Live data from Hacker News

Ask YC: Securing your servers?

news.ycombinator.com

1–10 of 25 posts

Ask YC: Securing your servers?

#1
What techniques do you use to secure your servers? I've had a lot of good luck with things like SuSE and AppArmor for my servers, but I'm curious if there are other Linux flavors (or other OSs) that have some solid security tools for surviving wild on the internet.

What do you use? What wouldn't you ever use again? Any absolute rules that you force yourself to follow before even bringing your server online?

Thanks!

Re: Ask YC: Securing your servers?

#4
One absolute rule for any *nix-based server:

In /etc/ssh/sshd_config, disable root logins:

PermitRootLogin no

Even if you think your password ist strong. This will stop a majority of the brute-force password-guessing attacks. For extra credit, install denyhosts as well. It has stopped a _lot_ of bad guys trying to brute-force my servers.

Re: Ask YC: Securing your servers?

#5
1. Expose the absolute minimum number of services (and even then only software with a good security reputation).

2. Lock them down as much as possible in configuration and access (for example: use iptables to restrict acces to only your home/office where possible).

3. Apply vendor security updates as quickly as possible (subscribe to mailing lists).

4. Remotely backup your data.

5. Hope for the best.

Re: Ask YC: Securing your servers?

#6
I'm not the best person at this, but I do the following on any machine I deal with which does not sit behind a firewall:

1. Disable root logins via ssh (as noted above by bbb).

2. Move ssh port from port 22 to something nonstandard. According to my logs, the number of idiots who try brute-force attacks on my machines dropped from 4/day to 0.

3. Put an iptables script into /etc/init.d and make sure it runs on startup at the normal multiuser run levels (on Debian, the command is something like /sbin/update-rc.d, but I don't remember exactly). I looked into more sophisticated firewall packages which generate iptables rules, but found them rather complicated, and probably overkill (YMMV). I essentially blocked all incoming traffic except on the nonstandard ssh port and ports 80 and 443.

Services which use ports other than 80, 443, and ssh should run on a privately routed network, or, at minimum, on a separate network interface with draconian access rules. iptables is pretty easy to use once for this stuff you get the hang of it.

Re: Ask YC: Securing your servers?

#7
1) Only allow login by private key pair and not by password (you don't have to disable root login then)

2) Only run the minimum amount of services.

3) Don't give anyone else access to the system. (root exploits) Also be cautious if you are running some freely available software (such as phpbb). When a security hole is found, an attacker could deploy code on your machine resulting in a denial of service attack against other internet users, or in worst case, compromising your machine with a root exploit.

4) If a security exploit is found , update! If your server got compromised, make a fresh install.

Re: Ask YC: Securing your servers?

#10
post #4

One absolute rule for any *nix-based server: In /etc/ssh/sshd_config, disable root logins: PermitRootLogin no Even if you think your password ist strong. This will stop a majority of the brute-force password-guessing attacks. For extra credit, install denyhosts as well. It has stopped a _lot_ of bad guys trying to brute-force my servers.

You might also want to use:

AllowUsers user1 user2...

And it's probably best to disable password logins and use keys instead (http://www.google.com./search?hl=en&q=ssh+authorized_key...).

Post reply on HN