161ffb8b2Sbluhm# The client writes a message to Sys::Syslog native method.
261ffb8b2Sbluhm# The syslogd writes it into a file and through a pipe.
361ffb8b2Sbluhm# The syslogd passes it via TLS to localhost loghost.
461ffb8b2Sbluhm# The cafile is the system default which has no matching cert.
561ffb8b2Sbluhm# Find the message in client, file, pipe, syslogd log.
661ffb8b2Sbluhm# Check that syslogd has verify failure and server has no message.
761ffb8b2Sbluhm
861ffb8b2Sbluhmuse strict;
961ffb8b2Sbluhmuse warnings;
10cee623ccSbluhmuse Errno ':POSIX';
1161ffb8b2Sbluhmuse Socket;
1261ffb8b2Sbluhm
13cee623ccSbluhmmy @errors = (EPIPE);
14cee623ccSbluhmmy $errors = "(". join("|", map { $! = $_ } @errors). ")";
15cee623ccSbluhm
1661ffb8b2Sbluhmour %args = (
1761ffb8b2Sbluhm    syslogd => {
1861ffb8b2Sbluhm	loghost => '@tls://localhost:$connectport',
190e8195d5Sbluhm	ktrace => {
20c733f1fdSbluhm	    qr{NAMI  "/etc/ssl/cert.pem"} => 1,
210e8195d5Sbluhm	},
2261ffb8b2Sbluhm	loggrep => {
230e8195d5Sbluhm	    qr{CAfile /etc/ssl/cert.pem} => 1,
2461ffb8b2Sbluhm	    qr/Logging to FORWTLS \@tls:\/\/localhost:\d+/ => '>=4',
258579df47Sbluhm	    qr/syslogd\[\d+\]: loghost .* connection error: /.
26e53c8955Sbluhm		qr/certificate verification failed: /.
27de6b6ac4Sbluhm		qr/self signed certificate in certificate chain/ => 1,
28bb7ea376Sbluhm	    get_testgrep() => 1,
2961ffb8b2Sbluhm	},
3061ffb8b2Sbluhm	cacrt => "default",
3161ffb8b2Sbluhm    },
3261ffb8b2Sbluhm    server => {
3361ffb8b2Sbluhm	listen => { domain => AF_UNSPEC, proto => "tls", addr => "localhost" },
3461ffb8b2Sbluhm	up => "IO::Socket::SSL socket accept failed",
3561ffb8b2Sbluhm	down => "Server",
3661ffb8b2Sbluhm	exit => 255,
3761ffb8b2Sbluhm	loggrep => {
3861ffb8b2Sbluhm	    qr/listen sock: (127.0.0.1|::1) \d+/ => 1,
39cee623ccSbluhm	    qr/IO::Socket::SSL socket accept failed: /.
40cee623ccSbluhm		qr/.*,SSL accept attempt failed error:.*/.
41*dd3c1892Sbluhm		qr/(ACCEPT_SR_FINISHED:tlsv1 alert unknown ca|$errors)/ => 1,
42bb7ea376Sbluhm	    get_testgrep() => 0,
4361ffb8b2Sbluhm	},
4461ffb8b2Sbluhm    },
4561ffb8b2Sbluhm);
4661ffb8b2Sbluhm
4761ffb8b2Sbluhm1;
48