args-sighup-privsep.pl revision 1.5
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 { write_between2logs(shift, sub { 14 my $self = shift; 15 ${$self->{server}}->loggrep("Signal", 8) 16 or die ref($self), " no 'Signal' between logs"; 17 })}, 18 loggrep => { get_between2loggrep() }, 19 }, 20 syslogd => { 21 ktrace => 1, 22 kdump => { 23 qr/syslogd PSIG SIGHUP caught handler/ => 2, 24 qr/syslogd RET execve 0/ => 1, 25 }, 26 loggrep => { 27 qr/syslogd: restarted/ => 1, 28 get_between2loggrep(), 29 }, 30 }, 31 server => { 32 func => sub { read_between2logs(shift, sub { 33 my $self = shift; 34 ${$self->{syslogd}}->rotate(); 35 ${$self->{syslogd}}->rotate(); 36 ${$self->{syslogd}}->kill_privsep('HUP'); 37 ${$self->{syslogd}}->loggrep("syslogd: restarted", 5) 38 or die ref($self), " no 'syslogd: restarted' between logs"; 39 print STDERR "Signal\n"; 40 })}, 41 loggrep => { get_between2loggrep() }, 42 }, 43 check => sub { 44 my $self = shift; 45 my $r = $self->{syslogd}; 46 $r->loggrep("bytes transferred", 1, 2) or sleep 1; 47 foreach my $name (qw(file pipe)) { 48 my $file = $r->{"out$name"}.".1"; 49 my $pattern = (get_between2loggrep())[0]; 50 check_pattern($name, $file, $pattern, \&filegrep); 51 } 52 }, 53); 54 551; 56