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

Subject-Alt-Name: Correct behavior of global option --san #1093

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ Easy-RSA 3 ChangeLog

3.2.0 (TBD)

* Subject-Alt-Name: Allow multiple --san instances (4893c1f) (#103)
* Remove default server subject alternative name (0b85a5d) (#576)
* Move Status Reports to 'easyrsa-tools.lib' (214b909) (#1080)
* export-p12, OpenSSL v1.x: Upgrade PBE and MAC options (60a508a)
Expand Down
23 changes: 16 additions & 7 deletions easyrsa3/easyrsa
Original file line number Diff line number Diff line change
Expand Up @@ -400,9 +400,12 @@ Usage: easyrsa [ OPTIONS.. ] <COMMAND> <TARGET> [ cmd-opts.. ]"

This global option adds a subjectAltName to the request or issued
certificate. It MUST be in a valid format accepted by openssl or
req/cert generation will fail. Note that including multiple such
names requires them to be comma-separated; further invocations of
this option will REPLACE the value.
req/cert generation will fail. NOTE: --san can be specified more
than once on the command line.

The following two command line examples are equivalent:
1. --san=DNS:server1,DNS:serverA,IP:10.0.0.1
2. --san=DNS:server1 --san=DNS:serverA --san=IP:10.0.0.1

Examples of the SAN_FORMAT_STRING shown below:

Expand Down Expand Up @@ -2228,8 +2231,12 @@ basicConstraints is not defined, cannot use 'pathlen'"
print "nsComment = \"$EASYRSA_NS_COMMENT\""
fi

# SAN extension
if [ "$EASYRSA_SAN" ]; then
print "$EASYRSA_SAN"
fi

# Add user supplied extra extensions
# and/or SAN extension
if [ "$EASYRSA_EXTRA_EXTS" ]; then
print "$EASYRSA_EXTRA_EXTS"
fi
Expand Down Expand Up @@ -5388,9 +5395,11 @@ while :; do
export EASYRSA_CP_EXT=1
;;
--subject-alt-name|--san)
export EASYRSA_EXTRA_EXTS="\
$EASYRSA_EXTRA_EXTS
subjectAltName = $val"
if [ "$EASYRSA_SAN" ]; then
export EASYRSA_SAN="$EASYRSA_SAN, $val"
else
export EASYRSA_SAN="subjectAltName = $val"
fi
;;
--usefn)
export EASYRSA_P12_FR_NAME="$val"
Expand Down