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 Profiler API (FastAPI under uvicorn, APP_PROFILER): PKI (easy-rsa), profiles, server settings.
|
|
|
|
|
# Install: see ovpmon-api.service. Settings come from /etc/ovpmon/env.
|
|
|
|
|
#
|
|
|
|
|
# The profiler runs as the unprivileged user ovpmon. Anything that needs root (install server.conf,
|
|
|
|
|
# publish the CRL, start/stop OpenVPN) goes through `doas /usr/local/sbin/ovpmon-helper <fixed args>`
|
|
|
|
|
# (rules: /etc/doas.conf, configuration: /etc/ovpmon/helper.conf). Therefore, unlike the other two
|
|
|
|
|
# services, this unit must NOT set NoNewPrivileges (doas is setuid) nor any seccomp-based option (see below), must not restrict capabilities,
|
|
|
|
|
# and must leave /etc/openvpn writable: the helper is a child of this process and inherits its
|
|
|
|
|
# mount namespace.
|
|
|
|
|
# Started without --reload and without depending on openvpn.
|
2026-01-28 22:37:47 +03:00
|
|
|
[Unit]
|
2026-10-05 10:45:24 +03:00
|
|
|
Description=OpenVPN Profiler API (uvicorn)
|
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_PROFILER
|
|
|
|
|
ExecStart=/opt/OpenVPN-Monitoring-Simple/APP_PROFILER/venv/bin/python -m uvicorn main:app --host 127.0.0.1 --port 8000
|
2026-01-28 22:37:47 +03:00
|
|
|
Restart=always
|
2026-10-05 10:45:24 +03:00
|
|
|
RestartSec=3
|
|
|
|
|
|
|
|
|
|
# Hardening (moderate, see the note above)
|
|
|
|
|
PrivateTmp=yes
|
|
|
|
|
ProtectHome=yes
|
|
|
|
|
ProtectSystem=full
|
|
|
|
|
ProtectControlGroups=yes
|
|
|
|
|
# Deliberately absent: ProtectKernelTunables, ProtectKernelModules, RestrictRealtime, LockPersonality,
|
|
|
|
|
# SystemCallFilter, RestrictAddressFamilies, MemoryDenyWriteExecute, RestrictNamespaces. They are enforced with a seccomp filter, and for an
|
|
|
|
|
# unprivileged unit systemd then sets NoNewPrivileges implicitly, which breaks the setuid doas
|
|
|
|
|
# ("doas: not installed setuid"). Verify with: grep NoNewPrivs /proc/<main pid>/status (must be 0)
|
|
|
|
|
# Write access: databases and logs; PKI, client profiles and the profiler log inside the install dir;
|
|
|
|
|
# /etc/openvpn and /var/log/openvpn for the root helper (a leading "-" ignores a missing path)
|
|
|
|
|
ReadWritePaths=/var/lib/ovpmon /var/log/ovpmon /opt/OpenVPN-Monitoring-Simple/APP_PROFILER/easy-rsa /opt/OpenVPN-Monitoring-Simple/APP_PROFILER/client-config
|
|
|
|
|
ReadWritePaths=-/opt/OpenVPN-Monitoring-Simple/APP_PROFILER/profiler.log
|
|
|
|
|
ReadWritePaths=-/etc/openvpn -/var/log/openvpn
|
2026-01-28 22:37:47 +03:00
|
|
|
|
|
|
|
|
[Install]
|
|
|
|
|
WantedBy=multi-user.target
|