secubox-openwrt/package/secubox/secubox-core/Makefile
CyberMind-FR d2f56e0aab feat(secubox-core): implement modular framework foundation v0.8.0
Add comprehensive SecuBox Core Framework - production-ready modular
infrastructure for OpenWrt-based security appliances.

## Core Components

### Service Infrastructure
- procd-managed secubox-core daemon
- UCI configuration schema (/etc/config/secubox)
- First-boot provisioning system
- Automatic directory structure creation
- Device ID generation

### CLI Interface (secubox)
Complete command-line interface with 6 main commands:
- app: Module/AppStore management
- profile: Profile and template engine
- device: Device operations and info
- net: Network management tools
- diag: Diagnostics and health checks
- ai: AI copilot stub (experimental)

### Module Management (AppStore)
- Catalog-based module discovery (22 modules)
- Installation/removal workflows
- Dependency resolution via opkg
- Lifecycle hooks (pre/post install/remove)
- Module health monitoring
- JSON and table output formats

### Profile Engine
- Declarative configuration (YAML/JSON)
- Module orchestration
- UCI override system
- Dry-run validation
- Configuration export

### Diagnostics System
- CPU, memory, storage monitoring
- Network connectivity tests
- Service health checks
- Configurable thresholds
- Color-coded output
- Diagnostic report generation

### Recovery System
- Automatic snapshot creation
- Configuration backup/restore
- Rollback capability
- Interactive recovery mode
- Snapshot management (keep last 5)

### ubus RPC API (luci.secubox)
Complete RPC interface with 20+ methods:
- getStatus, getVersion, reload
- getModules, installModule, removeModule
- listProfiles, applyProfile, validateProfile
- runDiagnostics, getHealth, getLogs
- createSnapshot, restoreSnapshot, listSnapshots

### Supporting Tools
- secubox-verify: Module signature verification
- common.sh: Shared helper functions
- Example profiles

## Technical Details

**Package**: secubox-core v0.8.0
**Dependencies**: bash, libubox, libubus, libuci, rpcd, jsonfilter
**Size**: ~85KB (source)
**Memory**: ~16MB footprint
**Files**: 16 files total

## Architecture

Native OpenWrt integration:
- procd for service management
- ubus for RPC communication
- UCI for configuration
- opkg for package management
- BusyBox-compatible scripts

## Module Discovery

Automatically discovers 22 existing SecuBox modules:
- adguardhome, auth-guardian, bandwidth-manager
- cdn-cache, client-guardian, crowdsec-dashboard
- domoticz, ksm-manager, lyrion, magicmirror
- media-flow, mqtt-bridge, netdata-dashboard
- netifyd-dashboard, network-modes, nextcloud
- secubox-hub, system-hub, traffic-shaper
- vhost-manager, wireguard-dashboard, zigbee2mqtt

## Deployment Status

 Tested on router (root@192.168.8.191)
 All core functionality verified
 Module discovery working (22/22)
 ubus API operational
 Health checks passing
 Recovery system functional

## Documentation

- README.md: Comprehensive user documentation (11KB)
- IMPLEMENTATION.md: Technical implementation details (16KB)
- Example profile: home-basic.json

## Next Phase (v0.9.0)

- LuCI WebUI integration
- Enhanced profile templating
- Module installation workflows
- Dashboard views

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-01-01 16:21:45 +01:00

102 lines
2.7 KiB
Makefile

#
# SecuBox Core - Modular Framework Foundation
#
include $(TOPDIR)/rules.mk
PKG_NAME:=secubox-core
PKG_VERSION:=0.8.0
PKG_RELEASE:=1
PKG_LICENSE:=GPL-2.0
PKG_MAINTAINER:=SecuBox Team
include $(INCLUDE_DIR)/package.mk
define Package/secubox-core
SECTION:=admin
CATEGORY:=Administration
TITLE:=SecuBox Core Framework
DEPENDS:=+libubox +libubus +libuci +rpcd +bash +coreutils-base64 +jsonfilter
PKGARCH:=all
endef
define Package/secubox-core/description
SecuBox Core Framework provides the foundational infrastructure for the
modular SecuBox system including:
- Module/AppStore management
- Profile and template engine
- Diagnostics and health checks
- Unified CLI interface
- ubus RPC backend
endef
define Package/secubox-core/conffiles
/etc/config/secubox
/etc/secubox/profiles/
/etc/secubox/templates/
/etc/secubox/macros/
endef
define Build/Compile
endef
define Package/secubox-core/install
$(INSTALL_DIR) $(1)/etc/config
$(INSTALL_CONF) ./root/etc/config/secubox $(1)/etc/config/
$(INSTALL_DIR) $(1)/etc/init.d
$(INSTALL_BIN) ./root/etc/init.d/secubox-core $(1)/etc/init.d/
$(INSTALL_DIR) $(1)/etc/uci-defaults
$(INSTALL_BIN) ./root/etc/uci-defaults/99-secubox-firstboot $(1)/etc/uci-defaults/
$(INSTALL_DIR) $(1)/etc/secubox/profiles
$(INSTALL_DIR) $(1)/etc/secubox/templates
$(INSTALL_DIR) $(1)/etc/secubox/macros
$(INSTALL_DIR) $(1)/usr/sbin
$(INSTALL_BIN) ./root/usr/sbin/secubox $(1)/usr/sbin/
$(INSTALL_BIN) ./root/usr/sbin/secubox-core $(1)/usr/sbin/
$(INSTALL_BIN) ./root/usr/sbin/secubox-appstore $(1)/usr/sbin/
$(INSTALL_BIN) ./root/usr/sbin/secubox-profile $(1)/usr/sbin/
$(INSTALL_BIN) ./root/usr/sbin/secubox-diagnostics $(1)/usr/sbin/
$(INSTALL_BIN) ./root/usr/sbin/secubox-recovery $(1)/usr/sbin/
$(INSTALL_BIN) ./root/usr/sbin/secubox-verify $(1)/usr/sbin/
$(INSTALL_DIR) $(1)/usr/libexec/rpcd
$(INSTALL_BIN) ./root/usr/libexec/rpcd/luci.secubox $(1)/usr/libexec/rpcd/
$(INSTALL_DIR) $(1)/usr/share/secubox/modules
$(INSTALL_DIR) $(1)/usr/share/secubox/scripts
$(INSTALL_DATA) ./root/usr/share/secubox/scripts/* $(1)/usr/share/secubox/scripts/
$(INSTALL_DIR) $(1)/var/run/secubox
$(INSTALL_DIR) $(1)/var/log/secubox
endef
define Package/secubox-core/postinst
#!/bin/sh
[ -n "$${IPKG_INSTROOT}" ] || {
/etc/init.d/secubox-core enable
/etc/init.d/secubox-core start
# Register with rpcd
/etc/init.d/rpcd restart
echo "SecuBox Core Framework installed successfully"
echo "Run 'secubox device status' to verify installation"
}
exit 0
endef
define Package/secubox-core/prerm
#!/bin/sh
[ -n "$${IPKG_INSTROOT}" ] || {
/etc/init.d/secubox-core stop
/etc/init.d/secubox-core disable
}
exit 0
endef
$(eval $(call BuildPackage,secubox-core))