args-sighup-tls.pl revision 1.2
1# The client writes a message to Sys::Syslog native method. 2# The syslogd writes it into a file and through a pipe. 3# The syslogd passes it via TLS to the loghost. 4# The server receives the message on its TLS socket. 5# Find the message in client, file, pipe, syslogd, server log. 6# Check that a SIGHUP reconnects the TLS stream and closes the socket. 7 8use strict; 9use warnings; 10use Socket; 11 12our %args = ( 13 client => { 14 func => sub { 15 my $self = shift; 16 write_between2logs($self, sub { 17 ${$self->{server}}->loggrep("Signal", 8) 18 or die ref($self), " no 'Signal' between logs"; 19 }); 20 }, 21 loggrep => { get_between2loggrep() }, 22 }, 23 syslogd => { 24 ktrace => 1, 25 fstat => 1, 26 kdump => { 27 qr/syslogd PSIG SIGHUP caught handler/ => 1, 28 qr/syslogd RET execve 0/ => 1, 29 }, 30 loghost => '@tls://127.0.0.1:$connectport', 31 loggrep => { 32 qr/config file changed: dying/ => 0, 33 qr/config file modified: restarting/ => 0, 34 qr/syslogd: restarted/ => 1, 35 get_between2loggrep(), 36 }, 37 }, 38 server => { 39 listen => { domain => AF_INET, addr => "127.0.0.1", proto => "tls" }, 40 redo => 0, 41 func => sub { 42 my $self = shift; 43 read_between2logs($self, sub { 44 if ($self->{redo}) { 45 $self->{redo}--; 46 return; 47 } 48 ${$self->{syslogd}}->rotate(); 49 ${$self->{syslogd}}->kill_syslogd('HUP'); 50 ${$self->{syslogd}}->loggrep("syslogd: restarted", 5) 51 or die ref($self), " no 'syslogd: restarted' between logs"; 52 print STDERR "Signal\n"; 53 # regeneate fstat file 54 ${$self->{syslogd}}->fstat(); 55 $self->{redo}++; 56 }); 57 }, 58 loggrep => { 59 get_between2loggrep(), 60 qr/Signal/ => 1, 61 qr/Accepted/ => 2, 62 }, 63 }, 64 fstat => { 65 loggrep => { 66 # sighup must not leak a TCP socket 67 qr/internet stream tcp/ => 1, 68 }, 69 }, 70); 71 721; 73