News for hackers. Stuff that matters.
Re:My First 10 Minutes on a Server by brobinson on Wednesday June 15, 2016 @02:48PM (#11911175)
>2048 bit RSA keys

Github recommends 4096 now, for what it's worth. [1]

>Pushing database backups offsite

This is a really bad idea and a good way to get owned. Database backups must be PULLED from the server, not pushed from it. Separately, you also need to test that you can restore from your backups periodically.

There were a couple other things I disagree with, but they're in the realm of personal preference. It's also interesting that this guide uses Linode which is a hosting company known to have had quite egregious security issues in the past. [2]

[1] https://help.github.com/articles/generating-a-new-ssh-key-an...

[2] https://www.google.com/#q=linode+hack

Re:My First 10 Minutes on a Server by brokenwren on Wednesday June 15, 2016 @03:20PM (#11911417)
I agree that pulling does appear to be more secure, but if someone breaches any of your servers undetected, you're pretty much hosed regardless.

Plus, the Inversoft guide specifically states that backups must be encrypted. I could put my backup ZIPs on a public Github repository and no one would be able to access the user data stored inside it. Therefore, it really doesn't matted if they are pushed or pulled.

Re:My First 10 Minutes on a Server by brobinson on Wednesday June 15, 2016 @07:27PM (#11912889)
If a script or cronjob or whatever on the server has write access to the repo, so does the hypothetical attacker.

I remember seeing a "hacking" website get wiped along with all of its backups about 15 years ago and it left a very strong impression on me regarding this issue.

Re:My First 10 Minutes on a Server by jjnoakes on Thursday June 16, 2016 @07:49AM (#11915464)
If it is write access but not delete access (nor overwrite access) then there is no issue.

It is sometimes more secure to push because it requires no inbound connections or authorizations the live machine.

Re:My First 10 Minutes on a Server by jacquesm on Wednesday June 15, 2016 @05:08PM (#11912163)
That may be true but with a pulled db backup and a good recovery strategy you'll be back up relatively quickly, without you'll be DOA.
Re:My First 10 Minutes on a Server by hueving on Wednesday June 15, 2016 @03:16PM (#11911368)
>This is a really bad idea and a good way to get owned. Database backups must be PULLED

Just make sure your database server doesn't have permission to delete backups (e.g. Have it POST a backup via HTTPS). There is nothing wrong with db server initiated backups.

Re:My First 10 Minutes on a Server by brobinson on Thursday June 16, 2016 @05:10AM (#11914916)
This is still open to abuse in the form of your legitimate backup script being disabled and replaced by one uploading false backups. You wouldn't know anything has happened until you go to restore from one.

Of course, this is an edge case, but I believe setting up a pull-based backup system is still going to be less work than a write-only push system.

Re:My First 10 Minutes on a Server by arielb1 on Thursday June 16, 2016 @09:59AM (#11916106)
A hacked server can have the backup server pull false backups as well.

Of course, your servers shouldn't be SSHing to your backup servers, but that goes both ways.

Re:My First 10 Minutes on a Server by tamana on Thursday June 16, 2016 @03:09PM (#11918180)
If the backup machine is compromised the attacker can corrupt your backups. Either way, if machine is hacked you risk loss.
Re:My First 10 Minutes on a Server by hueving on Thursday June 16, 2016 @04:43PM (#11918731)
That's ridiculous. The same tricks can be played on a pull based system once you have compromised the DB server.
Re:My First 10 Minutes on a Server by nnutter on Wednesday June 15, 2016 @02:53PM (#11911214)
Why must they be PULLED?
Re:My First 10 Minutes on a Server by mastorrent on Wednesday June 15, 2016 @03:03PM (#11911278)
If a server can push backups, it must necessarily have credentials for and write access to that backup repository. If the server is compromised, that write access could be used to attack the backup repository as well. Pulling backups from a server removes the need for credentials or access to the backup repository.
Re:My First 10 Minutes on a Server by pfg on Wednesday June 15, 2016 @04:10PM (#11911798)
That is one valid way of solving this problem. Another option is to have a permission system that allows you specify that the server can only append new data, but not delete or overwrite existing files. This is useful if you don't want the added complexity of having a separate "backup management" service, which could easily become a bottleneck if you are backing up a lot of data from multiple servers.

One way to do this is with S3, for example, is to use an IAM role with only the "PutObject" permission, and enable object versioning for the bucket to prevent a compromised server from being able to delete data by overwriting existing files.

Re:My First 10 Minutes on a Server by foodstances on Wednesday June 15, 2016 @06:27PM (#11912617)
It's also easy to do this with Tarsnap. You can split out your host keys with tarsnap-keymgmt into separate read, write, and delete keys. Just take your delete key off of the host and store it somewhere secure.
Re:My First 10 Minutes on a Server by cperciva on Thursday June 16, 2016 @02:55AM (#11914473)
Or better yet, create the key somewhere else and only upload the keys you want to have on the server. Otherwise there's a chance that the original tarsnap key is left in an unallocated block.
Re:My First 10 Minutes on a Server by taneq on Wednesday June 15, 2016 @09:37PM (#11913412)
Not an expert here, but this seems to me to be stripping away one layer of security. Kind of like saying that you can leave a key to your house lying around as long as the pantry door is locked - if your database server gets owned, they now have some kind of login to your backup server as opposed to no kind of login.

Maybe the extra layer doesn't add much security, but if it's a simple config change and it does add something, wouldn't it be worth doing?

Re:My First 10 Minutes on a Server by pfg on Wednesday June 15, 2016 @11:36PM (#11913758)
Not a bad point - it's a trade-off.

You could make a similar point about the centralized backup management server - it needs to have "some kind of login" to all your production database server, so of that host is compromised (which might only store encrypted copies of your backup), so are all your database servers if those privileges can be escalated. You could argue that one backup host is easier to secure than a complex system such as AWS, but then I would argue that it would probably be hard to beat the track record of S3/IAM. ;-)

Both approaches have their place. If you're dealing with a large number of hosts and a lot of data, the backup host will quickly become a bottleneck and you're probably better off with the append-only approach. If that's not a concern for you (i.e. you're not running into any bandwidth limits on the backup hosts) and want to deal with operating yet another service to avoid the risk of e.g. IAM privilege escalation, the other solution might be a better fit.

Re:My First 10 Minutes on a Server by walrus01 on Wednesday June 15, 2016 @07:25PM (#11912880)
Doesn't entirely fix the problem, but using public/private key auth and a private key created just for the backup cron job, the server can push a backup via scp/ssh to its own user account which on the destination end is chrooted into a particular backup destination directory.
Re:My First 10 Minutes on a Server by zeeZ on Thursday June 16, 2016 @04:31AM (#11914780)
Plus, if you're super paranoid, pulling doesn't require leaving any ports open and software listening on the repository.
Re:My First 10 Minutes on a Server by tamana on Thursday June 16, 2016 @03:11PM (#11918192)
But it requires leaving a port open on the DB server where an attacker can get a whole copy of your database, or destroy it.
Re:My First 10 Minutes on a Server by amdavidson on Thursday June 16, 2016 @04:03PM (#11918505)
Many database servers are not serving databases solely to themselves and have that port open as part of the normal course of operation.
Re:My First 10 Minutes on a Server by lebca on Thursday June 16, 2016 @01:54PM (#11917725)
Could you recommend another hosting service with better security practices than Linode?
Re:My First 10 Minutes on a Server by brobinson on Sunday June 19, 2016 @02:25AM (#11932017)
I don't currently use them, but I've had good luck with Vultr and they haven't had any incidents like Linode AFAIK. There's also AWS, Azure, whatever Google's thing is called, and all the other big ones. I have no opinion on DigitalOcean even though I currently have a VPS with them since I'm not running anything remotely mission critical there.