You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hc.apache.org by GitBox <gi...@apache.org> on 2020/03/22 09:47:12 UTC

[GitHub] [httpcomponents-core] Hakky54 opened a new pull request #194: Switched to TLSv1.2 as default if no protocol is provided

Hakky54 opened a new pull request #194: Switched to TLSv1.2 as default if no protocol is provided
URL: https://github.com/apache/httpcomponents-core/pull/194
 
 
   TLSv1.0 and TLSv1.1 are deprecated this year. It would be better for the SSlContextBuilder to use a newer (not deprecated) encryption protocol by default if the user does not provide any.
   
   This change will not prevent the user to still use an older version when providing the old one.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


[GitHub] [httpcomponents-core] michael-o edited a comment on issue #194: Switched to TLSv1.2 as default protocol if none provided

Posted by GitBox <gi...@apache.org>.
michael-o edited a comment on issue #194: Switched to TLSv1.2 as default protocol if none provided
URL: https://github.com/apache/httpcomponents-core/pull/194#issuecomment-602191075
 
 
   Can we revert this for now until something like OpenSSL syntax is possible: `TLSv1.2+TLSv1.3`? We could probably steal code from Tomcat which does the parsing.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


[GitHub] [httpcomponents-core] ok2c commented on issue #194: Switched to TLSv1.2 as default protocol if none provided

Posted by GitBox <gi...@apache.org>.
ok2c commented on issue #194: Switched to TLSv1.2 as default protocol if none provided
URL: https://github.com/apache/httpcomponents-core/pull/194#issuecomment-602186787
 
 
   @Hakky54 Please note a better way of controlling the TLS protocol versions advertised as supported is through `SSLParameters` during the initial TLS handshake phase.
   
   HttpCore applies this strategy to all HTTP connections by default 
   ```
   public final class DefaultTlsSetupHandler implements Callback<SSLParameters> {
   
       @Override
       public void execute(final SSLParameters sslParameters) {
           sslParameters.setProtocols(TLS.excludeWeak(sslParameters.getProtocols()));
           sslParameters.setCipherSuites(TlsCiphers.excludeWeak(sslParameters.getCipherSuites()));
       }
   
   }
   ```

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


[GitHub] [httpcomponents-core] michael-o commented on issue #194: Switched to TLSv1.2 as default protocol if none provided

Posted by GitBox <gi...@apache.org>.
michael-o commented on issue #194: Switched to TLSv1.2 as default protocol if none provided
URL: https://github.com/apache/httpcomponents-core/pull/194#issuecomment-602191075
 
 
   Can we revert this for now until something like OpenSSL syntax is possible: `TLSv1.2+TLSv1.3`?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


[GitHub] [httpcomponents-core] Hakky54 commented on issue #194: Switched to TLSv1.2 as default protocol if none provided

Posted by GitBox <gi...@apache.org>.
Hakky54 commented on issue #194: Switched to TLSv1.2 as default protocol if none provided
URL: https://github.com/apache/httpcomponents-core/pull/194#issuecomment-602185960
 
 
   Hi @michael-o Well let me try to give more context to the pull request by explaining what the behaviour was before the code change. Apache SSLContextBuilder was using by TLS when the user didn't specify a specific protocol. So basically it was using TLSv1.0, a protocol from the year 1999, which currently it deprecated. See below fo the list of encryption protocols:
   <img width="436" alt="Screenshot 2020-03-22 at 12 11 55" src="https://user-images.githubusercontent.com/16032204/77248002-72e70d00-6c36-11ea-98fa-29ef302a4619.png">
   https://en.wikipedia.org/wiki/Transport_Layer_Security
   
   We need to provide a better protocol as a default to prevent that users of the SSLContextBuilder accidentally get the deprecated protocol by forgetting to specify that they want to use TLSv1.3 or TLSv1.2.
   
   So the existing code for these methods/code will return the old protocol of 1999:
   [SSLContexts#createDefault()](https://hc.apache.org/httpcomponents-core-ga/httpcore/apidocs/org/apache/http/ssl/SSLContexts.html#createDefault())
   [SSLContextBuilder](https://hc.apache.org/httpcomponents-core-ga/httpcore/apidocs/org/apache/http/ssl/SSLContextBuilder.html)
   ```
   public static void main(String[] args) throws NoSuchAlgorithmException, KeyManagementException {
       SSLContext defaultSSLContext = SSLContexts.createDefault();
       System.out.println(defaultSSLContext.getProtocol());
   
       SSLContext customSSLContext = SSLContextBuilder.create()
               .build();
       System.out.println(customSSLContext.getProtocol());
   }
   ```
   
   So with the code change within this pull request the user of these classes will be getting TLSv1.2 by default for the above code snippet if they **don't specify** a protocol at all. But if they specify it, like the code below they will even get TLSv1.3
   
   ```
   public static void main(String[] args) throws NoSuchAlgorithmException, KeyManagementException {
       SSLContext customSSLContext = SSLContextBuilder.create()
               .setProtocol("TLSv1.3")
               .build();
       System.out.println(customSSLContext.getProtocol());
   }
   ```
   
   I hope this makes it a bit more clear. So back to your question. The default protocol now will be TLSv1.2 instead of TLSv1.0. In my opinion I wouldn't like to provide TLSv1.3 by default if the user didn't specified it, because the protocol is still new and not fully adopter by most of the servers. Most likely the most users will get a runtime exception during the handshake proces because the server is still using TLSv1.2 and are not compatible with TLSv1.3.
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


[GitHub] [httpcomponents-core] Hakky54 edited a comment on issue #194: Switched to TLSv1.2 as default protocol if none provided

Posted by GitBox <gi...@apache.org>.
Hakky54 edited a comment on issue #194: Switched to TLSv1.2 as default protocol if none provided
URL: https://github.com/apache/httpcomponents-core/pull/194#issuecomment-602185960
 
 
   Hi @michael-o Well let me try to give more context to the pull request by explaining what the behaviour was before the code change. Apache SSLContextBuilder was using by TLS when the user didn't specify a specific protocol. So basically it was using TLSv1.0, a protocol from the year 1999, which currently is deprecated. See below fo the list of encryption protocols:
   <img width="436" alt="Screenshot 2020-03-22 at 12 11 55" src="https://user-images.githubusercontent.com/16032204/77248002-72e70d00-6c36-11ea-98fa-29ef302a4619.png">
   https://en.wikipedia.org/wiki/Transport_Layer_Security
   
   We need to provide a better protocol as a default to prevent that users of the SSLContextBuilder accidentally get the deprecated protocol by forgetting to specify that they want to use TLSv1.3 or TLSv1.2.
   
   So the existing code for these methods/code will return the old protocol of 1999:
   [SSLContexts#createDefault()](https://hc.apache.org/httpcomponents-core-ga/httpcore/apidocs/org/apache/http/ssl/SSLContexts.html#createDefault())
   [SSLContextBuilder](https://hc.apache.org/httpcomponents-core-ga/httpcore/apidocs/org/apache/http/ssl/SSLContextBuilder.html)
   ```
   public static void main(String[] args) throws NoSuchAlgorithmException, KeyManagementException {
       SSLContext defaultSSLContext = SSLContexts.createDefault();
       System.out.println(defaultSSLContext.getProtocol());
   
       SSLContext customSSLContext = SSLContextBuilder.create()
               .build();
       System.out.println(customSSLContext.getProtocol());
   }
   ```
   
   So with the code change within this pull request the user of these classes will be getting TLSv1.2 by default for the above code snippet if they **don't specify** a protocol at all. But if they specify it, like the code below they will even get TLSv1.3
   
   ```
   public static void main(String[] args) throws NoSuchAlgorithmException, KeyManagementException {
       SSLContext customSSLContext = SSLContextBuilder.create()
               .setProtocol("TLSv1.3")
               .build();
       System.out.println(customSSLContext.getProtocol());
   }
   ```
   
   I hope this makes it a bit more clear. So back to your question. The default protocol now will be TLSv1.2 instead of TLSv1.0. In my opinion I wouldn't like to provide TLSv1.3 by default if the user didn't specified it, because the protocol is still new and not fully adopter by most of the servers. Most likely the most users will get a runtime exception during the handshake proces because the server is still using TLSv1.2 and are not compatible with TLSv1.3.
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


[GitHub] [httpcomponents-core] ok2c commented on issue #194: Switched to TLSv1.2 as default protocol if none provided

Posted by GitBox <gi...@apache.org>.
ok2c commented on issue #194: Switched to TLSv1.2 as default protocol if none provided
URL: https://github.com/apache/httpcomponents-core/pull/194#issuecomment-602185649
 
 
   @michael-o I ran a few tests and indeed the change has the opposite effect than expected. 
   
   With `TLS` as default protocol the client hello with Java 13 looks like that 
   ```
   "ClientHello": {
     "client version"      : "TLSv1.2",
   ...
       "supported_versions (43)": {
         "versions": [TLSv1.3, TLSv1.2, TLSv1.1, TLSv1]
       },
   ...
   }
   ```  
   With `TLSv1.2` as default protocol the client it does
   ```
   "ClientHello": {
     "client version"      : "TLSv1.2",
   ...
      "supported_versions (43)": {
         "versions": [TLSv1.2, TLSv1.1, TLSv1]
       }
     ]
   ...
   }
   ```
   It is obviously not something we would want.
   
   @Hakky54 I am afraid I will have to revert the change.  
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


[GitHub] [httpcomponents-core] michael-o edited a comment on issue #194: Switched to TLSv1.2 as default protocol if none provided

Posted by GitBox <gi...@apache.org>.
michael-o edited a comment on issue #194: Switched to TLSv1.2 as default protocol if none provided
URL: https://github.com/apache/httpcomponents-core/pull/194#issuecomment-602176189
 
 
   This basically means that TLS 1.3 will not be available by default? Please note that there is OpenJSSE provider for Java 1.8 backporting  TLS 1.3 support for Java 8.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


[GitHub] [httpcomponents-core] michael-o edited a comment on issue #194: Switched to TLSv1.2 as default protocol if none provided

Posted by GitBox <gi...@apache.org>.
michael-o edited a comment on issue #194: Switched to TLSv1.2 as default protocol if none provided
URL: https://github.com/apache/httpcomponents-core/pull/194#issuecomment-602191075
 
 
   Can we revert this for now until something like OpenSSL syntax is possible: `TLSv1.2+TLSv1.3`? WE could probably steal code from Tomcat which does the parsing.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


[GitHub] [httpcomponents-core] michael-o commented on issue #194: Switched to TLSv1.2 as default protocol if none provided

Posted by GitBox <gi...@apache.org>.
michael-o commented on issue #194: Switched to TLSv1.2 as default protocol if none provided
URL: https://github.com/apache/httpcomponents-core/pull/194#issuecomment-602176189
 
 
   This basically means that TLS 1.3 will not be available by default? Please note that ethere is OpenJSSE provider for Java 1.8 backporting  TLS 1.3 support for Java 8.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


[GitHub] [httpcomponents-core] Hakky54 commented on issue #194: Switched to TLSv1.2 as default protocol if none provided

Posted by GitBox <gi...@apache.org>.
Hakky54 commented on issue #194: Switched to TLSv1.2 as default protocol if none provided
URL: https://github.com/apache/httpcomponents-core/pull/194#issuecomment-602188961
 
 
   @ok2c 
   Good that you mentioned that part. So Apache was already excluding weak protocols by default, that's awesome. I missed that part, sorry my bad. I see indeed this code:
   ```
   public static String[] excludeWeak(final String... protocols) {
       if (protocols == null) {
           return null;
       }
       final List<String> enabledProtocols = new ArrayList<>();
       for (final String protocol: protocols) {
           if (!protocol.startsWith("SSL") && !protocol.equals(V_1_0.id) && !protocol.equals(V_1_1.id)) {
               enabledProtocols.add(protocol);
           }
       }
       if (enabledProtocols.isEmpty()) {
           enabledProtocols.add(V_1_2.id);
       }
       return enabledProtocols.toArray(new String[0]);
   }
   ```
   That would make this pull request not needed I guess

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


[GitHub] [httpcomponents-core] Hakky54 removed a comment on issue #194: Switched to TLSv1.2 as default protocol if none provided

Posted by GitBox <gi...@apache.org>.
Hakky54 removed a comment on issue #194: Switched to TLSv1.2 as default protocol if none provided
URL: https://github.com/apache/httpcomponents-core/pull/194#issuecomment-602185960
 
 
   Hi @michael-o Well let me try to give more context to the pull request by explaining what the behaviour was before the code change. Apache SSLContextBuilder was using by TLS when the user didn't specify a specific protocol. So basically it was using TLSv1.0, a protocol from the year 1999, which currently is deprecated. See below fo the list of encryption protocols:
   <img width="436" alt="Screenshot 2020-03-22 at 12 11 55" src="https://user-images.githubusercontent.com/16032204/77248002-72e70d00-6c36-11ea-98fa-29ef302a4619.png">
   https://en.wikipedia.org/wiki/Transport_Layer_Security
   
   We need to provide a better protocol as a default to prevent that users of the SSLContextBuilder accidentally get the deprecated protocol by forgetting to specify that they want to use TLSv1.3 or TLSv1.2.
   
   So the existing code for these methods/code will return the old protocol of 1999:
   [SSLContexts#createDefault()](https://hc.apache.org/httpcomponents-core-ga/httpcore/apidocs/org/apache/http/ssl/SSLContexts.html#createDefault())
   [SSLContextBuilder](https://hc.apache.org/httpcomponents-core-ga/httpcore/apidocs/org/apache/http/ssl/SSLContextBuilder.html)
   ```
   public static void main(String[] args) throws NoSuchAlgorithmException, KeyManagementException {
       SSLContext defaultSSLContext = SSLContexts.createDefault();
       System.out.println(defaultSSLContext.getProtocol());
   
       SSLContext customSSLContext = SSLContextBuilder.create()
               .build();
       System.out.println(customSSLContext.getProtocol());
   }
   ```
   
   So with the code change within this pull request the user of these classes will be getting TLSv1.2 by default for the above code snippet if they **don't specify** a protocol at all. But if they specify it, like the code below they will even get TLSv1.3
   
   ```
   public static void main(String[] args) throws NoSuchAlgorithmException, KeyManagementException {
       SSLContext customSSLContext = SSLContextBuilder.create()
               .setProtocol("TLSv1.3")
               .build();
       System.out.println(customSSLContext.getProtocol());
   }
   ```
   
   I hope this makes it a bit more clear. So back to your question. The default protocol now will be TLSv1.2 instead of TLSv1.0. In my opinion I wouldn't like to provide TLSv1.3 by default if the user didn't specified it, because the protocol is still new and not fully adopter by most of the servers. Most likely the most users will get a runtime exception during the handshake proces because the server is still using TLSv1.2 and are not compatible with TLSv1.3.
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


[GitHub] [httpcomponents-core] ok2c commented on issue #194: Switched to TLSv1.2 as default protocol if none provided

Posted by GitBox <gi...@apache.org>.
ok2c commented on issue #194: Switched to TLSv1.2 as default protocol if none provided
URL: https://github.com/apache/httpcomponents-core/pull/194#issuecomment-602191203
 
 
   @michael-o I already did.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


[GitHub] [httpcomponents-core] ok2c merged pull request #194: Switched to TLSv1.2 as default protocol if none provided

Posted by GitBox <gi...@apache.org>.
ok2c merged pull request #194: Switched to TLSv1.2 as default protocol if none provided
URL: https://github.com/apache/httpcomponents-core/pull/194
 
 
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


[GitHub] [httpcomponents-core] ok2c edited a comment on issue #194: Switched to TLSv1.2 as default protocol if none provided

Posted by GitBox <gi...@apache.org>.
ok2c edited a comment on issue #194: Switched to TLSv1.2 as default protocol if none provided
URL: https://github.com/apache/httpcomponents-core/pull/194#issuecomment-602185649
 
 
   @michael-o I ran a few tests and indeed the change has the opposite effect than expected. 
   
   With `TLS` as default protocol the client hello with Java 13 looks like that 
   ```
   "ClientHello": {
     "client version"      : "TLSv1.2",
   ...
       "supported_versions (43)": {
         "versions": [TLSv1.3, TLSv1.2, TLSv1.1, TLSv1]
       },
   ...
   }
   ```  
   With `TLSv1.2` as default protocol the client hello looks like that
   ```
   "ClientHello": {
     "client version"      : "TLSv1.2",
   ...
      "supported_versions (43)": {
         "versions": [TLSv1.2, TLSv1.1, TLSv1]
       }
     ]
   ...
   }
   ```
   It is obviously not the behavior we would want as default.
   
   @Hakky54 I am afraid I will have to revert the change.  
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


[GitHub] [httpcomponents-core] ok2c commented on issue #194: Switched to TLSv1.2 as default protocol if none provided

Posted by GitBox <gi...@apache.org>.
ok2c commented on issue #194: Switched to TLSv1.2 as default protocol if none provided
URL: https://github.com/apache/httpcomponents-core/pull/194#issuecomment-602189425
 
 
   @Hakky54 There still might be projects that make use of `SSLContextBuilder` to create `SSLContext` instances for some other purposes. It would certainly be sensible to exclude weak protocols at the time of `SSLContext` construction but I am not sure if there is a way to do so.  

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org