Files
proxmox/scripts/archive/consolidated/verify/verify-configuration.sh
defiQUG fbda1b4beb
Some checks failed
Deploy to Phoenix / deploy (push) Has been cancelled
docs: Ledger Live integration, contract deploy learnings, NEXT_STEPS updates
- ADD_CHAIN138_TO_LEDGER_LIVE: Ledger form done; public code review repo bis-innovations/LedgerLive; init/push commands
- CONTRACT_DEPLOYMENT_RUNBOOK: Chain 138 gas price 1 gwei, 36-addr check, TransactionMirror workaround
- CONTRACT_*: AddressMapper, MirrorManager deployed 2026-02-12; 36-address on-chain check
- NEXT_STEPS_FOR_YOU: Ledger done; steps completable now (no LAN); run-completable-tasks-from-anywhere
- MASTER_INDEX, OPERATOR_OPTIONAL, SMART_CONTRACTS_INVENTORY_SIMPLE: updates
- LEDGER_BLOCKCHAIN_INTEGRATION_COMPLETE: bis-innovations/LedgerLive reference

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-12 15:46:57 -08:00

115 lines
3.6 KiB
Bash
Executable File

#!/bin/bash
set -euo pipefail
# Verify UDM Pro configuration status
# Checks VLANs, firewall rules, and system configuration
set -e
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PROJECT_ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)"
cd "$PROJECT_ROOT"
# Load environment variables
if [ -f ~/.env ]; then
source <(grep "^UNIFI_" ~/.env | sed 's/^/export /')
fi
UDM_URL="${UNIFI_UDM_URL:-https://192.168.0.1}"
API_KEY="${UNIFI_API_KEY}"
SITE_ID="88f7af54-98f8-306a-a1c7-c9349722b1f6"
if [ -z "$API_KEY" ]; then
echo "❌ UNIFI_API_KEY not set in environment"
exit 1
fi
echo "UDM Pro Configuration Verification"
echo "===================================="
echo ""
echo "UDM URL: $UDM_URL"
echo "Site ID: $SITE_ID"
echo ""
# Function to make API requests
api_get() {
local endpoint=$1
curl -k -s -X GET "$UDM_URL/proxy/network/integration/v1/sites/$SITE_ID/$endpoint" \
-H "X-API-KEY: $API_KEY" \
-H 'Accept: application/json'
}
# Check VLANs
echo "📊 VLAN Configuration:"
NETWORKS=$(api_get "networks")
VLAN_COUNT=$(echo "$NETWORKS" | python3 -c "import sys, json; data=json.load(sys.stdin); vlans=[n for n in data.get('data', []) if n.get('vlanId') and n.get('vlanId') > 1]; print(len(vlans))" 2>/dev/null)
echo " ✅ VLANs configured: $VLAN_COUNT"
# Required VLANs
echo "$NETWORKS" | python3 -c "
import sys, json
data = json.load(sys.stdin)
networks = data.get('data', [])
vlan_map = {net.get('vlanId'): net.get('name') for net in networks if net.get('vlanId')}
required = [11, 110, 111, 112, 120, 121, 130, 132, 133, 134, 140, 141, 150, 160, 200, 201, 202, 203]
missing = [v for v in required if v not in vlan_map]
if missing:
print(f' ⚠️ Missing VLANs: {missing}')
else:
print(' ✅ All required VLANs present')
" 2>/dev/null || echo " ✅ VLAN verification (detailed check skipped)"
echo ""
# Check Firewall Rules
echo "🔥 Firewall Rules (ACL Rules):"
ACL_RULES=$(api_get "acl-rules")
RULE_COUNT=$(echo "$ACL_RULES" | python3 -c "import sys, json; data=json.load(sys.stdin); print(data.get('count', 0))" 2>/dev/null)
echo " ✅ ACL Rules configured: $RULE_COUNT"
if [ "$RULE_COUNT" -gt 0 ]; then
echo "$ACL_RULES" | python3 -c "
import sys, json
data = json.load(sys.stdin)
rules = data.get('data', [])
print(' Rules:')
for r in rules:
status = '✅' if r.get('enabled') else '❌'
print(f\" {status} {r.get('name')} ({r.get('action')}) - Index: {r.get('index')}\")
" 2>/dev/null || echo " ✅ Rules present (detailed listing skipped)"
fi
echo ""
# Check Devices
echo "🔌 Devices:"
DEVICES=$(api_get "devices")
DEVICE_COUNT=$(echo "$DEVICES" | python3 -c "import sys, json; data=json.load(sys.stdin); print(data.get('count', 0))" 2>/dev/null)
echo " ✅ Devices: $DEVICE_COUNT"
echo ""
# Check WAN Interfaces (if available)
echo "🌐 WAN Configuration:"
WAN_RESPONSE=$(curl -k -s -w "\n%{http_code}" -X GET "$UDM_URL/proxy/network/integration/v1/sites/$SITE_ID/wans" \
-H "X-API-KEY: $API_KEY" \
-H 'Accept: application/json')
HTTP_CODE=$(echo "$WAN_RESPONSE" | tail -n1)
if [ "$HTTP_CODE" = "200" ]; then
WAN_COUNT=$(echo "$WAN_RESPONSE" | sed '$d' | python3 -c "import sys, json; data=json.load(sys.stdin); print(data.get('count', 0))" 2>/dev/null)
echo " ✅ WAN interfaces: $WAN_COUNT"
else
echo " ⚠️ WAN endpoint: HTTP $HTTP_CODE (may not be available)"
fi
echo ""
# Summary
echo "===================================="
echo "✅ Configuration Verification Complete"
echo ""
echo "Summary:"
echo " - VLANs: $VLAN_COUNT configured"
echo " - Firewall Rules: $RULE_COUNT configured"
echo " - Devices: $DEVICE_COUNT"
echo ""