cn:ccr:krb5:krb-slave
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| cn:ccr:krb5:krb-slave [2023/11/15 13:57] – [Kerberos] monducci@infn.it | cn:ccr:krb5:krb-slave [2024/07/08 15:53] (current) – enrico@infn.it | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| + | ====== Kerberos slave ====== | ||
| + | |||
| + | **EL9 (RockyLinux/ | ||
| + | |||
| + | |||
| + | Diasbilitato ipv6 | ||
| + | |||
| + | |||
| + | ===== Installazione pacchetti ===== | ||
| + | |||
| + | |||
| + | dnf install -y bind-utils | ||
| + | | ||
| + | dnf install -y fail2ban fail2ban-firewalld | ||
| + | | ||
| + | dnf install -y s-nail (mail-x è stato sostituito da s-nail) | ||
| + | |||
| + | ===== Data, ora e timezone ===== | ||
| + | |||
| + | timedatectl set-timezone Europe/ | ||
| + | |||
| + | ===== Configurazione servizio: chrony ===== | ||
| + | |||
| + | |||
| + | In / | ||
| + | |||
| + | server ntp-1.infn.it iburst | ||
| + | server ntp-2.infn.it iburst | ||
| + | server ntp-3.infn.it iburst | ||
| + | |||
| + | Far ripartire il servizio | ||
| + | |||
| + | systemctl restart chronyd.service | ||
| + | e controllare la configurazione | ||
| + | |||
| + | [root@krb ~]# chronyc sources | ||
| + | MS Name/IP address | ||
| + | =============================================================================== | ||
| + | ^- dns1.ge.infn.it | ||
| + | ^- dns2.ge.infn.it | ||
| + | ^* ntp.cnaf.infn.it | ||
| + | |||
| + | |||
| + | ===== Configurazione servizio: fail2ban | ||
| + | |||
| + | mv / | ||
| + | cp / | ||
| + | chcon -u system_u / | ||
| + | ll -Z / | ||
| + | |||
| + | Modificare / | ||
| + | e modificare banaction (commentare le IPTables e mettere firewalld) nel seguente modo: | ||
| + | |||
| + | [sshd] | ||
| + | # To use more aggressive sshd modes set filter parameter " | ||
| + | # normal (default), ddos, extra or aggressive (combines all). | ||
| + | # See " | ||
| + | #mode = normal | ||
| + | port = ssh | ||
| + | logpath = %(sshd_log)s | ||
| + | backend = %(sshd_backend)s | ||
| + | enabled = true | ||
| + | bantime = 30m | ||
| + | findtime = 10m | ||
| + | maxretry = 3 | ||
| + | |||
| + | ------- | ||
| + | [selinux-ssh] | ||
| + | | ||
| + | port = ssh | ||
| + | logpath | ||
| + | enabled = true | ||
| + | bantime = 30m | ||
| + | |||
| + | ---------- | ||
| + | |||
| + | # Default banning action (e.g. iptables, iptables-new, | ||
| + | # iptables-multiport, | ||
| + | # action_* variables. Can be overridden globally or per | ||
| + | # section within jail.local file | ||
| + | ## banaction = iptables-multiport | ||
| + | ## banaction_allports = iptables-allports | ||
| + | banaction = firewallcmd-rich-rules[actiontype=] | ||
| + | banaction_allports = firewallcmd-rich-rules[actiontype=] | ||
| + | |||
| + | Abilitare a fare partire il servizio fail2ban | ||
| + | |||
| + | systemctl enable fail2ban.service | ||
| + | systemctl start fail2ban.service | ||
| + | |||
| + | fail2ban-client status | ||
| + | | ||
| + | Status | ||
| + | |- Number of jail: 2 | ||
| + | `- Jail list: | ||
| + | |||
| + | Per vedere la lista di IP banditi | ||
| + | |||
| + | fail2ban-client banned | ||
| + | [{' | ||
| + | |||
| + | ===== Configurazione servizio: firewalld | ||
| + | |||
| + | firewall-cmd --permanent --zone=public --remove-service=dhcpv6-client | ||
| + | firewall-cmd --permanent --zone=public --remove-service=cockpit | ||
| + | |||
| + | firewall-cmd --permanent --zone=public --add-service=kerberos | ||
| + | firewall-cmd --permanent --zone=public --add-service=kprop | ||
| + | |||
| + | firewall-cmd --reload | ||
| + | |||
| + | Anche la configurazione del firewall per il servizio SSH deve essere modificata per accettare login solo da host certificati (non da tutta la LAN). \\ | ||
| + | Ovviamente la configurazione specifica dipende dalla struttura. \\ | ||
| + | Esempio | ||
| + | |||
| + | firewall-cmd --permanent --zone=public --add-rich-rule=' | ||
| + | | ||
| + | firewall-cmd --permanent --zone=public --remove-service=ssh | ||
| + | | ||
| + | systemctl restart firewalld.service | ||
| + | | ||
| + | Per vedere lo stato del firewall: | ||
| + | | ||
| + | firewall-cmd --list-all | ||
| + | |||
| + | ===== Configurazione mail ===== | ||
| + | Configurare postfix/ | ||
| + | |||
| + | |||
| + | |||
| + | ===== Kerberos ===== | ||
| + | |||
| + | === Installazione dei pacchetti === | ||
| + | |||
| + | |||
| + | dnf install -y krb5-libs krb5-server | ||
| + | |||
| + | |||
| + | === Configurazione === | ||
| + | |||
| + | if [ -e / | ||
| + | curl -o / | ||
| + | chcon -u system_u / | ||
| + | |||
| + | ll -lZ / | ||
| + | -rw-r--r--. 1 root root system_u: | ||
| + | -rw-r--r--. 1 root root system_u: | ||
| + | |||
| + | == Configurazione KDC == | ||
| + | |||
| + | Verificare i seguenti file: | ||
| + | / | ||
| + | / | ||
| + | |||
| + | |||
| + | ls -lZ / | ||
| + | -rw-------. 1 root root system_u: | ||
| + | |||
| + | ls -lZ / | ||
| + | -rw-------. 1 root root system_u: | ||
| + | |||
| + | Eseguire: | ||
| + | if [ -e / | ||
| + | | ||
| + | curl -o / | ||
| + | | ||
| + | chcon -u system_u / | ||
| + | | ||
| + | chmod 600 / | ||
| + | |||
| + | == Keytab == | ||
| + | |||
| + | Copiare il keytab dell' | ||
| + | |||
| + | chcon -u system_u / | ||
| + | [root@krb ~]# ll -Z / | ||
| + | -rw-------. 1 root root system_u: | ||
| + | |||
| + | == Master Key == | ||
| + | Farsi mandare la master key dai gestori del kerberos nazionale e copiarla in: | ||
| + | | ||
| + | / | ||
| + | chcon -u system_u / | ||
| + | |||
| + | NON far partire il servizio KDC fino a quando non si riceve il DB dal master (altrimenti il KDC prova a generarne uno iniziale). | ||
| + | |||
| + | == Configurazione di kprop.service == | ||
| + | A partire dalla RHEL9 xinetd non è più supportato e bisogna usare i servizi systemd. \\ | ||
| + | Esiste un servizio predisposto che è il kprop.service che fa riferimento al file / | ||
| + | per la definizione di parametri specifici da passare al kpropd | ||
| + | |||
| + | |||
| + | |||
| + | cat / | ||
| + | KPROPD_ARGS= -r INFN.IT -P 754 -a / | ||
| + | |||
| + | |||
| + | echo " | ||
| + | | ||
| + | chcon -u system_u / | ||
| + | | ||
| + | chmod 600 / | ||
| + | | ||
| + | systemctl enable --now kprop.service | ||
| + | Created symlink / | ||
| + | | ||
| + | systemctl status kprop.service | ||
| + | ● kprop.service - Kerberos 5 Propagation | ||
| + | | ||
| + | | ||
| + | Main PID: 1071 (kpropd) | ||
| + | Tasks: 1 (limit: 22958) | ||
| + | | ||
| + | CPU: 6min 53.622s | ||
| + | | ||
| + | | ||
| + | | ||
| + | Jun 08 10:24:32 krb kpropd[695441]: | ||
| + | Jun 08 10:24:35 krb kpropd[695443]: | ||
| + | Jun 08 10:24:38 krb kpropd[695445]: | ||
| + | Jun 08 10:24:41 krb kpropd[695447]: | ||
| + | Jun 08 10:24:44 krb kpropd[695449]: | ||
| + | Jun 08 10:24:47 krb kpropd[695451]: | ||
| + | Jun 08 10:24:50 krb kpropd[695453]: | ||
| + | Jun 08 10:24:53 krb kpropd[695455]: | ||
| + | Jun 08 10:24:57 krb kpropd[695457]: | ||
| + | Jun 08 10:25:00 krb kpropd[695459]: | ||
| + | |||
| + | |||
| + | Avvisare gli amministratori di Kerberos inviando una mail a k5-admin@lists.infn.it | ||
| + | |||
| + | Una volta configurata la propagazione dal Master e ricevuto il DB dei principal | ||
| + | |||
| + | # ls -laZ / | ||
| + | -rw-------. 1 root root system_u: | ||
| + | -rw-------. 1 root root system_u: | ||
| + | -rw-------. 1 root root system_u: | ||
| + | -rw-------. 1 root root system_u: | ||
| + | |||
| + | far partire il KDC | ||
| + | |||
| + | |||
| + | systemctl enable --now krb5kdc.service | ||
| + | Created symlink / | ||
| + | |||
| + | Verificare lo stato del servizio | ||
| + | systemctl status krb5kdc.service | ||
| + | |||
| + | ===== Servizi attivi ===== | ||
| + | |||
| + | |||
| + | * postfix/ | ||
| + | |||
| + | * firewalld | ||
| + | * fail2ban | ||
| + | |||
| + | * kprop | ||
| + | * krb5kdc | ||
| + | |||
| + | |||
| + | |||
