Developing the realmd component-------------------------------This adds functionality to Cockpit to join an AD or IPA domain.Some features of Cockpit require a domain to test. Cockpit should workwith either Active Directory or IPA.### Running a test domainTo contribute to this component, run a test domain which endsup being rather easy. Install the stuff in [test/README.md](../../test/README.md)near the top. And then do the following:$ bots/vm-run --network servicesIn that VM, start `/root/run-freeipa` to start an IPA domain controller, or`/root/run-samba-domain` for a Samba AD domain controller. Now inanother terminal do the following:$ sudo /bin/sh -c "echo -e 'domain cockpit.lan\nsearch cockpit.lan\nnameserver 10.111.112.100\n' > /etc/resolv.conf"Make sure this works:$ realm discover cockpit.lanAnd now you're ready to use the feature. For IPA there's an account called"admin" with the password "foobarfoo", for Samba AD it is user "Administrator"with password "foobarFoo123".To test your DNS, the following should succeed without any error messageson your server with cockpit:$ host cockpit.lanNow verify that you can authenticate against the IPA server. See passwordabove.$ kinit admin@COCKPIT.LANPassword for admin@COCKPIT.LAN:## Running a Microsoft AD server in AWSIf you want to test against Microsoft Active Directory instead of Samba or FreeIPA, thesimplest way is to start a temporary[managed AD in AWS](https://docs.aws.amazon.com/directoryservice/latest/admin-guide/directory_microsoft_ad.html)(or another cloud provider). Just follow the few[setup steps](https://docs.aws.amazon.com/directoryservice/latest/admin-guide/ms_ad_getting_started.html#ms_ad_getting_started_create_directory):Select the smallest edition, specify a directory DNS name (e. g. `ad.cockpit.lan`) and a password for the `Admin` user,and about 20 minutes later the domain server should be set up. The details pageof the created domain shows the DNS server's IP; put that into `/etc/resolv.conf`.From then on, joining that domain with `realm` or Cockpit works in the same way.## Setting up Single Sign onCockpit can perform single sign on authentication via Kerberos. To test andwork on this feature, you must have a domain on your network. See sectionabove if you do not.Use the following guide to configure things, with more troubleshooting advicebelow:https://docs.cockpit-project.org/cockpit-guide/latest/guide/sso.html**BUG:** The host name of the computer Cockpit is running on should end withthe domain name. If it does not, then rename the computer Cockpit is running on:[realmd bug](https://bugzilla.redhat.com/show_bug.cgi?id=1144343)$ sudo hostnamectl set-hostname my-server.domain.com**BUG:** If your domain is an IPA domain, then you need to explicitly add a servicebefore Cockpit can be used with Single Sign on. The following must be done onthe computer running Cockpit.[realmd bug](https://bugzilla.redhat.com/show_bug.cgi?id=1144292)$ sudo -s# kinit admin@COCKPIT.LAN# ipa service-add --ok-as-delegate=true --ok-to-auth-as-delegate=true --force HTTP/my-server.cockpit.lan@COCKPIT.LAN# ipa-getkeytab -q -s services.cockpit.lan -p HTTP/my-server.cockpit.lan -k /etc/krb5.keytabNow when you go to your cockpit instance you should be able to log in withoutauthenticating. Make sure to use the full hostname that you set above, the onethat includes the domain name.If you want to use Cockpit to connect to a second server make sure that secondserver is joined to a domain, and that you can ssh into it using GSSAPI authenticationwith the domain user:$ ssh -o PreferredAuthentications=gssapi-with-mic admin@my-server2.domain.comIf you thought that was nasty and tiresome, it's because it is at present :S## Using delegated credentialsCockpit can delegate forwardable credentials. Make sure to specify you want themduring kinit:$ kinit -f admin@COCKPIT.LAN$ klist -fDefault principal: admin@COCKPIT.LAN...Flags: FIAUse the IPA GUI to setup "Trusted for delegation" for the host and service thatCockpit is running on. Make sure to tell the browser to delegate credentialsas seen in the guide:https://docs.cockpit-project.org/cockpit-guide/latest/guide/sso.htmlZe goggles, zey do nothing!