1# The syslogd listens on localhost TLS socket with false client verification.
2# The client connects with a wrong client certificate.
3# The syslogd writes error into a file and through a pipe.
4# The syslogd passes error via UDP to the loghost.
5# The server receives the error message on its UDP socket.
6# Find the error message in client, file, syslogd, server log.
7# Check that the syslogd rejects client.
8
9use strict;
10use warnings;
11use Socket;
12
13our %args = (
14    client => {
15	connect => { domain => AF_UNSPEC, proto => "tls", addr => "localhost",
16	    port => 6514 },
17	sslcert => "client.crt",
18	sslkey => "client.key",
19	up => qr/IO::Socket::SSL socket connect failed/,
20	down => qr/SSL connect attempt failed/,
21	exit => 255,
22	loggrep => {
23	    qr/Client IO::Socket::SSL socket connect failed: /.
24		qr/,SSL connect attempt failed /.
25		qr/because of handshake problems error:/ => 1,
26	},
27    },
28    syslogd => {
29	options => ["-S", "localhost", "-K", "fake-ca.crt"],
30	ktrace => {
31	    qr{NAMI  "fake-ca.crt"} => 1,
32	},
33	loggrep => {
34	    qr{Server CAfile fake-ca.crt} => 1,
35	    qr{tls logger .* accepted} => 1,
36	    qr/syslogd: tls logger .* connection error: /.
37		qr/handshake failed: error:.*RSA_/ => 1,
38	},
39    },
40    server => {
41	func => sub {
42	    my $self = shift;
43	    read_message($self, qr/syslogd: tls logger .* connection error/);
44	},
45	loggrep => {},
46    },
47    file => {
48	loggrep => {
49	    qr/syslogd: tls logger .* connection error: handshake failed/ => 1,
50	},
51    },
52    pipe => { nocheck => 1, },
53    tty => { nocheck => 1, },
54);
55
561;
57