fix: binary patch purevpn-cli to use correct pured daemon download URL

The purevpn-cli binary hardcodes /cross-platform/linux-cli/production/pured-linux-x64.gz
which returns HTTP 403. Correct URL is /cross-platform/linux-daemon/1.4.1/pured-linux-x64.gz.

- Pre-download pured daemon from correct URL during build
- Binary patch (same-length, 54 bytes) replaces hardcoded wrong path in-place
- Daemon already present so first run doesn't trigger broken download

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-12 19:08:27 +01:00
parent 1c2d903a95
commit f7fffc0ac3

View File

@@ -37,12 +37,23 @@ RUN curl -fsSL https://apps.purevpn-tools.com/cross-platform/linux-cli/productio
&& 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.
# ── Pre-download pured daemon + patch wrong URL in purevpn-cli binary ────────
# The binary hardcodes /cross-platform/linux-cli/production/pured-linux-x64.gz
# which returns HTTP 403. The correct URL (from the installer script) is under
# /cross-platform/linux-daemon/1.4.1/. Same-length replacement (54 bytes each).
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
RUN python3 -c "
data = open('/opt/purevpn-cli/bin/purevpn-cli','rb').read()
old = b'cross-platform/linux-cli/production/pured-linux-x64.gz'
new = b'cross-platform/linux-daemon/1.4.1/pured-linux-x64.gz?x'
assert len(old)==len(new), f'{len(old)} vs {len(new)}'
n = data.count(old); assert n > 0, 'pattern not found'
open('/opt/purevpn-cli/bin/purevpn-cli','wb').write(data.replace(old,new))
print(f'Patched {n} occurrence(s)')
"
# ── Fake systemctl (pured.service) ───────────────────────────────────────────
# purevpn-cli checks `systemctl is-active pured.service` to detect missing