Best practices per “alzare” un nuovo server …
SSH
/etc/ssh/sshd_configUseDNS no
Protocol 2
PermitRootLogin no
YUM
yum -y update
rpm –import http://dag.wieers.com/rpm/packages/RPM-GPG-KEY.dag.txt
rpm -Uvh http://packages.sw.be/rpmforge-release/rpmforge-release-0.5.1-1.el5.rf.i386.rpm
yum install fetchmail wget bzip2 unzip zip nmap openssl lynx fileutils ncftp gcc gcc-c++ system* quota bind-chroot mysql mysql-devel mysql-server cyrus-sasl cyrus-sasl-devel cyrus-sasl-gssapi cyrus-sasl-md5 cyrus-sasl-plain postfix dovecot php php-devel php-gd php-imap php-ldap php-mysql php-odbc php-pear php-xml php-xmlrpc curl curl-devel perl-libwww-perl ImageMagick libxml2 libxml2-devel webalizer ntp perl-HTML-Parser perl-DBI perl-Net-DNS perl-Digest-SHA1 rpm* postgrey kernel-headers kernel-devel smbldap* alpine
updatedb
makewhatis
INITTAB
/etc/inittabmodificare il parametro da: “id:5:initdefault:”
a: “id:3:initdefault:”
File HOSTS
/etc/hostsModificare il file da …
127.0.0.1 pdc.server.it pdc localhost.localdomain localhost
::1 localhost6.localdomain6 localhost6a …
127.0.0.1 localhost.localdomain localhost
(INDIRIZZO_IP_SERVER) pdc.server.it pdc
/etc/sysctl.conf
Aggiungere al file:
# Enable TCP SYN Cookie Protection
net.ipv4.tcp_syncookies = 1
# Disable ICMP Redirect Acceptance
net.ipv4.conf.all.accept_redirects = 0
# Enable IP spoofing protection, turn on source route verification
net.ipv4.conf.all.rp_filter = 1
# Enable ignoring broadcasts request
net.ipv4.icmp_echo_ignore_broadcasts = 1
# Enable bad error message Protection
net.ipv4.icmp_ignore_bogus_error_responses = 1
# Log Spoofed Packets, Source Routed Packets, Redirect Packets
net.ipv4.conf.all.log_martians = 1
# increase TCP max buffer size setable using setsockopt()
net.core.rmem_max = 40500000
net.core.wmem_max = 40500000
# increase Linux autotuning TCP buffer limits
# min, default, and max number of bytes to use
# set max to at least 4MB, or higher if you use very high BDP paths
net.ipv4.tcp_rmem = 4096 87380 40500000
net.ipv4.tcp_wmem = 4096 65536 40500000
# don’t cache ssthresh from previous connection
net.ipv4.tcp_no_metrics_save = 1
net.ipv4.tcp_moderate_rcvbuf = 1
# recommended to increase this for 1000 BT or higher
net.core.netdev_max_backlog = 2500
# for 10 GigE, use this
# net.core.netdev_max_backlog = 30000net.ipv4.conf.all.send_redirects = 0
net.ipv4.conf.default.send_redirects = 0
net.ipv4.tcp_max_syn_backlog = 1280
net.ipv4.conf.all.accept_source_route = 0
net.ipv4.conf.all.secure_redirects = 0
net.ipv4.conf.default.accept_redirects = 0
net.ipv4.conf.default.secure_redirects = 0
net.ipv4.tcp_timestamps = 0
yum install chkrootkit rkhunter
rkhunter –update
rkhunter -c
chkrootkit
AGGIORNAMENTI AUTOMATICI DI SISTEMA
Digitare: crontab -e ed inserire
07 00 * * * /usr/bin/yum -y updateNel caso di aggiornamento di macchina virtuale con installati i VMware Tools …
07 00 * * * /usr/bin/yum -y update –exclude=*kernel*
Stoppare i servizi “inutili”
chkconfig anacron off
chkconfig atd off
chkconfig auditd off
chkconfig cpuspeed off
chkconfig kudzu off
chkconfig netfs off
chkconfig ip6tables off
chkconfig smartd off
chkconfig pcscd off
chkconfig cups off
chkconfig mcstrans off
chkconfig nfslock off
chkconfig rpcgssd off
chkconfig rpcidmapd off
chkconfig portmap off
chkconfig nfs off
Gestione del firewall …
wget ftp://ftp.pbone.net/mirror/ftp.falsehope.net/home/tengel/centos/4/te/i386/RPMS/portsentry-1.2-1.te.i386.rpm
rpm -Uvh portsentry-1.2-1.te.i386.rpm
chkconfig portsentry onvi /etc/portsentry/portsentry.conf
# Default TCP ident and NetBIOS service
ADVANCED_EXCLUDE_TCP=”21,22,25,53,80,110,113,135,137,138,139,443,445″
# Default UDP route (RIP), NetBIOS, bootp broadcasts.
ADVANCED_EXCLUDE_UDP=”520,517,518,513,138,137,123,68,67,53″scommentare:
#KILL_RUN_CMD=”/bin/mail -s ‘Portscan from $TARGET$ on port $PORT$’ user@host < /dev/null"
Skel
Quando viene creata la home directory di un nuovo utente, viene inizializzata con i file dalla directory /etc/skel.
L’amministratore di sistema può creare dei file in /etc/skel che daranno un ambiente di default per gli utenti.
Ad esempio può creare un file /etc/skel/.profile che imposta la variabile d’ambiente EDITOR ad un editor facile da usare.Comunque di solito è meglio provare a tenere /etc/skel il più piccolo possibile, perché sarebbe poi quasi impossibile aggiornare i file degli utenti esistenti. Ad esempio, se cambia il nome dell’editor, tutti gli utenti esistenti dovrebbero modificare il proprio .profile . L’amministratore di sistema può provare a farlo automaticamente, con uno script, ma è quasi certo che danneggerebbe il file di qualcuno.
Quando possibile è meglio mettere le configurazioni globali nei file globali, come /etc/profile . In questo modo è possibile aggiornarlo senza rovinare i setup personali degli utenti.
cd /etc/skel
mkdir -p /etc/skel/Maildir/new
mkdir -p /etc/skel/Maildir/cur
mkdir -p /etc/skel/Maildir/tmp
segnalo due ottimi manuali, in inglese ovviamente, sull’argomento LDAP
http://www.linuxteam.info/blog/deploying-openldap