loki: add basic auth for log push and dual-ship promtail
Some checks failed
Run nix flake check / flake-check (push) Failing after 4m36s
Some checks failed
Run nix flake check / flake-check (push) Failing after 4m36s
- Loki bound to localhost, Caddy reverse proxy with basic_auth - Vault secret (shared/loki/push-auth) for password, bcrypt hash generated at boot for Caddy environment - Promtail dual-ships to monitoring01 (direct) and loki.home.2rjus.net (with basic auth), conditional on vault.enable - Terraform: new shared loki-push policy added to all AppRoles Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -26,6 +26,17 @@ path "secret/data/shared/nixos-exporter/*" {
|
||||
EOT
|
||||
}
|
||||
|
||||
# Shared policy for Loki push authentication (all hosts push logs)
|
||||
resource "vault_policy" "loki_push" {
|
||||
name = "loki-push"
|
||||
|
||||
policy = <<EOT
|
||||
path "secret/data/shared/loki/*" {
|
||||
capabilities = ["read", "list"]
|
||||
}
|
||||
EOT
|
||||
}
|
||||
|
||||
# Define host access policies
|
||||
locals {
|
||||
host_policies = {
|
||||
@@ -138,7 +149,7 @@ resource "vault_approle_auth_backend_role" "hosts" {
|
||||
backend = vault_auth_backend.approle.path
|
||||
role_name = each.key
|
||||
token_policies = concat(
|
||||
["${each.key}-policy", "homelab-deploy", "nixos-exporter"],
|
||||
["${each.key}-policy", "homelab-deploy", "nixos-exporter", "loki-push"],
|
||||
lookup(each.value, "extra_policies", [])
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user