{"id":2626,"date":"2016-02-26T16:22:48","date_gmt":"2016-02-26T21:22:48","guid":{"rendered":"https:\/\/infotechguy.net\/?p=2626"},"modified":"2025-02-22T11:26:46","modified_gmt":"2025-02-22T16:26:46","slug":"masking-2-way-mutual-ssl-authentication-using-f5-ltm-or-haproxy","status":"publish","type":"post","link":"https:\/\/infotechguy.net\/?p=2626","title":{"rendered":"F5 BIGIP and HAProxy &#8212; Masking 2-Way &#8220;Mutual&#8221; SSL Authentication"},"content":{"rendered":"<p>Hello folks,<\/p>\n<p>So a recent post I published talked about <a href=\"https:\/\/infotechguy.net\/1-way-vs-2-way-ssl-authentication\/\">1-Way vs 2-way SSL Authentication<\/a> in some decent detail. We learned that 2-Way &#8220;Mutual&#8221; SSL Authentication can be used to enforce both parties attempting to communicate securely to provide authenticity. In other words, prove to each other that they are who they say they are. This can be very powerful from a security standpoint, but is it practical? The answer is, yes and no. The constraint comes from the aspect of administration (actually create certificates for each client) and manageability (keep accounting and maintaining actively lists of trusts) with the trade-off of proper authenticity. For example at first administering and managing 10 client certificates may be okay, but then imaging 100, or even a 1,000! So in this post I wanted to approach the idea of utilizing some tools we can use to offload some of this administration and management while maintaining Mutual Authentication with another entity. The idea revolves around one major assumption, users of a particular service (In this case a web-server) reside on a privately controlled and trusted network<\/p>\n<p>My idea is if we have a group of clients residing on an internal privately addressed network, we can use either an F5 LTM or HAProxy to proxy our users&#8217;s connections destined for a service that is enforcing 2-Way SSL &#8220;Mutual&#8221; Authentication. The F5 LTM or HAProxy would perform the 2-Way SSL Mutual Authentication <em>on behalf<\/em> of each connecting user, eliminating the technical need to generate certificates for each client, while maintaining an element of mutual trust to the end service.<\/p>\n<p><strong>The basic idea is: (notice only our F5 LTM\/HAproxy and the web-server perform 2-Way &#8220;Mutual&#8221; Authentication)<\/strong><\/p>\n<p><a href=\"https:\/\/infotechguy.net\/wp-content\/uploads\/2021\/03\/diagram1.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-3281 size-full\" src=\"https:\/\/infotechguy.net\/wp-content\/uploads\/2021\/03\/diagram1.png\" alt=\"\" width=\"894\" height=\"447\" srcset=\"https:\/\/infotechguy.net\/wp-content\/uploads\/2021\/03\/diagram1.png 894w, https:\/\/infotechguy.net\/wp-content\/uploads\/2021\/03\/diagram1-300x150.png 300w, https:\/\/infotechguy.net\/wp-content\/uploads\/2021\/03\/diagram1-768x384.png 768w\" sizes=\"auto, (max-width: 894px) 100vw, 894px\" \/><\/a><\/p>\n<h4><\/h4>\n<p><!--more--><\/p>\n<h3>Preliminary Steps:<\/h3>\n<p>For the following steps please read my <a href=\"https:\/\/infotechguy.net\/1-way-vs-2-way-ssl-authentication\/\">1-Way vs 2-Way SSL Authentication Post.<\/a><\/p>\n<ol>\n<li>\n<h5>Create a the <strong>web-server&#8217;<\/strong>s CSR and Key<\/h5>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" title=\"Creating Web-Server Key and CSR\">root@ca:\/opt# openssl req -config openssl-rootca.conf -extensions server_req_ext -new -nodes -newkey rsa:2048 -keyout web-server.key -out web-server.csr -days 365\nGenerating a 2048 bit RSA private key\n................................+++\n............................................................................+++\nwriting new private key to 'web-server2.key'\n-----\nYou are about to be asked to enter information that will be incorporated\ninto your certificate request.\nWhat you are about to enter is what is called a Distinguished Name or a DN.\nThere are quite a few fields but you can leave some blank\nFor some fields there will be a default value,\nIf you enter '.', the field will be left blank.\n-----\nEnter Country [US]:\nState or Province Name (full name) [Connecticut]:\nLocality Name (eg, city) [Wethersfield]:\nOrganization Name [thejimmahknows]:\nUnit Name [Test Unit]:\nCommon Name (e.g. server FQDN or YOUR name) []:web-server\nContact email for this Certificate [admin@example.com]:\n<\/pre>\n<p>&nbsp;<\/li>\n<li>\n<h5>Create the F5 &amp; HAproxy <strong>Server-Side<\/strong> CSR and Key<\/h5>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" title=\"Create F5 &amp; HAProxy Client CSR and Key\">root@ca:\/opt# openssl req -config openssl-rootca.conf -extensions client_req_ext -new -nodes -newkey rsa:2048 -keyout ha-client1.key -out ha-client1.csr -days 365\nGenerating a 2048 bit RSA private key\n...................+++\n.....+++\nwriting new private key to 'ha-client1.key'\n-----\nYou are about to be asked to enter information that will be incorporated\ninto your certificate request.\nWhat you are about to enter is what is called a Distinguished Name or a DN.\nThere are quite a few fields but you can leave some blank\nFor some fields there will be a default value,\nIf you enter '.', the field will be left blank.\n-----\nEnter Country [US]:\nState or Province Name (full name) [Connecticut]:\nLocality Name (eg, city) [Wethersfield]:\nOrganization Name [thejimmahknows]:\nUnit Name [Test Unit]:\nCommon Name (e.g. server FQDN or YOUR name) []:ha-client1\nContact email for this Certificate [admin@example.com]:\n<\/pre>\n<p>&nbsp;<\/li>\n<li>\n<h5>Create the F5 &amp; HAproxy <strong>Client-Side<\/strong> (connection the client will actual connect to)<\/h5>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" title=\"Create the client-side CSR and Key\">root@ca:\/opt# openssl req -config openssl-rootca.conf -extensions server_req_ext -new -nodes -newkey rsa:2048 -keyout virtual-service.key -out virtual-service.csr -days 365\nGenerating a 2048 bit RSA private key\n........................+++\n.............................................................+++\nwriting new private key to 'virtual-service.key'\n-----\nYou are about to be asked to enter information that will be incorporated\ninto your certificate request.\nWhat you are about to enter is what is called a Distinguished Name or a DN.\nThere are quite a few fields but you can leave some blank\nFor some fields there will be a default value,\nIf you enter '.', the field will be left blank.\n-----\nEnter Country [US]:\nState or Province Name (full name) [Connecticut]:\nLocality Name (eg, city) [Wethersfield]:\nOrganization Name [thejimmahknows]:\nUnit Name [Test Unit]:\nCommon Name (e.g. server FQDN or YOUR name) []:mytestvip\nContact email for this Certificate [admin@example.com]:\n<\/pre>\n<\/li>\n<li>\n<h5>Using our CA from my previous ariticle, sign all three of these certificates<\/h5>\n<p><strong>Sign the web-server&#8217;s CSR<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" title=\"Sign web-server CSR\">root@ca:\/opt# openssl ca -config openssl-rootca.conf -extensions server_req_ext -in web-server2.csr -out web-server2.crt\nUsing configuration from openssl-rootca.conf\nEnter pass phrase for \/opt\/rootCA.key:\nCheck that the request matches the signature\nSignature ok\nThe Subject's Distinguished Name is as follows\ncountryName           :PRINTABLE:'US'\nstateOrProvinceName   :ASN.1 12:'Connecticut'\nlocalityName          :ASN.1 12:'Wethersfield'\norganizationName      :ASN.1 12:'thejimmahknows'\norganizationalUnitName:ASN.1 12:'Test Unit'\ncommonName            :ASN.1 12:'web-server'\nCertificate is to be certified until Feb 25 15:10:27 2017 GMT (365 days)\nSign the certificate? [y\/n]:y\n\n\n1 out of 1 certificate requests certified, commit? [y\/n]y\nWrite out database with 1 new entries\nData Base Updated\n<\/pre>\n<p><strong>Sign the F5 &amp; HAProxy Server-Side CSR (This is the connection the F5 makes to our backend pool members)<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" title=\"Sign the F5 &amp; HAProxy Client-Side CSR\">root@ca:\/opt# openssl ca -config openssl-rootca.conf -extensions client_req_ext -in ha-client1.csr -out ha-client1.crt\nUsing configuration from openssl-rootca.conf\nEnter pass phrase for \/opt\/rootCA.key:\nCheck that the request matches the signature\nSignature ok\nThe Subject's Distinguished Name is as follows\ncountryName           :PRINTABLE:'US'\nstateOrProvinceName   :ASN.1 12:'Connecticut'\nlocalityName          :ASN.1 12:'Wethersfield'\norganizationName      :ASN.1 12:'thejimmahknows'\norganizationalUnitName:ASN.1 12:'Test Unit'\ncommonName            :ASN.1 12:'ha-client1'\nCertificate is to be certified until Feb 25 15:12:16 2017 GMT (365 days)\nSign the certificate? [y\/n]:y\n\n\n1 out of 1 certificate requests certified, commit? [y\/n]y\nWrite out database with 1 new entries\nData Base Updated\n<\/pre>\n<p><strong>Sign the F5 &amp; HAProxy Client-Side CSR (This is the connection our users will connect to, the VIP)<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" title=\"Sign the F5 &amp; HAProxy Client-Side CSR\">root@ca:\/opt# openssl ca -config openssl-rootca.conf -extensions server_req_ext -in virtual-service.csr -out virtual-service.crt\nUsing configuration from openssl-rootca.conf\nEnter pass phrase for \/opt\/rootCA.key:\nCheck that the request matches the signature\nSignature ok\nThe Subject's Distinguished Name is as follows\ncountryName           :PRINTABLE:'US'\nstateOrProvinceName   :ASN.1 12:'Connecticut'\nlocalityName          :ASN.1 12:'Wethersfield'\norganizationName      :ASN.1 12:'thejimmahknows'\norganizationalUnitName:ASN.1 12:'Test Unit'\ncommonName            :ASN.1 12:'mytestvip'\nCertificate is to be certified until Feb 25 15:15:09 2017 GMT (365 days)\nSign the certificate? [y\/n]:y\n\n\n1 out of 1 certificate requests certified, commit? [y\/n]y\nWrite out database with 1 new entries\nData Base Updated\n<\/pre>\n<p>&nbsp;<\/li>\n<li>\n<h5>Configure Apache web-server to enforce the 2-Way &#8220;Mutual&#8221; Authentication<\/h5>\n<p><strong> Apache Config from previous post.<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">root@web-server:\/opt# vi \/etc\/apache2\/sites-available\/default.conf\nListen 443\n&lt;VirtualHost *:443&gt;\n        DocumentRoot           \"\/var\/www\/\"\n\n        SSLEngine               on\n        SSLCACertificateFile   \/opt\/rootCA.crt\n        SSLCertificateFile     \/opt\/web-server.crt\n        SSLCertificateKeyFile  \/opt\/web-server.key\n       SSLCARevocationFile    \/opt\/rootCRL.crl\n        SSLStrictSNIVHostCheck on\n        SSLVerifyClient        require\n        SSLVerifyDepth         1\n\n# Allows PHP to read Certificate info\n        SSLOptions +stdEnvVars\n\n        LogFormat \"%h %l %u %t \\\"%r\\\" %&gt;s %b \\\"%{Referer}i\\\" \\\"%{User-Agent}i\\\"\" combined\n        CustomLog \"\/tmp\/access.log\" combined\n        ErrorLog \"\/tmp\/error.log\"\n\n&lt;\/VirtualHost&gt;\n<\/pre>\n<p><strong>Restart Apache<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">root@web-server:\/opt# service apache2 restart<\/pre>\n<p><strong> For Troubleshooting create this index.php file<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" title=\"index.php troubleshooting file\">&lt;?php\necho \"Date       =   \" . date('Y-m-d H:i:s') . \"&lt;br&gt;\";\n\necho \"Client Cert =  \" . $_SERVER['SSL_CLIENT_S_DN_CN'] . \"&lt;br&gt;\";\necho \"Server Cert =  \" . $_SERVER['SSL_SERVER_S_DN_CN'] . \"&lt;br&gt;\";\necho \"Server Serial =  \" . $_SERVER['SSL_SERVER_M_SERIAL'] . \"&lt;br&gt;\";\n?&gt;\n<\/pre>\n<p>&nbsp;<\/li>\n<\/ol>\n<h3>Masking with F5 LTM:<\/h3>\n<ol>\n<li>\n<h5><strong>Importing Certificates<\/strong><\/h5>\n<p><a href=\"https:\/\/infotechguy.net\/wp-content\/uploads\/2021\/03\/F5-Import-Certificates.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-3283 size-full\" src=\"https:\/\/infotechguy.net\/wp-content\/uploads\/2021\/03\/F5-Import-Certificates.jpg\" alt=\"\" width=\"581\" height=\"683\" srcset=\"https:\/\/infotechguy.net\/wp-content\/uploads\/2021\/03\/F5-Import-Certificates.jpg 581w, https:\/\/infotechguy.net\/wp-content\/uploads\/2021\/03\/F5-Import-Certificates-255x300.jpg 255w\" sizes=\"auto, (max-width: 581px) 100vw, 581px\" \/><\/a><\/p>\n<p><a href=\"https:\/\/infotechguy.net\/wp-content\/uploads\/2021\/03\/F5-Import-Cert.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-3284 size-full\" src=\"https:\/\/infotechguy.net\/wp-content\/uploads\/2021\/03\/F5-Import-Cert.jpg\" alt=\"\" width=\"1200\" height=\"404\" srcset=\"https:\/\/infotechguy.net\/wp-content\/uploads\/2021\/03\/F5-Import-Cert.jpg 1200w, https:\/\/infotechguy.net\/wp-content\/uploads\/2021\/03\/F5-Import-Cert-300x101.jpg 300w, https:\/\/infotechguy.net\/wp-content\/uploads\/2021\/03\/F5-Import-Cert-1024x345.jpg 1024w, https:\/\/infotechguy.net\/wp-content\/uploads\/2021\/03\/F5-Import-Cert-768x259.jpg 768w\" sizes=\"auto, (max-width: 1200px) 100vw, 1200px\" \/><\/a><\/p>\n<ul>\n<li><strong>Import virtual-service certificate<\/strong>\n<ul>\n<li><a href=\"https:\/\/infotechguy.net\/wp-content\/uploads\/2021\/03\/import-virtual-service-ssl.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-3286\" src=\"https:\/\/infotechguy.net\/wp-content\/uploads\/2021\/03\/import-virtual-service-ssl-300x154.png\" alt=\"\" width=\"600\" height=\"308\" srcset=\"https:\/\/infotechguy.net\/wp-content\/uploads\/2021\/03\/import-virtual-service-ssl-300x154.png 300w, https:\/\/infotechguy.net\/wp-content\/uploads\/2021\/03\/import-virtual-service-ssl.png 707w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><\/a><\/li>\n<li><a href=\"https:\/\/infotechguy.net\/wp-content\/uploads\/2021\/03\/virtual-service-ssl-shown.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-3287\" src=\"https:\/\/infotechguy.net\/wp-content\/uploads\/2021\/03\/virtual-service-ssl-shown-300x166.png\" alt=\"\" width=\"600\" height=\"332\" srcset=\"https:\/\/infotechguy.net\/wp-content\/uploads\/2021\/03\/virtual-service-ssl-shown-300x166.png 300w, https:\/\/infotechguy.net\/wp-content\/uploads\/2021\/03\/virtual-service-ssl-shown.png 733w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><\/a><\/li>\n<li><a href=\"https:\/\/infotechguy.net\/wp-content\/uploads\/2021\/03\/Import-virtual-service-cert.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-3288\" src=\"https:\/\/infotechguy.net\/wp-content\/uploads\/2021\/03\/Import-virtual-service-cert-300x141.png\" alt=\"\" width=\"600\" height=\"282\" srcset=\"https:\/\/infotechguy.net\/wp-content\/uploads\/2021\/03\/Import-virtual-service-cert-300x141.png 300w, https:\/\/infotechguy.net\/wp-content\/uploads\/2021\/03\/Import-virtual-service-cert.png 453w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><\/a><\/li>\n<\/ul>\n<\/li>\n<li><strong>Import ha-client1 certificate<\/strong>\n<ul>\n<li>Use the same steps from above.<\/li>\n<\/ul>\n<\/li>\n<li><strong>Import the rootCA certificate (used to authenticate the web-server)<\/strong>\n<ul>\n<li>Use the same steps from above.<br \/>\n<a href=\"https:\/\/infotechguy.net\/wp-content\/uploads\/2021\/03\/Import-my-Root-CA.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-3289\" src=\"https:\/\/infotechguy.net\/wp-content\/uploads\/2021\/03\/Import-my-Root-CA-300x152.png\" alt=\"\" width=\"600\" height=\"304\" srcset=\"https:\/\/infotechguy.net\/wp-content\/uploads\/2021\/03\/Import-my-Root-CA-300x152.png 300w, https:\/\/infotechguy.net\/wp-content\/uploads\/2021\/03\/Import-my-Root-CA.png 450w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><\/a><\/li>\n<\/ul>\n<\/li>\n<li><strong>All 3 Certificates imported<\/strong><\/li>\n<li><a href=\"https:\/\/infotechguy.net\/wp-content\/uploads\/2021\/03\/Import-Completed.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-3290\" src=\"https:\/\/infotechguy.net\/wp-content\/uploads\/2021\/03\/Import-Completed-300x121.jpg\" alt=\"\" width=\"600\" height=\"242\" srcset=\"https:\/\/infotechguy.net\/wp-content\/uploads\/2021\/03\/Import-Completed-300x121.jpg 300w, https:\/\/infotechguy.net\/wp-content\/uploads\/2021\/03\/Import-Completed-1024x412.jpg 1024w, https:\/\/infotechguy.net\/wp-content\/uploads\/2021\/03\/Import-Completed-768x309.jpg 768w, https:\/\/infotechguy.net\/wp-content\/uploads\/2021\/03\/Import-Completed.jpg 1207w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><\/a><\/li>\n<\/ul>\n<\/li>\n<li>\n<h5>Create the SSL Profiles<\/h5>\n<ul>\n<li><strong>Create the client-side-connection SSL profile<\/strong>\n<ul>\n<li><a href=\"https:\/\/infotechguy.net\/wp-content\/uploads\/2021\/03\/Create-Client-SSLProfile.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-3291\" src=\"https:\/\/infotechguy.net\/wp-content\/uploads\/2021\/03\/Create-Client-SSLProfile.jpg\" alt=\"\" width=\"600\" height=\"581\" srcset=\"https:\/\/infotechguy.net\/wp-content\/uploads\/2021\/03\/Create-Client-SSLProfile.jpg 605w, https:\/\/infotechguy.net\/wp-content\/uploads\/2021\/03\/Create-Client-SSLProfile-300x291.jpg 300w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><\/a><\/li>\n<li><a href=\"https:\/\/infotechguy.net\/wp-content\/uploads\/2021\/03\/new-client-side-connection.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-3292\" src=\"https:\/\/infotechguy.net\/wp-content\/uploads\/2021\/03\/new-client-side-connection-298x300.png\" alt=\"\" width=\"600\" height=\"605\" srcset=\"https:\/\/infotechguy.net\/wp-content\/uploads\/2021\/03\/new-client-side-connection-298x300.png 298w, https:\/\/infotechguy.net\/wp-content\/uploads\/2021\/03\/new-client-side-connection-150x150.png 150w, https:\/\/infotechguy.net\/wp-content\/uploads\/2021\/03\/new-client-side-connection.png 744w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><\/a><\/li>\n<\/ul>\n<\/li>\n<li><strong>Create the server-side-connection SSL profile<\/strong>\n<ul>\n<li><a href=\"https:\/\/infotechguy.net\/wp-content\/uploads\/2021\/03\/Create-Server-SSLProfile.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-3294\" src=\"https:\/\/infotechguy.net\/wp-content\/uploads\/2021\/03\/Create-Server-SSLProfile-300x287.jpg\" alt=\"\" width=\"600\" height=\"574\" srcset=\"https:\/\/infotechguy.net\/wp-content\/uploads\/2021\/03\/Create-Server-SSLProfile-300x287.jpg 300w, https:\/\/infotechguy.net\/wp-content\/uploads\/2021\/03\/Create-Server-SSLProfile.jpg 617w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><\/a><\/li>\n<li><a href=\"https:\/\/infotechguy.net\/wp-content\/uploads\/2021\/03\/server-side-connection-profile1.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-3295\" src=\"https:\/\/infotechguy.net\/wp-content\/uploads\/2021\/03\/server-side-connection-profile1-264x300.jpg\" alt=\"\" width=\"600\" height=\"681\" srcset=\"https:\/\/infotechguy.net\/wp-content\/uploads\/2021\/03\/server-side-connection-profile1-264x300.jpg 264w, https:\/\/infotechguy.net\/wp-content\/uploads\/2021\/03\/server-side-connection-profile1-902x1024.jpg 902w, https:\/\/infotechguy.net\/wp-content\/uploads\/2021\/03\/server-side-connection-profile1-768x872.jpg 768w, https:\/\/infotechguy.net\/wp-content\/uploads\/2021\/03\/server-side-connection-profile1.jpg 919w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><\/a><\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<h5>Create the Server Pool<\/h5>\n<ul>\n<li><a href=\"https:\/\/infotechguy.net\/wp-content\/uploads\/2021\/03\/create-f5-pool.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-3296\" src=\"https:\/\/infotechguy.net\/wp-content\/uploads\/2021\/03\/create-f5-pool-300x294.jpg\" alt=\"\" width=\"600\" height=\"588\" srcset=\"https:\/\/infotechguy.net\/wp-content\/uploads\/2021\/03\/create-f5-pool-300x294.jpg 300w, https:\/\/infotechguy.net\/wp-content\/uploads\/2021\/03\/create-f5-pool.jpg 658w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><\/a><\/li>\n<li>Verify Pool Status is GOOD<a href=\"https:\/\/infotechguy.net\/wp-content\/uploads\/2021\/03\/Pool-status-good.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-3297\" src=\"https:\/\/infotechguy.net\/wp-content\/uploads\/2021\/03\/Pool-status-good-300x169.png\" alt=\"\" width=\"600\" height=\"337\" srcset=\"https:\/\/infotechguy.net\/wp-content\/uploads\/2021\/03\/Pool-status-good-300x169.png 300w, https:\/\/infotechguy.net\/wp-content\/uploads\/2021\/03\/Pool-status-good.png 370w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><\/a><\/li>\n<\/ul>\n<\/li>\n<li>\n<h5>Create the Virtual Server aka VIP<\/h5>\n<ul>\n<li><a href=\"https:\/\/infotechguy.net\/wp-content\/uploads\/2021\/03\/create-vip-general-properties.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-3298\" src=\"https:\/\/infotechguy.net\/wp-content\/uploads\/2021\/03\/create-vip-general-properties-232x300.png\" alt=\"\" width=\"600\" height=\"777\" srcset=\"https:\/\/infotechguy.net\/wp-content\/uploads\/2021\/03\/create-vip-general-properties-232x300.png 232w, https:\/\/infotechguy.net\/wp-content\/uploads\/2021\/03\/create-vip-general-properties.png 695w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><\/a><\/li>\n<li><a href=\"https:\/\/infotechguy.net\/wp-content\/uploads\/2021\/03\/create-vip-resources.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-3299\" src=\"https:\/\/infotechguy.net\/wp-content\/uploads\/2021\/03\/create-vip-resources-300x167.png\" alt=\"\" width=\"600\" height=\"333\" srcset=\"https:\/\/infotechguy.net\/wp-content\/uploads\/2021\/03\/create-vip-resources-300x167.png 300w, https:\/\/infotechguy.net\/wp-content\/uploads\/2021\/03\/create-vip-resources.png 700w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><\/a><\/li>\n<li>Verify VIP (Vritual Server) looks good<br \/>\n<a href=\"https:\/\/infotechguy.net\/wp-content\/uploads\/2021\/03\/virtual-service-looks-good.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-3300\" src=\"https:\/\/infotechguy.net\/wp-content\/uploads\/2021\/03\/virtual-service-looks-good-300x69.png\" alt=\"\" width=\"600\" height=\"139\" srcset=\"https:\/\/infotechguy.net\/wp-content\/uploads\/2021\/03\/virtual-service-looks-good-300x69.png 300w, https:\/\/infotechguy.net\/wp-content\/uploads\/2021\/03\/virtual-service-looks-good-768x178.png 768w, https:\/\/infotechguy.net\/wp-content\/uploads\/2021\/03\/virtual-service-looks-good.png 942w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><\/a><\/li>\n<\/ul>\n<\/li>\n<li>\n<h5><strong>Test by using Chrome to connect to our virtual-service<\/strong><\/h5>\n<p><a href=\"https:\/\/infotechguy.net\/wp-content\/uploads\/2021\/03\/Success-F5.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-3301\" src=\"https:\/\/infotechguy.net\/wp-content\/uploads\/2021\/03\/Success-F5-300x138.png\" alt=\"\" width=\"600\" height=\"277\" srcset=\"https:\/\/infotechguy.net\/wp-content\/uploads\/2021\/03\/Success-F5-300x138.png 300w, https:\/\/infotechguy.net\/wp-content\/uploads\/2021\/03\/Success-F5.png 494w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><\/a><\/li>\n<li>\n<h5>Certificate revocation<\/h5>\n<ul>\n<li><strong>Revoke the ha-client1.crt<\/strong> (The certificate the F5 authenticates with when connecting to the web-server)\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" title=\"Revoke ha-client.crt\">root@ca:\/opt# openssl ca -config openssl-rootca.conf -revoke ha-client1.crt -crl_reason keyCompromise\nUsing configuration from openssl-rootca.conf\nEnter pass phrase for \/opt\/rootCA.key:\nRevoking Certificate 1005.\nData Base Updated\n<\/pre>\n<\/li>\n<li><strong>Re-generate the CRL<\/strong>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" title=\"Re-generate the CRL\">root@ca:\/opt# openssl ca -config openssl-rootca.conf -gencrl -out rootCRL.crl\nUsing configuration from openssl-rootca.conf\nEnter pass phrase for \/opt\/rootCA.key:\n\nroot@ca:\/opt# openssl crl -noout -text -in rootCRL.crl\nCertificate Revocation List (CRL):\n        Version 2 (0x1)\n    Signature Algorithm: sha256WithRSAEncryption\n        Issuer: \/C=US\/ST=Connecticut\/L=Wethersfield\/O=thejimmahknows\/OU=Test Unit\/CN=MyRootAuthority\/emailAddress=admin@example.com\n        Last Update: Feb 26 18:42:33 2016 GMT\n        Next Update: Mar 27 18:42:33 2016 GMT\n        CRL extensions:\n            X509v3 Authority Key Identifier: \n                keyid:E3:A6:FD:69:23:0A:25:AF:7B:77:7A:B8:03:0B:B6:8A:CF:F2:B2:B8\n\n            Authority Information Access: \n                CA Issuers - URI:http:\/\/ocsp.thejimmahknows.com\/rootCA.crt\n\n            X509v3 CRL Number: \n                4100\nRevoked Certificates:\n    Serial Number: 1003\n        Revocation Date: Jan 16 18:55:22 2016 GMT\n    Serial Number: 1005\n        Revocation Date: Feb 26 18:38:04 2016 GMT\n        CRL entry extensions:\n            X509v3 CRL Reason Code: \n                Key Compromise\n<\/pre>\n<p><strong>Notice the Serial Number 1005 is revoked in the CRL file now.<\/strong><\/li>\n<li><strong>Replace the rootCRL.crl file on the web-server and restart Apache<\/strong>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">scp \/opt\/rootCRL.crl root@web-server:\/opt\/rootCRL.crl\n\nroot@web-server:\/opt# service apache2 restart<\/pre>\n<\/li>\n<li><strong>Test using the virtual-service VIP on the F5 again.<\/strong><br \/>\n<a href=\"https:\/\/infotechguy.net\/wp-content\/uploads\/2021\/03\/Revoked-Successful.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-3303\" src=\"https:\/\/infotechguy.net\/wp-content\/uploads\/2021\/03\/Revoked-Successful-300x197.png\" alt=\"\" width=\"600\" height=\"394\" srcset=\"https:\/\/infotechguy.net\/wp-content\/uploads\/2021\/03\/Revoked-Successful-300x197.png 300w, https:\/\/infotechguy.net\/wp-content\/uploads\/2021\/03\/Revoked-Successful-768x504.png 768w, https:\/\/infotechguy.net\/wp-content\/uploads\/2021\/03\/Revoked-Successful.png 775w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><\/a><\/li>\n<\/ul>\n<\/li>\n<\/ol>\n<h3>Masking with HAProxy:<\/h3>\n<p><em>If you are unfamiliar with HAProxy, I recommend checking out my <a href=\"https:\/\/infotechguy.net\/load-balancing-with-haproxy-1-4\/\">article on setting up HAProxy<\/a>. Or my articles on using <a href=\"https:\/\/infotechguy.net\/the-bigip-f5-alterantive-using-haproxy-and-keepalived-part-1\/\" target=\"_blank\" rel=\"noopener noreferrer\">HAProxy as a F5 LTM replacement.<\/a><\/em><\/p>\n<ol>\n<li><strong>Before we being, we have to generate and sign another certificate and key because we revoked the ha-client.crt perviously.<\/strong>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" title=\"Re-generate a ha-client CSR and Key\">root@ca:\/opt# openssl req -config openssl-rootca.conf -extensions client_req_ext -new -nodes -newkey rsa:2048 -keyout ha-client2.key -out ha-client2.csr -days 365\nGenerating a 2048 bit RSA private key\n.+++\n....................................+++\nwriting new private key to 'ha-client2.key'\n-----\nYou are about to be asked to enter information that will be incorporated\ninto your certificate request.\nWhat you are about to enter is what is called a Distinguished Name or a DN.\nThere are quite a few fields but you can leave some blank\nFor some fields there will be a default value,\nIf you enter '.', the field will be left blank.\n-----\nEnter Country [US]:\nState or Province Name (full name) [Connecticut]:\nLocality Name (eg, city) [Wethersfield]:\nOrganization Name [thejimmahknows]:\nUnit Name [Test Unit]:\nCommon Name (e.g. server FQDN or YOUR name) []:ha-client2\nContact email for this Certificate [admin@example.com]:\n<\/pre>\n<p><strong>And Sign it<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" title=\"Sign the ha-client2 cert\">root@ca:\/opt# openssl ca -config openssl-rootca.conf -extensions client_req_ext -in ha-client2.csr -out ha-client2.crt\nUsing configuration from openssl-rootca.conf\nEnter pass phrase for \/opt\/rootCA.key:\nCheck that the request matches the signature\nSignature ok\nThe Subject's Distinguished Name is as follows\ncountryName           :PRINTABLE:'US'\nstateOrProvinceName   :ASN.1 12:'Connecticut'\nlocalityName          :ASN.1 12:'Wethersfield'\norganizationName      :ASN.1 12:'thejimmahknows'\norganizationalUnitName:ASN.1 12:'Test Unit'\ncommonName            :ASN.1 12:'ha-client2'\nCertificate is to be certified until Feb 25 19:47:40 2017 GMT (365 days)\nSign the certificate? [y\/n]:y\n\n\n1 out of 1 certificate requests certified, commit? [y\/n]y\nWrite out database with 1 new entries\nData Base Updated\n<\/pre>\n<\/li>\n<li><strong>Copy All 3 certificates to our HAProxy server<\/strong>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" title=\"Copy certs to HAproxy box\">root@ca:\/opt# scp virtual-service.* root@172.16.0.44:\/opt\/\nroot@ca:\/opt# scp ha-client2.* root@172.16.0.44:\/opt\/\nroot@ca:\/opt# scp rootCA.crt root@172.16.0.44:\/opt\/<\/pre>\n<\/li>\n<li><strong>We need to chain the virtual-service certificate with the root CA certificate for HAProxy to accept it.<\/strong> (<a href=\"https:\/\/www.digicert.com\/ssl-support\/pem-ssl-creation.htm\" target=\"_blank\" rel=\"noopener noreferrer\">For help reference this<\/a>)\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" title=\"Chaining the virtual-servers pem file\">root@test-haproxy:\/opt# cat virtual-service.key &gt;&gt; virtual-service-chain.pem\nroot@test-haproxy:\/opt# cat virtual-service.crt &gt;&gt; virtual-service-chain.pem\nroot@test-haproxy:\/opt# cat rootCA.crt &gt;&gt; virtual-service-chain.pem<\/pre>\n<p><strong>And ha-client2<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">root@test-haproxy:\/opt# cat ha-client2.key &gt;&gt; ha-client2.pem\nroot@test-haproxy:\/opt# cat ha-client2.crt &gt;&gt; ha-client2.pem \n<\/pre>\n<\/li>\n<li><strong>\u00a0Edit your haproxy.conf file to match<\/strong>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" title=\"haproxy.conf\">global\n        log \/dev\/log    local0\n        log \/dev\/log    local1 notice\n        chroot \/var\/lib\/haproxy\n        stats socket \/run\/haproxy\/admin.sock mode 660 level admin\n        stats timeout 30s\n       user haproxy\n       group haproxy\n        daemon\n\n        # Default SSL material locations\n        ca-base \/etc\/ssl\/certs\n        crt-base \/etc\/ssl\/private\n\n        # Default ciphers to use on SSL-enabled listening sockets.\n        # For more information, see ciphers(1SSL). This list is from:\n        #  https:\/\/hynek.me\/articles\/hardening-your-web-servers-ssl-ciphers\/\n        ssl-default-bind-ciphers ECDH+AESGCM:DH+AESGCM:ECDH+AES256:DH+AES256:ECDH+AES128:DH+AES:ECDH+3DES:DH+3DES:RSA+AESGCM:RSA+AES:RSA+3DES:!aNULL:!MD5:!DSS\n        ssl-default-bind-options no-sslv3\n        tune.ssl.default-dh-param 2048\n\ndefaults\n        log     global\n        timeout connect 5000\n        timeout client  50000\n        timeout server  50000\n        errorfile 400 \/etc\/haproxy\/errors\/400.http\n        errorfile 403 \/etc\/haproxy\/errors\/403.http\n        errorfile 408 \/etc\/haproxy\/errors\/408.http\n        errorfile 500 \/etc\/haproxy\/errors\/500.http\n        errorfile 502 \/etc\/haproxy\/errors\/502.http\n        errorfile 503 \/etc\/haproxy\/errors\/503.http\n        errorfile 504 \/etc\/haproxy\/errors\/504.http\n\n\nfrontend vs_172.16.0.44_443\n        bind 172.16.0.44:443 ssl crt \/opt\/virtual-service-chain.pem\n        default_backend pool_test2waySSL\n\n\nbackend pool_test2waySSL\n        server testweb01 172.16.0.25:443 ssl verify required ca-file \/opt\/rootCA.crt crt \/opt\/ha-client2.pem\n<\/pre>\n<\/li>\n<li><strong>Success!!<\/strong><br \/>\n<a href=\"https:\/\/infotechguy.net\/wp-content\/uploads\/2021\/03\/HAProxy-Success.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-3304\" src=\"https:\/\/infotechguy.net\/wp-content\/uploads\/2021\/03\/HAProxy-Success-300x139.png\" alt=\"\" width=\"600\" height=\"278\" srcset=\"https:\/\/infotechguy.net\/wp-content\/uploads\/2021\/03\/HAProxy-Success-300x139.png 300w, https:\/\/infotechguy.net\/wp-content\/uploads\/2021\/03\/HAProxy-Success.png 510w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><\/a><\/li>\n<li><strong>Revocation test<\/strong>\n<ul>\n<li><strong>Revoke and re-generate the rootCRL.crl file<\/strong>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" title=\"Revoke\">root@ca:\/opt# openssl ca -config openssl-rootca.conf -revoke ha-client2.crt -crl_reason keyCompromise\nUsing configuration from openssl-rootca.conf\nEnter pass phrase for \/opt\/rootCA.key:\nRevoking Certificate 1007.\nData Base Updated\n<\/pre>\n<p><strong>And re-generate the CRL<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" title=\"re-generate CRL\">root@ca:\/opt# openssl ca -config openssl-rootca.conf -gencrl -out rootCRL.crl\nUsing configuration from openssl-rootca.conf\nEnter pass phrase for \/opt\/rootCA.key:\n<\/pre>\n<\/li>\n<li><strong>Reload Apache on our web-server to pick up the new CRL file<\/strong>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" title=\"Restart Apache2\">root@web-server:\/opt# service apache2 restart<\/pre>\n<\/li>\n<li><strong>Now we test&#8230;.<\/strong><br \/>\n<a href=\"https:\/\/infotechguy.net\/wp-content\/uploads\/2021\/03\/haproxy-revoke.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-3305\" src=\"https:\/\/infotechguy.net\/wp-content\/uploads\/2021\/03\/haproxy-revoke-300x191.png\" alt=\"\" width=\"600\" height=\"383\" srcset=\"https:\/\/infotechguy.net\/wp-content\/uploads\/2021\/03\/haproxy-revoke-300x191.png 300w, https:\/\/infotechguy.net\/wp-content\/uploads\/2021\/03\/haproxy-revoke-768x490.png 768w, https:\/\/infotechguy.net\/wp-content\/uploads\/2021\/03\/haproxy-revoke.png 785w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><\/a><\/li>\n<\/ul>\n<\/li>\n<\/ol>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Hello folks, So a recent post I published talked about 1-Way vs 2-way SSL Authentication in some decent detail. We learned that 2-Way &#8220;Mutual&#8221; SSL Authentication can be used to enforce both parties attempting to&#46;&#46;&#46;<\/p>\n","protected":false},"author":2,"featured_media":4241,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[65,112],"class_list":["post-2626","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-f5","tag-f5","tag-security-2"],"_links":{"self":[{"href":"https:\/\/infotechguy.net\/index.php?rest_route=\/wp\/v2\/posts\/2626","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/infotechguy.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/infotechguy.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/infotechguy.net\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/infotechguy.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2626"}],"version-history":[{"count":1,"href":"https:\/\/infotechguy.net\/index.php?rest_route=\/wp\/v2\/posts\/2626\/revisions"}],"predecessor-version":[{"id":4145,"href":"https:\/\/infotechguy.net\/index.php?rest_route=\/wp\/v2\/posts\/2626\/revisions\/4145"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/infotechguy.net\/index.php?rest_route=\/wp\/v2\/media\/4241"}],"wp:attachment":[{"href":"https:\/\/infotechguy.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2626"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/infotechguy.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2626"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/infotechguy.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2626"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}