News for hackers. Stuff that matters.
Re:My First 10 Minutes on a Server by brokenwren on Wednesday June 15, 2016 @11:21AM (#11909844)
This one is pretty decent but if you want the ultimate guide check out this one:

https://www.inversoft.com/guides/2016-guide-to-user-data-sec...

It covers 10x what all the other guides cover in terms of server and application security. It was posted a few weeks ago on HN but didn't make the front-page.

Re:My First 10 Minutes on a Server by atonse on Wednesday June 15, 2016 @11:25AM (#11909873)
My worry here is that, in posting what seems to be a book, people just won't even do it because we don't have time to do it, unless this is a primary part of their jobs.

If a 10 minute guide gets users 90% of the way, then they're more likely to do it. And that's good enough to cover a majority of automated attacks.

Update: I take it back – they've provided scripts to run this stuff. I will explore these. Thanks for the link.

Re:My First 10 Minutes on a Server by peterwwillis on Wednesday June 15, 2016 @01:56PM (#11910841)
Back in the day, The Linux Documentation Project had a trove of hundreds of HOWTOs covering every facet of using Linux. By today's standards they seem like "books", but in reality they were step-by-step instructions for anything you could ever want to do in Linux. No digging through forums, no combing through man pages, no following broken outdated blog posts that didn't explain what you were doing. I find it sad that these are seen as detrimental today.
Re:My First 10 Minutes on a Server by viraptor on Thursday June 16, 2016 @05:36AM (#11915020)
I feel like arch wiki is that thing today. It's a bit disorganised and things get outdated while nobody's looking, but there's almost anything you'd every want in there.
Re:My First 10 Minutes on a Server by peterwwillis on Thursday June 16, 2016 @11:05AM (#11916612)
It seems like there a bunch of articles there but they're more like notes on how to use a tool specifically with Arch, rather than a guide for everyone.

Compare this page http://www.tldp.org/HOWTO/Quota.html to this page https://wiki.archlinux.org/index.php/Disk_quota . TLDP organized HOWTOs like mini-books; tables of content, multiple authors, versioned releases, and of course, you could download them all and search through them by category. And they didn't assume things like the distribution setting up a bunch of the tools and system for you, so you learned how the tools actually worked.

Re:My First 10 Minutes on a Server by viraptor on Thursday June 16, 2016 @05:57PM (#11919184)
Sure, it's a different format. But you can always dig into man pages or other documentation to learn the details. Arch wiki is great for practical solutions - for example https://wiki.archlinux.org/index.php/HiDPI is the place to go to for hidpi display configuration. TLDP has not been seriously updated since hidpi even came out. Similar to https://wiki.archlinux.org/index.php/Power_management - there's no recent TLDP equivalent.

I appreciate TLDP for what it is and the details they go to. But Arch wiki can easily be read as a FAQ for all modern systems. And it will usually send you to other places for details (sometimes TLDP as well)

Re:My First 10 Minutes on a Server by wandering2 on Wednesday June 15, 2016 @04:21PM (#11911877)
So are they outdated now?
Re:My First 10 Minutes on a Server by Swannie on Thursday June 16, 2016 @08:43AM (#11915690)
A lot of the commands they documented have become obsolete or out of fashion.

E.g. Apache 1, BIND, sendmail, cgi-bin, ifconfig, etc.

Re:My First 10 Minutes on a Server by thrkw123456789 on Thursday June 16, 2016 @02:11AM (#11914338)
Check out the arch linux wiki.
Re:My First 10 Minutes on a Server by throwanem on Wednesday June 15, 2016 @11:53AM (#11910070)
The problem isn't that it's long; the problem is that it's not navigable - there needs to be a table of contents. There's great stuff in here, but it's hard to sort out what I already know how to do from what I can actually use.
Re:My First 10 Minutes on a Server by brokenwren on Wednesday June 15, 2016 @02:09PM (#11910902)
HTML version now has a TOC as well!
Re:My First 10 Minutes on a Server by JdeBP on Wednesday June 15, 2016 @12:09PM (#11910163)
There is a table of contents in the PDF version.
Re:My First 10 Minutes on a Server by throwanem on Wednesday June 15, 2016 @12:26PM (#11910274)
Yeah, but it's a PDF. Anyway, why can't you generate a TOC into the HTML version from whatever format you're actually authoring in? Good tooling support should make this not hard.

EDIT: And now the HTML version has a TOC, too! Talk about immediate gratification -- kudos to whoever did that!

Re:My First 10 Minutes on a Server by hendry on Thursday June 16, 2016 @02:08AM (#11914327)
I wrote a tool the other day to help create a Table of Contents https://github.com/kaihendry/toc
Re:My First 10 Minutes on a Server by robotdan on Wednesday June 15, 2016 @11:34AM (#11909934)
Agreed - it is a bit long. But if you want to set something up from top to bottom it may be worth it. Cool - I saw the link to Github as well, looks like there is code to do much of what the article outlines. Awesome.
Re:My First 10 Minutes on a Server by brokenwren on Wednesday June 15, 2016 @12:15PM (#11910200)
The hackthis application that is referenced in the guide is also in Github here:

https://github.com/inversoft/passport-js-example

It uses Ember, Node.js, Express, Sequelize, MySQL and Passport User Database (https://www.inversoft.com/products/user-database-sso).

Re:My First 10 Minutes on a Server by 0xmohit on Wednesday June 15, 2016 @11:49AM (#11910033)
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.
Re:My First 10 Minutes on a Server by kderbe on Wednesday June 15, 2016 @02:25PM (#11911018)
I don't know enough about server security to critique most of that guide, but the Password Security section is clearly behind the times:

> Passwords should always be hashed using a strong, one-way hash algorithm. [...] hashed with an algorithm like SHA-256 7 times.

If they had simply written "just use bcrypt" they'd be much closer to 2016-era security practices.

Re:My First 10 Minutes on a Server by brokenwren on Wednesday June 15, 2016 @03:17PM (#11911382)
BCrypt works fine, but I wouldn't say it is "2016-era security practices". It was written in 1999 and hasn't had as much scrutiny as SHA or Blowfish (although it is based on Blowfish).

Regardless, using a salted, multi-pass algorithm will keep everything nicely secured using nearly any hashing algorithm.

Remember the goal is not to crack one user's password using a brute force lookup table, it is to crack everyone's password.

Re:My First 10 Minutes on a Server by hyperpape on Wednesday June 15, 2016 @10:32PM (#11913556)
BCrypt is apparently just fine in 2016: https://news.ycombinator.com/item?id=11120528.
Re:My First 10 Minutes on a Server by wglb on Thursday June 16, 2016 @09:31AM (#11915920)
It is in fact a 2016-era good security practice.

And it is designed to prevent what your last sentence says.

Re:My First 10 Minutes on a Server by mkagenius on Wednesday June 15, 2016 @12:35PM (#11910334)
We are preparing one focussing on application development:

https://github.com/FallibleInc/security-guide-for-developers... (work in progress)

Re:My First 10 Minutes on a Server by abglassman on Wednesday June 15, 2016 @03:08PM (#11911312)
Great checklist.
Re:My First 10 Minutes on a Server by codelitt on Wednesday June 15, 2016 @11:27AM (#11909885)
Yes. We originally just put this together just as a primer for younger engineers to understand the basic steps. The guide you posted looks really good though. It looks like it covers some of the application side of things as well.
Re:My First 10 Minutes on a Server by robotdan on Wednesday June 15, 2016 @11:42AM (#11909987)
So many people get some of the most basic security wrong. It is great to see people trying to educate instead of just pointing out issues. Thanks for this work.
Re:My First 10 Minutes on a Server by brokenwren on Wednesday June 15, 2016 @12:00PM (#11910114)
I love the fail2ban part of your guide! I totally need to try that.
Re:My First 10 Minutes on a Server by tempVariable on Wednesday June 15, 2016 @01:42PM (#11910762)
That is great as well. Quite extensive.
Re:My First 10 Minutes on a Server by obitech on Thursday June 16, 2016 @01:46AM (#11914257)
Great guide!