News for hackers. Stuff that matters.
Re:Identical Droplets in the DigitalOcean: Regenerate your U... by voltagex_ on Monday July 29, 2013 @07:35PM (#6124548)
I think I need a list of things to check. This sounds pretty scriptable though:

* SSH Host Key

* SSH Authorized Keys

* SSH PermitRootLogin

* Disabling password auth in favour of keys

* Security updates from the distro

* SELinux (maybe?)

Anything else?

Re:Identical Droplets in the DigitalOcean: Regenerate your U... by patio11 on Monday July 29, 2013 @08:27PM (#6124733)
a) Move SSH off port 22. (Really limited security gain when implementing the rest of the suggestions, but saves spam in your logs.)

b) Software firewall via e.g. IPtables is generally the first thing I turn on after rebooting SSHd with the new settings.

c) (Optional) Consider using an architecture where you have N boxes and SSH only listens on a local interface on N-1 boxes, with the Nth box running nothing but your VPN. (This is also a good architecture choice for admin consoles, folks. www.example.com resolves to a public IP, admin.example.com resolves to a private IP, so even if they're technically speaking on the same box/boxes you won't lose the admin console if someone unwisely uses the same password for a WordPress blog somewhere.)

Re:Identical Droplets in the DigitalOcean: Regenerate your U... by bigiain on Monday July 29, 2013 @08:57PM (#6124831)
Consider fail2ban.

It can be configured to automatically add (and later remove) ip addresses to iptables based on login failures (found by running regexes on logfiles).

I've got rules blocking ip addresses with multiple failed ssh or wordpress login attempts for an hour to be very effective. I've still got a bit of "brute force poop" in the logfiles, but much less than before. I've seen a suggestion for adding an additional fail2ban "recursive rule" - dropping any ip address with repeated fail2ban lockouts for much longer times - if you trigger multiple 1 hour lockouts for ssh auth failures, you might get dropped for a week or more. I haven't felt the need to implement that one yet.

Re:Identical Droplets in the DigitalOcean: Regenerate your U... by dsl on Monday July 29, 2013 @08:37PM (#6124773)
My honeypots have been seeing scans on 2022, 2222, 3022, etc. for years now. You should be setting proper ACLs for 22 and not moving to another port.
Re:Identical Droplets in the DigitalOcean: Regenerate your U... by RKearney on Monday July 29, 2013 @08:50PM (#6124816)
HostGator uses port 2222 for all their shared hosting. I never understood this, given how easy it would be to modify an attack to use the new port.
Re:Identical Droplets in the DigitalOcean: Regenerate your U... by voltagex_ on Monday July 29, 2013 @11:15PM (#6125207)
ACLs as in allow/deny? What if I'm using a dynamic IP on my client? In that case, should I just be using a "trusted" SSH gateway?
Re:Identical Droplets in the DigitalOcean: Regenerate your U... by dsl on Sunday August 04, 2013 @02:09PM (#6156443)
You should be using a VPN into a trusted bounce box.
Re:Identical Droplets in the DigitalOcean: Regenerate your U... by discodave on Tuesday July 30, 2013 @02:05AM (#6125576)
But then you have the same problem on the gateway.
Re:Identical Droplets in the DigitalOcean: Regenerate your U... by Domenic_S on Tuesday July 30, 2013 @12:33AM (#6125393)
The name for c), assuming you harden the box a bit is a bastion host

http://en.wikipedia.org/wiki/Bastion_host

Re:Identical Droplets in the DigitalOcean: Regenerate your U... by lmm on Tuesday July 30, 2013 @09:29AM (#6126783)
I've never understood the logic behind these software firewalls. If you have one enabled it's inspecting all incoming packets, exposing a large surface of what's often quite complicated C code.

Any service that has bound to a public-facing port on a machine I run has done so because I wanted it to; if I had a firewall I'd need to add an exception for it. Any service that's only meant to be accessed from the same machine has bound on loopback. Services that are accessed from another "internal" machine are properly authenticated, which means the network doesn't have to be trusted; spoofing packets won't help an attacker at all. Frankly if your defences rely on the idea that all packets from ip xxx.xxx.xxx.xxx are "safe" you're going to get burned.

Where's the value in a software firewall supposed to be?

Re:Identical Droplets in the DigitalOcean: Regenerate your U... by jackalope on Tuesday July 30, 2013 @10:40AM (#6127171)
I've used iptables as a lightweight IDS for years without incident, so I've found the benefits to outweigh any known risks.

The most dramatic example I have is that I manage a very heavy database-driven web application from an outside vendor that must be public to the entire world. Even a simple request of the home page results in dozens of queries, and users that are logged in put an additional load on resources. I've addressed performance with other optimizations, but since we have no need to generate additional traffic, I have iptables rules to detect unwanted crawlers or pen-testers and block them (based on probes to unused ports/IP addresses, user-agent strings, etc.). When we originally deployed the application, crashes were routine during peak cycles. Now, the server barely breaks a sweat. The ability to implement simple logic in a robust, time-tested software firewall plays an important role.

Other examples include mitigating SSH brute force attacks, port knocking, forensic logging and honeypots. My honeypots protect me from many undisclosed vulnerabilities, simply because attackers are poking around in places they shouldn't be and are automatically blocked. It's much nicer to review a simple report of blocked attacks than it is to troubleshoot a compromised server.

Re:Identical Droplets in the DigitalOcean: Regenerate your U... by cdjk on Tuesday July 30, 2013 @10:18AM (#6127064)
What if you want to do something between "everyone can access it" and "only local host can access it?". For example, I have to run a recursive DNS resolver on a port other than 53 because my ISP intercepts DNS traffic. I've limited access to only my ISPs IPs at the software firewall, so as not to unwittingly take part in a DNS amplification attack.

Or what if I want to run a mail relay but only allow machines I control to access it. Or block a user who's doing something nefarious?

Sure, most services allow you to control access by ip, but I'd much rather manage it all in one place. And the ports show up as closed if you block at the firewall.

Re:Identical Droplets in the DigitalOcean: Regenerate your U... by lmm on Wednesday July 31, 2013 @04:33AM (#6132503)
>What if you want to do something between "everyone can access it" and "only local host can access it?". For example, I have to run a recursive DNS resolver on a port other than 53 because my ISP intercepts DNS traffic. I've limited access to only my ISPs IPs at the software firewall, so as not to unwittingly take part in a DNS amplification attack.

Hmm. In that specific instance it makes sense, because spoofing the IP is the whole point of the attack. I'd argue that's basically unique to DNS though, in which case the advantage of managing it in the same place as your other services goes away.

>Or what if I want to run a mail relay but only allow machines I control to access it.

Then you use a real authentication mechanism (i.e. SMTP AUTH). Otherwise it would seem perfectly possible for a spammer to spoof one of your IPs and use your relay.

Re:Identical Droplets in the DigitalOcean: Regenerate your U... by icebraining on Monday July 29, 2013 @07:42PM (#6124572)
The difference is that with most of those, you can create a snapshot of an instance and then duplicate the configuration, but Host keys are special, since they need to be re-created for each instance.

In any case, there was discussion on those issues not long ago: https://news.ycombinator.com/item?id=5316093

Re:Identical Droplets in the DigitalOcean: Regenerate your U... by __david__ on Tuesday July 30, 2013 @03:36AM (#6125768)
> SSH PermitRootLogin

I assume you mean to disable it? I see that listed in various places, but I don't understand why it matters… I like to kill all passwords on my VMs (so there's nothing to brute force), uninstall sudo and only use ssh keys to authenticate. I would like to know why this is a bad idea.

Re:Identical Droplets in the DigitalOcean: Regenerate your U... by jon-wood on Tuesday July 30, 2013 @05:09AM (#6125965)
This is more of an issue on machines with multiple people who can access them. If you disallow logging in as root and use sudo to escalate privileges when needed then there's an audit trail of who did what (or at least a record of someone starting a shell with root privileges at around the time of something bad happening).
Re:Identical Droplets in the DigitalOcean: Regenerate your U... by VLM on Tuesday July 30, 2013 @09:45AM (#6126863)
A slight correction in that if you examine the logs on any SSH server connected to the net you'll see an absolute flood of Chinese (and other) compromised windows boxes trying to brute force (sorta) passwords for the root account using ssh.

So if you disable root logins, they have no idea what to use as a username. Oh sure someone who personally knows which machine you maintain might be able to guess jonwood is your username or my username is vlm... but they'll never be able to log in as root and botnets aren't smart enough to try anything else. Aside from root, I wouldn't make your "primary user name" = "hostname" either.

Thinking back at my occasional examination of logs, I don't know if I've ever been scanned by bot nets trying Anything other than root as a username. I'm sure it happens, but I can't afford to spend 5 minutes per syslog line in my life either...

Re:Identical Droplets in the DigitalOcean: Regenerate your U... by dbdr on Wednesday July 31, 2013 @01:00PM (#6135154)
I did see remote bots attempting to guess ssh usernames besides root. For instance bob, john, guest, ...
Re:Identical Droplets in the DigitalOcean: Regenerate your U... by gtani on Monday July 29, 2013 @08:49PM (#6124814)