Log deprecation info message when using 'io.netty.handler.ssl.openssl.useKeyManagerFactory' and ignore it when using BoringSSL (#9162)

Motivation:

When we added support for KeyManagerFactory we also allowed to disable it to make the change less risky. This was done years ago and so there is really no need to use the property anyway.
Unfortunally due a change in netty-tcnative it is even not supported anymore when using BoringSSL.

Modifications:

- Log an info message to tell users that 'io.netty.handler.ssl.openssl.useKeyManagerFactory' is deprecated when it is used
- Ignore 'io.netty.handler.ssl.openssl.useKeyManagerFactory' when BoringSSL is used.

Result:

Fixes https://github.com/netty/netty/issues/9147.
This commit is contained in:
Norman Maurer 2019-05-22 08:40:19 +02:00 committed by GitHub
parent 2dc686ded1
commit af98b62150
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -246,13 +246,24 @@ public final class OpenSsl {
SSL.setKeyMaterial(ssl, cert, key); SSL.setKeyMaterial(ssl, cert, key);
supportsKeyManagerFactory = true; supportsKeyManagerFactory = true;
try { try {
useKeyManagerFactory = AccessController.doPrivileged(new PrivilegedAction<Boolean>() { boolean propertySet = SystemPropertyUtil.contains(
@Override "io.netty.handler.ssl.openssl.useKeyManagerFactory");
public Boolean run() { if (!IS_BORINGSSL) {
return SystemPropertyUtil.getBoolean( useKeyManagerFactory = SystemPropertyUtil.getBoolean(
"io.netty.handler.ssl.openssl.useKeyManagerFactory", true); "io.netty.handler.ssl.openssl.useKeyManagerFactory", true);
if (propertySet) {
logger.info("System property " +
"'io.netty.handler.ssl.openssl.useKeyManagerFactory'" +
" is deprecated and so will be ignored in the future");
} }
}); } else {
if (propertySet) {
logger.info("System property " +
"'io.netty.handler.ssl.openssl.useKeyManagerFactory'" +
" is deprecated and will be ignored when using BoringSSL");
}
}
} catch (Throwable ignore) { } catch (Throwable ignore) {
logger.debug("Failed to get useKeyManagerFactory system property."); logger.debug("Failed to get useKeyManagerFactory system property.");
} }