Add hook system

This commit is contained in:
2026-07-19 02:30:26 +02:00
parent b73f303b4d
commit 33ff828b83
8 changed files with 197 additions and 3 deletions
+21
View File
@@ -23,6 +23,27 @@
#dns_ip: 127.0.0.1
#
# Optional path to the hooks base directory (default: <etc_dir>/hooks).
# Executable files placed in this tree are run around zone and record mutations. The tree narrows
# progressively; every level is optional and a hook fires for every event along its path:
#
# hooks/ -> every action and phase (zone+record, add+delete, pre+post)
# hooks/<kind>/ -> all actions/phases of <kind> (zone|record)
# hooks/<kind>/<action>/ -> both phases of <action> (add|delete)
# hooks/<kind>/<action>/<phase>/ -> single phase only (pre|post)
#
# All matching hooks across all levels are collected and run sorted by filename (run-parts style);
# only executable files are run. Each hook inherits the terminal: stdout/stderr appear live and it
# may be interactive (prompt and read stdin). In batch mode (-b) stdin is /dev/null, so reads get EOF.
# A pre-hook exiting non-zero aborts the operation (exit code 190); a post-hook failure prints an ERROR and continues.
# Hooks receive context via env vars (DNSMGR_KIND/ACTION/PHASE/ZONE/VIEW and, for records,
# DNSMGR_RECORD_NAME/TTL/TYPE/VALUE).
# DNSMGR_ZONE_FILE (zone file path) is set only for managed zones and and not for zone add pre-hooks nor for zone delete post-hooks.
#
#hooks_dir: /etc/dns-manager/hooks
#
# Dictionary of paths to key files (TSIG) per view used for zone transfers and DDNS updates.
# This option is mandatory when using views other than the default (_default) or if the usage of a key