secubox-openwrt/package/secubox/secubox-p2p/root/www/api/factory/tools
CyberMind-FR a9130715e9 feat(p2p): Add SecuBox Factory unified dashboard with signed Merkle snapshots
Implement mesh-distributed, cryptographically-validated control center:

- Add factory.sh library with Ed25519 signing via signify-openbsd
- Add Merkle tree calculation for /etc/config validation
- Add CGI endpoints: dashboard, tools, run, snapshot, pubkey
- Add KISS Web UI (~280 lines vanilla JS, inline CSS, zero deps)
- Add gossip-based 3-peer fanout for snapshot synchronization
- Add offline operations queue with replay on reconnect
- Add LuCI iframe integration under MirrorBox > Factory tab
- Configure uhttpd alias for /factory/ on port 7331
- Bump secubox-p2p version to 0.4.0

Factory UI accessible at http://<device>:7331/factory/

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-31 08:03:54 +01:00

127 lines
3.0 KiB
Bash

#!/bin/sh
# Factory Tools - List available SecuBox tools
# CGI endpoint for SecuBox Factory
echo "Content-Type: application/json"
echo "Access-Control-Allow-Origin: *"
echo "Access-Control-Allow-Methods: GET, OPTIONS"
echo ""
# Handle CORS preflight
if [ "$REQUEST_METHOD" = "OPTIONS" ]; then
exit 0
fi
# Define available tools
# Each tool has: id, name, description, category, dangerous flag
cat << 'EOF'
{
"tools": [
{
"id": "snapshot",
"name": "Create Snapshot",
"description": "Create signed Merkle snapshot of current configuration",
"category": "security",
"icon": "camera",
"dangerous": false
},
{
"id": "verify",
"name": "Verify Snapshot",
"description": "Verify cryptographic signature of current snapshot",
"category": "security",
"icon": "shield-check",
"dangerous": false
},
{
"id": "gossip",
"name": "Gossip Sync",
"description": "Synchronize snapshots with peer nodes via gossip protocol",
"category": "mesh",
"icon": "refresh",
"dangerous": false
},
{
"id": "discover",
"name": "Discover Peers",
"description": "Scan network for SecuBox peers via mDNS",
"category": "mesh",
"icon": "search",
"dangerous": false
},
{
"id": "services",
"name": "List Services",
"description": "Get status of all local services",
"category": "monitoring",
"icon": "server",
"dangerous": false
},
{
"id": "validate",
"name": "Validate Modules",
"description": "Run module validation checks",
"category": "maintenance",
"icon": "check-circle",
"dangerous": false
},
{
"id": "repair",
"name": "Auto-Repair",
"description": "Attempt automatic repair of common issues",
"category": "maintenance",
"icon": "wrench",
"dangerous": true
},
{
"id": "backup",
"name": "Create Backup",
"description": "Create configuration backup",
"category": "backup",
"icon": "download",
"dangerous": false
},
{
"id": "pending",
"name": "Pending Operations",
"description": "Show queued offline operations",
"category": "queue",
"icon": "clock",
"dangerous": false
},
{
"id": "replay",
"name": "Replay Pending",
"description": "Execute queued offline operations",
"category": "queue",
"icon": "play",
"dangerous": true
},
{
"id": "fingerprint",
"name": "Node Fingerprint",
"description": "Show this node's cryptographic fingerprint",
"category": "security",
"icon": "fingerprint",
"dangerous": false
},
{
"id": "merkle",
"name": "Merkle Root",
"description": "Calculate current Merkle root of configurations",
"category": "security",
"icon": "hash",
"dangerous": false
}
],
"categories": [
{"id": "security", "name": "Security", "order": 1},
{"id": "mesh", "name": "Mesh Network", "order": 2},
{"id": "monitoring", "name": "Monitoring", "order": 3},
{"id": "maintenance", "name": "Maintenance", "order": 4},
{"id": "backup", "name": "Backup", "order": 5},
{"id": "queue", "name": "Queue", "order": 6}
]
}
EOF