aboutsummaryrefslogtreecommitdiffstats
path: root/hsrvpn
blob: a39e790640a5f250f3a6ca6f454d92efef62177f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/bin/bash

set -e

if (($# < 1)); then
    echo "Usage: $0 <username>" >&2
    exit 1
fi

username=$1
host=vpn.hsr.ch

password=$(keyring get openhsr-connect $username)
tokens=( $(keyring get hsrvpn-secrets $username) )

token=${tokens[0]}
unset -v 'tokens[0]'

echo "${tokens[@]}" | keyring set hsrvpn-secrets $username

echo "$token"

printf '%s\n' "$password" "$token" | sudo openconnect "$host" -u "$username"