10e8195d5Sbluhm# The syslogd listens on localhost TLS socket.
20e8195d5Sbluhm# The client writes a message into a localhost TLS socket.
30e8195d5Sbluhm# The syslogd writes it into a file and through a pipe.
40e8195d5Sbluhm# The syslogd passes it via UDP to the loghost.
50e8195d5Sbluhm# The server receives the message on its UDP socket.
60e8195d5Sbluhm# Find the message in client, file, pipe, syslogd, server log.
70e8195d5Sbluhm# Check that the file log contains the hostname and message.
80e8195d5Sbluhm
90e8195d5Sbluhmuse strict;
100e8195d5Sbluhmuse warnings;
110e8195d5Sbluhmuse Socket;
120e8195d5Sbluhm
130e8195d5Sbluhmour %args = (
140e8195d5Sbluhm    client => {
150e8195d5Sbluhm	connect => { domain => AF_UNSPEC, proto => "tls", addr => "localhost",
160e8195d5Sbluhm	    port => 6514 },
170e8195d5Sbluhm	loggrep => {
180e8195d5Sbluhm	    qr/connect sock: (127.0.0.1|::1) \d+/ => 1,
190e8195d5Sbluhm	    get_testgrep() => 1,
200e8195d5Sbluhm	},
210e8195d5Sbluhm    },
220e8195d5Sbluhm    syslogd => {
230e8195d5Sbluhm	options => ["-S", "localhost"],
240e8195d5Sbluhm	fstat => {
250e8195d5Sbluhm	    qr/^root .* internet/ => 0,
260e8195d5Sbluhm	    qr/ internet6? stream tcp \w+ (127.0.0.1|\[::1\]):6514$/ => 1,
270e8195d5Sbluhm	},
280e8195d5Sbluhm	ktrace => {
290e8195d5Sbluhm	    qr{NAMI  "/etc/ssl/private/localhost.key"} => 1,
300e8195d5Sbluhm	    qr{NAMI  "/etc/ssl/localhost.crt"} => 1,
310e8195d5Sbluhm	},
320e8195d5Sbluhm	loggrep => {
330e8195d5Sbluhm	    qr{Keyfile /etc/ssl/private/localhost.key} => 1,
340e8195d5Sbluhm	    qr{Certfile /etc/ssl/localhost.crt} => 1,
35*7c3cb5daSbluhm	    qr/Accepting tcp connection/ => 1,
368579df47Sbluhm	    qr/syslogd\[\d+\]: tls logger .* accepted/ => 1,
37*7c3cb5daSbluhm	    qr/Completed tls handshake/ => 1,
388579df47Sbluhm	    qr/syslogd\[\d+\]: tls logger .* connection close/ => 1,
390e8195d5Sbluhm	},
400e8195d5Sbluhm    },
410e8195d5Sbluhm    file => {
420e8195d5Sbluhm	loggrep => {
430e8195d5Sbluhm	    qr/ localhost /. get_testgrep() => 1,
440e8195d5Sbluhm	},
450e8195d5Sbluhm    },
460e8195d5Sbluhm);
470e8195d5Sbluhm
480e8195d5Sbluhm1;
49