<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
    <title>nully0x</title>
    <subtitle>Welcome to my nerd space</subtitle>
    <link rel="self" type="application/atom+xml" href="https://notes.nully0x.site/atom.xml"/>
    <link rel="alternate" type="text/html" href="https://notes.nully0x.site"/>
    <generator uri="https://www.getzola.org/">Zola</generator>
    <updated>2026-06-02T00:00:00+00:00</updated>
    <id>https://notes.nully0x.site/atom.xml</id>
    <entry xml:lang="en">
        <title>A note on ArgoCD behind Traefik — double TLS</title>
        <published>2026-06-02T00:00:00+00:00</published>
        <updated>2026-06-02T00:00:00+00:00</updated>
        
        <author>
          <name>
            nully0x
          </name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://notes.nully0x.site/a-note-on-argocd-tls/"/>
        <id>https://notes.nully0x.site/a-note-on-argocd-tls/</id>
        
        <content type="html" xml:base="https://notes.nully0x.site/a-note-on-argocd-tls/">&lt;p&gt;I deployed ArgoCD behind Traefik with cert-manager issuing a Let&#x27;s Encrypt certificate for &lt;code&gt;cd.mywebsite.co&lt;&#x2F;code&gt;. DNS resolved correctly, the cert was issued and ready, the ingress was configured — but the URL returned a &lt;code&gt;307&lt;&#x2F;code&gt; redirect loop instead of the ArgoCD login page.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;the-symptom&quot;&gt;The Symptom&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #ABB2BF; background-color: #282C34;&quot;&gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #61AFEF;&quot;&gt;$&lt;&#x2F;span&gt;&lt;span style=&quot;color: #98C379;&quot;&gt; curl&lt;&#x2F;span&gt;&lt;span style=&quot;color: #D19A66;&quot;&gt; -vk&lt;&#x2F;span&gt;&lt;span style=&quot;color: #98C379;&quot;&gt; https:&#x2F;&#x2F;cd.mywebsite.co&lt;&#x2F;span&gt;&lt;span&gt; 2&amp;gt;&amp;amp;1 |&lt;&#x2F;span&gt;&lt;span style=&quot;color: #61AFEF;&quot;&gt; head&lt;&#x2F;span&gt;&lt;span style=&quot;color: #D19A66;&quot;&gt; -20&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;* SSL connection using TLSv1.3 &#x2F; TLS_AES_128_GCM_SHA256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;* Server certificate:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;*   subject:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #E06C75;&quot;&gt; CN&lt;&#x2F;span&gt;&lt;span style=&quot;color: #56B6C2;&quot;&gt;=&lt;&#x2F;span&gt;&lt;span style=&quot;color: #98C379;&quot;&gt;cd.mywebsite.co&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;*   issuer:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #E06C75;&quot;&gt; C&lt;&#x2F;span&gt;&lt;span style=&quot;color: #56B6C2;&quot;&gt;=&lt;&#x2F;span&gt;&lt;span style=&quot;color: #98C379;&quot;&gt;US&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #E06C75;&quot;&gt; O&lt;&#x2F;span&gt;&lt;span style=&quot;color: #56B6C2;&quot;&gt;=&lt;&#x2F;span&gt;&lt;span style=&quot;color: #98C379;&quot;&gt;Let&amp;#39;s Encrypt; CN=R10&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #98C379;&quot;&gt;&amp;lt; HTTP&#x2F;2 307&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #98C379;&quot;&gt;&amp;lt; location: https:&#x2F;&#x2F;cd.mywebsite.co&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;TLS was fine. The cert was valid. But the response was a &lt;code&gt;307&lt;&#x2F;code&gt; redirect back to itself.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;checking-the-traefik-logs&quot;&gt;Checking the Traefik Logs&lt;&#x2F;h3&gt;
&lt;p&gt;The Traefik access logs confirmed the redirect was coming from the ArgoCD server, not Traefik:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #ABB2BF; background-color: #282C34;&quot;&gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #61AFEF;&quot;&gt;$&lt;&#x2F;span&gt;&lt;span style=&quot;color: #98C379;&quot;&gt; kubectl logs&lt;&#x2F;span&gt;&lt;span style=&quot;color: #D19A66;&quot;&gt; -n&lt;&#x2F;span&gt;&lt;span style=&quot;color: #98C379;&quot;&gt; traefik&lt;&#x2F;span&gt;&lt;span style=&quot;color: #D19A66;&quot;&gt; -l&lt;&#x2F;span&gt;&lt;span style=&quot;color: #98C379;&quot;&gt; app=traefik&lt;&#x2F;span&gt;&lt;span style=&quot;color: #D19A66;&quot;&gt; --tail=50&lt;&#x2F;span&gt;&lt;span&gt; |&lt;&#x2F;span&gt;&lt;span style=&quot;color: #61AFEF;&quot;&gt; grep&lt;&#x2F;span&gt;&lt;span style=&quot;color: #98C379;&quot;&gt; argocd&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #61AFEF;&quot;&gt;&amp;quot;GET &#x2F; HTTP&#x2F;1.1&amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #D19A66;&quot;&gt; 307 58&lt;&#x2F;span&gt;&lt;span style=&quot;color: #98C379;&quot;&gt; &amp;quot;-&amp;quot; &amp;quot;-&amp;quot; &amp;quot;argocd-argocd-server-cd-mywebsite-co@kubernetes&amp;quot; &amp;quot;http:&#x2F;&#x2F;10.120.1.9:8080&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Traefik was terminating TLS and forwarding plain HTTP to the ArgoCD server on port 8080. But ArgoCD was also serving its own TLS by default, so it saw an HTTP request and issued a &lt;code&gt;307&lt;&#x2F;code&gt; redirect to HTTPS — creating a loop.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;the-argocd-server-args&quot;&gt;The ArgoCD Server Args&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #ABB2BF; background-color: #282C34;&quot;&gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #61AFEF;&quot;&gt;$&lt;&#x2F;span&gt;&lt;span style=&quot;color: #98C379;&quot;&gt; kubectl get deploy&lt;&#x2F;span&gt;&lt;span style=&quot;color: #D19A66;&quot;&gt; -n&lt;&#x2F;span&gt;&lt;span style=&quot;color: #98C379;&quot;&gt; argocd argocd-server&lt;&#x2F;span&gt;&lt;span style=&quot;color: #D19A66;&quot;&gt; -o&lt;&#x2F;span&gt;&lt;span style=&quot;color: #98C379;&quot;&gt; jsonpath=&amp;#39;{.spec.template.spec.containers[0].args}&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: #98C379;&quot;&gt;&amp;quot;&#x2F;usr&#x2F;local&#x2F;bin&#x2F;argocd-server&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;No flags. ArgoCD defaults to TLS-enabled mode, so it was doing its own TLS termination on top of Traefik&#x27;s.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;the-fix&quot;&gt;The Fix&lt;&#x2F;h3&gt;
&lt;p&gt;ArgoCD reads its configuration from the &lt;code&gt;argocd-cmd-params-cm&lt;&#x2F;code&gt; ConfigMap via environment variables. The deployment already has &lt;code&gt;ARGOCD_SERVER_INSECURE&lt;&#x2F;code&gt; wired to read from &lt;code&gt;server.insecure&lt;&#x2F;code&gt; in that ConfigMap — it just wasn&#x27;t set.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #ABB2BF; background-color: #282C34;&quot;&gt;&lt;code data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #7F848E;font-style: italic;&quot;&gt;# k8s&#x2F;argocd&#x2F;cmd-params-cm.yaml&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #E06C75;&quot;&gt;apiVersion&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #98C379;&quot;&gt; v1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #E06C75;&quot;&gt;kind&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #98C379;&quot;&gt; ConfigMap&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #E06C75;&quot;&gt;metadata&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #E06C75;&quot;&gt;  name&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #98C379;&quot;&gt; argocd-cmd-params-cm&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #E06C75;&quot;&gt;  namespace&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #98C379;&quot;&gt; argocd&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #E06C75;&quot;&gt;data&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #E06C75;&quot;&gt;  server.insecure&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #98C379;&quot;&gt; &amp;quot;true&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Applied and rolled out:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #ABB2BF; background-color: #282C34;&quot;&gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #61AFEF;&quot;&gt;$&lt;&#x2F;span&gt;&lt;span style=&quot;color: #98C379;&quot;&gt; kubectl apply&lt;&#x2F;span&gt;&lt;span style=&quot;color: #D19A66;&quot;&gt; -f&lt;&#x2F;span&gt;&lt;span style=&quot;color: #98C379;&quot;&gt; k8s&#x2F;argocd&#x2F;cmd-params-cm.yaml&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #61AFEF;&quot;&gt;$&lt;&#x2F;span&gt;&lt;span style=&quot;color: #98C379;&quot;&gt; kubectl rollout restart deploy argocd-server&lt;&#x2F;span&gt;&lt;span style=&quot;color: #D19A66;&quot;&gt; -n&lt;&#x2F;span&gt;&lt;span style=&quot;color: #98C379;&quot;&gt; argocd&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;verification&quot;&gt;Verification&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #ABB2BF; background-color: #282C34;&quot;&gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #61AFEF;&quot;&gt;$&lt;&#x2F;span&gt;&lt;span style=&quot;color: #98C379;&quot;&gt; curl&lt;&#x2F;span&gt;&lt;span style=&quot;color: #D19A66;&quot;&gt; -vk&lt;&#x2F;span&gt;&lt;span style=&quot;color: #98C379;&quot;&gt; https:&#x2F;&#x2F;cd.mywebsite.co&lt;&#x2F;span&gt;&lt;span&gt; 2&amp;gt;&amp;amp;1 |&lt;&#x2F;span&gt;&lt;span style=&quot;color: #61AFEF;&quot;&gt; head&lt;&#x2F;span&gt;&lt;span style=&quot;color: #D19A66;&quot;&gt; -5&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&amp;lt; HTTP&#x2F;2 200&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&amp;lt; content-type: text&#x2F;html;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #E06C75;&quot;&gt; charset&lt;&#x2F;span&gt;&lt;span style=&quot;color: #56B6C2;&quot;&gt;=&lt;&#x2F;span&gt;&lt;span style=&quot;color: #98C379;&quot;&gt;utf-8&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The ArgoCD UI loaded. No more redirect loop.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;why-this-works&quot;&gt;Why this works&lt;&#x2F;h3&gt;
&lt;p&gt;When a reverse proxy (Traefik, Nginx, etc.) terminates TLS, the application behind it should not also terminate TLS. The &lt;code&gt;--insecure&lt;&#x2F;code&gt; flag tells ArgoCD to serve plain HTTP on port 8080, trusting the proxy to handle encryption.&lt;&#x2F;p&gt;
&lt;p&gt;The traffic flow becomes:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #ABB2BF; background-color: #282C34;&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Client (HTTPS :443)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  → Traefik (TLS termination, uses cert-manager cert)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    → ArgoCD server (plain HTTP :8080)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;ArgoCD hot-reloads the &lt;code&gt;argocd-server-tls&lt;&#x2F;code&gt; secret and&lt;&#x2F;p&gt;
</content>
        
    </entry>
    <entry xml:lang="en">
        <title>A note on code style</title>
        <published>2026-03-07T00:00:00+00:00</published>
        <updated>2026-03-07T00:00:00+00:00</updated>
        
        <author>
          <name>
            nully0x
          </name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://notes.nully0x.site/a-note-code-style/"/>
        <id>https://notes.nully0x.site/a-note-code-style/</id>
        
        <content type="html" xml:base="https://notes.nully0x.site/a-note-code-style/">&lt;hr &#x2F;&gt;
&lt;h1 id=&quot;security-vs-ux&quot;&gt;Security vs UX&lt;&#x2F;h1&gt;
&lt;p&gt;Most code style discussions focus on the surface: readability, maintainability, or performance. But there&#x27;s an argument that shapes decisions the conflict between writing code that protects the system and code that serves the user.&lt;&#x2F;p&gt;
&lt;p&gt;A small example from a sign-in implementation illustrates this.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;the-user-focused-approach-semantic-clarity&quot;&gt;The User-Focused Approach (Semantic Clarity)&lt;&#x2F;h3&gt;
&lt;p&gt;When a user submits credentials, the server looks up the user by email. Two things can go wrong: the user doesn&#x27;t exist, or the database throws an error. Clean, semantically correct code would handle them differently:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #ABB2BF; background-color: #282C34;&quot;&gt;&lt;code data-lang=&quot;typescript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #C678DD;&quot;&gt;if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span style=&quot;color: #56B6C2;&quot;&gt;!&lt;&#x2F;span&gt;&lt;span style=&quot;color: #E06C75;&quot;&gt;user&lt;&#x2F;span&gt;&lt;span&gt;) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #7F848E;font-style: italic;&quot;&gt;  &#x2F;&#x2F; Client knows to check their spelling&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #C678DD;&quot;&gt;  return new&lt;&#x2F;span&gt;&lt;span style=&quot;color: #61AFEF;&quot;&gt; ApplicationError&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #98C379;&quot;&gt;&amp;quot;Invalid email or password&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #D19A66;&quot;&gt; 401&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #C678DD;&quot;&gt;if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span style=&quot;color: #E06C75;&quot;&gt;user&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C678DD;&quot;&gt; instanceof&lt;&#x2F;span&gt;&lt;span style=&quot;color: #E5C07B;&quot;&gt; Error&lt;&#x2F;span&gt;&lt;span&gt;) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #7F848E;font-style: italic;&quot;&gt;  &#x2F;&#x2F; Client knows the system is struggling&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #C678DD;&quot;&gt;  return new&lt;&#x2F;span&gt;&lt;span style=&quot;color: #61AFEF;&quot;&gt; ApplicationError&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #98C379;&quot;&gt;&amp;quot;Internal server error&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #D19A66;&quot;&gt; 500&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;This is user-focused code. The client gets an accurate signal. A &lt;code&gt;401&lt;&#x2F;code&gt; means &quot;check your credentials.&quot; A &lt;code&gt;500&lt;&#x2F;code&gt; means &quot;something went wrong on our end, try again.&quot;&lt;&#x2F;p&gt;
&lt;h3 id=&quot;the-security-focused-approach-the-information-leak&quot;&gt;The Security-Focused Approach (The Information Leak)&lt;&#x2F;h3&gt;
&lt;p&gt;Security-focused code looks unintuitive based on UX. It intentionally collapses distinct failures into a single, vague response:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #ABB2BF; background-color: #282C34;&quot;&gt;&lt;code data-lang=&quot;typescript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #C678DD;&quot;&gt;if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span style=&quot;color: #E06C75;&quot;&gt;user&lt;&#x2F;span&gt;&lt;span style=&quot;color: #C678DD;&quot;&gt; instanceof&lt;&#x2F;span&gt;&lt;span style=&quot;color: #E5C07B;&quot;&gt; Error&lt;&#x2F;span&gt;&lt;span&gt;) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #E5C07B;&quot;&gt;  Logger&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color: #61AFEF;&quot;&gt;error&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #98C379;&quot;&gt;`Error fetching user during sign-in`&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #E06C75;&quot;&gt; user&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #7F848E;font-style: italic;&quot;&gt;  &#x2F;&#x2F; Intentionally returning 401 instead of 500&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #C678DD;&quot;&gt;  return new&lt;&#x2F;span&gt;&lt;span style=&quot;color: #61AFEF;&quot;&gt; ApplicationError&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #98C379;&quot;&gt;&amp;quot;Invalid email or password&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #D19A66;&quot;&gt; 401&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #C678DD;&quot;&gt;if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span style=&quot;color: #56B6C2;&quot;&gt;!&lt;&#x2F;span&gt;&lt;span style=&quot;color: #E06C75;&quot;&gt;user&lt;&#x2F;span&gt;&lt;span&gt;) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #C678DD;&quot;&gt;  return new&lt;&#x2F;span&gt;&lt;span style=&quot;color: #61AFEF;&quot;&gt; ApplicationError&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #98C379;&quot;&gt;&amp;quot;Invalid email or password&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #D19A66;&quot;&gt; 401&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;strong&gt;Why?&lt;&#x2F;strong&gt; Returning a &lt;code&gt;500&lt;&#x2F;code&gt; for a DB error leaks information. An attacker can observe: &lt;em&gt;&quot;this email returns 401, that email returns 500.&quot;&lt;&#x2F;em&gt; From that difference, they can infer whether an account exists. This is &lt;strong&gt;User Enumeration&lt;&#x2F;strong&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;the-side-channel-timing-attacks&quot;&gt;The Side Channel (Timing Attacks)&lt;&#x2F;h3&gt;
&lt;p&gt;The tension goes deeper than status codes. Even if the response body is identical, the &lt;strong&gt;time&lt;&#x2F;strong&gt; it takes to process the request can leak the same information.&lt;&#x2F;p&gt;
&lt;p&gt;If a database lookup for a non-existent user returns in 10ms, but a &lt;code&gt;bcrypt&lt;&#x2F;code&gt; password comparison for an existing user takes 300ms, the attacker still wins. Security-focused code might introduce artificial delays to ensure every auth request takes the same amount of time. To a performance-focused dev, this looks like a bug. To a security focused dev, that just normal.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;the-broader-principle&quot;&gt;The Broader Principle&lt;&#x2F;h3&gt;
&lt;p&gt;Security-focused code often violates our intuitions about &quot;good&quot; code:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Generic messages&lt;&#x2F;strong&gt; look like poor error handling.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Uniform response times&lt;&#x2F;strong&gt; look like performance regressions.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Redundant checks&lt;&#x2F;strong&gt; look like over-engineering.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Neither is wrong. The problem is when a codebase doesn&#x27;t document a given piece of code to which it focuses on. A dev seeing the collapsed &lt;code&gt;401&lt;&#x2F;code&gt; without context will flag it as a bug and they&#x27;d be right, by the normal rules.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;which-should-you-use&quot;&gt;Which should you use?&lt;&#x2F;h3&gt;
&lt;p&gt;When security shapes a code decision, make it visible. The comment isn&#x27;t for the compiler; it&#x27;s for the future version of yourself who will look at this and think &quot;this looks wrong.&quot;&lt;&#x2F;p&gt;
&lt;p&gt;Security-focused code and user-focused code can coexist, but they need to be legible to each other. The style isn&#x27;t arbitrary. The master it serves should be declared.&lt;&#x2F;p&gt;
</content>
        
    </entry>
    <entry xml:lang="en">
        <title>A note on git fsck</title>
        <published>2026-03-05T00:00:00+00:00</published>
        <updated>2026-03-05T00:00:00+00:00</updated>
        
        <author>
          <name>
            nully0x
          </name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://notes.nully0x.site/a-note-on-git-fsck/"/>
        <id>https://notes.nully0x.site/a-note-on-git-fsck/</id>
        
        <content type="html" xml:base="https://notes.nully0x.site/a-note-on-git-fsck/">&lt;h2 id=&quot;recovering-dropped-changes-via-git-dangling-commits&quot;&gt;Recovering Dropped Changes via Git Dangling Commits&lt;&#x2F;h2&gt;
&lt;p&gt;I recently hit a scenario where I mistakenly dropped test files after a branch cleanup. The files were staged and committed on an unintended branch, in an attempt to clean-up, I mistakenly dropped the commit. &lt;code&gt;git status&lt;&#x2F;code&gt; showed a clean tree, and the files were physically gone from the disk.&lt;&#x2F;p&gt;
&lt;p&gt;In Git, objects (commits, blobs, trees) aren&#x27;t immediately deleted when a branch is removed. They become &quot;dangling&quot; until the garbage collector runs.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;1-identify-the-loss&quot;&gt;1. Identify the Loss&lt;&#x2F;h3&gt;
&lt;p&gt;The working tree was clean, but &lt;code&gt;tests&#x2F;unit&#x2F;&lt;&#x2F;code&gt; was missing.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #ABB2BF; background-color: #282C34;&quot;&gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #61AFEF;&quot;&gt;$&lt;&#x2F;span&gt;&lt;span style=&quot;color: #98C379;&quot;&gt; git log&lt;&#x2F;span&gt;&lt;span style=&quot;color: #D19A66;&quot;&gt; --oneline -5&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #61AFEF;&quot;&gt;1c8b1bb&lt;&#x2F;span&gt;&lt;span style=&quot;color: #98C379;&quot;&gt; implement auth middleware&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #61AFEF;&quot;&gt;32ac0cd&lt;&#x2F;span&gt;&lt;span style=&quot;color: #98C379;&quot;&gt; Merge pull request&lt;&#x2F;span&gt;&lt;span style=&quot;color: #7F848E;font-style: italic;&quot;&gt; #25 &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #56B6C2;&quot;&gt;...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #61AFEF;&quot;&gt;$&lt;&#x2F;span&gt;&lt;span style=&quot;color: #98C379;&quot;&gt; ls tests&#x2F;unit&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #61AFEF;&quot;&gt;ls:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #98C379;&quot;&gt; cannot access &amp;#39;tests&#x2F;unit&#x2F;&amp;#39;: No such file or directory&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;2-scanning-for-dangling-objects&quot;&gt;2. Scanning for Dangling Objects&lt;&#x2F;h3&gt;
&lt;p&gt;Since the commit was no longer reachable via any branch or the reflog (if the reflog was also cleared), &lt;code&gt;git fsck&lt;&#x2F;code&gt; is the tool to verify the database integrity and find &quot;lost&quot; objects.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #ABB2BF; background-color: #282C34;&quot;&gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #61AFEF;&quot;&gt;$&lt;&#x2F;span&gt;&lt;span style=&quot;color: #98C379;&quot;&gt; git fsck&lt;&#x2F;span&gt;&lt;span style=&quot;color: #D19A66;&quot;&gt; --lost-found&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #61AFEF;&quot;&gt;Checking&lt;&#x2F;span&gt;&lt;span style=&quot;color: #98C379;&quot;&gt; object directories: 100%&lt;&#x2F;span&gt;&lt;span&gt; (256&#x2F;256), done.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #61AFEF;&quot;&gt;dangling&lt;&#x2F;span&gt;&lt;span style=&quot;color: #98C379;&quot;&gt; commit b6c8f8efbb7d1ce8c53e04611ee4d8d40d52e092&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #61AFEF;&quot;&gt;dangling&lt;&#x2F;span&gt;&lt;span style=&quot;color: #98C379;&quot;&gt; commit 25cc8b34b9346d9e084402d96cd2d1278f2338cd&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;3-inspecting-the-fragments&quot;&gt;3. Inspecting the Fragments&lt;&#x2F;h3&gt;
&lt;p&gt;I used &lt;code&gt;git show&lt;&#x2F;code&gt; with &lt;code&gt;--stat&lt;&#x2F;code&gt; to find which dangling commit held the missing test files.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #ABB2BF; background-color: #282C34;&quot;&gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #61AFEF;&quot;&gt;$&lt;&#x2F;span&gt;&lt;span style=&quot;color: #98C379;&quot;&gt; git show b6c8f8efbb7d1ce8c53e04611ee4d8d40d52e092&lt;&#x2F;span&gt;&lt;span style=&quot;color: #D19A66;&quot;&gt; --stat&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #61AFEF;&quot;&gt;commit&lt;&#x2F;span&gt;&lt;span style=&quot;color: #98C379;&quot;&gt; b6c8f8efbb7d1ce8c53e04611ee4d8d40d52e092&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #61AFEF;&quot;&gt;Author:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #98C379;&quot;&gt; nully0x&lt;&#x2F;span&gt;&lt;span&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #98C379;&quot;&gt;myemail@something.co&lt;&#x2F;span&gt;&lt;span&gt;m&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #61AFEF;&quot;&gt;Date:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #98C379;&quot;&gt;   Thu Mar&lt;&#x2F;span&gt;&lt;span style=&quot;color: #D19A66;&quot;&gt; 5&lt;&#x2F;span&gt;&lt;span style=&quot;color: #98C379;&quot;&gt; 19:19:16&lt;&#x2F;span&gt;&lt;span style=&quot;color: #D19A66;&quot;&gt; 2026&lt;&#x2F;span&gt;&lt;span style=&quot;color: #98C379;&quot;&gt; +0100&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #61AFEF;&quot;&gt;    add&lt;&#x2F;span&gt;&lt;span style=&quot;color: #98C379;&quot;&gt; testing&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #61AFEF;&quot;&gt; tests&#x2F;unit&#x2F;middleware&#x2F;authenticate.test.ts&lt;&#x2F;span&gt;&lt;span&gt; |&lt;&#x2F;span&gt;&lt;span style=&quot;color: #61AFEF;&quot;&gt; 229&lt;&#x2F;span&gt;&lt;span style=&quot;color: #98C379;&quot;&gt; +++++++++++++++++++++++++++++&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #61AFEF;&quot;&gt; tests&#x2F;unit&#x2F;services&#x2F;jwt.test.ts&lt;&#x2F;span&gt;&lt;span&gt;            |&lt;&#x2F;span&gt;&lt;span style=&quot;color: #61AFEF;&quot;&gt; 128&lt;&#x2F;span&gt;&lt;span style=&quot;color: #98C379;&quot;&gt; ++++++++++++++++&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #61AFEF;&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span style=&quot;color: #98C379;&quot;&gt; files changed,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #D19A66;&quot;&gt; 356&lt;&#x2F;span&gt;&lt;span style=&quot;color: #98C379;&quot;&gt; insertions&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #61AFEF;&quot;&gt;+&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;4-restoration&quot;&gt;4. Restoration&lt;&#x2F;h3&gt;
&lt;p&gt;Since the object is a valid commit, I simply cherry-picked the hash back into the current branch.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #ABB2BF; background-color: #282C34;&quot;&gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #61AFEF;&quot;&gt;$&lt;&#x2F;span&gt;&lt;span style=&quot;color: #98C379;&quot;&gt; git cherry-pick b6c8f8efbb7d1ce8c53e04611ee4d8d40d52e092&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;[feat-auth-middleware d31c34f] add testing&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #61AFEF;&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span style=&quot;color: #98C379;&quot;&gt; files changed,&lt;&#x2F;span&gt;&lt;span style=&quot;color: #D19A66;&quot;&gt; 356&lt;&#x2F;span&gt;&lt;span style=&quot;color: #98C379;&quot;&gt; insertions&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: #61AFEF;&quot;&gt;+&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #61AFEF;&quot;&gt; create&lt;&#x2F;span&gt;&lt;span style=&quot;color: #98C379;&quot;&gt; mode&lt;&#x2F;span&gt;&lt;span style=&quot;color: #D19A66;&quot;&gt; 100644&lt;&#x2F;span&gt;&lt;span style=&quot;color: #98C379;&quot;&gt; tests&#x2F;unit&#x2F;middleware&#x2F;authenticate.test.ts&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #61AFEF;&quot;&gt; create&lt;&#x2F;span&gt;&lt;span style=&quot;color: #98C379;&quot;&gt; mode&lt;&#x2F;span&gt;&lt;span style=&quot;color: #D19A66;&quot;&gt; 100644&lt;&#x2F;span&gt;&lt;span style=&quot;color: #98C379;&quot;&gt; tests&#x2F;unit&#x2F;services&#x2F;jwt.test.ts&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;why-this-works&quot;&gt;Why this works&lt;&#x2F;h3&gt;
&lt;p&gt;Git&#x27;s storage model is additive. When you &quot;delete&quot; a commit, you are usually just deleting the &lt;strong&gt;reference&lt;&#x2F;strong&gt; (the branch pointer) to that commit. The actual commit object persists in &lt;code&gt;.git&#x2F;objects&lt;&#x2F;code&gt; until:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;code&gt;git gc&lt;&#x2F;code&gt; runs (usually triggered after a certain number of loose objects).&lt;&#x2F;li&gt;
&lt;li&gt;The object exceeds the &lt;code&gt;gc.pruneExpire&lt;&#x2F;code&gt; grace period (defaulting to 2 weeks for unreachable objects).&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;As long as you haven&#x27;t run &lt;code&gt;git gc --prune=now&lt;&#x2F;code&gt;, your &quot;deleted&quot; work is likely still recoverable via &lt;code&gt;fsck&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
</content>
        
    </entry>
    <entry xml:lang="en">
        <title>Resolving DNS Resolution Issues in Minikube for Kubernetes Service </title>
        <published>2024-10-31T00:00:00+00:00</published>
        <updated>2024-10-31T00:00:00+00:00</updated>
        
        <author>
          <name>
            nully0x
          </name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://notes.nully0x.site/resolving-dns-resolution-issues-in-minikube-for-kubernetes-services/"/>
        <id>https://notes.nully0x.site/resolving-dns-resolution-issues-in-minikube-for-kubernetes-services/</id>
        
        <content type="html" xml:base="https://notes.nully0x.site/resolving-dns-resolution-issues-in-minikube-for-kubernetes-services/">&lt;p&gt;When using Kubernetes on Minikube, you might encounter DNS resolution errors that prevent your containers from reaching external resources. This can cause issues for jobs that rely on fetching packages or updates from the internet. A typical error might look like this:&lt;&#x2F;p&gt;
&lt;p&gt;Temporary failure resolving &#x27;deb.debian.org&#x27;
WARNING: fetching https:&#x2F;&#x2F;dl-cdn.alpinelinux.org&#x2F;alpine&#x2F;v3.18&#x2F;main: temporary error (try again later)&lt;&#x2F;p&gt;
&lt;p&gt;This guide provides a step-by-step solution to resolve DNS issues in Minikube, configure CoreDNS, and ensure stable access to external repositories.&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;Prerequisites:&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;ul&gt;
&lt;li&gt;Minikube installed and running locally.&lt;&#x2F;li&gt;
&lt;li&gt;Basic knowledge of Kubernetes, Kubernetes jobs, and how to access Minikube.&lt;&#x2F;li&gt;
&lt;li&gt;kubectl CLI configured to interact with your Minikube instance.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;problem-overview&quot;&gt;Problem Overview&lt;&#x2F;h3&gt;
&lt;p&gt;When running a job or pod in Minikube, if you encounter errors indicating DNS failures (like Temporary failure resolving &#x27;deb.debian.org&#x27;), this is usually due to DNS misconfiguration within the Minikube environment. Minikube uses CoreDNS for internal DNS resolution, and by default, it forwards DNS requests to the local system’s &#x2F;etc&#x2F;resolv.conf. However, this may fail if local DNS configurations are restricted or unreliable.&lt;&#x2F;p&gt;
&lt;p&gt;Here&#x27;s an example of the type of error you might encounter in job logs:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #ABB2BF; background-color: #282C34;&quot;&gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #61AFEF;&quot;&gt;Temporary&lt;&#x2F;span&gt;&lt;span style=&quot;color: #98C379;&quot;&gt; failure resolving &amp;#39;deb.debian.org&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #61AFEF;&quot;&gt;Failed&lt;&#x2F;span&gt;&lt;span style=&quot;color: #98C379;&quot;&gt; to fetch http:&#x2F;&#x2F;deb.debian.org&#x2F;debian&#x2F;dists&#x2F;bookworm&#x2F;InRelease&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #61AFEF;&quot;&gt;Unable&lt;&#x2F;span&gt;&lt;span style=&quot;color: #98C379;&quot;&gt; to locate package kubectl&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The issue prevents packages from being installed, which can disrupt jobs that need specific tools, like kubectl or ssh-keygen.&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;To fix this issue:&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;ul&gt;
&lt;li&gt;Modify the CoreDNS configuration in Minikube to directly use external DNS servers (e.g., Google’s 8.8.8.8 and Cloudflare’s 1.1.1.1).&lt;&#x2F;li&gt;
&lt;li&gt;Restart CoreDNS pods to apply changes.&lt;&#x2F;li&gt;
&lt;li&gt;Verify that DNS resolution is working from within the Minikube cluster.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;step-1-edit-the-coredns-configmap&quot;&gt;Step 1: Edit the CoreDNS ConfigMap&lt;&#x2F;h3&gt;
&lt;p&gt;In Kubernetes, DNS settings are managed by the CoreDNS ConfigMap located in the kube-system namespace. Follow these steps to configure CoreDNS to forward requests to reliable external DNS servers.&lt;&#x2F;p&gt;
&lt;p&gt;Run the following command to open the CoreDNS ConfigMap in an editor:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #ABB2BF; background-color: #282C34;&quot;&gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #61AFEF;&quot;&gt;kubectl&lt;&#x2F;span&gt;&lt;span style=&quot;color: #98C379;&quot;&gt; edit configmap coredns&lt;&#x2F;span&gt;&lt;span style=&quot;color: #D19A66;&quot;&gt; -n&lt;&#x2F;span&gt;&lt;span style=&quot;color: #98C379;&quot;&gt; kube-system&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Update the forward configuration within the Corefile to use external DNS servers 8.8.8.8 and 1.1.1.1 instead of &#x2F;etc&#x2F;resolv.conf. Your modified Corefile should look like this for the forward section:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #ABB2BF; background-color: #282C34;&quot;&gt;&lt;code data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #98C379;&quot;&gt;forward . 8.8.8.8 1.1.1.1 {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #98C379;&quot;&gt;max_concurrent 1000&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Save and close the editor. Kubernetes will automatically apply the ConfigMap changes.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;step-2-restart-coredns-pods&quot;&gt;Step 2: Restart CoreDNS Pods&lt;&#x2F;h3&gt;
&lt;p&gt;To apply the DNS changes, the CoreDNS pods need to be restarted:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #ABB2BF; background-color: #282C34;&quot;&gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #61AFEF;&quot;&gt;kubectl&lt;&#x2F;span&gt;&lt;span style=&quot;color: #98C379;&quot;&gt; delete pod&lt;&#x2F;span&gt;&lt;span style=&quot;color: #D19A66;&quot;&gt; -n&lt;&#x2F;span&gt;&lt;span style=&quot;color: #98C379;&quot;&gt; kube-system&lt;&#x2F;span&gt;&lt;span style=&quot;color: #D19A66;&quot;&gt; -l&lt;&#x2F;span&gt;&lt;span style=&quot;color: #98C379;&quot;&gt; k8s-app=kube-dns&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;This command deletes the existing CoreDNS pods, and Kubernetes will recreate them automatically with the new configuration.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;step-3-verify-dns-resolution&quot;&gt;Step 3: Verify DNS Resolution&lt;&#x2F;h3&gt;
&lt;p&gt;Once the CoreDNS pods restart, it’s essential to verify that DNS resolution works correctly within the Minikube environment.&lt;&#x2F;p&gt;
&lt;p&gt;Run a Test Pod: Launch a temporary pod with DNS utilities installed:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #ABB2BF; background-color: #282C34;&quot;&gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #61AFEF;&quot;&gt;kubectl&lt;&#x2F;span&gt;&lt;span style=&quot;color: #98C379;&quot;&gt; run&lt;&#x2F;span&gt;&lt;span style=&quot;color: #D19A66;&quot;&gt; -i --tty&lt;&#x2F;span&gt;&lt;span style=&quot;color: #98C379;&quot;&gt; dnsutils&lt;&#x2F;span&gt;&lt;span style=&quot;color: #D19A66;&quot;&gt; --image=tutum&#x2F;dnsutils --restart=Never --&lt;&#x2F;span&gt;&lt;span style=&quot;color: #98C379;&quot;&gt; &#x2F;bin&#x2F;sh&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Test DNS Resolution: Inside the pod’s shell, test DNS resolution with the following commands:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #ABB2BF; background-color: #282C34;&quot;&gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #61AFEF;&quot;&gt;nslookup&lt;&#x2F;span&gt;&lt;span style=&quot;color: #98C379;&quot;&gt; deb.debian.org&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #61AFEF;&quot;&gt;ping&lt;&#x2F;span&gt;&lt;span style=&quot;color: #D19A66;&quot;&gt; -c 4&lt;&#x2F;span&gt;&lt;span style=&quot;color: #98C379;&quot;&gt; deb.debian.org&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Expected output for nslookup:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #ABB2BF; background-color: #282C34;&quot;&gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #61AFEF;&quot;&gt;Server:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #D19A66;&quot;&gt;         8.8.8.8&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #61AFEF;&quot;&gt;Address:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #98C379;&quot;&gt;        8.8.8.8#53&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #61AFEF;&quot;&gt;Non-authoritative&lt;&#x2F;span&gt;&lt;span style=&quot;color: #98C379;&quot;&gt; answer:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #61AFEF;&quot;&gt;deb.debian.org&lt;&#x2F;span&gt;&lt;span style=&quot;color: #98C379;&quot;&gt;  canonical name = debian.map.fastlydns.net.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #61AFEF;&quot;&gt;Name:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #98C379;&quot;&gt;   debian.map.fastlydns.net&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #61AFEF;&quot;&gt;Address:&lt;&#x2F;span&gt;&lt;span style=&quot;color: #D19A66;&quot;&gt; 151.101.1.130&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;If you see an IP address returned without errors, the DNS is correctly configured.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;step-4-retry-the-kubernetes-job&quot;&gt;Step 4: Retry the Kubernetes Job&lt;&#x2F;h3&gt;
&lt;p&gt;With DNS resolution working, re-run any Kubernetes job or pod that was previously failing due to DNS issues.&lt;&#x2F;p&gt;
&lt;p&gt;For example, if you were using a job to generate SSH keys and create a Kubernetes secret, redeploy the job:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #ABB2BF; background-color: #282C34;&quot;&gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #61AFEF;&quot;&gt;kubectl&lt;&#x2F;span&gt;&lt;span style=&quot;color: #98C379;&quot;&gt; delete job&#x2F;pod&lt;&#x2F;span&gt;&lt;span&gt;  &amp;lt;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #98C379;&quot;&gt;job-nam&lt;&#x2F;span&gt;&lt;span&gt;e&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #61AFEF;&quot;&gt;kubectl&lt;&#x2F;span&gt;&lt;span style=&quot;color: #98C379;&quot;&gt; apply&lt;&#x2F;span&gt;&lt;span style=&quot;color: #D19A66;&quot;&gt; -f&lt;&#x2F;span&gt;&lt;span&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #98C379;&quot;&gt;your-job-manifest.yam&lt;&#x2F;span&gt;&lt;span&gt;l&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Then, monitor the job’s logs to verify that it installs packages successfully:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #ABB2BF; background-color: #282C34;&quot;&gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #61AFEF;&quot;&gt;kubectl&lt;&#x2F;span&gt;&lt;span style=&quot;color: #98C379;&quot;&gt; logs&lt;&#x2F;span&gt;&lt;span style=&quot;color: #D19A66;&quot;&gt; -f&lt;&#x2F;span&gt;&lt;span style=&quot;color: #98C379;&quot;&gt; job&#x2F;&lt;&#x2F;span&gt;&lt;span&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span style=&quot;color: #98C379;&quot;&gt;job-nam&lt;&#x2F;span&gt;&lt;span&gt;e&amp;gt; (could&lt;&#x2F;span&gt;&lt;span style=&quot;color: #98C379;&quot;&gt; be pod name as well&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;troubleshooting&quot;&gt;Troubleshooting&lt;&#x2F;h3&gt;
&lt;p&gt;Common Errors and Fixes&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Temporary Failure Resolving ‘deb.debian.org’: This error usually means the CoreDNS configuration is not applied correctly. Double-check the forward block in the CoreDNS ConfigMap and ensure that you specified valid DNS IPs.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;No External Connectivity in the Pod: If ping or nslookup fails, the problem may be with Minikube’s network configuration. Restart Minikube and verify that you’re using a network that allows external internet access.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;resetting-dns-to-defaults&quot;&gt;Resetting DNS to Defaults&lt;&#x2F;h3&gt;
&lt;p&gt;If you want to reset the CoreDNS configuration to its default state, simply remove the custom DNS IPs and revert to using &#x2F;etc&#x2F;resolv.conf:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #ABB2BF; background-color: #282C34;&quot;&gt;&lt;code data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #98C379;&quot;&gt;forward . &#x2F;etc&#x2F;resolv.conf {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #98C379;&quot;&gt;max_concurrent 1000&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Delete the CoreDNS pods to apply changes.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;summary&quot;&gt;Summary&lt;&#x2F;h3&gt;
&lt;p&gt;In this guide, we covered how to resolve DNS issues in a Minikube-powered Kubernetes environment by modifying CoreDNS to use reliable external DNS servers. This fix is essential for jobs and pods that require stable internet access to install packages or interact with external APIs.&lt;&#x2F;p&gt;
&lt;p&gt;By following these steps, you should be able to:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Configure CoreDNS for reliable external DNS.&lt;&#x2F;li&gt;
&lt;li&gt;Resolve DNS resolution errors in Kubernetes jobs.&lt;&#x2F;li&gt;
&lt;li&gt;Troubleshoot DNS connectivity in Minikube.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
</content>
        
    </entry>
    <entry xml:lang="en">
        <title>A note on provisioning SSL on cloud instance or VPS</title>
        <published>2024-08-02T00:00:00+00:00</published>
        <updated>2024-08-02T00:00:00+00:00</updated>
        
        <author>
          <name>
            nully0x
          </name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://notes.nully0x.site/a-note-on-provisioning-ssl-on-ec2-instance/"/>
        <id>https://notes.nully0x.site/a-note-on-provisioning-ssl-on-ec2-instance/</id>
        
        <content type="html" xml:base="https://notes.nully0x.site/a-note-on-provisioning-ssl-on-ec2-instance/">&lt;h2 id=&quot;introduction&quot;&gt;Introduction&lt;&#x2F;h2&gt;
&lt;p&gt;Securing websites with SSL&#x2F;TLS certificates is crucial for protecting user data and maintaining trust. This article is a guide on provisioning SSL certificates using Let&#x27;s Encrypt and managing an Nginx web server on EC2 or any Virtual Private Server (VPS).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;provisioning-ssl-certificates-with-let-s-encrypt&quot;&gt;Provisioning SSL Certificates with Let&#x27;s Encrypt&lt;&#x2F;h2&gt;
&lt;p&gt;Let&#x27;s Encrypt offers a free and automated way to obtain SSL&#x2F;TLS certificates. Here&#x27;s how to provision an SSL certificate on your EC2 instance or VPS:&lt;&#x2F;p&gt;
&lt;h3 id=&quot;installing-certbot&quot;&gt;Installing Certbot&lt;&#x2F;h3&gt;
&lt;p&gt;Certbot is the official client for Let&#x27;s Encrypt. To install it on Ubuntu with Nginx:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #ABB2BF; background-color: #282C34;&quot;&gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #61AFEF;&quot;&gt;sudo&lt;&#x2F;span&gt;&lt;span style=&quot;color: #98C379;&quot;&gt; apt-get update&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #61AFEF;&quot;&gt;sudo&lt;&#x2F;span&gt;&lt;span style=&quot;color: #98C379;&quot;&gt; apt-get install certbot python3-certbot-nginx&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;obtaining-the-certificate&quot;&gt;Obtaining the Certificate&lt;&#x2F;h3&gt;
&lt;p&gt;With Certbot installed, you can obtain an SSL certificate:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #ABB2BF; background-color: #282C34;&quot;&gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #61AFEF;&quot;&gt;sudo&lt;&#x2F;span&gt;&lt;span style=&quot;color: #98C379;&quot;&gt; certbot&lt;&#x2F;span&gt;&lt;span style=&quot;color: #D19A66;&quot;&gt; --nginx&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;This command will guide you through the process, asking for your domain name and handling the Nginx configuration automatically.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;choosing-the-authentication-method&quot;&gt;Choosing the Authentication Method&lt;&#x2F;h3&gt;
&lt;p&gt;Let&#x27;s Encrypt typically uses HTTP validation for domain verification. Certbot handles this process automatically by temporarily modifying your web server configuration.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;setting-up-automatic-renewal&quot;&gt;Setting Up Automatic Renewal&lt;&#x2F;h3&gt;
&lt;p&gt;Let&#x27;s Encrypt certificates are valid for 90 days. Set up automatic renewal to maintain uninterrupted SSL protection:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Test the renewal process:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #ABB2BF; background-color: #282C34;&quot;&gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #61AFEF;&quot;&gt;sudo&lt;&#x2F;span&gt;&lt;span style=&quot;color: #98C379;&quot;&gt; certbot renew&lt;&#x2F;span&gt;&lt;span style=&quot;color: #D19A66;&quot;&gt; --dry-run&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Enable automatic renewal (on systems with systemd):&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #ABB2BF; background-color: #282C34;&quot;&gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #61AFEF;&quot;&gt;sudo&lt;&#x2F;span&gt;&lt;span style=&quot;color: #98C379;&quot;&gt; systemctl enable certbot.timer&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #61AFEF;&quot;&gt;sudo&lt;&#x2F;span&gt;&lt;span style=&quot;color: #98C379;&quot;&gt; systemctl start certbot.timer&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;managing-nginx-web-server&quot;&gt;Managing Nginx Web Server&lt;&#x2F;h2&gt;
&lt;p&gt;Efficient management of your Nginx server is crucial for maintaining a secure and performant web presence.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;basic-nginx-management-commands&quot;&gt;Basic Nginx Management Commands&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;Start Nginx: &lt;code&gt;sudo systemctl start nginx&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Stop Nginx: &lt;code&gt;sudo systemctl stop nginx&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Restart Nginx: &lt;code&gt;sudo systemctl restart nginx&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;applying-configuration-changes&quot;&gt;Applying Configuration Changes&lt;&#x2F;h3&gt;
&lt;p&gt;After modifying Nginx configuration files, apply changes without service interruption:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #ABB2BF; background-color: #282C34;&quot;&gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #61AFEF;&quot;&gt;sudo&lt;&#x2F;span&gt;&lt;span style=&quot;color: #98C379;&quot;&gt; systemctl reload nginx&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;monitoring-nginx-status&quot;&gt;Monitoring Nginx Status&lt;&#x2F;h3&gt;
&lt;p&gt;Check the current status of Nginx:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #ABB2BF; background-color: #282C34;&quot;&gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #61AFEF;&quot;&gt;sudo&lt;&#x2F;span&gt;&lt;span style=&quot;color: #98C379;&quot;&gt; systemctl status nginx&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;best-practices-and-considerations&quot;&gt;Best Practices and Considerations&lt;&#x2F;h2&gt;
&lt;ol&gt;
&lt;li&gt;Regularly check Nginx error logs at &lt;code&gt;&#x2F;var&#x2F;log&#x2F;nginx&#x2F;error.log&lt;&#x2F;code&gt; for potential issues.&lt;&#x2F;li&gt;
&lt;li&gt;Keep your system and Nginx up to date to protect against vulnerabilities.&lt;&#x2F;li&gt;
&lt;li&gt;Use &lt;code&gt;sudo systemctl enable nginx&lt;&#x2F;code&gt; to ensure Nginx starts automatically on system boot.&lt;&#x2F;li&gt;
&lt;li&gt;Customize your Nginx configuration to optimize performance and security for your specific needs.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;conclusion&quot;&gt;Conclusion&lt;&#x2F;h2&gt;
&lt;p&gt;Provisioning SSL certificates with Let&#x27;s Encrypt and effectively managing your Nginx web server are essential skills for maintaining a secure and reliable web presence on EC2 or any VPS. By following this guide, you can ensure your website is protected with HTTPS and your web server is running smoothly.&lt;&#x2F;p&gt;
&lt;p&gt;For more detailed information, consult the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;certbot.eff.org&#x2F;&quot;&gt;Certbot documentation&lt;&#x2F;a&gt; and the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;nginx.org&#x2F;en&#x2F;docs&#x2F;&quot;&gt;Nginx documentation&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
        
    </entry>
</feed>
