====== Opensuse hardening ====== Autore: **//Calogero Bonasia//** [[http://www.linuxteam.it/|www.linuxteam.it]] \\ Ultima revisione: **//29 dicembre 2008//** \\ \\ ===== Brevi indicazioni per effettuare l'hardening di un server openSUSE ===== ==== Nel BIOS ==== * impostare come prima unità di avvio il disco fisso * disabilitare il floppy disk e il CD * impostare una password di BIOS * disabilitare il boot da usb o da PXE * disabilitare l'accesso da consolle seriale se previsto ==== LILO e GRUB ==== È possibile impedire all'utente di eseguire modifiche al kernel per LILO aggiungere in /etc/lilo.conf, prima della definizione delle immagini, le righe: restricted password=unapassword Per GRUB in /boot/grub/grub.conf la riga password = unapassword ed evitare che i due file siano leggibili da tutti gli utenti chmod 600 /etc/lilo.conf Impostare una password di root per il single user in /etc/inittab ~~:S:wait:/sbin/sulogin ==== Passiamo al SUID ==== Nei sistemi UNIX-like, le applicazioni vengono eseguite con i privilegi dell'utente che le lancia, tranne nel caso in cui siano state impostate "SUID". In quest'ultimo caso, vengono eseguite con i privilegi del loro owner. Quindi una applicazione SUID root viene eseguita con i privilegi di root. Questo significa che eventuali problemi di sicurezza avranno un impatto molto più alto. Per vedere i comandi con SUID attivo find / \( ! -fstype nfs \) -type f \( -perm -04000 -o -perm -02000 \) -exec ls -l {} \; Modificare quindi chmod a-s /usr/bin/chage chmod a-s /usr/bin/gpasswd chmod a-s /usr/bin/wall chmod a-s /usr/bin/chfn chmod a-s /usr/bin/chsh chmod a-s /usr/bin/newgrp chmod a-s /usr/bin/at chmod a-s /usr/bin/gpg chmod a-s /usr/bin/man chmod a-s /usr/bin/rcp chmod a-s /usr/bin/rsh chmod a-s /usr/bin/crontab chmod a-s /usr/sbin/postdrop chmod a-s /usr/sbin/postqueue chmod a-s /usr/sbin/utempter chmod a-s /usr/bin/passwd chmod a-s /usr/bin/write chmod a-s /bin/ping chmod a-s /bin/ping6 chmod a-s /bin/mount chmod a-s /bin/eject chmod a-s /bin/umount chmod a-s /usr/bin/expiry chmod a-s /usr/lib/pt_chown chmod a-s /usr/bin/rlogin chmod a-s /sbin/unix_chkpwd chmod a-s /sbin/unix2_chkpwd Disabilitare chmod 0 /usr/bin/rcp chmod 0 /usr/bin/rlogin chmod 0 /usr/bin/rsh find /home -name .rhosts -exec rm -i {} \; chmod 0 /usr/bin/telnet rpm -e telnet-server chmod 0 /usr/bin/ftp ==== Rinforzare SSH ==== Aprire il file ''/etc/ssh/sshd_config'' e individuare la riga Protocol = 2,1 e decommentarla, commentare X11Forwarding yes e fare la stessa cosa sul file /etc/ssh/ssh_config. Individuare la riga Protocol = 2,1 e decommentarla, commentare ForwardX11Trusted yes. Dare: rcsshd restart ==== Disabilitare Control + Alt + Canc ==== Commentare in /etc/inittab a::ctrlaltdel:/sbin/shutdown -t3 -r now ==== Scadenza delle password ==== Impostare la scadenza della password per gli utenti in /etc/login.defs PASS_MAX_DAYS 180 PASS_WARN_AGE 14 Per gli utenti già creati, impostare come segue: chage -l $utente chage -M 180 -W 14 $utente ==== Limitare i Denial Of Service ==== Per limitare i Denial Of Service, modificare il numero di CoreDump e il numero di processi a disposizione di ciascun utente in /etc/security/limits.conf hard core 0 soft nproc 200 hard nproc 250 ==== Disabilitare IPv6 ==== echo "alias net-pf-10 off" >> /etc/modprobe.conf echo "alias ipv6 off" >> /etc/modprobe.conf infine riavviare il sistema.