Skip to content

Commit

Permalink
LibreSSL corrections: genpkey and no-password
Browse files Browse the repository at this point in the history
Squashed commit of the following:

* easyrsa_openssl() - Disable 'genpkey -config' for LibreSSL
  Closes: OpenVPN#601

* Set '-nodes' for LibreSSL version 3 'no-password' mode
  Closes: OpenVPN#602

Minor corrections to indentation/comments.

Signed-off-by: Richard T Bonhomme <[email protected]>
  • Loading branch information
TinCanTech committed Jun 19, 2022
1 parent 17df3b8 commit c300f60
Showing 1 changed file with 17 additions and 4 deletions.
21 changes: 17 additions & 4 deletions easyrsa3/easyrsa
Original file line number Diff line number Diff line change
Expand Up @@ -702,7 +702,10 @@ easyrsa_openssl() {

# OpenSSL 1x genpkey does not support -config - Not as documented:
# https://www.openssl.org/docs/manmaster/man1/openssl-genpkey.html
if [ "$osslv_major" = 3 ] && [ "$openssl_command" = genpkey ]; then
# This could be anyones bug ..
if [ "$openssl_command" = genpkey ] && \
[ "$ssl_lib" = openssl ] && [ "$osslv_major" = 3 ]
then
has_config=1
fi

Expand Down Expand Up @@ -792,12 +795,15 @@ verify_ssl_lib() {
if [ -z "$EASYRSA_SSL_OK" ]; then
# redirect std-err to ignore missing etc/ssl/openssl.cnf file
val="$("$EASYRSA_OPENSSL" version 2>/dev/null)"

# SSL lib name
case "${val%% *}" in
# OpenSSL does require a safe config-file for ampersand
OpenSSL) ssl_lib=openssl; require_safe_ssl_conf=1 ;;
LibreSSL) ssl_lib=libressl; require_safe_ssl_conf=1 ;;
*) die "\
Missing or invalid OpenSSL
Missing SSL binary or invalid SSL output for 'version':
* '${val%% *}'
Expected to find openssl command at: $EASYRSA_OPENSSL"
esac

Expand All @@ -806,8 +812,14 @@ Expected to find openssl command at: $EASYRSA_OPENSSL"
osslv_major="${osslv_major%%.*}"
case "$osslv_major" in
1) no_password='-nodes' ;;
2) no_password='-nodes' ;; # LibreSSL Only
3) no_password='-noenc' ;;
2) no_password='-nodes' ;;
3)
case "$ssl_lib" in
openssl) no_password='-noenc' ;;
libressl) no_password='-nodes' ;;
*) die "Unsupported SSL library: $ssl_lib"
esac
;;
*) die "Unsupported SSL library: $osslv_major"
esac
message "Using SSL: $EASYRSA_OPENSSL ${val}"
Expand Down Expand Up @@ -3482,6 +3494,7 @@ detect_host() {
show_host() {
print_version
print "$host_out | ${ssl_lib:-ssl_lib not set}"
[ ! "$EASYRSA_DEBUG" ] && return
case "$easyrsa_host_os" in
win) set ;;
nix) env ;;
Expand Down

0 comments on commit c300f60

Please sign in to comment.