Skip to content

Commit

Permalink
Pass UCSF_VPN_LOGPATH to OpenConnect
Browse files Browse the repository at this point in the history
  • Loading branch information
HenrikBengtsson committed May 17, 2024
1 parent 8d510f6 commit 72ff1c5
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 5 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ Useful resources:
* UCSF Managing Your Passwords:
- https://it.ucsf.edu/services/managing-your-passwords
Version: 5.7.0-9032
Version: 5.7.0-9033
Copyright: Henrik Bengtsson (2016-2024)
License: GPL (>= 2.1) [https://www.gnu.org/licenses/gpl.html]
Source: https://github.com/HenrikBengtsson/ucsf-vpn
Expand Down
20 changes: 16 additions & 4 deletions bin/ucsf-vpn
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@
### * UCSF Managing Your Passwords:
### - https://it.ucsf.edu/services/managing-your-passwords
###
### Version: 5.7.0-9032
### Version: 5.7.0-9033
### Copyright: Henrik Bengtsson (2016-2024)
### License: GPL (>= 2.1) [https://www.gnu.org/licenses/gpl.html]
### Source: https://github.com/HenrikBengtsson/ucsf-vpn
Expand Down Expand Up @@ -1328,7 +1328,7 @@ function openconnect_start() {
mdebug "token: <not specified>"
fi
mdebug "opts: [n=${#opts[@]}] ${opts[*]}"
mdebug "call: sudo UCSF_VPN_VERSION=$(version) UCSF_VPN_FLAVOR=$(flavor_home) openconnect ${opts[*]} --authgroup=\"$realm\""
mdebug "call: sudo UCSF_VPN_VERSION=$(version) UCSF_VPN_FLAVOR=$(flavor_home) UCSF_VPN_LOGPATH=$(logpath) openconnect ${opts[*]} --authgroup=\"$realm\""

if [[ $token == "push" ]]; then
mnote "Open the Duo Mobile app on your smartphone or tablet to confirm ..."
Expand Down Expand Up @@ -1363,10 +1363,10 @@ function openconnect_start() {
;;
esac
# shellcheck disable=SC2086
sudo echo -e "$two_pwds" | sudo UCSF_VPN_VERSION="$(version)" UCSF_VPN_FLAVOR="$(flavor_home)" openconnect "${opts[@]}" --authgroup="$realm" 2> "$fh_stderr" 1> "$fh_stdout"
sudo echo -e "$two_pwds" | sudo UCSF_VPN_VERSION="$(version)" UCSF_VPN_FLAVOR="$(flavor_home)" UCSF_VPN_LOGPATH="$(logpath)" openconnect "${opts[@]}" --authgroup="$realm" 2> "$fh_stderr" 1> "$fh_stdout"
else
# shellcheck disable=SC2086
sudo UCSF_VPN_VERSION="$(version)" UCSF_VPN_FLAVOR="$(flavor_home)" openconnect "${opts[@]}" --authgroup="$realm" 2> "$fh_stderr" 1> "$fh_stdout"
sudo UCSF_VPN_VERSION="$(version)" UCSF_VPN_FLAVOR="$(flavor_home)" UCSF_VPN_LOGPATH="$(logpath)" openconnect "${opts[@]}" --authgroup="$realm" 2> "$fh_stderr" 1> "$fh_stdout"
fi

## Update IP-info file
Expand Down Expand Up @@ -1657,6 +1657,18 @@ function flavor_home() {
}


function logpath() {
local path

path="$(xdg_state_path)/logs"
if [ ! -d "$path" ]; then
mkdir -p "$path"
fi

echo "${path}"
}


# -------------------------------------------------------------------------
# MAIN
# -------------------------------------------------------------------------
Expand Down

0 comments on commit 72ff1c5

Please sign in to comment.