Commit Graph

84 Commits

Author SHA1 Message Date
da8eeb27ca lxc: add foundational CLI and docs 2025-12-29 17:25:47 +01:00
eab24f9609 secubox: add first-run and app wizards 2025-12-29 17:14:04 +01:00
7c5ad8e53d app-store: add manifest registry and CLI 2025-12-29 17:02:20 +01:00
9cdbb21a99 luci-app-vhost-manager: migrate to vhosts config 2025-12-29 16:31:18 +01:00
d566a84dda feat: theme-aligned monitoring and seccubox logs 2025-12-29 15:41:13 +01:00
54e0b5df6c feat: cascade navigation and zigbee presets 2025-12-29 14:40:22 +01:00
8c27583eba System Hub 0.5.1-2 2025-12-29 12:08:37 +01:00
4dca3c1917 Update theme selector and deploy tooling 2025-12-29 10:55:51 +01:00
b20f9cbb8c fix(sync): Update script path after relocation to secubox-tools
Fixed sync_module_versions.sh to reference the correct path after
moving the Python script from scripts/ to secubox-tools/ directory.

Changes:
- Updated SCR path: scripts/sync_module_versions.py → secubox-tools/sync_module_versions.py

Tested: Script now runs successfully and reports "no changes"

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

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-28 22:02:20 +01:00
ef936f1295 docs: Add GitHub Pages documentation site structure
Created comprehensive documentation site using MkDocs Material theme
for GitHub Pages deployment. Moved version sync scripts to secubox-tools.

## Documentation Site (18 new files)

Created docs/ directory with complete documentation:

**Main Pages:**
- index.md - Home page with navigation cards and module overview
- quick-start.md - Quick start guide
- documentation-index.md - Documentation index

**Development Guides:**
- development-guidelines.md - Complete development reference (1857 lines)
- code-templates.md - Working examples and patterns (1405 lines)
- module-implementation-guide.md - Step-by-step workflow (901 lines)

**Reference Documentation:**
- claude.md - Build system and RPCD architecture (553 lines)
- validation-guide.md - Validation workflows (518 lines)
- permissions-guide.md - Permission guidelines (248 lines)
- luci-development-reference.md - LuCI development (1196 lines)

**Module Information:**
- module-status.md - 15 module status (896 lines)
- feature-regeneration-prompts.md - AI prompts (2084 lines)
- todo-analyse.md - Roadmap and tasks (1080 lines)

**Archive (4 files):**
- archive/index.md - Archive index
- archive/build-issues.md - Build troubleshooting
- archive/completion-report.md - Project milestones
- archive/module-enable-disable-design.md - Feature design

**Styling:**
- stylesheets/extra.css - SecuBox custom CSS

## Scripts Reorganization (2 files moved)

Moved version sync utilities to secubox-tools:
- scripts/sync_module_versions.py → secubox-tools/sync_module_versions.py
- scripts/sync_module_versions.sh → secubox-tools/sync_module_versions.sh

## Site Features

- Material theme with dark/light mode
- Responsive design with navigation tabs
- Live search and syntax highlighting
- Custom SecuBox branding (indigo/violet gradients)
- 12,780+ lines of comprehensive documentation

Summary:
- 21 files changed (+12,780 lines)
- 18 new documentation pages
- 2 scripts relocated
- Ready for GitHub Pages deployment

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

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-28 21:57:29 +01:00
3e1da58d73 feat(build): Add support for luci-theme-* packages in local-build.sh
Extended the local build script to support both luci-app-* and luci-theme-*
package patterns, enabling builds of theme packages like luci-theme-secubox.

Changes:
- Updated validate_makefiles() to validate both package types
- Extended copy_packages() to copy both luci-app-* and luci-theme-* packages
- Modified configure_packages() to enable both package types in .config
- Updated build_packages() to build both package types
- Enhanced collect_artifacts() to find and collect theme packages
- Added luci-theme-* pattern support in argument parsing
- Updated firmware build to copy both package types to OpenWrt

Tested with: ./local-build.sh build luci-theme-secubox
Result: Successfully built luci-theme-secubox-0.4.0-r1.apk

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

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-28 18:26:50 +01:00
6314884f00 feat: Add help system integration and fix menu structure
- Created help system (help.js, help.css) for all modules
- Integrated help button in network-modes module
- Fixed menu structure: removed empty Network Management category
- Fixed all dashboard and modules page links
- Added website deployment script
- Created comprehensive documentation

New Files:
- DOCS/HELP_INTEGRATION_PLAN.md
- DOCS/WEBSITE_DEPLOYMENT_GUIDE.md
- EXAMPLES/help-button-integration.js
- luci-app-secubox/htdocs/luci-static/resources/secubox/help.js
- luci-app-secubox/htdocs/luci-static/resources/secubox/help.css
- secubox-tools/deploy-website.sh

Modified:
- luci-app-network-modes: Added help button integration
- luci-app-secubox: Fixed menu paths and module links

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

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-28 16:29:04 +01:00
562ac55fe1 feat(network-modes): Prepare v0.3.5 implementation foundation
- Version bump to 0.3.5 in Makefile and README
- Add helpers.js utility module for common UI operations
- Expand API with new RPC method declarations
- Enhance view files with improved functionality:
  - accesspoint.js: Enhanced WiFi configuration options
  - relay.js: WireGuard setup improvements
  - router.js: Expanded proxy and vhost settings
  - sniffer.js: Enhanced capture configuration
  - wizard.js: Improved mode selection flow
- RPCD backend enhancements (+176 lines)
- Add deployment script for easier testing

Claude settings: Update permissions for network-modes work

Preparation for implementing features documented in CODEX-v0.3.5.md
2025-12-28 14:25:50 +01:00
aa24441da4 fix(tools): Remove hanging dependency installation loop
- Removed manual installation loop for individual dependencies that caused hangs
- Dependencies now handled via 'feeds install -a' and .config settings
- lucihttp and cgi-io disabled in .config (compilation failures)
- SecuBox packages are PKGARCH:=all (scripts), don't need compiled deps

Fixes interactive prompts and ^C hangs during build process.
2025-12-28 11:21:19 +01:00
49b0fa4e31 feat: Change default OpenWrt version from 24.10 to 25.12
Make OpenWrt 25.12.0-rc1 the default version across all build systems.

Changes:

1. secubox-tools/local-build.sh
   - Default: 24.10.5 → 25.12.0-rc1
   - Comment updated: "25.12.0-rc1 (default), 24.10.5 (stable LTS)"

2. .github/workflows/build-openwrt-packages.yml
   - Input default: 24.10.5 → 25.12.0-rc1
   - Env fallback: 24.10.5 → 25.12.0-rc1

3. .github/workflows/build-secubox-images.yml
   - Input default: 24.10.5 → 25.12.0-rc1
   - Env fallback: 24.10.5 → 25.12.0-rc1
   - Comment updated

4. DOCS/MODULE_STATUS.md + docs/module-status.md
   - Supported versions order updated:
     - 25.12.0-rc1 (latest, primary target)
     - 24.10.5 (LTS, stable)
     - 23.05.5 (legacy support)

Rationale:
- OpenWrt 25.12 uses new APK package format (Alpine-based)
- Better alignment with latest OpenWrt development
- 24.10.5 remains available as stable LTS option
- All workflows support both versions

Users can still override with:
- Environment variable: OPENWRT_VERSION=24.10.5
- Workflow input when manually triggering builds
- Command line: ./local-build.sh build --version 24.10.5

Package formats:
- 25.12.0-rc1 and SNAPSHOT: .apk (Alpine apk)
- 24.10.5 and earlier: .ipk (opkg)

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

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-28 11:16:25 +01:00
e78b723dd7 fix(tools): Prevent lucihttp compilation failure in local-build.sh
Applied same fix as GitHub Actions workflow to local build script.

Problem:
- lucihttp and cgi-io fail to compile in SDK environment
- Missing lua.h headers cause: ninja: build stopped: subcommand failed
- Our SecuBox packages are PKGARCH:=all (scripts only), don't need these

Changes to secubox-tools/local-build.sh:

1. Removed lucihttp and cgi-io from build loop
   - Only build: lua, liblua, rpcd (essentials that work)
   - Skip: lucihttp, cgi-io (fail with missing lua.h)

2. Added configuration to disable problematic packages
   - Explicitly disable in .config:
     # CONFIG_PACKAGE_lucihttp is not set
     # CONFIG_PACKAGE_cgi-io is not set

3. Enabled use of pre-built packages from feeds
   - CONFIG_DEVEL=y
   - CONFIG_FEED_packages=y
   - CONFIG_FEED_luci=y

4. Updated dependency installation
   - Install lucihttp/cgi-io from feeds (for metadata)
   - But disable compilation to prevent SDK failures

Result:
- Local builds will no longer fail with "ninja: build stopped"
- SDK uses pre-built dependencies instead of compiling
- SecuBox packages (pure scripts) build successfully

This matches the fix in .github/workflows/build-openwrt-packages.yml

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

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-28 11:13:35 +01:00
403283419c docs: Reorganize documentation structure and add architecture diagrams
Major documentation improvements and restructuring for better maintainability
and navigation.

## Structural Changes

### New Documentation Organization
- Move all documentation to DOCS/ directory for better organization
- Create DOCS/archive/ for historical documents
- Move deployment scripts to secubox-tools/ directory

### Archived Documents
- COMPLETION_REPORT.md → archive/ (project milestone)
- MODULE-ENABLE-DISABLE-DESIGN.md → archive/ (feature implemented)
- BUILD_ISSUES.md → archive/ (issues resolved)
- Add archive/README.md with archiving policy and document index

## Documentation Enhancements

### Version Standardization
- Add version headers to CLAUDE.md (v1.0.0)
- Add version headers to BUILD_ISSUES.md (v1.0.0)
- Standardize date format to YYYY-MM-DD across all docs

### Cross-References & Navigation
- Add "See Also" sections to PERMISSIONS-GUIDE.md
- Add "See Also" sections to VALIDATION-GUIDE.md
- Link quick references to detailed guides
- Improve documentation discoverability

### Architecture Diagrams (Mermaid)
Add 3 professional diagrams to DEVELOPMENT-GUIDELINES.md:

1. **System Architecture Diagram** (§2)
   - Complete data flow: Browser → LuCI → RPCD → ubus → System
   - Color-coded components by layer
   - Shows JavaScript, RPC, RPCD daemon, UCI, system services

2. **Deployment Workflow Diagram** (§9)
   - Step-by-step deployment process with validation checkpoints
   - Error recovery paths for common issues (403, 404, -32000)
   - Local validation, file transfer, permission fixes, service restarts

3. **Component Hierarchy Diagram** (§1)
   - Standard page structure and CSS class relationships
   - Page → Header → Stats → Content → Cards → Buttons
   - Shows design system component organization

## New Files

### TODO-ANALYSE.md
- Comprehensive documentation improvement roadmap
- Tasks categorized: Immediate, Short-term, Long-term, Optional
- Progress tracking with acceptance criteria
- Covers testing, security, performance guides
- Documentation automation plans

## Benefits

 Cleaner project structure (docs in DOCS/, tools in secubox-tools/)
 Better documentation navigation with cross-references
 Visual understanding through architecture diagrams
 Historical documents archived but accessible
 Standardized versioning across all documentation
 Clear roadmap for future documentation improvements

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

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-28 09:52:15 +01:00
a995b81e97 fix(ci): add ninja-build to dependencies in all build workflows
- Add ninja-build to package build workflow (build-openwrt-packages.yml)
- Add ninja-build to image build workflow (build-secubox-images.yml)
- Update secubox-tools/README.md with ninja-build dependency
- Update secubox-tools/local-build.sh dependency check and install instructions
- Ninja is required by OpenWrt build system for some compilation tasks

This resolves missing ninja errors in GitHub Actions builds.
2025-12-28 03:25:32 +01:00
a53e5f7068 feat: Add comprehensive permission management system (v0.3.1)
Implement three-tier permission management across all SecuBox modules:

**1. Package-Level Permissions (PKG_FILE_MODES)**
- Add PKG_FILE_MODES to all 15 module Makefiles
- RPCD scripts: 755 (executable)
- CSS/JS/JSON files: 644 (default, no config needed)
- Ensures correct permissions at installation time

**2. Runtime Permission Fix**
- New script: /usr/libexec/secubox/fix-permissions.sh
- RPCD method: luci.secubox fix_permissions
- UI control: "🔧 Fix Perms" button in Quick Actions
- Fixes all permissions and restarts services

**3. Automation & Documentation**
- secubox-tools/add-pkg-file-modes.sh: Auto-configure PKG_FILE_MODES
- PERMISSIONS-GUIDE.md: Comprehensive permissions guide
- MODULE-ENABLE-DISABLE-DESIGN.md: Enable/disable system design doc
- Updated Makefile template with PKG_FILE_MODES pattern

**Modules Updated:**
- luci-app-auth-guardian
- luci-app-bandwidth-manager
- luci-app-cdn-cache
- luci-app-client-guardian
- luci-app-crowdsec-dashboard
- luci-app-ksm-manager
- luci-app-media-flow
- luci-app-netdata-dashboard
- luci-app-netifyd-dashboard
- luci-app-network-modes
- luci-app-secubox (+ fix-permissions.sh script)
- luci-app-system-hub
- luci-app-traffic-shaper
- luci-app-vhost-manager
- luci-app-wireguard-dashboard

**Benefits:**
- No more manual permission fixes after installation
- Users can fix permissions from UI without SSH access
- Proper OpenWrt package management compliance
- Automated detection and configuration

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

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-28 02:19:30 +01:00
c1669b0840 feat: Add support for .apk package format (OpenWrt 25.12+)
OpenWrt 25.12.0-rc1 introduced a major change: switching from opkg
to apk (Alpine Package Manager). This commit adds full support for
building both package formats based on the OpenWrt version.

**Package Build Workflow (.github/workflows/build-openwrt-packages.yml):**
- Added automatic version detection for package format
- 25.12+ and SNAPSHOT → .apk format
- 24.10 and earlier → .ipk format
- Updated feeds configuration to use correct branch (openwrt-25.12, openwrt-24.10, etc.)
- Modified artifact collection to handle both .apk and .ipk files
- Updated build summary to show package format
- Added PKG_EXT environment variable to track format across workflow steps
- Updated dependency download to handle both APKINDEX.tar.gz and Packages formats
- Skip dependency downloads for RC versions (repos may not be stable)

**Local Build Script (secubox-tools/local-build.sh):**
- Added package format detection based on OPENWRT_VERSION
- Updated feeds.conf generation to select correct branch dynamically
- Modified build_packages() to detect and build correct package format
- Updated collect_artifacts() to collect both .apk and .ipk files
- Updated SHA256SUMS generation for both formats
- Export PKG_EXT variable for use across functions

**Documentation:**
- CLAUDE.md: Added package format support details
- README.md: Updated compatibility table with package format column
- Added note explaining apk vs ipk distinction

**Key Changes:**
- Backwards compatible: existing workflows continue to work for .ipk
- Future-proof: ready for OpenWrt 25.12 stable release
- Automatic detection: no manual configuration needed
- Comprehensive: covers all build scenarios (GitHub Actions, local builds)

Tested scenarios:
- OpenWrt 24.10.5 → builds .ipk 
- OpenWrt 25.12.0-rc1 → builds .apk 
- SNAPSHOT → builds .apk 

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

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-27 08:16:10 +01:00
c1dd6a95ff feat: Add OpenWrt 25.12.0-rc1 and 24.10.5 to build workflows
Updated GitHub Actions workflows and build scripts to support the
latest OpenWrt versions:

- Added 25.12.0-rc1 (latest release candidate) for testing
- Added 24.10.5 (latest stable release)
- Changed default version from 23.05.5 to 24.10.5

Changes:
- .github/workflows/build-secubox-images.yml: Added new versions, updated default
- .github/workflows/build-openwrt-packages.yml: Added new versions, updated default
- secubox-tools/local-build.sh: Updated default version and added comment
- CLAUDE.md: Updated documentation with supported versions
- README.md: Updated build instructions and compatibility table
- secubox-tools/README.md: Updated environment variables documentation

The 25.12.0-rc1 includes major changes:
- Switch from opkg to apk package manager
- Integration of attended Sysupgrade into default LuCI
- Wi-Fi scripts converted to ucode
- Support for 160+ new devices (2180+ total)

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

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-27 08:07:12 +01:00
14b0f4facb feat: add automated permission validation and fix tools
Added comprehensive automation for file permissions management to prevent
HTTP 403 errors caused by incorrect permissions (600 instead of 644).

🆕 New Tool: fix-permissions.sh
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Automated script to fix and verify file permissions:

Features:
- Fixes local source permissions (--local)
- Fixes remote router permissions (--remote)
- Default: fixes both local and remote
- Auto-verifies RPCD scripts (755)
- Auto-verifies CSS files (644)
- Auto-verifies JS files (644)
- Clears cache and restarts services (remote)
- Reports all changes made

Usage:
  ./secubox-tools/fix-permissions.sh --local   # Before commit
  ./secubox-tools/fix-permissions.sh --remote  # After deploy
  ./secubox-tools/fix-permissions.sh           # Both

 Enhanced: validate-modules.sh - Check 7
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Added comprehensive permission validation:

Check 7: htdocs file permissions
- Validates all CSS files have 644 permissions
- Validates all JS files have 644 permissions
- Reports files with wrong permissions
- Suggests fix-permissions.sh for auto-correction
- Counts permission errors in summary

Total validation checks: 7
1. RPCD script names vs ubus objects
2. Menu paths vs view file locations
3. View files have menu entries
4. RPCD script permissions (755)
5. JSON syntax validation
6. ubus object naming convention
7. htdocs file permissions (644) ← NEW

📚 Documentation Updates
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

DEVELOPMENT-GUIDELINES.md:
- Added "Correction Automatique" section with fix-permissions.sh
- Added "Validation Automatique des Permissions" section
- Added recommended workflow: fix → validate → commit → deploy → fix remote

QUICK-START.md:
- Updated Validation section with fix-permissions.sh
- Updated Common Errors Quick Fix with automated script
- Updated Pre-Commit Checklist with automated tools
- Marked permissions as "auto-verified" in checklist

CLAUDE.md:
- Updated critical rules with auto-fix commands
- Added 7 validation checks list
- Enhanced Validation section with detailed check descriptions
- Added fix-permissions.sh to workflow

🔧 Files Modified
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

New:
+ secubox-tools/fix-permissions.sh (executable)

Modified:
* secubox-tools/validate-modules.sh (Check 7 added)
* DEVELOPMENT-GUIDELINES.md (~50 lines added)
* QUICK-START.md (~15 lines added)
* CLAUDE.md (~25 lines added)

🎯 Problem Solved
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Root cause: Files created/deployed with umask 0077 result in 600 permissions
Symptom: HTTP 403 Forbidden errors on CSS/JS resources
Impact: Modules fail to load in browser

Recent examples:
- secubox: 10 files with 600 permissions (monitoring.js, theme.js, etc.)
- netdata-dashboard: 3 files with 600 permissions

Solution: Automated detection and correction tools now prevent this issue

Workflow integration:
 Pre-commit: fix-permissions.sh --local
 Validation: validate-modules.sh (Check 7)
 Post-deploy: fix-permissions.sh --remote

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

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-26 20:51:52 +01:00
a611831898 fix: validation script now completes all 6 checks successfully
Fixed issue where validate-modules.sh would exit prematurely during check 3
due to grep failures in while loops with set -e enabled.

Changes:
- Added set -o pipefail for better error handling
- Temporarily disable set -e during grep checks in view file validation loop
- Script now completes all 6 validation checks successfully
- Exit code 0 when only warnings present (debug files without menu entries)

Validation results:
✓ Check 1: RPCD naming vs ubus objects (15 modules)
✓ Check 2: Menu paths vs view files (15 modules, 100+ views)
✓ Check 3: View files have menu entries (2 warnings for debug files)
✓ Check 4: RPCD permissions (15 scripts executable)
✓ Check 5: JSON syntax validation (30 files)
✓ Check 6: ubus naming convention (17 objects)

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

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-26 20:04:42 +01:00
cf39eb6e1d fix: resolve validation issues across all modules
- Fixed minified RPC declaration in secubox/modules.js that caused false positive in validation
- Added 30 missing menu entries across 10 modules:
  * bandwidth-manager: clients, schedules
  * client-guardian: zones, portal, logs, alerts, parental
  * crowdsec-dashboard: metrics
  * netdata-dashboard: system, processes, realtime, network
  * netifyd-dashboard: talkers, risks, devices
  * network-modes: router, accesspoint, relay, sniffer
  * secubox: settings
  * system-hub: components, diagnostics, health, remote, settings
  * vhost-manager: internal, ssl, redirects
  * wireguard-dashboard: traffic, config
- All modules now pass comprehensive validation (0 errors, 0 warnings)

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

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-25 09:01:06 +01:00
8b5337f120 feat: add complete SecuBox package suite to firmware builds
Include all 13 SecuBox packages in firmware image builds, organized by
category. Previously only 7 packages were included, missing the central
hub and several key components.

Added Packages:
- luci-app-secubox (Central hub - CRITICAL)
- luci-app-auth-guardian (Authentication system)
- luci-app-bandwidth-manager (QoS & quotas)
- luci-app-cdn-cache (CDN proxy cache)
- luci-app-media-flow (Media traffic detection)
- luci-app-vhost-manager (Virtual host manager)

Complete Package List (13 total):

Core Control (2):
- luci-app-secubox - Central hub
- luci-app-system-hub - System control center

Security & Monitoring (2):
- luci-app-crowdsec-dashboard - CrowdSec security
- luci-app-netdata-dashboard - System monitoring

Network Intelligence (2):
- luci-app-netifyd-dashboard - Deep packet inspection
- luci-app-network-modes - Network mode configuration

VPN & Access Control (3):
- luci-app-wireguard-dashboard - WireGuard VPN
- luci-app-client-guardian - NAC & captive portal
- luci-app-auth-guardian - Authentication system

Bandwidth & Traffic (2):
- luci-app-bandwidth-manager - QoS & quotas
- luci-app-media-flow - Media traffic detection

Performance & Services (2):
- luci-app-cdn-cache - CDN proxy cache
- luci-app-vhost-manager - Virtual host manager

Impact:
- Firmware images now include complete SecuBox security suite
- All modules accessible immediately after flashing
- No need to install packages separately
- Consistent feature set across all firmware builds

Changes:
- local-build.sh: Updated firmware configuration
- build-secubox-images.yml: Updated GitHub Actions workflow

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

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-25 06:43:52 +01:00
804b93a4ff fix: create tmp directories to prevent opkg lock file errors
During firmware image creation, opkg tries to create a lock file in the
staging root filesystem's /tmp directory, but this directory doesn't
always exist, causing the build to fail at the final packaging stage.

Error:
  opkg_conf_load: Could not create lock file
  .../root.orig-mvebu//tmp/opkg.lock: No such file or directory
  ERROR: target/linux failed to build

Solution:
- Create tmp directories in all staging root filesystems before build
- Apply fix in both parallel and single-threaded build paths
- Use wildcard patterns to catch all target architectures

Changes:
- local-build.sh: Create tmp dirs before and during retry
- build-secubox-images.yml: Create tmp dirs in workflow
- .gitignore: Ignore build artifacts (openwrt/, local-feed/, .vscode/)

This ensures the build can complete the final image packaging step
successfully, generating the firmware images.

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

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-24 18:03:13 +01:00
3a2150d822 fix: disable GDB in toolchain to resolve build failures
The firmware builds were failing during toolchain compilation due to
GDB (GNU debugger) missing testsuite/Makefile. This is a known issue
with OpenWrt's GDB toolchain component.

Error:
  Missing testsuite/Makefile
  make[7]: *** [Makefile:1992: subdir_do] Error 1
  ERROR: toolchain/gdb failed to build

Solution:
- Disable GDB in toolchain with '# CONFIG_GDB is not set'
- GDB is not needed for building firmware images
- Only useful for on-device debugging (can be installed separately)
- Enable BUILD_LOG for better debugging

This fix applies to both:
- Local firmware builds (local-build.sh)
- GitHub Actions firmware builds (build-secubox-images.yml)

Impact:
- Toolchain will compile successfully
- Firmware images will be generated
- Build time remains the same (1-2 hours for full build)
- No impact on firmware functionality

Tested with:
- OpenWrt 23.05.5
- Target: mvebu/cortexa72 (MOCHAbin)

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

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-24 17:26:58 +01:00
51ef704058 feat: add diagnostics and debug command for firmware builds
Add comprehensive diagnostics when firmware images aren't generated and
a new debug-firmware command to troubleshoot build configuration without
running the full build process.

New Features:
- debug-firmware command to check configuration and available profiles
- Enhanced diagnostic output when no firmware images are found:
  * Shows all files in target directory
  * Lists available targets that were built
  * Scans build log for errors
  * Analyzes file types in target directory
  * Provides actionable troubleshooting steps

The debug-firmware command shows:
- Device configuration (target, subtarget, profile)
- Current .config settings
- Whether device profile is properly configured
- Available device profiles for the target
- Build output directory contents
- Suggestions for next steps

Usage:
  ./secubox-tools/local-build.sh debug-firmware mochabin

This helps identify configuration issues before running the lengthy
build process again.

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

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-24 17:07:56 +01:00
6da042505e feat: add firmware image building to local build script
Add comprehensive firmware building functionality to local-build.sh,
replicating the GitHub Actions firmware build workflow. Users can now
build complete OpenWrt firmware images with SecuBox pre-installed
locally, in addition to building packages.

New Features:
- New 'build-firmware' command to build complete firmware images
- Support for GlobalScale devices (ESPRESSObin, Sheeva64, MOCHAbin)
- Device profile definitions with automatic target/subtarget configuration
- Automatic OpenWrt source download and caching
- Device-specific package configuration (10G for MOCHAbin, WiFi for Ultra)
- Firmware configuration with same settings as GitHub Actions workflow:
  * CONFIG_TARGET_PER_DEVICE_ROOTFS=y for image generation
  * Explicit PROFILE parameter in make commands
  * Device profile verification before building
- Artifact collection with firmware images, packages, and checksums
- Build time tracking and verbose logging
- 'clean-all' command to remove OpenWrt source (saves ~20GB)

Device Profiles:
- espressobin-v7 (mvebu/cortexa53)
- espressobin-ultra (mvebu/cortexa53 with WiFi)
- sheeva64 (mvebu/cortexa53)
- mochabin (mvebu/cortexa72 with 10G networking)
- x86-64 (x86/64 generic PC)

Usage:
  ./secubox-tools/local-build.sh build-firmware mochabin
  ./secubox-tools/local-build.sh build-firmware espressobin-v7

Output:
  Firmware images placed in build/firmware/<device>/
  - *.img.gz, *sysupgrade.bin, *factory.bin files
  - SHA256SUMS checksums
  - BUILD_INFO.txt with build details
  - packages/ directory with SecuBox .ipk files

Documentation:
- Updated README.md with firmware building examples
- Added device profiles and environment variables
- Added example workflows for firmware building
- Distinguished between package building (SDK) and firmware building (full source)

Technical Details:
- Uses full OpenWrt source (not SDK) for firmware builds
- Configures feeds identically to GitHub Actions workflow
- Includes same configuration fixes for image generation
- Verifies device profile selection before lengthy build
- Supports parallel and single-threaded builds with automatic retry
- Downloads and caches OpenWrt source for reuse

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

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-24 16:31:12 +01:00
29c9ee04b3 fix: correct Makefile include paths for SDK and image builds
Fix critical build failure in GitHub Actions workflows and local build script.
The issue was that LuCI package Makefiles reference ../../luci.mk which doesn't
exist when packages are copied to SDK or OpenWrt build environments.

Changes:
- build-openwrt-packages.yml: Auto-fix Makefile paths after package copy
- build-secubox-images.yml: Auto-fix Makefile paths for image builds
- local-build.sh: Complete rewrite to use feed-based architecture
  * Packages installed as local feed instead of direct copy
  * Automatic Makefile path correction (../../luci.mk → $(TOPDIR)/feeds/luci/luci.mk)
  * Skip dependency resolution with NO_DEPS=1 for arch-independent packages
  * Single package build support throughout the pipeline

This fixes the "No such file or directory: ../../luci.mk" error that prevented
all package and firmware image builds from succeeding.

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

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-24 14:02:31 +01:00
c739104bca feat: add local build tool that replicates GitHub Actions workflows
- Add local-build.sh: comprehensive local build system
  - Validates packages (Makefiles, JSON, JavaScript, shell scripts)
  - Downloads and caches OpenWrt SDK
  - Builds .ipk packages locally
  - Supports multiple architectures (x86-64, ARM, MIPS)
  - Collects artifacts with SHA256 checksums

- Update CLAUDE.md with local build documentation
  - Add Local Build section with usage examples
  - Update Development Workflow to include local testing
  - List supported architectures and environment variables

- Update secubox-tools/README.md
  - Add comprehensive local-build.sh documentation
  - Update workflow examples to include local building
  - Add dependencies and installation instructions

Benefits:
- Test builds locally before CI/CD
- Faster development iteration
- Reduced GitHub Actions usage
- Offline development support

Usage:
  ./secubox-tools/local-build.sh validate
  ./secubox-tools/local-build.sh build
  ./secubox-tools/local-build.sh build luci-app-<name>
  ./secubox-tools/local-build.sh build --arch <arch>
  ./secubox-tools/local-build.sh full

🤖 Generated with Claude Code

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-24 11:37:26 +01:00
4caf3c14bd feat: add module generation validation and pre-push hooks
Comprehensive validation tooling for SecuBox module generation and git workflow.

New Tools:
-----------

1. validate-module-generation.sh
   - Deep validation of single module during/after generation
   - Checks 9 categories: Makefile, RPCD, ACL, Menu, JS Views, UCI, Permissions, Security, Docs
   - Validates RPCD naming (luci.* prefix) vs JavaScript ubus objects
   - Validates menu paths vs actual view file locations
   - Cross-checks RPC methods between JavaScript and RPCD
   - Security scans for hardcoded credentials and dangerous commands
   - Exit codes: 0=pass, 1=critical errors

2. pre-push-validation.sh
   - Git pre-push hook that blocks push if critical errors found
   - Validates all modules before allowing remote push
   - Detects modified modules and runs comprehensive checks
   - Prevents deployment of broken modules
   - Can be bypassed with --no-verify (not recommended)

3. install-git-hooks.sh
   - One-command installation of git hooks
   - Creates symlink from .git/hooks/pre-push to pre-push-validation.sh
   - Enables automatic validation before every push

Documentation:
--------------

4. VALIDATION-GUIDE.md
   - Complete guide to validation workflow
   - Critical naming convention rules with examples
   - Module generation checklist (5 phases)
   - Common validation errors and fixes
   - Best practices and troubleshooting
   - CI/CD integration examples

Updated:
--------

5. secubox-tools/README.md
   - Added descriptions for new validation tools
   - Added recommended workflows for module generation and modification
   - Organized tools into categories (Validation, Maintenance)

Key Validation Rules Enforced:
-------------------------------

✓ RPCD script name MUST match ubus object name (exact match with luci. prefix)
  Example: object: 'luci.cdn-cache' → file: luci.cdn-cache

✓ Menu paths MUST match view file locations (prevent HTTP 404)
  Example: "path": "cdn-cache/overview" → view/cdn-cache/overview.js

✓ All ubus objects MUST use luci.* prefix
   'luci.cdn-cache'  'cdn-cache'

✓ ACL permissions MUST cover all RPCD methods

✓ JavaScript RPC method calls MUST exist in RPCD implementation

✓ RPCD scripts MUST be executable (chmod +x)

✓ All JSON files MUST have valid syntax

✓ Security: No hardcoded credentials or dangerous commands

Benefits:
---------

- Prevents RPC errors (-32000: Object not found)
- Prevents HTTP 404 errors (view files not found)
- Catches naming mismatches before deployment
- Ensures ACL permissions are complete
- Enforces consistent naming conventions
- Blocks broken modules from being pushed
- Provides detailed error messages with fix suggestions

Usage:
------

# Validate new/modified module:
./secubox-tools/validate-module-generation.sh luci-app-cdn-cache

# Install git hooks (one-time):
./secubox-tools/install-git-hooks.sh

# After installation, validation runs automatically:
git push  # Pre-push validation blocks if errors found

# Manual pre-push validation:
./secubox-tools/pre-push-validation.sh

See VALIDATION-GUIDE.md for complete documentation and workflows.

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

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-24 10:06:20 +01:00
92f3318729 feat: add comprehensive module validation tooling
Add validate-modules.sh script that validates critical naming conventions
and module structure to prevent common RPC and HTTP 404 errors.

New validation checks:
- RPCD script names must match ubus object names (luci.* prefix)
- Menu paths must match view file locations
- View files must have corresponding menu entries
- RPCD scripts must be executable
- JSON files must have valid syntax
- ubus objects must follow naming convention

Updated CLAUDE.md documentation with:
- Critical naming conventions section with examples
- Common error patterns and solutions
- Updated development workflow to include validation
- Enhanced troubleshooting guide for RPC and 404 errors
- Updated package structure diagram with correct RPCD naming

Added secubox-tools/README.md:
- Detailed usage instructions for validation script
- Common fixes for naming issues
- CI/CD integration examples
- Quick reference for critical naming rules

This tooling prevents deployment of modules with naming mismatches that
cause runtime errors like:
- RPC call failed with error -32000: Object not found
- HTTP error 404 while loading view files

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

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-24 09:56:42 +01:00
c81788b9c3 fix: auto-repair all SecuBox modules 2025-12-23 01:30:26 +01:00