-# $OpenBSD: Proc.pm,v 1.9 2020/07/24 22:12:00 bluhm Exp $
+# $OpenBSD: Proc.pm,v 1.10 2022/03/25 14:15:10 bluhm Exp $
# Copyright (c) 2010-2020 Alexander Bluhm <bluhm@openbsd.org>
# Copyright (c) 2014 Florian Riehm <mail@friehm.de>
use IO::File;
use POSIX;
use Time::HiRes qw(time alarm sleep);
+use IO::Socket::SSL;
my %CHILDREN;
do {
$self->child();
print STDERR $self->{up}, "\n";
+ $self->{ts} = $self->{cs}
+ if $self->{connectproto} && $self->{connectproto} eq "tls";
$self->{func}->($self);
+ $self->{ts}->close(SSL_fast_shutdown => 0)
+ or die ref($self), " SSL shutdown: $!,$SSL_ERROR"
+ if $self->{ts};
+ delete $self->{ts};
} while ($self->{redo});
print STDERR "Shutdown", "\n";
port => 6514 },
func => sub {
my $self = shift;
+ delete $self->{ts};
shutdown(\*STDOUT, 1)
or die ref($self), " shutdown write failed: $!";
${$self->{syslogd}}->loggrep("tls logger .* connection close", 5)
port => 6514 },
func => sub {
my $self = shift;
+ delete $self->{ts};
setsockopt(STDOUT, SOL_SOCKET, SO_LINGER, pack('ii', 1, 0))
or die ref($self), " set socket linger failed: $!";
},
server => {
func => sub {
my $self = shift;
- ${$self->{syslogd}}->loggrep("tls logger .* connection error", 5)
+ ${$self->{syslogd}}->loggrep(
+ qr/tls logger .* connection (?:close|error)/, 5)
or die ref($self), " no connection error in syslogd.log";
},
loggrep => {},
qr/.*,SSL connect attempt failed error:.*$errors/;
my $shutdownerror = qr/Client error after shutdown: /.
qr/.*:tlsv1 alert decrypt error/;
+my $sslshutdown = qr/Client SSL shutdown: /;
our %args = (
client => {
sslcert => "client.crt",
sslkey => "client.key",
up => qr/IO::Socket::SSL socket connect failed/,
- down => qr/SSL connect attempt failed|error after shutdown/,
+ down => qr/SSL connect attempt failed|$shutdownerror|$sslshutdown/,
exit => 255,
loggrep => {
- qr/$connecterror|$shutdownerror/ => 1,
+ qr/$connecterror|$shutdownerror|$sslshutdown/ => 1,
},
},
syslogd => {
port => 514,
}},
],
- func => sub { redo_connect( shift, sub {
+ func => sub { redo_connect(shift, sub {
my $self = shift;
write_message($self, "client connect proto: ".
$self->{connectproto}) if $self->{connectproto};
-# $OpenBSD: funcs.pl,v 1.39 2021/12/22 15:14:13 bluhm Exp $
+# $OpenBSD: funcs.pl,v 1.40 2022/03/25 14:15:10 bluhm Exp $
# Copyright (c) 2010-2021 Alexander Bluhm <bluhm@openbsd.org>
#
sleep .1;
close(delete $self->{cs})
or die ref($self), " close failed: $!";
+ delete $self->{ts};
}
if (my $redo = shift @{$self->{redo}}) {
if (my $connect = $redo->{connect}) {