<?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 Akhil Bhavirisetty on Medium]]></title>
        <description><![CDATA[Stories by Akhil Bhavirisetty on Medium]]></description>
        <link>https://medium.com/@akhil-bhavirisetty?source=rss-b302f60a9bb0------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*mj2dIhcG1zJHY52y.</url>
            <title>Stories by Akhil Bhavirisetty on Medium</title>
            <link>https://medium.com/@akhil-bhavirisetty?source=rss-b302f60a9bb0------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 02 Dec 2026 04:53:59 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@akhil-bhavirisetty/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[Enabling SSL for keycloak using Cloudflare(Keycloak Part2)]]></title>
            <link>https://akhil-bhavirisetty.medium.com/enabling-ssl-for-keycloak-using-cloudflare-keycloak-part2-1b9b340853cd?source=rss-b302f60a9bb0------2</link>
            <guid isPermaLink="false">https://medium.com/p/1b9b340853cd</guid>
            <category><![CDATA[keycloak]]></category>
            <category><![CDATA[ubuntu]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[ssl]]></category>
            <category><![CDATA[cloudflare]]></category>
            <dc:creator><![CDATA[Akhil Bhavirisetty]]></dc:creator>
            <pubDate>Sat, 29 May 2021 07:24:35 GMT</pubDate>
            <atom:updated>2021-05-29T07:33:12.477Z</atom:updated>
            <cc:license>http://creativecommons.org/publicdomain/zero/1.0/</cc:license>
            <content:encoded><![CDATA[<p>This is the second part of the series “Securing MERN application using keycloak”</p><h4>Overview</h4><p>In this blog, I will provide the step-by-step guide to enable the SSL using cloudflare, for standalone keycloak installation in Ubuntu</p><h4>Create a java keystore</h4><p>A java Keystore is used to store the SSL certificate requests(CSR), certificates and certificates reply</p><p>Java Keystore can be created using Keytool as below:</p><pre>keytool -genkey -alias &lt;your_domain_name&gt; -keyalg RSA -keystore keycloak.jks -keysize 2048</pre><pre>Enter keystore password: secret<br>    Re-enter new password: secret<br>    What is your first and last name?<br>    [Unknown]:  &lt;DNS of the machine&gt;<br>    What is the name of your organizational unit?<br>    [Unknown]:  Keycloak<br>    What is the name of your organization?<br>    [Unknown]:  &lt;Org Name&gt;<br>    What is the name of your City or Locality?<br>    [Unknown]:  Fremont<br>    What is the name of your State or Province?<br>    [Unknown]:  CA<br>    What is the two-letter country code for this unit?<br>    [Unknown]:  US<br>    Is CN=&lt;DNS of the machine&gt;, OU=Keycloak, O=&lt;Org Name&gt;, L=Fremont, ST=CA, C=US correct?<br>    [no]:  yes</pre><p>After executing this command, the keycloak.jks file will be generated in the same directory as you executed the keytool command in.</p><h4>Generate the Certificate Request (CSR)</h4><pre>keytool -v -certreq -keystore keystore.jks -keyalg rsa -alias &lt;your_domain_name&gt; &gt; keycloak.careq</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*c_NYcZP8SdCxS0l-ief8zA.png" /><figcaption>Certificate Signed Request</figcaption></figure><h4>Add DNS Record in Cloudflare</h4><p>Get the keycloak machine’s external IP and add a DNS record in the cloudflare as shown below</p><p>Make sure that the Proxy is enabled for the DNS record.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XngN_BzRjX_e8F-qU7oV6g.png" /><figcaption>Cloudflare DNS entry with proxy enabled</figcaption></figure><blockquote><strong>Note:</strong> If the proxy is not enabled, then browsers complain as Cloudflare origin certificate certificate is not trusted</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TkNZRo2x3sSBf4FvvI7aUQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FHA4Kn0eNlAHyiabLNqddg.png" /></figure><h4>Use CSR and generate the certificate</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xAMzUEGFbBs7eHAlyqVklA.png" /></figure><h4>Download the Certificate reply</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*08isPtqus924aKUSGDQDtg.png" /><figcaption>Download Certificate</figcaption></figure><h4>Download the CA root certificate</h4><p>Cloudflare Origin CA root certificate can be downloaded from <a href="https://support.cloudflare.com/hc/en-us/articles/115000479507-Managing-Cloudflare-Origin-CA-certificates#h_30cc332c-8f6e-42d8-9c59-6c1f06650639">here</a> as shown below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vVIzBXQx0b0Nn0abp2z5wQ.png" /><figcaption>Cloudflare Origin CA Root Certificate</figcaption></figure><h4>Import the root certificate</h4><p>Import the Cloudflare Origin CA root certificate into keystore</p><pre>keytool -importcert -trustcacerts -keystore keystore.jks -file CARoot.pem -alias root</pre><h4>Import the certificate reply</h4><p>Import the certificate reply from cloudflare into keystore</p><pre>keytool -importcert -trustcacerts -alias &lt;your_domain_name&gt; -file keycloak_cert.pem -keystore keystore.jks</pre><h4>Configure Keycloak to Use the Keystore</h4><ol><li>Copy the keystore.jks file into the configuration/ directory</li><li>In the standalone configuration file, the security-realms element should look like this:</li></ol><pre>&lt;security-realm name=&quot;<strong><em>UndertowRealm</em></strong>&quot;&gt;<br>    &lt;server-identities&gt;<br>        &lt;ssl&gt;<br>            &lt;keystore path=&quot;<strong><em>keycloak.jks</em></strong>&quot; relative-to=&quot;jboss.server.config.dir&quot; keystore-password=&quot;secret&quot; /&gt;<br>        &lt;/ssl&gt;<br>    &lt;/server-identities&gt;<br>&lt;/security-realm&gt; </pre><p>3. Next, in the standalone configuration file, the child element of subsystem xmlns=&quot;urn:jboss:domain:undertow:12.0&quot;, should contain the following stanza:</p><pre>&lt;subsystem xmlns=&quot;urn:jboss:domain:undertow:12.0&quot;&gt;<br>   &lt;buffer-cache name=&quot;default&quot;/&gt;<br>   &lt;server name=&quot;default-server&quot;&gt;<br>      &lt;https-listener name=&quot;https&quot; socket-binding=&quot;https&quot; security-realm=&quot;<strong><em>UndertowRealm</em></strong>&quot;/&gt;<br>   ...<br>&lt;/subsystem&gt;</pre><p>Restart the keycloak server and access the keycloak dashboard in the browser.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rYV12oZivjDA4Le6HrYiAQ.png" /><figcaption>Secure Keycloak dashboard</figcaption></figure><p>SSL is enabled for the keycloak server.</p><h4>Conclusion</h4><p>In this blog, we have covered how to setup a java keystore in ubuntu, add the DNS record for keycloak in cloudflare, configure keycloak to use keystore and enable the SSL for keycloak.</p><h4>References</h4><ol><li>Keycloak SSL setup guide</li></ol><p><a href="https://www.keycloak.org/docs/latest/server_installation/#_setting_up_ssl">Server Installation and Configuration Guide</a></p><p>2. Guide to ecrypt traffic from cloudflare and origin server</p><p><a href="https://support.cloudflare.com/hc/en-us/articles/115000479507-Managing-Cloudflare-Origin-CA-certificates">Managing Cloudflare Origin CA certificates</a></p><blockquote><a href="https://akhil-bhavirisetty.medium.com/standalone-keycloak-installation-on-ubuntu-18-04-keycloak-part1-d101a8b2d920">Previous blog: Installing Keycloak in Ubuntu</a></blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1b9b340853cd" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Installing Keycloak on Ubuntu 18.04!! (Keycloak Part1)]]></title>
            <link>https://akhil-bhavirisetty.medium.com/standalone-keycloak-installation-on-ubuntu-18-04-keycloak-part1-d101a8b2d920?source=rss-b302f60a9bb0------2</link>
            <guid isPermaLink="false">https://medium.com/p/d101a8b2d920</guid>
            <category><![CDATA[installation]]></category>
            <category><![CDATA[keycloak]]></category>
            <category><![CDATA[ubuntu]]></category>
            <category><![CDATA[technology]]></category>
            <dc:creator><![CDATA[Akhil Bhavirisetty]]></dc:creator>
            <pubDate>Thu, 27 May 2021 23:53:54 GMT</pubDate>
            <atom:updated>2021-05-28T00:15:50.452Z</atom:updated>
            <content:encoded><![CDATA[<p>This is the first part of the series “<em>Securing MERN application using keycloak</em>”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/480/1*SVSCcyaSWOArlJ9AzcdZSA.png" /></figure><h4>Overview:</h4><p>In this story, I will guide you the steps for a simple standalone installation keycloak 13.0.1 on Ubuntu 18.04 provisioned in Google Cloud Platform</p><h4>Before you Start</h4><p>Make sure you have <a href="https://openjdk.java.net/">OpenJDK 1.8</a> or newer installed in the Ubuntu Instance</p><h4>Download <strong>keycloak</strong></h4><p>1. Get the <em>keycloak-13.0.1.tar.gz</em> URL from keycloak downloads page as shown below</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0Oh60KEJybrr8q28wjKxpQ.png" /><figcaption>URL for keycloak-13.0.1.tar.gz</figcaption></figure><p>2. Change directory to /opt <em>(Note: You can download in any directory)</em></p><pre>cd /opt</pre><p>3. Download keycloak using wget</p><pre>wget <a href="https://github.com/keycloak/keycloak/releases/download/13.0.1/keycloak-13.0.1.tar.gz">https://github.com/keycloak/keycloak/releases/download/13.0.1/keycloak-13.0.1.tar.gz</a></pre><h4>Uncompress Keycloak file</h4><p>Use tar or equivalent to uncompress the file</p><pre>tar -xvzf keycloak-13.0.1.tar.gz</pre><h4>Run the Keycloak server in background mode</h4><pre>sudo /opt/keycloak-13.0.1/bin/standalone.sh -b=0.0.0.0 &amp;</pre><ul><li><em>-b indicates binding ip address.</em></li><li><em>Binding 0.0.0.0 to allow internet traffic</em></li></ul><h4>Access Keycloak from Browser</h4><ol><li>Get the External IP of the Ubuntu Instance running in GCP</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aLk5jXGO8d9sKsx1-vtFew.png" /></figure><ol><li>Try accessing <a href="http://&lt;external-ip&gt;:8080/auth">http://&lt;external-ip&gt;:8080/auth</a>(<em>By default, Keycloak runs on 8080 port for http</em>)</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UH2tmihRgGmquKbQICGntA.png" /></figure><h4>Add Admin User</h4><p>Use “add-user-keycloak.sh” script to add admin user</p><pre>sudo /opt/keycloak-13.0.1/bin/add-user-keycloak.sh -u admin -p &lt;password&gt;</pre><h4>Restart Keycloak</h4><pre>sudo kill -9 $(ps -ef | grep keycloak | awk {‘print $2’})</pre><pre>sudo /opt/keycloak-13.0.1/bin/standalone.sh -b=0.0.0.0 &amp;</pre><h4>Access Keycloak</h4><ol><li>Access <a href="http://&lt;external-ip&gt;:8080/auth">http://&lt;external-ip&gt;:8080/auth</a></li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UMijElx5cMmpXOLSjpzZaQ.png" /></figure><p>2. Now click on the Administration Console as shown above</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XQAb-YUZjJQZEjS83LENbA.png" /></figure><h4>You will get the HTTPS required error</h4><p>You can either enable SSL or disable the SSL-required option using through keycloak script.</p><h4>Reference Links:</h4><p><a href="https://www.keycloak.org/docs/latest/server_installation/index.html">https://www.keycloak.org/docs/latest/server_installation/index.html</a></p><p>Next part: Enabling SSL for keycloak using Cloudflare (Keycloak Part2)</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d101a8b2d920" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>