1# The client writes a message to Sys::Syslog native method. 2# The syslogd writes it into a file and through a pipe. 3# The syslogd passes it via TLS with client certificate to the loghost. 4# The server tries to verify the connection to its TLS socket with wrong ca. 5# Find the message in client, file, pipe, syslogd log. 6# Check that syslogd and server have error message in log. 7 8use strict; 9use warnings; 10use Errno ':POSIX'; 11use Socket; 12 13my @errors = (EPIPE, ECONNRESET); 14my $errors = "(". join("|", map { $! = $_ } @errors). 15 "|tlsv1 alert decrypt error)"; 16 17our %args = ( 18 syslogd => { 19 options => [qw(-c client.crt -k client.key)], 20 loghost => '@tls://localhost:$connectport', 21 loggrep => { 22 qr/ClientCertfile client.crt/ => 1, 23 qr/ClientKeyfile client.key/ => 1, 24 qr/syslogd\[\d+\]: loghost .* connection error: .*$errors/ => 1, 25 get_testgrep() => 1, 26 }, 27 }, 28 server => { 29 listen => { domain => AF_UNSPEC, proto => "tls", addr => "localhost" }, 30 sslca => "fake-ca.crt", 31 up => qr/IO::Socket::SSL socket accept failed/, 32 down => qr/SSL accept attempt failed error/, 33 exit => 255, 34 loggrep => { 35 qr/Server IO::Socket::SSL socket accept failed: /. 36 qr/.*certificate verify failed/ => 1. 37 }, 38 }, 39); 40 411; 42