<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
    <title>
        encthenet ramblings    </title>
        <link type="application/atom+xml" href="https://blogtest.funkthat.com/atom.xml" rel="self" />
    
        <link rel="alternate" type="text/html" href=""/>
    
        
    <updated>2024-09-17T11:52:21Z</updated>

    <id>https://blogtest.funkthat.com/atom.xml</id>

            <entry>
            <title type="html">Simple Mobile Push Notifications</title>
            <author><name>John-Mark Gurney</name></author>
            <link href="/posts/mobile-push-notifications.html"/>
            <updated>2024-09-17T00:00:00Z</updated>
            <published>2024-09-17T00:00:00Z</published>
            <id>https://blogtest.funkthat.com/posts/mobile-push-notifications.html</id>
                        <category   scheme="https://blogtest.funkthat.comsearch/label"
                        term="security"
                        label="Security" />
                        <category   scheme="https://blogtest.funkthat.comsearch/label"
                        term="signal"
                        label="Signal" />
                        <category   scheme="https://blogtest.funkthat.comsearch/label"
                        term="web"
                        label="Web" />
            
            <content type="html">
                                &lt;article class=&#34;post&#34;&gt;

&lt;h1 id=&#34;mobile-push-notifications-title&#34;&gt;&lt;a class=&#34;no-tufte-underline&#34; href=&#34;/posts/mobile-push-notifications.html#mobile-push-notifications-title&#34;&gt;Simple Mobile Push&amp;nbsp;Notifications&lt;/a&gt;&lt;/h1&gt;

&lt;p class=&#34;posted&#34;&gt;Posted: September 17, 2024 at 12:00 &lt;span class=&#34;caps&#34;&gt;PM&lt;/span&gt;&lt;/p&gt;

&lt;ul class=&#34;tags clear&#34;&gt;
&lt;li&gt;
    &lt;a class=&#34;small&#34; href=&#34;/search/label/security.html&#34;&gt;&amp;nbsp;security
    &lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
    &lt;a class=&#34;small&#34; href=&#34;/search/label/signal.html&#34;&gt;&amp;nbsp;signal
    &lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
    &lt;a class=&#34;small&#34; href=&#34;/search/label/web.html&#34;&gt;&amp;nbsp;web
    &lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class=&#34;clear&#34;&gt;&lt;/div&gt;
&lt;section&gt;
&lt;p&gt;&lt;span class=&#34;caps&#34;&gt;&lt;span class=&#34;caps&#34;&gt;TL&lt;/span&gt;&lt;/span&gt;;&lt;span class=&#34;caps&#34;&gt;&lt;span class=&#34;caps&#34;&gt;DR&lt;/span&gt;&lt;/span&gt;: Check out &lt;a href=&#34;https://funkthat.com/gitea/jmg/wpn/&#34;&gt;&lt;span class=&#34;caps&#34;&gt;&lt;span class=&#34;caps&#34;&gt;WPN&lt;/span&gt;&lt;/span&gt;&lt;/a&gt; for code that
implements push notifications to your browser (mobile or&amp;nbsp;desktop).&lt;/p&gt;
&lt;h2 id=&#34;background&#34;&gt;Background&lt;a class=&#34;headerlink&#34; href=&#34;/posts/mobile-push-notifications.html#background&#34; title=&#34;Permanent link&#34;&gt;¶&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;I run my own server/services, so it’s helpful to be able to receive notifications,
such as when a hard drive starts throwing errors, or when I get an &lt;span class=&#34;caps&#34;&gt;&lt;span class=&#34;caps&#34;&gt;SMS&lt;/span&gt;&lt;/span&gt; to
my home phone, or when &lt;a href=&#34;https://funkthat.com/gitea/jmg/snapaid/&#34;&gt;snapaid&lt;/a&gt;
fails to process a FreeBSD announcement.  I had used a Java Signal client
for a while, but that required both a phone number, but also a complex
Java runtime to keep running, and eventually Signal upgraded the server
protocol such that the client I had stopped working, and getting a new client
working was too much&amp;nbsp;work.&lt;/p&gt;
&lt;p&gt;I was originally thinking about writing a custom Android App that just
did this, but thinking about things a bit more, I realized that Web
browsers have both a &lt;a href=&#34;https://developer.mozilla.org/en-US/docs/Web/API/Push_API&#34;&gt;Push &lt;span class=&#34;caps&#34;&gt;&lt;span class=&#34;caps&#34;&gt;API&lt;/span&gt;&lt;/span&gt;&lt;/a&gt; and a
&lt;a href=&#34;https://developer.mozilla.org/en-US/docs/Web/API/Notifications_API&#34;&gt;Notifications &lt;span class=&#34;caps&#34;&gt;&lt;span class=&#34;caps&#34;&gt;API&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;
that I could use.  Using an official notification &lt;span class=&#34;caps&#34;&gt;&lt;span class=&#34;caps&#34;&gt;API&lt;/span&gt;&lt;/span&gt; would keep the
battery usage in check unlike using a custom protocol (or I’d have to use
Google’s &lt;span class=&#34;caps&#34;&gt;&lt;span class=&#34;caps&#34;&gt;GCM&lt;/span&gt;&lt;/span&gt; directly, and yes, I do realize that web browsers are likely using
it under the&amp;nbsp;hood).&lt;/p&gt;
&lt;p&gt;The blog post &lt;a href=&#34;https://web.dev/articles/push-notifications-overview&#34;&gt;Push notifications overview&lt;/a&gt;
has a good overview on how they&amp;nbsp;work.&lt;/p&gt;
&lt;h2 id=&#34;overview&#34;&gt;Overview&lt;a class=&#34;headerlink&#34; href=&#34;/posts/mobile-push-notifications.html#overview&#34; title=&#34;Permanent link&#34;&gt;¶&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;With a little bit of research, I found some
&lt;a href=&#34;https://gist.github.com/code-boxx/bc6aed37345ad1783cfb7d230f438120&#34;&gt;example code&lt;/a&gt;
that would register the push api, post the necessary info, and then display
the notification&amp;nbsp;received.&lt;/p&gt;
&lt;p&gt;There are better guides on this, but the short is that it requests
notifications, and once the user grants permission, registers a service
worker, and once that service worker is registered, subscribe to the &lt;a href=&#34;https://developer.mozilla.org/en-US/docs/Web/API/Push_API&#34;&gt;Push
&lt;span class=&#34;caps&#34;&gt;&lt;span class=&#34;caps&#34;&gt;API&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;, and &lt;code&gt;POST&lt;/code&gt;s the necessary info to the server.  With the information
&lt;code&gt;POST&lt;/code&gt;&lt;span class=&#34;quo&#34;&gt;‘&lt;/span&gt;d, there’s a simple client that can be used to push&amp;nbsp;notifications.&lt;/p&gt;
&lt;p&gt;With a little bit of work, I got it working and modified to be even more
simple by not requiring a Python webserver, but instead use a &lt;span class=&#34;caps&#34;&gt;&lt;span class=&#34;caps&#34;&gt;CGI&lt;/span&gt;&lt;/span&gt; so that
it integrates with your existing web&amp;nbsp;server.&lt;/p&gt;
&lt;p&gt;The installation and setup instructions are located in the &lt;a href=&#34;https://funkthat.com/gitea/jmg/wpn/&#34;&gt;&lt;span class=&#34;caps&#34;&gt;&lt;span class=&#34;caps&#34;&gt;WPN&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&amp;nbsp;repository.&lt;/p&gt;&lt;/section&gt;
&lt;/article&gt;            </content>
        </entry>
            <entry>
            <title type="html">Isolated IP Management</title>
            <author><name>John-Mark Gurney</name></author>
            <link href="/posts/isolated-ip-management.html"/>
            <updated>2023-08-17T00:00:00Z</updated>
            <published>2023-08-17T00:00:00Z</published>
            <id>https://blogtest.funkthat.com/posts/isolated-ip-management.html</id>
                        <category   scheme="https://blogtest.funkthat.comsearch/label"
                        term="FreeBSD"
                        label="Freebsd" />
                        <category   scheme="https://blogtest.funkthat.comsearch/label"
                        term="jails"
                        label="Jails" />
            
            <content type="html">
                                &lt;article class=&#34;post&#34;&gt;

&lt;h1 id=&#34;isolated-ip-management-title&#34;&gt;&lt;a class=&#34;no-tufte-underline&#34; href=&#34;/posts/isolated-ip-management.html#isolated-ip-management-title&#34;&gt;Isolated &lt;span class=&#34;caps&#34;&gt;IP&lt;/span&gt;&amp;nbsp;Management&lt;/a&gt;&lt;/h1&gt;

&lt;p class=&#34;posted&#34;&gt;Updated: August 25, 2023 at 4:15 &lt;span class=&#34;caps&#34;&gt;PM&lt;/span&gt;&lt;/p&gt;&lt;p class=&#34;posted&#34;&gt;Originally Posted: August 17, 2023 at 12:00 &lt;span class=&#34;caps&#34;&gt;PM&lt;/span&gt;&lt;/p&gt;

&lt;ul class=&#34;tags clear&#34;&gt;
&lt;li&gt;
    &lt;a class=&#34;small&#34; href=&#34;/search/label/FreeBSD.html&#34;&gt;&amp;nbsp;FreeBSD
    &lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
    &lt;a class=&#34;small&#34; href=&#34;/search/label/jails.html&#34;&gt;&amp;nbsp;jails
    &lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class=&#34;clear&#34;&gt;&lt;/div&gt;
&lt;section&gt;
&lt;p&gt;Edited on 2023-08-25 to add how to start the jail on each&amp;nbsp;boot.&lt;/p&gt;
&lt;p&gt;The latest iteration of my home firewall has a spare interface.  Many
switches these days have a dedicated management interface, and I wanted
something similar for my firewall.  I want an interface that I can plug in,
get an &lt;span class=&#34;caps&#34;&gt;&lt;span class=&#34;caps&#34;&gt;IP&lt;/span&gt;&lt;/span&gt; via &lt;span class=&#34;caps&#34;&gt;&lt;span class=&#34;caps&#34;&gt;DHCP&lt;/span&gt;&lt;/span&gt;, and I can ssh into and it’ll “just work” even if
there’s a misconfiguration, or an &lt;span class=&#34;caps&#34;&gt;&lt;span class=&#34;caps&#34;&gt;IP&lt;/span&gt;&lt;/span&gt;&amp;nbsp;conflict.&lt;/p&gt;
&lt;p&gt;On FreeBSD,
&lt;a href=&#34;https://wiki.freebsd.org/Jails#VNET-based_networking_for_Jails&#34;&gt;vnet jails&lt;/a&gt;
are a way to isolate an interface such that it won’t interfere (or receive
interference) from other interfaces.  Some may have just used epair and
assigned IPs, but this could cause conflict, while using a unix domain
socket keeps things isolated, and FreeBSD ships w/ everything needed to
make this work.  A package like &lt;code&gt;socat&lt;/code&gt; isn’t&amp;nbsp;needed.&lt;/p&gt;
&lt;p&gt;Configuring the host was straight forward, make a directory for the&amp;nbsp;socket:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;mkdir /var/mgmt
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;And then add a line to &lt;code&gt;/etc/inetd.conf&lt;/code&gt; to listen to incoming connections
on the socket and launch &lt;code&gt;sshd&lt;/code&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;/var/mgmt/mgmt.ssh.sock stream  unix    nowait  root    /usr/sbin/sshd  sshd -i
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The &lt;code&gt;-i&lt;/code&gt; option to &lt;code&gt;sshd&lt;/code&gt; tells it to run in “&lt;code&gt;inetd&lt;/code&gt;” mode, which means that
the stdin and stdout of the process is the socket to use for&amp;nbsp;communication.&lt;/p&gt;
&lt;p&gt;The next harder part was getting a jail configured that would accept
incoming connections and forward them to the unix domain&amp;nbsp;socket.&lt;/p&gt;
&lt;p&gt;First the jail configuration, which goes in &lt;code&gt;/etc/jail.conf&lt;/code&gt; or similar&amp;nbsp;location:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;mgmt {
        host.hostname = mgmt;                           # Hostname

        vnet =&#34;new&#34;;
        vnet.interface=&#34;mgmt0&#34;;

        path = &#34;/usr/jails/mgmt/root&#34;;                   # Path to the jail
        mount.fstab=&#34;/usr/jails/mgmt/fstab&#34;;             # mount spec

        mount.devfs;                                    # Mount devfs inside the jail
        devfs_ruleset = &#34;101&#34;;

        exec.start = &#34;/bin/sh /etc/rc&#34;;                 # Start command
        exec.stop = &#34;/bin/sh /etc/rc.shutdown&#34;;         # Stop command
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;There isn’t anything special in this.  It’s pretty standard jail
configuration, the differences are the vnet configuration, and the
&lt;code&gt;devfs_ruleset&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;The &lt;code&gt;devfs_ruleset&lt;/code&gt; is necessary in order to expose the bpf interface
used by dhclient.  This required the following lines in &lt;code&gt;/etc/devfs.rules&lt;/code&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;[mydevfsrules_jail=100]
add include $devfsrules_hide_all
add include $devfsrules_unhide_basic
add include $devfsrules_unhide_login

[devfsrules_jail_dhcp=101]
add include $mydevfsrules_jail
add path &#39;bpf*&#39; unhide
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Note that after adding the above lines, you need to&amp;nbsp;run:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;service devfs start
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;to load the rules (per
&lt;a href=&#34;https://man.freebsd.org/cgi/man.cgi?query=devfs&amp;amp;apropos=0&amp;amp;sektion=8&amp;amp;manpath=FreeBSD+13.2-RELEASE+and+Ports&amp;amp;arch=default&amp;amp;format=html&#34;&gt;devfs(8)&lt;/a&gt;
man&amp;nbsp;page).&lt;/p&gt;
&lt;p&gt;Note: I learned my mistake not to number my blocks immediately after
the standard defaults (from &lt;code&gt;/etc/defaults/devfs.rules&lt;/code&gt;).  I had done that
befure but there’s now a conflict, so I skip ahead a bit to get a unique&amp;nbsp;range.&lt;/p&gt;
&lt;p&gt;Now I needed to make a number of directories for the&amp;nbsp;jail:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;mkdir -p /usr/jails/mgmt/root
mkdir -p /usr/jails/mgmt/etc
mkdir -p /usr/jails/mgmt/var/mgmt
mkdir -p /usr/jails/mgmt/tmp
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;I needed to setup the &lt;code&gt;fstab&lt;/code&gt; for the&amp;nbsp;jail:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;# Device                Mountpoint      FStype  Options         Dump    Pass#
/                       /usr/jail/mgmt/root     nullfs  ro      0       0
/usr/jail/mgmt/etc      /usr/jail/mgmt/root/etc nullfs  rw      0       0
/usr/jail/mgmt/var      /usr/jail/mgmt/root/var nullfs  rw      0       0
/var/mgmt               /usr/jail/mgmt/root/var/mgmt    nullfs  ro      0       0
/usr/jail/mgmt/tmp      /usr/jail/mgmt/root/tmp nullfs  rw      0       0
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This is a little bit more tricky, It first &lt;code&gt;nullfs&lt;/code&gt; mounts the root system.
I’m using &lt;span class=&#34;caps&#34;&gt;&lt;span class=&#34;caps&#34;&gt;ZFS&lt;/span&gt;&lt;/span&gt; boot environments, so this is a pretty clean FreeBSD install
without much host specific data.  It then mounts some jail specific directories
for &lt;code&gt;etc&lt;/code&gt;, &lt;code&gt;tmp&lt;/code&gt; and &lt;code&gt;var&lt;/code&gt; and finally mounts the shared directory w/ the
unix domain socket to the host system.  Also note that a couple of the mounts
are read-only to prevent the jail from modifying the&amp;nbsp;system.&lt;/p&gt;
&lt;p&gt;The &lt;code&gt;etc&lt;/code&gt; directory was populated from the system &lt;code&gt;etc&lt;/code&gt; via:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;tar -cf - -C /etc . | tar -xf - -C /usr/jails/mgmt/etc
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Then the jail was configured, first &lt;code&gt;/usr/jails/mgmt/etc/rc.conf&lt;/code&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;hostname=&#34;mgmt.funkthat.com&#34;

sendmail_enable=&#34;NONE&#34;
sendmail_submit_enable=&#34;NO&#34;
sendmail_outbound_enable=&#34;NO&#34;
sendmail_msp_queue_enable=&#34;NO&#34;

# Management port
ifconfig_mgmt0=&#34;DHCP&#34;

# necessary as devd can&#39;t be run in a jail
synchronous_dhclient=&#34;YES&#34;

inetd_enable=&#34;YES&#34;              # Run the network daemon dispatcher (YES/NO).
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The key part of this configuration that took me a while to figure out was
the &lt;code&gt;synchronous_dhclient&lt;/code&gt; line.  It used to be that &lt;code&gt;netif&lt;/code&gt; would start
dhclient, but in order to better handle &lt;span class=&#34;caps&#34;&gt;&lt;span class=&#34;caps&#34;&gt;USB&lt;/span&gt;&lt;/span&gt; ethernet devices and other
removable interfaces, it was moved to &lt;code&gt;devd&lt;/code&gt;.  The only problem is that
&lt;code&gt;devd&lt;/code&gt; hasn’t been jail’ified, and you can’t run it to get things like
link notifications that would normally launch dhclient.  Setting this to
yes, makes sure it gets launched when the jail&amp;nbsp;starts.&lt;/p&gt;
&lt;p&gt;And then the following line was added to &lt;code&gt;/usr/jails/mgmt/etc/inetd.conf&lt;/code&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;ssh     stream  tcp     nowait  root    /usr/bin/nc     nc -N -U /var/mgmt/mgmt.ssh.sock
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This is the part that will forward incoming connections to the ssh port
on to the unix domain&amp;nbsp;socket.&lt;/p&gt;
&lt;p&gt;Now that everything is configured, a simple &lt;code&gt;jail -c mgmt&lt;/code&gt; will get
the jail running and accepting&amp;nbsp;connections.&lt;/p&gt;
&lt;p&gt;To get the jail to start every boot, add the following to the host’s
&lt;code&gt;/etc/rc.conf&lt;/code&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;jail_enable=&#34;YES&#34;       # Set to NO to disable starting of any jails
jail_list=&#34;mgmt&#34;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This was testing and deployed on a FreeBSD 14-&lt;span class=&#34;caps&#34;&gt;&lt;span class=&#34;caps&#34;&gt;CURRENT&lt;/span&gt;&lt;/span&gt; build as of August
8th, 2023, or more specifically, from &lt;code&gt;main-n264621-09c20a29328&lt;/code&gt;, but it
should work on all currently supported FreeBSD&amp;nbsp;releases.&lt;/p&gt;&lt;/section&gt;
&lt;/article&gt;            </content>
        </entry>
            <entry>
            <title type="html">Making FreeBSD magnet links</title>
            <author><name>John-Mark Gurney</name></author>
            <link href="/2022/12/making-freebsd-magnet-links.html"/>
            <updated>2018-07-03T00:00:00Z</updated>
            <published>2018-07-03T00:00:00Z</published>
            <id>https://blogtest.funkthat.com/2022/12/making-freebsd-magnet-links.html</id>
                        <category   scheme="https://blogtest.funkthat.comsearch/label"
                        term="FreeBSD"
                        label="Freebsd" />
                        <category   scheme="https://blogtest.funkthat.comsearch/label"
                        term="magnet"
                        label="Magnet" />
            
            <content type="html">
                                &lt;article class=&#34;post&#34;&gt;

&lt;h1 id=&#34;making-freebsd-magnet-links-title&#34;&gt;&lt;a class=&#34;no-tufte-underline&#34; href=&#34;/2022/12/making-freebsd-magnet-links.html#making-freebsd-magnet-links-title&#34;&gt;Making FreeBSD magnet&amp;nbsp;links&lt;/a&gt;&lt;/h1&gt;

&lt;p class=&#34;posted&#34;&gt;Updated: December  7, 2022 at 12:20 &lt;span class=&#34;caps&#34;&gt;PM&lt;/span&gt;&lt;/p&gt;&lt;p class=&#34;posted&#34;&gt;Originally Posted: July  3, 2018 at 4:49 &lt;span class=&#34;caps&#34;&gt;PM&lt;/span&gt;&lt;/p&gt;

&lt;ul class=&#34;tags clear&#34;&gt;
&lt;li&gt;
    &lt;a class=&#34;small&#34; href=&#34;/search/label/FreeBSD.html&#34;&gt;&amp;nbsp;FreeBSD
    &lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
    &lt;a class=&#34;small&#34; href=&#34;/search/label/magnet.html&#34;&gt;&amp;nbsp;magnet
    &lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class=&#34;clear&#34;&gt;&lt;/div&gt;
&lt;section&gt;
&lt;p&gt;Note: This was originally posted
&lt;a href=&#34;/2018/07/making-freebsd-magnet-links.html#making-freebsd-magnet-links-title&#34;&gt;here&lt;/a&gt;,
but things have been improved since then and so it has been&amp;nbsp;updated.&lt;/p&gt;
&lt;p&gt;For the last few years, I’ve been producing torrents and publishing
magnet links, but there is some special work that I do to make these.
The first few releases, I inserted a bogus tracker into the torrent,
because despite there being plenty of tools out there for producing
trackerless (&lt;span class=&#34;caps&#34;&gt;&lt;span class=&#34;caps&#34;&gt;DHT&lt;/span&gt;&lt;/span&gt;) torrents, they were all &lt;span class=&#34;caps&#34;&gt;&lt;span class=&#34;caps&#34;&gt;GUI&lt;/span&gt;&lt;/span&gt; and I never found any that
were command line based.  The other was there was/is no tool for
extracting the info hash and building the magnet link.  There may be
tools now, but I couldn’t find any when I started 3 years&amp;nbsp;ago.&lt;/p&gt;
&lt;p&gt;The following steps are based upon the recent release of FreeBSD 11.2‑R,
adjust as&amp;nbsp;necessary.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Fetch the FreeBSD release and release announcement into a directory
   (I create a per release directory).
   remove the &lt;code&gt;CHECKSUM.SHA256&lt;/code&gt;, &lt;code&gt;CHECKSUM.SHA512&lt;/code&gt; and &lt;code&gt;index.html*&lt;/code&gt; files.
   &lt;pre class=&#34;fullwidth&#34;&gt;&lt;code&gt;
   $ REL=12.4-RELEASE
   $ RELABV=12.4R
   $ curl https://www.funkthat.com/~jmg/FreeBSD-snap/snapshot.idx.xz | xzcat | awk &#39; $2 == &#34;&#39;&#34;$REL&#34;&#39;&#34; { print $9 }&#39; | xargs -L 1 -P 3  wget --no-verbose -c --limit-rate=7000k
   $ wget https://www.freebsd.org/releases/$RELABV/announce.asc

   &lt;/code&gt;&lt;/pre&gt;
   This step depends upon
   &lt;a href=&#34;https://funkthat.com/gitea/jmg/snapaid&#34;&gt;snapaid&lt;/a&gt; running.
   If it is no longer running for some reason, &lt;code&gt;addinfo.sh&lt;/code&gt; could
   be run manually against the release email (not the downloaded
   &lt;code&gt;announce.asc&lt;/code&gt; file as the message id is needed) to generate
   snapshot.idx.xz locally, and use that&amp;nbsp;instead.
&lt;/li&gt;&lt;li&gt;Verify the &lt;span class=&#34;caps&#34;&gt;&lt;span class=&#34;caps&#34;&gt;GPG&lt;/span&gt;&lt;/span&gt; key that signed the above files.  This is usually Glen
   Barber’s key, but not always.  I have met and verified his fingerprint
   in person,  If you have verified someone’s key who has signed Glen’s
   key, that is another good&amp;nbsp;way.
&lt;/li&gt;&lt;li&gt;Verify the release announcement:
   &lt;pre class=&#34;fullwidth&#34;&gt;&lt;code&gt;
   $ gpg --verify announce.asc
   Warning: using insecure memory!
   gpg: Signature made Mon Dec  5 17:34:59 2022 PST using RSA key ID 478FE293
   gpg: Good signature from &#34;Glen Barber &amp;lt;gjb @ FreeBSD.org&amp;gt;&#34; [unknown]
   gpg:                 aka &#34;Glen Barber &amp;lt;gjb @ keybase.io&amp;gt;&#34; [unknown]
   gpg:                 aka &#34;Glen Barber &amp;lt;gjb @ glenbarber.us&amp;gt;&#34; [unknown]
   gpg:                 aka &#34;Glen Barber &amp;lt;glen.j.barber @ gmail.com&amp;gt;&#34; [unknown]
   gpg: WARNING: This key is not certified with a trusted signature!
   gpg:          There is no indication that the signature belongs to the owner.
   Primary key fingerprint: 78B3 42BA 26C7 B2AC 681E  A7BE 524F 0C37 A0B9 46A3
        Subkey fingerprint: 8D12 403C 2E6C AB08 6CF6  4DA3 0314 58A5 478F E293
   &lt;/code&gt;&lt;/pre&gt;
&lt;/li&gt;&lt;li&gt;In the past I have used BitTornado for other things, so I ended up
   using it as the basis to make the tool for creating trackerless torrent
   files.  The modifications were simple.  It appears that the original
   BitTornado &lt;span class=&#34;caps&#34;&gt;&lt;span class=&#34;caps&#34;&gt;CVS&lt;/span&gt;&lt;/span&gt; tree is off-line (anyways, it was served insecurely),
   but it looks like
   &lt;a href=&#34;https://github.com/effigies/BitTornado&#34;&gt;effigies/BitTornado&lt;/a&gt; is
   similar enough that it could be modified and used.  I copied
   &lt;code&gt;btmakemetafile.py&lt;/code&gt; to &lt;code&gt;btmaketrackerless.py&lt;/code&gt; and applied the following
   patch:
   &lt;pre class=&#34;fullwidth&#34;&gt;&lt;code&gt;
   $ diff -u btmakemetafile.py btmaketrackerless.py 
   --- btmakemetafile.py   2004-05-24 12:54:52.000000000 -0700
   +++ btmaketrackerless.py        2016-10-10 17:13:32.742081000 -0700
   @@ -23,9 +23,9 @@
    def prog(amount):
        print &#39;%.1f%% complete\r&#39; % (amount * 100),

   -if len(argv) &amp;lt; 3:
   +if len(argv) &amp;lt; 2:
        a,b = split(argv[0])
   -    print &#39;Usage: &#39; + b + &#39; &amp;lt;trackerurl&amp;gt; &amp;lt;file&amp;gt; [file...] [params...]&#39;
   +    print &#39;Usage: &#39; + b + &#39; &amp;lt;file&amp;gt; [file...] [params...]&#39;
        print
        print formatDefinitions(defaults, 80)
        print_announcelist_details()
   @@ -33,9 +33,9 @@
        exit(2)

    try:
   -    config, args = parseargs(argv[1:], defaults, 2, None)
   -    for file in args[1:]:
   -        make_meta_file(file, args[0], config, progress = prog)
   +    config, args = parseargs(argv[1:], defaults, 1, None)
   +    for file in args[0:]:
   +        make_meta_file(file, None, config, progress = prog)
    except ValueError, e:
        print &#39;error: &#39; + str(e)
        print &#39;run with no args for parameter explanations&#39;

   &lt;/code&gt;&lt;/pre&gt;
   If you notice, the only thing that is done is to drop the first argument,
   and instead of passing it into &lt;code&gt;make_meta_file&lt;/code&gt;, a &lt;code&gt;None&lt;/code&gt; is passed
   instead.  This will simply not add trackers to the torrent&amp;nbsp;file.
&lt;/li&gt;&lt;li&gt;I then run the following script to verify the downloaded files, and
   generate the torrent files:
   &lt;pre class=&#34;fullwidth&#34;&gt;&lt;code&gt;
   $ cat cmp.sh
   #!/bin/sh -
   # REL=12.4-RELEASE
   # RELABV=12.4R
   # xzcat ~jmg/public_html/FreeBSD-snap/snapshot.idx.xz | awk &#39; $2 == &#34;&#39;&#34;$REL&#34;&#39;&#34; { print $9 }&#39; | xargs -L 1 -P 3  wget --no-verbose -c --limit-rate=7000k
   # XXX - following command 404, manually saved from relase announcement
   # wget https://www.freebsd.org/releases/$RELABV/announce.asc
   # wget -c https://download.freebsd.org/ftp/releases/CI-IMAGES/$REL/amd64/Latest/FreeBSD-$REL-amd64-BASIC-CI.raw.xz
   # wget -c https://download.freebsd.org/ftp/releases/VM-IMAGES/$REL/riscv64/Latest/FreeBSD-$REL-riscv-riscv64.{qcow2,raw,vhd,vmdk}.xz

   grep -h &#39;^   SHA512&#39; announce.asc | sed -e &#39;s/SHA512 (\(.*\)) = \(.*\)/\2 \1/&#39; | sort -k 2 &amp;gt; sha512.from.asc

   while read hash fname; do
           if [ -e &#34;$fname&#34; ]; then
                   if [ -e &#34;$fname&#34;.torrent ]; then
                           echo skipping &#34;$fname&#34;...
                           continue
                   fi

                   sigfile=$(grep -l -- &#34;$fname&#34; *.asc | head -n 1)
                   echo checking &#34;$fname&#34;, sig in: &#34;$sigfile&#34;
                   #res=`sha512 -q &#34;$fname&#34;`
                   #res=`shasum -a 512 &#34;$fname&#34; | awk &#39;{ print $1 }&#39;`
                   res=$(openssl sha512  &amp;lt; &#34;$fname&#34; | awk &#39;{ print $2 }&#39;)
                   echo &#34;File is: $res&#34;
                   if [ x&#34;$res&#34; != x&#34;$hash&#34; ]; then
                           echo missmatch!  &#34;$fname&#34;
                           exit 1
                   fi
                   btmaketrackerless.py &#34;$fname&#34; &amp;amp;
           else
                   echo missing &#34;$fname&#34;
                   exit 1
           fi
   done &amp;lt; sha512.from.asc

   &lt;/code&gt;&lt;/pre&gt;
&lt;/li&gt;&lt;li&gt;Once all the torrents have been generated, I then make the magnet
   links:
   &lt;pre class=&#34;fullwidth&#34;&gt;&lt;code&gt;
   $ cat btmakemagnet.sh
   #!/bin/sh -

   # metainfo file.: FreeBSD-10.3-RELEASE-sparc64-bootonly.iso.torrent
   # info hash.....: 06091dabce1296d11d1758ffd071e7109a92934f
   # file name.....: FreeBSD-10.3-RELEASE-sparc64-bootonly.iso
   # file size.....: 203161600 (775 * 262144 + 0)
   # announce url..: udp://tracker.openbittorrent.com:80
   # btshowmetainfo 20030621 - decode BitTorrent metainfo files

   for i in *.torrent; do
           btshowmetainfo.py &#34;$i&#34; | awk &#39;
   $0 ~ &#34;^info hash&#34; { info = $3 }
   $0 ~ &#34;^file name&#34; { name = $3 }
   END {
           print &#34;magnet:?xt=urn:btih:&#34; info &#34;&amp;amp;dn=&#34; name
   }&#39;
   done
   &lt;/code&gt;&lt;/pre&gt;
&lt;/li&gt;&lt;li&gt;I then create the magnet links file, and update the
   &lt;a href=&#34;https://wiki.freebsd.org/Torrents&#34;&gt;Torrents&lt;/a&gt; wiki&amp;nbsp;page.
&lt;/li&gt;&lt;/ol&gt;&lt;/section&gt;
&lt;/article&gt;            </content>
        </entry>
            <entry>
            <title type="html">tmux beginners guide</title>
            <author><name>John-Mark Gurney</name></author>
            <link href="/2022/11/tmux.html"/>
            <updated>2022-11-15T00:00:00Z</updated>
            <published>2022-11-15T00:00:00Z</published>
            <id>https://blogtest.funkthat.com/2022/11/tmux.html</id>
                        <category   scheme="https://blogtest.funkthat.comsearch/label"
                        term="tweets"
                        label="Tweets" />
            
            <content type="html">
                                &lt;article class=&#34;post&#34;&gt;

&lt;h1 id=&#34;tmux-title&#34;&gt;&lt;a class=&#34;no-tufte-underline&#34; href=&#34;/2022/11/tmux.html#tmux-title&#34;&gt;tmux beginners&amp;nbsp;guide&lt;/a&gt;&lt;/h1&gt;

&lt;p class=&#34;posted&#34;&gt;Posted: November 15, 2022 at 12:00 &lt;span class=&#34;caps&#34;&gt;PM&lt;/span&gt;&lt;/p&gt;

&lt;ul class=&#34;tags clear&#34;&gt;
&lt;li&gt;
    &lt;a class=&#34;small&#34; href=&#34;/search/label/tweets.html&#34;&gt;&amp;nbsp;tweets
    &lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class=&#34;clear&#34;&gt;&lt;/div&gt;
&lt;section&gt;
&lt;p&gt;Originally Posted: Sun Aug 07 18:40:30 +0000&amp;nbsp;2022&lt;/p&gt;
&lt;p&gt;First, here’s the .tmux.conf I use (alt text to&amp;nbsp;copy/paste).&lt;/p&gt;
&lt;p&gt;This remaps the control key from ctrl-b (^B) to ctrl-a which is more natural for&amp;nbsp;me.&lt;/p&gt;
&lt;p&gt;Next is split windows, to have two windows side by side: ^A %, to have top/bottom: ^A&amp;nbsp;“.&lt;/p&gt;
&lt;p&gt;
&lt;img src=&#34;/media/twitter/FZlDEhHVQAEj5eA.png&#34; alt=&#34;unbind C-b set -g prefix C-a bind C-a send-prefix  bind ^L refresh-client set-window-option -g mode-keys vi  bind &amp;lt; resize-pane -L 4 bind &amp;gt; resize-pane -R 4 bind - resize-pane -D 4 bind + resize-pane -U 4  set -g mode-mouse off set -g mouse-resize-pane off set -g mouse-select-pane off set -g mouse-select-window off  bind k select-pane -U bind j select-pane -D bind h select-pane -L bind l select-pane -R &#34;&gt;
&lt;/p&gt;
&lt;p&gt;To move between windows, ^A then one of h (up) j (left) k (right) l (ell down), aka the vi movement keys, or you can use arrow&amp;nbsp;keys.&lt;/p&gt;
&lt;p&gt;To resize the current window, ^A &amp;lt; or &amp;gt; or + or&amp;nbsp;-.&lt;/p&gt;
&lt;p&gt;To swap two windows (to move them around), ^A { or ^A&amp;nbsp;}.&lt;/p&gt;
&lt;p&gt;To copy between windows, ^A [.  Then move the cursor to where you want to start, hit space to start selection, move to the end, hit enter.  Now that you have your selection, to paste it, ^A&amp;nbsp;].&lt;/p&gt;
&lt;p&gt;To create another workspace in the same session ^A c.  To switch workspaces, ^A&amp;nbsp;num.&lt;/p&gt;
&lt;p&gt;Note that my window/workspace terminology doesn’t line up w/ tmux’s, but makes more sense to&amp;nbsp;me.&lt;/p&gt;
&lt;p&gt;fin.&lt;/p&gt;
&lt;p&gt;Oh, another thing.  You have have multiple terminals connected to the same session (tmux attach).  This is great for pair programming, so you both don’t have to crowd around a terminal and swap keyboards, each can be on their own laptop, or now w/ &lt;span class=&#34;caps&#34;&gt;&lt;span class=&#34;caps&#34;&gt;WFH&lt;/span&gt;&lt;/span&gt;, be far&amp;nbsp;away.&lt;/p&gt;&lt;/section&gt;
&lt;/article&gt;            </content>
        </entry>
            <entry>
            <title type="html">Nearly Complete Guide to RNG on a microcontroller</title>
            <author><name>John-Mark Gurney</name></author>
            <link href="/2022/02/nearly-complete-rng-guide.html"/>
            <updated>2022-02-12T00:00:00Z</updated>
            <published>2022-02-12T00:00:00Z</published>
            <id>https://blogtest.funkthat.com/2022/02/nearly-complete-rng-guide.html</id>
                        <category   scheme="https://blogtest.funkthat.comsearch/label"
                        term="security"
                        label="Security" />
                        <category   scheme="https://blogtest.funkthat.comsearch/label"
                        term="rng"
                        label="Rng" />
                        <category   scheme="https://blogtest.funkthat.comsearch/label"
                        term="microcontroller"
                        label="Microcontroller" />
            
            <content type="html">
                                &lt;article class=&#34;post&#34;&gt;

&lt;h1 id=&#34;nearly-complete-rng-guide-title&#34;&gt;&lt;a class=&#34;no-tufte-underline&#34; href=&#34;/2022/02/nearly-complete-rng-guide.html#nearly-complete-rng-guide-title&#34;&gt;Nearly Complete Guide to &lt;span class=&#34;caps&#34;&gt;RNG&lt;/span&gt; on a&amp;nbsp;microcontroller&lt;/a&gt;&lt;/h1&gt;

&lt;p class=&#34;posted&#34;&gt;Posted: February 12, 2022 at 11:50 &lt;span class=&#34;caps&#34;&gt;AM&lt;/span&gt;&lt;/p&gt;

&lt;ul class=&#34;tags clear&#34;&gt;
&lt;li&gt;
    &lt;a class=&#34;small&#34; href=&#34;/search/label/microcontroller.html&#34;&gt;&amp;nbsp;microcontroller
    &lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
    &lt;a class=&#34;small&#34; href=&#34;/search/label/rng.html&#34;&gt;&amp;nbsp;rng
    &lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
    &lt;a class=&#34;small&#34; href=&#34;/search/label/security.html&#34;&gt;&amp;nbsp;security
    &lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class=&#34;clear&#34;&gt;&lt;/div&gt;
&lt;section&gt;
&lt;p&gt;Security depends upon cryptography and which in turn depends upon a
Random Number Generator (&lt;span class=&#34;caps&#34;&gt;&lt;span class=&#34;caps&#34;&gt;RNG&lt;/span&gt;&lt;/span&gt;).  An &lt;span class=&#34;caps&#34;&gt;&lt;span class=&#34;caps&#34;&gt;RNG&lt;/span&gt;&lt;/span&gt; is used for key generation (both
symmetric and asymmetric) and key negotiation (session establishment).
The later is an absolute requirement to ensure that communications can
be secured.  The former (key generation) can be used at first boot for
personalization, but isn’t necessary as it could be done when personalizing
the device at programming or first&amp;nbsp;deployment.&lt;/p&gt;
&lt;p&gt;There are two types of RNGs, the first is a True Random Number Generator
(&lt;span class=&#34;caps&#34;&gt;&lt;span class=&#34;caps&#34;&gt;TRNG&lt;/span&gt;&lt;/span&gt;).  This is one that takes some non-deterministic process, often
physical, and measures it.  Often, these are slow and are not uniform,
requiring a post processing step before the are&amp;nbsp;useful.&lt;/p&gt;
&lt;p&gt;The second type is a Pseudo Random Number Generator (&lt;span class=&#34;caps&#34;&gt;&lt;span class=&#34;caps&#34;&gt;PRNG&lt;/span&gt;&lt;/span&gt;)&lt;label for=&#34;sn-drbg&#34; class=&#34;margin-toggle sidenote-number&#34;&gt;&lt;/label&gt;&lt;input type=&#34;checkbox&#34; id=&#34;sn-drbg&#34; class=&#34;margin-toggle&#34;&gt;&lt;span class=&#34;sidenote&#34;&gt;&lt;a href=&#34;https://www.nist.gov/&#34;&gt;&lt;span class=&#34;caps&#34;&gt;&lt;span class=&#34;caps&#34;&gt;NIST&lt;/span&gt;&lt;/span&gt;&lt;/a&gt; also refers to a
&lt;span class=&#34;caps&#34;&gt;&lt;span class=&#34;caps&#34;&gt;PRNG&lt;/span&gt;&lt;/span&gt; as a Deterministic Random Bit Generator (&lt;span class=&#34;caps&#34;&gt;&lt;span class=&#34;caps&#34;&gt;DRBG&lt;/span&gt;&lt;/span&gt;).&lt;/span&gt;.  PRNGs
take a seed, and can generate large, effectively unlimited amounts of
random data, when seeded properly.  The issue is than if someone is able
to obtain the seed, they will be able to predict the subsequent values,
allowing breaking&amp;nbsp;security.&lt;/p&gt;
&lt;p&gt;The standard practice is to gather data from a &lt;span class=&#34;caps&#34;&gt;&lt;span class=&#34;caps&#34;&gt;TRNG&lt;/span&gt;&lt;/span&gt;, and use it to seed
a &lt;span class=&#34;caps&#34;&gt;&lt;span class=&#34;caps&#34;&gt;PRNG&lt;/span&gt;&lt;/span&gt;.  It used to be common that the &lt;span class=&#34;caps&#34;&gt;&lt;span class=&#34;caps&#34;&gt;PRNG&lt;/span&gt;&lt;/span&gt; should more additional random
data mixed in, but I agree w/ djb (&lt;span class=&#34;caps&#34;&gt;&lt;span class=&#34;caps&#34;&gt;D. J.&lt;/span&gt;&lt;/span&gt; Bernstein) that once seeded, no
additional seeding is needed&lt;label for=&#34;sn-entropy&#34; class=&#34;margin-toggle
sidenote-number&#34;&gt;&lt;/label&gt;&lt;input type=&#34;checkbox&#34; id=&#34;sn-entropy&#34; class=&#34;margin-toggle&#34;&gt;&lt;span class=&#34;sidenote&#34;&gt;See his blog post
&lt;a href=&#34;https://blog.cr.yp.to/20140205-entropy.html&#34;&gt;Entropy Attacks!&lt;/a&gt;&lt;/span&gt;
as modern PRNGs are secure and can generate random data such that their
state will not leak.&lt;label for=&#34;sn-prng-secure&#34; class=&#34;margin-toggle
sidenote-number&#34;&gt;&lt;/label&gt;&lt;input type=&#34;checkbox&#34; id=&#34;sn-prng-secure&#34; class=&#34;margin-toggle&#34;&gt;&lt;span class=&#34;sidenote&#34;&gt;That is, taking it’s output,
that neither past nor future output can be&amp;nbsp;predicted.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;There are lots of libraries and papers that talk about how to solve the
problem for RNGs on a microcontroller that may not have an integrated
[T]&lt;span class=&#34;caps&#34;&gt;&lt;span class=&#34;caps&#34;&gt;RNG&lt;/span&gt;&lt;/span&gt; block, but I have not been able to find a complete guide for
integrating their work into a project where even a relative beginner
could get it&amp;nbsp;functional.&lt;/p&gt;
&lt;p&gt;This article was written as I developed the
&lt;a href=&#34;https://www.funkthat.com/gitea/jmg/lora-irrigation&#34;&gt;lora-irrigation&lt;/a&gt;
project.  This project will be used as an example, and the code reference
is mostly licensed under the 2-clause &lt;span class=&#34;caps&#34;&gt;&lt;span class=&#34;caps&#34;&gt;BSD&lt;/span&gt;&lt;/span&gt; license, and so is freely
usable for your own&amp;nbsp;projects.&lt;/p&gt;
&lt;h2 id=&#34;sources-of-randomness&#34;&gt;Sources of Randomness&lt;a class=&#34;headerlink&#34; href=&#34;/2022/02/nearly-complete-rng-guide.html#sources-of-randomness&#34; title=&#34;Permanent link&#34;&gt;¶&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;As mentioned, most microcontrollers do not have a dedicated hardware
block like modern &lt;span class=&#34;caps&#34;&gt;&lt;span class=&#34;caps&#34;&gt;AMD64&lt;/span&gt;&lt;/span&gt; (aka x86-64) processors do w/ the &lt;span class=&#34;caps&#34;&gt;&lt;span class=&#34;caps&#34;&gt;RDRAND&lt;/span&gt;&lt;/span&gt;
instruction.  Though they do not, there are other sources that are&amp;nbsp;available.&lt;/p&gt;
&lt;p&gt;The first, and easiest one is the Analog Digital Converter (&lt;span class=&#34;caps&#34;&gt;&lt;span class=&#34;caps&#34;&gt;ADC&lt;/span&gt;&lt;/span&gt;).  Even
if the &lt;span class=&#34;caps&#34;&gt;&lt;span class=&#34;caps&#34;&gt;ADC&lt;/span&gt;&lt;/span&gt; pin is tied to ground, the process of digital conversion is
not 100% deterministic as there are errors in the converter or noise
introduced on the pin.&lt;label for=&#34;sn-adcnoise&#34; class=&#34;margin-toggle sidenote-number&#34;&gt;&lt;/label&gt;&lt;input type=&#34;checkbox&#34; id=&#34;sn-adcnoise&#34; class=&#34;margin-toggle&#34;&gt;&lt;span class=&#34;sidenote&#34;&gt;The article
&lt;a href=&#34;https://www.analog.com/en/analog-dialogue/articles/adc-input-noise.html&#34;&gt;&lt;span class=&#34;caps&#34;&gt;&lt;span class=&#34;caps&#34;&gt;ADC&lt;/span&gt;&lt;/span&gt; Input Noise: The Good, The Bad, and The Ugly. Is No Noise Good
Noise?&lt;/a&gt;
talks about&amp;nbsp;this.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;The data sheet for the microcontroller will help determine the expected
randomness from the part.  In the case of the
&lt;a href=&#34;https://www.st.com/content/st_com/en/products/microcontrollers-microprocessors/stm32-32-bit-arm-cortex-mcus/stm32-ultra-low-power-mcus/stm32l1-series/stm32l151-152/stm32l151cc.html&#34;&gt;&lt;span class=&#34;caps&#34;&gt;&lt;span class=&#34;caps&#34;&gt;STM32L151CC&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;
that I’m using, Table 57 of the data sheet lists the Effective number
of bits (&lt;span class=&#34;caps&#34;&gt;&lt;span class=&#34;caps&#34;&gt;ENOB&lt;/span&gt;&lt;/span&gt;) as typically 10 bits, which is a couple bits short of
the 12 bit resolution of the &lt;span class=&#34;caps&#34;&gt;&lt;span class=&#34;caps&#34;&gt;ADC&lt;/span&gt;&lt;/span&gt;.  This means that the 2 least
significant bits are likely to have some noise in them.  I did a run,
and collected 114200 samples from the &lt;span class=&#34;caps&#34;&gt;&lt;span class=&#34;caps&#34;&gt;ADC&lt;/span&gt;&lt;/span&gt;.  The &lt;a href=&#34;https://en.wikipedia.org/wiki/R%C3%A9nyi_entropy#Shannon_entropy&#34;&gt;Shannon
entropy&lt;/a&gt;
calculated using the empirical probabilities was 2.48.&lt;label for=&#34;sn-shannonenropy&#34; class=&#34;margin-toggle sidenote-number&#34;&gt;&lt;/label&gt;
&lt;input type=&#34;checkbox&#34; id=&#34;sn-shannonenropy&#34; class=&#34;margin-toggle&#34;&gt;
&lt;span class=&#34;sidenote&#34;&gt;Now this is not strictly Shannon entropy, as the
values were calculated from the experiment, and Shannon entropy should
be calculated from the a priori probabilities.&lt;/span&gt;  Discarding the
0’s (which makes up over half the results) improves the entropy
calculation to 3.29.  The
&lt;a href=&#34;https://en.wikipedia.org/wiki/R%C3%A9nyi_entropy#Min-entropy&#34;&gt;min-entropy&lt;/a&gt;&lt;label for=&#34;sn-min-entropy-fwdref&#34; class=&#34;margin-toggle sidenote-number&#34;&gt;&lt;/label&gt;,
&lt;input type=&#34;checkbox&#34; id=&#34;sn-min-entropy-fwdref&#34; class=&#34;margin-toggle&#34;&gt;
&lt;span class=&#34;sidenote&#34;&gt;Forward reference:
&lt;a href=&#34;/2022/02/nearly-complete-rng-guide.html#min-entropy-awk&#34;&gt;min-entropy awk script&lt;/a&gt;&lt;/span&gt;
a better indicator of entropy, calculation is 1.2 bits, and if all the
0’s are dropped, it improves to 2.943.  This does help, but in the end,
subtracting the data sheet’s &lt;span class=&#34;caps&#34;&gt;&lt;span class=&#34;caps&#34;&gt;ENOB&lt;/span&gt;&lt;/span&gt; from the &lt;span class=&#34;caps&#34;&gt;&lt;span class=&#34;caps&#34;&gt;ADC&lt;/span&gt;&lt;/span&gt; resolution does result
in an approximate estimate of&amp;nbsp;entropy.&lt;/p&gt;
&lt;p&gt;It is possibly that a correlation analysis between samples could
further reduce the entropy gathers via the &lt;span class=&#34;caps&#34;&gt;&lt;span class=&#34;caps&#34;&gt;ADC&lt;/span&gt;&lt;/span&gt;, but with sufficient
collection, this should be able to be&amp;nbsp;avoided.&lt;/p&gt;
&lt;p&gt;The second is using uninitialized &lt;span class=&#34;caps&#34;&gt;&lt;span class=&#34;caps&#34;&gt;SRAM&lt;/span&gt;&lt;/span&gt;.  It turns out that this has
been studied in &lt;a href=&#34;https://dl.acm.org/doi/10.1145/2593069.2593218&#34;&gt;Software Only, Extremely Compact, Keccak-based Secure
&lt;span class=&#34;caps&#34;&gt;&lt;span class=&#34;caps&#34;&gt;PRNG&lt;/span&gt;&lt;/span&gt; on &lt;span class=&#34;caps&#34;&gt;&lt;span class=&#34;caps&#34;&gt;ARM&lt;/span&gt;&lt;/span&gt; Cortex-M&lt;/a&gt;
and &lt;a href=&#34;https://www.intrinsic-id.com/wp-content/uploads/2017/05/prng_seeding.pdf&#34;&gt;Secure &lt;span class=&#34;caps&#34;&gt;&lt;span class=&#34;caps&#34;&gt;PRNG&lt;/span&gt;&lt;/span&gt; Seeding on Commercial Off-the-Shelf
Microcontrollers&lt;/a&gt;.
Depending upon how the &lt;span class=&#34;caps&#34;&gt;&lt;span class=&#34;caps&#34;&gt;SRAM&lt;/span&gt;&lt;/span&gt; is designed in the chip, it can create a
situation where each bit of &lt;span class=&#34;caps&#34;&gt;&lt;span class=&#34;caps&#34;&gt;SRAM&lt;/span&gt;&lt;/span&gt; will be indeterminate at boot up.
Both of these papers studied a similar microcontroller, an
&lt;span class=&#34;caps&#34;&gt;&lt;span class=&#34;caps&#34;&gt;STM32F100R8&lt;/span&gt;&lt;/span&gt; to the one I am using, a &lt;span class=&#34;caps&#34;&gt;&lt;span class=&#34;caps&#34;&gt;STM32L151CC&lt;/span&gt;&lt;/span&gt;.&lt;/p&gt;
&lt;p&gt;I ran my own experiments where I powered on an &lt;span class=&#34;caps&#34;&gt;&lt;span class=&#34;caps&#34;&gt;STM3L151CC&lt;/span&gt;&lt;/span&gt; and dumped
the &lt;span class=&#34;caps&#34;&gt;&lt;span class=&#34;caps&#34;&gt;SRAM&lt;/span&gt;&lt;/span&gt; 8 times and analyzed the results.  I limited my analysis to
26863 bytes the 32 KiBytes of ram (remaining was data/bss or stack, so
would not change, or was zeros). I then calculated the min-entropy for
each bit across power cycles and the resulting sum was 11188, or
approximately .416 bits per byte.  This is 5.2% and in line with what
the later paper observed for a similar&amp;nbsp;device.&lt;/p&gt;
&lt;p&gt;Part of using a source of randomness is making sure that it is usable.
In the case of the &lt;span class=&#34;caps&#34;&gt;&lt;span class=&#34;caps&#34;&gt;ADC&lt;/span&gt;&lt;/span&gt;, each reading can be evaluated against previous
reads to ensure that the data being obtained is possibly random.  In
the case of &lt;span class=&#34;caps&#34;&gt;&lt;span class=&#34;caps&#34;&gt;SRAM&lt;/span&gt;&lt;/span&gt;, this is more tricky, as the state of &lt;span class=&#34;caps&#34;&gt;&lt;span class=&#34;caps&#34;&gt;SRAM&lt;/span&gt;&lt;/span&gt; is static,
and short of a reset, will not change.  This means that to use &lt;span class=&#34;caps&#34;&gt;&lt;span class=&#34;caps&#34;&gt;SRAM&lt;/span&gt;&lt;/span&gt;,
proper analysis of the device, or family of devices, need to be evaluated
for suitability.  There are cases where a device’s &lt;span class=&#34;caps&#34;&gt;&lt;span class=&#34;caps&#34;&gt;SRAM&lt;/span&gt;&lt;/span&gt; does not provide
adequate entropy, as discussed in the papers, and so this method should
not be used in those cases, or not solely relied&amp;nbsp;upon.&lt;/p&gt;
&lt;p&gt;The following is an &lt;code&gt;awk&lt;/code&gt; script for calculating the min-entropy of the
provided data.  Each sample must be the first item on a line, and each
sample must be a hexadecimal value w/o any leading &lt;code&gt;0x&lt;/code&gt; or other leading&amp;nbsp;identifier:&lt;/p&gt;
&lt;pre id=&#34;min-entropy-awk&#34; class=&#34;language-awk fullwidth&#34;&gt;&lt;code&gt;# Copyright 2021 John-Mark Gurney
# This script is licensed under the 2-clause BSD license

function max(a, b)
{
        if (a &amp;gt; b)
                return a;
        else
                return b;
}

{
        v = (&#34;0x&#34; $1) + 0; a[NR] = v;
        maxv = max(maxv, v);
}

END {
        tcnt = length(a);
        me = 0;
        for (bit = 0; 2^bit &amp;lt;= maxv; bit += 1) {
                cnt0 = 0;
                cnt1 = 0;
                for (i in a) {
                        tbit = int((a[i] / 2 ^ bit) % 2);
                        if (tbit)
                                cnt1 += 1;
                        else
                                cnt0 += 1;
                }
                v = -log(max(cnt0, cnt1) / tcnt) / log(2);
                print &#34;bit &#34; bit &#34;:\t&#34; v;
                me += v;
        }
        printf &#34;total:\t%0.3f\n&#34;, me;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;It is also possible that there are other parts of the board/design
that could be a source of randomness.  The project that started this
journey is using &lt;a href=&#34;https://en.wikipedia.org/wiki/LoRa&#34;&gt;LoRa&lt;/a&gt; for
communication.  It turns out that the sample code for the radio chip
(&lt;a href=&#34;https://github.com/Lora-net/LoRaMac-node&#34;&gt;LoRaMac‑node&lt;/a&gt;) implements
a &lt;a href=&#34;https://github.com/Lora-net/LoRaMac-node/blob/7f12997754ad8e38a84daa85f62e7e6c0e5dbe59/src/radio/radio.h#L154-L163&#34;&gt;random interface&lt;/a&gt;.
The function just waits one milisecond, reads the &lt;span class=&#34;caps&#34;&gt;&lt;span class=&#34;caps&#34;&gt;RSSI&lt;/span&gt;&lt;/span&gt; value, takes
the low bit and repeats this 32 times to return a 32-bit word.  There
are issues with this as I cannot find any description of the expected
randomness in the data sheet, nor in the code.  It also does not do
any conditioning, so just because it returns 32-bits, does not guarantee
32-bits of usable entropy.  I have briefly looked at the output, and
there does appear to be higher lengths of runs than expected.  Another
issue is that it’s collection takes a while, as the fastest is 1 bit
per ms.  So, assuming the need to collect 8 bits for 1 bit of entropy
(pure speculation), that means at minimum 2 seconds to collect the
2048 bits necessary for 256 bits of&amp;nbsp;entropy.&lt;/p&gt;
&lt;h2 id=&#34;uniquifying&#34;&gt;Uniquifying&lt;a class=&#34;headerlink&#34; href=&#34;/2022/02/nearly-complete-rng-guide.html#uniquifying&#34; title=&#34;Permanent link&#34;&gt;¶&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;One of the other ways to help ensure that a microcontroller is to
integrate per device values into the &lt;span class=&#34;caps&#34;&gt;&lt;span class=&#34;caps&#34;&gt;PRNG&lt;/span&gt;&lt;/span&gt;.  This does not guarantee
uniqueness between boots, but it does make it harder to attack if an
attacker is able to control the other sources of&amp;nbsp;randomness.&lt;/p&gt;
&lt;p&gt;In the case of the &lt;span class=&#34;caps&#34;&gt;&lt;span class=&#34;caps&#34;&gt;STM32L151&lt;/span&gt;&lt;/span&gt; chip I am using, there is a unique
device id register.  The device register is programmed at the
factory.  Because it is unknown if this unique id is recorded by the
manufacturer, and possibly traced through the supply chain, and no
guarantees are made to both the uniqueness or privacy, it has limited
use to provide any serious additional&amp;nbsp;randomization.&lt;/p&gt;
&lt;p&gt;Another method, is to write entropy at provisioning time.  This can be
done in either flash memory or &lt;span class=&#34;caps&#34;&gt;&lt;span class=&#34;caps&#34;&gt;EEPROM&lt;/span&gt;&lt;/span&gt;, which may have a more granular
write&amp;nbsp;access.&lt;/p&gt;
&lt;h2 id=&#34;using-sram&#34;&gt;Using &lt;span class=&#34;caps&#34;&gt;&lt;span class=&#34;caps&#34;&gt;SRAM&lt;/span&gt;&lt;/span&gt;&lt;a class=&#34;headerlink&#34; href=&#34;/2022/02/nearly-complete-rng-guide.html#using-sram&#34; title=&#34;Permanent link&#34;&gt;¶&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;The tricky part of using &lt;span class=&#34;caps&#34;&gt;&lt;span class=&#34;caps&#34;&gt;SRAM&lt;/span&gt;&lt;/span&gt; is figuring out how to access the
uninitialized memory.  Despite having full access to the environment,
modifying the startup code, which is often written in assembly, to do
the harvesting makes an implementation less portable.  Using standard
C, or another high level language, makes this easier, &lt;em&gt;but&lt;/em&gt; we need to
know where the end of the data and bss segments are.  This is where
looking at the linker script will come&amp;nbsp;in.&lt;/p&gt;
&lt;p&gt;A linker script is used to allocate and map the program’s data to the
correct locations.  This includes allocating memory so that all the
code and data fits in flash, but also allocating ram for variables, and
stack.  Often there will be a symbol provided that marks where the data
and bss sections in ram end, and the heap should begin.  For example,
in &lt;a href=&#34;https://www.funkthat.com/gitea/jmg/lora-irrigation/src/commit/91a6fb590b68af1bcd34f776d4a58c89ac581c7d/stm32/l151ccux/STM32L151CCUX_FLASH.ld#L185-L186&#34;&gt;&lt;code&gt;STM32L151CCUX_FLASH.ld&lt;/code&gt; at lines 185 &lt;span class=&#34;amp&#34;&gt;&amp;amp;&lt;/span&gt;
186&lt;/a&gt;
it defines the symbols &lt;code&gt;end&lt;/code&gt; and &lt;code&gt;_end&lt;/code&gt;, the later of which is often
used by &lt;code&gt;sbrk&lt;/code&gt; (or &lt;code&gt;_sbrk&lt;/code&gt; in my project’s case in
libnosys&lt;label for=&#34;sn-sbrk-sample&#34; class=&#34;margin-toggle sidenote-number&#34;&gt;&lt;/label&gt;&lt;input type=&#34;checkbox&#34; id=&#34;sn-sbrk-sample&#34; class=&#34;margin-toggle&#34;&gt;
&lt;span class=&#34;sidenote&#34;&gt;A sample &lt;code&gt;_sbrk&lt;/code&gt; is in &lt;a href=&#34;https://www.funkthat.com/gitea/jmg/lora-irrigation/src/commit/91a6fb590b68af1bcd34f776d4a58c89ac581c7d/loramac/src/boards/mcu/saml21/hal/utils/src/utils_syscalls.c#L67-L83&#34;&gt;utils_syscalls.c&lt;/a&gt;,
though this particular implementation is not used by my project.&lt;/span&gt;)
to allocate memory for the heap.  Using sbrk is the easiest method to
access uninitalized &lt;span class=&#34;caps&#34;&gt;&lt;span class=&#34;caps&#34;&gt;SRAM&lt;/span&gt;&lt;/span&gt;, but modifying or adding a symbol can be used
if your microcontroller’s framework does not support&amp;nbsp;sbrk.&lt;/p&gt;
&lt;h2 id=&#34;putting-it-together&#34;&gt;Putting it together&lt;a class=&#34;headerlink&#34; href=&#34;/2022/02/nearly-complete-rng-guide.html#putting-it-together&#34; title=&#34;Permanent link&#34;&gt;¶&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;It is accepted that integrating as many difference sournces of entropy
(TRNGs) is best.  This ensures that as long as any single soruce is
good, or each one is not great, but combined they provide enough
entropy (preferably at least 128 bits), that the seeded &lt;span class=&#34;caps&#34;&gt;&lt;span class=&#34;caps&#34;&gt;PRNG&lt;/span&gt;&lt;/span&gt; will be
secure and&amp;nbsp;unpredictable.&lt;/p&gt;
&lt;p&gt;As some sources are only available at first boot, e.g. &lt;span class=&#34;caps&#34;&gt;&lt;span class=&#34;caps&#34;&gt;SRAM&lt;/span&gt;&lt;/span&gt;, it is
best to save a fork of the &lt;span class=&#34;caps&#34;&gt;&lt;span class=&#34;caps&#34;&gt;PRNG&lt;/span&gt;&lt;/span&gt; to stable storage.  In my
implementation, I decided to use &lt;span class=&#34;caps&#34;&gt;&lt;span class=&#34;caps&#34;&gt;EEPROM&lt;/span&gt;&lt;/span&gt; for this.  I added an
additional &lt;span class=&#34;caps&#34;&gt;&lt;span class=&#34;caps&#34;&gt;EEPROM&lt;/span&gt;&lt;/span&gt; section in the linker script, and then added a symbol
&lt;a href=&#34;https://www.funkthat.com/gitea/jmg/lora-irrigation/src/branch/main/strobe_rng_init.c#L39&#34;&gt;rng_save&lt;/a&gt;
that is put in this section.  This should be 256-bits (32-bytes) as
the savings of smaller does not make sense, and any proper &lt;span class=&#34;caps&#34;&gt;&lt;span class=&#34;caps&#34;&gt;PRNG&lt;/span&gt;&lt;/span&gt; when
seeded with 256-bits will provide enough randomness.  Writing to &lt;span class=&#34;caps&#34;&gt;&lt;span class=&#34;caps&#34;&gt;EEPROM&lt;/span&gt;&lt;/span&gt;
does require a little more work to have the code save to this region,
rather than &lt;span class=&#34;caps&#34;&gt;&lt;span class=&#34;caps&#34;&gt;RAM&lt;/span&gt;&lt;/span&gt;, but the &lt;span class=&#34;caps&#34;&gt;&lt;span class=&#34;caps&#34;&gt;STM32&lt;/span&gt;&lt;/span&gt; &lt;span class=&#34;caps&#34;&gt;&lt;span class=&#34;caps&#34;&gt;HAL&lt;/span&gt;&lt;/span&gt; layer has functions that make this&amp;nbsp;easy.&lt;/p&gt;
&lt;p&gt;It would be great if the &lt;span class=&#34;caps&#34;&gt;&lt;span class=&#34;caps&#34;&gt;PRNG&lt;/span&gt;&lt;/span&gt; seed could be stored in read-once,
write-once memory to ensure that it can be read, mixed in with any
additional entropy, and then written out, but I do not know of any
microcontroller that supports this&amp;nbsp;feature.&lt;/p&gt;
&lt;p&gt;Part of this is is to ensure that the the state between the saved
seed, and the &lt;span class=&#34;caps&#34;&gt;&lt;span class=&#34;caps&#34;&gt;PRNG&lt;/span&gt;&lt;/span&gt; state used for this boot is disjoint, and that if
either seed is compromised, neither can be backtracked to obtain the
other.  In the case of &lt;a href=&#34;https://strobe.sourceforge.io/papers/strobe-latest.pdf&#34;&gt;strobe&lt;/a&gt;,
the function &lt;a href=&#34;https://www.funkthat.com/gitea/jmg/lora-irrigation/src/branch/main/strobe/strobe.c#L319-L331&#34;&gt;strobe_randomize&lt;/a&gt;
does a &lt;span class=&#34;caps&#34;&gt;&lt;span class=&#34;caps&#34;&gt;RATCHET&lt;/span&gt;&lt;/span&gt; operation at the end, which ensure the state cannot be rolled
back to figure out what was generated, and as the generated bytes does
not contain the entire state of the &lt;span class=&#34;caps&#34;&gt;&lt;span class=&#34;caps&#34;&gt;PRNG&lt;/span&gt;&lt;/span&gt;, it cannot be used to
reconstruct the future&amp;nbsp;seed.&lt;/p&gt;
&lt;p&gt;Another advantage of using &lt;span class=&#34;caps&#34;&gt;&lt;span class=&#34;caps&#34;&gt;EEPROM&lt;/span&gt;&lt;/span&gt; is the ability to provide an initial
set of entropy bytes at firmware flashing time.  I did attempt to add
this, but OpenOCD, which I use for programming the Node151 device,
does not support programming &lt;span class=&#34;caps&#34;&gt;&lt;span class=&#34;caps&#34;&gt;EEPROM&lt;/span&gt;&lt;/span&gt;, so in my case, this was not
possible&lt;label for=&#34;sn-eeprom-flash&#34; class=&#34;margin-toggle sidenote-number&#34;&gt;&lt;/label&gt;&lt;input type=&#34;checkbox&#34; id=&#34;sn-eeprom-flash&#34; class=&#34;margin-toggle&#34;&gt;&lt;span class=&#34;sidenote&#34;&gt;Despite not using it, the infrastructure to generate perso entropy is still present in the &lt;a href=&#34;https://www.funkthat.com/gitea/jmg/lora-irrigation/src/branch/main/Makefile#L152-L157&#34;&gt;Makefile&lt;/a&gt;.&lt;/span&gt;.
I could have added an additional source data file to the flash, but
figured that the other sources of entropy were adequate enough for my&amp;nbsp;project.&lt;/p&gt;&lt;/section&gt;
&lt;/article&gt;            </content>
        </entry>
            <entry>
            <title type="html">CODEpendence</title>
            <author><name>John-Mark Gurney</name></author>
            <link href="/2021/07/CODEpendence-github.html"/>
            <updated>2021-07-07T00:00:00Z</updated>
            <published>2021-07-07T00:00:00Z</published>
            <id>https://blogtest.funkthat.com/2021/07/CODEpendence-github.html</id>
                        <category   scheme="https://blogtest.funkthat.comsearch/label"
                        term="security"
                        label="Security" />
                        <category   scheme="https://blogtest.funkthat.comsearch/label"
                        term="GitHub"
                        label="Github" />
                        <category   scheme="https://blogtest.funkthat.comsearch/label"
                        term="git"
                        label="Git" />
            
            <content type="html">
                                &lt;article class=&#34;post&#34;&gt;

&lt;h1 id=&#34;CODEpendence-github-title&#34;&gt;&lt;a class=&#34;no-tufte-underline&#34; href=&#34;/2021/07/CODEpendence-github.html#CODEpendence-github-title&#34;&gt;CODEpendence&lt;/a&gt;&lt;/h1&gt;

&lt;p class=&#34;posted&#34;&gt;Posted: July  7, 2021 at 11:16 &lt;span class=&#34;caps&#34;&gt;AM&lt;/span&gt;&lt;/p&gt;

&lt;ul class=&#34;tags clear&#34;&gt;
&lt;li&gt;
    &lt;a class=&#34;small&#34; href=&#34;/search/label/git.html&#34;&gt;&amp;nbsp;git
    &lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
    &lt;a class=&#34;small&#34; href=&#34;/search/label/GitHub.html&#34;&gt;&amp;nbsp;GitHub
    &lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
    &lt;a class=&#34;small&#34; href=&#34;/search/label/security.html&#34;&gt;&amp;nbsp;security
    &lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class=&#34;clear&#34;&gt;&lt;/div&gt;
&lt;section&gt;
&lt;p&gt;&lt;span class=&#34;caps&#34;&gt;&lt;span class=&#34;caps&#34;&gt;TL&lt;/span&gt;&lt;/span&gt;;dr: If you use submodules that point to a GitHub repo, make sure
that the commit id matches an offical branch or tag, especially if
upgraded via a &lt;span class=&#34;caps&#34;&gt;&lt;span class=&#34;caps&#34;&gt;PR&lt;/span&gt;&lt;/span&gt; or submitted&amp;nbsp;patch.&lt;/p&gt;
&lt;p&gt;This issue was disclosed to GitHub via the HackerOne Bug Bounty
program and resolved by them in a timely manner.  The
&lt;a href=&#34;https://www.funkthat.com/~jmg/github.submodules.hash.txt&#34;&gt;writeup&lt;/a&gt; is
available and is the same one that was provided to GitHub.  It contains
the complete steps in more detail than this blog post&amp;nbsp;does.&lt;/p&gt;
&lt;h2 id=&#34;discovery&#34;&gt;Discovery&lt;a class=&#34;headerlink&#34; href=&#34;/2021/07/CODEpendence-github.html#discovery&#34; title=&#34;Permanent link&#34;&gt;¶&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Earlier this year, I was dealing with a git repo that used submodules.
I’ve never been a fan of them due to the extra work involved in using
them.  But then a thought hit me, last year, when GitHub took down
youtube-dl, someone was a bit sneaky and inserted a &lt;a href=&#34;https://www.reddit.com/r/programming/comments/jhlhok/someone_replaced_the_github_dmca_repo_with/&#34;&gt;copy of it into
GitHub’s &lt;span class=&#34;caps&#34;&gt;&lt;span class=&#34;caps&#34;&gt;DMCA&lt;/span&gt;&lt;/span&gt; repo&lt;/a&gt;.
They were able to do this because there is a feature/bug in GitHub’s
backend, that all the commits to a forked repo are accessible in the
parent repo, it’s just that the branches and tags are maintained
separately.&lt;label for=&#34;sn-reason&#34; class=&#34;margin-toggle sidenote-number&#34;&gt;
&lt;/label&gt;&lt;input type=&#34;checkbox&#34; id=&#34;sn-reason&#34; class=&#34;margin-toggle&#34;&gt;
&lt;span class=&#34;sidenote&#34;&gt;This makes sense to reduce storing duplicate data
if a repo is large or has many&amp;nbsp;forks.&lt;/span&gt;&lt;/p&gt;
&lt;h2 id=&#34;verification&#34;&gt;Verification&lt;a class=&#34;headerlink&#34; href=&#34;/2021/07/CODEpendence-github.html#verification&#34; title=&#34;Permanent link&#34;&gt;¶&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;The next question, would combining these into an attack even work?
What would things look like?  I created a few accounts to test them,
creating a project to represent a code dependancy,
&lt;a href=&#34;https://github.com/upstream123/depproj&#34;&gt;depproj&lt;/a&gt;, that would be
imported into another project by another user,
&lt;a href=&#34;https://github.com/comproj/proj&#34;&gt;proj&lt;/a&gt;.  Then once those were created,
have a malicious user create a fork of both the
&lt;a href=&#34;https://github.com/maliciousrepo/depproj&#34;&gt;deprpoj&lt;/a&gt; and the
&lt;a href=&#34;https://github.com/maliciousrepo/proj&#34;&gt;proj&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Once the malicious forks were created, clone them locally.  With the
clones, malicious &lt;a href=&#34;https://github.com/maliciousrepo/depproj/commit/91781e4b9e1b1c944e19db740db12304755666b5&#34;&gt;code can be
inserted&lt;/a&gt;
into the depproj repo.  If you look at the repo, the previous commit
was done as the maliciousrepo user, but while I was working on this,
I remembered that w/ git, you can set the commit author to be anything
(signing helps prevent that), so this commit appears to be done by the
correct upstream123&amp;nbsp;user.&lt;/p&gt;
&lt;p&gt;Once the malicious code has been inserted, the malicious user can now
update the submodule of the project to the commit id of the malicious
code.  This is done simply by&amp;nbsp;doing:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;cd depproj
git fetch origin &amp;lt;commitid&amp;gt;
git checkout &amp;lt;commitid&amp;gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Even though the depproj still points to the upstream123 repo, because
fork commits appear &lt;span class=&#34;caps&#34;&gt;&lt;span class=&#34;caps&#34;&gt;IN&lt;/span&gt;&lt;/span&gt; the depproj repo, the above works w/o any other
changes.  This is also what makes it dangerous, because the repo is not
changed, it can be disguised as a simple version&amp;nbsp;update.&lt;/p&gt;
&lt;p&gt;A &lt;a href=&#34;https://github.com/comproj/proj/pull/3&#34;&gt;&lt;span class=&#34;caps&#34;&gt;&lt;span class=&#34;caps&#34;&gt;PR&lt;/span&gt;&lt;/span&gt;&lt;/a&gt; is then submitted to the
project being attacked.  I did not control the author of commits as
well as I should have, but it still is effective.  If you click into
the proposed change, and then click on code.c, the file changed, it’ll
bring you to the &lt;a href=&#34;https://github.com/upstream123/depproj/compare/91781e4b9e1b1c944e19db740db12304755666b5...370d35ec5df81a16bb361111faeb665ea90de026#diff-e43700a08429a0231daba9a49ff36a118566849856da2811ae074417ebb552d0&#34;&gt;change compare
view&lt;/a&gt;.
For this demo, it was a small change, but if the project is large, it’s
would be easy to bury a minor flaw in lots of changes.  The other thing
to note about this page is that the author displayed is &lt;span class=&#34;caps&#34;&gt;&lt;span class=&#34;caps&#34;&gt;NOT&lt;/span&gt;&lt;/span&gt; the author
of the change, but it appears that it is a legitimate change by the
author of the repo. &lt;a href=&#34;/media/images/codependence-comp-author.png&#34;&gt;&lt;img alt=&#34;Screenshot of github comparing changes with a popup of the author showing the author owns this repository and committed to this repository.&#34; src=&#34;/media/images/codependence-comp-author.png&#34;&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2 id=&#34;conclusion&#34;&gt;Conclusion&lt;a class=&#34;headerlink&#34; href=&#34;/2021/07/CODEpendence-github.html#conclusion&#34; title=&#34;Permanent link&#34;&gt;¶&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;This is an interesting attack in that it leverages two features in a
way that has surprising results.  It demonstrates that software
dependancies need to be reviewed, and vetted, and that if you’re using
GitHub, that just because a &lt;span class=&#34;caps&#34;&gt;&lt;span class=&#34;caps&#34;&gt;PR&lt;/span&gt;&lt;/span&gt; says it’s updating a submodule to the
new version, it doesn’t mean that it is safe to simply merge in the&amp;nbsp;change.&lt;/p&gt;
&lt;h2 id=&#34;timeline&#34;&gt;Timeline&lt;a class=&#34;headerlink&#34; href=&#34;/2021/07/CODEpendence-github.html#timeline&#34; title=&#34;Permanent link&#34;&gt;¶&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;2021-03-31 — Reported to GitHub via HackerOne.&lt;br&gt;
2021-03-31 — More info requested and provided.&lt;br&gt;
2021-04-01 — Ack’d issue and started work on fix.&lt;br&gt;
2021-05-04 — GitHub determined it was low risk, but did add warning when viewing commit.&lt;br&gt;
2021-05-05 — Asked GitHub for disclosure timeline.&lt;br&gt;
2021-06-04 — Pinged GitHub again.&lt;br&gt;
2021-07-07 — Published blog post.&lt;br&gt;&lt;/p&gt;&lt;/section&gt;
&lt;/article&gt;            </content>
        </entry>
            <entry>
            <title type="html">Installing FreeBSD on a PC Engines APU4C2</title>
            <author><name>John-Mark Gurney</name></author>
            <link href="/2019/08/installing-freebsd-on-pc-engines-apu4c2.html"/>
            <updated>2019-08-08T00:00:00Z</updated>
            <published>2019-08-08T00:00:00Z</published>
            <id>https://blogtest.funkthat.com/2019/08/installing-freebsd-on-pc-engines-apu4c2.html</id>
                        <category   scheme="https://blogtest.funkthat.comsearch/label"
                        term="FreeBSD"
                        label="Freebsd" />
            
            <content type="html">
                                &lt;article class=&#34;post&#34;&gt;

&lt;h1 id=&#34;installing-freebsd-on-pc-engines-apu4c2-title&#34;&gt;&lt;a class=&#34;no-tufte-underline&#34; href=&#34;/2019/08/installing-freebsd-on-pc-engines-apu4c2.html#installing-freebsd-on-pc-engines-apu4c2-title&#34;&gt;Installing FreeBSD on a &lt;span class=&#34;caps&#34;&gt;PC&lt;/span&gt; Engines &lt;span class=&#34;caps&#34;&gt;APU4C2&lt;/span&gt;&lt;/a&gt;&lt;/h1&gt;

&lt;p class=&#34;posted&#34;&gt;Posted: August  8, 2019 at 11:08 &lt;span class=&#34;caps&#34;&gt;PM&lt;/span&gt;&lt;/p&gt;

&lt;ul class=&#34;tags clear&#34;&gt;
&lt;li&gt;
    &lt;a class=&#34;small&#34; href=&#34;/search/label/FreeBSD.html&#34;&gt;&amp;nbsp;FreeBSD
    &lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class=&#34;clear&#34;&gt;&lt;/div&gt;
&lt;section&gt;
&lt;p&gt;I recently upgraded my internet connection, and needed some additional
performance, so I purchased a &lt;a href=&#34;https://www.pcengines.ch/apu4c2.htm&#34;&gt;&lt;span class=&#34;caps&#34;&gt;&lt;span class=&#34;caps&#34;&gt;APU&lt;/span&gt;&lt;/span&gt;.4C2&lt;/a&gt;.
When I tried to boot it up, I would get to loading the kernel, but then
I would not get&amp;nbsp;anything.&lt;/p&gt;
&lt;p&gt;After a quick search I found Dr. David A. Eckhardt’s post on
&lt;a href=&#34;https://www.cs.cmu.edu/~davide/howto/apu4c4.html&#34;&gt;How to Install FreeBSD 12.0 on a &lt;span class=&#34;caps&#34;&gt;&lt;span class=&#34;caps&#34;&gt;PC&lt;/span&gt;&lt;/span&gt; Engines apu2 Machine (apu4c4)&lt;/a&gt;.
The instructions require mounting the memstick image on a FreeBSD box,
but I don’t have one hand for mounting the image.  Once I knew what I
needed to do, I realized I didn’t need to mount the image to set the
options&amp;nbsp;needed.&lt;/p&gt;
&lt;p&gt;First on boot, I hit F10 so that I’d be presented with a boot menu.
Strictly this isn’t needed, but helped me time the next part.  I then
selected the &lt;span class=&#34;caps&#34;&gt;&lt;span class=&#34;caps&#34;&gt;USB&lt;/span&gt;&lt;/span&gt; drive that had the memstick image, and as soon as I
selected the image, I immediately started hitting space bar.  This
dropped me into the first stage boot&amp;nbsp;loader:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;Select boot device:

1. USB MSC Drive Generic STORAGE DEVICE 0566
2. ata0-0: SATA SSD ATA-11 Hard-Disk (15272 MiBytes)
3. Payload [memtest]
4. Payload [setup]

Booting from Hard Disk...
-
FreeBSD/x86 boot
Default: 0:ad(0,a)/boot/loader
boot:
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This is the point to enter in the line that would normally go into
&lt;code&gt;boot.conf&lt;/code&gt;: &lt;code&gt;-h -S115200 -v&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Once that is entered, this proceeded to the loader boot loader.  I
selected &lt;code&gt;3&lt;/code&gt; to escape to the loader prompt.  This allowed me to enter
some of the commands that would go into &lt;code&gt;loader.conf&lt;/code&gt;.  Note that the
commands w/ a &lt;code&gt;.&lt;/code&gt; in them need to be preceded w/ the &lt;code&gt;set&lt;/code&gt; command:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;Type &#39;?&#39; for a list of commands, &#39;help&#39; for more detailed help.
OK boot_serial=&#34;YES&#34;
OK console=&#34;comconsole&#34;
OK comconsole_speed=&#34;115200&#34; 
OK set kern.cam.boot_delay=&#34;15000&#34;
OK set kern.cam.scsi_delay=&#34;15000&#34;
OK set hw.igb.enable_msix=0
OK set hw.pci.enable_msix=0
OK set hint.ahci.0.msi=&#34;0&#34;
OK set hint.ahci.1.msi=&#34;0&#34;
OK boot
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;And as you can see, I finally booted the kernel using “&lt;code&gt;boot&lt;/code&gt;&lt;span class=&#34;dquo&#34;&gt;“&lt;/span&gt;.&lt;/p&gt;
&lt;p&gt;This started the install process and things proceeded as normal.  I
decided to use &lt;span class=&#34;caps&#34;&gt;&lt;span class=&#34;caps&#34;&gt;GPT&lt;/span&gt;&lt;/span&gt; instead of &lt;span class=&#34;caps&#34;&gt;&lt;span class=&#34;caps&#34;&gt;MBR&lt;/span&gt;&lt;/span&gt; for the partitioning scheme.  It is
not a big deal which one is picked.  I also did the recommended settings
so that upon reboot the above settings would keep.  I do plan on
attempting to flash the bios and see if I can’t get &lt;span class=&#34;caps&#34;&gt;&lt;span class=&#34;caps&#34;&gt;MSI&lt;/span&gt;&lt;/span&gt; and/or &lt;span class=&#34;caps&#34;&gt;&lt;span class=&#34;caps&#34;&gt;MSI&lt;/span&gt;&lt;/span&gt;-X
working, as that would be a huge advantage for&amp;nbsp;interrupts.&lt;/p&gt;
&lt;p&gt;One option for reducing &lt;span class=&#34;caps&#34;&gt;&lt;span class=&#34;caps&#34;&gt;CPU&lt;/span&gt;&lt;/span&gt; heat is to run powerd.  The powerd daemon
will monitor &lt;span class=&#34;caps&#34;&gt;&lt;span class=&#34;caps&#34;&gt;CPU&lt;/span&gt;&lt;/span&gt; usage, and dynamically adjust the frequency of the &lt;span class=&#34;caps&#34;&gt;&lt;span class=&#34;caps&#34;&gt;CPU&lt;/span&gt;&lt;/span&gt;
to match the current&amp;nbsp;load.&lt;/p&gt;&lt;/section&gt;
&lt;/article&gt;            </content>
        </entry>
            <entry>
            <title type="html">Using Signal on a server</title>
            <author><name>John-Mark Gurney</name></author>
            <link href="/2019/04/using-signal-on-server.html"/>
            <updated>2019-04-08T00:00:00Z</updated>
            <published>2019-04-08T00:00:00Z</published>
            <id>https://blogtest.funkthat.com/2019/04/using-signal-on-server.html</id>
                        <category   scheme="https://blogtest.funkthat.comsearch/label"
                        term="signal"
                        label="Signal" />
                        <category   scheme="https://blogtest.funkthat.comsearch/label"
                        term="security"
                        label="Security" />
            
            <content type="html">
                                &lt;article class=&#34;post&#34;&gt;

&lt;h1 id=&#34;using-signal-on-server-title&#34;&gt;&lt;a class=&#34;no-tufte-underline&#34; href=&#34;/2019/04/using-signal-on-server.html#using-signal-on-server-title&#34;&gt;Using Signal on a&amp;nbsp;server&lt;/a&gt;&lt;/h1&gt;

&lt;p class=&#34;posted&#34;&gt;Posted: April  8, 2019 at 1:54 &lt;span class=&#34;caps&#34;&gt;PM&lt;/span&gt;&lt;/p&gt;

&lt;ul class=&#34;tags clear&#34;&gt;
&lt;li&gt;
    &lt;a class=&#34;small&#34; href=&#34;/search/label/security.html&#34;&gt;&amp;nbsp;security
    &lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
    &lt;a class=&#34;small&#34; href=&#34;/search/label/signal.html&#34;&gt;&amp;nbsp;signal
    &lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class=&#34;clear&#34;&gt;&lt;/div&gt;
&lt;section&gt;
&lt;p&gt;For a long while, I’d been using an email to &lt;span class=&#34;caps&#34;&gt;&lt;span class=&#34;caps&#34;&gt;SMS&lt;/span&gt;&lt;/span&gt; gateway to push
important notifications from my server, such as &lt;span class=&#34;caps&#34;&gt;&lt;span class=&#34;caps&#34;&gt;SMART&lt;/span&gt;&lt;/span&gt; error messages,
to my phone.  After all the
&lt;a href=&#34;https://en.wikipedia.org/wiki/NSA_warrantless_surveillance_(2001%E2%80%932007)&#34;&gt;&lt;span class=&#34;caps&#34;&gt;&lt;span class=&#34;caps&#34;&gt;NSA&lt;/span&gt;&lt;/span&gt; warrantless surveillance&lt;/a&gt;,
I made a commitment to encrypt as much of my communications as possible.
When Signal came out, I adopted it because of it’s strong encryption and
privacy.  Ever since I’ve been wanting to use it for notifications from
my server.  I finally got around to trying out the &lt;span class=&#34;caps&#34;&gt;&lt;span class=&#34;caps&#34;&gt;CLI&lt;/span&gt;&lt;/span&gt; version, and got
it to&amp;nbsp;work.&lt;/p&gt;
&lt;p&gt;The installation of the command line utility for Signal was more straight
forward than I was expecting.  I decided to use
&lt;a href=&#34;https://github.com/AsamK/signal-cli&#34;&gt;signal-cli&lt;/a&gt; and I was a bit worried,
as it uses Java.  Java has historically been difficult to run on FreeBSD
due to lack of support and draconian licensing terms.  I was surprised
that the packages for OpenJDK 8 were both present and just worked on my
server.  A simple &lt;code&gt;pkg install openjdk8&lt;/code&gt; got Java up and&amp;nbsp;running.&lt;/p&gt;
&lt;p&gt;One thing to note is that the package said that fdesc and proc needed to
be mounted for Java to work, but I did not, and things still worked.
There are likely other parts of Java that may not work w/o those mounted,
but not for&amp;nbsp;Signal.&lt;/p&gt;
&lt;p&gt;As I have been using &lt;span class=&#34;caps&#34;&gt;&lt;span class=&#34;caps&#34;&gt;OSS&lt;/span&gt;&lt;/span&gt; for a long time, I like to build things from
source, so I followed the instructions at
&lt;a href=&#34;https://github.com/AsamK/signal-cli#building&#34;&gt;Building signal-cli&lt;/a&gt; and
got the command built with out any&amp;nbsp;trouble.&lt;/p&gt;
&lt;p&gt;Once the command was built, the
&lt;a href=&#34;https://github.com/AsamK/signal-cli#usage&#34;&gt;Usage guide&lt;/a&gt; provided the
basics, but didn’t include instructions on how to verify the safety
numbers to ensure that the initial exchange was not MitM’d.  There is a
&lt;a href=&#34;https://github.com/AsamK/signal-cli/blob/master/man/signal-cli.1.adoc&#34;&gt;man page&lt;/a&gt;,
but it requires a2x and separate steps to build, but a little bit of
digging got me the necessary steps (also, it turns out that the adoc
format is a simple text&amp;nbsp;format).&lt;/p&gt;
&lt;p&gt;With a bit of searching, I found the &lt;code&gt;listIdentities&lt;/code&gt; and &lt;code&gt;verify&lt;/code&gt;
commands.  There may have been another way, but because I had sent a
test message, my phone was&amp;nbsp;listed:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;$ signal-cli -u +XXXXXXXXXXX listIdentities
+YYYYYYYYYYY: TRUSTED_UNVERIFIED Added: Sat Apr 06 18:43:15 PDT 2019 Fingerprint: ZZ ZZ ZZ ZZ ZZ ZZ ZZ ZZ ZZ ZZ ZZ ZZ ZZ ZZ ZZ ZZ ZZ ZZ ZZ ZZ ZZ ZZ ZZ ZZ ZZ ZZ ZZ ZZ ZZ ZZ ZZ ZZ ZZ  Safety Number: WWWWW WWWWW WWWWW WWWWW WWWWW WWWWW WWWWW WWWWW WWWWW WWWWW WWWWW WWWWW
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;And then I needed to use the &lt;code&gt;trust&lt;/code&gt; subcommand:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;$ signal-cli -u +XXXXXXXXXXX trust -v &#39;WWWWW WWWWW WWWWW WWWWW WWWWW WWWWW WWWWW WWWWW WWWWW WWWWW WWWWW WWWWW&#39; +YYYYYYYYYYY
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The hardest part of this was figuring out how to invoke the command upon
reception of an email.  I used an alias listed in &lt;code&gt;/etc/aliases&lt;/code&gt; to forward
the email to both the &lt;span class=&#34;caps&#34;&gt;&lt;span class=&#34;caps&#34;&gt;SMS&lt;/span&gt;&lt;/span&gt; gateway and myself.  The issue with trying to
invoke the command from here was that the command was run as the &lt;code&gt;mailnull&lt;/code&gt;
user, which of course didn’t have access to my user’s home directory to
read the private key.  After a bit of debating, I remembered I use
&lt;code&gt;procmail&lt;/code&gt;, and realized this was the best way to send the&amp;nbsp;message.&lt;/p&gt;
&lt;p&gt;I created a symlink for the command into my user’s bin directory, created
a short script called &lt;code&gt;sendcell&lt;/code&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;$ cat ~/bin/sendcell
#!/bin/sh -

~user/bin/signal-cli -u +XXXXXXXXXXX send +YYYYYYYYYYY
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;and then added a filter to my &lt;code&gt;.procmailrc&lt;/code&gt; file.  The filter at first
looked like&amp;nbsp;this:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;:0Wf
* ^TO_celluser@([^@\.]*\.)*example.com
| sendcell
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;But after the first test, it included all the headers, including all the
&lt;code&gt;Received&lt;/code&gt; headers, so I updated it to use &lt;code&gt;formail&lt;/code&gt; to remove all but the
&lt;code&gt;From&lt;/code&gt;, &lt;code&gt;Subject&lt;/code&gt; and &lt;code&gt;Date&lt;/code&gt; (in case the message gets significantly delayed,
I can see by how much)&amp;nbsp;headers:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;:0c
* ^TO_celluser@([^@\.]*\.)*example.com
{
:0Wf
| formail -k -X From: -X Subject: -X Date:

:0
| sendcell
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;and now I get the messages delivered to my phone&amp;nbsp;securely!&lt;/p&gt;
&lt;p&gt;It is tempting to use this to be able to invoke commands on my server
remotely, but there isn’t much I need to do when I don’t have my laptop
with&amp;nbsp;me.&lt;/p&gt;&lt;/section&gt;
&lt;/article&gt;            </content>
        </entry>
            <entry>
            <title type="html">Crash Dumps: Do I submit them?</title>
            <author><name>John-Mark Gurney</name></author>
            <link href="/2018/10/crash-dumps-do-i-submit-them.html"/>
            <updated>2018-10-23T00:00:00Z</updated>
            <published>2018-10-23T00:00:00Z</published>
            <id>https://blogtest.funkthat.com/2018/10/crash-dumps-do-i-submit-them.html</id>
                        <category   scheme="https://blogtest.funkthat.comsearch/label"
                        term="security"
                        label="Security" />
            
            <content type="html">
                                &lt;article class=&#34;post&#34;&gt;

&lt;h1 id=&#34;crash-dumps-do-i-submit-them-title&#34;&gt;&lt;a class=&#34;no-tufte-underline&#34; href=&#34;/2018/10/crash-dumps-do-i-submit-them.html#crash-dumps-do-i-submit-them-title&#34;&gt;Crash Dumps: Do I submit&amp;nbsp;them?&lt;/a&gt;&lt;/h1&gt;

&lt;p class=&#34;posted&#34;&gt;Posted: October 23, 2018 at 3:54 &lt;span class=&#34;caps&#34;&gt;PM&lt;/span&gt;&lt;/p&gt;

&lt;ul class=&#34;tags clear&#34;&gt;
&lt;li&gt;
    &lt;a class=&#34;small&#34; href=&#34;/search/label/security.html&#34;&gt;&amp;nbsp;security
    &lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class=&#34;clear&#34;&gt;&lt;/div&gt;
&lt;section&gt;
&lt;p&gt;&lt;span class=&#34;caps&#34;&gt;&lt;span class=&#34;caps&#34;&gt;TL&lt;/span&gt;&lt;/span&gt;;&lt;span class=&#34;caps&#34;&gt;&lt;span class=&#34;caps&#34;&gt;DR&lt;/span&gt;&lt;/span&gt;: No, do not submit your crash dumps.  Consumers: No company has
sane crash dump policies to ensure your privacy and &lt;span class=&#34;caps&#34;&gt;&lt;span class=&#34;caps&#34;&gt;PII&lt;/span&gt;&lt;/span&gt; is protected,
minimized and secured.  Companies: You need to ensure that crash dumps
are handled in a secure manner and that crash dumps are just that: a
crash dump. Anything not directly related to a crash dump should be
excluded. Usage statistics and the like do not belong in crash&amp;nbsp;reports.&lt;/p&gt;
&lt;h2 id=&#34;why-not-send-dumps&#34;&gt;Why Not Send Dumps?&lt;a class=&#34;headerlink&#34; href=&#34;/2018/10/crash-dumps-do-i-submit-them.html#why-not-send-dumps&#34; title=&#34;Permanent link&#34;&gt;¶&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;There is a long history of companies failing to minimize the data and
to protect it.  Microsoft for years sent crash dumps over the internet
in the clear
(&lt;a href=&#34;https://en.wikipedia.org/wiki/Windows_Error_Reporting#Privacy_concerns_and_use_by_the_NSA&#34;&gt;&lt;span class=&#34;caps&#34;&gt;&lt;span class=&#34;caps&#34;&gt;WER&lt;/span&gt;&lt;/span&gt; &lt;span class=&#34;amp&#34;&gt;&amp;amp;&lt;/span&gt; Privacy conerns&lt;/a&gt;).
This allowed the &lt;span class=&#34;caps&#34;&gt;&lt;span class=&#34;caps&#34;&gt;NSA&lt;/span&gt;&lt;/span&gt; to harvest them, and develop 0-days for issues that
&lt;span class=&#34;caps&#34;&gt;&lt;span class=&#34;caps&#34;&gt;MS&lt;/span&gt;&lt;/span&gt; failed to fix.  Google’s Chrome would send a screencap of the entire
Desktop along with it’s crash dumps
(&lt;a href=&#34;https://twitter.com/vmjulix/status/857482886097715200&#34;&gt;link&lt;/a&gt;).  It
previously would only send the window, but now sends the entire screen.
Though they provide a preview, there is no way to see exactly what
information will be&amp;nbsp;sent.&lt;/p&gt;
&lt;p&gt;I do not relish in advising people to not submit crash dumps as this
will impact developers ability to fix bugs.  But as with all aspects of
security, companies continue to demonstrate that they are not willing
to do the work that is necessary to protect user’s data and their&amp;nbsp;privacy.&lt;/p&gt;
&lt;h2 id=&#34;communication&#34;&gt;Communication&lt;a class=&#34;headerlink&#34; href=&#34;/2018/10/crash-dumps-do-i-submit-them.html#communication&#34; title=&#34;Permanent link&#34;&gt;¶&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;You need to communicate to your users how crash dumps are handled.  Just
saying, trust us, does not inspire confidence, as there are a large
number of cases of data breaches where the company has said exactly that
leading up to leaks.  The policy is the first step to demonstrating that
you have thought about user’s concerns and decided how you will handle
their personal and sensitive&amp;nbsp;data.&lt;/p&gt;
&lt;p&gt;The policy also helps shape how employees will treat the data too.  By
having the policy, it is a reiteration to the employees that user data
isn’t simply chaff, but that it needs to be protected and handled with&amp;nbsp;care.&lt;/p&gt;
&lt;p&gt;Just saying that it’s protected by a privacy policy isn’t enough.  For
example, Google Chrome’s Report an Issue says that the information is
protected by their privacy policy, but if you read the Chrome browser
Privacy Policy, there is nothing in there that says how the data is
handled.  That it is handled like the rest of the data collected does
not inspire confidence that the possibly confidential data that may be
included will be handled with greater&amp;nbsp;care.&lt;/p&gt;
&lt;h2 id=&#34;how-to-handle-dumps&#34;&gt;How to handle dumps&lt;a class=&#34;headerlink&#34; href=&#34;/2018/10/crash-dumps-do-i-submit-them.html#how-to-handle-dumps&#34; title=&#34;Permanent link&#34;&gt;¶&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;The first step is to ensure that what is collected in the dump has
minimum information needed to debug issues.  Code paths (back traces)
are likely to be safe.  Data, such as arguments to functions, may include
user data and needs to be carefully examined.  There are many different
types of data that can be released from embarrassing (what website was
visited), to security breach (including cookies/tokens for web sites
that may not be yours), to confidential intellectual property leaking
(source code, designs, etc).  Each of these may have different impact on
the user, but should never&amp;nbsp;happen.&lt;/p&gt;
&lt;p&gt;Second, crash dumps need to be transmitted confidentially.  This means
either using &lt;span class=&#34;caps&#34;&gt;&lt;span class=&#34;caps&#34;&gt;TLS&lt;/span&gt;&lt;/span&gt; or encrypting the dumps with a tool like &lt;span class=&#34;caps&#34;&gt;&lt;span class=&#34;caps&#34;&gt;GPG&lt;/span&gt;&lt;/span&gt; before
sending.  This ensures that unauthorized parties are unable to view the
contents.  The &lt;span class=&#34;caps&#34;&gt;&lt;span class=&#34;caps&#34;&gt;NSA&lt;/span&gt;&lt;/span&gt; used the dumps to gather information for their
operations, which if Microsoft had properly protected their user’s data,
this would not have&amp;nbsp;happened.&lt;/p&gt;
&lt;p&gt;Third, they need to be stored in a secure manner and able to be
expunged.  It should even be possible for the user to remove the crash
dump if they discover that information was shared when it should not have
been.  The life time that a company keeps the dumps should be limited.
If you haven’t fixed a bug from five years ago, how do you know you can
reproduce it, or that if you are able to reproduce it, that the code is
still present in your current software?  It the crash is a major issue,
it is likely that you’ll have more recent dumps that exhibit the same
issue if it is a problem, so old dumps are just not as useful compared
to the data that may be&amp;nbsp;present.&lt;/p&gt;
&lt;p&gt;As crash data needs to be deleted, almost any cloud service is immediately
excluded unless other precautions are used, such as encryption.  With
the cloud, you have zero visibility into how the data is managed and how
or when it is backed up.  Cloud providers rarely tell you their retention
policies on back ups, and other policies that may keep data around.  Do
they securely remove your &lt;span class=&#34;caps&#34;&gt;&lt;span class=&#34;caps&#34;&gt;VM&lt;/span&gt;&lt;/span&gt;’s storage when they migrate it?  Do they
ensure that storage is deleted from all clones, shards, servers and
backups when you delete it?  If not, how long will that data stay around
before it is finally&amp;nbsp;expunged.&lt;/p&gt;
&lt;p&gt;Fourth, access to dumps need to be controlled.  Auditing is a good first
step to know who is accessing the data, but additional measures like
limiting who has access needs to be used.  Not everyone on the team needs
access to them.  As they are classified, they can be assigned to teams
or people that need access to the data in them.  This helps make sure
that an employee isn’t trolling for nudes or other confidential
information.  It should also limit how easy data is copied out of the
archive.  How these controls are put in place will vary by&amp;nbsp;company.&lt;/p&gt;
&lt;p&gt;Edit:  Case in point:  I recently opened a support case with Apple.
Apple provides a program to collect data to send to them to help trouble
shoot the issue.   The program collected 280 &lt;span class=&#34;caps&#34;&gt;&lt;span class=&#34;caps&#34;&gt;MB&lt;/span&gt;&lt;/span&gt; of data.  When uploading
the data, Apple informs the user that it is their responsibility to &lt;span class=&#34;caps&#34;&gt;&lt;span class=&#34;caps&#34;&gt;NOT&lt;/span&gt;&lt;/span&gt;
submit any personal information that they don’t want.  There is no way
most people are qualified to look at the data, and even redact it
properly.  I
&lt;a href=&#34;https://twitter.com/encthenet/status/1057445997373087744&#34;&gt;attempted to do so&lt;/a&gt;,
and it took a very long time, and I’m not sure that I got everything.
Expecting a normal computer user to be able to do this is&amp;nbsp;insane.&lt;/p&gt;&lt;/section&gt;
&lt;/article&gt;            </content>
        </entry>
            <entry>
            <title type="html">TLS Client Authentication Leaks User Info (pre-TLS1.3)</title>
            <author><name>John-Mark Gurney</name></author>
            <link href="/2018/10/tls-client-authentication-leaks-user.html"/>
            <updated>2018-10-15T00:00:00Z</updated>
            <published>2018-10-15T00:00:00Z</published>
            <id>https://blogtest.funkthat.com/2018/10/tls-client-authentication-leaks-user.html</id>
                        <category   scheme="https://blogtest.funkthat.comsearch/label"
                        term="TLS"
                        label="Tls" />
                        <category   scheme="https://blogtest.funkthat.comsearch/label"
                        term="security"
                        label="Security" />
            
            <content type="html">
                                &lt;article class=&#34;post&#34;&gt;

&lt;h1 id=&#34;tls-client-authentication-leaks-user-title&#34;&gt;&lt;a class=&#34;no-tufte-underline&#34; href=&#34;/2018/10/tls-client-authentication-leaks-user.html#tls-client-authentication-leaks-user-title&#34;&gt;&lt;span class=&#34;caps&#34;&gt;TLS&lt;/span&gt; Client Authentication Leaks User Info (pre-&lt;span class=&#34;caps&#34;&gt;TLS1&lt;/span&gt;.3)&lt;/a&gt;&lt;/h1&gt;

&lt;p class=&#34;posted&#34;&gt;Posted: October 15, 2018 at 10:54 &lt;span class=&#34;caps&#34;&gt;AM&lt;/span&gt;&lt;/p&gt;

&lt;ul class=&#34;tags clear&#34;&gt;
&lt;li&gt;
    &lt;a class=&#34;small&#34; href=&#34;/search/label/security.html&#34;&gt;&amp;nbsp;security
    &lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
    &lt;a class=&#34;small&#34; href=&#34;/search/label/TLS.html&#34;&gt;
        &lt;span class=&#34;caps&#34;&gt;TLS&lt;/span&gt;
    &lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class=&#34;clear&#34;&gt;&lt;/div&gt;
&lt;section&gt;
&lt;p&gt;It’s been long known that &lt;span class=&#34;caps&#34;&gt;&lt;span class=&#34;caps&#34;&gt;TLS&lt;/span&gt;&lt;/span&gt; is not the best privacy protecting
protocol in that &lt;span class=&#34;caps&#34;&gt;&lt;span class=&#34;caps&#34;&gt;SNI&lt;/span&gt;&lt;/span&gt; leaks what domain the client connects to.  I’m a
bit surprised that I haven’t seen the failure to protect user
information when using client authentication mentioned, but it’s likely
that &lt;span class=&#34;caps&#34;&gt;&lt;span class=&#34;caps&#34;&gt;TLS&lt;/span&gt;&lt;/span&gt; client authentication is so rarely used, that this have not
been on anyone’s&amp;nbsp;radar.&lt;/p&gt;
&lt;p&gt;&lt;span class=&#34;caps&#34;&gt;&lt;span class=&#34;caps&#34;&gt;TL&lt;/span&gt;&lt;/span&gt;;&lt;span class=&#34;caps&#34;&gt;&lt;span class=&#34;caps&#34;&gt;DR&lt;/span&gt;&lt;/span&gt;: Just don’t use &lt;span class=&#34;caps&#34;&gt;&lt;span class=&#34;caps&#34;&gt;TLS&lt;/span&gt;&lt;/span&gt; client authentication on anything before &lt;span class=&#34;caps&#34;&gt;&lt;span class=&#34;caps&#34;&gt;TLS&lt;/span&gt;&lt;/span&gt;&amp;nbsp;1.3.&lt;/p&gt;
&lt;p&gt;With &lt;span class=&#34;caps&#34;&gt;&lt;span class=&#34;caps&#34;&gt;TLS&lt;/span&gt;&lt;/span&gt; 1.2 and earlier, if you use client authentication, the client
certificate is transmitted in the clear.  This contains enough
information to uniquely identify the user.  If it didn’t, then there
would be no way for the server to do the&amp;nbsp;authentication.&lt;/p&gt;
&lt;p&gt;The danger of this is that Eve (eavesdroppers) on path will be able to
track your user’s (or your) connections, where they connect from, figure
out how much data they transfer between to/from your site and likely
profile their&amp;nbsp;usage.&lt;/p&gt;
&lt;p&gt;I was confident that this was the case as I know that the entire
handshake is in the clear.  It isn’t till the Finished messages that
the session becomes encrypted.  (&lt;span class=&#34;caps&#34;&gt;&lt;span class=&#34;caps&#34;&gt;TLS&lt;/span&gt;&lt;/span&gt; 1.3 fixed this by using a new
derived key, &lt;code&gt;[sender]_handshake_traffic_secret&lt;/code&gt;, to encrypt all the
server params, which the client will use to encrypt it’s response to
the certificate request in the server params.)  I decided to verify
that this was the&amp;nbsp;case.&lt;/p&gt;
&lt;p&gt;I generated a server and a client certificate and&amp;nbsp;key:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;openssl req -batch -new -newkey rsa:1024 -days 365 -nodes -x509 -keyout server.key -out server.crt
openssl req -batch -new -newkey rsa:1024 -days 365 -nodes -x509 -keyout client.key -out client.crt
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;I then launched the server, and included the &lt;code&gt;-Verify&lt;/code&gt; and &lt;code&gt;-CAfile&lt;/code&gt; options
for &lt;code&gt;s_server&lt;/code&gt; to request a client&amp;nbsp;certificate:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;openssl s_server -accept 5829 -cert server.crt -key server.key -Verify 5 -CAfile client.crt -debug
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Then I ran tcpdump to capture the&amp;nbsp;session:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;sudo tcpdump -s 0 -n -i lo0 -w clientcert.tcpdump port 5829
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;And then the client to connect to the&amp;nbsp;server:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;openssl s_client -connect localhost:5829 -key client.key -cert client.crt -debug
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;A usual, non-client authenticated connection and close was about 17
packets, but when I included the client authentication, it became 42
packets (the&amp;nbsp;answer!).&lt;/p&gt;
&lt;p&gt;I loaded the packet capture into wireshark, applied the &lt;span class=&#34;caps&#34;&gt;&lt;span class=&#34;caps&#34;&gt;SSL&lt;/span&gt;&lt;/span&gt; protocol
analysis and confirmed that the client certificate was present in clear
text:
&lt;a href=&#34;/media/images/tls.packet.capture.screenshot.png&#34;&gt;&lt;img alt=&#34;Wireshark shows TLS handshake with client authentication, with the client certificate displayed in plaintext.&#34; src=&#34;/media/images/tls.packet.capture.screenshot.png&#34;&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;So, there you have it.  Do not use client authentication, pre-&lt;span class=&#34;caps&#34;&gt;&lt;span class=&#34;caps&#34;&gt;TLS&lt;/span&gt;&lt;/span&gt; 1.3,
if you care about the privacy of your&amp;nbsp;users.&lt;/p&gt;
&lt;p&gt;It is safe to use client authentication w/ a &lt;span class=&#34;caps&#34;&gt;&lt;span class=&#34;caps&#34;&gt;TLS&lt;/span&gt;&lt;/span&gt; 1.3 server as long as
the server requires all clients be 1.3 clients.  If the key exchange
algorithm is one of DHE_DSA, DHE_RSA, or an &lt;span class=&#34;caps&#34;&gt;&lt;span class=&#34;caps&#34;&gt;ECDH&lt;/span&gt;&lt;/span&gt; key exchange algorithm,
the random bytes in the Hello messages are signed and these bytes are
used by &lt;span class=&#34;caps&#34;&gt;&lt;span class=&#34;caps&#34;&gt;TLS&lt;/span&gt;&lt;/span&gt; 1.3 for downgrade protection.  As the signature covers these
bytes, the client would be able to detect any attempts to modify the
server or client handshake messages to force a downgrade before it would
send the client&amp;nbsp;certificate.&lt;/p&gt;
&lt;p&gt;Thanks to Mike Hamburg for reviewing an earlier version of this blog
post and pointing out that &lt;span class=&#34;caps&#34;&gt;&lt;span class=&#34;caps&#34;&gt;TLS&lt;/span&gt;&lt;/span&gt; 1.3 was not vulnerable to this and
helping w/ some of the research to prove&amp;nbsp;it.&lt;/p&gt;
&lt;p&gt;References:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://tools.ietf.org/html/rfc5246#page-36&#34;&gt;&lt;span class=&#34;caps&#34;&gt;&lt;span class=&#34;caps&#34;&gt;TLS&lt;/span&gt;&lt;/span&gt; 1.2 Protocol&amp;nbsp;Diagram&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://tools.ietf.org/html/rfc5246#page-52&#34;&gt;&lt;span class=&#34;caps&#34;&gt;&lt;span class=&#34;caps&#34;&gt;TLS&lt;/span&gt;&lt;/span&gt; 1.2&amp;nbsp;ServerKeyExchange&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://tools.ietf.org/html/rfc4492#page-20&#34;&gt;&lt;span class=&#34;caps&#34;&gt;&lt;span class=&#34;caps&#34;&gt;ECC&lt;/span&gt;&lt;/span&gt; Cipher Suites for &lt;span class=&#34;caps&#34;&gt;&lt;span class=&#34;caps&#34;&gt;TLS&lt;/span&gt;&lt;/span&gt; ServerKeyExchange&amp;nbsp;Signature&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://tools.ietf.org/html/rfc8446#section-2&#34;&gt;&lt;span class=&#34;caps&#34;&gt;&lt;span class=&#34;caps&#34;&gt;TLS&lt;/span&gt;&lt;/span&gt; 1.3 Protocol&amp;nbsp;Diagram&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://tools.ietf.org/html/rfc8446#section-4.1.3&#34;&gt;&lt;span class=&#34;caps&#34;&gt;&lt;span class=&#34;caps&#34;&gt;TLS&lt;/span&gt;&lt;/span&gt; 1.3 Server Hello&lt;/a&gt; Downgrade&amp;nbsp;Protection&lt;/li&gt;
&lt;/ul&gt;&lt;/section&gt;
&lt;/article&gt;            </content>
        </entry>
            <entry>
            <title type="html">Making FreeBSD magnet links</title>
            <author><name>John-Mark Gurney</name></author>
            <link href="/2018/07/making-freebsd-magnet-links.html"/>
            <updated>2018-07-03T00:00:00Z</updated>
            <published>2018-07-03T00:00:00Z</published>
            <id>https://blogtest.funkthat.com/2018/07/making-freebsd-magnet-links.html</id>
                        <category   scheme="https://blogtest.funkthat.comsearch/label"
                        term="FreeBSD"
                        label="Freebsd" />
                        <category   scheme="https://blogtest.funkthat.comsearch/label"
                        term="magnet"
                        label="Magnet" />
            
            <content type="html">
                                &lt;article class=&#34;post&#34;&gt;

&lt;h1 id=&#34;making-freebsd-magnet-links-title&#34;&gt;&lt;a class=&#34;no-tufte-underline&#34; href=&#34;/2018/07/making-freebsd-magnet-links.html#making-freebsd-magnet-links-title&#34;&gt;Making FreeBSD magnet&amp;nbsp;links&lt;/a&gt;&lt;/h1&gt;

&lt;p class=&#34;posted&#34;&gt;Posted: July  3, 2018 at 4:49 &lt;span class=&#34;caps&#34;&gt;PM&lt;/span&gt;&lt;/p&gt;

&lt;ul class=&#34;tags clear&#34;&gt;
&lt;li&gt;
    &lt;a class=&#34;small&#34; href=&#34;/search/label/FreeBSD.html&#34;&gt;&amp;nbsp;FreeBSD
    &lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
    &lt;a class=&#34;small&#34; href=&#34;/search/label/magnet.html&#34;&gt;&amp;nbsp;magnet
    &lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class=&#34;clear&#34;&gt;&lt;/div&gt;
&lt;section&gt;
&lt;blockquote&gt;&lt;span style=&#34;font-size:2em&#34;&gt;⚠&lt;/span&gt;️ This post is old, the most up to date one is
&lt;a href=&#34;/2022/12/making-freebsd-magnet-links.html&#34;&gt;here&lt;/a&gt;.&lt;/blockquote&gt;

&lt;p&gt;For the last few years, I’ve been producing torrents and publishing
magnet links, but there is some special work that I do to make these.
The first few releases, I inserted a bogus tracker into the torrent,
because despite there being plenty of tools out there for producing
trackerless (&lt;span class=&#34;caps&#34;&gt;&lt;span class=&#34;caps&#34;&gt;DHT&lt;/span&gt;&lt;/span&gt;) torrents, they were all &lt;span class=&#34;caps&#34;&gt;&lt;span class=&#34;caps&#34;&gt;GUI&lt;/span&gt;&lt;/span&gt; and I never found any that
were command line based.  The other was there was/is no tool for
extracting the info hash and building the magnet link.  There may be
tools now, but I couldn’t find any when I started 3 years&amp;nbsp;ago.&lt;/p&gt;
&lt;p&gt;The following steps are based upon the recent release of FreeBSD 11.2‑R,
adjust as&amp;nbsp;necessary.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Fetch FreeBSD into a directory (I create a per release directory).  There
   are a few directories that you have mirror, I use wget for this.  The
   mirroring feature for wget isn’t great.  After each command I have to
   remove the &lt;code&gt;CHECKSUM.SHA256&lt;/code&gt;, &lt;code&gt;CHECKSUM.SHA512&lt;/code&gt; and &lt;code&gt;index.html*&lt;/code&gt; files.
   &lt;pre class=&#34;fullwidth&#34;&gt;&lt;code&gt;
   $ wget -c -r -l 1 -nd --limit-rate=800k https://download.freebsd.org/ftp/releases/ISO-IMAGES/11.2/
   $ wget -c -r -l 1 -nd --limit-rate=800k https://download.freebsd.org/ftp/releases/VM-IMAGES/11.2-RELEASE/aarch64/Latest/
   $ wget -c -r -l 1 -nd --limit-rate=800k https://download.freebsd.org/ftp/releases/VM-IMAGES/11.2-RELEASE/amd64/Latest/
   $ wget -c -r -l 1 -nd --limit-rate=800k https://download.freebsd.org/ftp/releases/VM-IMAGES/11.2-RELEASE/i386/Latest/
   &lt;/code&gt;&lt;/pre&gt;
&lt;/li&gt;&lt;li&gt;Fetch the signature files:
   &lt;pre class=&#34;fullwidth&#34;&gt;&lt;code&gt;
   $ wget https://www.freebsd.org/releases/11.2R/CHECKSUM.SHA512-FreeBSD-11.2-RELEASE-{amd64,i386,powerpc,powerpc-powerpc64,sparc64,arm64-aarch64}.asc
   $ wget https://www.freebsd.org/releases/11.2R/CHECKSUM.SHA512-FreeBSD-11.2-RELEASE-{amd64,i386,arm64-aarch64}-vm.asc
   $ wget https://www.freebsd.org/releases/11.2R/CHECKSUM.SHA512-FreeBSD-11.2-RELEASE-arm-armv6-{BANANAPI,BEAGLEBONE,CUBIEBOARD,CUBIEBOARD2,CUBBOX-HUMMINGBOARD,GUMSTIX,PANDABOARD,RPI-B,RPI2,WANDBOARD}.asc
   &lt;/code&gt;&lt;/pre&gt;
&lt;/li&gt;&lt;li&gt;Verify the &lt;span class=&#34;caps&#34;&gt;&lt;span class=&#34;caps&#34;&gt;GPG&lt;/span&gt;&lt;/span&gt; key that signed the above files.  This is usually Glen
   Barber’s key, but not always.  I have met and verified his fingerprint
   in person,  If you have verified someone’s key who has signed Glen’s
   key, that is another good&amp;nbsp;way.
&lt;/li&gt;&lt;li&gt;Verify the checksum files:
   &lt;pre class=&#34;fullwidth&#34;&gt;&lt;code&gt;
   $ for i in *.asc; do gpg --verify $i; done
   You should see a bunch of lines like:
   Warning: using insecure memory!
   gpg: Signature made Fri Jun 22 09:33:50 2018 PDT
   gpg:                using RSA key 0x031458A5478FE293
   gpg: Good signature from &#34;Glen Barber &amp;lt;gjb@FreeBSD.org&amp;gt;&#34; [full]
   gpg:                 aka &#34;Glen Barber &amp;lt;glen.j.barber@gmail.com&amp;gt;&#34; [full]
   gpg:                 aka &#34;Glen Barber &amp;lt;gjb@glenbarber.us&amp;gt;&#34; [full]
   gpg:                 aka &#34;Glen Barber &amp;lt;gjb@keybase.io&amp;gt;&#34; [unknown]
   gpg: WARNING: not a detached signature; file &#39;CHECKSUM.SHA512-FreeBSD-11.2-RELEASE-amd64-vm&#39; was NOT verified!
   &lt;/code&gt;&lt;/pre&gt;The last line can be ignored.  The non-&lt;code&gt;.asc&lt;/code&gt; files were d/l’d and will
   not be used.  Make sure that all of the files report &lt;code&gt;Good signature&lt;/code&gt;.
&lt;/li&gt;&lt;li&gt;In the past I have used BitTornado for other things, so I ended up
   using it as the basis to make the tool for creating trackerless torrent
   files.  The modifications were simple.  It appears that the original
   BitTornado &lt;span class=&#34;caps&#34;&gt;&lt;span class=&#34;caps&#34;&gt;CVS&lt;/span&gt;&lt;/span&gt; tree is off-line (anyways, it was served insecurely),
   but it looks like
   &lt;a href=&#34;https://github.com/effigies/BitTornado&#34;&gt;effigies/BitTornado&lt;/a&gt; is
   similar enough that it could be modified and used.  I copied
   &lt;code&gt;btmakemetafile.py&lt;/code&gt; to &lt;code&gt;btmaketrackerless.py&lt;/code&gt; and applied the following
   patch:
   &lt;pre class=&#34;fullwidth&#34;&gt;&lt;code&gt;
   $ diff -u btmakemetafile.py btmaketrackerless.py 
   --- btmakemetafile.py   2004-05-24 12:54:52.000000000 -0700
   +++ btmaketrackerless.py        2016-10-10 17:13:32.742081000 -0700
   @@ -23,9 +23,9 @@
    def prog(amount):
        print &#39;%.1f%% complete\r&#39; % (amount * 100),

   -if len(argv) &amp;lt; 3:
   +if len(argv) &amp;lt; 2:
        a,b = split(argv[0])
   -    print &#39;Usage: &#39; + b + &#39; &amp;lt;trackerurl&amp;gt; &amp;lt;file&amp;gt; [file...] [params...]&#39;
   +    print &#39;Usage: &#39; + b + &#39; &amp;lt;file&amp;gt; [file...] [params...]&#39;
        print
        print formatDefinitions(defaults, 80)
        print_announcelist_details()
   @@ -33,9 +33,9 @@
        exit(2)

    try:
   -    config, args = parseargs(argv[1:], defaults, 2, None)
   -    for file in args[1:]:
   -        make_meta_file(file, args[0], config, progress = prog)
   +    config, args = parseargs(argv[1:], defaults, 1, None)
   +    for file in args[0:]:
   +        make_meta_file(file, None, config, progress = prog)
    except ValueError, e:
        print &#39;error: &#39; + str(e)
        print &#39;run with no args for parameter explanations&#39;

   &lt;/code&gt;&lt;/pre&gt;
   If you notice, the only thing that is done is to drop the first argument,
   and instead of passing it into &lt;code&gt;make_meta_file&lt;/code&gt;, a &lt;code&gt;None&lt;/code&gt; is passed
   instead.  This will simply not add trackers to the torrent&amp;nbsp;file.
&lt;/li&gt;&lt;li&gt;I then run the following script to verify the downloaded files, and
   generate the torrent files:
   &lt;pre class=&#34;fullwidth&#34;&gt;&lt;code&gt;
   $ cat cmp.sh 
   #!/bin/sh -
   # wget -c -r -l 1 -nd --limit-rate=800k https://download.freebsd.org/ftp/releases/ISO-IMAGES/11.2/
   # wget -c -r -l 1 -nd --limit-rate=800k https://download.freebsd.org/ftp/releases/VM-IMAGES/11.2-RELEASE/aarch64/Latest/
   # wget -c -r -l 1 -nd --limit-rate=800k https://download.freebsd.org/ftp/releases/VM-IMAGES/11.2-RELEASE/amd64/Latest/
   # wget -c -r -l 1 -nd --limit-rate=800k https://download.freebsd.org/ftp/releases/VM-IMAGES/11.2-RELEASE/i386/Latest/
   # wget https://www.freebsd.org/releases/11.2R/CHECKSUM.SHA512-FreeBSD-11.2-RELEASE-{amd64,i386,powerpc,powerpc-powerpc64,sparc64,arm64-aarch64}.asc
   # wget https://www.freebsd.org/releases/11.2R/CHECKSUM.SHA512-FreeBSD-11.2-RELEASE-{amd64,i386,arm64-aarch64}-vm.asc
   # wget https://www.freebsd.org/releases/11.2R/CHECKSUM.SHA512-FreeBSD-11.2-RELEASE-arm-armv6-{BANANAPI,BEAGLEBONE,CUBIEBOARD,CUBIEBOARD2,CUBBOX-HUMMINGBOARD,GUMSTIX,PANDABOARD,RPI-B,RPI2,WANDBOARD}.asc

   grep -h &#39;^SHA512&#39; CHECK*.asc | sed -e &#39;s/SHA512 (\(.*\)) = \(.*\)/\2 \1/&#39; | sort -k 2 &amp;gt; sha512.from.asc

   while read hash fname; do
           if [ -e &#34;$fname&#34; ]; then
                   sigfile=`grep -l -- &#34;$fname&#34; *.asc | head -n 1`
                   echo checking &#34;$fname&#34;, sig in: &#34;$sigfile&#34;
                   #res=`sha512 -q &#34;$fname&#34;`
                   res=`shasum -a 512 &#34;$fname&#34; | awk &#39;{ print $1 }&#39;`
                   echo &#34;File is: $res&#34;
                   if [ x&#34;$res&#34; != x&#34;$hash&#34; ]; then
                           echo missmatch!  &#34;$fname&#34;
                           exit 1
                   fi
                   if ! [ -e &#34;$fname&#34;.torrent ]; then
                           btmaketrackerless.py &#34;$fname&#34;
                   fi
           else
                   echo missing &#34;$fname&#34;
                   exit 1
           fi
   done &amp;lt; sha512.from.asc
   &lt;/code&gt;&lt;/pre&gt;
&lt;/li&gt;&lt;li&gt;Once all the torrents have been generated, I then make the magnet
   links:
   &lt;pre class=&#34;fullwidth&#34;&gt;&lt;code&gt;
   $ cat btmakemagnet.sh 
   #!/bin/sh -

   # metainfo file.: FreeBSD-10.3-RELEASE-sparc64-bootonly.iso.torrent
   # info hash.....: 06091dabce1296d11d1758ffd071e7109a92934f
   # file name.....: FreeBSD-10.3-RELEASE-sparc64-bootonly.iso
   # file size.....: 203161600 (775 * 262144 + 0)
   # announce url..: udp://tracker.openbittorrent.com:80
   # btshowmetainfo 20030621 - decode BitTorrent metainfo files

   for i in *.torrent; do
           btshowmetainfo.py &#34;$i&#34; | awk &#39;
   $0 ~ &#34;^info hash&#34; { info = $3 }
   $0 ~ &#34;^file name&#34; { name = $3 }
   END {
           print &#34;magnet:?xt=urn:btih:&#34; info &#34;&amp;amp;dn=&#34; name
   }&#39;
   done
   &lt;/code&gt;&lt;/pre&gt;
&lt;/li&gt;&lt;li&gt;I then create the magnet links file, and update the
   &lt;a href=&#34;https://wiki.freebsd.org/Torrents&#34;&gt;Torrents&lt;/a&gt; wiki&amp;nbsp;page.
&lt;/li&gt;&lt;/ol&gt;

&lt;p&gt;&lt;s&gt;Sorry about the code formatting.  I don’t know how to make it look better
in blogger.&lt;/s&gt;&lt;label for=&#34;sn-blogger&#34; class=&#34;margin-toggle
sidenote-number&#34;&gt;&lt;/label&gt;&lt;input type=&#34;checkbox&#34; id=&#34;sn-blogger&#34; class=&#34;margin-toggle&#34;&gt;&lt;span class=&#34;sidenote&#34;&gt;This blog
no longer uses&amp;nbsp;blogger.&lt;/span&gt;&lt;/p&gt;&lt;/section&gt;
&lt;/article&gt;            </content>
        </entry>
            <entry>
            <title type="html">Unusable Insecurity</title>
            <author><name>John-Mark Gurney</name></author>
            <link href="/2018/03/unusable-insecurity.html"/>
            <updated>2018-03-16T00:00:00Z</updated>
            <published>2018-03-16T00:00:00Z</published>
            <id>https://blogtest.funkthat.com/2018/03/unusable-insecurity.html</id>
                        <category   scheme="https://blogtest.funkthat.comsearch/label"
                        term="security"
                        label="Security" />
            
            <content type="html">
                                &lt;article class=&#34;post&#34;&gt;

&lt;h1 id=&#34;unusable-insecurity-title&#34;&gt;&lt;a class=&#34;no-tufte-underline&#34; href=&#34;/2018/03/unusable-insecurity.html#unusable-insecurity-title&#34;&gt;Unusable&amp;nbsp;Insecurity&lt;/a&gt;&lt;/h1&gt;

&lt;p class=&#34;posted&#34;&gt;Posted: March 16, 2018 at 1:40 &lt;span class=&#34;caps&#34;&gt;PM&lt;/span&gt;&lt;/p&gt;

&lt;ul class=&#34;tags clear&#34;&gt;
&lt;li&gt;
    &lt;a class=&#34;small&#34; href=&#34;/search/label/security.html&#34;&gt;&amp;nbsp;security
    &lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class=&#34;clear&#34;&gt;&lt;/div&gt;
&lt;section&gt;
&lt;p&gt;Many people claim that security is hard, and in many cases it is hard,
but that isn’t an excuse to make it harder than it needs to be. There
are many layers to security, but adding extra layers, or making security
controls inscrutable is a great way to ensure insecurity. Security needs
to be simple and straightforward to configure, and easy to understand.
There may be knobs for advanced users, but defaults need to be simple and&amp;nbsp;correct.&lt;/p&gt;
&lt;p&gt;I recently looked at using S3 as a shared store for some data. I was
using the account New Context created for me that had limited &lt;span class=&#34;caps&#34;&gt;&lt;span class=&#34;caps&#34;&gt;AWS&lt;/span&gt;&lt;/span&gt;
permissions. Creating the S3 bucket was simple enough, and making it
not-public was too, but then I wanted to create a user/&lt;span class=&#34;caps&#34;&gt;&lt;span class=&#34;caps&#34;&gt;API&lt;/span&gt;&lt;/span&gt; key that only
had access to the S3 bucket. Per Amazon
&lt;a href=&#34;https://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html&#34;&gt;&lt;span class=&#34;caps&#34;&gt;&lt;span class=&#34;caps&#34;&gt;IAM&lt;/span&gt;&lt;/span&gt; Best Practices&lt;/a&gt;,
you should not share your account, but create new users for access. It
turns out that I did not have the CreateUser permission. I involved a
co-worker who did have permissions to create the user. Adding another
person to the task makes things more complex through communication and
their availability to work on it instead of their normal&amp;nbsp;work.&lt;/p&gt;
&lt;p&gt;As part of creating a user, you have to figure out what the Policy that
you need to assign to the user. Amazon provides some
&lt;a href=&#34;https://docs.aws.amazon.com/AmazonS3/latest/dev/example-bucket-policies.html&#34;&gt;Bucket Policy Examples&lt;/a&gt;,
but none of them is a simple policy on granting read and write permissions
to the bucket. There is an
&lt;a href=&#34;https://awspolicygen.s3.amazonaws.com/policygen.html&#34;&gt;Amazon Policy Generator&lt;/a&gt;
for helping you to create the policies, but it doesn’t allow you to
select buckets from your account (to simplify &lt;span class=&#34;caps&#34;&gt;&lt;span class=&#34;caps&#34;&gt;ARN&lt;/span&gt;&lt;/span&gt; [Amazon Resource Name]
selection), and there are almost 70 actions provided in the selector.
After some brief reading, I settled on a simple policy that I thought
would allow the new user proper access: 4 permissions: PutObjects,
GetObjects, ListObjects and&amp;nbsp;RestoreObjects.&lt;/p&gt;
&lt;p&gt;My co-worker created the user and applied the policy, but then I got an
error handle code. Amazon does not provide an interface for turning on
logging and/or querying why a request failed. Despite the error handle,
I had &lt;span class=&#34;caps&#34;&gt;&lt;span class=&#34;caps&#34;&gt;ZERO&lt;/span&gt;&lt;/span&gt; insight into why the request failed. I could have involved
&lt;span class=&#34;caps&#34;&gt;&lt;span class=&#34;caps&#34;&gt;AWS&lt;/span&gt;&lt;/span&gt; support, but now that would add yet another party in attempting to
properly configure&amp;nbsp;S3.&lt;/p&gt;
&lt;p&gt;At this stage, I decided to give up, as I had already spent a few hours
of my time, some of my co-worker’s time, and a couple weeks due to
various delays due to availability and other work. In this case, storing
the data in S3 was more of a nicety, and I decided that checking the
data into a private git repo was adequate compared to the complexities
involved in configuring S3. git was a tried and tested way to store data
and restrict access while S3 for this usage was not, and hard to&amp;nbsp;configure.&lt;/p&gt;
&lt;p&gt;After I wrote this blog post, a coworker linked me to the blog post titled
&lt;a href=&#34;https://aws.amazon.com/blogs/security/writing-iam-policies-how-to-grant-access-to-an-amazon-s3-bucket/&#34;&gt;Writing &lt;span class=&#34;caps&#34;&gt;&lt;span class=&#34;caps&#34;&gt;IAM&lt;/span&gt;&lt;/span&gt; Policies: How to Grant Access to an Amazon S3 Bucket&lt;/a&gt;.
It is concerning that this blog post has not been integrated, nor linked
to from any of the &lt;span class=&#34;caps&#34;&gt;&lt;span class=&#34;caps&#34;&gt;IAM&lt;/span&gt;&lt;/span&gt; or S3 documentation. This is a valuable resource
that should not be&amp;nbsp;hidden.&lt;/p&gt;
&lt;p&gt;I’m clearly not the only one that has had issues configuring S3 buckets.
The end of 2017 has shown a large number of organizations fail to
properly secure their S3 buckets, leaving many terabytes of data open
for public download. It is unacceptable that such a service is so
difficult to configure. The site
&lt;a href=&#34;https://s3stupidity.com/&#34;&gt;https://s3stupidity.com/&lt;/a&gt; lists the large
number of breaches, many of which are by large companies who should
have the technical chops (and $$) to properly configure&amp;nbsp;it.&lt;/p&gt;
&lt;p&gt;Security controls need to be simple and clear. Their descriptions need
to be accurate and concise in what they do, and how they do it. Amazon
does have a number of good resources, but they do not have a
comprehensive guide for what each permission does. You cannot blame
users for security failures when you make it next to impossible to
configure&amp;nbsp;properly.&lt;/p&gt;
&lt;p&gt;Edited to remove a couple extra&amp;nbsp;words.&lt;/p&gt;&lt;/section&gt;
&lt;/article&gt;            </content>
        </entry>
            <entry>
            <title type="html">Adventures in Autobahn/WAMP Security</title>
            <author><name>John-Mark Gurney</name></author>
            <link href="/2017/09/adventures-in-autobahnwamp-security.html"/>
            <updated>2017-09-17T00:00:00Z</updated>
            <published>2017-09-17T00:00:00Z</published>
            <id>https://blogtest.funkthat.com/2017/09/adventures-in-autobahnwamp-security.html</id>
                        <category   scheme="https://blogtest.funkthat.comsearch/label"
                        term="web"
                        label="Web" />
                        <category   scheme="https://blogtest.funkthat.comsearch/label"
                        term="WAMP"
                        label="Wamp" />
                        <category   scheme="https://blogtest.funkthat.comsearch/label"
                        term="security"
                        label="Security" />
            
            <content type="html">
                                &lt;article class=&#34;post&#34;&gt;

&lt;h1 id=&#34;adventures-in-autobahnwamp-security-title&#34;&gt;&lt;a class=&#34;no-tufte-underline&#34; href=&#34;/2017/09/adventures-in-autobahnwamp-security.html#adventures-in-autobahnwamp-security-title&#34;&gt;Adventures in Autobahn/&lt;span class=&#34;caps&#34;&gt;WAMP&lt;/span&gt;&amp;nbsp;Security&lt;/a&gt;&lt;/h1&gt;

&lt;p class=&#34;posted&#34;&gt;Posted: September 17, 2017 at 12:21 &lt;span class=&#34;caps&#34;&gt;PM&lt;/span&gt;&lt;/p&gt;

&lt;ul class=&#34;tags clear&#34;&gt;
&lt;li&gt;
    &lt;a class=&#34;small&#34; href=&#34;/search/label/security.html&#34;&gt;&amp;nbsp;security
    &lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
    &lt;a class=&#34;small&#34; href=&#34;/search/label/WAMP.html&#34;&gt;
        &lt;span class=&#34;caps&#34;&gt;WAMP&lt;/span&gt;
    &lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
    &lt;a class=&#34;small&#34; href=&#34;/search/label/web.html&#34;&gt;&amp;nbsp;web
    &lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class=&#34;clear&#34;&gt;&lt;/div&gt;
&lt;section&gt;
&lt;h2 id=&#34;or-how-security-continues-to-suck-because-its-hard-and-someone-elses-problemtm&#34;&gt;Or how security continues to suck because: It’s Hard and Someone Else’s Problem™&lt;a class=&#34;headerlink&#34; href=&#34;/2017/09/adventures-in-autobahnwamp-security.html#or-how-security-continues-to-suck-because-its-hard-and-someone-elses-problemtm&#34; title=&#34;Permanent link&#34;&gt;¶&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;For a personal project, I’ve decided to use &lt;span class=&#34;caps&#34;&gt;&lt;span class=&#34;caps&#34;&gt;WAMP&lt;/span&gt;&lt;/span&gt; to move some events and
messages around between different components.  I decided on the AutoBahn
libraries and Crossbar.io as the router.  I was already somewhat familiar
w/ AutoBahn from previous work, and the Crossbar.io router seems to just
work.  As a security person, I decided to evaluate how to make things as
secure as&amp;nbsp;possible.&lt;/p&gt;
&lt;p&gt;First off,
&lt;a href=&#34;https://twitter.com/encthenet/status/881596129573347328&#34;&gt;my projects must be both authenticated and encrypted&lt;/a&gt;.
&lt;span class=&#34;caps&#34;&gt;&lt;span class=&#34;caps&#34;&gt;WAMP&lt;/span&gt;&lt;/span&gt; does not appear to have it’s own encryption layer, but it does have
it’s own authentication layer.  You really don’t want to have to trust
two different authentication layers&lt;label for=&#34;sn-encauth&#34; class=&#34;margin-toggle sidenote-number&#34;&gt;&lt;/label&gt;&lt;input type=&#34;checkbox&#34; id=&#34;sn-encauth&#34; class=&#34;margin-toggle&#34;&gt;&lt;span class=&#34;sidenote&#34;&gt;The
encryption layer must be authenticated, otherwise
any attacker could MiTM the connection.  Most uses of &lt;span class=&#34;caps&#34;&gt;&lt;span class=&#34;caps&#34;&gt;TLS&lt;/span&gt;&lt;/span&gt; make use of
the &lt;span class=&#34;caps&#34;&gt;&lt;span class=&#34;caps&#34;&gt;CA&lt;/span&gt;&lt;/span&gt; system for authentication (which has serious issues in trust),
and most web apps add their own authentication layer on top of it (not
using Basic Auth, or other scheme).  The issues w/ this is that if there
is no binding between the two layers, the lower layer (application
layer) cannot be sure that the upper layer has not been compromised.&lt;/span&gt;,
so being able to use
&lt;a href=&#34;https://tools.ietf.org/html/rfc5929&#34;&gt;&lt;span class=&#34;caps&#34;&gt;&lt;span class=&#34;caps&#34;&gt;TLS&lt;/span&gt;&lt;/span&gt; Channel Bindings&lt;/a&gt; would be an
improvement.  This would ensure that a strong authentication method in
&lt;span class=&#34;caps&#34;&gt;&lt;span class=&#34;caps&#34;&gt;WAMP&lt;/span&gt;&lt;/span&gt; would ensure that the channel is properly encrypted.  I
&lt;a href=&#34;https://twitter.com/crossbario/status/904690145907142656&#34;&gt;received confirmation&lt;/a&gt;
from the Crossbar.io team that it was&amp;nbsp;present.&lt;/p&gt;
&lt;p&gt;Autobahn and Crossbar.io supports a number of
&lt;a href=&#34;https://crossbar.io/docs/Authentication/&#34;&gt;different authentication schemes&lt;/a&gt;.
As I plan on putting this behind a reverse proxy (which I realize will
have it’s own issues w/ channel binding), I wanted the strongest security
binding between my client and the server (and I’m a glutton for punishment
for using unproven tech).  The only one that satisfies this requirement
is &lt;span class=&#34;caps&#34;&gt;&lt;span class=&#34;caps&#34;&gt;WAMP&lt;/span&gt;&lt;/span&gt;-Cryptosign.&lt;/p&gt;
&lt;p&gt;After I got basic functionality working to make sure things would be
workable w/ this framework, I decided to start working on the
authentication piece.  First problem I ran into was that the AutoBahn|&lt;span class=&#34;caps&#34;&gt;&lt;span class=&#34;caps&#34;&gt;JS&lt;/span&gt;&lt;/span&gt;
library does not support &lt;span class=&#34;caps&#34;&gt;&lt;span class=&#34;caps&#34;&gt;TLS&lt;/span&gt;&lt;/span&gt; channel binding.  There is a good reason the
library doesn’t support it, and it’s for a very bad reason.  There is
no support in the browser &lt;a href=&#34;https://www.w3.org/TR/websockets/&#34;&gt;WebSocket &lt;span class=&#34;caps&#34;&gt;&lt;span class=&#34;caps&#34;&gt;API&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;
to query the channel binding information necessary.  The fact that
WebSockets was standardized after Channel bindings were demonstrates that
the people involved in standardizing the web do not take security
seriously.  As usual, they assume that security is not their problem and
leaves it up to someone else to solve (or at another&amp;nbsp;layer).&lt;/p&gt;
&lt;p&gt;Disappointed that I wouldn’t be able to use channel bindings w/ the web
client for this project (I still had the crappy &lt;span class=&#34;caps&#34;&gt;&lt;span class=&#34;caps&#34;&gt;CA&lt;/span&gt;&lt;/span&gt; authentication of &lt;span class=&#34;caps&#34;&gt;&lt;span class=&#34;caps&#34;&gt;TLS&lt;/span&gt;&lt;/span&gt;,
so not all was lost), I moved forward w/ CryptoSign.  As has been
demonstrated many times, the only way to get security baked in, is to
make it as easy as possible to use.  I’ve been long familiar w/
&lt;a href=&#34;https://nacl.cr.yp.to/box.html&#34;&gt;Crypto Box&lt;/a&gt; by djb (and used by the
Autobahn libraries), and also the &lt;a href=&#34;https://noiseprotocol.org/&#34;&gt;noise protocol&lt;/a&gt;
(which my friend Trevor created).  Both of these have goals of making
it simple to let developers include security in their projects and not
mess it up, resulting in a broken system.  As currently implemented,
Autobahn’s CryptoSign is most definitely not easy to&amp;nbsp;use.&lt;/p&gt;
&lt;p&gt;Though the documentation is decent, some examples are not present
(&lt;code&gt;client_ssh_key.py&lt;/code&gt; for example from
&lt;a href=&#34;https://github.com/crossbario/crossbar-examples/tree/master/authentication/cryptosign/static&#34;&gt;&lt;span class=&#34;caps&#34;&gt;&lt;span class=&#34;caps&#34;&gt;WAMP&lt;/span&gt;&lt;/span&gt;-cryptosign Static Authentication&lt;/a&gt;).
The
&lt;a href=&#34;https://autobahn.readthedocs.io/en/latest/wamp/programming.html#running-components&#34;&gt;ApplicationRunner&lt;/a&gt;
helper class does not document how to make use of authentication.  Though
the static authentication page has examples, they make you write quite
a bit of boiler&amp;nbsp;plate.&lt;/p&gt;
&lt;p&gt;Then even once you do that, you find out that the code doesn’t even work
on Python 2.7 and have to
&lt;a href=&#34;https://github.com/crossbario/autobahn-python/pull/901&#34;&gt;fix it&lt;/a&gt; for
them.  Hopefully the pull request (&lt;span class=&#34;caps&#34;&gt;&lt;span class=&#34;caps&#34;&gt;PR&lt;/span&gt;&lt;/span&gt;) will not be ignored because of the
failing &lt;span class=&#34;caps&#34;&gt;&lt;span class=&#34;caps&#34;&gt;CI&lt;/span&gt;&lt;/span&gt; tests, because the current &lt;span class=&#34;caps&#34;&gt;&lt;span class=&#34;caps&#34;&gt;CI&lt;/span&gt;&lt;/span&gt; tests are problems with their
&lt;span class=&#34;caps&#34;&gt;&lt;span class=&#34;caps&#34;&gt;CI&lt;/span&gt;&lt;/span&gt; environment, and not the &lt;span class=&#34;caps&#34;&gt;&lt;span class=&#34;caps&#34;&gt;PR&lt;/span&gt;&lt;/span&gt;.  For &lt;span class=&#34;caps&#34;&gt;&lt;span class=&#34;caps&#34;&gt;CI&lt;/span&gt;&lt;/span&gt; checks like this, it should only
ding your &lt;span class=&#34;caps&#34;&gt;&lt;span class=&#34;caps&#34;&gt;PR&lt;/span&gt;&lt;/span&gt; on checks that are newly failing, and ignore any checks that
were previously failing.  This isn’t the first project that their &lt;span class=&#34;caps&#34;&gt;&lt;span class=&#34;caps&#34;&gt;CI&lt;/span&gt;&lt;/span&gt;
environment was&amp;nbsp;broken.&lt;/p&gt;
&lt;p&gt;Even w/ the fixes in place, there is no documented method of extracting
a public key from a generated ssh key.  I will be adding a method to
print this&amp;nbsp;out.&lt;/p&gt;
&lt;p&gt;If I (who knows cryptography decently) have to fix and spend hours making
this work, it’s no wonder than everyone things that strong cryptography
is hard.  It is hard, but it shouldn’t&amp;nbsp;be.&lt;/p&gt;&lt;/section&gt;
&lt;/article&gt;            </content>
        </entry>
            <entry>
            <title type="html">Installing and running NetBSD and OpenBSD under bhyve</title>
            <author><name>John-Mark Gurney</name></author>
            <link href="/2015/07/installing-and-running-netbsd-and.html"/>
            <updated>2015-07-28T00:00:00Z</updated>
            <published>2015-07-28T00:00:00Z</published>
            <id>https://blogtest.funkthat.com/2015/07/installing-and-running-netbsd-and.html</id>
                        <category   scheme="https://blogtest.funkthat.comsearch/label"
                        term="NetBSD"
                        label="Netbsd" />
                        <category   scheme="https://blogtest.funkthat.comsearch/label"
                        term="OpenBSD"
                        label="Openbsd" />
                        <category   scheme="https://blogtest.funkthat.comsearch/label"
                        term="bhyve"
                        label="Bhyve" />
                        <category   scheme="https://blogtest.funkthat.comsearch/label"
                        term="FreeBSD"
                        label="Freebsd" />
            
            <content type="html">
                                &lt;article class=&#34;post&#34;&gt;

&lt;h1 id=&#34;installing-and-running-netbsd-and-title&#34;&gt;&lt;a class=&#34;no-tufte-underline&#34; href=&#34;/2015/07/installing-and-running-netbsd-and.html#installing-and-running-netbsd-and-title&#34;&gt;Installing and running NetBSD and OpenBSD under&amp;nbsp;bhyve&lt;/a&gt;&lt;/h1&gt;

&lt;p class=&#34;posted&#34;&gt;Posted: July 28, 2015 at 8:37 &lt;span class=&#34;caps&#34;&gt;PM&lt;/span&gt;&lt;/p&gt;

&lt;ul class=&#34;tags clear&#34;&gt;
&lt;li&gt;
    &lt;a class=&#34;small&#34; href=&#34;/search/label/bhyve.html&#34;&gt;&amp;nbsp;bhyve
    &lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
    &lt;a class=&#34;small&#34; href=&#34;/search/label/FreeBSD.html&#34;&gt;&amp;nbsp;FreeBSD
    &lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
    &lt;a class=&#34;small&#34; href=&#34;/search/label/NetBSD.html&#34;&gt;&amp;nbsp;NetBSD
    &lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
    &lt;a class=&#34;small&#34; href=&#34;/search/label/OpenBSD.html&#34;&gt;&amp;nbsp;OpenBSD
    &lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class=&#34;clear&#34;&gt;&lt;/div&gt;
&lt;section&gt;
&lt;p&gt;These instructions assume that you have downloaded the install &lt;span class=&#34;caps&#34;&gt;&lt;span class=&#34;caps&#34;&gt;ISO&lt;/span&gt;&lt;/span&gt; from
the respective sources.  These were doing with specific versions, and
there may be minor changes with older and newer&amp;nbsp;versions.&lt;/p&gt;
&lt;p&gt;These instructions could possibly be more simple, such as not using
separate device maps for &lt;code&gt;grub-bhyve&lt;/code&gt;.   These were testing on a month
old &lt;span class=&#34;caps&#34;&gt;&lt;span class=&#34;caps&#34;&gt;HEAD&lt;/span&gt;&lt;/span&gt;.&lt;/p&gt;
&lt;p&gt;There are other guides that cover most of this, and probably in more
detail.  The issue that I had was the exact commands to grub to load
kernels was not well documented.  Both of the images boot and are able
to get &lt;span class=&#34;caps&#34;&gt;&lt;span class=&#34;caps&#34;&gt;DHCP&lt;/span&gt;&lt;/span&gt; leases and pass basic&amp;nbsp;traffic.&lt;/p&gt;
&lt;p&gt;Hope this helps&amp;nbsp;others!&lt;/p&gt;
&lt;h2 id=&#34;netbsd&#34;&gt;NetBSD&lt;a class=&#34;headerlink&#34; href=&#34;/2015/07/installing-and-running-netbsd-and.html#netbsd&#34; title=&#34;Permanent link&#34;&gt;¶&lt;/a&gt;&lt;/h2&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Install &lt;code&gt;grub2-bhyve&lt;/code&gt;:
 &lt;br&gt;
&lt;/p&gt;&lt;pre class=&#34;fullwidth&#34;&gt;&lt;code&gt;
   pkg install grub2-bhyve
   &lt;/code&gt;&lt;/pre&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Create a file called &lt;code&gt;instdev.map&lt;/code&gt; containing:
 &lt;br&gt;
&lt;/p&gt;&lt;pre class=&#34;fullwidth&#34;&gt;&lt;code&gt;
   (cd0) NetBSD-6.1.5-amd64.iso
   (hd1) netbsd.img
   &lt;/code&gt;&lt;/pre&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Create the file &lt;code&gt;netbsd.img&lt;/code&gt; with the correct size:
 &lt;br&gt;
&lt;/p&gt;&lt;pre class=&#34;fullwidth&#34;&gt;&lt;code&gt;
   truncate -s 3g netbsd.img
   &lt;/code&gt;&lt;/pre&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Run the following commands (or put into a script file) under &lt;code&gt;sh&lt;/code&gt;:
 &lt;br&gt;
&lt;/p&gt;&lt;pre class=&#34;fullwidth&#34;&gt;&lt;code&gt;
   MEM=512M
   VM=nbsd615
   bhyvectl --destroy --vm=$VM
   grub-bhyve -r cd0 -M $MEM -m instdev.map $VM &amp;lt;&amp;lt;EOF
   knetbsd -h -r cd0a
   (cd0)/netbsdboot
   EOF
   bhyve -A -H -P -s 0:0,hostbridge -s 1:0,lpc \
       -s 2:0,virtio-net,tap3 -s 3:0,virtio-blk,./netbsd.img \
       -s 4:0,ahci-cd,./NetBSD-6.1.5-amd64.iso \
       -l com1,stdio -c 2 -m $MEM $VM
   &lt;/code&gt;&lt;/pre&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;This will run the installer, complete the&amp;nbsp;installation.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Create a file called &lt;code&gt;dev.map&lt;/code&gt; containing:
 &lt;br&gt;
&lt;/p&gt;&lt;pre class=&#34;fullwidth&#34;&gt;&lt;code&gt;
   (hd1) netbsd.img
   &lt;/code&gt;&lt;/pre&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Now in the future, to run NetBSD from the image, run the following commands:
 &lt;br&gt;
&lt;/p&gt;&lt;pre class=&#34;fullwidth&#34;&gt;&lt;code&gt;
   MEM=512M
   VM=nbsd615
   bhyvectl --destroy --vm=$VM
   grub-bhyve -r cd0 -M $MEM -m dev.map $VM &amp;lt;&amp;lt;EOF
   knetbsd -h -r ld0a
   (hd1,msdos1)/netbsdboot
   EOF
   bhyve -A -H -P -s 0:0,hostbridge -s 1:0,lpc \
       -s 2:0,virtio-net,tap3 -s 3:0,virtio-blk,./netbsd.img \
       -l com1,stdio -c 2 -m $MEM $VM
   &lt;/code&gt;&lt;/pre&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Profit!&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h2 id=&#34;openbsd&#34;&gt;OpenBSD&lt;a class=&#34;headerlink&#34; href=&#34;/2015/07/installing-and-running-netbsd-and.html#openbsd&#34; title=&#34;Permanent link&#34;&gt;¶&lt;/a&gt;&lt;/h2&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Install &lt;code&gt;grub2-bhyve&lt;/code&gt;:
 &lt;br&gt;
&lt;/p&gt;&lt;pre class=&#34;fullwidth&#34;&gt;&lt;code&gt;
   pkg install grub2-bhyve
   &lt;/code&gt;&lt;/pre&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Create a file called &lt;code&gt;instdev.map&lt;/code&gt; containing:
 &lt;br&gt;
&lt;/p&gt;&lt;pre class=&#34;fullwidth&#34;&gt;&lt;code&gt;
   (cd0) install57.iso
   (hd1) openbsd.img
   &lt;/code&gt;&lt;/pre&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Create the file &lt;code&gt;openbsd.img&lt;/code&gt; with the correct size:
 &lt;br&gt;
&lt;/p&gt;&lt;pre class=&#34;fullwidth&#34;&gt;&lt;code&gt;
   truncate -s 3g openbsd.img
   &lt;/code&gt;&lt;/pre&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Run the following commands (or put into a script file) under &lt;code&gt;sh&lt;/code&gt;:
 &lt;br&gt;
&lt;/p&gt;&lt;pre class=&#34;fullwidth&#34;&gt;&lt;code&gt;
   MEM=512M
   VM=obsd57
   bhyvectl --destroy --vm=$VM
   grub-bhyve -r cd0 -M $MEM -m instdev.map $VM &amp;lt;&amp;lt;EOF
   kopenbsd -h com0
   (cd0)/5.7/amd64/bsd.rdboot
   EOF
   bhyve -A -H -P -s 0:0,hostbridge -s 1:0,lpc \
       -s 2:0,virtio-net,tap3 -s 3:0,virtio-blk,./openbsd.img \
       -s 4:0,ahci-cd,./install57.iso \
       -l com1,stdio -c 2 -m $MEM $VM
   &lt;/code&gt;&lt;/pre&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;This will run the installer, complete the&amp;nbsp;installation.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Create a file called &lt;code&gt;dev.map&lt;/code&gt; containing:
 &lt;br&gt;
&lt;/p&gt;&lt;pre class=&#34;fullwidth&#34;&gt;&lt;code&gt;
   (hd1) netbsd.img
   &lt;/code&gt;&lt;/pre&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Now in the future, to run OpenBSD from the image, run the following commands:
 &lt;br&gt;
&lt;/p&gt;&lt;pre class=&#34;fullwidth&#34;&gt;&lt;code&gt;
   MEM=512M
   VM=obsd57
   bhyvectl --destroy --vm=$VM
   grub-bhyve -r hd1 -M $MEM -m dev.map $VM &amp;lt;&amp;lt;EOF
   kopenbsd -h com0 -r sd0a
   (hd1,openbsd1)/bsdboot
   EOF
   bhyve -A -H -P -s 0:0,hostbridge -s 1:0,lpc \
       -s 2:0,virtio-net,tap3 -s 3:0,virtio-blk,./openbsd.img \
       -s 4:0,ahci-cd,./install57.iso \
       -l com1,stdio -c 2 -m $MEM $VM
   &lt;/code&gt;&lt;/pre&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Profit!&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;&lt;/section&gt;
&lt;/article&gt;            </content>
        </entry>
            <entry>
            <title type="html">XML Schema Validation for the command line</title>
            <author><name>John-Mark Gurney</name></author>
            <link href="/2015/05/xml-schema-validation-for-command-line.html"/>
            <updated>2015-05-07T00:00:00Z</updated>
            <published>2015-05-07T00:00:00Z</published>
            <id>https://blogtest.funkthat.com/2015/05/xml-schema-validation-for-command-line.html</id>
                        <category   scheme="https://blogtest.funkthat.comsearch/label"
                        term="xml"
                        label="Xml" />
                        <category   scheme="https://blogtest.funkthat.comsearch/label"
                        term="schema"
                        label="Schema" />
            
            <content type="html">
                                &lt;article class=&#34;post&#34;&gt;

&lt;h1 id=&#34;xml-schema-validation-for-command-line-title&#34;&gt;&lt;a class=&#34;no-tufte-underline&#34; href=&#34;/2015/05/xml-schema-validation-for-command-line.html#xml-schema-validation-for-command-line-title&#34;&gt;&lt;span class=&#34;caps&#34;&gt;XML&lt;/span&gt; Schema Validation for the command&amp;nbsp;line&lt;/a&gt;&lt;/h1&gt;

&lt;p class=&#34;posted&#34;&gt;Posted: May  7, 2015 at 2:17 &lt;span class=&#34;caps&#34;&gt;PM&lt;/span&gt;&lt;/p&gt;

&lt;ul class=&#34;tags clear&#34;&gt;
&lt;li&gt;
    &lt;a class=&#34;small&#34; href=&#34;/search/label/schema.html&#34;&gt;&amp;nbsp;schema
    &lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
    &lt;a class=&#34;small&#34; href=&#34;/search/label/xml.html&#34;&gt;&amp;nbsp;xml
    &lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class=&#34;clear&#34;&gt;&lt;/div&gt;
&lt;section&gt;
&lt;p&gt;It turns out that unless you use a full fledge &lt;span class=&#34;caps&#34;&gt;&lt;span class=&#34;caps&#34;&gt;XML&lt;/span&gt;&lt;/span&gt; editor, validating
your &lt;span class=&#34;caps&#34;&gt;&lt;span class=&#34;caps&#34;&gt;XML&lt;/span&gt;&lt;/span&gt; document against a schema is difficult.  Most tools require you
to specify a single schema file.  If you have an &lt;span class=&#34;caps&#34;&gt;&lt;span class=&#34;caps&#34;&gt;XML&lt;/span&gt;&lt;/span&gt; document that
contains more than one name space this doesn’t work too well as often,
each name space is in a separate schema&amp;nbsp;file.&lt;/p&gt;
&lt;p&gt;The &lt;span class=&#34;caps&#34;&gt;&lt;span class=&#34;caps&#34;&gt;XML&lt;/span&gt;&lt;/span&gt; document has &lt;code&gt;xmlns&lt;/code&gt; attributes which use a &lt;span class=&#34;caps&#34;&gt;&lt;span class=&#34;caps&#34;&gt;URI&lt;/span&gt;&lt;/span&gt; as the identifier.
These URIs are for identifying it, and not a &lt;span class=&#34;caps&#34;&gt;&lt;span class=&#34;caps&#34;&gt;URL&lt;/span&gt;&lt;/span&gt;, so not able to be used.
In fact, different cases in the URIs specify different name spaces even
in the “host” part, though that is not the case with URLs.  In order for
validators to find the schema, the attribute
&lt;code&gt;&lt;a href=&#34;https://www.w3.org/TR/xmlschema-1/#schema-loc&#34;&gt;xsi:schemaLocation&lt;/a&gt;&lt;/code&gt; is
used to map the name space URIs to the URLs of the&amp;nbsp;schema.&lt;/p&gt;
&lt;p&gt;The &lt;code&gt;xsi:schemaLocation&lt;/code&gt; mapping is very simple.  It is simply a white
space delimited list of &lt;span class=&#34;caps&#34;&gt;&lt;span class=&#34;caps&#34;&gt;URI&lt;/span&gt;&lt;/span&gt;/&lt;span class=&#34;caps&#34;&gt;&lt;span class=&#34;caps&#34;&gt;URL&lt;/span&gt;&lt;/span&gt; pairs.  None of the command line tools
that I used uses this attribute to make the schema validation simple.
This includes &lt;a href=&#34;https://web.archive.org/web/20210415145100/http://xmlsoft.org/xmllint.html&#34;&gt;xmllint&lt;/a&gt;&lt;label for=&#34;sn-xmlintarchive&#34; class=&#34;margin-toggle sidenote-number&#34;&gt;&lt;/label&gt;
&lt;input type=&#34;checkbox&#34; id=&#34;sn-xmlintarchive&#34; class=&#34;margin-toggle&#34;&gt;&lt;span class=&#34;sidenote&#34;&gt;Via WayBack Machine as original link it http only.&lt;/span&gt;
which uses the libxml2 library.  I also tried to use the Java &lt;span class=&#34;caps&#34;&gt;&lt;span class=&#34;caps&#34;&gt;XML&lt;/span&gt;&lt;/span&gt; library
Xerces, but was unable to get it to work.  Xerces did not provide a
simple command line utility, and I couldn’t figure out the correct java
command line to invoke the validator&amp;nbsp;class.&lt;/p&gt;
&lt;p&gt;My coworker, &lt;a href=&#34;https://web.archive.org/web/20151012162546/http://fivetwentysix.com/&#34;&gt;Patrick&lt;/a&gt;&lt;label for=&#34;sn-526archive&#34; class=&#34;margin-toggle sidenote-number&#34;&gt;&lt;/label&gt;
&lt;input type=&#34;checkbox&#34; id=&#34;sn-526archive&#34; class=&#34;margin-toggle&#34;&gt;
&lt;span class=&#34;sidenote&#34;&gt;Via WayBack Machine as original link is now defunct.&lt;/span&gt;, found the blog entry,
&lt;a href=&#34;https://avinmathew.com/nokogiri-xml-schema-validation-with-multiple-schema-files/&#34;&gt;Nokogiri &lt;span class=&#34;caps&#34;&gt;&lt;span class=&#34;caps&#34;&gt;XML&lt;/span&gt;&lt;/span&gt; schema validation with multiple schema files&lt;/a&gt;,
which talks about using &lt;code&gt;xs:import&lt;/code&gt; to have a single schema file support
multiple name spaces.  With this, we realized that we could finally get
our &lt;span class=&#34;caps&#34;&gt;&lt;span class=&#34;caps&#34;&gt;XML&lt;/span&gt;&lt;/span&gt; document&amp;nbsp;verified.&lt;/p&gt;
&lt;p&gt;As I know shell scripting well, I decided to write a script to automate
creating a unified schema and validate a document.  The tools don’t cache
the schema documents, requiring fetching the schema each time you want
to validate the &lt;span class=&#34;caps&#34;&gt;&lt;span class=&#34;caps&#34;&gt;XML&lt;/span&gt;&lt;/span&gt; document.  We did attempt to write the schema files
to disk, and reuse those, &lt;em&gt;but&lt;/em&gt; there are issues in that some schemas
reference other resources in them.  If the schema is not retrieved from
the web, these internal resources are not retrieved also, causing errors
when validating some &lt;span class=&#34;caps&#34;&gt;&lt;span class=&#34;caps&#34;&gt;XML&lt;/span&gt;&lt;/span&gt;&amp;nbsp;documents.&lt;/p&gt;
&lt;p&gt;With a little bit of help from &lt;code&gt;xsltproc&lt;/code&gt; to extract xsi:schemaLocation,
it wasn’t to hard to generate the schema document and provide it to&amp;nbsp;xmllint.&lt;/p&gt;
&lt;p&gt;The code (&lt;a href=&#34;https://www.funkthat.com/~jmg/xmlval.sh&#34;&gt;xmlval.sh&lt;/a&gt;):&lt;/p&gt;
&lt;pre class=&#34;showlines&#34;&gt;&lt;code class=&#34;language-shell&#34;&gt;#!/bin/sh -

cat &amp;lt;&amp;lt;EOF |
&amp;lt;?xml version=&#34;1.0&#34;?&amp;gt;
&amp;lt;xsl:stylesheet version=&#34;1.0&#34;
    xmlns:xsl=&#34;http://www.w3.org/1999/XSL/Transform&#34;
    xmlns:xsi=&#34;http://www.w3.org/2001/XMLSchema-instance&#34;
&amp;gt;

 &amp;lt;xsl:output method=&#34;text&#34;/&amp;gt;
 &amp;lt;xsl:template match=&#34;/&#34;&amp;gt;
  &amp;lt;xsl:value-of select=&#34;/*/@xsi:schemaLocation&#34;/&amp;gt;
 &amp;lt;/xsl:template&amp;gt;

&amp;lt;/xsl:stylesheet&amp;gt;
EOF
    xsltproc - &#34;$1&#34; |
    sed -e &#39;s/ */\
/g&#39; |
    sed -e &#39;/^$/d&#39; |
    (echo &#39;&amp;lt;?xml version=&#34;1.0&#34; encoding=&#34;UTF-8&#34;?&amp;gt;&#39;
     echo &#39;&amp;lt;xs:schema xmlns:xs=&#34;http://www.w3.org/2001/XMLSchema&#34; xmlns:nospace=&#34;nospace&#34; targetNamespace=&#34;http://www.example.com/nospace&#34;&amp;gt;&#39;
     while :; do
        if ! read a; then
            break
        fi
        if ! read b; then
            break
        fi
        echo &#39;&amp;lt;xs:import namespace=&#34;&#39;&#34;$a&#34;&#39;&#34; schemaLocation=&#34;&#39;&#34;$b&#34;&#39;&#34;/&amp;gt;&#39;
    done
    echo &#39;&amp;lt;/xs:schema&amp;gt;&#39;) |
    xmllint --noout --schema - &#34;$1&#34;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Though the script looks complicated, it is a straight forward&amp;nbsp;pipeline:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Lines 3-16 provide the xslt document to &lt;code&gt;xsltproc&lt;/code&gt; on line 17 to
   extract schema location&amp;nbsp;attribute.&lt;/li&gt;
&lt;li&gt;Lines 18-20 replace multiple spaces with new lines and deletes any
   blank lines.  It should probably also handle tabs, but none of the
   documents that I have had tabs.  After this, we now have the odd
   lines containing the &lt;span class=&#34;caps&#34;&gt;&lt;span class=&#34;caps&#34;&gt;URI&lt;/span&gt;&lt;/span&gt; of the name space, and the even lines
   contain the &lt;span class=&#34;caps&#34;&gt;&lt;span class=&#34;caps&#34;&gt;URL&lt;/span&gt;&lt;/span&gt; for the&amp;nbsp;schema.&lt;/li&gt;
&lt;li&gt;Lines 21 and 22 are the header for the new schema&amp;nbsp;document.&lt;/li&gt;
&lt;li&gt;Lines 23-31 pulls in these line pairs and create the necessary
   &lt;code&gt;xs:import&lt;/code&gt; lines.&lt;/li&gt;
&lt;li&gt;Line 32 provides the closing element for the schema&amp;nbsp;document.&lt;/li&gt;
&lt;li&gt;Line 33 gives the schema document to xmllint for&amp;nbsp;validation.&lt;/li&gt;
&lt;/ol&gt;&lt;/section&gt;
&lt;/article&gt;            </content>
        </entry>
            <entry>
            <title type="html">Building bhyve Images using makefs and mkimg</title>
            <author><name>John-Mark Gurney</name></author>
            <link href="/2014/10/building-bhyve-images-using-makefs-and.html"/>
            <updated>2014-10-29T00:00:00Z</updated>
            <published>2014-10-29T00:00:00Z</published>
            <id>https://blogtest.funkthat.com/2014/10/building-bhyve-images-using-makefs-and.html</id>
                        <category   scheme="https://blogtest.funkthat.comsearch/label"
                        term="bhyve"
                        label="Bhyve" />
                        <category   scheme="https://blogtest.funkthat.comsearch/label"
                        term="FreeBSD"
                        label="Freebsd" />
            
            <content type="html">
                                &lt;article class=&#34;post&#34;&gt;

&lt;h1 id=&#34;building-bhyve-images-using-makefs-and-title&#34;&gt;&lt;a class=&#34;no-tufte-underline&#34; href=&#34;/2014/10/building-bhyve-images-using-makefs-and.html#building-bhyve-images-using-makefs-and-title&#34;&gt;Building bhyve Images using makefs and&amp;nbsp;mkimg&lt;/a&gt;&lt;/h1&gt;

&lt;p class=&#34;posted&#34;&gt;Posted: October 29, 2014 at 8:57 &lt;span class=&#34;caps&#34;&gt;PM&lt;/span&gt;&lt;/p&gt;

&lt;ul class=&#34;tags clear&#34;&gt;
&lt;li&gt;
    &lt;a class=&#34;small&#34; href=&#34;/search/label/bhyve.html&#34;&gt;&amp;nbsp;bhyve
    &lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
    &lt;a class=&#34;small&#34; href=&#34;/search/label/FreeBSD.html&#34;&gt;&amp;nbsp;FreeBSD
    &lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class=&#34;clear&#34;&gt;&lt;/div&gt;
&lt;section&gt;
&lt;p&gt;Recently Neel Natu &lt;a href=&#34;https://svnweb.freebsd.org/changeset/base/r273375&#34;&gt;committed&lt;/a&gt;
work to enable bhyve to run on &lt;span class=&#34;caps&#34;&gt;&lt;span class=&#34;caps&#34;&gt;AMD&lt;/span&gt;&lt;/span&gt; processors.  My main development
machine is an &lt;span class=&#34;caps&#34;&gt;&lt;span class=&#34;caps&#34;&gt;AMD&lt;/span&gt;&lt;/span&gt; A10-5700, so the commit enables me to use bhyve for&amp;nbsp;testing.&lt;/p&gt;
&lt;p&gt;&lt;span class=&#34;caps&#34;&gt;&lt;span class=&#34;caps&#34;&gt;EDIT&lt;/span&gt;&lt;/span&gt;: Anish Gupta did the work that Neel Natu committed.  Thanks&amp;nbsp;Anish!&lt;/p&gt;
&lt;p&gt;I had previously built images using &lt;code&gt;makefs&lt;/code&gt; and &lt;code&gt;mkimg&lt;/code&gt; for a &lt;span class=&#34;caps&#34;&gt;&lt;span class=&#34;caps&#34;&gt;CF&lt;/span&gt;&lt;/span&gt; card for
use in another machine, so being able to build images to use with bhyve
makes&amp;nbsp;sense.&lt;/p&gt;
&lt;p&gt;First, you need to make sure that you have a complete source check out
along with a completed buildworld and buildkernel.  Then follow these&amp;nbsp;steps:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Install world and distribution into a temporary directory using the &lt;code&gt;NO_ROOT&lt;/code&gt; option:
    &lt;pre class=&#34;fullwidth&#34;&gt;&lt;code&gt;
    make installworld DESTDIR=&amp;lt;tmpdir&amp;gt; -DDB_FROM_SRC -DNO_ROOT
    make distribution DESTDIR=&amp;lt;tmpdir&amp;gt; -DDB_FROM_SRC -DNO_ROOT
    &lt;/code&gt;&lt;/pre&gt;
    This preps everything with the defaults as&amp;nbsp;necessary.&lt;/li&gt;
&lt;li&gt;Install a kernel either into a different directory (I do this) or into the same directory above:
    &lt;pre class=&#34;fullwidth&#34;&gt;&lt;code&gt;
    make installkernel DESTDIR=&amp;lt;tmpkerndir&amp;gt; -DNO_ROOT KERNCONF=&amp;lt;conf&amp;gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;
&lt;li&gt;Make a directory with your custom configuration files.  The basics
    are &lt;code&gt;/etc/rc.conf&lt;/code&gt; and &lt;code&gt;/etc/fstab&lt;/code&gt; and you might want &lt;code&gt;/firstboot&lt;/code&gt; on
    there too.  You will also need a &lt;code&gt;METALOG&lt;/code&gt; file which contains the
    permissions for the files.  This is just a standard &lt;code&gt;mtree&lt;/code&gt; file, so
    you could use &lt;code&gt;mtree&lt;/code&gt; to generate this instead of creating it by hand.
    The file contents are&amp;nbsp;below.&lt;/li&gt;
&lt;li&gt;Build the ufs image using the &lt;code&gt;makeroot.sh&lt;/code&gt; script in the src tree at &lt;code&gt;tools/tools/makeroot/makeroot.sh&lt;/code&gt;:
    &lt;pre class=&#34;fullwidth&#34;&gt;&lt;code&gt;
    /usr/src/tools/tools/makeroot/makeroot.sh  -e &amp;lt;custdir&amp;gt;/METALOG -e &amp;lt;tmpkerndir&amp;gt;/METALOG -p &amp;lt;tmpdir&amp;gt;/etc/master.passwd -s 2g ufs.img root
    &lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;
&lt;li&gt;Build the disc image:
    &lt;pre class=&#34;fullwidth&#34;&gt;&lt;code&gt;
    mkimg -s gpt -b &amp;lt;tmpdir&amp;gt;/boot/pmbr -p freebsd-boot:=&amp;lt;tmpdir&amp;gt;/boot/gptboot -p freebsd-swap::1G -p freebsd-ufs:=ufs.img -o disc.img
    &lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;
&lt;li&gt;Run the image:
    &lt;pre class=&#34;fullwidth&#34;&gt;&lt;code&gt;
    sh /usr/share/examples/bhyve/vmrun.sh -d disc.img vm0
    &lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;There you have it.   Besides running the image, all the other steps can
be done as a normal user w/o root&amp;nbsp;access.&lt;/p&gt;
&lt;p&gt;&lt;span class=&#34;caps&#34;&gt;&lt;span class=&#34;caps&#34;&gt;EDIT&lt;/span&gt;&lt;/span&gt;: You also might want to include an &lt;code&gt;/entropy&lt;/code&gt; file (populated with 4k
from &lt;code&gt;/dev/random&lt;/code&gt;) in your custom directory so that the image has a good
seed for entropy at first boot for things such as sshd key&amp;nbsp;generation.&lt;/p&gt;
&lt;p&gt;File&amp;nbsp;contents:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;/etc/fstab&lt;/code&gt;:
&lt;br&gt;
&lt;/p&gt;&lt;pre class=&#34;fullwidth&#34;&gt;&lt;code&gt;
  /dev/vtbd0p3    /               ufs     rw              1 1
  &lt;/code&gt;&lt;/pre&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Custom &lt;code&gt;METALOG&lt;/code&gt;:
&lt;br&gt;
&lt;/p&gt;&lt;pre class=&#34;fullwidth&#34;&gt;&lt;code&gt;
  #mtree 2.0
  ./etc/rc.conf type=file uname=root gname=wheel mode=0644
  ./etc/fstab type=file uname=root gname=wheel mode=0644
  ./firstboot type=file uname=root gname=wheel mode=0644
  &lt;/code&gt;&lt;/pre&gt;

&lt;/li&gt;
&lt;/ul&gt;&lt;/section&gt;
&lt;/article&gt;            </content>
        </entry>
            <entry>
            <title type="html">Python ctypes wrapper for FLAC</title>
            <author><name>John-Mark Gurney</name></author>
            <link href="/2014/03/python-ctypes-wrapper-for-flac.html"/>
            <updated>2014-03-15T00:00:00Z</updated>
            <published>2014-03-15T00:00:00Z</published>
            <id>https://blogtest.funkthat.com/2014/03/python-ctypes-wrapper-for-flac.html</id>
                        <category   scheme="https://blogtest.funkthat.comsearch/label"
                        term="Python"
                        label="Python" />
                        <category   scheme="https://blogtest.funkthat.comsearch/label"
                        term="FLAC"
                        label="Flac" />
                        <category   scheme="https://blogtest.funkthat.comsearch/label"
                        term="audio"
                        label="Audio" />
            
            <content type="html">
                                &lt;article class=&#34;post&#34;&gt;

&lt;h1 id=&#34;python-ctypes-wrapper-for-flac-title&#34;&gt;&lt;a class=&#34;no-tufte-underline&#34; href=&#34;/2014/03/python-ctypes-wrapper-for-flac.html#python-ctypes-wrapper-for-flac-title&#34;&gt;Python ctypes wrapper for &lt;span class=&#34;caps&#34;&gt;FLAC&lt;/span&gt;&lt;/a&gt;&lt;/h1&gt;

&lt;p class=&#34;posted&#34;&gt;Posted: March 15, 2014 at 5:11 &lt;span class=&#34;caps&#34;&gt;PM&lt;/span&gt;&lt;/p&gt;

&lt;ul class=&#34;tags clear&#34;&gt;
&lt;li&gt;
    &lt;a class=&#34;small&#34; href=&#34;/search/label/audio.html&#34;&gt;&amp;nbsp;audio
    &lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
    &lt;a class=&#34;small&#34; href=&#34;/search/label/FLAC.html&#34;&gt;
        &lt;span class=&#34;caps&#34;&gt;FLAC&lt;/span&gt;
    &lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
    &lt;a class=&#34;small&#34; href=&#34;/search/label/Python.html&#34;&gt;&amp;nbsp;Python
    &lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class=&#34;clear&#34;&gt;&lt;/div&gt;
&lt;section&gt;
&lt;p&gt;As many people know, I’ve a fan of Python and I have been using it for
over 15 years&amp;nbsp;now.&lt;/p&gt;
&lt;p&gt;One of the recent improvements that Python has made is the inclusion of
ctypes, which allows you to write a wrapper around shared libraries in
Python making it much easier to integrate libraries.  Previously you’d
have to know the C Python &lt;span class=&#34;caps&#34;&gt;&lt;span class=&#34;caps&#34;&gt;API&lt;/span&gt;&lt;/span&gt; to get a module.  There was &lt;span class=&#34;caps&#34;&gt;&lt;span class=&#34;caps&#34;&gt;SWIG&lt;/span&gt;&lt;/span&gt;, but if
the library was complicated, it’d often not produce working code and even
if it did, you’d have to hand tweak the output to get it to work the way
you think it&amp;nbsp;should.&lt;/p&gt;
&lt;p&gt;One of the projects I’ve worked on is a UPnP media server.  One of the
features it has is the ability to decode a flac file and support seeking
with in the&amp;nbsp;file.&lt;/p&gt;
&lt;p&gt;I have now released a package of the code:
&lt;a href=&#34;https://www.funkthat.com/~jmg/releases/ctflac-1.0.tar.gz&#34;&gt;ctflac-1.0.tar.gz&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;The one issue w/ ctypes is that some code can be very slow in Python.
The &lt;span class=&#34;caps&#34;&gt;&lt;span class=&#34;caps&#34;&gt;FLAC&lt;/span&gt;&lt;/span&gt; library presents the sample data as arrays for each channel,
though most libraries interleave the channel data.  I have written a very
small library (that is optional) interleave.c that does this interleaving
in faster C code.  In my tests, using the C code results in about a third of the &lt;span class=&#34;caps&#34;&gt;&lt;span class=&#34;caps&#34;&gt;CPU&lt;/span&gt;&lt;/span&gt;&amp;nbsp;usage.&lt;/p&gt;
&lt;p&gt;Hope this is useful for&amp;nbsp;others!&lt;/p&gt;&lt;/section&gt;
&lt;/article&gt;            </content>
        </entry>
            <entry>
            <title type="html">CTF + ARMeb + debugging</title>
            <author><name>John-Mark Gurney</name></author>
            <link href="/2014/03/ctf-armeb-debugging.html"/>
            <updated>2014-03-05T00:00:00Z</updated>
            <published>2014-03-05T00:00:00Z</published>
            <id>https://blogtest.funkthat.com/2014/03/ctf-armeb-debugging.html</id>
                        <category   scheme="https://blogtest.funkthat.comsearch/label"
                        term="ctf"
                        label="Ctf" />
                        <category   scheme="https://blogtest.funkthat.comsearch/label"
                        term="debugging"
                        label="Debugging" />
                        <category   scheme="https://blogtest.funkthat.comsearch/label"
                        term="arm"
                        label="Arm" />
            
            <content type="html">
                                &lt;article class=&#34;post&#34;&gt;

&lt;h1 id=&#34;ctf-armeb-debugging-title&#34;&gt;&lt;a class=&#34;no-tufte-underline&#34; href=&#34;/2014/03/ctf-armeb-debugging.html#ctf-armeb-debugging-title&#34;&gt;&lt;span class=&#34;caps&#34;&gt;CTF&lt;/span&gt; + ARMeb +&amp;nbsp;debugging&lt;/a&gt;&lt;/h1&gt;

&lt;p class=&#34;posted&#34;&gt;Posted: March  5, 2014 at 7:21 &lt;span class=&#34;caps&#34;&gt;PM&lt;/span&gt;&lt;/p&gt;

&lt;ul class=&#34;tags clear&#34;&gt;
&lt;li&gt;
    &lt;a class=&#34;small&#34; href=&#34;/search/label/arm.html&#34;&gt;&amp;nbsp;arm
    &lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
    &lt;a class=&#34;small&#34; href=&#34;/search/label/ctf.html&#34;&gt;&amp;nbsp;ctf
    &lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
    &lt;a class=&#34;small&#34; href=&#34;/search/label/debugging.html&#34;&gt;&amp;nbsp;debugging
    &lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class=&#34;clear&#34;&gt;&lt;/div&gt;
&lt;section&gt;
&lt;p&gt;I’ve been working on making the &lt;span class=&#34;caps&#34;&gt;&lt;span class=&#34;caps&#34;&gt;AVILA&lt;/span&gt;&lt;/span&gt; board work again with FreeBSD.
Thanks to Jim from Netgate for sending me a board to do this&amp;nbsp;work.&lt;/p&gt;
&lt;p&gt;I still have a pending patch waiting to go through bde to fix an
unaligned off_t store which gets things farther, but with the patch I’m
getting a: &lt;code&gt;panic: vm_page_alloc: page 0xc0805db0 is wired&lt;/code&gt; shortly after
the machine launches the&amp;nbsp;daemons.&lt;/p&gt;
&lt;p&gt;I did work to get cross gdb working for armeb (committed in r261787 and
r261788), but that didn’t help as there is no kernel gdb support on
armeb.  As I’m doing this debugging over the network, I can’t dump a&amp;nbsp;core.&lt;/p&gt;
&lt;p&gt;I didn’t feel like hand decoding a &lt;code&gt;struct vm_page&lt;/code&gt;, so I thought of other
methods, and one way is to use &lt;span class=&#34;caps&#34;&gt;&lt;span class=&#34;caps&#34;&gt;CTF&lt;/span&gt;&lt;/span&gt; to parse the data type and decode the
data.  I know python and ctypes, so I decided to wrap libctf and see
what I could&amp;nbsp;do.&lt;/p&gt;
&lt;p&gt;Getting the initial python wrapper working was easy, but my initial test
data was the kernel on my amd64 box that I am developing on.  Now I
needed to use real armeb &lt;span class=&#34;caps&#34;&gt;&lt;span class=&#34;caps&#34;&gt;CTF&lt;/span&gt;&lt;/span&gt; data.  I point it to my kernel, and I get:
“&lt;code&gt;File uses more recent ELF version than libctf&lt;/code&gt;&lt;span class=&#34;dquo&#34;&gt;“&lt;/span&gt;.  Ok, extract the &lt;span class=&#34;caps&#34;&gt;&lt;span class=&#34;caps&#34;&gt;CTF&lt;/span&gt;&lt;/span&gt;
data from the kernel (ctf data is stored in a section named &lt;code&gt;.SUNW_ctf&lt;/code&gt;)
and work on that&amp;nbsp;directly:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;$ objcopy -O binary --set-section-flags optfiles=load,alloc -j .SUNW_ctf /tftpboot/kernel.avila.avila /dev/null
objcopy: /tftpboot/kernel.avila.avila: File format not recognized
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Well, ok, that’s not too surprising since it’s an &lt;span class=&#34;caps&#34;&gt;&lt;span class=&#34;caps&#34;&gt;ARMEB&lt;/span&gt;&lt;/span&gt; binary, lets&amp;nbsp;try:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;$ /usr/obj/arm.armeb/usr/src.avila/tmp/usr/bin/objcopy -O binary --set-section-flags optfiles=load,alloc -j .SUNW_ctf /tftpboot/kernel.avila.avila /tmp/test.avila.ctf     
$ ls -l /tmp/test.avila.ctf 
-rwxr-xr-x  1 jmg  wheel  0 Mar  5 17:59 /tmp/test.avila.ctf
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Hmm, that didn’t work too well, ok, lets just use dd to extract the data
using info from &lt;code&gt;objdump -x&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Ok, now that I’ve done that, I&amp;nbsp;get:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;ValueError: &#39;/tmp/avila.ctf&#39;: File is not in CTF or ELF format
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Hmm, why is that?  Well, it turns out that the endian of the &lt;span class=&#34;caps&#34;&gt;&lt;span class=&#34;caps&#34;&gt;CTF&lt;/span&gt;&lt;/span&gt; data
is wrong.  The magic is &lt;code&gt;cf f1&lt;/code&gt;, but the magic on amd64 is &lt;code&gt;f1 cf&lt;/code&gt;, it’s
endian swapped.  That’s annoying.  After spending some time trying to
build an cross shared version of libctf, I find that it has the same&amp;nbsp;issue.&lt;/p&gt;
&lt;p&gt;After a bit of looking around, I discover the &lt;span class=&#34;caps&#34;&gt;&lt;span class=&#34;caps&#34;&gt;CTF&lt;/span&gt;&lt;/span&gt; can only ever read
native endianness, but &lt;code&gt;ctfmerge&lt;/code&gt; has a magic option that will write out
endian swapped data if necessary depending upon the &lt;span class=&#34;caps&#34;&gt;&lt;span class=&#34;caps&#34;&gt;ELF&lt;/span&gt;&lt;/span&gt; file it’s
putting in.  This means that the &lt;span class=&#34;caps&#34;&gt;&lt;span class=&#34;caps&#34;&gt;CTF&lt;/span&gt;&lt;/span&gt; data in an armeb object file will
be different depending upon the endian you compiled it on, so the object
file isn’t cross compatible.  But, this does mean that the data in the
object files will be readable by libctf, just not the data written into
the&amp;nbsp;kernel.&lt;/p&gt;
&lt;p&gt;So, I create a sacrificial amd64&amp;nbsp;binary:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;$ echo &#39;int main() {}&#39; | cc -o /tmp/avila2.ctf -x c -
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;And use &lt;code&gt;ctfmerge&lt;/code&gt; to put the data in&amp;nbsp;it:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;$ ctfmerge -L fldkj -o /tmp/avila2.ctf /usr/obj/arm.armeb/usr/src.avila/sys/AVILA/*.o
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;and again use &lt;code&gt;dd&lt;/code&gt; to extract the &lt;code&gt;.SUNW_ctf&lt;/code&gt; section into a separate&amp;nbsp;file.&lt;/p&gt;
&lt;p&gt;With all this work, I finally have the &lt;span class=&#34;caps&#34;&gt;&lt;span class=&#34;caps&#34;&gt;CTF&lt;/span&gt;&lt;/span&gt; data in a format that libctf
can parse, so, I try to parse some data.  Now the interesting thing is
that the &lt;span class=&#34;caps&#34;&gt;&lt;span class=&#34;caps&#34;&gt;CTF&lt;/span&gt;&lt;/span&gt; data does encode sizes of integers, but it uses the native
arch’s pointer sizes for &lt;code&gt;CTF_K_POINTER&lt;/code&gt; types, which means that pointers
appear to be 8 bytes in size instead of the correct 4 bytes.  A little
more hacking on the ctf.py script to force all pointers to be 4 bytes,
and a little help to convert ddb output to a string and finally, I have
a dump of the &lt;code&gt;struct vm_page&lt;/code&gt; that I was trying to get all&amp;nbsp;along:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;{&#39;act_count&#39;: &#39;\x00&#39;,
 &#39;aflags&#39;: &#39;\x00&#39;,
 &#39;busy_lock&#39;: 1,
 &#39;dirty&#39;: &#39;\xff&#39;,
 &#39;flags&#39;: 0,
 &#39;hold_count&#39;: 0,
 &#39;listq&#39;: {&#39;tqe_next&#39;: 0xc0805e00, &#39;tqe_prev&#39;: 0xc06d18a0},
 &#39;md&#39;: {&#39;pv_kva&#39;: 3235856384,
        &#39;pv_list&#39;: {&#39;tqh_first&#39;: 0x0, &#39;tqh_last&#39;: 0xc0805de0},
        &#39;pv_memattr&#39;: &#39;\x00&#39;,
        &#39;pvh_attrs&#39;: 0},
 &#39;object&#39;: 0xc06d1878,
 &#39;oflags&#39;: &#39;\x04&#39;,
 &#39;order&#39;: &#39;\t&#39;,
 &#39;phys_addr&#39;: 17776640,
 &#39;pindex&#39;: 3572,
 &#39;plinks&#39;: {&#39;memguard&#39;: {&#39;p&#39;: 0, &#39;v&#39;: 3228376932},
            &#39;q&#39;: {&#39;tqe_next&#39;: 0x0, &#39;tqe_prev&#39;: 0xc06d1f64},
            &#39;s&#39;: {&#39;pv&#39;: 0xc06d1f64, &#39;ss&#39;: {&#39;sle_next&#39;: 0x0}}},
 &#39;pool&#39;: &#39;\x00&#39;,
 &#39;queue&#39;: &#39;\xff&#39;,
 &#39;segind&#39;: &#39;\x01&#39;,
 &#39;valid&#39;: &#39;\xff&#39;,
 &#39;wire_count&#39;: 1}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;So, the above was produced w/ the final &lt;a href=&#34;https://www.funkthat.com/~jmg/ctf.py&#34;&gt;ctf.py&lt;/a&gt;&amp;nbsp;script.&lt;/p&gt;&lt;/section&gt;
&lt;/article&gt;            </content>
        </entry>
    </feed>