<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>trust &#8211; Random Thoughts</title>
	<atom:link href="/tag/trust/feed/" rel="self" type="application/rss+xml" />
	<link>/</link>
	<description></description>
	<lastBuildDate>Thu, 26 Jan 2023 03:01:32 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.1.1</generator>

<image>
	<url>/wp-content/uploads/2023/01/cropped-android-chrome-512x512-1-32x32.png</url>
	<title>trust &#8211; Random Thoughts</title>
	<link>/</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>ZTNA to Services Through Cloudflare</title>
		<link>/2022/09/26/ztna-to-services-through-cloudflare/</link>
		
		<dc:creator><![CDATA[zach]]></dc:creator>
		<pubDate>Mon, 26 Sep 2022 02:59:00 +0000</pubDate>
				<category><![CDATA[selfhosted]]></category>
		<category><![CDATA[cloudflare]]></category>
		<category><![CDATA[homelab]]></category>
		<category><![CDATA[sase]]></category>
		<category><![CDATA[trust]]></category>
		<category><![CDATA[warp]]></category>
		<category><![CDATA[zero]]></category>
		<category><![CDATA[ztna]]></category>
		<guid isPermaLink="false">/?p=7</guid>

					<description><![CDATA[## Overview 🔍 If vendor marketing is any indication, &#8220;Zero Trust&#8221; is the biggest buzzword in security lately. But not without reason; a well implemented security architecture with strong identity verification and zero trust principles is the foundation of good security today. It&#8217;s amsuing to me how many breaches in the past few months reported [&#8230;]]]></description>
										<content:encoded><![CDATA[
<p><strong>## Overview <img src="https://s.w.org/images/core/emoji/14.0.0/72x72/1f50d.png" alt="🔍" class="wp-smiley" style="height: 1em; max-height: 1em;" /></strong></p>



<p>If vendor marketing is any indication, &#8220;Zero Trust&#8221; is the biggest buzzword in security lately. But not without reason; a well implemented security architecture with strong identity verification and zero trust principles is the foundation of good security today. It&#8217;s amsuing to me how many breaches in the past few months reported in the news have had the same things; valid account, compromise of phishable 2-factor credentials, compromise of enterprise VPN, establish foothold, move laterally.</p>



<p>As Cloudflare tags their practice of [&#8220;dogfooding&#8221;](https://blog.cloudflare.com/dogfooding-from-home/) Cloudflare Access, for me &#8220;dogfooding&#8221; is using Cloudflare Acccess to adopt a zero trust approach to my self hosted services. For a while, I have been using Cloudflare Tunnels (formerly known as Argo Tunnels) with identity providers as sort-of a &#8220;front line&#8221; identity verification to services. This is cool and all, but it doesn&#8217;t fully automate the identification process, and breaks a lot of &#8220;app&#8221; functionality. For example, built in functionality of Home Assistant or Bitwarden breaks, due to Cloudflare access prompting for authentication. Plus, it opens the door to a further enhanced security model (device posture checks, malware inspection, step up authentication, and more).</p>



<p>In this post, I&#8217;ll assume you already have [Cloudflare for Teams](https://blog.cloudflare.com/introducing-cloudflare-for-teams/), with apps configured with public hostnames configured via Cloudflare Tunnels (and perhaps some policies to govern access already). What I want to highlight is the addition of &#8220;gateway&#8221; access by configuration of managed devices within a team/organization through the &#8220;Warp&#8221; client.</p>



<p><strong>## Initial Setup <img src="https://s.w.org/images/core/emoji/14.0.0/72x72/1f477.png" alt="👷" class="wp-smiley" style="height: 1em; max-height: 1em;" /></strong></p>



<p>In order to confgiure apps for ZTNA access through the Warp client, you will need clients to utilize Cloudflare&#8217;s Secure Web Gateway (SWG). For more information on developing Gateway Policies, see the [Cloudflare Docs](https://developers.cloudflare.com/cloudflare-one/policies/filtering/).</p>



<p>The important part here is not necessarily on what Gateway Policies you implement, but that the Cloudflare SWG must be able to inspect HTTP traffic (ie, DNS inspection through forwarding from a defined location is NOT engough), which [requires the WARP client, with trusted certificate](https://developers.cloudflare.com/cloudflare-one/policies/filtering/initial-setup/http/).</p>



<p>Prior to enrolling device, I would recommend configuring a basic device enrollment policy for the WARP client. This is found under &#8220;`Settings -&gt; WARP Client -&gt; Device Enrollment Permissions&#8220;`</p>



<p>Similar to access policies, the enrollment policy defines what devices can enroll in your Cloudflare team. Below is a &#8220;family members&#8221; policy for which I included a list of list of authorized family member emails. In an enterprise scenario, this could be something more aligned to organization policies, such as &#8220;allow all *@acme.organization.com.&#8221;</p>



<p>![device-policy](/assets/img/device-enrollment-policy.png)</p>



<p>You will also want to configure a device posture check under &#8220;`Settings -&gt; WARP Client -&gt; Device Posture&#8220;`. For my scenario, I have configured the [&#8220;Require Gateway&#8221;](https://developers.cloudflare.com/cloudflare-one/identity/devices/warp-client-checks/require-gateway/) check. Per Cloudflare, &#8220;Require Gateway will only allow requests coming from devices whose traffic is filtered by your organization’s Cloudflare Gateway configuration. This policy is best used when you want to protect company-owned assets by only allowing access to employees&#8221; &#8211; exactly what we desire to enable ZTNA.</p>



<p>![device-posture](/assets/img/device-posture.png)</p>



<p>Note that device posture checks open up a door to enhance security; allowing more granular access to services based on risk, including enforcing a certain (up-to-date) OS version, precense of security controls, and more.</p>



<p><strong>## Certificate Trust <img src="https://s.w.org/images/core/emoji/14.0.0/72x72/1f91d.png" alt="🤝" class="wp-smiley" style="height: 1em; max-height: 1em;" /></strong></p>



<p>Next in the setup process, you will need to add the Cloudflare for Teams certificate as a trusted root certificate in the device you are enrolling for access. Cloudflare provides standard .crt and .pem files in the docs linked [here](https://developers.cloudflare.com/cloudflare-one/connections/connect-devices/warp/install-cloudflare-cert), and should be installed as instructed per device vendor.</p>



<p>Installation of this certificate is necessary to allow for HTTP inspection. Platforms such as Android may provide warning that installation of a certificate will allow third parties to view private data sent to websites. This is true &#8211; Cloudflare SWG, when performing HTTP inspection, is an &#8220;adversary-in-the-middle&#8221; for all HTTP requests on the client. In our scenario, this is desirable, as it is only through HTTP inspection that we can direct apps to private gateway access, as well as enforce DLP controls, malware inspection, lockdown allowed tenants, and more.</p>



<p><strong>## Certificate Pinning <img src="https://s.w.org/images/core/emoji/14.0.0/72x72/1f4cc.png" alt="📌" class="wp-smiley" style="height: 1em; max-height: 1em;" /></strong></p>



<p>For those familiar with TLS interception, whether through transparent proxy, or SWG platform &#8211; these issues are nothing new. But I believe it is worth pointing on the &#8220;issue&#8221; that TLS interception, and the introduction of &#8220;adversary-in-the-middle&#8221; has on various services, particularly client applications.</p>



<p>One of the biggest hurdles to properly implementing TLS/HTTP inspection across the board is the wide usage of certificate pinning through various vendors. For large detail on the pros/cons of certificate pinning, I recommend checking out this [Digicert article](https://www.digicert.com/blog/certificate-pinning-what-is-certificate-pinning) on the topic &#8211; but the TLDR for this scenario is that certificate pinned applictaions indicate a scenario in which, in some shape or form, an application developer has forced their app to be &#8220;pinned&#8221; to a particular certificate of theirs. When using WARP gateway, or any TLS interception scenario, the previously trusted certificate inspecting the traffic will be presented. This will completely break app functionality, as the backend will be met with &#8220;certificate not trusted&#8221;, or similar errors. Even though the intercepting certificate is trusted at the system level, the certificate pinning of the app ignores this trust.</p>



<p>Luckily, Cloudflare provides a simple &#8220;one-click&#8221; button. When onboarding on Teams, the first &#8220;create HTTP&#8221; policy that is pre-templated is a &#8220;certificate pinning&#8221; policy (pictured below).</p>



<p>![cert-pinning](/assets/img/cert-pinning.png)</p>



<p>The policy defines a list of applications correlating to domains known to cause issue with cert pinning, and defines a policy to bypass, or not inspect the traffic. Implementing this HTTP policy will resolve most common certificate pinning issues. I saw most &#8211; because it is not an end-to-end list. As you utilizing the gateway &#8211; you will notice normal traffic breaking, often due to certificate pinning. By observing logs and testing bypass of domains, you can walkthrough and remediate some of these issues.</p>



<p><strong>## Device Enrollment <img src="https://s.w.org/images/core/emoji/14.0.0/72x72/1f4f1.png" alt="📱" class="wp-smiley" style="height: 1em; max-height: 1em;" /></strong></p>



<p>Now that you&#8217;ve trusted the Cloudflare teams certificate, and understand and have bypassed the requisite apps for certificate pinning, you are ready to enroll the client and begin passing HTTP traffic through Cloudflare gateway.</p>



<p>For small homelab usage, I&#8217;m going to assume you&#8217;re running manual deployments of the WARP client (although instructions for deploying via Intune, JAMF, etc exist. And I would love to develop a procedure for managed deployment of an organization WARP client through JumpCloud free tier&#8230; but that is a topic for another post&#8230;)</p>



<p>The Cloudflare Docs for [manual installation](https://developers.cloudflare.com/cloudflare-one/connections/connect-devices/warp/deployment/manual-deployment/) describe the process; either CLI or GUI based per platform. Ultimately, the WARP client will need to be configured to use the &#8220;Cloudflare for Teams&#8221; login, and you will authenticate to meet the defined device enrollment criteria via configured identity providers, and be granted access to the Cloudflare team via WARP.</p>



<p><strong>## Policy Configuration <img src="https://s.w.org/images/core/emoji/14.0.0/72x72/1f942.png" alt="🥂" class="wp-smiley" style="height: 1em; max-height: 1em;" /></strong></p>



<p>So you have your device enrolled, and you&#8217;re inspecting HTTP traffic through the gateway. The final step is enable the &#8220;requirement&#8221; of the gateway to an access application, and use that as a condition to bypass authentication.</p>



<p>For this scenario, I have added a policy &#8220;bypass authentication through gateway&#8221; for my bitwarden (vaultwarden) Access application.</p>



<p>![bitwarden-bypass](/assets/img/bitwarden-bypass.png)</p>



<p>Within the policy, the only condition I have is the &#8220;require gateway&#8221;, which was defined under WARP Client device posture checks in the initial setup. Again, depending on risk level, additional device posture checks could be enforced as need, so that even a &#8220;managed&#8221; device could be denied access to bitwarden if not up to patching, missing antivirus, etc.</p>



<p>![require-gateway](/assets/img/require-gateway.png)</p>



<p>After saving the policy &#8211; try testing out access. For the Bitwarden scenario, I changed my hostname from an internal DNS name to my public access domain (previously behind an authentication layer). Now, I can sync the Bitwarden app whenever, creating a software defined perimter for access to any of my self hosted services!</p>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
