<?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 Kamran Hashmi on Medium]]></title>
        <description><![CDATA[Stories by Kamran Hashmi on Medium]]></description>
        <link>https://medium.com/@kamranali.k47?source=rss-18c676f7d11f------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*FGMVY-hQhgMpe9pLO-pKAw.png</url>
            <title>Stories by Kamran Hashmi on Medium</title>
            <link>https://medium.com/@kamranali.k47?source=rss-18c676f7d11f------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 29 Nov 2026 23:25:30 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@kamranali.k47/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[Installing GoDaddy's New R1 SSL Certificates on Windows Server 2016 (IIS 10): Fixing OpenSSL 3 PFX…]]></title>
            <link>https://medium.com/@kamranali.k47/installing-godaddys-new-r1-ssl-certificates-on-windows-server-2016-iis-10-fixing-openssl-3-pfx-85ee9a0e2ce6?source=rss-18c676f7d11f------2</link>
            <guid isPermaLink="false">https://medium.com/p/85ee9a0e2ce6</guid>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[sre]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[windows-server]]></category>
            <dc:creator><![CDATA[Kamran Hashmi]]></dc:creator>
            <pubDate>Fri, 27 Nov 2026 08:59:30 GMT</pubDate>
            <atom:updated>2026-11-27T09:52:26.902Z</atom:updated>
            <content:encoded><![CDATA[<h3>Installing GoDaddy&#39;s New R1 SSL Certificates on Windows Server 2016 (IIS 10): Fixing OpenSSL 3 PFX and Chain Errors</h3><p>A production-safe guide to legacy PFX exports, GoDaddy&#39;s new R1v1 intermediate <em>hierarchy, and SNI-safe IIS rebinding without disturbing client ACME/Let&#39;s Encrypt sites.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0IR50JS7UWdR8AlAHoVE-Q.png" /></figure><p>If you manage legacy Windows Server 2016 servers running IIS 10, renewing a GoDaddy SSL certificate in 2026 can suddenly break in ways that did not happen in previous years. You export a valid .pfx file, import it into IIS Manager, attach it to your HTTPS site binding—and either IIS rejects the password or browsers throw NET::ERR_CERT_AUTHORITY_INVALID (or CDN Error 526).</p><p>Nothing is wrong with your certificate. Two platform changes collided at the same time:</p><ol><li>OpenSSL 3&#39;s default PKCS#12 encryption is incompatible with Windows Server 2016. OpenSSL 3 exports .pfx containers with PBES2 / PBKDF2 / AES-256-CBC by default. Windows Server 2016&#39;s older CryptoAPI throws &quot;The specified network password is not correct&quot; or &quot;Invalid provider specified&quot; even when your password is right.</li><li>GoDaddy migrated certificate issuance from the legacy G2 intermediate to the new R1 hierarchy. Older certificates were issued directly by Go Daddy Secure Certificate Authority - G2, which Windows Server 2016 already cached years ago. Newly renewed certificates are issued by GoDaddy TLS Intermediate CA OV - R1v1 (or DV equivalent), which chains through GoDaddy TLS Root CA - R1 (cross-signed by Go Daddy Root Certificate Authority - G2). Importing a .pfx through IIS Manager does not install those new intermediate CAs into Windows&#39; Intermediate Certification Authorities store (LocalMachine\CA), leaving IIS serving a broken chain.</li></ol><p>Here is the exact, production-safe workflow to build a Windows Server 2016–compatible .pfx, install GoDaddy&#39;s new R1 chain safely, and rebind a single canary domain—or all matching bindings—without touching client ACME / Let&#39;s Encrypt certificates on the same server.</p><h3>TL;DR: The 30-Second Incident Triage &amp; Quick-Fix Cheatsheet</h3><p>If you are currently resolving an active production incident, use this cheatsheet immediately.</p><h4>Failure Mode vs. Instant Fix Matrix</h4><ul><li>PFX Import Fails (“The specified network password is not correct” or “Invalid provider specified”): Root Cause — OpenSSL 3 exports PFX using PBES2 / PBKDF2 / AES-256-CBC while Windows Server 2016 CryptoAPI only supports legacy 3DES/RC2. Instant Fix — Add the -legacy flag to openssl pkcs12 -export to force legacy 3DES encryption.</li><li>Browser / CDN Error (NET::ERR_CERT_AUTHORITY_INVALID or Cloudflare Error 526): Root Cause — GoDaddy moved to the R1 hierarchy, and IIS Manager GUI does not import intermediates into Cert:\LocalMachine\CA. Instant Fix — Import gd_ov-r1-g2_iis_intermediates.p7b directly into Cert:\LocalMachine\CA via PowerShell.</li><li>PowerShell Error (Import-Certificate rejects file extension): Root Cause — PowerShell 5.1 on Windows Server 2016 does not support .pem extensions. Instant Fix — Pass the .p7b container (or individual .crt files) from the GoDaddy IIS zip package.</li><li>Multi-Tenant Outage (Client ACME / Let&#39;s Encrypt sites broken): Root Cause — Running iisreset or a naive IP binding script (*:443:) clobbered SNI bindings. Instant Fix — Bind surgically using SNI (SslFlags = 1) matching only the target thumbprint; never touch IP bindings.</li></ul><h4>Emergency 4-Step Production Fix</h4><pre># 1. On your Linux/macOS build machine (OpenSSL 3):<br><br># Sanitize BOM and export Windows 2016-compatible legacy PFX<br><br>sed -i &#39;1s/^\xef\xbb\xbf//&#39; private.key<br><br>openssl pkcs12 -export -legacy \<br><br>  -out cert-2026-legacy.pfx \<br><br>  -inkey private.key \<br><br>  -in cert.crt \<br><br>  -certfile gd_ov-r1-g2_iis_intermediates.p7b \<br><br>  -name &quot;Wildcard-2026-Legacy&quot; \<br><br>  -passout pass:YourExportPassword<br><br><br></pre><pre># 2. In an Administrator PowerShell session on Windows Server 2016:<br><br># Install the missing R1 intermediate certificates into machine store (Additive &amp; Safe)<br><br>Import-Certificate -FilePath &quot;C:\certs\gd_ov-r1-g2_iis_intermediates.p7b&quot; -CertStoreLocation Cert:\LocalMachine\CA<br><br><br><br># 3. Import PFX into WebHosting (or My) store<br><br>$pwd = ConvertTo-SecureString &quot;YourExportPassword&quot; -AsPlainText -Force<br><br>$cert = Import-PfxCertificate -FilePath &quot;C:\certs\cert-2026-legacy.pfx&quot; -CertStoreLocation &quot;Cert:\LocalMachine\WebHosting&quot; -Password $pwd -Exportable<br><br><br><br># 4. Surgical SNI Rebind (Zero downtime, zero iisreset, zero impact on tenant sites)<br><br>Import-Module WebAdministration<br><br>$binding = Get-WebBinding -Protocol &quot;https&quot; | Where-Object { ($_.bindingInformation -split &#39;:&#39;)[2] -ieq &quot;app.example.com&quot; }<br><br>$binding.AddSslCertificate($cert.Thumbprint, &quot;WebHosting&quot;)</pre><h3>Why IIS Manager GUI Import Alone Fails on Renewals</h3><p>When IIS imports a .pfx via Server Certificates → Import..., it stores the leaf certificate and private key in Personal or WebHosting, not the intermediate certificates in Cert:\LocalMachine\CA. Windows HTTP.sys and Schannel build the TLS chain dynamically from the machine certificate stores.</p><p>If your server only has the old G2 intermediate, IIS transmits only the leaf *.example.com certificate during the TLS handshake. Browsers fail chain validation (ERR_CERT_AUTHORITY_INVALID), and reverse proxies or CDNs configured for Full (Strict) TLS reject the origin with Error 526.</p><h3>Step 1: Verify Your Private Key Matches the Issued Certificate</h3><p>GoDaddy&#39;s IIS download archive (*.zip) contains only public certificates (typically *.crt, *.pem, and gd_ov-r1-g2_iis_intermediates.p7b). Your private key stays wherever you generated the CSR.</p><p>Before bundling anything, confirm mathematically that your private key matches the newly issued certificate:</p><pre>openssl x509 -noout -modulus -in cert.crt | openssl sha256<br>openssl rsa  -noout -modulus -in private.key | openssl sha256<br><br></pre><p>Both SHA-256 hashes must be identical.</p><blockquote>Watch out for UTF-8 BOMs: If your private key was saved from Notepad or a Windows editor, it often starts with a hidden UTF-8 Byte Order Mark (\xef\xbb\xbf), which causes openssl to fail with unable to load Private Key. Strip any BOM cleanly before exporting:</blockquote><pre>sed &#39;1s/^\xef\xbb\xbf//&#39; private.key &gt; private-clean.key<br>chmod 600 private-clean.key<br><br></pre><h3>Step 2: Extract and Verify the New R1 Intermediate Chain</h3><p>Unpack GoDaddy&#39;s .p7b intermediate bundle into PEM format so we can inspect and verify the full chain:</p><pre>openssl pkcs7 -print_certs -in gd_ov-r1-g2_iis_intermediates.p7b -out intermediates.pem<br><br></pre><p>Inspect the extracted certificates:</p><pre>openssl crl2pkcs7 -nocrl -certfile intermediates.pem | openssl pkcs7 -print_certs -noout<br><br></pre><p>You should see two non-self-signed CA certificates:</p><ol><li>subject=...CN=GoDaddy TLS Intermediate CA OV - R1v1 → issuer=...CN=GoDaddy TLS Root CA - R1</li><li>subject=...CN=GoDaddy TLS Root CA - R1 → issuer=...CN=Go Daddy Root Certificate Authority - G2</li></ol><p>If you also want the self-signed Go Daddy Root Certificate Authority - G2 root included in your .pfx bundle (optional, since Windows already trusts G2 in Trusted Root Certification Authorities), append it to full-chain.pem, then verify locally:</p><pre>openssl verify -verbose -untrusted intermediates.pem cert.crt<br># Expected: cert.crt: OK<br><br></pre><h3>Step 3: Export a Windows Server 2016–Compatible PFX (-legacy)</h3><p>To ensure Windows Server 2016 CryptoAPI parses the .pfx cleanly, export with OpenSSL 3&#39;s -legacy flag and attach a clear Friendly Name (e.g., Example 2026-2027 GD) so it is easy to identify inside IIS Manager:</p><pre>openssl pkcs12 -export -legacy \<br>  -out example-2026-legacy.pfx \<br>  -inkey private-clean.key \<br>  -in cert.crt \<br>  -certfile intermediates.pem \<br>  -name &quot;Example 2026-2027 GD&quot; \<br>  -passout pass:YourExportPassword<br><br></pre><p>Delete private-clean.key once exported, and verify the .pfx structure:</p><pre>openssl pkcs12 -legacy -info -noout -in example-2026-legacy.pfx -passin pass:YourExportPassword<br><br></pre><p>Confirm the encryption algorithms match Windows Server 2016 expectations:</p><ul><li>MAC: sha1, Iteration 2048</li><li>PKCS7 Encrypted data: pbeWithSHA1And40BitRC2-CBC, Iteration 2048</li><li>Shrouded Keybag: pbeWithSHA1And3-KeyTripleDES-CBC, Iteration 2048</li></ul><h3>Step 4: Install the R1 Intermediates into LocalMachine\CA Safely</h3><p>On a multi-tenant IIS server hosting both your wildcard domain (*.example.com) and dozens of client custom domains (such as Let&#39;s Encrypt / ACME certificates), administrators often hesitate to touch the machine certificate store.</p><p>Here is why installing the two GoDaddy R1 intermediates into Cert:\LocalMachine\CA is safe:</p><ul><li>No private keys are involved: Both certificates are public CA certificates (CA:TRUE). They can only verify signatures, never sign or impersonate anything.</li><li>Purely additive: Both certificates are not self-signed, so they belong in Intermediate Certification Authorities (Cert:\LocalMachine\CA)—never in Trusted Root Certification Authorities (Cert:\LocalMachine\Root). Trust remains anchored to the existing G2 root from 2009.</li><li>No collision with G2 or ACME certificates: Existing G2 certificates and Let&#39;s Encrypt chains remain completely untouched, and removing the two R1 thumbprints cleanly reverses the change.</li></ul><h4>PowerShell 5.1 Caveat: Do Not Pass .pem to Import-Certificate</h4><p>On Windows Server 2016 (PowerShell 5.1), Import-Certificate rejects .pem file extensions. Pass GoDaddy&#39;s .p7b bundle (or individual .crt files) instead:</p><pre># Imports both R1v1 and R1-cross-G2 into Local Computer -&gt; Intermediate Certification Authorities<br>Import-Certificate -FilePath &quot;C:\certs\gd_ov-r1-g2_iis_intermediates.p7b&quot; -CertStoreLocation Cert:\LocalMachine\CA<br><br></pre><p>Verify both subjects appear in Cert:\LocalMachine\CA:</p><pre>Get-ChildItem Cert:\LocalMachine\CA | Where-Object { $_.Subject -like &quot;*GoDaddy*&quot; -or $_.Subject -like &quot;*Go Daddy*&quot; } | Format-Table Subject, Issuer, NotAfter -AutoSize<br><br></pre><h3>Step 5: Import the PFX and Validate Key + Chain in PowerShell 5.1</h3><p>Two common PowerShell pitfalls trip people up on Windows Server 2016:</p><ul><li>Import-PfxCertificate has no -KeyStorageFlags parameter in PowerShell 5.1. Importing directly to Cert:\LocalMachine\WebHosting or Cert:\LocalMachine\My already stores the private key in the machine keystore (MachineKeySet + PersistKeySet). Add -Exportable so IIS/HTTP.sys can access it cleanly.</li><li>Use My (Personal) if you have non-SNI bindings. Windows Server 2016 supports WebHosting for SNI (SslFlags = 1) bindings, whereas non-SNI IP bindings (*:443:) require the certificate in Cert:\LocalMachine\My.</li></ul><p>Run this in an Administrator PowerShell session to import and validate before touching any live IIS binding:</p><pre>$pfxPath  = &quot;C:\certs\example-2026-legacy.pfx&quot;<br>$password = ConvertTo-SecureString &quot;YourExportPassword&quot; -AsPlainText -Force<br>$store    = &quot;WebHosting&quot; # Use &quot;My&quot; if any binding has SNI disabled<br> <br>$cert = Import-PfxCertificate -FilePath $pfxPath -CertStoreLocation &quot;Cert:\LocalMachine\$store&quot; -Password $password -Exportable<br> <br>if (-not $cert.HasPrivateKey) {<br>    certutil.exe -repairstore $store $cert.Thumbprint<br>    $cert = Get-Item &quot;Cert:\LocalMachine\$store\$($cert.Thumbprint)&quot;<br>}<br> <br>$chain = New-Object System.Security.Cryptography.X509Certificates.X509Chain<br>$chain.ChainPolicy.RevocationMode = [System.Security.Cryptography.X509Certificates.X509RevocationMode]::NoCheck<br>$chainOk = $chain.Build($cert)<br> <br>Write-Host &quot;FriendlyName  : $($cert.FriendlyName)&quot;<br>Write-Host &quot;Thumbprint    : $($cert.Thumbprint)&quot;<br>Write-Host &quot;HasPrivateKey : $($cert.HasPrivateKey)&quot;<br>Write-Host &quot;Chain Valid   : $chainOk&quot;<br>$chain.ChainElements | ForEach-Object { Write-Host &quot;  -&gt; $($_.Certificate.Subject)&quot; }<br><br></pre><p>Do not move to Step 6 until HasPrivateKey is True and Chain Valid is True showing all four chain elements (*.example.com → R1v1 → R1 → G2 Root).</p><h3>Step 6: Rebind IIS Safely Without Breaking Client ACME / Let’s Encrypt Sites</h3><h4>Option A: Test a Single Canary Domain First (Zero iisreset, Zero Impact to Other Sites)</h4><p>Instead of switching every binding at once or running iisreset across a multi-site production server, test one hostname first (e.g., app.example.com) and verify that SNI (SslFlags = 1) is enabled:</p><pre>Import-Module WebAdministration<br>$newThumb   = &quot;&lt;NEW_THUMBPRINT&gt;&quot;<br>$targetHost = &quot;app.example.com&quot;<br> <br>$binding = Get-WebBinding -Protocol &quot;https&quot; | Where-Object {<br>    ($_.bindingInformation -split &#39;:&#39;)[2] -ieq $targetHost<br>}<br> <br>if (-not $binding) { throw &quot;No HTTPS binding found for $targetHost&quot; }<br> <br>$isSni = (($binding.sslFlags -band 1) -eq 1)<br>if (-not $isSni) {<br>    Write-Warning &quot;SNI is OFF for $targetHost. Enable SNI first so no other non-SNI bindings are affected.&quot;<br>} else {<br>    $binding.AddSslCertificate($newThumb, &quot;WebHosting&quot;)<br>    Write-Host &quot;Updated ONLY $targetHost to $newThumb.&quot; -ForegroundColor Green<br>}<br><br></pre><p>Re-binding that single SNI hostname refreshes HTTP.sys for app.example.com without restarting IIS or affecting any other domain.</p><h4>Option B: Bulk-Replace Only Old GoDaddy Bindings (Skipping ACME/Client Sites)</h4><p>Avoid querying IIS:\SslBindings\*!443 in scripts—that wildcard path skips SNI bindings (!443!hostname). Instead, inspect $b.certificateHash directly via Get-WebBinding and match only &lt;OLD_THUMBPRINT&gt;:</p><pre>Import-Module WebAdministration<br>$oldThumb = &quot;&lt;OLD_THUMBPRINT&gt;&quot;<br>$newThumb = &quot;&lt;NEW_THUMBPRINT&gt;&quot;<br>$store    = &quot;WebHosting&quot;<br> <br>foreach ($site in (Get-Website)) {<br>    foreach ($b in (Get-WebBinding -Name $site.Name -Protocol &quot;https&quot;)) {<br>        if ($b.certificateHash -and ($b.certificateHash.ToUpper() -eq $oldThumb.ToUpper())) {<br>            Write-Host &quot;Updating $($site.Name) -&gt; $($b.bindingInformation)&quot;<br>            $b.AddSslCertificate($newThumb, $store)<br>        }<br>    }<br>}<br><br></pre><p>Because every ACME / Let&#39;s Encrypt binding has its own thumbprint, none of your client domains are modified. Only run iisreset /noforce during a maintenance window if HTTP.sys continues serving a stale cached chain after rebinding.</p><h3>Step 7: Verify the Live TLS Chain End-to-End</h3><p>Verify the full handshake from an external machine using openssl s_client.</p><blockquote>CDN Tip: If a hostname is proxied behind a CDN (such as Cloudflare), querying the domain directly shows the CDN edge certificate rather than your IIS origin certificate. Connect directly to your server&#39;s public IP with -servername to inspect what IIS actually serves:</blockquote><pre>openssl s_client -connect &lt;ORIGIN_IP&gt;:443 -servername app.example.com -showcerts &lt;/dev/null</pre><p>Check for:</p><ul><li>depth=3 … Go Daddy Root Certificate Authority - G2</li><li>depth=2 … GoDaddy TLS Root CA - R1</li><li>depth=1 … GoDaddy TLS Intermediate CA OV - R1v1</li><li>depth=0 … CN=*.example.com</li><li>Verify return code: 0 (ok)</li></ul><p>Then confirm one of your client ACME domains on the same server still serves its Let&#39;s Encrypt certificate cleanly:</p><pre>openssl s_client -connect &lt;ORIGIN_IP&gt;:443 -servername booking.clientdomain.com &lt;/dev/null | grep -E &quot;subject=|issuer=|Verify return&quot;</pre><h3>Final Note: Plan Ahead for January 12, 2027</h3><p>While this -legacy PFX and R1 intermediate workflow keeps IIS 10 on Windows Server 2016 running reliably today, Microsoft Windows Server 2016 reaches End of Extended Support on January 12, 2027. Alongside automating certificate renewals, schedule an OS upgrade path to Windows Server 2022 or 2025 so your web tier stays patched and natively supports modern cryptography.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=85ee9a0e2ce6" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to expose your on-prem server to the internet without a public IP]]></title>
            <link>https://medium.com/@kamranali.k47/how-to-expose-your-on-prem-server-to-the-internet-without-a-public-ip-fac167502837?source=rss-18c676f7d11f------2</link>
            <guid isPermaLink="false">https://medium.com/p/fac167502837</guid>
            <category><![CDATA[cloud-engineering]]></category>
            <category><![CDATA[cloudflare]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[homelab]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <dc:creator><![CDATA[Kamran Hashmi]]></dc:creator>
            <pubDate>Tue, 26 May 2026 20:07:27 GMT</pubDate>
            <atom:updated>2026-11-27T10:05:28.712Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2C96Iwg-bIgU5MdCe__bCw.jpeg" /></figure><p>If you run services on a local or private server — a Windows VM, a home lab, an on-prem API — you’ve hit the wall: no public IP means no inbound traffic. The usual workarounds (port forwarding, reverse proxies, VPNs) all require firewall access or infrastructure you may not control.</p><p>Cloudflare Tunnel solves this cleanly. Your server makes an <strong>outbound</strong> connection to Cloudflare’s edge. Cloudflare proxies public traffic back through that connection. No inbound ports. No public IP. Free on the base plan.</p><h3>TL;DR: The 30-Second Incident Triage &amp; Quick-Deploy Cheatsheet</h3><p>If you need to establish a secure tunnel right now, use this copy-paste runbook.</p><h4>Production Triage &amp; Architecture Matrix</h4><ul><li>No Public IP / CGNAT (ISP blocks inbound 80/443): Outbound QUIC/HTTPS tunnel to Cloudflare Edge — Run cloudflared tunnel run &lt;TUNNEL_NAME&gt; (Outbound only).</li><li>Subdomain Routing (api.domain.com vs web.domain.com): config.yml ingress rule mapping — Map hostnames to local localhost:&lt;PORT&gt; with a mandatory fallback rule.</li><li>Service Persistence (Tunnel dies when terminal closes): OS Service Daemon (systemd or Windows Service) — Run cloudflared service install.</li><li>Origin TLS Mismatch (502 Bad Gateway to internal HTTPS): noTLSVerify ingress flag — Add originRequest: noTLSVerify: true if local service uses self-signed TLS.</li></ul><h4>Emergency 4-Step Runbook (Linux / Windows)</h4><pre># 1. Authenticate cloudflared with your Cloudflare account<br><br>cloudflared tunnel login<br><br><br><br># 2. Create the tunnel<br><br>cloudflared tunnel create prod-edge-tunnel<br><br># Note the generated Tunnel ID (UUID) and credentials file path:<br><br># ~/.cloudflared/&lt;TUNNEL_ID&gt;.json<br><br><br><br><br><br><br></pre><pre># 3. Create ~/.cloudflared/config.yml<br><br>tunnel: &lt;TUNNEL_ID&gt;<br><br>credentials-file: /etc/cloudflared/&lt;TUNNEL_ID&gt;.json<br><br><br><br>ingress:<br><br>  - hostname: app.yourdomain.com<br><br>    service: http://localhost:8080<br><br>  - hostname: api.yourdomain.com<br><br>    service: http://localhost:3000<br><br>  # Mandatory catch-all rule (cloudflared will refuse to start without this)<br><br>  - service: http_status:404</pre><pre># 4. Route DNS in Cloudflare and install as a system service<br><br>cloudflared tunnel route dns prod-edge-tunnel app.yourdomain.com<br><br>cloudflared tunnel route dns prod-edge-tunnel api.yourdomain.com<br><br><br><br><br><br><br><br># Linux (systemd)<br><br>sudo cloudflared --config /etc/cloudflared/config.yml service install<br><br>sudo systemctl enable --now cloudflared<br><br><br><br># Windows (Administrator PowerShell)<br><br>cloudflared service install<br><br>Start-Service cloudflared</pre><h3>How it works</h3><pre>User → yourdomain.com → Cloudflare edge → tunnel → your server</pre><p>Your server runs a lightweight daemon called cloudflared. It opens persistent outbound connections to Cloudflare&#39;s global network. When a request hits your domain, Cloudflare routes it through the tunnel to your local service. The response travels back the same way.</p><p>You get HTTPS, DDoS protection, and Cloudflare’s edge caching — for free, without touching your firewall.</p><h3>Prerequisites</h3><ul><li>A domain on Cloudflare (using Cloudflare nameservers)</li><li>A server running your service (Windows, Linux)</li><li>cloudflared installed on that server</li></ul><h3>Step 1 — Install cloudflared</h3><p><strong>Windows:</strong></p><pre>[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12<br>Invoke-WebRequest -Uri &quot;https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-windows-amd64.msi&quot; -OutFile &quot;C:\cloudflared.msi&quot;<br>Start-Process msiexec.exe -Wait -ArgumentList &#39;/I C:\cloudflared.msi /quiet&#39;</pre><p><strong>Linux:</strong></p><pre>curl -L https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-linux-amd64 -o /usr/local/bin/cloudflared<br>chmod +x /usr/local/bin/cloudflared</pre><p>Copy the binary to a path with no spaces to avoid quoting issues on Windows:</p><pre>mkdir C:\cloudflared<br>Copy-Item &quot;C:\Program Files (x86)\cloudflared\cloudflared.exe&quot; C:\cloudflared\</pre><h3>Step 2 — Authenticate with Cloudflare</h3><pre>cloudflared tunnel login</pre><p>This opens a browser window. Log in and select your domain. Cloudflare writes a cert.pem credential file to ~/.cloudflared/ (or C:\Users\&lt;user&gt;\.cloudflared\ on Windows). Copy it to your working directory.</p><h3>Step 3 — Create a tunnel</h3><pre>cloudflared tunnel create my-tunnel</pre><p>Note the tunnel ID from the output — you’ll need it in the config. Cloudflare writes a credentials JSON file alongside cert.pem.</p><p>Copy both files to your working directory:</p><pre>Copy-Item &quot;C:\Users\Administrator\.cloudflared\&lt;tunnel-id&gt;.json&quot; C:\cloudflared\<br>Copy-Item &quot;C:\Users\Administrator\.cloudflared\cert.pem&quot; C:\cloudflared\</pre><h3>Step 4 — Write the config file</h3><p>Create C:\cloudflared\config.yml:</p><pre>tunnel: &lt;your-tunnel-id&gt;<br>credentials-file: C:\cloudflared\&lt;your-tunnel-id&gt;.json</pre><pre>ingress:<br>  - hostname: api.yourdomain.com<br>    service: <a href="https://localhost/">https://localhost:443</a><br>    originRequest:<br>      noTLSVerify: true<br>      httpHostHeader: api.yourdomain.com<br>  - hostname: app.yourdomain.com<br>    service: <a href="http://localhost/">http://localhost:80</a><br>  - service: http_status:404</pre><p><strong>Key points:</strong></p><ul><li>Use noTLSVerify: true if your local service uses a self-signed or internal certificate.</li><li>The final - service: http_status:404 is required — it catches any unmatched hostname.</li><li>If your IIS site uses host header routing, set httpHostHeader to match the binding exactly.</li><li>Use a path with no spaces on Windows (C:\cloudflared\) to avoid service startup failures.</li></ul><h3>Step 5 — Route DNS to the tunnel</h3><pre>cloudflared tunnel route dns my-tunnel api.yourdomain.com<br>cloudflared tunnel route dns my-tunnel app.yourdomain.com</pre><p>This creates CNAME records in Cloudflare DNS pointing to your tunnel. If a record already exists, delete it in the Cloudflare dashboard first and re-run the command.</p><h3>Step 6 — Test the tunnel manually</h3><p>Before installing as a service, run it in the foreground to confirm it connects:</p><pre>cloudflared --config C:\cloudflared\config.yml tunnel run my-tunnel</pre><p>You should see:</p><pre>INF Registered tunnel connection connIndex=0 ... location=mrs01 protocol=quic<br>INF Registered tunnel connection connIndex=1 ... location=mrs06 protocol=quic</pre><p>Four registered connections means the tunnel is healthy. Press Ctrl+C once confirmed.</p><h3>Step 7 — Install as a Windows service</h3><p>On Windows, the service binary path must include the config and tunnel name explicitly — the default service install command omits them.</p><p>First install the service:</p><pre>C:\cloudflared\cloudflared.exe --config C:\cloudflared\config.yml service install</pre><p>Then update the binary path (run in CMD, not PowerShell):</p><pre>sc config cloudflared binpath= &quot;C:\cloudflared\cloudflared.exe --config C:\cloudflared\config.yml tunnel run my-tunnel&quot;</pre><p>Verify:</p><pre>sc qc cloudflared</pre><p>BINARY_PATH_NAME should show the full command. Then start it:</p><pre>net start cloudflared</pre><p><strong>On Linux</strong>, use the built-in service installer:</p><pre>sudo cloudflared service install<br>sudo systemctl start cloudflared<br>sudo systemctl enable cloudflared</pre><h3>Step 8 — Verify</h3><pre>cloudflared tunnel info my-tunnel</pre><p>You should see active connectors with edge locations listed. Then open your public URL in a browser — traffic is now flowing through the tunnel.</p><h3>Common issues</h3><p><strong>Error 1033 — Cloudflare Tunnel error</strong> The tunnel DNS record exists but cloudflared is not running. Start the service and confirm with tunnel info.</p><p><strong>Service starts but no active connections</strong> The service binary path is missing --config and tunnel run. Update it with sc config as shown in Step 7.</p><p><strong>“Marked for deletion” when uninstalling</strong> Kill the cloudflared.exe process with taskkill /F /IM cloudflared.exe, then retry the uninstall.</p><p><strong>Config path with spaces causes startup failure</strong> Move everything to C:\cloudflared\ — a path with no spaces. The Windows service manager splits on spaces when parsing the binary path.</p><h3>What you get</h3><p>Once the tunnel is running you have a production-grade edge in front of your on-prem service:</p><ul><li><strong>HTTPS</strong> with auto-renewed certificates via Cloudflare</li><li><strong>DDoS protection</strong> at the edge before traffic reaches your server</li><li><strong>Zero exposed ports</strong> — your firewall stays closed</li><li><strong>Global routing</strong> through Cloudflare’s anycast network</li><li><strong>Free</strong> on any Cloudflare plan, including the free tier</li></ul><p>The tunnel survives reboots (it’s a system service), reconnects automatically on network interruption, and maintains multiple redundant connections to different edge locations simultaneously.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fac167502837" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Managing multiple Git identities across platforms can get messy fast.]]></title>
            <link>https://medium.com/@kamranali.k47/mastering-multiple-git-accounts-like-a-pro-github-gitlab-self-hosted-532c1ff82c71?source=rss-18c676f7d11f------2</link>
            <guid isPermaLink="false">https://medium.com/p/532c1ff82c71</guid>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[git]]></category>
            <category><![CDATA[programming]]></category>
            <dc:creator><![CDATA[Kamran Hashmi]]></dc:creator>
            <pubDate>Mon, 17 Nov 2025 12:21:16 GMT</pubDate>
            <atom:updated>2026-11-27T10:20:00.050Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*t6EdVT5YixYPh_FHJs6bdA.png" /></figure><p>Managing multiple Git identities across platforms can get messy fast. One minute you’re committing to a personal GitHub repo, the next you’re reviewing a client’s project on their self-hosted GitLab and suddenly you’ve pushed using the wrong email. We’ve all been there.</p><p>If you juggle personal projects, company repositories, and client work, a clean, automated identity-management setup isn’t just convenient — it’s essential for professionalism, security, and peace of mind.</p><p>This guide walks you through a bulletproof way to keep your Git identities fully organized using <strong>separate SSH keys</strong> and <strong>conditional Git configs</strong>. It’s scalable, secure, and once set up, you’ll forget it’s even there.</p><h3>TL;DR: The 30-Second Incident Triage &amp; Quick-Setup Cheatsheet</h3><p>If you just committed with the wrong email or SSH key, use this cheatsheet immediately.</p><h4>Failure Mode vs. Instant Fix Matrix</h4><ul><li>Wrong Author Email in Commit (Committed with personal instead of work email): git config user.email defaulted to global identity — Run git commit — amend — reset-author (before pushing).</li><li>SSH Permission Denied (Permission to org/repo denied to user-A): ssh-agent offered the first loaded key instead of the host-specific key — Add IdentitiesOnly yes and explicit IdentityFile in ~/.ssh/config.</li><li>includeIf Not Triggering (Work email not applied in subdirectories): Missing trailing slash or syntax mismatch in gitdir: - Ensure path ends with / (e.g., gitdir:~/work/) and path is absolute or begins with ~/.</li><li>Unverified GitHub Commits (Commits lack the green &quot;Verified&quot; badge): Missing GPG or SSH commit signing configuration - Enable commit.gpgsign = true and gpg.format = ssh pointing to your signing key.</li></ul><h4>Emergency 4-Step Architecture Runbook</h4><pre># 1. Directory Tree Layout<br><br>mkdir -p ~/work ~/personal ~/clients<br><br><br><br># 2. Generate Dedicated Ed25519 Keys<br><br>ssh-keygen -t ed25519 -C &quot;kamran.work@company.com&quot; -f ~/.ssh/id_ed25519_work<br><br>ssh-keygen -t ed25519 -C &quot;kamran.personal@gmail.com&quot; -f ~/.ssh/id_ed25519_personal<br><br>chmod 600 ~/.ssh/id_ed25519_*</pre><pre># 3. Configure ~/.ssh/config (Prevent SSH key-leaking)<br><br>Host github.com-work<br><br>    HostName github.com<br><br>    User git<br><br>    IdentityFile ~/.ssh/id_ed25519_work<br><br>    IdentitiesOnly yes<br><br><br><br>Host github.com<br><br>    HostName github.com<br><br>    User git<br><br>    IdentityFile ~/.ssh/id_ed25519_personal<br><br>    IdentitiesOnly yes</pre><pre># 4. ~/.gitconfig (Global configuration with conditional includes)<br><br>[user]<br><br>    name = Kamran Hashmi<br><br>    email = kamran.personal@gmail.com<br><br><br><br># Automatically override identity when inside ~/work/<br><br>[includeIf &quot;gitdir:~/work/&quot;]<br><br>    path = ~/.gitconfig-work<br><br><br><br># Automatically override identity when inside ~/clients/<br><br>[includeIf &quot;gitdir:~/clients/&quot;]<br><br>    path = ~/.gitconfig-clients</pre><pre># Contents of ~/.gitconfig-work<br><br>[user]<br><br>    name = Kamran Hashmi<br><br>    email = kamran.work@company.com<br><br>    signingkey = ~/.ssh/id_ed25519_work.pub<br><br>[commit]<br><br>    gpgsign = true<br><br>[gpg]<br><br>    format = ssh</pre><h3>Why Developers Must Take Identity Management Seriously</h3><p>Accidentally leaking the wrong identity can lead to:</p><ul><li>Incorrect commit authorship</li><li>Exposing personal email on professional repos</li><li>CI/CD pipelines breaking due to mismatched credentials</li><li>Security risks when reusing SSH keys</li><li>Hours wasted fixing accidental misconfigurations</li></ul><p>The fix? A clean, structured, automated setup.</p><h3>The Winning Strategy: SSH Keys + Conditional Git Config</h3><p>The system you’ll build consists of three core components:</p><ol><li><strong>Independent SSH keys</strong> for every Git identity</li><li><strong>An SSH config</strong> that tells your system which key to use</li><li><strong>Conditional Git configs</strong> that select the right email &amp; name every time</li></ol><p>Once these are in place, switching Git accounts becomes automatic.</p><h3>Step 1 — Generate Separate SSH Keys</h3><p>Every identity deserves its own key. It keeps access isolated and avoids messy authentication issues.</p><pre>ssh-keygen -t ed25519 -C &quot;work@company.com&quot; -f ~/.ssh/id_github_work<br>ssh-keygen -t ed25519 -C &quot;personal@email.com&quot; -f ~/.ssh/id_gitlab_personal<br>ssh-keygen -t ed25519 -C &quot;contractor@client.com&quot; -f ~/.ssh/id_gitlab_client</pre><h3>Best Practices</h3><ul><li>Use <strong>ed25519</strong> keys</li><li>Always set a passphrase</li><li>Name keys clearly (e.g., id_github_work)</li><li>Never reuse the same key on multiple platforms</li></ul><p>Load them once using ssh-agent:</p><pre>eval &quot;$(ssh-agent -s)&quot;<br>ssh-add ~/.ssh/id_github_work<br>ssh-add ~/.ssh/id_gitlab_personal<br>ssh-add ~/.ssh/id_gitlab_client</pre><h3>Step 2 — Add Public Keys to Your Git Platforms</h3><p>Each hosting platform has a section for adding SSH keys.</p><p>Quick commands:</p><pre>cat ~/.ssh/id_github_work.pub<br>cat ~/.ssh/id_gitlab_personal.pub</pre><p>Then test them:</p><pre>ssh -T git@github.com<br>ssh -T git@gitlab.com</pre><p>You should see a greeting from each platform.</p><h3>Step 3 — Build a Clean SSH Config</h3><p>This is where the magic begins. Your system will now automatically use the correct key.</p><p>Create or edit:</p><p>~/.ssh/config</p><pre># GitHub - Work<br>Host github.com<br>  HostName github.com<br>  User git<br>  IdentityFile ~/.ssh/id_github_work<br>  IdentitiesOnly yes<br># GitHub - Personal (alias)<br>Host github-personal<br>  HostName github.com<br>  User git<br>  IdentityFile ~/.ssh/id_gitlab_personal<br>  IdentitiesOnly yes<br># GitLab - Personal<br>Host gitlab.com<br>  HostName gitlab.com<br>  User git<br>  IdentityFile ~/.ssh/id_gitlab_personal<br>  IdentitiesOnly yes<br># Self-hosted GitLab (client)<br>Host gitlab.client-company.com<br>  HostName gitlab.client-company.com<br>  User git<br>  IdentityFile ~/.ssh/id_gitlab_client<br>  IdentitiesOnly yes</pre><h3>Why this matters</h3><ul><li>IdentitiesOnly yes prevents your system from offering <em>all</em> your keys</li><li>Aliases (e.g., github-personal) allow multiple accounts on the same platform</li></ul><p>Cloning personal GitHub repo:</p><pre>git clone git@github-personal:username/project.git</pre><p>Beautiful and clean.</p><h3>Step 4 — Automate Identity Selection with Conditional Git Config</h3><p>This makes sure every project automatically uses the correct name/email.</p><h3>Main Git config (~/.gitconfig)</h3><pre>[includeIf &quot;gitdir:~/work/&quot;]<br>  path = ~/.gitconfig-work<br>[includeIf &quot;gitdir:~/personal/&quot;]<br>  path = ~/.gitconfig-personal<br>[includeIf &quot;gitdir:~/clients/acme/&quot;]<br>  path = ~/.gitconfig-acme</pre><h3>Work Identity (~/.gitconfig-work)</h3><pre>[user]<br>  name = John Doe<br>  email = john.doe@company.com</pre><h3>Personal Identity (~/.gitconfig-personal)</h3><pre>[user]<br>  name = John Doe<br>  email = john.personal@gmail.com</pre><h3>Client Identity (~/.gitconfig-acme)</h3><pre>[user]<br>  name = John Doe (Contractor)<br>  email = john@acmecorp.io</pre><h3>Step 5 — Use a Clean Directory Structure</h3><p>This allows conditional configs to function seamlessly.</p><pre>~/work/<br>~/personal/<br>~/clients/acme/<br>~/clients/globex/</pre><p>Everything placed under ~/work/ will automatically use your work identity — hands-free.</p><h3>Verification &amp; Troubleshooting</h3><h3>Check identity in any repo:</h3><pre>git config user.email</pre><h3>List all active configs:</h3><pre>git config --list --show-origin</pre><h3>SSH debug:</h3><pre>ssh -vT git@github.com</pre><h3>Advanced Enhancements</h3><h3>✔ Enable Commit Signing (GPG)</h3><p>Keeps your commits verified and trusted.</p><h3>✔ Fix Permissions</h3><pre>chmod 700 ~/.ssh<br>chmod 600 ~/.ssh/config<br>chmod 600 ~/.ssh/id_*</pre><h3>✔ Global Pre-Commit Hook (Optional)</h3><p>Warnings if you’re using the wrong identity:</p><pre>EMAIL=$(git config user.email)<br>REMOTE=$(git config --get remote.origin.url)<br><br>if [[ $REMOTE == *&quot;company&quot;* ]] &amp;&amp; [[ $EMAIL != *&quot;@company.com&quot; ]]; then<br>  echo &quot;Wrong Git identity for this repo!&quot;<br>  exit 1<br>fi</pre><h3>✔ Use SSH Config Includes for Large Setups</h3><p>Keeps your configuration maintainable.</p><h3>Common Pitfalls (And How to Fix Them)</h3><h3>❌ Permission denied (publickey)</h3><ul><li>Key not added to platform</li><li>Wrong IdentityFile</li><li>SSH agent not loaded</li></ul><h3>❌ Git uses the wrong email</h3><ul><li>Conditional include path mismatch</li><li>Missing trailing slash (gitdir:~/work/)</li></ul><h3>❌ SSH tries the wrong key</h3><ul><li>Ensure IdentitiesOnly yes is present</li></ul><h3>Security Checklist</h3><p>Before calling it done, ensure:</p><p>✅ Unique SSH key for every identity<br> ✅ Passphrases enabled<br> ✅ Correct file permissions<br> ✅ No plaintext tokens in Git configs<br> ✅ Old keys removed from GitHub/GitLab<br> ✅ Annual key rotation</p><p>This setup protects your accounts and your reputation.</p><h3>Conclusion</h3><p>With this system in place, you’ll never again:</p><ul><li>Commit with the wrong email</li><li>Push using the wrong SSH key</li><li>Reveal personal info on client repositories</li><li>Manually reconfigure Git identities</li></ul><p>Your workflow becomes <strong>automatic, clean, secure, and scalable</strong>.</p><p>Whether you’re a freelancer, DevOps engineer, or open-source contributor, this is a game-changing improvement to your daily routine.</p><h3>If You Found This Useful</h3><p>Share this guide with your team — it can save hours of confusion (and embarrassment).</p><p>Feel free to drop questions, improvements, or your own workflow tips in the comments.</p><p><strong>Tags:</strong> Git, DevOps, SSH, GitHub, GitLab, Productivity, Security, Developer Tools</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=532c1ff82c71" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>