Skip to content

Commit 32131c7

Browse files
fix: solve crash if vault_port is set below 1024 by adding CAP_NET_ADMIN
1 parent 456f330 commit 32131c7

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

role_variables.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -729,6 +729,8 @@ available starting at Vault version 1.4.
729729
## `vault_port`
730730

731731
- TCP port number to on which to listen
732+
- Setting `vault_port` below 1024 will add the `CAP_NET_BIND_SERVICE` capability to the systemd service
733+
- This capability allows an unprivileged user to start a service on a privileged port
732734
- Default value: 8200
733735

734736
## `vault_max_lease_ttl`

templates/vault_service_systemd.j2

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ PrivateDevices=yes
2121
SecureBits=keep-caps
2222
Capabilities=CAP_IPC_LOCK+ep
2323
{% if systemd_version.stdout is version('230', '>=') %}
24-
AmbientCapabilities=CAP_SYSLOG CAP_IPC_LOCK
24+
AmbientCapabilities=CAP_SYSLOG CAP_IPC_LOCK {{ "CAP_NET_BIND_SERVICE" if vault_port < 1024 }}
2525
{% endif %}
26-
CapabilityBoundingSet=CAP_SYSLOG CAP_IPC_LOCK
26+
CapabilityBoundingSet=CAP_SYSLOG CAP_IPC_LOCK {{ "CAP_NET_BIND_SERVICE" if vault_port < 1024 }}
2727
NoNewPrivileges=yes
2828
{% if vault_gcs_copy_sa and vault_gcs_credentials_src_file is defined and vault_gcs_credentials_dst_file|length -%}
2929
Environment=GOOGLE_APPLICATION_CREDENTIALS={{ vault_gcs_credentials_dst_file }}

0 commit comments

Comments
 (0)