args-secure-udp.pl revision 1.1
1# The client writes messages to localhost IPv4 and IPv6 UDP socket. 2# The syslogd does not receive them as it is started without -u. 3# Check that client does send the message, but it is not in the file. 4# Check with fstat that both *:514 sockets are bound. 5# Check that there is no recvfrom localhost in syslogd ktrace. 6 7use strict; 8use warnings; 9use Socket; 10 11our %args = ( 12 client => { 13 connectaddr => "none", 14 redo => [ 15 { 16 domain => AF_INET, 17 addr => "127.0.0.1", 18 }, 19 { 20 domain => AF_INET, 21 addr => "127.0.0.1", 22 }, 23 { 24 domain => AF_INET6, 25 addr => "::1", 26 }, 27 ], 28 func => sub { 29 my $self = shift; 30 write_message($self, "client addr: ". $self->{connectaddr}); 31 if ($self->{cs}) { 32 # wait for possible icmp errors, port is open 33 sleep .1; 34 close($self->{cs}) 35 or die ref($self), " close failed: $!"; 36 }; 37 if (my $connect = shift @{$self->{redo}}) { 38 $self->{connectdomain} = $connect->{domain}; 39 $self->{connectaddr} = $connect->{addr}; 40 $self->{connectproto} = "udp"; 41 $self->{connectport} = "514"; 42 } else { 43 delete $self->{connectdomain}; 44 $self->{logsock} = { type => "native" }; 45 setlogsock($self->{logsock}) 46 or die ref($self), " setlogsock failed: $!"; 47 sleep .1; 48 write_log($self); 49 undef $self->{redo}; 50 } 51 }, 52 loggrep => { 53 qr/client addr:/ => 4, 54 get_testgrep() => 1, 55 } 56 }, 57 syslogd => { 58 options => [], 59 loghost => "/dev/null", 60 fstat => { 61 qr/^_syslogd syslogd .* internet6? dgram udp \*:514$/ => 2, 62 }, 63 ktrace => { 64 qr/127\.0\.0\.1/ => 0, 65 qr/\[::1\]/ => 0, 66 }, 67 }, 68 server => { 69 noserver => 1, 70 }, 71 file => { 72 loggrep => { 73 qr/client addr: none/ => 1, 74 qr/client addr:/ => 1, 75 get_testgrep() => 1, 76 } 77 }, 78); 79 801; 81