selfhosted

This magazine is from a federated server and may be incomplete. Browse more on the original instance.

kureta, in Self hosted photo library with S3

You can use docker, mount s3 as a volume and use immich.

Atemu, in The "safest" way of self hosting
@Atemu@lemmy.ml avatar

One “hammer” mitigation to most threats could conceivably face when self-hosting is to never expose your services to the internet using a firewall. “Securing” your services against a small circle of guests/friends/family members in your home network is a lot simpler than securing against the entire world.
If you need to access your services remotely, there are ways to achieve that without permanently opening a single port to the internet such as Tailscale or ZeroTier.

Otherwise, commonly used tools in self-hosting such as Docker or VMs usually offer quite decent separation even if a service is compromised.

Nothing replaces good security hygiene though. Keep your stuff up-to-date. Use secure methods of authentication such as hard to guess passwords or better. Make frequent backups (3-2-1). The usual.

mholiv, in Encrypted fileshares in the local network?

NFS over WireGuard is probably going to be the best when it comes to encrypted file shares without the need to set up Kerberos. Just set up the WireGuard tunnel and export over those ips.

1984,
@1984@lemmy.today avatar

I never thought of using nfs over wireguard. Very nice.

MigratingtoLemmy,

This is a pretty good idea. Thanks

mholiv,

No problem. It should be wayyy faster than sshfs for the record. Both NFS and WireGuard are best in class tools.

MigratingtoLemmy,

That is wonderful to know

brewery, in SSO with automatic user creation

I found that it really depends on the app and how they’ve set it up. For the vast majority, the users in your SSO will be added to the other app when they first login. I use Authentik and Nextdoor, and the user is automatically created from details from Authentik. Generally you can enable multiple login types so can play with SSO whilst still enabling access until it works. You can usually switch off non-SSO access afterwards too.

You set which field defines the user (e.g. username or email). If there is already a user then it’ll just login to that account you already created, so you can also create a user in both.

You can limit access to certain groups of users in Authentik. You can also setup headers that get passed along to apps (e.g. in Nextcloud you can setup a size limit for each group that gets passed on to Nextcloud when they first register - the Authentik or Nextcloud documentation tells you how).

I found quite a few apps don’t have SSO functionality, and I usually end up doing a reverse proxy pass through Authentik. Nginx Proxy Manager first goes to Authentik, you login then it’ll pass you to the app. If already logged into Authentik, NPM takes you directly to the app. I switched off login altogether on the apps, especially for tools where you don’t need users (e.g. Stirling PDF). Only logged users get to the app. Authentik can forward any headers you set so I have a feeling you can use it for the app’s own login (though not new users) but not managed to work it out.

One app I tried recently had SSO but you couldn’t enable access to the main household for new SSO users so had to create an account in the app first, then SSO would let users login. I ended up not using that app for other reasons anyway.

I do recommend Authentik and you can setup access one by one so definitely try it and see.

iAvicenna, in Does anyone else harvest the magnets and platters from old drives as a monument to selfhosting history?
@iAvicenna@lemmy.world avatar

Now I am feeling sorry I did not…

TCB13, (edited ) in The "safest" way of self hosting
@TCB13@lemmy.world avatar

Your basic requirements are:

  • Some kind of domain / subdomain payed or free;
  • Preferably Home ISP that has provides public IP addresses - no CGNAT BS;
  • Ideally a static IP at home, but you can do just fine with a dynamic DNS service such as freedns.afraid.org.

Quick setup guide and checklist:

  1. Create your subdomain for the dynamic DNS service freedns.afraid.org and install the daemon on the server - will update your domain with your dynamic IP when it changes;
  2. List what ports you need remote access to;
  3. Isolate the server from your main network as much as possible. If possible have then on a different public IP either using a VLAN or better yet with an entire physical network just for that - avoids VLAN hopping attacks and DDoS attacks to the server that will also take your internet down;
  4. If you’re using VLANs then configure your switch properly. Decent switches allows you to restrict the WebUI to a certain VLAN / physical port - this will make sure if your server is hacked they won’t be able to access the Switch’s UI and reconfigure their own port to access the entire network. Note that cheap TP-Link switches usually don’t have a way to specify this;
  5. Configure your ISP router to assign a static local IP to the server and port forward what’s supposed to be exposed to the internet to the server;
  6. Only expose required services (nginx, game server, program x) to the Internet us. Everything else such as SSH, configuration interfaces and whatnot can be moved to another private network and/or a WireGuard VPN you can connect to when you want to manage the server;
  7. Use custom ports with 5 digits for everything - something like 23901 (up to 65535) to make your service(s) harder to find;
  8. Disable IPv6? Might be easier than dealing with a dual stack firewall and/or other complexities;
  9. Use nftables / iptables / another firewall and set it to drop everything but those ports you need for services and management VPN access to work - 10 minute guide;
  10. Configure nftables to only allow traffic coming from public IP addresses (IPs outside your home network IP / VPN range) to the Wireguard or required services port - this will protect your server if by some mistake the router starts forwarding more traffic from the internet to the server than it should;
  11. Configure nftables to restrict what countries are allowed to access your server. Most likely you only need to allow incoming connections from your country and more details here.

Realistically speaking if you’re doing this just for a few friends why not require them to access the server through WireGuard VPN? This will reduce the risk a LOT and won’t probably impact the performance. Here a decent setup guide and you might use this GUI to add/remove clients easily.

Don’t be afraid to expose the Wireguard port because if someone tried to connect and they don’t authenticate with the right key the server will silently drop the packets.

Now if your ISP doesn’t provide you with a public IP / port forwarding abilities you may want to read this in order to find why you should avoid Cloudflare tunnels and how to setup and alternative / more private solution.

USSEthernet, in Does anyone else harvest the magnets and platters from old drives as a monument to selfhosting history?

Both of my autistic kids love magents. I will pull them from old drives, car/pc speakers, or anything else that has them.

MP3Martin, (edited ) in Question: Best UI to manage VMs and containers?
@MP3Martin@programming.dev avatar

I don’t think it can natively do VMs but I’m using CapRover to deploy Docker images on my server

AngryCommieKender, in Does anyone else harvest the magnets and platters from old drives as a monument to selfhosting history?

I thought you made a custom thermos bottle at first

kamen,

Same.

BearOfaTime, (edited ) in How to access traefik hostnames from tailscale clients

I assume when you say externally you mean via Tailscale, but without running Tailscale on each container/service?

What I currently do is run Tailscale on a few workstation-type devices, but everything else in my network doesn’t run the Tailscale client (partly because things like printers, outers, etc can’t run the client, and it’s less convenient for things like servers).

Those type of devices can be accessed by running one Tailscale node as a Subnet Router. This device is then able to route traffic to it’s subnet. Currently I use a Raspberry Pi for this.

My Pi also runs PiHole and acts as my DNS server, so it can name resolve local resources, though I don’t think this is required, because Tailscale has its own DNS resolution called Magic DNS. So your Subnet Router should be able to resolve those names anyway (going off memory here, so be sure to check the docs, I may be misremembering how it works since I use the same device for DNS).

You don’t even need Tailscale on a remote device to access your LAN - if you enable the Funnel service, you can provide an inbound encrypted path to specified resources.

WASTECH,
@WASTECH@lemmy.world avatar

That is almost the exact same thing I am doing. I have 2 Pi’s running PiHole in HA and I just made one of them the subnet router to allow this access. Since I will be the only one using this, I don’t care to use Funnel right now, but thanks for showing that to me. I am (obviously) new to using Tailscale, and that looks like a very neat feature.

genie, in The "safest" way of self hosting

I’ll assume you mean what I mean when I say I want to be safe with my self hosting – that is, “safe” but also easily accessible enough that my friends/family don’t balk the first time they try to log in or reset their password. There are all kinds of strategies you can use to protect your data, but I’ll cover the few that I find to be reasonable.

  1. Port Forwarding – as someone mentioned already, port forwarding raw internet traffic to a server is probably a bad idea based on the information given. Especially since it isn’t strictly necessary.
  2. Consumer Grade Tunnel Services – I’m sure there are others, but cloudflare tunnels can be a safer option of exposing a service to the public internet.
  3. Personal VPN (my pick) – if your number of users is small, it may be easiest to set up a private VPN. This has the added benefit of making things like PiHole available to all of your devices wherever you go. Popular options include Tailscale (easiest, but relies on trusting Tailscale) or Wireguard/OpenVPN (bare bones with excellent documentation). I think there are similar options to tailscale through NordVPN (and probably others), where it “magically” handles connecting your devices but then you face a ~5 device limit.

With Wireguard or OpenVPN you may ask: “How do I do that without opening a port? You just said that was a bad idea!” Well, the best way that I have come up with is to use a VPS (providers include Digital Ocean, Linode to name a few) where you typically get a public IP address for free (as in free beer). You still have a public port open in your virtual private network, but it’s an acceptable risk (in my mind, for my threat model) given it’s on a machine that you don’t own or care about. You can wipe that VPS machine any time you want, the cost is time.

It’s all a trade-off. You can go to much further lengths than I’ve described here to be “safer” but this is the threshold that I’ve found to be easy and Good Enough for Me™.

If I were starting over I would start with Tailscale and work up from there. There are many many good options and only you can decide which one is best for your situation!

atzanteol, (edited )

Port Forwarding – as someone mentioned already, port forwarding raw internet traffic to a server is probably a bad idea based on the information given. Especially since it isn’t strictly necessary.

I don’t mean to take issue with you specifically, but I see this stated in this community a lot.

For newbies I can agree with the sentiment “generally” - but this community seems to have gotten into some weird cargo-cult style thinking about this. “Port forwarding” is not a bad idea end of discussion. It’s a bad idea to expose a service if you haven’t taken any security precautions for on a system that is not being maintained. But exposing a wireguard service on a system which you keep up-to-date is not inherently a bad thing. Bonus points if VPN is all it does and has restricted local accounts.

In fact of all the services homegamers talk about running in their homelab wireguard is one of the safest to expose to the internet. It has no “well-known port” so it’s difficult to scan for. It uses UDP which is also difficult to scan for. It has great community support so there will be security patches. It’s very difficult to configure in an insecure way (I can’t even think of how one can). And it requires public/private key auth rather than allowing user-generated passwords. They don’t even allow you to pick insecure encryption algorithms like other VPNs do. It’s a great choice for a home VPN.

genie,

You make a great point. I really shouldn’t contribute to the boogeyman-ification of port forwarding.

I certainly agree there is nothing inherently wrong or dangerous with port forwarding in and of itself. It’s like saying a hammer is bad. Not true in the slightest! A newbie swinging it around like there’s no tomorrow might smack their fingers a few times, but that’s no fault of hammer :)

Port forwarding is a tool, and is great/necessary for many jobs. For my use case I love that Wireguard offers a great alternative that: completes my goal, forces the use of keys, and makes it easy to do so.

atzanteol,

Glad you didn’t take my comment as being “aggressive” since it certainly wasn’t meant to be. :-)

Wireguard is a game-changer to me. Any other VPN I’ve tried to setup makes the user make too many decisions that require a fair amount of knowledge. Just by making good decisions on your behalf and simplifying the configuration they’ve done a great job of helping to secure the internet. An often overlooked piece of security is that “making it easier to do something the right way is good for security.”

genie,

Right!! Just like anything there’s a trade-off.

Glad you phrased the well-intentioned (and fair) critique in a kind way! I love it when there’s good discourse around these topics

atzanteol, (edited ) in The "safest" way of self hosting

You’re going to get a lot of bad or basic advice with no reasoning (use a firewall) in here… And as you surmised this is a very big topic and you haven’t provided a lot of context about what you intend to do. I don’t have any specific links, but I do have some advice for you:

First - keep in mind that security is a process not a thing. 90% of your security will come from being diligent about applying patches, keeping software up-to-date, and paying attention to security news. If you’re not willing to apply regular patches then don’t expose anything to the internet. There are automated systems that simply scan for known vulnerabilities on the internet. Self-hosting is NOT “set it and forget it”. Figuring out ways to automate this help make it easy to do and thus more likely to be done. Checkout things like Ansible for that.

Second is good authentication hygiene. Choose good passwords. Better yet long passphrases. Or enable MFA and other additional protections. And BE SURE TO CHANGE ANY DEFAULT PASSWORDS for software you setup. Often there is some default ‘admin’ user.

Beyond that your approach is"security in depth" - you take a layered approach to security understanding what your exposure is and what will happen should one of your services / systems be hacked.

Examples of security in depth:

  • Proper firewalling will ensure that you don’t accidentally expose services you don’t intend to expose (adds a layer of protection). Sometimes there are services running that you didn’t expect.
  • Use things like “fail2ban” that will add IP addresses to temporary blocklists if they start trying user/passwords that don’t work. This could catch a bot from finding that “admin/password” user on your Nextcloud server that you haven’t changed yet…

Minimize your attack surface area. If it doesn’t need to be exposed to the internet then don’t expose it. VPNs can help with the “I want to connect to my home server while I’m away” problem and are easy to setup (tailscale and wireguard being two popular options). If your service needs to be “public” to the internet understand that this is a bigger step and that everything here should be taken more seriously.

Minimize your exposure. Think though the question of “if a malicious person got this password what would happen and how would I handle it?” Would they have access to files from other services running on the same server (having separation between services can help with this)? Would they have access to unencrypted files with sensitive data? It’s all theoretical, until it isn’t…

If you do expose services to the internet monitor your logs to see if there is anything “unusual” happening. Be prepared to see lots of bots attempting to hack services. It may be scary at first, but relatively harmless if you’ve followed the above recommendations. “Failed logins” by the thousands are fine. fail2ban can help cut that down a bit though.

Overall I’d say start small and start “internal” (nothing exposed to the internet). Get through a few update/upgrade cycles to see how things go. And ask questions! Especially about any specific services and how to deploy them securely. Some are more risky than others.

thelittleblackbird,

Best answer to your question, try to stick to it

Nester,

Wow, thank you so much for taking the time to answer. I really do appreciate it.

Going off of what you said, I am going to take what I currently have, scale it back, and attempt to get more separation between services.

Again, thank you!

atzanteol,

Happy to help.

Going off of what you said, I am going to take what I currently have, scale it back, and attempt to get more separation between services.

Containerization and virtualization can help with the separation of services - especially in an environment where you can’t throw hardware at the problem. Containers like Docker/podman and LXD/LXC aren’t “perfect” (isolation-wise) but do provide a layer of isolation between things that run in the container and the host (as well as other services). A compromised service would still need to find a way out of the container (adding a layer of protection). But they still all share the same physical resources and kernel so any vulnerabilities in the kernel would potentially be vulnerable (keep your systems up-to-date). A full VM like VirtualBox or VMWare will provide greater separation at the cost of using more resources.

Docker’s isolation is generally “good enough” for the most part though. Your aggressors are more likely to be bot nets scanning for low-hanging fruit (poorly configured services, known exploits, default admin passwords, etc.) rather than targeted attacks by state-funded hackers anyway.

KingThrillgore, in Does anyone else harvest the magnets and platters from old drives as a monument to selfhosting history?
@KingThrillgore@lemmy.ml avatar

No, because I am worried the NSA may try to collate data from them. In fact, I zero-wipe, drill bit the drives in the platters and the PCB, and drop them off at e-waste for recycling.

MigratingtoLemmy, in Question: Best UI to manage VMs and containers?

If you’re running a compatible OS (Debian will work), cockpit for VMs and whatever you like for containers.

Or just do everything on the command line like us crusty system admins

MigratingtoLemmy, in Alternative to Home Assistant for ESPHome Devices

Why aren’t you using Node-red and ntfy/MQTT brokers? HA is feature-bloat for me

TCB13,
@TCB13@lemmy.world avatar

I wasn’t aware that node-red existed until this post :P

MigratingtoLemmy,

Have fun!

  • All
  • Subscribed
  • Moderated
  • Favorites
  • selfhosted@lemmy.world
  • localhost
  • All magazines
  • Loading…
    Loading the web debug toolbar…
    Attempt #