Allow rotating the vpn connection

This commit is contained in:
Manuel Thalmann 2025-05-01 21:30:51 +02:00
parent aa0ce24ab4
commit f81e4dfadb
4 changed files with 42 additions and 0 deletions
scripts/Common/Software/docker/services/jellyfin

View file

@ -24,6 +24,7 @@ RUN export DEBIAN_FRONTEND=noninteractive \
COPY ./proton/supervisord.conf /etc/supervisor/supervisord.conf
COPY --from=protonwire /usr/bin/protonwire /usr/bin/
COPY --chmod=755 ./proton/proton-entrypoint.sh /usr/local/bin/proton-entrypoint
COPY --chmod=755 ./proton/rotate.sh /usr/local/bin/proton-rotate
COPY --chmod=755 ./proton/service-entrypoint.sh /usr/local/bin/service-entrypoint
COPY --chmod=755 ./proton/pvpn-login.py /usr/bin/pvpn-login
COPY --chmod=755 ./proton/pvpn-cli.py /usr/bin/pvpn-cli
@ -34,6 +35,7 @@ RUN { echo "#!/bin/bash"; echo 'flask --app /opt/pvpn-api.py run --port 8989'; }
ENV PVPN_USERNAME= \
PVPN_CMD_ARGS="--p2p --random" \
PVPN_ROTATE_INTERVAL= \
USERNAME=proton \
PUID=1000 \
PGID=1000 \

View file

@ -0,0 +1,12 @@
#!/usr/bin/env bash
if [ ${PVPN_ROTATE_INTERVAL:-0} -gt 0 ]
then
echo "Rotating VPN connection every $PVPN_ROTATE_INTERVAL seconds"
while true
do
sleep $PVPN_ROTATE_INTERVAL
echo "Rotating VPN connection…"
supervisorctl restart pvpn-cli
done
fi

View file

@ -1,8 +1,18 @@
[supervisord]
nodaemon=true
user=root
logfile=/dev/null
logfile_maxbytes=0
[unix_http_server]
file=%(here)s/supervisord.sock
[supervisorctl]
serverurl=unix://%(here)s/supervisord.sock
[rpcinterface:supervisor]
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
[include]
files=/etc/supervisor/conf.d/*
@ -23,3 +33,11 @@ stdout_logfile=/dev/fd/1
stdout_logfile_maxbytes=0
stderr_logfile=/dev/fd/2
stderr_logfile_maxbytes=0
[program:proton-rotate]
command=proton-rotate
exitcodes=0
stdout_logfile=/dev/fd/1
stdout_logfile_maxbytes=0
stderr_logfile=/dev/fd/2
stderr_logfile_maxbytes=0

View file

@ -1,8 +1,18 @@
[supervisord]
nodaemon=true
user=root
logfile=/dev/null
logfile_maxbytes=0
[unix_http_server]
file=%(here)s/supervisord.sock
[supervisorctl]
serverurl=unix://%(here)s/supervisord.sock
[rpcinterface:supervisor]
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
[include]
files=/etc/supervisor/conf.d/*