![[Alcatel logo]](/local-icons/alcatel.gif)
Unix DMZ hardening procedure
revised
This is a loose document of things to do to harden the Solaris/Unix
system for use in the DMZ. There is a LOT that needs doing, at some
point I would hope to be able to turn this into a script..... uh-huh...
More to the point, some portions of this document can be
applied to the DMZ target via 'cut and paste'; while other steps
are really a top level description of what needs to be fixed (and
thus need some external intelligence to drive the action). Note: that
SUN provides a tool that will automate this via the
Solaris Security Toolkit (JASS),
this tool has a very high overhead both in learning and configuration.
Since this is going to be a cookbook for Alcatel IND, I'm including all
of the stuff that we do on a box in the DMZ, things like routing, cshrc
mods, legatto.....
Also NOTE: this stuff must be done prior to placing the box into a
live Internet, and you should get complete ufsdump tapes of the
whole box just before placing it into the DMZ..... (A ufsdump tape can
be restored from a single user cdrom loaded kernel, unlike a Legatto or
Veritas tape)
A few different areas to deal with:
- System Installation (Install Solaris 7 or greater!)
- Select a User workstaion install
- Use the following _minimums_ for partition sizing:
- 0 / 128 Mbytes
- 1 swap 2048 MBytes
- 3 /var 512 MBytes
- 5 /opt 512 MBytes
- 6 /usr 1024 MBytes
- 7 /export/home Remaining disk
(This slice map would be for a single disk install - YMMV)
- Install latest MU
- Install latest recomended patches (for
Solaris 2.5.1,
Solaris 2.6,
Solaris 7,
Solaris 8,
Solaris 9)
- Install latest security (see SunSolve)
- Install OS specifics:
- Solaris 2.5.1
- Solaris 2.6
- Solaris 7
- Solaris 8
- Install platform specifics:
- Netra T1/105
- Install the following local packages:
-
TCP wrappers
-
PRNGD entropy generator.
-
OpenSSH tools.
- For DNS servers install latest BIND
(chroot'd)
- For Mail gateway boxes install the latest Sendmail
or Juniper smtpd (chroot'd)
- Remove the following packages
- pkgrm SUNWpcelx SUNWpcmci SUNWpcmcu SUNWpcmem
SUNWpcser SUNWpsdpr
- pkgrm SUNWpcelxx SUNWpcmcx SUNWpcmemx SUNWpsdprx SUNWpcserx
- pkgrm SUNWnisr SUNWnisu
- pkgrm SUNWypu SUNWypr
- pkgrm SUNWatfsr SUNWatfsu
- pkgrm SUNWadmfw (needed for showrev)
- pkgrm SUNWinst
- pkgrm SUNWluu SUNWlur
- pkgrm SUNWbnur SUNWbnuu
- pkgrm SUNWkcspf SUNWkcsrl SUNWkcspx SUNWkcspg SUNWkcsrt
- pkgrm SUNWmipu SUNWmipr
- pkgrm SUNWsacom SUNWsadmi SUNWsadmx SUNWsasnm SUNWsasnx
SUNWmibii
- pkgrm SUNWsndmr SUNWsndmu
- pkgrm SUNWsshdu SUNWsshdr SUNWsshcu SUNWsshr SUNWsshu
- Initial system setup (from console)
- setup csh as root shell in /etc/passwd and
move root's home to /root
- create root's home directory /root
- setup root-mo and root-th accounts, also with home in /root
- set terminal console terminal type to vt100 in /etc/inittab
- setup temporary default router
- modify /etc/default/login to allow root login on ptys,
and set UMASK to 077
- General file and permission stuff - The goal here is to setup
a resonably safe root login environment and then to lock the
configuration files down so that changes are a little harder to make.
By moving root's home directory we will keep root's files out of /.
This will keep / a little cleaner and perhaps keep folks from poking
around root's files.
- close up trusts
- mkdir /root
- chmod 700 /root
- cd /root
- touch .rhosts .forward .profile .kshrc .netrc
- chmod 0 .rhosts .forward .profile .kshrc .netrc
- chown root:sys .rhosts .forward .profile .kshrc .netrc
- cd /
- touch .cshrc .logout .login .rhosts .forward
.profile .kshrc .netrc .exrc
- chmod 0 .cshrc .logout .login .rhosts .forward
.profile .kshrc .netrc .exrc
- chown root:sys .cshrc .logout .login .rhosts .forward
.profile .kshrc .netrc .exrc
- rm /etc/hosts.equiv
- touch /etc/hosts.equiv
- chmod 0 /etc/hosts.equiv
- chown root:sys /etc/hosts.equiv
- touch /.cpr_config
- chmod 0 /.cpr_config
- chown root:sys /.cpr_config
- chmod 0 /etc/dfs/dfstab
- chown root:sys /etc/dfs/dfstab
- set directory/file perms /etc /var/mail via
- chmod -R g-w /etc
- chmod +t /var/mail
- Close up utmp and utmpx
- chmod 644 /var/adm/utmp*
- Protect global login profile
- chmod 600 /etc/.login
- ex/vi - holes
- touch /root/.exrc
- chmod 0 /root/.exrc
- chown root:sys /root/.exrc
- "set noexrc" and "set nomodelines"
in EXINIT env var (in cshrc)
- Configure logging
- touch /var/adm/sulog
- chmod 600 /var/adm/sulog
- chown root:sys /var/adm/sulog
- touch /var/adm/loginlog
- chmod 600 /var/adm/loginlog
- chown root:sys /var/adm/loginlog
- touch /var/log/tripwire
- chown root:sys /var/log/tripwire
- chmod 600 /var/log/tripwire
- touch /var/log/authlog
- chown root:sys /var/log/authlog
- chmod 600 /var/log/authlog
- rm -rf /var/tmp
- ln -s /tmp /var/tmp
- Kill routed/rdisc
- touch /etc/notrouter
- mv /usr/sbin/in.rdisc /usr/sbin/in.rdisc.disabled
- chmod 444 /usr/sbin/in.rdisc.disabled
- echo "Norip le0" > /etc/gateways
- echo "Norip hme0" >> /etc/gateways
- echo "Norip hme1" >> /etc/gateways
- echo "Norip dmfe0" >> /etc/gateways
- echo "Norip dmfe1" >> /etc/gateways
- Close up 'su'
- chmod o-rwx /usr/bin/su
- chmod o-rwx /usr/sbin/su
- chmod o-rwx /sbin/su.static
- chgrp sys /usr/bin/su
- chgrp sys /usr/sbin/su
- chgrp sys /sbin/su.static
- Remove promicous things
- rm /usr/sbin/snoop
- File permissions
- chmod go-w /var/saf/_log
- chmod go-w /var/mail/:saved
- chmod go-w /dev/kstat
- chmod go-w /dev/ksyms
- chmod go-w /dev/conslog
- Some CERT/wiretap file fixes - fixes some stoopid file permissions
- chmod u-s /usr/lib/fs/ufs/ufsrestore
- chmod u-s /usr/sbin/pgxconfig
- chmod 0 /usr/openwin/bin/Xsun
- chmod 0 /usr/sbin/sadmind
- chmod 0 /usr/lib/dmi/snmpXdmid
- cd /usr/lib/fs/ufs
- chmod -s quota ufsdump
- cd /usr/bin
- chmod -s write at atq atrm crontab eject newgrp
fdformat yppasswd tip uptime admintool chkey
cancel lp lpset lpstat netstat
- chmod 0 rcp rdist rlogin rpcinfo rsh rup ruptime
rusers rwho
- chmod -s sparcv[79]/ipcs sparcv[79]/ps
sparcv[79]/uptime sparcv[79]/w
- cd /usr/sbin
- chmod -s wall traceroute ping pmconfig sacadm arp lpmove
ffbconfig m64config afbconfig igsconfig pgxconfig dmesg
- chmod -s sparcv[79]/prtconf sparcv[79]/swap
sparcv[79]/sysdef sparcv[79]/whodo
- chmod 0 /usr/sbin/static/rcp
- cd /usr/ucb
- chmod -s sparcv7/ps sparcv9/ps
- cd /usr/platform/`uname -i`/sbin
- chmod -s eeprom prtdiag
- cd /usr/openwin/bin
- chmod -s xlock mailtool kcms_c* sys-suspend
- cd /usr/dt/bin
- chmod -s dtaction dtappgather dtmail dtprintinfo dtsession
- cd /usr/sbin
- mv in.fingerd in.fingerd.disabled
- mv in.named in.named.disabled
- mv in.rarpd in.rarpd.disabled
- mv in.routed in.routed.disabled
- mv in.tftpd in.tftpd.disabled
- mv in.tnamed in.tnamed.disabled
- mv in.uucpd in.uucpd.disabled
- mv rpc.bootpramed rpc.bootpramed.disabled
- mv rpc.nisd rpc.nisd.disabled
- mv rpc.nisd_resolv rpc.nisd_resolv.disabled
- mv rpc.nispasswdd rpc.nispasswdd.disabled
- chmod 0 *.disabled
- 'fsirand' on all filesystems (Note: this must be done
in single user mode, prefferably boot -s from cdrom).
This step randomizes the inodes such that file allocation
does not follow predictable patterns anymore. If
this is not done from the single user state, your
file systems (esp. /) will likely become trashed.
- set /, /usr, /opt, /export/... to ro and nosuid in /etc/vfstab
(except for the ~ftp file system)
- Remove un-nessecary service startup scripts
- In /etc/rc2.d, move the following:
- cd /etc/rc2.d
- mkdir defunct
- mv S30sysid.net defunct
- mv S40llc2 defunct
- mv S42ncakmod defunct
- mv S47asppp defunct
- mv S47pppd defunct
- mv S70uucp defunct
- mv S71ldap.client defunct
- mv S71rpc defunct
- mv S71sysid.sys defunct
- mv S72autoinstall defunct
- mv S72directory defunct
- mv S72slpd defunct
- mv S73cachefs.daemon defunct
- mv S73nfs.client defunct
- mv S74autofs defunct
- mv S74xntpd defunct
- mv S75flashprom defunct
- mv S80lp defunct
- mv S80spc defunct
- mv S85power defunct
- mv S88sendmail defunct
- mv S89bdconfig defunct
- mv S90wbem defunct
- mv S91zuluinit defunct
- mv S91leoconfig defunct
- mv S92volmgt defunct
- mv S93cacheos.finish defunct
- mv S94ncalogd defunct
- mv S95ncad defunct
- mv S95IIim defunct
- mv S95svm.sync defunct
- mv S98efcode defunct
- mv S99dtlogin defunct
- mv S99rcapd defunct
- mv S99tsquantum defunct
- chmod -R 0 defunct
- In /etc/rc3.d, move the following:
- cd /etc/rc3.d
- mkdir defunct
- mv S13kdc.master defunct
- mv S14kdc defunct
- mv S15nfs.server defunct
- mv S16boot.server defunct
- mv S34dhcp defunct
- mv S52imq defunct
- mv S76snmpdx defunct
- mv S77dmi defunct
- mv S81volmgt defunct
- mv S84appserv defunct
- mv S89sshd defunct
- mv S90samba defunct
- chmod -R 0 defunct
- In /etc/init.d, move the following:
- cd /etc/init.d
- mkdir defunct
- rm *.old
- mv appserv defunct
- mv asppp defunct
- mv autofs defunct
- mv autoinstall defunct
- mv boot.server defunct
- mv buttons_n_dials-setup defunct
- mv cachefs.daemon defunct
- mv cacheos.finish defunct
- mv dhcp defunct
- mv dhcpagent defunct
- mv directory defunct
- mv dtlogin defunct
- mv efcode defunct
- mv flashprom defunct
- mv imq defunct
- mv init.dmi defunct
- mv init.snmpdx defunct
- mv init.wbem defunct
- mv kdc defunct
- mv kdc.master defunct
- mv ldap.client defunct
- mv leoconfig defunct
- mv llc2 defunct
- mv lp defunct
- mv ncad defunct
- mv ncakmod defunct
- mv ncalogd defunct
- mv nfs.client defunct
- mv nfs.server defunct
- mv power defunct
- mv pppd defunct
- mv rcapd defunct
- mv rpc defunct
- mv samba defunct
- mv sendmail defunct
- mv slpd defunct
- mv spc defunct
- mv sshd defunct
- mv svm.init defunct
- mv svm.sync defunct
- mv sysid.net defunct
- mv sysid.sys defunct
- mv tsquantum defunct
- mv uucp defunct
- mv volmgt defunct
- mv webstart defunct
- mv xntpd defunct
- mv zuluinit defunct
- chmod -R 0 defunct
- Clean-out automounter files and NIS reminants
- rm /etc/auto_*
- rm /etc/defaultdomain
- lock down at/cron
- echo root > /etc/cron.d/at.allow
- echo root > /etc/cron.d/cron.allow
- chown root:sys /etc/cron.d/*.allow
- chmod 644 /etc/cron.d/*.allow
- fixup service rcs
- echo 'UMASK=077' > /etc/default/ftpd
- echo 'BANNER=""' >> /etc/default/ftpd
- echo 'BANNER=""' > /etc/default/telnetd
- chmod 644 /etc/default/ftpd /etc/default/telnetd
- chown root:sys /etc/default/ftpd /etc/default/telnetd
- close up DTlogin/XDMCP
- echo localhost > /usr/dt/config/Xaccess
- echo 127.0.0.1 >> /usr/dt/config/Xaccess
- echo "\!*" >> /usr/dt/config/Xaccess
- mkdir /etc/dt
- mkdir /etc/dt/config
- cp /usr/dt/config/Xaccess /etc/dt/config/Xaccess
- chmod 644 /usr/dt/config/Xaccess /etc/dt/config/Xaccess
- chown root:sys /usr/dt/config/Xaccess /etc/dt/config/Xaccess
- Setup temporary trusts
- add the following hosts to /root/.rhosts:
- nameserver
- omni
- oncilla
- hypatia
- add the following host IP address pairs to /etc/hosts:
- 198.206.181.139 nameserver
- 198.206.181.20 omni
- 198.206.181.190 oncilla
- 198.206.181.43 hypatia
- File copies from hypatia archives
Note: the archive is setup so that you can use scp to copy three
specific directories onto the target and be done with the whole
operation....
- Install the following root env files from
Hypatia. You can either copy them from the browser or login
to hypatia and use scp.
- rcp -p /export/hy_h0/library/DMZ/root/.alias
${DMZHOST}:/root/.alias
- rcp -p /export/hy_h0/library/DMZ/root/.cshrc
${DMZHOST}:/root/.cshrc
- rcp -p /export/hy_h0/library/DMZ/root/.local-paths
${DMZHOST}:/root/.local-paths
- rcp -p /export/hy_h0/library/DMZ/root/.logout
${DMZHOST}:/root/.logout
- rcp -p /export/hy_h0/library/DMZ/root/.prmpt
${DMZHOST}:/root/.prmpt
- rcp -p /export/hy_h0/library/DMZ/root/.xredirect
${DMZHOST}:/root/.xredirect
- Install the following local configurations from
Hypatia
These files may need modifications depending on the
version of Solaris you are installing.... Please make the
appropriate mods after installation
- rcp -p /export/hy_h0/library/DMZ/etc/defaultrouter
${DMZHOST}:/etc
- rcp -p /export/hy_h0/library/DMZ/etc/ftpusers
${DMZHOST}:/etc
- rcp -p /export/hy_h0/library/DMZ/etc/issue
${DMZHOST}:/etc
- rcp -p /export/hy_h0/library/DMZ/etc/netmasks
${DMZHOST}:/etc
- rcp -p /export/hy_h0/library/DMZ/etc/networks
${DMZHOST}:/etc
- rcp -p /export/hy_h0/library/DMZ/etc/nscd.conf
${DMZHOST}:/etc
- rcp -p /export/hy_h0/library/DMZ/etc/nsswitch.conf
${DMZHOST}:/etc
- rcp -p /export/hy_h0/library/DMZ/etc/resolv.conf
${DMZHOST}:/etc
- rcp -p /export/hy_h0/library/DMZ/etc/shells
${DMZHOST}:/etc
- rcp -p /export/hy_h0/library/DMZ/etc/syslog.conf
${DMZHOST}:/etc
- rcp -p /export/hy_h0/library/DMZ/etc/system
${DMZHOST}:/etc
- rcp -p /export/hy_h0/library/DMZ/etc/rc2.d/S98aind
${DMZHOST}:/etc/rc2.d
- rcp -p /export/hy_h0/library/DMZ/etc/mail/aliases
${DMZHOST}:/etc/mail
- rcp -p /export/hy_h0/library/DMZ/etc/mail/sendmail.cf.dmz
${DMZHOST}:/etc/mail/sendmail.cf
- rcp -p /export/hy_h0/library/DMZ/etc/hosts ${DMZHOST}:/etc
NOTE: you will need to uncomment the appropriate defrouter
entry for the DMZ leg that the dmzhost is installed on.
- Name mappings
- rcp -p /var/DMZ/rpc ${DMZHOST}:/etc
- Verify file contents
- Verify /etc/group,passwd,shadow file base from nameserver
- *LK* all psuedo users in /etc/shadow
- Close up inetd.conf (verify nameserver:/var/DMZ/inetd.conf)
Add tcp-wrappers to ftp,telnet,shell,login,exec,comsat,talk
- Copy S98routing from nameserver
Verify for your location
- Set TCP_STRONG_ISS=2 in /etc/default/inetinit
- Uncomment KEYBOARD_ABORT=alternate in /etc/default/kbd.
This sets the ABORT sequence CR~^B
- Modify /etc/system to suit local conditions.
- Copy snmp.conf from nameserver to /etc/snmp/conf/snmpd.conf
and modify to suit.
- Modify /etc/inetd.conf in.ftp entry to include -dl
(connection logging)
- Add -t option to inetd startup in /etc/init.d/inetsvc
- Comment out in.named entries in /etc/init.d/inetsvc (for non-DNS)
- Set PASSLENGTH=8 in /etc/default/passwd
- Install packages (FROM omni)
- Install NTP
- rcp -rp /usr/local/DMZ/ntp $DMZHOST:/opt
- On dmzhost
- mv /opt/ntp/etc/S73xntp /etc/rc2.d
- OR add to crontab
- #
- # time sync this beast
- #
- 12,42 * * * * /opt/ntp/bin/ntpdate timeserver > /dev/null 2>&1
- #
- # other security thingys
- #
- 15 7 * * 6 find / -user root -perm -4000 -exec ls -lat {} \;
- Install idled
- rcp -rp /usr/local/DMZ/idled $DMZHOST:/opt
- On dmzhost
- cp /opt/idled/S95idled /etc/rc2.d
- Install minimum local utilities
- rcp -rp /usr/local/DMZ/local $DMZHOST:/opt
- Install tripwire (from nameserver)
- rcp -p /net/sun/Packages/tw-sol-2.2.1.tar.gz
$DMZHOST:/tmp
- On dmzhost
- cd /tmp
- gzcat tw-sol-2.2.1.tar.gz|tar xvf -
- cd /tmp/tripwire??
- ./install.sh
- cp /tmp/tripwire??/README.kris /opt/TSS
- Install networker client (from ??)
- rcp /net/sun/Packages/LGTOclient.tar.gz
$DMZHOST:/tmp
- On dmzhost
- cd /tmp
- gzcat LGTOclient.tar.gz|tar xvf -
- pkgadd -d . LGTOclnt
- Run ASET in high mode - fix security
- Install tocsin/klaxon to detect port scans. - modify the
/etc/inetd.conf file as shown to catch some trivial scans.
- shell stream tcp nowait root /usr/local/bin/klaxid klaxon shell
- login stream tcp nowait root /usr/local/bin/klaxid klaxon login
- exec stream tcp nowait root /usr/local/bin/klaxid klaxon exec
- supdup stream tcp nowait root /usr/local/bin/klaxon klaxon supdup
- tcpmux stream tcp nowait root /usr/local/bin/klaxon klaxon tcpmux
- tftp dgram udp wait root /usr/local/bin/klaxid klaxon tftp
- echo stream tcp nowait root /usr/local/bin/klaxon klaxon echo
- discard stream tcp nowait root /usr/local/bin/klaxon klaxon discard
- chargen stream tcp nowait root /usr/local/bin/klaxon klaxon chargen
- Or for tocsin - /usr/local/bin/tocsin tcpmux echo discard chargen supdup x400
- Mods to move into DMZ
- Modify /etc/hosts for new hostname/IP addr
- Modify /etc/hostname.ifN, /etc/nodename, /etc/net/*
- Verify mail aliases and sendmail.cf
- remove hosts from /root/.rhosts:
- rm /root/.rhosts
- touch /root/.rhosts
- chown root:sys /root/.rhosts
- chmod 0 /root/.rhosts
- Verify /etc/resolv.conf
- Verify S98routing for YOUR net config.
- Verify and initiate Tripwire processing. (README.kris)
add to crontab:
'5 1 * * * /opt/TSS/bin/tripwire -m c -M -s -n > /dev/null 2>&1'
copy twpol.txt, hosname.twd, tw.pol to DMZ save area
- Remove pam_rhosts_auth lines in /etc/pam.conf
- Configure tripwire
7) install tripwire into /opt/TSS - follow the README.kris instructions
- Edit the policy file in /opt/TSS/policy/twpol.txt
- Configure database
- cd /opt/TSS/policy
-
- Install user accounts - The last step is to install the
global login that Alcanet can use to access this box. Though
these folk will not normally access our boxen, we need to provide
a door for them to help us.
- mkdir /opt/logins
- chmod 755 /opt/logins
- mkdir /opt/logins/alcanet
- chmod 755 /opt/logins/alcanet
- chown alcanet:alcatel /opt/logins/alcanet
- cd /opt/logins/alcanet
- touch .rhosts .forward .profile .kshrc .netrc .exrc
- chmod 0 .rhosts .forward .profile .kshrc .netrc .exrc
- cp /root/.cshrc .
- cp /root/.prmpt .
- cp /root/.logout .
- chown alcanet:alcatel .rhosts .forward .profile .exrc
.kshrc .netrc .cshrc .prmpt .logout
Post-install
- Maintain security patch level
- Maintain Sendmail
- Maintain BIND
(some generic notes from previous DMZ hardening:
install recomeded patches
JRE1.8?
SunScan
DNS
do port scan.....
)
additional stuff
Insure tripwire is auditing:
/etc, /etc/init.d, /etc/rc0.d, /etc/rc1.d, /etc/rc2.d, /etc/rc3.d
/usr/sbin, /kernel, /etc/cron.d, /etc/defautl, /var/cron,
/var/spool/cron, !/var/spool/cron/atjobs, /etc/cron.d/*{allow,deny}
add secure rpcbind to machines that MUST have rpcs
(ftp.pocupine.org/pub/security/rpcbind...)
Add 103582-12 (or higher) TCP connection Queue patch (2.5.1)