-
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
EasyRSA Behavior Change - 3.0.8 - 3.2.0 - EASYRSA_REQ_CN / --req-cn /--subject-alt-name #1148
Comments
@joubertdj Please show the command and output using the |
@TinCanTech : Thanks for the quick response. The command:
|
When I try to use the sign-req for the --req-cn it also complains about that ... |
@joubertdj relax .. you can leave this open, for now. |
@joubertdj Thanks. First: Upgrading from With regard to your SAN use, you have figured out the solution. 👍 With regard to your use of The This change was made in commit: 7227909 I will expand on this decision later. However, you have to accept that your use of |
@TinCanTech : Hehehe ... yeah, please don't ask why I never used the FQDN ... I think I "did" at one point but when I placed an "explanation" instead of FQDN it "looked better" (or something like that ... there was also some RFC that indicated CN's aren't really used/considered but the SAN is the priority (this works with most/all our systems ... )) Ah well, thanks, I will just have to amend though then ... |
My usage is more easy:
but it is broken now too with same error:
It'm using
|
Commented in
Got same error, but for
After this my commands work as before (probably). |
It is good to see that EasyRSA code is easy to customise. Version 3.1.7 also has the functionality that you desire. Version 3.2.0 is a development snapshot. |
@TinCanTech : This was the RFC I was referring to that indicated that the CN isn't preferred anymore, but SAN: https://www.rfc-editor.org/rfc/rfc2818.html, this portion: "If a subjectAltName extension of type dNSName is present, that MUST |
@joubertdj Thank you, I am aware of RFC2818. |
This patch does not apply to 3.2.0, so I made my own based on it:
|
Sorry about that, I raised it against Having taken a close look at how |
Linking: #1170 - Resolves use of |
Patch:
|
Please try |
Not fixed:
Check near |
This bug is still here in 3.2.1:
Patch:
|
@VVD: I tried the script below but cannot reproduce the error on 3.2.1:
Please extend the script such that we can reproduce the issue. |
# grep -vE '^(#|$)' /usr/local/etc/openvpn/pki/vars
if [ -z "$EASYRSA_CALLER" ]; then
echo "You appear to be sourcing an Easy-RSA *vars* file. This is" >&2
echo "no longer necessary and is disallowed. See the section called" >&2
echo "*How to use this file* near the top comments for more details." >&2
return 1
fi
set_var EASYRSA_PKI "/usr/local/etc/openvpn/pki"
set_var EASYRSA_REQ_COUNTRY "XX"
set_var EASYRSA_REQ_PROVINCE "XXXXXX"
set_var EASYRSA_REQ_CITY "XXXXXX"
set_var EASYRSA_REQ_ORG "XXXXXX"
set_var EASYRSA_REQ_EMAIL "[email protected]"
set_var EASYRSA_REQ_OU "XXX"
set_var EASYRSA_REQ_CN "hostname.domain.name"
set_var EASYRSA_KEY_SIZE 4096
set_var EASYRSA_ALGO ed
set_var EASYRSA_CURVE ed25519
set_var EASYRSA_CA_EXPIRE 3650
set_var EASYRSA_CERT_EXPIRE 3650
set_var EASYRSA_CRL_DAYS 3650
set_var EASYRSA_CERT_RENEW 3650
set_var EASYRSA_DIGEST "sha512" # /usr/local/bin/easyrsa gen-req easyrsa321test nopass batch
Using Easy-RSA 'vars' configuration:
* /usr/local/etc/openvpn/pki/vars
-----
Notice
------
Private-Key and Public-Certificate-Request files created.
Your files are:
* req: /usr/local/etc/openvpn/pki/reqs/easyrsa321test.req
* key: /usr/local/etc/openvpn/pki/private/easyrsa321test.key # /usr/local/bin/easyrsa --batch '--passin=pass:********' sign-req client easyrsa321test
Using Easy-RSA 'vars' configuration:
* /usr/local/etc/openvpn/pki/vars
Using configuration from /usr/local/etc/openvpn/pki/e6c8cb62/temp.1.1
Check that the request matches the signature
Signature ok
The Subject's Distinguished Name is as follows
commonName :ASN.1 12:'hostname.domain.name'
ERROR:There is already a certificate for /CN=hostname.domain.name
The matching entry has the following details
Type :Valid
Expires on :261015175821Z
Serial Number :01
File name :unknown
Subject Name :/CN=hostname.domain.name
Easy-RSA error:
easyrsa_openssl - Command has failed:
* openssl ca -utf8 -batch -in /usr/local/etc/openvpn/pki/reqs/easyrsa321test.req -out /usr/local/etc/openvpn/pki/e6c8cb62/temp.3
.1 -extfile /usr/local/etc/openvpn/pki/e6c8cb62/temp.2.1 -passin pass:******** -days 3650
EasyRSA Version Information
Version: 3.2.1
Generated: Fri Sep 13 13:04:18 CDT 2024
SSL Lib: OpenSSL 3.0.13 30 Jan 2024 (Library: OpenSSL 3.0.13 30 Jan 2024)
Git Commit: 3f60a68702713161ab44f9dd80ce01f588ca49ac
Source Repo: https://github.com/OpenVPN/easy-rsa
Host: 3.2.1 | nix | FreeBSD | /usr/local/bin/bash |
@VVD Still not reproducing with the script below run under sh on FreeBSD 14.1-RELEASE-p3 amd64 with easy-rsa-3.2.1,1 from ports. #!/bin/sh
set -eux
export EASYRSA_PKI="$(mktemp -d)"
easyrsa --batch init-pki
cat <<'_EOF' >"$EASYRSA_PKI/vars"
set_var EASYRSA_REQ_COUNTRY "XX"
set_var EASYRSA_REQ_PROVINCE "XXXXXX"
set_var EASYRSA_REQ_CITY "XXXXXX"
set_var EASYRSA_REQ_ORG "XXXXXX"
set_var EASYRSA_REQ_EMAIL "[email protected]"
set_var EASYRSA_REQ_OU "XXX"
set_var EASYRSA_REQ_CN "hostname.example.org"
set_var EASYRSA_KEY_SIZE 4096
set_var EASYRSA_ALGO ed
set_var EASYRSA_CURVE ed25519
set_var EASYRSA_CA_EXPIRE 3650
set_var EASYRSA_CERT_EXPIRE 3650
set_var EASYRSA_CRL_DAYS 3650
set_var EASYRSA_CERT_RENEW 3650
set_var EASYRSA_DIGEST "sha512"
_EOF
easyrsa --batch build-ca nopass
easyrsa gen-req "$USER" nopass batch
easyrsa --batch --passin=pass:asdfassdf sign-req client "$USER" Output:
|
@VVD note in your logs there is this error report (3rd line) above what you try to fix.
|
From root.
OpenSSL from base only. This config work for 8 years, added 277 users and it work fine with 3.1.7.
I know - I used this info for write the patch. |
So... it also works fine with 3.2.1 for me. And now? I think you best file a new issue once you have a way that others can reliably reproduce what you find to be a bug and what to me looks like your trying to generate a certificate you already have, which you do not want to clobber. |
Does the OpenVPN server work fully with the keys generated by your script?
Ofc I have certificate with name "hostname.domain.name" in pki - it was generated during prepare server's certificates for OpenVPN. |
You are wasting everybodys time by not explaining what you do, and then weasling out and adding more variables to the equation that was incomplete from the start. For the last time before I ignore you for good, here and on FreeBSD: Please write a or extend my script that I can run and that shows, on my computer,
If you mask your fields and that masking hides the bug, nobody will be able to help you. To put it bluntly, if you cannot show the bug, then there is no bug, and no reason for anyone to accept the patch. |
I don't understand what you're missing in my messages? I've provided all the command lines and all the messages from the script: /usr/local/bin/easyrsa gen-req easyrsa321test nopass batch
/usr/local/bin/easyrsa --batch '--passin=pass:********' sign-req client easyrsa321test And I provide patch to fix this bug. You're not asking me to share my pki, are you? My server configuration has been working for about 8 years now and I can't remember the exact command line for generating a server certificate, not to mention that they were created by easyrsa on a much older version and on FreeBSD 10.x. easyrsa init-pki
easyrsa build-ca
easyrsa gen-dh
easyrsa gen-req vpn.unislabs.com nopass
easyrsa sign-req server hostname.domain.name Test on just created new pki: # grep Subject: issued/test*.crt
issued/test1.crt: Subject: CN=test1
issued/test2.crt: Subject: CN=test2
issued/test3.crt: Subject: CN=hostname.domain.name
issued/test4.crt: Subject: CN=hostname.domain.name Another manifestation of this bug: # cat index.txt
V 340923162244Z 34DC2E0865281A037C4704DA3FB4A966 unknown /CN=test1
V 340923162258Z 370EBA0C35D32B0025821015CFFE1DEB unknown /CN=test2
V 340923162352Z 041BB7EF2315EB19706F3AE0C59A7B22 unknown /CN=hostname.domain.name
V 340923162416Z 430F39AC894AEBE2D90FB3E1BA9FBA10 unknown /CN=hostname.domain.name In index.txt it is impossible to see the list of users to whom certificates were issued, as well as which users' certificates were actually revoked and which were not. If change in file # grep Subject: issued/test6.crt
Subject: CN=test6
# grep test6 index.txt
V 340923164142Z 47A783F4A59B603E07791EA41BB5F5DA unknown /CN=test6 This is the essence of the error: the correct value for the if [ "$EASYRSA_REQ_CN" = ChangeMe ]; then
export EASYRSA_REQ_CN="$file_name_base"
fi or the variable default_vars() {
…
set_var EASYRSA_REQ_CN ChangeMe
… One more test:
From new pki
From old pki
Maybe it looks at |
I don't care as long as you don't show me a way to reproduce the bug. If your previous comment convinces the easy-rsa authors, we'll see a fix in the next official release and take it to FreeBSD from there. Until then, I'll unsubscribe from this bug. |
@mandree This appears to be the root of the problem. @VVD Please confirm that the file:
|
Considering the upgrade path from This is also addressed by the file @VVD This most likely indicates that you have customised your EasyRSA cannot be responsible for user changes of the SSL config file. |
@VVD Please share the |
I have:
Probably it was default for easyrsa 3.0.x.
openssl-easyrsa.cnf is from ~3.0.7 too. Equal to this: https://github.com/OpenVPN/easy-rsa/blob/4ce6e9c8e4b681c739b179a506a8ad1ca6d6ebe4/easyrsa3/openssl-easyrsa.cnf |
Updating |
@VVD Thanks for sharing. Your initial settings would obviously prohibit duplicate As for your updated settings, please provide the |
@TinCanTech, after updating no failures, but all new records in |
Good.
That is the expected behavior. Remove |
I know. if [ "$EASYRSA_REQ_CN" = ChangeMe ]; then
export EASYRSA_REQ_CN="$file_name_base"
fi Can you please explain why this |
The default setting for If this default has not been changed then the If you have previously set This is expected behavior and also the reason why |
This is clear from the code (I know shell). |
Because that is the correct way.
Allowing duplicate |
Your file may be similar to the file you linked to but it is not the same. For that file, the hash is I do not think it is necessary to add this hash to I am also satisfied that any behavioral changes are positive improvements.
|
I don't understand what you mean. |
Hash:
Hash:
Missing new line due to copy/paste error. Now fixed. |
I have been using easyrsa for a while now ... and maybe I have been using it "incorrectly", the result was actually precisely what I wanted. For several system clients I generate a specific CA, with unique CNs, and then the different systems that needs to intercommunicate I generate certificates for each of the systems, all with unique CNs and unique SAN (IPs DNS, etc.).
Previously, when I had a vars file with EASYRSA_REQ_CN and EASYRSA_BATCH set, then the build-ca command would take that CN as the CA CN name.
And when I then run something like (just an example):
./easyrsa --req-cn="Supercompany - Loc X - Subsystem X" --subject-alt-name="IP:127.0.0.1, DNS:localhost" gen-req "sysb" nopass
I would get a private key of "sysb.key", a CSR of "sysb.req, and then I could sign it ... and the SAN will also be in tack, and the CN name will be as it was required within the sysb.crt file ... however, this behavior is now different in 3.2.0.
When I tried it as previously ... I got regular errors of:
'gen-req' does not support setting an external commonName
What is the correct way of obtaining the previous behavior? I tried removing the EASYRSA_REQ_CN but then things gets even weirder with the key being something like: "--req-cn="Supercompany - Loc X - Subsystem X".key"
The text was updated successfully, but these errors were encountered: