How to Implement HAPROXY in Oracle Apps R12.1


Please read article on more website security checks How to Conduct a Website Security Check


In an earlier post, I shared how HAPROXY is used as a reverse proxy for Oracle Apps. Now I am going to share how to implement the same.

I am using a separate server to install HAproxy and one EBS server.

The HAProxy server(OEL 7) I am using in my environment is known as oel7.lab (DNS name I have mapped as funerptest.lab)

[root@oel7 ~]# cat /etc/hosts
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.56.110 oel7.lab oel7
192.168.56.110 funerptest.lab funerptest


Steps:

1) Install haproxy
[root@oel7 ~]# yum install haproxy
2) Validate haproxy installation

[root@oel7 ~]# which haproxy
/usr/sbin/haproxy
[root@oel7 ~]# ls -l /etc/haproxy
total 4
-rw-r--r-- 1 root root 3142 Jun 28  2019 haproxy.cfg


3) Check the status of haproxy

[root@oel7 ~]# systemctl status haproxy
● haproxy.service - HAProxy Load Balancer
   Loaded: loaded (/usr/lib/systemd/system/haproxy.service; disabled; vendor preset: disabled)
   Active: inactive (dead)

4) Enable haproxy services after reboot and Enable the outbound connection of haproxy.

[root@oel7 ~]# systemctl enable haproxy
Created symlink from /etc/systemd/system/multi-user.target.wants/haproxy.service to /usr/lib/systemd/system/haproxy.service.

[root@oel7 haproxy]# setsebool -P haproxy_connect_any 1
setsebool:  SELinux is disabled.
systemctl start haproxy
5) Copy certificate and key bundle from your location to /etc/haproxy/bundle.pem

I have created a self-signed certificate. You get a CA-signed certificate as well.

Please refer to the below link on how to create a self-signed certificate.


Club the server certificate and key together in a bundle.

[root@oel7 certificates]# cat server.crt server.key >>/etc/haproxy/bundle.pem
[root@oel7 certificates]# ls -ltr /etc/haproxy/bundle.pem
-rw-r--r-- 1 root root 2879 Mar 28 18:45 /etc/haproxy/bundle.pem

6)Backup original HA config file.

[root@oel7 certificates]# cd /etc/haproxy/
[root@oel7 haproxy]# ls -ltr
total 8
-rw-r--r-- 1 root root 3142 Jun 28  2019 haproxy.cfg
-rw-r--r-- 1 root root 2879 Mar 28 18:45 bundle.pem
[root@oel7 haproxy]# cp haproxy.cfg haproxy.cfg_orig

7) Edit and update defaults settings options in haproxy

Add option forwardfor except 127.0.0.0/8 header ClientIP

Add the following line to the Global section (ciphers must be all on one long line) to define a set of strong cipher suites: # Ristic's Apache CipherSuite selection ssl-default-bind-ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES128-SHA:ECDHE-ECDSA-AES256-SHA:ECDHE-ECDSA-AES128-SHA256:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES128-SHA:ECDHE-RSA-AES256-SHA:ECDHE-RSA-AES128-SHA256:ECDHE-RSA-AES256-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES256-SHA256:EDH-RSA-DES-CBC3-SHA


8) Edit and update Front end detail in haproxy config. It should have the correct certificate bundle path.

frontend main *:5000 bind 0.0.0.0:443 ssl no-sslv3 crt /etc/haproxy/bundle.pem default_backend ebs

9) Edit and Add Backend details in haproxy config. The URL is for EBS login.

backend ebs balance roundrobin mode http server ebs funebs122.lab:8050



10) Validate haproxy configuration

[root@oel7 haproxy]# haproxy -f /etc/haproxy/haproxy.cfg -c
[WARNING] 086/185942 (2949) : Setting tune.ssl.default-dh-param to 1024 by default, if your workload permits it you should set it to at least 2048. Please set a value >= 1024 to make this warning disappear.
Configuration file is valid

11) Shutdown application services on EBS and update context values to point to SSL haproxy DNS.

s_webentryurlprotocol ==> https
s_webentryhost ==> funerptest
s_webentrydomain ==> lab
s_active_webport ==> 443
s_login_page ==> https://funerptest.lab:443/OA_HTML/AppsLogin
s_endUserMonitoringURL ==> https://funerptest.lab:443/oracle_smp_chronos/oracle_smp_chronos_sdk.gif
s_external_url ==> https://funerptest.lab:443
s_chronosURL ==> https://funerptest.lab:443/oracle_smp_chronos/oracle_smp_chronos_sdk.gif
s_enable_sslterminator ==> Remove # value


12) Update httpd.conf file to make sure that the Actual Client IP is read in the access log not the haproxy server IP. In real this would be done in the template file to avoid removal of entry after autoconfig(httpd_conf_1013.tmp)

cd $FND_TOP/admin/template/custom
cp ../httpd_conf_1013.tmp .


Edit httpd_conf_1013.tmp on EBS server and uncomment below

UseWebCacheIp ON

13) Run autoconfig on EBS application.

14) Add compatibility URL setting in IE.

15) Re-test the new EBS URL with HTTPS. The client will only see haproxy server securing your main

ebs application server.




16) Reconfigure workflow or any other required setup as per the environment.






If you like please follow and comment