secubox-openwrt/package/secubox/luci-app-secubox-netifyd/root/etc/uci-defaults/90-secubox-netifyd
CyberMind-FR c68b1b2cc0 feat: Add persistent netifyd collector setup (v1.0.3)
The netifyd collector cron job now persists across reboots:

- Add collector_enabled option to UCI config (secubox-netifyd.sink)
- Create init script (secubox-netifyd-collector) to manage cron job
- Update netifyd-collector-setup with enable/disable/status commands
- Apply collector settings on first boot via uci-defaults

Usage:
  netifyd-collector-setup unix /tmp/netifyd-flows.json  # Enable
  netifyd-collector-setup disable                       # Disable
  netifyd-collector-setup status                        # Show status

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-08 17:50:28 +01:00

59 lines
2.1 KiB
Bash
Executable File

#!/bin/sh
# SecuBox Netifyd - UCI defaults setup
# Creates required directories and initializes configuration
# Create netifyd directories if they don't exist
mkdir -p /etc/netify.d/plugins.d
mkdir -p /etc/netify.d/address-groups.d
# Ensure proper permissions
chmod 755 /etc/netify.d
chmod 755 /etc/netify.d/plugins.d
chmod 755 /etc/netify.d/address-groups.d
# Note: netify-categories.json is NOT created here as netifyd 5.2.1+ expects
# a newer format that differs from the legacy format. Let netifyd manage this
# file on its own, or operate without it (which works fine).
# Initialize UCI configuration if it doesn't exist
if ! uci -q get secubox-netifyd.settings >/dev/null 2>&1; then
uci set secubox-netifyd.settings=settings
uci set secubox-netifyd.settings.auto_refresh='1'
uci set secubox-netifyd.settings.refresh_interval='5'
uci set secubox-netifyd.settings.socket_type='unix'
uci set secubox-netifyd.settings.unix_socket_path='/var/run/netifyd/netifyd.sock'
uci set secubox-netifyd.settings.socket_address='127.0.0.1'
uci set secubox-netifyd.settings.socket_port='7150'
uci set secubox-netifyd.settings.auto_start='1'
uci commit secubox-netifyd
fi
# Analytics settings
if ! uci -q get secubox-netifyd.analytics >/dev/null 2>&1; then
uci set secubox-netifyd.analytics=analytics
uci set secubox-netifyd.analytics.top_apps_limit='10'
uci set secubox-netifyd.analytics.top_protocols_limit='10'
uci set secubox-netifyd.analytics.top_devices_limit='20'
uci set secubox-netifyd.analytics.data_retention_days='7'
uci commit secubox-netifyd
fi
# Initialize sink/collector settings if missing
if ! uci -q get secubox-netifyd.sink.collector_enabled >/dev/null 2>&1; then
uci set secubox-netifyd.sink.collector_enabled='0'
uci commit secubox-netifyd
fi
# Apply collector cron job if enabled in UCI
if [ "$(uci -q get secubox-netifyd.sink.collector_enabled)" = "1" ]; then
/etc/init.d/secubox-netifyd-collector enable 2>/dev/null
/etc/init.d/secubox-netifyd-collector start 2>/dev/null
fi
# Restart netifyd if it's running to apply changes
if pidof netifyd >/dev/null 2>&1; then
/etc/init.d/netifyd restart >/dev/null 2>&1
fi
exit 0