Commit Graph

1196 Commits

Author SHA1 Message Date
fe8c3aaf5e fix(nextcloud): Add /apps/ nginx location to fix 403 errors
The /apps/dashboard/ and other app paths were returning 403 Forbidden
because nginx was matching the directory via try_files before routing
to PHP. Added explicit location ^~ /apps/ to rewrite to index.php.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-17 03:44:24 +01:00
aecd4ee4f6 docs: Update tracking files for mailctl firewall & Nextcloud 31.0.14
- Nextcloud upgraded from 30.0.17 to 31.0.14
- mailctl firewall_setup now persists UCI rules for mail ports
- All apps updated (mail, tasks, external, spreed/Talk)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-16 23:59:16 +01:00
f5d2122fd3 fix(mailserver): Ensure dovecot users file is readable
Add permission fix for /etc/dovecot/users in startup script.
Without this, dovecot auth fails with "Permission denied" when
trying to read the passwd-file for LMTP delivery.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-16 16:02:27 +01:00
a0fc2cee62 fix(mailserver): Add UCI firewall rules for mail ports
The firewall-setup command now adds:
- Input rules for ports 25, 143, 465, 587, 993 (accept from WAN)
- Forward rules for mail ports (WAN -> LAN mailserver)
- DNAT rules in firewall.user (excluding LAN subnet)

This ensures nftables input_wan and forward_wan chains allow
mail traffic to reach the mailserver container.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-16 15:56:31 +01:00
f6f4176170 docs: Update tracking files for mail reception fix
- Mark "Inbound Port 25 Blocked" as RESOLVED
- Document nftables and postfix lmdb fixes

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-16 15:53:06 +01:00
4154913810 fix(mailserver): Use lmdb instead of hash for postfix maps
Alpine Linux uses LMDB instead of Berkeley DB hash format.
Changed virtual_mailbox_maps from hash: to lmdb: prefix.

Also fixes:
- nftables forward_wan missing port 25 accept rule
- nftables input_wan missing port 25 accept rule
- gk2@secubox.in missing from vmailbox

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-16 15:51:48 +01:00
19406e128c fix(mailserver): Complete dovecot permission fixes
- Add dovecot run directory permission setup
- Add dovenull to dovecot group (fixes login directory access)
- Update HISTORY.md with changes

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-16 15:43:46 +01:00
c379aee903 fix(mailserver): Add dovecot run directory permission fix
Fix anvil-auth-penalty socket permission issues that caused
authentication failures. Ensures /run/dovecot has correct ownership
before and after dovecot starts.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-16 15:26:43 +01:00
ca6d4fa160 docs: Update tracking files for Nextcloud and WAF fixes
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-16 15:12:15 +01:00
4bd0c09b2e feat(nextcloud): Add user management and password reset
- Add list_users RPCD method to list Nextcloud users via OCC
- Add reset_password RPCD method for password reset via OCC
- Add Users tab in LuCI dashboard with user list
- Add password reset modal with confirmation
- Parse Nextcloud user:displayname JSON format

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-16 15:10:35 +01:00
31aea08b0c docs: Update tracking files for mailserver password fix
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-16 14:00:43 +01:00
778ab4a1e8 fix(mailserver): Fix password reset hash corruption
- Use printf instead of echo to preserve $6$ hash prefix
- Write dovecot entry to temp file to avoid shell expansion
- Use correct uid:gid 102:105 for vmail user
- Add userdb_mail field to dovecot passwd format
- Use /var/mail path to match container layout

The SHA512-CRYPT hash ($6$...) was being corrupted when passed
through nested shell commands - the $6$ was interpreted as a
shell variable and removed.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-16 13:59:06 +01:00
7151bc6138 feat(mailserver): Add mail autoconfig and user repair features
Autoconfig:
- Created config-v1.1.xml (Thunderbird), autodiscover.xml (Outlook),
  email.mobileconfig (Apple) for automatic mail client configuration
- Added uhttpd instance on port 8025 to serve autoconfig files
- Added HAProxy backends with waf_bypass for autoconfig domains
- Added mailctl autoconfig-setup and autoconfig-status commands

LuCI Mailserver:
- Added user_repair method for mailbox repair (doveadm force-resync)
- Added repair button to user actions in overview

LuCI Nextcloud:
- Added list_users method to list Nextcloud users
- Added reset_password method for password reset via OCC

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-16 13:26:23 +01:00
856a167ad4 fix(mailserver): Add firewall-setup command excluding LAN clients
- Add mailctl firewall-setup command to configure mail port forwarding
- Add mailctl firewall-clear command to remove mail firewall rules
- Firewall rules now use "! -s LAN_SUBNET" to exclude LAN clients
- LAN clients can reach external mail servers (OVH, Gmail, etc.)
- WAN traffic on mail ports redirected to local mailserver

Fixes SSL certificate errors when LAN clients connect to external IMAP/SMTP

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-16 13:02:45 +01:00
a461e0e4d6 docs: Update tracking files for mailserver alias feature
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-16 12:54:04 +01:00
23c38cd2f1 feat(mailserver): Add alias management via ubus
- Fix alias_add RPCD to read JSON from stdin (ubus compatibility)
- Add alias_del function to users.sh
- Add alias del command to mailctl
- Add alias_del RPCD method

Tested: alias_add, alias_list, alias_del all work via ubus call

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-16 12:38:55 +01:00
67441bd97b feat(nextcloud): Add tabs to KISS sidebar navigation
Add Nextcloud Overview and Settings tabs to kiss-theme sidebar for
consistent navigation across all SecuBox apps.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-16 12:31:27 +01:00
7bfec387dc feat(hexojs): Add tabs to KISS sidebar navigation
- Add HexoJS tabs (Overview, Posts, Editor, Media, Deploy, Sync, Theme,
  Settings) to kiss-theme.js nav config
- Remove duplicate inline tabs from overview.js
- Tabs now appear in sidebar when HexoJS is selected

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-16 10:43:27 +01:00
1585975e90 refactor(hexojs): Use shared kiss-theme module
Replace inline CSS with shared secubox/kiss-theme module for simpler,
faster, more efficient rendering. Code reduced from 320 to 188 lines.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-16 10:36:56 +01:00
832afe9851 feat(hexojs): KISS-style dashboard with inline CSS
Completely rewrote overview.js with self-contained inline CSS following
the KISS design pattern. Dark theme with stats grid, quick actions,
instance cards with status badges, and clean backups table.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-16 10:34:22 +01:00
44178cbbf5 fix(hexojs): Fix RPC expect unwrapping in dashboard load function
The listInstances and listBackups RPC declarations use expect which
unwraps the response array directly. Changed results[0].instances to
results[0] and results[3].backups to results[3].

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-16 10:30:59 +01:00
c2cd204ea9 feat(hexojs): Multi-instance enhancement with backup/restore and Git integration
- Add backup/restore commands to hexoctl (backup, restore, backup list/delete)
- Add GitHub clone support (hexoctl github clone <url> [instance] [branch])
- Add Gitea push support (hexoctl gitea push [instance] [message])
- Add quick-publish command (clean + build + publish in one step)
- Add 15 new RPCD methods for instance/backup/git management
- Rewrite LuCI dashboard with KISS theme:
  - Multi-instance management with status cards
  - Instance controls: start/stop, quick publish, backup, editor, preview
  - GitHub/Gitea clone modals
  - Backup table with restore/delete
  - Stats grid: instances, posts, drafts, backups
- Update API with 12 new RPC declarations
- Update ACL with new permissions

Also includes DNS Master app created in previous session.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-16 10:26:55 +01:00
16ed7e2d7a fix(mailserver): Add IMAP port 143 to status check
- Added port 143 to RPCD port detection list
- Fixed KISS nav path for Nextcloud (admin/secubox/services/nextcloud)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-16 09:56:51 +01:00
efa74990be feat(mailserver): KISS theme enhancement for LuCI dashboard
- Complete rewrite of overview.js with full KISS theme styling
- 4-column stats grid (Status, Users, Storage, SSL)
- Port status cards with visual indicators
- Two-column layout: Users + Aliases tables
- Webmail card with status badge and quick actions
- Connection info panel with server details
- Live polling with 10s refresh
- Added fix_ports, alias_del methods to ACL
- Added Mail Server + Nextcloud to KISS nav sidebar

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-16 09:52:19 +01:00
1d3fb1ed7c docs: Update tracking files for Nextcloud SSL, WAF rules, mail autoconfig
- Nextcloud production deploy with HAProxy SSL
- WAF rules for Nextcloud & Roundcube CVEs
- Mail client autoconfig DNS and XML endpoint

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-16 09:01:11 +01:00
2bc2eac994 fix(nextcloud): Fix nginx config for Nextcloud app routing
- Change location / from try_files to rewrite for proper app URL handling
- Fixes 403 errors when accessing /apps/* URLs after authentication
- All URLs now properly route through index.php

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-16 08:17:49 +01:00
5b6bf8560a fix(nextcloud): Use configurable HTTP port and correct PHP-FPM socket
- Change nginx to listen on ${NEXTCLOUD_HTTP_PORT:-8080} instead of hardcoded port 80
- Fix PHP-FPM socket path to use detected PHP version (php${PHP_VERSION}-fpm.sock)
- Avoids port conflict with HAProxy on port 80 when using host networking

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-16 08:10:03 +01:00
b78ea3b683 fix(nextcloud): Fix LXC rootfs download and chroot mounts
- Parse HTML directory listing instead of non-existent index.json
- URL-encode colon in date path for LXC image server
- Add mount_chroot_fs/umount_chroot_fs helpers for proper chroot
- Mount /dev, /dev/pts, /proc, /sys before running apt
- Remove php-smbclient (not in base repos)
- Install gnupg/gpgv first for apt verification

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-16 08:02:01 +01:00
09b40c3b88 feat(nextcloud): Migrate to LXC with full-stack enhancement
- Migrate from Docker to Debian 12 LXC container
- Full stack: Nginx, MariaDB, Redis, PHP 8.2-FPM, Nextcloud
- Rewrite nextcloudctl CLI with install/backup/restore/ssl/occ commands
- New UCI config schema: main, db, redis, ssl, backup sections
- Enhanced RPCD backend with 15 methods
- KISS dashboard with Overview/Backups/SSL/Logs tabs
- Updated dependencies for LXC packages
- SecuBox menu path integration

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-16 07:49:17 +01:00
59d0e89a8c feat(gk2hub): Use subdomain URLs instead of redirect paths
- Infrastructure: media, localai, webmail, feed, tube, social, wazuh
- MetaBlogizer: HAProxy vhost lookup for automatic subdomain detection
- Added icons for new service types (tube, social, wazuh, etc.)
- 67 services now display with proper subdomain URLs

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-15 17:01:54 +01:00
491120609b docs: Update tracking files for mitmproxy WAF dashboard fix
- Added mitmproxy WAF data path fix to WIP.md and HISTORY.md
- RPCD now reads from /srv/mitmproxy-in for correct threat stats

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-15 10:35:01 +01:00
42d85c4d0f fix(mitmproxy): Use WAF input data path for threat stats
- Changed RPCD handler to read from /srv/mitmproxy-in (WAF input)
- Previously read from /srv/mitmproxy which had no threat data
- Fixed threats_today, alerts, autobans stats
- Check mitmproxy-in and mitmproxy-out containers for running status

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-15 10:30:21 +01:00
8cfa6fba70 docs: Update tracking files for mailserver gk2 restore and Gitea privacy fix
- Restored gk2@secubox.in user from backup after container reinstall
- Fixed secubox-evolution Gitea repo privacy (public → private)
- Documented secubox_evolution streamlit instance fix (runtime config)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-15 09:45:56 +01:00
274dbd8add docs: Update tracking files for 2026-02-15 work
- HAProxy reload fix (copy config before signal)
- Mitmproxy Host header preservation for OAuth
- WAF global reset (70 vhosts/ACLs)
- PeerTube email configuration with mailserver
- Wazuh agent watchdog implementation
- Streamlit Gitea sync (4 new repos)
- Service fixes (roundcube, evolution, wazuh)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-15 09:19:30 +01:00
851910e185 feat(wazuh): Add watchdog to wazuh-agent startup script
Adds a watchdog loop that checks every 60 seconds if wazuh-agentd
is running and automatically restarts the Wazuh service if it stops.

Fixes agent disconnection issues caused by wazuh-agentd process dying.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-15 09:11:07 +01:00
f3f6eb4e4b fix(haproxy,mitmproxy): Fix config reload and preserve Host header
haproxyctl:
- Copy generated config to /etc/haproxy/ inside container before reload
- HAProxy reads from /etc/haproxy/haproxy.cfg, not /opt/haproxy/config/

mitmproxy haproxy_router.py:
- Save original Host header before setting backend destination
- Restore Host header after routing to preserve it for backend validation
- Fixes PeerTube OAuth and other apps that validate Host header

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-15 07:40:20 +01:00
1a8beb45e0 feat(peertube,portal): Add PeerTube config and generative luci-tree
- secubox-app-peertube: Update default port to 9001, hostname to tube.gk2.secubox.in
- luci-app-secubox-portal: Add RPCD backend for dynamic tree generation
  - get_tree: Auto-discovers luci-app-* packages grouped by category
  - get_containers: Lists LXC containers with running state
  - get_vhosts: Lists HAProxy virtual hosts
- luci-tree.js: Rewritten to use RPC for live data with refresh button

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-15 06:48:10 +01:00
ffb9fe3785 fix(peertube): Change default port from 9000 to 9001
Port 9000 is used by Lyrion music server.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-15 06:04:25 +01:00
5c34ca2cae feat(luci): Add luci-app-peertube dashboard for PeerTube video platform
- RPCD handler (luci.peertube) with 11 methods: status, start, stop,
  install, uninstall, update, logs, emancipate, live_enable,
  live_disable, configure_haproxy
- ACL permissions for read (status, logs) and write operations
- Dashboard features:
  - Install wizard with features and requirements
  - Service status display with access URL
  - Live streaming toggle with enable/disable buttons
  - HAProxy configuration status
  - Emancipate form for public exposure
  - Logs viewer with refresh

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-15 05:51:04 +01:00
dcc34c8bf6 feat(peertube): Add PeerTube video platform package
New secubox-app-peertube package for self-hosted video streaming:

- LXC Debian container with PostgreSQL, Redis, Node.js, FFmpeg
- peertubectl control script with install/update/emancipate commands
- UCI configuration for server, transcoding, live streaming, storage
- procd init script with respawn support
- HAProxy integration with WebSocket and extended timeouts
- RTMP live streaming support (optional)
- S3/object storage support (configurable)
- Admin commands for user management
- Backup/restore functionality

Commands:
  peertubectl install              - Create LXC container with full stack
  peertubectl emancipate <domain>  - Full exposure with HAProxy + ACME
  peertubectl admin create-user    - Create user accounts
  peertubectl live enable          - Enable RTMP live streaming
  peertubectl backup/restore       - Database backup

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-15 05:43:22 +01:00
daa755986e fix(streamlitctl): Add mitmproxy route sync step to emancipation
After emancipating a service, automatically sync routes to mitmproxy
WAF to ensure traffic can be properly routed through the mitmproxy
containers without manual intervention.

The new _emancipate_mitmproxy() function calls mitmproxyctl sync-routes
after HAProxy configuration to keep mitmproxy routing table in sync.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-15 05:29:48 +01:00
1513041d90 fix(vortex-firewall): Detect BIND RPZ in addition to dnsmasq
RPCD handler now checks for both:
- /etc/dnsmasq.d/vortex-firewall.conf (dnsmasq mode)
- /etc/bind/zones/rpz.vortex.zone (BIND RPZ mode)

This fixes the "0 blocked domains" display when using BIND DNS server.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-14 17:31:06 +01:00
c3ebb4a42a fix(interceptor): Check mitmproxy-in/out containers instead of mitmproxy
The mitmproxy service now uses separate containers:
- mitmproxy-in: External WAF (WAN protection)
- mitmproxy-out: Insider WAF (LAN threat detection)

Updated RPCD handler to check correct container names for status.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-14 17:21:25 +01:00
54d555206b chore(feed): Update secubox-app-bonus local feed packages
Regenerated Packages index with proper Filename fields for all ipk files.
Updated all package versions to latest builds.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-14 17:18:02 +01:00
e3093aab6b feat(luci-app-wazuh): Add KISS UI theme and add to feed
- Rewrite overview.js to use KissTheme wrapper
- Add health status cards for Agent, Manager, Indexer, CrowdSec
- Add alert statistics with color-coded counters
- Add security layers table (Firewall, IPS, SIEM, WAF)
- Add quick actions with restart agent button
- Include built IPK in secubox-feed

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-14 16:36:44 +01:00
9eaa16171d fix(mitmproxy): Fix wildcard route priority matching
- Support both "*.domain" and ".domain" wildcard formats in haproxy_router.py
- Sort wildcards by length (longest first) for correct specificity matching
- Add auto-reload: check routes file mtime every 10 requests
- Update metablogizerctl to use mitmproxyctl sync-routes

Also fix luci-app-wazuh api.js to use baseclass.extend

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-14 16:03:43 +01:00
b1c34021db feat(wazuh): Add LuCI dashboard for Wazuh SIEM integration
Create luci-app-wazuh package with unified security monitoring dashboard
inspired by SysWarden's layered defense model:

- 4 views: Overview, Alerts, File Integrity, Agents
- RPCD handler with 12 API methods for status, alerts, FIM, agent control
- SysWarden-style 4-layer security visualization:
  - Layer 1: Vortex Firewall + nftables (kernel-level)
  - Layer 2: CrowdSec + Bouncer (IPS)
  - Layer 3: Wazuh Manager (SIEM/XDR)
  - Layer 4: mitmproxy + HAProxy (WAF)
- CrowdSec integration for threat correlation
- Real-time polling and auto-refresh
- Simplified printf-based JSON output (avoids jshn segfault)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-14 14:45:05 +01:00
a3f3b2dd8c fix(wazuh): Handle multiple deb archive compression formats
Support xz, gz, and zst compression for data.tar in deb packages.
Modern Wazuh debs use data.tar.xz instead of data.tar.gz.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-14 14:28:15 +01:00
7d87bfbc92 feat(wazuh): Add Wazuh Manager LXC container package
New package secubox-wazuh-manager provides complete SIEM stack:
- Wazuh Manager: Agent management, log analysis, threat detection
- Wazuh Indexer: OpenSearch-based alert storage
- Wazuh Dashboard: Web UI for visualization (port 5601)

Features:
- Automated LXC container deployment with Debian 12
- HAProxy integration with waf_bypass for dashboard
- Agent management commands (list, info, remove)
- API access and token generation
- Log viewing for all components
- Shell access for administration

CLI: wazuh-managerctl with install/start/stop/status/configure-haproxy

Requirements: 4GB+ RAM, 20GB+ storage for production use

Complements secubox-app-wazuh agent for full SIEM deployment.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-14 13:31:31 +01:00
6f777761e7 feat(wazuh): Add Wazuh security agent package
New package secubox-app-wazuh provides:
- Wazuh Agent installation and management for ARM64/OpenWrt
- File Integrity Monitoring (FIM) for /etc, /usr/sbin, /etc/config
- Log analysis: syslog, CrowdSec, firewall
- Rootcheck and Security Configuration Assessment
- CrowdSec integration for threat sync
- CLI: wazuhctl with install/configure/register/status commands

Wazuh provides SIEM/XDR capabilities complementing CrowdSec:
- Endpoint detection and response
- Compliance monitoring (PCI-DSS, GDPR, HIPAA)
- Vulnerability detection
- Active response automation

Requires external Wazuh Manager or future secubox-wazuh-manager LXC.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-14 13:28:00 +01:00