66
--smtp-ssl-cert-path <str> * Path to ca-certificates (either directory or file).
67
Pass an empty string to disable certificate
68
verification.
69
+ --smtp-ssl-client-cert <str> * Path to the client certificate file
70
+ --smtp-ssl-client-key <str> * Path to the private key file for the client certificate
71
--smtp-domain <str> * The domain name sent to HELO/EHLO handshake
72
--smtp-auth <str> * Space-separated list of allowed AUTH mechanisms, or
73
"none" to disable authentication.
281
my ($to_cmd, $cc_cmd, $header_cmd);
282
my ($smtp_server, $smtp_server_port, @smtp_server_options);
283
my ($smtp_authuser, $smtp_encryption, $smtp_ssl_cert_path);
284
+my ($smtp_ssl_client_cert, $smtp_ssl_client_key);
285
my ($batch_size, $relogin_delay);
286
my ($identity, $aliasfiletype, @alias_files, $smtp_domain, $smtp_auth);
287
my ($imap_sent_folder);
353
my %config_path_settings = (
354
"aliasesfile" => \@alias_files,
355
"smtpsslcertpath" => \$smtp_ssl_cert_path,
356
+ "smtpsslclientcert" => \$smtp_ssl_client_cert,
357
+ "smtpsslclientkey" => \$smtp_ssl_client_key,
358
"mailmap.file" => \$mailmap_file,
359
"mailmap.blob" => \$mailmap_blob,
360
);
536
"smtp-ssl" => sub { $smtp_encryption = 'ssl' },
537
"smtp-encryption=s" => \$smtp_encryption,
538
"smtp-ssl-cert-path=s" => \$smtp_ssl_cert_path,
539
+ "smtp-ssl-client-cert=s" => \$smtp_ssl_client_cert,
540
+ "smtp-ssl-client-key=s" => \$smtp_ssl_client_key,
541
"smtp-debug:i" => \$debug_net_smtp,
542
"smtp-domain:s" => \$smtp_domain,
543
"smtp-auth=s" => \$smtp_auth,
1527
}
1528
1529
sub ssl_verify_params {
1530
+ my %ret = ();
1531
+
1532
eval {
1533
require IO::Socket::SSL;
1534
IO::Socket::SSL->import(qw/SSL_VERIFY_PEER SSL_VERIFY_NONE/);
1540
1541
if (!defined $smtp_ssl_cert_path) {
1542
# use the OpenSSL defaults
1534
- return (SSL_verify_mode => SSL_VERIFY_PEER());
1543
+ $ret{SSL_verify_mode} = SSL_VERIFY_PEER();
1544
+ }
1545
+ else {
1546
+ if ($smtp_ssl_cert_path eq "") {
1547
+ $ret{SSL_verify_mode} = SSL_VERIFY_NONE();
1548
+ } elsif (-d $smtp_ssl_cert_path) {
1549
+ $ret{SSL_verify_mode} = SSL_VERIFY_PEER();
1550
+ $ret{SSL_ca_path} = $smtp_ssl_cert_path;
1551
+ } elsif (-f $smtp_ssl_cert_path) {
1552
+ $ret{SSL_verify_mode} = SSL_VERIFY_PEER();
1553
+ $ret{SSL_ca_file} = $smtp_ssl_cert_path;
1554
+ } else {
1555
+ die sprintf(__("CA path \"%s\" does not exist"), $smtp_ssl_cert_path);
1556
+ }
1557
}
1558
1537
- if ($smtp_ssl_cert_path eq "") {
1538
- return (SSL_verify_mode => SSL_VERIFY_NONE());
1539
- } elsif (-d $smtp_ssl_cert_path) {
1540
- return (SSL_verify_mode => SSL_VERIFY_PEER(),
1541
- SSL_ca_path => $smtp_ssl_cert_path);
1542
- } elsif (-f $smtp_ssl_cert_path) {
1543
- return (SSL_verify_mode => SSL_VERIFY_PEER(),
1544
- SSL_ca_file => $smtp_ssl_cert_path);
1545
- } else {
1546
- die sprintf(__("CA path \"%s\" does not exist"), $smtp_ssl_cert_path);
1559
+ if (defined $smtp_ssl_client_cert) {
1560
+ $ret{SSL_cert_file} = $smtp_ssl_client_cert;
1561
}
1562
+ if (defined $smtp_ssl_client_key) {
1563
+ if (!defined $smtp_ssl_client_cert) {
1564
+ # Accept the client key only when a certificate is given.
1565
+ # We die here because this case is a user error.
1566
+ die sprintf(__("Only client key \"%s\" specified"),
1567
+ $smtp_ssl_client_key);
1568
+ }
1569
+ $ret{SSL_key_file} = $smtp_ssl_client_key;
1570
+ }
1571
+
1572
+ return %ret;
1573
}
1574
1575
sub file_name_is_absolute {