args-sighup-tls.pl revision 1.3
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 { write_between2logs(shift, sub { 15 my $self = shift; 16 ${$self->{server}}->loggrep("Signal", 8) 17 or die ref($self), " no 'Signal' between logs"; 18 })}, 19 loggrep => { get_between2loggrep() }, 20 }, 21 syslogd => { 22 ktrace => 1, 23 fstat => 1, 24 kdump => { 25 qr/syslogd PSIG SIGHUP caught handler/ => 1, 26 qr/syslogd RET execve 0/ => 1, 27 }, 28 loghost => '@tls://127.0.0.1:$connectport', 29 loggrep => { 30 qr/config file changed: dying/ => 0, 31 qr/config file modified: restarting/ => 0, 32 qr/syslogd: restarted/ => 1, 33 get_between2loggrep(), 34 }, 35 }, 36 server => { 37 listen => { domain => AF_INET, addr => "127.0.0.1", proto => "tls" }, 38 redo => 0, 39 func => sub { read_between2logs(shift, sub { 40 my $self = shift; 41 if ($self->{redo}) { 42 $self->{redo}--; 43 return; 44 } 45 ${$self->{syslogd}}->rotate(); 46 ${$self->{syslogd}}->kill_syslogd('HUP'); 47 ${$self->{syslogd}}->loggrep("syslogd: restarted", 5) 48 or die ref($self), " no 'syslogd: restarted' between logs"; 49 print STDERR "Signal\n"; 50 # regenerate fstat file 51 ${$self->{syslogd}}->fstat(); 52 $self->{redo}++; 53 })}, 54 loggrep => { 55 get_between2loggrep(), 56 qr/Signal/ => 1, 57 qr/Accepted/ => 2, 58 }, 59 }, 60 fstat => { 61 loggrep => { 62 # sighup must not leak a TCP socket 63 qr/internet stream tcp/ => 1, 64 }, 65 }, 66); 67 681; 69