<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Ben Jefferies</title>
    <description>The latest articles on DEV Community by Ben Jefferies (@benjefferies).</description>
    <link>https://dev.to/benjefferies</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F92679%2F718667c4-ba1e-42c1-9623-61e43b2a6971.jpeg</url>
      <title>DEV Community: Ben Jefferies</title>
      <link>https://dev.to/benjefferies</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/benjefferies"/>
    <language>en</language>
    <item>
      <title>Branch Protection Bot Github Action</title>
      <dc:creator>Ben Jefferies</dc:creator>
      <pubDate>Wed, 24 Nov 2021 21:46:08 +0000</pubDate>
      <link>https://dev.to/benjefferies/branch-protection-bot-5ei2</link>
      <guid>https://dev.to/benjefferies/branch-protection-bot-5ei2</guid>
      <description>&lt;h3&gt;
  
  
  My Workflow
&lt;/h3&gt;

&lt;p&gt;Automation everywhere is the pinnacle of DevOps and version control can be part of that too however if you enable branch protection rules it can make it impossible to automatically check in files as a part of a github action workflow and that's where the Branch Protection Bot has helped me temporarily disable branch protection so that I can automatically manage version control whilst minimising risk.&lt;/p&gt;

&lt;h3&gt;
  
  
  Submission Category:
&lt;/h3&gt;

&lt;p&gt;DevOps, CICD&lt;/p&gt;

&lt;h3&gt;
  
  
  Yaml File or Link to Code
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://github.com/benjefferies/branch-protection-bot/blob/master/.github/workflows/python.yml"&gt;Branch Protection Bot&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Additional Resources / Info
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://github.com/search?q=branch-protection-bot&amp;amp;type=code"&gt;https://github.com/search?q=branch-protection-bot&amp;amp;type=code&lt;/a&gt;&lt;/p&gt;

</description>
      <category>actionshackathon21</category>
      <category>github</category>
      <category>opensource</category>
    </item>
    <item>
      <title>How to DOS yourself using LetsEncrypt and cert-manager</title>
      <dc:creator>Ben Jefferies</dc:creator>
      <pubDate>Wed, 30 Oct 2019 08:26:51 +0000</pubDate>
      <link>https://dev.to/benjefferies/how-to-dos-yourself-using-letsencrypt-and-cert-manager-4pkn</link>
      <guid>https://dev.to/benjefferies/how-to-dos-yourself-using-letsencrypt-and-cert-manager-4pkn</guid>
      <description>&lt;h2&gt;
  
  
  The Early Days
&lt;/h2&gt;

&lt;p&gt;DevOps is a challenging beast when you decide to move from a few EC2 instances and an RDS instance in AWS to a Kubernetes cluster even if it’s a managed service so it’s safe to say we’ve learned a few lessons in the process not leaving out this one. Towards the end of 2018, the Open Banking SaaS we’ve been developing for a while started to kick off and we managed to make a few sales to a couple of big banks, we knew the hacked together bash scripts and manually provisioned EC2 instances weren’t going to cut it so we thought we’d embrace Kubernetes. I would say I am reasonably proficient with docker and used PaaS such as CloudFoundry so in my naivety thought how hard could this Kubernetes stuff be. Very soon into the process, we realised how much we still had to learn and that it would be a steep learning curve.&lt;/p&gt;

&lt;h2&gt;
  
  
  Things are going well until…
&lt;/h2&gt;

&lt;p&gt;Fast forward some time and we’ve been managing multiple clusters, automatically provisioning them with our CI/CD pipelines and things are going well. We do continuous deployment into our “master” cluster which is essentially the latest and greatest SaaS offering. We tear down and rebuild this environment nightly at 2 am to ensure we can reliably provision a cluster and no manual tweaks are causing the cluster to be stable. We notice that our functional tests fail every morning and it seems to resolve itself by the time we all start work so we start looking at the logs from the deployment, realising they’re giving nothing away. We add more logging and debugging. We start by using the common DNS tools, dig and nslookup.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ nslookup service.bank.master.forgerock.financial
Server:        127.0.0.53
Address:    127.0.0.53#53
Non-authoritative answer:
*** Can't find service.bank.master.forgerock.financial: No answer
$ dig service.bank.master.forgerock.financial
; &amp;lt;&amp;lt;&amp;gt;&amp;gt; DiG 9.11.3-1ubuntu1.9-Ubuntu &amp;lt;&amp;lt;&amp;gt;&amp;gt; service.bank.master.forgerock.financial
;; global options: +cmd
;; Got answer:
;; -&amp;gt;&amp;gt;HEADER&amp;lt;&amp;lt;- opcode: QUERY, status: NOERROR, id: 44619
;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 1
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 65494
;; QUESTION SECTION:
;service.bank.master.forgerock.financial. IN A
;; Query time: 49 msec
;; SERVER: 127.0.0.53#53(127.0.0.53)
;; WHEN: Tue Oct 22 15:27:16 BST 2019
;; MSG SIZE  rcvd: 68
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;They show that the DNS doesn’t seem to be resolving for some of our domains A records. An A record is essentially the mapping between the domain name and the server it should resolve to. We’ve created a wildcard A record for our subdomain so it should be a catch-all right…?&lt;/p&gt;

&lt;h2&gt;
  
  
  LetsEncrypt and cert-manager
&lt;/h2&gt;

&lt;p&gt;This is where we bring in cert-manager. If you’re not familiar with cert-manager it’s a service which pairs nicely with the TLS certificate issuing service LetsEncrypt which is great when you want simple automated TLS certificates that automatically renew. For LetsEncrypt to issue a TLS certificate for your domain it must first trust that you own the domain. There are two ways cert-manager can do this:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Host an HTTP endpoint with a string LetsEncrypt knows about&lt;/li&gt;
&lt;li&gt;Add a DNS TXT record with a string LetsEncrypt knows about&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;We do the latter, so we provide cert-manager a restricted service account so it can dynamically add a DNS TXT record and prove to LetsEncrypt we own the domain. The TXT record is a record which can have an arbitrary string in it.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Problem
&lt;/h2&gt;

&lt;p&gt;Back to our problem. So we’re trying to diagnose why some of our domains resolve and others don’t when we came across an &lt;a href="https://github.com/jetstack/cert-manager/issues/806#issuecomment-453787144"&gt;issue&lt;/a&gt; on the cert-manager GitHub repo suggesting something we quickly dismissed at first which described a situation where TXT records on subdomains that have a wildcard would not return the A record. This surely cannot be true or we would have heard of it before. We discuss the issue further when my colleague presses the idea further and we also come across a &lt;a href="http://i-heart-geek.blogspot.com/2011/11/easy-dns-mistake-with-txt-and-wildcard.html"&gt;2011&lt;/a&gt; blog on the same topic. So, we go to work trying to manually reproduce the issue by adding a TXT record on a subdomain and poll it using dnschecker.org and slowly one DNS server at a time the DNS A record disappears. We remove the TXT record and the DNS A record comes back to life. We try adding an A record on the subdomain and the issue with the TXT record doesn’t manifest. The solution to this problem was explicitly having an A record per subdomain.&lt;/p&gt;

</description>
      <category>kubernetes</category>
      <category>certmanager</category>
      <category>letsencrypt</category>
      <category>dns</category>
    </item>
  </channel>
</rss>
