Suggestions here are divided into:
| Green Everyone should apply these! Unless you really want to be hacked. |
| Yellow For the more cautious -- do these if you are a little worried about being hacked. |
| Red For the truly paranoid -- if you have not moved to OpenBSD already! |
There are no guarantees for what's here. Remember that security and convenience are usually inversely proportional. Good luck...
Before you start
| Green -- everyone Make sure that you have rescue media available. Particularly before continuing with these suggestions. Try the Knoppix rescue media: http://www.knoppix.org/ |
Update your kernel and applications
| Green -- everyone Make sure that you apply all security updates! |
Protect against network threats
|
|
| Green -- everyone Attackers are attempting to login to your system via SSH as
common default accounts like test, admin,
guest, and root. Browse through /etc/passwd and
disable all unneeded accounts. At least disable these, if they
exist: Also make very certain that root has a strong password! |
| Red -- paranoid Do the above, and also disable remote root access over SSH. Make /etc/ssh/sshd_config contain the
line: |
|
|
| Green -- everyone Use lsof to list your system's open TCP and UDP
ports: Every one of those open ports is a risk. Do you really need to run every TCP/UDP service? Turn off what you do not need! You definitely should not run Telnet or any of the Berkeley R* services (rlogin, rcp, rsh). For standalone services like HTTP/HTTPS, stop and disable the boot
script: For services run out of xinetd, edit the specific
configuration script and signal xinetd to reload its
configuration: |
| Yellow If you must run HTTP, then do not also run HTTPS unless you really need a secure server (avoid some complication and reliance on the OpenSSL shared libraries). Edit /etc/httpd/conf/httpd.conf and comment out the line
reading: |
| Red -- paranoid By the time you finish, your lsof output contains only the
following: |
|
|
| Green -- everyone Assuming there is no reference to /etc/rc.d/rc.firewall in any existing boot script, do the following. And if there is a reference, then either remove those references or use a different name in the following.
|
| Red -- paranoid As above, but change the next-to-last block of code to the following
(DROP vs REJECT): |
|
| ||
| Green -- everyone Put the following directives in /etc/ssh/sshd_config to
configure the SSH server. Note that many of the SSH defaults are secure,
so include the following but comment out any other directives currently
used.
And for the SSH client configuration in /etc/ssh/ssh_config:
| ||
| Red -- paranoid Put the following directives in /etc/ssh/sshd_config. Note
that many of the SSH defaults are secure, so include the following but
comment out any other directives currently used in your SSH daemon
configuration:
And for the SSH client configuration in /etc/ssh/ssh_config:
|
Prevent trivial root console break-in.
| Green -- everyone Add the following line to the file /etc/inittab right after the line referencing /etc/rc.d/rc.sysinit ss:S:respawn:/sbin/suloginOtherwise, just type linux s at the LILO prompt to break in as root on the console. |
| Yellow -- cautious Do the above. And since an attacker could always boot from removable media like your Knoppix CD:
|
| Red -- paranoid Do both of the above. And since an attacker could open the system case and reset the BIOS or remove the hard drive, keep the computer in a physically secured room. |
Harden the file system
| Green -- everyone Make /tmp a RAM-based filesystem. RAM is much faster than a disk, and any data stored there is truly temporary and is lost at shutdown.
| ||||||
| Yellow -- cautious Do the above, but prevent an attacker from doing many things by making
/tmp less useful to them. Make the /etc/fstab entry
say: | ||||||
| Red -- paranoid Do all the above, and also use the noexec, nosuid, and nodev options on other partitions:
|
Harden root authentication
| Yellow -- cautious Best practice for the root account is:
Disallow direct root login
Prevent unencrypted transmission of the root password
Limit the set of people able to attempt to become root
At this point you could write the root password on the monitor, and ordinary users still would be unable to become root -- not that this is a good idea, but root privileges now require knowledge of a privileged account's password plus knowledge of the root password. |
Harden user authentication
|
|
| Green -- everyone Make sure that the file /etc/pam.d/system-auth contains the
following line: |
| Yellow -- cautious No, use: |
| Red -- paranoid You know, if you really want to take full advantage of the
security offered by the 128-bit MD5 cryptographic hash used to
authenticate the login pass phrase, you should consider the fact that
English text contains about 1.2 bits of entropy per character, and 128/1.2
= 106.66666: |