Pilot Auto-Trust
Automated trust management for Pilot Protocol with policy-based decision making.
Commands
Pending entries carry only node_id, public_key, justification and
received_at (under .data.pending[]) — no hostname and no address. To
apply a policy on hostname or network, resolve each requester in the
registry with lookup first. A requester whose record the registry won't
return (for example a private node) gets no hostname or networks, so these
rules leave it pending for manual review.
List Pending Requests
pilotctl --json pending
Auto-Approve by Network
pilotctl --json pending | jq -r '.data.pending[].node_id' | while read -r NODE_ID; do
if pilotctl --json lookup "$NODE_ID" | jq -e 'any(.data.networks[]?; . == 1)' >/dev/null; then
pilotctl --json approve "$NODE_ID"
fi
done
Auto-Approve by Hostname Pattern
pilotctl --json pending | jq -r '.data.pending[].node_id' | while read -r NODE_ID; do
HOST=$(pilotctl --json lookup "$NODE_ID" | jq -r '.data.hostname // empty')
case "$HOST" in
agent-prod-*) pilotctl --json approve "$NODE_ID" ;;
esac
done
Hostnames are first-come in the registry — anyone can claim an unused
agent-prod-… name — so pair a hostname rule with a network or public-key
check before approving anything sensitive.
Batch Reject by Hostname Pattern
pilotctl --json pending | jq -r '.data.pending[].node_id' | while read -r NODE_ID; do
HOST=$(pilotctl --json lookup "$NODE_ID" | jq -r '.data.hostname // empty')
case "$HOST" in
untrusted-*) pilotctl --json reject "$NODE_ID" "Untrusted source" ;;
esac
done
Workflow Example
#!/bin/bash
# Auto-approve production agents from a known network; reject requesters
# the registry places on other networks; leave unresolvable ones pending.
pilotctl --json pending | jq -r '.data.pending[].node_id' | while read -r NODE_ID; do
RECORD=$(pilotctl --json lookup "$NODE_ID" 2>/dev/null) || continue # unresolvable: manual review
HOST=$(echo "$RECORD" | jq -r '.data.hostname // empty')
"$RECORD" | jq -r 'any(.data.networks[]?; . == 1)')
if [ "$ON_PROD" = "true" ]; then
case "$HOST" in
agent-prod-*) pilotctl --json approve "$NODE_ID" ;;
esac
else
pilotctl --json reject "$NODE_ID" "Unknown network"
fi
done
Dependencies
Requires pilot-protocol, pilotctl, and jq.