2.8. Hardening Pyramid
Problem
You want your little routerboard to be as hardened as you can make it. What steps can you take to make it as secure as possible?
Solution
Your first job is to change root's password to something a little less obvious than "root," the default password. Run these commands:
pyramid:~# /sbin/rw
pyramid:~# passwdThen, add an unprivileged user for remote logins over SSH:
pyramid:~# useradd -m alrac
pyramid:~# passwd alracYou'll need to set the setuid
bit on the su command so that
ordinary users can su to
root:
pyramid:~# chmod +s /bin/suNext, harden OpenSSH: disable root logins over SSH, disable password logins, and set up public-key authentication. Chapter 7 tells how to do all this.
Turn off unnecessary services and network interfaces. If you're not going to use the web interface or SSH login, turn them off. SSH is disabled by changing its startup command to a kill command, like this:
pyramid:/etc/rc2.d# mv S20ssh K20sshThe web GUI is disabled by commenting out this line in /etc/inittab:
# Lighttpd (with FastCGI, SSL and PHP) HT:23:respawn:/sbin/lighttpd -f /etc/lighttpd.conf -m /lib -D > /dev/null 2>&1
Pay close attention to your application security. Because this is a multihomed device, configure your applications to use only the interfaces they need to, and allow only authorized users. Keep your user accounts tidy, and don't leave unused ones lying around. Use good strong passwords, written down and stored in a safe place.
Run Netstat locally and Nmap remotely ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access