Commit Graph

1236 Commits

Author SHA1 Message Date
f9f2be9252 fix(system-hub): Fix get_denoise_stats RPCD returning no response
- Replace jsonfilter with grep for CrowdSec decision counting
- Add ipset existence check before listing blocked IPs
- Add safety fallbacks for empty/invalid counts
- Bump version to 0.5.2-r2

The jsonfilter -e '@[*]' approach failed with CrowdSec's
multi-line JSON output, causing exit code 251 errors.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-21 07:05:24 +01:00
cec4893db9 feat(security): Implement SysWarden Evolution #1-3 security enhancements
Evolution #1 - IP Blocklist (secubox-app-ipblocklist, luci-app-ipblocklist):
- Pre-emptive blocking layer with ipset (~100k IPs)
- Default sources: Data-Shield, Firehol Level 1
- Supports nftables (fw4) and iptables backends
- LuCI KISS dashboard with sources/whitelist management

Evolution #2 - AbuseIPDB Reporter (luci-app-crowdsec-dashboard v0.8.0):
- New "AbuseIPDB" tab in CrowdSec Dashboard
- crowdsec-reporter.sh CLI for reporting blocked IPs
- RPCD handler luci.crowdsec-abuseipdb with 9 methods
- Cron job for automatic reporting every 15 minutes
- IP reputation checker in dashboard

Evolution #3 - Log Denoising (luci-app-system-hub v0.5.2):
- Three modes: RAW, SMART (noise ratio), SIGNAL_ONLY (filter known IPs)
- Integrates with IP Blocklist ipset + CrowdSec decisions
- RPCD methods: get_denoised_logs, get_denoise_stats
- Denoise mode selector panel with noise ratio indicator

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-20 20:11:24 +01:00
a81e8dd8ca fix(bandwidth-manager): Fix traffic graphs for nftables kernel
- Return Mbps as decimal strings instead of integers (shows 0.45 instead of 0)
- Replace iptables tracking with conntrack/nftables for per-client bytes
- Works with nftables kernel that has no iptables compatibility

Note: Add cron job for historical data: */5 * * * * ubus call luci.bandwidth-manager record_stats

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-20 16:39:26 +01:00
53dc035955 fix(crowdsec): Read WAF threats from mitmproxy-in instance
The CrowdSec dashboard was reading from /srv/mitmproxy/threats.log
but the WAF input instance writes to /srv/mitmproxy-in/threats.log.

Fixed paths:
- threats.log: /srv/mitmproxy -> /srv/mitmproxy-in
- autoban-processed.log: /srv/mitmproxy -> /srv/mitmproxy-in

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-20 16:29:29 +01:00
bab3ce3e33 feat(portal): Add SSO portal with gk2 subdomains and guide page
- Portal page with all service links using *.gk2.secubox.in format
- User guide with updated gk2 subdomain URLs
- Guide link added to login page bottom
- HAProxy vhost configured for portal.secubox.in
- WAF routing enabled through mitmproxy

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-20 15:26:14 +01:00
2f7d57dced feat(hexojs): Add content upload wizard and moderation system
- Add upload.js wizard with multi-target publishing (HexoJS, Gitea, Streamlit, MetaBlogizer)
- Add submit.js for user content submission with moderation workflow
- Add moderation RPCD methods: submit_for_review, list_pending, approve_submission, reject_submission
- Update ACL with new moderation permissions
- Add menu entries for Upload and Submit & Moderate views

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-20 14:11:20 +01:00
9887b3555d feat(vm): Add LuCI VM Manager and Vortex Firewall stats improvements
- Add luci-app-vm for LXC container management dashboard
  - Status bar with total/running/stopped containers, disk usage
  - Container cards with Start/Stop/Restart, Snapshot, Export
  - RPCD handler with 10 methods

- Fix Vortex Firewall statistics tracking
  - Replace x47 multiplier with unique_ips metric
  - Read blocks from BIND RPZ log via stats file
  - RPCD now returns unique_ips count

- Add c3box-vm-builder.sh for portable VM creation
  - Downloads OpenWrt x86-64 image
  - Injects SecuBox configuration
  - Converts to VMDK/VDI/OVA formats

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-20 12:57:09 +01:00
1e6fe68dfb docs: Bump version to v0.24.0
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-20 11:52:34 +01:00
58220065b5 feat(v0.23.0): Matrix homeserver, SaaS Relay CDN caching, Media Hub dashboard
Matrix Homeserver (Conduit):
- E2EE mesh messaging using Conduit v0.10.12 in LXC container
- matrixctl CLI: install/uninstall, user/room management, federation
- luci-app-matrix: status cards, user form, emancipate, mesh publish
- RPCD backend with 17 methods
- Identity (DID) integration and P2P mesh publication

SaaS Relay CDN Caching & Session Replay:
- CDN cache profiles: minimal, gandalf (default), aggressive
- Session replay modes: shared, per_user, master
- saasctl cache/session commands for management
- Enhanced mitmproxy addon (415 lines) with response caching

Media Services Hub Dashboard:
- Unified dashboard at /admin/services/media-hub
- Category-organized cards (streaming, conferencing, apps, etc.)
- Service status indicators with start/stop/restart controls
- RPCD backend querying 8 media services

Also includes:
- HexoJS static upload workflow and multi-user auth
- Jitsi config.js Promise handling fix
- Feed package updates

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-20 11:44:26 +01:00
b6747c197e feat(security): Add instant ban feature and user management
- Add enhanced instant ban for critical threats (SQL injection, CVE exploits, RCE)
  - CrowdSec trigger scenario for single-hit bans on severity=critical
  - Instant ban daemon (10s polling) for rapid response
  - UCI options: instant_ban_enabled, instant_ban_duration (48h default)
  - WAF addon updated to route critical threats to instant-ban.log

- Add centralized user management (secubox-core-users, luci-app-secubox-users)
  - CLI tool: secubox-users add/del/passwd/list/sync/status
  - LuCI dashboard under System > SecuBox Users
  - Unified user provisioning across Nextcloud, PeerTube, Matrix, Jabber, Email

- Add Matrix/Conduit integration (secubox-app-matrix, luci-app-matrix)
  - LXC-based Conduit homeserver deployment
  - Full RPCD handler with user/room management
  - HAProxy integration for federation

- Add provision-users.sh script for bulk user creation
- Update secubox-feed with new IPKs

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-19 20:17:28 +01:00
91cfd35d7a feat(voip): Add call recording feature with LuCI management
- Add MixMonitor integration for automatic call recording
- Add voipctl rec commands: enable/disable/status/list/play/download/delete/cleanup
- Add recordings.js LuCI view with audio player and date filtering
- Add RPCD methods for recording management
- Add UCI config section for recording settings (format, retention)
- Fix OVH API signature to use openssl instead of sha1sum
- Improve PJSIP trunk config with realm and qualify settings

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-19 15:11:46 +01:00
7b4cf2dfe6 feat(portal): Add VoIP/Jabber/Mail to luci-tree categories
Add luci-app-voip, luci-app-jabber, luci-app-jitsi, luci-app-mail,
luci-app-nextcloud, luci-app-webradio to AI & Communication category.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-19 14:45:54 +01:00
e416fa14a6 feat(jabber): Add VoIP integration to LuCI dashboard
Add Jingle VoIP, SMS Relay, and Voicemail Notifications sections to
the Jabber overview.js. Expose 9 new RPC methods in api.js for VoIP
control. Also includes remaining VoIP package updates (dialer view,
asterisk-config.sh) from previous session.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-19 14:37:17 +01:00
dd9594d52b docs: Update tracking files for WAF VoIP/XMPP filters and Jitsi Meet
- Added 4 new WAF categories: voip (12), xmpp (10), cve_voip (9), cve_xmpp (8)
- Self-hosted Jitsi Meet deployed at meet.gk2.secubox.in
- Full LXC container with Prosody/Jicofo/JVB/Nginx
- Webchat updated to use self-hosted Jitsi

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-19 12:08:20 +01:00
64bfeccfdb feat(mitmproxy): Add VoIP/XMPP WAF protection rules
New WAF categories for VoIP and Jabber security:

- voip: SIP header injection, ARI command injection, FreePBX RCE,
  AMI web access, multipart traversal, Digest auth attacks
- xmpp: XSS in messages/presence, BOSH hijack, XXE via XInclude,
  WebSocket XSS, HTTP upload abuse, null byte in JID
- cve_voip: Asterisk PJSIP crash (CVE-2021-26906), negative CL DoS,
  Via header overflow, Route header crash, SDP buffer overflow,
  CSeq method overflow, FreePBX/Kamailio/OpenSIPS CVEs
- cve_xmpp: Prosody namespace confusion, stream DoS, upload DoS,
  ejabberd disco leak, Converse.js XSS, Strophe.js parsing crash,
  Tigase unauth user creation

Also added:
- UCI waf_rules section with toggles for all 12 categories
- Auto-ban options for VoIP/XMPP attack patterns
- Updated waf-sync script for new categories

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-19 10:43:06 +01:00
6affa7cd30 fix(voip): Add Debian Bullseye repo for Asterisk package
Asterisk was removed from Debian Bookworm main repositories.
Added Bullseye repo with pinning to install asterisk packages.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-19 09:27:22 +01:00
4ca46b61e2 feat(voip): Add VoIP packages with OVH provisioning and Jabber integration
New packages:
- secubox-app-voip: Asterisk PBX in LXC container
- luci-app-voip: Dashboard with extensions, trunks, click-to-call

VoIP features:
- voipctl CLI for container, extensions, trunks, calls, voicemail
- OVH Telephony API auto-provisioning for SIP trunks
- Click-to-call web interface with quick dial
- RPCD backend with 15 methods

Jabber VoIP integration:
- Jingle VoIP support (STUN/TURN via mod_external_services)
- SMS relay via OVH (messages to sms@domain)
- Voicemail notifications via Asterisk AMI → XMPP
- 9 new RPCD methods for VoIP features

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-19 09:22:06 +01:00
3c992026ed feat(jabber): Add Converse.js webchat interface and fix Prosody binding
- Add webchat setup with Converse.js for browser-based chat access
- Fix Prosody HTTP binding to all interfaces (not just localhost)
- Add http_interfaces and https_interfaces to config
- Run Prosody as prosody user to avoid root permission issues
- Add /chat/ path for webchat served by Prosody http_files module
- Mount webchat directory in LXC container for easy customization
- Update install/emancipate output to show webchat URL

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-19 08:58:46 +01:00
e849c38aa2 docs: Update tracking files for Jabber deployment
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-19 08:13:01 +01:00
8377f8b092 fix(jabber): Fix Prosody startup and process detection
- Run Prosody as prosody user (not root) via su -s /bin/sh
- Fix process detection to look for lua.*prosody pattern
- Generate SSL certs using openssl instead of prosodyctl
- Remove deprecated cross_domain_websocket option
- Create config file before certificate generation

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-19 08:00:33 +01:00
247d688a72 docs: Update tracking files for Jabber/XMPP packages
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-19 07:52:31 +01:00
b0d208777d feat(jabber): Add Jabber/XMPP server packages (Prosody)
New packages:
- secubox-app-jabber: LXC-based Prosody XMPP server with:
  - Debian Bookworm container
  - Full XMPP support (C2S, S2S, MUC, MAM)
  - HTTP upload for file sharing
  - BOSH and WebSocket for web clients
  - SSL/TLS encryption
  - User and room management via jabberctl

- luci-app-jabber: LuCI dashboard with:
  - Status overview and service controls
  - User management (add/delete)
  - Emancipate workflow (HAProxy + SSL + DNS)
  - Connection info display
  - Log viewer

CLI commands:
  jabberctl install/uninstall/start/stop/status
  jabberctl user add/del/passwd/list
  jabberctl room create/delete/list
  jabberctl emancipate <domain>

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-19 07:48:09 +01:00
3150c65e99 feat(peertube): Add yt-dlp video import to LuCI dashboard
- Install yt-dlp in PeerTube LXC container for video downloads
- Add RPCD methods: import_video, import_status
- Add UI section with URL input and download button
- Support YouTube, Vimeo, and 1000+ video sites
- Download videos to import folder for PeerTube admin upload
- Show download status and video count

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-17 16:20:50 +01:00
75b85080fa feat(mitmproxy): Add WAF Filters UI to LuCI dashboard
- Add new WAF Filters tab displaying 10 detection categories
- Categories: sqli, xss, lfi, rce, cve_2024, scanners, webmail, api_abuse, nextcloud, roundcube
- Toggle enable/disable per category with live updates
- Expandable rules tables with patterns, descriptions, CVE links
- Summary stats: total categories, active filters, rule count
- RPCD methods: get_waf_rules, toggle_waf_category
- Update menu entry and ACL permissions

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-17 16:02:58 +01:00
00f584e6a0 docs: Bump version to v0.21.0 in WIP.md
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-17 15:50:21 +01:00
c4669fafc9 docs: Mailserver migration Alpine → Debian 12
- Replaced unstable Alpine container with Debian 12 Bookworm
- Fixed persistent Dovecot permission issues (UID/GID mismatch)
- Postfix + Dovecot properly configured for Debian
- Mail data and SSL certificates preserved
- Webmail now working reliably

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-17 15:49:50 +01:00
edbd58d95d feat(security): Add ndpid to security dashboard, Streamlit/MetaBlogizer to apps
Security KISS Dashboard:
- Add ndpid (nDPI daemon) to RPCD status method
- Add ndpid to services monitoring array (6 services total)

APPS Portal:
- Add Streamlit to Services category (Python data apps)
- Add MetaBlogizer to Services category (AI blog generation)

Also includes secubox-cloner enhancements from earlier session.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-17 15:29:54 +01:00
dd1e7cbbde feat(security-threats): Add Wazuh SIEM to security status bar
- Add wazuh_running status check to RPCD handler
- Display Wazuh alongside CrowdSec, netifyd, mitmproxy in dashboard

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-17 14:57:46 +01:00
1945c5b5c3 docs: Update tracking files for Nextcloud LXC enhancement
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-17 14:46:38 +01:00
4d193c5e48 feat(nextcloud): Enhance LXC package with storage stats and backup management
- Update Nextcloud version to 31.0.5
- Add auto-start (lxc.start.auto) for boot persistence
- Add memory limit cgroup configuration
- Fix nginx /apps/ path for static assets (CSS, JS, SVG)
- Add Storage tab with disk usage visualization
- Add delete backup functionality
- Add RPCD methods: uninstall, get_storage, delete_backup
- Update ACL permissions for new methods
- Rewrite README.md with LXC architecture docs

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-17 14:41:04 +01:00
92c3a4df46 docs: Update tracking files for luci-app-webradio addition
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-17 14:35:19 +01:00
418e99e481 feat(webradio): Add luci-app-webradio LuCI interface
Complete WebRadio management interface for OpenWrt:
- Dashboard with server status, listeners, now playing
- Icecast/Ezstream server configuration
- Playlist management with shuffle/upload
- Programming grid scheduler with jingle support
- Live audio input via DarkIce (ALSA)
- Security: SSL/TLS, rate limiting, CrowdSec integration

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-17 14:25:31 +01:00
d02f65118e docs: Update HISTORY.md for v0.20.6 release
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-17 07:37:19 +01:00
d03608e3e3 docs: Update WIP.md for v0.20.6 release
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-17 07:36:20 +01:00
a47800df6f fix(dns-master): Make bump_serial POSIX-compatible
Replace bash-specific substring syntax with POSIX alternatives:
- ${var:0:8} -> cut -c1-8
- ${var:8:2} -> cut -c9-10
- $((10#$var + 1)) -> expr

This fixes "arithmetic syntax error" when running via RPCD (busybox ash).

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-17 07:34:47 +01:00
f95b381077 fix(mailserver): Fix dovecot users file permissions in user_add/passwd
Both user_add and user_passwd functions now set correct permissions
(644 root:dovecot) after updating /etc/dovecot/users inside the
container. This prevents "Permission denied" errors on authentication
after adding users or changing passwords.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-17 07:30:49 +01:00
3aacabd5c1 fix(mailserver): Fix dovecot users file permissions after add-user
Ensure /etc/dovecot/users has 644 permissions and root:dovecot ownership
after adding a user. Without this, dovecot cannot read the passwd-file
and authentication fails with "Permission denied".

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-17 07:26:46 +01:00
95e14c183b fix(mailserver): Improve Dovecot startup permissions
- Create login/token-login/empty directories with correct ownership
- Set proper permissions for dovenull user on login directories
- Remove stale auth-token-secret.dat on startup (prevents "compromised token" errors)
- Increase sleep time after dovecot start for socket creation
- Fix permissions again after socket creation

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-17 07:11:22 +01:00
8412639a8c fix(nextcloud): Add cron setup for background jobs
Configure Nextcloud cron job (every 5 minutes) in container startup
script for proper background task execution (file scanning, cleanup,
notifications, etc.)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-17 03:50:29 +01:00
aa86161af0 fix(nextcloud): Remove /apps/ location block breaking static files
The ^~ /apps/ location was taking precedence over static file regex
locations, causing SVG icons to return 404. The root location's
rewrite to index.php already handles app routing correctly.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-17 03:49:01 +01:00
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