Initial commit: VaultMesh Skills collection
Collection of operational skills for VaultMesh infrastructure including: - backup-sovereign: Backup and recovery operations - btc-anchor: Bitcoin anchoring - cloudflare-tunnel-manager: Cloudflare tunnel management - container-registry: Container registry operations - disaster-recovery: Disaster recovery procedures - dns-sovereign: DNS management - eth-anchor: Ethereum anchoring - gitea-bootstrap: Gitea setup and configuration - hetzner-bootstrap: Hetzner server provisioning - merkle-forest: Merkle tree operations - node-hardening: Node security hardening - operator-bootstrap: Operator initialization - proof-verifier: Cryptographic proof verification - rfc3161-anchor: RFC3161 timestamping - secrets-vault: Secrets management 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
45
dns-sovereign/scripts/21_zone_apply.sh
Normal file
45
dns-sovereign/scripts/21_zone_apply.sh
Normal file
@@ -0,0 +1,45 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
||||
SKILL_ROOT="$(dirname "$SCRIPT_DIR")"
|
||||
source "$SCRIPT_DIR/_common.sh"
|
||||
|
||||
: "${PDNS_API_KEY:=}"
|
||||
: "${PDNS_WEB_PORT:=8081}"
|
||||
: "${ZONE_NAME:=}"
|
||||
: "${NS1_NAME:=}"
|
||||
: "${NS2_NAME:=}"
|
||||
|
||||
api() {
|
||||
local method="$1"; shift
|
||||
local url="$1"; shift
|
||||
curl -sS -X "$method" "$url" -H "X-API-Key: $PDNS_API_KEY" -H "Content-Type: application/json" "$@"
|
||||
}
|
||||
|
||||
main() {
|
||||
confirm_gate
|
||||
[[ -n "$PDNS_API_KEY" ]] || die "PDNS_API_KEY is required."
|
||||
[[ -n "$ZONE_NAME" ]] || die "ZONE_NAME is required."
|
||||
|
||||
local zone="${ZONE_NAME%\.}."
|
||||
local ns1="${NS1_NAME:-ns1.${ZONE_NAME}}"
|
||||
local ns2="${NS2_NAME:-ns2.${ZONE_NAME}}"
|
||||
|
||||
local base="http://127.0.0.1:${PDNS_WEB_PORT}/api/v1/servers/localhost"
|
||||
# Check if zone exists
|
||||
if api GET "$base/zones/$zone" | jq -e '.name' >/dev/null 2>&1; then
|
||||
log_warn "Zone already exists: $zone"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
log_info "Creating zone: $zone"
|
||||
api POST "$base/zones" --data "{
|
||||
\"name\": \"$zone\",
|
||||
\"kind\": \"Native\",
|
||||
\"masters\": [],
|
||||
\"nameservers\": [\"$ns1.\", \"$ns2.\"]
|
||||
}" | jq '.' > "$SKILL_ROOT/outputs/zone_create_result.json"
|
||||
|
||||
log_info "Zone created; output saved: outputs/zone_create_result.json"
|
||||
}
|
||||
main "$@"
|
||||
Reference in New Issue
Block a user