Skip to content
This repository has been archived by the owner on Feb 4, 2020. It is now read-only.

Commit

Permalink
Changes on profile options. Added option to decrease OpenVPN privileges
Browse files Browse the repository at this point in the history
  • Loading branch information
mazen160 committed Nov 5, 2018
1 parent 7272ca8 commit 6b0194b
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions protonvpn-cli.sh
Original file line number Diff line number Diff line change
Expand Up @@ -205,9 +205,14 @@ function init_cli() {
chmod 0400 "$(get_protonvpn_cli_home)/.custom_dns"
fi

read -p "[.] [Security] Decrease OpenVPN privileges? [Y/n]: " "decrease_openvpn_privileges"
if [[ "$decrease_openvpn_privileges" == "y" || "$decrease_openvpn_privileges" == "Y" || "$decrease_openvpn_privileges" == "" ]]; then
echo "$decrease_openvpn_privileges" > "$(get_protonvpn_cli_home)/.decrease_openvpn_privileges"
fi

read -p "[.] Enable Killswitch? [Y/n]: " "enable_killswitch"
if [[ "$enable_killswitch" == "n" || "$enable_killswitch" == "N" ]]; then
echo > "$(get_protonvpn_cli_home)/.disable_killswitch"
if [[ "$enable_killswitch" == "y" || "$enable_killswitch" == "Y" || "$enable_killswitch" == "" ]]; then
echo > "$(get_protonvpn_cli_home)/.enable_killswitch"
fi

chown -R "$USER:$(id -gn $USER)" "$(get_protonvpn_cli_home)/"
Expand Down Expand Up @@ -543,9 +548,14 @@ function openvpn_connect() {
--auth-retry nointeract
--verb 4
--log "$connection_logs"
--user nobody
--group "$(id -gn nobody)"
)

if [[ -f "$(get_protonvpn_cli_home)/.decrease_openvpn_privileges" ]]; then
OPENVPN_OPTS+=(--user nobody
--group "$(id -gn nobody)"
)
fi

if [[ $PROTONVPN_CLI_DAEMON == true ]]; then
openvpn --daemon "${OPENVPN_OPTS[@]}"
trap 'openvpn_disconnect "" dont_exit' INT TERM
Expand Down Expand Up @@ -711,7 +721,7 @@ function get_openvpn_config_info() {
}

function killswitch() {
if [[ -f "$(get_protonvpn_cli_home)/.disable_killswitch" ]]; then
if [[ ! -f "$(get_protonvpn_cli_home)/.enable_killswitch" ]]; then
return
fi

Expand Down

0 comments on commit 6b0194b

Please sign in to comment.