-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
'build-ca' fails if '--passin=file:' and '--passout=file:' use the same filename #728
Comments
https://www.openssl.org/docs/man3.0/man1/openssl-passphrase-options.html EasyRSA passes options |
That may be what the docs say, but if I pass the same filename to both args,
Also true, but in the call to |
Please be precise about the commands you are using and the error messages returned. |
As I stated earlier, the issue is that Regardless, it took me quite a while to track the error down when I was building a CA, so even if no change is made to the code, |
@jbrubake You failed to post the requested details. My own test:
|
It is NEVER really a good idea to use the same in/out file. You're depending on too many variables. When do updates flush to disk, is the file being written at the same time it's being read? Did it read in fully before it truncated for write, etc? Don't do this. |
OpenSSL document what will happen if both options point to the same file, even to the extent that it need not be a regular file. Also, EasyRSA is passing these options directly to OpenSSL. My testing shows that it works. All there is now is to figure out what @jbrubake is doing wrong .. |
|
I run
I understand that OpenSSL says |
Closed: Cannot reproduce. @jbrubake Please state the exact commands that you are using. |
I believe what @jbrubake is referring to is this (running on an up-to-date Debian bookworm VM with a fresh download of EasyRSA 3.1.2): root@vpn:~# easyrsa --pki-dir=/tmp/easy-rsa/pki init-pki
Notice
------
'init-pki' complete; you may now create a CA or requests.
Your newly created PKI dir is:
* /tmp/easy-rsa/pki
* Using Easy-RSA configuration:
* IMPORTANT: Easy-RSA 'vars' template file has been created in your new PKI.
Edit this 'vars' file to customise the settings for your PKI.
To use a global vars file, use global option --vars=<YOUR_VARS>
* Using x509-types directory: /usr/share/easy-rsa/x509-types
root@vpn:~# echo password >mypass
root@vpn:~# easyrsa --pki-dir=/tmp/easy-rsa/pki --passin=file:mypass --passout=file:mypass build-ca
* Using SSL: openssl OpenSSL 3.0.8 7 Feb 2023 (Library: OpenSSL 3.0.8 7 Feb 2023)
* Using Easy-RSA configuration: /tmp/easy-rsa/pki/vars
Using configuration from /tmp/easy-rsa/pki/1e765e65/temp.59c73b04
.....................+....+..+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*............+.+...+.....+...+.......+..+.........+.......+...+.....+.+...+..+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*.....+..+.......+...+.....+...................+......+........+.+........+...+...+..........+..+............+.+.........+..................+........+.......+..+.+.....+............+...+.+...........+....+...+........+...+....+..+..........+..............+.+........+..........+.....+......+...................+..+...............+....+........................+..+...+...+.............+..+....+......+...+......+........+...+.......+...........+.+......+.....+...+....+...+.........+...........+....+......+.........+...+...+..+......+......+.+............+..+.........+...................+..+......+.............+..+...+.+.........+.....+...............................+.....+..........+...+......+...............+..+..................+.......+........+.......+...+...........+.+..+.+.....................+.....+.........+....+.....................+..+...+....+...+...+..+.........+....+.....+...................+...............+..+......+...+......+.+..+.+.........+.....................+.........+...+...+.....+.+......+.....+....+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
..+........+...+....+.....+......+...+.+...+........+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*.....+....+..+.........+.+..+.+..+....+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*.................+....+......+...+..+....+.....+.+...+.....+.+.....+...+.+..+...+.......+........+..........+...........+.+.....+....+...+.....+.+.....+..........+......+.....+.........+............+...............+.............+.....................+.....+....+...............+.....+.+.....+..........+.....+.+.................+......+.+..............+...................+...........+.+......+..+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Error reading password from BIO
Error getting passwords
Easy-RSA error:
Failed to build the CA certificate If I may add my two cents: I find it very confusing that both |
FTR, I cannot fix version 3.1.2 because of the Easy-RSA release process. However, an exclusion for the specific case of On reflection, this should only be a warning, because OpenSSL say that using the same file is fine, provided you follow what OpenSSL expects. Linking #838 |
I propose the patch #950 to fix this issue. |
If you want to pass the passphrase on the command line when running
build-ca
you have to use both--passin
and--passout
because creating the private key uses the value of--passout
and generating the CSR uses the value of--passin
. Both arguments need to have the same value because the involve encrypting and decrypting the private keyHowever, when
easyrsa
generates the CSR, its call toopenssl req
passes both-passout
and-passin
andopenssl req
fails (and thereforeeasyrsa
fails) if both of those use the samefile:xxx
value.openssl req
requires the filenames to be different (although the contents can be the same).As far as I can tell, the way that
easyrsa
is callingopenssl req
only requires the-passin
argument in order to decrypt the private key. The-passout
argument is needed if you are also generating the private key at the same time, which is not whateasyrsa
is doing.The portion of the code with the problem involved is here. Deleting line 1443 (containing $EASYRSA_PASSOUT) would fix the problem, but maybe there is some combination of arguments where it is actually required?
The text was updated successfully, but these errors were encountered: