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

Expose EASYRSA_PASSIN and EASYRSA_PASSOUT env variables #368

Merged
merged 2 commits into from Mar 29, 2020
Merged

Expose EASYRSA_PASSIN and EASYRSA_PASSOUT env variables #368

merged 2 commits into from Mar 29, 2020

Conversation

pschiffe
Copy link
Contributor

By exposing these variables it's possible to configure the password from
various sources by specifing env vars. This is a followup to PR #242

Fixes #365

@pschiffe
Copy link
Contributor Author

cc @luizluca

@pschiffe
Copy link
Contributor Author

The CI check failed with error An error occurred while generating the build script. - not sure what that means, all tests are passing - Completed Sat 21 Mar 2020 06:58:02 PM CET (Total errors: 0). Could someone try to rerun that travis test?

@ecrist
Copy link
Member

ecrist commented Mar 21, 2020

Looks like Travis might be having a problem with their Mac build boxes.

pschiffe added a commit to pschiffe/docker-openvpn that referenced this pull request Mar 21, 2020
@luizluca
Copy link
Contributor

The patch has many unrelated whitespace changes

@pschiffe
Copy link
Contributor Author

Dropped the whitespace changes from the patch.

easyrsa3/vars.example Outdated Show resolved Hide resolved
@luizluca
Copy link
Contributor

A malicious agent could set EASYRSA_PASSOUT and skip asking the admin for a password. If the admin inattentive does not notice that, a private key might be saved using the password defined by the malicious agent. Another attack would be to use EASYRSA_PASSOUT to destroy data overwriting a target file writable by easyrsa caller. Although, setting arbitrary env vars would be enough to potentially do much more harm than this case.

Another non-intentional problem would be someone leaving EASYRSA_PASSIN/OUT defined by mistake (used in a previous easyrsa call). It could make the command fail without a clear warning or save a private key with a previously used password. Maybe we should add a warning if data came from an env var.

Setting any random data to EASYRSA_PASSIN/OUT will only make command fail as its content is protected by double quotes and it always prefix it with '--passin/out' option.

I don't think that this patch will make too much harm and it does add an alternative way to pass arguments. Besides the vars.example change I suggested, it should be accepted.

@ecrist
Copy link
Member

ecrist commented Mar 23, 2020

That information is better documented in the EasyRSA-Advanced.md file. I do think a mention in the config file specifying it is NOT recommended to be set there would be best. Maybe even a check in easyrsa itself to refuse to use a config file that contains EASYRSA_PASSIN/OUT value?

@pschiffe
Copy link
Contributor Author

@ecrist up to you - let me know what would you like to see here and I can try to do it. I didn't find any examples in the script how to warn that variable is set in the config file and I'm not sure if it's worth the effort and complexity, but if you think it's important..

@ecrist
Copy link
Member

ecrist commented Mar 24, 2020

@pschiffe there's nothing in there now - a simple grep test for the config file would suffice. I can help if needed.

By exposing these variables it's possible to configure the password from
various sources by specifing env vars. This is a followup to PR #242

Fixes #365
and refuse to continue if they are present there, as they might containg
passwords.
@pschiffe
Copy link
Contributor Author

I've included a commit with grep check for the env vars in the config file.

@ecrist
Copy link
Member

ecrist commented Mar 29, 2020

I'll merge this, looks good on the surface. Could use an update to unit tests in OpenVPN/easyrsa-unit-tests#26

@ecrist ecrist merged commit 9499318 into OpenVPN:master Mar 29, 2020
@Deantwo
Copy link

Deantwo commented Sep 16, 2021

I cannot find any usage examples or documentation on how to use this at all.
Can the documentation be updated and maybe a link to it be posted here?

@luizluca
Copy link
Contributor

You mean --passin/--passout arg? It is a standard openssl argument https://www.openssl.org/docs/manmaster/man1/openssl-passphrase-options.html

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

Successfully merging this pull request may close these issues.

allow external EASYRSA_PASSIN and EASYRSA_PASSOUT env vars
4 participants