@@ -61,6 +61,7 @@ sub new {
61
61
ca_cert_file => $ca_cert_file ,
62
62
ssl_cert_file => $ssl_cert_file ,
63
63
ssl_fingerprint => $params {ssl_fingerprint } || $config -> {' ssl-fingerprint' },
64
+ ssl_keystore => $params {ssl_keystore } || $config -> {' ssl-keystore' },
64
65
_vardir => $config -> {' vardir' },
65
66
};
66
67
bless $self , $class ;
@@ -569,6 +570,9 @@ sub _KeyChain_or_KeyStore_Export {
569
570
}
570
571
}
571
572
573
+ # Support --ssl-keystore=none option
574
+ return if $self -> {ssl_keystore } && $self -> {ssl_keystore } =~ / ^none$ /i ;
575
+
572
576
# Read certificates are cached for one hour after the service is started
573
577
return $_SSL_ca-> {_certs }
574
578
if $_SSL_ca-> {_expiration } && time < $_SSL_ca-> {_expiration };
@@ -606,6 +610,36 @@ sub _KeyChain_or_KeyStore_Export {
606
610
@certs = IO::Socket::SSL::Utils::PEM_file2certs($file )
607
611
if -s $file ;
608
612
} else {
613
+ my @certCommands ;
614
+ if ($self -> {ssl_keystore }) {
615
+ foreach my $case (split (/ ,+/ , $self -> {ssl_keystore })) {
616
+ $case = trimWhitespace($case );
617
+ if ($case =~ / ^(Store|Enterprise|GroupPolicy|User)?-?(CA|Root)$ / ) {
618
+ my $store = $2 =~ / CA/i ? " CA" : " Root" ;
619
+ my $option = $1 ? " -$1 " : " " ;
620
+ push @certCommands , " certutil -Silent -Split$option -Store $store " ;
621
+ } else {
622
+ $logger -> debug(" Unsupported ssl-keystore option definition: $case " );
623
+ }
624
+ }
625
+ } else {
626
+ @certCommands = (
627
+ " certutil -Silent -Split -Store CA" ,
628
+ " certutil -Silent -Split -Store Root" ,
629
+ " certutil -Silent -Split -Enterprise -Store CA" ,
630
+ " certutil -Silent -Split -Enterprise -Store Root" ,
631
+ " certutil -Silent -Split -GroupPolicy -Store CA" ,
632
+ " certutil -Silent -Split -GroupPolicy -Store Root" ,
633
+ " certutil -Silent -Split -User -Store CA" ,
634
+ " certutil -Silent -Split -User -Store Root"
635
+ );
636
+ }
637
+
638
+ unless (@certCommands ) {
639
+ $logger -> debug(" No keystore to export server certificates from" );
640
+ return
641
+ }
642
+
609
643
# Windows keystore support
610
644
Cwd-> require();
611
645
my $cwd = Cwd::cwd();
@@ -619,16 +653,6 @@ sub _KeyChain_or_KeyStore_Export {
619
653
my $certdir = $tmpdir -> dirname;
620
654
$certdir =~ s {\\ } { /} g ;
621
655
if (-d $certdir ) {
622
- my @certCommands = (
623
- " certutil -Silent -Split -Store CA" ,
624
- " certutil -Silent -Split -Store Root" ,
625
- " certutil -Silent -Split -Enterprise -Store CA" ,
626
- " certutil -Silent -Split -Enterprise -Store Root" ,
627
- " certutil -Silent -Split -GroupPolicy -Store CA" ,
628
- " certutil -Silent -Split -GroupPolicy -Store Root" ,
629
- " certutil -Silent -Split -User -Store CA" ,
630
- " certutil -Silent -Split -User -Store Root"
631
- );
632
656
$logger -> debug2(" Changing to '$certdir ' temporary folder" );
633
657
chdir $certdir ;
634
658
0 commit comments