Vault

Vault Audit Devices Overview: Tamper-Resistance and Storage in Practice

2026-04-19
NicheeLab Editorial Team

Vault guarantees operation traceability by writing requests and responses to audit devices.

This article focuses on tamper-resistance and storage (retention, rotation, aggregation) of audit logs, covering both production practice and certification prep.

Audit Device Basics and Tamper-Resistance Thinking

Vault audit devices emit metadata for every request and response. The main types are file, syslog, and socket, and you can enable multiple devices at once. In production, the standard practice is to enable at least one audit device, and ideally to duplicate audit output across different paths.

Sensitive values inside audit logs (tokens, secrets, and so on) are HMAC-hashed using a key unique to each audit device — the raw values are never recorded. This prevents leakage of sensitive data while still enabling correlation analysis via consistent hashes. Tamper-resistance comes from HMAC hashing combined with immutable storage (append-only/WORM/permissions) and a tamper-resistant transport path.

  • Auditing is disabled by default — enable it before going to production
  • Each device has its own HMAC key, so the same value hashes differently across devices
  • If any enabled audit device fails to write, the default behavior is to fail the request to prevent unaudited operations
  • Design tamper-resistance around three pillars: HMAC concealment, tamper-resistant storage, and transport protection (remote forwarding / TLS)
DevicePrimary UseTamper Defense StrategyAvailability / Latency Characteristics
fileSingle-node or simple deployments. Writes JSON lines locallyStrict file permissions, append-only, disciplined logrotate, forward to a downstream audit serverVulnerable to disk-full conditions. Stable at high throughput. Filesystem failures risk failing requests
syslogCentralized aggregation via the OS syslog (SIEM, etc.)WORM and tamper-detection on the remote receiver, choose TCP/TLS, separate privilegesSensitive to network degradation. UDP risks loss, TCP increases latency
socketSends directly to a collector (TCP/UDP/UNIX)Protect the path and endpoint with mTLS or UNIX permissionsHeavily dependent on the collector. Plan for redundancy in case backpressure fails requests

Audit log tamper-resistance and storage paths (example)

Vault ServersAudit Dev (file)HTTPS / append-onlyWORM/Immutable Storage/SIEMAudit Dev (socket)TCP/TLSCentral Syslog/Collector

Minimum enablement steps: list devices and add a file device

vault audit list
vault audit enable file file_path=/var/log/vault_audit.log mode=0640
# 推奨: root所有、ディレクトリは事前作成、監査専用パーティションも検討

Enablement and Configuration Patterns

Audit devices are enabled by name and mounted under /sys/audit/<name>. You can configure multiple file/syslog/socket devices simultaneously. The operational rule of thumb is to duplicate across heterogeneous systems (local retention + remote aggregation).

For file, write permissions and rotation design are critical. For syslog/socket, network health directly drives audit availability. At initial configuration, prioritize permissions, paths, and network (firewall/TLS) checks.

  • file: explicitly set file_path and the permissions (mode)
  • syslog: use facility/tag to make filtering easier at the aggregator
  • socket: specify socket_type (tcp/udp/unix) and address. Reflect collector availability in your SLO
  • Run multiple devices in parallel so a single-side failure does not lose audit data

Configuration examples via CLI and API (including syslog/socket)

# syslog 例
vault audit enable syslog tag=vault facility=AUTH

# socket 例 (TCPでコレクタへ)
vault audit enable socket socket_type=tcp address=collector.internal:1514

# APIでfileデバイスを有効化
curl -sS \
  --header "X-Vault-Token: $VAULT_TOKEN" \
  --request PUT \
  --data '{"type":"file","options":{"file_path":"/var/log/vault_audit.log","mode":"0640"}}' \
  $VAULT_ADDR/v1/sys/audit/file-1

# 無効化
vault audit disable file-1

Log Format and HMAC on Sensitive Data

Audit logs are typically line-delimited JSON. Representative fields include time, type, request (operation/path/remote address/headers), auth (accessor/policies), response (status/warnings), and error. Sensitive values are HMAC-hashed using a per-device key.

To search for occurrences of a specific raw value, have Vault compute the hash for the target device and match against that. This lets you correlate operations involving the value without ever exposing the value itself.

  • HMACs differ per device, so always perform searches scoped to the target device
  • Design operations on the assumption that tokens and secret values never appear in plaintext
  • Prepare per-use-case filters on path/operation/remote_address/response_status to accelerate analysis

Sample log line and hash-based search

# サンプル監査行(JSON一行)
{"time":"2026-04-19T09:12:34.567Z","type":"request","auth":{"client_token":"hmac-sha256:7f...","accessor":"hmac-sha256:62...","policies":["default"],"display_name":"token"},"request":{"id":"6f...","operation":"read","path":"secret/data/foo","remote_address":"10.0.0.5"},"response":{"status":200},"error":false}

# 値のハッシュを生成し、ログ検索に利用
vault audit hash file/ my-actual-token
# => hmac-sha256:abc123...
# 生成されたハッシュ文字列でログをgrep/jq検索

Designing Retention, Rotation, and Availability

Tamper-resistance hinges on hardening the storage layer. For file devices, minimize permissions and combine with append-only or WORM storage. For syslog/socket, ensure immutability on the remote receiver (tamper detection / chained protection of the audit trail).

Rotation is the basic safeguard against capacity exhaustion. For file devices, pick a reliable procedure that fits your environment, such as copytruncate or rename + SIGHUP. Since the default audit-device behavior is to fail requests when writes are blocked, rehearse link outages and disk-full scenarios to understand the SLO impact.

  • Files: owner root, mode around 0640, isolate exhaustion impact with a dedicated audit partition
  • Rotation: copytruncate or rename + SIGHUP. Periodically verify the reopen procedure
  • Remote aggregation: enable WORM, versioning, and delete auditing on the receiver
  • Dual paths: combine file with syslog (or socket) to prevent audit data loss

An example logrotate configuration for the file device

/var/log/vault_audit.log {
  daily
  rotate 14
  compress
  missingok
  notifempty
  copytruncate
  create 0640 root root
}
# 監査要件に応じて保持期間/圧縮/暗号化を調整

Operational Validation and Troubleshooting

After configuration, automate write verification. As a simple check, intentionally call the API and verify that audit lines increase and the collector receives the same count.

When troubleshooting, check the state in vault audit list, output permissions and free space, and collector reachability. Because failed audit writes cause requests themselves to fail, a rise in application-side error rates is usually the easiest signal to spot.

  • Use vault audit list to confirm that multiple devices are enabled
  • Inspect recent request lines with jq/grep, matching timestamps to op/path
  • Check the collector-side receive counter for count consistency
  • Run scenario tests for permission errors (EACCES), disk-full (ENOSPC), and network outages (ETIMEDOUT)

Verification snippets

# 監査デバイス一覧
vault audit list -format=json | jq '.'

# ダミーリクエストで監査行を発生
vault kv get -field=value secret/data/foo || true

# fileに出る最新10行を確認
tail -n 10 /var/log/vault_audit.log | jq -c '{time,type,req:(.request|{op:.operation,path})}'

# 値検索に必要なHMACの生成
vault audit hash file/ my-actual-token

Exam Prep: Key Points Likely on Associate/Ops

Common exam topics include enabling auditing, the device types, the purpose of HMAC, redundancy, failure-mode behavior, and search methods (audit hash). Lock in these points with their practical context in mind.

  • Auditing is disabled by default — enable at least one path before going live
  • When to use file/syslog/socket, and the best practice of running them in parallel
  • Sensitive values are HMAC-hashed; correlate by computing the hash with vault audit hash
  • The baseline behavior is for requests to fail if any audit device cannot write
  • Rotation and permission design (0640, root ownership, append-only/WORM)
  • For central aggregation / remote retention, protect the path with TCP/TLS or mTLS

Check Your Understanding

Associate / Ops

問題 1

You are designing Vault auditing for production. From a tamper-resistance and storage standpoint, which combination is most appropriate?

  1. Enable a file device with minimum permissions and append-only mode. In parallel, send to a remote receiver via syslog (or socket), with WORM and tamper detection enabled on the receiver
  2. Configure syslog-only over UDP to minimize network latency, with no local retention
  3. Use only a file device, set permissions to 777 so the application can also read it, increasing audit transparency
  4. Disable all audit devices. Substitute application access logs and keep Vault lightweight

正解: A

Duplicated auditing (local append-only + remote WORM) plus minimum permissions delivers both tamper-resistance and availability. UDP-only risks loss, mode 777 invites tampering and leakage, and disabling audit is unacceptable for compliance.

Frequently Asked Questions

What happens to Vault requests if an audit device becomes unwritable?

By default, if any enabled audit device cannot be written to, the request fails. This is intentional, to prevent unaudited operations. Validate the impact with fault injection at design time, and rely on redundancy and monitoring.

How do you correlate HMAC-hashed values in audit logs?

Run vault audit hash <device/> <value> to generate the HMAC for the target device, then search logs with that hash string. Each device uses a distinct key, so searches must be scoped per device.

Which is better for logrotate: rename or copytruncate?

It depends on your environment. Rename requires reopening the file descriptor, so pair it with a SIGHUP-style reload. Copytruncate is simpler to switch over but carries a small risk of momentary loss, so either way you should rehearse in production-like environments and combine with monitoring.

Check what you learned with practice questions

Practice with certification-focused question sets

無料で問題を解いてみる
Author

NicheeLab Editorial Team

NicheeLab editorial team focused on data engineering and cloud certification learning. Content is structured around practical study needs and official exam domains.


Related articles
Vault

Vault Core Concepts: Sealed/Unsealed, Auth, Secrets (2026)

Vault fundamentals — sealed/unsealed state, auth methods, se...

Vault

Vault Operations Professional (VOP-003): Complete Guide (2026)

Pass the Vault Operations Professional exam — enterprise pat...

Vault

Vault Path-Based Routing: API URL Structure (2026)

How Vault's path-based routing works — mount points, sub-pat...

Vault

Vault Tokens: Auth Token Mechanics (2026)

Token fundamentals — service vs. batch tokens, accessor, ren...

Vault

Vault Token Types: Service, Batch, Periodic (2026)

Service vs. batch tokens compared — performance, ACL behavio...

Browse all Vault articles (101)
© 2026 NicheeLab All rights reserved.