-
Notifications
You must be signed in to change notification settings - Fork 65
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improvements to ssl-keystore parameter #824
base: develop
Are you sure you want to change the base?
Changes from 3 commits
a46cd30
7dd35db
8ccb507
df97ac7
22fc53b
a57c19d
7de97c1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -553,9 +553,6 @@ sub _setSSLOptions { | |
sub _KeyChain_or_KeyStore_Export { | ||
my ($self) = @_; | ||
|
||
# Only MacOSX and MSWin32 are supported | ||
return unless $OSNAME =~ /^darwin|MSWin32$/; | ||
|
||
# But we don't need to extract anything if we still use an option to authenticate server certificate | ||
return if $self->{ca_cert_file} || $self->{ca_cert_dir} || (ref($self->{ssl_fingerprint}) eq 'ARRAY' && @{$self->{ssl_fingerprint}}); | ||
|
||
|
@@ -607,7 +604,11 @@ sub _KeyChain_or_KeyStore_Export { | |
command => "security find-certificate -a -p > '$file'", | ||
logger => $logger | ||
); | ||
@certs = IO::Socket::SSL::Utils::PEM_file2certs($file) | ||
getAllLines( | ||
command => "security find-certificate -a -p /System/Library/Keychains/SystemRootCertificates.keychain >> '$file'", | ||
logger => $logger | ||
); | ||
push @certs, IO::Socket::SSL::Utils::PEM_file2certs($file) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That was not my idea. I prefer to change the command on a given "ssl-keystore" value. Here you force the run of 2 commands where this is not required for most people as Mozilla::CA should provide the public CA certificates. I would prefer something like:
and even, on l.695, the test on Mozilla::CA should be changed to not load it if system public ca are used as this would be redundant:
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The Mozilla CA may not include self-signed CA certs available on system store. I updated the macOS code to meet your expectations, but I still believe the system root CA store should be loaded instead of the current user (root) as it's useless since it contains only Apple CA's - I know the default CA store from the user can be changed but most users won't do that. |
||
if -s $file; | ||
} else { | ||
my @certCommands; | ||
|
@@ -691,6 +692,13 @@ sub _KeyChain_or_KeyStore_Export { | |
} | ||
} | ||
|
||
# Like Mozilla::CA, but using certs from /etc/ssl/certs | ||
if ($OSNAME !~ /^darwin|MSWin32$/) { | ||
my $sslcacert = "/etc/ssl/certs/ca-certificates.crt"; | ||
push @certs, IO::Socket::SSL::Utils::PEM_file2certs($sslcacert) | ||
if -e $sslcacert; | ||
} | ||
|
||
Comment on lines
+694
to
+700
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As I said on my first comment, this is not required as this is still the default. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I believe there should be cases where internal CA is used and some automation tool already added the self-signed certificate to system CA store and it's not a public certificate provided by Mozilla::CA. As this use case is supported on Windows and macOS (otherwise it wouldn't need to import the keystore/keychain from those systems), I don't see why don't include support for keystore of other systems too, only if the SSL library loads it by default? |
||
# Always include default CA file from Mozilla::CA | ||
if (Mozilla::CA->require()) { | ||
my $cacert = Mozilla::CA::SSL_ca_file(); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You probably misunderstood my purpose: Mozilla::CA library is supported by default on all platform.
"ssl-keystore" is only there to permit usage of certificates deployed in keystore or keychain as related OS provides tools to handle such deployment.
On other OS, we don't have such usage and people still have other solutions. So don't enable "ssl-keystore" support on other OS and keep this code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From what I've seen, the Mozilla::CA isn't loaded because this line exit the function if OS is not macOS or Windows, but if Mozilla::CA is supported on Unix/Linux systems but this support isn't enable because the code exits the function before importing it.