Implement secubox-master-link (backend) and luci-app-master-link (LuCI frontend) for secure node onboarding into the SecuBox mesh via HMAC-SHA256 join tokens, blockchain-backed peer trust, and gigogne (nested) hierarchy with depth limiting. Backend provides: token management, join/approve/reject protocol, IPK bundle serving, CGI API endpoints, and a dark-themed landing page for new nodes. Frontend provides a 3-tab LuCI view (overview, join requests, mesh tree) with RPCD integration. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
62 lines
1.3 KiB
Bash
62 lines
1.3 KiB
Bash
#!/bin/sh
|
|
|
|
. /usr/share/libubox/jshn.sh
|
|
|
|
case "$1" in
|
|
list)
|
|
echo '{"status":{},"peers":{},"tree":{},"token_generate":{},"approve":{"fingerprint":"str","action":"str","reason":"str"},"token_cleanup":{}}'
|
|
;;
|
|
call)
|
|
case "$2" in
|
|
status)
|
|
. /usr/lib/secubox/master-link.sh 2>/dev/null
|
|
ml_status
|
|
;;
|
|
peers)
|
|
. /usr/lib/secubox/master-link.sh 2>/dev/null
|
|
ml_peer_list
|
|
;;
|
|
tree)
|
|
. /usr/lib/secubox/master-link.sh 2>/dev/null
|
|
ml_tree
|
|
;;
|
|
token_generate)
|
|
. /usr/lib/secubox/master-link.sh 2>/dev/null
|
|
ml_token_generate
|
|
;;
|
|
approve)
|
|
read -r input
|
|
fingerprint=$(echo "$input" | jsonfilter -e '@.fingerprint' 2>/dev/null)
|
|
action=$(echo "$input" | jsonfilter -e '@.action' 2>/dev/null)
|
|
reason=$(echo "$input" | jsonfilter -e '@.reason' 2>/dev/null)
|
|
|
|
. /usr/lib/secubox/master-link.sh 2>/dev/null
|
|
|
|
case "$action" in
|
|
approve)
|
|
ml_join_approve "$fingerprint"
|
|
;;
|
|
reject)
|
|
ml_join_reject "$fingerprint" "$reason"
|
|
;;
|
|
promote)
|
|
ml_promote_to_submaster "$fingerprint"
|
|
;;
|
|
*)
|
|
echo '{"error":"invalid_action"}'
|
|
;;
|
|
esac
|
|
;;
|
|
token_cleanup)
|
|
. /usr/lib/secubox/master-link.sh 2>/dev/null
|
|
ml_token_cleanup
|
|
;;
|
|
*)
|
|
echo '{"error":"unknown_method"}'
|
|
;;
|
|
esac
|
|
;;
|
|
esac
|
|
|
|
exit 0
|