Skip to content

Commit

Permalink
update OpenSSL 1.1.1 TLS 1.3 support for pre-release versions
Browse files Browse the repository at this point in the history
Previously Centmin Mod supported OpenSSL 1.1.1-dev version pulled from github master branch but need to rework routines so to support tarball based OpenSSL 1.1.1 pre-release alphas and eventually OpenSSL 1.1.1 tarball versions https://community.centminmod.com/threads/openssl-1-1-1-first-alpha-pre-release-1-out.13996/#post-59524
  • Loading branch information
centminmod committed Feb 13, 2018
1 parent 2da737c commit 5b0dda6
Show file tree
Hide file tree
Showing 7 changed files with 55 additions and 20 deletions.
5 changes: 3 additions & 2 deletions addons/acmetool.sh
Expand Up @@ -614,8 +614,9 @@ sslopts_check() {
CHACHACIPHERS=""
fi

DETECTOPENSSL_ONEZERO=$(echo $OPENSSL_VERSION | cut -d . -f1,2)
if [[ "$DETECTOPENSSL_ONEZERO" = '1.1' ]]; then
DETECTOPENSSL_ONEZERO=$(echo $OPENSSL_VERSION | cut -d . -f1-2)
DETECTOPENSSL_ONEONE=$(echo $OPENSSL_VERSION | cut -d . -f1-3 | grep -o 1.1.1)
if [[ "$DETECTOPENSSL_ONEZERO" = '1.1' ]] || [[ "$DETECTOPENSSL_ONEONE" = '1.1.1' ]]; then
# openssl 1.1.0 unsupported flag enable-tlsext
if [[ "$(grep -w 'tls1_3' "${DIR_TMP}/openssl-${OPENSSL_VERSION}/Configure")" ]]; then
TLSONETHREEOPT=' enable-tls1_3'
Expand Down
29 changes: 27 additions & 2 deletions inc/nginx_configure.inc
Expand Up @@ -145,8 +145,9 @@ if [ -f "${CM_INSTALLDIR}/inc/z_custom.inc" ]; then
fi

# adjustments for OpenSSL 1.1.0
DETECTOPENSSL_ONEZERO=$(echo $OPENSSL_VERSION | cut -d . -f1,2)
if [[ "$DETECTOPENSSL_ONEZERO" = '1.1' ]]; then
DETECTOPENSSL_ONEZERO=$(echo $OPENSSL_VERSION | cut -d . -f1-2)
DETECTOPENSSL_ONEONE=$(echo $OPENSSL_VERSION | cut -d . -f1-3 | grep -o 1.1.1)
if [[ "$DETECTOPENSSL_ONEZERO" = '1.1' ]] || [[ "$DETECTOPENSSL_ONEONE" = '1.1.1' ]]; then
echo "detected $OPENSSL_VERSION"
WITHOPENSSL_OPT=""
WITHOPENSSL_OPTECHO=""
Expand Down Expand Up @@ -610,6 +611,12 @@ if [[ "$CENTOS_SEVEN" = '7' || "$CENTOS_SIX" = '6' ]]; then
OPENSSLOPT=" --with-openssl=../openssl-tls1.3 --with-openssl-opt='enable-tls1_3'"
else
OPENSSLOPT=" --with-openssl=../openssl-tls1.3 --with-openssl-opt='enable-tls1_3'"
fi
elif [[ "$DETECTOPENSSL_ONEONE" = '1.1.1' && "$ORESTY_LUANGINX" != [yY] ]]; then
if [[ "$(uname -m)" = 'x86_64' ]]; then
OPENSSLOPT=" --with-openssl=../$OPENSSLDIR --with-openssl-opt='enable-tls1_3'"
else
OPENSSLOPT=" --with-openssl=../$OPENSSLDIR --with-openssl-opt='enable-tls1_3'"
fi
else
if [[ "$(uname -m)" = 'x86_64' ]]; then
Expand All @@ -630,6 +637,12 @@ if [[ "$CENTOS_SEVEN" = '7' || "$CENTOS_SIX" = '6' ]]; then
OPENSSLOPT=" --with-openssl=../openssl-tls1.3 --with-openssl-opt='enable-tls1_3'"
else
OPENSSLOPT=" --with-openssl=../openssl-tls1.3 --with-openssl-opt='enable-tls1_3'"
fi
elif [[ "$DETECTOPENSSL_ONEONE" = '1.1.1' && "$ORESTY_LUANGINX" != [yY] ]]; then
if [[ "$(uname -m)" = 'x86_64' ]]; then
OPENSSLOPT=" --with-openssl=../$OPENSSLDIR --with-openssl-opt='enable-tls1_3'"
else
OPENSSLOPT=" --with-openssl=../$OPENSSLDIR --with-openssl-opt='enable-tls1_3'"
fi
else
export STATICLIBSSL="${OPENSSL_CUSTOMPATH}"
Expand Down Expand Up @@ -1506,6 +1519,12 @@ else
OPENSSLOPT=" --with-openssl=../openssl-tls1.3 --with-openssl-opt='enable-tls1_3'"
else
OPENSSLOPT=" --with-openssl=../openssl-tls1.3 --with-openssl-opt='enable-tls1_3'"
fi
elif [[ "$DETECTOPENSSL_ONEONE" = '1.1.1' && "$ORESTY_LUANGINX" != [yY] ]]; then
if [[ "$(uname -m)" = 'x86_64' ]]; then
OPENSSLOPT=" --with-openssl=../$OPENSSLDIR --with-openssl-opt='enable-tls1_3'"
else
OPENSSLOPT=" --with-openssl=../$OPENSSLDIR --with-openssl-opt='enable-tls1_3'"
fi
else
if [[ "$TLSONETHREE_DETECT" = [yY] ]]; then
Expand Down Expand Up @@ -1534,6 +1553,12 @@ else
OPENSSLOPT=" --with-openssl=../openssl-tls1.3 --with-openssl-opt='enable-tls1_3'"
else
OPENSSLOPT=" --with-openssl=../openssl-tls1.3 --with-openssl-opt='enable-tls1_3'"
fi
elif [[ "$DETECTOPENSSL_ONEONE" = '1.1.1' && "$ORESTY_LUANGINX" != [yY] ]]; then
if [[ "$(uname -m)" = 'x86_64' ]]; then
OPENSSLOPT=" --with-openssl=../$OPENSSLDIR --with-openssl-opt='enable-tls1_3'"
else
OPENSSLOPT=" --with-openssl=../$OPENSSLDIR --with-openssl-opt='enable-tls1_3'"
fi
else
export STATICLIBSSL="${OPENSSL_CUSTOMPATH}"
Expand Down
5 changes: 3 additions & 2 deletions inc/nginx_install.inc
Expand Up @@ -239,11 +239,12 @@ funct_nginxconfigure
fi

# detect OpenSSL 1.1.0 for make -jXX support
DETECTOPENSSL_ONEZERO=$(echo $OPENSSL_VERSION | cut -d . -f1,2)
DETECTOPENSSL_ONEZERO=$(echo $OPENSSL_VERSION | cut -d . -f1-2)
DETECTOPENSSL_ONEONE=$(echo $OPENSSL_VERSION | cut -d . -f1-3 | grep -o 1.1.1)
if [[ "$LIBRESSL_SWITCH" = [yY] ]]; then
time make${MAKETHREADS}
else
if [[ "$DETECTOPENSSL_ONEZERO" = '1.1' ]]; then
if [[ "$DETECTOPENSSL_ONEZERO" = '1.1' ]] || [[ "$DETECTOPENSSL_ONEONE" = '1.1.1' ]]; then
time make${MAKETHREADS}
else
time make
Expand Down
4 changes: 2 additions & 2 deletions inc/nginx_patch.inc
Expand Up @@ -8,7 +8,7 @@ ngx_hpack_patch() {
NGINX_PUSHBASE=$NGINX_VERSION
echo "$DETECT_NGXVER"
fi
DETECTOPENSSL_ONEZERO=$(echo $OPENSSL_VERSION | cut -d . -f1,2)
DETECTOPENSSL_ONEZERO=$(echo $OPENSSL_VERSION | cut -d . -f1-2)
if [[ "$NGINX_HPACK" = [yY] && "$DETECT_NGXVER" -ge '1013006' ]]; then
pushd "${DIR_TMP}/nginx-${NGINX_PUSHBASE}"
cecho "patching nginx http/2 full HPACK encoding support" $boldyellow
Expand Down Expand Up @@ -186,7 +186,7 @@ patchnginx() {
sleep "$NGINXPATCH_DELAY"

# unofficial OpenSSL 1.1.0 beta Nginx patches
DETECTOPENSSL_ONEZERO=$(echo $OPENSSL_VERSION | cut -d . -f1,2)
DETECTOPENSSL_ONEZERO=$(echo $OPENSSL_VERSION | cut -d . -f1-2)
# detect nginx <=1.11.3 or => 1.11.0 as 1.11.4+ has fix for openssl 1.1 so no patching needed
# http://hg.nginx.org/nginx/rev/1891b2892b68
if [ "$ngver" ]; then
Expand Down
5 changes: 3 additions & 2 deletions inc/nginx_upgrade.inc
Expand Up @@ -727,11 +727,12 @@ fi
fi
# detect OpenSSL 1.1.0 for make -jXX support
DETECTOPENSSL_ONEZERO=$(echo $OPENSSL_VERSION | cut -d . -f1,2)
DETECTOPENSSL_ONEZERO=$(echo $OPENSSL_VERSION | cut -d . -f1-2)
DETECTOPENSSL_ONEONE=$(echo $OPENSSL_VERSION | cut -d . -f1-3 | grep -o 1.1.1)
if [[ "$LIBRESSL_SWITCH" = [yY] ]]; then
time make${MAKETHREADS}
else
if [[ "$DETECTOPENSSL_ONEZERO" = '1.1' ]]; then
if [[ "$DETECTOPENSSL_ONEZERO" = '1.1' ]] || [[ "$DETECTOPENSSL_ONEONE" = '1.1.1' ]]; then
time make${MAKETHREADS}
else
time make
Expand Down
22 changes: 14 additions & 8 deletions inc/openssl_install.inc
Expand Up @@ -125,7 +125,8 @@ if [[ "$(uname -m)" != 'x86_64' ]]; then
CLOUDFLARE_PATCHSSL='n'
fi

DETECTOPENSSL_ONEZERO=$(echo $OPENSSL_VERSION | cut -d . -f1,2)
DETECTOPENSSL_ONEZERO=$(echo $OPENSSL_VERSION | cut -d . -f1-2)
DETECTOPENSSL_ONEONE=$(echo $OPENSSL_VERSION | cut -d . -f1-3 | grep -o 1.1.1)

if [[ "$CLOUDFLARE_PATCHSSL" = [yY] && "$DETECTOPENSSL_ONEZERO" = '1.0' ]]; then
# if [[ "${OPENSSL_VERSION}" = '1.0.1h' ]]; then
Expand Down Expand Up @@ -326,7 +327,8 @@ installopenssl() {
# so fall back to 1.0.2 branch if lua nginx module is enabled
OPENSSL_VERSION="$OPENSSL_VERSIONFALLBACK"
fi
DETECTOPENSSL_ONEZERO=$(echo $OPENSSL_VERSION | cut -d . -f1,2)
DETECTOPENSSL_ONEZERO=$(echo $OPENSSL_VERSION | cut -d . -f1-2)
DETECTOPENSSL_ONEONE=$(echo $OPENSSL_VERSION | cut -d . -f1-3 | grep -o 1.1.1)
if [ ! -f /usr/local/go/bin/go ]; then
# if golang is not detected BoringSSL switch will be disabled
# and default to using OpenSSL 1.0.2+
Expand Down Expand Up @@ -424,7 +426,7 @@ installopenssl() {
fi

#-- Build static openssl
if [[ "$TLSONETHREE" = [yY] && "$ORESTY_LUANGINX" != [yY] ]]; then
if [[ "$TLSONETHREE" = [yY] && "$ORESTY_LUANGINX" != [yY] ]] && [[ "$DETECTOPENSSL_ONEONE" != '1.1.1' ]] ; then
OPENSSL_CUSTOMPATH='/opt/openssl-tls1.3'
export STATICLIBSSL="${OPENSSL_CUSTOMPATH}"
cd "$DIR_TMP"
Expand All @@ -451,7 +453,7 @@ installopenssl() {
else
ECNISTP_OPT=""
fi
if [[ "$DETECTOPENSSL_ONEZERO" = '1.1' ]]; then
if [[ "$DETECTOPENSSL_ONEZERO" = '1.1' ]] || [[ "$DETECTOPENSSL_ONEONE" = '1.1.1' ]]; then
# openssl 1.1.0 unsupported flag enable-tlsext
if [[ "$(grep -w 'tls1_3' Configure)" ]]; then
TLSONETHREEOPT=' enable-tls1_3'
Expand All @@ -469,12 +471,14 @@ installopenssl() {
elif [[ ! "${OPENSSL_THREADS}" ]]; then
OPENSSL_THREADSOPT=""
fi
./config -Wl,--enable-new-dtags,-rpath,'$(LIBRPATH)' --prefix=$STATICLIBSSL --openssldir=$STATICLIBSSL shared${ECNISTP_OPT}${TLSONETHREEOPT}${OPENSSL_THREADSOPT}
echo "./config -Wl,--enable-new-dtags,-rpath=${STATICLIBSSL}/lib --prefix=$STATICLIBSSL --openssldir=$STATICLIBSSL shared${ECNISTP_OPT}${TLSONETHREEOPT}${OPENSSL_THREADSOPT}"
./config -Wl,--enable-new-dtags,-rpath=${STATICLIBSSL}/lib --prefix=$STATICLIBSSL --openssldir=$STATICLIBSSL shared${ECNISTP_OPT}${TLSONETHREEOPT}${OPENSSL_THREADSOPT}
else
echo "./config --prefix=$STATICLIBSSL --openssldir=$STATICLIBSSL shared enable-tlsext${ECNISTP_OPT}"
./config --prefix=$STATICLIBSSL --openssldir=$STATICLIBSSL shared enable-tlsext${ECNISTP_OPT}
fi
else
if [[ "$DETECTOPENSSL_ONEZERO" = '1.1' ]]; then
if [[ "$DETECTOPENSSL_ONEZERO" = '1.1' ]] || [[ "$DETECTOPENSSL_ONEONE" = '1.1.1' ]]; then
# openssl 1.1.0 unsupported flag enable-tlsext
if [[ "$(grep -w 'tls1_3' Configure)" ]]; then
TLSONETHREEOPT=' enable-tls1_3'
Expand All @@ -483,12 +487,14 @@ installopenssl() {
TLSONETHREEOPT=""
TLSONETHREE_DETECT='n'
fi
./config -Wl,--enable-new-dtags,-rpath,'$(LIBRPATH)' --prefix=$STATICLIBSSL --openssldir=$STATICLIBSSL shared${TLSONETHREEOPT}
echo "./config -Wl,--enable-new-dtags,-rpath=${STATICLIBSSL}/lib --prefix=$STATICLIBSSL --openssldir=$STATICLIBSSL shared${TLSONETHREEOPT}"
./config -Wl,--enable-new-dtags,-rpath=${STATICLIBSSL}/lib --prefix=$STATICLIBSSL --openssldir=$STATICLIBSSL shared${TLSONETHREEOPT}
else
echo "./config --prefix=$STATICLIBSSL --openssldir=$STATICLIBSSL shared enable-tlsext"
./config --prefix=$STATICLIBSSL --openssldir=$STATICLIBSSL shared enable-tlsext
fi
fi
if [[ "$DETECTOPENSSL_ONEZERO" = '1.1' ]]; then
if [[ "$DETECTOPENSSL_ONEZERO" = '1.1' ]] || [[ "$DETECTOPENSSL_ONEONE" = '1.1.1' ]]; then
make${MAKETHREADS}
else
make depend
Expand Down
5 changes: 3 additions & 2 deletions tools/nv.sh
Expand Up @@ -717,8 +717,9 @@ else
CHACHACIPHERS=""
fi

DETECTOPENSSL_ONEZERO=$(echo $OPENSSL_VERSION | cut -d . -f1,2)
if [[ "$DETECTOPENSSL_ONEZERO" = '1.1' ]]; then
DETECTOPENSSL_ONEZERO=$(echo $OPENSSL_VERSION | cut -d . -f1-2)
DETECTOPENSSL_ONEONE=$(echo $OPENSSL_VERSION | cut -d . -f1-3 | grep -o 1.1.1)
if [[ "$DETECTOPENSSL_ONEZERO" = '1.1' ]] || [[ "$DETECTOPENSSL_ONEONE" = '1.1.1' ]]; then
# openssl 1.1.0 unsupported flag enable-tlsext
if [[ "$(grep -w 'tls1_3' "${DIR_TMP}/openssl-${OPENSSL_VERSION}/Configure")" ]]; then
TLSONETHREEOPT=' enable-tls1_3'
Expand Down

0 comments on commit 5b0dda6

Please sign in to comment.