@@ -61,6 +61,7 @@ sub new {
6161 ca_cert_file => $ca_cert_file ,
6262 ssl_cert_file => $ssl_cert_file ,
6363 ssl_fingerprint => $params {ssl_fingerprint } || $config -> {' ssl-fingerprint' },
64+ ssl_keystore => $params {ssl_keystore } || $config -> {' ssl-keystore' },
6465 _vardir => $config -> {' vardir' },
6566 };
6667 bless $self , $class ;
@@ -569,6 +570,9 @@ sub _KeyChain_or_KeyStore_Export {
569570 }
570571 }
571572
573+ # Support --ssl-keystore=none option
574+ return if $self -> {ssl_keystore } && $self -> {ssl_keystore } =~ / ^none$ /i ;
575+
572576 # Read certificates are cached for one hour after the service is started
573577 return $_SSL_ca-> {_certs }
574578 if $_SSL_ca-> {_expiration } && time < $_SSL_ca-> {_expiration };
@@ -606,6 +610,36 @@ sub _KeyChain_or_KeyStore_Export {
606610 @certs = IO::Socket::SSL::Utils::PEM_file2certs($file )
607611 if -s $file ;
608612 } 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+
609643 # Windows keystore support
610644 Cwd-> require();
611645 my $cwd = Cwd::cwd();
@@ -619,16 +653,6 @@ sub _KeyChain_or_KeyStore_Export {
619653 my $certdir = $tmpdir -> dirname;
620654 $certdir =~ s {\\ } { /} g ;
621655 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- );
632656 $logger -> debug2(" Changing to '$certdir ' temporary folder" );
633657 chdir $certdir ;
634658
0 commit comments