working base

This commit is contained in:
Michal Humpula
2025-03-16 10:20:48 +01:00
parent 0ddf5f1c36
commit 5fbd72b370
19 changed files with 3261 additions and 0 deletions

44
route-switcher.service Normal file
View File

@@ -0,0 +1,44 @@
[Unit]
Description=Route-Switcher - Automatic network failover service
Documentation=https://git.hudrydum.cz/michal.humpula/route-switcher
After=network.target network-online.target
Wants=network-online.target
ConditionPathExists=/usr/local/sbin/route-switcher
[Service]
Type=simple
ExecStart=/usr/local/sbin/route-switcher
Restart=always
RestartSec=5
StandardOutput=journal
StandardError=journal
# Environment variables (customize these for your network)
Environment=RUST_LOG=info
Environment=PRIMARY_INTERFACE=eth0
Environment=SECONDARY_INTERFACE=eth1
Environment=PRIMARY_GATEWAY=192.168.1.1
Environment=SECONDARY_GATEWAY=192.168.2.1
Environment=PING_TARGET=8.8.8.8
User=root
Group=root
CapabilityBoundingSet=CAP_NET_ADMIN CAP_NET_RAW
AmbientCapabilities=CAP_NET_ADMIN CAP_NET_RAW
NoNewPrivileges=true
# Resource limits
LimitNOFILE=65536
LimitNPROC=4096
# Process isolation
ProtectSystem=strict
ProtectHome=true
ReadWritePaths=/var/log
PrivateTmp=true
ProtectKernelTunables=true
ProtectControlGroups=true
RestrictRealtime=true
[Install]
WantedBy=multi-user.target