Skip to content

Commit

Permalink
Assure that root is checked prior doing anything
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexandru Cheltuitor committed Dec 14, 2020
1 parent 884e9ad commit 3db683a
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 21 deletions.
4 changes: 2 additions & 2 deletions debian/changelog
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
protonvpn-cli (3.1.0-10) UNRELEASED; urgency=low
protonvpn-cli (3.1.0-11) UNRELEASED; urgency=low

* Add support for protonvpn-nm-lib v0.2.0-1
* Cache servers after connecting to vpn if previous cache failed
Expand All @@ -10,7 +10,7 @@ protonvpn-cli (3.1.0-10) UNRELEASED; urgency=low
* Bugfix: Catch KeyringError
* Bugfix: Cache prior displays connection status; incorrect cache when using dialog

-- Proton Technologies AG <[email protected]> Fri, 04 Dec 2020 17:0:22 +0000
-- Proton Technologies AG <[email protected]> Mond, 14 Dec 2020 11:25:18 +0000

protonvpn-cli (3.0.0-10) UNRELEASED; urgency=low

Expand Down
43 changes: 24 additions & 19 deletions protonvpn_cli/cli_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,29 +48,11 @@ class CLIWrapper():
+ "----------------"
+ "------------"
)
time_sleep_value = 1
reconector_manager = ReconnectorManager()
user_conf_manager = UserConfigurationManager()
ks_manager = KillSwitchManager(user_conf_manager)
connection_manager = ConnectionManager()
user_manager = UserManager()
server_manager = ServerManager(CertificateManager(), user_manager)
ipv6_lp_manager = IPv6LeakProtectionManager()
protonvpn_dialog = ProtonVPNDialog(server_manager, user_manager)
CLI_COMMAND_DICT = dict(
servername=server_manager.direct,
fastest=server_manager.fastest,
random=server_manager.random_c,
cc=server_manager.country_f,
sc=server_manager.feature_f,
p2p=server_manager.feature_f,
tor=server_manager.feature_f,
)

def __init__(self):
if "SUDO_UID" in os.environ:
print(
"\nRunning ProtonVPN as root is not indended and "
"\nRunning ProtonVPN as root is not supported and "
"is highly discouraged, as it might introduce "
"undesirable side-effects."
)
Expand All @@ -79,6 +61,29 @@ def __init__(self):
if not user_input == "y":
sys.exit(1)

self.time_sleep_value = 1
self.reconector_manager = ReconnectorManager()
self.user_conf_manager = UserConfigurationManager()
self.ks_manager = KillSwitchManager(self.user_conf_manager)
self.connection_manager = ConnectionManager()
self.user_manager = UserManager()
self.server_manager = ServerManager(
CertificateManager(), self.user_manager
)
self.ipv6_lp_manager = IPv6LeakProtectionManager()
self.protonvpn_dialog = ProtonVPNDialog(
self.server_manager, self.user_manager
)
self.CLI_COMMAND_DICT = dict(
servername=self.server_manager.direct,
fastest=self.server_manager.fastest,
random=self.server_manager.random_c,
cc=self.server_manager.country_f,
sc=self.server_manager.feature_f,
p2p=self.server_manager.feature_f,
tor=self.server_manager.feature_f,
)

def connect(self, args):
"""Proxymethod to connect to ProtonVPN."""

Expand Down

0 comments on commit 3db683a

Please sign in to comment.