View Javadoc

1   /**
2    * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
3    * agreements. See the NOTICE file distributed with this work for additional information regarding
4    * copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the
5    * "License"); you may not use this file except in compliance with the License. You may obtain a
6    * copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable
7    * law or agreed to in writing, software distributed under the License is distributed on an "AS IS"
8    * BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License
9    * for the specific language governing permissions and limitations under the License.
10   */
11  package org.apache.hadoop.hbase.jetty;
12  
13  import java.io.IOException;
14  import java.util.ArrayList;
15  
16  import javax.net.ssl.SSLEngine;
17  
18  import org.mortbay.jetty.security.SslSelectChannelConnector;
19  
20  /**
21   * Avoid SSL V3.0 "Poodle" Vulnerability - CVE-2014-3566
22   */
23  public class SslSelectChannelConnectorSecure extends SslSelectChannelConnector {
24    @Override
25    protected SSLEngine createSSLEngine() throws IOException {
26      SSLEngine sslEngine = super.createSSLEngine();
27      ArrayList<String> secureProtocols = new ArrayList<String>();
28      for (String p : sslEngine.getEnabledProtocols()) {
29        if (!p.contains("SSLv3")) {
30          secureProtocols.add(p);
31        }
32      }
33      sslEngine.setEnabledProtocols(secureProtocols.toArray(new String[secureProtocols.size()]));
34      return sslEngine;
35    }
36  }