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 Errno ':POSIX'; 12use Socket; 13 14my @errors = (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( 22 qr/connection error: handshake failed:/, 5) 23 or die ref($self), " no handshake failed error in syslogd.log"; 24 })}, 25 }, 26 syslogd => { 27 loghost => '@tls://127.0.0.1:$connectport', 28 loggrep => { 29 qr/Logging to FORWTLS \@tls:\/\/127.0.0.1:\d+/ => '>=6', 30 qr/syslogd\[\d+\]: .*/. 31 qr/connection error: handshake failed:/ => 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( 43 qr/connection error: handshake failed:/, 5) 44 or die ref($self), " no handshake failed error in syslogd.log"; 45 $self->listen(); 46 })}, 47 loggrep => { 48 qr/^Accepted$/ => 2, 49 qr/syslogd\[\d+\]: loghost .* connection close/ => 1, 50 qr/syslogd\[\d+\]: .*/. 51 qr/connection error: handshake failed:/ => 1, 52 get_between2loggrep(), 53 }, 54 }, 55 file => { 56 loggrep => { 57 qr/syslogd\[\d+\]: .*/. 58 qr/connection error: handshake failed: .*$errors/ => 1, 59 get_between2loggrep(), 60 }, 61 }, 62); 63 641; 65