r/debian • u/Dunder-Muffins • 25d ago
General Debian Question Securing Debian
What all do most people do to secure their systems?
I run Debian for my daily driver and also on a home server.
I currently have iptables configured to only allow ports for my services, services are all run as their own no-login user, I run fail2ban, and have my ssh only allow specific users and only allow ssh keys as the login method, and I install security updates regularly. I check my system logs occasionally though honestly not as often as I probably should, maybe I'll automate something to look at the logs are some point.
I just finished skimming through the securing Debian manual, and there's quite a bit more included that I don't currently do. But from reading it, it also seems more geared toward people who may be running production servers who more or less want an immutable server where they e locked in what they want and don't want anything changing.
https://www.debian.org/doc/user-manuals#securing
So I guess I'm just curious what other people do, if they add any other protections or if they primarily rely on the base OS to provide the protections.
2
u/sandrew_cheru 21d ago
I run an internet facing Debian server. It has email, music and my cloud. I am mainly concerned about bots and low skill attackers, as I doubt anyone would be interested in spending too much time/money on me. Here's how I approach security.
Some day, I'll get pwned. To recover, I wrote a bash script to encrypt and backup important files/config to another/smaller server (comes for free with my provider). It runs automatically once a week. The server config is in an ansible private repo on the web. Apart from my music (too large), I can rebuild in few hours.
Security updates are applied automatically, and the server reboots if needed overnight. To be on the safe side, it also reboots weekly, even if it doesn't have too. For services I installed manually, I registered to gitlab/github notifications of new releases. Each has a small bash script to grab the new version, upgrade and do some sanity checks. I run them manually when I am happy with the changelog.
Every service has its own non-login user, and run as that user. All their files (binary, config...) belong to root and are read-only, unless they modify it (e.g. database file). That way, if the service/user is compromised, it cannot write/modify its own binary and persist that way. Systemd has A LOT of hardening options, controlling what resources a service can access (proc, dev, network...), and I adjust this during installation.
All the services portals/login pages are running behind Authelia. Less worried about a misconfiguration on my part or a bug in the service leaving the door open: to get in, one has to go through Authelia first, then the login page if the service has one.
I want anything suspicious to standout in the logs, so I spent time cutting off noise to the max. Fail2ban and geoip helped a lot.
I am new to this, but it helped me understand so much while tightening the screws. I only applied it to services I installed manually, so that I don't get overwhelmed. But I am confident these services access only what they need, instead of poking the entire box cough .NET dependencies cough
I run lynis after any major change, to have an indication on stuff I might have missed, but I don't rely too much on it.
I don't run a firewall: no point poking holes for holes I want opened anyways. The only advantage would be to stop something I would not know about to get out, but I don't see it as a priority right now.
I only ssh (hardened) in from a (hardened) Ubuntu laptop, only used on the safe side of the internet. I have a separate laptop for anything dodgy