Update 3 files
- /home/.chezmoiscripts/universal/run_onchange_after_24-vpn-darwin.tmpl - /home/.chezmoiscripts/universal/run_onchange_after_24-vpn-linux.tmpl - /software.yml
This commit is contained in:
parent
ef7a632df3
commit
455d5bcdd2
3 changed files with 23 additions and 7 deletions
|
@ -4,4 +4,7 @@
|
|||
{{ includeTemplate "universal/profile" }}
|
||||
{{ includeTemplate "universal/logg" }}
|
||||
|
||||
# wireguard_conf_dir: /etc/wireguard
|
||||
# system_connections_path: /Library/Preferences/com.apple.networkextension.plist
|
||||
|
||||
{{ end -}}
|
|
@ -1,16 +1,29 @@
|
|||
{{- if eq .host.distro.family "linux" -}}
|
||||
{{- if and (eq .host.distro.family "linux") (stat (joinPath .host.home ".config" "age" "chezmoi.txt")) -}}
|
||||
#!/usr/bin/env bash
|
||||
|
||||
{{ includeTemplate "universal/profile" }}
|
||||
{{ includeTemplate "universal/logg" }}
|
||||
|
||||
if command -v nmcli > /dev/null; then
|
||||
nmcli connection import type openvpn file '{{ vpn_connection.file }}'
|
||||
nmcli connection modify '{{ ovpn_name }}' +vpn.data username={{ vpn_connection.username }}
|
||||
nmcli connection modify '{{ ovpn_name }}' vpn.secrets 'password={{ vpn_connection.password }}'
|
||||
nmcli connection modify '{{ ovpn_name }}' +vpn.data password-flags=0
|
||||
### OpenVPN profiles
|
||||
find "${XDG_CONFIG_HOME:-$HOME/.config}/vpn" -type f -name "*.ovpn" | while read OVPN_FILE; do
|
||||
nmcli connection import type openvpn file '{{ vpn_connection.file }}'
|
||||
nmcli connection modify '{{ ovpn_name }}' +vpn.data username={{ vpn_connection.username }}
|
||||
nmcli connection modify '{{ ovpn_name }}' vpn.secrets 'password={{ vpn_connection.password }}'
|
||||
nmcli connection modify '{{ ovpn_name }}' +vpn.data password-flags=0
|
||||
done
|
||||
|
||||
### WireGuard profiles
|
||||
if [ -d /etc/NetworkManager/system-connections ]; then
|
||||
find "${XDG_CONFIG_HOME:-$HOME/.config}/vpn" -type f -name "*.nmconnection" | while read WG_FILE; do
|
||||
logg info "Adding $WG_FILE to /etc/NetworkManager/system-connections
|
||||
chezmoi decrypt "$WG_FILE" > /etc/NetworkManager/system-connections
|
||||
done
|
||||
else
|
||||
logg warn '/etc/NetworkManager/system-connections is not a directory!'
|
||||
fi
|
||||
else
|
||||
logg info '`nmcli` is unavailable'
|
||||
logg warn '`nmcli` is unavailable'
|
||||
fi
|
||||
|
||||
{{ end -}}
|
|
@ -8293,7 +8293,7 @@ softwarePackages:
|
|||
_name: WireGuard Client
|
||||
_when:mas: '! test -d /Applications/WireGuard.app'
|
||||
choco: wireguard
|
||||
mas: TODO MAS (not available as Homebrew cask)
|
||||
mas: 1451685025
|
||||
scoop: wireguard-np
|
||||
wireguard-tools:
|
||||
_bin: wg
|
||||
|
|
Loading…
Reference in a new issue