Skip to content

Commit d2acb2c

Browse files
committed
make config options mandatory
1 parent 8a30992 commit d2acb2c

File tree

8 files changed

+117
-120
lines changed

8 files changed

+117
-120
lines changed

tailscale/DOCS.md

Lines changed: 30 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -40,21 +40,28 @@ however, it is nice to know where you need to go later on.
4040

4141
## Configuration
4242

43-
This add-on has almost no additional configuration options for the
44-
add-on itself.
43+
The add-on by default exposes "Exit Node" capabilities that you can enable from
44+
your Tailscale account. Additionally, if the Supervisor managed your network
45+
(which is the default), the add-on will also advertise routes to your subnets on
46+
all supported interfaces to Tailscale.
4547

46-
However, when logging in to Tailscale, you can configure your Tailscale
47-
network right from their interface.
48+
Consider disabling key expiry to avoid losing connection to your Home Assistant
49+
device. See [Key expiry][tailscale_info_key_expiry] for more information.
50+
51+
Logging in to Tailscale, you can configure your Tailscale network right from
52+
their interface.
4853

4954
<https://login.tailscale.com/>
5055

51-
The add-on exposes "Exit Node" capabilities that you can enable from your
52-
Tailscale account. Additionally, if the Supervisor managed your network (which
53-
is the default), the add-on will also advertise routes to your subnets on all
54-
supported interfaces to Tailscale.
56+
1. Navigate to the [Machines page][tailscale_machines] of the admin console, and
57+
find your Home Assistant instance.
5558

56-
Consider disabling key expiry to avoid losing connection to your Home Assistant
57-
device. See [Key expiry][tailscale_info_key_expiry] for more information.
59+
1. Click on the **&hellip;** icon at the right side and select the "Edit route
60+
settings..." option. The "Exit node" and "Subnet routes" functions can be
61+
enabled here.
62+
63+
1. Click on the **&hellip;** icon at the right side and select the "Disable key
64+
expiry" option.
5865

5966
```yaml
6067
accept_dns: true
@@ -89,7 +96,7 @@ userspace_networking: true
8996
If you are experiencing trouble with MagicDNS on this device and wish to
9097
disable, you can do so using this option.
9198

92-
When not set, this option is enabled by default.
99+
This option is enabled by default.
93100

94101
MagicDNS may cause issues if you run things like Pi-hole or AdGuard Home
95102
on the same machine as this add-on. In such cases disabling `accept_dns`
@@ -103,7 +110,7 @@ your tailnet.
103110

104111
More information: [Subnet routers][tailscale_info_subnets]
105112

106-
When not set, this option is enabled by default.
113+
This option is enabled by default.
107114

108115
### Option: `advertise_exit_node`
109116

@@ -114,7 +121,7 @@ route all your public internet traffic as needed, like a consumer VPN.
114121

115122
More information: [Exit nodes][tailscale_info_exit_nodes]
116123

117-
When not set, this option is enabled by default.
124+
This option is enabled by default.
118125

119126
**Note:** You can't advertise this device as an exit node and at the same time
120127
specify an exit node to use. See also the "Option: `exit_node`" section of this
@@ -134,7 +141,7 @@ all nodes on the tailnet will use that IP address for their traffic egress.
134141
135142
More information: [App connectors][tailscale_info_app_connectors]
136143
137-
When not set, this option is enabled by default.
144+
This option is enabled by default.
138145
139146
### Option: `advertise_routes`
140147
@@ -149,8 +156,8 @@ If you want to disable this option, specify an empty list in the configuration
149156
150157
More information: [Subnet routers][tailscale_info_subnets]
151158
152-
When not set, the add-on by default will advertise routes to your subnets on all
153-
supported interfaces.
159+
The add-on by default will advertise routes to your subnets on all supported
160+
interfaces by adding `local_subnets` to the list.
154161
155162
### Option: `exit_node`
156163
@@ -209,7 +216,7 @@ This option allows you to enable Tailscale Serve or Funnel features to present
209216
your Home Assistant instance with a valid certificate on your tailnet or on the
210217
internet.
211218
212-
When not set, this option is disabled by default.
219+
This option is disabled by default.
213220
214221
Tailscale can provide a TLS certificate for your Home Assistant instance within
215222
your tailnet domain.
@@ -284,14 +291,14 @@ internet.
284291
285292
Only ports 443, 8443, and 10000 are allowed by Tailscale.
286293
287-
When not set, port 443 is used by default.
294+
Port 443 is used by default.
288295
289296
### Option: `snat_subnet_routes`
290297
291298
This option allows subnet devices to see the traffic originating from the subnet
292299
router, and this simplifies routing configuration.
293300
294-
When not set, this option is enabled by default.
301+
This option is enabled by default.
295302
296303
To support advanced [Site-to-site networking][tailscale_info_site_to_site] (e.g.
297304
to traverse multiple networks), you can disable this functionality, and follow
@@ -310,7 +317,7 @@ nodes, subnet routers, and app connectors), to only allow return packets for
310317
existing outbound connections. Inbound packets that don't belong to an existing
311318
connection are dropped.
312319

313-
When not set, this option is disabled by default.
320+
This option is disabled by default.
314321

315322
### Option: `tags`
316323

@@ -325,7 +332,7 @@ This add-on supports [Tailscale's Taildrop][tailscale_info_taildrop] feature,
325332
which allows you to send files to your Home Assistant instance from other
326333
Tailscale devices.
327334

328-
When not set, this option is enabled by default.
335+
This option is enabled by default.
329336

330337
Received files are stored in the `/share/taildrop` directory.
331338

@@ -335,7 +342,7 @@ The add-on uses [userspace networking mode][tailscale_info_userspace_networking]
335342
to make your Home Assistant instance (and optionally the local subnets)
336343
accessible within your tailnet.
337344

338-
When not set, this option is enabled by default.
345+
This option is enabled by default.
339346

340347
If you need to access other clients on your tailnet from your Home Assistant
341348
instance, disable userspace networking mode, which will create a `tailscale0`
@@ -463,3 +470,4 @@ SOFTWARE.
463470
[tailscale_info_tags]: https://tailscale.com/kb/1068/tags
464471
[tailscale_info_taildrop]: https://tailscale.com/kb/1106/taildrop
465472
[tailscale_info_userspace_networking]: https://tailscale.com/kb/1112/userspace-networking
473+
[tailscale_machines]: https://login.tailscale.com/admin/machines

tailscale/config.yaml

Lines changed: 30 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -27,21 +27,37 @@ map:
2727
- share:rw
2828
ports:
2929
41641/udp: null
30+
options:
31+
accept_dns: true
32+
accept_routes: true
33+
advertise_exit_node: true
34+
advertise_connector: true
35+
advertise_routes:
36+
- local_subnets
37+
log_level: info
38+
login_server: "https://controlplane.tailscale.com"
39+
share_homeassistant: disabled
40+
share_on_port: 443
41+
snat_subnet_routes: true
42+
stateful_filtering: false
43+
tags: []
44+
taildrop: true
45+
userspace_networking: true
3046
schema:
31-
accept_dns: bool?
32-
accept_routes: bool?
33-
advertise_exit_node: bool?
34-
advertise_connector: bool?
47+
accept_dns: bool
48+
accept_routes: bool
49+
advertise_exit_node: bool
50+
advertise_connector: bool
3551
advertise_routes:
36-
- "match(^(((25[0-5]|(2[0-4]|1\\d|[1-9]?)\\d)\\.){3}(25[0-5]|(2[0-4]|1\\d|[1-9]?)\\d)\\/(3[0-2]|[12]?\\d)|[a-fA-F\\d.:]+:[a-fA-F\\d.:]+\\/(12[0-8]|(1[01]|[1-9]?)\\d))$)?"
52+
- "match(^(?:local.subnets|(?:(?:25[0-5]|(?:2[0-4]|1\\d|[1-9]?)\\d)\\.){3}(?:25[0-5]|(?:2[0-4]|1\\d|[1-9]?)\\d)\\/(?:3[0-2]|[12]?\\d)|[a-fA-F\\d.:]+:[a-fA-F\\d.:]+\\/(?:12[0-8]|(?:1[01]|[1-9]?)\\d))$)"
3753
exit_node: "match(^(?:(?:(?:25[0-5]|(?:2[0-4]|1\\d|[1-9]?)\\d)\\.){3}(?:25[0-5]|(?:2[0-4]|1\\d|[1-9]?)\\d)|[a-fA-F\\d.:]+:[a-fA-F\\d.:]+|[a-fA-F\\d]{8}(?:-[a-fA-F\\d]{4}){3}-[a-fA-F\\d]{12}|auto:any)$)?"
38-
log_level: list(trace|debug|info|notice|warning|error|fatal)?
39-
login_server: url?
40-
share_homeassistant: list(disabled|serve|funnel)?
41-
share_on_port: match(^(443|8443|10000)$)?
42-
snat_subnet_routes: bool?
43-
stateful_filtering: bool?
54+
log_level: list(trace|debug|info|notice|warning|error|fatal)
55+
login_server: url
56+
share_homeassistant: list(disabled|serve|funnel)
57+
share_on_port: match(^(?:443|8443|10000)$)
58+
snat_subnet_routes: bool
59+
stateful_filtering: bool
4460
tags:
45-
- "match(^tag:[a-zA-Z][a-zA-Z0-9-]*$)?"
46-
taildrop: bool?
47-
userspace_networking: bool?
61+
- "match(^tag:[a-zA-Z][a-zA-Z0-9-]*$)"
62+
taildrop: bool
63+
userspace_networking: bool

tailscale/rootfs/etc/s6-overlay/s6-rc.d/post-tailscaled/run

Lines changed: 20 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -16,36 +16,29 @@ declare keyexpiry
1616
# Default options
1717
options+=(--hostname "$(bashio::info.hostname)")
1818

19-
# Accept magicDNS by default when not set, or when explicitly enabled
20-
if ! bashio::config.has_value "accept_dns" || \
21-
bashio::config.true "accept_dns";
22-
then
19+
# Accept magicDNS when explicitly enabled
20+
if bashio::config.true "accept_dns"; then
2321
options+=(--accept-dns)
2422
else
2523
options+=(--accept-dns=false)
2624
fi
2725

28-
# Accept routes by default when not set, or when explicitly enabled
29-
if ! bashio::config.has_value "accept_routes" || \
30-
bashio::config.true "accept_routes";
31-
then
26+
# Accept routes when explicitly enabled
27+
if bashio::config.true "accept_routes"; then
3228
options+=(--accept-routes)
3329
else
3430
options+=(--accept-routes=false)
3531
fi
3632

3733
# Check exit node configuration
38-
if (! bashio::config.has_value "advertise_exit_node" || \
39-
bashio::config.true "advertise_exit_node") && \
34+
if bashio::config.true "advertise_exit_node" && \
4035
bashio::config.has_value "exit_node"
4136
then
4237
bashio::exit.nok "You can't advertise this device as an exit node and at the same time specify an exit node to use"
4338
fi
4439

45-
# Advertise as exit node by default when not set, or when explicitly enabled
46-
if ! bashio::config.has_value "advertise_exit_node" || \
47-
bashio::config.true "advertise_exit_node";
48-
then
40+
# Advertise as exit node when explicitly enabled
41+
if bashio::config.true "advertise_exit_node"; then
4942
options+=(--advertise-exit-node)
5043
else
5144
options+=(--advertise-exit-node=false)
@@ -61,42 +54,33 @@ else
6154
options+=(--exit-node-allow-lan-access=false)
6255
fi
6356

64-
# Advertise app connector by default when not set, or when explicitly enabled
65-
if ! bashio::config.has_value "advertise_connector" || \
66-
bashio::config.true "advertise_connector";
67-
then
57+
# Advertise app connector when explicitly enabled
58+
if bashio::config.true "advertise_connector"; then
6859
options+=(--advertise-connector)
6960
else
7061
options+=(--advertise-connector=false)
7162
fi
7263

7364
# Get configured control server
74-
if bashio::config.has_value "login_server";
75-
then
76-
login_server=$(bashio::config "login_server")
77-
options+=(--login-server="${login_server}")
78-
fi
65+
login_server=$(bashio::config "login_server")
66+
options+=(--login-server="${login_server}")
7967

80-
# Enable stateful filtering (it's disabled by default from v1.66.4)
81-
if ! bashio::config.has_value "stateful_filtering" || \
82-
bashio::config.false "stateful_filtering";
83-
then
84-
options+=(--stateful-filtering=false)
85-
else
68+
# Enable stateful filtering when explicitly enabled
69+
if bashio::config.true "stateful_filtering"; then
8670
options+=(--stateful-filtering)
71+
else
72+
options+=(--stateful-filtering=false)
8773
fi
8874

89-
# Support advanced site-to-site networking, disable source addresses NAT
90-
if ! bashio::config.has_value "snat_subnet_routes" || \
91-
bashio::config.true "snat_subnet_routes";
92-
then
75+
# Enable source NAT when explicitly enabled
76+
if bashio::config.true "snat_subnet_routes"; then
9377
options+=(--snat-subnet-routes)
9478
else
9579
options+=(--snat-subnet-routes=false)
9680
fi
9781

9882
# Get configured tags
99-
tags=$(bashio::config "tags//[] | join(\",\")" "")
83+
tags=$(bashio::config "tags | join(\",\")" "")
10084
options+=(--advertise-tags="${tags}")
10185

10286
# Advertise subnet routes
@@ -161,8 +145,7 @@ fi
161145

162146
# Warn about colliding subnet routes if non-userspace networking and accepting routes are enabled
163147
if bashio::config.false "userspace_networking" && \
164-
(! bashio::config.has_value "accept_routes" || \
165-
bashio::config.true "accept_routes");
148+
bashio::config.true "accept_routes";
166149
then
167150
readarray -t colliding_routes < <( \
168151
comm -1 -2 \
@@ -184,9 +167,7 @@ then
184167
fi
185168

186169
# Notify about userspace networking
187-
if ! bashio::config.has_value "userspace_networking" || \
188-
bashio::config.true "userspace_networking";
189-
then
170+
if bashio::config.true "userspace_networking"; then
190171
bashio::log.notice \
191172
"The add-on uses userspace networking mode."
192173
bashio::log.notice \

tailscale/rootfs/etc/s6-overlay/s6-rc.d/share-homeassistant/run

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,4 +69,4 @@ fi
6969
echo "" >&3
7070

7171
# Set up serve or funnel
72-
exec /opt/tailscale $(bashio::config 'share_homeassistant') --https=$(bashio::config 'share_on_port' '443') --set-path=/ "http://127.0.0.1:$(bashio::core.port)"
72+
exec /opt/tailscale $(bashio::config 'share_homeassistant') --https=$(bashio::config 'share_on_port') --set-path=/ "http://127.0.0.1:$(bashio::core.port)"

tailscale/rootfs/etc/s6-overlay/s6-rc.d/tailscaled/run

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,8 @@ if bashio::var.has_value "${udp_port}"; then
2323
options+=(--port=${udp_port})
2424
fi
2525

26-
# Use userspace networking by default when not set, or when explicitly enabled
27-
if ! bashio::config.has_value "userspace_networking" || \
28-
bashio::config.true "userspace_networking";
29-
then
26+
# Use userspace networking when explicitly enabled
27+
if bashio::config.true "userspace_networking"; then
3028
options+=(--tun=userspace-networking)
3129
fi
3230

tailscale/rootfs/etc/s6-overlay/scripts/stage2_hook.sh

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -59,30 +59,25 @@ if bashio::var.has_value "${proxy_and_funnel_port}"; then
5959
fi
6060

6161
# Disable protect-subnets service when userspace-networking is enabled or accepting routes is disabled
62-
if ! bashio::config.has_value "userspace_networking" || \
63-
bashio::config.true "userspace_networking" || \
62+
if bashio::config.true "userspace_networking" || \
6463
bashio::config.false "accept_routes";
6564
then
6665
rm /etc/s6-overlay/s6-rc.d/post-tailscaled/dependencies.d/protect-subnets
6766
fi
6867

69-
# If advertise_routes is configured, do not wait for the local network to be ready to collect subnet information
70-
if bashio::config.exists "advertise_routes";
68+
# If local subnets are not configured in advertise_routes, do not wait for the local network to be ready to collect subnet information
69+
if ! bashio::config "advertise_routes" | grep -Eq "^local.subnets$";
7170
then
7271
rm /etc/s6-overlay/s6-rc.d/post-tailscaled/dependencies.d/local-network
7372
fi
7473

7574
# Disable forwarding service when userspace-networking is enabled
76-
if ! bashio::config.has_value "userspace_networking" || \
77-
bashio::config.true "userspace_networking";
78-
then
75+
if bashio::config.true "userspace_networking"; then
7976
rm /etc/s6-overlay/s6-rc.d/user/contents.d/forwarding
8077
fi
8178

8279
# Disable mss-clamping service when userspace-networking is enabled
83-
if ! bashio::config.has_value "userspace_networking" || \
84-
bashio::config.true "userspace_networking";
85-
then
80+
if bashio::config.true "userspace_networking"; then
8681
rm /etc/s6-overlay/s6-rc.d/user/contents.d/mss-clamping
8782
fi
8883

@@ -91,9 +86,7 @@ if bashio::config.false 'taildrop'; then
9186
rm /etc/s6-overlay/s6-rc.d/user/contents.d/taildrop
9287
fi
9388

94-
# Disable share-homeassistant service when share_homeassistant has not been explicitly enabled
95-
if ! bashio::config.has_value 'share_homeassistant' || \
96-
bashio::config.equals 'share_homeassistant' 'disabled'
97-
then
89+
# Disable share-homeassistant service when it has been explicitly disabled
90+
if bashio::config.equals 'share_homeassistant' 'disabled'; then
9891
rm /etc/s6-overlay/s6-rc.d/user/contents.d/share-homeassistant
9992
fi

0 commit comments

Comments
 (0)