|
Packit Service |
4684c1 |
#!/bin/sh
|
|
Packit Service |
4684c1 |
|
|
Packit Service |
4684c1 |
# Copyright (C) 2019 Red Hat, Inc.
|
|
Packit Service |
4684c1 |
#
|
|
Packit Service |
4684c1 |
# Author: Nikos Mavrogiannopoulos
|
|
Packit Service |
4684c1 |
#
|
|
Packit Service |
4684c1 |
# This file is part of GnuTLS.
|
|
Packit Service |
4684c1 |
#
|
|
Packit Service |
4684c1 |
# GnuTLS is free software; you can redistribute it and/or modify it
|
|
Packit Service |
4684c1 |
# under the terms of the GNU General Public License as published by the
|
|
Packit Service |
4684c1 |
# Free Software Foundation; either version 3 of the License, or (at
|
|
Packit Service |
4684c1 |
# your option) any later version.
|
|
Packit Service |
4684c1 |
#
|
|
Packit Service |
4684c1 |
# GnuTLS is distributed in the hope that it will be useful, but
|
|
Packit Service |
4684c1 |
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
Packit Service |
4684c1 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
Packit Service |
4684c1 |
# General Public License for more details.
|
|
Packit Service |
4684c1 |
#
|
|
Packit Service |
4684c1 |
# You should have received a copy of the GNU Lesser General Public License
|
|
Packit Service |
4684c1 |
# along with this program. If not, see <https://www.gnu.org/licenses/>
|
|
Packit Service |
4684c1 |
#
|
|
Packit Service |
4684c1 |
|
|
Packit Service |
4684c1 |
srcdir="${srcdir:-.}"
|
|
Packit Service |
4684c1 |
SERV="${SERV:-../src/gnutls-serv${EXEEXT}}"
|
|
Packit Service |
4684c1 |
CLI="${CLI:-../src/gnutls-cli${EXEEXT}}"
|
|
Packit Service |
4684c1 |
TMPFILE=config.$$.tmp
|
|
Packit Service |
4684c1 |
TMPFILE2=log.$$.tmp
|
|
Packit Service |
4684c1 |
export GNUTLS_SYSTEM_PRIORITY_FAIL_ON_INVALID=1
|
|
Packit Service |
4684c1 |
|
|
Packit Service |
4684c1 |
if ! test -x "${SERV}"; then
|
|
Packit Service |
4684c1 |
exit 77
|
|
Packit Service |
4684c1 |
fi
|
|
Packit Service |
4684c1 |
|
|
Packit Service |
4684c1 |
if ! test -x "${CLI}"; then
|
|
Packit Service |
4684c1 |
exit 77
|
|
Packit Service |
4684c1 |
fi
|
|
Packit Service |
4684c1 |
|
|
Packit Service |
4684c1 |
if test "${WINDIR}" != ""; then
|
|
Packit Service |
4684c1 |
exit 77
|
|
Packit Service |
4684c1 |
fi
|
|
Packit Service |
4684c1 |
|
|
Packit Service |
4684c1 |
. "${srcdir}/scripts/common.sh"
|
|
Packit Service |
4684c1 |
|
|
Packit Service |
4684c1 |
check_for_datefudge
|
|
Packit Service |
4684c1 |
|
|
Packit Service |
4684c1 |
CERT="${srcdir}/certs/cert-ecc256.pem"
|
|
Packit Service |
4684c1 |
KEY="${srcdir}/certs/ecc256.pem"
|
|
Packit Service |
4684c1 |
|
|
Packit Service |
4684c1 |
eval "${GETPORT}"
|
|
Packit Service |
4684c1 |
launch_server $$ --echo --priority "NORMAL" --x509keyfile ${KEY} --x509certfile ${CERT}
|
|
Packit Service |
4684c1 |
PID=$!
|
|
Packit Service |
4684c1 |
wait_server ${PID}
|
|
Packit Service |
4684c1 |
|
|
Packit Service |
4684c1 |
# successful case, 224 bit min-profile, 256 bit key
|
|
Packit Service |
4684c1 |
cat <<_EOF_ > ${TMPFILE}
|
|
Packit Service |
4684c1 |
[overrides]
|
|
Packit Service |
4684c1 |
|
|
Packit Service |
4684c1 |
# 224 bits
|
|
Packit Service |
4684c1 |
min-verification-profile=medium
|
|
Packit Service |
4684c1 |
_EOF_
|
|
Packit Service |
4684c1 |
|
|
Packit Service |
4684c1 |
export GNUTLS_DEBUG_LEVEL=3
|
|
Packit Service |
4684c1 |
unset GNUTLS_SYSTEM_PRIORITY_FILE
|
|
Packit Service |
4684c1 |
|
|
Packit Service |
4684c1 |
datefudge "2017-11-22" \
|
|
Packit Service |
4684c1 |
"${CLI}" -p "${PORT}" 127.0.0.1 --priority NORMAL --verify-hostname localhost --x509cafile "${srcdir}/certs/ca-cert-ecc.pem" --logfile ${TMPFILE2} </dev/null >/dev/null ||
|
|
Packit Service |
4684c1 |
fail "expected connection to succeed (1)"
|
|
Packit Service |
4684c1 |
|
|
Packit Service |
4684c1 |
export GNUTLS_SYSTEM_PRIORITY_FILE="${TMPFILE}"
|
|
Packit Service |
4684c1 |
|
|
Packit Service |
4684c1 |
datefudge "2017-11-22" \
|
|
Packit Service |
4684c1 |
"${CLI}" -p "${PORT}" 127.0.0.1 --priority NORMAL:%PROFILE_LOW --verify-hostname localhost --x509cafile "${srcdir}/certs/ca-cert-ecc.pem" --logfile ${TMPFILE2} </dev/null >/dev/null ||
|
|
Packit Service |
4684c1 |
fail "expected connection to succeed (2)"
|
|
Packit Service |
4684c1 |
|
|
Packit Service |
4684c1 |
datefudge "2017-11-22" \
|
|
Packit Service |
4684c1 |
"${CLI}" -p "${PORT}" 127.0.0.1 --priority NORMAL:%PROFILE_MEDIUM --verify-hostname localhost --x509cafile "${srcdir}/certs/ca-cert-ecc.pem" --logfile ${TMPFILE2} </dev/null >/dev/null ||
|
|
Packit Service |
4684c1 |
fail "expected connection to succeed (3)"
|
|
Packit Service |
4684c1 |
|
|
Packit Service |
4684c1 |
# failure case, 384 bit min-profile, 256 bit key
|
|
Packit Service |
4684c1 |
cat <<_EOF_ > ${TMPFILE}
|
|
Packit Service |
4684c1 |
[overrides]
|
|
Packit Service |
4684c1 |
|
|
Packit Service |
4684c1 |
min-verification-profile=ultra
|
|
Packit Service |
4684c1 |
_EOF_
|
|
Packit Service |
4684c1 |
|
|
Packit Service |
4684c1 |
unset GNUTLS_SYSTEM_PRIORITY_FILE
|
|
Packit Service |
4684c1 |
|
|
Packit Service |
4684c1 |
datefudge "2017-11-22" \
|
|
Packit Service |
4684c1 |
"${CLI}" -p "${PORT}" 127.0.0.1 --priority NORMAL --verify-hostname localhost --x509cafile "${srcdir}/certs/ca-cert-ecc.pem" --logfile ${TMPFILE2} </dev/null >/dev/null ||
|
|
Packit Service |
4684c1 |
fail "expected connection to succeed (1)"
|
|
Packit Service |
4684c1 |
|
|
Packit Service |
4684c1 |
export GNUTLS_SYSTEM_PRIORITY_FILE="${TMPFILE}"
|
|
Packit Service |
4684c1 |
|
|
Packit Service |
4684c1 |
datefudge "2017-11-22" \
|
|
Packit Service |
4684c1 |
"${CLI}" -p "${PORT}" 127.0.0.1 --priority NORMAL:%PROFILE_LOW --verify-hostname localhost --x509cafile "${srcdir}/certs/ca-cert-ecc.pem" --logfile ${TMPFILE2} </dev/null >/dev/null &&
|
|
Packit Service |
4684c1 |
fail "expected connection to fail (1)"
|
|
Packit Service |
4684c1 |
|
|
Packit Service |
4684c1 |
datefudge "2017-11-22" \
|
|
Packit Service |
4684c1 |
"${CLI}" -p "${PORT}" 127.0.0.1 --priority NORMAL:%PROFILE_MEDIUM --verify-hostname localhost --x509cafile "${srcdir}/certs/ca-cert-ecc.pem" --logfile ${TMPFILE2} </dev/null >/dev/null &&
|
|
Packit Service |
4684c1 |
fail "expected connection to fail (2)"
|
|
Packit Service |
4684c1 |
|
|
Packit Service |
4684c1 |
kill ${PID}
|
|
Packit Service |
4684c1 |
wait
|
|
Packit Service |
4684c1 |
|
|
Packit Service |
4684c1 |
exit 0
|