úterý 2. února 2021

iscsi target/initiator centos8/fedora33

 target (server): centos 8


dnf install targetcli

targetcli

/backstores/block create isdd /dev/sdd
cd /iscsi
create iqn.2001-04.com.linux:issd:lc-node1

cd iqn.2001-04.com.linux:issd:lc-node1/tpg1/luns
create /backstores/block/isdd

cd ../acls
create iqn.2001-04.com.linux:issd:lc-node1

cd ../portals  # pokud je potreba - lepe omezit firewallem
 delete 0.0.0.0 3260
 create 172.25.... 3260  #(lokalni IP - "listen to")

exit

firewall-cmd --zone=dmz --permanent --add-port=3260/tcp
firewall-cmd --reload

systemctl restart target
#systemctl restart iscsid #tohle asi neni potreba
#systemctl restart iscsi. # tohle asi neni potreba

#test
ss -napt |grep 3260

initiator: fedora33
----------
klient:
vim /etc/iscsi/iscsid.conf #zde nastavit prihlsovani pres CHAP, jmeno a heslo (neni nutne, neni nstaveno na serveru)
vim /etc/iscsi/initiatorname.iscsi #zde nastavit InitiatorName:
    InitiatorName=iqn.2001-04.com.linux:issd:lc-node1

systemctl restart iscsi
systemctl restart iscsid

iscsiadm -m discovery -t sendtargets -p 192.168.206.34
iscsiadm --mode node --targetname iqn.2001-04.com.linux:issd:lc-node1  --login

--------------------------------

zdroje:

https://www.root.cz/clanky/cluster-na-linuxu-sdilene-uloziste-pomoci-iscsi-a-multipathingu/

 https://www.thegeekdiary.com/how-to-configure-iscsi-target-and-initiator-using-targetcli-in-centos-rhel-7/

 

(stary pristup pomoci tgt-admin: http://linux-training.be/storage/ch13.html )



úterý 19. listopadu 2019

SMTP server - send email via telnet

To send e-mail via telnet (and test the smtp server setup):

telnet smtp.example.com 25 

helo smtp.example.com
mail from:<user@example.com>
rcpt to:<user2@customer.com>
data
From: test@mydomain.com
Subject: test mail from command line

this is test number 1
sent from linux box
.
quit

For starttls:

 ehlo smtp.example.com

středa 24. července 2019

flooded /var/log/messages by "slice" messages


flooded /var/log/messages by "slice" messages

Thanks to: https://www.golinuxhub.com/2017/12/how-to-redirect-specific-log-messages.html

Create separate configuration file inside /etc/rsyslog.d
 # touch /etc/rsyslog.d/rsyslog_loginauth.conf

# vim /etc/rsyslog.d/rsyslog_loginauth.conf
if $programname == "systemd" and ($msg contains "Starting Session" or $msg contains "Started Session" or $msg contains "Created slice" or $msg contains "Starting user-") then /var/log/login_auth
& stop

Next restart the rsyslog service
# systemctl restart rsyslog
The log messages will be redirected to /var/log/login_auth .

For rotation of the new log file: add to the top of  /etc/logrortate.d/syslog
# vim /etc/logrotate.d/syslog

/var/log/cron
/var/log/maillog
/var/log/messages
/var/log/secure
/var/log/spooler
/var/log/login_auth
{ ...

úterý 18. června 2019

auditing for samba

Auditing for samba -  the procedure follows guide available here: http://a32.me/2009/10/samba-audit-trail/

Adapt the /etc/samba/smb.conf :

[global]
# Audit settings
        full_audit:prefix = %u|%I|%S
        full_audit:failure = connect
        full_audit:success = connect disconnect opendir mkdir rmdir closedir open close read pread write pwrite sendfile rename unlink chmod fchmod chown fchown chdir ftruncate lock symlink readlink link mknod realpath
        full_audit:facility = local5
        full_audit:priority = notice

then for each share:

[samba]
        ...
        vfs objects = full_audit

and restart the samba daemon

systemctl restart smb

The logged information is going to be stored using syslog. For Centos this regards rsyslog, /etc/rsyslog.d/smb-audit.conf :

local5.notice /var/log/samba/audit.log 
& ~

or, for newer rsyslog installations

local5.notice /var/log/samba/audit.log 
& stop

and restart rsyslog daemon

systemctl restart rsyslog

Finally, the logfile rotation in /etc/logrotate.d/samba is already active for all files in /var/log/samba/*

/var/log/samba/* {
    notifempty
    olddir /var/log/samba/old
    missingok
    sharedscripts
    copytruncate
    compress
}

Logrotate is run automatically by cron, no restart is necessary.

čtvrtek 13. prosince 2018

failed array in LVM

unmount fs:
]# umount /data

check size of the failed array
]# cat /proc/mdstat
md127 : active raid1 sdi1[3]
      3906886464 blocks super 1.2 [2/1] [_U]
      bitmap: 30/30 pages [120KB], 65536KB chunk

size in gigabytes:
 $((3906886464/1024/1024)) = 3725(G)

check filesystem and reduce the LV
]# e2fsck -f /dev/mapper/titdata1-data1
]# lvreduce --resizefs -L -3800G /dev/mapper/titdata1-data1

reduce CG :
]#  vgreduce titdata1 /dev/md127
   --- failed, because the array was originally /dev/md1 (this is also specified in /etc/mdadm.conf)

]# ln /dev/md127 /dev/md1

free /dev/md1 in VG
]# pvmove /dev/md1
]# vgreduce titdata1 /dev/md1
]# lvextend -l +100%FREE /dev/mapper/titdata1-data1
]# resize2fs /dev/mapper/titdata1-data1
]# e2fsck -f /dev/mapper/titdata1-data1

úterý 11. prosince 2018

Samba - downgrade in Centos

After update to CentOS Linux release 7.6.1810 (Core) the Samba package stopped working.

Selective donwgrade of samba:

download from:
http://mirror.centos.org/centos/7.5.1804/updates/x86_64/Packages/
following packages:

libipa_hbac-1.16.0-19.el7_5.8.x86_64.rpm
libsmbclient-4.7.1-9.el7_5.x86_64.rpm
libsss_autofs-1.16.0-19.el7_5.8.x86_64.rpm
libsss_certmap-1.16.0-19.el7_5.8.x86_64.rpm
libsss_idmap-1.16.0-19.el7_5.8.x86_64.rpm
libsss_nss_idmap-1.16.0-19.el7_5.8.x86_64.rpm
libsss_sudo-1.16.0-19.el7_5.8.x86_64.rpm
libwbclient-4.7.1-9.el7_5.x86_64.rpm
python-sssdconfig-1.16.0-19.el7_5.8.noarch.rpm
samba-4.7.1-9.el7_5.x86_64.rpm
samba-client-4.7.1-9.el7_5.x86_64.rpm
samba-client-libs-4.7.1-9.el7_5.x86_64.rpm
samba-common-4.7.1-9.el7_5.noarch.rpm
samba-common-libs-4.7.1-9.el7_5.x86_64.rpm
samba-common-tools-4.7.1-9.el7_5.x86_64.rpm
samba-dc-4.7.1-9.el7_5.x86_64.rpm
samba-devel-4.7.1-9.el7_5.x86_64.rpm
samba-libs-4.7.1-9.el7_5.x86_64.rpm
sssd-1.16.0-19.el7_5.8.x86_64.rpm
sssd-ad-1.16.0-19.el7_5.8.x86_64.rpm
sssd-client-1.16.0-19.el7_5.8.x86_64.rpm
sssd-common-1.16.0-19.el7_5.8.x86_64.rpm
sssd-common-pac-1.16.0-19.el7_5.8.x86_64.rpm
sssd-ipa-1.16.0-19.el7_5.8.x86_64.rpm
sssd-krb5-1.16.0-19.el7_5.8.x86_64.rpm
sssd-krb5-common-1.16.0-19.el7_5.8.x86_64.rpm
sssd-ldap-1.16.0-19.el7_5.8.x86_64.rpm
sssd-proxy-1.16.0-19.el7_5.8.x86_64.rpm

to new folder, then:
yum downgrade *
systemctl restart nmb
systemctl restart smb

pondělí 28. srpna 2017

problem with the owncloud client after system update

The updated client fails to load:

owncloud: error while loading shared libraries: libqt5keychain.so.1: 
cannot open shared object file: No such file or directory

The client is installed from the obvious repo server: isv:ownCloud:desktop


The library in question is available as
(newer)
opt-libqt5keychain1-0.7.0-9.4.x86_64
from isv_ownCloud_desktop
and (older)
qtkeychain-qt5-0.7.0-1.el7.x86_64
from epel.

The CentOS 7 version of owncloud client is compiled against the epel version of qt5. This, it is necessary to drive the yum to install the epel version of the
libqt5keychain1
package:


yum remove opt-libqt5keychain1-0.7.0-9.4.x86_64
yum --disablerepo=isv_ownCloud_desktop install qtkeychain-qt5-0.7.0-1.el7.x86_64

yum install owncloud-client



Now, the complete owncloud client is installed from the epel  repository