annotate files/fwireguard.in @ 782:11f3101c1980

farray.sh: Implemented plain Insertionsort. Using the optimized algorithm already used in Shell sort, just without manx gaps and using only the fixed last step 1.
author Franz Glasner <fzglas.hg@dom66.de>
date Sat, 26 Oct 2024 18:35:37 +0200
parents 24129dd789f0
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
458
09c782570d89 Add a rc.d script "fwireguard" to help with automatic setup of Wireguard interfaces
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
1 #!/bin/sh
09c782570d89 Add a rc.d script "fwireguard" to help with automatic setup of Wireguard interfaces
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
2
09c782570d89 Add a rc.d script "fwireguard" to help with automatic setup of Wireguard interfaces
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
3 # PROVIDE: fwireguard
09c782570d89 Add a rc.d script "fwireguard" to help with automatic setup of Wireguard interfaces
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
4 # REQUIRE: NETWORKING
09c782570d89 Add a rc.d script "fwireguard" to help with automatic setup of Wireguard interfaces
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
5 # KEYWORD: shutdown
09c782570d89 Add a rc.d script "fwireguard" to help with automatic setup of Wireguard interfaces
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
6
09c782570d89 Add a rc.d script "fwireguard" to help with automatic setup of Wireguard interfaces
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
7 # @(#)%%SIMPLEVERSIONTAG%%
09c782570d89 Add a rc.d script "fwireguard" to help with automatic setup of Wireguard interfaces
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
8
09c782570d89 Add a rc.d script "fwireguard" to help with automatic setup of Wireguard interfaces
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
9 #
09c782570d89 Add a rc.d script "fwireguard" to help with automatic setup of Wireguard interfaces
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
10 # fwireguard_enable (bool): Set to "YES" to enable wireguard (default: "NO")
09c782570d89 Add a rc.d script "fwireguard" to help with automatic setup of Wireguard interfaces
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
11 # fwireguard_wait (str): wait (sleep) this time before calling post-start
09c782570d89 Add a rc.d script "fwireguard" to help with automatic setup of Wireguard interfaces
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
12 # when configuring an interface (default: 2s)
460
4bd501f9e955 Allow to configure the configuration directory for fwireguard
Franz Glasner <fzglas.hg@dom66.de>
parents: 459
diff changeset
13 # fwireguard_configdir (str): Where fwireguard finds its configuration
4bd501f9e955 Allow to configure the configuration directory for fwireguard
Franz Glasner <fzglas.hg@dom66.de>
parents: 459
diff changeset
14 # (default: %%PREFIX%%/etc/fwireguard)
472
692c6357ce39 Add missing comment for new variable fwireguard_interfaces
Franz Glasner <fzglas.hg@dom66.de>
parents: 471
diff changeset
15 # fwireguard_interfaces (str): Set to "AUTO" (default) to automatically handle
692c6357ce39 Add missing comment for new variable fwireguard_interfaces
Franz Glasner <fzglas.hg@dom66.de>
parents: 471
diff changeset
16 # all wireguard interfaces or provide a list of
692c6357ce39 Add missing comment for new variable fwireguard_interfaces
Franz Glasner <fzglas.hg@dom66.de>
parents: 471
diff changeset
17 # wireguard interfaces to be handled
458
09c782570d89 Add a rc.d script "fwireguard" to help with automatic setup of Wireguard interfaces
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
18 #
461
f8858fc8c7f3 Docs: wording
Franz Glasner <fzglas.hg@dom66.de>
parents: 460
diff changeset
19 # NOTE: All wireguard interfaces must be mentioned fist in "cloned_interfaces".
459
345f1270e41e Note that all wireguard interfaces must be mentioned first in "cloned_interfaces"
Franz Glasner <fzglas.hg@dom66.de>
parents: 458
diff changeset
20 #
458
09c782570d89 Add a rc.d script "fwireguard" to help with automatic setup of Wireguard interfaces
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
21
665
24129dd789f0 Shellcheck for rc-scripts
Franz Glasner <fzglas.hg@dom66.de>
parents: 473
diff changeset
22 # shellcheck disable=SC2034,SC2129,SC2223,SC3037
24129dd789f0 Shellcheck for rc-scripts
Franz Glasner <fzglas.hg@dom66.de>
parents: 473
diff changeset
23
24129dd789f0 Shellcheck for rc-scripts
Franz Glasner <fzglas.hg@dom66.de>
parents: 473
diff changeset
24 # shellcheck disable=SC1094 # parsing fails: rc.subr contains unknown features
458
09c782570d89 Add a rc.d script "fwireguard" to help with automatic setup of Wireguard interfaces
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
25 . /etc/rc.subr
09c782570d89 Add a rc.d script "fwireguard" to help with automatic setup of Wireguard interfaces
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
26
09c782570d89 Add a rc.d script "fwireguard" to help with automatic setup of Wireguard interfaces
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
27 name=fwireguard
09c782570d89 Add a rc.d script "fwireguard" to help with automatic setup of Wireguard interfaces
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
28 desc="Wireguard startup helper"
09c782570d89 Add a rc.d script "fwireguard" to help with automatic setup of Wireguard interfaces
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
29 rcvar=fwireguard_enable
09c782570d89 Add a rc.d script "fwireguard" to help with automatic setup of Wireguard interfaces
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
30 extra_commands="reload status"
09c782570d89 Add a rc.d script "fwireguard" to help with automatic setup of Wireguard interfaces
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
31
09c782570d89 Add a rc.d script "fwireguard" to help with automatic setup of Wireguard interfaces
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
32 start_cmd="${name}_start"
09c782570d89 Add a rc.d script "fwireguard" to help with automatic setup of Wireguard interfaces
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
33 stop_cmd="${name}_stop"
09c782570d89 Add a rc.d script "fwireguard" to help with automatic setup of Wireguard interfaces
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
34 reload_cmd="${name}_reload"
09c782570d89 Add a rc.d script "fwireguard" to help with automatic setup of Wireguard interfaces
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
35 status_cmd="${name}_status"
09c782570d89 Add a rc.d script "fwireguard" to help with automatic setup of Wireguard interfaces
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
36
09c782570d89 Add a rc.d script "fwireguard" to help with automatic setup of Wireguard interfaces
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
37 load_rc_config $name
09c782570d89 Add a rc.d script "fwireguard" to help with automatic setup of Wireguard interfaces
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
38
09c782570d89 Add a rc.d script "fwireguard" to help with automatic setup of Wireguard interfaces
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
39 : ${fwireguard_enable:="NO"}
09c782570d89 Add a rc.d script "fwireguard" to help with automatic setup of Wireguard interfaces
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
40 : ${fwireguard_wait="2s"}
473
c3125616d0ec Make the configuration directory of fwireguard configurable
Franz Glasner <fzglas.hg@dom66.de>
parents: 472
diff changeset
41 : ${fwireguard_configdir:="%%FWIREGUARD_ETCDIR%%"}
471
e2555d5fc61f Implement a fwireguard RC variable to manually determine the names of wireguard interfaces to configure to.
Franz Glasner <fzglas.hg@dom66.de>
parents: 461
diff changeset
42 : ${fwireguard_interfaces="AUTO"}
e2555d5fc61f Implement a fwireguard RC variable to manually determine the names of wireguard interfaces to configure to.
Franz Glasner <fzglas.hg@dom66.de>
parents: 461
diff changeset
43
e2555d5fc61f Implement a fwireguard RC variable to manually determine the names of wireguard interfaces to configure to.
Franz Glasner <fzglas.hg@dom66.de>
parents: 461
diff changeset
44
e2555d5fc61f Implement a fwireguard RC variable to manually determine the names of wireguard interfaces to configure to.
Franz Glasner <fzglas.hg@dom66.de>
parents: 461
diff changeset
45 # Automatically expand to the interface names if needed
e2555d5fc61f Implement a fwireguard RC variable to manually determine the names of wireguard interfaces to configure to.
Franz Glasner <fzglas.hg@dom66.de>
parents: 461
diff changeset
46 [ "${fwireguard_interfaces}" = "AUTO" ] && fwireguard_interfaces="$(/sbin/ifconfig -g wg)"
458
09c782570d89 Add a rc.d script "fwireguard" to help with automatic setup of Wireguard interfaces
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
47
09c782570d89 Add a rc.d script "fwireguard" to help with automatic setup of Wireguard interfaces
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
48
09c782570d89 Add a rc.d script "fwireguard" to help with automatic setup of Wireguard interfaces
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
49 fwireguard_start()
09c782570d89 Add a rc.d script "fwireguard" to help with automatic setup of Wireguard interfaces
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
50 {
460
4bd501f9e955 Allow to configure the configuration directory for fwireguard
Franz Glasner <fzglas.hg@dom66.de>
parents: 459
diff changeset
51 local _f _if
4bd501f9e955 Allow to configure the configuration directory for fwireguard
Franz Glasner <fzglas.hg@dom66.de>
parents: 459
diff changeset
52
4bd501f9e955 Allow to configure the configuration directory for fwireguard
Franz Glasner <fzglas.hg@dom66.de>
parents: 459
diff changeset
53 if [ ! -d "${fwireguard_configdir}" ]; then
4bd501f9e955 Allow to configure the configuration directory for fwireguard
Franz Glasner <fzglas.hg@dom66.de>
parents: 459
diff changeset
54 mkdir "${fwireguard_configdir}"
4bd501f9e955 Allow to configure the configuration directory for fwireguard
Franz Glasner <fzglas.hg@dom66.de>
parents: 459
diff changeset
55 fi
471
e2555d5fc61f Implement a fwireguard RC variable to manually determine the names of wireguard interfaces to configure to.
Franz Glasner <fzglas.hg@dom66.de>
parents: 461
diff changeset
56 for _if in ${fwireguard_interfaces}; do
458
09c782570d89 Add a rc.d script "fwireguard" to help with automatic setup of Wireguard interfaces
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
57
460
4bd501f9e955 Allow to configure the configuration directory for fwireguard
Franz Glasner <fzglas.hg@dom66.de>
parents: 459
diff changeset
58 _f="${fwireguard_configdir}/${_if}.key"
458
09c782570d89 Add a rc.d script "fwireguard" to help with automatic setup of Wireguard interfaces
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
59 if [ ! -f "${_f}" ]; then
09c782570d89 Add a rc.d script "fwireguard" to help with automatic setup of Wireguard interfaces
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
60 echo "Generating secret key for ${_if} in ${_f}"
09c782570d89 Add a rc.d script "fwireguard" to help with automatic setup of Wireguard interfaces
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
61 (umask 0077; /usr/bin/wg genkey > "${_f}")
09c782570d89 Add a rc.d script "fwireguard" to help with automatic setup of Wireguard interfaces
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
62 fi
09c782570d89 Add a rc.d script "fwireguard" to help with automatic setup of Wireguard interfaces
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
63
460
4bd501f9e955 Allow to configure the configuration directory for fwireguard
Franz Glasner <fzglas.hg@dom66.de>
parents: 459
diff changeset
64 _f="${fwireguard_configdir}/${_if}.pub"
458
09c782570d89 Add a rc.d script "fwireguard" to help with automatic setup of Wireguard interfaces
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
65 if [ ! -f "${_f}" ]; then
09c782570d89 Add a rc.d script "fwireguard" to help with automatic setup of Wireguard interfaces
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
66 echo "Generating public key for ${_if} in ${_f}"
665
24129dd789f0 Shellcheck for rc-scripts
Franz Glasner <fzglas.hg@dom66.de>
parents: 473
diff changeset
67 /usr/bin/wg pubkey < "${fwireguard_configdir}/${_if}.key" > "${_f}"
458
09c782570d89 Add a rc.d script "fwireguard" to help with automatic setup of Wireguard interfaces
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
68 fi
09c782570d89 Add a rc.d script "fwireguard" to help with automatic setup of Wireguard interfaces
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
69
460
4bd501f9e955 Allow to configure the configuration directory for fwireguard
Franz Glasner <fzglas.hg@dom66.de>
parents: 459
diff changeset
70 _f="${fwireguard_configdir}/${_if}.conf"
458
09c782570d89 Add a rc.d script "fwireguard" to help with automatic setup of Wireguard interfaces
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
71 if [ ! -f "${_f}" ]; then
09c782570d89 Add a rc.d script "fwireguard" to help with automatic setup of Wireguard interfaces
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
72 echo "Generating minimal config for ${_if} in ${_f}"
09c782570d89 Add a rc.d script "fwireguard" to help with automatic setup of Wireguard interfaces
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
73 umask 0077
09c782570d89 Add a rc.d script "fwireguard" to help with automatic setup of Wireguard interfaces
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
74 echo "[Interface]" > "${_f}"
09c782570d89 Add a rc.d script "fwireguard" to help with automatic setup of Wireguard interfaces
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
75 /usr/bin/printf 'PrivateKey\t\t= ' >> "${_f}"
460
4bd501f9e955 Allow to configure the configuration directory for fwireguard
Franz Glasner <fzglas.hg@dom66.de>
parents: 459
diff changeset
76 /bin/cat "${fwireguard_configdir}/${_if}.key" >> "${_f}"
458
09c782570d89 Add a rc.d script "fwireguard" to help with automatic setup of Wireguard interfaces
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
77 echo -e "#ListenPort\t\t= 51820" >> "${_f}"
09c782570d89 Add a rc.d script "fwireguard" to help with automatic setup of Wireguard interfaces
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
78 echo -e "#FwMark\t\t\t= 0x12345678\n" >> "${_f}"
09c782570d89 Add a rc.d script "fwireguard" to help with automatic setup of Wireguard interfaces
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
79 echo "#[Peer]" >> "${_f}"
09c782570d89 Add a rc.d script "fwireguard" to help with automatic setup of Wireguard interfaces
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
80 echo -e "#PublicKey\t\t= BlAbLABlA/EtCeTcEtc=" >> "${_f}"
09c782570d89 Add a rc.d script "fwireguard" to help with automatic setup of Wireguard interfaces
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
81 echo -e "#AllowedIPs\t\t= 10.X.X.1/32, 10.X.X.2/32" >> "${_f}"
09c782570d89 Add a rc.d script "fwireguard" to help with automatic setup of Wireguard interfaces
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
82 echo -e "#PresharedKey\t\t= BlAbLABlA/EtCeTcEtc=" >> "${_f}"
09c782570d89 Add a rc.d script "fwireguard" to help with automatic setup of Wireguard interfaces
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
83 echo -e "#Endpoint\t\t= [2001:db8::1]:51820" >> "${_f}"
09c782570d89 Add a rc.d script "fwireguard" to help with automatic setup of Wireguard interfaces
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
84 echo -e "#PersistentKeepalive\t= 30" >> "${_f}"
09c782570d89 Add a rc.d script "fwireguard" to help with automatic setup of Wireguard interfaces
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
85 fi
09c782570d89 Add a rc.d script "fwireguard" to help with automatic setup of Wireguard interfaces
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
86
09c782570d89 Add a rc.d script "fwireguard" to help with automatic setup of Wireguard interfaces
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
87 /sbin/ifconfig "${_if}" destroy
09c782570d89 Add a rc.d script "fwireguard" to help with automatic setup of Wireguard interfaces
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
88 /sbin/ifconfig "${_if}" create # will take ifconfig_wgX="inet values" from /etc/rc.conf
09c782570d89 Add a rc.d script "fwireguard" to help with automatic setup of Wireguard interfaces
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
89 /usr/bin/wg setconf "${_if}" "${_f}"
460
4bd501f9e955 Allow to configure the configuration directory for fwireguard
Franz Glasner <fzglas.hg@dom66.de>
parents: 459
diff changeset
90 if [ -x "${fwireguard_configdir}/${_if}.post-start" ]; then
458
09c782570d89 Add a rc.d script "fwireguard" to help with automatic setup of Wireguard interfaces
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
91 if [ -n "${fwireguard_wait}" ]; then
09c782570d89 Add a rc.d script "fwireguard" to help with automatic setup of Wireguard interfaces
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
92 /bin/sleep "${fwireguard_wait}"
09c782570d89 Add a rc.d script "fwireguard" to help with automatic setup of Wireguard interfaces
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
93 fi
460
4bd501f9e955 Allow to configure the configuration directory for fwireguard
Franz Glasner <fzglas.hg@dom66.de>
parents: 459
diff changeset
94 "${fwireguard_configdir}/${_if}.post-start"
458
09c782570d89 Add a rc.d script "fwireguard" to help with automatic setup of Wireguard interfaces
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
95 fi
09c782570d89 Add a rc.d script "fwireguard" to help with automatic setup of Wireguard interfaces
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
96 # /usr/bin/wg syncconf ${_if} ${_f}
09c782570d89 Add a rc.d script "fwireguard" to help with automatic setup of Wireguard interfaces
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
97 done
09c782570d89 Add a rc.d script "fwireguard" to help with automatic setup of Wireguard interfaces
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
98 }
09c782570d89 Add a rc.d script "fwireguard" to help with automatic setup of Wireguard interfaces
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
99
09c782570d89 Add a rc.d script "fwireguard" to help with automatic setup of Wireguard interfaces
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
100
09c782570d89 Add a rc.d script "fwireguard" to help with automatic setup of Wireguard interfaces
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
101 fwireguard_stop()
09c782570d89 Add a rc.d script "fwireguard" to help with automatic setup of Wireguard interfaces
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
102 {
460
4bd501f9e955 Allow to configure the configuration directory for fwireguard
Franz Glasner <fzglas.hg@dom66.de>
parents: 459
diff changeset
103 local _if
4bd501f9e955 Allow to configure the configuration directory for fwireguard
Franz Glasner <fzglas.hg@dom66.de>
parents: 459
diff changeset
104
471
e2555d5fc61f Implement a fwireguard RC variable to manually determine the names of wireguard interfaces to configure to.
Franz Glasner <fzglas.hg@dom66.de>
parents: 461
diff changeset
105 for _if in ${fwireguard_interfaces}; do
460
4bd501f9e955 Allow to configure the configuration directory for fwireguard
Franz Glasner <fzglas.hg@dom66.de>
parents: 459
diff changeset
106 if [ -x "${fwireguard_configdir}/${_if}.pre-stop" ]; then
4bd501f9e955 Allow to configure the configuration directory for fwireguard
Franz Glasner <fzglas.hg@dom66.de>
parents: 459
diff changeset
107 "${fwireguard_configdir}/${_if}.pre-stop"
458
09c782570d89 Add a rc.d script "fwireguard" to help with automatic setup of Wireguard interfaces
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
108 fi
09c782570d89 Add a rc.d script "fwireguard" to help with automatic setup of Wireguard interfaces
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
109 /sbin/ifconfig "${_if}" down
09c782570d89 Add a rc.d script "fwireguard" to help with automatic setup of Wireguard interfaces
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
110 done
09c782570d89 Add a rc.d script "fwireguard" to help with automatic setup of Wireguard interfaces
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
111 }
09c782570d89 Add a rc.d script "fwireguard" to help with automatic setup of Wireguard interfaces
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
112
09c782570d89 Add a rc.d script "fwireguard" to help with automatic setup of Wireguard interfaces
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
113
09c782570d89 Add a rc.d script "fwireguard" to help with automatic setup of Wireguard interfaces
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
114 fwireguard_reload()
09c782570d89 Add a rc.d script "fwireguard" to help with automatic setup of Wireguard interfaces
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
115 {
09c782570d89 Add a rc.d script "fwireguard" to help with automatic setup of Wireguard interfaces
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
116 fwireguard_start
09c782570d89 Add a rc.d script "fwireguard" to help with automatic setup of Wireguard interfaces
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
117 }
09c782570d89 Add a rc.d script "fwireguard" to help with automatic setup of Wireguard interfaces
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
118
09c782570d89 Add a rc.d script "fwireguard" to help with automatic setup of Wireguard interfaces
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
119
09c782570d89 Add a rc.d script "fwireguard" to help with automatic setup of Wireguard interfaces
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
120 fwireguard_status()
09c782570d89 Add a rc.d script "fwireguard" to help with automatic setup of Wireguard interfaces
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
121 {
09c782570d89 Add a rc.d script "fwireguard" to help with automatic setup of Wireguard interfaces
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
122 local _if
460
4bd501f9e955 Allow to configure the configuration directory for fwireguard
Franz Glasner <fzglas.hg@dom66.de>
parents: 459
diff changeset
123
471
e2555d5fc61f Implement a fwireguard RC variable to manually determine the names of wireguard interfaces to configure to.
Franz Glasner <fzglas.hg@dom66.de>
parents: 461
diff changeset
124 for _if in ${fwireguard_interfaces}; do
458
09c782570d89 Add a rc.d script "fwireguard" to help with automatic setup of Wireguard interfaces
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
125 /usr/bin/wg show "${_if}"
09c782570d89 Add a rc.d script "fwireguard" to help with automatic setup of Wireguard interfaces
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
126 done
09c782570d89 Add a rc.d script "fwireguard" to help with automatic setup of Wireguard interfaces
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
127 }
09c782570d89 Add a rc.d script "fwireguard" to help with automatic setup of Wireguard interfaces
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
128
09c782570d89 Add a rc.d script "fwireguard" to help with automatic setup of Wireguard interfaces
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
129
09c782570d89 Add a rc.d script "fwireguard" to help with automatic setup of Wireguard interfaces
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
130 run_rc_command "$1"