cloudflare-warp-in-docker

use the WARP client with Cloudflare Zero Trust in Docker

参考repo

pull image

1
2
3
docker pull swr.cn-north-4.myhuaweicloud.com/ddn-k8s/docker.io/caomingjun/warp:latest `
docker tag swr.cn-north-4.myhuaweicloud.com/ddn-k8s/docker.io/caomingjun/warp:latest docker.io/caomingjun/warp:latest `
docker rmi swr.cn-north-4.myhuaweicloud.com/ddn-k8s/docker.io/caomingjun/warp:latest
1
2
3
docker pull swr.cn-north-4.myhuaweicloud.com/ddn-k8s/docker.io/caomingjun/warp:latest \
docker tag swr.cn-north-4.myhuaweicloud.com/ddn-k8s/docker.io/caomingjun/warp:latest docker.io/caomingjun/warp:latest \
docker rmi swr.cn-north-4.myhuaweicloud.com/ddn-k8s/docker.io/caomingjun/warp:latest

run image

1
docker run -d --name warp -p 1081:1080 -e WARP_SLEEP=2 -v warp:/var/lib/cloudflare-warp --cap-add MKNOD --cap-add AUDIT_WRITE --cap-add NET_ADMIN --device-cgroup-rule "c 10:200 rwm" --sysctl net.ipv6.conf.all.disable_ipv6=0 --sysctl net.ipv4.conf.all.src_valid_mark=1 caomingjun/warp
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
docker run -d --name warp `
  -p 1081:1080 `
  -e WARP_SLEEP=2 `
  -v warp:/var/lib/cloudflare-warp `
  --cap-add MKNOD `
  --cap-add AUDIT_WRITE `
  --cap-add NET_ADMIN `
  --device-cgroup-rule "c 10:200 rwm" `
  --sysctl net.ipv6.conf.all.disable_ipv6=0 `
  --sysctl net.ipv4.conf.all.src_valid_mark=1 `
  caomingjun/warp
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
docker run -d --name warp \
  -p 1081:1080 \
  -e WARP_SLEEP=2 \
  -v warp:/var/lib/cloudflare-warp \
  --cap-add MKNOD \
  --cap-add AUDIT_WRITE \
  --cap-add NET_ADMIN \
  --device-cgroup-rule "c 10:200 rwm" \
  --sysctl net.ipv6.conf.all.disable_ipv6=0 \
  --sysctl net.ipv4.conf.all.src_valid_mark=1 \
  caomingjun/warp

登录

1
docker exec -it warp bash
1
warp-cli registration delete && warp-cli registration new thesixonenine
1
warp-cli registration token com.cloudflare.warp://thesixonenine.cloudflareaccess.com/auth?token=
1
warp-cli connect
1
warp-cli status
1
curl --socks5-hostname 127.0.0.1:1080 https://cloudflare.com/cdn-cgi/trace

以下部分摘抄自原repo的文档

If you want to use the WARP client with Cloudflare Zero Trust, just start the container without specifying license key, use docker exec -it warp bash to get into the container and follow these steps:

  1. warp-cli registration delete to delete current registration
  2. warp-cli registration new <your-team-name> to enroll the device
  3. Open the link in the output in a browser and follow the instructions to complete the registration
  4. On the success page, right-click and select View Page Source.
  5. Find the HTML metadata tag that contains the token. For example, <meta http-equiv="refresh" content"=0;url=com.cloudflare.warp://acmecorp.cloudflareaccess.com/auth?token=yeooilknmasdlfnlnsadfojDSFJndf_kjnasdf..." />
  6. Copy the URL field: com.cloudflare.warp://<your-team-name>.cloudflareaccess.com/auth?token=<your-token>
  7. In the terminal, run the following command using the URL obtained in the previous step: warp-cli registration token com.cloudflare.warp://<your-team-name>.cloudflareaccess.com/auth?token=<your-token>. If you get an API error, then the token has expired. Generate a new one by refreshing the web page and quickly grab the new token from the page source.
  8. warp-cli connect to reconnect using new registration.
  9. Wait untill warp-cli status shows Connected.
  10. Try curl --socks5-hostname 127.0.0.1:1080 https://cloudflare.com/cdn-cgi/trace to verify the connection.

This is only needed for the first time. After the device is enrolled, the registration information will be stored in the ./data directory, if you don’t delete them, the container will automatically use the registration information to connect to the WARP service after restart or recreate.

Licensed under CC BY-NC-SA 4.0
使用 Hugo 构建
主题 Stack 由 Jimmy 设计