Skip to content

Commit

Permalink
Protect local subnets only if non-userspace networking is used AND ac…
Browse files Browse the repository at this point in the history
…cepting routes are enabled
  • Loading branch information
lmagyar committed Oct 23, 2023
1 parent 7382fe4 commit d2fabc1
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
7 changes: 5 additions & 2 deletions tailscale/rootfs/etc/s6-overlay/s6-rc.d/post-tailscaled/run
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,11 @@ fi

bashio::log.info "Tailscale is running"

# Notify about colliding subnet routes if non-userspace-networking is enabled
if bashio::config.false "userspace_networking"; then
# Warn about colliding subnet routes if non-userspace networking and accepting routes are enabled
if bashio::config.false "userspace_networking" && \
(! bashio::config.has_value "accept_routes" || \
bashio::config.true "accept_routes");
then
readarray -t colliding_routes < <( \
comm -1 -2 \
<(subnet-routes local) \
Expand Down
11 changes: 8 additions & 3 deletions tailscale/rootfs/etc/s6-overlay/scripts/stage2_hook.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,19 @@
# S6 Overlay stage2 hook to customize services
# ==============================================================================

# Disable protect-subnets service when userspace-networking is enabled
# Disable mss-clamping service when userspace-networking is enabled
# Disable protect-subnets service when userspace-networking is enabled or accepting routes is disabled
if ! bashio::config.has_value "userspace_networking" || \
bashio::config.true "userspace_networking";
bashio::config.true "userspace_networking" || \
bashio::config.false "accept_routes";
then
rm /etc/s6-overlay/s6-rc.d/user/contents.d/protect-subnets
rm /etc/s6-overlay/s6-rc.d/post-tailscaled/dependencies.d/protect-subnets
fi

# Disable mss-clamping service when userspace-networking is enabled
if ! bashio::config.has_value "userspace_networking" || \
bashio::config.true "userspace_networking";
then
rm /etc/s6-overlay/s6-rc.d/user/contents.d/mss-clamping
fi

Expand Down

0 comments on commit d2fabc1

Please sign in to comment.