REPORT_EMAIL='dmarc@*****'
REPORT_ORG='*****'
SMTP_SERVER='*****'
+SMTP_USER='****'
+SMTP_PASS='****'
mv ${WORK_DIR}/opendmarc.dat ${WORK_DIR}/opendmarc_import.dat -f
# cat /dev/null > ${WORK_DIR}/opendmarc.dat
# chown opendmarc:opendmarc ${WORK_DIR}/opendmarc.dat
/usr/sbin/opendmarc-import --dbhost=${DB_SERVER} --dbuser=${DB_USER} --dbpasswd=${DB_PASS} --dbname=${DB_NAME} --verbose < ${WORK_DIR}/opendmarc_import.dat
-/usr/sbin/opendmarc-reports --dbhost=${DB_SERVER} --dbuser=${DB_USER} --dbpasswd=${DB_PASS} --dbname=${DB_NAME} --smtp-server=${SMTP_SERVER} --verbose --interval=86400 --report-email=${REPORT_EMAIL} --report-org=${REPORT_ORG}
+/usr/sbin/opendmarc-reports --dbhost=${DB_SERVER} --dbuser=${DB_USER} --dbpasswd=${DB_PASS} --dbname=${DB_NAME} --smtp-server=${SMTP_SERVER} --smtp-user=${SMTP_USER} --smtp-passwd=${SMTP_PASS} --smtp-use-tls --verbose --interval=86400 --report-email=${REPORT_EMAIL} --report-org=${REPORT_ORG}
/usr/sbin/opendmarc-expire --dbhost=${DB_SERVER} --dbuser=${DB_USER} --dbpasswd=${DB_PASS} --dbname=${DB_NAME} --verbose
use POSIX;
use MIME::Base64;
use Net::SMTP;
+use Authen::SASL;
require DBD::mysql;
my $repemail = "postmaster@" . $repdom;
my $smtp_server = '127.0.0.1';
-my $smtp_port = 25;
+my $smtp_port = 587;
+my $smtp_user;
+my $smtp_passwd;
+my $smtp_usetls = 0;
my $smtp;
my $answer;
print STDERR "\t--report-org reporting organization [$repdom]\n";
print STDERR "\t--smtp-port smtp server port [$smtp_port]\n";
print STDERR "\t--smtp-server smtp server [$smtp_server]\n";
+ print STDERR "\t--smtp-user smtp user (for SASL login)\n";
+ print STDERR "\t--smtp-passwd smtp password (for SASL login)\n";
+ print STDERR "\t--smtp-use-tls use TLS for SMTP\n";
print STDERR "\t--test don't send reports\n";
print STDERR "\t--utc operate in UTC\n";
print STDERR "\t (implies --keepfiles --noupdate)\n";
'report-org=s' => \$repdom,
'smtp-server=s' => \$smtp_server,
'smtp-port=i' => \$smtp_port,
+ 'smtp-user=s' => \$smtp_user,
+ 'smtp-passwd=s' => \$smtp_passwd,
+ 'smtp-use-tls!' => \$smtp_usetls,
'update!' => \$doupdate,
'utc!' => \$use_utc,
'verbose+' => \$verbose,
$smtp = Net::SMTP->new($smtp_server,
'Port' => $smtp_port,
'Hello' => hostfqdn());
+
if (!defined($smtp))
{
print STDERR "$progname: open SMTP server $smtp_server:$smtp_port failed\n";
exit(1);
}
+if ($smtp_usetls)
+{
+ $smtp->starttls();
+}
+
+if (defined($smtp_user))
+{
+ if (!$smtp->auth($smtp_user, $smtp_passwd))
+ {
+ print STDERR "$progname: could not login to $smtp_server as user $smtp_user\n";
+ exit(1);
+ }
+}
+
foreach (@$domainset)
{
$domain = $_->[0];