Vault: Systemd Unit file has deprecated features 'Capabilities' and 'StartLimitIntervalSec'

Created on 8 Aug 2019  路  7Comments  路  Source: hashicorp/vault

The documentation on this page provides a systemd unit file

https://learn.hashicorp.com/vault/operations/ops-deployment-guide

[Unit]
Description="HashiCorp Vault - A tool for managing secrets"
Documentation=https://www.vaultproject.io/docs/
Requires=network-online.target
After=network-online.target
ConditionFileNotEmpty=/etc/vault.d/vault.hcl

[Service]
User=vault
Group=vault
ProtectSystem=full
ProtectHome=read-only
PrivateTmp=yes
PrivateDevices=yes
SecureBits=keep-caps
AmbientCapabilities=CAP_IPC_LOCK
Capabilities=CAP_IPC_LOCK+ep
CapabilityBoundingSet=CAP_SYSLOG CAP_IPC_LOCK
NoNewPrivileges=yes
ExecStart=/usr/local/bin/vault server -config=/etc/vault.d/vault.hcl
ExecReload=/bin/kill --signal HUP $MAINPID
KillMode=process
KillSignal=SIGINT
Restart=on-failure
RestartSec=5
TimeoutStopSec=30
StartLimitIntervalSec=60
StartLimitBurst=3
LimitNOFILE=65536

[Install]
WantedBy=multi-user.target

If you attempt to use it verbatim on ubuntu 18.04, you will get these errors in journald

Aug 08 10:37:39 foobar systemd[1]: /etc/systemd/system/vault.service:17: Support for option Capabilities= has been removed and it is ignored
Aug 08 10:37:39 foobar systemd[1]: /etc/systemd/system/vault.service:27: Unknown lvalue 'StartLimitIntervalSec' in section 'Service'
uname -a
Linux foobar 4.15.0-46-generic #49-Ubuntu SMP Wed Feb 6 09:33:07 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux

Most helpful comment

Updated the Deployment Guide accordingly.

All 7 comments

I can confirm this bug.

I'm no systemd expert, but on a test system I use

CapabilityBoundingSet=CAP_SYSLOG CAP_IPC_LOCK
AmbientCapabilities=CAP_IPC_LOCK

like you have, with no Capabilities, and it works fine.

@ncabatoff Thank you!
Actually, I've just pruned my vault.service off the legacy Capabilities and the remaining values match those you posted. And, are sufficient to start the service and bind it to port 443.

Phew, I sleep in peace now!

Thanks for raising this issue. I'll take a look at compatibility. The goal is to have it working satisfactorily on Ubuntu 16/18 and Centos 6/7 as we see these distros a lot. It might be that we can tweak these settings and still support all OSes in one file, but with some journald warnings, not errors. If not, we may need to provide different service files depending on the OS.

We are working to merge an updated systemd service file for Vault. We are fixing a configuration issue but not removing deprecated configuration as we continue to support Ubuntu 16/18 and Centos 7 (6 didn't have systemd by default). This means supporting systemd as old as 219.

The result is:

  • Leave Capabilities in the [Service] configuration as newer versions of systemd will ignore it (but log lack of support)
  • Move StartLimitIntervalSec from the [Service] configuration to the [Unit] configuration for systemd 230+
  • Add StartLimitInterval to the [Service] configuration for systemd <230
  • Add StartLimitBurst to the [Unit] configuration for systemd 230+ but also leave in the [Service] configuration for systemd <230

Updated the Deployment Guide accordingly.

Based on the above explanation and the updates now live in the Learn portal, I consider this closed. If @spuder or anyone else on this issue has further feedback, please let us know. Thanks!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

dreamcat4 picture dreamcat4  路  77Comments

lbernail picture lbernail  路  31Comments

hashbrowncipher picture hashbrowncipher  路  65Comments

bitglue picture bitglue  路  37Comments

weakcamel picture weakcamel  路  51Comments