/etc/login.defs aggiungere
PASS_MIN_LEN da 5 a 8
/etc/profile ~/.profile aggiungere
TMOUT=7200
/etc/exports deve contenere
/dir/to/export
host1.mydomain.com(ro,root_squash)
poi
/usr/sbin/exportfs -a
(se installato xserver)
rm -f
/etc/security/console.apps/halt
rm -f
/etc/security/console.apps/poweroff
rm -f
/etc/security/console.apps/shutdown
rm -f
/etc/security/console.apps/xserver
da rileggere e verificare
disabilitare i servizi dal file /etc/inetd.conf
### ftp telnet shell login exec talk ntalk imap pop-2 pop-3 finger auth
occhio ad eliminare linuxconf
chmod 600 /etc/inetd.conf
chown root.root /etc/inetd.conf
stat /etc/inetd.conf
killall -HUP inetd
chattr +i /etc/inetd.conf
contenuto di /etc/hosts.deny
# access is denied by default
# deny access to everyone
ALL:ALL, PARANOID #matches any hosts whose name does not match its
address
contenuto di /etc/hosts.allow:
sshd: 192.168.195.1 roberto
tcpdchk
aggiungere -h alla linea di telnet nel file /etc/inetd
telnet stream tcp nowait root /usr/sbintcpd in.telnetd.-h
modificare il file /etc/host.conf aggiungendo
#Lookup names via DNS first then fall back to /etc/hosts
order bind,hosts
#We have machines with multiple IP addresses
multi on
#Check for IP address spoofing
nospoof on
chattr +i /etc/services
Indicare nel file /etc/securetty solo i devices dov'e' ammesso login di root (es. solo tty1), #disabilitare le altre linee
userdel adm
userdel lp
userdel sync
userdel shutdown
userdel halt
userdel news
userdel uucp
userdel operator
userdel games # se non usi xwindow
userdel gopher
userdel ftp # per ftp anonimo
groupdel adm
groupdel lp
groupdel news
groupdel uucp
groupdel games # se non usi xwindow
groupdel dip
groupdel pppusers
groupdel popusers # se non usi pop server per l'email
groupdel slipusers
magari spostare i chattr+i tutti insieme alla fine
chattr +i /etc/passwd
chattr +i /etc/shadow
chattr +i /etc/group
chattr +i /etc/gshadow
(da verificare e provare bene pag. 52)
Modificare nel file /etc/security/limits.conf
hard core 0
hard rss 5000
hard nproc 20
aggiungere la linea seguente al file /etc/pam.login
session required /lib.security/pam_limits.so
prima della penultima linea, quella "# session optional /lib/security/pam_console.so"
nel file /etc/fstab
aggiungere a defaults anche ,rw,nosuid,nodev ed eventualmente anche ,noexec (es. per la partizione dov'e' montato /tmp)
flags: defaults noquota nosuid nodev noexec quota ro rw suid
spostandolo su un floppy disk oppure rendere disponibile il file solo a root
chmod 700 /bin/rpm
nel file /etc/profile cambiare testo in:
HISTFILESIZE=20
HISTSIZE=20
e sistemare anche la riga con EXPORT
per i nuovi utenti il file template e' /etc/skel/.bash_logout
inserire la linea:
rm -f $HOME/.bash_history
per gli utenti gia' esistenti modificare il file ~/.bash_logout
aggiungere nel file /etc/lilo.conf
timeout=00
restricted
password={password}
ed eseguire poi
chmod 600 /etc/lilo.conf
/sbin/lilo -v
chattr +i /etc/lilo.conf
su stampante o su un'altra macchina in rete
i files in /etc/rc.d/init.d
chmod -R 700 /etc/rc.d/init.d/
find / -type f \( -perm 04000 -o -perm -02000 \) \-exec ls -lg {} \;
Eliminare bit SUID dai seguenti programmi:
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/write
chmod a-s /usr/sbin/usernetctl
chmod a-s /usr/sbin/traceroute
chmod a-s /bin/mount
chmod a-s /bin/umount
chmod a-s /bin/ping
chmod a-s /sbin/netreport
Parametri del kernel
aggiungere nel file /etc/sysctl.conf
### non risponde a ping request
net.ipv4.icmp_echo_ignore_all = 1
### non risponde a ping broadcast
net.ipv4.icmp_echo_broacasts = 1
### disab source routing ip
net.ipv4.conf.all.accept_source_route = 0
### abilita protez da tcp syn cookie
### (config_syn_cookies = Y compilaz kernel)
net.ipv4.tcp_syncookies = 1
### disab ICMP redirect accept
net.ipv4.conf.all.accept_redirects = 0
### abil protez da always-defrag
net.ipv4.ip_always_defrag = 1
### disab msg errore in rete
net.ipv4.icmp_bogus_error_responses = 1
### protez ip spoofing
net.ipv4.conf.all.rp_filter = 1
### log pacchetti spoofed,source routed, redirect
net.ipv4.conf.all.log_martians
poi riavviare: /etc/rc.d/init/network restart
Cerca files strani:
punto_punto_spazio, punto
find / -name ".. " -print -xdev
find / -name ".*" -print -xdev
files ancora con sgid/suid attivato
find / type f \( -perm 04000 -o -perm 02000 \) \-exec ls lg {} \;
gruppi e dir scrivibili da tutti
find / -type f \( -perm -2 -o -perm -20 \) -exec ls -lg {} \;
find / -type d \( -perm -2 -o -perm -20 \) -exec ls -ldg {} \;
files senza proprietario:
find / -nouser -o -nogroup
files .rhost
find / -name .rhosts
segnalazione via mail in automatico:
creare il file /etc/cron.daily/find_rhosts_files contenente
#!/usr/bin/find /home -name .rhosts | (cat <<EOF
Elenco dei files .rhosts trovati in /home
EOF
cat )| /bin/mail -s "Elenco files .rhosts rilevato"