From c595a85d87897459a3cc32a4bac13de62845941d Mon Sep 17 00:00:00 2001 From: Jonas Forsberg Date: Sat, 15 Aug 2020 13:36:44 +0200 Subject: [PATCH 1/3] added wireguard --- salt/pillars/packages.sls | 1 + 1 file changed, 1 insertion(+) diff --git a/salt/pillars/packages.sls b/salt/pillars/packages.sls index 65b911d..b59dbc3 100644 --- a/salt/pillars/packages.sls +++ b/salt/pillars/packages.sls @@ -15,3 +15,4 @@ packages: xdg-utils: { status: installed } nodejs10: { status: installed } pattern:devel_basis: { status: installed } + wireguard-tools: { status: installed } From a616830a7bfe647a15ea845f632d23cbb11efb79 Mon Sep 17 00:00:00 2001 From: Jonas Forsberg Date: Sat, 15 Aug 2020 14:15:37 +0200 Subject: [PATCH 2/3] added abspath for db --- bin/setupWireguard | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/setupWireguard b/bin/setupWireguard index 52d74ce..6c1da6e 100755 --- a/bin/setupWireguard +++ b/bin/setupWireguard @@ -1,5 +1,5 @@ #!/bin/bash -keepassdb="Nextcloud/passwords/Passwords.kdbx" +keepassdb="$HOME/Nextcloud/passwords/Passwords.kdbx" type wg >/dev/null 2>&1 || { printf "wireguard is not installed\n" >&2; exit 1; } type keepassxc-cli >/dev/null 2>&1 || { printf "KeepassXC is not installed\n" >&2; exit 1; } From df8685b6feb40d4c2920e99d935115a23fc6cd0f Mon Sep 17 00:00:00 2001 From: Jonas Forsberg Date: Sat, 15 Aug 2020 14:18:34 +0200 Subject: [PATCH 3/3] Generate QR Code for wireguard configs Added the functionality to generate QR codes from configurations stored in KeepassXC --- bin/genwgQR | 20 ++++++++++++++++++++ salt/pillars/hosts/bart.sls | 1 + 2 files changed, 21 insertions(+) create mode 100755 bin/genwgQR diff --git a/bin/genwgQR b/bin/genwgQR new file mode 100755 index 0000000..dd0c0ce --- /dev/null +++ b/bin/genwgQR @@ -0,0 +1,20 @@ +#!/bin/bash +keepassdb="$HOME/Nextcloud/passwords/Passwords.kdbx" + +type qrencode >/dev/null 2>&1 || { printf "qrencode is not installed\n" >&2; exit 1; } +type keepassxc-cli >/dev/null 2>&1 || { printf "KeepassXC is not installed\n" >&2; exit 1; } + +printf "Enter password for $keepassdb: " +read -s password +printf "\n" + +printf "Enter device name you want to generate the code for: " +read device + +printf "Enter the tunnel name: " +read tunnel + + +echo "$password" | keepassxc-cli show -q --attributes Notes "$keepassdb" /Wireguard/"$device"/"$tunnel" | qrencode -t ansiutf8 + +unset password diff --git a/salt/pillars/hosts/bart.sls b/salt/pillars/hosts/bart.sls index d88a437..4be7e96 100644 --- a/salt/pillars/hosts/bart.sls +++ b/salt/pillars/hosts/bart.sls @@ -1,2 +1,3 @@ packages: weechat: { status: installed } + grencode: { status: installed }