Add 4 new packages implementing unified device intelligence and DNS provider API management: - secubox-app-dns-provider: dnsctl CLI with OVH, Gandi, Cloudflare adapters for DNS record CRUD, HAProxy vhost sync, propagation verification, and ACME DNS-01 wildcard certificate issuance - luci-app-dns-provider: RPCD handler + LuCI views for provider settings and DNS record management - secubox-app-device-intel: Aggregation layer merging mac-guardian, client-guardian, DHCP, P2P mesh, and exposure data with heuristic classification engine and USB/MQTT/Zigbee emulator modules - luci-app-device-intel: RPCD handler + 5 LuCI views (dashboard, devices, emulators, mesh, settings) with shared API and CSS Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
56 lines
1.4 KiB
Bash
56 lines
1.4 KiB
Bash
#!/bin/sh
|
|
# Gandi LiveDNS v5 Provider Adapter
|
|
# Requires: api_key (Personal Access Token or API Key)
|
|
|
|
GANDI_API_BASE="https://api.gandi.net"
|
|
|
|
_gandi_request() {
|
|
local method="$1" path="$2" body="$3"
|
|
local api_key=$(uci -q get dns-provider.gandi.api_key)
|
|
|
|
local curl_args="-s -X $method"
|
|
curl_args="$curl_args -H 'Content-Type: application/json'"
|
|
curl_args="$curl_args -H 'Authorization: Bearer $api_key'"
|
|
|
|
if [ -n "$body" ]; then
|
|
eval curl $curl_args -d "'$body'" "'${GANDI_API_BASE}${path}'" 2>/dev/null
|
|
else
|
|
eval curl $curl_args "'${GANDI_API_BASE}${path}'" 2>/dev/null
|
|
fi
|
|
}
|
|
|
|
dns_list() {
|
|
local zone="$1"
|
|
_gandi_request GET "/v5/livedns/domains/${zone}/records"
|
|
}
|
|
|
|
dns_add() {
|
|
local zone="$1" type="$2" subdomain="$3" target="$4" ttl="${5:-3600}"
|
|
local body="{\"rrset_type\":\"${type}\",\"rrset_ttl\":${ttl},\"rrset_values\":[\"${target}\"]}"
|
|
_gandi_request POST "/v5/livedns/domains/${zone}/records/${subdomain}/${type}" "$body"
|
|
}
|
|
|
|
dns_rm() {
|
|
local zone="$1" type="$2" subdomain="$3"
|
|
_gandi_request DELETE "/v5/livedns/domains/${zone}/records/${subdomain}/${type}"
|
|
}
|
|
|
|
dns_verify() {
|
|
local fqdn="$1"
|
|
local result=$(nslookup "$fqdn" 2>/dev/null | grep -A1 "Name:" | tail -1)
|
|
if [ -n "$result" ]; then
|
|
echo "resolved"
|
|
else
|
|
echo "not_resolved"
|
|
fi
|
|
}
|
|
|
|
dns_test_credentials() {
|
|
local result=$(_gandi_request GET "/v5/livedns/domains")
|
|
if echo "$result" | grep -q "fqdn"; then
|
|
echo "ok"
|
|
else
|
|
echo "failed: $result"
|
|
fi
|
|
}
|