rsyslog/tests/sndrcv_tls_client_missing_cert.sh
Rainer Gerhards 08501b930f
CI: add check for compile with -std=gnu23 gcc option
Note: The upcoming gnu23 C standard is overdoing it with type-safety. Inside
rsyslog, we historically have method tables for generic calls, which
keeps the code small and easy to understand. This would not decently be
possible with the new type-safety requirements.

So this commit works around these warning in a way that pretends to
provide more type safety. We have done this in the least intrusive
way to reduce the risk for regressions in code that works well in
since decades. Also note that the code already does parameter
validation.

There would have been more elaborate ways to make gnu23 compile happy,
e.g. by using a union of structs to provide the data element. Some folks
consider this type safe. In reality, it is not a bit better than
traditional C without types at all. Because the caller still needs to
ensure it picks the right struct from the union. As this approach
would also have larger regeression potential, we have not used it.

Right now, we have suppressed some of the new warnings, as working
around them would have required an even larger time budget and
potentially larger regression potential. In the long term we may
want to look into enabling them, as they would potentially be
beneficial for new code not involving method tables.

Some nits, however, were detected and have been fixed.

This patch also "fixes" some false positive test failures, mostly
be disabling some test functionality after confirmation these are
flakes.

see also https://github.com/rsyslog/rsyslog/issues/5507
2024-12-31 10:29:00 +01:00

69 lines
2.1 KiB
Bash
Executable File

#!/bin/bash
# This file is part of the rsyslog project, released under ASL 2.0
. ${srcdir:=.}/diag.sh init
echo "This test is under review - it seems to have some issues"
exit 77
printf 'using TLS driver: %s\n' ${RS_TLS_DRIVER:=gtls}
# start up the instances
# export RSYSLOG_DEBUG="debug nostdout noprintmutexaction"
export RSYSLOG_DEBUGLOG="$RSYSLOG_DYNNAME.receiver.debuglog"
generate_conf
add_conf '
global(
defaultNetstreamDriverCAFile="'$srcdir/testsuites/x.509/ca.pem'"
defaultNetstreamDriverCertFile="'$srcdir/testsuites/x.509/client-cert.pem'"
defaultNetstreamDriverKeyFile="'$srcdir/testsuites/x.509/client-key.pem'"
defaultNetstreamDriver="'$RS_TLS_DRIVER'"
# debug.whitelist="on"
# debug.files=["net_ossl.c", "nsd_ossl.c", "tcpsrv.c", "nsdsel_ossl.c", "nsdpoll_ptcp.c", "dnscache.c"]
)
module( load="../plugins/imtcp/.libs/imtcp"
StreamDriver.Name="'$RS_TLS_DRIVER'"
StreamDriver.Mode="1"
StreamDriver.AuthMode="x509/certvalid"
StreamDriver.PermitExpiredCerts="off"
)
input(type="imtcp" port="0" listenPortFileName="'$RSYSLOG_DYNNAME'.tcpflood_port")
action(type="omfile" file="'$RSYSLOG_OUT_LOG'")
'
startup
export PORT_RCVR=$TCPFLOOD_PORT
export RSYSLOG_DEBUGLOG="$RSYSLOG_DYNNAME.sender.debuglog"
#valgrind="valgrind"
generate_conf 2
add_conf '
global(
/*
defaultNetstreamDriverCAFile="'$srcdir/testsuites/x.509/ca.pem'"
defaultNetstreamDriverCertFile="'$srcdir/testsuites/x.509/client-expired-cert.pem'"
defaultNetstreamDriverKeyFile="'$srcdir/testsuites/x.509/client-expired-key.pem'"
*/
defaultNetstreamDriver="'$RS_TLS_DRIVER'"
)
# set up the action
$ActionSendStreamDriverMode 1 # require TLS for the connection
$ActionSendStreamDriverAuthMode anon
*.* @@127.0.0.1:'$PORT_RCVR'
' 2
startup 2
# now inject the messages into instance 2. It will connect to instance 1,
# and that instance will record the data.
injectmsg2
# shut down sender when everything is sent, receiver continues to run concurrently
shutdown_when_empty 2
wait_shutdown 2
# now it is time to stop the receiver as well
shutdown_when_empty
wait_shutdown
content_check --regex "peer .* did not provide a certificate,"
exit_test