1# The TLS server writes a message back to the syslogd.
2# The client writes a message to Sys::Syslog native method.
3# The syslogd writes it into a file and through a pipe.
4# The syslogd passes it via IPv4 TLS to an explicit loghost.
5# The server receives the message on its TLS socket.
6# Find the message in client, pipe, syslogd, server log.
7# Check that syslogd writes a debug message about the message sent back.
8
9use strict;
10use warnings;
11use Socket;
12
13my $sendback = "syslogd tcp server send back message";
14
15our %args = (
16    client => {
17	func => sub {
18	    my $self = shift;
19	    ${$self->{syslogd}}->loggrep("loghost .* did send .* back", 5)
20		or die ref($self), " no send back in syslogd.log";
21	    write_log($self);
22	},
23    },
24    syslogd => {
25	loghost => '@tls://127.0.0.1:$connectport',
26	loggrep => {
27	    qr/Logging to FORWTLS \@tls:\/\/127.0.0.1:\d+/ => '>=4',
28	    get_testgrep() => 1,
29	    qr/did send /.length($sendback).qr/ bytes back/ => 1,
30	},
31    },
32    server => {
33	listen => { domain => AF_INET, proto => "tls", addr => "127.0.0.1" },
34	func => sub {
35	    print($sendback);
36	    read_log(@_);
37	},
38    },
39    file => {
40	loggrep => {
41	    qr/$sendback/ => 0,
42	},
43    },
44);
45
461;
47