this post was submitted on 27 Jan 2025
440 points (98.5% liked)

Selfhosted

41554 readers
591 users here now

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:

  1. Be civil: we're here to support and learn from one another. Insults won't be tolerated. Flame wars are frowned upon.

  2. No spam posting.

  3. 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.

  4. Don't duplicate the full text of your blog or github here. Just post the link for folks to click.

  5. Submission headline should match the article title (don’t cherry-pick information from the title to fit your agenda).

  6. No trolling.

Resources:

Any issues on the community? Report it using the report flag.

Questions? DM the mods!

founded 2 years ago
MODERATORS
 

Just exposed Immich via a remote and reverse proxy using Caddy and tailscale tunnel. I'm securing Immich using OAuth.

I don't have very nerdy friends so not many people appreciate this.

top 50 comments
sorted by: hot top controversial new old
[–] Deepus@lemm.ee 6 points 1 day ago

Nice one dude, i know the pain of not having nerdy friends to share shit like this with.

[–] eletes@sh.itjust.works 9 points 2 days ago
[–] walden@sub.wetshaving.social 77 points 3 days ago (10 children)

Wrapping my head around reverse proxy was a game changer for me. I could finally host things that are usefull outside my LAN. I use Nginx-Proxy-Manager which makes the config simple for lazy's like me.

[–] reddwarf@feddit.nl 2 points 1 day ago (1 children)

Used to mess around with multiple Apache Proxy Servers. When I left that job I found Docker and (amongst other things) NPM and I swear, I stared at the screen in disbelief on how easy the setup and config was. All that time we wasted on Apache, the issues, the upgrades, the nightmare in setting it all up...

If I were to do that job again I would not hesitate to use NPM 100% and stop wasting my time with that Apache Proxy mess.

[–] NostraDavid@programming.dev 2 points 10 hours ago* (last edited 10 hours ago)

NPM

Nginx-Proxy-Manager. Got it.

I didn't read the parent comment well enough and was wondering what the Node Package Manager had to do with anything 😂

[–] Concave1142@lemmy.world 18 points 3 days ago

NPM is awesome until you have a weird error that the web GUI does not give a hint about the problem. Used it for years at this point and wouldn't consider anything else at this point. It just works and is super simple.

[–] cm0002@lemmy.world 7 points 2 days ago (1 children)

+1 for NPM! Used to even do things manually, but I'm too lazy for that and NPM fulfils nearly all my use cases lol

load more comments (1 replies)
load more comments (7 replies)
[–] ikidd@lemmy.world 22 points 2 days ago* (last edited 2 days ago) (6 children)

Like, good for you, man.

But you should really keep your stuff inside the VPN and not expose things, it opens up a pile of potential risks that you don't need to have. You can still use a reverse proxy inside the VPN and use your own DNS server that spits out that internal address to your devices for your various applications. If you absolutely, positively must have something exposed directly, put it on it's own VLAN and with no access to anything you value.

[–] EncryptKeeper@lemmy.world 9 points 2 days ago (2 children)

@randombullet@programming.dev

Don’t listen to this guy. You don’t have to turtle all your stuff inside a VPN if you don’t want to. Hosting services on the internet is what the internet was created for. It’s up to you whether what you want to host is exposed to the internet or not, and as long as you’re aware of the risks do what you want man. I will mention that Immich specifically might not be the best idea to expose since it’s so unstable, but that depends on your level of comfortability. Worst case scenario is somebody gets into your Immich and can see all your photos. Would this be a dealbreaker for you? If so don’t expose it publicly. Otherwise you’re perfectly fine.

[–] ikidd@lemmy.world 7 points 2 days ago (3 children)

Nobody said they had to. I made him aware of the risks in case he wasn't. You seem to have an axe to grind there.

load more comments (3 replies)
[–] Hawk@lemmynsfw.com 1 points 1 day ago

Absolutely that's what the internet was made for!

But family photos keep a bit more secure, Particularly if it's syncing directly from your phone, I take a lot of explicit photos of my wife, but also code that I'm writing on my computer, or the kids playing, etc.

[–] randombullet@programming.dev 13 points 2 days ago (11 children)

I want to be able to upload/download/share my photos from anywhere in the world without using a VPN. Additionally, this satisfies the wife requirement. It works in the background without her needing her to turn on the VPN. I don't want her to keep asking me how do I turn on the VPN? If it's just me, then no issue, I'll use a VPN.

[–] PM_Your_Nudes_Please@lemmy.world 8 points 2 days ago* (last edited 2 days ago)

Yeah, you always have to account for the wife factor. Same reason I’m using Plex instead of Jellyfin for my video hosting; I’d personally prefer Jellyfin, but the wife factor (really the mother-in-law factor, but whatever…) demands that it doesn’t require a ton of config on the user’s end. If the goal is to encourage use by your family, it can’t be fiddly or difficult to set up on their end.

[–] Hawk@lemmynsfw.com 1 points 1 day ago* (last edited 1 day ago)

To be fair, wireguard is pretty painless.

load more comments (9 replies)
[–] valkyre09@lemmy.world 8 points 2 days ago* (last edited 2 days ago) (3 children)

I don’t even bother with the internal DNS server. I just set my A records in Cloudflare to point to the private IPs

[–] lorentz@feddit.it 6 points 2 days ago

I tired the same, but my router wants to be smart by filtering DNS responses that points to local IP. I guess whoever designed it considered it a security feature. It is a stock router from the ISP, its configuration interface is minimal, borderline to non existent.

[–] lka1988@lemmy.dbzer0.com 2 points 2 days ago

Sounds like Cloudflare tunnels. I used that for a while, until I realized I didn't want to be tied to Cloudflare.

[–] stetech@lemmy.world 4 points 2 days ago (3 children)

Do the private IPs not change at all? Or can you handle that automatically?

I have next to no experience, but I’m pretty sure that wouldn’t work for me since my IP changes? Idk

[–] WolfLink@sh.itjust.works 2 points 1 day ago

Most routers have a feature to assign static IPs to a specific MAC address. You can also tell most devices to try to take a specific IP instead of using DHCP.

There are multiple ways to set it up, but it’s very possible to set a specific device to always have the same local IP, which is usually the first step to many self-hosting scenarios.

[–] valkyre09@lemmy.world 4 points 2 days ago (1 children)

You can either set a DHCP reservation in your router, or manually set the IP on the device.

When I say private IP, I’m referring to the internal IP e.g 192.168.1.X

Means internally I just go to the domain without having to remember the IP I set.

load more comments (1 replies)
[–] starshipwinepineapple@programming.dev 2 points 2 days ago* (last edited 2 days ago)

Edit: i see now they're talking about private IP, but in case you want to learn about getting a static IP for other things...

Many ISPs will give you a dynamic (changing) IP rather than a static (unchanging) IP. Just check your IP once a week for a few weeks to see if it changes.

There are some services that get around this by checking your ip regularly and updating their records automatically. This is called a dynamic DNS provider (DDNS). I used to use "noip" but since then there are quite a few like cloudflare DDNS.

Beyond that you just would want to make sure your router or whatever device is assigning IPs on your network to give a static assignment to the server. Assigning IPs is handled by a DHCP server and it would usually be your router, but if you have a pihole you might be using that as a DHCP server instead.

Between DDNS and DHCP you can make sure both your external IP and internal IP are static.

[–] Fedegenerate@lemmynsfw.com 1 points 1 day ago

You can still use a reverse proxy inside the VPN and use your own DNS server that spits out that internal address to your devices for your various applications.

Excuse me what? Here's my dumb ass navigating to "[device name]:[port] over tailscale.

I've tried this a couple times and I've always failed. I could never figure out how to get a http://service.domain request to my Nginx install to be proxied in the first place. I tried putting pihole on tailscale and setting that as tailscale's DNS. It blocked ads but I couldn't navigate to custom domains. I put NPM on tailscale hoping that was the issue. I looked for LocalDNS/CNAMES in tailscale to see if I could do it that way. Do I have to set a local machine as an exit node and do split DNS shenanigans, service.domain goes through to my local and everything else the wider web? Do I set a router node?!

Not expecting you to troubleshoot, I don't have time to see it through anyhow. Just annoyed at myself I couldn't figure it out and driven to try again.

[–] milicent_bystandr@lemm.ee 4 points 2 days ago

Opening it up lets you use it from devices that aren't on tailscale, or for friends and family. I have the same idea with Nebula instead of Tailscale, if I can figure it out.

load more comments (1 replies)
[–] Voroxpete@sh.itjust.works 22 points 3 days ago (3 children)

I'm a huge fan of Caddy and I wish more people would try it. The utter simplicity of the config file is breathtaking when you compare it with Apache or Nginx. Stuff that takes twenty or thirty lines in other webservers becomes just one in Caddy.

[–] vividspecter@lemm.ee 3 points 1 day ago

The only thing I don't like about caddy is that using DNS challenge requires recompiling the program itself, and the plugins themselves can be a bit quirky. Mind you, you can easily handle this with a separate program like lego or certbot so not a huge deal.

load more comments (2 replies)
[–] ramenshaman@lemmy.world 14 points 2 days ago (2 children)

Can someone ELI5? I'm a noob who aspires to set up immich in the near future. I only recently started making efforts to separate myself from the cloud. So far I've got a wireguard server set up and I've disconnected both my Bambu printers from the cloud and I'm currently setting up some home assistant stuff. Pretty soon I'm hoping to set up a NAS, Immich, Plex (or similar) and replace my google nest cameras.

[–] Nibodhika@lemmy.world 16 points 2 days ago

I'll try to ELI5, if there's something you don't understand ask me.

Op has a home server where he's running immich, that's only accessible when he's at home via the IP, so something like http://192.168.0.3:3000, so he installed Tailscale on that server. Tailscale is a VPN (Virtual Private Network) that allows you to connect to your stuff remotely, it's a nice way to do it because it is P2P (peer-to-peer) which means that in theory only he can access that network, whereas if he were using one of the many VPNs people use for other reasons, other people on the same VPN could access his server.

Ok, so now he can access his immich instance away from home, all he has to do is connect to the VPN on his phone or laptop and he'll be able to access it with something like http://my_server:3000 since Tailscale adds a DNS (Domain Name System) which resolves the hostnames to whatever IP they have on the Tailscale network.

But if you want to give your family access it's hard to explain to them that they need to connect to this VPN, so he rented a VPS (Virtual Private Server) on some company like DigitalOcean or Vultr and connected that machine to the Tailscale network. He probably also got a domain name from somewhere like namecheap, and pointed that domain name to his VPS. Só now he can access his VPS by using ssh user@myserver.com. Now all he needs to do is have something on the VPS which redirects everything that comes to a certain address into the Tailscale machine, Caddy is a nice way to do this, but the more traditional approach is ngnix, so if he puts Caddy on that VPS a config like this:

immich.myserver.com {
    handle {
        reverse_proxy my_server.tailscale.network.name:3000
    }
}

Then any requests that come to https://immich.myserver.com will get redirected to the home server via Tailscale.

It is a really nice setup, plus OP also added authentication and some other stuff to make it a bit more secure against attacks directly on immich.

[–] randombullet@programming.dev 6 points 2 days ago (3 children)

Pretty much I have caddy on a VPS that's pointing to my internal IP using a tailscale tunnel. You are still exposing the web gui to the Internet so I just changed authentication to OAuth to mitigate since risk. There is still a possibility of attacks via zero days, but my immich is on a VM and I'm creating firewall rules to just allow certain ports out.

load more comments (3 replies)
[–] guy@piefed.social 10 points 3 days ago (1 children)

Good job!
I'm still trying to understand what it is and why I would want it. I see several programs I use recommend it but I just don't get what it does and why what it does is good.

[–] catloaf@lemm.ee 12 points 2 days ago (2 children)

It does a couple things. It's one service that routes requests to multiple services. So if you have radarr, sonarr, etc., you can put a reverse proxy in front and use the same ip-port to connect to all, and the proxy routes the request to the service by hostname.

If you have multiple instances of the same service for HA, it can load balance between them (though this is unlikely for a homelab).

Personally I run all my services through docker and put traefik in front, so that I don't have to keep track of ports. It's all by name.

It's also nice because traefik handles HTTPS termination, so it automatically gets certs for each name, and the backing service never needs to worry about it (it's http on the backend, but all that traffic is internal).

load more comments (2 replies)
[–] Noggog@programming.dev 5 points 2 days ago (5 children)

Just out of curiosity, is the tail scale part of this required? If i just reverse proxy things and have them only protected from there by the login screen of the app being shown, that's obviously less safe. But the attackers would still need to brute force my passwords to get any access? If they did, then they could do nasty things within the app, but limited to that app. Are there other vulnerabilities I'm not thinking about?

[–] ikidd@lemmy.world 8 points 2 days ago* (last edited 2 days ago) (2 children)

I don't think a tailscale tunnel helps this anyway, maybe just from standard antispoofing and geoblocks, but it still gets to the application in full eventually, when they can do what they'd do if it was directly exposed. The attack surface might be an entire API, not just your login screen. You have no idea what that first page implements that could be used to gain access. And they could request another page that has an entirely different surface.

If someone has Nextcloud exposed, I'm not stopping at the /login page that comes up by default and hitting it with a rainbow table; I'm requesting remote.php where all the access goodies are. That has a huge surface that bypasses the login screen entirely, might not be rate limited, and maybe there's something in webdav that's vulnerable enough that I don't need a correct token, I just need to confuse remote.php into letting me try to pop it.

You can improve this by putting a basic auth challenge at least in front of the applications webpage. That would drastically reduce the potential endpoints.

load more comments (2 replies)
[–] WolfLink@sh.itjust.works 1 points 1 day ago

I only let things I trust are secure (e.g. ssh) have access from the internet, other services I hide behind a VPN (e.g. Tailscale).

load more comments (3 replies)
load more comments
view more: next ›