Files
Kamino/roles/openbao/templates/openbao.service.j2
T
Defame1297 eda69bcbf5 feat(openbao): add the role's main entry point
A consumer gets a running single-node OpenBao server on integrated raft
storage, listening on TLS they supply, left uninitialised and sealed.

The role installs the pinned 2.7.3 release tarball, checked by get_url
against the sha256 of each architecture from the release's checksums.txt
(its GPG signature checks out against OpenBao's release key). It creates
its own system user, data directory, configuration and sandboxed unit:
Type=notify, SIGINT stop, MemorySwapMax=0 instead of mlock, an empty
capability set, ProtectSystem=strict with the data directory writable,
and ExecReload sending SIGHUP. The directive set was tried against the
real binary under systemd before it was kept.

TLS certificate, key and CA paths are required unless openbao_tls_disable
is true, which warns; validation fails before any change when a file is
missing, and the role checks the service user can read the key and
certificate before writing the config. It reads its seal status over
https://127.0.0.1 validated against the CA file, so an address other
than a wildcard or loopback gets a second loopback listener.

The tasks are split by job (validate, prereqs, install, configure,
seal_status) so the init, unseal, audit and update work can reuse them.

Refs: #536
Assisted-by: Claude Code
2026-12-06 21:19:15 +00:00

54 lines
1.4 KiB
Django/Jinja

{{ ansible_managed | comment }}
[Unit]
Description=OpenBao secret store
Documentation=https://openbao.org/docs/
Wants=network-online.target
After=network-online.target
ConditionFileNotEmpty={{ openbao_config_dir }}/openbao.hcl
[Service]
Type=notify
User={{ openbao_user }}
Group={{ openbao_group }}
ExecStart={{ openbao_bin_path }} server -config={{ openbao_config_dir }}/openbao.hcl
# SIGHUP reloads the listener certificates and the log level without sealing the server. The
# shell's own kill, because the kill binary (procps) is not on every host.
ExecReload=/bin/sh -c 'kill -HUP "$MAINPID"'
KillMode=process
KillSignal=SIGINT
TimeoutStopSec=30
Restart=on-failure
RestartSec=5
LimitNOFILE=65536
# OpenBao has no mlock since 2.0: keep its memory out of swap and out of core dumps instead.
MemorySwapMax=0
LimitCORE=0
UMask=0077
NoNewPrivileges=true
CapabilityBoundingSet=
AmbientCapabilities=
ProtectSystem=strict
ReadWritePaths={{ openbao_data_dir }}
ProtectHome=true
PrivateTmp=true
PrivateDevices=true
ProtectKernelModules=true
ProtectKernelTunables=true
ProtectKernelLogs=true
ProtectControlGroups=true
ProtectClock=true
ProtectHostname=true
RestrictNamespaces=true
RestrictRealtime=true
RestrictSUIDSGID=true
LockPersonality=true
MemoryDenyWriteExecute=true
SystemCallArchitectures=native
SystemCallFilter=@system-service
SystemCallFilter=~@privileged @resources
RestrictAddressFamilies=AF_UNIX AF_INET AF_INET6 AF_NETLINK
[Install]
WantedBy=multi-user.target