Files
vpndock/vpn-node/Dockerfile
Malin 1c2d903a95 fix: fake systemctl for pured.service + pre-install service file
purevpn-cli checks `systemctl is-active pured.service` to determine if
components are installed. Without systemd this always returns inactive,
triggering endless sudo/reinstall loop and ETXTBSY when trying to overwrite
the running daemon binary.

Fake systemctl returns "active" when pured is listening on :9485, "inactive"
otherwise. Also handles start/stop/disable/daemon-reload as no-ops.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-12 18:59:40 +01:00

69 lines
4.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
# ── Pre-download pured daemon (avoids runtime download which 403s) ────────────
# The binary hardcodes the wrong S3 path; the correct URL is in the installer.
RUN curl -fsSL "https://apps.purevpn-tools.com/cross-platform/linux-daemon/1.4.1/pured-linux-x64.gz" \
-o /opt/purevpn-cli/pured-linux-x64.gz \
&& gzip -d /opt/purevpn-cli/pured-linux-x64.gz \
&& chmod +x /opt/purevpn-cli/pured-linux-x64
# ── Fake systemctl (pured.service) ───────────────────────────────────────────
# purevpn-cli checks `systemctl is-active pured.service` to detect missing
# components. Without systemd, this always returns inactive → endless sudo loop.
# Fake systemctl returns "active" when the daemon is reachable on :9485.
COPY systemctl.sh /usr/local/bin/systemctl
RUN chmod +x /usr/local/bin/systemctl \
&& mkdir -p /etc/systemd/system \
&& cp /opt/purevpn-cli/pured.service /etc/systemd/system/pured.service
# ── 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"]