diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index e0b327f..b0d37ae 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -223,6 +223,7 @@ jobs: run: | docker run --rm "$IMAGE@$DIGEST" --help docker run --rm --entrypoint gpauth "$IMAGE@$DIGEST" --help + docker run --rm --entrypoint sh "$IMAGE@$DIGEST" -lc 'test "$(id -u gp)" = "1000" && test "$SUDO_UID" = "1000"' - name: Export digest run: | mkdir -p /tmp/digests @@ -329,6 +330,17 @@ jobs: with: path: gh-release/gp/.build/artifacts + - name: Rename APK artifacts + run: | + shopt -s nullglob + + for file in gh-release/gp/.build/artifacts/artifact-gp-apk-amd64/*.apk; do + mv "$file" "${file%.apk}-x86_64.apk" + done + for file in gh-release/gp/.build/artifacts/artifact-gp-apk-ubuntu-24.04-arm/*.apk; do + mv "$file" "${file%.apk}-aarch64.apk" + done + - name: Create GH release env: GH_TOKEN: ${{ secrets.GH_PAT }} diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index c40f78d..3a7d49d 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -197,6 +197,7 @@ jobs: run: | docker run --rm "$IMAGE@$DIGEST" --help docker run --rm --entrypoint gpauth "$IMAGE@$DIGEST" --help + docker run --rm --entrypoint sh "$IMAGE@$DIGEST" -lc 'test "$(id -u gp)" = "1000" && test "$SUDO_UID" = "1000"' - name: Export digest run: | mkdir -p /tmp/digests diff --git a/README.md b/README.md index 1fb3f02..9edc828 100644 --- a/README.md +++ b/README.md @@ -281,7 +281,25 @@ docker run --rm -it --cap-add=NET_ADMIN --device=/dev/net/tun \ connect --cookie-on-stdin ``` -For browser authentication in a headless environment, pipe `gpauth` remote-browser output into `gpclient`: +For browser authentication in a headless environment, use remote browser authentication: + +```bash +docker run --rm -it --cap-add=NET_ADMIN --device=/dev/net/tun \ + yuezk/globalprotect-openconnect: \ + connect --browser remote +``` + +On a Linux host, add host networking if the VPN routes should affect the host network namespace: + +```bash +docker run --rm -it --network host --cap-add=NET_ADMIN --device=/dev/net/tun \ + yuezk/globalprotect-openconnect: \ + connect --browser remote +``` + +Without `--network host`, the VPN connection stays inside the container's network namespace. Docker Desktop on macOS and Windows does not make the host use the VPN through `--network host`; run `gpclient` on the host or use a container gateway setup for host traffic. + +Alternatively, pipe `gpauth` remote-browser output into `gpclient`: ```bash docker run --rm -it --entrypoint gpauth yuezk/globalprotect-openconnect: \ diff --git a/packaging/docker/alpine/Dockerfile b/packaging/docker/alpine/Dockerfile index 024e285..6bd82bc 100644 --- a/packaging/docker/alpine/Dockerfile +++ b/packaging/docker/alpine/Dockerfile @@ -42,6 +42,9 @@ RUN install -Dm755 target/release/gpclient /out/usr/bin/gpclient \ FROM alpine:${ALPINE_VERSION} +ENV SUDO_UID=1000 \ + HOME=/root + RUN apk add --no-cache \ ca-certificates \ gmp \ @@ -55,6 +58,8 @@ RUN apk add --no-cache \ openssl \ p11-kit \ zlib \ + && addgroup -g 1000 gp \ + && adduser -D -u 1000 -G gp gp \ && update-ca-certificates COPY --from=builder /out/ /