|
Packit Service |
991b93 |
#!/bin/sh
|
|
Packit Service |
991b93 |
|
|
Packit Service |
991b93 |
# Copyright (C) 2019 Red Hat, Inc.
|
|
Packit Service |
991b93 |
#
|
|
Packit Service |
991b93 |
# Author: Nikos Mavrogiannopoulos
|
|
Packit Service |
991b93 |
#
|
|
Packit Service |
991b93 |
# This file is part of GnuTLS.
|
|
Packit Service |
991b93 |
#
|
|
Packit Service |
991b93 |
# GnuTLS is free software; you can redistribute it and/or modify it
|
|
Packit Service |
991b93 |
# under the terms of the GNU General Public License as published by the
|
|
Packit Service |
991b93 |
# Free Software Foundation; either version 3 of the License, or (at
|
|
Packit Service |
991b93 |
# your option) any later version.
|
|
Packit Service |
991b93 |
#
|
|
Packit Service |
991b93 |
# GnuTLS is distributed in the hope that it will be useful, but
|
|
Packit Service |
991b93 |
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
Packit Service |
991b93 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
Packit Service |
991b93 |
# General Public License for more details.
|
|
Packit Service |
991b93 |
#
|
|
Packit Service |
991b93 |
# You should have received a copy of the GNU Lesser General Public License
|
|
Packit Service |
991b93 |
# along with this program. If not, see <https://www.gnu.org/licenses/>
|
|
Packit Service |
991b93 |
#
|
|
Packit Service |
991b93 |
|
|
Packit Service |
991b93 |
srcdir="${srcdir:-.}"
|
|
Packit Service |
991b93 |
SERV="${SERV:-../src/gnutls-serv${EXEEXT}}"
|
|
Packit Service |
991b93 |
CLI="${CLI:-../src/gnutls-cli${EXEEXT}}"
|
|
Packit Service |
991b93 |
TMPFILE=config.$$.tmp
|
|
Packit Service |
991b93 |
export GNUTLS_SYSTEM_PRIORITY_FAIL_ON_INVALID=1
|
|
Packit Service |
991b93 |
|
|
Packit Service |
991b93 |
if ! test -x "${SERV}"; then
|
|
Packit Service |
991b93 |
exit 77
|
|
Packit Service |
991b93 |
fi
|
|
Packit Service |
991b93 |
|
|
Packit Service |
991b93 |
if ! test -x "${CLI}"; then
|
|
Packit Service |
991b93 |
exit 77
|
|
Packit Service |
991b93 |
fi
|
|
Packit Service |
991b93 |
|
|
Packit Service |
991b93 |
if test "${WINDIR}" != ""; then
|
|
Packit Service |
991b93 |
exit 77
|
|
Packit Service |
991b93 |
fi
|
|
Packit Service |
991b93 |
|
|
Packit Service |
991b93 |
. "${srcdir}/scripts/common.sh"
|
|
Packit Service |
991b93 |
|
|
Packit Service |
991b93 |
check_for_datefudge
|
|
Packit Service |
991b93 |
|
|
Packit Service |
991b93 |
CERT="${srcdir}/certs/cert-ecc256.pem"
|
|
Packit Service |
991b93 |
KEY="${srcdir}/certs/ecc256.pem"
|
|
Packit Service |
991b93 |
|
|
Packit Service |
991b93 |
eval "${GETPORT}"
|
|
Packit Service |
991b93 |
launch_server $$ --echo --priority "NORMAL:+SHA256" --x509keyfile ${KEY} --x509certfile ${CERT}
|
|
Packit Service |
991b93 |
PID=$!
|
|
Packit Service |
991b93 |
wait_server ${PID}
|
|
Packit Service |
991b93 |
|
|
Packit Service |
991b93 |
#successful case, test whether the ciphers we disable below work
|
|
Packit Service |
991b93 |
echo "Sanity testing"
|
|
Packit Service |
991b93 |
|
|
Packit Service |
991b93 |
datefudge "2017-11-22" \
|
|
Packit Service |
991b93 |
"${CLI}" -p "${PORT}" 127.0.0.1 --priority NORMAL:-CIPHER-ALL:+AES-128-GCM:-GROUP-ALL:+GROUP-FFDHE2048 --verify-hostname localhost --x509cafile "${srcdir}/certs/ca-cert-ecc.pem" </dev/null >/dev/null ||
|
|
Packit Service |
991b93 |
fail ${PID} "stage1: expected connection to succeed (1)"
|
|
Packit Service |
991b93 |
|
|
Packit Service |
991b93 |
datefudge "2017-11-22" \
|
|
Packit Service |
991b93 |
"${CLI}" -p "${PORT}" 127.0.0.1 --priority NORMAL:-VERS-ALL:+VERS-TLS1.2:-CIPHER-ALL:+AES-128-CBC:+AES-256-CBC:-MAC-ALL:+SHA1 --verify-hostname localhost --x509cafile "${srcdir}/certs/ca-cert-ecc.pem" </dev/null >/dev/null ||
|
|
Packit Service |
991b93 |
fail ${PID} "stage1: expected connection to succeed (2)"
|
|
Packit Service |
991b93 |
|
|
Packit Service |
991b93 |
cat <<_EOF_ > ${TMPFILE}
|
|
Packit Service |
991b93 |
[overrides]
|
|
Packit Service |
991b93 |
|
|
Packit Service |
991b93 |
tls-disabled-cipher = aes-128-gcm
|
|
Packit Service |
991b93 |
tls-disabled-cipher = aes-128-cbc
|
|
Packit Service |
991b93 |
tls-disabled-mac = sha1
|
|
Packit Service |
991b93 |
tls-disabled-group = group-ffdhe2048
|
|
Packit Service |
991b93 |
_EOF_
|
|
Packit Service |
991b93 |
|
|
Packit Service |
991b93 |
GNUTLS_SYSTEM_PRIORITY_FILE=${TMPFILE}
|
|
Packit Service |
991b93 |
export GNUTLS_DEBUG_LEVEL=3
|
|
Packit Service |
991b93 |
export GNUTLS_SYSTEM_PRIORITY_FILE
|
|
Packit Service |
991b93 |
|
|
Packit Service |
991b93 |
echo "Testing TLS1.3"
|
|
Packit Service |
991b93 |
echo " * sanity"
|
|
Packit Service |
991b93 |
datefudge "2017-11-22" \
|
|
Packit Service |
991b93 |
"${CLI}" -p "${PORT}" 127.0.0.1 --priority NORMAL --verify-hostname localhost --x509cafile "${srcdir}/certs/ca-cert-ecc.pem" </dev/null >/dev/null ||
|
|
Packit Service |
991b93 |
fail ${PID} "stage2: expected connection to succeed (1)"
|
|
Packit Service |
991b93 |
|
|
Packit Service |
991b93 |
echo " * fallback to good options"
|
|
Packit Service |
991b93 |
datefudge "2017-11-22" \
|
|
Packit Service |
991b93 |
"${CLI}" -p "${PORT}" 127.0.0.1 --priority NORMAL:-CIPHER-ALL:+AES-128-GCM:+AES-256-GCM:-GROUP-ALL:+GROUP-FFDHE2048:+GROUP-FFDHE3072 --verify-hostname localhost --x509cafile "${srcdir}/certs/ca-cert-ecc.pem" </dev/null >/dev/null ||
|
|
Packit Service |
991b93 |
fail ${PID} "stage2: expected connection to succeed (2)"
|
|
Packit Service |
991b93 |
|
|
Packit Service |
991b93 |
echo " * disabled cipher"
|
|
Packit Service |
991b93 |
datefudge "2017-11-22" \
|
|
Packit Service |
991b93 |
"${CLI}" -p "${PORT}" 127.0.0.1 --priority NORMAL:-CIPHER-ALL:+AES-128-GCM --verify-hostname localhost --x509cafile "${srcdir}/certs/ca-cert-ecc.pem" </dev/null && #>/dev/null &&
|
|
Packit Service |
991b93 |
fail ${PID} "stage2: expected connection to fail (1)"
|
|
Packit Service |
991b93 |
|
|
Packit Service |
991b93 |
echo " * disabled group"
|
|
Packit Service |
991b93 |
datefudge "2017-11-22" \
|
|
Packit Service |
991b93 |
"${CLI}" -p "${PORT}" 127.0.0.1 --priority NORMAL:-GROUP-ALL:+GROUP-FFDHE2048 --verify-hostname localhost --x509cafile "${srcdir}/certs/ca-cert-ecc.pem" </dev/null >/dev/null &&
|
|
Packit Service |
991b93 |
fail ${PID} "stage2: expected connection to fail (2)"
|
|
Packit Service |
991b93 |
|
|
Packit Service |
991b93 |
echo "Testing TLS1.2"
|
|
Packit Service |
991b93 |
echo " * sanity"
|
|
Packit Service |
991b93 |
datefudge "2017-11-22" \
|
|
Packit Service |
991b93 |
"${CLI}" -p "${PORT}" 127.0.0.1 --priority NORMAL:-VERS-ALL:+VERS-TLS1.2 --verify-hostname localhost --x509cafile "${srcdir}/certs/ca-cert-ecc.pem" </dev/null >/dev/null ||
|
|
Packit Service |
991b93 |
fail ${PID} "stage3: expected connection to succeed (1)"
|
|
Packit Service |
991b93 |
|
|
Packit Service |
991b93 |
echo " * fallback to good options"
|
|
Packit Service |
991b93 |
datefudge "2017-11-22" \
|
|
Packit Service |
991b93 |
"${CLI}" -p "${PORT}" 127.0.0.1 --priority NORMAL:-VERS-ALL:+VERS-TLS1.2:-CIPHER-ALL:+AES-128-CBC:+AES-256-CBC:+AES-256-GCM:-MAC-ALL:+SHA1:+AEAD --verify-hostname localhost --x509cafile "${srcdir}/certs/ca-cert-ecc.pem" </dev/null >/dev/null ||
|
|
Packit Service |
991b93 |
fail ${PID} "stage3: expected connection to succeed (2)"
|
|
Packit Service |
991b93 |
|
|
Packit Service |
991b93 |
echo " * disabled cipher"
|
|
Packit Service |
991b93 |
datefudge "2017-11-22" \
|
|
Packit Service |
991b93 |
"${CLI}" -p "${PORT}" 127.0.0.1 --priority NORMAL:-VERS-ALL:+VERS-TLS1.2:-CIPHER-ALL:+AES-128-CBC --verify-hostname localhost --x509cafile "${srcdir}/certs/ca-cert-ecc.pem" </dev/null >/dev/null &&
|
|
Packit Service |
991b93 |
fail ${PID} "stage3: expected connection to fail (1)"
|
|
Packit Service |
991b93 |
|
|
Packit Service |
991b93 |
echo " * disabled MAC"
|
|
Packit Service |
991b93 |
datefudge "2017-11-22" \
|
|
Packit Service |
991b93 |
"${CLI}" -p "${PORT}" 127.0.0.1 --priority NORMAL:-VERS-ALL:+VERS-TLS1.2:-MAC-ALL:+SHA1 --verify-hostname localhost --x509cafile "${srcdir}/certs/ca-cert-ecc.pem" </dev/null >/dev/null &&
|
|
Packit Service |
991b93 |
fail ${PID} "stage3: expected connection to fail (2)"
|
|
Packit Service |
991b93 |
|
|
Packit Service |
991b93 |
|
|
Packit Service |
991b93 |
kill ${PID}
|
|
Packit Service |
991b93 |
wait
|
|
Packit Service |
991b93 |
|
|
Packit Service |
991b93 |
rm -f ${TMPFILE}
|
|
Packit Service |
991b93 |
|
|
Packit Service |
991b93 |
exit 0
|