tls: added ability to store certs in config/ssl

was hard coded to ./ssl
This commit is contained in:
Matt Simerson 2013-04-20 16:27:14 -04:00
parent f03128523c
commit 515188ace5

View File

@ -63,9 +63,10 @@ use IO::Socket::SSL 0.98;
sub init {
my ($self, $qp, $cert, $key, $ca) = @_;
$cert ||= 'ssl/qpsmtpd-server.crt';
$key ||= 'ssl/qpsmtpd-server.key';
$ca ||= 'ssl/qpsmtpd-ca.crt';
my $dir = -d 'ssl' ? 'ssl' : 'config/ssl';
$cert ||= "$dir/qpsmtpd-server.crt";
$key ||= "$dir/qpsmtpd-server.key";
$ca ||= "$dir/qpsmtpd-ca.crt";
unless ( -f $cert && -f $key && -f $ca ) {
$self->log(LOGERROR, "Cannot locate cert/key! Run plugins/tls_cert to generate");
return;
@ -120,7 +121,7 @@ sub hook_ehlo {
sub hook_unrecognized_command {
my ($self, $transaction, $cmd, @args) = @_;
return DECLINED unless $cmd eq 'starttls';
return DECLINED unless lc $cmd eq 'starttls';
return DECLINED unless $transaction->notes('tls_enabled');
return DENY, "Syntax error (no parameters allowed)" if @args;