{"id":875,"date":"2015-04-23T11:36:40","date_gmt":"2015-04-23T09:36:40","guid":{"rendered":"https:\/\/www.vioreliftode.com\/?p=875"},"modified":"2016-04-14T13:38:34","modified_gmt":"2016-04-14T11:38:34","slug":"adfs-3-0-wap-sni-and-network-load-balancing","status":"publish","type":"post","link":"https:\/\/www.vioreliftode.com\/index.php\/adfs-3-0-wap-sni-and-network-load-balancing\/","title":{"rendered":"ADFS 3.0, WAP, SNI and Network Load Balancing"},"content":{"rendered":"<input class=\"fooboxshare_post_id\" type=\"hidden\" value=\"875\"\/><p>So you decide to build an ADFS 3.0 farm using Windows Server 2012 R2. You configure the farm properly and the ADFS checks performed directly on the ADFS servers are working fine.<\/p>\n<p>&nbsp;<\/p>\n<p>The next step is to load balance the traffic between the two ADFS nodes. To achieve this functionality you will use a NLB solution. Let&#8217;s assume you will use <a href=\"http:\/\/www.iis.net\/downloads\/microsoft\/application-request-routing\" target=\"_blank\">IIS + ARR<\/a>.<br \/>\n<em>Please note this scenario is valid also for other NLB solutions. I mention here IIS + ARR for the simple fact IIS + ARR are Microsoft solutions and a lot of companies are leveraging first the Microsoft solution (before looking into alternatives).<\/em><\/p>\n<p>&nbsp;<\/p>\n<p>After you properly configure the IIS + ARR to load balance the traffic between the two ADFS servers, you try to verify the connection usually by connecting at <strong>https:\/\/<em>[yourSTSfqdn]<\/em>\/adfs\/ls\/idpinitiatedsignon.htm<\/strong>, but you receive a HTTP 502.<\/p>\n<p style=\"margin: 0in; font-family: Verdana; font-size: 10.0pt; color: #cc0000;\"><span style=\"font-weight: bold;\">502 &#8211; Web server received an invalid response while acting as a gateway or proxy server.<\/span><\/p>\n<p style=\"margin-top: 7pt; margin-bottom: 0pt; font-family: Verdana; font-size: 10.0pt; color: black;\"><span style=\"font-weight: bold;\">There is a problem with the page you are looking for, and it cannot be displayed. When the Web server (while acting as a gateway or proxy) contacted the upstream content server, it received an invalid response from the content server.<\/span><\/p>\n<p style=\"margin-top: 7pt; margin-bottom: 0pt; font-family: Verdana; font-size: 10.0pt; color: black;\"><span style=\"font-weight: bold;\">The page will be available soon.<\/span><\/p>\n<p>\u00a0<a href=\"https:\/\/www.vioreliftode.com\/wp-content\/uploads\/2015\/04\/ADFS_3.0_WAP_SNI_and_Network_Load_Balancing_01.png\"><img loading=\"lazy\" class=\"alignleft size-full wp-image-877\" src=\"https:\/\/www.vioreliftode.com\/wp-content\/uploads\/2015\/04\/ADFS_3.0_WAP_SNI_and_Network_Load_Balancing_01.png\" alt=\"ADFS_3.0_WAP_SNI_and_Network_Load_Balancing_01\" width=\"822\" height=\"359\" srcset=\"https:\/\/www.vioreliftode.com\/wp-content\/uploads\/2015\/04\/ADFS_3.0_WAP_SNI_and_Network_Load_Balancing_01.png 822w, https:\/\/www.vioreliftode.com\/wp-content\/uploads\/2015\/04\/ADFS_3.0_WAP_SNI_and_Network_Load_Balancing_01-300x131.png 300w\" sizes=\"(max-width: 822px) 100vw, 822px\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<p><strong>What\u2019s the reason?<\/strong><br \/>\n<span style=\"text-decoration: underline;\">ADFS 3.0<\/span> (part of Windows Server 2012 R2) is <span style=\"text-decoration: underline;\">by default<\/span> setup (by the ADFS Configuration Wizard) to <span style=\"text-decoration: underline;\">require Server Name Indication<\/span>.<br \/>\n<span style=\"text-decoration: underline;\">Web Application Proxy<\/span> (part of Windows Server 2012 R2, replacement of ADFS proxy) is also <span style=\"text-decoration: underline;\">by default<\/span> setup (by the Web Application Proxy Configuration Wizard) to <span style=\"text-decoration: underline;\">require Server Name Indication<\/span>.<\/p>\n<p>&nbsp;<\/p>\n<p>Like the <a title=\"Microsoft Windows WebDAV Client does not support Server Name Indication (SNI)\" href=\"\/index.php\/microsoft-windows-webdav-client-does-not-support-server-name-indication-sni\/\" target=\"_blank\">WebDav client does not support Server Name Indication (SNI)<\/a> situation, ARR is non-SNI capable.<br \/>\n<em>The majority of articles I read about SNI are mentioning a list of SNI compatible web browsers. Yes, the web browsers probably represent 99% of the HTTP clients, but the rest of the HTTP based clients are applications which can also be non-SNI capable.<\/em><br \/>\n<em> To make sure I am not misunderstood: SNI is not evil. In fact I like it and I am using as much as possible. \u000bFrom Wikipedia:\u00a0\u201cServer Name Indication (SNI) is an extension to the TLS protocol that indicates to what hostname the client is attempting to connect at the start of the handshaking process. This allows a server to present multiple certificates on the same IP address and port number and hence allows multiple secure (HTTPS) websites (or any other Service over TLS) to be served off the same IP address without requiring all those sites to use the same certificate. It is the conceptual equivalent to HTTP\/1.1 virtual hosting for HTTPS.&#8221;<\/em><\/p>\n<p>&nbsp;<\/p>\n<p>What does ARR extension mainly does, is to receive your (client) HTTP request and route it based on specific load balancing algorithm to a specific server (part of a farm configuration). The server replies back to NLB (IIS + ARR) the HTTP response and after that the NLB sends the HTTP response back to the client. So, at some point ARR is behaving as a HTTP client.<\/p>\n<p>&nbsp;<\/p>\n<p><strong>What\u2019s the problem?<br \/>\n<\/strong>\u000bThe problem in this case is: ARR is non-SNI capable, which means the request sent by the NLB (IIS+ARR) node to the ADFS\/WAP servers does not contains &#8220;server_name&#8221; extension as part of the SSL\/TLS handshake.<\/p>\n<p>&nbsp;<\/p>\n<p><span style=\"text-decoration: underline;\">Example of a successful ADFS request sent by a SNI capable client.<\/span><br \/>\n<a href=\"https:\/\/www.vioreliftode.com\/wp-content\/uploads\/2015\/04\/ADFS_3.0_WAP_SNI_and_Network_Load_Balancing_02.png\"><img loading=\"lazy\" class=\"alignleft size-full wp-image-878\" src=\"https:\/\/www.vioreliftode.com\/wp-content\/uploads\/2015\/04\/ADFS_3.0_WAP_SNI_and_Network_Load_Balancing_02.png\" alt=\"ADFS_3.0_WAP_SNI_and_Network_Load_Balancing_02\" width=\"1124\" height=\"665\" srcset=\"https:\/\/www.vioreliftode.com\/wp-content\/uploads\/2015\/04\/ADFS_3.0_WAP_SNI_and_Network_Load_Balancing_02.png 1124w, https:\/\/www.vioreliftode.com\/wp-content\/uploads\/2015\/04\/ADFS_3.0_WAP_SNI_and_Network_Load_Balancing_02-300x177.png 300w, https:\/\/www.vioreliftode.com\/wp-content\/uploads\/2015\/04\/ADFS_3.0_WAP_SNI_and_Network_Load_Balancing_02-1024x606.png 1024w\" sizes=\"(max-width: 1124px) 100vw, 1124px\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<p><span style=\"text-decoration: underline;\">Example of an unsuccessful ADFS request sent by ARR (non-SNI capable).<\/span><br \/>\n<a href=\"https:\/\/www.vioreliftode.com\/wp-content\/uploads\/2015\/04\/ADFS_3.0_WAP_SNI_and_Network_Load_Balancing_03.png\"><img loading=\"lazy\" class=\"alignleft size-full wp-image-879\" src=\"https:\/\/www.vioreliftode.com\/wp-content\/uploads\/2015\/04\/ADFS_3.0_WAP_SNI_and_Network_Load_Balancing_03.png\" alt=\"ADFS_3.0_WAP_SNI_and_Network_Load_Balancing_03\" width=\"975\" height=\"518\" srcset=\"https:\/\/www.vioreliftode.com\/wp-content\/uploads\/2015\/04\/ADFS_3.0_WAP_SNI_and_Network_Load_Balancing_03.png 975w, https:\/\/www.vioreliftode.com\/wp-content\/uploads\/2015\/04\/ADFS_3.0_WAP_SNI_and_Network_Load_Balancing_03-300x159.png 300w\" sizes=\"(max-width: 975px) 100vw, 975px\" \/><\/a><br \/>\nas result, without the Server Name extension in the header, ADFS is unable to identify which certificate to serve and the connection will be reset by server.<br \/>\n<a href=\"https:\/\/www.vioreliftode.com\/wp-content\/uploads\/2015\/04\/ADFS_3.0_WAP_SNI_and_Network_Load_Balancing_04.png\"><img loading=\"lazy\" class=\"alignleft size-full wp-image-880\" src=\"https:\/\/www.vioreliftode.com\/wp-content\/uploads\/2015\/04\/ADFS_3.0_WAP_SNI_and_Network_Load_Balancing_04.png\" alt=\"ADFS_3.0_WAP_SNI_and_Network_Load_Balancing_04\" width=\"989\" height=\"628\" srcset=\"https:\/\/www.vioreliftode.com\/wp-content\/uploads\/2015\/04\/ADFS_3.0_WAP_SNI_and_Network_Load_Balancing_04.png 989w, https:\/\/www.vioreliftode.com\/wp-content\/uploads\/2015\/04\/ADFS_3.0_WAP_SNI_and_Network_Load_Balancing_04-300x190.png 300w\" sizes=\"(max-width: 989px) 100vw, 989px\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<p>Well, as mentioned earlier, ADFS 3.0 and WAP are by default setup to listen and respond to HTTPS connections where &#8220;server_name&#8221; extension is present as part of the SSL\/TLS handshake.\u000bIt&#8217;s the same reason why the non-SNI web browsers don&#8217;t work with by default ADFS 3.0 and WAP configurations.<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p><strong>Solution<\/strong><br \/>\nThe solution is to make ADFS 3.0 and WAP to respond also to the HTTPS requests sent by non-SNI capable clients. Basically we need to configure an http.sys fallback certificate and is 100% supported by Microsoft (it&#8217;s just not part of the default configuration &#8211; and somehow I agree with this decision).<br \/>\nSo, on all ADFS and WAP nodes load balanced using IIS+ARR is necessary to configure an http.sys fallback certificate. Basically these servers will bind the ADFS\/WAP listeners to HTTPS and will use one certificate to encrypt all the traffic performed through TCP 443. From best practices point of view this configuration is totally fine (because for servers like ADFS and WAP is not recommended to install and configure other roles who need to be bound to HTTPS).<br \/>\nA full description can be found here -&gt; <a href=\"http:\/\/blogs.technet.com\/b\/applicationproxyblog\/archive\/2014\/06\/19\/how-to-support-non-sni-capable-clients-with-web-application-proxy-and-ad-fs-2012-r2.aspx\" target=\"_blank\">http:\/\/blogs.technet.com\/b\/applicationproxyblog\/archive\/2014\/06\/19\/how-to-support-non-sni-capable-clients-with-web-application-proxy-and-ad-fs-2012-r2.aspx<\/a>.<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p><strong>How to configure an http.sys fallback certificate?<br \/>\n<\/strong><em>make sure you replace XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX with the thumbprint certificate used to secure the AFDS communications (from command line execute &#8220;netsh http show sslcert&#8221;, or check the certificate)<br \/>\n<a href=\"https:\/\/www.vioreliftode.com\/wp-content\/uploads\/2015\/04\/ADFS_3.0_WAP_SNI_and_Network_Load_Balancing_05.png\"><img loading=\"lazy\" class=\"alignleft size-full wp-image-881\" src=\"https:\/\/www.vioreliftode.com\/wp-content\/uploads\/2015\/04\/ADFS_3.0_WAP_SNI_and_Network_Load_Balancing_05.png\" alt=\"ADFS_3.0_WAP_SNI_and_Network_Load_Balancing_05\" width=\"419\" height=\"523\" srcset=\"https:\/\/www.vioreliftode.com\/wp-content\/uploads\/2015\/04\/ADFS_3.0_WAP_SNI_and_Network_Load_Balancing_05.png 419w, https:\/\/www.vioreliftode.com\/wp-content\/uploads\/2015\/04\/ADFS_3.0_WAP_SNI_and_Network_Load_Balancing_05-240x300.png 240w\" sizes=\"(max-width: 419px) 100vw, 419px\" \/><\/a><br \/>\n<\/em><\/p>\n<p>&nbsp;<\/p>\n<p><span style=\"text-decoration: underline;\">On all ADFS 3.0 servers execute the following command<\/span><\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\nnetsh http add sslcert ipport=0.0.0.0:443 certhash=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX appid={5d89a20c-beab-4389-9447-324788eb944a}\r\n<\/pre>\n<p>&nbsp;<\/p>\n<p><span style=\"text-decoration: underline;\">On all WAP servers execute the following command<\/span><\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\nnetsh http add sslcert ipport=0.0.0.0:443 certhash=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX appid={f955c070-e044-456c-ac00-e9e4275b3f04}\r\n<\/pre>\n<p>&nbsp;<\/p>\n<p>Once the change is performed the connections performed by non-SNI clients will be accepted by ADFS \/ WAP servers (in this case ARR will be able to establish TLS communications with ADFS\/WAS =&gt; so an IIS+ARR based NLB can be used to load balance the ADFS traffic).<br \/>\n<a href=\"https:\/\/www.vioreliftode.com\/wp-content\/uploads\/2015\/04\/ADFS_3.0_WAP_SNI_and_Network_Load_Balancing_06.png\"><img loading=\"lazy\" class=\"alignleft size-full wp-image-882\" src=\"https:\/\/www.vioreliftode.com\/wp-content\/uploads\/2015\/04\/ADFS_3.0_WAP_SNI_and_Network_Load_Balancing_06.png\" alt=\"ADFS_3.0_WAP_SNI_and_Network_Load_Balancing_06\" width=\"822\" height=\"360\" srcset=\"https:\/\/www.vioreliftode.com\/wp-content\/uploads\/2015\/04\/ADFS_3.0_WAP_SNI_and_Network_Load_Balancing_06.png 822w, https:\/\/www.vioreliftode.com\/wp-content\/uploads\/2015\/04\/ADFS_3.0_WAP_SNI_and_Network_Load_Balancing_06-300x131.png 300w\" sizes=\"(max-width: 822px) 100vw, 822px\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<p><strong>How can I find out if my ADFS\/WAS server accepts only SNI requests?<br \/>\n<\/strong>When the ADFS\/WAS server doesn&#8217;t have a fallback certificate configured, the following registry key is empty: HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Services\\HTTP\\Parameters\\SslBindingInfo<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>So you decide to build an ADFS 3.0 farm using Windows Server 2012 R2. You configure the farm properly and the ADFS checks performed directly on the ADFS servers are working fine. &nbsp; The next step is to load balance the traffic between the two ADFS nodes. To achieve this functionality you will use a &hellip; <a href=\"https:\/\/www.vioreliftode.com\/index.php\/adfs-3-0-wap-sni-and-network-load-balancing\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">ADFS 3.0, WAP, SNI and Network Load Balancing<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"spay_email":"","jetpack_publicize_message":"","jetpack_is_tweetstorm":false},"categories":[32,75,74],"tags":[77,78,80,76,79],"jetpack_featured_media_url":"","jetpack_publicize_connections":[],"jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p4NfDd-e7","_links":{"self":[{"href":"https:\/\/www.vioreliftode.com\/index.php\/wp-json\/wp\/v2\/posts\/875"}],"collection":[{"href":"https:\/\/www.vioreliftode.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.vioreliftode.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.vioreliftode.com\/index.php\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/www.vioreliftode.com\/index.php\/wp-json\/wp\/v2\/comments?post=875"}],"version-history":[{"count":0,"href":"https:\/\/www.vioreliftode.com\/index.php\/wp-json\/wp\/v2\/posts\/875\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.vioreliftode.com\/index.php\/wp-json\/wp\/v2\/media?parent=875"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.vioreliftode.com\/index.php\/wp-json\/wp\/v2\/categories?post=875"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.vioreliftode.com\/index.php\/wp-json\/wp\/v2\/tags?post=875"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}