<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Tech Junk Trunk</title>
    <description>Technical Junk Trunk Blog - Code, Automation, Learn</description>
    <link>https://techjunktrunk.com//</link>
    <atom:link href="https://techjunktrunk.com//feed.xml" rel="self" type="application/rss+xml" />
    <pubDate>Fri, 10 Nov 2017 18:47:36 +0000</pubDate>
    <lastBuildDate>Fri, 10 Nov 2017 18:47:36 +0000</lastBuildDate>
    <generator>Jekyll v3.6.2</generator>
    
      <item>
        <title>Add a private key to your ssh agent from a variable.</title>
        <description>&lt;p&gt;I always have a hard time remembering how to add an ssh key (&lt;code class=&quot;highlighter-rouge&quot;&gt;ssh-add&lt;/code&gt;) from an environment variable containing the private key.  “In a variable!?”  You may exclaim, don’t worry it’s typically a ‘secret’ variable on a continous integration system that supports masking sensitive variable key/values.  I wouldn’t recommend doing this unless you’re certain the value of your variable is not going to accidently leak in plain text .&lt;/p&gt;

&lt;p&gt;To redirect the contents of the environment variable into &lt;code class=&quot;highlighter-rouge&quot;&gt;ssh-add&lt;/code&gt; instead of a real file simply use:&lt;/p&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;eval $(ssh-agent -s) 
ssh-add &amp;lt;(echo &quot;$PRIVATE_KEY&quot;) 

# List out your new key's fingerprint
ssh-add -l

# Don't forget to cleanup your agent after you're done using it if you're not on an ephemeral build server.
ssh-agent -k
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;The more general lesson here is &lt;code class=&quot;highlighter-rouge&quot;&gt;&amp;lt;(echo &quot;$VAR&quot;)&lt;/code&gt; is good for redirecting variables instead of a file incases where a good old pipe &lt;code class=&quot;highlighter-rouge&quot;&gt;|&lt;/code&gt; just won’t work.&lt;/p&gt;
</description>
        <pubDate>Fri, 10 Nov 2017 12:47:00 +0000</pubDate>
        <link>https://techjunktrunk.com//bash/2017/11/10/ssh-add-from-environment-variable/</link>
        <guid isPermaLink="true">https://techjunktrunk.com//bash/2017/11/10/ssh-add-from-environment-variable/</guid>
        
        <category>bash</category>
        
        <category>ssh</category>
        
        
        <category>bash</category>
        
      </item>
    
      <item>
        <title>Traefik default server catch all rule</title>
        <description>&lt;p&gt;Yesterday I found myself testing out &lt;a href=&quot;https://traefik.io/&quot;&gt;traefik&lt;/a&gt; for the first time after this &lt;a href=&quot;https://discourse.pi-hole.net/t/pi-hole-docker-docker-compose-x86-and-traefik-as-reverse-proxy/5321&quot;&gt;forum request piqued my interest&lt;/a&gt;, mainly as a replacement for my &lt;a href=&quot;https://github.com/jwilder/nginx-proxy&quot;&gt;jwilder/nginx-proxy&lt;/a&gt; reverse proxy.  In order to block ads with my pi-hole image traefik’s reverse proxy needed a critical feature, a defaut site / server…which I found surprisingly not well documented!  So here we are documenting it on my new blog.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://stackoverflow.com/questions/43171835/how-do-i-set-a-default-host-container-in-traefik-with-the-docker-backend&quot;&gt;This stack overflow post&lt;/a&gt; looked promising at first, but really the poster was reqesting a simple www+non www rule.  I needed default host functionality similar to nginx or apache webservers’ concept of default servers: a low priority catch all server that unmatched domain requests will be directed to.&lt;/p&gt;

&lt;p&gt;After I gave up googling I turned to the docs.  This is what I ended up trying that worked for me to have a true ‘default host’ that got rid of the default 404 everything behavior traefik ships with:&lt;/p&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;    # from my docker-compose.yaml service block
    labels:
      - &quot;traefik.frontend.rule=HostRegexp:{catchall:.*}&quot;
      - &quot;traefik.frontend.priority=1&quot;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;If you don’t speak regex &lt;code class=&quot;highlighter-rouge&quot;&gt;.*&lt;/code&gt; translates to any character for any length.  The HostRegexp just follows traefik’s (and go’s) &lt;a href=&quot;https://docs.traefik.io/basics/#matchers&quot;&gt;rules for regex&lt;/a&gt; which requires this style &lt;code class=&quot;highlighter-rouge&quot;&gt;{name:&amp;lt;regex&amp;gt;}&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://docs.traefik.io/basics/#priorities&quot;&gt;The priority setting is critical&lt;/a&gt;!  Without it all my other docker containers’ traefik proxies stopped working and the catchall took top priority.  Priority 1 was the lowest integer that worked for me while other containers had no priority set.  Setting priority to 0 just causes the the catchall regex to become top priority again.&lt;/p&gt;

&lt;p&gt;After getting traefik, pi-hole, and another web container plexpy working together I decied to convert all my other containers over and will try runnig traefik as my new simple single host docker home servers’ reverse proxy for now.  Hopefully it works out, if it goes well I may start recommending it to others in my docker READMEs.&lt;/p&gt;

</description>
        <pubDate>Fri, 03 Nov 2017 21:00:00 +0000</pubDate>
        <link>https://techjunktrunk.com//docker/2017/11/03/traefik-default-server-catch-all/</link>
        <guid isPermaLink="true">https://techjunktrunk.com//docker/2017/11/03/traefik-default-server-catch-all/</guid>
        
        <category>docker</category>
        
        <category>proxy</category>
        
        <category>traefik</category>
        
        
        <category>docker</category>
        
      </item>
    
  </channel>
</rss>
