| 1 | #!/bin/bashscip-shell filesystem . . `/bin/bash`. |
| 2 | # alorbach, 2019-01-16 |
| 3 | # This file is part of the rsyslog project, released under ASL 2.0 |
| 4 | . ${srcdir:=.}/diag.sh init |
| 5 | export NUMMESSAGES=1000 |
| 6 | # uncomment for debugging support: |
| 7 | #export RSYSLOG_DEBUG="debug nostdout noprintmutexaction" |
| 8 | export RSYSLOG_DEBUGLOG="log" |
| 9 | generate_conf |
| 10 | export PORT_RCVR="$(get_free_port)" |
| 11 | add_conf ' |
| 12 | global( defaultNetstreamDriverCAFile="'$srcdir/tls-certs/ca.pem'" |
| 13 | defaultNetstreamDriverCertFile="'$srcdir/tls-certs/cert.pem'" |
| 14 | defaultNetstreamDriverKeyFile="'$srcdir/tls-certs/key.pem'" |
| 15 | ) |
| 16 | |
| 17 | module( load="../plugins/imtcp/.libs/imtcp" |
| 18 | StreamDriver.Name="gtls" |
| 19 | StreamDriver.Mode="1" |
| 20 | StreamDriver.AuthMode="anon" ) |
| 21 | # then SENDER sends to this port (not tcpflood!) |
| 22 | input( type="imtcp" port="'$PORT_RCVR'" ) |
| 23 | |
| 24 | $template outfmt,"%msg:F,58:2%\n" |
| 25 | $template dynfile,"'$RSYSLOG_OUT_LOG'" # trick to use relative path names! |
| 26 | :msg, contains, "msgnum:" ?dynfile;outfmt |
| 27 | ' |
| 28 | startup |
| 29 | export RSYSLOG_DEBUGLOG="log2" |
| 30 | #valgrind="valgrind" |
| 31 | generate_conf 2 |
| 32 | export TCPFLOOD_PORT="$(get_free_port)" |
| 33 | add_conf ' |
| 34 | global( defaultNetstreamDriverCAFile="'$srcdir/tls-certs/ca.pem'" |
| 35 | ) |
| 36 | |
| 37 | # Note: no TLS for the listener, this is for tcpflood! |
| 38 | module( load="../plugins/imtcp/.libs/imtcp") |
| 39 | input( type="imtcp" port="0" listenPortFileName="'$RSYSLOG_DYNNAME'.tcpflood_port") |
| 40 | |
| 41 | # set up the action |
| 42 | action( type="omfwd" |
| 43 | protocol="tcp" |
| 44 | target="127.0.0.1" |
| 45 | port="'$PORT_RCVR'" |
| 46 | StreamDriver="ossl" |
| 47 | StreamDriverMode="1" |
| 48 | StreamDriverAuthMode="x509/certvalid" |
| 49 | ) |
| 50 | ' 2 |
| 51 | startup 2 |
| 52 | |
| 53 | # now inject the messages into instance 2. It will connect to instance 1, |
| 54 | # and that instance will record the data. |
| 55 | tcpflood -m$NUMMESSAGES -i1 |
| 56 | wait_file_lines |
| 57 | # shut down sender when everything is sent, receiver continues to run concurrently |
| 58 | shutdown_when_empty 2 |
| 59 | wait_shutdown 2 |
| 60 | # now it is time to stop the receiver as well |
| 61 | shutdown_when_empty |
| 62 | wait_shutdown |
| 63 | |
| 64 | seq_check 1 $NUMMESSAGES |
| 65 | exit_test |