Skip to content

Commit 7602a52

Browse files
committed
Fixes
1 parent 1abaf12 commit 7602a52

3 files changed

Lines changed: 24 additions & 48 deletions

File tree

README.md

Lines changed: 8 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ This image packages the Linux `cloudflare-warp` client for running a Cloudflare
55
It is designed for:
66

77
- headless `warp-cli` connector enrollment
8-
- plain node connectivity by default
9-
- optional subnet routing through the container
10-
- optional routed return traffic by enabling forwarding and disabling reverse path filtering
8+
- bidirectional mesh traffic
9+
- subnet routing through the container
10+
- routed return traffic by enabling forwarding and disabling reverse path filtering
1111
- network troubleshooting with `ping` and `traceroute`
1212

1313
## What is included
@@ -18,9 +18,9 @@ It is designed for:
1818
- an entrypoint that:
1919
- starts `warp-svc`
2020
- streams `warp-svc` logs into `docker logs`
21-
- optionally enables IPv4 forwarding for subnet routing
22-
- optionally disables `rp_filter` to avoid dropping asymmetric return traffic
23-
- optionally accepts forwarded traffic in the `FORWARD` chain
21+
- enables IPv4 forwarding
22+
- disables `rp_filter` to avoid dropping asymmetric return traffic
23+
- accepts forwarded traffic in the `FORWARD` chain
2424
- optionally runs `warp-cli connector new <TOKEN>`
2525
- optionally runs `warp-cli connect`
2626
- periodically logs `warp-cli status` changes
@@ -45,15 +45,7 @@ Set your connector token first:
4545
export WARP_CONNECTOR_TOKEN='your-cloudflare-mesh-token'
4646
```
4747

48-
By default the container behaves like a WARP Mesh node and does not enable subnet forwarding.
49-
50-
To turn on subnet routing and reverse-path handling, set:
51-
52-
```bash
53-
export WARP_ENABLE_SUBNET_ROUTING=true
54-
```
55-
56-
If subnet routing is enabled and you are using `network_mode: host`, apply the routing sysctls on the Docker host before starting the container:
48+
If you are using `network_mode: host`, apply the routing sysctls on the Docker host before starting the container:
5749

5850
```bash
5951
sudo sysctl -w net.ipv4.ip_forward=1
@@ -74,8 +66,6 @@ If you want to manage forwarding policy outside the container, set:
7466
export WARP_MANAGE_FORWARD_CHAIN=false
7567
```
7668

77-
`WARP_MANAGE_FORWARD_CHAIN` only matters when `WARP_ENABLE_SUBNET_ROUTING=true`.
78-
7969
The container also supports periodic status logging. The default interval is 15 seconds, and only changed status snapshots are emitted:
8070

8171
```bash
@@ -106,9 +96,7 @@ docker exec -it cf-warp-cli traceroute 1.1.1.1
10696

10797
## Routing notes
10898

109-
When `WARP_ENABLE_SUBNET_ROUTING=false`, this container just joins Mesh as a node and does not try to route third-party subnet traffic.
110-
111-
When `WARP_ENABLE_SUBNET_ROUTING=true`, the surrounding network must send the target CIDR back through this container's host. The container enables forwarding and avoids reverse path filtering drops, but upstream route tables still need to point the advertised subnet toward the Docker host running this container.
99+
For subnet routing to work end to end, the surrounding network must send the target CIDR back through this container's host. The container enables forwarding and avoids reverse path filtering drops, but upstream route tables still need to point the advertised subnet toward the Docker host running this container.
112100

113101
If this is deployed in a cloud VPC, also make sure the instance or VM is allowed to forward traffic and that any source/destination checking is disabled where required by the platform.
114102

docker-compose.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ services:
1212
environment:
1313
WARP_CONNECTOR_TOKEN: "${WARP_CONNECTOR_TOKEN}"
1414
WARP_AUTOCONNECT: "true"
15-
WARP_ENABLE_SUBNET_ROUTING: "${WARP_ENABLE_SUBNET_ROUTING:-false}"
1615
WARP_MANAGE_FORWARD_CHAIN: "true"
1716
WARP_STATUS_INTERVAL_SECONDS: "${WARP_STATUS_INTERVAL_SECONDS:-15}"
1817
volumes:

docker/entrypoint.sh

Lines changed: 16 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,6 @@ log() {
66
printf '[%s] %s\n' "$(date -u +'%Y-%m-%dT%H:%M:%SZ')" "$*"
77
}
88

9-
is_true() {
10-
case "${1,,}" in
11-
1|true|yes|on) return 0 ;;
12-
*) return 1 ;;
13-
esac
14-
}
15-
169
log_command_output() {
1710
local prefix="$1"
1811

@@ -49,11 +42,6 @@ set_sysctl_if_present() {
4942
}
5043

5144
configure_forwarding() {
52-
if ! is_true "${WARP_ENABLE_SUBNET_ROUTING:-false}"; then
53-
log "WARP_ENABLE_SUBNET_ROUTING is disabled; skipping forwarding and reverse-path configuration"
54-
return 0
55-
fi
56-
5745
set_sysctl_if_present net.ipv4.ip_forward 1
5846
set_sysctl_if_present net.ipv4.conf.all.forwarding 1
5947

@@ -63,17 +51,15 @@ configure_forwarding() {
6351
}
6452

6553
configure_firewall() {
66-
if ! is_true "${WARP_ENABLE_SUBNET_ROUTING:-false}"; then
67-
log "WARP_ENABLE_SUBNET_ROUTING is disabled; leaving iptables FORWARD chain unchanged"
68-
return 0
69-
fi
70-
7154
local manage_forward_chain="${WARP_MANAGE_FORWARD_CHAIN:-true}"
7255

73-
if ! is_true "${manage_forward_chain}"; then
74-
log "WARP_MANAGE_FORWARD_CHAIN is disabled; leaving iptables FORWARD chain unchanged"
75-
return 0
76-
fi
56+
case "${manage_forward_chain,,}" in
57+
1|true|yes|on) ;;
58+
*)
59+
log "WARP_MANAGE_FORWARD_CHAIN is disabled; leaving iptables FORWARD chain unchanged"
60+
return 0
61+
;;
62+
esac
7763

7864
if command -v iptables >/dev/null 2>&1; then
7965
iptables -C FORWARD -j ACCEPT >/dev/null 2>&1 || iptables -A FORWARD -j ACCEPT
@@ -172,12 +158,15 @@ enroll_connector_if_requested() {
172158
connect_if_requested() {
173159
local autoconnect="${WARP_AUTOCONNECT:-true}"
174160

175-
if is_true "${autoconnect}"; then
176-
log "Connecting WARP"
177-
warp-cli --accept-tos connect 2>&1 | log_command_output "[warp-cli] "
178-
else
179-
log "WARP_AUTOCONNECT is disabled; leaving the client disconnected"
180-
fi
161+
case "${autoconnect,,}" in
162+
1|true|yes|on)
163+
log "Connecting WARP"
164+
warp-cli --accept-tos connect 2>&1 | log_command_output "[warp-cli] "
165+
;;
166+
*)
167+
log "WARP_AUTOCONNECT is disabled; leaving the client disconnected"
168+
;;
169+
esac
181170
}
182171

183172
status_snapshot() {

0 commit comments

Comments
 (0)