<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wc="https://wilhelm.codes/ns/feed/1.0"><channel><title>Wilhelm Codes · Networking</title><link>https://wilhelm.codes/tags/networking/</link><description>Coder and platform engineer. Slinger of nibbles, bits and bytes. Over 25 years of professional experience as a software engineer. Love making glowing rectangles go "beep-boop".</description><generator>Hugo</generator><language>en-US</language><managingEditor>0xdeadbeef@devilmayco.de (Wilhelm Murdoch)</managingEditor><webMaster>0xdeadbeef@devilmayco.de (Wilhelm Murdoch)</webMaster><lastBuildDate>Thu, 11 Nov 2021 00:00:00 +0000</lastBuildDate><atom:link href="https://wilhelm.codes/tags/networking/index.xml" rel="self" type="application/rss+xml"/><item><title>Messing Around with TXT Records</title><link>https://wilhelm.codes/blog/messing-around-with-txt-records/</link><pubDate>Thu, 11 Nov 2021 00:00:00 +0000</pubDate><author>0xdeadbeef@devilmayco.de (Wilhelm Murdoch)</author><guid>https://wilhelm.codes/blog/messing-around-with-txt-records/</guid><category>dns</category><category>devops</category><category>networking</category><wc:kind>post</wc:kind><description>If you&amp;rsquo;ve spent any time in an ops-related position, you&amp;rsquo;ve had to add these records when using custom domain names while integrating with some 3rd-party service. Especially, if you&amp;rsquo;ve ever wanted to configure an email service provider, like Google&amp;rsquo;s Gmail, to appear as if you&amp;rsquo;re sending emails from a personal domain name.</description><content:encoded><![CDATA[<p>If you&rsquo;ve spent any time in an ops-related position, you&rsquo;ve had to add these records when using custom domain names while integrating with some 3rd-party service. Especially, if you&rsquo;ve ever wanted to configure an email service provider, like Google&rsquo;s Gmail, to appear as if you&rsquo;re sending emails from a personal domain name.</p>
<h2 id="wanna-see-a-neat-trick">
  <a class="heading-link" href="#wanna-see-a-neat-trick">Wanna see a neat trick?<span class="heading-anchor" aria-hidden="true">#</span>
  </a>
</h2>
<p>Open up your terminal of choice and invoke this <code>dig</code> command:</p>
<div class="code-block">
  <div class="code-head">
    <span class="code-file"></span>
    <span class="code-lang">Bash</span>
  </div>
  <div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">dig txt contact.wilhelm.codes +short</span></span></code></pre></div>
</div>
<p>You should see, hopefully 🤞, the following block of text as a response:</p>
<div class="code-block">
  <div class="highlight"><pre tabindex="0" class="chroma"><code class="language-text" data-lang="text"><span class="line"><span class="cl">&#34;twitter: @wilhelm&#34;
</span></span><span class="line"><span class="cl">&#34;github:  wilhelm-murdoch&#34;
</span></span><span class="line"><span class="cl">&#34;keybase: 7F89 5036 2816 06F6&#34;
</span></span><span class="line"><span class="cl">&#34;blog:    https://wilhelm.codes/&#34;</span></span></code></pre></div>
</div>
<h2 id="what-youre-looking-at">
  <a class="heading-link" href="#what-youre-looking-at">What you&rsquo;re looking at.<span class="heading-anchor" aria-hidden="true">#</span>
  </a>
</h2>
<p>Simply put, you&rsquo;re looking at my contact details using a simple DNS <code>TXT</code> record lookup. There are <a href="https://dns.google/query?name=contact.wilhelm.codes">heaps</a> <a href="https://toolbox.googleapps.com/apps/dig/#TXT/">of</a> <a href="https://www.diggui.com/">online tools</a> out there to help you directly query DNS records, but <code>dig</code> tends to be the most common utility included included in most Linux distributions as well as MacOS.</p>
<h2 id="why-might-you-do-this">
  <a class="heading-link" href="#why-might-you-do-this">Why might you do this?<span class="heading-anchor" aria-hidden="true">#</span>
  </a>
</h2>
<p>Originally, <code>TXT</code> records were meant to allow DNS administrators to attach simple plain text human-readable &ldquo;notes&rdquo; to their zones. A bit later, it became common practice to use this flexible record type as a way to verify ownership of a domain.</p>
<p>If you&rsquo;ve spent any time in an ops-related position, you&rsquo;ve had to add these records when using custom domain names while integrating with some 3rd-party service. Especially, if you&rsquo;ve ever wanted to configure an email service provider, like Google&rsquo;s Gmail, to appear as if you&rsquo;re sending emails from a personal domain name.</p>
<p>So, why not also create personal, human-readable way of declaring ownership over a domain as well? Like a globally-accessible low-tech &ldquo;business card&rdquo;.</p>
<p>DNS is effectively a globally-distributed, (mostly) fault-tolerant, eventually-consistent key / value store. These details can be easily looked up and verified by anyone with an Internet connection.</p>
<p>And as for &ldquo;Why?&rdquo;, why not?</p>
<h2 id="heres-you-would-implement-it">
  <a class="heading-link" href="#heres-you-would-implement-it">Here&rsquo;s you would implement it.<span class="heading-anchor" aria-hidden="true">#</span>
  </a>
</h2>
<p>Honestly, there&rsquo;s nothing special about how to implement this. It&rsquo;s just another record. In my case, I ended up creating a separate <code>TXT</code> record <em>per</em> contact detail. Depending on which server software your DNS provider is using, you may or may not be able to create multi-line text blocks. So, your safest bet is just multiple one-liners attached to the same <code>CNAME</code>.</p>
<p>I recently migrated my zone for <code>wilhelm.codes</code> from <a href="https://www.vultr.com/">Vultr</a> to <a href="https://www.cloudflare.com/">CloudFlare</a> and this is pretty much what it all looks like:</p>
<p><img
  src="https://wilhelm.codes/blog/messing-around-with-txt-records/image-1_hu_3936a63f6d16eb12.webp"
  srcset="/blog/messing-around-with-txt-records/image-1_hu_3936a63f6d16eb12.webp 736w"
  sizes="(max-width: 48rem) 100vw, 736px"
  width="736"
  height="284"
  alt=""
  
  loading="lazy"
  decoding="async"
/>
</p>
<p>Obviously, this interface will be different if you use a different service, but that&rsquo;s all there is to it!</p>
<h2 id="thats-it">
  <a class="heading-link" href="#thats-it">That&rsquo;s it!<span class="heading-anchor" aria-hidden="true">#</span>
  </a>
</h2>
<p>Yep. This isn&rsquo;t groundbreaking stuff and I&rsquo;m surely not the first person to do something like this. Just a bit of (mostly) harmless DNS fun!</p>]]></content:encoded></item></channel></rss>