Skip to content

Commit

Permalink
disable killswitch while connect/login
Browse files Browse the repository at this point in the history
  • Loading branch information
ouster committed Sep 8, 2022
1 parent f1c0d2e commit d603d17
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
3 changes: 3 additions & 0 deletions rootfs/usr/bin/nord_connect
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,19 @@
[[ -n ${PRE_CONNECT} ]] && eval ${PRE_CONNECT}

echo "Connecting..."
nordvpn set killswitch disable
current_sleep=1
until nordvpn connect ${CONNECT}; do
if [ ${current_sleep} -gt 4096 ]; then
echo "Unable to connect."
nordvpn set killswitch enable
exit 1
fi
echo "Unable to connect retrying in ${current_sleep} seconds."
sleep ${current_sleep}
current_sleep=$((current_sleep * 2))
done
nordvpn set killswitch enable

[[ -n ${POST_CONNECT} ]] && eval ${POST_CONNECT}

Expand Down
5 changes: 5 additions & 0 deletions rootfs/usr/bin/nord_login
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,24 @@ if ! iptables -L > /dev/null 2>&1; then
done
fi

nordvpn set killswitch disable

[[ -z "${PASS}" ]] && [[ -f "${PASSFILE}" ]] && PASS="$(head -n 1 "${PASSFILE}")"
nordvpn logout > /dev/null

if [[ -n ${TOKEN} ]]; then
nordvpn login --token "${TOKEN}" || {
echo "Invalid token."
nordvpn set killswitch enable
exit 1
}
else
nordvpn login --legacy --username "${USER}" --password "${PASS}" || {
echo "Invalid Username or password."
nordvpn set killswitch enable
exit 1
}
fi

nordvpn set killswitch enable
exit 0

0 comments on commit d603d17

Please sign in to comment.