<?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"><channel><title><![CDATA[Dishant's Publishing Realm]]></title><description><![CDATA[A software engineer with expertise in building and deploying application platforms, and devops workflows.]]></description><link>https://blog.dishant.me</link><generator>RSS for Node</generator><lastBuildDate>Fri, 01 May 2026 02:25:27 GMT</lastBuildDate><atom:link href="https://blog.dishant.me/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[SAML OIDC Bridge]]></title><description><![CDATA[The purpose of this blog is to explain and demonstrate bridging of saml to openid auth flows.The requirement arises through the need of enabling applications which natively support openid but the IDP is only SAML compatible. This becomes a challenge ...]]></description><link>https://blog.dishant.me/saml-oidc-bridge</link><guid isPermaLink="true">https://blog.dishant.me/saml-oidc-bridge</guid><category><![CDATA[SAML]]></category><category><![CDATA[OpenID Connect]]></category><category><![CDATA[OAuth2]]></category><category><![CDATA[bridge]]></category><category><![CDATA[authentication]]></category><category><![CDATA[SSO]]></category><dc:creator><![CDATA[Dishant Pandya]]></dc:creator><pubDate>Fri, 19 Apr 2024 04:36:29 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/stock/unsplash/lmFJOx7hPc4/upload/54f0a38a681253e7bc2b7cda18b531a2.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1713500629057/f0ea4bdb-c582-4333-838f-766ca15be613.png" alt class="image--center mx-auto" /></p>
<p>The purpose of this blog is to explain and demonstrate bridging of saml to openid auth flows.<br />The requirement arises through the need of enabling applications which natively support openid but the IDP is only SAML compatible. This becomes a challenge when implementing Single Sign On auth, and due to regulatory needs we can have one source of truth, for user auth across the organisation. No native auth flow or user collection must be build scoped within the app to bypass the SSO.</p>
<p>Though due to limitation of only SAML support, we cannot straight away implement such SSO auth flows.</p>
<p>One way of doing this is a broker/bridge mechanism.</p>
<h2 id="heading-overview">Overview</h2>
<p><img src="https://mermaid.ink/img/pako:eNp9kt1qwyAUgF9FvAs0L5CLQpYwCKykLN3V3IXEs1aSHDN_Vkbpu09jpRtr55V6zvn8jnqivRJAC2rgwwH2UEu-13xiSPxoZ8CmJtUoAS0p5zlfrx-0FHt4bZu6IlutPqUA_VaQBqWV3IJJRaWzB_I4qiM5Sj-LZRF7E5Ff2V25eboc6smlGciLAU2sIh2M0FuyJKTKX8yfpYG4rJt6exWMYotTCkZCWuXZTY1nsE5jzCqN97FSod81s0ID9yWyOxe20xzNGIQSIzTY8mBXjVxO_91V9udlfIPGOCBL4k4NgAHnAwzpik6gJy6Ff-dTwDJqDzABo4WfCq4HRhmefZ4_XXVf2NPCagcr6mbhDS9_Im2CkFbpTfw3vcJ3uafnbw88wq0?type=png" alt class="image--center mx-auto" /></p>
<ul>
<li><p>SAML to OIDC Bridge is layering an IDP over another.</p>
</li>
<li><p>The Bridge acts as both IDP and SP to delegate and translate auth flow cross protocol.</p>
</li>
<li><p>On the IDP end it serves OIDC/Oauth2 protocol.</p>
</li>
<li><p>On the SP end it used SAML Client</p>
</li>
<li><p>The Bridge is configured with OIDC Auth Details.</p>
</li>
<li><p>The OpenID client id and client key is used by app to authenticate with bridge oidc provider.</p>
</li>
<li><p>The OIDC provider uses <a target="_blank" href="https://oauth.net/2/pkce/">PKCE</a> to secure the client auth in additional to client id and secret.</p>
</li>
<li><p>It ensures that the client using the user tokens is the same as the one that has requested them.</p>
</li>
</ul>
<h2 id="heading-flow">Flow:</h2>
<ul>
<li><p>The a user on client app asks for login.</p>
</li>
<li><p>They are redirected to SAML IDP selection on bridge.</p>
</li>
<li><p>Upon Selection they authenticate with IDP.</p>
</li>
<li><p>On successful authentication SAML Assertion callback is made.</p>
</li>
<li><p>Bridge then inform the OIDC Provider component to issue correspondig openid credentials.</p>
</li>
<li><p>Using the openid tokens user is authenticated and authorized to access the requested resource.</p>
</li>
</ul>
<h1 id="heading-setup">Setup:</h1>
<p>For demonstration we’ll be using a <a target="_blank" href="http://oidcdebugger.com">oidcdebugger.com</a> as client service, and setup a bridge on local with a SAML IDP using Okta.</p>
<p>Execute the commands as follows:</p>
<pre><code class="lang-bash">git <span class="hljs-built_in">clone</span> https://codeberg.org/drpdishant/k8s-lab.git 
<span class="hljs-built_in">cd</span> k8s-lab/saml2-oidc docker-compose up -d 
<span class="hljs-comment"># This serves the bridge at https://saml2oidc.127.0.0.1.nip.io</span>
</code></pre>
<p># The endpoints are preconfigured in Okta to work with.</p>
<p>Openid config endpoint will be https://saml2oidc.127.0.0.1.nip.io/.well-known/openid-configuration</p>
<p>Check <code>config.json</code> for SAML SP and OpenID Provider config.</p>
<p>This one has an oidc client configured with following params:</p>
<pre><code class="lang-json">{
    <span class="hljs-attr">"client_id"</span>: <span class="hljs-string">"some-client-id"</span>,
    <span class="hljs-attr">"client_secret"</span>: <span class="hljs-string">"client-secret"</span>,
    <span class="hljs-attr">"redirect_uris"</span>: [
        <span class="hljs-string">"https://oidcdebugger.com/debug"</span>
    ],
    <span class="hljs-attr">"allowedOrigins"</span>: [
        <span class="hljs-string">"https://oidcdebugger.com"</span>
    ],
    <span class="hljs-attr">"token_endpoint_auth_method"</span>: <span class="hljs-string">"none"</span>
}
</code></pre>
<p>Use these to configure client at <a target="_blank" href="https://oidcdebugger.com/">https://oidcdebugger.com/</a></p>
<h2 id="heading-usage">Usage:</h2>
<ul>
<li><p>Open <a target="_blank" href="https://oidcdebugger.com/">oidcdebugger.com</a></p>
</li>
<li><p>Configure The params as follows:</p>
<ul>
<li><p><strong>Authorize URI:</strong> <a target="_blank" href="https://saml2oidc.127.0.0.1.nip.io/auth">https://saml2oidc.127.0.0.1.nip.io/auth</a></p>
</li>
<li><p><strong>Redirect URI:</strong> <a target="_blank" href="https://oidcdebugger.com/debug">https://oidcdebugger.com/debug</a></p>
</li>
<li><p><strong>Client ID:</strong> some-client-id</p>
</li>
<li><p><strong>Scope:</strong> openid</p>
</li>
<li><p><strong>Response type</strong>: code</p>
</li>
<li><p><strong>Use PKCE?:</strong> checked (SHA256)</p>
<ul>
<li>Token URI: <a target="_blank" href="https://saml2oidc.127.0.0.1.nip.io/token">https://saml2oidc.127.0.0.1.nip.io/token</a></li>
</ul>
</li>
<li><p><strong>Response mode:</strong> form_post</p>
</li>
</ul>
</li>
<li><p>Send Request</p>
</li>
<li><p>You’ll be prompted to choose the IDP.</p>
</li>
<li><p>Choose the IDP and you’ll be sent to Okta Login Page.</p>
</li>
<li><p>Enter the following credentials:</p>
<ul>
<li><p>Username: <a target="_blank" href="mailto:john.wick@boogeyman.com">john.wick@boogeyman.com</a></p>
</li>
<li><p>Password: Overhung1-Celtic0-Driver3-Activate0</p>
</li>
</ul>
</li>
<li><p>Upon Successful login you’ll be redirected to debug page.</p>
</li>
</ul>
]]></content:encoded></item><item><title><![CDATA[nohup & systemd]]></title><description><![CDATA[To be honest, there won't be any need of such comparison if system admins did their research and understand fundamentals of a Linux based OS well, but recently via some of my peers I have come to across scenarios where experienced Linux Admins have b...]]></description><link>https://blog.dishant.me/nohup-systemd</link><guid isPermaLink="true">https://blog.dishant.me/nohup-systemd</guid><category><![CDATA[systemd]]></category><category><![CDATA[Linux]]></category><category><![CDATA[nohup]]></category><dc:creator><![CDATA[Dishant Pandya]]></dc:creator><pubDate>Sun, 30 Apr 2023 22:17:06 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/unsplash/QBpZGqEMsKg/upload/v1669953196628/jT7mmfr28.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>To be honest, there won't be any need of such comparison if system admins did their research and understand fundamentals of a Linux based OS well, but recently via some of my peers I have come to across scenarios where experienced Linux Admins have been running background processes with nohup in production, and not even having slightest idea of harnessing the capabilities of systemd service unit.</p>
<p>Sadly it has come to this that the sysadmins of cloud era have been boasting their knowledge of cloud services but lacking the fundamental understanding of Linux, and how operating systems function. All due to fast paced learning and FOMO, they have been missing out important aspects of running servers and maintaining them reliably. Another factor recently observed is heavy reliance on AI tools to seek quick answers. With that said lets being with actually discussing the title.</p>
<h2 id="heading-what-is-nohup">What is nohup?</h2>
<p>As the definition on Wikipedia says, nohup is a POSIX command which means "no hang up". Its purpose is to execute a command such that it ignores the HUP (hangup) signal and therefore does not stop when the user logs out.</p>
<p>It is usually helpful for admins to run ad-hoc background tasks across SSH sessions, or on their workstations, so that they don't have to worry about exiting the process upon accidental termination of sessions. ad-hoc background tasks are usually once in a while jobs that won't be repeated and don't require any availability or reliability, nohup only helps admins to run such tasks in background for time being to increase their productivity and perform many such tasks in parallel which don't require constant monitoring.</p>
<p>Some examples of such tasks are:</p>
<ul>
<li><p>syncing a large filesystem, object storages</p>
</li>
<li><p>one off database migrations</p>
</li>
<li><p>debugging services</p>
</li>
<li><p>temporary webhooks</p>
</li>
</ul>
<pre><code class="lang-bash">$ nohup s3 sync s3://large-bucket-old s3://large-bucket-new &amp;
$ <span class="hljs-built_in">exit</span>
</code></pre>
<h2 id="heading-what-is-systemd"><strong>What is systemd?</strong></h2>
<p>As the definition on Wikipedia says, systemd is a software suite that provides an array of system components for Linux operating systems. Its main aim is to unify service configuration and behavior across Linux distributions; Its primary component is a "system and service manager"—an init system used to bootstrap user space and manage user processes.</p>
<p>systemd has been integral part of many linux distributions as in init system and is at the root of process management that serves user experience for server and desktop users. Its a daemon that manages other daemons.</p>
<p><mark>In multitasking computer operating systems, a daemon is a computer program that runs as a background process, rather than being under the direct control of an interactive user.</mark></p>
<p>Using systemd you can not only configure your applications services as daemon processes, but also configure the sequence they start up, you can define dependencies, on other processes e.g <em>an app process starting up after database.</em></p>
<p>Along with dependency on other systemd managed processes you can also define target you want your process to start into.</p>
<p><em><mark>systemd targets are different states that your system can boot into, comparable to System V runlevels.</mark></em></p>
<p>Systemd Unit file for nginx webserver.</p>
<pre><code class="lang-bash">[Unit]
Description=The NGINX HTTP and reverse proxy server
After=syslog.target network.target remote-fs.target nss-lookup.target

[Service]
Type=forking
PIDFile=/run/nginx.pid
ExecStartPre=/usr/sbin/nginx -t
ExecStart=/usr/sbin/nginx
ExecReload=/bin/<span class="hljs-built_in">kill</span> -s HUP <span class="hljs-variable">$MAINPID</span>
ExecStop=/bin/<span class="hljs-built_in">kill</span> -s QUIT <span class="hljs-variable">$MAINPID</span>
PrivateTmp=<span class="hljs-literal">true</span>

[Install]
WantedBy=multi-user.target
</code></pre>
<p>The common configuration items are configured in the generic [Unit] and [Install] sections.</p>
<p>complete list of options available can be found in systemd man pages, by running <code>man systemd.unit</code> and <code>man systemd.install</code> respectively</p>
<p>The service specific configuration options are configured in the [Service] section.</p>
<p>Complete list of Service section options can be found by running <code>man systemd.service</code></p>
<p>If you have observed almost any standard service you install on a linux server configures a systemd service unit file, because its the standard way of doing it. Though all of it is scripted and packaged to be installed by your package manager most of the time and you don't have to configure it yourself , it doesn't mean that you can't configure systemd for your own application services. You can use it to run your web apps built in java, python, nodejs etc. Anything you want to be running in background and orchestrate its start-up across system reboots, systemd is best way to do that.</p>
<h3 id="heading-closing-note">Closing Note:</h3>
<p>Although we have been talking about systemd all this time, its not only init system out there but a popular and default for many OSes, and what you can achieve with systemd can be achieved with other init systems also. Some of these are SysV, openrc, upstart etc.</p>
<h3 id="heading-conclusion">Conclusion:</h3>
<p>nohup, although being a quick and easy way to run background task, is ineffective for long running services in production, such as databases, application servers, webservers, etc, while systemd is at core of process management in multitasking linux operating systems and preferable way to run apps and web servers as daemon processes in Linux, in production.</p>
<p>References:</p>
<ul>
<li><p>https://documentation.suse.com/smart/systems-management/html/reference-managing-systemd-targets-systemctl/index.html</p>
</li>
<li><p>https://www.shellhacks.com/systemd-service-file-example/</p>
</li>
<li><p>https://www.slant.co/topics/4663/~linux-init-systems</p>
</li>
</ul>
]]></content:encoded></item></channel></rss>