New Packages: - secubox-cve-triage: AI-powered CVE analysis and vulnerability management - NVD API integration for CVE data - CrowdSec CVE alert correlation - LocalAI-powered impact analysis - Approval workflow for patch recommendations - Multi-source monitoring (opkg, LXC, Docker) - luci-app-cve-triage: Dashboard with alerts, pending queue, risk score - secubox-vortex-dns: Meshed multi-dynamic subdomain delegation - Master/slave hierarchical DNS delegation - Wildcard domain management - First Peek auto-registration - Gossip-based exposure config sync - Submastering for nested hierarchies Fixes: - Webmail 401 login: config.docker.inc.php was overriding IMAP host to ssl://mail.secubox.in:993 which Docker couldn't reach - Fixed mailctl webmail configure to use socat proxy (172.17.0.1:10143) Documentation: - Added LXC cgroup:mixed fix to FAQ-TROUBLESHOOTING.md - Updated CLAUDE.md to include FAQ consultation at startup Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
83 lines
2.3 KiB
Bash
83 lines
2.3 KiB
Bash
#!/bin/sh /etc/rc.common
|
|
|
|
START=95
|
|
STOP=10
|
|
USE_PROCD=1
|
|
|
|
NAME="mailserver"
|
|
|
|
start_service() {
|
|
local enabled=$(uci -q get mailserver.main.enabled)
|
|
[ "$enabled" = "1" ] || {
|
|
echo "Mail server is disabled. Enable with: uci set mailserver.main.enabled=1"
|
|
return 0
|
|
}
|
|
|
|
local container=$(uci -q get mailserver.main.container)
|
|
container="${container:-mailserver}"
|
|
|
|
if ! lxc-info -n "$container" >/dev/null 2>&1; then
|
|
echo "Container '$container' not found. Create with: mailctl install"
|
|
return 1
|
|
fi
|
|
|
|
echo "Starting mail server container: $container"
|
|
lxc-start -n "$container"
|
|
|
|
# Wait for container to get IP
|
|
sleep 3
|
|
|
|
# Start IMAP/SMTP proxies for Docker containers (if socat available)
|
|
# This allows Docker-based webmail to connect to LXC mailserver
|
|
if command -v socat >/dev/null 2>&1; then
|
|
local mail_ip=$(lxc-info -n "$container" -iH 2>/dev/null | head -1)
|
|
if [ -n "$mail_ip" ]; then
|
|
# Kill existing proxies
|
|
pkill -f "socat.*10143" 2>/dev/null
|
|
pkill -f "socat.*10025" 2>/dev/null
|
|
# Start IMAP proxy on port 10143 for Docker containers
|
|
socat TCP-LISTEN:10143,bind=0.0.0.0,fork,reuseaddr TCP:${mail_ip}:143 &
|
|
# Start SMTP proxy on port 10025 for Docker containers
|
|
socat TCP-LISTEN:10025,bind=0.0.0.0,fork,reuseaddr TCP:${mail_ip}:25 &
|
|
echo "Started Docker-to-LXC mail proxies (IMAP:10143, SMTP:10025)"
|
|
fi
|
|
fi
|
|
}
|
|
|
|
stop_service() {
|
|
local container=$(uci -q get mailserver.main.container)
|
|
container="${container:-mailserver}"
|
|
|
|
# Stop Docker-to-LXC mail proxies
|
|
pkill -f "socat.*10143" 2>/dev/null
|
|
pkill -f "socat.*10025" 2>/dev/null
|
|
|
|
if lxc-info -n "$container" 2>/dev/null | grep -q "RUNNING"; then
|
|
echo "Stopping mail server container: $container"
|
|
lxc-stop -n "$container" -t 30
|
|
fi
|
|
}
|
|
|
|
reload_service() {
|
|
local container=$(uci -q get mailserver.main.container)
|
|
container="${container:-mailserver}"
|
|
|
|
if lxc-info -n "$container" 2>/dev/null | grep -q "RUNNING"; then
|
|
echo "Reloading mail server services..."
|
|
lxc-attach -n "$container" -- postfix reload 2>/dev/null
|
|
lxc-attach -n "$container" -- doveadm reload 2>/dev/null
|
|
fi
|
|
}
|
|
|
|
status() {
|
|
local container=$(uci -q get mailserver.main.container)
|
|
container="${container:-mailserver}"
|
|
|
|
if lxc-info -n "$container" 2>/dev/null | grep -q "RUNNING"; then
|
|
echo "Mail server: Running"
|
|
lxc-attach -n "$container" -- postfix status 2>/dev/null
|
|
else
|
|
echo "Mail server: Stopped"
|
|
fi
|
|
}
|