2026-10-05 10:45:24 +03:00
|
|
|
# managed by ovpmon deploy/native (install.sh / update.sh replace this file only while this marker line is present)
|
|
|
|
|
#
|
|
|
|
|
# OpenVPN Monitor API (Flask under gunicorn, APP_CORE).
|
|
|
|
|
# Install: deploy/native/install.sh renders this template (install dir, if not the default) into
|
|
|
|
|
# /etc/systemd/system/ovpmon-api.service. Manual use: copy it there, `systemctl daemon-reload`,
|
|
|
|
|
# `systemctl enable --now ovpmon-api`. Guide: DOCS/Deployment/Scenario2_System_Services.md
|
|
|
|
|
#
|
|
|
|
|
# Settings come from /etc/ovpmon/env (root:root 600; systemd reads it as root before the user switch).
|
|
|
|
|
# The service does not depend on openvpn: the VPN server is started from the UI through the root helper.
|
2026-01-28 22:37:47 +03:00
|
|
|
[Unit]
|
2026-10-05 10:45:24 +03:00
|
|
|
Description=OpenVPN Monitor API (gunicorn)
|
2026-01-28 22:37:47 +03:00
|
|
|
After=network.target
|
2026-10-05 10:45:24 +03:00
|
|
|
Wants=network.target
|
2026-01-28 22:37:47 +03:00
|
|
|
|
|
|
|
|
[Service]
|
|
|
|
|
Type=simple
|
2026-10-05 10:45:24 +03:00
|
|
|
User=ovpmon
|
|
|
|
|
Group=ovpmon
|
|
|
|
|
EnvironmentFile=/etc/ovpmon/env
|
|
|
|
|
WorkingDirectory=/opt/OpenVPN-Monitoring-Simple/APP_CORE
|
|
|
|
|
ExecStart=/opt/OpenVPN-Monitoring-Simple/APP_CORE/venv/bin/python -m gunicorn -w 2 -b 127.0.0.1:5001 openvpn_api_v3:app
|
2026-01-28 22:37:47 +03:00
|
|
|
Restart=always
|
2026-10-05 10:45:24 +03:00
|
|
|
RestartSec=3
|
|
|
|
|
|
|
|
|
|
# Hardening: code and virtualenv are root-owned and read-only for the service
|
|
|
|
|
NoNewPrivileges=yes
|
|
|
|
|
PrivateTmp=yes
|
|
|
|
|
ProtectHome=yes
|
|
|
|
|
ProtectSystem=full
|
|
|
|
|
ProtectKernelTunables=yes
|
|
|
|
|
ProtectKernelModules=yes
|
|
|
|
|
ProtectControlGroups=yes
|
|
|
|
|
RestrictRealtime=yes
|
|
|
|
|
LockPersonality=yes
|
|
|
|
|
# Write access: databases (and their migration backups) and logs
|
|
|
|
|
ReadWritePaths=/var/lib/ovpmon /var/log/ovpmon
|
2026-01-28 22:37:47 +03:00
|
|
|
|
|
|
|
|
[Install]
|
|
|
|
|
WantedBy=multi-user.target
|