I got this from the ICMP info mailing list. Thought everyone might get some use out of it. > > A Paper on Linux Security v1 > ---------------------------- > >This text will describe how you can, from an unsecured new Linux system, >make it into a fortress. > > >---------------------------------------------------------------------- >So you installed Linux for the first time, and now you want to be safe >from the Bad Guys (aka. crackers..) First of all, I need to say that no >system is 100% safe, no matter what you use to protect it (unless you >turn the system off..). That said, Linux offers a lot of tools to protect >yourself. We'll try to use them as best as we can to make this >hypothetical system secure. First of all, you need to know what's running >on the system, and what you need to run. Look into inetd.conf (usualy in >/etc or /etc/inet) and disable everything you don't need. You might want >to have telnet, ftp, mail and web servers running, but you probably don't >need RPC services or chargen. Also check the system startup files (usualy >in /etc/rc.d or /etc/rc) called rc.inet1, rc.inet2 or rc. There are >comments beside every line that tells you what that service is, and you >can use the man pages to find out too. When this is done, kill -HUP the >inetd process (killall -HUP inetd) and all the things you don't need that >are currently running (or just reboot the system). > >Now, you want to know if some other process you forgot might be running, >or if one of your users might have started a program that listens for >connections, and might have security holes. Use the netstat command >(usualy: netstat -a) to find this out. Every line shows a process >listening on a specific port, or a connection between two hosts. > >Now, let's say for this example that you have two systems, one is your >Linux server on which you run a web server, mail, news, telnet and ftp, >and one is your workstation, connected on that server: > > > ------------------- ------------------------ >Internet ------- | server (system 1) | ----- | workstation (system 2) | > ------------------- ------------------------ > >You might want to only allow telneting on system 1 from system 2, while >allowing other people from the Internet to FTP on system 1. There are two >ways to restrict which IP can connect to a system. The first one is with >TCP wrappers, in /etc/hosts.allow and /etc/hosts.deny. The second one is >by firewalling. You should check the newsletter about IPFWadm for more >about firewalls (http://icmpinfo.darkelf.net/newsletters/1.txt) > >You should also look for any setuid binaries on your system (find / -perm >4000 -print) and change them to normal binaries (chmod -s <file name>) if >you don't think your users will need them. Also, you might want to >prevent login as root from any other place than console. You usualy >define this in /etc/securetty (see man securetty) by removing the lines >begining by ttyp. > >One last thing to think about is logs. If someone hacks into your Linux >server, he will probably erase the system logs. You can use remote >logging against that. You need to tell the logging program to send logs >to system 1 AND to system 2. For that, you need to have syslogd running >on both systems. On system 1, configure syslog.conf (usualy in /etc) so >it will send logs to both systems: > ># local logs >*.* /var/adm/syslog.log ># remote logs >*.* @system2.hostname.com > >That way, you will have 2 copies of the logs. On system 2 you need to >allow syslogd to receive logs from system 1 (usualy by running: >syslogd -r). See man syslog.conf for more. > >I hope this helped the new Linux users out there. Feel free to mail me >with any comment. > >Drow <[EMAIL PROTECTED]> >---------------------------------------------------------------------- > > > > > > > >Patrick Lambert >---------------------------------------------------------------------- >DarkElf Network SysAdmin http://www.darkelf.net >OKC.OK.US.UnderNet.Org Operator http://www.undernet.org > Check the main resource for developers at www.fastethernet.net >---------------------------------------------------------------------- > > -- PLEASE read the Red Hat FAQ, Tips, Errata and the MAILING LIST ARCHIVES! http://www.redhat.com/RedHat-FAQ /RedHat-Errata /RedHat-Tips /mailing-lists To unsubscribe: mail [EMAIL PROTECTED] with "unsubscribe" as the Subject.
