<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Frederic ROBINET on Medium]]></title>
        <description><![CDATA[Stories by Frederic ROBINET on Medium]]></description>
        <link>https://medium.com/@robinef?source=rss-29522f836ae1------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*tcX8cNKhKvqh68rZ.jpg</url>
            <title>Stories by Frederic ROBINET on Medium</title>
            <link>https://medium.com/@robinef?source=rss-29522f836ae1------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 19 Nov 2026 00:06:01 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@robinef/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[CloudFoundry : mutual TLS for your cloud native application with Credhub]]></title>
            <link>https://medium.com/@robinef/cloudfoundry-how-to-bind-mutual-tls-cloud-native-app-with-credhub-servicebroker-76ce5abcae5b?source=rss-29522f836ae1------2</link>
            <guid isPermaLink="false">https://medium.com/p/76ce5abcae5b</guid>
            <category><![CDATA[security]]></category>
            <category><![CDATA[pivotal]]></category>
            <category><![CDATA[ssl-certificate]]></category>
            <category><![CDATA[cloud-foundry]]></category>
            <dc:creator><![CDATA[Frederic ROBINET]]></dc:creator>
            <pubDate>Thu, 15 Nov 2018 17:43:47 GMT</pubDate>
            <atom:updated>2018-11-15T17:43:47.019Z</atom:updated>
            <content:encoded><![CDATA[<h3>CloudFoundry : mutual TLS for your cloud native application with Credhub</h3><p>How to remove the pain of certificates management</p><h4>A little bit of context</h4><p>Security is a hot topic, especially today in the IoT world where the number of connected devices is growing all around the globe. In this context people that are building solutions need to be sure that <strong>security</strong> is at every level, in the code but also in the communication between clients and servers.</p><p>Thats why sometimes <a href="https://dzone.com/articles/mutual-authentication-two-way-ssl-explained-using">mutual TLS</a> is mandatory because it ensure one of the best level of security by providing to the client a way to be acknowledge as the one he is pretending to be by the server and vice et versa.</p><p>Mutual TLS is not easy to implement and maintain, especially because it requires the client to embed a key and a certificate that he needs to use to establish the connection with the server. But when you have several clients and several environments it can become really tricky.</p><h4>Credhub</h4><p>Recently Cloud Foundry introduced a security concept to manage cloud native application secrets, the “<a href="https://www.youtube.com/watch?v=NUXpz0Dni50"><strong>3R strategy</strong></a>”. The concept is simple, credentials needs to rotate so you will be sure that secrets have a short life and in case of compromission it will give the attacker a small time frame to try to compromise your system.</p><p>To put this strategy in action, a new component called Credhub has been introduced to Cloud Foundry. Its a single place of trust where a majority of the credentials used by many Cloud Foundry components are stored.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/438/0*bW1ERpOMM-GmrQht.png" /><figcaption>Credhub from CloudFoundry</figcaption></figure><h3>Where to start ?</h3><h4>Prerequisites</h4><p>Here is the list of prerequisites if you want to be able to implement this security strategy:</p><ul><li>Cloud Foundry 2.2 or above</li><li><a href="https://github.com/srinivasa-vasu/credentials-service-broker">Credhub Service Broker</a> or <a href="https://docs.pivotal.io/credhub-service-broker/using.html">Pivotal Credhub Service Broker</a></li><li><a href="https://blog.codeship.com/how-to-set-up-mutual-tls-authentication/">External server with Client/Server certificate capabilities</a></li></ul><h4>The strategy</h4><p>The idea here is to leverage Credhub and the service broker mechanism to be able to inject client certificates using the cloud native principle of <a href="https://12factor.net/config">environment variable</a> and <a href="https://12factor.net/backing-services">external services dependencie</a>s. The benefit is clear: certificates are not anymore embedded in your code or deployment but they will be automatically injected in your application ENV based on the service and space.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*m5hDCc8PRUSEu64jk9HUeg.png" /></figure><h4>Service Broker preparation</h4><p><strong>Step1</strong><em> : </em>Get your client private key and client certificate from the server provider. (ex: nginx mTLS link from prerequisite)</p><p><strong>Step2</strong> : Create a service instance with the client private key and certificate from <em>step 1</em>. You must carefully put the certificate and key in 1 line by replacing any new line by the character <strong>\n</strong></p><pre>cf create-service credhub kinja-cert kinja -c &#39;{<br> &quot;name&quot;: &quot;/kinja/certificate&quot;,<br> &quot;type&quot;: &quot;certificate&quot;,<br> &quot;value&quot;: {<br>  &quot;certificate&quot;: &quot; - - -BEGIN CERTIFICATE …&quot;,<br> &quot;private_key&quot;: &quot; - - -BEGIN RSA PRIVATE KEY… &quot;<br>  }<br> }&#39;</pre><h4>Certificate implementation</h4><p><strong>Step3</strong> : Declare your application dependancy by binding it to the newly created service with the <em>cf bind-service </em>command:</p><pre>cf bind myapp kinja</pre><p>This is where the magic happen, your app will automatically retrieve the client private key and certificate by using the Open Service Broker + Credhub mechanism (3.a,3.b,3.c). If you want to know more those steps please check this <a href="https://medium.com/@srinivasan.surprise/credhub-as-an-opinionated-service-8336442fb2bc">post</a>.</p><pre>{<br>&quot;name&quot;: &quot;kinja&quot;,<br>&quot;instance_name&quot;: &quot;kinja&quot;,<br>&quot;binding_name&quot;: null,<br>&quot;credentials&quot;: {<br>&quot;credhub-ref&quot;: &quot;/credhub-service-broker/credhub/f3fa240c-1350-4536-b5ce-c0692e974967/credentials&quot;<br>},</pre><p><strong>Step 4 </strong>: Connect to the server by using the ENV variable in your code. Please find a NodeJS example below.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/936665fe4ad82b02cb8d3c851732d975/href">https://medium.com/media/936665fe4ad82b02cb8d3c851732d975/href</a></iframe><p>That’s all ! Next step could be to create as much service instances as needed but then it’s specific to your implementation.</p><p>Thank you for reading. If you find something wrong or better ways to do it, let me know in the comments below.</p><p>If you like the post, hit the :clap: button below so that others may find it useful.</p><p>Thanks to <a href="https://medium.com/u/2d4c0ff694f9">Lakshman Diwaakar</a> and <a href="https://medium.com/u/3e1b62e1f242">Jérôme Wiedemann</a> for helping me reviewing this post.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=76ce5abcae5b" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>