1# The TLS server closes the connection to 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 does a TLS reconnect and passes it to loghost. 5# The server receives the message on its new accepted TLS socket. 6# Find the message in client, pipe, syslogd, server log. 7# Check that syslogd and server close and reopen the connection. 8 9use strict; 10use warnings; 11use Socket; 12use Errno ':POSIX'; 13 14my @errors = (ECONNREFUSED, EPIPE); 15my $errors = "(". join("|", map { $! = $_ } @errors). ")"; 16 17our %args = ( 18 client => { 19 func => sub { write_between2logs(shift, sub { 20 my $self = shift; 21 ${$self->{syslogd}}->loggrep($errors, 5) 22 or die ref($self), " no $errors in syslogd.log"; 23 })}, 24 }, 25 syslogd => { 26 loghost => '@tls://127.0.0.1:$connectport', 27 loggrep => { 28 qr/Logging to FORWTLS \@tls:\/\/127.0.0.1:\d+/ => '>=6', 29 qr/syslogd\[\d+\]: /. 30 qr/(connect .*|.* connection error: handshake failed): /. 31 $errors => 1, 32 get_between2loggrep(), 33 }, 34 }, 35 server => { 36 listen => { domain => AF_INET, proto => "tls", addr => "127.0.0.1" }, 37 func => sub { accept_between2logs(shift, sub { 38 my $self = shift; 39 $self->close(); 40 shutdown(\*STDOUT, 1) 41 or die ref($self), " shutdown write failed: $!"; 42 ${$self->{syslogd}}->loggrep($errors, 5) 43 or die ref($self), " no $errors in syslogd.log"; 44 $self->listen(); 45 })}, 46 loggrep => { 47 qr/Accepted/ => 2, 48 qr/syslogd\[\d+\]: loghost .* connection close/ => 1, 49 qr/syslogd\[\d+\]: /. 50 qr/(connect .*|.* connection error: handshake failed): /. 51 $errors => 1, 52 get_between2loggrep(), 53 }, 54 }, 55 file => { 56 loggrep => { 57 qr/syslogd\[\d+\]: /. 58 qr/(connect .*|.* connection error: handshake failed): /. 59 $errors => 1, 60 get_between2loggrep(), 61 }, 62 }, 63); 64 651; 66