Hardening Linux servers for remote access
I host several Linux servers which allow users remote access and file transfer capabilities via SSHv2/SFTP. These systems are already hardened with external firewalls, SSH hardening ala DenyHosts and internal privilege hardening via Bastille, limits.conf and some of my own hand-rolled scripts. Is there anything you might recommend to further tighten such a setup, since many users will have shell access?
It sounds like you've got most of the bases covered. I have a few suggestions that may assist you:
Look at PAM and potentially how to use it to harden your user controls. Strong passwords and authentication controls are critical on hosts with large numbers of shell users.
Consider a deployment of SELinux (or depending on your platform AppArmor). While both can be complicated to configure they can be very powerful in adding more granular controls to your hosts.
Consider very carefully what packages are installed, for example, if a lot of users have shell access then the addition of tools like compilers and scripting languages can greatly assist an attacker in compromising your host. Ensure you have the minimal and most appropriate set of packages installed.
Often the first warnings of something going wrong is a log message. Try setting up some centralized logging and alerting on some of the more critical messages for security and operations and consider the use of tools like SEC or Swatch, which are helpful with this.
Lastly, ensure you keep up to date with patches and updates for both your operating system and your applications.
Hope that helps and good luck with securing your hosts.
This was first published in January 2008