args-sighup-privsep.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 UDP to the loghost. 4# The server receives the message on its UDP socket. 5# Find the message in client, file, pipe, syslogd, server log. 6# Check that a SIGHUP is propagated from privsep parent to syslog child. 7 8use strict; 9use warnings; 10 11our %args = ( 12 client => { 13 func => sub { 14 my $self = shift; 15 write_between2logs($self, sub { 16 ${$self->{server}}->loggrep("Signal", 8) 17 or die ref($self), " no 'Signal' between logs"; 18 }); 19 }, 20 loggrep => { get_between2loggrep() }, 21 }, 22 syslogd => { 23 ktrace => 1, 24 kdump => { 25 qr/syslogd PSIG SIGHUP caught handler/ => 2, 26 qr/syslogd RET execve 0/ => 1, 27 }, 28 loggrep => { 29 qr/syslogd: restarted/ => 1, 30 get_between2loggrep(), 31 } 32 }, 33 server => { 34 func => sub { 35 my $self = shift; 36 read_between2logs($self, sub { 37 ${$self->{syslogd}}->rotate(); 38 ${$self->{syslogd}}->rotate(); 39 ${$self->{syslogd}}->kill_privsep('HUP'); 40 ${$self->{syslogd}}->loggrep("syslogd: restarted", 5) 41 or die ref($self), " no 'syslogd: restarted' between logs"; 42 print STDERR "Signal\n"; 43 }); 44 }, 45 loggrep => { get_between2loggrep() }, 46 }, 47 check => sub { 48 my $self = shift; 49 my $r = $self->{syslogd}; 50 foreach my $name (qw(file pipe)) { 51 my $file = $r->{"out$name"}.".1"; 52 my $pattern = (get_between2loggrep())[0]; 53 check_pattern($name, $file, $pattern, \&filegrep); 54 } 55 }, 56); 57 581; 59