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:
44
cloudflare-tunnel-manager/scripts/rollback/undo_dns.sh
Normal file
44
cloudflare-tunnel-manager/scripts/rollback/undo_dns.sh
Normal file
@@ -0,0 +1,44 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
||||
SKILL_ROOT="$(dirname "$(dirname "$SCRIPT_DIR")")"
|
||||
source "$SKILL_ROOT/scripts/_common.sh"
|
||||
|
||||
: "${CF_API_TOKEN:=}"
|
||||
: "${ZONE_NAME:=}"
|
||||
: "${HOSTNAME:=}"
|
||||
: "${CONFIG_DIR:=$SKILL_ROOT/outputs/config}"
|
||||
|
||||
api() {
|
||||
local method="$1"; shift
|
||||
local url="$1"; shift
|
||||
curl -sS -X "$method" "$url" \
|
||||
-H "Authorization: Bearer $CF_API_TOKEN" \
|
||||
-H "Content-Type: application/json" \
|
||||
"$@"
|
||||
}
|
||||
|
||||
main() {
|
||||
confirm_gate
|
||||
[[ -n "$CF_API_TOKEN" ]] || die "CF_API_TOKEN is required."
|
||||
[[ -n "$ZONE_NAME" ]] || die "ZONE_NAME is required."
|
||||
[[ -n "$HOSTNAME" ]] || die "HOSTNAME is required."
|
||||
need jq
|
||||
need curl
|
||||
|
||||
local z; z="$(api GET "https://api.cloudflare.com/client/v4/zones?name=$ZONE_NAME" | jq -r '.result[0].id')"
|
||||
[[ -n "$z" && "$z" != "null" ]] || die "Unable to resolve zone id for $ZONE_NAME"
|
||||
|
||||
local rec; rec="$(api GET "https://api.cloudflare.com/client/v4/zones/$z/dns_records?type=CNAME&name=$HOSTNAME")"
|
||||
local rec_id; rec_id="$(echo "$rec" | jq -r '.result[0].id')"
|
||||
if [[ -n "$rec_id" && "$rec_id" != "null" ]]; then
|
||||
log_warn "Deleting DNS record id: $rec_id ($HOSTNAME)"
|
||||
api DELETE "https://api.cloudflare.com/client/v4/zones/$z/dns_records/$rec_id" | jq -e '.success==true' >/dev/null || die "Failed to delete DNS record."
|
||||
else
|
||||
log_warn "No DNS record found for $HOSTNAME"
|
||||
fi
|
||||
|
||||
rm -f "$CONFIG_DIR/dns_route.json" || true
|
||||
log_info "DNS rollback complete."
|
||||
}
|
||||
main "$@"
|
||||
18
cloudflare-tunnel-manager/scripts/rollback/undo_service.sh
Normal file
18
cloudflare-tunnel-manager/scripts/rollback/undo_service.sh
Normal file
@@ -0,0 +1,18 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
||||
SKILL_ROOT="$(dirname "$(dirname "$SCRIPT_DIR")")"
|
||||
source "$SKILL_ROOT/scripts/_common.sh"
|
||||
|
||||
: "${SERVICE_NAME:=cloudflared-tunnel}"
|
||||
|
||||
main() {
|
||||
confirm_gate
|
||||
need systemctl
|
||||
log_warn "Stopping/disabling service: $SERVICE_NAME"
|
||||
sudo systemctl stop "$SERVICE_NAME" || true
|
||||
sudo systemctl disable "$SERVICE_NAME" || true
|
||||
sudo systemctl daemon-reload || true
|
||||
log_info "Service rollback complete."
|
||||
}
|
||||
main "$@"
|
||||
28
cloudflare-tunnel-manager/scripts/rollback/undo_tunnel.sh
Normal file
28
cloudflare-tunnel-manager/scripts/rollback/undo_tunnel.sh
Normal file
@@ -0,0 +1,28 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
||||
SKILL_ROOT="$(dirname "$(dirname "$SCRIPT_DIR")")"
|
||||
source "$SKILL_ROOT/scripts/_common.sh"
|
||||
|
||||
: "${TUNNEL_NAME:=}"
|
||||
: "${CONFIG_DIR:=$SKILL_ROOT/outputs/config}"
|
||||
|
||||
main() {
|
||||
confirm_gate
|
||||
[[ -n "$TUNNEL_NAME" ]] || die "TUNNEL_NAME is required."
|
||||
|
||||
if [[ -f "$CONFIG_DIR/tunnel.json" ]]; then
|
||||
local tunnel_id; tunnel_id="$(jq -r '.id' "$CONFIG_DIR/tunnel.json")"
|
||||
if [[ -n "$tunnel_id" && "$tunnel_id" != "null" ]]; then
|
||||
log_warn "Deleting tunnel via cloudflared: $TUNNEL_NAME ($tunnel_id)"
|
||||
cloudflared tunnel delete -f "$tunnel_id" || cloudflared tunnel delete -f "$TUNNEL_NAME" || true
|
||||
fi
|
||||
else
|
||||
log_warn "No tunnel.json snapshot; attempting delete by name: $TUNNEL_NAME"
|
||||
cloudflared tunnel delete -f "$TUNNEL_NAME" || true
|
||||
fi
|
||||
|
||||
rm -f "$CONFIG_DIR/tunnel.json" "$CONFIG_DIR/config.yml" || true
|
||||
log_info "Tunnel rollback complete."
|
||||
}
|
||||
main "$@"
|
||||
Reference in New Issue
Block a user