kv.sslip.io: (key-value) read/write/delete TXTs

We enable special behavior under the `kv.sslip.io` subdomain: it can be
treated as a key-value store, the sub-subdomain being the key, and the
TXT record being the value.

For example, to write ("put") the value "12.0.1" to the key
"macos-version" on the `ns-gce.sslip.io.` nameserver, you'd use the
following `dig` command:

```shell
dig @ns-gce.sslip.io. txt put.12.0.1.macos-version.kv.sslip.io.
```

To read ("get") the value back, you'd write the following `dig` command:

```shell
dig @ns-gce.sslip.io. txt get.macos-version.kv.sslip.io.
```

Since "get" is the default behavior, you don't need to include it in the
domain name:

```shell
dig @ns-gce.sslip.io. txt macos-version.kv.sslip.io.
```

Finally, when you're done with the key-value, you can "delete" it:

```shell
dig @ns-gce.sslip.io. txt delete.macos-version.kv.sslip.io.
```

Notes:

- Keys are case-insensitive (to accommodate DNS convention). In other
  words, `KEY.kv.sslip.io` and `key.kv.sslip.io` return the same TXT
  record.
- Values are case-sensitive. `put.CamelCase.style.kv.sslip.io` sets the
  TXT record to "CamelCase".
- `put` requests will return the TXT record being put; i.e.
  `put.hello.world.kv.sslip.io` returns one TXT record of one string,
  `hello`.
- `delete` requests will return the TXT record being deleted; i.e.
  `delete.world.kv.sslip.io` returns one TXT record of one string,
  `hello`. If the TXT record does not exist, no TXT records will be
  returned.
- Values are limited to 63 bytes to mitigate using the sslip.io servers
  in a [DNS amplification
  attack](https://us-cert.cisa.gov/ncas/alerts/TA13-088A).
- Values are not persistent: if the server is restarted, all values
  disappear. Poof.
- Values are not consistent. If a value is set in `ns-aws.sslip.io`, it
  does not propagate to `ns-gce.sslip.io` nor `ns-azure.sslip.io`.
This commit is contained in:
Brian Cunnie
2021-11-30 05:39:57 -08:00
parent 4ba3516834
commit 78722b6887
4 changed files with 163 additions and 1 deletions

View File

@@ -227,6 +227,52 @@ dig @ns.sslip.io txt ip.sslip.io +short -6 # forces IPv6 lookup; sample reply "2
"https://icanhazip.com/">https://icanhazip.com/</a> requires 8692 bytes spread out over 34 packets—over 14 times
as much! Admittedly bandwidth usage is a bigger concern for the one hosting the service than the one using the
service.</p>
<h4 id="key-value-store"><code>kv.sslip.io</code>: (key-value) read/write/delete TXTs</h4>
<p>We enable special behavior under the <code>kv.sslip.io</code> subdomain: it can be treated as a key-value
store, the sub-subdomain being the key, and the TXT record being the value.</p>
<p>For example, to write ("put") the value "12.0.1" to the key "macos-version" on the
<code>ns-gce.sslip.io.</code> nameserver, you'd use the following <code>dig</code> command:</p>
<pre><code class="lang-shell">dig @ns-gce<span class="hljs-selector-class">.sslip</span><span class=
"hljs-selector-class">.io</span>. txt put.<span class="hljs-number">12.0</span>.<span class=
"hljs-number">1</span><span class="hljs-selector-class">.macos-version</span><span class=
"hljs-selector-class">.kv</span><span class="hljs-selector-class">.sslip</span><span class=
"hljs-selector-class">.io</span>.
</code></pre>
<p>To read ("get") the value back, you'd write the following <code>dig</code> command:</p>
<pre><code class="lang-shell">dig @ns-gce<span class="hljs-selector-class">.sslip</span><span class=
"hljs-selector-class">.io</span>. txt get<span class="hljs-selector-class">.macos-version</span><span class=
"hljs-selector-class">.kv</span><span class="hljs-selector-class">.sslip</span><span class=
"hljs-selector-class">.io</span>.
</code></pre>
<p>Since "get" is the default behavior, you don't need to include it in the domain name:</p>
<pre><code class="lang-shell">dig @ns-gce<span class="hljs-selector-class">.sslip</span><span class=
"hljs-selector-class">.io</span>. txt macos-version<span class="hljs-selector-class">.kv</span><span class=
"hljs-selector-class">.sslip</span><span class="hljs-selector-class">.io</span>.
</code></pre>
<p>Finally, when you're done with the key-value, you can "delete" it:</p>
<pre><code class="lang-shell">dig @ns-gce<span class="hljs-selector-class">.sslip</span><span class=
"hljs-selector-class">.io</span>. txt delete<span class="hljs-selector-class">.macos-version</span><span class=
"hljs-selector-class">.kv</span><span class="hljs-selector-class">.sslip</span><span class=
"hljs-selector-class">.io</span>.
</code></pre>
<p>Notes:</p>
<ul>
<li>Keys are case-insensitive (to accommodate DNS convention). In other words, <code>KEY.kv.sslip.io</code> and
<code>key.kv.sslip.io</code> return the same TXT record.</li>
<li>Values are case-sensitive. <code>put.CamelCase.style.kv.sslip.io</code> sets the TXT record to
"CamelCase".</li>
<li><code>put</code> requests will return the TXT record being put; i.e.
<code>put.hello.world.kv.sslip.io</code> returns one TXT record of one string, <code>hello</code>.</li>
<li><code>delete</code> requests will return the TXT record being deleted; i.e.
<code>delete.world.kv.sslip.io</code> returns one TXT record of one string, <code>hello</code>. If the TXT
record does not exist, no TXT records will be returned.</li>
<li>Values are limited to 63 bytes to mitigate using the sslip.io servers in a <a href=
"https://us-cert.cisa.gov/ncas/alerts/TA13-088A">DNS amplification attack</a>.
</li>
<li>Values are not persistent: if the server is restarted, all values disappear. Poof.</li>
<li>Values are not consistent. If a value is set in <code>ns-aws.sslip.io</code>, it does not propagate to
<code>ns-gce.sslip.io</code> nor <code>ns-azure.sslip.io</code>.</li>
</ul>
<h4 id="version">Determining The Server Version of Software</h4>You can determine the server version of the
sslip.io software by querying the TXT record of <code>version.sslip.io</code>:
<pre>