this post was submitted on 25 Apr 2025
79 points (94.4% liked)

Selfhosted

46653 readers
1067 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
 

uSentry is a lightweight, self-hosted Identity and Access Management (IAM) and Single Sign-On (SSO) solution designed for homelab and small-scale environments.

⚡ A single PHP file. < 400 lines of code. No database. No background processes. No cloud. Just works. ⚡

Most IAM and SSO solutions require databases, certificates and background services baked into a dozen containers. This is all fine but also also overkill for homelabs and impossible for low-power ARM devices. uSentry is different, it isn't pretty but it sucks less for a lot of use cases.

Enjoy!

top 24 comments
sorted by: hot top controversial new old
[–] Xanza@lemm.ee 22 points 2 months ago* (last edited 2 months ago) (2 children)

I'm torn between this being fucking genius, and a terrible idea all at once.


EDIT: Requires ngx_http_auth_request_module. * Caddy4lyfe. *

[–] TCB13@lemmy.world 12 points 2 months ago* (last edited 2 months ago) (1 children)

Well, me too. But frankly OpenIAM (24GB of RAM as a requirement) Keycloak, Authelia do too much, require too much and aren't suitable at all for SBCs and small scale stuff.


Edit: This is targeted at people that run nginx as a standalone server or proxy.

[–] Xanza@lemm.ee 8 points 2 months ago

I respect it.

[–] neodc@sh.itjust.works 9 points 2 months ago (1 children)
[–] Xanza@lemm.ee 6 points 2 months ago (1 children)
[–] TCB13@lemmy.world 6 points 2 months ago (1 children)

If you manage to make it worth with Caddy can you share your config? I can add it to the readme or something. Thanks.

[–] Xanza@lemm.ee 7 points 2 months ago

For sure. I'm likely gonna take a look at it this weekend.

[–] cecilkorik@lemmy.ca 8 points 2 months ago* (last edited 2 months ago) (1 children)

I have been constantly asking myself why there isn't something like this, and just wondering if maybe I was missing something about the seeming immense complexity of doing this on a small scale.

Now there is something like this.

I don't love PHP, but I also don't love having dozens of separate passwords, keys, certificates and other nonsense to keep track of like I'm doing now. I don't mind using PHP to get around that if I can.

[–] TCB13@lemmy.world 4 points 2 months ago

Well, it isn’t pretty, but gets the job done.

The thing with PHP in this case is that I was already serving a ton of simple websites / small apps like freshrss that use PHP and by making this tool in PHP it means I don’t need yet another process running and wasting resources, can just re-use the existing php-fpm for this.

For what’s worth PHP is better than it looks, and my implementation is very crude, but also small and auditable and contained to a single file. :)

[–] dont@lemmy.world 5 points 2 months ago* (last edited 2 months ago) (1 children)

I love the simplicity of this, I really do, but I don't consider this SSO. It may be if you're a single user, but even then, many things I'm hosting have their own authentication layer and allow offloading only to some oidc-/oauth or ldap-provider.

[–] TCB13@lemmy.world 4 points 2 months ago* (last edited 2 months ago)

In the simplest form it might be SSO. It does support multiple users and if you look for instance at the filebrowser it’s very possible to pass the username. But yes, this is very simple, very crude and exactly what a lot of people need.

[–] possiblylinux127@lemmy.zip 4 points 2 months ago

https://github.com/lldap/lldap

You also could go freeipa or Samba AD

[–] x00z@lemmy.world 4 points 2 months ago (1 children)

Fun little project but I think auth_basic would be perfectly fine instead.

[–] TCB13@lemmy.world 6 points 2 months ago

Hmm… some people are going to say that basic auth would be insecure, I’m not going to be there because in this particular case it’s about the same thing.

However, this might be easier to configure and manage permissions than basic auth. Also this works cross-domain and basic auth will require full re-auth for every domain. Another obvious advantage is that at some point I plan to integrate 2FA.

[–] Vendetta9076@sh.itjust.works 2 points 2 months ago (2 children)

I feel like committing secrets to a config file instead of .env is a terrible idea. Thats being said this is really useful I'm sure.

[–] Xanza@lemm.ee 3 points 2 months ago (1 children)

The entire point of .env files are to separate secrets from code. Its specifically the usage for which they were created.

[–] Vendetta9076@sh.itjust.works 2 points 2 months ago (1 children)

Yes?

Are we misunderstanding each other?

[–] Xanza@lemm.ee 2 points 2 months ago (1 children)

We are. I read I feel like committing secrets to a config file instead of .env is a terrible idea. as I feel like committing secrets to a .env is a terrible idea..

Muh bad.

All good brother :)

[–] TCB13@lemmy.world 3 points 2 months ago* (last edited 2 months ago) (1 children)

I get the point, but don’t forget those “secrets” are bcrypt hashes. Not really reversible.

[–] Vendetta9076@sh.itjust.works 5 points 2 months ago* (last edited 2 months ago) (1 children)

The issue isn't that. The issue is its a config ~~folder~~ file and a lot of people back their configs up to things like github.

[–] TCB13@lemmy.world 1 points 2 months ago (1 children)

You can backup the entire file then. I get your point, but it also seems like you’re referring to some container-based approach where you would place this inside a container and then mount the config file to some path. While some people might like that approach, that kind of goes against the original idea here, I didn’t want to run yet another instance of nginx for auth, nor another php-fpm - the ideia was simply to use this on a low power device , no containers, no overhead of duplicate webservers and PHP, just a single nginx running a couple of apps on the same php-fpm alongside this.

[–] Vendetta9076@sh.itjust.works 1 points 2 months ago (1 children)

I think youre misunderstanding my point but thats okay. Its not for me but as a thing itself its really impressive and you should be proud to have written it. I'm sure others will find great use in it :)

[–] TCB13@lemmy.world 1 points 2 months ago

I can split the config to another file, not really a big deal. :)