this post was submitted on 03 Apr 2024
22 points (89.3% liked)

Selfhosted

61941 readers
588 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:

Detailed Rules Post

  1. Be civil.

  2. No spam.

  3. Posts are to be related to self-hosting.

  4. Don't duplicate the full text of your blog or readme if you're providing a link.

  5. Submission headline should match the article title.

  6. No trolling.

  7. Promotion posts require active participation, with an account that is at least 30 days old. F/LOSS without a paywall has exceptions, with requirements. See the rules link for details. Tags [CBH] or [AIP] are required, see the links in Rule 8 for details.

  8. AI-related discussions and AI-involved promotional posts have additional requirements for tagging, as noted in Rule 7 and the AI & Promotional Post Expanded Rules post, and find example disclosures here.

Resources:

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

Questions? DM the mods!

founded 3 years ago
MODERATORS
 

I host a few docker containers and use nginx proxy manager to access them externally since I like to have access away from home. Most of them have some sort of login system but there are a few examples where there isn't so I currently don't publicly expose them. I would ideally like to be able to use totp for this as well.

top 23 comments
sorted by: hot top controversial new old
[–] UltraBlack@lemmy.world 17 points 2 years ago* (last edited 2 years ago) (2 children)

most reverse proxies have SSO tooling that you can set up pretty easily

But honestly, have you considered just using wireguard for these cases? It's much more secure if you just want a bunch of stuff hidden from the rest of the world

[–] emax_gomax@lemmy.world 6 points 2 years ago (1 children)

If you want a richer login authelia + caddy is good.

[–] CatTrickery@lemmy.world 3 points 2 years ago

Ooh that Authelia looks pretty much ideal. I'll give it a try and see how well it works.

[–] Teng@lemmy.ml 1 points 2 years ago (1 children)

How to use WireGuard for that? (Noob here)

[–] UltraBlack@lemmy.world 1 points 2 years ago

WireGuard

try wg-easy. it's on the docker hub and it makes setting up a wireguard tunnel incredibly easy (as in, press the add button). The initial docker configuration process was a bit annoying to me since I had no prior experience, but most of the issues were down to the dns settings, which I eventually figured out.

[–] DeltaTangoLima@reddrefuge.com 10 points 2 years ago* (last edited 2 years ago) (1 children)

I use Nginx Proxy Manager and Authelia for just this. Authelia supports a wide range of identity and MFA providers.

Edit: although Authelia has an article on how to set it up, I found it still missed some key info. This article was the one that helped me most in getting it to work.

[–] ikidd@lemmy.world 1 points 2 years ago

Be nice if the images worked on that link.

[–] chiisana@lemmy.chiisana.net 7 points 2 years ago (2 children)

I use Traefik as reverse proxy and Authentik as SSO IdP. When I connect to my “exposed” service, Traefik middleware determines if I have the appropriate access credentials established. If so, I get access; if not, I’m bounced over to Authentik, where I enter my username, and authenticate via Passkey (modern passwordless gated by private keys behind biometrics unlock). The middleware can also be bypassed based on my pre established private custom HTTP header, so apps doesn’t support the flow (ie mobile client for some apps) can get in directly as well.

[–] rentar42@kbin.social 3 points 2 years ago (1 children)

I've got the same setup! What I love about authentik is that I can even add a Google login as an authentication method. That severely increases the spouse-acceptance factor, as they don't have to "remember yet another password" or "carry around another thingie". Personally I use a YubiKey anyway, but for others who aren't into it "for fun" or for philosophical reasons reducing the friction as much as possible is paramount.

[–] chiisana@lemmy.chiisana.net 1 points 2 years ago

I’m so lucky I got my SO on board with using a password manager early on! However, the passwordless login (after figuring out how send a user to the enroll stage initially) makes it so smiple, don’t even need the federated Google login.

[–] uninvitedguest@lemmy.ca 2 points 2 years ago (1 children)

How does this work for you when using an app (E.g. Nextcloud, home assistant, etc) where log in isn't handled by a browser that can redirect, but instead expects username and password credentials entered in-app?

[–] chiisana@lemmy.chiisana.net 2 points 2 years ago

I don’t use the two you’ve called out, so I cannot guarantee my Google results are accurate, but the principle is similar…

If the app supports external authentication (usually, looking for things like OIDC, SAML, or SSO in the documentation), then I’d configure the app to do that and skip the Traefik middleware piece.

This is what I’d do based on what I’m seeing on this article for NextCloud. That is, when all is said and done, I’d go https://nexcloud.myunexistent.deployment/ and be greeted with the next cloud login screen, where the external authentication option is shown on screen.

A similar setup might be achieved with Home Assistant’s commandline authentication provider to delegate authentication out via command line setup. Alternatively, use hass-auth-header plugin along with trusted proxy to delegate authentication out to the reverse proxy.

Hope this points to a relevant direction for you!

I agree with everything everyone else has said here but if you looking for the most basic solution it's already in NPM. You can configure basic auth in an access list and apply it to the site.

[–] Shimitar@feddit.it 2 points 2 years ago

Add Pam or basic auth to nginx and you are done.

[–] namelivia@lemmy.world 1 points 2 years ago (1 children)
[–] node815@lemmy.world 1 points 2 years ago (1 children)

With that, I use Pomerium for apps which accept a HTTP Headers, for example, my Fresh Tomato firmware flashed router, it has a HTTP dialog. This allows me to login from the road if I need to manage something like rebooting it or updating firewall rules etc.

My access flow is this :

router.example.com ---> Cloudflare Tunnel ---> Pomerium IP --->Authentik ---> Router's Gui.

It works flawlessly. I don't often use it, but when I do, it helps. I also had it enabled for AdguardHome but moved to Technitium DNS which I prefer and that doesn't have the HTTP Headers so it's not fully compatible with Pomerium that I'm aware of.

[–] namelivia@lemmy.world 1 points 2 years ago (1 children)

What does Authentik do in combination with pomerium? I don't have it

[–] node815@lemmy.world 2 points 2 years ago (1 children)

Authentik is my IDP provider so I put it in front of all my publicly facing Apps which support OIDC login. For example, I can log into my Portainer instance from an external network, but to do so, I log into Authentik First which sends it to my service.

For the apps which support HTTP headers, like I said, Pomerium acts as the service which passes my credentials to the device. I admit - Authentik does this also without the need for Pomerium, (through their flow settings) but I found Pomerium to be much easier to set up for this than Authentik and haven't looked back or felt the need to change it.

[–] namelivia@lemmy.world 1 points 2 years ago

Ah I see! Thanks for the explanation, I have pomerium in front of everything using Google as IDP. Then if the app supports header authentication (like grafana) I get automatically logged in, and for those that don't I have to log in again (a bit inconvenient) I event went as far as forking one and implementing header authentication myself.

[–] Decronym@lemmy.decronym.xyz 1 points 2 years ago* (last edited 2 years ago)

Acronyms, initialisms, abbreviations, contractions, and other phrases which expand to something larger, that I've seen in this thread:

Fewer Letters More Letters
CF CloudFlare
DNS Domain Name Service/System
HTTP Hypertext Transfer Protocol, the Web
IP Internet Protocol
SSO Single Sign-On
nginx Popular HTTP server

[Thread #653 for this sub, first seen 3rd Apr 2024, 23:05] [FAQ] [Full list] [Contact] [Source code]

[–] PeachMan@lemmy.world 1 points 2 years ago

It's pretty easy to do this with Cloudflare Tunnels. You can set them up to use a Google account for SSO. Downside of course is that you're reliant on Google and CF.

[–] jet@hackertalks.com 1 points 2 years ago

Tailscale, cloud flare, come to mind

[–] blackbarn@lemm.ee 1 points 2 years ago

Throwing my setup in: Traefik with Authentik