1 .\" Copyright (c) 2020 Kungliga Tekniska Högskolan
2 .\" (Royal Institute of Technology, Stockholm, Sweden).
3 .\" All rights reserved.
5 .\" Redistribution and use in source and binary forms, with or without
6 .\" modification, are permitted provided that the following conditions
9 .\" 1. Redistributions of source code must retain the above copyright
10 .\" notice, this list of conditions and the following disclaimer.
12 .\" 2. Redistributions in binary form must reproduce the above copyright
13 .\" notice, this list of conditions and the following disclaimer in the
14 .\" documentation and/or other materials provided with the distribution.
16 .\" 3. Neither the name of the Institute nor the names of its contributors
17 .\" may be used to endorse or promote products derived from this software
18 .\" without specific prior written permission.
20 .\" THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
21 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
24 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
36 .Nd HTTP HDB Administration Interface
42 .Op Fl d | Fl Fl daemon
43 .Op Fl Fl daemon-child
44 .Op Fl Fl reverse-proxied
45 .Op Fl p Ar port number (default: 443)
47 .Op Fl Fl no-allow-GET
48 .Op Fl Fl GET-with-csrf-token
49 .Op Fl Fl csrf-header= Ns Ar HEADER-NAME
50 .Op Fl Fl temp-dir= Ns Ar DIRECTORY
51 .Op Fl Fl cert=HX509-STORE
52 .Op Fl Fl private-key=HX509-STORE
53 .Op Fl T | Fl Fl token-authentication-type=Negotiate|Bearer
56 .Op Fl l | Fl Fl local
57 .Op Fl Fl local-read-only
59 .Op Fl Fl stash-file=FILENAME
60 .Op Fl Fl primary-server-uri=URI
61 .Op Fl Fl read-only-admin-server=HOSTNAME[:PORT]
62 .Op Fl Fl writable-admin-server=HOSTNAME[:PORT]
63 .Op Fl Fl kadmin-client-name=PRINCIPAL
64 .Op Fl Fl kadmin-client-keytab=KEYTAB
65 .Op Fl t | Fl Fl thread-per-client
67 .Fl Fl verbose= Ns Ar run verbosely
71 Serves the following resources over HTTP:
77 end-point allows callers to get a principal's keys in
79 format for named principals, possibly performing write operations
80 such as creating a non-existent principal, or rotating its keys,
82 Note that this end-point can cause KDC HDB principal entries to
83 be modified or created incidental to fetching the principal's
85 The use of the HTTP POST method is required when this end-point
86 writes to the KDC's HDB.
91 end-point allows callers to get
93 contents for a given principal.
95 This service can run against a local HDB, or against a remote HDB
99 Read operations are always allowed, but write operations can be
100 preformed either against writable
102 server(s) or redirected to another
107 end-point accepts a single query parameter:
108 .Bl -tag -width Ds -offset indent
109 .It Ar princ=PRINCIPAL .
112 All HTTP APIs served by this program accept POSTs, with all
113 request parameters given as either URI query parameters, and/or
114 as form data in the POST request body, in either
115 .Ar application/x-www-form-urlencoded
117 .Ar multipart/formdata .
118 If GETs are enabled, then request parameters must be supplied as
119 URI query parameters.
121 Note that requests that cause changes to the HDB must always be
122 done via POST, never GET.
124 URI query parameters must be of the form
125 .Ar param0=value¶m1=value...
126 Some parameters can be given multiple values -- see the
127 descriptions of the end-points.
128 .Sh CROSS-SITE REQUEST FORGERY PROTECTION
130 of the resources service by this service are intended to be
131 executed by web pages.
133 Most of the resources provided by this service are
135 in the sense that they do not change server-side state besides
136 logging, and in that they are idempotent, but they are
139 the requesting party is trusted to see the response.
140 Since none of these resources are intended to be used from web
141 pages, it is important that web pages not be able to execute them
143 observe the responses.
145 Some of the resources provided by this service do change
146 server-side state, specifically principal entries in the KDC's
148 Those always require the use of POST, not GET.
150 In a web browser context, pages from other origins will be able
151 to attempt requests to this service, but should never be able to
152 see the responses because browsers normally wouldn't allow that.
153 Nonetheless, anti cross site request forgery (CSRF) protection
156 This service provides the following CSRF protection features:
157 .Bl -tag -width Ds -offset indent
158 .It requests are rejected if they have a
160 (except the experimental /get-negotiate-token end-point)
161 .It the service can be configured to require a header that would make the
162 request not Dq simple
163 .It GETs can be disabled (see options), thus requiring POSTs
164 .It GETs can be required to have a CSRF token (see below)
165 .It POSTs can be required to have a CSRF token
169 .Ar /get-negotiate-token
170 end-point, however, always accepts
174 To obtain a CSRF token, first execute the request without the
175 CSRF token, and the resulting error
176 response will include a
180 To execute a request with a CSRF token, first obtain a CSRF token
181 as described above, then copy the token to the request as the
182 value of the request's
186 The key for keying the CSRF token HMAC is that of the first
188 .Sq WELLKNOWN/CSRFTOKEN
189 principal for the realm being used.
190 Every realm served by this service must have this principal.
194 end-point accepts various parameters:
195 .Bl -tag -width Ds -offset indent
197 Names the host-based service principal whose keys to get.
198 May be given multiple times, and all named principal's keys will
200 .It Ar dNSName=HOSTNAME
201 Names the host-based service principal's hostname whose keys to get.
202 May be given multiple times, and all named principal's keys will
204 .It Ar service=SERVICE
207 will be qualified with this service name to form a host-based
209 May be given multiple times, in which case the cartesian product
218 Must be present if the
220 daemon's default realm is not desired.
221 .It Ar enctypes=ENCTYPE,...
222 A comma-separated list of enctypes that the principal is expected
223 to support (used for Kerberos Ticket session key negotiation).
225 .Ar supported_enctypes
228 .It Ar materialize=true
229 If the named principal(s) is (are) virtual, this will cause it
230 (them) to be materialized as a concrete principal.
231 (Currently not supported.)
233 If the named principal(s) does not (do not) exist, this will
234 cause it (them) to be created.
235 The default attributes for new principals created this way will
236 be taken (except for the disabled attribute) from any containing
237 virtual host-based service principal namespace that include a
240 in the hostname component, or from
242 (see the CONFIGURATION section).
244 This will cause the keys of concrete principals to be rotated.
246 This will cause old keys of concrete principals to be deleted
247 if their keys are being rotated.
248 This means that extant service tickets with those principals as
249 the target will not be able to be decrypted by the caller as it
250 will not have the necessary keys.
255 header will be set on
261 cache control parameter will be set to the least number of
262 seconds until before any of the requested principal's keys could
264 For virtual principals this will be either the time left until a
265 quarter of the rotation period before the next rotation, or the
267 quarter of the rotation period after the next rotation.
268 For concrete principals this will be the time left to the first
269 such principal's password expiration, or, if none of them have a
270 configured password expiration time, then half of the
271 .Nm new_service_key_delay
278 Authorization is handled via the same mechanism as in
280 which was originally intended to authorize certification requests
282 Authorization for extracting keys is specified like for
287 .Nm krb5.conf(5) section.
288 Clients with host-based principals for the
290 service can create and extract keys for their own service name,
291 but otherwise a number of service names are denied:
292 .Bl -tag -width Ds -offset indent
297 as well as all the service names for Heimdal-specific services:
298 .Bl -tag -width Ds -offset indent
308 .Bl -tag -width Ds -offset indent
321 Expected audience(s) of bearer tokens (i.e., acceptor name).
326 Detach from TTY and run in the background.
328 .Fl Fl reverse-proxied
330 Serves HTTP instead of HTTPS, accepting only looped-back connections.
332 .Fl p Ar port number (default: 443)
338 If given, then HTTP GET will be allowed for the various end-points
341 Otherwise only HEAD and POST will be allowed.
342 By default GETs are allowed, but this will change soon.
346 If given then HTTP GETs will be rejected for the various
347 end-points other than
350 .Fl Fl csrf-protection-type= Ns Ar CSRF-PROTECTION-TYPE
353 .Ar CSRF-PROTECTION-TYPE
355 .Bl -bullet -compact -offset indent
365 This may be given multiple times.
366 The default is to require CSRF tokens for POST requests, and to
367 require neither a non-simple header nor a CSRF token for GET
371 .Sx CROSS-SITE REQUEST FORGERY PROTECTION .
373 .Fl Fl csrf-header= Ns Ar HEADER-NAME
375 If given, then all requests other than to the
377 service must have the given request
379 set (the value is irrelevant).
381 .Fl Fl temp-dir= Ns Ar DIRECTORY
383 Directory for temp files.
384 If not specified then a temporary directory will be made.
386 .Fl Fl cert= Ns Ar HX509-STORE
388 Certificate file path (PEM) for HTTPS service.
389 May contain private key as well.
391 .Fl Fl private-key= Ns Ar HX509-STORE
393 Private key file path (PEM), if the private key is not stored along with the
396 .Fl T Ar HTTP-AUTH-TYPE,
397 .Fl Fl token-authentication-type= Ns Ar HTTP-AUTH-TYPE
399 HTTP bearer token authentication type(s) supported (may be given more than
408 .Fl Fl thread-per-client
410 Uses a thread per-client instead of as many threads as there are CPUs.
412 .Fl Fl realm= Ns Ar REALM
414 The realm to serve, if not the default realm.
415 Note that clients can request keys for principals in other realms, and
417 will attempt to satisfy those requests too.
421 Do not perform write operations.
422 Write operations will either fail or if a primary
424 URI is configured, then they will be redirected there.
428 Use a local HDB, at least for read operations, and, if
429 .Fl Fl local-read-only
430 is not given, then also write operations.
432 .Fl Fl local-read-only
434 Do not perform writes on a local HDB.
435 Either redirect write operations if a primary
437 URI is configured, or use a writable remote
443 A local HDB to serve.
444 Note that this can be obtained from the
447 .Fl Fl stash-file=FILENAME
449 A stash file containing a master key for a local HDB.
450 Note that this can be obtained from the
453 .Fl Fl primary-server-uri=URI
455 The URL of an httpkadmind to which to redirect write operations.
457 .Fl Fl read-only-admin-server=HOSTNAME[:PORT]
459 The hostname (and possibly port number) of a
461 service to use for read-only operations.
464 service's principal name is
468 given here can be a name that resolves to the IP addresses of all
473 If not specified, but needed, this will be obtained by looking for
474 .Nm readonly_admin_server
477 or, if enabled, performing
478 DNS lookups for SRV resource records named
479 .Ar _kerberos-adm-readonly._tcp.<realm> .
481 .Fl Fl writable-admin-server=HOSTNAME[:PORT]
483 The hostname (and possibly port number) of a
485 service to use for write operations.
486 If not specified, but needed, this will be obtained by looking for
490 or, if enabled, performing DNS lookups for SRV resource records named
491 .Ar _kerberos-adm._tcp.<realm> .
493 .Fl Fl kadmin-client-name=PRINCIPAL
495 The client principal name to use when connecting to a
499 .Ar httpkadmind/admin .
501 .Fl Fl kadmin-client-keytab=KEYTAB
503 The keytab containing keys for the
504 .Ar kadmin-client-name .
505 Note that you may use an
508 .Ar HDBGET:/var/heimdal/heimdal.db
509 (or whatever the HDB specification is).
512 .Fl Fl verbose= Ns Ar run verbosely
526 .It Pa /etc/krb5.conf
529 Authorizer configuration goes in
533 .Nm krb5.conf(5). For example:
535 .Bd -literal -offset indent
537 simple_csr_authorizer_directory = /etc/krb5/simple_csr_authz
538 ipc_csr_authorizer = {
539 service = UNIX:/var/heimdal/csr_authorizer_sock
543 Configuration parameters specific to
545 .Bl -tag -width Ds -offset indent
546 .It csr_authorizer_handles_svc_names = BOOL
547 .It new_hostbased_service_principal_attributes = ...
552 .Nm get_keys_max_spns = NUMBER
553 parameter can be used to specify a maximum number of principals whose
554 keys can be retrieved in one
563 .Nm new_hostbased_service_principal_attributes
564 parameter may be used instead of virtual host-based service
565 namespace principals to specify the attributes of new principals
568 and its value is a hive with a service name then a hostname or
569 namespace, and whose value is a set of attributes as given in the
573 .Bd -literal -offset indent
575 new_hostbased_service_principal_attributes = {
577 a-particular-hostname.test.h5l.se = ok-as-delegate
578 .prod.test.h5l.se = ok-as-delegate
584 .Dq host/a-particular-hostname.test.h5l.se ,
587 will be allowed to get delegated credentials (ticket forwarding),
588 and that hostnames matching the glob pattern
589 .Dq host/*.prod.test.h5l.se ,
592 will also allowed to get delegated credentials.
593 All host-based service principals created via
596 .Nm new_hostbased_service_principal_attributes
597 service namespaces will have the empty attribute set.
603 .Ar $ httpkadmind -d --cert=PEM-FILE:/etc/httpkadmind.pem
610 on a secondary KDC, using redirects for write operations:
612 .Ar $ httpkadmind -d --cert=PEM-FILE:/etc/httpkadmind.pem
615 --local-read-only -T Negotiate
618 --primary-server-uri=https://the-primary-server.fqdn/
622 on a secondary KDC, proxying kadmin to perform writes at the primary KDC, using
623 DNS to discover the kadmin server:
625 .Ar $ httpkadmind -d --cert=PEM-FILE:/etc/httpkadmind.pem
628 --local-read-only -T Negotiate
631 --kadmin-client-keytab=FILE:/etc/krb5.keytab
637 .Ar $ httpkadmind -d --cert=PEM-FILE:/etc/httpkadmind.pem
640 -T Negotiate --kadmin-client-keytab=FILE:/etc/krb5.keytab
643 See logging section of