Scenario 1: Passthrough Termination

Scenario 1 offers encryption setup with SSL passthrough for HA Proxy and improved security for JVM.

Configure HA Proxy with SSL Passthrough

In this example, we setup SSL Passthrough, which sends SSL connections directly to the backend for termination. Unlike SSL Proxy Termination, the requests remain encrypted and the decryption load is distributed across the backend servers. However, the certificate information must be replicated on every server.
Add the following to your local.properties file, replacing <password> with the passwords configured for the properties.
datahub.security.https.enabled=true
datahub.server.url=https://localhost:8443/datahub-webapp/
 
datahub.security.basic.admin.user=<password>
datahub.security.basic.admin.password=<password>
Add the following to your Tomcat 8.5.x server.xml file.
   <Connector
protocol="org.apache.coyote.http11.Http11NioProtocol"
port="8443" maxThreads="200"
scheme="https" secure="true" SSLEnabled="true"
keystoreFile="/opt/tomcat/conf/datahub.jks" keystorePass="123456"
clientAuth="false" sslProtocol="TLS"/>

Configure Java Cryptography Extension (JCE) Provider

To enable higher crypto security in Java 7 and Java 8, we need to lift the 1024-bit long prime restriction on Diffie-Hellman. Follow the steps here: https://docs.oracle.com/cd/E19830-01/819-4712/ablsc/index.htmlInformation published on non-SAP site.

Alternately this may help
  1. Download these jars:

  2. Move the jars you just downloaded to $JAVA_HOME/lib/ext

  3. Edit $JAVA_HOME/lib/security/java.security as follows: security.provider.1=org.bouncycastle.jce.provider.BouncyCastleProvider

  4. Restart the app using JRE.

Update for JCE Security Policy

You must update your JCE Security Policy files to achieve an effective configuration..

  1. Download the Java Cryptography Extension (JCE) Unlimited Strength Jurisdiction Policy Files 8 Download zip

    http://www.oracle.com/technetwork/java/javase/downloads/jce8-download-2133166.htmlInformation published on non-SAP site.

  2. Extract the files from the zip. unzip jce_policy-8.zip

  3. Copy the jars.

    cp /usr/lib/jvm/java-1.8-openjdk/jre/lib/security/UnlimitedJCEPolicyJDK8/*.jar $JAVA_HOME/jre/lib/security/
  4. Set the security on the directory. chmod -R 640 $JAVA_HOME/jre/lib/security/

Steps Performed on the HAProxy Server

Edit your haproxy config file. The default path to this file is /etc/haproxy/haproxy.cfg. Depending on your test environment, this configuration file may be installed on another path.

global
    chroot /var/lib/haproxy
    #log /dev/log   local0
    #log /dev/log   local1 notice
    stats socket /run/haproxy/admin.sock mode 660 level admin
    stats timeout 30s
    user haproxy
    group haproxy
    daemon
 
    # Default SSL material locations
    ca-base /etc/ssl/certs
    crt-base /etc/ssl/private
 
    # Default ciphers to use on SSL-enabled listening sockets.
    # For more information, see ciphers(1SSL). This list is from:
    #  https://hynek.me/articles/hardening-your-web-servers-ssl-ciphers/
    ssl-default-bind-options no-sslv3
    ssl-default-bind-ciphers ECDH+AESGCM:DH+AESGCM:ECDH+AES256:DH+AES256:ECDH+AES128:DH+AES:RSA+AESGCM:RSA+AES:!aNULL:!MD5:!DSS
 
    ssl-default-server-options no-sslv3
    ssl-default-server-ciphers ECDH+AESGCM:DH+AESGCM:ECDH+AES256:DH+AES256:ECDH+AES128:DH+AES:RSA+AESGCM:RSA+AES:!aNULL:!MD5:!DSS
     
    tune.ssl.default-dh-param 2048
 
defaults
    log global
    mode    http
    option  httplog
    option  dontlognull
        timeout connect 5000
        timeout client  50000
        timeout server  50000
 
############################
# Scenario 1 Configure HA Proxy with SSL Passthrough
############################
 
frontend https_passthrough_front
   mode tcp
   bind *:9797
   #stats uri /haproxy?stats
   default_backend https_passthrough_back
 
backend https_passthrough_back
   mode tcp
   balance roundrobin
   option ssl-hello-chk
   option httpchk GET /datahub-webapp/v1/status HTTP/1.0\r\nAuthorization:\ Basic\ YWRtaW46c2VjcmV0
   server node1 172.17.0.1:8443 check check-ssl verify none
   server node2 172.17.0.2:8443 check check-ssl verify none
   server node3 172.17.0.3:8443 check check-ssl verify none
   http-check expect string Running
 
 
############################
 
listen stats
   bind *:8181
   stats enable
   stats uri /
   stats realm Haproxy\ Statistics
   stats auth admin:<password>

Test the HA Proxy with SSL Passthrough

curl Data Hub HA Proxy Passthrough

curl -k -v --insecure --user admin:<password> https://<haproxyIP>:9797/datahub-webapp/v1/status

The output of the curl command should include HTTP/1.1 200 OK.