Files
Kamino/roles/openbao/templates/openbao.hcl.j2
T
Defame1297 c450cb7c37 fix(openbao): refuse an unreadable key before any change
The readability check of the TLS certificate and key ran after the role
had created the user and directories and installed the binary, so a
fresh host with a key the service user cannot read was changed and then
failed. It now runs in validation, from the files' owner, group and
mode against openbao_user and openbao_group, before anything changes;
prepare proves it on the fresh host.

Also from review:
- a seal status read that fails names the 127.0.0.1 IP SAN and
  openbao_tls_ca_file instead of a raw SSL error
- :: gets the loopback listener too: it reaches 127.0.0.1 only while
  net.ipv6.bindv6only is 0
- the listen address check rejects strings such as ... or :::
- the TLS-disabled warning is registered, and verify asserts it
- a missing binary under --skip-tags install fails with a clear message
- the README names openbao_user and openbao_group and says the always
  tagged prereqs run under --tags health too

Refs: #536
Assisted-by: Claude Code
2026-12-06 22:22:50 +00:00

36 lines
1.2 KiB
Django/Jinja

{{ ansible_managed | comment }}
{% macro hostport(address, port) %}{{ ('[' ~ address ~ ']') if ':' in address else address }}:{{ port }}{% endmacro %}
{% macro tls() %}
{% if openbao_tls_disable | bool %}
tls_disable = true
{% else %}
tls_cert_file = {{ openbao_tls_cert_file | to_json }}
tls_key_file = {{ openbao_tls_key_file | to_json }}
tls_min_version = {{ openbao_tls_min_version | to_json }}
{% endif %}
{% endmacro %}
ui = {{ openbao_ui | bool | lower }}
api_addr = {{ openbao_api_addr | to_json }}
cluster_addr = {{ openbao_cluster_addr | to_json }}
storage "raft" {
path = {{ openbao_data_dir | to_json }}
node_id = {{ openbao_node_id | to_json }}
}
listener "tcp" {
address = {{ hostport(openbao_listen_address, openbao_port) | to_json }}
cluster_address = {{ hostport(openbao_listen_address, openbao_cluster_port) | to_json }}
{{ tls() -}}
}
{# :: reaches 127.0.0.1 only while net.ipv6.bindv6only is 0, so it gets the loopback listener too. #}
{% if openbao_listen_address not in ['0.0.0.0', '127.0.0.1'] %}
# The role reads its own API on loopback.
listener "tcp" {
address = {{ hostport('127.0.0.1', openbao_port) | to_json }}
{{ tls() -}}
}
{% endif %}