this post was submitted on 22 Nov 2023
4 points (100.0% liked)

Homelab

371 readers
9 users here now

Rules

founded 11 months ago
MODERATORS
 

Started off by

  1. Enabling unattended updates
  2. Enable only ssh login with key
  3. Create user with sudo privileges
  4. Disable root login
  5. Enable ufw with necessary ports
  6. Disable ping
  7. Change ssh default port 21 to something else.

Got the ideas from networkchuck

Did this on the proxmox host as well as all VMs.

Any suggestions?

top 50 comments
sorted by: hot top controversial new old
[–] [email protected] 3 points 10 months ago (2 children)
  1. Don’t bother with disabling icmp. You’ll use it way more then it’s worth disabling, and something like nmap -Pn -p- X.X.X.0/24 will find all your servers anyways (same can be said for ssh and port 22. But moving that does stop some bots)

  2. As long as i go out not exposing anything the the global internet, you really don’t need a lot. The fire wall should already deny all inbound traffic.

The next step is monitoring. It's one thing to think your stuff is safe and locked down. It's another thing to know your stuff is safe. Something like Observium, Nagios, Zabbix, or otherwise is a great way to make sure everything stays up, as well as having insights into what everything it doing. Even Uptime Kuma is a good test. Then something like Wazuh to watch for security events and OpenVAS or Nessus, to look holes. I'd even though in CrowdSec for host based virus detection. (Warning, this will quickly send you down the rabbit hole of being a SOC analyst for your own home)

[–] [email protected] 2 points 10 months ago

Block outbound traffic too.

Open up just what you need.

Segment internally and restrict access. You don't need more than SSH to a Linux Server, or perhaps to it's web interface for an application running on it.

load more comments (1 replies)
[–] [email protected] 2 points 10 months ago

I watch networkchuck on occasion, but some of his ideas are... questionable I think. Not necessarily wrong, but not the "YOU MUST DO THIS" that his titles suggest (I get it, get clicks, no hate).

Of the ideas you mentioned, (2), (3), (4), and (5) are somewhere between "reasonable" and "definitely". The rest are either iffy (unattended updates) or security theater (disable ICMP, change ports).

Something to keep in mind for step (2), securing SSH login with a key: this is only as secure as your key. If your own machine, or any machine or service that stores your key, is compromised then your entire network is compromised. Granted, this is kind of obvious, but just making it clear.

As for security theater, specifically step (6). Don't disable ping. It adds nothing to security and makes it harder to troubleshoot. If I am an attacker in a position for ping to get to an internal resource in the first place, then I'm just going to listen for ARP broadcasts (on same subnet) or let an internal router do it for me ("request timed out" == host is there but not responding).

[–] [email protected] 2 points 10 months ago (1 children)

Don't expose anything to the outside world. If you do, use something like Cloudflare tunnels or Tailscale.

load more comments (1 replies)
[–] [email protected] 2 points 10 months ago

Take a look at CIS benchmarks and DoD STIGs. Many companies are starting to harden their infrastructure using these standards, depending on the requirements of the environment. Once you get the hang of it, then automate deployment. DO NOT blow in ALL of the rules at once. You WILL break shit. Every environment has security exceptions. If you’re running Active Directory, run Ping Castle and remediate any issues. Audit often, make sure everything is being monitored.

[–] [email protected] 2 points 10 months ago

Honestly, between the home lab being behind a RTR, NATed, patched & updated, and given the lack of users clicking on random crap and plugging in thumb drives from God Only Knows Where ... I'd go out on a limb and say it's already more secure than most PCs.

There's also no data besides what I already put on Medium and GitHub, so it's not a very attractive target.

[–] [email protected] 1 points 10 months ago (2 children)

automatic updates is a great strategy for breaking the system

[–] [email protected] 1 points 10 months ago

Some would argue that not having them, is a great strategy for breaking in the system :P

[–] [email protected] 1 points 10 months ago (1 children)

Automatic backups are great for recovering from broken updates lol

load more comments (1 replies)
[–] [email protected] 1 points 10 months ago

I use practical security measures that match my level of exposure and don't severely limit my convienience.

If your lab isn't exposed directly to the internet, at the very least update your servers from time to time, use a string root (admin users as well) password. That's more than enough.

If your lab is exposed, the same applies but update more often. Use SSH keys.

Don't go overboard - the majority of security incidents are from lack of basic security

[–] [email protected] 1 points 10 months ago (1 children)

Unattended updates are a recipe for trouble. I'd never enable that.

I have no public services apart from 2 OpenVPN servers. To access everything else I connect to one of the OpenVPNs and use the services through the VPN routings.

The VPN can only be accessed if you possess a cert and key. I could even implement 2fa but for now SSL auth works securely enough.

[–] [email protected] 1 points 10 months ago

I run unattended-upgrades on all the debian/ubuntu deployments I manage. One of the deployments even has automatic reboots enabled. I still do major upgrades by hand/terraform, but the process itself works flawless in my experience.

[–] [email protected] 1 points 10 months ago

My security is basically if they get past an updated opnsense firewall I could be highly inconvenienced, but everything irreplaceable is backed up in the cloud and offline in my basement.

[–] [email protected] 1 points 10 months ago

Filter incoming traffic from countries with malicious attacks :)

[–] [email protected] 1 points 10 months ago

Hosted reverse proxy and VPN servers. I have no open ports on my home network.

[–] [email protected] 1 points 10 months ago (2 children)
  1. Domain auth (1 place to set passwords and SSH keys), no root SSH
  2. SSH by key only
  3. Passworded sudo (last line of defence)
  4. Only open firewall hole is OpenVPN with security dialled up high
  5. VLANs - laptops segregated from servers
  6. Strict firewall rules between VLANs
  7. TLS on everything
  8. Daily update check alerts (no automatic updates, but persists until I deal with them)
  9. Separate isolated syslog server for audit trails
  10. Cold backups
load more comments (2 replies)
[–] [email protected] 1 points 10 months ago

UDM’s regular built in threat filtering, good firewall rules, updated services, and not opening up unnecessarily to the internet. And be vigilant but don’t worry too much about it. That’s it.

[–] [email protected] 1 points 10 months ago

My home lab and production network are separated by a firewall.

I have backups and plans to rebuild my lab, I actually do it regularly.

My labs do risky things, I get comfortable with those things before doing it in production.

[–] [email protected] 1 points 10 months ago

Armed guards at every entrance.

[–] [email protected] 1 points 10 months ago

Don't expose unnecessary things to the internet, keep any client PCs patched, use some sort of malware protection ... and that's all you need to do.

All these VLANs are such are just overkill unless you're actively exposing things to the internet. They wind up breaking really useful stuff, especially stuff that relies on multicast.

Besides, that Chinese IoT device can't get hacked if it's not open to the 'net in the first place.

[–] [email protected] 1 points 10 months ago

SSH shouldn’t be internet accessible Changing an SSH port won’t stop someone more than 15 seconds. Disabling ping is security through obscurity at best.

[–] [email protected] 1 points 10 months ago

Do not discount physical security, lock the doors to your house and get an enclosed rack that you can lock

[–] [email protected] 1 points 10 months ago
  1. Snort on perimeter inbound and outbound.
  2. ntopng on perimeter.
  3. Heavy VLAN segmentation. Like with like.
  4. Inter-VLAN ACLs on core switch. This is a stateless firewall. Some VLANs with certain device types have inbound and outbound. Trusted devices only have inbound.
  5. SPAN to Security Onion for all internal traffic.
  6. SNMPv3 monitoring on all devices.
  7. MAC Sticky on all camera ports because the cabling extends outside of the physical structure of the house. I am going to implement Dot1X at some point.
  8. VRFs for sensitive infrastructure to prevent outbound routing completely.
  9. A VRF for devices to be forced through an external VPN (Mullvad). Used for devices that do not support a VPN agent.
  10. No antivirus. All antivirus is a botnet.
  11. All server infrastructure is Devuan using OpenRC instead of systemd.
  12. Gaming PC is Artix.
  13. DNS blackhole.
  14. Public DNS is a Swiss no-logging provider which I use DoT to send my queries to.
  15. LibreWolf or Brave Browser on everything.
  16. Only hole into the network is a 4096 bit encrypted Wireguard instance operating in a container using an uncommon port. I wrote a custom script that can reach into the container and pull from the API in order to show active sessions, GeoIP, browser fingerprints, length of time the socket has been open, etc.
  17. I use geofencing for inbound connections to the Wireguard instance. I only allow my immediate area cellular ISPs IANA address spaces to touch my network. Same goes for the geographic area surrounding my parents house.
  18. Unattended updates using custom scripting for my servers, including rebuilding the Wireguard container every single night, updating the server, and I also fire Nessus at it every night. If in the morning there is a CVE of note on that server, the NAT rule allowing traffic to the VPN is disabled at the perimeter until a sufficient patch is released.
  19. I run STIGs on everything, within reason and where infrastructure allows, in my suite.
  20. LibreSSL over OpenSSL.
[–] [email protected] 1 points 10 months ago

set up vpn and disable ssh access from outside network

[–] [email protected] 1 points 10 months ago

Also consider TCP Wrappers (hosts.allow/hosts.deny) and DenyHosts/fail2ban.

[–] [email protected] 1 points 10 months ago (1 children)

By not opening anything to the wider internet.

load more comments (1 replies)
[–] [email protected] 1 points 10 months ago (5 children)

Enabling unattended updates -> Hell no. Regular Patchdays
Enable only ssh login with key -> yes
Create user with sudo privileges -> yes
Disable root login -> no
Enable ufw with necessary ports -> Basic iptables, but not on all hosts. But fail2ban
Disable ping -> nope
Change ssh default port 21 to something else. -> nope

load more comments (5 replies)
[–] [email protected] 1 points 10 months ago

If it's a Debian system, "Create user with sudo privileges" and "Disable root login" can be done during initial setup. Just leave the root password blank and it'll disable the root user and grant sudo permission to the regular user you create.

Create a separate management VLAN and use it for all your infra (web UIs of all your networking hardware, Proxmox, SSH for servers, etc).

For unattended upgrades, ensure the auto updaters are properly configured so they're used ONLY for bug and security fixes, nor for minor or major releases! Debian unattended-upgrades has good settings out-of-the-box but you may want to add any custom repos you're using. Make sure you have an email relay server configured in the Exim config, as it uses apt-listchanges to email the changelogs to you.

But above all, press the power button to turn it off and then never turn it on again. 100% unhackable.

[–] [email protected] 1 points 10 months ago

I just host a bunch of worthless stuff that no one wants.

[–] [email protected] 1 points 10 months ago

Non standard ports.

Ssh keys.

Web certificates.

[–] [email protected] 1 points 10 months ago

Disable ICMP? The network team sends their regards 🐴

[–] [email protected] 1 points 10 months ago

Opnsense firewall at perimeter...and that's about it. Chances of anything getting in with no exposed ports is pretty slim so I don't really bother with anything more.

For SSH exposed servers/VPS I do change the port though. Cut down log noise & maybe dodge the odd portscanner or two

[–] [email protected] 1 points 10 months ago

Easy, i keep it up to date, i have nothing exposed to the internet, and i lock the door :)

[–] [email protected] 1 points 10 months ago

Lock and key, shotgun by the door

[–] [email protected] 1 points 10 months ago

Disable root login covers 99.9999 percent of it, as long as your box has only one or two obscure login accounts.

[–] [email protected] 1 points 10 months ago

Tailscale, expose nothing to the wider web if not actually needed.

[–] [email protected] 1 points 10 months ago

Is there really any security benefit to not using default ports? Especially if the service is not open externally? I cannot find any official documentation that states you should be doing that.

[–] [email protected] 1 points 10 months ago

Anything that faces the internet I have on a separate vlan. Each system on that vlan is treated as if it was facing the internet directly, that way if one of them gets compromised the hacker will not get far trying to get into any other machines.

Rest of my network is a little more tame just for ease of access since it's only me on here.

Although at some point I do want to revisit my security protocol even locally, just in case. Hitting some kind of drive by trojan script or something within the browser is always a possibility, it could work in reverse where it connects to an external server and then accesses the rest of the network that way. I'm not aware of such trojans but I'm sure it's possible.

I do block all outbound ports except for base internet ports but a properly written malicious script would probably take that into account and use a common port like 443.

At some point I might setup a honeypot. Just need to name the VM "cryptowallet" or something like that and it would be a very fast target. If access to it is detected it would alert me and shut off the internet.

[–] [email protected] 1 points 10 months ago

I know this is a feature in Unifi, but disabling access from countries with know bot farms (China, India) etc.
Unless you need access to them.

[–] [email protected] 1 points 10 months ago

Honestly I just use a good firewall and forward_auth/authelia in caddy (so authentication happens before any apps) and it works well.

I also don't expose SSH to the public internet anymore (more laziness than anything, have it semi-exposed in yggdrasil and wireguard) (mostly because the SSH logs get annoying for journalctl -f)

[–] [email protected] 1 points 10 months ago

Cloudflare and whitelist CF ips, they publish a file

This is ofc to redirect the traffic the services that are on the cloud.

And those services reside on a separate VLAN and have their own reverse proxy on their own VM/docker whatever.

[–] [email protected] 1 points 10 months ago

Only expose applications to the Internet if you have a good need to. Otherwise, use a VPN to access your home network and get to your applications that way.

If you are exposing them to the internet, take precautions. Use a reverse proxy. Use 2FA if the app supports it. Always use good, long passwords. Login as a limited user whenever possible, and disable admin users for services whenever possible. Consider an alternative solution for authentication, like Authentik. Consider using Fail2ban or Crowdsec to help mitigate the risks of brute force attacks or attacks by known bad actors. Consider the use of Cloudflare tunnels (there are plusses and minuses) to help mitigate the risk of DDOS attacks or to implement other security enhancements that can sit in front of the service.

What might be a good reason for exposing an application to the Internet? Perhaps you want to make it available to multiple people who you don't expect to all install VPN clients. Perhaps you want to use it from devices where you can't install one yourself, like a work desktop. This is why my Nextcloud and Calibre Web installs, plus an instance of Immich I'm test-driving, are reachable online.

But if the application only needs to be accessed by you, with devices you control, use a VPN. There are a number of ways to do this. I run a Wireguard server directly on my router, and it only took a few clicks to enable and configure in tandem with the router company's DDNS service. Tailscale makes VPN setup very easy with minimal setup as well. My NAS administration has no reason to be accessible over the internet. Neither does my Portainer instance. Or any device on my network I might want to SSH into. For all of that, I connect with the VPN first, and then connect to the service.

[–] [email protected] 1 points 10 months ago

Well your host management interfaces shouldn't be exposed to the internet. Use a VPN if you need to access it remotely.

[–] [email protected] 1 points 10 months ago

With a leash. She is very hyper.

[–] [email protected] 1 points 10 months ago

Hopes and prayers

[–] [email protected] 1 points 10 months ago

Originally I'd change the SSH port, obviously only allow pubkey based auth.

Now however, I do everything over wireguard. Every device has Wireguard Access and depending on that different rules what they can access.

load more comments
view more: next ›