<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Middleware on Miek Gieben</title>
    <link>https://miek.nl/tags/middleware/</link>
    <description>Recent content in Middleware on Miek Gieben</description>
    <generator>Hugo</generator>
    <language>en-us</language>
    <copyright>© Copyright 2007-2024 Miek Gieben</copyright>
    <lastBuildDate>Thu, 24 Mar 2016 18:31:18 +0000</lastBuildDate>
    <atom:link href="https://miek.nl/tags/middleware/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>SkyDNS in CoreDNS</title>
      <link>https://miek.nl/2016/march/24/skydns-in-coredns/</link>
      <pubDate>Thu, 24 Mar 2016 18:31:18 +0000</pubDate>
      <guid>https://miek.nl/2016/march/24/skydns-in-coredns/</guid>
      <description>&lt;p&gt;The &lt;a href=&#34;https://github.com/miekg/coredns/tree/master/middleware/etcd&#34;&gt;etcd middleware&lt;/a&gt; is shaping&#xA;up nicely. With the following &lt;code&gt;Corefile&lt;/code&gt; you already have a big chunk of the SkyDNS funcionality:&lt;/p&gt;&#xA;&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;.:1053 {&#xA;    errors&#xA;    etcd skydns.local&#xA;    proxy . 8.8.8.8:53&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Which says, run on port 1053, accept queries for &lt;em&gt;all&lt;/em&gt; zones, if the zone matches &lt;code&gt;skydns.local.&lt;/code&gt; go look&#xA;in etcd, if it doesn&amp;rsquo;t forward to GOOG. Multiple zones should work as well, but this is not tested&#xA;as of yet.&lt;/p&gt;&#xA;&lt;p&gt;Let&amp;rsquo;s test this &lt;a href=&#34;https://github.com/skynetservices/skydns/blob/master/README.md&#34;&gt;with the examples from SkyDNS&#39;&#xA;README&lt;/a&gt;. Let&amp;rsquo;s add all the &lt;code&gt;rails&lt;/code&gt;&#xA;production sites. (Why does this use rails btw?)&lt;/p&gt;</description>
    </item>
    <item>
      <title>CoreDNS Chaining Middleware</title>
      <link>https://miek.nl/2016/march/19/coredns-chaining-middleware/</link>
      <pubDate>Sat, 19 Mar 2016 20:59:53 +0000</pubDate>
      <guid>https://miek.nl/2016/march/19/coredns-chaining-middleware/</guid>
      <description>&lt;p&gt;&lt;a href=&#34;https://github.com/miekg/coredns&#34;&gt;CoreDNS&lt;/a&gt; is shaping up nicely and of course&#xA;the middleware (taken from &lt;a href=&#34;https://caddyserver.com/&#34;&gt;Caddy&lt;/a&gt;) is working great.&lt;/p&gt;&#xA;&lt;p&gt;Take for instance the following. We want to rewrite ANY queries to HINFO (because&#xA;&lt;a href=&#34;https://tools.ietf.org/html/draft-dnsop-refuse-any-00&#34;&gt;DDoS&lt;/a&gt;) and &lt;em&gt;then&lt;/em&gt; proxy them&#xA;to Google. We also need some logging. So after downloading and compiling CoreDNS, create&#xA;the following &lt;code&gt;Corefile&lt;/code&gt;:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-txt&#34; data-lang=&#34;txt&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;.:1053 {&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    log stdout&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    rewrite ANY HINFO&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    proxy . 8.8.8.8:53&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;By default CoreDNS will read a file called &lt;code&gt;Corefile&lt;/code&gt;, so we can just start it with:&lt;/p&gt;</description>
    </item>
    <item>
      <title>Caddy DNS update</title>
      <link>https://miek.nl/2016/march/17/caddy-dns-update/</link>
      <pubDate>Thu, 17 Mar 2016 22:13:29 +0000</pubDate>
      <guid>https://miek.nl/2016/march/17/caddy-dns-update/</guid>
      <description>&lt;p&gt;More &lt;a href=&#34;https://miek.nl/2016/march/14/first-light/&#34;&gt;light&lt;/a&gt;!&lt;/p&gt;&#xA;&lt;p&gt;My &amp;ldquo;Port Caddy to be a DNS server&amp;rdquo;-project is alive and kicking. Code will be published soon-ish,&#xA;mostly waiting for actually naming the bloody thing. Code is also littered with TODOs.&lt;/p&gt;&#xA;&lt;p&gt;I&amp;rsquo;ve implemented the following middlewares, the all need tests and actual use, but here we go:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;code&gt;log&lt;/code&gt;, for logging (as in Caddy)&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;error&lt;/code&gt;, for error logging (as in Caddy). These both include the &lt;code&gt;{{placeholder}}&lt;/code&gt; syntax, so you&#xA;can use &lt;code&gt;{{port}}&lt;/code&gt; and even &lt;code&gt;{&amp;gt;}&lt;/code&gt; for logging header bits.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;file&lt;/code&gt;, really, really stupid zone file backed zone implementation, more a proof of concept&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;reflect&lt;/code&gt;, reflect (test) middleware&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;proxy&lt;/code&gt;, proxy requests to an upstream nameserver/resolver&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;I also want to add a &lt;code&gt;rewrite&lt;/code&gt; middleware that will, for instance, rewrite ANY queries to HINFO&#xA;ones.&lt;/p&gt;</description>
    </item>
  </channel>
</rss>
