this post was submitted on 06 Jul 2024
34 points (92.5% liked)

Selfhosted

40341 readers
858 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 1 year ago
MODERATORS
34
How to host a userbase (self.selfhosted)
submitted 4 months ago* (last edited 4 months ago) by zweieuro to c/selfhosted
 

Hi!

I am an embedded systems guy so this is new territory for me. I want to be able to host my own userbase somewhere, mainly I just want to figure out how they work. But all i can find are closed solutions that have some amount of pricing or are obscured. I also feel like it'd be wrong to re-write something like this myself.

I've tried googling around a bit but keep getting similar results so I am assuming I am asking the wrong question. What I want: Ideally some kind of dockerized setup where a user can navigate to a website to create an account, which I can then query through php or some other API. Stuff like password reset or stripe would be nice but is secondary as that can most likely be added another way.

I found stuff like usernbase which seems interesting and even includes something like subscriptions, but I'd like to self host it and not rely on something like the AWS.

Ideally I want to get OAUTH2.0 to work as well, to learn how exactly it works.

Any pointers would be greatly appreciated!

top 21 comments
sorted by: hot top controversial new old
[–] [email protected] 6 points 4 months ago* (last edited 4 months ago)

Authentik, Authelia, Keycloak, KaniDM come to mind.

That'd be identity providers / authentication servers or SSO solutions. But with most (/all?) of them, you'd have to program the payment logic yourself.

I think there are webshops, platforms to sell online courses and ERP or eCommerce software that can do both payment and authentication. I'm not a expert on that.

I think most solutions are either custom solutions that have been programmed by the people themselves (at least to some degree) or some of the big, commercial (and proprietary) platforms to sell online courses and memberships.

But don't search for "userbase [...]" that's a term I've never heard of. Search for "membership", "identity management", "single sign-on", "eCommerce" and "Stripe" (because it's one of the largest payment providers. And I'd have a look at the eCommerce world. Usually it's difficult to find something good. Most of them want a share of your revenue and aren't entirely open source. Maybe something to sell online courses with, is more likely to have the things you need.

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

I use OpenLDAP for my source of truth (user base) and have Authelia configured to use that for users.

Authelia supports acting as an OIDC provider as well as an auth source for apps I host behind Nginx.

For apps that support LDAP, they're plumbed directly in to that and apps using more modern auth schemes (or apps that don't support either OIDC/LDAP) are protected by Authelia - they use the same userbase in LDAP.

OpenLDAP isn't easy, though, so you might want to look at something like FreeIPA or 389 Directory Server instead.

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

I've looked at that, but not lately. Last I checked, it was kind of pseudo-LDAP and only really focused on user authentication. I can't read through it now, but will check it out later. For OP's purposes, though, yeah, that should do nicely as a user base for Authelia.

My LDAP server also backs my DHCP, DNS, SMTP/IMAP, SIP, and a few other things beyond user auth, so I kind of need a full LDAP server. The good thing is once you get OpenLDAP setup (and get a good grasp of the cn=config schema), it's pretty easy to manage with Apache Directory Studio. Getting to that point, though, lol, is quite a mountain to climb.

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

Silly question but what is a userbase

[–] zweieuro 2 points 4 months ago

Absolutely general purpose. In the most simple terms, email, password hash, and a bit of metadata

[–] hperrin 4 points 4 months ago
[–] [email protected] 3 points 4 months ago

What do you want those users to be able to do with their accounts?

A CMS like Drupal or Wordpress might be what you want.

It's hard to recommend something when you haven't described the purpose. Having users register accounts is just a means to some end.

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

I’m not entirely sure what you mean by userbase, but based on your description it sounds like you could set up a Wordpress docker container with some plugins to handle what you want and then use the Wordpress api for the calls. If you’re looking for like a paid membership situation for the site, there are free and pay plugins that can accomplish the payments and subscription integrations.

[–] zweieuro 1 points 4 months ago (2 children)

I am very reluctant to use WordPress at all because I've heard terrible things from multiple colleagues. It looks like something that'd get problematic at some point.

[–] ikidd 1 points 4 months ago

Wordpress issues lie in using plugins that aren't maintained or written well. The source and quality of plugins varies wildly.

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

That’s totally fair. Wordpress can accomplish what you want, but also can be a giant nightmare. I ran a membership based Wordpress site for around a decade (self hosted and maintained), and it was mostly okay, but also many times a giant headache. I fully understand wanting to avoid Wordpress.

[–] [email protected] 3 points 4 months ago

So, you want an LDAP server or a forum? That's either FreeIPA or hosting Discourse

[–] [email protected] 3 points 4 months ago

I think it would be a good idea to take a step back and ask what is it that you’re trying to achieve.

Userbase, the service linked, is a backend as a service platform that offers you authentication and basic database that you can access via their api. You’d then code your own front end web app to interact with their service and store data there. You pay only per storage used by their storage tiers, which are frankly fairly fair priced. If that is something you’d need, that’s a good idea, but you’d be coding the front end yourself.

If you’re only looking for authentication with OAuth, and then coding your own API backend, then something like Authentik would be a nice self hosted authentication provider. Others that commonly gets mentioned but I’ve got limited/no experience with worlds new keycloak, or fusionauth. Managed services here would be your Auth0, Okta, etc.

If you’ve got a specific use case in mind, then it may be a good idea to say what service you’re thinking about, and the community may be able to suggest prebuilt solutions that good better and require less lift.

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

Supabase is a dockerised postgres with user auth, rest API and some other goodies. It's maybe too complicated as a starter.
Appwrite might also work for ya. Much easier to get into, but also less feature complete.
Pocketbase might also work. Haven't used it tho

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

Haven't used it yet, but I've been researching authentik for my own SSO.

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

What is your goal? Custom stuff isn't too hard if you just want to implement basic password login and token-based auth. Otherwise you could use something like Firebase, Okta, or Cognito.

[–] ikidd 2 points 4 months ago

Pocketbase looks interesting for this.

[–] [email protected] 1 points 4 months ago* (last edited 4 months ago)

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

Fewer Letters More Letters
DHCP Dynamic Host Configuration Protocol, automates assignment of IPs when connecting to a network
DNS Domain Name Service/System
IMAP Internet Message Access Protocol for email
SMTP Simple Mail Transfer Protocol
SSO Single Sign-On

5 acronyms in this thread; the most compressed thread commented on today has 5 acronyms.

[Thread #853 for this sub, first seen 6th Jul 2024, 21:05] [FAQ] [Full list] [Contact] [Source code]

[–] [email protected] 1 points 4 months ago* (last edited 4 months ago)

https://geek-cookbook.funkypenguin.co.nz/recipes/keycloak/authenticate-against-openldap/

It builds on the Keycloak and OpenLDAP tutorials but they're all very well covered.

[–] c10l 1 points 4 months ago

I’ve been using glauth + Authelia for a couple years with no issues and almost zero maintenance.

https://github.com/glauth/glauth https://www.authelia.com/