summaryrefslogtreecommitdiff
path: root/regress/usr.sbin/syslogd/args-client-tls-fake.pl
blob: 5ece99184d351a379feffe38c14af03e8d6e7e81 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# The syslogd listens on localhost TLS socket with false client verification.
# The client connects with a wrong client certificate.
# The syslogd writes error into a file and through a pipe.
# The syslogd passes error via UDP to the loghost.
# The server receives the error message on its UDP socket.
# Find the error message in client, file, syslogd, server log.
# Check that the syslogd rejects client.

use strict;
use warnings;
use Socket;

our %args = (
    client => {
	connect => { domain => AF_UNSPEC, proto => "tls", addr => "localhost",
	    port => 6514 },
	sslcert => "client.crt",
	sslkey => "client.key",
	up => qr/IO::Socket::SSL socket connect failed/,
	down => qr/SSL connect attempt failed/,
	exit => 255,
	loggrep => {
	    qr/Client IO::Socket::SSL socket connect failed: /.
		qr/,SSL connect attempt failed /.
		qr/because of handshake problems error:/ => 1,
	},
    },
    syslogd => {
	options => ["-S", "localhost", "-K", "fake-ca.crt"],
	ktrace => {
	    qr{NAMI  "fake-ca.crt"} => 1,
	},
	loggrep => {
	    qr{Server CAfile fake-ca.crt} => 1,
	    qr{tls logger .* accepted} => 1,
	    qr/syslogd: tls logger .* connection error: /.
		qr/handshake failed: error:.*:CRYPTO_internal:/ => 1,
	},
    },
    server => {
	func => sub {
	    my $self = shift;
	    read_message($self, qr/syslogd: tls logger .* connection error/);
	},
	loggrep => {},
    },
    file => {
	loggrep => {
	    qr/syslogd: tls logger .* connection error: handshake failed/ => 1,
	},
    },
    pipe => { nocheck => 1, },
    tty => { nocheck => 1, },
);

1;