Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion reports/opendmarc-expire.in
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,13 @@ my $def_dbname = "opendmarc";
my $def_dbuser = "opendmarc";
my $def_dbpasswd = "opendmarc";
my $def_dbport = "3306";
my $def_dbssl = 0;
my $dbhost;
my $dbname;
my $dbuser;
my $dbpasswd;
my $dbport;
my $dbssl;

my $dbscheme = "@SQL_BACKEND@";

Expand All @@ -66,6 +68,7 @@ sub usage
print STDERR "\t--dbname=name database name [$def_dbname]\n";
print STDERR "\t--dbpasswd=passwd database password [$def_dbpasswd]\n";
print STDERR "\t--dbport=port database port [$def_dbport]\n";
print STDERR "\t--dbssl access database over SSL [$def_dbssl]\n";
print STDERR "\t--dbuser=user database user [$def_dbuser]\n";
print STDERR "\t--expire=days expiration time, in days [$def_maxage]\n";
print STDERR "\t--help print help and exit\n";
Expand All @@ -79,6 +82,7 @@ my $opt_retval = &Getopt::Long::GetOptions ('alltables!' => \$alltables,
'dbname=s' => \$dbname,
'dbpasswd=s' => \$dbpasswd,
'dbport=s' => \$dbport,
'dbssl!' => \$dbssl,
'dbuser=s' => \$dbuser,
'expire=i' => \$maxage,
'help!' => \$helponly,
Expand Down Expand Up @@ -155,6 +159,18 @@ if (!defined($dbport))
}
}

if (!defined($dbssl))
{
if (defined($ENV{'OPENDMARC_SSL'}))
{
$dbssl = $ENV{'OPENDMARC_SSL'};
}
else
{
$dbssl = $def_dbssl;
}
}

if (!defined($dbuser))
{
if (defined($ENV{'OPENDMARC_USER'}))
Expand Down Expand Up @@ -196,7 +212,7 @@ if ($verbose)
}

my $dbi_dsn = "DBI:" . $dbscheme . ":database=" . $dbname .
";host=" . $dbhost . ";port=" . $dbport;
";host=" . $dbhost . ";port=" . $dbport . ";mysql_ssl=" . $dbssl;

$dbi_h = DBI->connect($dbi_dsn, $dbuser, $dbpasswd, { PrintError => 0 });
if (!defined($dbi_h))
Expand Down
5 changes: 5 additions & 0 deletions reports/opendmarc-import.8.in
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@ Specifies the TCP port on which the SQL server is expected to be listening.
Defaults to the value of the environment variable OPENDMARC_PORT, or 3306
if the environment variable is not set.
.TP
.I --dbssl
Specifies to use SSL/TLS to connect to SQL server. Defaults to the value
of the environment variable OPENDMARC_SSL or false if the environment
variable is not set.
.TP
.I --dbuser=user
Specifies the SQL user to be used to access the database. Defaults to
the value of the environment variable OPENDMARC_USER, or "opendmarc" if
Expand Down
18 changes: 17 additions & 1 deletion reports/opendmarc-import.in
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,15 @@ my $def_dbname = "opendmarc";
my $def_dbuser = "opendmarc";
my $def_dbpasswd = "opendmarc";
my $def_dbport = "3306";
my $def_dbssl = 0;
my $def_interval = "86400";
my $def_inputfh = *STDIN;
my $dbhost;
my $dbname;
my $dbuser;
my $dbpasswd;
my $dbport;
my $dbssl;
my $inputfile;
my $inputfh;

Expand Down Expand Up @@ -420,6 +422,7 @@ sub usage
print STDERR "\t--dbname=name database name [$def_dbname]\n";
print STDERR "\t--dbpasswd=passwd database password [$def_dbpasswd]\n";
print STDERR "\t--dbport=port database port [$def_dbport]\n";
print STDERR "\t--dbssl access database over SSL [$def_dbssl]\n";
print STDERR "\t--dbuser=user database user [$def_dbuser]\n";
print STDERR "\t--input=file input file [STDIN]\n";
print STDERR "\t--help print help and exit\n";
Expand All @@ -432,6 +435,7 @@ my $opt_retval = &Getopt::Long::GetOptions ('dbhost=s' => \$dbhost,
'dbname=s' => \$dbname,
'dbpasswd=s' => \$dbpasswd,
'dbport=s' => \$dbport,
'dbssl!' => \$dbssl,
'dbuser=s' => \$dbuser,
'input=s' => \$inputfile,
'help!' => \$helponly,
Expand Down Expand Up @@ -508,6 +512,18 @@ if (!defined($dbport))
}
}

if (!defined($dbssl))
{
if (defined($ENV{'OPENDMARC_SSL'}))
{
$dbssl = $ENV{'OPENDMARC_SSL'};
}
else
{
$dbssl = $def_dbssl;
}
}

if (!defined($dbuser))
{
if (defined($ENV{'OPENDMARC_USER'}))
Expand Down Expand Up @@ -544,7 +560,7 @@ if (!flock($inputfh, LOCK_SH))
}

my $dbi_dsn = "DBI:" . $dbscheme . ":database=" . $dbname .
";host=" . $dbhost . ";port=" . $dbport;
";host=" . $dbhost . ";port=" . $dbport . ";mysql_ssl=" . $dbssl;

$dbi_h = DBI->connect($dbi_dsn, $dbuser, $dbpasswd, { PrintError => 0 });
if (!defined($dbi_h))
Expand Down
18 changes: 17 additions & 1 deletion reports/opendmarc-params.in
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,13 @@ my $def_dbname = "opendmarc";
my $def_dbuser = "opendmarc";
my $def_dbpasswd = "opendmarc";
my $def_dbport = "3306";
my $def_dbssl = 0;
my $dbhost;
my $dbname;
my $dbuser;
my $dbpasswd;
my $dbport;
my $dbssl;

my $dbscheme = "@SQL_BACKEND@";

Expand Down Expand Up @@ -131,6 +133,7 @@ sub usage
print STDERR "\t--dbname=name database name [$def_dbname]\n";
print STDERR "\t--dbpasswd=passwd database password [$def_dbpasswd]\n";
print STDERR "\t--dbport=port database port [$def_dbport]\n";
print STDERR "\t--dbssl access database over SSL [$def_dbssl]\n";
print STDERR "\t--dbuser=user database user [$def_dbuser]\n";
print STDERR "\t--rua=string aggregate report URI(s)\n";
print STDERR "\t--help print help and exit\n";
Expand All @@ -144,6 +147,7 @@ my $opt_retval = &Getopt::Long::GetOptions ('dbhost=s' => \$dbhost,
'dbname=s' => \$dbname,
'dbpasswd=s' => \$dbpasswd,
'dbport=s' => \$dbport,
'dbssl!' => \$dbssl,
'dbuser=s' => \$dbuser,
'help!' => \$helponly,
'rua=s' => \$rua,
Expand Down Expand Up @@ -223,6 +227,18 @@ if (!defined($dbport))
}
}

if (!defined($dbssl))
{
if (defined($ENV{'OPENDMARC_SSL'}))
{
$dbssl = $ENV{'OPENDMARC_SSL'};
}
else
{
$dbssl = $def_dbssl;
}
}

if (!defined($dbuser))
{
if (defined($ENV{'OPENDMARC_USER'}))
Expand All @@ -241,7 +257,7 @@ if ($verbose)
}

my $dbi_dsn = "DBI:" . $dbscheme . ":database=" . $dbname .
";host=" . $dbhost . ";port=" . $dbport;
";host=" . $dbhost . ";port=" . $dbport . ";mysql_ssl=" . $dbssl;

$dbi_h = DBI->connect($dbi_dsn, $dbuser, $dbpasswd, { PrintError => 0 });
if (!defined($dbi_h))
Expand Down
5 changes: 5 additions & 0 deletions reports/opendmarc-reports.8.in
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,11 @@ Specifies the TCP port on which the SQL server is expected to be listening.
Defaults to the value of the environment variable OPENDMARC_PORT, or 3306
if the environment variable is not set.
.TP
.I --dbssl
Specifies to use SSL/TLS to connect to SQL server. Defaults to the value
of the environment variable OPENDMARC_SSL or false if the environment
variable is not set.
.TP
.I --dbuser=user
Specifies the SQL user to be used to access the database. Defaults to
the value of the environment variable OPENDMARC_USER, or "opendmarc" if
Expand Down
18 changes: 17 additions & 1 deletion reports/opendmarc-reports.in
Original file line number Diff line number Diff line change
Expand Up @@ -127,12 +127,14 @@ my $def_dbname = "opendmarc";
my $def_dbuser = "opendmarc";
my $def_dbpasswd = "opendmarc";
my $def_dbport = "3306";
my $def_dbssl = 0;
my $def_interval = "86400";
my $dbhost;
my $dbname;
my $dbuser;
my $dbpasswd;
my $dbport;
my $dbssl;

my $dbscheme = "@SQL_BACKEND@";

Expand All @@ -157,6 +159,7 @@ sub usage
print STDERR "\t--dbname=name database name [$def_dbname]\n";
print STDERR "\t--dbpasswd=passwd database password [$def_dbpasswd]\n";
print STDERR "\t--dbport=port database port [$def_dbport]\n";
print STDERR "\t--dbssl access database over SSL [$def_dbssl]\n";
print STDERR "\t--dbuser=user database user [$def_dbuser]\n";
print STDERR "\t--domain=name force a report for named domain\n";
print STDERR "\t--help print help and exit\n";
Expand Down Expand Up @@ -186,6 +189,7 @@ my $opt_retval = &Getopt::Long::GetOptions ('day!' => \$daybound,
'dbname=s' => \$dbname,
'dbpasswd=s' => \$dbpasswd,
'dbport=s' => \$dbport,
'dbssl!' => \$dbssl,
'dbuser=s' => \$dbuser,
'domain=s' => \$forcedomain,
'help!' => \$helponly,
Expand Down Expand Up @@ -272,6 +276,18 @@ if (!defined($dbport))
}
}

if (!defined($dbssl))
{
if (defined($ENV{'OPENDMARC_SSL'}))
{
$dbssl = $ENV{'OPENDMARC_SSL'};
}
else
{
$dbssl = $def_dbssl;
}
}

if (!defined($dbuser))
{
if (defined($ENV{'OPENDMARC_USER'}))
Expand Down Expand Up @@ -304,7 +320,7 @@ if ($verbose)
}

my $dbi_dsn = "DBI:" . $dbscheme . ":database=" . $dbname .
";host=" . $dbhost . ";port=" . $dbport;
";host=" . $dbhost . ";port=" . $dbport . ";mysql_ssl=" . $dbssl;

$dbi_h = DBI->connect($dbi_dsn, $dbuser, $dbpasswd, { PrintError => 0 });
if (!defined($dbi_h))
Expand Down