- 
                Notifications
    You must be signed in to change notification settings 
- Fork 9.1k
HADOOP-16371: Option to disable GCM for SSL connections when running on Java 8 #970
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
          
     Closed
      
      
    
  
     Closed
                    Changes from all commits
      Commits
    
    
  File filter
Filter by extension
Conversations
          Failed to load comments.   
        
        
          
      Loading
        
  Jump to
        
          Jump to file
        
      
      
          Failed to load files.   
        
        
          
      Loading
        
  Diff view
Diff view
There are no files selected for viewing
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
|  | @@ -1973,6 +1973,20 @@ | |
| </description> | ||
| </property> | ||
|  | ||
| <property> | ||
| <name>fs.s3a.ssl.channel.mode</name> | ||
| <value>default_jsse</value> | ||
| <description> | ||
| If secure connections to S3 are enabled, configures the SSL | ||
|          | ||
| implementation used to encrypt connections to S3. Supported values are: | ||
| "default_jsse" and "default_jsse_with_gcm". "default_jsse" uses the Java | ||
| Secure Socket Extension package (JSSE). However, when running on Java 8, | ||
| the GCM cipher is removed from the list of enabled ciphers. This is due | ||
| to performance issues with GCM in Java 8. "default_jsse_with_gcm" uses | ||
| the JSSE with the default list of cipher suites. | ||
| </description> | ||
| </property> | ||
|  | ||
| <!-- Azure file system properties --> | ||
| <property> | ||
| <name>fs.AbstractFileSystem.wasb.impl</name> | ||
|  | ||
        
          
          
            57 changes: 57 additions & 0 deletions
          
          57 
        
  ...p-common/src/test/java/org/apache/hadoop/security/ssl/TestDelegatingSSLSocketFactory.java
  
  
      
      
   
        
      
      
    
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,57 @@ | ||
| /* | ||
| * Licensed to the Apache Software Foundation (ASF) under one | ||
| * or more contributor license agreements. See the NOTICE file | ||
| * distributed with this work for additional information | ||
| * regarding copyright ownership. The ASF licenses this file | ||
| * to you under the Apache License, Version 2.0 (the | ||
| * "License"); you may not use this file except in compliance | ||
| * with the License. You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
|  | ||
| package org.apache.hadoop.security.ssl; | ||
|  | ||
| import java.io.IOException; | ||
| import java.util.Arrays; | ||
|  | ||
| import org.junit.Test; | ||
|  | ||
| import org.apache.hadoop.util.NativeCodeLoader; | ||
|  | ||
| import static org.assertj.core.api.Assertions.assertThat; | ||
| import static org.junit.Assume.assumeTrue; | ||
|  | ||
| /** | ||
| * Tests for {@link DelegatingSSLSocketFactory}. | ||
| */ | ||
| public class TestDelegatingSSLSocketFactory { | ||
|  | ||
| @Test | ||
| public void testOpenSSL() throws IOException { | ||
| assumeTrue("Unable to load native libraries", | ||
| NativeCodeLoader.isNativeCodeLoaded()); | ||
| assumeTrue("Build was not compiled with support for OpenSSL", | ||
| NativeCodeLoader.buildSupportsOpenssl()); | ||
| DelegatingSSLSocketFactory.initializeDefaultFactory( | ||
| DelegatingSSLSocketFactory.SSLChannelMode.OpenSSL); | ||
| assertThat(DelegatingSSLSocketFactory.getDefaultFactory() | ||
| .getProviderName()).contains("openssl"); | ||
| } | ||
|  | ||
| @Test | ||
| public void testJSEENoGCMJava8() throws IOException { | ||
| assumeTrue("Not running on Java 8", | ||
| System.getProperty("java.version").startsWith("1.8")); | ||
| DelegatingSSLSocketFactory.initializeDefaultFactory( | ||
| DelegatingSSLSocketFactory.SSLChannelMode.Default_JSSE); | ||
| assertThat(Arrays.stream(DelegatingSSLSocketFactory.getDefaultFactory() | ||
| .getSupportedCipherSuites())).noneMatch("GCM"::contains); | ||
| } | ||
| } | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
      
      Oops, something went wrong.
        
    
  
  Add this suggestion to a batch that can be applied as a single commit.
  This suggestion is invalid because no changes were made to the code.
  Suggestions cannot be applied while the pull request is closed.
  Suggestions cannot be applied while viewing a subset of changes.
  Only one suggestion per line can be applied in a batch.
  Add this suggestion to a batch that can be applied as a single commit.
  Applying suggestions on deleted lines is not supported.
  You must change the existing code in this line in order to create a valid suggestion.
  Outdated suggestions cannot be applied.
  This suggestion has been applied or marked resolved.
  Suggestions cannot be applied from pending reviews.
  Suggestions cannot be applied on multi-line comments.
  Suggestions cannot be applied while the pull request is queued to merge.
  Suggestion cannot be applied right now. Please check back later.
  
    
  
    
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.
By calling wildfly methods without using reflection, this class can only be loaded or used if wildfly is on the CP. While this is already a requirement of hadoop-azure, I don't want to add it to hadoop-aws. Somehow reflection is going to be needed here.
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.
The check in
NetworkBinding#bindSSLChannelModeexplicitly prevents S3A users from settingfs.s3a.ssl.channel.modetodefaultorOpenSSL, so there should be no way an S3A user can trigger the Wildfly jar from actually being used.IIUC Java correctly, a class should still be able to load this class without Wildfly on the classpath. Java only looks for the Wildly classes when a Wildly class is initialized (in this case
OpenSSLProvider). The import statements are only used during compilation. ref: https://stackoverflow.com/a/12620773/11511572There 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.
Thanks.
I always had the belief that integers and other simple constants may just get compiled in but that the class load Will kick off as soon as you reference a string in class. I should do more experiments. Maybe even learn Java assembly language. Anyway, as long as we don't try referencing, things like strings from the class, we should be okay. And as the little wild fly JAR is not currently on the hadoop-aws test CP, we are implicitly verifying this. We probably have to be careful once we had more support for it -we need to make sure we've not accidentally made it mandatory.