<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <link>http://code.secondbit.org/infra/codestorage/hg-ssh/</link>
    <language>en-us</language>

    <title>infra/codestorage/hg-ssh Changelog</title>
    <description>infra/codestorage/hg-ssh Changelog</description>
    <item>
    <title>[default] Pull hostkeys when pulling SSH keys.</title>
    <guid isPermaLink="true">http://code.secondbit.org/infra/codestorage/hg-ssh/rev/4c6afe37e83a</guid>
             <link>http://code.secondbit.org/infra/codestorage/hg-ssh/rev/4c6afe37e83a</link>
    <description>
              <![CDATA[
	<table>
	<tr>
		<th style="text-align:left;">changeset</th>
		<td>4c6afe37e83a</td>
              </tr>
              <tr>
                              <th style="text-align:left;">branch</th>
                              <td>default</td>
              </tr>
              <tr>
                              <th style="text-align:left;">bookmark</th>
		<td></td>
	</tr>
	<tr>
		<th style="text-align:left;">tag</th>
		<td>tip</td>
	</tr>
	<tr>
		<th style="text-align:left;vertical-align:top;">user</th>
		<td>&#80;&#97;&#100;&#100;&#121;&#32;&#60;&#112;&#97;&#100;&#100;&#121;&#64;&#115;&#101;&#99;&#111;&#110;&#100;&#98;&#105;&#116;&#46;&#111;&#114;&#103;&#62;</td>
	</tr>
	<tr>
		<th style="text-align:left;vertical-align:top;">description</th>
		<td>Pull hostkeys when pulling SSH keys.<br/>
<br/>
Rather than relying on Kubernetes secrets and baking public keys right in, which<br/>
was bound to get fraught, we now have some graceful degradation. It defaults to<br/>
automatically-generated random keys, but will try to download some keys from<br/>
Google Cloud Storage for the host. If it can find some, it'll try to use those,<br/>
instead.</td>
	</tr>
	<tr>
		<th style="text-align:left;vertical-align:top;">files</th>
		<td>Dockerfile<br />hostkeys/ssh_host_dsa_key.pub<br />hostkeys/ssh_host_ecdsa_key.pub<br />hostkeys/ssh_host_ed25519_key.pub<br />hostkeys/ssh_host_key.pub<br />hostkeys/ssh_host_rsa_key.pub<br />pullkeys.sh<br />run.sh<br /></td>
	</tr>
	</table>
	]]></description>
    <author>&#80;&#97;&#100;&#100;&#121;&#32;&#60;&#112;&#97;&#100;&#100;&#121;&#64;&#115;&#101;&#99;&#111;&#110;&#100;&#98;&#105;&#116;&#46;&#111;&#114;&#103;&#62;</author>
    <pubDate>Thu, 15 Oct 2015 01:32:28 -0700</pubDate>
</item>
<item>
    <title>This time with bonus host key pinning.</title>
    <guid isPermaLink="true">http://code.secondbit.org/infra/codestorage/hg-ssh/rev/bf7b66df555f</guid>
             <link>http://code.secondbit.org/infra/codestorage/hg-ssh/rev/bf7b66df555f</link>
    <description>
              <![CDATA[
	<table>
	<tr>
		<th style="text-align:left;">changeset</th>
		<td>bf7b66df555f</td>
              </tr>
              <tr>
                              <th style="text-align:left;">branch</th>
                              <td></td>
              </tr>
              <tr>
                              <th style="text-align:left;">bookmark</th>
		<td></td>
	</tr>
	<tr>
		<th style="text-align:left;">tag</th>
		<td></td>
	</tr>
	<tr>
		<th style="text-align:left;vertical-align:top;">user</th>
		<td>&#80;&#97;&#100;&#100;&#121;&#32;&#60;&#112;&#97;&#100;&#100;&#121;&#64;&#115;&#101;&#99;&#111;&#110;&#100;&#98;&#105;&#116;&#46;&#111;&#114;&#103;&#62;</td>
	</tr>
	<tr>
		<th style="text-align:left;vertical-align:top;">description</th>
		<td>This time with bonus host key pinning.<br/>
<br/>
You know what's _super obnoxious_? Getting a MITM warning just because a Docker<br/>
container restarted.<br/>
<br/>
So, basically, every time you set up an SSH server, it generated its own<br/>
public/private keypair. And the first time you connect, you'd get that public<br/>
key from it, and store it locally. Then if you tried connecting later, and a<br/>
different public key was used, OpenSSH would vomit an error in your face and<br/>
stop the connection, because it thought you were running into a<br/>
man-in-the-middle attack. Which is generally a Good Thing.<br/>
<br/>
But when we apply this to Docker, it becomes problematic. I'm not subject to a<br/>
MITM attack, my container just restarted, you silly machine.<br/>
<br/>
The correct way around this problem was to reuse the public/private key pair as<br/>
part of the image. So I put the public keys in the image itself, and used<br/>
Kubernetes secrets to mount the private keys at /data/ssh/, and then a script to<br/>
copy them all over into the /etc/ssh directory, where they'd override the<br/>
generated ones. This means that every instance of this container has the same<br/>
public/private key combo, meaning no more warning. That solves the problem in a<br/>
reasonably secure (I think) way when the image is only used by us, but if anyone<br/>
else wants to use the image, suddenly they need to edit it. They need to change<br/>
the public keys, because they don't have our private keys.</td>
	</tr>
	<tr>
		<th style="text-align:left;vertical-align:top;">files</th>
		<td>Dockerfile<br />hostkeys/ssh_host_dsa_key.pub<br />hostkeys/ssh_host_ecdsa_key.pub<br />hostkeys/ssh_host_ed25519_key.pub<br />hostkeys/ssh_host_key.pub<br />hostkeys/ssh_host_rsa_key.pub<br />run.sh<br /></td>
	</tr>
	</table>
	]]></description>
    <author>&#80;&#97;&#100;&#100;&#121;&#32;&#60;&#112;&#97;&#100;&#100;&#121;&#64;&#115;&#101;&#99;&#111;&#110;&#100;&#98;&#105;&#116;&#46;&#111;&#114;&#103;&#62;</author>
    <pubDate>Thu, 15 Oct 2015 00:14:32 -0700</pubDate>
</item>
<item>
    <title>Set trust settings to avoid annoying message.</title>
    <guid isPermaLink="true">http://code.secondbit.org/infra/codestorage/hg-ssh/rev/1b1ca7817a10</guid>
             <link>http://code.secondbit.org/infra/codestorage/hg-ssh/rev/1b1ca7817a10</link>
    <description>
              <![CDATA[
	<table>
	<tr>
		<th style="text-align:left;">changeset</th>
		<td>1b1ca7817a10</td>
              </tr>
              <tr>
                              <th style="text-align:left;">branch</th>
                              <td></td>
              </tr>
              <tr>
                              <th style="text-align:left;">bookmark</th>
		<td></td>
	</tr>
	<tr>
		<th style="text-align:left;">tag</th>
		<td></td>
	</tr>
	<tr>
		<th style="text-align:left;vertical-align:top;">user</th>
		<td>&#80;&#97;&#100;&#100;&#121;&#32;&#60;&#112;&#97;&#100;&#100;&#121;&#64;&#115;&#101;&#99;&#111;&#110;&#100;&#98;&#105;&#116;&#46;&#111;&#114;&#103;&#62;</td>
	</tr>
	<tr>
		<th style="text-align:left;vertical-align:top;">description</th>
		<td>Set trust settings to avoid annoying message.<br/>
<br/>
Update the hgrc to trust the .hgrc files of everyone in the committers group,<br/>
because I got tired of seeing the &quot;not trusting file<br/>
/mounted/repos/blah-blah/.hg/hgrc from untrusted user root, group committers&quot;<br/>
message every time I pushed.</td>
	</tr>
	<tr>
		<th style="text-align:left;vertical-align:top;">files</th>
		<td>hgrc<br /></td>
	</tr>
	</table>
	]]></description>
    <author>&#80;&#97;&#100;&#100;&#121;&#32;&#60;&#112;&#97;&#100;&#100;&#121;&#64;&#115;&#101;&#99;&#111;&#110;&#100;&#98;&#105;&#116;&#46;&#111;&#114;&#103;&#62;</author>
    <pubDate>Wed, 14 Oct 2015 23:17:12 -0700</pubDate>
</item>
<item>
    <title>Use the relative DNS address.</title>
    <guid isPermaLink="true">http://code.secondbit.org/infra/codestorage/hg-ssh/rev/bc0c83d5015d</guid>
             <link>http://code.secondbit.org/infra/codestorage/hg-ssh/rev/bc0c83d5015d</link>
    <description>
              <![CDATA[
	<table>
	<tr>
		<th style="text-align:left;">changeset</th>
		<td>bc0c83d5015d</td>
              </tr>
              <tr>
                              <th style="text-align:left;">branch</th>
                              <td></td>
              </tr>
              <tr>
                              <th style="text-align:left;">bookmark</th>
		<td></td>
	</tr>
	<tr>
		<th style="text-align:left;">tag</th>
		<td></td>
	</tr>
	<tr>
		<th style="text-align:left;vertical-align:top;">user</th>
		<td>&#80;&#97;&#100;&#100;&#121;&#32;&#60;&#112;&#97;&#100;&#100;&#121;&#64;&#115;&#101;&#99;&#111;&#110;&#100;&#98;&#105;&#116;&#46;&#111;&#114;&#103;&#62;</td>
	</tr>
	<tr>
		<th style="text-align:left;vertical-align:top;">description</th>
		<td>Use the relative DNS address.<br/>
<br/>
Use the relative DNS address when digging for web frontends, which now works<br/>
thanks to +search on dig. This allows us to transfer between namespaces without<br/>
needing to change anything. Also makes this, in general, more flexible.</td>
	</tr>
	<tr>
		<th style="text-align:left;vertical-align:top;">files</th>
		<td>post-commit-broadcast.sh<br /></td>
	</tr>
	</table>
	]]></description>
    <author>&#80;&#97;&#100;&#100;&#121;&#32;&#60;&#112;&#97;&#100;&#100;&#121;&#64;&#115;&#101;&#99;&#111;&#110;&#100;&#98;&#105;&#116;&#46;&#111;&#114;&#103;&#62;</author>
    <pubDate>Wed, 14 Oct 2015 23:01:04 -0700</pubDate>
</item>
<item>
    <title>Update to broadcast pushes to all our web frontends.</title>
    <guid isPermaLink="true">http://code.secondbit.org/infra/codestorage/hg-ssh/rev/121585c71fd7</guid>
             <link>http://code.secondbit.org/infra/codestorage/hg-ssh/rev/121585c71fd7</link>
    <description>
              <![CDATA[
	<table>
	<tr>
		<th style="text-align:left;">changeset</th>
		<td>121585c71fd7</td>
              </tr>
              <tr>
                              <th style="text-align:left;">branch</th>
                              <td></td>
              </tr>
              <tr>
                              <th style="text-align:left;">bookmark</th>
		<td></td>
	</tr>
	<tr>
		<th style="text-align:left;">tag</th>
		<td></td>
	</tr>
	<tr>
		<th style="text-align:left;vertical-align:top;">user</th>
		<td>&#80;&#97;&#100;&#100;&#121;&#32;&#60;&#112;&#97;&#100;&#100;&#121;&#64;&#115;&#101;&#99;&#111;&#110;&#100;&#98;&#105;&#116;&#46;&#111;&#114;&#103;&#62;</td>
	</tr>
	<tr>
		<th style="text-align:left;vertical-align:top;">description</th>
		<td>Update to broadcast pushes to all our web frontends.<br/>
<br/>
We'll need dig, so install that when we apt-get.<br/>
<br/>
Fix a typo in the hashbang line for create_user.sh<br/>
<br/>
Add an hgrc file that goes in /etc/mercurial/hgrc to add the<br/>
changegroup.fe_publish hook to all our repos. Basically, any time we get a<br/>
change on disk, that automatically gets propagated out to all the frontend using<br/>
our post-commit-broadcast.sh script.<br/>
<br/>
Write the aforementioned post-commit-broadcast.sh script. This basically finds<br/>
the repo we're in (by stripping known prefixes), then uses dig to compile a list<br/>
of web frontends. Finally, for each web frontend, we do an hg push over http.<br/>
<br/>
Not so hard, but it means all our web frontends are kept recent.<br/>
<br/>
This has a few shortcomings. I don't think it will work when starting a new<br/>
repo; I think we need to wait for hg-repo-sync to back that up, then the web<br/>
frontend to pull from backups. Another possibility is that we push, then stand<br/>
up a new front end before the push makes it into the backups. The frontend then<br/>
won't have that push until it pulls again from backups. These are rare,<br/>
minutes-long windows where we're out of sync, so I'm really ok with these<br/>
failure modes.</td>
	</tr>
	<tr>
		<th style="text-align:left;vertical-align:top;">files</th>
		<td>Dockerfile<br />create_user.sh<br />hgrc<br />post-commit-broadcast.sh<br /></td>
	</tr>
	</table>
	]]></description>
    <author>&#80;&#97;&#100;&#100;&#121;&#32;&#60;&#112;&#97;&#100;&#100;&#121;&#64;&#115;&#101;&#99;&#111;&#110;&#100;&#98;&#105;&#116;&#46;&#111;&#114;&#103;&#62;</author>
    <pubDate>Wed, 14 Oct 2015 20:55:18 -0700</pubDate>
</item>
<item>
    <title>Update to be more modular.</title>
    <guid isPermaLink="true">http://code.secondbit.org/infra/codestorage/hg-ssh/rev/2f4a2a20ad6d</guid>
             <link>http://code.secondbit.org/infra/codestorage/hg-ssh/rev/2f4a2a20ad6d</link>
    <description>
              <![CDATA[
	<table>
	<tr>
		<th style="text-align:left;">changeset</th>
		<td>2f4a2a20ad6d</td>
              </tr>
              <tr>
                              <th style="text-align:left;">branch</th>
                              <td></td>
              </tr>
              <tr>
                              <th style="text-align:left;">bookmark</th>
		<td></td>
	</tr>
	<tr>
		<th style="text-align:left;">tag</th>
		<td></td>
	</tr>
	<tr>
		<th style="text-align:left;vertical-align:top;">user</th>
		<td>&#80;&#97;&#100;&#100;&#121;&#32;&#60;&#112;&#97;&#100;&#100;&#121;&#64;&#115;&#101;&#99;&#111;&#110;&#100;&#98;&#105;&#116;&#46;&#111;&#114;&#103;&#62;</td>
	</tr>
	<tr>
		<th style="text-align:left;vertical-align:top;">description</th>
		<td>Update to be more modular.<br/>
<br/>
We updated our Mercurial serving architecture to be a bit more modular. The main<br/>
difference is that we now are based off the secondbit/hg-repo-sync image, and<br/>
don't need to do as much setup to get the basics (Mercurial, folders, etc.)<br/>
<br/>
We now have a pullkeys.ssh script, which pulls down the SSH keys stored in a<br/>
specified GCS bucket, and creates users for them. This allows us to update who<br/>
has push access, without modifying the docker image.<br/>
<br/>
We also have a custom run.sh script now, instead of starting sshd directly,<br/>
because we need to do a few things when starting this up:<br/>
<br/>
1. Modify the permissions on the mounted directories while we're root so SSH<br/>
users can write and read the committed files. We have to do this at start time<br/>
instead of at image build time because Kubernetes' volumes don't respect the<br/>
permissions set at build time.<br/>
2. Pull all the repos backed up to GCS to local disk, which means that startup<br/>
automatically picks up at the last known state. This script is built into the<br/>
image by secondbit/hg-repo-sync.<br/>
3. Pull all the SSH keys from GCS, using the new script. This creates the new<br/>
users and lets us SSH into the server, while keeping the user definitions<br/>
separate from the image itself.<br/>
4. Finally, start the SSH daemon.</td>
	</tr>
	<tr>
		<th style="text-align:left;vertical-align:top;">files</th>
		<td>Dockerfile<br />pullkeys.sh<br />run.sh<br /></td>
	</tr>
	</table>
	]]></description>
    <author>&#80;&#97;&#100;&#100;&#121;&#32;&#60;&#112;&#97;&#100;&#100;&#121;&#64;&#115;&#101;&#99;&#111;&#110;&#100;&#98;&#105;&#116;&#46;&#111;&#114;&#103;&#62;</author>
    <pubDate>Sun, 11 Oct 2015 17:06:15 -0700</pubDate>
</item>
<item>
    <title>Initial commit.</title>
    <guid isPermaLink="true">http://code.secondbit.org/infra/codestorage/hg-ssh/rev/eeaf3e97ed44</guid>
             <link>http://code.secondbit.org/infra/codestorage/hg-ssh/rev/eeaf3e97ed44</link>
    <description>
              <![CDATA[
	<table>
	<tr>
		<th style="text-align:left;">changeset</th>
		<td>eeaf3e97ed44</td>
              </tr>
              <tr>
                              <th style="text-align:left;">branch</th>
                              <td></td>
              </tr>
              <tr>
                              <th style="text-align:left;">bookmark</th>
		<td></td>
	</tr>
	<tr>
		<th style="text-align:left;">tag</th>
		<td></td>
	</tr>
	<tr>
		<th style="text-align:left;vertical-align:top;">user</th>
		<td>&#80;&#97;&#100;&#100;&#121;&#32;&#60;&#112;&#97;&#100;&#100;&#121;&#64;&#115;&#101;&#99;&#111;&#110;&#100;&#98;&#105;&#116;&#46;&#111;&#114;&#103;&#62;</td>
	</tr>
	<tr>
		<th style="text-align:left;vertical-align:top;">description</th>
		<td>Initial commit.<br/>
<br/>
This hardcodes more than it should and syncs with Google Cloud Storage more than<br/>
is really necessary, but it A) works and B) is currently on code.secondbit.org,<br/>
so that should probably be recorded for posterity.</td>
	</tr>
	<tr>
		<th style="text-align:left;vertical-align:top;">files</th>
		<td>.hgignore<br />Dockerfile<br />create_user.sh<br /></td>
	</tr>
	</table>
	]]></description>
    <author>&#80;&#97;&#100;&#100;&#121;&#32;&#60;&#112;&#97;&#100;&#100;&#121;&#64;&#115;&#101;&#99;&#111;&#110;&#100;&#98;&#105;&#116;&#46;&#111;&#114;&#103;&#62;</author>
    <pubDate>Mon, 17 Aug 2015 19:07:28 -0400</pubDate>
</item>

  </channel>
</rss>