metvpn
This commit is contained in:
parent
b98bfb0b2d
commit
6667fdf0d5
1 changed files with 19 additions and 0 deletions
19
bin/executable_metvpn.tmpl
Normal file
19
bin/executable_metvpn.tmpl
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
#!{{ .chezmoi.pathSeparator }}bin{{ .chezmoi.pathSeparator }}zsh
|
||||||
|
|
||||||
|
if (( UID != 0 ))
|
||||||
|
then
|
||||||
|
exec sudo "$(realpath "$0")" "$@"
|
||||||
|
fi
|
||||||
|
|
||||||
|
openvpn --config <(sudo -u {{ .chezmoi.user }} {{ .chezmoi.config.gopass.command }} show metrans{{ .chezmoi.pathSeparator }}vpn tcp.ovpn) --askpass <(sudo -u {{ .chezmoi.user }} {{ .chezmoi.config.gopass.command }} show metrans{{ .chezmoi.pathSeparator }}vpn) &
|
||||||
|
ovpn=$?
|
||||||
|
set -v
|
||||||
|
until ip l show dev metrans &>{{ .chezmoi.pathSeparator }}dev{{ .chezmoi.pathSeparator }}null
|
||||||
|
do
|
||||||
|
sleep 0.5
|
||||||
|
done
|
||||||
|
resolvectl dns metrans 192.168.1.61 192.168.1.62
|
||||||
|
resolvectl domain metrans '~metrans.local' '~corp.metrans.cz'
|
||||||
|
|
||||||
|
wait
|
||||||
|
kill "$ovpn"
|
Loading…
Add table
Reference in a new issue