Added joinztnet()
This commit is contained in:
parent
e39a31809f
commit
36739985f8
31
startup.bash
31
startup.bash
|
@ -1,13 +1,35 @@
|
||||||
#!/usr/bin/env bash -x
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
joinztnet() {
|
||||||
|
local ztaddrlist ztoutput ztaddr
|
||||||
|
ztaddrlist="$1"
|
||||||
|
|
||||||
|
# Yes, this is UUOC. No, I won't be changing it.
|
||||||
|
# shellcheck disable=2002,2162
|
||||||
|
cat "$ztaddrlist" | while read ztaddr; do
|
||||||
|
# `zerotier-cli join $address` will return the same success message if already joined
|
||||||
|
# to $address
|
||||||
|
ztoutput=$(zerotier-cli join "$ztaddr")
|
||||||
|
if [[ "$ztoutput" != "200 join OK" ]]; then
|
||||||
|
printf "Error: Unable to join ZeroTier network with ID: %s\nOutput: %s" \
|
||||||
|
"$ztaddr" \
|
||||||
|
"$ztoutput"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
####
|
####
|
||||||
# Runtime Config
|
# Runtime Config
|
||||||
|
|
||||||
# Copy authorized_keys secret to the user's ssh config folder
|
# Copy authorized_keys secret to the user's ssh config folder
|
||||||
# (symlinking will not do, because sshd checks perms of the file tree above the target of the link)
|
# (symlinking will not do, because sshd checks perms of the file tree above the target of the link)
|
||||||
install -Dm 600 -o thurstylark -g thurstylark /run/secrets/tl-weechat-authorizedkeys /home/thurstylark/.ssh/authorized_keys
|
install \
|
||||||
|
-Dm 600 \
|
||||||
|
-o thurstylark \
|
||||||
|
-g thurstylark \
|
||||||
|
/run/secrets/tl-weechat-authorizedkeys \
|
||||||
|
/home/thurstylark/.ssh/authorized_keys
|
||||||
|
|
||||||
|
|
||||||
####
|
####
|
||||||
|
@ -16,6 +38,9 @@ install -Dm 600 -o thurstylark -g thurstylark /run/secrets/tl-weechat-authorized
|
||||||
# Start zerotier-one in daemon mode
|
# Start zerotier-one in daemon mode
|
||||||
zerotier-one -d
|
zerotier-one -d
|
||||||
|
|
||||||
|
# Attempt to join the specified ZeroTier networks
|
||||||
|
joinztnets /run/secrets/tl-weechat-ztnetaddrs
|
||||||
|
|
||||||
# Start sshd
|
# Start sshd
|
||||||
sshd
|
sshd
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue