Changing the port seems like a pointless step, just disallow access from everywhere and allow only from select IPs. Port scanners will scan all open ports and will detect that it's ssh, regardless of port number.
Selfhosted
A place to share alternatives to popular online services that can be self-hosted without giving up privacy or locking you into a service you don't control.
Rules:
-
Be civil: we're here to support and learn from one another. Insults won't be tolerated. Flame wars are frowned upon.
-
No spam posting.
-
Posts have to be centered around self-hosting. There are other communities for discussing hardware or home computing. If it's not obvious why your post topic revolves around selfhosting, please include details to make it clear.
-
Don't duplicate the full text of your blog or github here. Just post the link for folks to click.
-
Submission headline should match the article title (don’t cherry-pick information from the title to fit your agenda).
-
No trolling.
Resources:
- selfh.st Newsletter and index of selfhosted software and apps
- awesome-selfhosted software
- awesome-sysadmin resources
- Self-Hosted Podcast from Jupiter Broadcasting
Any issues on the community? Report it using the report flag.
Questions? DM the mods!
Agreed. Security through obscurity is a fallacy.
If OP just wants to use it himself, a good idea might be to setup a VPN service and only allow the other services to be used from the VPN. That can be done with wire guard and a reverse proxy for example.
While I do completely agree, changing ports is more about getting rid of low-hanging fruit so some script kiddie doesn't get into 22. But again I do agree with everything you said.
Just firewall the port and there's no difference for your hypothetical script kiddies. Don't ever do security by obscurity.
Of you have Skript kiddies logging in successfully on 22, you have way different problems.
Of course, changing a port number is not a good security improvement even in the realm of security through obscurity.
Changing the default port isn’t any more secure, but you’ll cut down on access attempts which will take some load off of your VM. It’s something that could be worth doing if you’re running a very cheap VPS.
It's well worth it for this reason alone. Unless you're running a honeypot, getting that noise out of your access logs can provide more actionable data to work with for more persistent threats.
Maybe try out FreedomBox? freedombox
is a Debian package which automatically sets up apache2
, firewalld
, fail2ban
and Letʼs Encrypt. It also automatically adds pre-canned configuration files for applications you install with it (e.g. Mediawiki, WordPress, Matrix, Postfix/Dovecot). The theoretical goal of FreedomBox is to allow anyone to set up a webserver and administer it via a webUI. So, although I would say itʼs not quite there yet for command-line-illiterate users, I have found the software useful as a turnkey server to see what makes certain web applications tick, albeït in mostly vanilla form.
For example, after installing a new app like WordPress, you could examine what exactly the FreedomBox scripts changed in the /etc/apache2/
or /etc/fail2ban/
configuration files.
You could try zerotier and only allow access from your ZT IPs. Thats how I set mine up, along with pointing cloudflare etc at it as well
Look into hardening measures implemented by https://github.com/dev-sec/ansible-collection-hardening/
I recommended reading through each role and decide which measures you want to implement (and port them to you own management system if you don't use ansible)
Your plan is solid. The important thing is that you configure those things correctly, but you’re following guides so that should be ok. It’s on a VPS so there’s no threat to your home network, and none of those services pose a significant risk to you even if they were compromised so there’s no reason to go overboard.
If I had any further advice to give it’d be:
-
Change any default usernames and passwords that any of your apps/databases use.
-
Use randomly generated passwords for all service accounts. So that if you do find yourself compromised, they don’t then know a password that you’ve reused somewhere else (like your email account).
-
Run those services using something like Docker with no access to each other.
-
Utilize your VPS provider’s cloud firewall if they have one. If you’re paying for a cheap VM, it shouldn’t need to deal with all the general firewalling from the internet. VPS providers often have free cloud firewalls you can offload that work to.
Docker is the way to go. More often than not self-hosted stuff already has docker instructions, and by design it doesn’t mount your entire drive or give access to really anything on your system unless defined explicitly, even networks are isolated iirc. OP, get educated on what docker is and what flags it has so you can easily see what has access to what before even spinning something up.
In addition to what you mentioned, setup logcheck to email you unexpected logs. It does require a bit of time and fine tuning to make it ignore expected logs, but in terms of security measures it's very powerful. I get an email every time I log in, incorrectly type my sudo password, etc. Sounds very verbose, but it also means it's verbose when something unexpected is happening which is what you want security-wise. A nice side effect of having to craft the regexes of what logs to ignore is that I know better what's running on my server :)