Live data from Hacker News

How I spend my first 5 minutes on a server

plusbryan.com

131–140 of 355 posts

Re: How I spend my first 5 minutes on a server

#131

I wouldn't bother with fail2ban considering password based SSH logins are disabled (which is good). Since the author is using ufw to control iptables, better to just use "ufw limit" rules for SSH port 22 to slow down the rate of any automated SSH bots trying to give your server a workout.

Indeed. I have always been a bit worried about such approaches, since they parse log files and attackers have some control over what is written to log files (user names and host names).

Re: How I spend my first 5 minutes on a server

#132
post #129

Earlier quoted context omitted.

Why do you say a VPN server is more secure? Which one? I, for one, trust ssh more than any other software wrt security, especially with password login disabled. Disclaimer: I am not a security expert.

I, also, trust SSH more than any other software. But it is still worth adding an additional layer of security in front of SSH to help protect from exploits. Let's say that, hypothetically, a 0-day exploit was discovered in SSH which allowed remote code execution. A script kiddie begins trawling the internet for publicly accessible SSH servers to attack. Your servers allow SSH from anywhere on the internet, and are ev…

Your outermost server is the one where you should be most worried about having vulnerabilities - if you have a VPN as the outer layer that means the VPN server must be exposed to the public internet, and anyone who compromises it is in a pretty good position. And I'd rate the odds of a 0-day being found at higher for most VPN software than for SSH.

Re: How I spend my first 5 minutes on a server

#133
It saddens me each time I see a security best practice guide that suggest turning off ssh access for root. Its a very useful feature, and the security industry should focus on the security problems rather than removing features without thinking about the actually benefits of doing so.

Sysadmins with root access should be able to handle a random 8 character or longer password, and that number is large enough for a secure public accessible ssh. If your not a sysadmin or unable to remember a random password, try go with a passphrase like "correct horse battery staple". If you have too many machines and thus can't remember passwords, then use a master password locally with a bit larger password and store certs there.

To do some math to illustrate the security of a random 8 character long password, someone would need to fill a 100/100 line for several hundred years to get through them all. By that time you should have noticed the constantly full connection, and be happy you haven't died of old age yet even after your 200th birthday.

However, 8 character passwords are not the suggested length by security experts. They suggest using a 10 character long password, as that is also secure in the case that your password hash somehow got lost.

For the several servers that I have, I have been more worried about the logs from failed attempts than I have been of anyone guessing the password. Logs wears on the hard drive, so one might want to install fail2ban to lower the number of writes to it. It also decrease the noise level in the server room.

Re: How I spend my first 5 minutes on a server

#134
post #133

It saddens me each time I see a security best practice guide that suggest turning off ssh access for root. Its a very useful feature, and the security industry should focus on the security problems rather than removing features without thinking about the actually benefits of doing so. Sysadmins with root access should be able to handle a random 8 character or longer password, and that number is large enough for a sec…

> Logs wears on the hard drive, so one might want to install fail2ban to lower the number of writes to it.

Or change the ssh port.

Re: How I spend my first 5 minutes on a server

#135
post #133

It saddens me each time I see a security best practice guide that suggest turning off ssh access for root. Its a very useful feature, and the security industry should focus on the security problems rather than removing features without thinking about the actually benefits of doing so. Sysadmins with root access should be able to handle a random 8 character or longer password, and that number is large enough for a sec…

.. and it saddens me each time I read a comment like this. It's best practice to disable remote root login. A whole industry supports this.

Re: How I spend my first 5 minutes on a server

#136
Couple of related questions:

1) Many people seem to be recommending Puppet / Chef. How many servers or installs do you need before this is a good ROI? (Over using odd bash scripts or cPanel/WHM)

2) Am I right in thinking kernel updates don't get applied until the server is rebooted? If so, how / when do you manage this?

Re: How I spend my first 5 minutes on a server

#137
post #133

It saddens me each time I see a security best practice guide that suggest turning off ssh access for root. Its a very useful feature, and the security industry should focus on the security problems rather than removing features without thinking about the actually benefits of doing so. Sysadmins with root access should be able to handle a random 8 character or longer password, and that number is large enough for a sec…

“correct horse battery staple” — the new hacker’s choice of password.

Re: How I spend my first 5 minutes on a server

#138

Beginner or not, you should probably use visudo [1] instead of vim /etc/sudoers for the sanity checks that it provides, if nothing else. A botched edit of /etc/sudoers that locks you (along with every other user) out of administrative access is an unpleasant way to learn this. [1] http://linux.die.net/man/8/visudo

You're absolutely right. Thanks for catching that!

In certain cases you may not even need to visudo :) AFAIK, Ubuntu's default /etc/sudoers contains this :

%admin ALL=(ALL) ALL

So you just need to make sure your 'deploy' user account belongs to the admin group and you're good to go.

Re: How I spend my first 5 minutes on a server

#139

Couple of related questions: 1) Many people seem to be recommending Puppet / Chef. How many servers or installs do you need before this is a good ROI? (Over using odd bash scripts or cPanel/WHM) 2) Am I right in thinking kernel updates don't get applied until the server is rebooted? If so, how / when do you manage this?

I've always thought 10 was the magic cut-off. I can imagine running "apt-get update && apt-get upgrade" ten times in a row before I get annoyed. Any more than that and I'd want scripting.

Really there's nothing stopping you from automating "some" machines and later pushing that out to the rest of your hosts. (Or just setting up trivial automation "configure NTP", "Disable root logins", "Append 'steve' to sudoers" - and keeping doing the rest by hand until you're confident.)

FWIW I use my toy configuration system, slaughter:

http://www.steve.org.uk/Software/slaughter/

Re: How I spend my first 5 minutes on a server

#140
post #11

I've never understood the point of fail2ban if you disable ssh password authentication. Yeah, it might eliminate some spam in the logs, but if you only allow key-based authentication that doesn't really matter.

Keys can be brute-forced.

No.
Post reply on HN