Other than to learn how, which is also why I'd provide text on how and now a bash script to just do it. Not everyone's needs are the exact same, and it's better to learn how to fish than be handed a line with one hooked. Maybe I have a strong reason not to go SSH keys only? I should at least understand how they work and why they're important so I can make the decision, wrong as many people think it may be.
Ideally the server comes up and applies chef, doing the needful to secure it. Hand-cooking a server is extremely painful.
We'll release an Ansible Playbook over the next week or so that follows these steps.
- https://github.com/openstack/openstack-ansible-security
- https://github.com/geerlingguy/ansible-role-securityI'm a security guy, so it would be embarrassing and possibly bad for my career if any of my servers got hacked, but I actually don't set up servers that often--it's not part of my job. These Web 2.0 configuration management solutions change pretty fast and don't care about reverse compatibility. So between my infrequent setups my configuration scripts pretty much always break.
Contrast this with bash, which cares a whole lot about reverse compatibility, and it's a no brainer. I've got scripts where the only modifications I've made since 2005 were to add functionality or increase security, never to fix existing functionality that was broken by a change to the system. I'll take that over Chef or Ansible (both tools I've used) any day.
Here is Ansible playbook I recently created https://github.com/chhantyal/5minutes
It's one of those cases where a tutorial explaining every change you're making and why you're making it really is pretty important.
As a side note, it's also sometimes better having a tutorial full of manual steps as that helps educate the "sysadmin" regarding best practices and some of the basics of Linux administration (if they weren't already familiar). That experience can be just as valuable as hardening the server itself.
You should really automate this process if you create more than one server, ever. It's fairly easy to get the basics, and if you don't automate it, I guarantee you'll miss one or more steps in the setup.
That said, if you do such things at scale, you'll likely have automated provisioning and configuration management systems in place anyway.
For example you could have images that have the static parts already pre-configured, and something like cloudinit for the ssh keys and/or passwords.
Or you provision the systems with foreman, and then use puppet for configuration management.
I think scripting all of this is great - but also agree that it is important to understand what is being performed.
It would run through a series of questions about your use case to build a security policy, and then edit config files for you.
The problem is that it needs to be aware of all the different flavors of Linux it might be running on, so it's naturally fragile and requires lots of maintenance. Sadly, it hasn't been updated in a few years.
It's good to know what's going on under the hood.
su -
curl -sS https://some.random.host/trust-me.sh | bash -
What could go wrong?(Because why in the world would anyone want to type in things by hand? Laziness for any repetetive manual labor is a greatest virtue of any good sysadmin.)