Mercurial > hgrepos > FreeBSD > ports > sysutils > local-bsdtools
annotate files/fwireguard.in @ 461:f8858fc8c7f3
Docs: wording
| author | Franz Glasner <fzglas.hg@dom66.de> |
|---|---|
| date | Tue, 11 Jun 2024 09:20:21 +0200 |
| parents | 4bd501f9e955 |
| children | e2555d5fc61f |
| 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) |
|
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
|
15 # |
| 461 | 16 # 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
|
17 # |
|
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 |
|
09c782570d89
Add a rc.d script "fwireguard" to help with automatic setup of Wireguard interfaces
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
19 . /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
|
20 |
|
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 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
|
22 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
|
23 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
|
24 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
|
25 |
|
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 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
|
27 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
|
28 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
|
29 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
|
30 |
|
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 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
|
32 |
|
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 : ${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
|
34 : ${fwireguard_wait="2s"} |
|
460
4bd501f9e955
Allow to configure the configuration directory for fwireguard
Franz Glasner <fzglas.hg@dom66.de>
parents:
459
diff
changeset
|
35 : ${fwireguard_configdir:="%%PREFIX%%/etc/fwireguard"} |
|
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
|
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 |
|
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 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
|
39 { |
|
460
4bd501f9e955
Allow to configure the configuration directory for fwireguard
Franz Glasner <fzglas.hg@dom66.de>
parents:
459
diff
changeset
|
40 local _f _if |
|
4bd501f9e955
Allow to configure the configuration directory for fwireguard
Franz Glasner <fzglas.hg@dom66.de>
parents:
459
diff
changeset
|
41 |
|
4bd501f9e955
Allow to configure the configuration directory for fwireguard
Franz Glasner <fzglas.hg@dom66.de>
parents:
459
diff
changeset
|
42 if [ ! -d "${fwireguard_configdir}" ]; then |
|
4bd501f9e955
Allow to configure the configuration directory for fwireguard
Franz Glasner <fzglas.hg@dom66.de>
parents:
459
diff
changeset
|
43 mkdir "${fwireguard_configdir}" |
|
4bd501f9e955
Allow to configure the configuration directory for fwireguard
Franz Glasner <fzglas.hg@dom66.de>
parents:
459
diff
changeset
|
44 fi |
|
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
|
45 for _if in `/sbin/ifconfig -g wg`; do |
|
09c782570d89
Add a rc.d script "fwireguard" to help with automatic setup of Wireguard interfaces
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
46 |
|
460
4bd501f9e955
Allow to configure the configuration directory for fwireguard
Franz Glasner <fzglas.hg@dom66.de>
parents:
459
diff
changeset
|
47 _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
|
48 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
|
49 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
|
50 (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
|
51 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
|
52 |
|
460
4bd501f9e955
Allow to configure the configuration directory for fwireguard
Franz Glasner <fzglas.hg@dom66.de>
parents:
459
diff
changeset
|
53 _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
|
54 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
|
55 echo "Generating public key for ${_if} in ${_f}" |
|
460
4bd501f9e955
Allow to configure the configuration directory for fwireguard
Franz Glasner <fzglas.hg@dom66.de>
parents:
459
diff
changeset
|
56 /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
|
57 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
|
58 |
|
460
4bd501f9e955
Allow to configure the configuration directory for fwireguard
Franz Glasner <fzglas.hg@dom66.de>
parents:
459
diff
changeset
|
59 _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
|
60 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
|
61 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
|
62 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
|
63 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
|
64 /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
|
65 /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
|
66 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
|
67 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
|
68 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
|
69 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
|
70 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
|
71 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
|
72 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
|
73 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
|
74 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
|
75 |
|
09c782570d89
Add a rc.d script "fwireguard" to help with automatic setup of Wireguard interfaces
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
76 /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
|
77 /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
|
78 /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
|
79 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
|
80 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
|
81 /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
|
82 fi |
|
460
4bd501f9e955
Allow to configure the configuration directory for fwireguard
Franz Glasner <fzglas.hg@dom66.de>
parents:
459
diff
changeset
|
83 "${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
|
84 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
|
85 # /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
|
86 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
|
87 } |
|
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 |
|
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 |
|
09c782570d89
Add a rc.d script "fwireguard" to help with automatic setup of Wireguard interfaces
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
90 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
|
91 { |
|
460
4bd501f9e955
Allow to configure the configuration directory for fwireguard
Franz Glasner <fzglas.hg@dom66.de>
parents:
459
diff
changeset
|
92 local _if |
|
4bd501f9e955
Allow to configure the configuration directory for fwireguard
Franz Glasner <fzglas.hg@dom66.de>
parents:
459
diff
changeset
|
93 |
|
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
|
94 for _if in `/sbin/ifconfig -g wg`; do |
|
460
4bd501f9e955
Allow to configure the configuration directory for fwireguard
Franz Glasner <fzglas.hg@dom66.de>
parents:
459
diff
changeset
|
95 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
|
96 "${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
|
97 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
|
98 /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
|
99 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
|
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 |
|
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 |
|
09c782570d89
Add a rc.d script "fwireguard" to help with automatic setup of Wireguard interfaces
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
103 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
|
104 { |
|
09c782570d89
Add a rc.d script "fwireguard" to help with automatic setup of Wireguard interfaces
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
105 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
|
106 } |
|
09c782570d89
Add a rc.d script "fwireguard" to help with automatic setup of Wireguard interfaces
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
107 |
|
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 |
|
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 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
|
110 { |
|
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 local _if |
|
460
4bd501f9e955
Allow to configure the configuration directory for fwireguard
Franz Glasner <fzglas.hg@dom66.de>
parents:
459
diff
changeset
|
112 |
|
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
|
113 for _if in `/sbin/ifconfig -g wg`; do |
|
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 /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
|
115 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
|
116 } |
|
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 run_rc_command "$1" |
