79.4. krb5-1.22.2
Kerberos 5 authentication libraries and tools
| Version | 1.22.2, release 2 |
| Shelf | auth — Authentication, authorisation, accounts and directory services |
| Phase | 41_system (System), 169 of 1047 in build order |
| Licence | MIT |
| Homepage | https://web.mit.edu/kerberos/ |
| Build time | 2.3 SBU |
| Installed size | 3.8 MiB in 123 files |
| Recipe | ports/core/auth/krb5/kpkgbuild |
About
MIT Kerberos 5 provides the libraries (libkrb5, libgssapi_krb5 and the rest) and the client tools — kinit, klist, kdestroy, kpasswd, kvno — with which a machine gets and uses tickets from a realm’s key distribution centre. KDOS needs it as a client and nothing more: kinit gets a ticket, and cifs.upcall from cifs-utils hands it to the kernel’s cifs module so that a sec=krb5 mount reaches a file server that will not take a password. The server half — the KDC, kadmind, the database utilities — is built, because there is no switch to leave it out, and then removed from the package. See also Kerberos is built and has never been given a ticket.
Why it is in KDOS
The comment above it in script/phases/41_system/packages.d/auth.txt:
A TICKET, BECAUSE A CORPORATE FILE SERVER OFTEN WILL NOT TAKE A PASSWORD.
kinitgets one andcifs.upcall— which is what puts krb5 in cifs-utils'depends— hands it to the kernel's cifs module, sosec=krb5has somewhere to call out to. The client half only: no KDC and no administration daemon are installed.
Sources
krb5-1.22.2.tar.gz(8.3 MiB)
sha2563243ffbc8ea4d4ac22ddc7dd2a1dc54c57874c40648b60ff97009763554eaf13
upstream: https://kerberos.org/dist/krb5/1.22/krb5-1.22.2.tar.gz
archive copy: sources-1/auth--krb5-1.22.2.tar.gz
Dependencies
Depends on: openssl, keyutils, e2fsprogs, bison.
Required by (14): chromium, cifs-utils, freerdp, libsoup3, libssh, libtirpc, nfs-utils, openconnect, openssh, postgresql, qt6-qtbase, qt6-qtwebengine, wine, wireshark.
Optional, off in KDOS
These switches in build.sh turn off a feature whose library is a port here. The recipe may turn each off on purpose, or because the library was not yet a port when the recipe was written; this list cannot tell which.
--without-ldap, line 34: openldap (explained with the switches below)--without-readline, line 35: readline (explained with the switches below)--without-libedit, line 36: libedit--without-lmdb, line 37: lmdb
Patches
build.sh applies these; kpkg applies nothing by itself.
openssl4.patch— Ports the PKINIT and KKDCP TLS plug-ins to OpenSSL 4, whereASN1_STRINGis opaque and several getters returnconst.k5tlschecks the proxy’s certificate withX509_check_host()andX509_check_ip_asc()instead of walking subjectAltName and the common name by hand, and PKINIT reads every ASN.1 string throughASN1_STRING_get0_data()andASN1_STRING_length(), both present in every OpenSSL from 1.1.0 on.
Installation
From the repository root, inside the build container, this is the line kdosbuild runs for the port:
script/chroot/exec.sh bash -c 'source script/phases/41_system/phase.env && kpkg install krb5'
What kpkg does
kpkg runs these steps, in this order, as root inside the chroot. The port directory is /ports/core/auth/krb5.
1. Verify every declared source. Each file a sha256 = line names, found in the port directory or in /var/cache/kpkg/sources, must hash to its line; a mismatch stops the build before anything is unpacked.
cd /ports/core/auth/krb5
echo '3243ffbc8ea4d4ac22ddc7dd2a1dc54c57874c40648b60ff97009763554eaf13 krb5-1.22.2.tar.gz' | sha256sum -c -
2. Unpack. The work directory is emptied and the first source is unpacked into $SRC with its top directory stripped; any later tarball lands unstripped beside it in $SRC_ROOT, and a file that is not a tarball is copied into $SRC.
SRC_ROOT=/var/cache/kpkg/work/krb5
SRC=$SRC_ROOT/krb5-1.22.2
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf krb5-1.22.2.tar.gz -C "$SRC" --strip-components=1
Every config.guess and config.sub older than automake’s is then replaced with automake’s, so a configure script recognises the musl target.
3. Build. build.sh is sourced in a subshell under set -e, from $SRC, with name, version, release and the five paths PKGNAME, PORT_SRC, SRC_ROOT, SRC and PKG set as shell variables. Its body, verbatim:
patch -p1 -i "$PORT_SRC/openssl4.patch"
cd src
./configure \
--prefix=/usr \
--sysconfdir=/etc \
--localstatedir=/var \
--libdir=/usr/lib \
--runstatedir=/run \
--sbindir=/usr/sbin \
--disable-static \
--disable-rpath \
--disable-nls \
--enable-dns-for-realm \
--with-crypto-impl=openssl \
--with-tls-impl=openssl \
--with-spake-openssl \
--enable-pkinit \
--with-keyutils \
--with-system-et \
--without-system-verto \
--without-ldap \
--without-readline \
--without-libedit \
--without-lmdb
make
make DESTDIR=$PKG install
rm -rf "$PKG/run"
for _s in krb5kdc kadmind kadmin.local kdb5_util kprop kpropd \
kproplog sserver gss-server sim_server uuserver krb5-send-pr; do
rm -f "$PKG/usr/sbin/$_s"
done
for _s in gss-client sclient sim_client uuclient krb5-send-pr; do
rm -f "$PKG/usr/bin/$_s"
done
rm -f "$PKG/usr/bin/ksu"
rm -f "$PKG/usr/share/man/man1/ksu.1"*
for _s in krb5kdc kadmind kadmin.local kdb5_util kdb5_ldap_util kprop kpropd \
kproplog sserver sclient kdc.conf kadm5.acl; do
rm -f "$PKG/usr/share/man/man1/$_s."* \
"$PKG/usr/share/man/man5/$_s."* "$PKG/usr/share/man/man8/$_s."*
done
install -Dm644 /dev/stdin "$PKG/etc/request-key.d/cifs.spnego.conf" <<'RK'
create cifs.spnego * * /usr/sbin/cifs.upcall %k
RK
The switches, and why each is set:
--sbindir=/usr/sbin,--runstatedir=/run— The server programs install to/usr/sbin, andbuild.shremoves them from there;libkrb5also compiles the directory in as the value of%{SBINDIR}in akrb5.confpath. The run-time directory compiled in is/run.make installcreates that directory in the package, and the package lint refusesrunin a port’s payload, sobuild.shremoves it again.--disable-rpath— Every library lands in/usr/lib, and an rpath naming the build tree is one the package manager cannot rewrite.--disable-nls— krb5 callsdgettextdirectly. With NLS left on,configurefindslibintl.hfrom thegettextport and then looks fordgettextby linking, finds it in musl’s C library and adds no-lintl; but thegettextport’slibintl.hrenames the call tolibintl_dgettext, which onlylibintldefines, and the first shared library fails withundefined reference to libintl_dgettext(see Gettext on musl). What is given up is translated messages from the Kerberos libraries.--enable-dns-for-realm— Find a realm’s KDCs from the DNS SRV records a domain publishes, instead of needing every realm written out inkrb5.conf; that is the shape asec=krb5mount is used in.--with-crypto-impl=openssl— Take AES, SHA-2 and the rest from OpenSSL rather than krb5’s built-in code; a second implementation on the same disk is a second set of advisories to track.--with-tls-impl=openssl— Build the TLS module that reaches a KDC through an MS-KKDCP HTTPS proxy.--with-spake-openssl— SPAKE pre-authentication with libcrypto’s NIST elliptic-curve groups.--enable-pkinit— PKINIT,kinitwith a certificate or a smart card.--with-keyutils— The kernel-keyring credential cache,KEYRING:, which akrb5.confmay name instead of a file;keyutilsis a dependency for it.--with-system-et— Usecompile_etandlibcom_errfrome2fsprogsinstead of building and installing krb5’s own copy.--without-system-verto— Build and install the bundledlibverto, the event-loop abstraction the KDC,kadmind,libkradand the OTP pre-authentication plug-in link. There is no libverto port; left alone,configurewould take a system libverto wheneverpkg-configfound one and the bundled copy otherwise, so the switch fixes the choice.--without-ldap,--without-lmdb— The LDAP and LMDB database back ends, which serve the KDC this package does not ship.--without-readline,--without-libedit— The line editor they would give iskadmin’s, andkadminadministers a realm this system does not serve.
The common switches of each build system are explained in the Flag glossary.
4. Package. kpkg removes libtool archives, the info directory index, mimeinfo.cache and every fonts.dir from $PKG, copies the source’s licence files into /usr/share/licenses/krb5, prunes what the image does not ship, lints the tree and rolls it reproducibly:
tar --sort=name --format=gnu --numeric-owner --owner=0 --group=0 \
--mtime=@$SOURCE_DATE_EPOCH \
--use-compress-program='xz -9 -T0 --block-size=32MiB --no-adjust' \
-cf krb5-1.22.2-2.tar.xz -C "$PKG" .
5. Adopt. kpkgadd installs the package’s files over the root, refusing a path another package owns, records the file list in /var/lib/kpkg/db/krb5, and runs the triggers its paths call for.
Contents
Installed programs: k5srvutil, kadmin, kdestroy, kinit, klist, kpasswd, krb5-config, kswitch, ktutil, kvno.
Installed libraries: libgssapi_krb5.so, libgssrpc.so, libk5crypto.so, libkadm5clnt.so, libkadm5clnt_mit.so, libkadm5srv.so, libkadm5srv_mit.so, libkdb5.so, libkrad.so, libkrb5.so, libkrb5support.so, libverto.so.
Installed directories: /usr/include/gssapi, /usr/include/gssrpc, /usr/include/kadm5, /usr/include/krb5, /usr/lib/krb5, /usr/share/examples, /usr/share/licenses/krb5, /var/krb5kdc.
Short descriptions
k5srvutil |
host key table (keytab) manipulation utility |
kadmin |
Kerberos V5 database administration program |
kdestroy |
destroy Kerberos tickets |
kinit |
obtain and cache Kerberos ticket-granting ticket |
klist |
list cached Kerberos tickets |
kpasswd |
change a user's Kerberos password |
krb5-config |
tool for linking against MIT Kerberos libraries |
kswitch |
switch primary ticket cache |
ktutil |
Kerberos keytab file maintenance utility |
kvno |
print key version numbers of Kerberos principals |
gssrpc.pc |
GSSAPI RPC implementation |
kadm-client.pc |
Kerberos administration client library |
kadm-server.pc |
Kerberos administration server library |
kdb.pc |
Kerberos database access libraries |
krb5.pc |
An implementation of Kerberos network authentication |
krb5-gssapi.pc |
Kerberos implementation of the GSSAPI |
mit-krb5.pc |
An implementation of Kerberos network authentication |
mit-krb5-gssapi.pc |
Kerberos implementation of the GSSAPI |
Notes
- The TLS module, SPAKE, PKINIT and the keyring are named, not probed. Left to
configure, each is dropped without an error when its probe misses. - The configure script is in
src. Everything above it in the tarball is documentation, sobuild.shchanges directory after the patch, which is written against the top. - What is removed after the install. The server programs (
krb5kdc,kadmind,kadmin.local,kdb5_util,kprop,kpropd,kproplog) and their manual pages; the tutorial servers and their clients (sserver/sclient,gss-server/gss-client,sim_server/sim_client,uuserver/uuclient);krb5-send-pr, which mails a bug report through a mail transport nothing configures; andksu. A partialmakein a tree with this many inter-library dependencies fails in places that have nothing to do with the KDC, so the whole tree is built and these are taken back out. ksuwould be a setuid-root binary nothing needs. It issufor a Kerberos principal, on a machine whose accounts are local and whose privilege escalation issudo; see setuid binaries.- The
request-keyrule.build.shinstalls/etc/request-key.d/cifs.spnego.conf, which tellsrequest-keyto runcifs.upcallwhen the kernel’s cifs module asks for a ticket.keyutilsowns that directory and ships it empty; without the rule the mount fails withRequired key not available, and nothing says which key. There is no rule forcifs.idmap: it needs winbind’s client library, whichsambahere is built without.