EQTY LabDocs

Install swtpm-notary

Install the swtpm-notary package, the patched emulator behind every notary-backed vTPM, on Ubuntu, Debian or macOS, or build it, and how the notary finds and runs it.

View as Markdown

swtpm-notary is the patched swtpm that serves every notary-backed vTPM; see the overview for what it changes. The notary looks for it at /opt/eqty/swtpm-notary/bin/swtpm before anything else, so installing the package is all it takes to make new vTPMs hardware-rooted. You do not run swtpm by hand: the notary launches one per vTPM.

Packages

Both packages install bin/swtpm and the swtpm tools, man pages, docs and the patch series under /opt/eqty/swtpm-notary. They come from the swtpm-notary releases.

sh
sudo apt install ./eqty-swtpm-notary_{{VERSION}}_amd64.deb

Built on Ubuntu 26.04. Its dependencies come from dpkg-shlibdeps: glib, json-glib, libseccomp, OpenSSL and GnuTLS, which apt pulls in.

sh
sudo installer -pkg eqty-swtpm-notary-{{VERSION}}-arm64.pkg -target /

Apple silicon only. The package is self-contained: the Homebrew libraries swtpm needs are copied into /opt/eqty/swtpm-notary/lib and referenced by @rpath, so the Mac needs no Homebrew. Release packages are signed with EQTY’s Developer ID and notarized.

Check that the fork is in place and that the notary uses it:

sh
/opt/eqty/swtpm-notary/bin/swtpm socket --help | grep -E -- '--eps|--extkey'
sudo eqty-notaryctl vtpm create --id probe --client-uid "$(id -u)" --client-gid "$(id -g)"
eqty-notaryctl vtpm show probe        # probe  running  backing=identity  hardwareEps=true, emulator /opt/eqty/swtpm-notary/bin/swtpm
sudo eqty-notaryctl vtpm delete probe

The Linux notary .deb can also bundle the fork at /usr/local/lib/eqty-notary/swtpm when it is built with it. The package here takes precedence.

Build

sh
./build.sh            # in Docker (ubuntu:26.04); needs docker
./build.sh --native   # on this host

The result is out/inst/bin/swtpm, with libtpms linked in statically. The script fails if it is not: the binary’s hash then covers the code that enforces key restrictions, which is what the notary’s allow-list pins. Native build dependencies:

  • Debian and Ubuntu: build-essential autoconf automake libtool pkg-config gawk libjson-glib-dev libseccomp-dev libglib2.0-dev libssl-dev libgnutls28-dev gnutls-bin libtasn1-6-dev libtasn1-bin libgmp-dev socat iproute2 expect.
  • macOS, with Homebrew: autoconf automake libtool pkgconf gawk socat json-glib gnutls openssl@3 glib. The script uses Homebrew’s OpenSSL 3 explicitly and links the fork’s libtpms.a by path, so Homebrew’s own libtpms is never picked up.

To package: packaging/build-deb.sh and packaging/build-pkg.sh write to out/. Set VERSION=v0.10.2-eqty.1 for a release version; the default is 0.10.2+eqty.g<commit>.

Tests

Upstream’s suites, in the build tree:

sh
cd out/build/libtpms && make check   # 10 of 10 pass
cd out/build/swtpm && make check     # 61 pass, 16 skipped (root, CUSE, TPM 1.2)

The notary’s own tests exercise the patches end to end: the seed never in the state, the EK stable across restarts, TPM2_ChangeEPS, quotes by a backed IAK. From a vcomp-notary-desktop checkout:

sh
EQTY_VTPM_FORK_SWTPM=$PWD/../swtpm-notary/out/inst/bin/swtpm cargo test -p notary-vtpm

Point the notary at a build

Without the package, tell the notary where the binary is and turn the hardware rooting on:

sh
EQTY_VTPM_SWTPM=/path/to/out/inst/bin/swtpm
EQTY_VTPM_BACKING=identity          # IAK and AKs held by the host TPM or Secure Enclave
EQTY_VTPM_EPS=1                     # seed derived by the host root, never stored

From notary 0.0.7 the last two are the defaults whenever the configured swtpm is the fork. See Configuration.

What the notary passes

For each vTPM the notary runs:

text
swtpm socket --tpm2 --tpmstate dir=<state> \
  --key fd=3,mode=aes-256-cbc,format=binary \
  --migration-key fd=4,mode=aes-256-cbc,format=binary \
  --eps fd=5,notary=<EQTY_VTPM_DIR>/notary.sock \
  --extkey mode=identity,notary=<EQTY_VTPM_DIR>/notary.sock \
  --server type=unixio,path=<id>.sock --ctrl type=unixio,path=<id>.sock.ctrl ...
OptionMeaning
--key, --migration-keyStock swtpm options. The state and migration keys arrive over pipes, unsealed by the host root, and never touch the filesystem.
--eps fd=<fd>[,notary=<socket>]The patch. Exactly 64 bytes of seed, then end of file. Kept in locked memory. Without notary=, TPM2_ChangeEPS fails; with it, the next seed is asked for over the socket.
--extkey mode=identity|all-signing,notary=<socket>The patch. Registers the key hooks and forwards key creation and signing to the notary. Both parts are required. identity backs restricted endorsement-hierarchy keys; all-signing every eligible key.

Each swtpm also runs with a clean environment, no core dumps, its own session, and is exec’d from the descriptor the notary hashed. The fork locks the seed in memory.

Update to a newer upstream

To rebase onto a newer swtpm or libtpms release, apply patches/<project>/*.patch to the new tag with git am, resolve conflicts, refresh the trees and the series in patches/, and run scripts/verify-patches.sh with its TAG updated. The script checks that libtpms/ and swtpm/ are exactly upstream plus the series; CI runs it on every release.

License

libtpms and swtpm keep their own licenses. The EQTY changes are offered under the same terms as the files they modify.