Security for LinuxThe goal of this document is to present a succinct overview of Linux security related subjects, tips & tricks that can help an aspiring sysadmin to create Linux workstations that are as secure as the state of the art allows. This HOWTO does not go into depth. Where possible, instead of spelling out everything it contains pointers to further information. Such, it relies on the natural intelligence of the implementor (the local sysadmin). More comprehensive documents are referenced below. This document is not portable to different operating systems, it assumes Linux. Partly it even assumes Redhat of the same version on each computer in the cluster. It assumes fast net connection between cluster members. It assumes cluster members trust each other. It partly assumes NFS: at least one central shared partition (may be read-only). Requirements: this documents assumes a sysadmin who has already taken the first hurdles: knows how to read and interpret the output of netstat and ps, edit a file, install packages etc. A great introductory text is the Security-Quickstart HOWTO, which comes in a general and a RedHat-specific version. See below for the reference. Quicklinks: Generic | Tools | Apache | SPAM | Windows | Firewalls | Cron | Organisations | Articles | Misc
Objectives of good sysadmin work
GenericSecurity comes in layers, for instance:
The 2 most important layers are not covered in this document: physical and social security. If somebody can enter your facility and tack an axe to your server, you just suffered a physical DOS (denial-of-service) attack. And if your users are willing to give their password to the "technician from QWest" on the telephone, you are susceptible to social attacks. nmap needs to be installed and run against each computer to make sure no unneeded ports are open. Use netstat or lsof to see what programs are behind each of the open ports and determine if they are really necessary. Run nmap explicitely for each port (1-65536) Unnecessary services include: swat, ident, auth, linuxconf-web. Remove the packages and disable the services in /etc/xinetd.d No telnet, rlogin, rsh, rexec. Ever. Only anonymous outgoing FTP. As little uploading as possible. Enable passwordless ssh connections so users find it convenient NFS is good, though sometimes locking issues need to be worked out. Keep updating kernels to get NFS fixes. Passwords should by shadow and MD5. Syslog: have central syslog server that writes directly to secure storage In especially vulnerable systems, see if you can mount things read-only, so even if they are broken into the attacker can't destroy anything. This can be done if the partition we want to secure is NFS mounted and the server's /etc/exports does not allow read-write access Automatic and manual backup systems - hd, tape, CDs. DVDs once DVD-writer standards stabilize. Run all daemons as their own user and group, NOT as root. Buy a service contract from redhat (RHN) and use it. up2date is invaluable. 60$/year is a steal. If your ftp server is wu-ftpd, in /etc/ftpaccess, set stat terse. This disables ftpd software + version information to the outside. But a better ftp server is vsftpd The Xserver option -nolisten tcp disables listening on port 6000. If you do want to access X over the net you still can, as long as you are using ssh forwarding. This is automatic if you are loged into the remote host with openssh. In the mysql configuration file /etc/my.cnf, you can set the option skip-networking in the [mysqld] section if all database access is only from the local machine. This disables mysql listening on port 3306. ToolsnmapShows the connectivity of a networked computer to the outside world, i.e. performs portscans. Should be run with different scanning options, i.e. -SN, -SX etc. When running it, use the -p option to scan all possible ports, not only known ones.
http://www.insecure.org/tools.html
nessus
snort
ACID
logcheck
GPG
Openwall kernel patches
tripwire
Run RedHat's up2date tool at least once a week.
ethereal
chkrootkit
Center for Internet Security
John the Ripper ApacheSet up SSL and encourage users to use it.Read up on CGI security and audit all CGI scripts on your web server. Perl's taint mode is your friend. Secure scripts are at http://nms-cgi.sourceforge.net/ Go through logs regularly and look for
Run apache as user apache, group apache, not user root or user nobody. Provide as little info as possible to clients: ServerSignature off ServerTokens Prod SPAMSpam AssassinIs an excellent heuristic spam detection program.
spamassassin-milter Pertinent parts of the sendmail config file /etc/mail/sendmail.mc WindowsWindows computers are to be regarded as untrusted members of a clusterNever leave a vanilla Windows computer on an unprotected connection to the internet. See the Worms under Windows article. Even if protected, Windows computer can be broken into through e-mail viruses or IE exploits. No administrator action can help there. Choose one of these solutions:
putty A list of ssh and scp clients and servers for Windows Windows computers should only access shared discs read-only Windows computers should not export services to non-Windows computers. No SQL, mail- or web servers under Windows! The applications with the biggest security risks seem to be IE and Outlook/Outlook Express. Try to move your users over to Mozilla and Pegasus mail/ Eudora mail. Educate the users. Tell them (or force, if need be) to switch off scriptability. Give them options. Make it easy for them to move to Unix: install X Servers on the Windows computers so they can begin running unix applications on them. Install Linux software that replicates Windows functionality. I.e. openoffice, mozilla, kmail etc. FirewallsFirewalls are an essential part of any security setup. A firewall can be installed on a single workstation, where it just serves as another security mechanism, or on a gateway where it protects an internal network from the internet.The linux iptables firewall configuration language and toolset is very comfortable and understandable, worth learning. The older ipchains language and tool is less developed and comfortable. It should be avoided.
The homepage to the iptables (netfilter) system
The NFS-HOWTO Tools for configuring a firewall under Linux:
Usefull scripts to be run by croncron.weekly: rpm --rebuilddbRebuild RPM database to prevent corruption.
cron.daily:
/etc/cron.hourly:
OrganisationsVisit each of those sites regularly.CERT Advisory mailing list - subscribe! Bugtraq mailing list - subscribe! Learn about tools, tactics and motives of the blackhat community Articels / DocumentsYou should look over each of the documents and understand what they are saying by heart.Worms under Windows. Shines a light at Windows' bad security Overview of admining a redhat 9 system. Worth checking out. The SSH FAQ. You should know everything about SSH. Additional software and references that you might want to check outmimedefangAllows for more complicated mail filtering. Worth a look if spamass-milt is not powerful enough.
Tagged Message Delivery Agent
MonMotha's Firewall
IPCop
Counterpane Internet Security, Inc
DEF CON: largest security conference
Security tools, papers, magazines
Information Systems Security Association The Honeynet project explained Secure Programming for Linux and Unix HOWTO SSH tunneling explained on the example of tunneling WiFi
This overview was written by Hans Ecke using experience gathered administrating a cluster of Linux workstations at the Colorado School of Mines 2000-2003.
|