Debian Codegraph @

doc/modules/guide/pages/sso.adoc

raw
1 [[sso]]
2 = Single Sign On
3
4 Cockpit can use Kerberos for Single Sign On authentication, where users
5 are automatically authenticated if they have a valid Kerberos ticket.
6
7 [[sso-server]]
8 == Server Requirements
9
10 To authenticate users, the server that Cockpit is running on must be
11 joined to a domain. This can usually be accomplished using the
12 https://freedesktop.org/software/realmd/docs/realm.html[`+realm join example.com+`]
13 command.
14
15 The domain must be resolvable by DNS. For instance, the SRV records of
16 the kerberos server should be resolvable:
17
18 ....
19 $ host -t SRV _kerberos._udp.example.com
20 _kerberos._udp.example.com has SRV record 0 100 88 dc.example.com
21 ....
22
23 The server running Cockpit should have a fully qualified name that ends
24 with the domain name.
25
26 There must be a valid Kerberos host key for the server in the
27 `+/etc/krb5.keytab+` file. Alternatively, if you would like to use a
28 different keytab, you can do so by placing it in
29 `+/etc/cockpit/krb5.keytab+`, or below `+$XDG_CONFIG_DIRS+` if set (see
30 link:./cockpit.conf.5.html[cockpit.conf]). It may be necessary to create
31 a kerberos service principal and update the keytab if it is not present.
32 Depending on your domain type different service names are required:
33
34 Active Directory::
35 `+HOST/[email protected]+`
36 IPA and MIT::
37 `+HTTP/[email protected]+`
38
39 When joining an IPA domain with Cockpit and the `+ipa+` command line
40 tool is available, both the service principal name and a
41 `+/etc/cockpit/krb5.keytab+` get created automatically, so that Kerberos
42 based single sign on into Cockpit works out of the box. If you want/need
43 to do this by hand or in a script, first create or modify the `+HTTP/+`
44 service principal:
45
46 ....
47 $ sudo ipa service-add --ok-as-delegate=true --ok-to-auth-as-delegate=true \
48 HTTP/[email protected]
49 # or, if it already exists, just enable delegation:
50 $ sudo ipa service-mod --ok-as-delegate=true --ok-to-auth-as-delegate=true \
51 HTTP/[email protected]
52 ....
53
54 Then generate a key for that principal:
55
56 ....
57 $ sudo ipa-getkeytab -p HTTP/[email protected] -k /etc/cockpit/krb5.keytab
58 ....
59
60 The following command can be used to list the
61 `+/etc/cockpit/krb5.keytab+`:
62
63 ....
64 $ sudo klist -k /etc/cockpit/krb5.keytab
65 ....
66
67 Lastly accounts from the domain must be resolvable to unix accounts on
68 the server running Cockpit. For example:
69
70 ....
71 $ getent passwd [email protected]
72 [email protected]:*:381001109:381000513:User Name:/home/user:/bin/sh
73 ....
74
75 If you wish to delegate your kerberos credentials to Cockpit, and allow
76 Cockpit to then connect to other machines using those credentials, you
77 should enable delegation for the hosts running Cockpit, and in some
78 cases the `+HTTP+` service as well. When joining an IPA domain, this is
79 enabled by default.
80
81 Domain admins (usually the `[email protected]+` group) should normally
82 also be able to administer any joined machine. Enable sudo access for
83 that group with the following command on the IPA server, for version
84 4.7.1 and later:
85
86 ....
87 ipa-advise enable-admins-sudo | sh -ex
88 ....
89
90 On earlier FreeIPA versions, run these commands instead, as a domain
91 admin on any joined machine:
92
93 ....
94 ipa sudorule-add --hostcat=all --cmdcat=all All
95 ipa sudorule-add-user --groups=admins All
96 ....
97
98 Note that this does not change security properties; domain admins can
99 give this privilege to themselves, so it is safe to enable by default.
100
101 [[sso-client]]
102 == Client Requirements
103
104 The client side, where your web browser is running, should have a valid
105 kerberos ticket in the current user session. A command like this will
106 get one:
107
108 ....
109 $ kinit [email protected]
110 Password for [email protected]:
111 ....
112
113 In addition your browser must be usually be configured to allow kerberos
114 authentication for the domain.
115
116 Mozilla Firefox::
117 Go to `+about:config+` and set the
118 `+network.negotiate-auth.trusted-uris+` setting to your domain name
119 preceded by a dot, ie: `+.example.com+`
120 Google Chrome::
121 On Linux: create the file
122 `+/etc/opt/chrome/policies/managed/example-com.json+` with the
123 contents:
124
125 {empty}::
126 ....
127 {
128 "AuthServerWhitelist": "*example.com"
129 }
130 ....
131
132 {empty}::
133 and restart the browser. On other platforms, exit your browser
134 completely, and start it with a command line like this:
135 `+google-chrome --auth-server-whitelist=*example.com+`
136
137 Use a fully qualified server name (with the domain name at the end) to
138 access Cockpit in your web browser.
139
140 If you wish to connect from one server to another in Cockpit using
141 kerberos SSO, then you have to explicitly enable all sorts of things.
142 For starters, make sure that delegated credentials are allowed by your
143 domain (see above). Next when requesting your kerberos ticket make sure
144 that forwardable tickets are requested:
145
146 ....
147 $ kinit -f [email protected]
148 Password for [email protected]:
149 ....
150
151 Make sure that the forwardable flag `+F+` is present in your ticket:
152
153 ....
154 $ klist -f
155 Ticket cache: KEYRING:persistent:1000:1000
156 Default principal: [email protected]
157
158 Valid starting Expires Service principal
159 18.03.2017 05:39:23 19.03.2017 05:39:20 krbtgt/[email protected]
160 Flags: FIA
161 ....
162
163 Lastly configure your browser to allow delegated, forwardable kerberos
164 credentials to be sent to Cockpit:
165
166 Mozilla Firefox::
167 Go to `+about:config+` and set the
168 `+network.negotiate-auth.delegation-uris+` setting to your domain name
169 preceded by a dot, ie: `+.example.com+`
170 Google Chrome::
171 On Linux: create the file
172 `+/etc/opt/chrome/policies/managed/example-com.json+` with the
173 contents:
174
175 {empty}::
176 ....
177 {
178 "AuthServerWhitelist": "*example.com",
179 "AuthNegotiateDelegateWhitelist": "*example.com"
180 }
181 ....
182
183 {empty}::
184 and restart the browser. On other platforms, exit your browser
185 completely, and start it with a command line like this:
186 `+google-chrome --auth-server-whitelist=*example.com --auth-negotiate-delegate-whitelist=*example.com+`