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:
Vault Sovereign
2025-12-27 00:25:00 +00:00
commit eac77ef7b4
213 changed files with 11724 additions and 0 deletions

View File

@@ -0,0 +1,25 @@
#!/usr/bin/env bash
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
source "$SCRIPT_DIR/_common.sh"
: "${ETH_RPC_URL:=}"
: "${ETH_PRIVATE_KEY:=}"
main() {
need date
need mkdir
need cat
need grep
need cut
need tr
need cast
[[ -n "$ETH_RPC_URL" ]] || die "ETH_RPC_URL is required."
[[ -n "$ETH_PRIVATE_KEY" ]] || die "ETH_PRIVATE_KEY is required (v1)."
# sanity ping
cast chain-id --rpc-url "$ETH_RPC_URL" >/dev/null 2>&1 || die "RPC not reachable."
log_info "Preflight OK."
}
main "$@"

View File

@@ -0,0 +1,25 @@
#!/usr/bin/env bash
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
source "$SCRIPT_DIR/_common.sh"
: "${ETH_RPC_URL:=}"
: "${CHAIN_ID:=1}"
: "${TO_ADDRESS:=0x0000000000000000000000000000000000000000}"
: "${GAS_LIMIT:=60000}"
: "${VALUE_WEI:=0}"
main() {
root_hex="$(read_root_hex)"
payload="$(pad_to_32_bytes_hex "$root_hex")"
echo "[PLAN] $(date -Iseconds) ETH Anchor"
echo "[PLAN] Chain ID (desired): $CHAIN_ID"
echo "[PLAN] RPC chain-id (actual): $(cast chain-id --rpc-url "$ETH_RPC_URL" 2>/dev/null || echo '?')"
echo "[PLAN] To: $TO_ADDRESS"
echo "[PLAN] Value (wei): $VALUE_WEI"
echo "[PLAN] Gas limit: $GAS_LIMIT"
echo "[PLAN] Root (raw): $root_hex"
echo "[PLAN] Calldata: 0x$payload"
echo "[PLAN] Next: export DRY_RUN=0 && ./scripts/11_apply.sh"
}
main "$@"

View File

@@ -0,0 +1,72 @@
#!/usr/bin/env bash
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
SKILL_ROOT="$(dirname "$SCRIPT_DIR")"
source "$SCRIPT_DIR/_common.sh"
: "${ETH_RPC_URL:=}"
: "${CHAIN_ID:=1}"
: "${TO_ADDRESS:=0x0000000000000000000000000000000000000000}"
: "${GAS_LIMIT:=60000}"
: "${VALUE_WEI:=0}"
: "${ETH_PRIVATE_KEY:=}"
: "${LABEL:=eth-anchor}"
main() {
confirm_gate
[[ -n "$ETH_RPC_URL" ]] || die "ETH_RPC_URL required."
[[ -n "$ETH_PRIVATE_KEY" ]] || die "ETH_PRIVATE_KEY required."
mkdir -p "$SKILL_ROOT/outputs/runs"
ts="$(date -Iseconds | tr ':' '-')"
run_dir="$SKILL_ROOT/outputs/runs/${LABEL}_${ts}"
mkdir -p "$run_dir"
root_hex="$(read_root_hex)"
payload="$(pad_to_32_bytes_hex "$root_hex")"
echo "$root_hex" > "$run_dir/root_hex.txt"
# send tx
log_info "Sending calldata tx..."
tx_hash="$(cast send --rpc-url "$ETH_RPC_URL" --private-key "$ETH_PRIVATE_KEY" \
--gas-limit "$GAS_LIMIT" --value "$VALUE_WEI" \
"$TO_ADDRESS" "0x$payload" | awk '/transactionHash/ {print $2}' | tr -d '\r' || true)"
# cast output format varies; fallback: take last 0x... in output
if [[ -z "$tx_hash" ]]; then
tx_hash="$(cast send --rpc-url "$ETH_RPC_URL" --private-key "$ETH_PRIVATE_KEY" \
--gas-limit "$GAS_LIMIT" --value "$VALUE_WEI" \
"$TO_ADDRESS" "0x$payload" 2>/dev/null | grep -Eo '0x[a-fA-F0-9]{64}' | tail -n1 || true)"
fi
[[ -n "$tx_hash" ]] || die "Unable to parse tx hash from cast output."
echo "$tx_hash" > "$run_dir/tx_hash.txt"
log_info "Fetching receipt..."
cast receipt --rpc-url "$ETH_RPC_URL" "$tx_hash" --json > "$run_dir/tx_receipt.json" || true
cat > "$run_dir/PROOF.json" <<EOF
{
"skill": "eth-anchor",
"version": "1.0.0",
"timestamp": "$(date -Iseconds)",
"chain_id": "$(cast chain-id --rpc-url "$ETH_RPC_URL")",
"to": "$TO_ADDRESS",
"value_wei": "$VALUE_WEI",
"gas_limit": "$GAS_LIMIT",
"root_hex": "$(json_escape "$root_hex")",
"calldata": "0x$payload",
"tx_hash": "$(json_escape "$tx_hash")",
"artifacts": {
"root_hex_file": "root_hex.txt",
"tx_hash_file": "tx_hash.txt",
"tx_receipt": "tx_receipt.json"
}
}
EOF
echo "$run_dir" > "$SKILL_ROOT/outputs/last_run_dir.txt"
log_info "Anchored on ETH. tx=$tx_hash"
log_info "Run dir: $run_dir"
}
main "$@"

View File

@@ -0,0 +1,47 @@
#!/usr/bin/env bash
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
SKILL_ROOT="$(dirname "$SCRIPT_DIR")"
source "$SCRIPT_DIR/_common.sh"
: "${ETH_RPC_URL:=}"
main() {
[[ -f "$SKILL_ROOT/outputs/last_run_dir.txt" ]] || die "No last run. Run 11_apply.sh first."
run_dir="$(cat "$SKILL_ROOT/outputs/last_run_dir.txt")"
status="$run_dir/status_matrix.json"
ok_proof=false; ok_tx=false; ok_receipt=false
[[ -f "$run_dir/PROOF.json" ]] && ok_proof=true
if [[ -f "$run_dir/tx_hash.txt" ]]; then
tx="$(cat "$run_dir/tx_hash.txt")"
[[ -n "$tx" ]] && ok_tx=true
if cast receipt --rpc-url "$ETH_RPC_URL" "$tx" >/dev/null 2>&1; then
ok_receipt=true
fi
fi
blockers="[]"
if [[ "$ok_tx" != "true" ]]; then blockers='["missing_tx_hash"]'
elif [[ "$ok_receipt" != "true" ]]; then blockers='["tx_receipt_not_found_yet"]'
fi
cat > "$status" <<EOF
{
"skill": "eth-anchor",
"timestamp": "$(date -Iseconds)",
"run_dir": "$(json_escape "$run_dir")",
"checks": [
{"name":"proof_present", "ok": $ok_proof},
{"name":"tx_hash_present", "ok": $ok_tx},
{"name":"tx_receipt_found", "ok": $ok_receipt}
],
"blockers": $blockers,
"warnings": [],
"next_steps": ["btc-anchor (optional stronger finality)", "proof-verifier"]
}
EOF
log_info "Wrote $status"
cat "$status"
}
main "$@"

View File

@@ -0,0 +1,36 @@
#!/usr/bin/env bash
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
SKILL_ROOT="$(dirname "$SCRIPT_DIR")"
source "$SCRIPT_DIR/_common.sh"
main() {
[[ -f "$SKILL_ROOT/outputs/last_run_dir.txt" ]] || die "No last run."
run_dir="$(cat "$SKILL_ROOT/outputs/last_run_dir.txt")"
report="$run_dir/audit_report.md"
status="$run_dir/status_matrix.json"
tx="$(cat "$run_dir/tx_hash.txt" 2>/dev/null || true)"
root_hex="$(cat "$run_dir/root_hex.txt" 2>/dev/null || true)"
cat > "$report" <<EOF
# ETH Anchor Audit Report
**Generated:** $(date -Iseconds)
**Run Dir:** \`$run_dir\`
**TX Hash:** \`$tx\`
**Root Hex:** \`$root_hex\`
**Skill Version:** 1.0.0
## Status Matrix
$(if [[ -f "$status" ]]; then echo '```json'; cat "$status"; echo '```'; else echo "_Missing status_matrix.json_"; fi)
## EU Compliance
EU (Ireland - Dublin), Irish jurisdiction. Anchors are public chain data.
EOF
log_info "Wrote $report"
cat "$report"
}
main "$@"

View File

@@ -0,0 +1,54 @@
#!/usr/bin/env bash
set -euo pipefail
log_info(){ echo "[INFO] $(date -Iseconds) $*"; }
log_warn(){ echo "[WARN] $(date -Iseconds) $*" >&2; }
log_error(){ echo "[ERROR] $(date -Iseconds) $*" >&2; }
die(){ log_error "$*"; exit 1; }
need(){ command -v "$1" >/dev/null 2>&1 || die "Missing required tool: $1"; }
confirm_gate() {
: "${DRY_RUN:=1}"
: "${REQUIRE_CONFIRM:=1}"
: "${CONFIRM_PHRASE:=I UNDERSTAND THIS WILL SEND AN ETH TRANSACTION}"
[[ "$DRY_RUN" == "0" ]] || die "DRY_RUN=$DRY_RUN (set DRY_RUN=0)."
if [[ "$REQUIRE_CONFIRM" == "1" ]]; then
echo "Type to confirm:"
echo " $CONFIRM_PHRASE"
read -r input
[[ "$input" == "$CONFIRM_PHRASE" ]] || die "Confirmation phrase mismatch."
fi
}
json_escape() {
local s="$1"
s="${s//\\/\\\\}"; s="${s//\"/\\\"}"; s="${s//$'\n'/\\n}"
printf "%s" "$s"
}
read_root_hex() {
# precedence: ROOT_HEX, else parse ROOT_FILE
: "${ROOT_HEX:=}"
: "${ROOT_FILE:=}"
if [[ -n "$ROOT_HEX" ]]; then
echo "$ROOT_HEX"
return 0
fi
[[ -n "$ROOT_FILE" ]] || die "Set ROOT_HEX or ROOT_FILE."
[[ -f "$ROOT_FILE" ]] || die "ROOT_FILE not found: $ROOT_FILE"
local rh
rh="$(grep '^root_hex=' "$ROOT_FILE" | head -n1 | cut -d= -f2)"
[[ -n "$rh" ]] || die "Could not parse root_hex from ROOT_FILE."
echo "$rh"
}
pad_to_32_bytes_hex() {
# expects hex without 0x
local h="$1"
h="${h#0x}"
# limit to 64, pad right with zeros if shorter (simple deterministic padding)
if [[ ${#h} -gt 64 ]]; then
echo "${h:0:64}"
else
printf "%-64s" "$h" | tr ' ' '0'
fi
}

View File

@@ -0,0 +1,19 @@
#!/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"
main() {
confirm_gate
if [[ ! -f "$SKILL_ROOT/outputs/last_run_dir.txt" ]]; then
log_warn "No last run; nothing to undo."
exit 0
fi
run_dir="$(cat "$SKILL_ROOT/outputs/last_run_dir.txt")"
log_warn "Removing last run artifacts (cannot undo on-chain tx): $run_dir"
rm -rf "$run_dir" || true
rm -f "$SKILL_ROOT/outputs/last_run_dir.txt" || true
log_info "Local rollback complete (on-chain tx remains)."
}
main "$@"