1# Syslogd gets no TLS server key.
2# The client cannot connect to 127.0.0.1 TLS socket.
3# Check that syslog log contains an error message.
4
5use strict;
6use warnings;
7use Socket;
8
9my $key = "/etc/ssl/private/127.0.0.1.key";
10my @sudo = $ENV{SUDO} ? $ENV{SUDO} : ();
11my @cmd = (@sudo, "rm", "-f", "--", $key);
12system(@cmd) and die "Command '@cmd' failed: $?";
13END {
14    local $?;
15    my @cmd = (@sudo, "cp", "--", "127.0.0.1.key", $key);
16    system(@cmd) and warn "Command '@cmd' failed: $?";
17}
18
19our %args = (
20    client => {
21	func => sub {
22	    my $self = shift;
23	    IO::Socket::IP->new(
24		Domain              => AF_INET,
25		Proto               => "tcp",
26		PeerAddr            => "127.0.0.1",
27		PeerPort            => 6514,
28	    ) and die "tcp socket connect to 127.0.0.1:6514 succeeded";
29	},
30	nocheck => 1,
31    },
32    syslogd => {
33	options => ["-S", "127.0.0.1:6514"],
34	ktrace => {
35	    qr{NAMI  "/etc/ssl/private/127.0.0.1:6514.key"} => 1,
36	    qr{NAMI  "/etc/ssl/127.0.0.1:6514.crt"} => 0,
37	    qr{NAMI  "/etc/ssl/private/127.0.0.1.key"} => 1,
38	    qr{NAMI  "/etc/ssl/127.0.0.1.crt"} => 0,
39	},
40	loggrep => {
41	    qr{Keyfile } => 0,
42	    qr{Certfile } => 0,
43	    qr{load server TLS key: failed to open key file} => 2,
44	    qr{tls_configure server: private/public key mismatch} => 1,
45	},
46    },
47    server => {
48	noserver => 1,
49    },
50    file => { nocheck => 1 },
51    pipe => { nocheck => 1 },
52    tty => { nocheck => 1 },
53);
54
551;
56