@@ -15,14 +15,14 @@ Build the container images and containers:
15
15
```
16
16
ipalab-config ipalab-localkdc.yaml
17
17
cd localkdc
18
- podman build -t fedora-localkdc containerfiles/Containerfile.localkdc .
18
+ ansible-galaxy install -r requirements.yml
19
+ podman build -t fedora-localkdc -f containerfiles/Containerfile.localkdc .
19
20
podman-compose up -d
20
21
```
21
22
22
23
Deploy the local KDC demo nodes:
23
24
24
25
```
25
- cd localkdc
26
26
ansible-playbook -i inventory.yml playbooks/configure-localkdc.yaml
27
27
```
28
28
@@ -73,6 +73,20 @@ profile with following features enabled:
73
73
- ` with-gssapi ` , to enable use of ` pam_sss_gss ` PAM module for GSSAPI
74
74
authentication
75
75
76
+ ### Configuring the local KDC
77
+
78
+ The playbook ` playbooks/configure-localkdc.yaml ` calls a tool named
79
+ ` localkdc-setup ` to provision the local KDC configuration. It generates a
80
+ Kerberos realm named ` LOCALKDC.<SOME UUID> ` and provisions well-known Kerberos
81
+ principals in it. There are two individual service principals and a number of
82
+ aliases for them:
83
+
84
+ - ` host/... ` principal is used by the SSH and SSSD services
85
+ - ` cifs/... ` principal is used by the Samba services
86
+
87
+ Each service principal is added together with own aliases that correspond to
88
+ the various versions of the machine hostname.
89
+
76
90
### Add a new user
77
91
78
92
Since authentication of the user accounts is handled with the help of local
@@ -81,14 +95,21 @@ the system-wide user store in `/etc/passwd`.
81
95
82
96
A new user account can be added with ` useradd ` tool. However, in order to set a
83
97
password for this new account, a Kerberos principal needs to be added with
84
- ` localkdc-kadmin ` tool. ` localkdc-kadmin ` is a wrapper around ` kadmin.local `
98
+ ` localkdc-useradd ` tool. ` localkdc-useradd ` is a wrapper around ` kadmin.local `
85
99
tool to work on the local KDC database.
86
100
87
101
```
88
102
# useradd newuser
89
- # localkdc-kadmin addprinc newuser
103
+ # localkdc-useradd newuser
90
104
```
91
105
106
+ It is important to use the wrapper tools for local KDC administration. In
107
+ particular, in order to avoid dependency on the local KDC realm, all user
108
+ principals created with a special, randomized, salt type for their Kerberos
109
+ keys. The keys also stored in a special aliased entry (` userdb:... ` ) to allow
110
+ local KDC database driver first to validate that a Kerberos principal does
111
+ indeed exist on the system as a user and then return this entry.
112
+
92
113
### Use of Kerberos tools
93
114
94
115
MIT Kerberos library used in the local KDC demo is modified to support UNIX
@@ -108,22 +129,21 @@ module and produces an initial ticket granting ticket (TGT) in the Kerberos
108
129
credentials cache which can be seen with the help of ` klist ` command:
109
130
110
131
```
111
- $ podman run -ti --network ipanet-localkdc registry.fedoraproject.org/fedora-toolbox:latest \
112
- ssh -l testuser ab.localkdc.test
132
+ $ podman run -ti --network ipanet-localkdc fedora-toolbox:latest ssh -l testuser ab.localkdc.test
113
133
The authenticity of host 'ab.localkdc.test (192.168.221.2)' can't be established.
114
- ED25519 key fingerprint is SHA256:DJEnxvJgd50csPmB3+bgHH2+Qfgr0y3Bnfrr7lEo1nA .
134
+ ED25519 key fingerprint is SHA256:xDUKVLHsHC7T66Q6LERBL1PSzatKFZUuI56xvpOWyw8 .
115
135
This key is not known by any other names.
116
136
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
117
137
Warning: Permanently added 'ab.localkdc.test' (ED25519) to the list of known hosts.
118
138
119
- Last login: Sat Jan 25 12:00:39 2025 from 192.168.221.8
139
+ Last login: Sat May 3 10: 12:21 2025 from 192.168.221.4
120
140
[testuser@ab ~]$ klist
121
- Ticket cache: KCM:1000:81791
122
- Default principal: testuser@AB. LOCALKDC.SITE
141
+ Ticket cache: KCM:1000:55628
142
+ Default principal: testuser@LOCALKDC.2A1A0335-BF33-4B96-AC68-F98DCBF154A9
123
143
124
144
Valid starting Expires Service principal
125
- 01/25 /25 12:01:21 01/26 /25 12:01:21 krbtgt/AB. LOCALKDC.SITE@AB. LOCALKDC.SITE
126
- renew until 02/01 /25 12:01:21
145
+ 05/03 /25 10:18:11 05/04 /25 10:18:11 krbtgt/LOCALKDC.2A1A0335-BF33-4B96-AC68-F98DCBF154A9@ LOCALKDC.2A1A0335-BF33-4B96-AC68-F98DCBF154A9
146
+ renew until 05/10 /25 10:18:11
127
147
```
128
148
129
149
In a separate console obtained with the help of ` podman exec -ti ab.localkdc.test ` ,
@@ -132,13 +152,13 @@ issued the Kerberos ticket, as recorded in the `/var/log/localkdc.log` (the
132
152
output excerpt has been reformatted for convenience):
133
153
134
154
```
135
- Jan 25 12:01:21 ab.localkdc.test krb5kdc[781 ](info): AS_REQ
155
+ May 03 10:18:11 ab.localkdc.test krb5kdc[1113 ](info): AS_REQ
136
156
(6 etypes {aes256-cts-hmac-sha384-192(20), aes128-cts-hmac-sha256-128(19),
137
157
aes256-cts-hmac-sha1-96(18), aes128-cts-hmac-sha1-96(17),
138
158
camellia256-cts-cmac(26), camellia128-cts-cmac(25)})
139
- /run/localkdc/kdc.sock: ISSUE: authtime 1737806481,
159
+ /run/localkdc/kdc.sock: ISSUE: authtime 1746267491,
140
160
etypes {rep=aes256-cts-hmac-sha384-192(20), tkt=aes256-cts-hmac-sha384-192(20), ses=aes256-cts-hmac-sha384-192(20)},
141
- testuser@AB. LOCALKDC.SITE for krbtgt/AB. LOCALKDC.SITE@AB. LOCALKDC.SITE
161
+ testuser@LOCALKDC.2A1A0335-BF33-4B96-AC68-F98DCBF154A9 for krbtgt/LOCALKDC.2A1A0335-BF33-4B96-AC68-F98DCBF154A9@ LOCALKDC.2A1A0335-BF33-4B96-AC68-F98DCBF154A9
142
162
```
143
163
144
164
After that, we can ask for a service ticket to a different service, in this
@@ -182,14 +202,14 @@ we can see that this connection has indeed been established:
182
202
```
183
203
$ podman exec -ti ab.localkdc.test smbstatus
184
204
185
- Samba version 4.21.3
205
+ Samba version 4.22.1
186
206
PID Username Group Machine Protocol Version Encryption Signing
187
207
----------------------------------------------------------------------------------------------------------------------------------------
188
- 1091 testuser testuser 192.168.221.2 (ipv4:192.168.221.2:43092 ) SMB3_11 AES-128-GCM AES-128-GMAC
208
+ 1943 testuser testuser 192.168.221.2 (ipv4:192.168.221.2:43620 ) SMB3_11 partial( AES-128-GCM) AES-128-GMAC
189
209
190
210
Service pid Machine Connected at Encryption Signing
191
211
---------------------------------------------------------------------------------------------
192
- testuser 1091 192.168.221.2 Sat Jan 25 12:17:22 PM 2025 UTC - -
212
+ testuser 1943 192.168.221.2 Sat May 3 10:38:31 AM 2025 UTC AES-128-GCM AES-128-GMAC
193
213
194
214
No locked files
195
215
```
@@ -199,18 +219,48 @@ No locked files
199
219
We can connect to Samba also from the remote machine. In this case, the client
200
220
system will not have access to the local KDC on the machine where Samba is
201
221
running. However, ` smbclient ` will be able to use IAKerb protocol extension to
202
- proxy Kerberos requests to the local KDC.
222
+ proxy Kerberos requests to the local KDC on the Samba server side .
203
223
204
224
```
205
- $ podman exec -ti asn.localkdc.test smbclient -U [email protected] //ab.localkdc.test/homes
206
-
207
- ....
225
+ $ podman exec -ti asn.localkdc.test runuser -l testuser
226
+ [testuser@asn ~]$ klist
227
+ klist: Credentials cache 'KCM:1000' not found
228
+ [testuser@asn ~]$ smbclient -U testuser --use-kerberos=required --use-krb5-ccache=KCM: --client-protection=encrypt //ab.localkdc.test/homes
229
+ Password for [ASN\testuser]:
230
+ Try "help" to get a list of possible commands.
231
+ smb: \> dir
232
+ . D 0 Sat May 3 09:50:07 2025
233
+ .. D 0 Sat May 3 09:50:07 2025
234
+ .bash_logout H 18 Fri Nov 8 00:00:00 2024
235
+ .bash_profile H 144 Fri Nov 8 00:00:00 2024
236
+ .bashrc H 522 Fri Nov 8 00:00:00 2024
237
+ localkdc-demo.tape N 2604 Fri May 2 10:39:04 2025
238
+ .cache DH 0 Sat May 3 09:48:53 2025
239
+ .config DH 0 Sat May 3 09:47:28 2025
240
+ .pki DH 0 Sat May 3 09:47:29 2025
241
+ .local DH 0 Sat May 3 09:47:29 2025
242
+ .ssh DH 0 Sat May 3 09:49:52 2025
243
+ .bash_history H 1217 Sat May 3 10:18:23 2025
244
+ localkdc-demo.webm N 2702801 Sat May 3 09:51:39 2025
245
+
246
+ 998540288 blocks of size 1024. 805004744 blocks available
208
247
smb: \>
248
+ [testuser@asn ~]$ klist
249
+ Ticket cache: KCM:1000:33341
250
+ Default principal: [email protected]
251
+
252
+ Valid starting Expires Service principal
253
+ 05/03/25 10:46:41 05/04/25 10:46:41 krbtgt/LOCALKDC.2A1A0335-BF33-4B96-AC68-F98DCBF154A9@LOCALKDC.2A1A0335-BF33-4B96-AC68-F98DCBF154A9
254
+ renew until 05/10/25 10:46:41
255
+ 05/03/25 10:46:41 05/04/25 10:46:41 cifs/ab.localkdc.test@
256
+ renew until 05/10/25 10:46:41
257
+ Ticket server: cifs/[email protected]
209
258
```
210
259
211
- An authentication in this case will use Kerberos mechanism but will require
212
- password to proxy the request to the local KDC on Samba server side over the
213
- SMB3 connection.
260
+ An authentication in this case will use Kerberos mechanism. However, Samba client will require
261
+ a password because there are no valid credentials (yet) to authenticate. On its
262
+ side, Samba server will then proxy the request to the local KDC on Samba server
263
+ side. This Kerberos exchange will happen completely over SMB3 connection.
214
264
215
265
## Recording video of the demo operations
216
266
@@ -220,9 +270,7 @@ The lab also includes a tape to record a video. Ansible playbook
220
270
Video recording is built upon excellent
221
271
[ VHS] ( https://github.com/charmbracelet/vhs ) tool. A pre-built version for
222
272
Fedora is provided in [ COPR
223
- abbra/vhs] ( https://copr.fedorainfracloud.org/coprs/abbra/vhs/ ) . This build also
224
- includes a fix from the upstream
225
- [ PR #551 ] ( https://github.com/charmbracelet/vhs/pull/551 ) .
273
+ abbra/vhs] ( https://copr.fedorainfracloud.org/coprs/abbra/vhs/ ) .
226
274
227
275
```
228
276
[in the generated localkdc directory]
0 commit comments