purevpn-cli is designed to run as non-root and calls sudo internally for privileged VPN setup. Running as root skips this flow and crashes. - Add vpnuser (home=/root so login tokens are shared with root setup) - Configure sudoers secure_path to include /opt/purevpn-cli/bin - Wrap all purevpn-cli calls in entrypoint with pvpn() helper (su vpnuser) - Keep iptables/danted running as root Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
53 lines
3.1 KiB
Docker
53 lines
3.1 KiB
Docker
FROM debian:bookworm-slim
|
|
|
|
LABEL description="dante SOCKS5 + purevpn-cli exit node"
|
|
|
|
# ── System dependencies ───────────────────────────────────────────────────────
|
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
dante-server \
|
|
sudo \
|
|
curl wget ca-certificates \
|
|
iproute2 iptables iputils-ping \
|
|
netcat-openbsd procps dnsutils \
|
|
expect \
|
|
openvpn wireguard wireguard-tools \
|
|
net-tools openresolv \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
# ── Non-root vpnuser ─────────────────────────────────────────────────────────
|
|
# purevpn-cli is designed to run as non-root; it calls sudo internally for
|
|
# privileged VPN setup. Home is /root so login tokens written by root are shared.
|
|
RUN useradd -M -d /root -s /bin/bash vpnuser
|
|
|
|
# ── Sudoers: passwordless + correct PATH for vpnuser ─────────────────────────
|
|
RUN echo "vpnuser ALL=(ALL:ALL) NOPASSWD: ALL" >> /etc/sudoers \
|
|
&& echo 'Defaults:vpnuser secure_path="/opt/purevpn-cli/bin:/opt/purevpn-cli:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"' >> /etc/sudoers
|
|
|
|
# ── Stub openvpn-systemd-resolved ────────────────────────────────────────────
|
|
RUN mkdir -p /usr/lib/openvpn \
|
|
&& printf '#!/bin/sh\nexit 0\n' \
|
|
| tee /usr/local/bin/openvpn-systemd-resolved \
|
|
/usr/lib/openvpn/openvpn-systemd-resolved > /dev/null \
|
|
&& chmod +x /usr/local/bin/openvpn-systemd-resolved \
|
|
/usr/lib/openvpn/openvpn-systemd-resolved
|
|
|
|
# ── Install purevpn-cli ───────────────────────────────────────────────────────
|
|
RUN curl -fsSL https://apps.purevpn-tools.com/cross-platform/linux-cli/production/cli-install.sh \
|
|
-o /tmp/cli-install.sh \
|
|
&& bash /tmp/cli-install.sh \
|
|
&& rm -f /tmp/cli-install.sh
|
|
|
|
# ── PATH ──────────────────────────────────────────────────────────────────────
|
|
ENV PATH=/opt/purevpn-cli/bin:/opt/purevpn-cli:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
|
|
|
|
# ── Location list ─────────────────────────────────────────────────────────────
|
|
COPY servers.txt /etc/vpndock/servers.txt
|
|
|
|
# ── Entrypoint ────────────────────────────────────────────────────────────────
|
|
COPY entrypoint.sh /entrypoint.sh
|
|
RUN chmod +x /entrypoint.sh
|
|
|
|
EXPOSE 1080
|
|
|
|
ENTRYPOINT ["/entrypoint.sh"]
|