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 c58404c3c4
commit 42296b950c

View File

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