Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Option to not store password #15

Open
dagrha opened this issue Jul 11, 2017 · 6 comments
Open

Option to not store password #15

dagrha opened this issue Jul 11, 2017 · 6 comments
Assignees

Comments

@dagrha
Copy link
Owner

dagrha commented Jul 11, 2017

Right now the password to connect to the PIA VPN is stored in the configuration files. Even though the file is pretty well protected since it is only readable by root, this is not ideal in terms of security. At the very least I'd like to add the option to not store the password, which would require entering your password every time a VPN connection is initiated.

Ideally we'd use Keyring or Wallet to handle passwords, but since this script aims to be cross-platform with minimal dependencies, that approach would be tricky.

@dagrha dagrha self-assigned this Jul 11, 2017
@nextbeat82
Copy link

Is it possible to use this option:

auth-users-pass .secrets

Then create a text file in the same directory called .secrets and in it place username and password on the first and second lines respectively. Protect this information from other users on your system:

chmod 600 .secrets

Ukd posted this information in https://www.privateinternetaccess.com/forum/discussion/20798/command-line-start-at-boot-linux-vpn

@dagrha
Copy link
Owner Author

dagrha commented Jul 22, 2017

Thanks for the comment, nextbeat82.

There are two issues here. First is that those instructions are for openvpn configuation files, whereas pypia configures NetworkManager configuration files. I am not sure if NM supports storing auth details in a separate file-- I will have to look into it.

The second issue though is whether this is any more secure. It's still a plaintext file sitting on your filesystem with the same permissions as the NetworkManager configuration files.

If the NetworkManager config files do support storing auth details in a separate file, maybe one approach would be to store the auth details in an encrypted file which would be decrypted on boot, prior to NetworkManager initiating.

@nextbeat82
Copy link

Sorry still a beginner with some of this stuff. I didn't understand at first that the .ovpn files were different than the profiles that were created for NetworkManager. According to the nm-settings-keyfile description page, "...private keys and passphrases may be stored in plaintext inside the file". Before that it mentioned that "..files that are readable or writable by any user or group other than 'root'" are ignored for security reasons. Looks like storing creds in a separate file is possibile. Haven't looked into having a system query encrypted files yet.

@dagrha
Copy link
Owner Author

dagrha commented Jul 31, 2017

Thanks for the info, nextbeat82. After reading that nice link you sent, I am now under the impression that nm does not allow the option to store credentials in a file outside of the keyfile. There are several secrets-flag options, but none seems to allow storing credentials in an external file:

0 - (NM owned) - the system is responsible for providing and storing this secret.

1 - (agent-owned) - a user-session secret agent is responsible for providing and storing this secret; when it is required, agents will be asked to provide it.

2 - (not-saved) - this secret should not be saved but should be requested from the user each time it is required.

4 - (not-required) - in some situations it cannot be automatically determined that a secret is required or not. This flag hints that the secret is not required and should not be requested from the user.

Currently pypia uses the 0 flag, so nm provides and stores the secrets in the keyfiles in /etc/NetworkManager/system-connections/ directory. I am guessing that using Keyring or Wallet is possible, given a 1 flag. A 2 flag would ask for credentials each time. 4 is not an option here.

@d4rkcat
Copy link

d4rkcat commented Nov 15, 2017

Hi @dagrha ,
Nice script, I also just protect the credentials with chmod 400. You can also add auth-nocache to the ovpn config to prevent openvpn from storing creds in memory.
It's a classic tossup between convenience and security, but my thinking is if you have a user with root access to your box then you are completely compromised no matter what. Entering the password every time just seems like too much hassle to me.

@dagrha
Copy link
Owner Author

dagrha commented Nov 16, 2017

thanks d4rkcat, I like your pia shell script, too. You have some nice options there, for example the firewall and port stuff.

I have poked around a little bit in documentation for the networkmanager keyfiles (i.e. the confs in /etc/NetworkManager/system-connections/) and I have yet to come across any flags for not caching credentials in memory. It does appear that, as you say, the ovpn files do allow that. I may have to migrate to ovpn files rather than NM keyfiles in the future to add more functionality.

I tend to agree with you about the convenience vs security stuff.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants