la prima (eth0) è collegata al modem e lasciamo che si assegni un IP via DHCP
dhclient eth0
sulla seconda (eth1) faremo la nostra rete interna sull'indirizzo 192.168.0.1
ipmasq
apt-get install ipmasq ipmasq stop ifconfig eth1 up ifconfig eth1 192.168.0.1 netmask 255.255.255.0 ipmasq startinterfacce di rete
per avere eth1 enabled at startup
edita /etc/network/interfaces ed aggiungi eth1 statico
esempio /etc/network/interfaces:
auto lo iface lo inet loopback auto eth0 iface eth0 inet dhcp auto eth1 iface eth1 inet static address 192.168.0.1 netmask 255.255.255.0in /etc/hosts puoi indicare gli altri computers della rete
192.168.0.2 caronte
indirizzo dinamico
apri un account con dyndns
setup un dynamic address
usa ddclient per automatizzarlo
esempio /etc/ddclient.conf:
pid=/var/run/ddclient.pid protocol=dyndns2 use=if, if=eth0 server=members.dyndns.org login=iltuologin password=latuapassword mail=iltuouser macchina.quelchele.orgsetup client machines
ifconfig eth0 192.168.0.2 broadcast 192.168.0.255 netmask 255.255.255.0 up route add default gw 192.168.0.1 eth0e metti nameserver in /etc/resolv.conf
rendi tutto valido all'avvio:
aggiungi in /etc/network/interfaces
auto eth0 iface eth0 inet static address 192.168.0.2 network 192.168.0.0 netmask 255.255.255.0 broadcast 192.168.0.255 gateway 192.168.0.1 dns-nameservers 1.253.128.10aggiungi in /etc/hosts il tuo network
192.168.0.2 macchina1 192.168.0.3 macchina2fstab
i settaggi del disco di storage o della chiavetta usb
esempio in /etc/fstab:
/dev/hdd1 /share auto nouser,auto,nosuid,noexec 0 0 /dev/sda1 /mnt/usbd vfat user,noauto 0 0nfs-shares
esempio /etc/exports:
/share 192.168.0.0/255.255.255.0(ro,insecure)
esempio /etc/hosts.deny
portmap: ALL amandad: ALL mountd: ALL lockd: ALL rquatad: ALL statd: ALLesempio /etc/hosts.allow
portmap: 192.168.0.0/255.255.255.0 amandad: 192.168.0.0/255.255.255.0 mountd: 192.168.0.0/255.255.255.0 lockd: 192.168.0.0/255.255.255.0 rquatad: 192.168.0.0/255.255.255.0 statd: 192.168.0.0/255.255.255.0dare accesso in sftp
adduser utente apt-get install rsshdare in /etc/passwd /usr/bin/rssh all'utente di cui si vuole limitare l'accesso
user:x:666:666::/share:/usr/bin/rsshedita /etc/rssh in modo che offra solo sftp e scp
un minimo di sicurezza
edita /etc/ssh/sshd_config
PermitRootLogin No
mount l'home filesystem with the noexec option
chmod -x ai binari che non vuoi fare eseguire dagli utenti o allo startup
riduci al minimo gli eseguibili con suid e sgid root
cd ~/ find / -perm +4000 > suids && find / -perm +2000 > sgids ls -ld `cat suids` ls -ld `cat sgids`ci basta avere su come SUID
chown root `cat suids` ; chmod 750 `cat suids`ora crea il gruppo su e limitane l'accesso
groupadd su chown root.su /bin/su chmod 4750 /bin/suora aggiungi te stesso al gruppo su
adduser myusername suedita /etc/security/limits.conf
regulary, run
apt-get update ; apt-get upgrade
generici comandi utili
cancella i .DS_Store che lascia il macosx:
find . -name ".DS_Store" -exec rm \{} \;
sistema i permessi dei files in una directory
find /share -type f -exec chmod 644 {} \;
sistema i permessi delle directory in una directory
find /share -type d -exec chmod 755 {} \;
riavvia sshd
/etc/init.d/ssh reload /etc/init.d/ssh restartlogwatch riporta
logwatch --range all --detail high --print --archives | less
netstat -an lsof | grep TCP lsof | grep UDP telnet localhost 25links