| 1 |
Developing the realmd component |
| 2 |
------------------------------- |
| 3 |
|
| 4 |
This adds functionality to Cockpit to join an AD or IPA domain. |
| 5 |
|
| 6 |
Some features of Cockpit require a domain to test. Cockpit should work |
| 7 |
with either Active Directory or IPA. |
| 8 |
|
| 9 |
### Running a test domain |
| 10 |
|
| 11 |
To contribute to this component, run a test domain which ends |
| 12 |
up being rather easy. Install the stuff in [test/README.md](../../test/README.md) |
| 13 |
near the top. And then do the following: |
| 14 |
|
| 15 |
$ bots/vm-run --network services |
| 16 |
|
| 17 |
In that VM, start `/root/run-freeipa` to start an IPA domain controller, or |
| 18 |
`/root/run-samba-domain` for a Samba AD domain controller. Now in |
| 19 |
another terminal do the following: |
| 20 |
|
| 21 |
$ sudo /bin/sh -c "echo -e 'domain cockpit.lan\nsearch cockpit.lan\nnameserver 10.111.112.100\n' > /etc/resolv.conf" |
| 22 |
|
| 23 |
Make sure this works: |
| 24 |
|
| 25 |
$ realm discover cockpit.lan |
| 26 |
|
| 27 |
And now you're ready to use the feature. For IPA there's an account called |
| 28 |
"admin" with the password "foobarfoo", for Samba AD it is user "Administrator" |
| 29 |
with password "foobarFoo123". |
| 30 |
|
| 31 |
To test your DNS, the following should succeed without any error messages |
| 32 |
on your server with cockpit: |
| 33 |
|
| 34 |
$ host cockpit.lan |
| 35 |
|
| 36 |
Now verify that you can authenticate against the IPA server. See password |
| 37 |
above. |
| 38 |
|
| 39 |
$ kinit [email protected] |
| 40 |
Password for [email protected]: |
| 41 |
|
| 42 |
## Running a Microsoft AD server in AWS |
| 43 |
|
| 44 |
If you want to test against Microsoft Active Directory instead of Samba or FreeIPA, the |
| 45 |
simplest way is to start a temporary |
| 46 |
[managed AD in AWS](https://docs.aws.amazon.com/directoryservice/latest/admin-guide/directory_microsoft_ad.html) |
| 47 |
(or another cloud provider). Just follow the few |
| 48 |
[setup steps](https://docs.aws.amazon.com/directoryservice/latest/admin-guide/ms_ad_getting_started.html#ms_ad_getting_started_create_directory): |
| 49 |
Select the smallest edition, specify a directory DNS name (e. g. `ad.cockpit.lan`) and a password for the `Admin` user, |
| 50 |
and about 20 minutes later the domain server should be set up. The details page |
| 51 |
of the created domain shows the DNS server's IP; put that into `/etc/resolv.conf`. |
| 52 |
|
| 53 |
From then on, joining that domain with `realm` or Cockpit works in the same way. |
| 54 |
|
| 55 |
## Setting up Single Sign on |
| 56 |
|
| 57 |
Cockpit can perform single sign on authentication via Kerberos. To test and |
| 58 |
work on this feature, you must have a domain on your network. See section |
| 59 |
above if you do not. |
| 60 |
|
| 61 |
Use the following guide to configure things, with more troubleshooting advice |
| 62 |
below: |
| 63 |
|
| 64 |
https://docs.cockpit-project.org/cockpit-guide/latest/guide/sso.html |
| 65 |
|
| 66 |
**BUG:** The host name of the computer Cockpit is running on should end with |
| 67 |
the domain name. If it does not, then rename the computer Cockpit is running on: |
| 68 |
[realmd bug](https://bugzilla.redhat.com/show_bug.cgi?id=1144343) |
| 69 |
|
| 70 |
$ sudo hostnamectl set-hostname my-server.domain.com |
| 71 |
|
| 72 |
**BUG:** If your domain is an IPA domain, then you need to explicitly add a service |
| 73 |
before Cockpit can be used with Single Sign on. The following must be done on |
| 74 |
the computer running Cockpit. |
| 75 |
[realmd bug](https://bugzilla.redhat.com/show_bug.cgi?id=1144292) |
| 76 |
|
| 77 |
$ sudo -s |
| 78 |
# kinit [email protected] |
| 79 |
# ipa service-add --ok-as-delegate=true --ok-to-auth-as-delegate=true --force HTTP/[email protected] |
| 80 |
# ipa-getkeytab -q -s services.cockpit.lan -p HTTP/my-server.cockpit.lan -k /etc/krb5.keytab |
| 81 |
|
| 82 |
Now when you go to your cockpit instance you should be able to log in without |
| 83 |
authenticating. Make sure to use the full hostname that you set above, the one |
| 84 |
that includes the domain name. |
| 85 |
|
| 86 |
If you want to use Cockpit to connect to a second server make sure that second |
| 87 |
server is joined to a domain, and that you can ssh into it using GSSAPI authentication |
| 88 |
with the domain user: |
| 89 |
|
| 90 |
$ ssh -o PreferredAuthentications=gssapi-with-mic [email protected] |
| 91 |
|
| 92 |
If you thought that was nasty and tiresome, it's because it is at present :S |
| 93 |
|
| 94 |
## Using delegated credentials |
| 95 |
|
| 96 |
Cockpit can delegate forwardable credentials. Make sure to specify you want them |
| 97 |
during kinit: |
| 98 |
|
| 99 |
$ kinit -f [email protected] |
| 100 |
$ klist -f |
| 101 |
Default principal: [email protected] |
| 102 |
... |
| 103 |
Flags: FIA |
| 104 |
|
| 105 |
Use the IPA GUI to setup "Trusted for delegation" for the host and service that |
| 106 |
Cockpit is running on. Make sure to tell the browser to delegate credentials |
| 107 |
as seen in the guide: |
| 108 |
|
| 109 |
https://docs.cockpit-project.org/cockpit-guide/latest/guide/sso.html |
| 110 |
|
| 111 |
Ze goggles, zey do nothing! |