When you spin up a fresh public Linux instance, automated scanners start knocking on your doors within milliseconds.
It doesn’t take much to get locked down properly, but missing a few basics can leave you exposed.
I’ve put together a straightforward guide covering the essential hardening steps from UFW and SSH key-only auth to secure Docker bindings and automated maintenance.
Original content by The Unknown Universe, written by a human and not AI generated!



Apples, Onions, Chocolate Mousse, I’d rather have any of them inside a bomb-proof safe.
I’m gonna go out on a limb here and liken the encrypted shell access that requires an additional secret just to have one’s password considered closer to the bombproof safe than to a food item.
A metaphor is nice but actually completing it is what puts it above mere allusion.
I’m gonna go out on a limb here and liken the encrypted shell access that requires an additional secret to two secrets written on a sticky note instead of one…
Are you now making an argument against password ssh or against obscurity altogether?
If it’s the former I’m on your side. Key ssh with passwords turned off defeated the recent asterisk mess if anyone was unfortunate enough to be relying on musl ssh.
Sorry, that last comment was rushed and just reacting to the philosophy of “let’s just throw another password around it.”
My real/main point is about root (sudo) access vs “unprivileged” users. In my experience, sudo is like putting up a (thin) glass window on a house, it’s a great way to communicate to gentle-folk that they are not supposed to come in, the door is locked, but they can still look inside (read access), and if they don’t mind making a mess they can certainly smash the window to bypass the lock, or if the window is too strong for them to break they can more easily burn the whole house down. A sudo locked door might make it necessary to have unusual lock picking skills if you’re going to sneak in, rearrange the furniture, then leave without everyone knowing that things have been messed with on first glance, but it’s not going to stop a DDOS from succeeding. The typical “non-privileged” user with command line access can easily trash most systems into a non-functional state, shortly after exporting most data of any value.
Then (different, but related rant): all of the “physical access to the device required” attack hardenings are of little help preventing these kind of attacks: https://www.infosecinstitute.com/resources/general-security/usb-killer-how-to-protect-your-devices/
Systems need good physical security first, and then they need serious least-privilege protection against ALL users, not just those who can get root access. Access to a general purpose terminal, even without root privilege, is more privilege than any untrusted user should ever have.
Yeah the Unix permissions model is insecure, acls have been around forever to deal with that.
No one is suggesting to just force people to use sudo as a security measure. What I said was that using a nonstandard admin user account with other accounts disallowed from ssh access will prevent lots of intrusions because people are generally just running credential spam attacks and your weird admin account isn’t in them.
Seriously look at your logs, it’s all generic well known accounts on port 22. You could prevent doorknob jigglers from getting in just by switching to a high port, disallowing all but one weird admin user and doing key as opposed to password. Fail2ban isn’t even really needed at that point and neither is port knocking.
A user may be able to do a lot of damage (less with layered security or defense in depth) but the real benefit of sudo is that aside from being unlucky enough to be using musl ssh, asterisk root lets you be incredibly obscure and that does a lot to keep the rabble out.
A while back I remembered the “would that end racism? Would that end sexism?” moment and I think a lot of your comment strays close to that territory. Ddos attacks are generally not the purview of how system administration is conducted, they are handled by cdns and infrastructure. Physical security is not the top priority of most server administrators (not because it isn’t important but because a vps in a container on a hypervisor running on a server in a rack in a datacenter with locks and cameras all around is in a much different situation than your laptop while you use the Starbucks bathroom, to be 100% clear).
I agree: non-standard everything prevents standard attacks, the non-standard username effectively becomes yet another password - a password that’s likely not too hard to discover, but certainly more work for the attack script than “root”. Same goes for non-standard ports, port knocking protocols, etc. etc. Every one of those things is just one more layer of thing that is probably not too hard to find if you’re specifically attacking the system, but certainly slows down standard sweeps. 20 years ago, you could effectively “secure” an open FTP site just by moving it off of port 21 to something random and too costly to scan for - security through obscurity works, or maybe worked before we had AI bots to untangle all the obscure stuff.
The core problem of basically all true cryptographically secure solutions is: key management. Focus your system administration design on use of strong keys, focus on strong key management, that’s true security. All the onion layers of obscurity are like hiding the key in the third flowerpot under the plastic plant pot inside the terracotta container inside a black plastic sleeve. Of course: real key management is hard, rotating the key hiding place between the third flowerpot and behind the wall hanging is something any sys admin can do.
Yes and no. Of course an easy solution is easy and getting the easy stuff out of the way is the point of whatever shake a dead chicken ritual script you scp over and run on new deployments.
Doing the hard stuff doesn’t make doing the easy stuff less worthwhile.
I would also like to make clear that with nonstandard logins and ports, restricted ssh, key ssh and fail2ban you essentially don’t have attack surface. What are they gonna do, use a residential proxy network to spread attempts across 100k ips to figure out your port and login (if you’re just using some tla greybeard larp username) before they start running key attacks against you? No. They’re gonna go mess with something else where the service gives them something quick and easy to feed to antifox to get a win.
Just because you ought to be able to put the keys to the castle in a perfectly cryptographically secure glass case on a pedestal lit up by a spotlight next to the gate with a sign next to it that says “these are the keys to everything” doesn’t mean you should.
If security through obscurity didn’t work then we wouldn’t be seeing 69 million obscure bugs that are all old enough to drive being discovered by ai.
As I understand it, the clever kids can spoof IPs without that…
yes: because easier with value is still out there. LLM crafted chained attacks just made all sorts of things MUCH easier. The same arguments still work in the physical world for domestic dogs (until the perp just tranqs/poisons the dogs) intrustion alarm systems etc. Easy as they are to defeat, it’s easier still to pick the lower hanging fruit - while there still is any.
No, of course not - do the onion, it discourages a lot of attackers. Don’t think for one second that the onion can’t/won’t be peeled. Ideally, the hard crypto lives in a middle layer where you can detect the peeling of the outer layers, because hard crypto shouldn’t fail on short timescales (like the heat death of the universe, in theory) and obscure inner layers just might thwart that quantum attack when it comes.
And AI is effectively that quantum threat made real for obscurity, I predict long before true cryptography falls to any real attacks AI will be obsoleting a lot of the security through obscurity.
Final point about key management - ultimately, somebody somewhere has to hold the secret securely. Same goes for obscurity protocols - if you ever lose the protocols, you’re just as screwed as losing your final trusted key. Those protocols have to be shared with anyone accessing the system, there’s your “key management” for obscurity, and it’s ad hoc - unproven, ususally unreviewed, and doubtlessly duplicated many times around the world no matter how obscure or random you think your protocols are, your management of them (sharing them with people who need to know them) is not going to be very obscure by comparison.
And, by the way, thanks for the discussion - I’m usually more on your side when having this argument at work and you’ve prompted me to find fwknop which is the kind of tool I might advocate for if anyone ever lets our department design a security protocol ever again: corpos are standardizing everything, which I predict is going to lead to a significant breach in the not-too-distant future, but it won’t be “our fault” for following the top-down advice. Hopefully I can still wedge some obscure things like fwknop as our “optional, additional layers” for our specific products so that we don’t fall when the rest of the company does.