home

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

commit 3a65aa249616b8deb812904ac1d318c99e5bac10
parent 9d7c69faeca870e3acf512230280e0a17d1517e2
Author: Vincent Demeester <vincent@sbr.pm>
Date:   Thu,  4 Jul 2019 13:44:29 +0200

naruhodo: add redhat-vpn script

Signed-off-by: Vincent Demeester <vincent@sbr.pm>

Diffstat:
Aassets/redhat-vpn.desktop | 8++++++++
Mmachines/naruhodo.nix | 1+
Apkgs/scripts/bin/redhat-vpn | 17+++++++++++++++++
3 files changed, 26 insertions(+), 0 deletions(-)

diff --git a/assets/redhat-vpn.desktop b/assets/redhat-vpn.desktop @@ -0,0 +1,7 @@ +[Desktop Entry] +Name=Red Hat VPN +Exec=gnome-terminal -- redhat-vpn +Type=Application +Terminal=true +Categories=System; +Icon=seahorse;+ \ No newline at end of file diff --git a/machines/naruhodo.nix b/machines/naruhodo.nix @@ -24,6 +24,7 @@ daemonService = true; capture = true; }; + home.file.".local/share/applications/redhat-vpn.desktop".source = ../assets/redhat-vpn.desktop; # FIXME(vdemeester) move this to the bootstrap shell # xdg.configFile."user-dirs.dirs".source = ../modules/profiles/assets/xorg/user-dirs.dirs; } diff --git a/pkgs/scripts/bin/redhat-vpn b/pkgs/scripts/bin/redhat-vpn @@ -0,0 +1,17 @@ +#!/usr/bin/env bash +# Connect to RedHat VPN +# This will ask for which VPN to connect (using available tools) and +# do some magic +set -e +export BEMENU_BACKEND=curses +connection=$(nmcli connection show | grep vpn | nix run nixpkgs.bemenu -c bemenu | awk '{print $3}') +key=$(authkey) + +passfile=$(mktemp) + +echo -n "vpn.secrets.password:" > $passfile +gpg --decrypt $HOME/desktop/documents/Red\ Hat/naruhodo.pass.gpg 2>/dev/null >>$passfile +echo -n "${key}" >> $passfile + +nmcli connection up ${connection} passwd-file $passfile +rm $passfile