this post was submitted on 13 Feb 2024
66 points (91.2% liked)

Selfhosted

40719 readers
486 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
 

I'm curious as to why someone would need to do that short of having a bunch of users and a small office at home. Or maybe managing the family's computers is easier that way?

I was considering a domain controller (biased towards linux since most servers/VMs are linux) but right now, for the homelab, it just seems like a shiny new toy to play with rather than something that can make life easier/more secure. There's also the problem of HA and being locked out of your computer if the DC is down.

Tell me why you're running it and the setup you've got that makes having a DC worth it.

Thanks!

top 50 comments
sorted by: hot top controversial new old
[–] cm0002@lemmy.world 29 points 10 months ago (13 children)

I do, for a multitude of reasons

  • Easier management of family computers
  • an authoritative source for Authentik SSO
  • Learning experience, I'm also heavy Linux, but I try to maintain an OS agnostic philosophy with my skill set so I can have options in my career
  • I was bored
  • Again, since I like to maintain an OS agnostic philosophy I have a healthy mix of Windows, Linux and MacOS devices, and you CAN in fact join Linux (w/ SSSD) and MacOS to a domain too

In addition to what others have said with roaming profiles and such:

DO NOT SET YOUR AD DOMAIN AS THE SAME DOMAIN OF A WEB ADDRESS YOU USE

I..er...someone... Found themselves in this situation and have been in a mess since lmao

[–] BigMikeInAustin@lemmy.world 11 points 10 months ago

Some of the best and worst decisions people have made started with, "I was bored." Ha!

[–] caleb@lemmy.moorenet.casa 5 points 10 months ago (3 children)

Can you explain your disclaimer? You suggest not setting your AD domain to a web address you use, like one for self hosted sites? So you buy 2 domains, one for AD and one for sites? Or you use an internal domain for AD?

[–] cm0002@lemmy.world 14 points 10 months ago (1 children)

AD is heavily reliant on the DNS protocol, so heavily in fact that a large component of an AD deployment is a DNS server.

So basically, when the AD DNS server takes over on your network It'll do DNS things as you'd expect, when it gets a DNS call with the AD domain it will answer with the AD server every time

If your AD domain and your web address domain are domain.com then whenever the AD DNS server gets theh call it won't answer with the IP address of the web server, it'll answer with the AD server, even when you are trying to access a web service like domain.com/Plex or something.

You can change the DNS server used on the host, but then you'll be borkin domain functionality in weird ways

Yea, you'd want an entirely different domain or an internal like domain.lan or in my case what I should have done is made it a subdomain like ad.domain.com

And also it's a bitch to change the AD domain once you get it all setup hence I've been procrastinating with hosts file workarounds lmfao

[–] nottelling@lemmy.world 15 points 10 months ago (1 children)

made it a subdomain

That is the correct answer.

[–] Xakuterie@dormi.zone 2 points 10 months ago (2 children)

If I remember correctly that is best practise, no? It was something.local or *.intern for years, until TLDs could be whatever you wanted them to be.

load more comments (2 replies)
[–] jemikwa@lemmy.blahaj.zone 3 points 10 months ago* (last edited 10 months ago)

In shorter terms to what the other comment said, your website won't work in networks that use DNS served by your DC. The website is fine on the Internet, but less so at home or at an office/on a VPN if you're an enterprise.
"I can't go to example.com on the VPN!" was a semi common ticket at my last company 🙃

[–] redfox@infosec.pub 3 points 10 months ago

All the descriptions are right and techniques. Microsoft sometimes refers to this is split-brain and their documentation.

Organizations that choose not to do that use an active directory specific subdomain like some of the other comments mentioned. Example: adds. Company.tld.

Computer1.adds.company.tld. Dc1.adds.cimoany.tld.

Others doing split domain are

Adds.company.internal

load more comments (11 replies)
[–] Nollij@sopuli.xyz 23 points 10 months ago (1 children)

You're overlooking a very common reason that people setup a homelab - practice for their careers. Many colleges offer a more legitimate setup for the same purpose, and a similar design. But if you're choosing to learn AD from a free/cheap book instead of a multi-thousand dollar course, you still need a lab to absorb the information and really understand it.

Granted, AD is of limited value to learn these days, but it's still a backbone for countless other tools that are highly relevant.

load more comments (1 replies)
[–] assembly@lemmy.world 11 points 10 months ago

I run AD at home but it’s because my job is in enterprise software engineering and so running these programs in my home lab requires AD integrations. It’s also needed for HyperV and SCVMM along with things like SQL server auth and GMSA which I can’t get out of testing. Ironically most of my work is in open source/Linux but Windows servers are all over the Enterprise so I don’t have a choice but to run this stuff. No real users on it and just used for the lab.

[–] Treczoks@lemmy.world 11 points 10 months ago (2 children)

Keep in mind that AD, Office, and Exchange is he holy trinity of getting hacked in the last years.

[–] redfox@infosec.pub 2 points 10 months ago

Also the cornerstone of enterprise, for better or worse at the moment.

load more comments (1 replies)
[–] mikyopii@programming.dev 11 points 10 months ago (1 children)

I ran it previously because I came from that world and I just thought that's what you did. I was less Linux-y then. It's really overkill for such a small network but if you want to learn AD then it might be worth it. Personally I hope to never look at AD again but alas I need moneyz.

If you do decide to run it make sure you enable profile caching in group policy, it will prevent you from being locked out when your DC is down. Also if you have laptops you can safely bring them outside your network and they will still be able to log in.

[–] MigratingtoLemmy@lemmy.world 3 points 10 months ago

Oh, that's a great idea. I always wondered how I would be able to log into my work laptop even without being connected to the company network; now I know why!

Would love more tips if you would have them for someone very new to AD!

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

You could look at freeIPA or something similar to stay on Linux.

I'm an AD specialist, starting when it came out with server 2000, and can tell you it's a waste of time for a home network unless you are doing this just because you want to learn it.

It will definitly not make your life any easier, and will increase attack vectors, especially if you don't know how to secure and protect it.

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

I agree that for this size of network AD is definitely not something you want to deal with unless you want to learn how it works.

However, I'm not sure it really increases attack vectors to have it running, outside of the fact that it's a new network service on the LAN. The out of the box default configuration is not bad these days, security-wise

[–] Unforeseen@sh.itjust.works 3 points 10 months ago (2 children)

The attack vectors I'm thinking of just come from the inherent complexity and centralization. I'm just considering the amount of damage that can be done with a compromised DA account for example vs a non directory environment.

It's complicated. Done right it can be more secure, not done right it's less secure.

I also only get brought in for problems for the last however many years, so I'm probaby a bit biased at this point haha.

I have had to tell companies they are going to have to rebuild thier AD from scratch because they didn't know what thier DSRM password was (usually after a ransomware attack). These are the sort of hassles I think about vs non AD.

[–] wreckedcarzz@lemmy.world 2 points 10 months ago

For the rest of us: DSRM

load more comments (1 replies)
load more comments (1 replies)
[–] computergeek125@lemmy.world 8 points 10 months ago* (last edited 10 months ago) (1 children)
  1. Yes I do - MS AD DC

  2. I don't have a ton of users, but I have a ton of computers. AD keeps them in sync. Plus I can point services like gitea and vCenter at it for even more. Guacamole highly benefits from this arrangement since I can set the password to match the AD password, and all users on all devices subsequently auto-login, even after a password change.

  3. Used to run single domain controller, now I have two (leftover free forever licenses from college). I plan to upgrade them as a tick/tock so I'm not spending a fortune on licensing frequently

  4. With native Windows clients and I believe sssd realmd joins, the default config is to cache the last hash you used to log in. So if you log in regularly to a server it should have an up to date cache should your DC cluster become unavailable. This feature is also used on corporate laptops that need to roam from the building without an always-on VPN. Enterprises will generally also ensure a backup local account is set up (and optionally auto-rotated) in case the domain becomes unavailable in a bad way so that IT can recover your computer.

  5. I used to run in homemade a Free IPA and a MS AD in a cross forest trust when I started ~5-6y ago on the directory stuff. Windows and Mac were joined to AD, Linux was joined to IPA. (I tried to join Mac to IPA but there was only a limited LDAP connector and AD was more painless and less maintenance). One user to rule them all still. IPA has loads of great features - I especially enjoyed setting my shell, sudoers rules, and ssh keys from the directory to be available everywhere instantly.

But, I had some reliability problems (which may be resolved, I have not followed up) with the update system of IPA at the time, so I ended up burning it down and rejoining all the Linux servers to AD. Since then, the only feature I've lost is centralized sudo and ssh keys (shell can be set in AD if you're clever). sssd handles six key MS group policies using libini, mapping them into relevant PAM policies so you even have some authorization that can be pushed from the DC like in Windows, with some relatively sane defaults.

I will warn - some MS group policies violate Linux INI spec (especially service definitions and firewall rules) can coredump libini, so you should put your Linux servers in a dedicated OU with their own group policies and limited settings in the default domain policy.

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

Thanks for the great answer.

Using AD for SSO in git-frontends and other applications is a fantastic idea. I will probably also run FreeIPA (that's a name I hadn't heard in a while till this thread, from another commenter) and have a trust relationship.

You're right, this is probably better for learning rather than actually using at home, since most of my computers are linux/BSD, so if I needed a central auth server, I'd probably be better off using something made for *nix.

With that said, I had a curious idea - can I spin up temporary credentials, using something akin to service/machine accounts, rotate credentials and invalidate credentials freely etc? In essence, I'm wondering if this can be a way to implement a sort of homegrown "AWS STS" alternative, for app secrets, workers and the like. I was initially looking at secret management suites like Vault and Conjur but what if this can do it?

Also, can AD encrypt the DB? Can FreeIPA do it? I'd like such an option for security.

Thanks!

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

I don't have an immediate answer for you on encryption. I know most of the communication is encrypted in flight for AD, and on disk passwords are stored hashed unless the "use reversible encryption field is checked". There are (in Microsoft terms) gMSAs (group-managed service accounts) but other than using one for ADFS (their oath provider), I have little knowledge of how it actually works on the inside.

AD also provides encryption key backup services for Bitlocker (MS full-partition encryption for NTFS) and the local account manager I mentioned, LAPS. Recovering those keys requires either a global admin account or specific permission delegation. On disk, I know MS has an encryption provider that works with the TPM, but I don't have any data about whether that system is used (or where the decryptor is located) for these accounts types with recoverable credentials.

I did read a story recently about a cyber security firm working with an org who had gotten their way all the way down to domain admin, but needed a biometric unlocked Bitwarden to pop the final backup server to "own" the org. They indicated that there was native windows encryption going on, and managed to break in using a now-patched vulnerability in Bitwarden to recover a decryption key achievable by resetting the domain admin's password and doing some windows magic. On my DC at home, all I know is it doesn't need my password to reboot so there's credentials recovery somewhere.

Directly to your question about short term use passwords: I'm not sure there's a way to do it out of the box in MS AD without getting into some overcomplicated process. Accounts themselves can have per-OU password expiration policies that are nanosecond accurate (I know because I once accidentally set a password policy to 365 nanoseconds instead of a year), and you can even set whole account expiry (which would prevent the user from unlocking their expired password with a changed one). Theoretically, you could design/find a system that interacts with your domain to set, impound/encrypt, and manage the account and password expiration of a given set of users, but that would likely be add on software.

[–] viking@infosec.pub 8 points 10 months ago (2 children)

I had it running in a genuine small office environment with 8 employees, who all need to run Windows due to some software constraints.

Policy management and user account controls are great for security, and remote management via rdp is also neat.

[–] possiblylinux127@lemmy.zip 3 points 10 months ago

Plus if you use Samba AD DC you can install it on Debian which will run no issues for years without anything but unattended upgrades.

load more comments (1 replies)
[–] conorab@lemmy.conorab.com 7 points 10 months ago

Run at home/lab to learn AD and also gives you a place to test out ideas before pushing to production. You may be able to run a legit AD server with licensing on AWS or similar if they have a free tier.

[–] aldalire@lemmy.dbzer0.com 5 points 10 months ago (1 children)

Im out of the loop here. What’s an AD? 🤔

[–] slazer2au@lemmy.world 5 points 10 months ago

Active Directory. Manages users, devices, and permissions.

[–] Kid_Thunder@kbin.social 3 points 10 months ago (2 children)

Personally I use FreeIPA for my LDAP. I like that I can create sudoers rules from one centralized place and manage ssh keys across all clients. Granted I could just use Ansible I suppose, which is how I update multiple distributions in my network and online but I like that I can just change SSH keys and sudoers from one place easily instead of changing tasks/roles. I also usually run cockpit even on my non-Red Hat distros with SSH keys just so I don't have to log into everything though it is somewhat limited outside of the Red Hat sphere.

If you don't want to use ProxMox or some other specialized HyperVisor ecosystem, you can also use Cockpit to manager your VMs along with your Pods. I wish there'd be more attention to it for features because it feels like it could do a lot more.

I also don't really worry about locking myself out for two reasons:

  1. I use SSH keys.

  2. I also have a break-glass local account on every system...with SSH keys. If its on your local network, you can use VNC/VM console/Remote Desktop with a local account while only allowing SSH with keys if you'd like. Just make sure if you're going to allow remote access outside of your network that you never forward the VNC/RDP ports. For SSH when I do this I always pick some random port -- never default and never common ones like 2222 to at least keep my logs less noisy from the botnet auto attacks.

For my online VPS' I use a firewall with geoIP from Maxmind and drop all ports but 443 from the world, except for whatever country I'm in. I drop all packets from certain countries that seem to auto-attack more often than others. I try to drop packets from all known (to me) Shodan scanners. If I'm not traveling I just restrict all other ports to my public IP's subnet though my IP hasn't changed for years. For status checking services like StatusCake, I use the "push" method instead using a simple cron job with curl instead of relying on servers around the world checking my ports. In this case, the services just check that my server has successfully hit them within X minutes to be "up".

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

Thank you for your experience using FreeIPA, your comment really got me re-thinking about AD, about trust setups and if I really needed a Windows domain controller other than for learning. Being able to manage Sudoers centrally is fantastic!

I plan to use XCP-ng as my hypervisor.

Unfortunately, I didn't quite catch how using SSH keys will keep you from getting locked out if your domain controller goes down. That sounds exactly like what I want, and great idea having a spare account on each machine!

Thanks for your comment, very informative!

[–] Kid_Thunder@kbin.social 2 points 10 months ago* (last edited 10 months ago) (1 children)

The SSH keys don't help me if I get locked out of a Domain Controller unless you're using OpenSSH (which is now a native feature you can turn on). In that case you can actually still log into the DC via command line because it authenticates based on authorized_keys and not the LDAP of the DC. I actually do this on the enterprise, not because I may get locked out but because it is just convenient. Granted you'll have to execute powershell on the command line once in to use the AD cmdlets.

On the other hand when you create a DC now-a-days (Server 2019...I don't remember if this is asked in the wizard when in Server 2016) you can create a "Directory Services Restore Mode" password which is basically a local admin account on the DC that you can log into only when the DC is booted into safe mode. You'll be asked to create it when you promote your DC.

load more comments (1 replies)
load more comments (1 replies)
[–] h3ndrik@feddit.de 3 points 10 months ago* (last edited 10 months ago) (2 children)

Uh, why use a Microsoft product that doesn't even tie into the rest of the selfhosted services very well? There are easier and way better solutions for SSO and web services. And I don't have a pool of 30 windows laptops that'd need to share a set of login credentials and software rollout, at home.

I'd rather use the time I'd put into such a project that is just work and little to no benefit for something else. For example doing backups, deleting the Windows on those laptops and replacing it with free software.

[–] redfox@infosec.pub 2 points 10 months ago

Sometimes it's for career progression or familiarity.

Just for SSO, might be easier ways, sure.

[–] MigratingtoLemmy@lemmy.world 2 points 10 months ago

The main idea was to see if AD will bring any benefit to my homelab. The idea of running a domain controller is very intriguing, and it doesn't need to be AD specifically, although I'd like to get some hands-on time with it too.

[–] azl@lemmy.sdf.org 3 points 10 months ago (2 children)

I do. 4 or 5 users and several computers plus virtual server members. I still use Linux for DNS which works surprisingly well after the initial setup.

I did it half for practice and half for fun, but having the authentication backend makes it good enough to keep around.

load more comments (2 replies)
[–] VelociCatTurd@lemmy.world 2 points 10 months ago (1 children)

It seems cool but it’s just going to be a big headache man. I would just spin up a domain controller and maybe some workstations to play around with.

load more comments (1 replies)
[–] ShellMonkey@lemmy.socdojo.com 2 points 10 months ago (2 children)

Not AD proper but a compatible controller Linux distro to tie the desktops to, plus common credentials across several services. Just simplifies things not having a dozen different logins.

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

Do you mean something like FreeIPA? Seems like a good way to maintain identity across services in the homelab.

[–] ShellMonkey@lemmy.socdojo.com 2 points 10 months ago* (last edited 10 months ago)

No, currently univention corporate server (UCS), but I'll give those a look since I've been eyeing a replacement for a while due to some long standing vulns that I'm keen to be rid of.

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

What is that controller distro you use?

I used to use a Linux based AD replacement years ago but they turned that one into a pay model and if I'm going to pay for something I'll just use Windows Server

load more comments (1 replies)
[–] dankm@lemmy.ca 2 points 10 months ago (1 children)

I set up FreeIPA at home. Similar in principle to AD.

load more comments (1 replies)
[–] possiblylinux127@lemmy.zip 2 points 10 months ago

If you do go for samba ad dc

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

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

Fewer Letters More Letters
DNS Domain Name Service/System
Git Popular version control system, primarily for code
IP Internet Protocol
Plex Brand of media server package
SSH Secure Shell for remote terminal access
SSO Single Sign-On
VNC Virtual Network Computing for remote desktop access
VPN Virtual Private Network
VPS Virtual Private Server (opposed to shared hosting)

[Thread #507 for this sub, first seen 13th Feb 2024, 02:55] [FAQ] [Full list] [Contact] [Source code]

[–] technohacker@programming.dev 3 points 10 months ago (2 children)

I find it funny it didn't point out Active Directory

[–] taladar@sh.itjust.works 2 points 10 months ago

Possibly because ad also exists as a word?

[–] ako946659663@lemm.ee 2 points 10 months ago

Thank you! I was curious why someone would use Azure DevOps for their homelab. Lol.

load more comments
view more: next ›