<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet type="text/xsl" href="atom.xsl"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title>Colin Cogle's Blog</title>
	<subtitle>Taking a future-focused approach.</subtitle>
	<author>
		<name>Colin Cogle</name>
		<email>colin@colincogle.name</email>
		<uri>https://colincogle.name</uri>
	</author>
	<category term="technology"/>
	<category term="PowerShell"/>
	<category term="programming"/>
	<category term="sysadmin" label="System administration"/>
	<category term="ham radio"/>
	<category term="Connecticut"/>
	<generator>VSCodium</generator>
	<icon>https://colincogle.name/profile/headshot2023@120w.jpg</icon>
	<id>urn:uuid:9212aad0-6018-48c6-bb41-e0f19347bb22</id>
	<link rel="self" type="application/atom+xml" href="https://colincogle.name/blog/atom.xml"/>
	<link rel="alternate" type="text/html" href="https://colincogle.name/blog/"/>
	<link rel="alternate" type="text/gemini" href="gemini://colincogle.name/blog/"/>
	<link rel="alternate" type="application/gopher-menu" href="gopher://colincogle.name/1/blog/"/>
	<link rel="related" href="https://mastodon.colincogle.name/@colin"/>
	<link rel="license" href="https://creativecommons.org/licenses/by-sa/4.0/"/>
	<link rel="search" href="https://colincogle.name/opensearch.xml" type="application/opensearchdescription+xml" title="Search Colin Cogle's website"/>
	<logo>https://colincogle.name/blog/blog.jpg</logo>
	<rights>© 2009-2025 Colin Cogle.  Content is licensed under a Creative Commons Attribution-ShareAlike 4.0 International license, BY-SA.</rights>
	<updated>2025-12-28T02:25:00-05:00</updated>

	<entry>
		<title>All About ADIF</title>
		<id>urn:uuid:bf578917-69bf-4531-b185-b7e1da8bca1a</id>
		<link rel="alternate" length="40532" type="text/html" href="https://colincogle.name/blog/all-about-adif/"/>
		<link rel="alternate" length="16408" type="text/markdown" href="https://colincogle.name/blog/all-about-adif/all-about-adif.md"/>
		<link rel="alternate" length="16010" type="text/gemini" href="gemini://colincogle.name/blog/all-about-adif/"/>
		<link rel="alternate" length="17083" type="text/plain" href="https://colincogle.name/blog/all-about-adif/all-about-adif.txt"/>
		<!--link rel="alternate" length="" type="application/gopher-menu" href="gopher://colincogle.name/1/blog/all-about-adif/"/-->
		<link rel="shortlink" href="http://colincogle.name/adif"/>
		<summary>No man is an island.  Part of ham radio is keeping accurate logs, for your benefit and theirs. Learn how to log in the platform-agnostic ADIF format.</summary>
		<published>2025-12-28T00:04:00-05:00</published>
		<updated>2025-12-28T00:04:00-05:00</updated>
		<category term="ham radio"/>
		<category term="tutorials"/>
		<content type="xhtml">
			<div xmlns="http://www.w3.org/1999/xhtml">
				<figure>
					<picture style="max-width:1280px;aspect-ratio:10/7">
						<source type="image/avif" srcset="https://colincogle.name/blog/all-about-adif/paperlogs.avif"/>
						<source type="image/jxl" srcset="https://colincogle.name/blog/all-about-adif/paperlogs.jxl"/>
						<source type="image/webp" srcset="https://colincogle.name/blog/all-about-adif/paperlogs.webp"/>
						<source type="image/png" srcset="https://colincogle.name/blog/all-about-adif/paperlogs.png"/>
						<img src="https://colincogle.name/blog/all-about-adif/paperlogs.png" lowsrc="http://colincogle.name/blog/all-about-adif/paperlogs@lowsrc.jpg" alt="An AI-generated image of an elderly ham radio operator in a dimly-lit room.  He's surrounded by old radios and writing into several notebooks.  This demonstrates how things used to be." title="Generated by AI, but I promise that this is the only AI-generated thing on this page." longdesc="https://www.craiyon.com/en/image/obWWOrWgRfmkWCugQPl_FQ" style="max-width:1280px;aspect-ratio:10/7"/>
					</picture>
					<figcaption>
						This is how your grandfather logged contacts.  I'm sure your grandfather was pretty awesome, and there's many things you should probably do the way he did.  Logging is not one of them.  (This image was generated by <abbr title="artificial intelligence">AI</abbr>, unlike the text of this article.)
					</figcaption>
				</figure>
				<section id="sec1">
					<header><h2>No Man Is an Island</h2></header>
					<p>Before we start, let's go back almost three centuries before radio was invented.</p>
					<figure>
						<blockquote lang="en-emodeng" cite="https://en.wikipedia.org/wiki/Devotions_upon_Emergent_Occasions#:~:text=No%20man%20is%20an%20Iland,%20intire%20of%20it%20selfe;%20every%20man%20is%20a%20peece%20of%20the%20Continent,%20a%20part%20of%20the%20maine" title="No man is an island, entire of itself; every man is a piece of the continent, a part of the main.">
							No man is an Iland, intire of it selfe; every man is a peece of the Continent, a part of the maine[.]
						</blockquote>
						<figcaption>An excerpt from <cite>Devotions upon Emergent Occasions</cite> by John Donne, as originally written in <time>1624</time>.</figcaption>
					</figure>
					<p>
						Indeed no man is an island, as you'll quickly learn after getting your amateur radio license.  It's a rather boring hobby if you don't engage with anyone!  Inevitably, you will make contact with someone, whether it's something as simple as FM voice on the 2 meter band, chatting with someone on the Worldwide talkgroup on an Internet-linked DMR hotspot, banging out Morse code, or a microwave Earth-moon-Earth moonbounce that you've carefully-arranged over the course of several weeks.  Live in the moment and enjoy it!
					</p>
					<p>
						Afterwards, though, you should log your contact.  It's common courtesy.  Many awards are out there ready to be claimed, from simple ones like QRZ's World Radio Friendship all the way up to prestigious ones such as the <abbr title="American Radio Relay League">ARRL</abbr>'s DX Century Club.  All of these awards rely on <em>both</em> parties submitting accurate and identical logs, resulting in a confirmed contact.  Even if you think you have zero interest in awards or logging, the person on the other end of the airwaves might have just contacted a new country, province, state, county, or grid square; and your log may be exactly what they need to progress.  As someone who's made <em>unconfirmed</em> contacts with rare tiny islands, I can't begin to tell you how much the other party's lack of logging bothers me.  (Seriously, when's the next time I'll hear someone from Saint Barthelemy?)
					</p>
					<p>
						Accurate logging also satisfies the <abbr title="Federal Communications Commission">FCC</abbr>'s vague requirement that all U.S. amateur stations keep a log.  The chance of them coming calling is somewhere around zero (unless you're doing something dumb), but being able to hand over a proper electronic log would make the bureaucrats happy.
					</p>
					<p>
						<span>The Amateur Data Interchange Format (<dfn>ADIF</dfn>) is the standard format for general-purpose ham radio logging</span>, so that's what this article will cover.  If you take part in contests, you'll be asked to submit logs in the abbreviated Cabrillo format, but there are online tools to strip down ADIF and convert it to Cabrillo, so let's not worry about that.
					</p>
				</section>

				<section id="sec2">
					<header><h2>But What About Logging Software?</h2></header>
					<p>
						Computers have long since infiltrated ham radio, for the better (despite what some curmudgeons might say).  The days of a physical logbook are dead and gone;  there are many apps out there designed to do the hard work for you.  N1MM Logger+ seems to be popular for Windows machines.  <a href="https://polo.ham2k.com/" rel="external">Ham2K Portable Logger</a> lets you log on your iOS, iPadOS, or Android device on the go.  For digital modes, the ubiquitous <a href="https://wsjt.sourceforge.io/wsjtx.html" rel="external">WSJT-X</a> keeps accurate ADIF logs right out of the box.
					</p>
					<p>
						Or, you can skip an app entirely and just punch the details into the forms in <a href="https://www.arrl.org/tqsl-download" rel="external"><abbr title="TrustedQSL">TQSL</abbr></a>, <a href="https://hamlog.online" rel="external" aria-label="ham log">HAMLOG</a>, or <a href="https://logbook.qrz.com/" rel="external">QRZ's Logbook</a>.  By all means, if you find something you like, use it!  Congratulations, <em>you</em> have reached the end of this article.  Fire up your app and get on the air.
					</p>
					<p>
						However, some of us out there may feel the most comfortable with a plain text editor.  Maybe you find an app but it eventually becomes unmaintained, or <a href="https://endof10.org/" rel="external nofollow">you get sick of planned obsolesence and switch operating systems</a>.  Maybe you're like me and you believe in being in control of your own personal data, and want a vendor-neutral, interoperable, non-fungible log that you can upload or import into any site or app of your choosing.  Let's face it, if <a href="https://www.nbcconnecticut.com/news/local/newington-based-nonprofit-pays-ransom-cyberattack/3370323/" rel="external">even the <abbr title="American Radio Relay League">ARRL</abbr> can get hit with ransomware</a>, it's never wise to trust a website or cloud service with the only copy of your irreplacable data.
					</p>
					<p>
						In short, use a logging app or service if you want, but I'm still going to teach you how to write logs in the ADIF format.  You never know when knowing the format will come in handy.
					</p>
				</section>

				<section id="sec3">
					<header><h2>The Basics</h2></header>
					<p>
						The ADIF format is nothing more than a series of fields, value lengths, and values.  Your values contain the data about your QSO, and the field names add structure.  The fields and lengths are enclosed in less-than and greater-than signs.  If you've worked with HTML or XML before, this may start to make sense quickly (just forget about closing tags).
					</p>
					<p>
						There are two ways to represent ADIF, the more common HTML-like ADI version; and a newer, strictly-XML version called ADX.  We'll be studying the former, as it's vastly more popular.
					</p>
					<p>
						When working with the ADI representation, your values <em>have</em> to follow the field name, but aside from that, you can add as much whitespace as you want.  You can put a space before a field.  You can put no space between fields.  You can put an entire QSO onto one line like I normally do, but for illustrative purposes, I'll put one or two (or three) fields on a line.  ADIF <em>can</em> be read by human eyes, but it's meant to be machine-parsed, and computers don't care if it's pretty or compact.
					</p>
					<p>
						For example, here's a QSO I had with one of my friends not too long ago.  He was using a repeater, I was using a hotspot.
					</p>
					<figure>
						<code class="code adif">
							<span><span class="field">&lt;CALL<span class="colon">:</span><span class="length">6</span>&gt;</span>KC1NHE</span><br/>
							<span class="indent"><span class="field">&lt;QSO_DATE<span class="colon">:</span><span class="length">8</span>&gt;</span>20250503 <span class="field">&lt;QSO_DATE_OFF<span class="colon">:</span><span class="length">8</span>&gt;</span>20250503</span><br/>
							<span class="indent"><span class="field">&lt;TIME_ON<span class="colon">:</span><span class="length">6</span>&gt;</span>031400 <span class="field">&lt;TIME_OFF<span class="colon">:</span><span class="length">6</span>&gt;</span>031722</span><br/>
							<span class="indent"><span class="field">&lt;OPERATOR<span class="colon">:</span><span class="length">5</span>&gt;</span>W1DNS <span class="field">&lt;STATION_CALLSIGN<span class="colon">:</span><span class="length">5</span>&gt;</span>W1DNS</span><br/>
							<span class="indent"><span class="field">&lt;BAND<span class="colon">:</span><span class="length">4</span>&gt;</span>70cm <span class="field">&lt;FREQ<span class="colon">:</span><span class="length">8</span>&gt;</span>445.8625 <span class="field">&lt;FREQ_RX<span class="colon">:</span><span class="length">8</span>&gt;</span>440.8625</span><br/>
							<span class="indent"><span class="field">&lt;MODE<span class="colon">:</span><span class="length">12</span>&gt;</span>DIGITALVOICE <span class="field">&lt;SUBMODE<span class="colon">:</span><span class="length">3</span>&gt;</span>DMR</span><br/>
							<span class="indent"><span class="field">&lt;PROP_MODE<span class="colon">:</span><span class="length">8</span>&gt;</span>INTERNET</span><br/>
							<span class="indent"><span class="field">&lt;RST_RCVD<span class="colon">:</span><span class="length">2</span>&gt;</span>S7 <span class="field">&lt;RST_SENT<span class="colon">:</span><span class="length">5</span>&gt;</span>S9+28</span><br/>
							<span class="indent"><span class="field">&lt;MY_RIG<span class="colon">:</span><span class="length">24</span>&gt;</span>Anytone AT-D878UVII Plus <span class="field">&lt;MY_ANTENNA<span class="colon">:</span><span class="length">5</span>&gt;</span>Stock</span><br/>
							<span class="indent"><span class="field">&lt;EOR&gt;</span></span>
						</code>
						<figcaption>
							A quick QSO while I was helping my friend test his DMR radio.  He talked into a repeater.  I used my Internet-connected hotspot.
						</figcaption>
					</figure>
					<p>Let me review each line for you:</p>
					<ol>
						<li>In line 1, <span>the <dfn>CALL</dfn> field indicates the other party's call sign</span>.  Note the <b>:6</b> that indicates how long the value will be.  This is easily the worst part of writing ADIF by hand.  <b>CALL</b> is mandatory, which is good because you can't have a proper QSO with only one person.</li>
						<li>Here, I have the date of the QSO.  <span>The mandatory <dfn>QSO_DATE</dfn> field is the date when the QSO began (in the UTC time zone, like all dates and times in ADIF).</span>  I also have <span>the optional <dfn>QSL_DATE_OFF</dfn> field to denote when the QSO ended.</span>  As you can see, each date field is exactly eight characters long.</li>
						<li>Likewise, <span>the <dfn>TIME_ON</dfn> field indicates (in UTC) what time the QSO began</span> and <span>the optional <dfn>TIME_OFF</dfn> field shows when it ended.</span>  I included hours, minutes, and seconds because I could pull that from my hotspot's netwatch, but you're allowed to omit the seconds.</li>
						<li><span>The <dfn>STATION_CALLSIGN</dfn> field is your station's callsign</span> and <span>the <dfn>OPERATOR</dfn> field is your personal callsign.  These two will almost always be the same, unless you're operating a club station.</span></li>
						<li>Next, we have <span>the <dfn>BAND</dfn> field to show which band the QSO happened on</span>.  You may instead (or in addition) supply <span>the <dfn>FREQ</dfn> field, which shows the transmitting frequency (in megahertz).</span>  As this QSO was through my hotspot, I included <span>the <dfn>FREQ_RX</dfn> field to show that I'm receiving this on a different frequency.</span>  You need to supply either the <b>BAND</b> or <b>FREQ</b> fields.  There's nothing wrong with including both.</li>
						<li><span>The <dfn>MODE and SUBMODE</dfn> fields indicate which mode was used in the QSO.  You need to specify at least <b>MODE</b>.  You'll need to check <a href="https://adif.org/315/ADIF_315.htm#Mode_Enumeration">the full list of modes and submodes</a>, unfortunately.</span></li>
						<li><span>The propagation mode field, <dfn>PROP_MODE</dfn>, indicates how the QSO happened.</span>  Examples include meteor scatter, satellite, sporadic-E, EchoLink, or some other Internet mode.  Because it was raining, I stayed inside and used my Internet-connected DMR hotspot, so I'm putting <b>INTERNET</b> here.  Internet-enabled QSOs can't be uploaded to Logbook of the World, but hey, ADIF is about logging what really happened.</li>
						<li><span>The <dfn>RST_SENT and RST_RCVD</dfn> fields are used to report signal strength.</span>  You can put any value you want here, such as <b>599</b>, <b>sounded good to me</b>, the S-values I saw reported by my hotspot, or the WSJT-X <abbr title="decibel">dB</abbr> values.</li>
						<li><span>The <dfn>MY_RIG</dfn> field tells what kind of radio I used.</span>  <span>The <dfn>MY_ANTENNA</dfn> field describes my antenna.</span>  In this case, I'm using my trusty Anytone HT with the surprisingly-low-<abbr title="Standing Wave Ratio">SWR</abbr> rubber duck.</li>
						<li>Finally, the <dfn>EOR</dfn> tag is used to end your QSO record.  This is one of few fields in ADIF that does not get a length value, not even a zero length.</li>
					</ol>
					<p>
						There, now my QSO is logged!  Let's try something a little more traditional next.
					</p>
				</section>

				<section id="sec4">
					<header><h2>Example:  An FT8 Contact</h2></header>
					<p>
						Let's look at a contact I made while doing <a href="https://pota.app/#/park/US-1691">Parks on the Air at Lover's Leap State Park</a> in New Milford, Connecticut.
					</p>
					<figure>
						<code class="code adif nocount">
							<span class="field" title="Contacted station's callsign">&lt;CALL<span class="colon">:</span><span class="length">5</span>&gt;</span>AA2JL
							<span class="field" title="Contacted station's maidenhead grid square">&lt;GRIDSQUARE<span class="colon">:</span><span class="length">4</span>&gt;</span>EL98
							<span class="field" title="Mode used for the QSO">&lt;MODE<span class="colon">:</span><span class="length">3</span>&gt;</span>FT8
							<span class="field" title="My signal as reported by the contacted station">&lt;RST_SENT<span class="colon">:</span><span class="length">3</span>&gt;</span>-12
							<span class="field" title="The contacted station's signal as I reported">&lt;RST_RCVD<span class="colon">:</span><span class="length">3</span>&gt;</span>-07
							<span class="field" title="When the QSO started">&lt;QSO_DATE<span class="colon">:</span><span class="length">8</span>&gt;</span>20250331
							<span class="field" title="When the QSO started">&lt;TIME_ON<span class="colon">:</span><span class="length">6</span>&gt;</span>142915
							<span class="field" title="When the QSO ended">&lt;QSO_DATE_OFF<span class="colon">:</span><span class="length">8</span>&gt;</span>20250331
							<span class="field" title="When the QSO ended">&lt;TIME_OFF<span class="colon">:</span><span class="length">6</span>&gt;</span>143829
							<span class="field" title="The band we used">&lt;BAND<span class="colon">:</span><span class="length">3</span>&gt;</span>20m
							<span class="field" title="The frequency we used">&lt;FREQ<span class="colon">:</span><span class="length">9</span>&gt;</span>14.076600
							<span class="field" title="My station's callsign">&lt;STATION_CALLSIGN<span class="colon">:</span><span class="length">5</span>&gt;</span>W1DNS
							<span class="field" title="My grid square (very exact!)">&lt;MY_GRIDSQUARE<span class="colon">:</span><span class="length">8</span>&gt;</span>FN31hn00
							<span class="field" title="My transmission power">&lt;TX_PWR<span class="colon">:</span><span class="length">3</span>&gt;</span>100
							<span class="field" title="End of record">&lt;EOR&gt;</span>
						</code>
						<figcaption>This is what WSJT-X logs when you fill out most of the fields.  See if you can figure out what everything means!  (Mouse over them if you want a hint.)</figcaption>
					</figure>
					<p>
						However, I like to add some other fields before I upload my QSO to the various logging platforms.  You never know which fields they'll show in their <abbr title="user interface">UI</abbr> now or in the future.  Plus, it makes your offline log more complete.  (Quick, how many lifetime QSOs have you had with South Dakota on 20 meters?  If your logs have all the fields, it's easier to search.)
					</p>
					<figure>
						<figcaption>
							This example omits the fields from the previous ADIF.  This is only what I'd add to the above, before the <code>&lt;EOR&gt;</code> field.
						</figcaption>
						<code class="code adif">
							<span><span class="field" title="A human-readable comment that I decided to provide.">&lt;COMMENT<span class="colon">:</span><span class="length">17</span>&gt;</span>POTA from US-1691</span><br/>
							<span><span class="field" title="Contacted station's CQ zone">&lt;CQZ<span class="colon">:</span><span class="length">1</span>&gt;</span>5 <span class="field" title="My CQ zone">&lt;MY_CQ_ZONE<span class="colon">:</span><span class="length">1</span>&gt;</span>5</span><br/>
							<span><span class="field" title="Contacted station's ITU zone">&lt;ITUZ<span class="colon">:</span><span class="length">1</span>&gt;</span>8 <span class="field" title="My ITU zone">&lt;MY_ITU_ZONE<span class="colon">:</span><span class="length">1</span>&gt;</span>8</span><br/>
							<span><span class="field" title="My latitude">&lt;MY_LAT<span class="colon">:</span><span class="length">11</span>&gt;</span>N041 32.593 <span class="field" title="My longitude">&lt;MY_LON<span class="colon">:</span><span class="length">11</span>&gt;</span>W073 24.512</span><br/>
							<span><span class="field" title="Contacted station's city">&lt;QTH<span class="colon">:</span><span class="length">8</span>&gt;</span>Clermont <span class="field" title="My city">&lt;MY_CITY<span class="colon">:</span><span class="length">11</span>&gt;</span>New Milford</span><br/>
							<span><span class="field" title="Contacted station's country, in &quot;state comma county&quot;">&lt;CNTY<span class="colon">:</span><span class="length">7</span>&gt;</span>FL,Lake <span class="field" title="My county, in the format &quot;state comma county&quot;">&lt;MY_CNTY<span class="colon">:</span><span class="length">13</span>&gt;</span>CT,Litchfield</span><br/>
							<span><span class="field" title="Contacted station's state or province">&lt;STATE<span class="colon">:</span><span class="length">2</span>&gt;</span>FL <span class="field" title="My state or province">&lt;MY_STATE<span class="colon">:</span><span class="length">2</span>&gt;</span>CT</span><br/>
							<span><span class="field" title="Contacted station's country">&lt;DXCC<span class="colon">:</span><span class="length">3</span>&gt;</span>291 <span class="field" title="My country">&lt;MY_DXCC<span class="colon">:</span><span class="length">3</span>&gt;</span>291</span><br/>
							<span><span class="field" title="My radio">&lt;MY_RIG<span class="colon">:</span><span class="length">12</span>&gt;</span>Yaesu FT-450</span><br/>
							<span><span class="field" title="My antenna">&lt;MY_ANTENNA<span class="colon">:</span><span class="length">11</span>&gt;</span>Abbree HF-3</span><br/>
							<span><span class="field" title="Was the QSO completed?">&lt;QSO_COMPLETE<span class="colon">:</span><span class="length">1</span>&gt;</span>Y</span><br/>
							<span><span class="field" title="Was the QSO unplanned?">&lt;QSO_RANDOM<span class="colon">:</span><span class="length">1</span>&gt;</span>Y</span><br/>
							<span><span class="field" title="My special interest group code;  Parks on the Air, in this case">&lt;MY_SIG<span class="colon">:</span><span class="length">4</span>&gt;</span>POTA</span><br/>
							<span><span class="field" title="My special interest group information;  in this case, the Parks on the Air code for Lovers Leap State Park.">&lt;MY_SIG_INFO<span class="colon">:</span><span class="length">7</span>&gt;</span>US-1691</span><br/>
							<span><span class="field" title="QSL card sent?">&lt;QSL_SENT<span class="colon">:</span><span class="length">1</span>&gt;</span>Y <span class="field" title="How was the QSL card sent? (D for direct mailing, in this case.)">&lt;QSL_SENT_VIA<span class="colon">:</span><span class="length">1</span>&gt;</span>Y <span class="field" title="QSL card sent when?">&lt;QSLSDATE<span class="colon">:</span><span class="length">8</span>&gt;</span>20250404</span>
						</code>
						<figcaption>Some more fields that I might add to a QSO.  Some are me, and some are for the other party to enjoy.  Most online logbooks might not show all of these fields, but they will usually preserve what you send them.</figcaption>
					</figure>
					<p>That's a lot, so let's cover them:</p>
					<ol>
						<li>The <dfn>CQZ and MY_CQ_ZONE</dfn> fields show the other party's CQ zone and your CQ zone, respectively.  CQ zones are an arbitrary way to divide the world into contactable sections.  Collect them all to win the Worked All Zones award.</li>
						<li>The <dfn>ITUZ and MY_ITU_ZONE</dfn> fields show the other party's ITU zones and your ITU zone, respectively.  ITU zones are yet another way to split up the world.</li>
						<li>The <dfn>MY_LAT and MY_LON</dfn> fields may be used to show your station's location.  You can be as exact or inexact as you want.  I was doing Parks on the Air, so I gave the exact GPS coordinates of my parking spot.  If you choose to include this, you need to use the silly <code>DDDD MM.MMM</code> format.</li>
						<li>The <dfn>QTH and MY_CITY</dfn> fields identify their and your city/town/village, respectively.  As with all of these pairs of their/my fields, the logging service won't pay much attention to how you describe the other station.  I only add them to the QSO because who knows what I'll do with this file in the future?</li>
						<li><span>The <dfn>CNTY and MY_CNTY</dfn> fields represent their and your county.  Not all countries have counties, but ARRL and QRZ have awards if you contact enough United States counties.</span>  (Yes, Connecticut still reports counties, even if the state government abolished county government in 1960 as a small-government measure, and switched to planning regions in 2024.)  I believe counties in the United Kingdom and Ireland use a different field.</li>
						<li>The <dfn>STATE and MY_STATE</dfn> fields have the abbreviation for your and their state or province.</li>
						<li><span>The <dfn>DXCC and MY_DXCC</dfn> fields indicate your and their country code, respectively, <a href="https://adif.org/315/ADIF_315.htm#DXCC_Entity_Code_Enumeration" rel="external">as defined by the ADIF specification</a>.</span></li>
						<li><b>MY_RIG</b> is your radio.  (Yes, there is a <b>RIG</b> field if you know what they're using.  Usually, they tell you on the QSL card.)</li>
						<li><b>MY_ANTENNA</b> describes your antenna.</li>
						<li>The <dfn>QSO_COMPLETE</dfn> field is a yes or no answer:  was the QSO fully completed?  In FT8 parlance, this is if you received their <code>RR73</code> or you sent or received a <code>73</code>.  Everything in FT8 should be completed, so I suppose this is more helpful for phone contacts that might get cut off due to interference or weird atmospheric effects.</li>
						<li>The <dfn>QSO_RANDOM</dfn> field is a yes or no answer:  did this QSO happen randomly?  FT8 is pretty random, but if you're my friend texting me for a radio check or if you're planning an <abbr title="Earth-moon-Earth">EME</abbr> microwave contact, this is a QSO that you were expecting.  Like most of these fields, it's optional;  a QSO is a QSO.</li>
						<li>Now, here's one that's actually important for Parks on the Air and other "OTA" programs.  <span>the <dfn>MY_SIG</dfn> field identifies some kind of special-interest group, such as <b>POTA</b> for Parks on the Air.</span>  (Likewise, if you're spotting someone doing POTA, whether you're at a park or not, you should put <code>&lt;SIG<span class="colon">:</span><span class="length">4</span>&gt;POTA</code> into your log.</li>
						<li>The <dfn>SIG_INFO and MY_SIG_INFO</dfn> expands on the above, adding more information to describe the specific thing you're doing.  In the case of Parks on the Air, I would supply the code(s) of the park(s) that I am currently at;  or, if I'm at home, I'll supply the other person's park code(s).  I know spotters don't need to upload their logs to Parks on the Air, so I just do this to be polite.  (Additionally, there are the <i>POTA_REF</i> and <i>MY_POTA_REF</i> fields for <abbr title="Parks on the Air">POTA</abbr> specifically.  I'm not sure which one is more "right", so I add them both.)</li>
						<li>You can also use ADIF logs to keep track of QSL cards that you send or receive.  <span>The <dfn>QSL_SENT</dfn> field tracks whether a card was sent, not sent, or is queued.</span>  <span>The <dfn>QSL_SENT_VIA</dfn> field lets you say if it was sent directly, via the bureau, or electronically.</span>  Finally, <span>the <dfn>QSLSDATE</dfn> field lets you specify when you sent the card.</span>  There are both defined and non-defined separate fields to keep track of received QSLs, sent and received electronic QSLs, Logbook of the World entries, QRZ logbook entries, and so on that you can explore to your heart's content.  In this case, I sent my contact a nice card after the fact.  I hope he sends me one back!</li>
					</ol>
				</section>

				<section>
					<header><h2>Log It!</h2></header>
					<p>
						<span>There are many more fields that are defined in <a href="https://adif.org.uk/adif" rel="external">the ADIF specification</a> (version 3.1.6 as of the time of this writing).  In addition, ADIF lets you use the <dfn>USERDEF</dfn> field to create your own fields as well.</span> Now that you have your logs not only created but chock full of wonderful entries, you're on your way to winning awards, helping others win awards, documenting your QSL's, or just plain keeping track of what you do in the hobby.
					</p>
					<p>
						It's worth noting that there are many defined and custom fields to keep track of whether your partner has logged the QSO as well.  Some examples include <i>LOTW_QSL_SENT</i> and <i>LOTW_QSL_RCVD</i> for Logbook of the World and <i>APP_QRZLOG_STATUS</i> for QRZ.com, to name a few.
					</p>
					<p>
						If anyone wants to practice logging, then I'll give you some practice myself!  <a href="https://www.qrz.com/db/W1DNS" rel="external me">Look for me, W1DNS.</a>  If we're close, bring your radios and we'll do some varied simplex QSO's on various bands and modes.  Otherwise, seek me out on the various Connecticut Brandmeister or <abbr title="New England Digital Emergency Communications Network">NEDECN</abbr> talkgroups.  We'll have a chat and then we'll make sure it all gets logged properly.
					</p>
				</section>
			</div>
		</content>
	</entry>

	<entry>
		<title>Putting a Dumb Weather Station on the Internet</title>
		<id>urn:uuid:5fe4bcb6-4a2f-4e7b-b146-314aa638260b</id>
		<link rel="alternate" length="27140" type="text/html" href="https://colincogle.name/blog/byo-weather-station/"/>
		<link rel="alternate" length="8749" type="text/markdown" href="https://colincogle.name/blog/byo-weather-station/byo-weather-station.md"/>
		<link rel="alternate" length="8590" type="text/gemini" href="gemini://colincogle.name/blog/byo-weather-station/"/>
		<link rel="alternate" length="8918" type="text/plain" href="https://colincogle.name/blog/byo-weather-station/byo-weather-station.txt"/>
		<!--link rel="alternate" length="" type="application/gopher-menu" href="gopher://colincogle.name/1/blog/byo-weather-station/"/-->
		<link rel="related" href="https://github.com/rhymeswithmogul/aprs-weather-submit/"/>
		<link rel="related" href="https://mastodon.colincogle.name/@weather"/>
		<link rel="shortlink" href="http://colincogle.name/weather"/>
		<summary>After all, why not?  Why shouldn't I put a dumb Temu weather station on the Internet?</summary>
		<published>2025-01-09T23:37:00-05:00</published>
		<updated>2025-01-10T09:12:00-05:00</updated>
		<category term="ham radio"/>
		<category term="hacking"/>
		<category term="tutorials"/>
		<content type="xhtml">
			<div xmlns="http://www.w3.org/1999/xhtml">
				<section>
					<header><h2>The Problem</h2></header>
					<p>
						Perhaps it's apartment life cramping my <abbr title="High Frequency">HF</abbr> style, but I've been into <abbr title="Automatic Packet Reporting System">APRS</abbr> ever since I got into ham radio.  It's an interesting way to share little bits of data with the world such as messages, positions, and weather information.
					</p>
					<p>
						As such, there are many commercial weather stations available that one can buy and hook up, and they will share their measurements via APRS, using either radio or the Internet (the latter is called <abbr title="Automatic Packet Reporting System - Internet Service">APRS-IS</abbr>).  I've seen some online, and they're great.  Some of them can measure temperature, humidity, precipiation, wind, radiation, light intensity, and more.  The major downside, though, is that these are expensive and cumbersome.
					</p>
					<p>
						There are few hobbies that really embrace the hacker ethos, and amateur radio is one of them.  It's the only service where the <abbr title="Federal Communications Commission">FCC</abbr> explicitly allows operators to build their own compliant equipment.
					</p>
					<figure>
						<picture class="webfeedsFeaturedVisual">
							<source srcset="https://colincogle.name/blog/byo-weather-station/bilbo.avif" type="image/avif"/>
							<source srcset="https://colincogle.name/blog/byo-weather-station/bilbo.webp" type="image/webp"/>
							<img src="https://colincogle.name/blog/byo-weather-station/bilbo.jpg" lowsrc="https://colincogle.name/blog/byo-weather-station/bilbo@lowsrc.jpg" alt="A meme featuring Bilbo Baggins from Peter Jackson's &quot;The Lord of the Rings: The Fellowship of the Ring&quot;, contemplating wearing The One Ring.  Text: &quot;After all, why not?  Why shouldn't I build my own ham radio equipment?&quot;" longdesc="https://knowyourmeme.com/memes/after-all-why-not-why-shouldnt-i-keep-it" loading="lazy" class="webfeedsFeaturedVisual"/>
						</picture>
						<figcaption>Time is money, and sometimes, you have more money than time.  This is not one of those cases.</figcaption>
					</figure>
				</section>

				<section>
					<header><h2>The Hardware</h2></header>
					<p>
						So, I picked up a nondescript wireless indoor/outdoor thermometer from Temu.  This is a barebones kit, lacking even a brand name, but it works very well.  A battery-powered transmitter goes outside, and a base station sits inside.  Like most things, this uses the 433 <abbr title="megahertz">MHz</abbr> band like many other consumer electronics.  After a simple pairing procedure that's no more complicated than pressing two buttons, the transmitter says, <q>It's 25 degrees outside,</q> and the base station shows that number on the screen.
					</p>
					<p>
						It's about as simple as it gets.  Being cheap, it's powered by alkaline batteries, transmits on a common frequency using a radio that was probably bought by the pallet, and does not encrypt the signal over the air.  We're going to use this to our advantage.
					</p>
					<figure>
						<picture>
							<source srcset="transmitter.avif" type="image/avif"/>
							<source srcset="transmitter.jxl" type="image/jxl"/>
							<source srcset="transmitter.webp" type="image/webp"/>
							<img src="transmitter.jpg" lowsrc="transmitter@lowsrc.jpg" alt="The outdoor transmitter to my weather station, snuggled up under the porch stairs.  Christmas lights are visible nearby." loading="lazy"/>
						</picture>
						<figcaption>No, the LED Christmas lights don't affect the temperature readings.</figcaption>
					</figure>
					<p>
						Years ago, I bought an RTL-<abbr title="Software Defined Radio">SDR</abbr> for no good reason.  First designed to let computers listen to <abbr title="Digital Video Broadcasting - Terrestrial">DVB-T</abbr> television signals, hackers quickly found out that this little <abbr title="Universal Serial Bus">USB</abbr> dongle can listen to just about any frequency.  The included antenna somewhat limits the product, but for what I need it for, it'll be perfect.
					</p>
					<p>
						I have my desktop computer near the window, so it can pick up the signals from the transmitter.  If you don't have that luxury, grab a Raspberry Pi or other single-board computer.  Connecting it to the Internet is left as an exercise to the reader.
					</p>
				</section>

				<section>
					<header><h2>The Parser</h2></header>
					<p>
						<a rel="external" href="https://github.com/merbanan/rtl_433">The <code>rtl_433</code> app</a> is an open-source decoder for signals on the 433 <abbr title="megahertz">MHz</abbr> band.  Once your SDR dongle is connected to your computer, you can simply run the <code>rtl_433</code> command-line app and watch for periodic broadcasts from your weather stations' transmitters.
					</p>
					<figure>
						<picture>
							<source srcset="https://colincogle.name/blog/byo-weather-station/rtl_433.jxl" type="image/jxl"/>
							<source srcset="https://colincogle.name/blog/byo-weather-station/rtl_433.webp" type="image/webp"/>
							<img src="https://colincogle.name/blog/byo-weather-station/rtl_433.png" lowsrc="https://colincogle.name/blog/byo-weather-station/rtl_433@lowsrc.png" alt="Terminal output of the rtl_433 command.  Aside from showing some noise level adjustments, there are a few lines of JSON data from various sensors in my neighborhood, including my weather station's transmitter." loading="lazy"/>
						</picture>
						<figcaption>It's not much to look at, but this step doesn't make things pretty.  That's happening later.</figcaption>
					</figure>
					<p>
						Once I got a feel for the data being transmitted, I messed around with command-line options until I got the output just the way I like it.
					</p>
					<figure>
						<code class="code bash nocount">
							<span>
								<span class="command">rtl_433</span>
								<span class="parameter" title="M for metadata">-M <span class="string">time:iso</span></span>
								<span class="parameter" title="M for metadata">-M <span class="string">protocol</span></span>
								<span class="parameter" title="M for metadata">-M <span class="string">level</span></span>
								<span class="parameter" title="C for conversion">-C <span class="string">customary</span></span>
								<span class="parameter" title="g for gain">-g <span class="number">0</span></span>
								<span class="parameter" title="Y for minimum level detection">-Y <span class="string">autolevel</span></span>
								<span class="parameter" title="M for metadata">-M <span class="string">noise</span></span>
								<span class="parameter" title="f for frequency">-f <span class="number" title="433.9 MHz">433.90M</span></span>
								<span class="parameter" title="F for output format">-F <span class="string">log</span></span>
								<span class="parameter" title="F for output format">-F <span class="string">syslog:127.0.0.1:42069</span></span>
								<span class="parameter" title="v, once, for a little more verbosity">-v</span>
							</span>
						</code>
						<figcaption>Of everything here, the most important options are the ones to emit sniffed data in the <abbr title="JavaScript Object Notation" aria-label="jason">JSON</abbr> format, and the option to send it to localhost on port 42069.  More on that later.</figcaption>
					</figure>
					<p>
						You can save this as a shell script and run it to build a daemon that will sniff your weather station's data and send it somewhere for processing.  In the next section, we'll build that somewhere.
					</p>
				</section>

				<section>
					<header><h2>The Uploader</h2></header>
					<p>
						People who have been following me for a while know that I've written a popular command-line tool called <a rel="external related noopener" href="https://github.com/rhymeswithmogul/aprs-weather-submit"><code>aprs-weather-submit</code></a>.  As I said <a href="https://colincogle.name/blog/aprs-weather-submit" title="Another blog post for you" rel="prev related">when I first introduced it to the world</a>, it lets you send out arbitrary weather data.  While you can go outside, eyeball a thermometer, then come back inside to report it, I'd intended for enterprising hackers to use it to bring their own weather data to the Internet of Things.  This is no exception!
					</p>
					<p>
						Now, my Bash skills aren't that great, and I didn't feel like sitting down and writing a data parser in C (at least not yet).  So, I turned to another of my cross-platform language skills, <a rel="tag" href="https://colincogle.name/blog/tags/PowerShell">PowerShell</a>.
					</p>
					<p>
						To make your lives easier, <a href="https://colincogle.name/blog/byo-weather-station/WeatherStationParser.ps1" type="text/plain">you can view and save my parser and uploader script</a>.  I'll summarize it briefly for you:
					</p>
					<ol>
						<li>The script starts a UDP listener on 127.0.0.1:42069 (by default).  That will listen for data sent by <code>rtl_433</code>.</li>
						<li>Ignore any data that's not from a weather station.</li>
						<li>Ignore any data that's not from <em>my</em> weather station.</li>
						<li>Parse out the temperature and humidity.</li>
						<li><code>aprs-weather-submit</code> is called with the hardcoded callsign and <abbr title="service set identifier">SSID</abbr>, hardcoded location, and the weather data.  It's all sent to the <a rel="external noopener" href="https://www.aprs2.net">Tier 2 APRS servers</a>, and nodes may digipeat it over <abbr title="radio frequency">RF</abbr>.</li>
						<li>The current time, temperature, and humidity are saved.  The weather station may broadcast a few times a minute, but it's considered rude to emit duplicate APRS packets more than once every ten minutes, so if the weather isn't changing, we're not going to spam the airwaves.</li>
					</ol>
					<p>
						My particular weather station can only sense temperature and humidity.  Other sensors might be able to detect barometric pressure.  If yours reports more or less data than mine, you can update the PowerShell script to include that.  <code>aprs-weather-submit</code> supports any environmental data defined in <a rel="external niopener" href="http://www.aprs.org/doc/APRS101.PDF" type="application/pdf">the APRS specification</a> and its addenda.
					</p>
					<p>
						At this point, we've connected the Temu weather station to the Internet and the ham radio network.  Anyone with an APRS-enabled radio, digipeater, receiver, or <a rel="external noopener" href="https://aprs.to/station/station.php?id=921976">just a web browser</a> can see what the temperature and humidity are at my house.
					</p>
					<p>
						But not everyone has an amateur radio license, and some of those who do don't have the equipment to listen to APRS packets.  Now, if you read the script, you'll see some stuff about Mastodon in there.  What's going on with that?
					</p>
				</section>

				<section>
					<header><h2>The Tooter</h2></header>
					<p>
						Not content with sharing my data via APRS, I decided to be even crazier and share out my data via Mastodon.  This federated social network that succeeded the former birdsite welcomes bots (that openly identify as bots), so I decided to create an account for this.  <a rel="me" href="https://mastodon.colincogle.name/@colin" title="Follow @colin@colincogle.name on Mastodon!">I run my own Mastodon instance</a>, so I was able to create <a href="https://mastodon.colincogle.name/@weather" title="Follow @weather@colincogle.name on Mastodon, if you dare." rel="related">a bot account for my weather station</a>.  However, you should have no issues creating a second account on any Mastodon instance.  Edit the profile, images, links, and whatnot to your liking.
					</p>
					<p>
						Once you're in your account settings, look for the options to create an <abbr title="Application Programming Interface">API</abbr> token.  Save it somewhere secure.  It's considered bad practice to hardcode it into your script, but I'm going to do it anyway, because this is just for me and it runs on my home computer.
					</p>
					<p>
						Once you have that server address and the authorization token pasted into the PowerShell script, this script will toot no more than once per hour.  Any more and we risk alienating anyone who's crazy enough to follow this bot account.
					</p>
					<figure>
						<picture>
							<source srcset="https://colincogle.name/blog/byo-weather-station/weather-toot.avif" type="image/avif"/>
							<source srcset="https://colincogle.name/blog/byo-weather-station/weather-toot.jxl" type="image/jxl"/>
							<source srcset="https://colincogle.name/blog/byo-weather-station/weather-toot.webp" type="image/webp"/>
							<img src="https://colincogle.name/blog/byo-weather-station/weather-toot.png" lowsrc="https://colincogle.name/blog/byo-weather-station/weather-toot@lowsrc.png" alt="The first Mastodon post by @weather@colincogle.name.  It reads: &quot;The current temperature is 7.2°C (44.96°F) with 93% humidity.  It's chilly out here!&quot;" loading="lazy" longdesc="https://mastodon.colincogle.name/@weather/113637639999983315/embed"/>
						</picture>
						<figcaption>The first toot from my weather station.  Rather inauspicious, but it does exactly what it's told.</figcaption>
					</figure>
					<p>
						With that, our little experiment is complete!  You can use an APRS app to check the weather at home, or simply open up Mastodon and look for the last toot from your weather station's account!
					</p>
				</section>
			</div>
		</content>
	</entry>

	<entry>
		<title>Push Comes to Dove’</title>
		<id>urn:uuid:d973b68e-025f-4008-9b14-1d0493a0e48d</id>
		<link rel="alternate" length="39832" type="text/html" href="https://colincogle.name/blog/dovecot-with-apple-push/"/>
		<link rel="alternate" length="15486" type="text/markdown" href="https://colincogle.name/blog/dovecot-with-apple-push/dovecot-with-apple-push.md"/>
		<link rel="alternate" length="15401" type="text/gemini" href="gemini://colincogle.name/blog/dovecot-with-apple-push/"/>
		<link rel="alternate" length="18108" type="text/plain" href="https://colincogle.name/blog/dovecot-with-apple-push/dovecot-with-apple-push.txt"/>
		<link rel="alternate" length="18108" type="application/gopher-menu" href="gopher://colincogle.name/blog/dovecot-with-apple-push/dovecot-with-apple-push.txt"/>
		<link rel="related" href="https://mastodon.social/@zvasilev/113340584044185696"/>
		<link rel="related" href="https://mastodon.social/@gyrester/113481190419731532"/>
		<link rel="shortlink" href="http://colincogle.name/push"/>
		<summary>By adding a few things to your Dovecot IMAP server, you can have instant new mail notifications on your Apple devices.</summary>
		<published>2024-10-19T12:27:00-04:00</published>
		<updated>2025-02-18T00:42:00-05:00</updated>
		<category term="sysadmin" label="System administration"/>
		<category term="Apple"/>
		<category term="iOS"/>
		<category term="email"/>
		<category term="self-hosted"/>
		<content type="xhtml">
			<div xmlns="http://www.w3.org/1999/xhtml">
				<aside>
					<header><h1>WARNING: This does not work.</h1></header>
					<p>
						Reader Gerben Wierda tried to set this up, and found out the hard way that Apple had deprecated and has now disabled the API endpoint this code uses to request certificates as of <time datetime="2024-10-29">October 29, 2024</time>.  Thus, this will no longer work, and existing installations cannot renew their certificates.  This is corroborated by <a rel="external noopener" href="https://github.com/freswa/dovecot-xaps-daemon/issues/43">a very long GitHub issue thread</a>.
					</p>
					<p>
						Also, this module is not compatible with Dovecot 2.4.
					</p>
				</aside>
				<section>
					<header><h2>Introduction</h2></header>
					<p>
						Self-hosting your email can be a challenge.  It's also a great learning experience if you want to understand system administration and see firsthand how email works.  There are many tutorials that show you how to set up your own email server, but if you can follow the directions to install the apps, configure your DNS zone, set up the big three acronyms (<abbr title="Sender Policy Framework">SPF</abbr>, <abbr title="DomainKeys Identified Mail" aria-label="dee-kim">DKIM</abbr>, and <abbr title="Domain-based Message Authentication, Reporting, and Compliance" aria-label="dee-mark">DMARC</abbr>), and get your IPv4 and IPv6 address not frowned upon by the major email providers, then you're left with a fully-working email server that works great with desktop apps (and you can install your own webmail, if you're into that).
					</p>
					<p>
						However, I have an iPhone, and I've found that my email doesn't always update as quickly as I'd like.  Having been in the Apple ecosystem for a while, I remember that Apple hyped their support for the <abbr title="Internet Mail Access Protocol" aria-label="I-map">IMAP</abbr> <span aria-label="idle">IDLE</span> extension in macOS Leopard, which lets your mail client keep a persistent connection open to your mail server.  When a new message arrives, your mail app finds out instantly and downloads it immediately.  However, Apple's three big mobile operating systems — <a href="https://mastodon.social/@zvasilev/113340584044185696" rel="external" title="An informative Mastodon thread.">iOS, iPadOS, and watchOS — never supported IMAP IDLE at all</a>, and neither can third-party mail apps due to platform limitations.  That persistent TCP connection to your email server would be a battery drain and a needless (albeit minuscule) consumer of metered data plans.  Thus, iOS (and its variants) will only fetch new mail a few times per hour or whenever you open the Mail app.  This is okay, but what if you're waiting for those stupid, less-secure emailed <abbr title="multi-factor authentication">MFA</abbr> codes?  You might be waiting a while.
					</p>
					<p>
						Despite this, Apple's own iCloud uses IMAP, yet it doesn't suffer from this limitation.  Why is that?
					</p>
				</section>

				<section>
					<header><h2>Apple Push Notification Service</h2></header>
					<p>
						To conserve battery, minimize cellular data usage, and maintain performance, iOS devices (with few exceptions) do not allow apps to keep persistent background connections to servers.  Instead, Apple created the Apple Push Notification Service.  An iOS device keeps a singular connection open to the <abbr title="Apple Push Notification Service">APNs</abbr>, and all app developers funnel their notifications through there.  When the phone gets a notification for an app, the app is allowed to wake up and perform a little bit of related work.
					</p>
					<p>
						Apple wisely used this feature for their own email servers.  Fortunately for us, they didn't follow Microsoft's lead and invent a monstrosity;  rather, Apple decided to use the open-source Dovecot POP3/IMAP server to power their infrastructure.  To work around their own self-inflicted problem for iOS, they wrote a custom plugin for Dovecot that advertises a new feature called <code aria-label="X Apple Push Service">XAPPLEPUSHSERVICE</code>.  When someone receives a new email, Dovecot takes the message and puts it in the user's inbox folder, then sends a push notification via <abbr title="Apple Push Notification Service">APNs</abbr>.  The user's iOS devices receive this push, then make an IMAP connection to iCloud's servers to download that new message.
					</p>
					<p>
						It's absurdly brilliant.  If you don't get a lot of email, then there's no reason for your phone to keep wasting power and data to log onto the mail server for no reason.  If you do get a lot of email, well, you'll get a notification almost instantly.  However, what isn't brilliant is that Apple doesn't seem to have released the full custom software suite as open-source.  Perhaps it never occurred to them, or perhaps it's an invisible impetus to get you to use iCloud for your mail, contacts, and calendars.  Fortunately, a dedicated programmer, <span class="vcard h-card"><a href="https://stefan.arentz.ca/" rel="external noopener" class="url u-url"><span class="fn p-name"><span class="given-name p-given-name">Stefan</span> <span class="family-name p-family-name">Arentz</span></span></a><meta content="st3fan" class="nickname p-nickname"/></span>, was able to reverse-engineer all of this, and has released his own Dovecot plugins that you can add onto your own email server.  However, I had better luck using forks written by <a href="https://github.com/freswa">Frederik Schwan</a>.
					</p>
					<p>
						It's worth noting that recent versions of macOS (since 10.7, “Lion”) also connect and listen to the <abbr title="Apple Push Notification Service">APNs</abbr>, though without the network limitations of iOS, it's merely a value-add for macOS.
					</p>
				</section>

				<section>
					<header><h2>Getting the Software</h2></header>
					<p>
						Yet, following the documentation on GitHub didn't yield a working product for me, so that's why I'm writing this tutorial.  May you learn from my mistakes.
					</p>
					<p>
						This article assumes that you've got a fully-functioning Dovecot server somewhere, version 2.2.19 or newer.  Some of these extra apps will need to be built from source, so make sure that you have a working C compiler and a copy of Git, as well as CMake and the Dovecot development libraries.  If you're using a Debian-based Linux, you should be able to do something like this:
					</p>
					<figure>
						<code class="code bash">
							<span>
								<span class="command">apt</span>
								<span class="parameter">build-dep</span><wbr/>
								<span class="string">dovecot-core</span>
							</span><br/>
							<span>
								<span class="command">apt</span>
								<span class="parameter">install</span><wbr/>
								<span class="string">build-essential</span>
								<span class="string">cmake</span>
								<span class="string">dovecot-dev</span>
								<span class="string">git</span>
								<span class="string">golang-go</span>
							</span>
						</code>
						<figcaption>
							Download and install the Dovecot development libraries, as well as all the tools we'll need to build some code.  This shouldn't take too long, and if you're tight on space, you should be able to <kbd>apt remove</kbd> these after we're done.
						</figcaption>
					</figure>

					<section>
						<header><h3>An app, <code>dovecot-xapsd-daemon</code></h3></header>
						<p>
							To start, we will need a copy of a server app called <code>dovecot-xapsd-daemon</code>.  There are a few forks out there, so make sure we're using <a href="https://github.com/freswa/dovecot-xaps-daemon" rel="external">the one by Frederik Schwan (freswa)</a>.  Be sure to use his app;  there are some forks, but we need both of the “official” versions.
						</p>
						<p>
							Clone the repository and build it.  Finally, we'll need to install its various pieces by hand, as unlike a lot of open-source projects, there doesn't seem to be an install script.
						</p>
						<figure>
							<code class="code bash">
								<span>
									<span class="prompt">$</span>
									<span class="command">git clone</span>
									<span class="string">https://github.com/freswa/dovecot-xaps-daemon.git</span>
								</span><br/>
								<span>
									<span class="prompt">$</span>
									<span class="command">cd</span>
									<span class="string" title="Thank you to Gerben Wierda for pointing out this typo, now corrected.">dovecot-xaps-daemon</span>
								</span><br/>
								<span>
									<span class="prompt">$</span>
									<span class="command">go</span>
									<span class="parameter">build</span>
									<span class="parameter">-o <span class="string">xapsd</span></span>
								</span><br/>
								<span/><br/>
								<span>
									<span class="prompt">$</span>
									<span class="comment"># Install the app.</span>
								</span><br/>
								<span>
									<span class="prompt">$</span>
									<span class="command">sudo ln</span>
									<span class="string">xapsd</span>
									<span class="string">/usr/bin/xapsd</span>
								</span><br/>
								<span/><br/>
								<span>
									<span class="prompt">$</span>
									<span class="comment"># Create the app's user account and home folder.</span>
								</span><br/>
								<span>
									<span class="prompt">$</span>
									<span class="command">sudo useradd</span>
									<span class="parameter">--create-home</span><wbr/>
									<span class="parameter">--home-dir <span class="string">/var/lib/xapsd</span></span><wbr/>
									<span class="parameter">--shell <span class="string">/bin/false</span></span><wbr/>
									<span class="parameter">--user-group</span><wbr/>
									<span class="string">xapsd</span>
								</span><br/>
								<span/><br/>
								<span>
									<span class="prompt">$</span>
									<span class="comment"># Install the configuration file.</span>
								</span><br/>
								<span>
									<span class="prompt">$</span>
									<span class="command">mkdir</span>
									<span class="string">/etc/xapsd/</span>
									<span class="string">/var/lib/xapsd</span>
								</span><br/>
								<span>
									<span class="prompt">$</span>
									<span class="command">cp</span>
									<span class="string">configs/xapsd/xapsd.yaml</span>
									<span class="string">/etc/xapsd/xapsd.yaml</span>
								</span><br/>
								<span/><br/>
								<span>
									<span class="prompt">$</span>
									<span class="comment"># Install the systemd unit file.</span>
								</span><br/>
								<span>
									<span class="prompt">$</span>
									<span class="command">cp</span>
									<span class="string">configs/xapsd/xapsd.service</span>
									<span class="string">/etc/systemd/system/</span>
								</span><br/>
								<span>
									<span class="prompt">$</span>
									<span class="command">sudo systemctl</span>
									<span class="parameter">daemon-reload</span>
								</span><br/>
								<span/><br/>
								<span>
									<span class="prompt">$</span>
									<span class="comment"># Install a systemd-tmpfiles configuration.</span>
								</span><br/>
								<span>
									<span class="prompt">$</span>
									<span class="comment"># If you don't have this installed, that's okay.</span>
								</span><br/>
								<span>
									<span class="prompt">$</span>
									<span class="command">cp</span>
									<span class="string">configs/xapsd/xapsd.tmpfiles</span>
									<span class="string">/etc/tmpfiles.d/</span>
									<span class="control"><span class="number">2</span>&gt;</span>
									<span class="string">/dev/null</span>
								</span>
							</code>
						</figure>
						<p>
							We've copied over a sample configuration file, <code>/etc/xapsd/xapsd.yaml</code>.  Go ahead and open that up in your favorite editor.  We'll need to edit one file — but first, we need to put our hashed password into that file.  You can't just type it in cleartext (thankfully!) nor can you hash it yourself.  Use the <code>xapsd</code> app itself to hash your password.
						</p>
						<figure>
							<div>
								<code class="code bash nocount">
									<span>
										<span class="prompt">$</span>
										<span class="command">xapsd</span>
										<span class="parameter">--pass</span>
										<span class="control">|</span>
										<span class="command">tee</span>
										<span class="parameter">--append <span class="string">/etc/xapsd/xapsd.yaml</span></span>
									</span><br/>
									<output>
										Please enter the password -&gt; <kbd>passw0rd</kbd><br/>
										This is the hash -&gt; 8f0e2f76e22b43e2855189877e7dc1e1e7d98c226c95db247cd1d547928334a9<br/>
										For security reasons, we don't fill in the hash automagically. Please do so yourself.
									</output>
								</code>
							</div>
							<figcaption>
								The unadulterated password is printed to the screen, so don't type it while anyone is peeking over your shoulder.
								But, the <code>tee</code> command will make sure it winds up in our configuration file.
							</figcaption>
						</figure>
						<p>
							Now, open the <code>/etc/xapsd/xapsd.yaml</code> file in your favorite editor.  We'll need to put the password hash in the right place, and add our username, too.
						</p>
						<figure>
							<details open="open">
								<summary><code>/etc/xapsd/xapsd.yaml</code></summary>
								<code class="code bash">
									<span class="comment"># set the loglevel to either trace, debug, error, fatal, info, panic or warn</span><br/>
									<span class="comment"># Default: info</span><br/>
									<span>
										<span class="command">loglevel</span><span class="operator">:</span>
										<span class="string">info</span>
									</span><br/>
									<span/><br/>
									<span class="comment"># xapsd creates a json file to store the registration persistent on disk.  This sets the location of the file.</span><br/>
									<span>
										<span class="command">databaseFile</span><span class="operator">:</span>
										<span class="string">/var/lib/xapsd/database.json</span>
									</span><br/>
									<span/><br/>
									<span class="comment"># xapsd listens on a socket for http/https requests from the dovecot plugin.  This sets the address and port number of the listen socket.</span><br/>
									<span>
										<span class="command">listenAddr</span><span class="operator">:</span>
										<ins class="string">'[::1]'</ins>
									</span><br/>
									<span>
										<span class="command">port</span><span class="operator">:</span>
										<span class="number">11619</span>
									</span><br/>
									<span/><br/>
									<span class="comment"># […]</span><br/>
									<span/><br/>
									<span class="comment"># Notifications that are not initiated by new messages are not sent immediately for two reasons:</span><br/>
									<span class="comment"># 1. When you move/copy/delete messages you most likely move/copy/delete more messages within a short period of time.</span><br/>
									<span class="comment"># 2. You don't need your mailboxes to synchronize immediately since they are automatically synchronized when opening the app</span><br/>
									<span class="comment"># If a new message comes and the move/copy/delete notification is still on hold it will be sent with the notification for the new message.  This sets the interval to check for delayed messages.</span><br/>
									<span>
										<span class="command">checkInterval</span><span class="operator">:</span>
										<span class="number">20</span>
									</span><br/>
									<span/><br/>
									<span class="comment"># Set the time how long notifications for not-new messages should be delayed until they are sent. Whenever checkInterval runs, it checks if "delay" &lt;= "waiting time" and sends the notification if the expression is true.</span><br/>
									<span>
										<span class="command">delay</span><span class="operator">:</span>
										<span class="number">30</span>
									</span><br/>
									<span/><br/>
									<span class="comment"># To retrieve certificates from Apple, we need to login with a valid Apple Account. The account's email must be given in cleartext, but the password has to be hashed before sending it. To not leak working credentials on running servers, we do not accept the cleartext password here.</span><br/>
									<span>
										<span class="command">appleId</span><span class="operator">:</span>
										<ins class="string">colin@colincogle.name</ins>
									</span><br/>
									<span/><br/>
									<span class="comment"># use `xaps -pass` to calculate the hash of the Apple Account password.</span><br/>
									<span>
										<span class="command">appleIdHashedPassword</span><span class="operator">:</span>
										<ins class="string">0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef</ins>
									</span>
								</code>
							</details>
							<figcaption>
								You will need to fill in your Apple Account username (email address) and password.  Fortunately, whether you use Apple's basic <abbr title="Multi-Factor Authentication">MFA</abbr> or you have Advanced Protection enabled, this single-factor usage will work just fine.  It'll get a certificate that will function as an additional factor in the future.
							</figcaption>
						</figure>

						<p>
							Once you've got the text file configured, it's time to start the daemon.
						</p>
						<figure>
							<code class="code bash nocount">
								<span>
									<span class="prompt">$</span>
									span class="command"&gt;sudo systemctl</span>
									<span class="parameter">--enable <span class="string">now</span>
									<span class="string">xapsd.service</span>
								</span>
							</code>
							<figcaption>
								If you're one of those anti-<code>systemd</code> people, that's fine, but you'll need to make your own init script.
							</figcaption>
						</figure>
						<p>
							As soon as you start the app, it will connect to the Apple Push Notification Service and request a client certificate automatically.  You should get an email confirming this (but you won't get a push notification because there are more steps).  If you do not get the email, check the logs for errors and troubleshoot as needed.
						</p>
					</section>

					<section id="sec3-2">
						<header><h3>A plugin, <code>dovecot-xaps-plugin</code></h3></header>
						<p>
							Next, you will need to download and compile the Dovecot plugin <a rel="external" href="https://github.com/freswa/dovecot-xaps-plugin"><code>dovecot-xaps-plugin</code></a>.
						</p>
						<figure>
							<code class="code bash">
								<span>
									<span class="prompt">$</span>
									<span class="command">git</span>
									<span class="parameter">clone</span>
									<span class="string">https://github.com/freswa/dovecot-xaps-plugin.git</span>
								</span><br/>
								<span>
									<span class="prompt">$</span>
									<span class="command">cd</span>
									<span class="string">dovecot-xaps-plugin/</span>
								</span><br/>
								<span>
									<span class="prompt">$</span>
									<span class="command">mkdir</span>
									<span class="string">build</span>
								</span><br/>
								<span>
									<span class="prompt">$</span>
									<span class="command">cd</span>
									<span class="string">build</span>
								</span><br/>
								<span>
									<span class="prompt">$</span>
									<span class="command">cmake</span>
									<span class="string">..</span>
									<span class="parameter">-D<span class="string">CMAKE_BUILD_TYPE<span class="operator">=</span>Release</span></span>
								</span><br/>
								<span>
									<span class="prompt">$</span>
									<span class="command">sudo make</span>
									<span class="parameter">install</span>
								</span><br/>
								<span>
									<span class="prompt">$</span>
									<span class="command">sudo cp</span>
									<span class="string">xaps.conf</span>
									<span class="string">/etc/dovecot/conf.d/95-xaps.conf</span>
								</span>
							</code>
							<figcaption>
								Download, build, and install the Dovecot plugin.  Then, we'll copy over a sample configuration file.  We will need to make some edits to it, though.
							</figcaption>
						</figure>

						<p>
							Now, let's edit the configuration file.  This file assumes that the daemon is listening on a UNIX socket, but it doesn't do that anymore.  It binds to IPv6 localhost, so we need to set the <code>xaps_config</code> file as I've done below.
						</p>
						<figure>
							<details open="open">
								<summary><code>/etc/dovecot/conf.d/95-xaps.conf</code></summary>
								<code class="code bash">
									<span>protocol imap <span class="level1">{</span></span><br/>
									<span><span class="indent">mail_plugins <span class="operator">=</span> <span class="variable">$mail_plugins</span> notify push_notification xaps_push_notification xaps_imap</span></span><br/>
									<span class="level1">}</span><br/>
									<span/><br/>
									<span>protocol lda <span class="level1">{</span></span><br/>
									<span><span class="indent">mail_plugins <span class="operator">=</span> <span class="variable">$mail_plugins</span> notify push_notification xaps_push_notification</span></span><br/>
									<span class="level1">}</span><br/>
									<span/><br/>
									<span>protocol lmtp <span class="level1">{</span></span><br/>
									<span><span class="indent">mail_plugins <span class="operator">=</span> <span class="variable">$mail_plugins</span> notify push_notification xaps_push_notification</span></span><br/>
									<span class="level1">}</span><br/>
									<span/><br/>
									<span>plugin <span class="level1">{</span></span><br/>
									<span><span class="indent comment"># Defaults to /var/run/dovecot/xapsd.sock</span></span><br/>
									<span><span class="indent"><del>#</del>xaps_config <span class="operator">=</span> <ins>url=http://[::1]:11619</ins></span></span><br/>
									<span/><br/>
									<span><span class="indent comment"># Defaults to NULL. Use if you want to determine the username used for PNs from environment variables provided by login mechanism. Value is variable name to look up.</span></span><br/>
									<span><span class="indent comment"># xaps_user_lookup = "colin@colincogle.name"</span></span><br/>
									<span/><br/>
									<span><span class="indent">push_notification_driver <span class="operator">=</span> xaps</span></span><br/>
									<span class="level1">}</span>
								</code>
							</details>
							<figcaption>
								You only need to change the <code>xaps_config</code> line.  Depending on your Dovecot configuration, you might have to set the <code>xaps_user_lookup</code> option as well.
							</figcaption>
						</figure>
						<p>
							Save that file and restart Dovecot!  The next time your phone connects to your email server, it'll notice that Dovecot is advertising the <code>XAPPLEPUSHSERVICE</code> feature and act accordingly.  The only thing to do now is to unplug your phone, lock it, send yourself an email, and see how little time it takes to get that pop-up on your screen.
						</p>
					</section>
				</section>

				<section>
					<header><h3>Push Notifications are Private</h3></header>
					<p>
						One thing I learned during my testing is that, unlike the kind of push notifications you're used to getting, these ones are invisible.  They do not contain the subject line, the sender name, or anything about the new email you've received.  None of that information gets relayed through Apple.  Your server is merely sending a notification to your phone, via <abbr title="Apple Push Notification Service">APNs</abbr>, that it should check for new email.  As Stefan writes:
					</p>
					<blockquote cite="https://github.com/st3fan/dovecot-xaps-daemon">
						<p>
							Each time a message is received, <code>dovecot-xaps-daemon</code> sends Apple a <abbr title="Transport Layer Security">TLS</abbr>-secured HTTP request, which Apple uses to send a notification over a persistent connection maintained […] between the user's device and Apple's push notification servers.
						</p>
						<p>
							The request contains the following information: a device token (used by Apple to identify which device should be sent a push notification), an account ID (used by the user's device to identify which account it should poll for new messages), and a certificate topic. The certificate topic identifies the server to Apple and is hardcoded in the certificate issued by Apple and setup in the configuration for <code>dovecot-xaps-daemon</code>.
						</p>
						<p>
							By virtue of having made the request, Apple also learns the <abbr title="Internet Protocol">IP</abbr> address of the server sending the push notification, and the time at which the push notification is sent by the server to Apple.
						</p>
						<p>
							While no information typically thought of as private is directly exposed to Apple, some difficult to avoid leaks still occur. For example, Apple could correlate that two or more users frequently receive a push notification at almost the exact same time. From this, Apple could potentially infer that these users are receiving the same message. For most users this may not be a significant new loss of privacy.
						</p>
					</blockquote>
					<p>
						Thus, the invisible notification says little more than, <q>Check your email.</q>  When your phone receives the notification, it logs onto the IMAP server and downloads the message.  Once it has that, iOS takes the message metadata and creates the notification that you will see.  If your phone can't contact your email server (for example, if IMAP is only available over a <abbr title="Virtual Private Network">VPN</abbr> that's not connected, or only over IPv6 while you're on an IPv4 “island”), then you will not see anything on your phone at all.
					</p>
				</section>

				<section id="sec5">
					<header><h3>You've Got Mail!</h3></header>
					<p>
						If you've read this far, and followed along at home, you have now added the <code aria-label="X Apple Push Service">XAPPLEPUSHSERVICE</code> feature to your Dovecot IMAP server.  The XAPS daemon and plugin are both running and communicating with the Apple Push Notification Service, and as far as I can tell, the certificate Apple minted for you will be renewed automatically.  While I will laud Apple for making their own private, secure, and efficient version of one of Microsoft Exchange's favorite features, they failed to go as far as properly releasing this plugin to the open-source community.  I'd also like to see this become an official Dovecot plugin, but I hope that the trial and error I put into this article has helped you to make your own email server just a little bit better.
					</p>
				</section>

				<aside>
					<header><h3>Correcting the Record</h3></header>
					<p>
						The first version of this article said that iOS would use IMAP IDLE while both on Wi-Fi and with power connected.  <a href="https://mastodon.social/@zvasilev/113340584044185696" rel="external" title="See the thread on Mastodon.">Zhivko Vasilev politely informed me that that was not true.</a>  Thank you for the correction!
					</p>
					<p>
						Then, <a href="https://mastodon.social/@gyrester/113481190419731532" rel="external noopener">gyrester pointed out</a> that I'd shared the wrong repository links in this article.  Stefan's original forks didn't work for me, but I'd had better luck with Frederik's.  This article has been corrected again.
					</p>
				</aside>
			</div>
		</content>
	</entry>

	<entry>
		<title>Canadian Son:  Roots, Stars, and Everything in Between</title>
		<id>urn:uuid:572e73db-e052-4289-bc24-11bb665ebeff</id>
		<link rel="alternate" length="131290" type="text/html" href="https://colincogle.name/blog/canadian-son/"/>
		<link rel="alternate" length="36827" type="text/markdown" href="https://colincogle.name/blog/canadian-son/canadian-son.md"/>
		<link rel="alternate" length="34816" type="text/gemini" href="gemini://colincogle.name/blog/canadian-son/"/>
		<link rel="alternate" length="31198" type="text/plain" href="https://colincogle.name/blog/canadian-son/canadian-son.txt"/>
		<link rel="shortlink" href="http://colincogle.name/sun"/>
		<summary>I took a trip to Canada to find my roots and stare at the sun.</summary>
		<published>2024-07-04T01:44:18-04:00</published>
		<updated>2024-07-31T23:56:00-04:00</updated>
		<category term="Canada"/>
		<category term="genealogy"/>
		<category term="space"/>
		<category term="vacation"/>
		<content type="xhtml">
			<div xmlns="http://www.w3.org/1999/xhtml">
				<section>
					<header><h2>Foreword and Forewarning</h2></header>
					<p>
						Some things only happen once in a lifetime;  it's rarer still to have so many lifetimes involved.
					</p>
					<p>
						A word of mild caution to my few regular readers:  This blog entry is going to be a little different from my usual fare.  It's going to be a little less formal, and a little more casual stream of consciousness.  This article won't be like stealing secret glances from a page from a teenager's diary, with the sentences written in ink and arranged into perfect chronological order;  instead, it'll be more like a memoir refined from the few days I spent visiting my friendly neighbor to the north.  It's also an excuse to share some photos and videos with my longform thoughts, so if you're on a slow cellular connection right now, bookmark this page and come back to it later when you have time (and Wi-Fi).
					</p>
					<p>
						There's also going to be a lot of talk about my long-dead ancestors, compiled from various sources by nothing more than a skilled amateur working in his free time over the years.  You may not be interested in the subject matter, but I hope you enjoy the ride all the same.
					</p>
				</section>
				
				<section>
					<header><h2>When the Heavens Align</h2></header>
					<p>
						Ever since I was young, trying to memorize all the names and faces at a family reunion, I've always had an interest in genealogy.  Over the years, I was able to trace my paternal grandfather's family back to England via New Brunswick, Canada.  Thankfully, these days, there are plenty of ways someone can do that.  <a rel="external" href="https://FamilySearch.com">FamilySearch</a>, <a rel="external" href="https://FindAGrave.com">Find A Grave</a>, and <a rel="external" href="https://ancestry.com">Ancestry.com</a> are all wonderful educational resources (even if Ancestry has locked your own past behind an overpriced capitalist paywall).
					</p>
					<p>
						A lot of my family history turned out to have taken place just over the international border, before my great-great-grandfather and some of his siblings left for America during the interwar period of the twentieth century.  Despite living in New England my entire life, I'd never been to Canada.  Perhaps I was waiting for the right reason;  that is, the perfect union of events that'd warrant me taking my head out of the stars long enough to cross this off my bucket list. 
					</p>
					<p>
						As luck would have it, I'd heard about the <a rel="external" href="https://www.GreatAmericanEclipse.com/">Great American Eclipse</a> well in advance, and I saw that it was passing over Ontario, Québec, and the Maritimes.  I planned this trip more than a year in advance, booked the Airbnb and got time off of work absurdly early, and began making a to-do list.  Then, there was nothing left to do but wait — and eventually, plan.
					</p>
					<figure>
						<picture>
							<source type="image/avif" srcset="https://colincogle.name/blog/canadian-son/TSE2024_EasternCanada.avif"/>
							<source type="image/jxl" srcset="https://colincogle.name/blog/canadian-son/TSE2024_EasternCanada.jxl"/>
							<source type="image/webp" srcset="https://colincogle.name/blog/canadian-son/TSE2024_EasternCanada.webp"/>
							<img src="https://colincogle.name/blog/canadian-son/TSE2024_EasternCanada.jpg" lowsrc="https://colincogle.name/blog/canadian-son/TSE2024_EasternCanada@lowsrc.jpg" alt="Map of the Great American Eclipse of April 8, 2024, showing how totality passed over Maine and the Canadian Maritimes." loading="lazy"/>
						</picture>
						<figcaption>
							Despite eclipses being mapped out millennia in advance, I somehow beat the Airbnb surge pricing.
						</figcaption>
					</figure>
				</section>
				
				<section id="getting-there">
					<header><h2>Getting There</h2></header>
					<p>
						As a Connecticut native, there are two axioms when you're driving a car.  Firstly, there's always traffic in Connecticut.  I hit traffic in Newtown, Waterbury, and Hartford.  Then, the roads were nice and clear for the rest of the day.  Literally nothing, though construction clogged things a tiny bit around Boston.  I'll never know why traffic seems to be strictly something for the Nutmeg State, especially with so many people travelling north to watch the eclipse.
					</p>
					<p>
						Secondly, if you drive for a few hours in southern New England, you'll wind up one or two states away.  That's how it went, until I reached the Maine border.  It's New England's largest state by far, with the only highway meandering its way up the coast and through the interior.  More than half of my journey was still ahead of me, with three hundred miles of <abbr title="Interstate">I</abbr>-95 in front of me.  I drive an electric vehicle, and I'd managed to get from my house near the New York state line all the way into Maine on a single charge — in the winter, on the highway, no less.  I was thrilled to see how much the state of Maine has invested in fast chargers — at least in southern Maine, south of Bangor.  
					</p>
					<p>
						I nearly filled up the car in Bangor for the 150-mile run to the border, as there are only Tesla Superchargers and overnight chargers after that point.  As any <abbr title="electric vehicle">EV</abbr> owner knows (or anyone who's left their phone in the car overnight to find it's dead), a cold battery puts out less power.  Not only was it wintertime, but a blizzard picked a fine time to blow in, dropping the temperature and wind chill, and my car's range with it.  While it wasn't enough to cause an <em>actual</em> problem, it was enough for my range anxiety to kick in.  Visibility was also reduced to next to nothing, as my high-beams only reflected off the blowing snow, and my low-beams only illuminated the dozens of signs reminding me that this unfamiliar, dark, unlit, unplowed stretch of <abbr title="Interstate">I</abbr>-95 where the townships have numbers instead of names and you run the risk of colliding with moose.
					</p>
					<p>
						I drove slow because of the snow.  Not only did that help me see where I was going, it squeezed a little more mileage out of my car.  I got into Canada with plenty of power left.  I also had the foresight to find a house with a car charger, which means you start every morning with a full car.
					</p>
					<p>
						In addition, I lost an hour of sleep due to the time zone change when crossing the border between Maine and New Brunswick.  While I could push a few buttons on my car to switch everything to metric, my phone and watch took a while to realize they were in a different time zone.
					</p>
					<p>
						That being said, it's a long drive and Houlton International Airport basically sits on the Canadian border.  Maybe next time I could save myself several hours.
					</p>
					<p>
						Once I was up there, I had no trouble finding a car charger when I needed or wanted one.  The provincial electric company has installed car chargers in many spots, and they dispense power <strong>at fair prices</strong> with a phone app that doesn't suck too badly.  Meanwhile, back home, you don't see Eversource installing any chargers, despite electricity being <em>the literal thing they exist to sell</em> — and at an insane markup, too.  But, that's the difference between our two countries;  in Canada, people expect the government to do something useful for them, and in America, we talk about overthrowing it (and with rare exception, do nothing about it but complain).  Maybe America would build more chargers if they came with stores that sold snacks at captive-audience prices.  But I'm getting way off-topic here.
					</p>
				</section>
				
				<section id="bridges">
					<header><h2>The Bridges of Carleton County</h2></header>
					<figure>
						<picture>
							<source type="image/avif" srcset="https://colincogle.name/blog/canadian-son/bridges/hartland@640w.avif 640w, https://colincogle.name/blog/canadian-son/bridges/hartland@960w.avif 960w, https://colincogle.name/blog/canadian-son/bridges/hartland@FHD.avif 1920w, https://colincogle.name/blog/canadian-son/bridges/hartland.avif 4032w"/>
							<source type="image/jxl" srcset="https://colincogle.name/blog/canadian-son/bridges/hartland@640w.jxl 640w, https://colincogle.name/blog/canadian-son/bridges/hartland@960w.jxl 960w, https://colincogle.name/blog/canadian-son/bridges/hartland@FHD.jxl 1920w, https://colincogle.name/blog/canadian-son/bridges/hartland.jxl 4032w"/>
							<source type="image/webp" srcset="https://colincogle.name/blog/canadian-son/bridges/hartland@640w.webp 640w, https://colincogle.name/blog/canadian-son/bridges/hartland@960w.webp 960w, https://colincogle.name/blog/canadian-son/bridges/hartland@FHD.webp 1920w, https://colincogle.name/blog/canadian-son/bridges/hartland.webp 4032w"/>
							<img src="https://colincogle.name/blog/canadian-son/bridges/hartland@960w.jpg" srcset="https://colincogle.name/blog/canadian-son/bridges/hartland@640w.jpg 640w, https://colincogle.name/blog/canadian-son/bridges/hartland@960w.jpg 960w, https://colincogle.name/blog/canadian-son/bridges/hartland@FHD.jpg 1920w, https://colincogle.name/blog/canadian-son/bridges/hartland.jpg 4032w" alt="The world's longest covered bridge, a wooden structure spanning the St. John River." loading="lazy" longdesc="https://en.wikipedia.org/wiki/Hartland_Covered_Bridge"/>
						</picture>
						<figcaption>
							The Hartland Covered Bridge is the world's longest surviving covered bridge.  It was a little odd to not see an American flag hoisted high in the sky, but I got used to the maple leaf quickly.
						</figcaption>
					</figure>
					<p>
						Whenever I go somewhere, I do want to see all the popular things, but I try to avoid the tourist traps.  I prefer to taste the local flavor, so to speak.  I'd found that the town of Hartland has the world's longest surviving covered bridge.  This 1,282-foot long bridge (measured before Canada's metrication in the early 1960s) carries a single lane of traffic across the mighty Saint John River.  It's paved and still an important thoroughfare for the town, so I joined the regular traffic and drove across it.
					</p>
					<figure class="video">
						<video controls="controls" muted="muted" preload="metadata" poster="https://colincogle.name/blog/canadian-son/bridges/hartland-drive.webp">
							<source type="video/mp4;  codecs=&quot;hvc1.2.4.L150.B0,mp4a.40.2&quot;" src="https://colincogle.name/blog/canadian-son/bridges/hartland-drive.hevc.m4v"/>
							<source type="video/webm; codecs=&quot;av01.0.12M.08.0.110.09.18.09.0,opus&quot;" src="https://colincogle.name/blog/canadian-son/bridges/hartland-drive.av1.webm"/>
							<source type="video/webm; codecs=&quot;vp09.02.40.10,opus&quot;" src="https://colincogle.name/blog/canadian-son/bridges/hartland-drive.vp9.webm"/>
							<source type="video/mp4;  codecs=&quot;avc1.640050,mp4a.40.2&quot;" src="https://colincogle.name/blog/canadian-son/bridges/hartland-drive.avc.m4v"/>
							<source type="video/webm; codecs=&quot;vp08.00.41.08.00,vorbis&quot;" src="https://colincogle.name/blog/canadian-son/bridges/hartland-drive.vp8.webm"/>
							<source type="video/mpeg; codecs=&quot;mp1v,mpga&quot;" src="https://colincogle.name/blog/canadian-son/bridges/hartland-drive.mpg"/>
							<source type="video/x-msvideo; codecs=&quot;cinepak,adpcm_ms&quot;" src="https://colincogle.name/blog/canadian-son/bridges/hartland-drive.avi"/>
							<p>
								Your browser either doesn't support videos, or you have that disabled.  That's fine.  You can download it in your favorite format and watch it on your own time:
								<ul>
									<li><a href="https://colincogle.name/blog/canadian-son/bridges/hartland-drive.hevc.m4v" type="video/mp4; codecs=&quot;hvc1.2.4.L150.B0,mp4a.40.2&quot;">MPEG-4 (HEVC)</a></li>
									<li><a href="https://colincogle.name/blog/canadian-son/bridges/hartland-drive.avc.m4v" type="video/mp4; codecs=&quot;avc1.640050,mp4a.40.2&quot;">MPEG-4 (AVC)</a></li>
									<li><a href="https://colincogle.name/blog/canadian-son/bridges/hartland-drive.av1.webm" type="video/webm; codecs=&quot;av01.0.12M.08.0.110.09.18.09.0,opus&quot;">WebM (AV1)</a></li>
									<li><a href="https://colincogle.name/blog/canadian-son/bridges/hartland-drive.vp9.webm" type="video/webm; codecs=&quot;vp09.02.40.10,opus&quot;">WebM (VP9)</a></li>
									<li><a href="https://colincogle.name/blog/canadian-son/bridges/hartland-drive.vp8.webm" type="video/webm; codecs=&quot;vp08.00.41.08.00,vorbis&quot;">WebM (VP8)</a></li>
									<li><a href="https://colincogle.name/blog/canadian-son/bridges/hartland-drive.mpg" type="video/mpeg; codecs=&quot;mp1v,mpga&quot;">MPEG-1 (for old computers)</a></li>
									<li><a href="https://colincogle.name/blog/canadian-son/bridges/hartland-drive.avi" type="video/x-msvideo; codecs=&quot;cinepak,adpcm_ms&quot;">AVI (Cinepak/ADPCM) (for other old computers)</a></li>
									<li>For the Apple ProRes file, contact me!</li>
								</ul>
							</p>
						</video>
						<figcaption>
							<p>
								Driving eastbound through the Hartland Covered Bridge.  There is no traffic light;  rather, people wait and take turns, because this is Canada and everyone I met on this trip was polite.  I'm not even making fun of stereotypes.  Everyone was nice.
							</p>
						</figcaption>
					</figure>
				
					<p>
						A few days later, I went to visit another nearby stop on my list:  a potato chip factory in the Waterville suburb of Hartland.  I was hoping to take a tour and sample some snacks, but I wound up only dismayed as I drove up to a charred, vacant lot with a lonely backhoe.  A quick search told me that <a rel="external" href="https://www.cbc.ca/news/canada/new-brunswick/hartland-devastated-factory-fire-1.7132280">the Covered Bridge Potato Chip plant had burned down</a> over a year ago, and the factory debris had long since been razed and disposed of, leaving only a charred vacant lot.
					</p>
					<p>
						Fortunately, one of their marketing gimmicks survived the blaze.  The world's shortest covered bridge (allegedly), at over 24 feet long, carries a single lane of foot traffic from the factory, over a rocky gorge, to the local gas station.  Unlike its larger sibling across town, I took the time to walk across this one.
					</p>
					<figure>
						<picture>
							<source type="image/avif" media="(orientation: portrait)" srcset="https://colincogle.name/blog/canadian-son/bridges/chips@640w.avif 640w, https://colincogle.name/blog/canadian-son/bridges/chips@960w.avif 960w, https://colincogle.name/blog/canadian-son/bridges/chips@FHD.avif 1920w, https://colincogle.name/blog/canadian-son/bridges/chips.avif 4284w"/>
							<source type="image/jxl" media="(orientation: portrait)" srcset="https://colincogle.name/blog/canadian-son/bridges/chips@640w.jxl 640w, https://colincogle.name/blog/canadian-son/bridges/chips@960w.jxl 960w, https://colincogle.name/blog/canadian-son/bridges/chips@FHD.jxl 1920w, https://colincogle.name/blog/canadian-son/bridges/chips.jxl 4284w"/>
							<source type="image/webp" media="(orientation: portrait)" srcset="https://colincogle.name/blog/canadian-son/bridges/chips@640w.webp 640w, https://colincogle.name/blog/canadian-son/bridges/chips@960w.webp 960w, https://colincogle.name/blog/canadian-son/bridges/chips@FHD.webp 1920w, https://colincogle.name/blog/canadian-son/bridges/chips.webp 4284w"/>
							<source type="image/jpg" media="(orientation: portrait)" srcset="https://colincogle.name/blog/canadian-son/bridges/chips@640w.jpg 640w, https://colincogle.name/blog/canadian-son/bridges/chips@960w.jpg 960w, https://colincogle.name/blog/canadian-son/bridges/chips@FHD.jpg 1920w, https://colincogle.name/blog/canadian-son/bridges/chips.jpg 4284w"/>
							<source type="image/heic" media="(orientation: portrait)" srcset="https://colincogle.name/blog/canadian-son/bridges/chips.heic 4284w"/>
							<source type="image/avif" media="(orientation: landscape)" srcset="https://colincogle.name/blog/canadian-son/bridges/chips-landscape@640w.avif 640w, https://colincogle.name/blog/canadian-son/bridges/chips-landscape@960w.avif 960w, https://colincogle.name/blog/canadian-son/bridges/chips-landscape@1920w.avif 1920w, https://colincogle.name/blog/canadian-son/bridges/chips-landscape.avif 4284w"/>
							<source type="image/jxl" media="(orientation: landscape)" srcset="https://colincogle.name/blog/canadian-son/bridges/chips-landscape@640w.jxl 640w, https://colincogle.name/blog/canadian-son/bridges/chips-landscape@960w.jxl 960w, https://colincogle.name/blog/canadian-son/bridges/chips-landscape@1920w.jxl 1920w, https://colincogle.name/blog/canadian-son/bridges/chips-landscape.jxl 4284w"/>
							<source type="image/webp" media="(orientation: landscape)" srcset="https://colincogle.name/blog/canadian-son/bridges/chips-landscape@640w.webp 640w, https://colincogle.name/blog/canadian-son/bridges/chips-landscape@960w.webp 960w, https://colincogle.name/blog/canadian-son/bridges/chips-landscape@1920w.webp 1920w, https://colincogle.name/blog/canadian-son/bridges/chips-landscape.webp 4284w"/>
							<source type="image/jpg" media="(orientation: landscape)" srcset="https://colincogle.name/blog/canadian-son/bridges/chips-landscape@640w.jpg 640w, https://colincogle.name/blog/canadian-son/bridges/chips-landscape@960w.jpg 960w, https://colincogle.name/blog/canadian-son/bridges/chips-landscape@1920w.jpg 1920w, https://colincogle.name/blog/canadian-son/bridges/chips-landscape.jpg 4284w"/>
							<img src="https://colincogle.name/blog/canadian-son/bridges/chips@640w.jpg" srcset="https://colincogle.name/blog/canadian-son/bridges/chips@640w.jpg 640w, https://colincogle.name/blog/canadian-son/bridges/chips@960w.jpg 960w, https://colincogle.name/blog/canadian-son/bridges/chips@FHD.jpg 1920w, https://colincogle.name/blog/canadian-son/bridges/chips.jpg 4284w" alt="The world's shortest covered bridge (reportedly), a wooden structure constructed by Covered Bridge Potato Chips to span this little rocky gorge." loading="lazy"/>
						</picture>
						<figcaption>
							That's over 700 centimeters for you Canadians.
						</figcaption>
					</figure>
					<p>
						Unfortunately, the Guinness Book of World Records says the <a rel="external" href="https://www.latchford.ca/attractions/">shortest covered bridge in the world is in Latchford, Ontario</a> at 3.4 meters "long", less than half the length of this one, but I'll give the chip company points for trying.
					</p>
					<p>
						In other news, <a rel="external nofollow" href="https://www.facebook.com/coveredbridgechips/posts/pfbid02Yseuxqby12XUnUK198nxVK6kX1qmTKe5PioJrPVJefCB6XoM55ffuKN2jHDT1zvEl" title="WARNING: Facebook post. If you find this on the web, let me know and I'll change this link.">the company does plan to rebuild a factory in the same spot</a>.  My Airbnb host gifted me a bag of their cheddar and sour cream chips, and after tasting them, I wish the company the best of luck!  They're hoping to have a new factory ready to go by the end of 2025.  (Also, please export these to the States.)
					</p>
				</section>
				
				<section id="library">
					<header><h2>Come Feed Thy Spirit</h2></header>
					<p>
						In <time datetime="1923-04-19">1923</time>, my great-great-grandparents, Murley and Kate, and their five sons — the twins Horace and Norris, Phillip, Burton, and John — left the sleepy farming community of Simonds, <abbr title="New Brunswick">NB</abbr>, crossing into Maine.  It wasn't the first time they'd left their homeland for America, but this time, it was permanent.  They eventually found their way to Connecticut, where generations of my family were born, raised, and died.  That's the story and the people I know.
					</p>
					<p>
						However, it's only natural to wonder about what came before everything you know, and what came before that, <i lang="la">ad infinitum</i>.  Following census, birth, marriage, and death records backwards, I'd found that my great-great-great-grandfather's name was Godfrey.  According to even older census records, it was a name that he'd inherited from his father, also named Godfrey.  The elder had immigrated to the British colony of New Brunswick sometime in the early 1800s, with the earliest written record of his life being his marriage to Mary Ann Jackson in <time datetime="1831-09-06">1831</time>.
					</p>
					<p>
						I'm going to note that the elder Godfrey was illiterate, as many people were back then.  It seems that his surname was spelled <b>Cogle</b> in England, as it is in America.  When he arrived in Canada, the spelling drifted to <b>Cougle</b>, likely when someone else wrote it down.  Various sources spell the Godfreys' last names both ways, though the younger Godfrey adopted the Cougle spelling.  For simplicity's sake, I'm usually going to spell it the way I spell it.  No offense to the generations of distant cousins who spell it with the "u".
					</p>
					<p>
						After re-discovering Tim Horton's over breakfast (their only Connecticut location closed more than a decade ago) and buying a few bags of coffee to import, my next stop was the <a rel="external" href="https://www1.gnb.ca/0003/pages/en/biblio-e.asp?Code=Hw">L. P. Fisher Public Library</a> in downtown Woodstock.  I knew about their genealogy department, old newspapers, and county records.  I thought that the librarians would be annoyed, lamenting that some dumb American dashed their dreams of a quiet and quick Saturday.  Once again, I grossly underestimated the profession.  The staff set me up in one of the reference rooms, and gave me a stack of old books (some of them handwritten!), recommended web sites, and gladly searched through dozens of rolls of microfiche at my request.  I was quite surprised to see how far microfiche has come ever since I was in elementary school, pushing rolls of film through a glorified lightbox.  Now, it's mostly computerized.
					</p>
					<figure>
						<picture>
							<source type="image/avif" srcset="https://colincogle.name/blog/canadian-son/microfiche@640w.avif 640w, https://colincogle.name/blog/canadian-son/microfiche@960w.avif 960w, https://colincogle.name/blog/canadian-son/microfiche@FHD.avif 1920w, https://colincogle.name/blog/canadian-son/microfiche@4K.avif 3840w, https://colincogle.name/blog/canadian-son/microfiche.avif 5712w"/>
							<source type="image/jxl" srcset="https://colincogle.name/blog/canadian-son/microfiche@640w.jxl 640w, https://colincogle.name/blog/canadian-son/microfiche@960w.jxl 960w, https://colincogle.name/blog/canadian-son/microfiche@FHD.jxl 1920w, https://colincogle.name/blog/canadian-son/microfiche@4K.jxl 3840w, https://colincogle.name/blog/canadian-son/microfiche.jxl 5712w"/>
							<source type="image/webp" srcset="https://colincogle.name/blog/canadian-son/microfiche@640w.webp 640w, https://colincogle.name/blog/canadian-son/microfiche@960w.webp 960w, https://colincogle.name/blog/canadian-son/microfiche@FHD.webp 1920w, https://colincogle.name/blog/canadian-son/microfiche@4K.webp 3840w, https://colincogle.name/blog/canadian-son/microfiche.webp 5712w"/>
							<img src="https://colincogle.name/blog/canadian-son/microfiche@640w.jpg" srcset="https://colincogle.name/blog/canadian-son/microfiche@640w.jpg 640w, https://colincogle.name/blog/canadian-son/microfiche@960w.jpg 960w, https://colincogle.name/blog/canadian-son/microfiche@FHD.jpg 1920w, https://colincogle.name/blog/canadian-son/microfiche@4K.jpg 3840w, https://colincogle.name/blog/canadian-son/microfiche.jpg 5712w" alt="A modern microfiche reader attached to a computer.  The reader is being used to display an issue of The Carleton Sentinel newspaper from 1859 on the computer screen." loading="lazy"/>
						</picture>
						<figcaption>
							Thanks to the intersection of tireless librarians and modern technology, I'm now reading an issue of <cite>The Carleton Sentinel</cite> from <time>1859</time> with minimal fuss.  Many of the old newspapers still exist in a stack in the corner of the room, but they're slowly digitizing them before the originals fall apart.  I wish them the best of luck, and hope that this somehow makes it online.
						</figcaption>
					</figure>
					<p>
						Together with a handwritten index of names and dates corresponding to mentions in the local newspaper, as well as plenty of dates from my own research, we spent a good chunk of this overcast April afternoon in the library, a veritable Alexandria in relevance, looking at newspapers from the nineteenth century.
					</p>
					<p>
						Later on, while he went to find some files that might be of interest, I noticed a map covering some of the back wall, nearly ceiling to floor.  Skilled, patient, and knowledgeable cartographers had drawn a map of Carleton County as it was in <time>1876</time>, showing not only each road and river as they coursed their paths through this new county in this new province of this new confederation, but they'd even dotted and annotated where each landowner called home.  I gave this map my undivided and rapt attention, staring into the past and looking for places whose names I'd only known as letters on a computer screen:  Wicklow, Knoxford, Richmond, but it was in Simonds where a familiar name reached beyond the time.
					</p>
					<figure>
						<div>
							<picture>
								<source type="image/avif" srcset="https://colincogle.name/blog/canadian-son/godfrey/map@640w.avif 640w, https://colincogle.name/blog/canadian-son/godfrey/map@960w.avif 960w, https://colincogle.name/blog/canadian-son/godfrey/map@1920w.avif 1920w, https://colincogle.name/blog/canadian-son/godfrey/map.avif 5712w"/>
								<source type="image/webp" srcset="https://colincogle.name/blog/canadian-son/godfrey/map@640w.webp 640w, https://colincogle.name/blog/canadian-son/godfrey/map@960w.webp 960w, https://colincogle.name/blog/canadian-son/godfrey/map@1920w.webp 1920w, https://colincogle.name/blog/canadian-son/godfrey/map.webp 5712w"/>
								<img src="https://colincogle.name/blog/canadian-son/godfrey/map@640w.jpg" srcset="https://colincogle.name/blog/canadian-son/godfrey/map@640w.webp 640w, https://colincogle.name/blog/canadian-son/godfrey/map@960w.webp 960w, https://colincogle.name/blog/canadian-son/godfrey/map@1920w.webp 1920w, https://colincogle.name/blog/canadian-son/godfrey/map.webp 5712w" alt="A map of Carleton County, New Brunswick as it appeared in 1876." loading="lazy"/>
							</picture>
							<picture>
								<source type="image/avif" srcset="https://colincogle.name/blog/canadian-son/godfrey/map-zoomed@640w.avif 640w, https://colincogle.name/blog/canadian-son/godfrey/map-zoomed@960w.avif 960w, https://colincogle.name/blog/canadian-son/godfrey/map-zoomed@1920w.avif 1920w, https://colincogle.name/blog/canadian-son/godfrey/map-zoomed.avif 4032w"/>
								<source type="image/webp" srcset="https://colincogle.name/blog/canadian-son/godfrey/map-zoomed@640w.webp 640w, https://colincogle.name/blog/canadian-son/godfrey/map-zoomed@960w.webp 960w, https://colincogle.name/blog/canadian-son/godfrey/map-zoomed@1920w.webp 1920w, https://colincogle.name/blog/canadian-son/godfrey/map-zoomed.webp 4032w"/>
								<img src="https://colincogle.name/blog/canadian-son/godfrey/map-zoomed.jpg" srcset="https://colincogle.name/blog/canadian-son/godfrey/map-zoomed@640w.jpg 640w, https://colincogle.name/blog/canadian-son/godfrey/map-zoomed@960w.jpg 960w, https://colincogle.name/blog/canadian-son/godfrey/map-zoomed@1920w.jpg 1920w, https://colincogle.name/blog/canadian-son/godfrey/map-zoomed.jpg 4032w" alt="A segment of a map of Carleton County, New Brunswick as it appeared in 1876.  Near the center of the photo, a bit inland from the Saint John River's west bank is a property marked with a dot labelled &quot;G. Cogle&quot;." loading="lazy"/>
							</picture>
						</div>
						<figcaption>
							The first image shows the map in all of its glory.  Unfortunately, I couldn't get rid of the glare no matter where I stood or how I photographed it.  The second map is a zoomed-in look at Simonds Parish, with a dot marked <q>G. Cogle</q> roughly near the middle.  Hey, I know him!  Well, I know <em>of</em> him.</figcaption>
					</figure>
					<p>
						Thankfully, Carleton County's roads haven't changed too much since then.  I opened up Apple Maps on my phone, found that same location, and dropped a pin on there.  I wish I could have stayed and dug through more old newspaper articles, but at that point, I was finding marriage announcements for his kids, and the occasional sentence saying that Godfrey had attended a town meeting.  It seemed like I was scraping the bottom of the barrel.  April days only offer so much daylight, and I didn't want to burn any more of it.
					</p>
					<p>
						I'd like to thank one of the staff members, Greg Campbell, for helping me to get my in-person research started and focused, for operating the microfiche reader as many times as I wanted, staring at the screen hoping to find the word "Cogle" highlighted, and for being chatty and explaining a bit of Carleton County's history to me.  If anyone reading this is considering researching family and provincial history in the area, he's the guy to ask.
					</p>
				</section>
				
				<section id="the-farm">
					<header><h2>Potato Field of Dreams</h2></header>
					<p>
						According to the old map of Carleton County, more or less confirmed by census records, Godfrey's farm was located on <a rel="external" href="https://www.openstreetmap.org/#map=15/46.3860361/-67.6004027" title="Set your GPS to 46° 23' 9.729&quot; N, 67° 36' 1.4508&quot; W (46.3860361, -67.6004027).">what is now called Dryer Road</a>, a little uphill half-paved street just off of Route 103.  The river and its little tributaries had changed slightly over the decades, and so had the road as it'd turned from a carriage road to a paved one for cars.
					</p>
					<p>
						I turned up the street into a spot so rural that you'd never guess the Trans-Canada Highway was less than a kilometer away. It's too bad that the eclipse brought me up here when the last vestiges of winter were still keeping everything brown and dead, and as bad luck would have it, this grey, overcast day was the only day that my tight itenerary let me be here.  Regardless, here I was, staring at the land where my third- and fourth-great-grandfathers farmed potatoes and raised their families.
					</p>
					<figure class="video">
						<video controls="controls" loop="loop" muted="muted" preload="metadata" poster="https://colincogle.name/blog/canadian-son/godfrey/farm@1x.jpg">
							<source src="https://colincogle.name/blog/canadian-son/godfrey/godfrey.avc.m4v" type="video/mp4;  codecs=&quot;avc1.640050,mp4a.40.2&quot;"/>
							<source src="https://colincogle.name/blog/canadian-son/godfrey/godfrey.hevc.m4v" type="video/mp4;  codecs=&quot;hvc1.2.4.L150.B0,mp4a.40.2&quot;"/>
							<source src="https://colincogle.name/blog/canadian-son/godfrey/godfrey.av1.webm" type="video/webm; codecs=&quot;av01.0.13M.08.0.100.09.18.09.0,opus&quot;"/>
							<source src="https://colincogle.name/blog/canadian-son/godfrey/godfrey.vp9.webm" type="video/webm; codecs=&quot;vp09.02.40.10,opus&quot;"/>
							<source src="https://colincogle.name/blog/canadian-son/godfrey/godfrey.vp8.webm" type="video/webm; codecs=&quot;vp08.00.41.08.00,vorbis&quot;"/>
							<source src="https://colincogle.name/blog/canadian-son/godfrey/godfrey.mpg" type="video/mpeg; codecs=&quot;mp1v,mpga&quot;"/>
							<source src="https://colincogle.name/blog/canadian-son/godfrey/godfrey.avi" type="video/x-msvideo; codecs=&quot;cinepak,adpcm_ms&quot;"/>
							<p>
								Your browser either doesn't support videos, or you have that disabled.  That's fine.  You can download it in your favorite format and watch it on your own time:
								<ul>
									<li><a href="https://colincogle.name/blog/canadian-son/godfrey/godfrey.avc.m4v" type="video/mp4; codecs=&quot;avc1.640050,mp4a.40.2&quot;">MPEG-4 (AVC)</a></li>
									<li><a href="https://colincogle.name/blog/canadian-son/godfrey/godfrey.hevc.m4v" type="video/mp4; codecs=&quot;hvc1.2.4.L150.B0,mp4a.40.2&quot;">MPEG-4 (HEVC)</a></li>
									<li><a href="https://colincogle.name/blog/canadian-son/godfrey/godfrey.av1.webm" type="video/webm; codecs=&quot;av01.0.13M.08.0.100.09.18.09.0,opus&quot;">WebM (AV1)</a></li>
									<li><a href="https://colincogle.name/blog/canadian-son/godfrey/godfrey.vp9.webm" type="video/webm; codecs=&quot;vp09.02.40.10,opus&quot;">WebM (VP9)</a></li>
									<li><a href="https://colincogle.name/blog/canadian-son/godfrey/godfrey.vp8.webm" type="video/webm; codecs=&quot;vp08.00.41.08.00,vorbis&quot;">WebM (VP8)</a></li>
									<li><a href="https://colincogle.name/blog/canadian-son/godfrey/godfrey.mpg" type="video/mpeg; codecs=&quot;mp1v,mpga&quot;">MPEG-1 (for old computers)</a></li>
									<li><a href="https://colincogle.name/blog/canadian-son/godfrey/godfrey.avi" type="video/x-msvideo; codecs=&quot;cinepak.adpcm_ms&quot;">AVI (for other old computers)</a></li>
									<li>For the Apple ProRes file, contact me!</li>
								</ul>
							</p>
						</video>
						<figcaption>
							<p>
								A 360° view of Godfrey Cogle's old farm.  His was the property that's behind me when the video begins.  The larger and more scenic farm closest to the Saint John River belonged to the younger Godfrey's father-in-law, William F. Drier, <abbr title="Esquire">Esq.</abbr>, for whom I assume this street is named after, too.  Why?  Because misery loves company, and history shows that the Cogle men can never seem to catch a break.
							</p>
						</figcaption>
					</figure>
					<p>
						If I ever go back to New Brunswick and get to do this all over again, I'd love to see what this looks like at the height of the summertime, when the grasses are green, the skies are blue, and with the potato crop maturing.  I bet it's beautiful when snow is only a memory, but I didn't let that diminish from the significance.
					</p>
				</section>
				
				<section id="dont-chase-the-dead">
					<header><h2>Don't Chase the Dead (Or Do)</h2></header>
					<p>
						I rounded out the day by visiting more graves in the area.  I'd wisely brought my hiking boots, as the local graveyards were still muddy and wet as the snow from <time datetime="2024-04-02">the previous Wednesday</time> melted away.  Trudging my way through the quietest and muddiest parts of sleepy Carleton County, armed with my phone and back-to-back calendar events with lists of who was buried where, I found many graves belonging to my distant Cougle cousins, many from my great-great-grandmother's branch of the Lunn family, and even my sixth-great-grandmother, Elizabeth Drier.  However, the elder Godfrey and his wife Mary Ann were missing from R. W. Hale's book, <cite>Southern Carleton County Cemeteries</cite>.  I checked cemeteries in Simonds, Knoxford, Wicklow, and Summerfield (to name a few parishes), holding out a glimmer of hope that I'd stumble across their graves, but I had the same luck as all of those who came before me.  All I could do was lay the occasional flower against an ancestor's or cousin's stone, then track some fresh mud into my car.
					</p>
					<p>
						If anyone reading this is researching names including (but not limited to) Cogle/Cougle, Drier, Jackson, or Lunn, the photographs of gravesites that I took on this trip have all been uploaded to <a rel="external" href="https://FindAGrave.com">Find A Grave</a> (with <abbr title="Global Positioning System">GPS</abbr> coordinates) so that you can see or visit them.  Consider it my little contribution to the world.  If you'd like the originals, contact me directly.
					</p>
					<p>
						I celebrated my small victories with a single flight of beers at <a rel="external" href="https://crosscreekbrewing.ca/">Cross Creek Brewing</a>.  Okay, so I <em>may</em> have squeezed this in between the library trip and the first round of cemetery visits, but I warned you up front that this story wouldn't be in perfect chronological order.  In my defense, my car was almost fully charged, so I let it finish up.
					</p>
					<figure>
						<picture>
							<source type="image/avif" srcset="https://colincogle.name/blog/canadian-son/beer@640w.avif 640w, https://colincogle.name/blog/canadian-son/beer@960w.avif 960w, https://colincogle.name/blog/canadian-son/beer@FHD.avif 1920w, https://colincogle.name/blog/canadian-son/beer@4K.avif 3840w, https://colincogle.name/blog/canadian-son/beer.avif 5712w"/>
							<source type="image/jxl" srcset="https://colincogle.name/blog/canadian-son/beer@640w.jxl 640w, https://colincogle.name/blog/canadian-son/beer@960w.jxl 960w, https://colincogle.name/blog/canadian-son/beer@FHD.jxl 1920w, https://colincogle.name/blog/canadian-son/beer@4K.jxl 3840w, https://colincogle.name/blog/canadian-son/beer.jxl 5712w"/>
							<source type="image/webp" srcset="https://colincogle.name/blog/canadian-son/beer@640w.webp 640w, https://colincogle.name/blog/canadian-son/beer@960w.webp 960w, https://colincogle.name/blog/canadian-son/beer@FHD.webp 1920w, https://colincogle.name/blog/canadian-son/beer@4K.webp 3840w, https://colincogle.name/blog/canadian-son/beer.webp 5712w"/>
							<img src="https://colincogle.name/blog/canadian-son/beer@640w.jpg" srcset="https://colincogle.name/blog/canadian-son/beer@640w.jpg 640w, https://colincogle.name/blog/canadian-son/beer@960w.jpg 960w, https://colincogle.name/blog/canadian-son/beer@FHD.jpg 1920w, https://colincogle.name/blog/canadian-son/beer@4K.jpg 3840w, beer.jpg 5712w" alt="A massive flight handle capable of holding ten taster glasses of beer.  It must have been carved from a slice of a full log.  One of the beers is missing because a keg kicked." loading="lazy"/>
						</picture>
						<figcaption>
							They offered a normal flight of four beers, but then I saw the tap handle capable of holding ten tasters.  As they say, when in Rome — or Canada, I guess. Besides, who knows if or when I'll come back?  One beer is missing because a keg kicked, so they discounted it slightly.
						</figcaption>
					</figure>
					<p>
						It was then that I remembered that Canadian dollars were not one-for-one with American dollars — dumb American, right? — but when you use a credit card or cash you got from an ATM, the exchange rate is calculated for you.  Tipping is a percentage, like it is back home, so whatever.
					</p>
					<p>
						Night fell, and I was greeted by the light pollution of Aroostook and Carleton Counties.  In case you couldn't tell, that was a joke.  The towns around Route 2 are some of the brightest spots in the province, but it was still a fair bit darker than it was back home.  If it weren't cold, muddy, and lacking outdoor chairs, I could have sat outside for a while just staring up into space.
					</p>
					<figure>
						<picture>
							<source type="image/avif" srcset="https://colincogle.name/blog/canadian-son/stars@640w.avif 640w, https://colincogle.name/blog/canadian-son/stars@960w.avif 960w, https://colincogle.name/blog/canadian-son/stars@1920w.avif 1920w, https://colincogle.name/blog/canadian-son/stars.avif 4032w"/>
							<source type="image/webp" srcset="https://colincogle.name/blog/canadian-son/stars@640w.webp 640w, https://colincogle.name/blog/canadian-son/stars@960w.webp 960w, https://colincogle.name/blog/canadian-son/stars@1920w.webp 1920w, https://colincogle.name/blog/canadian-son/stars.webp 4032w"/>
							<img src="https://colincogle.name/blog/canadian-son/stars@1920w.jpg" srcset="https://colincogle.name/blog/canadian-son/stars@640w.jpg 640w, https://colincogle.name/blog/canadian-son/stars@960w.jpg 960w, https://colincogle.name/blog/canadian-son/stars@1920w.jpg 1920w, https://colincogle.name/blog/canadian-son/stars.jpg 4032w" alt="Stars in a dark night sky." loading="lazy"/>
						</picture>
						<figcaption>Shut up and stare.</figcaption>
					</figure>
				</section>
				
				<section id="mars-hill">
					<header><h2>In Search of a Dead Man</h2></header>
					<p>
						Sunday opened just like every morning I'd spent in Canada thus far:  to Tim Horton's for their bacon, egg, lettuce, and tomato sandwich, with the optional habañero sauce.  I've tried replicating it back home, but whether it's on Kaiser roll or a proper New York City-style bagel, it just isn't the same.  Props to Timmies for whatever they do.
					</p>
					<p>
						I visited some more graves in some very rural parts of New Brunswick, crossing onto dirt roads that were almost entirely mud.  
					</p>
					<p>
						I drove across the border, down a seldom-used road through an official border crossing.  After answering questions related to taxation and imports (the opposite of what the Canadian border patrol had asked me when I came in), and already losing my grasp on the metric system, I continued north up U.S. Route 1 toward where the younger Godfrey spends his time.
					</p>
					<p>
						It'd be remiss to talk about a man's final resting place without talking about his life.  Godfrey Cougle (spelling it as it appears on his grave) was born in Richmond, New Brunswick on <time datetime="1847-12-25">Christmas Day in 1847</time> to Godfrey and Mary Ann (Jackson) Cougle, the seventh child out of twelve and the fourth of four sons.  His obituary would read, <q>But little is known […] of his boyhood</q>, which is a good summary of my genealogical efforts.  By <time>1871</time>, he and his father were living in Simonds where the video up above was recorded, and in <time>1873</time>, he married Matilda Blanche Drier, the daughter of William L. Drier, <abbr title="Esquire">Esq</abbr> and the sister of the <a href="https://www.aucklandmuseum.com/discover/research/publications/papahou/vol57/drier" rel="noopener external">surgeon and shell collector <abbr title="Doctor">Dr.</abbr> <abbr title="Ezra">E.</abbr> Newton Drier</a>.  Godfrey's father died in <time datetime="1880-08">1880</time> from heart disease at the age of 75.  The family moved on, with the <time>1891</time> Census of Canada showing them living in nearby Wicklow, where Godfrey and Matilda would complete their family two years later with the birth of their ninth child.
					</p>
					<p>
						On <time datetime="1900-12-06">December 6, 1900</time>, a blurb appeared on page six of the nearby Maine newspaper, the <cite>Presque Isle Star-Herald</cite>.  It was as strong in meaning as it was simple in its brevity:
					</p>
					<figure>
						<blockquote cite="https://colincogle.name/blog/canadian-son/godfrey/separation.png">
							<header>Notice.</header>
							<p>Whereas my wife, Matilda Cougle, has left my bed and board without just cause or provocation, all persons are cautioned not to harbor her or give her creal on my account as I shall pay no bills of her contracting after this date.</p>
							<address>
								G. Cougle.<br/>
								Knoxford, Carleton <abbr title="County">Co.</abbr>, <abbr title="New Brunswick">N. B.</abbr>, <time datetime="1900-11-18"><abbr title="November">Nov.</abbr> 18th, 1900</time>.
							</address>
						</blockquote>
						<figcaption>
							Hey, it happens to the best of us.
						</figcaption>
					</figure>
					<p>
						It seems that Matilda had fled to Maine.  Her just cause or provocation has been lost to the ages.  However, <time datetime="1902-10-29">two years later</time>, their divorce was made official in a Penobscot County courthouse.
					</p>
					<p>
						Perhaps Godfrey had fallen in love all over again.  His reasoning, too, is stuck in the past, but it wouldn't be long before second wedding bells rang for him.  He married Elizabeth J. Rand (née York) on <time datetime="1904-12-31">New Year's Eve 1904</time> in Mars Hill, Maine, shortly after celebrating his 57th birthday.  Eliza had two adult sons <q>to whom he [Godfrey] was an own father.</q>
					</p>
					<p>
						I'd like to think that Godfrey and Eliza had a happy marriage, for he spent the rest of his life in Mars Hill, dying on <time datetime="1929-11-17">November 17, 1929</time>.  The local Baptist church performed an Adventist service for him, and he was buried in King's Grove Cemetery three days after his death.  His wife died <time datetime="1942-01-16">January 16, 1942</time> and was interred along with him.
					</p>
					<p>
						It wasn't hard to find the cemetery;  nothing is hard to find in the age of cell phones with mapping apps, except for a single rock.  After over an hour trudging through the snow, grass, and mud, I was starting to wonder if <a rel="external" href="https://www.findagrave.com/memorial/118576563/godfrey-cougle" title="Don't mind the photos and obituary that I've added since then.  It wasn't worth getting the Internet Archive involved.">the Godfrey Cougle entry on Find A Grave</a> was punking me.  I thought I'd checked every stone at least twice.  I even resorted to using my belt and a long stick to lift up a fallen face-down stone.  But then, in the shadow of a tree, I found my man.
					</p>
					<figure>
						<div>
							<picture>
								<source type="image/avif" srcset="https://colincogle.name/blog/canadian-son/godfrey/grave/from-afar@640w.avif 640w, https://colincogle.name/blog/canadian-son/godfrey/grave/from-afar@960w.avif 960w, https://colincogle.name/blog/canadian-son/godfrey/grave/from-afar@1280w.avif 1280w,https://colincogle.name/blog/canadian-son/godfrey/grave/from-afar@1920w.avif 1920w, https://colincogle.name/blog/canadian-son/godfrey/grave/from-afar.avif 4284w"/>
								<source type="image/webp" srcset="https://colincogle.name/blog/canadian-son/godfrey/grave/from-afar@640w.webp 640w, https://colincogle.name/blog/canadian-son/godfrey/grave/from-afar@960w.webp 960w, https://colincogle.name/blog/canadian-son/godfrey/grave/from-afar@1280w.webp 1280w, https://colincogle.name/blog/canadian-son/godfrey/grave/from-afar@1920w.webp 1920w, https://colincogle.name/blog/canadian-son/godfrey/grave/from-afar.webp 4284w"/>
								<img src="https://colincogle.name/blog/canadian-son/godfrey/grave/from-afar@640w.jpg" srcset="https://colincogle.name/blog/canadian-son/godfrey/grave/from-afar@640w.jpg 640w, https://colincogle.name/blog/canadian-son/godfrey/grave/from-afar@960w.jpg 960w, https://colincogle.name/blog/canadian-son/godfrey/grave/from-afar@1280w.jpg 1280w, https://colincogle.name/blog/canadian-son/godfrey/grave/from-afar@1920w.jpg 1920w,  https://colincogle.name/blog/canadian-son/godfrey/grave/from-afar.jpg 4284w" alt="Godfrey and Eliza Cougle's grave as seen from afar.  It's the one in the shadow of that tree." loading="lazy"/>
							</picture>
							<picture>
								<source type="image/avif" srcset="https://colincogle.name/blog/canadian-son/godfrey/grave/plain@640w.avif 640w, https://colincogle.name/blog/canadian-son/godfrey/grave/plain@960w.avif 960w, https://colincogle.name/blog/canadian-son/godfrey/grave/plain@1280w.avif 1280w, https://colincogle.name/blog/canadian-son/godfrey/grave/plain@1920w.avif 1920w, https://colincogle.name/blog/canadian-son/godfrey/grave/plain.avif 3024w"/>
								<source type="image/webp" srcset="https://colincogle.name/blog/canadian-son/godfrey/grave/plain@640w.webp 640w, https://colincogle.name/blog/canadian-son/godfrey/grave/plain@960w.webp 960w, https://colincogle.name/blog/canadian-son/godfrey/grave/plain@1280w.webp 1280w, https://colincogle.name/blog/canadian-son/godfrey/grave/plain@1920w.webp 1920w, https://colincogle.name/blog/canadian-son/godfrey/grave/plain.webp 4032w"/>
								<img src="https://colincogle.name/blog/canadian-son/godfrey/grave/plain@640w.jpg" srcset="https://colincogle.name/blog/canadian-son/godfrey/grave/plain@640w.jpg 640w, https://colincogle.name/blog/canadian-son/godfrey/grave/plain@960w.jpg 960w, https://colincogle.name/blog/canadian-son/godfrey/grave/plain@1280w.jpg 1280w, https://colincogle.name/blog/canadian-son/godfrey/grave/plain@1920w.jpg 1920w, https://colincogle.name/blog/canadian-son/godfrey/grave/plain.jpg 4032w" alt="Godfrey and Eliza Cougle's grave." loading="lazy"/>
							</picture>
							<picture>
								<source type="image/avif" srcset="https://colincogle.name/blog/canadian-son/godfrey/grave/decorated@640w.avif 640w, https://colincogle.name/blog/canadian-son/godfrey/grave/decorated@960w.avif 960w, https://colincogle.name/blog/canadian-son/godfrey/grave/decorated@1280w.avif 1280w, https://colincogle.name/blog/canadian-son/godfrey/grave/decorated@1920w.avif 1920w, https://colincogle.name/blog/canadian-son/godfrey/grave/decorated.avif 3024w"/>
								<source type="image/webp" srcset="https://colincogle.name/blog/canadian-son/godfrey/grave/decorated@640w.webp 640w, https://colincogle.name/blog/canadian-son/godfrey/grave/decorated@960w.webp 960w, https://colincogle.name/blog/canadian-son/godfrey/grave/decorated@1280w.webp 1280w, https://colincogle.name/blog/canadian-son/godfrey/grave/decorated@1920w.webp 1920w, https://colincogle.name/blog/canadian-son/godfrey/grave/decorated.webp 3024w"/>
								<img src="https://colincogle.name/blog/canadian-son/godfrey/grave/decorated@640w.jpg" srcset="https://colincogle.name/blog/canadian-son/godfrey/grave/decorated@640w.jpg 640w, https://colincogle.name/blog/canadian-son/godfrey/grave/decorated@960w.jpg 960w, https://colincogle.name/blog/canadian-son/godfrey/grave/decorated@1280w.jpg 1280w, https://colincogle.name/blog/canadian-son/godfrey/grave/decorated@1920w.jpg 1920w, https://colincogle.name/blog/canadian-son/godfrey/grave/decorated.jpg 3024w" alt="Godfrey and Eliza Cougle's grave." loading="lazy"/>
							</picture>
						</div>
						<figcaption>
							My trip to Canada had taken me to Maine to stare at a rock, and that part of my mission was accomplished.  Yes, it was a nice and well-maintained rock, and it was mesmering in its own way.
						</figcaption>
						
					</figure>
					<p>
						I left him with a few real flowers, as well as a fake floral stone topper that I'd found blowing around a graveyard in Knoxford the day before, then bid my great-great-great-grandfather and his wife farewell.
					</p>
					<p>
						I drove north until I could cross the border at Fort Fairfield.  My ancestors crossed here, albeit in the opposite direction, though I was more interested in the car charger on the Andover side.  (Plus, why cross at the same place twice?  Keep the border patrol on their toes!)  The <abbr title="Canadian Border Services Agency">CBSA</abbr> agent guessed I was coming for the eclipse, but he didn't seem too impressed at me finding my long-lost relative.  It was either my tongue-in-cheek ask to let me in because all of my stuff was in my Florenceville-Bristol Airbnb, or my valid passport and reasoning, that got me back into Canada.
					</p>
					<p>
						I stopped near the banks of the Saint John River in Perth-Andover and couldn't resist taking a few pictures, not only of the mighty river, but also of my car, which had gotten splattered during the day's muddy adventures.  (Be wary when you see the "pavement ends" signs.  Things can get a little rough, especially with a heavy car.)
					</p>
					<p>
						Okay, fine.  I went up a muddy road, decided I wasn't going to go further and get stuck.  Then, while I was turning around, I got stuck.  Shout out to the guy in the tractor who pulled my electric car less than one meter onto more stable ground.  I wish my dashcam's SD card hadn't corrupted, because that was a sight to behold.  Only my pride was damaged, and we both had a good laugh about it.  If you're reading this, email me, because what I had in my wallet wasn't enough to thank you properly.
					</p>
					<figure>
						<div>
							<picture>
								<source type="image/avif" srcset="https://colincogle.name/blog/canadian-son/dirtycar@640w.avif 640w, https://colincogle.name/blog/canadian-son/dirtycar@960w.avif 960w, https://colincogle.name/blog/canadian-son/dirtycar@1280w.avif 1280w, https://colincogle.name/blog/canadian-son/dirtycar@1920w.avif 1920w, https://colincogle.name/blog/canadian-son/dirtycar.avif 4032w"/>
								<source type="image/webp" srcset="https://colincogle.name/blog/canadian-son/dirtycar@640w.webp 640w, https://colincogle.name/blog/canadian-son/dirtycar@960w.webp 960w, https://colincogle.name/blog/canadian-son/dirtycar@1280w.avif 1280w, https://colincogle.name/blog/canadian-son/dirtycar@1920w.webp 1920w, https://colincogle.name/blog/canadian-son/dirtycar.webp 4032w"/>
								<img src="https://colincogle.name/blog/canadian-son/dirtycar@640w.jpg" srcset="https://colincogle.name/blog/canadian-son/dirtycar@640w.jpg 640w, https://colincogle.name/blog/canadian-son/dirtycar@960w.jpg 960w, https://colincogle.name/blog/canadian-son/dirtycar@1280w.jpg 1280w, https://colincogle.name/blog/canadian-son/dirtycar@1920w.jpg 1920w, https://colincogle.name/blog/canadian-son/dirtycar.jpg 4032w" alt="A blue Chevrolet Bolt EV splattered with mud." loading="lazy"/>
							</picture>
							<picture>
								<source type="image/avif" srcset="https://colincogle.name/blog/canadian-son/river@640w.avif 640w, https://colincogle.name/blog/canadian-son/river@960w.avif 960w, https://colincogle.name/blog/canadian-son/river@1280w.avif 1280w, https://colincogle.name/blog/canadian-son/river@1920w.avif 1920w, https://colincogle.name/blog/canadian-son/river@4K.avif 3840w, https://colincogle.name/blog/canadian-son/river.avif 8064w"/>
								<source type="image/webp" srcset="https://colincogle.name/blog/canadian-son/river@640w.webp 640w, https://colincogle.name/blog/canadian-son/river@960w.webp 960w, https://colincogle.name/blog/canadian-son/river@1280w.webp 1280w, https://colincogle.name/blog/canadian-son/river@1920w.webp 1920w, https://colincogle.name/blog/canadian-son/river@4K.webp 3840w, https://colincogle.name/blog/canadian-son/river.webp 8064w"/>
								<img src="https://colincogle.name/blog/canadian-son/river@640w.jpg" srcset="https://colincogle.name/blog/canadian-son/river@640w.jpg 640w, https://colincogle.name/blog/canadian-son/river@960w.jpg 960w, https://colincogle.name/blog/canadian-son/river@1280w.jpg 1280w, https://colincogle.name/blog/canadian-son/river@1920w.jpg 1920w, https://colincogle.name/blog/canadian-son/river@4K.jpg 3840w, https://colincogle.name/blog/canadian-son/river.jpg 8064w" alt="The Saint John River in Perth-Andover, New Brunswick, facing south on a clear late winter day." loading="lazy"/>
							</picture>
						</div>
						<figcaption>
							A lot of blue in this picture.
						</figcaption>
					</figure>
				</section>
				
				<section id="eclipse-day">
					<header><h2>Staring at the Sun</h2></header>
					<p>
						The next day, I'd stopped at <a rel="external" href="https://moonshinecreek.ca">Moonshine Creek Distillery</a> in Waterville to try this new spirit they invented called <a rel="external" href="https://moonshinecreek.ca/canadiana/">Canadiana</a>.  This clear liquor is made by fermenting all of the sugar out of a fresh batch of maple syrup, and the hearts are diluted with water from maple trees.  The result is filtered clear and is somewhat smooth, lacking maple flavor but carrying its gentle earthy tones.  I had tastes of that, as well as a variant of Canada's official drink, the Caesar;  both were delicious, the latter surprising me as it has a tomato base and I don't like Bloody Marys.  Perhaps Moonshine Creek's decision to make this variant with their pickle moonshine helped.  (It sounds strange, but they work better together.)
					</p>
					<p>
						While I had my few-milliliter samples, wondering if I can get this shipped States-side (no, I can't), someone saw my Connecticut license plate in the parking lot and jokingly remarked that it's like another American invasion up here.  He also mentioned that the nearby towns were right in the exact middle of totality, which was just my luck.  Still, having spent a few days in the area, I opted out of Woodstock's EclipseFest in favor of visiting the provincial capital of Fredericton, and seeing what that was like.
					</p>
					<p>
						An hour later, I was deep into New Brunswick, carrying my modest photography gear, a ham radio, a portable battery for my phone (fully charged, knowing me), and enough eclipse glasses to share.  I left my car to charge in a garage (my car was half-dead and I still spent far more on the parking space than the electricity I consumed), I slung my backpack over my shoulders, checked my watch, and then proceeded to make the best of the next four hours.
					</p>
					<figure>
						<picture>
							<source type="image/avif" srcset="https://colincogle.name/blog/canadian-son/eclipse-day/window-art-zoomed@640w.avif 640w, https://colincogle.name/blog/canadian-son/eclipse-day/window-art-zoomed@960w.avif 960w, https://colincogle.name/blog/canadian-son/eclipse-day/window-art-zoomed@1280w.avif 1280w, https://colincogle.name/blog/canadian-son/eclipse-day/window-art@1920w.avif 1920w, https://colincogle.name/blog/canadian-son/eclipse-day/window-art@4K.avif 3840w, https://colincogle.name/blog/canadian-son/eclipse-day/window-art.avif 5712w"/>
							<source type="image/webp" srcset="https://colincogle.name/blog/canadian-son/eclipse-day/window-art-zoomed@640w.webp 640w, https://colincogle.name/blog/canadian-son/eclipse-day/window-art-zoomed@960w.webp 960w, https://colincogle.name/blog/canadian-son/eclipse-day/window-art-zoomed@1280w.webp 1280w, https://colincogle.name/blog/canadian-son/eclipse-day/window-art@1920w.webp 1920w, https://colincogle.name/blog/canadian-son/eclipse-day/window-art@4K.webp 3840w, https://colincogle.name/blog/canadian-son/eclipse-day/window-art.webp 5712w"/>
							<img src="https://colincogle.name/blog/canadian-son/eclipse-day/window-art-zoomed@640w.jpg" srcset="https://colincogle.name/blog/canadian-son/eclipse-day/window-art-zoomed@640w.jpg 640w, https://colincogle.name/blog/canadian-son/eclipse-day/window-art-zoomed@960w.jpg 960w, https://colincogle.name/blog/canadian-son/eclipse-day/window-art-zoomed@1280w.jpg 1280w, https://colincogle.name/blog/canadian-son/eclipse-day/window-art@1920w.jpg 1920w, https://colincogle.name/blog/canadian-son/eclipse-day/window-art@4K.jpg 3840w, https://colincogle.name/blog/canadian-son/eclipse-day/window-art.jpg 5712w" alt="An eclipse-themed painting done on the window of a meat market in Fredericton, New Brunswick.  It features the earth trying to take a picture of the sun, but the moon is photo-bombing it." loading="lazy"/>
						</picture>
						<figcaption>
							Some art on a meat market.
						</figcaption>
					</figure>
					<p>
						My wandering and whatnot wound up bringing me to the Fredericton riverfront, once again on the banks of the mighty Saint John.  Hundreds of other people had already gathered in this kilometers-long park, but I found a spot off of a walkway, in sight of the Westmorland Street Bridge, one of the two bridges linking the water-split halves of the city.  In front of me was a basketball court, a skate park, a warehouse, and a clear view of the southwestern sky.  I took out my tripod, attached my <abbr title="solid-state disk">SSD</abbr> and battery to my phone, and pointed it toward the sun.
					</p>
					<figure>
						<picture>
							<source type="image/avif" srcset="https://colincogle.name/blog/canadian-son/eclipse-day/crowd@640w.avif 640w, https://colincogle.name/blog/canadian-son/eclipse-day/crowd@960w.avif 960w, https://colincogle.name/blog/canadian-son/eclipse-day/crowd@1280w.avif 1280w, https://colincogle.name/blog/canadian-son/eclipse-day/crowd@1920w.avif 1920w, https://colincogle.name/blog/canadian-son/eclipse-day/crowd@4K.avif 3840w, https://colincogle.name/blog/canadian-son/eclipse-day/crowd.avif 5712w"/>
							<source type="image/webp" srcset="https://colincogle.name/blog/canadian-son/eclipse-day/crowd@640w.webp 640w, https://colincogle.name/blog/canadian-son/eclipse-day/crowd@960w.webp 960w, https://colincogle.name/blog/canadian-son/eclipse-day/crowd@1280w.webp 1280w, https://colincogle.name/blog/canadian-son/eclipse-day/crowd@1920w.webp 1920w, https://colincogle.name/blog/canadian-son/eclipse-day/crowd@4K.webp 3840w, https://colincogle.name/blog/canadian-son/eclipse-day/crowd.webp 5712w"/>
							<img src="https://colincogle.name/blog/canadian-son/eclipse-day/crowd@640w.jpg" srcset="https://colincogle.name/blog/canadian-son/eclipse-day/crowd@640w.jpg 640w, https://colincogle.name/blog/canadian-son/eclipse-day/crowd@960w.jpg 960w, https://colincogle.name/blog/canadian-son/eclipse-day/crowd@1280w.jpg 1280w, https://colincogle.name/blog/canadian-son/eclipse-day/crowd@1920w.jpg 1920w, https://colincogle.name/blog/canadian-son/eclipse-day/crowd@4K.jpg 3840w, https://colincogle.name/blog/canadian-son/eclipse-day/crowd.jpg 5712w" alt="A crowd at the Fredericton waterfront to watch the eclipse." loading="lazy"/>
						</picture>
						<figcaption>
							Eclipse-goers gathered at the Fredericton waterfront to watch the event.
						</figcaption>
					</figure>
					<p>
						Bands played songs, food trucks and portable beer gardens served foodstuffs, and an <span title="master/mistress of ceremonies">emcee</span> occasionally gave us updates on the sun.  Eventually, I saw through my filter that the sun was no longer perfectly round.  Slowly, over the course of an hour or so, the sun turned from a sphere, to a toenail, and back again.
					</p>
					<figure class="twofer">
						<div>
							<picture>
								<source type="image/avif" srcset="https://colincogle.name/blog/canadian-son/eclipse-day/sun-1@640w.avif 640w, https://colincogle.name/blog/canadian-son/eclipse-day/sun-1@960w.avif 960w, https://colincogle.name/blog/canadian-son/eclipse-day/sun-1@1280w.avif 1280w, https://colincogle.name/blog/canadian-son/eclipse-day/sun-1@1920w.avif 1920w, https://colincogle.name/blog/canadian-son/eclipse-day/sun-1.avif 5712w"/>
								<source type="image/webp" srcset="https://colincogle.name/blog/canadian-son/eclipse-day/sun-1@640w.webp 640w, https://colincogle.name/blog/canadian-son/eclipse-day/sun-1@960w.webp 960w, https://colincogle.name/blog/canadian-son/eclipse-day/sun-1@1280w.webp 1280w, https://colincogle.name/blog/canadian-son/eclipse-day/sun-1@1920w.webp 1920w, https://colincogle.name/blog/canadian-son/eclipse-day/sun-1.webp 5712w"/>
								<img src="https://colincogle.name/blog/canadian-son/eclipse-day/sun-1@640w.jpg" srcset="https://colincogle.name/blog/canadian-son/eclipse-day/sun-1@640w.jpg 640w, https://colincogle.name/blog/canadian-son/eclipse-day/sun-1@960w.jpg 960w, https://colincogle.name/blog/canadian-son/eclipse-day/sun-1@1280w.jpg 1280w, https://colincogle.name/blog/canadian-son/eclipse-day/sun-1@1920w.jpg 1920w, https://colincogle.name/blog/canadian-son/eclipse-day/sun-1.jpg 5712w" alt="Moments sun the eclipse.  Thin white clouds are blocking the sun." loading="lazy"/>
							</picture>
							<picture>
								<source type="image/avif" srcset="https://colincogle.name/blog/canadian-son/eclipse-day/sun-2@640w.avif 640w, https://colincogle.name/blog/canadian-son/eclipse-day/sun-2@960w.avif 960w, https://colincogle.name/blog/canadian-son/eclipse-day/sun-2@1280w.avif 1280w, https://colincogle.name/blog/canadian-son/eclipse-day/sun-2@1920w.avif 1920w, https://colincogle.name/blog/canadian-son/eclipse-day/sun-2.avif 5712w"/>
								<source type="image/webp" srcset="https://colincogle.name/blog/canadian-son/eclipse-day/sun-2@640w.webp 640w, https://colincogle.name/blog/canadian-son/eclipse-day/sun-2@960w.webp 960w, https://colincogle.name/blog/canadian-son/eclipse-day/sun-2@1280w.webp 1280w, https://colincogle.name/blog/canadian-son/eclipse-day/sun-2@1920w.webp 1920w, https://colincogle.name/blog/canadian-son/eclipse-day/sun-2.webp 5712w"/>
								<img src="https://colincogle.name/blog/canadian-son/eclipse-day/sun-2@640w.jpg" srcset="https://colincogle.name/blog/canadian-son/eclipse-day/sun-2@640w.jpg 640w, https://colincogle.name/blog/canadian-son/eclipse-day/sun-2@960w.jpg 960w, https://colincogle.name/blog/canadian-son/eclipse-day/sun-2@1280w.jpg 1280w, https://colincogle.name/blog/canadian-son/eclipse-day/sun-2@1920w.jpg 1920w, https://colincogle.name/blog/canadian-son/eclipse-day/sun-2.jpg 5712w" alt="Moments sun the eclipse.  The clouds moved out of the way just in time." loading="lazy"/>
							</picture>
							<picture>
								<source type="image/avif" srcset="https://colincogle.name/blog/canadian-son/eclipse-day/before-42740@640w.avif 640w, https://colincogle.name/blog/canadian-son/eclipse-day/before-42740@960w.avif 960w, https://colincogle.name/blog/canadian-son/eclipse-day/before-42740@1280w.avif 1280w, https://colincogle.name/blog/canadian-son/eclipse-day/before-42740@1920w.avif 1920w, https://colincogle.name/blog/canadian-son/eclipse-day/before-42740.avif 5712w"/>
								<source type="image/webp" srcset="https://colincogle.name/blog/canadian-son/eclipse-day/before-42740@640w.webp 640w, https://colincogle.name/blog/canadian-son/eclipse-day/before-42740@960w.webp 960w, https://colincogle.name/blog/canadian-son/eclipse-day/before-42740@1280w.webp 1280w, https://colincogle.name/blog/canadian-son/eclipse-day/before-42740@1920w.webp 1920w, https://colincogle.name/blog/canadian-son/eclipse-day/before-42740.webp 5712w"/>
								<img src="https://colincogle.name/blog/canadian-son/eclipse-day/before-42740@640w.jpg" srcset="https://colincogle.name/blog/canadian-son/eclipse-day/before-42740@640w.jpg 640w, https://colincogle.name/blog/canadian-son/eclipse-day/before-42740@960w.jpg 960w, https://colincogle.name/blog/canadian-son/eclipse-day/before-42740@1280w.jpg 1280w, https://colincogle.name/blog/canadian-son/eclipse-day/before-42740@1920w.jpg 1920w, https://colincogle.name/blog/canadian-son/eclipse-day/before-42740.jpg 5712w" alt="Moments before the eclipse.  Thin white clouds are blocking the sun." loading="lazy"/>
							</picture>
							<picture>
								<source type="image/avif" srcset="https://colincogle.name/blog/canadian-son/eclipse-day/sun-3@640w.avif 640w, https://colincogle.name/blog/canadian-son/eclipse-day/sun-3@960w.avif 960w, https://colincogle.name/blog/canadian-son/eclipse-day/sun-3@1280w.avif 1280w, https://colincogle.name/blog/canadian-son/eclipse-day/sun-3@1920w.avif 1920w, https://colincogle.name/blog/canadian-son/eclipse-day/sun-3.avif 5712w"/>
								<source type="image/webp" srcset="https://colincogle.name/blog/canadian-son/eclipse-day/sun-3@640w.webp 640w, https://colincogle.name/blog/canadian-son/eclipse-day/sun-3@960w.webp 960w, https://colincogle.name/blog/canadian-son/eclipse-day/sun-3@1280w.webp 1280w, https://colincogle.name/blog/canadian-son/eclipse-day/sun-3@1920w.webp 1920w, https://colincogle.name/blog/canadian-son/eclipse-day/sun-3.webp 5712w"/>
								<img src="https://colincogle.name/blog/canadian-son/eclipse-day/sun-3@640w.jpg" srcset="https://colincogle.name/blog/canadian-son/eclipse-day/sun-3@640w.jpg 640w, https://colincogle.name/blog/canadian-son/eclipse-day/sun-3@960w.jpg 960w, https://colincogle.name/blog/canadian-son/eclipse-day/sun-3@1280w.jpg 1280w, https://colincogle.name/blog/canadian-son/eclipse-day/sun-3@1920w.jpg 1920w, https://colincogle.name/blog/canadian-son/eclipse-day/sun-3.jpg 5712w" alt="Moments before the eclipse.  The clouds moved out of the way just in time." loading="lazy"/>
							</picture>
							<picture>
								<source type="image/avif" srcset="https://colincogle.name/blog/canadian-son/eclipse-day/sun-clouds-1@640w.avif 640w, https://colincogle.name/blog/canadian-son/eclipse-day/sun-clouds-1@960w.avif 960w, https://colincogle.name/blog/canadian-son/eclipse-day/sun-clouds-1@1280w.avif 1280w, https://colincogle.name/blog/canadian-son/eclipse-day/sun-clouds-1@1920w.avif 1920w, https://colincogle.name/blog/canadian-son/eclipse-day/sun-clouds-1.avif 5712w"/>
								<source type="image/webp" srcset="https://colincogle.name/blog/canadian-son/eclipse-day/sun-clouds-1@640w.webp 640w, https://colincogle.name/blog/canadian-son/eclipse-day/sun-clouds-1@960w.webp 960w, https://colincogle.name/blog/canadian-son/eclipse-day/sun-clouds-1@1280w.webp 1280w, https://colincogle.name/blog/canadian-son/eclipse-day/sun-clouds-1@1920w.webp 1920w, https://colincogle.name/blog/canadian-son/eclipse-day/sun-clouds-1.webp 5712w"/>
								<img src="https://colincogle.name/blog/canadian-son/eclipse-day/sun-clouds-1@640w.jpg" srcset="https://colincogle.name/blog/canadian-son/eclipse-day/sun-clouds-1@640w.jpg 640w, https://colincogle.name/blog/canadian-son/eclipse-day/sun-clouds-1@960w.jpg 960w, https://colincogle.name/blog/canadian-son/eclipse-day/sun-clouds-1@1280w.jpg 1280w, https://colincogle.name/blog/canadian-son/eclipse-day/sun-clouds-1@1920w.jpg 1920w, https://colincogle.name/blog/canadian-son/eclipse-day/sun-clouds-1.jpg 5712w" alt="Moments before the eclipse.  The clouds moved out of the way just in time." loading="lazy"/>
							</picture>
							<picture>
								<source type="image/avif" srcset="https://colincogle.name/blog/canadian-son/eclipse-day/sun-clouds-2@640w.avif 640w, https://colincogle.name/blog/canadian-son/eclipse-day/sun-clouds-2@960w.avif 960w, https://colincogle.name/blog/canadian-son/eclipse-day/sun-clouds-2@1280w.avif 1280w, https://colincogle.name/blog/canadian-son/eclipse-day/sun-clouds-2@1920w.avif 1920w, https://colincogle.name/blog/canadian-son/eclipse-day/sun-clouds-2.avif 5712w"/>
								<source type="image/webp" srcset="https://colincogle.name/blog/canadian-son/eclipse-day/sun-clouds-2@640w.webp 640w, https://colincogle.name/blog/canadian-son/eclipse-day/sun-clouds-2@960w.webp 960w, https://colincogle.name/blog/canadian-son/eclipse-day/sun-clouds-2@1280w.webp 1280w, https://colincogle.name/blog/canadian-son/eclipse-day/sun-clouds-2@1920w.webp 1920w, https://colincogle.name/blog/canadian-son/eclipse-day/sun-clouds-2.webp 5712w"/>
								<img src="https://colincogle.name/blog/canadian-son/eclipse-day/sun-clouds-1@640w.jpg" srcset="https://colincogle.name/blog/canadian-son/eclipse-day/sun-clouds-2@640w.jpg 640w, https://colincogle.name/blog/canadian-son/eclipse-day/sun-clouds-2@960w.jpg 960w, https://colincogle.name/blog/canadian-son/eclipse-day/sun-clouds-2@1280w.jpg 1280w, https://colincogle.name/blog/canadian-son/eclipse-day/sun-clouds-2@1920w.jpg 1920w, https://colincogle.name/blog/canadian-son/eclipse-day/sun-clouds-2.jpg 5712w" alt="Moments before the eclipse.  The clouds moved out of the way just in time." loading="lazy"/>
							</picture>
							<picture>
								<source type="image/avif" srcset="https://colincogle.name/blog/canadian-son/eclipse-day/before-43256@640w.avif 640w, https://colincogle.name/blog/canadian-son/eclipse-day/before-43256@960w.avif 960w, https://colincogle.name/blog/canadian-son/eclipse-day/before-43256@1280w.avif 1280w, https://colincogle.name/blog/canadian-son/eclipse-day/before-43256@1920w.avif 1920w, https://colincogle.name/blog/canadian-son/eclipse-day/before-43256.avif 5712w"/>
								<source type="image/webp" srcset="https://colincogle.name/blog/canadian-son/eclipse-day/before-43256@640w.webp 640w, https://colincogle.name/blog/canadian-son/eclipse-day/before-43256@960w.webp 960w, https://colincogle.name/blog/canadian-son/eclipse-day/before-43256@1280w.webp 1280w, https://colincogle.name/blog/canadian-son/eclipse-day/before-43256@1920w.webp 1920w, https://colincogle.name/blog/canadian-son/eclipse-day/before-43256.webp 5712w"/>
								<img src="https://colincogle.name/blog/canadian-son/eclipse-day/before-43256@640w.jpg" srcset="https://colincogle.name/blog/canadian-son/eclipse-day/before-43256@640w.jpg 640w, https://colincogle.name/blog/canadian-son/eclipse-day/before-43256@960w.jpg 960w, https://colincogle.name/blog/canadian-son/eclipse-day/before-43256@1280w.jpg 1280w, https://colincogle.name/blog/canadian-son/eclipse-day/before-43256@1920w.jpg 1920w, https://colincogle.name/blog/canadian-son/eclipse-day/before-43256.jpg 5712w" alt="Moments before the eclipse.  The clouds moved out of the way just in time." loading="lazy"/>
							</picture>
							<picture>
								<source type="image/avif" srcset="https://colincogle.name/blog/canadian-son/eclipse-day/before-43303@640w.avif 640w, https://colincogle.name/blog/canadian-son/eclipse-day/before-43303@960w.avif 960w, https://colincogle.name/blog/canadian-son/eclipse-day/before-43303@1280w.avif 1280w, https://colincogle.name/blog/canadian-son/eclipse-day/before-43303@1920w.avif 1920w, https://colincogle.name/blog/canadian-son/eclipse-day/before-43303.avif 5712w"/>
								<source type="image/webp" srcset="https://colincogle.name/blog/canadian-son/eclipse-day/before-43303@640w.webp 640w, https://colincogle.name/blog/canadian-son/eclipse-day/before-43303@960w.webp 960w, https://colincogle.name/blog/canadian-son/eclipse-day/before-43303@1280w.webp 1280w, https://colincogle.name/blog/canadian-son/eclipse-day/before-43303@1920w.webp 1920w, https://colincogle.name/blog/canadian-son/eclipse-day/before-43303.webp 5712w"/>
								<img src="https://colincogle.name/blog/canadian-son/eclipse-day/before-43303@640w.jpg" srcset="https://colincogle.name/blog/canadian-son/eclipse-day/before-43303@640w.jpg 640w, https://colincogle.name/blog/canadian-son/eclipse-day/before-43303@960w.jpg 960w, https://colincogle.name/blog/canadian-son/eclipse-day/before-43303@1280w.jpg 1280w, https://colincogle.name/blog/canadian-son/eclipse-day/before-43303@1920w.jpg 1920w, https://colincogle.name/blog/canadian-son/eclipse-day/before-43303.jpg 5712w" alt="Moments before the eclipse.  The clouds moved out of the way just in time." loading="lazy"/>
							</picture>
						</div>
						<figcaption>
							There were no clouds in the sky, except for minutes before the celestial event.  It provided for some harrowing photography, and me wondering if should have skipped the genealogy and gone to Québec instead.  Thankfully, it all worked out in the end.  All photos in this section are arranged in chronological order, with and without me holding a solar filter over the iPhone's lenses.
						</figcaption>
					</figure>
					<p>
						Finally, the coveted two minutes and sixteen seconds came.  If you don't have professional-ish photography gear like my colleague who saw this same eclipse in southwestern Texas, your photos of the sun will be absolutely terrible in comparison.  If you're not <abbr title="National Aeronautics and Space Administration">NASA</abbr> or a gigantic telescope, your pictures of the sun may still suck.  Trust me when I say that a total solar eclipse, at 100% totality and nothing less, is truly a sight to behold in person.
						<a rel="me external" href="https://mastodon.colincogle.name/@colin/112237661883511894">As I wrote on Mastodon while the memory was still fresh in my mind:</a>
					</p>
					<blockquote cite="https://mastodon.colincogle.name/@colin/112237661883511894">
						<p>
							The crowd gathered on the Fredericton waterfront cheers, and then falls silent during totality.  They lower their glasses.  I cannot speak for them, but as for me, I am humbled to but the speck I am in the infinite cosmos, and gaze in wonder on something I will never again see in my days on this Earth. I am not religious, but it is in these three minutes that I understand how people claim to have felt the presence of God or Allah.
						</p>
						<p>
							The moment is gone, and I won’t see anything like this again; but I will talk about my memories until the day I die. Still, I share these photos in hopes that you may taste a drop of the cosmic wine my eyes consumed by the cask.
						</p>
					</blockquote>
					<p>
						When I knew my camera was inadequate, I focused on something else besides the magnificent union of sun and moon.
					</p>
					<figure>
						<picture>
							<source type="image/avif" srcset="https://colincogle.name/blog/canadian-son/eclipse-day/during-43359@640w.avif 640w, https://colincogle.name/blog/canadian-son/eclipse-day/during-43359@960w.avif 960w, https://colincogle.name/blog/canadian-son/eclipse-day/during-43359@1280w.avif 1280w, https://colincogle.name/blog/canadian-son/eclipse-day/during-43359@1920w.avif 1920w, https://colincogle.name/blog/canadian-son/eclipse-day/during-43359.avif 5712w"/>
							<source type="image/webp" srcset="https://colincogle.name/blog/canadian-son/eclipse-day/during-43359@640w.webp 640w, https://colincogle.name/blog/canadian-son/eclipse-day/during-43359@960w.webp 960w, https://colincogle.name/blog/canadian-son/eclipse-day/during-43359@1280w.webp 1280w, https://colincogle.name/blog/canadian-son/eclipse-day/during-43359@1920w.webp 1920w, https://colincogle.name/blog/canadian-son/eclipse-day/during-43359.webp 5712w"/>
							<img src="https://colincogle.name/blog/canadian-son/eclipse-day/during-43359@640w.jpg" srcset="https://colincogle.name/blog/canadian-son/eclipse-day/during-43359@640w.jpg 640w, https://colincogle.name/blog/canadian-son/eclipse-day/during-43359@960w.jpg 960w, https://colincogle.name/blog/canadian-son/eclipse-day/during-43359@1280w.jpg 1280w, https://colincogle.name/blog/canadian-son/eclipse-day/during-43359@1920w.jpg 1920w, https://colincogle.name/blog/canadian-son/eclipse-day/during-43359.jpg 5712w" alt="A photo of the solar eclipse in Fredericton, New Brunswick.  The moon looks like a dark dot obscuring the sun.  Only the corona is visible.  Thin clouds are around the sun, but not enough to obscure the full detail." loading="lazy"/>
						</picture>
						<picture>
							<source type="image/avif" srcset="https://colincogle.name/blog/canadian-son/eclipse-day/during-43507@640w.avif 640w, https://colincogle.name/blog/canadian-son/eclipse-day/during-43507@960w.avif 960w, https://colincogle.name/blog/canadian-son/eclipse-day/during-43507@1280w.avif 1280w, https://colincogle.name/blog/canadian-son/eclipse-day/during-43507@1920w.avif 1920w, https://colincogle.name/blog/canadian-son/eclipse-day/during-43507.avif 5712w"/>
							<source type="image/webp" srcset="https://colincogle.name/blog/canadian-son/eclipse-day/during-43507@640w.webp 640w, https://colincogle.name/blog/canadian-son/eclipse-day/during-43507@960w.webp 960w, https://colincogle.name/blog/canadian-son/eclipse-day/during-43507@1280w.webp 1280w, https://colincogle.name/blog/canadian-son/eclipse-day/during-43507@1920w.webp 1920w, https://colincogle.name/blog/canadian-son/eclipse-day/during-43507.webp 5712w"/>
							<img src="https://colincogle.name/blog/canadian-son/eclipse-day/during-43507@640w.jpg" srcset="https://colincogle.name/blog/canadian-son/eclipse-day/during-43507@640w.jpg 640w, https://colincogle.name/blog/canadian-son/eclipse-day/during-43507@960w.jpg 960w, https://colincogle.name/blog/canadian-son/eclipse-day/during-43507@1280w.jpg 1280w, https://colincogle.name/blog/canadian-son/eclipse-day/during-43507@1920w.jpg 1920w, https://colincogle.name/blog/canadian-son/eclipse-day/during-43507.jpg 5712w" alt="The Westmorland Bridge in Fredericton, New Brunswick during totality during the Great American Eclipse.  The sky is dark above but light at the horizon.  The streetlights are on." loading="lazy"/>
						</picture>
						<picture>
							<source type="image/avif" srcset="https://colincogle.name/blog/canadian-son/eclipse-day/during-43514@640w.avif 640w, https://colincogle.name/blog/canadian-son/eclipse-day/during-43514@960w.avif 960w, https://colincogle.name/blog/canadian-son/eclipse-day/during-43514@1280w.avif 1280w, https://colincogle.name/blog/canadian-son/eclipse-day/during-43514@1920w.avif 1920w, https://colincogle.name/blog/canadian-son/eclipse-day/during-43514.avif 5712w"/>
							<source type="image/webp" srcset="https://colincogle.name/blog/canadian-son/eclipse-day/during-43514@640w.webp 640w, https://colincogle.name/blog/canadian-son/eclipse-day/during-43514@960w.webp 960w, https://colincogle.name/blog/canadian-son/eclipse-day/during-43514@1280w.webp 1280w, https://colincogle.name/blog/canadian-son/eclipse-day/during-43514@1920w.webp 1920w, https://colincogle.name/blog/canadian-son/eclipse-day/during-43514.webp 5712w"/>
							<img src="https://colincogle.name/blog/canadian-son/eclipse-day/during-43514@640w.jpg" srcset="https://colincogle.name/blog/canadian-son/eclipse-day/during-43514@640w.jpg 640w, https://colincogle.name/blog/canadian-son/eclipse-day/during-43514@960w.jpg 960w, https://colincogle.name/blog/canadian-son/eclipse-day/during-43514@1280w.jpg 1280w, https://colincogle.name/blog/canadian-son/eclipse-day/during-43514@1920w.jpg 1920w, https://colincogle.name/blog/canadian-son/eclipse-day/during-43514.jpg 5712w" alt="The sun during a total solar eclipse in Fredericton in 2024.  The sky is dark and a few stars are visible.  The moon is covering the sun.  Streetlights have turned on." loading="lazy"/>
						</picture>
						<figcaption>
							Photos during totality.  The sun and the moon looked a million times better in person, so I also photographed my surroundings, the Saint John River waterfront, and the nearby Westmorland Bridge.
						</figcaption>
					</figure>
					<p>
						Needless to say, if you ever get a chance to see a <em>total</em> solar eclipse in person, I strongly recommend you do it.  There is nothing like it.  When you hear the crowd gasp as they pull off their sunglasses, you really feel like you're a part of something greater.  I heard that one or two couples somewhere on the riverfront picked that exact moment to exchange wedding vows.  Now I understand the hype.
					</p>
					<p>
						I ended my time in the capital visiting a hole-in-the-wall fish and chips place, and was shocked at how good it was.  Fredericton is probably an hour from the shore, but I've got to say:  they did it beautifully.  If I had a pen and a non-greasy piece of paper, I might have written home about it.
					</p>
					<p>
						On the way back, I ran into a local who visits his friend in Connecticut every so often.  As our cars charged (I was only charging long enough to go inside and use the bathroom, because the rates are so cheap up there), I had to break the news to him that the Tim Horton's in Plainville is long gone.  He said he'd try not to let it worsen his next trip down to the States.
					</p>
				</section>
				
				<section id="next-time">
					<header><h2>Next Time</h2></header>
					<p>
						The next day, I packed up bright and early, thanked my unseen Airbnb host for her hospitality and gifted her a beer from <a rel="external" href="https://www.housatonicriverbrewing.com/">my local brewery</a> as she gifted me some from hers (thank you again, Jayne!), and I was off.
					</p>
					<p>
						When I crossed the border in Houlton, the border patrol agent was shocked to hear that I'd found my great-great-great-grandfather.  She welcomed me back home, and I told her that I was still at least nine hours away.
					</p>
					<figure>
						<div>
							<picture>
								<source type="image/avif" srcset="https://colincogle.name/blog/canadian-son/mileage-metric@640w.avif 640w, https://colincogle.name/blog/canadian-son/mileage-metric@960w.avif 960w, https://colincogle.name/blog/canadian-son/mileage-metric@1280w.avif 1280w, https://colincogle.name/blog/canadian-son/mileage-metric@1920w.avif 1920w, https://colincogle.name/blog/canadian-son/mileage-metric.avif 5712w"/>
								<source type="image/webp" srcset="https://colincogle.name/blog/canadian-son/mileage-metric@640w.webp 640w, https://colincogle.name/blog/canadian-son/mileage-metric@960w.webp 960w, https://colincogle.name/blog/canadian-son/mileage-metric@1280w.webp 1280w, https://colincogle.name/blog/canadian-son/mileage-metric@1920w.webp 1920w, https://colincogle.name/blog/canadian-son/mileage-metric.webp 5712w"/>
								<img src="https://colincogle.name/blog/canadian-son/mileage-metric@640w.jpg" srcset="https://colincogle.name/blog/canadian-son/mileage-metric@640w.jpg 640w, https://colincogle.name/blog/canadian-son/mileage-metric@960w.jpg 960w, https://colincogle.name/blog/canadian-son/mileage-metric@1280w.jpg 1280w, https://colincogle.name/blog/canadian-son/mileage-metric@1920w.jpg 1920w, https://colincogle.name/blog/canadian-son/mileage-metric.jpg 5712w" alt="My Chevrolet Bolt EV's trip odometer saying I've driven 2,590.2 kilometers with an efficiency of 18.5 kilowatt-hours per 100 kilometers." loading="lazy"/>
							</picture>
							<picture>
								<source type="image/avif" srcset="https://colincogle.name/blog/canadian-son/mileage-us@640w.avif 640w, https://colincogle.name/blog/canadian-son/mileage-us@960w.avif 960w, https://colincogle.name/blog/canadian-son/mileage-us@1280w.avif 1280w, https://colincogle.name/blog/canadian-son/mileage-us@1920w.avif 1920w, https://colincogle.name/blog/canadian-son/mileage-us.avif 5712w"/>
								<source type="image/webp" srcset="https://colincogle.name/blog/canadian-son/mileage-us@640w.webp 640w, https://colincogle.name/blog/canadian-son/mileage-us@960w.webp 960w, https://colincogle.name/blog/canadian-son/mileage-us@1280w.webp 1280w, https://colincogle.name/blog/canadian-son/mileage-us@1920w.webp 1920w, https://colincogle.name/blog/canadian-son/mileage-us.webp 5712w"/>
								<img src="https://colincogle.name/blog/canadian-son/mileage-us@640w.jpg" srcset="https://colincogle.name/blog/canadian-son/mileage-us@640w.jpg 640w, https://colincogle.name/blog/canadian-son/mileage-us@960w.jpg 960w, https://colincogle.name/blog/canadian-son/mileage-us@1280w.jpg 1280w, https://colincogle.name/blog/canadian-son/mileage-us@1920w.jpg 1920w, https://colincogle.name/blog/canadian-son/mileage-us.jpg 5712w" alt="My Chevrolet Bolt EV's trip odometer saying I've driven 1,609.5 miles with an efficiency of 3.4 miles per kilowatt-hour." loading="lazy"/>
							</picture>
						</div>
						<figcaption>
							How far did I drive in five days?  This far.  Pardon the poor efficiency, but it was winter and most of Maine's highways are rated for 120 <abbr title="kilometers per hour">km/h</abbr> (75 miles per hour);  on the way home, the weather was clear and I didn't feel like taking it slow anymore.
						</figcaption>
					</figure>
					<p>
						I hope I can return to New Brunswick again someday.  I'd love to show my own kids and grandkids their history.  I'd love to show them the graves of their own ancestors, and I'd hope that they pass it on to my descendants long after I'm gone.  Greg Campbell recommended I visit the Hartland library as well, as they also have a great collection of genealogical and historical material, so there's already impetus for another trip.
					</p>
					<p>
						Until next time, Canada, thank you for the memories.
					</p>
				</section>
			</div>
		</content>
	</entry>

	<entry>
		<title>Do It Better: SSH</title>
		<id>urn:uuid:92dac542-1cd3-4362-be2e-5d1bde28b314</id>
		<link rel="alternate" type="text/html" href="https://colincogle.name/blog/do-it-better/ssh/" length="57781"/>
		<link rel="alternate" type="text/gemini" href="gemini://colincogle.name/blog/do-it-better/ssh/" length="28959"/>
		<link rel="alternate" type="text/markdown" href="https://colincogle.name/blog/do-it-better/ssh/do-it-better-ssh.md" length="29192"/>
		<link rel="alternate" type="text/plain" href="https://colincogle.name/blog/do-it-better/ssh/do-it-better-ssh.txt" length="31825"/>
		<link rel="alternate" type="application/gopher-menu" href="gopher://colincogle.name/1/blog/do-it-better/ssh/"/>
		<link rel="shortlink" href="http://colincogle.name/ssh"/>
		<link rel="related" href="http://colincogle.name/blog/sshfp"/>
		<category term="sysadmin" label="System administration"/>
		<category term="security"/>
		<category term="tutorials"/>
		<category term="PowerShell"/>
		<category term="Windows"/>
		<category term="macOS"/>
		<category term="Linux"/>
		<summary>SSH is easy to secure, but that doesn't mean there isn't more work to be done.</summary>
		<published>2023-11-07T22:35:00-05:00</published>
		<updated>2023-11-09T00:07:00-05:00</updated>
		<content type="xhtml">
			<div xmlns="http://www.w3.org/1999/xhtml">
			<section>
					<header><h2>Introduction</h2></header>
					<p>Let's talk about SSH.  It is the quintessential Swiss army knife for system administrators.  It can browse and transfer remote files, forward ports, proxy and tunnel traffic, but it's most famous for its eponymous job of giving you a remote shell, securely (hence its name).  As processors have gotten faster and cheaper, and encryption has become almost frictionless, it's long since replaced Telnet for configuring embedded devices.  In fact, even <a href="https://learn.microsoft.com/en-us/windows-server/administration/openssh/openssh_overview">Microsoft acquiesced and made SSH a first-class citizen</a> starting with Windows Server 2019.</p>

					<p>You'd think with SSH everywhere, it would be easy to configure, right?  Well, you are right.  In fact, the default configuration of OpenSSH is pretty secure, but I guarantee you're still not implementing it as well as you could.</p>
				</section>

				<section>
					<header><h2>Installing It</h2></header>
					<p>I'm going to assume that your operating system either includes or is supported by a recent version of OpenSSH.  We're going to configure things to support only the most modern features, so if you're trying to connect with an ancient version of macOS or PuTTY for Windows Vista, you might get shown the cold shoulder.  <em>We're dealing with security.  Upgrade your software.</em></p>

					<section>
						<header><h3>The Client</h3></header>
						<p>Every major desktop operating system — even Windows — now includes the OpenSSH client (the part you use to connect to other SSH servers).  Open up a terminal, PowerShell window, Command Prompt, or what-have-you and try typing in <kbd>ssh</kbd>.  I bet something will happen.</p>
					</section>

					<section>
						<header><h3>The Server</h3></header>
						<p>As for the OpenSSH server (the thing you log into), how you get that depends on your operating system.  For Windows 10, Windows Server 2019, and newer, the OpenSSH client is usually installed by default, while <a href="https://learn.microsoft.com/en-us/windows-server/administration/openssh/openssh_install_firstuse">the OpenSSH server exists as a Feature On Demand</a>.  It's built into macOS but dormant until you <a href="https://support.apple.com/guide/mac-help/allow-a-remote-computer-to-access-your-mac-mchlp1066/mac">go into <b>Sharing Preferences</b> and enable <b>Remote Login</b></a>.  Meanwhile, on Linux, you should try installing <kbd>openssh-server</kbd> and seeing what happens.</p>

						<p>If you're using a network device or some other embedded device, check and see what's available.  Enterprise-oriented networking equipment often includes an SSH server.  Embedded devices typically use a smaller SSH daemon like Busybox or Dropbear, neither of which I'm going to cover in detail in this article.  This article is focused more on permanent installations, such as on a remote server.</p>
	
						<p>Once you've installed an SSH server, you will have to edit text files to get it configured just the way we like it.  UNIX and UNIX-like systems will install the configuration files into <code>/etc/ssh</code>.  (Windows users, it's somewhere under <code>C:\ProgramData</code>.)</p>

						<p>You could use a reference configuration like <a href="https://infosec.mozilla.org/guidelines/openssh">Mozilla's <b>Modern</b> OpenSSH setup</a>, or work with me while I create something newer.  Open up the server's main configuration file, <code>sshd_config</code>.  Most of the work we'll be doing will take place in this single file.  Leave it open and keep reading.</p>
					</section>
				</section>

				<section>
					<header><h2>Lock the Door, or Remove the Door</h2></header>
					<p>Let me state the obvious.  Just because SSH is secure, why risk it?  You are enabling and exposing a remote access method.  That's the whole point, but it bears repeating.  Consider how much risk you're willing to take, and don't push a half-assed solution into production.</p>

					<p>The first thing to consider is where you will be accessing this remote server <em>from</em>.  Just because we <em>can</em> open port 22 to the whole world doesn't mean that we should.  Ask yourself:</p>

					<section>
						<header><h3>I'll only be accessing this server from within my home, office, colo, etc.</h3></header>
						<p>Well, this makes it easy.  Don't expose SSH to the public Internet.  Do not add a firewall rule.  Do not create a NAT policy.  Do not pass Go and do not collect $200.  Look, you're already done with this step.</p>
					</section>

					<section>
						<header><h3>But I <em>could</em> be connecting from anywhere!</h3></header>
						<p>This is the other extreme.  Maybe you travel a lot.  Maybe you're often on random Wi-Fi networks.  Maybe your <abbr title="Internet service provider">ISP</abbr> only offers dynamic IP addresses.  Or, you might be lazy, and that's fine, too.</p>

						<p>In this case, just configure your firewall to allow SSH connections from anywhere.  For example, in this made-up firewall pseudocode, we might make the following changes:</p>

						<figure>
							<pre>add firewall rule "SSH Server" allow port 22/tcp from anywhere to "MyServer"
add firewall nat-policy "SSH Server IPv4" source (any to original) destination (WAN1 to "MyServer") port (22 to original)
save</pre>
							<figcaption>This pseudocode illustrates how to modify a firewall configuration via a command-line interface.  This is completely made up, so don't copy and paste it anywhere.</figcaption>
						</figure>

						<p>Every network should have some kind of firewall or network control device.  Maybe it's a fancy SonicWall or Cisco device.  Perhaps it's a simple Azure or AWS security group.  Perhaps it's just the modem/router hybrid your <abbr title="Internet service provider">ISP</abbr> gave you.  This part is left as an exercise to the reader.  (I believe in you.)</p>
					</section>
					
					<section>
						<header><h3>Okay, fine.  I <em>suppose</em> I only need access from a select few locations.</h3></header>
						<p>This scenario is often used in businesses, and mine is no exception.  My company policy is to make remote management interfaces only available to a select few IPv4 addresses and IPv6 subnets.  This does mean that remote employees (myself included) need to use a VPN or a remote desktop, but that's a small price to pay for a surprisingly-effective security implementation.  As I once explained this:</p>
						<blockquote>
							A hacker can't knock on the door if they can't get to it in the first place.
						</blockquote>

						<p>In this scenario, you will expose your SSH server to the Internet, setting up the necessary firewall rules (and IPv4 NAT policies, if you need that older protocol).  However, in this case, configure your firewall rules so that access is only allowed from certain IP addresses or subnets.  For example:</p>
	
						<figure>
							<pre>new address-group "Trusted IP Addresses"
edit address-group "Trusted IP Addresses" add address 192.0.2.1/32
edit address-group "Trusted IP Addresses" add address 2001:db8:1234::/48

add firewall rule "SSH Server" allow port 22/tcp from "Trusted IP Addresses" to "MyServer"

# for "legacy IP"
add nat-policy "SSH Server IPv4" source (any to original) destination (WAN1 to "MyServer") port (22 to original)
save</pre>
							<figcaption>A sample configuration in this made-up firewall language.  Hopefully it illustrates what I'm trying to show.</figcaption>
						</figure>

						<p>If your remote-side ISP only provides you dynamic IP addresses, maybe you can still configure this scenario.  Does your remote firewall offer some kind of VPN or VPN-like feature?  If so, set that up, then configure your firewall to allow SSH connections from VPN clients instead of the entire Internet.</p>
					</section>
				</section>

				<section>
					<header><h2>Security Through Obscurity?</h2></header>
					<p>Some people will tell you that you should never run SSH on the default port of TCP 22.  They'll advise you to pick another number.  While that may defer script kiddies and automated scans, it's trivial to find an SSH service.  For example, I could just scan all of your ports in the span of a few minutes:</p>
					<figure>
						<pre>nmap yourserver.yourdomain.com -p 1-65535 -A --open</pre>
						<figcaption>Yes, it's really that easy to scan an IP address.</figcaption>
					</figure>

					<p>Or, I can just <a href="https://www.shodan.io/search?query=ssh" rel="nofollow">type your IPv4 address into Shodan and get a report instantly</a>.  In either case, I found that your SSH server is running on port 42069, let's say.  I can also see what version of OpenSSH it uses, and begin to see how it might be configured.  Don't waste your time with security theater and just leave it on port 22.</p>
				</section>

				<section>
					<header><h2>One Lock, One Key</h2></header>
					<p>SSH relies on public key cryptography to authenticate servers and users.  There are four major key types still in use today:</p>
					<ul>
						<li>RSA is the tried and true key generation algorithm.  It's the oldest, but widely supported.  It does require large keys, which results in slower cryptography.</li>
						<li>DSA was another popular algorithm, but its time has passed.  It's been removed from OpenSSH 7.0 and newer, finally.</li>
						<li>ECDSA was the first major challenger to the RSA hegemony.  It uses smaller keys without compromising security.  However, it's imperfect, and some people believe that the United States government may have backdoored it.  (If so, Edward Snowden hasn't told us about it.)</li>
						<li>EdDSA is the newest algorithm that fixes the weaknesses of ECDSA and matches or exceeds the security of RSA.  It's also much faster.  One specific curve, Curve25519, has taken the cryptography world by storm and is gaining wide support in the industry.</li>
					</ul>

					<p>My recommendation is to use EdDSA for everything, falling back to ECDSA or RSA if needed.  However, since we're only targeting the newest versions of OpenSSH, let's forget that anything besides Curve25519 exists.</p>

					<section>
						<header><h3>Host Keys</h3></header>
						<p>When you start SSH for the first time, you'll notice that it generates many different kinds of host keys:  RSA, ECDSA, and Ed25519 (and DSA if you have an older version).  There's no need to use anything but the newest, so let's disable and delete the others.</p>
						<p>Stop your SSH server, and edit your <code>sshd_config</code> file.  Comment out all of the other `HostKey` lines.</p>
						<figure>
							<pre><ins>#</ins>HostKey /etc/ssh/ssh_host_rsa_key
<ins>#</ins>HostKey /etc/ssh/ssh_host_ecdsa_key
HostKey /etc/ssh/ssh_host_ed25519_key</pre>
							<figcaption>Comment out all other <code>HostKey</code> lines.</figcaption>
						</figure>

						<p>Now, delete all other host keys and restart OpenSSH:</p>
						<figure>
							<kbd>rm /etc/ssh/ssh_host_*sa_key*<br/>systemctl restart sshd</kbd>
							<figcaption>
								These commands delete all non-Ed25519 host keys from disk, and then restart OpenSSH.  If you have not edited <code>sshd_config</code>, then OpenSSH will replace the missing host keys.
							</figcaption>
						</figure>
					</section>

					<p>Now, only clients that support Ed25519 host keys can even attempt to log in.  This step by itself will break many old IP scanners, botnets, and script kiddies' tools.  (I look through my logs sometimes and see a lot of connections failing because <code>ssh-rsa</code> is unsupported.)</p>
				</section>

				<section>
					<header><h2>Keep Only the Best Key Exchanges</h2></header>
					<p>Now that we have only the best host key type remaining, let's take a look at the next stage of the SSH connection, when the client and server exchange keys and prepare to set up an encrypted session.  Just like with host keys, there are a lot of key exchanges supported.  We should only support the most secure ones.</p>

					<p>And, just like with host keys, older versions of OpenSSH may not be able to connect.  But if all our computers are using, let's say, OpenSSH 8, why bother supporting older versions?</p>

					<p>You can run the <kbd>ssh -Q kex</kbd> command to see all key exchanges supported by your version of OpenSSH, but there are three that we'll be using:</p>
					<ul>
						<li>
							<code>sntrup761x25519-sha512@openssh.com</code> provides excellent post-quantum security that doesn't affect performance too badly.  We'll use that first.
						</li>
						<li>
							<code>curve25519-sha256@libssh.com</code> and <code>curve25519-sha256</code> provide excellent security and performance.  Enable them both.  (I'm not sure what the difference is between them — <a href="https://mastodon.colincogle.name/@colin" rel="me">toot at me</a> if you do.)
						</li>
					</ul>
					
					<p>We're going to leave these off the list for varying reasons:</p>
					<ul>
						<li>The <code>ecdh</code> curves use ECDSA, and we prefer EdDSA.  They're fine to enable if needed.</li>
						<li><code>diffie-hellman-group-exchange-sha256</code> is older and slower, but still secure.  Still, I won't be using this.</li>
						<li>Anything like <code>diffie-hellman-group<var>N</var></code> should be avoided.</li>
					</ul>
					
					<p>Go ahead and put the algorithms you want into the <code>sshd_config</code> file, like so:</p>
					<figure>
						<code><ins>KexAlgorithms sntrup761x25519-sha512@openssh.com,curve25519-sha256@openssh.com,curve25519-sha256</ins></code>
						<figcaption>Our three most-secure key exchange algorithms.</figcaption>
					</figure>

					<p>With all of these multiple-choice directives, an SSH client and server will go down the list, from left to right, and use the first thing that they mutually agree on.  Always arrange them from most secure to least secure, and omit ones you don't want to support.</p>

					<section>
						<header><h3>Disabling Less-Secure Diffie-Hellman Moduli</h3></header>
						<p>Though we've disabled all Diffie-Hellman key exchanges in this topic, you may need to re-enable them if you need to support an older client.  Even if you don't, it's still good practice, just in case they get re-enabled for whatever reason.  There is a file, <code>/etc/ssh/moduli</code>, which needs to be edited.  While it can be edited by hand, <a href="https://infosec.mozilla.org/guidelines/openssh#intermediate-openssh-53">the fine folks at Mozilla have given us a Bash one-liner</a>:</p>
						<figure>
							<kbd>sudo sh -c "awk '<var>$5</var> &gt;= 3071' /etc/ssh/moduli &gt; /etc/ssh/moduli.tmp &amp;&amp; mv /etc/ssh/moduli.tmp /etc/ssh/moduli"</kbd>
							<figcaption>
								A single line of code to copy and paste into your terminal.
								(Source: <a href="https://infosec.mozilla.org/guidelines/openssh#intermediate-openssh-53">Mozilla Security Assurance and Security Operations</a>.  I've wrapped it into a call to <code>sudo</code> for your convenience.)
							</figcaption>
						</figure>
					</section>

					<p>Now, any DH key exchanges will use 3072-bit RSA at a minimum.</p>
				</section>

				<section>
					<header><h2>Ciphers for Bulk Encryption</h2></header>
					<p>Now that both sides can exchange keys securely, we need to look at ciphers.  We have far fewer options here, but that's fine because what's offered is quite secure.  You can use <kbd>ssh -Q cipher</kbd> to see what's supported.</p>
					<ul>
						<li>The <code>aes256-gcm@openssh.com</code> and <code>aes128-gcm@openssh.com</code> ciphers are the most secure, and AES in Galois Counter Mode is hardware-accelerated on most processors.  These are what most everyone should use.</li>
						<li><code>chacha20-poly1305@openssh.com</code> is another secure 256-bit algorithm that <em>may</em> be faster on some embedded devices and older ARM processors.</li>
						<li><code>aes256-<span aria-label="counter">ctr</span></code>, <code>aes192-<span aria-label="counter">ctr</span></code>, <code>aes128-<span aria-label="counter">ctr</span></code> are older but still secure implementations of AES.  They might not be as fast as the AES-GCM ones.</li>
					</ul>

					<p>Do not use any of these:</p>
					<ul>
						<li>CBC cipher modes are subject to padding oracle attacks.</li>
						<li>CAST-128, 3DES, and Blowfish use 64-bit blocks which are considered too small these days.</li>
						<li>SHA-1 collisions can be manufactured.</li>
						<li>Rijndael is a pre-standards version of AES.</li>
					</ul>

					<p>Let's add this line to our <code>sshd_config</code> file:</p>
					<figure>
						<code><ins>Ciphers aes256-gcm@openssh.com,aes128-gcm@openssh.com,chacha20-poly1305@openssh.com</ins></code>
						<figcaption>These three are the most secure ciphers.  Feel free to re-arrange them for best performance.</figcaption>
					</figure>

					<section>
						<header><h3>Performance Considerations</h3></header>
						<p>While both provide security that won't be broken anytime soon, I would recommend using AES-256 over AES-128 in most cases.  However, I sometimes run graphical apps over SSH by using Waypipe (and the older X forwarding), and I have noticed AES-128 provides a significant speed boost in that case.  If you plan to use Waypipe, X forwarding, or you plan to transfer a lot of files via SSH, you may want to consider listing AES-128 first.</p>
						<p>My servers prefer AES-256, but my desktop prefers AES-128.  If you're unsure, you can also set per-host settings on the client side — <a href="#sshconfig">more on that later</a>.</p>
					</section>
				</section>

				<section>
					<header><h2>Hashing and Data Verification</h2></header>
					<p>Finally, there are MACs — Message Authentication Codes — used to verify that encrypted data has not been modified, intentionally or otherwise, in transit.  Again, you can use <kbd>ssh -Q MACs</kbd> to view what's supported, and we'll promptly cull this long list.</p>
					<p>The SHA-2 family is the most secure, and there isn't much of a performance impact on modern hardware.  Sort by number of bits, in descending order.</p>
					<p>Avoid or disable anything with the following characteristics:</p>
					<ol>
						<li>Omit anything using 64-bit or 96-bit digests, as those are too small for modern use.</li>
						<li>Omit anything using broken algorithms like MD5 or SHA-1.</li>
						<li>Avoid anything using <a href="https://eprint.iacr.org/2023/277">weak algorithms like RIPEMD-160</a></li>
						<li>Avoid anything <em>not</em> using ETM (Encrypt-then-MAC mode), as the alternative of hashing before encrypting can lead to weaknesses.</li>
					</ol>

					<p>That doesn't leave us with much, but it leaves us with good options.  Add this line to your <code>sshd_config</code>.</p>
					<figure>
						<code><ins>MACs hmac-sha2-512-etm@openssh.com,hmac-sha2-256-etm@openssh.com,umac-128-etm@openssh.com</ins></code>
						<figcaption>Yet another line to add to your file.</figcaption>
					</figure>
				</section>

				<section>
					<header><h2>Other SSHd Options</h2></header>
					<p>Now, we're going to explore the other lines in the <code>sshd_config</code> file.  Many of these need little explanation, so I'm going to go through this next section quickly.</p>

					<section>
						<header><h3>Always Use SSH Version 2</h3></header>
						<p>SSH version 1 was deprecated back in <time datetime="2006-01">2006</time> with <a href="https://datatracker.ietf.org/doc/rfc4251/">RFC 4251</a>, and all support was removed from OpenSSH 7.6 back in <time datetime="2017-10-03">2017</time>.  It's dead.  Get on with your life.</p>

						<p>If it makes you feel better, try adding this to your <code>sshd_config</code> and hope it doesn't complain about an unsupported option:</p>
						<figure>
							<code><ins>Protocol 2</ins></code>
							<figcaption>
								If you <em>really</em> need SSH version 1, you should re-evaluate your life choices and figure out what mistakes led you to this moment.
							</figcaption>
						</figure>
					</section>

					<section>
						<header><h3>Don't Use Passwords, Use Keys</h3></header>
						<p>Take it from Mister <abbr title="Information Technology">IT</abbr> Guy over here:  <strong>don't use passwords if there's a better option</strong>.  Generating SSH keys is a quick and painless procedure.  Disable password-based logins and stop credential stuffing before it occurs.</p>
						<figure>
							<code># Disable password-based logins, and only allow key-based logins.<br/><ins>AuthenticationMethods publickey</ins></code>
							<figcaption>
								If you <em>really</em> have a good reason to be using SSH with password-based authentication in the age of credential stuffing, please hang up your keyboard and mouse and consider another career.
							</figcaption>
						</figure>

						<p>If your server and clients are joined to a Kerberos realm or an Active Directory domain, you can look into setting up OpenSSH's native Kerberos and GSSAPI authentication mechanisms.  A Kerberos ticket is arguably even more secure than a stealable key.  I haven't worked with OpenSSH and Kerberos in many years, so I won't pretend to know how to configure it.</p>
					</section>

					<section>
						<header><h3>Get Lost, Root!</h3></header>
						<p>There is literally no good reason to be working as root on a daily basis.  Anyone sane should be using <kbd>sudo</kbd> to elevate their own permissions.  However, it's possible you set a root password long ago, or you may have accidentally associated a public key with the root account.</p>
						<p>Regardless, logging in as root over a network is a pretty terrible idea.  Unless you can literally sit down and explain why you should not make this change, you should make this change:</p>
						<figure>
							<code><del>#PermitRootLogin prohibit-password</del><br/><ins>PermitRootLogin no</ins></code>
							<figcaption>If your SSH key gets compromised (somehow), at least the hackers won't have a root account.</figcaption>
						</figure>
					</section>

					<section>
						<header><h3>Do You Really Need X Forwarding?</h3></header>
						<p>X forwarding is a great way to run graphical Linux apps over an SSH connection, and have them appear on your remote screen like a native, local app.</p>
						<p>However, many Linux distributions have switched Xorg for Wayland.  If you use Wayland, you should be using Waypipe to run graphical apps over SSH, as I found it much faster.  Thus, if you're using Wayland, your server is headless, or all of this just plain sounds like a dumb idea, comment out the <b>X11Forwarding</b> line in <code>sshd_config</code>, or set it to <kbd>no</kbd>:</p>
						<figure>
							<code><ins># We don't need classic X11 forwarding to be supported.</ins><br/><ins>#</ins>X11Forwarding yes</code>
							<figcaption>Comment your config files.  You'll thank yourself eventually.</figcaption>
						</figure>
						<p>You can comment out any other options that start with `X11` if you like a nice, clean configuration file;  however, they won't have any effect.</p>
					</section>

					<section>
						<header><h3>More Logging</h3></header>
						<p>If something goes wrong, you're going to want to refer to your logs, so let's make sure we generate some useful data.  If you'd like to know which keys are being used to log into your server, bump up the logging level.</p>
						<figure>
							<code>SyslogFacility AUTH<br/>LogLevel <del>INFO</del><ins>VERBOSE</ins></code>
							<figcaption>Add or edit these lines to your <code>sshd_config</code>.</figcaption>
						</figure>

						<p>You can also log what people do via SFTP file transfers.</p>
						<figure>
							<code>Subsystem sftp /usr/lib/sftp-server <ins>-f AUTHPRIV -l INFO</ins></code>
							<figcaption>Another quick edit to <code>sshd_config</code>.</figcaption>
						</figure>

						<p>After a successful login, you should show the user their previous login to make sure it matches what they expect.</p>
						<figure>
							<code><del>#PrintLastLog no</del><br/><ins>PrintLastLog yes</ins><br/><br/><del>#UseDNS no</del><br/><ins>UseDNS yes</ins></code>
							<figcaption>If DNS lookups are computationally expensive for whatever reason, you can keep <b>UseDNS</b> off.</figcaption>
						</figure>
					</section>
				</section>

				<section>
					<header><h2>Storing SSH Fingerprints in DNS</h2></header>
					<p>When you connect to a new SSH server for the first time, you will be asked to verify the SSH fingerprint, so that you can avoid a future man-in-the-middle attack.  Most people will blindly accept it.  However, this process can be automated by putting the server's host key fingerprint(s) into DNS.</p>
					<p>Pick a public name for your server, and then feed it to the `ssh-keygen -r` command, like so:</p>
					<figure>
						<div>
							<kbd>ssh-keygen -r myserver.mydomain.com</kbd><br/><samp>myserver.mydomain.com. IN SSHFP 4 1 5919fdbf8b988eced9a8aca480708a791658aa64<br/>myserver.mydomain.com. IN SSHFP 4 2 e166e0335b269cf0b2a0a7cb58e672bce471dafd8b7af634165eed432608acf5</samp>
						</div>
						<figcaption>Output of the multipurpose <code>ssh-keygen</code> tool when you ask it to make SSHFP records (<code>-r</code>).</figcaption>
					</figure>

					<p>If you get more than two records, then you must have forgotten to delete your unwanted SSH host keys in the previous steps.  That's fine.  We only want the Ed25519 host key fingerprints, which all begin with the number <samp>4</samp>.  Ignore the others.</p>
					<p>Now, go to wherever you go to edit your DNS zone.  This might be Cloudflare, a local BIND server, or your registrar.  <a href="/blog/sshfp" rel="related">If you're unlucky enough to be using Microsoft DNS Server, I have you covered</a>, believe it or not.</p>
					<p>Next, add two new SSHFP records, one for each line.  If you're unluckier still and your DNS host doesn't support SSHFP records (looking at you, GoDaddy and Network Solutions), then you're out of luck.</p>
					<p>Note that this is all for naught if you don't use DNSSEC.  If your zones aren't signed, please look at a calendar, see what year it is, then ask yourself why you haven't secured your infrastructure yet.  Even GoDaddy realized how important secure DNS is to the Internet ecosystem and <a href="https://www.godaddy.com/help/what-is-dnssec-6135#activate">stopped charging extra for DNSSEC</a>.  (Even those scummy capitalists can do the right thing once in a while.)</p>
					<p>Now, edit your <em>local</em> machine's <code>/etc/ssh/ssh_config</code> file and add the following two lines:</p>
					<figure>
						<code>Host *<br/>VerifyHostKeyDNS yes</code>
						<figcaption>This is not yet supported on the Windows ports of OpenSSH, but it doesn't hurt to add it if/when Microsoft implements it.</figcaption>
					</figure>
					<p>Now, when you connect to an SSH server for the first time, SSHFP records will be retrieved from DNS, and your computer will help you decide if you're connecting to the right server.</p>
				</section>
				
				<section>
					<header><h3>Bonus: PowerShell Remoting over SSH</h3></header>
					<p>Believe it or not, this is now supported!  If <a href="https://learn.microsoft.com/en-us/powershell/scripting/learn/remoting/ssh-remoting-in-powershell">using SSH as a native transport for PowerShell remoting</a> sounds like something you want, add this line, substituting the correct path for your particular system:</p>
					<figure>
						<code><ins>Subsystem	powershell	/usr/bin/pwsh -sshs -NoLogo</ins></code>
						<figcaption>
							Add this line to your <code>/etc/ssh/sshd_config</code> file.  Substitute the correct path to your system's PowerShell binary.
						</figcaption>
					</figure>
				</section>
					
				<section>
					<header><h2>Setting Up Public-Key Authentication</h2></header>
					<p>Now that we've set up OpenSSH, we're ready to expose it to the Internet.  However, there is one problem we haven't addressed:  we can't log in.  Remember, we disabled password-based logins earlier!  To make SSH usable and secure, we're going to log in with a keypair.</p>

					<section>
						<header><h3>Generating Your First Keypair</h3></header>
						<p>If you already have one you'd like to use, skip this entire section.  On your computer (not the server), generate a new key.  Open up a terminal and, like before, we're going to use Ed25519.</p>
						<p>You'll be prompted to create a password to protect your key against theft.  Pick something strong, or throw your <abbr title="operational security">opesec</abbr> to the wind and use no password at all.</p>
						<figure>
							<code>mkdir -p ~/.ssh<br/>cd ~/.ssh<br/>ssh-keygen -t ed25519 -f id_ed25519</code>
							<figcaption>Three little commands will generate your first keypair.  Again, skip this if you have one you already prefer to use.</figcaption>
						</figure>
						<p>Now, why did I pick the name <kbd>id_ed25519</kbd>?  Keys named like <code>id_<var>algorithm</var></code> will be tried automatically when connecting to servers.  If you use a different name, you'll need to specify an <code>IdentityFile</code> manually for each remote server you connect to.</p>
						<p>In the <code>.ssh</code> folder in your home folder, you will have two files.  <code>id_ed25519</code> is your private key.  That should never leave your computer (except when being securely backed up), and never fall into the hands of an attacker.  This goes double if you decided not to protect your key with a password.  The other file is <code>id_ed25519<b>.pub</b></code>, which you can and will share with the world.</p>
						<p>Some people have strong philosophical opinions about using one keypair per server.  I disagree.  I believe a key is more closely associated with a person (or a person's device) and I have no problem using the same keypair for many servers.  However, I do create separate ones for personal use and work use.</p>
					</section>

					<section>
						<header><h3>Getting Your Public Key to the Server</h3></header>
						<p>Now that you have a public key, we need to get it to the server.  Copying and pasting is usually the simplest way, so open up <code>id_ed25519.pub</code> in a text editor and copy that whole thing.</p>
						<p>On the server, navigate to <code>~/.ssh</code> and edit the <code>authorized_keys</code> file.  Paste that public key onto a blank line, then hit save!</p>
					</section>

					<section>
						<header><h3>Moment of Truth</h3></header>
						<p>Let's give it a shot!</p>
						<figure>
							<kbd>ssh user@myserver.mydomain.com</kbd>
							<figcaption>Substitute everything as needed.</figcaption>
						</figure>
						<p>If your local and remote usernames are the same, you can leave off the <code>user@</code>.</p>
						<p>If you've set up SSHFP records, you should see <samp>Verified host key found in DNS.</samp>  Accept the correct fingerprint and you should be logged in!</p>
					</section>
				</section>

				<section>
					<header><h2>Multi-Factor Authentication</h2></header>
					<p>By this point, we've set up a pretty secure SSH server, but I'm sure my astute and security-conscious readers are getting ready to <a href="https://mastodon.colincogle.name/@colin" rel="me">send me angry toots</a> about me teaching them to expose a remote access method to the Internet with only single-factor authentication enabled.  If you're using Kerberos or only allowing certain IP addresses to connect, this <em>may</em> not be necessary.  Plus, keys are far less likely to be stolen than passwords.  Still, let me show you how to implement MFA via the classic TOTP method.</p>
					<p>These steps only apply to Linux systems that use <abbr title="Pluggable Authentication Modules">PAM</abbr> for user authentication, which should be almost all of them these days.  On your server, find and install the <a href="https://github.com/google/google-authenticator-libpam">Google Authenticator PAM module</a>.  On Debian-like systems, a simple <kbd>apt install libpam-google-authenticator</kbd> will do the trick.</p>
					<p>Since we're about to mess with the thing that authenticates users, open up another terminal or SSH session on the server, and <em>keep it open until we're done and we've tested that it works</em>.  Otherwise, a typo could lock you out and give you a very hard problem to fix.</p>
					<p>Edit the file <code>/etc/pam.d/sshd</code> and add the following line to the top, above the one that ends in <code>pam_nologin.so</code>:</p>
					<figure>
						<code><ins>auth	required	pam_google_authenticator.so</ins><br/>account	required	pam_nologin.so</code>
						<figcaption>
							You can add some space-separated parameters to that first line if you'd like.  We'll cover those shortly.
						</figcaption>
					</figure>
					<p>If you've made other changes to your PAM configuration files, then <a href="https://www.cricalix.net/2021/04/16/openssh-google-authenticator-pam-module/">you may need to do some debugging</a>.  Add <kbd title="with a space"> debug</kbd> to the end of that <code>pam_google_authenticator.so</code> line to generate more debugging output in your logs.</p>
					<p>Next, edit your <code>/etc/ssh/sshd_config</code> file, adding this new stuff and making sure these other lines are present, too:</p>
					<figure>
						<code>AuthenticationMethods publickey<ins>,keyboard-interactive:pam</ins><br/><ins>ChallengeResponseAuthentication yes</ins><br/>PermitEmptyPasswords no<br/>UsePAM yes</code>
						<figcaption>Two simple additions to your SSH server configuration will allow MFA to work.</figcaption>
					</figure>
					<p>Now, on the server, run the <kbd>google-authenticator</kbd> command to generate your secret (as a QR code) and some backup codes.  Scan the QR code with your authenticator app (despite the name, it doesn't need to be Google Authenticator) and be sure to save the backup <abbr title="Multi-Factor Authentication">MFA</abbr> codes somewhere safe.</p>
					<p>Moment of truth, again!  In a new window, try to SSH into your server again.  If all goes well, you'll be prompted for an MFA code before your SSH login completes.</p>
					<p>Note that <em>all</em> SSH users will be required to use MFA.  If they haven't set up MFA, then PAM will deny their SSH login every time.  To work around this, remove MFA enforcement by adding <kbd> nullok</kbd> to that PAM.d line we added earlier.</p>
				</section>

				<section id="sshconfig">
					<header><h2>Client-Specific Settings</h2></header>
					<p>Now that we've configured our servers, we can create profiles for our connections so that we don't need to remember and type in every single detail every time.  OpenSSH gives us two files:  the system-level <code>/etc/ssh/ssh_config</code> and the user-specific <code>~/.ssh/config</code>.  Both files have the same syntax.  Whichever one you choose to edit depends on your personal preferences.</p>
					<p>Note that, when you're writing this file, you may be connecting to SSH servers that you do not control.  You may want to leave all secure options in here, and let your SSH servers be more restrictive.</p>
					<figure>
						<figcaption>What follows is a sample <code>ssh_config</code> file.  I've got a lot of options in here to illustrate what can be done.  Obviously, you can and should tweak this to your liking, and if you find anything that sounds interesting, <kbd>man ssh_config</kbd> is your friend.</figcaption>
						<pre># Anything starting with "Host *" will be applied to all outgoing SSH connections.
Host *
	# Let's always attempt to use passwordless authentication.
	# We'll also set a default key to use, too.
	IdentitiesOnly yes
	IdentityFile ~/.ssh/id_ed25519
	
	# Always verify host keys via SSHFP records, if present.
	VerifyHostKeyDNS yes
	
	# In this section, we're going to say which host keys we will accept.
	# The "cert" options are for SSH certificates, which I did not cover in this article,
	# but are generally considered to be a good thing.
	HostKeyAlgorithms ssh-ed25519-cert-v01@openssh.com,ssh-rsa-cert-v01@openssh.com,ssh-ed25519,ssh-rsa,ecdsa-sha2-nistp521-cert-v01@openssh.com,ecdsa-sha2-nistp384-cert-v01@openssh.com,ecdsa-sha2-nistp256-cert-v01@openssh.com,ecdsa-sha2-nistp521,ecdsa-sha2-nistp384,ecdsa-sha2-nistp256
	
	# The next three options I already covered in detail above.
	KexAlgorithms sntrup761x25519-sha512@openssh.com,curve25519-sha256@libssh.org,curve25519-sha256,ecdh-sha2-nistp521,ecdh-sha2-nistp384,ecdh-sha2-nistp256,diffie-hellman-group-exchange-sha256
	MACs hmac-sha2-512-etm@openssh.com,hmac-sha2-256-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-512,hmac-sha2-256,umac-128@openssh.com
	Ciphers aes256-gcm@openssh.com,aes128-gcm@openssh.com,chacha20-poly1305@openssh.com,aes256-ctr,aes192-ctr,aes128-ctr
	
# Now, we can set host-specific stuff.
# In this example, I set a custom hostname and a faster cipher.
Host mydesktop
	HostName 2001:db8:0:1::1
	Ciphers aes128-gcm@openssh.com

# GitHub has many IP addresses.  To avoid having to constantly accept new keys,
# we can disable OpenSSH's IP-to-DNS mappings.
Host github.com
	CheckHostIP no
	StrictHostKeyChecking ask
	User rhymeswithmogul

# A hypothetical old piece of networking equipment may require insecure methods
# to be re-enabled.  You can amend your KexAlgorithms, HostKeyAlgorithms, MACs,
# and Ciphers lists with a plus sign. I like to do it this way, in case a future
# firmware update offers more secure options.
Host oldfirewall
	HostName 192.0.2.1
	User admin
	IdentityFile ~/.ssh/id_my_old_rsa_key
	KexAlgorithms +diffie-hellman-group-exchange-sha1</pre>
					</figure>
				</section>

				<section>
					<header><h2>In Conclusion</h2></header>
					<p>SSH isn't hard.  It's actually quite simple to configure and use, certainly more so than a modern email server.  However, we've taken the time to adjust some default settings, break some compatibilty, and we've hardened things significantly.  You can now SSH safely, and that's all that matters.</p>
				</section>
			</div>
		</content>
	</entry>

	<entry>
		<title>Fare Thee Well</title>
		<id>urn:uuid:e1a69fd8-d78b-4df2-81e1-83c0f8fe695f</id>
		<link rel="alternate" type="text/html" href="https://colincogle.name/blog/fare-thee-well/" length="19846"/>
		<link rel="alternate" type="text/gemini" href="gemini://colincogle.name/blog/fare-thee-well/" length="7645"/>
		<link rel="alternate" type="text/plain" href="https://colincogle.name/blog/fare-thee-well/fare-thee-well.txt" length="8098"/>
		<link rel="alternate" type="application/pdf" href="https://colincogle.name/blog/fare-thee-well/fare-thee-well.pdf" length="698049"/>
		<link rel="alternate" type="application/x-latex" href="https://colincogle.name/blog/fare-thee-well/fare-thee-well.tex" length="7214"/>
		<link rel="alternate" type="application/gopher-menu" href="gopher://colincogle.name/1/blog/fare-thee-well/" length="1315"/>
		<link rel="shortlink" href="http://colincogle.name/bus"/>
		<category term="Connecticut"/>
		<category term="capitalism"/>
		<category term="politics"/>
		<category term="public transit"/>
		<summary>Bus fares have returned to Connecticut, and more service changes will arrive for both road and rail.</summary>
		<published>2023-10-05T21:00:00-04:00</published>
		<updated>2023-10-16T21:13:00-04:00</updated>
		<content type="xhtml">
			<div xmlns="http://www.w3.org/1999/xhtml">
				<figure>
					<picture>
						<source type="image/avif" srcset="https://colincogle.name/blog/fare-thee-well/faresresume@750w.avif 750w, https://colincogle.name/blog/fare-thee-well/faresresume@1500w.avif 1500w, https://colincogle.name/blog/fare-thee-well/faresresume@3000w.avif 3000w"/>
						<source type="image/jxl" srcset="https://colincogle.name/blog/fare-thee-well/faresresume@750w.jxl 750w, https://colincogle.name/blog/fare-thee-well/faresresume@1500w.jxl 1500w, https://colincogle.name/blog/fare-thee-well/faresresume@3000w.jxl 3000w"/>
						<source type="image/webp" srcset="https://colincogle.name/blog/fare-thee-well/faresresume@750w.webp 750w, https://colincogle.name/blog/fare-thee-well/faresresume@1500w.webp 1500w, https://colincogle.name/blog/fare-thee-well/faresresume@3000w.webp 3000w"/>
						<img fetchpriority="high" srcset="https://colincogle.name/blog/fare-thee-well/faresresume@750w.jpg 750w, https://colincogle.name/blog/fare-thee-well/faresresume@1500w.jpg 1500w, https://colincogle.name/blog/fare-thee-well/faresresume@3000w.jpg 3000w" src="https://colincogle.name/blog/fare-thee-well/faresresume@750w.jpg" alt="A bus in downtown Hartford announces via its front-mounted dispaly that the resumption of fares begins April 1, 2023." longdesc="https://www.ctpublic.org/news/2023-04-18/free-fares-are-over-for-ct-bus-riders-whos-to-blame"/>
					</picture>
					<figcaption>
						A bus in downtown Hartford announces the resumption of fares beginning <time datetime="2023-04-01">April 1, 2023</time>.
						(<a href="https://ctmirror.org/2023/04/19/cttransit-ct-bus-fare-free-ending-april-1/cttransit-bus-fare/">Source</a>: Mark Mirko, <i>Connecticut Public</i>.)
					</figcaption>
				</figure>

				<p>
					After <time datetime="PT1Y">a full year</time> of giving Connecticut residents a (literal) free ride during the worst of global inflation, the Connecticut Department of Transportation ended its relief efforts and resumed collecting bus fares on <time datetime="2023-04-01">April 1, 2023</time>.
				</p>

				<p>
					Included in <a href="https://www.cga.ct.gov/2022/ba/pdf/2022HB-06001-R00SS1-BA.pdf">the bill last year that provided a "gas tax holiday" for drivers, American Rescue Plan Act funds were used to eliminate bus fares for CT Transit</a>.  Free rides were successful in convincing passengers to return in droves to the state's largest bus network, as <a href="https://www.wshu.org/connecticut-news/2022-09-27/connecticut-bus-fares-have-been-free-since-april-1-ridership-is-now-exceeding-pre-covid-totals">ridership rates rose to pre-pandemic levels and then some</a>.  Riders universally lauded the Lamont administration for the program, which helped many low-income riders get where they needed to go.  Thanks to the fare-free program, Daisy Rodriguez of Hartford, who uses the bus for work seven days a week, saved over $750 during the worst of inflation.  <a href="https://ctmirror.org/2022/07/17/ct-transit-bus-ridership-is-recovering-in-part-because-of-free-fares/">As quoted in the <i>Connecticut Mirror</i></a>, <q cite="https://ctmirror.org/2022/07/17/ct-transit-bus-ridership-is-recovering-in-part-because-of-free-fares/">She noted that before the program began, <q>Sometimes you don’t have the money for the bus fare, and you have to walk.</q></q>
				</p>

				<p>
					The benefits of Connecticut's fare-free program weren't just seen in the pockets of essential workers like Ms. Rodriguez.  At the peak of COVID-19 as long-haul commuters adjusted to working remotely, trains saw less than ten percent of their usual passengers;  however, local and essential workers continued to ride the bus, with Connecticut's buses carrying "only" about half as many passengers.  For those who rode through the early pandemic, $63 per month on an unlimited-use bus pass was some deserved money back in their pockets.
				</p>

				<p>
					Free or reduced fares are not a new concept.  They've existed in some form since World War II, often as a benefit for seniors, students, military members, the disabled, or essential workers.  Private companies this author has contracted with would often purchase transit passes for interns and new employees as a perk.
				</p>

				<p>
					Providing transportation for disadvantaged Americans and military families isn't just the right thing to do:  it's what any common-sense government would do.  How else is everyone, regardless of background, supposed to enjoy life, liberty, and the pursuit of happiness when they're stuck in a city, and can't afford a car due to financial constraints or the mere logistics of owning a car in an urban area?
				</p>

				<p>
					Connecticut's fare-free program put our cities alongside others including Boston; Richmond, <abbr title="Virginia">VA</abbr>; Albuquerque; Kansas City; and Olympia, <abbr title="Washington">WA</abbr>.  <a href="https://www.washingtonpost.com/nation/2022/03/14/boston-free-public-transit/">Boston mayor Michelle Wu told reporters <q cite="https://www.washingtonpost.com/nation/2022/03/14/boston-free-public-transit/">that removing barriers to public transportation is a major step toward climate justice, racial equity[,] and mobility.</q></a>
				</p>

				<p>
					Why did it end?  Fortunately, we got to hear it directly from the source.  <a href="https://www.ctpublic.org/news/2023-04-18/free-fares-are-over-for-ct-bus-riders-whos-to-blame">In an interview on Connecticut Public's <i>Where We Live</i> in <time datetime="2023-03-14">March 2023</time>, Governor Ned Lamont said that the federal Department of Transportation told him, <q cite="https://www.ctpublic.org/news/2023-04-18/free-fares-are-over-for-ct-bus-riders-whos-to-blame">[y]ou can't provide free bus service until you do an equity study.</q></a>  Though state and local municipalities may decide to set fares, federal civil rights laws prohibit changes that last more than twelve months unless a proper equity analysis is performed.  A spokesperson for the DOT said in response that <q>this is a routine activity for large transit systems and helps them evaluate whether fare changes will have disparate impacts on the basis of race, color, or national origin.</q>
				</p>

				<p>
					Since then, <a href="https://portal.ct.gov/-/media/DOT/documents/dptransportation/SAFE-2023-Documents/2023-CTDOT-Rail-and-Bus-SAFE_final-draft_230918.pdf">the Connecticut General Assembly's Transportation Committee has sat down and performed the study, releasing a draft of their report</a> on <time datetime="2023-09-18">September 18, 2023</time>.  The study found that a majority of Connecticut's public transportation would not undergo major changes, and thus, no equity analysis would be required.  In response to reduced ridership rates compared to pre-pandemic levels, there would be slightly fewer trains on Fridays and/or weekends.  Metro-North fares would go up by about six percent, or about forty cents for a one-way peak-hours ride; and the Hartford Line and Shore Line East would see an even smaller increase.  However, it's worth noting and commending that student pricing across all lines would stay the same or decrease.
				</p>

				<p>
					On the other hand, this year's budget gave more money to the state's bus lines, and service is getting a tune-up to focus on <q cite="https://portal.ct.gov/-/media/DOT/documents/dptransportation/SAFE-2023-Documents/2023-CTDOT-Rail-and-Bus-SAFE_final-draft_230918.pdf?page=46">better access to jobs, training, and education by providing service that operates later and seven days a week</q>.  Many bus and shuttle routes in the Hartford Division would be changed or consolidated, affecting riders in Hartford, Berlin, Newington, Bristol, and New Britain — including Central Connecticut State University; however, few routes would be eliminated entirely.  On the other hands, to accommodate growth in the south-central part of the state, the New Haven Division would see new lines created covering Northford, Wallingford, Meriden, Orange, and Milford.  While fare-free rides won't be returning permanently, it could make temporary comebacks due to construction, promotions, or "spare the air" days.
				</p>

				<p>
					That said, the case for moving people from point A to point B isn't an economic one.  It's not an expendable line item in the state's budget, nor in one's personal budget.  Public transit is an investment in people and the local economy.  Simply put, if workers can't <em>get</em> to work, then they <em>can't</em> work; and if workers can't work, then the economy suffers.  Fares need to be as low as possible, and routes need to be plentiful and efficient to ensure that workers can go where they are needed.  On the other side of the balancing act, bus drivers deserve to be paid well for their role in bringing an invaluable public service to every stop along the route.  The next step is for our state legislators to review the committee's report and help Connecticut residents to get where they need to go.
				</p>
			</div>
		</content>
	</entry>

	<entry>
		<title>PowerShell Polish, Part 1:  Perfecting Your Scripts</title>
		<id>urn:uuid:a8464f82-0fdc-4322-b0ca-11f890fed820</id>
		<link rel="alternate" type="text/html" href="https://colincogle.name/blog/powershell-polish-1" length="52366"/>
		<link rel="alternate" type="text/markdown" href="https://colincogle.name/blog/powershell-polish-1/powershell-polish-1.md" length="20692"/>
		<link rel="alternate" type="text/gemini" href="gemini://colincogle.name/blog/powershell-polish-1/" length="20292"/>
		<link rel="alternate" type="text/plain" href="https://colincogle.name/blog/powershell-polish-1/powershell-polish-1.txt" length="22633"/>
		<link rel="alternate" type="application/gopher-menu" href="gopher://colincogle.name/1/blog/powershell-polish-1" length="3308"/>
		<link rel="shortlink" href="http://colincogle.name/PoSH1"/>
		<category term="PowerShell"/>
		<category term="Git"/>
		<category term="open source"/>
		<category term="tutorials"/>
		<summary>Here's how to take your PowerShell script and turn it into the best version of itself.</summary>
		<published>2023-06-25T22:18:00-04:00</published>
		<updated>2023-06-25T22:18:00-04:00</updated>
		<content type="xhtml">
			<div xmlns="http://www.w3.org/1999/xhtml">
				<figure>
					<picture>
						<source type="image/avif" srcset="https://colincogle.name/blog/powershell-polish-1/LookingRatherPoSH@320w.avif 320w, https://colincogle.name/blog/powershell-polish-1/LookingRatherPoSH@640w.avif 640w, https://colincogle.name/blog/powershell-polish-1/LookingRatherPoSH@1280w.avif 1280w, https://colincogle.name/blog/powershell-polish-1/LookingRatherPoSH@1920w.avif 1920w, https://colincogle.name/blog/powershell-polish-1/LookingRatherPoSH@2560w.avif 2560w, https://colincogle.name/blog/powershell-polish-1/LookingRatherPoSH.avif 3861w" sizes="(max-width:400px) 320px, (max-width:960px) 640px, (max-width:1813w) 1280px, (max-width:2700px) 1920px, (max-width:3600px) 2560px, 3861px"/>
						<source type="image/webp" srcset="https://colincogle.name/blog/powershell-polish-1/LookingRatherPoSH@320w.webp 320w, https://colincogle.name/blog/powershell-polish-1/LookingRatherPoSH@640w.webp 640w, https://colincogle.name/blog/powershell-polish-1/LookingRatherPoSH@1280w.webp 1280w, https://colincogle.name/blog/powershell-polish-1/LookingRatherPoSH@1920w.webp 1920w, https://colincogle.name/blog/powershell-polish-1/LookingRatherPoSH@2560w.webp 2560w, https://colincogle.name/blog/powershell-polish-1/LookingRatherPoSH.webp 3861w" sizes="(max-width:400px) 320px, (max-width:960px) 640px, (max-width:1813w) 1280px, (max-width:2700px) 1920px, (max-width:3600px) 2560px, 3861px"/>
						<img src="https://colincogle.name/blog/powershell-polish-1/LookingRatherPoSH@640w.jpg" lowsrc="https://colincogle.name/blog/powershell-polish-1/LookingRatherPoSH@low.jpg" srcset="https://colincogle.name/blog/powershell-polish-1/LookingRatherPoSH@320w.jpg 320w, https://colincogle.name/blog/powershell-polish-1/LookingRatherPoSH@640w.jpg 640w, https://colincogle.name/blog/powershell-polish-1/LookingRatherPoSH@1280w.jpg 1280w, https://colincogle.name/blog/powershell-polish-1/LookingRatherPoSH@1920w.jpg 1920w, https://colincogle.name/blog/powershell-polish-1/LookingRatherPoSH@2560w.jpg 2560w, https://colincogle.name/blog/powershell-polish-1/LookingRatherPoSH.jpg 3861w" sizes="(max-width:400px) 320px, (max-width:960px) 640px, (max-width:1813w) 1280px, (max-width:2700px) 1920px, (max-width:3600px) 2560px, 3861px" itemprop="url" alt="The PowerShell mascot getting her hair done." class="webfeedsFeaturedVisual"/>
					</picture>
					<figcaption>We'll have you looking <q aria-label="posh">PoSH</q> in no time.  [Image credit: me]</figcaption>
				</figure>
				<section>
					<header><h2>Introduction</h2></header>
					<p>If you know what PowerShell is, then there's a good chance that you're a Windows power user or a <abbr title="system administrator">sysadmin</abbr> of some sort.  Moreover, if you're working with PowerShell on a daily or weekly basis, you've probably written a really nice script.  Whether you made it to put a new tool in your virtual tool belt, to automate some tedious task, or just for a programming challenge; congratulations on writing a cool script.</p>
					<p>Now, you might be tempted to toss it deep inside your Documents folder and call it done.  However, if your code is like <em>anything ever written</em>, you'll inevitably be faced with two hurdles:  how to share your file, and how to manage version control.  With a little work up front, you can transform your script from something static and unchanging into something that you'll want to share with the entire world.</p>
					<p>In the PowerShell world, there are two ways to package something for mass consumption:  <b>scripts</b> and <b>modules</b>.  While modules are a better way to package and share multiple files, we'll save those for another article.  Today, we're going to focus on scripts, single files that contain all of your code.</p>
					<p>While you can read the article by itself, you're free to use this as a guide to update one of your own creations.  If you have a script of yours in mind, go ahead and open it up in your favorite code editor.  (If you're looking for one, I recommend <a href="https://code.visualstudio.com/">Visual Studio Code</a>.)</p>
				</section>
				<section>
					<header><h2>Our Example Script</h2></header>
					<p>For the purposes of this article, I'm going to be working on this little script.  It's nothing more than a quick game of guess the number, a rite of passage for any computer science student, somewhere between saying <q>Hello World!</q> and <a href="https://en.wikipedia.org/wiki/Hunt_the_Wumpus">hunting a wumpus</a>.  To illustrate some concepts as we go along, I've tried to violate some best practices and make some garish styling decisions that I otherwise would not do.</p>
					<figure>
						<code class="code powershell">
							<span>
								<span class="comment"># version 1.3</span>
							</span><br/>
							<span>
								<span class="cmdlet">echo</span>
								<span class="string">"Welcome to Gues the Number!"</span>
							</span><br/>
							<span>
								<span class="variable">$x</span>
								<span class="operator">=</span>
								<span class="cmdlet">Get-Random <span class="parameter">-min</span> <span class="number">1 6</span></span>
							</span><br/>
							<span>
								<span class="operator">Do</span><span class="level1">{</span>
							</span><br/>
							<span>
								<span class="variable">$guess</span><span class="operator">=</span><span class="cmdlet">Read-Host</span>
								<span class="string">"what's your guess?"</span>
							</span><br/>
							<span>
								<span class="operator indent">if</span>
								<span class="level2">(</span><span class="variable">$guess</span>
								<span class="operator">-eq</span>
								<span class="variable">$x</span><span class="level2">) {</span><span class="cmdlet">write-host</span>
								<span class="string">"You win!"</span><span class="level2">}</span>
							</span><br/>
							<span>
								<span class="operator indent">else</span>
							</span><br/>
							<span>
								<span class="level2 indent">{</span><span class="cmdlet">Write-host</span>
								<span class="string">"Wrong!"</span><span class="level2">}</span>
							</span><br/>
							<span>
								<span class="level1">}</span>
								<span class="operator">while</span><span class="level1">(</span><span class="variable">$guess</span>
								<span class="operator">-ne</span>
								<span class="variable">$x</span><span class="level1">)</span>
							</span>
						</code>
						<figcaption>Figure 1: Our working script before making any changes.</figcaption>
					</figure>
				</section>

				<section>
					<header><h2><span title="git gud">Git Good</span>:  Versioning and Source Control</h2></header>
					<p>If you're following along at home, I'm going to have you make a lot of changes to your script as we go along.  Thus, I'm bumping this up to step number one.  You'll see why.</p>
					<p>Eventually, you (or one of your users) will find a bug in your script, and you'll have to fix it.  The biggest problem with managing a script is keeping track of your changes.  You might be thinking to yourself, <q>Why would I ever need an old version of my script?</q>  Well, let's assume that, over time, you make a version 1.1, then a version 1.2, and then a version 1.3 that has a bug.  How do you know <em>when</em> the bug was introduced?  Could it be something you changed recently, or could it be something you changed last week?</p>
					<p>This is where a version control system comes into play.  The most popular one right now is called <b>Git</b>.  You can quickly install it on your system:</p>
					<ul>
						<li>Windows users should download and install <a href="https://gitforwindows.org/">Git for Windows</a>.  (This is what I use at work.)</li>
						<li><a href="https://git-scm.com/download/mac">macOS users have a few options</a>, including <a href="https://apps.apple.com/us/app/xcode/id497799835?mt=12">downloading Xcode from the Mac App Store</a> (which is a lot, unless you install only the command-line tools, but it's a pretty nice <abbr title="integrated development environment">IDE</abbr>, too).</li>
						<li>Linux users might already have it installed, but if not, something like <code class="bash"><span class="command">sudo apt</span> <span class="parameter">install</span> <span class="string">git</span></code> might do the trick.</li>
					</ul>
					<p>Git only works on entire folders, so create a new folder and put your script inside it.  Once you've done that, we're going to initiate a new repository, add your file to Git's tracking, and commit it to a version 1.3 tag.</p>
					<figure>
						<code class="code powershell">
							<span>
								<span class="prompt">PS C:\&gt;</span>
								<span class="cmdlet">mkdir</span>
								<span class="string">GuessTheNumber</span>
							</span><br/>
							<span>
								<span class="prompt">PS C:\&gt;</span>
								<span class="cmdlet">mv</span>
								<span class="string">GuessTheNumber.ps1</span>
								<span class="string">GuessTheNumber</span>
							</span><br/>
							<span>
								<span class="prompt">PS C:\&gt;</span>
								<span class="cmdlet">cd</span>
								<span class="string">GuessTheNumber</span>
							</span><br/>
							<span>
								<span class="prompt">PS C:\&gt;</span>
								<span class="cmdlet">git init</span>
							</span><br/>
							<span>
								<span class="prompt">PS C:\&gt;</span>
								<span class="cmdlet">git add</span>
								<span class="parameter">-A</span>
							</span><br/>
							<span>
								<span class="prompt">PS C:\&gt;</span>
								<span class="cmdlet">git commit</span>
								<span class="parameter">-m</span>
								<span class="string">"Initial commit"</span>
							</span><br/>
							<span>
								<span class="prompt">PS C:\&gt;</span>
								<span class="cmdlet">git tag</span>
								<span class="string">v1.3</span>
								<span class="parameter">-m</span>
								<span class="string">"This was the first version I put into Git.</span>
							</span>
						</code>
						<figcaption>
							Figure 2: Congratulations!  We've initiated a new Git repository, and committed our file into it.
						</figcaption>
					</figure>
					<p>Now that we have our initial version safely tucked away in Git, we can work to our heart's content!</p>

					<h3>Further Reading</h3>
					<p>I don't have time to go into Git in-depth here.  One could write an entire book explaining how Git works, but if you're looking for a good tutorial, I can personally recommend <a href="https://learn.microsoft.com/en-us/training/challenges?id=1c865402-c95c-4a52-9f34-35a1c559861c">the Microsoft Developer Tools Challenge</a>.</p>
				</section>

				<section>
					<header><h2>Styling Your Code</h2></header>
					<p>Our first goal is to clean up our spaghetti code and make it look pretty.  We won't be changing any functionality, but by making it look nicer, it will be easier for you (or others) to read and maintain.</p>
					<p>Everyone has or develops their own coding style.  As someone who can code in C, C++, and Java, I tend to follow some parts of <a href="https://www.gnu.org/prep/standards/standards.html#Writing-C">the Standard C style</a> whenever it makes sense and whenever it makes the code the easiest to read.  Some tips I recommend:</p>
					<ul>
						<li>Comment your code wherever appropriate!  (If this is something that you're going to share with the world, consider writing your comments in English, as it's the <i lang="pml">lingua franca</i> of the programming world.)</li>
						<li>Give your variables useful names.  If you're not declaring a loop or a simple three-line function, then <code class="powershell"><var class="variable">$x</var></code> is probably a terrible name.</li>
						<li>Stick in a line break if it makes things look cleaner.</li>
						<li>Indent lines when opening a new block, and</li>
						<li>Put curly braces on their own line.</li>
						<li>Put spaces around operators.</li>
					</ul>
					<p>If you're contributing to someone else's project, look for a <code>CONTRIBUTING</code> file in the source code.  That will tell you what coding style the project expects from all contributors.  Please follow that, instead of what you and I think best.</p>
					<p>Regardless, no matter what, your PowerShell cmdlets and statements should be properly capitalized, matching however you see them in official documentation.  It also goes without saying that you should check your spelling and grammar.</p>
					<figure>
						<code class="code powershell">
							<span>
								<span class="comment"># <ins>This is </ins>version 1.3</span>
							</span><br/>
							<span>
								<span class="cmdlet">echo</span>
								<span class="string">"Welcome to Gues<ins>s</ins> the Number!"</span>
							</span><br/>
							<span>
								<ins> </ins>
							</span><br/>
							<span>
								<ins class="comment"># Pick a random number between one and six, inclusive.</ins>
							</span><br/>
							<span>
								<span class="variable">$<del>x</del><ins>theNumber</ins></span>
								<span class="operator">=</span>
								<span class="cmdlet">Get-Random <span class="parameter">-min</span> <span class="number">1 6</span></span>
							</span><br/>
							<span>
								<span class="operator"><del>d</del><ins>D</ins>o</span>
							</span><br/>
							<span>
								<span class="level1">{</span>
							</span><br/>
							<span>
								<ins>    </ins><span class="variable">$guess</span><ins> </ins><span class="operator">=</span><ins> </ins><span class="cmdlet">Read-Host</span>
								<span class="string">"What's your guess?"</span>
							</span><br/>
							<span>
								<span class="operator indent"><del>i</del><ins>I</ins>f</span>
								<span class="level2">(</span><span class="variable">$guess</span>
								<span class="operator">-eq</span>
								<span class="variable">$<del>x</del><ins>theNumber</ins></span><span class="level2">)</span><ins> </ins>
							</span><br/>
							<span>
								<span class="level2 indent">{</span>
							</span><br/>
							<span>
								<span class="cmdlet indent2"><del>w</del><ins>W</ins>rite-<del>h</del><ins>H</ins>ost</span>
								<span class="string">"You win!"</span><ins> </ins>
							</span><br/>
							<span>
								<span class="level2 indent">}</span>
							</span><br/>
							<span>
								<span class="operator indent"><del>e</del><ins>E</ins>lse</span>
							</span><br/>
							<span>
								<span class="level2 indent">{</span><ins> </ins>
							</span><br/>
							<span>
								<span class="cmdlet indent2">Write-<del>h</del><ins>H</ins>ost</span>
								<span class="string">"Wrong!"</span><ins> </ins>
							</span><br/>
							<span>
								<span class="level2 indent">}</span>
							</span><br/>
							<span>
								<span class="level1">}</span>
								<span class="operator"><del>w</del><ins>W</ins>hile</span><ins> </ins><span class="level1">(</span><span class="variable">$guess</span>
								<span class="operator">-ne</span>
								<span class="variable">$theNumber</span><span class="level1">)</span>
							</span>
						</code>
						<figcaption>Figure 3: Our code after fixing spelling, grammar, and poor style.  That's so much easier to read!  (Well, it would be if I didn't have the <del>deletions</del> and <ins>inserts</ins>.)</figcaption>
					</figure>
					<p>Now, let's commit our changes.</p>
					<figure>
						<code class="code bash">
							<span>
								<span class="command">git commit</span>
								<span class="parameter">-m <span class="string">"Fixed spelling, grammar, and style."</span></span>
							</span>
						</code>
						<figcaption>Figure 4: Commit your changes so you can track them later.  You should write better commit messages, too, but this isn't a Git best practices tutorial.  I'm just teaching you enough to get you up and running.</figcaption>
					</figure>
				</section>

				<section>
					<header><h2>PSScriptAnalyzer;  Or, How to Conform to PowerShell's Best Practices</h2></header>
					<p>Microsoft has developed an automated tool called <a href="https://learn.microsoft.com/en-us/powershell/utility-modules/psscriptanalyzer/overview?view=ps-modules"><b>PSScriptAnalyzer</b></a> to scan your PowerShell files for common mistakes, bad practices, and other things you should avoid.</p>
					<figure>
						<figcaption>Figure 5:  Downloading and running PSScriptAnalyzer.</figcaption>
						<code class="code powershell">
							<span>
								<span class="prompt">PS /home/colin&gt;</span>
								<span class="cmdlet">Install-Module</span>
								<span class="string">PSScriptAnalyzer</span>
							</span><br/>
							<span>
								<span class="prompt">PS /home/colin&gt;</span>
								<span class="cmdlet">Invoke-ScriptAnalyzer</span>
								<span class="string">./GuessTheNumber.ps1</span>
							</span>
						</code>
						<samp class="code powershell">RuleName : PSAvoidUsingCmdletAliases<br/>
Severity : Warning<br/>
Line     : 2<br/>
Column   : 1<br/>
Message  : 'echo' is an alias of 'Write-Output'. Alias can introduce possible problems and make scripts hard to maintain. Please consider changing alias to its full content.</samp>
					</figure>
					<p>As you can see, it complained that we used an alias in our code.  While it's much easier to type out interactively (and something I do frequently), you should always avoid that when writing scripts.</p>
					<p>Likewise, we should always spell out our parameters for clarity, and provide default and implied ones for clarity, too.  For example, in our call to <code class="powershell"><span class="cmdlet">Get-Random</span></code>, we'd used <code class="powershell"><span class="parameter">-min</span></code> when we should have used <code class="powershell"><span class="parameter">-Minimum</span></code>, and we can improve readability by adding in the implied <code class="powershell"><span class="parameter">-Maximum</span></code>.</p>
					<p>Remember, <em>you</em> might be a seasoned PowerShell expert, but that doesn't mean the next person reading your code will be.</p>
					<figure>
						<code class="code powershell">
							<span>
								<span class="comment"># This is version 1.3</span>
							</span><br/>
							<span>
								<span class="cmdlet"><del>echo</del><ins>Write-Output</ins></span>
								<span class="string">"Welcome to Guess the Number!"</span>
							</span><br/>
							<span/><br/>
							<span>
								<span class="comment"># Pick a random number between one and six, inclusive.</span>
							</span><br/>
							<span>
								<span class="variable">$theNumber</span>
								<span class="operator">=</span>
								<span class="cmdlet">
									Get-Random
									<span class="parameter">-<del>min</del><ins>Minimum</ins></span>
									<span class="number">1</span>
									<ins class="parameter">-Maximum </ins><span class="number">6</span>
								</span>
							</span><br/>
							<span>
								<span class="operator">Do</span>
							</span><br/>
							<span>
								<span class="level1">{</span>
							</span><br/>
							<span>
								<span class="variable indent">$guess</span>
								<span class="operator">=</span>
								<span class="cmdlet">Read-Host</span>
								<span class="string">"What's your guess?"</span>
							</span><br/>
							<span>
								<span class="operator indent">If</span>
								<span class="level2">(</span><span class="variable">$guess</span>
								<span class="operator">-eq</span>
								<span class="variable">$theNumber</span><span class="level2">)</span>
							</span><br/>
							<span>
								<span class="level2 indent">{</span>
							</span><br/>
							<span>
								<span class="cmdlet indent2">Write-Host</span>
								<span class="string">"You win!"</span>
							</span><br/>
							<span>
								<span class="level2 indent">}</span>
							</span><br/>
							<span>
								<span class="operator indent">Else</span>
							</span><br/>
							<span>
								<span class="level2 indent">{</span>
							</span><br/>
							<span>
								<span class="cmdlet indent2">Write-Host</span>
								<span class="string">"Wrong!"</span>
							</span><br/>
							<span>
								<span class="level2 indent">}</span>
							</span><br/>
							<span>
								<span class="level1">}</span>
								<span class="operator">While</span> <span class="level1">(</span><span class="variable">$guess</span>
								<span class="operator">-ne</span>
								<span class="variable">$theNumber</span><span class="level1">)</span>
							</span>
						</code>
						<figcaption>Figure 6: Cleaning up some common PowerShell trouble.</figcaption>
					</figure>
					<figure>
						<code class="code bash">
							<span>
								<span class="command">git commit</span>
								<span class="parameter">-m <span class="string">"Resolved PSScriptAnalyzer's complaints."</span></span>
							</span>
						</code>
						<figcaption>Figure 7: Get into the habit of making a commit whenever you complete a small step.</figcaption>
					</figure>
				</section>

				<section>
					<header><h2>Adding Metadata</h2></header>
					<p>This is where we start to move into the more PowerShell-specific things you can do to make your script a little easier to work on.  PowerShell has a comment block known as <code>PSScriptInfo</code> where you can specify metadata — that is, information about your script.</p>
					<p>Rather than type mere comments into your editor, you can and should define your metadata in a standard way (especially if you have dreams of this script being in the PowerShell Gallery someday).  You can use the <a href="https://learn.microsoft.com/en-us/powershell/module/powershellget/update-scriptfileinfo" class="powershell"><code class="cmdlet">Update-ScriptFileInfo</code></a> cmdlet to add a metadata block to your script, or you can edit most of it in your text editor:</p>
					<figure>
						<kbd class="code powershell">
							<span>
								<span class="prompt">PS /home/colin&gt;</span>
								<span class="cmdlet">Update-ScriptFileInfo</span>
								<span class="string">GuessTheNumber.ps1</span>
								<span class="parameter">-Author <span class="string">"Colin Cogle"</span></span>
								<span class="parameter">-Version <span class="number">1.3.0</span></span>
								<span class="parameter">-Description <span class="string">"Play a game of guess the number."</span></span>
							</span><br/>
							<span>
								<span class="prompt">PS /home/colin&gt;</span>
								<span class="cmdlet">Get-Content</span>
								<span class="string">GuessTheNumber.ps1</span>
							</span>
						</kbd><br/>
						<samp class="code powershell">
							<span><span class="comment">&lt;#PSScriptInfo</span></span><br/>
							<span><span class="comment">.VERSION 1.0</span></span><br/>
							<span><span class="comment">.GUID ff00ae24-9a16-4d6f-9845-ed7a7d8133b1</span></span><br/>
							<span><span class="comment">.AUTHOR colin</span></span><br/>
							<span><span class="comment">.COMPANYNAME</span></span><br/>
							<span><span class="comment">.COPYRIGHT</span></span><br/>
							<span><span class="comment">.TAGS</span></span><br/>
							<span><span class="comment">.LICENSEURI</span></span><br/>
							<span><span class="comment">.PROJECTURI</span></span><br/>
							<span><span class="comment">.ICONURI</span></span><br/>
							<span><span class="comment">.EXTERNALMODULEDEPENDENCIES </span></span><br/>
							<span><span class="comment">.REQUIREDSCRIPTS</span></span><br/>
							<span><span class="comment">.EXTERNALSCRIPTDEPENDENCIES</span></span><br/>
							<span><span class="comment">.RELEASENOTES</span></span><br/>
							<span><span class="comment"/></span><br/>
							<span><span class="comment">.PRIVATEDATA</span></span><br/>
							<span><span class="comment">#&gt;</span></span><br/>
							<span><span class="comment"/></span><br/>
							<span><span class="comment">&lt;#</span></span><br/>
							<span><span class="cmdlet">.DESCRIPTION</span></span><br/>
							<span><span class="comment"> foo</span></span><br/>
							<span><span class="comment"/></span><br/>
							<span><span class="comment">#&gt;</span></span><br/>
							<span><span class="comment"/></span><br/>
							<span><span class="operator">Param<span class="operator level1">()</span></span></span><br/>
							<span>[…]</span>
						</samp>
						<figcaption>
							Figure 8: If you just want to add the comment block and fill it in in your IDE, then you're like me; know that the only required parameter to make this run is <code class="powershell"><span class="parameter">-Description</span></code>.
						</figcaption>
					</figure>
					<p>Let's go ahead and fill out some of these fields.  You can remove any lines that you're not going to use or that don't apply.</p>
					<figure>
						<code class="code powershell">
							<span><span class="comment">&lt;#PSScriptInfo</span></span><br/>
							<span><span class="comment">.VERSION 1.3.0</span></span><br/>
							<span><span class="comment">.GUID ff00ae24-9a16-4d6f-9845-ed7a7d8133b1</span></span><br/>
							<span><span class="comment">.AUTHOR Colin Cogle</span></span><br/>
							<span><span class="comment">.COPYRIGHT © 2023 Colin Cogle. All Rights Reserved.</span></span><br/>
							<span><span class="comment">.TAGS number, guessing, game, tutorial, <span class="cmdlet">Windows</span>, <span class="cmdlet">macOS</span>, <span class="cmdlet">Linux</span></span></span><br/>
							<span><span class="comment">.LICENSEURI <a rel="license" href="https://www.gnu.org/licenses/agpl-3.0.en.html">https://www.gnu.org/licenses/agpl-3.0.en.html</a></span></span><br/>
							<span><span class="comment">.RELEASENOTES</span></span><br/>
							<span><span class="comment">This release of GuessTheNumber.ps1 contains many bug fixes:</span></span><br/>
							<span><span class="comment"> - Implement PSScriptInfo and help.</span></span><br/>
							<span><span class="comment"> - Code cleanup.</span></span><br/>
							<span><span class="comment">#&gt;</span></span><br/>
							<span/><br/>
							<span><span class="comment">&lt;#</span></span><br/>
							<span><span class="cmdlet">.DESCRIPTION</span></span><br/>
							<span><span class="comment"> foo</span></span><br/>
							<span/><br/>
							<span><span class="comment">#&gt;</span></span><br/>
							<span/><br/>
							<span><span class="operator">Param<span class="operator level1">()</span></span></span><br/>
							<span>[…]</span>
						</code>
						<figcaption>
							Figure 9:  This looks a lot nicer now that we've filled in the ScriptInfo fields.  We'll take care of the rest shortly.  (Note that I removed the extra line breaks as a manner of preference.)
						</figcaption>
					</figure>
					<p>Now, you have metadata defined in the proper manner, via two comment blocks.  This data can be read by <code class="powershell"><span class="cmdlet">Test-ScriptFileInfo</span></code>, online galleries, or by any eyeballs that happen to perusing your source code.  Be sure to update the version number and release notes whenever you decide it's time.</p>
				</section>

				<section>
					<header><h2>Get Help for <code class="powershell"><span class="cmdlet">Get-Help</span></code></h2></header>
					<p>How often have you looked at someone else's script or code and wondered how to use it?  Perhaps that won't be a problem with our script, but it's like I say at work:  <em>always</em> document your work.</p>
					<p>We can use <kbd>Get-Help</kbd> to learn more about this script:</p>
					<figure>
						<samp class="code powershell">
							<span>
								<span class="prompt">PS C:\&gt;</span>
								<kbd>
									<span class="cmdlet">Get-Help</span>
									.\GuessTheNumber.ps1
								</kbd>
							</span><br/>
							<span>GuessTheNumber.ps1</span>
						</samp>
						<figcaption>Figure 10: The output of <code>Get-Help</code>, by default.  There isn't much to look at.</figcaption>
					</figure>
					<p>If you haven't already, open up your PowerShell script and take a look at the new blocks in your script.  The second one is where we'll be focusing our attention.  What you're looking at is <a href="https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_comment_based_help">PowerShell's comment-based help system</a>.  This block consists of several paragraphs of plain text occasionally marked up with headings that begin with a dot.  (Though PowerShell was developed by Microsoft, this syntax looks a lot like <code>troff</code> commands from the UNIX world.)</p>
					<p>Let's go ahead and use some of the most common keywords to help describe our script.  At the very least, <code>.DESCRIPTION</code> was filled in for you, but we can add and edit others.  Note that we won't be using all of these.</p>
					<dl>
						<dt><code>.SYNOPSIS</code></dt>
						<dd>A one-line summary of what your script does.</dd>
						<dt><code>.DESCRIPTION</code></dt>
						<dd>A longer summary of what your code does.  You can write multiple paragraphs.</dd>
						<dt><code>.PARAMETER <var>InputObject</var></code></dt>
						<dd>If your script accepts command-line parameters, you should explain what they do.  If we had a parameter named <code>-InputObject</code>, we would proceed to describe it.  You can specify this as many times as you need.</dd>
						<dt><code>.INPUTS</code> and <code>.OUTPUTS</code></dt>
						<dd>If your script accepts pipeline input or generates pipeline output, provide the data type and a description.</dd>
						<dt><code>.EXAMPLE</code></dt>
						<dd>This is the only structured help item.  On the first line after this, show the command line.  Then, after a blank line, describe what that will do.  (Ironically, I will show the example later.)  You can specify this as many times as you want.</dd>
						<dt><code>.NOTES</code></dt>
						<dd>Is there anything else your users should know?  For example, do they need to run a command before attempting to run your script?  Does it only support certain data types?</dd>
						<dt><code>.LINK</code></dt>
						<dd>You can use this (multiple times, if you'd like) to recommend users read other help topics.  You can name other cmdlets, conceptual help topics, or specify a URL.  If you specify at least one HTTP or HTTPS URL, the first one will be used for <kbd class="powershell"><span class="cmdlet">Get-Help</span> <span class="parameter">-Online</span></kbd>.</dd>
					</dl>
					<p>Edit the second comment block to look something like this:</p>
					<figure>
						<code class="code powershell">
							<span><span class="comment">&lt;#</span></span><br/>
							<span><span class="comment">.SYNOPSIS</span></span><br/>
							<span><span class="comment"> Play a game of guess the number.</span></span><br/>
							<span/><br/>
							<span><span class="comment">.DESCRIPTION</span></span><br/>
							<span><span class="comment"> This script plays a game of guess the number.  The computer will pick a</span></span><br/>
							<span><span class="comment"> number between one and six, and you will be prompted to guess it.</span></span><br/>
							<span/><br/>
							<span><span class="comment">.EXAMPLE</span></span><br/>
							<span><span class="comment"> PS C:\&gt; .\GuessTheNumber.ps1</span></span><br/>
							<span/><br/>
							<span><span class="comment"> Begins a game.  This script runs interactively, and it does not accept</span></span><br/>
							<span><span class="comment"> pipeline input or parameters.</span></span><br/>
							<span/><br/>
							<span><span class="comment">.NOTES</span></span><br/>
							<span><span class="comment"> If you wish to stop playing, press Control-C to break.</span></span><br/>
							<span/><br/>
							<span><span class="comment">.LINK</span></span><br/>
							<span><span class="comment"> https://colincogle.name/blog/powershell-polish-1/</span></span><br/>
							<span><span class="comment">#&gt;</span></span><br/>
							<span/><br/>
							<span><span class="operator">Param<span class="operator level1">()</span></span></span>
						</code>
						<figcaption>Figure 11: The second comment block fleshed out with some helpful information.  Note that an empty parameter definition was automatically added.  This is required when using <code>PSScriptInfo</code>, comment-based help, or both.</figcaption>
					</figure>
					<p>Let's try that command again!</p>
					<figure>
						<samp class="code powershell">
							<span>
								<span class="prompt">PS C:\&gt;</span>
								<kbd>
									<span class="cmdlet">Get-Help</span>
									.\GuessTheNumber.ps1
								</kbd>
							</span><br/>
							<span/><br/>
							<span>NAME</span><br/>
							<span>	C:\GuessTheNumber.ps1</span><br/>
							<span/><br/>
							<span>SYNOPSIS</span><br/>
							<span>	Play a game of guess the number.</span><br/>
							<span/><br/>
							<span/><br/>
							<span>SYNTAX</span><br/>
							<span>	GuessTheNumber.ps1 [&lt;CommonParameters&gt;]</span><br/>
							<span/><br/>
							<span/><br/>
							<span>DESCRIPTION</span><br/>
							<span>	This script plays a game of guess the number.  The computer will pick a</span><br/>
							<span>	number between one and six, and you will be prompted to guess it.</span><br/>
							<span/><br/>
							<span/><br/>
							<span>RELATED LINKS</span><br/>
							<span>	https://colincogle.name/blog/powershell-polish-1/</span><br/>
							<span/><br/>
							<span>REMARKS</span><br/>
							<span>	To see the examples, type: "Get-Help GuessTheNumber.ps1 -Examples"</span><br/>
							<span>	For more information, type: "Get-Help GuessTheNumber.ps1 -Detailed"</span><br/>
							<span>	For technical information, type: "Get-Help GuessTheNumber.ps1 -Full"</span><br/>
							<span>	For online help, type: "Get-Help GuessTheNumber.ps1 -Online"</span>
						</samp>
						<figcaption>Figure 12: The output of <code>Get-Help</code>, thanks to our hard work!  Doesn't that look so much better?</figcaption>
					</figure>
					<p>Beautiful!  If you don't see everything you typed, that's normal; try running <kbd class="powershell"><span class="cmdlet">Get-Help</span> <span class="parameter">-Full</span></kbd> to learn everything.  <kbd>git add</kbd>, <kbd>git commit</kbd>, and let's wrap this up!</p>
				</section>

				<section>
					<header><h2>Going the Distance:  Signing Your Code</h2></header>
					<p>We've worked hard on our script, and now we've got something that's ready to share with the world.  Authors put their name on the cover, artists sign or tag their work, and PowerShell scripters also have the option to sign their code.  While this is optional, and you can run unsigned code perfectly well, there are many benefits to slapping a digital signature on your script:</p>
					<ol>
						<li>Windows PowerShell or Windows SmartScreen may show a warning when you try to run an unsigned script.</li>
						<li>In some corporate environments, an administrator may have used InTune or Group Policy to go one step further, and modify Windows PowerShell's execution policy such that unsigned scripts will not run.</li>
						<li>If anyone modifies your script, the signature will be invalid, which Windows will treat as <em>worse</em> than unsigned.</li>
						<li>You get to look professional (and enjoy a small ego boost) by seeing your name attached to your script.  This goes double if you're a business or if you code for a living.</li>
					</ol>

					<section>
						<header><h3>Where to Find Magic Bits</h3></header>
						<p>Now, we have a problem.  Where does someone get a code signing certificate?  While the <abbr title="Internet Security Research Group">ISRG</abbr> and Let's Encrypt have effectively democratized <em>server</em> certificates by making them available for free, they have no plans to do the same for other types — and that includes code signing certificates.  (I'll complain about <span aria-label="ess mime">S/MIME</span> certificates in another blog post.)</p>
						<p>You can use a self-signed certificate for small deployments.  You can share your certificate with your family and friends, and build your own little web of trust, but that is not scalable.  If someone asked me to install a certificate in my root store to run their script, I would do one of two things:  either click through the unsigned code warnings, or simply not run their script.</p>
						<p>Businesses might run their own internal certificate authority;  Active Directory Certificate Services is fairly popular.  If your company has its own private <abbr title="Certificate Authority">CA</abbr>, you could ask your <abbr title="Information Technology">IT</abbr> department to take a leap of faith and issue you a code signing certificate.  Having both run the <abbr title="Certificate Authority">CA</abbr> and used it to sign code, that's a wonderful option for code that will only run on company-owned computers.  For sharing with a wider audience, though, we're back to square one.</p>
						<p>You can detach-sign your code with PGP keys or distribute hashes, and hope your users verify everything before running it.  There's also some chatter about <a href="https://sigstore.dev" title="I can't quite figure this one out, but I think I'm all for it!">doing something with blockchains</a>, but it's going to be years before this can even be a contender.  Ultimately, if you want to sign your code <em>and</em> sign it properly so that anyone in the world can trust your code, then you will need to bite the bullet and pay someone money for these magic bits that make operating systems happy.  I was quite happy with <a href="https://SignMyCode.com" title="This is not a paid endorsement.  I'm just a satisfied customer.">SignMyCode.com</a>, but you should find a vendor that's right for you.</p>
						<p>In my case, I made an ECDSA private key, then gave my vendor a certificate signing request and a copy of my legal identification.  Once they verified that I'm me, I was the proud owner of <a href="/pgp/codesigning.cer">a globally-trusted code signing certificate</a>.</p>
					</section>

					<section>
						<header><h3>How to Sign a Script;  Or, How to Turn Magic Bits Into Other Magic Bits</h3></header>
						<p>You're going to need a Windows computer for the following step, as Microsoft doesn't make all of <code>Microsoft.PowerShell.Security</code>'s cmdlets — namely, <code class="powershell"><a href="https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.security/set-authenticodesignature" class="cmdlet">Set-AuthenticodeSignature</a></code> — available on other platforms.</p>
						<p>This little code block assumes that you have your one and only code signing certificate imported into your Personal store.</p>
						<figure>
							<code class="code powershell">
								<span>
									<span class="prompt">PS C:\&gt;</span>
									<span class="cmdlet">Set-AuthenticodeSignature</span>
									<span class="parameter">-Certificate</span>
									<span class="operator level1">(</span><span class="cmdlet">Get-ChildItem</span>
									<span class="string">Cert:\CurrentUser\My</span>
									<span class="parameter">-CodeSigning</span><span class="operator level1">)[</span><span class="number">0</span><span class="operator level1">]</span>
									<span class="operator">`</span>
								</span><br/>
								<span>
									<span class="indent parameter">-IncludeChain</span> NotRoot
									<span class="operator">`</span>
								</span><br/>
								<span>
									<span class="indent parameter">-TimestampServer</span>
									<span class="string">http://timestamp.digicert.com</span>
									<span class="operator">`</span>
								</span><br/>
								<span>
									<span class="indent parameter">-HashAlgorithm</span>
									<span>SHA256</span>
									<span class="operator">`</span>
								</span><br/>
								<span>
									<span class="indent parameter">-FilePath</span>
									<span class="string">.\GuessTheNumber.ps1</span>
								</span>
							</code>
							<figcaption>Figure 13: How to sign your code.  If, for some reason, you actually have opinions about timestamp servers, you can substitute your own.</figcaption>
						</figure>
						<p>If you look at your script, you will see a long comment block at the very end.  This is the digital signature and timestamp, encoded in a portable format.  If you right-click your script and choose Properties, you can also see your name on the new Digital Signatures tab!</p>
						<figure>
							<picture>
								<source type="image/avif" srcset="https://colincogle.name/blog/powershell-polish-1/digitalsignature.avif"/>
								<source type="image/webp" srcset="https://colincogle.name/blog/powershell-polish-1/digitalsignature.webp"/>
								<img src="https://colincogle.name/blog/powershell-polish-1/digitalsignature.png" lowsrc="https://colincogle.name/blog/powershell-polish-1/digitalsignature@low.png" alt="The Digital Signatures tab on Windows file properties, showing that a valid signature exists for this file." class="webfeedsFeaturedVisual" loading="lazy"/>
							</picture>
							<figcaption>Figure 14: See your name in the programmers' equivalent of shining lights.</figcaption>
						</figure>
					</section>
				</section>

				<section>
					<header><h2>In Conclusion</h2></header>
					<p>Congratulations on making it this far!  If you've been following along at home, you've now taken one of your own scripts and turned it into the best possible version of itself.  Go ahead and share it far and wide.</p>
					<p>You might have noticed that I didn't talk much about the <a href="https://powershellgallery.com">PowerShell Gallery</a>.  While you can publish and install scripts from it, it really focuses on modules, which I'll be touching on in a future blog post.</p>
				</section>
			</div>
		</content>
	</entry>

	<entry>
		<title>Watching Baseball in 2023</title>
		<id>urn:uuid:ea17973e-b122-44bc-9297-0ef981acf7c0</id>
		<link rel="alternate" type="text/html" href="https://colincogle.name/blog/watching-baseball-in-2023" length="24012"/>
		<link rel="alternate" type="text/markdown" href="https://colincogle.name/blog/watching-baseball-in-2023/watching-baseball-in-2023.md" length="10162"/>
		<link rel="alternate" type="text/gemini" href="gemini://colincogle.name/blog/watching-baseball-in-2023/" length="10410"/>
		<link rel="alternate" type="text/plain" href="https://colincogle.name/blog/watching-baseball-in-2023/watching-baseball-in-2023.txt" length="11740"/>
		<link rel="alternate" type="application/gopher-menu" href="gopher://colincogle.name/1/blog/watching-baseball-in-2023" length="3953"/>
		<link rel="shortlink" href="http://colincogle.name/K"/>
		<category term="Baseball"/>
		<category term="Capitalism" label="Capitalism Ruins Everything"/>
		<summary>The Internet lets you stream anything you want directly to your favorite screen, unless what you want is to watch a baseball game.</summary>
		<published>2023-04-13T22:36:00-04:00</published>
		<updated>2023-04-17T00:18:40-04:00</updated>
		<content type="xhtml">
			<div xmlns="http://www.w3.org/1999/xhtml">
				<div>
					<figure class="webfeedsFeaturedVisual u-photo u-featured">
						<picture class="webfeedsFeaturedVisual">
							<source type="image/avif" srcset="https://colincogle.name/blog/watching-baseball-in-2023/mlbtoot@narrow.avif" media="(max-width:500px)"/>
							<source type="image/jxl" srcset="https://colincogle.name/blog/watching-baseball-in-2023/mlbtoot@narrow.jxl" media="(max-width:500px)"/>
							<source type="image/wp2" srcset="https://colincogle.name/blog/watching-baseball-in-2023/mlbtoot@narrow.wp2" media="(max-width:500px)"/>
							<source type="image/webp" srcset="https://colincogle.name/blog/watching-baseball-in-2023/mlbtoot@narrow.webp" media="(max-width:500px)"/>
							<source type="image/png" srcset="https://colincogle.name/blog/watching-baseball-in-2023/mlbtoot@narrow.png" media="(max-width:500px)"/>
							<source type="image/avif" srcset="https://colincogle.name/blog/watching-baseball-in-2023/mlbtoot.avif"/>
							<source type="image/jxl" srcset="https://colincogle.name/blog/watching-baseball-in-2023/mlbtoot.jxl"/>
							<source type="image/wp2" srcset="https://colincogle.name/blog/watching-baseball-in-2023/mlbtoot.wp2"/>
							<source type="image/webp" srcset="https://colincogle.name/blog/watching-baseball-in-2023/mlbtoot.webp"/>
							<img src="https://colincogle.name/blog/watching-baseball-in-2023/mlbtoot.gif" lowsrc="https://colincogle.name/blog/watching-baseball-in-2023/mlbtoot@low.gif" alt="@colincogle@mastodon.social tooted: &quot;The #MLB streaming/TV schedule is getting more convoluted than ever, but I fear how bad watching a baseball game will be in a few years.  “You gonna watch the Yankees game tonight?”  “Yeah, I’m downloading Microsoft Word right now.”  “No, that’s next week. Tonight’s game is streaming at FDA.gov.”&quot;" longdesc="https://mastodon.social/@colincogle/110076038054873318/" class="webfeedsFeaturedVisual"/>
						</picture>
						<figcaption>
							<a href="https://mastodon.social/@colincogle/110076038054873318/" class="u-repost-of">The toot that started it all.</a>
						</figcaption>
					</figure>
				</div>

				<section>
					<header><h2>For The Love of the Game</h2></header>
					<p>
						When I was a kid, watching a baseball game was simple.  If you can't make it to the ballpark, you turn on the TV to one of your local channels.  Back then, WPIX had almost every New York Yankees game.  I can still hear Phil "Scooter" Rizzuto's voice in my head to this day.
					</p>
					<p>
						One day, things got a little more complicated.  I wanted to watch the game, but my father said that it wasn't on.  It was on some other network called MSG that we didn't get with basic cable.  Two networks?  That was manageable.  Most games were still on channel 11.  Life goes on.
					</p>
					<p>
						That brings our story to <time datetime="1995-10-03">the autumn of 1995</time>, and this young Yankees fan was more excited than Don Mattingly to finally get a taste of postseason baseball.  And what a year it was!  Not only did "Donnie Baseball" and I discover what playoffs were, but there were more of them this year!  On the other hand, I certainly needed help finding the right channel.  This wasn't on MSG, nor PIX.  I don't remember if it was on Fox or ESPN, but I'm glad that John Smoltz was too busy pitching to provide annoying commentary.  Sadly, our season ended at the Kingdone, just like Mattingly's long career.
					</p>
					<p>
						I don't need to tell anyone <a href="https://www.youtube.com/watch?v=sJe2dNJ3q48" title="YouTube: watch Wade Boggs ride a horse through Yankee Stadium">what happened in <time datetime="1996-10-26T22:55:00-05:00">1996</time></a>, or in 1998, 1999, and 2000.  The games were on one of two channels, and if I was somehow away from my screen, the dulcet sounds of John Sterling and Michael Kay were never too far away during those magnificent years.  Baseball was great, the plays were intense, and the steroids only made it all that more grandiose.
					</p>
					<figure>
						<picture>
							<source type="image/avif" srcset="https://colincogle.name/blog/watching-baseball-in-2023/wadeboggs@narrow@0.5x.avif 451w, https://colincogle.name/blog/watching-baseball-in-2023/wadeboggs@narrow.avif 902w" media="(max-width:982px)"/>
							<source type="image/jxl" srcset="https://colincogle.name/blog/watching-baseball-in-2023/wadeboggs@narrow@0.5x.jxl  451w, https://colincogle.name/blog/watching-baseball-in-2023/wadeboggs@narrow.jxl  902w" media="(max-width:982px)"/>
							<source type="image/webp" srcset="https://colincogle.name/blog/watching-baseball-in-2023/wadeboggs@narrow@0.5x.webp 451w, https://colincogle.name/blog/watching-baseball-in-2023/wadeboggs@narrow.webp 902w" media="(max-width:982px)"/>
							<source type="image/jpg" srcset="https://colincogle.name/blog/watching-baseball-in-2023/wadeboggs@narrow@0.5x.jpg  451w, https://colincogle.name/blog/watching-baseball-in-2023/wadeboggs@narrow.jpg  902w" media="(max-width:982px)"/>
							<source type="image/avif" srcset="https://colincogle.name/blog/watching-baseball-in-2023/wadeboggs@0.5x.avif 600w, https://colincogle.name/blog/watching-baseball-in-2023/wadeboggs.avif 1200w"/>
							<source type="image/jxl" srcset="https://colincogle.name/blog/watching-baseball-in-2023/wadeboggs@0.5x.jxl  600w, https://colincogle.name/blog/watching-baseball-in-2023/wadeboggs.jxl  1200w"/>
							<source type="image/webp" srcset="https://colincogle.name/blog/watching-baseball-in-2023/wadeboggs@0.5x.webp 600w, https://colincogle.name/blog/watching-baseball-in-2023/wadeboggs.webp 1200w"/>
							<img src="https://colincogle.name/blog/watching-baseball-in-2023/wadeboggs@0.5x.jpg" srcset="https://colincogle.name/blog/watching-baseball-in-2023/wadeboggs@0.5x.jpg 600w, https://colincogle.name/blog/watching-baseball-in-2023/wadeboggs.jpg 1200w" lowsrc="https://colincogle.name/blog/watching-baseball-in-2023/wadeboggs@low.jpg" alt="Wade Boggs riding on a policeman's horse after winning the World Series." longdesc="https://www.youtube.com/watch?v=Lac2R8qwTyw"/>
						</picture>
						<figcaption>
							<p>Wade Boggs and the horse he rode in on, moments after winning the 1996 World Series.  (Credit:  Gerald Herbert, New York Daily News)</p>
						</figcaption>
					</figure>
					<p>
						2001 still hurts, but imagine my surprise when, that next spring, the <abbr title="Yankees Entertainment and Sports">YES</abbr> Network launched.  Finally, almost every game was all in one place, and growing up in Connecticut, that was added to basic cable.  Of course, 'PIX got a few games, but MSG was finally out of the picture.  At long last, all 162 regular-season games were ready to watch.
					</p>
					<p><q>Holy cow!</q> indeed, Scooter.</p>
					<p>
						I've never paid for cable TV.  My college had it, but after I graduated, I didn't even bother.  One apartment had a TV antenna that got a fuzzy WPIX signal, until the digital switchover killed that for good.  I would watch here and there, but John Sterling and Suzyn Waldman were always a fixture whenever I had an open ear.  I didn't pay much attention to the TV world.  YES was there, and nothing bad was going to happen.
					</p>
					<p>
						And then, they put on <a href="https://en.wikipedia.org/wiki/Infield_shift" rel="nofollow">the shift</a>.
					</p>
				</section>

				<section>
					<header><h2>Content, <i lang="fr">à la Carte</i></h2></header>
					<p>
						Here we are in 2023, and the subscription era is in full swing.  Cable TV was insanely expensive, and I'm not alone in that sentiment.  It wasn't long before Netflix rose to prominence, and the entertainment wars started fresh.  However, unlike Betamax and HD-DVD, this was no physical media; these were bits pushed out over the Internet.  There would be no losers, no service thrown to the wayside, and everyone's apps coexisting peacefully, side-by-side.  Every service would get their few dollars a month, whether or not there were eyeballs watching.
					</p>
					<p>
						Unfortunately, this model eventually spiraled down.  The big players like Netflix and Hulu have seen growth slow down, and they're forced to invest in creating content instead of simply delivering it, in hopes that they'll stand out, and convince some people who are sick of being nickel-and-dimed to say goodbye to one of their competitors.  Big-budget movies and sophomoric animated content are two ways to do it, but they're starting to wisen up, and looking for markets that have been underserved.
					</p>
					<p>
						For us Yankees fans, YES still shows most of the games.  My poor father will get to watch most of the season, but more and more broadcasts are simply disappearing for him.  Amazon Prime will take some, Apple <span aria-label="TV Plus">TV+</span> will exclusively air some, and now Peacock wants to strut around?
					</p>
					<p>
						It's not that I <em>can't</em> keep track anymore.  It's that they made me stop caring.  Strike one.
					</p>
					<p>
						Why?  Each of these services will cost you five to ten dollars per month.  If you want to watch all 162 games this season, you're looking at eight months' worth of streaming services.  Quick and fuzzy math says it will be $240 for those three services—and, don't forget, this is on top of your regular cable bill!  It's enough to make a trip to Yankee Stadium look cheap.
					</p>
					<p>
						But let's say that you've got enough disposable income to blow on any streaming service you want.  Now you face the task of trying to set it all up.  <a href="https://www.bloomberg.com/news/articles/2022-05-14/mlb-frustrates-fans-as-baseball-moves-to-amazon-apple-streaming">In a Bloomberg article about this same topic</a>, one baseball fan's son was tasked with setting up his father to watch all the games.  <q cite="https://www.bloomberg.com/news/articles/2022-05-14/mlb-frustrates-fans-as-baseball-moves-to-amazon-apple-streaming"><q>He finds it all very confusing and bewildering,</q> John, 36, said later in an interview. <q>It makes me wonder what older fans are doing if they don't have younger children who know this stuff.</q></q>
					</p>
					<p>
						My father is in his late sixties, and he never cared to operate anything more complicated than a lamp.  Needless to say, he missed out on a lot of games last year, because they were exclusive to an app he can't download, on a platform he doesn't use, for a sort of device that he wouldn't care to use if I set it up and left it next to his bed.
					</p>
					<p>
						Millennials are currently the largest generation alive in the United States.  While we're pushing forty, <a href="https://adage.com/article/podcast-marketers-brief/how-major-league-baseball-trying-draw-more-young-fans/2327386" title="57 years old">the average baseball fan is nearly sixty years old</a>.  We're the most technologically-savvy generation, and my father wouldn't own a cell phone if he didn't have to.  (Don't get me started on landlines.)  While I can't blame any capitalist for cajoling the lion's share of the market in hopes to hook the next generation of baseball fans, it seems like they're giving the middle finger to their aging base.
					</p>
					<p>
						Older fans don't have the technical know-how.  Middle-aged fans don't have the time.  Younger fans don't have the money for all these apps and services.  Who exactly is Major League Baseball catering to these days?
					</p>
					<p>Swing and a miss for strike two.</p>
				</section>

				<section>
					<header><h2>Don't Hate the Players, Hate the Game</h2></header>
					<p>
						But that's fine, right?  Let the free market suffer.  You can go straight to the source and sign up for <a href="https://mlb.tv">MLB.TV</a>, right?  Live baseball games on any device.  Heck, T-Mobile hands it out for free almost every year.  Whip out your phone, tablet, computer, my dad's smart TV (which I could probably pre-configure for him), and stream any game you want.  Right?
					</p>
					<p>
						Called strike three!  The fans go down looking.
					</p>
					<figure>
						<picture>
							<source type="image/avif" srcset="https://colincogle.name/blog/watching-baseball-in-2023/terms@narrow.avif" media="(max-width:958px)"/>
							<source type="image/webp" srcset="https://colincogle.name/blog/watching-baseball-in-2023/terms@narrow.webp" media="(max-width:958px)"/>
							<source type="image/png" srcset="https://colincogle.name/blog/watching-baseball-in-2023/terms@narrow.png" media="(max-width:958px)"/>
							<source type="image/avif" srcset="https://colincogle.name/blog/watching-baseball-in-2023/terms.avif"/>
							<source type="image/webp" srcset="https://colincogle.name/blog/watching-baseball-in-2023/terms.webp"/>
							<img src="https://colincogle.name/blog/watching-baseball-in-2023/terms.png" lowsrc="https://colincogle.name/blog/watching-baseball-in-2023/terms@low.png" alt="MLB.TV signup page with &quot;out-of-market games&quot; circled." longdesc="https://www.mlb.com/live-stream-games/subscribe"/>
						</picture>
						<figcaption>
							<p>A screenshot of the MLB.TV sign-up page.  Emphasis mine on <q cite="https://www.mlb.com/live-stream-games/subscribe">out-of-market games</q>.</p>
						</figcaption>
					</figure>
					<p>
						<a href="https://ftw.usatoday.com/lists/mlb-tv-blackout-rules-explained">Back in the 1970s, MLB, over-the-air regional sports networks, and the new national broadcast networks agreed on some arcane blackout rules</a>, a policy that survived the rise and fall of cable TV and well <a href="https://www.mlb.com/live-stream-games/help-center/blackout-policy">into the Internet age</a>.  That means that you cannot watch your local team without an actual television network agreeing to give it to you.
					</p>
					<p>
						That means you can't watch the Yankees (or Mets) in New York, Connecticut, northern New Jersey, or northeastern Pennsylvania.  If you live in New England and want to root for the Boston Red Sox, tough.  If you're a San Francisco Giants fan living in Guam, you're out of luck (for some reason).  No one has it worse than Canadians, who can't watch their nation's <em>only</em> team, the Toronto Blue Jays, no matter <em>which</em> ocean they're nearer to—unless it's the Indian Ocean, in which case, I hope you have a good cell signal!
					</p>
					<p>
						<a href="https://www.espn.com/mlb/news/story?id=2870960">An Astros fan from Fort Worth, Texas summed it up best in a 2007 online posting:  <q cite="https://www.espn.com/mlb/news/story?id=2870960">As a business major, I find it fascinating that a business is actively refusing to get its product out.</q></a>
					</p>
					<figure>
						<picture>
							<source type="image/svg+xml" srcset="https://colincogle.name/blog/watching-baseball-in-2023/blackout.svg"/>
							<source type="image/webp" srcset="https://colincogle.name/blog/watching-baseball-in-2023/blackout.webp"/>
							<img src="https://colincogle.name/blog/watching-baseball-in-2023/blackout.png" alt="MLB RSN blackout map for the continential United States (as of July 10, 2007)" type="image/png" longdesc="https://commons.wikimedia.org/wiki/File:MLB_Blackout_Areas.svg"/>
						</picture>
						<figcaption>
							<p>The <abbr title="Major League Baseball">MLB</abbr> regional blackout map for the continental United States.  It's old, but replace "Florida" with "Miami" and it's still accurate.</p>
							<p>(Credit: <cite>MLB_Blackout_Areas.svg</cite> by <a href="https://commons.wikimedia.org/wiki/File:MLB_Blackout_Areas.svg">Braindrain0000</a>, <a href="https://creativecommons.org/licenses/by-sa/3.0/">CC BY-SA 3.0</a>. Modified to look better in dark mode.)</p>
						</figcaption>
					</figure>
					<p>
						This is the part of the article where I'd give you some hope.  Frequent arbiter of silly decisions and current MLB Commissioner Rob Manfred <a href="https://www.startribune.com/mlb-commissioner-blackouts-diamond-sports-bankruptcy-bally-sports-north-rob-manfred/600252772/">has <em>hinted</em> that the blackout era <em>may</em> come to an end... soon?</a>  Until then, fans won't be able to root, root, root for the home team;  since they can't watch, it's a shame.
					</p>
					<p>
						As for me, when the radio just won't do, I'm going back to the easiest and most reliable way to watch the games short of going to the ballpark or putting up a TV antenna.  I'll be using a method that has crystal-clear video, great audio, and my choice of the home or away feeds.  It's a method that removes most advertising, all commercials, and gives MLB exactly zero revenue:  <strong>piracy</strong>.
					</p>
					<p>
						<q>Holy cow</q> indeed, Scooter.
					</p>
				</section>
			</div>
		</content>
	</entry>

	<entry>
		<title>Plain Text in Plain Sight:  Smaller Alternatives to the World Wide Web</title>
		<id>urn:uuid:4112755e-1694-40e3-a0bb-fc7fc7bcb46c</id>
		<link rel="alternate" type="text/html" href="https://colincogle.name/blog/the-small-web/" length="24837"/>
		<link rel="alternate" type="text/markdown" href="https://colincogle.name/blog/the-small-web/the-small-web.md" length="6250"/>
		<link rel="alternate" type="text/gemini" href="gemini://colincogle.name/blog/the-small-web/" length="7247"/>
		<link rel="alternate" type="text/plain" href="https://colincogle.name/blog/the-small-web/the-small-web.txt" length="8227"/>
		<link rel="alternate" type="text/latex" href="https://colincogle.name/blog/the-small-web/the-small-web.tex" length="8150"/>
		<link rel="alternate" type="application/pdf" href="https://colincogle.name/blog/the-small-web/the-small-web.pdf" length="534789"/>
		<link rel="alternate" type="application/gopher-menu" href="gopher://colincogle.name/1/blog/the-small-web/" length="2423"/>
		<link rel="shortlink" href="http://colincogle.name/♊"/>
		<category term="technology"/>
		<category term="Hacking"/>
		<category term="Opinion"/>
		<category term="2600" label="2600:  The Hacker Quarterly"/>
		<summary>The Web is growing more bloated and invasive every day, but it's not the only way to share information online.</summary>
		<published>2023-02-05T22:55:00-05:00</published>
		<updated>2023-02-05T22:55:00-05:00</updated>
		<content type="xhtml">
			<div xmlns="http://www.w3.org/1999/xhtml">
				<p>(This was first published in <cite>2600:  The Hacker Quarterly</cite>, Volume 39:2 (<abbr title="pages">pp.</abbr> 7-8).  <a rel="related" href="https://store.2600.com/collections/2020-2021">Please support the official release by buying a paper or PDF copy of the magazine!</a>)</p>
				<figure>
					<picture itemscope="itemscope" itemtype="https://schema.org/ImageObject" class="webfeedsFeaturedVisual">
						<source type="image/avif" srcset="https://colincogle.name/blog/the-small-web/GeminiGopher-square@800w.avif 800w, https://colincogle.name/blog/the-small-web/GeminiGopher-square@1600w.avif 1600w, https://colincogle.name/blog/the-small-web/GeminiGopher-square.avif 3072w" media="(max-width: 800px)"/>
						<source type="image/avif" srcset="https://colincogle.name/blog/the-small-web/GeminiGopher@1152w.avif 1152w, https://colincogle.name/blog/the-small-web/GeminiGopher@2304w.avif 2304w, https://colincogle.name/blog/the-small-web/GeminiGopher.avif 4032w"/>
						<source type="image/jxl" srcset="https://colincogle.name/blog/the-small-web/GeminiGopher-square@800w.jxl 800w, https://colincogle.name/blog/the-small-web/GeminiGopher-square@1600w.jxl 1600w, https://colincogle.name/blog/the-small-web/GeminiGopher-square.jxl 3072w" media="(max-width: 800px)"/>
						<source type="image/jxl" srcset="https://colincogle.name/blog/the-small-web/GeminiGopher@1152w.jxl 1152w, https://colincogle.name/blog/the-small-web/GeminiGopher@2304w.jxl 2304w, https://colincogle.name/blog/the-small-web/GeminiGopher.jxl 4032w"/>
						<source type="image/webp" srcset="https://colincogle.name/blog/the-small-web/GeminiGopher-square@800w.webp 800w, https://colincogle.name/blog/the-small-web/GeminiGopher-square@1600w.webp 1600w, https://colincogle.name/blog/the-small-web/GeminiGopher-square.webp 3072w" media="(max-width: 800px)"/>
						<source type="image/webp" srcset="https://colincogle.name/blog/the-small-web/GeminiGopher@1152w.webp 1152w, https://colincogle.name/blog/the-small-web/GeminiGopher@2304w.webp 2304w, https://colincogle.name/blog/the-small-web/GeminiGopher.webp 4032w"/>
						<source type="image/jpg" srcset="https://colincogle.name/blog/the-small-web/GeminiGopher-square@800w.jpg 800w, https://colincogle.name/blog/the-small-web/GeminiGopher-square@1600w.jpg 1600w, https://colincogle.name/blog/the-small-web/GeminiGopher-square.jpg 3072w" media="(max-width: 800px)"/>
						<source type="image/jpg" srcset="https://colincogle.name/blog/the-small-web/GeminiGopher@1152w.jpg 1152w, https://colincogle.name/blog/the-small-web/GeminiGopher@2304w.jpg 2304w, https://colincogle.name/blog/the-small-web/GeminiGopher.jpg 4032w"/>
						<img src="https://colincogle.name/blog/the-small-web/GeminiGopher.jpg" lowsrc="https://colincogle.name/blog/the-small-web/GeminiGopher@lowsrc.jpg" alt="A gopher wearing a Gemini-era space helmet." class="webfeedsFeaturedVisual" itemprop="image"/>
					</picture>
					<figcaption>
						<p>A Gopher wearing a Gemini-era space helmet.  It'll make sense after you read this article.</p>
						<p>Image credits:  remixed from <a href="https://pixexid.com/image/the-most-beautiful-gopher-in-nature-rgxpdegy"><cite>The most beautiful gopher in nature</cite> by Ralph Nas</a> and <a href="https://airandspace.si.edu/collection-objects/helmet-gemini-g4-c-gold-visor-training/nasm_A19710791000"><cite>Helmet, Gemini, G4-C, Gold Visor, Training</cite> from the Smithsonian Institute</a>.</p>
					</figcaption>
				</figure>
				<p>What's wrong with the World Wide Web?  You open a browser, connect to a server (usually securely), and interact with content.  With a few clicks, you can get news, sports scores, movies, inane updates from people you may know, cat pictures, hacker magazines, dinner… what's not to love?</p>
				<p>Sir Tim Berners-Lee published <a href="http://info.cern.ch">the first Web site</a> in <time datetime="1990-12-20">December 1990</time>, where he described his new document management system, hypertext, and the markup language for it.  Though he continues to shape the incessantly-evolving ecosystem as the head of the World Wide Web Consortium, there are problems with the modern Web which will likely outlive us:  ads, trackers, megabytes of JavaScript bloat, <abbr title="Digital Rights Management">DRM</abbr>, cookies, nonconsensual data collection and analytics, pop-ups, pop-overs, pop-unders, autoplaying music, commercialization, compartmentalization, autoplaying video in the corners of news articles, top-ten lists spread across eleven pages, ugly Facebook share buttons everywhere (even on PornHub for some reason, in case someone out there thinks their family and friends will love this video).  And that's just off the top of my head.</p>
				<figure>
					<figcaption>I know what I must sound like.</figcaption>
					<picture itemscope="itemscope" itemtype="https://schema.org/ImageObject">
						<source type="image/avif" srcset="https://colincogle.name/blog/the-small-web/simpson_thinner.avif" media="(max-width: 800px)"/>
						<source type="image/jxl" srcset="https://colincogle.name/blog/the-small-web/simpson_thinner.jxl" media="(max-width: 800px)"/>
						<source type="image/webp" srcset="https://colincogle.name/blog/the-small-web/simpson_thinner.webp" media="(max-width: 800px)"/>
						<source type="image/jpeg" srcset="https://colincogle.name/blog/the-small-web/simpson_thinner.jpg" media="(max-width: 800px)"/>
						<source type="image/avif" srcset="https://colincogle.name/blog/the-small-web/simpson.avif"/>
						<source type="image/jxl" srcset="https://colincogle.name/blog/the-small-web/simpson.jxl"/>
						<source type="image/jpeg" srcset="https://colincogle.name/blog/the-small-web/simpson.jpg"/>
						<img src="https://colincogle.name/blog/the-small-web/simpson.jpg" lowsrc="https://colincogle.name/blog/the-small-web/simpson.lowsrc.jpg" itemprop="contentUrl image url" alt="A screenshot from The Simpsons:  a photo of Grandpa Simpson with the headline, &quot;Old Man Yells at Cloud&quot;." longdesc="https://knowyourmeme.com/memes/old-man-yells-at-cloud"/>
					</picture>
				</figure>
				<p>It's easy to be an old man yelling at a cloud.  It should surprise no one that the World Wide Web is here to stay.  However, that doesn't mean we can't come up with alternatives.  In fact, we already have — and I'm not talking about mobile apps or Tor Browser.</p>
				<h2>Go for Gopher</h2>
				<p>When you strip away everything superfluous, <a href="https://colincogle.name/blog/the-small-web/the-small-web.txt" rel="alternate">you're left with plain text</a>.  No formatting, no scripting, just words on a page.  That was the idea behind <b>Gopher</b>.  Named for the University of Minnesota's mascot (in case you were wondering), <span><dfn>Gopher</dfn> is a filesystem-inspired protocol to make your computer <i aria-label="go for">go-fer</i> information online.</span></p>
				<p>Gopher sites (sometimes called Gopher holes, because why not) are typically presented as a text-based menu.  You have words, and you have links to folders, files, or other sites.  That's it.  Unlike the Web, all Gopher sites look the same and navigate identically.  It's truly a product of <a href="https://youtu.be/TcmpqeIcbAw" title="Funny video by Ryan George">a time when NFT stood for <i>nice <span aria-label="fucking">f---ing</span> Tamagotchi</i></a>.</p>
				<p>This forced simplicity is part of the reason why it failed.  While HTML is forgiving of mistakes, Gophermaps are strict and make you follow <a href="https://datatracker.ietf.org/doc/html/rfc1436">RFC 1436</a> to a <b>T</b>.  Needless to say, once customizing your MySpace pages became a thing, Gopher was looking very long in the tooth.  Browsers eventually removed support for it, getting rid of it like an unwanted rodent.</p>
				<p>Somehow, though, Gopherspace isn't dead.  <a href="https://en.wikipedia.org/wiki/Gopher_(protocol)#Server_census">In <time datetime="PT15Y">the past fifteen years</time>, the number of Gopher servers online has tripled</a>.  Servers, clients, and (ironically) Web browser extensions continue to be developed.  Most notably, <a href="gopher://stevenf.com/0/journal/2022/04/18/first-playdates-shipping.txt">the Playdate handheld gaming system had its release notes only available via Gopher</a>, leading to <a href="https://www.theregister.com/2022/05/23/the_return_of_the_gopher/">some news coverage for the plaintext protocol</a>!</p>
				<p>Gopher is more than nostalgia for the days when the Internet made noise when you turned it on.  You can find news, weather, search engines, <a href="gopher://colincogle.name" rel="home">home pages</a>, <span><dfn>phlogs</dfn> (the equivalent of blogs)</span>, and more.  Perhaps this little rodent living under the Web isn't so dead after all.</p>
				<h2>Blast Off with Gemini</h2>
				<p>Fast-forward to <time>2019</time>.  A person by the handle Solderpunk was frustrated with the <abbr title="World Wide Web">WWW</abbr> and how crazy things were getting.  <a href="https://kidscodecs.com/interview-solderpunk">In an interview</a>, he said, <q cite="https://kidscodecs.com/interview-solderpunk">Visiting websites is basically a matter of downloading and running software,without any way to know in advance what that software might do, and very little ability to pick and choose which things you let it do.</q>  However, he also thought Gopher was too rigid and restrictive.  The community sat down and thought up something like <q cite="gemini://gemini.circumlunar.space/docs/faq.gmi"><q>the web, stripped right back to its essence</q> or as <q>Gopher, souped up and modernized just a little</q></q>.  The result was something these outer space buffs called <b>Project Gemini</b>.</p>
				<p>Like Gopher, it's another simple text-based protocol that was designed to be intentionally difficult to expand, to avoid the feature creep that the <abbr title="World Wide Web">WWW</abbr> underwent.  However, Gemini sites (called <b>capsules</b>) are more modern, featuring Unicode, free-flowing text, <span><dfn>gemtext</dfn> (think: Markdown)</span>, virtual hosting, TLS 1.3, <a href="gemini://gemini.circumlunar.space/docs/specification.gmi">and more</a>.</p>
				<p>In three short years, Gemini has gone from IRC discussions to something implemented by over 2,000 servers, and it shows no signs of slowing down.  More <a rel="me home" href="gemini://colincogle.name">capsules</a> and <span><dfn>gemlogs</dfn> (again, "blogs")</span> are rocketing off into Geminispace every day.</p>
				<h2>So the Web Is Dead, Right?</h2>
				<p>No, and far from it.  For general browsing, the World Wide Web is going nowhere, and that's fine.  I've spent this article trashing it, but the good still vastly outweighs the bad.  My bank will never implement Gopher.  Amazon won't be selling products on Gemini anytime soon.  Despite the big Web, there is definitely a place for the "small web" these days.</p>
				<p>Consider:</p>
				<ul>
					<li>Has your computer gotten too slow to run Google Chrome?  Is that old Android tablet struggling?  Did Apple cut off macOS updates for your perfectly-good laptop?  Don't fork over your hard-earned cash and make more e-waste.  A Gemini browser would make that old device feel like new — and put less strain on the old battery.</li>
					<li>Perhaps you want to get your vintage computer or old cell phone back online, but good luck using a 25-year-old Web browser.  Gopher was <em>made</em> for retrocomputing!</li>
					<li>Traveling out to the boonies and stuck with dial-up or a 2G phone signal?  It's rare, but it happens.  You could spend an hour watching one web page open, or use Gemini and get it done in seconds.</li>
					<li>Do you prefer the command line?  Text-mode web browsers can be cumbersome, but Gemini and Gopher were <em>built</em> for the terminal.</li>
				</ul>
				<p>If you feel like everything online is getting bloated, and everyone wants to track you and sell you their crap, there are thinner alternatives.  We can <a href="https://libera.chat">chat on IRC</a>, talk on newsgroups, send email instead of signing our lives away to Meta — and now, we have some alternatives to the ever-expanding Web.  However you choose to do it, happy browsing!</p>
			</div>
		</content>
	</entry>

	<entry>
		<title>So You Changed Your Callsign.  Now What?</title>
		<id>urn:uuid:cedd0f42-436b-4a07-b829-7b3d12b0f912</id>
		<link rel="alternate" type="text/html" href="https://colincogle.name/blog/vanity-callsign-howto/" length="22778"/>
		<link rel="alternate" type="text/markdown" href="https://colincogle.name/blog/vanity-callsign-howto/vanity-callsign-howto.md" length="9882"/>
		<link rel="alternate" type="text/gemini" href="gemini://colincogle.name/blog/vanity-callsign-howto/" length="9282"/>
		<link rel="alternate" type="text/plain" href="https://colincogle.name/blog/vanity-callsign-howto/vanity-callsign-howto.txt" length="9714"/>
		<link rel="alternate" type="application/gopher-menu" href="gopher://colincogle.name/1/blog/vanity-callsign-howto/" length="945"/>
		<link rel="shortlink" href="http://colincogle.name/W1DNS"/>
		<category term="Ham radio"/>
		<category term="tutorials"/>
		<summary>Changing your amateur radio callsign requires you to file one simple form with the FCC… right?</summary>
		<published>2022-12-07T21:33:26-05:00</published>
		<updated>2022-12-18T21:45:17-05:00</updated>
		<content type="xhtml">
			<div xmlns="http://www.w3.org/1999/xhtml">
				<p>On a whim, I thought it'd be funny to change my randomly-assigned amateur radio callsign from KC1HBK to W1DNS.  Why that?  I live in the northeast United States, where <i>W1</i> is a local prefix.  Also, I work in the <abbr title="Information Technology">IT</abbr> industry, where we have <a href="https://imgur.com/YKvOiA4">a running joke that <q>it's always DNS</q></a>. I decided that getting a one-time chuckle and/or annoyed groan from people was definitely worth the $35 application fee.</p>
				<p>This article is geared toward ham radio operators living in the United States.  For everyone else, requesting and getting a vanity callsign from your country's licensing authority is left as an exercise to the reader.</p>
				<h2>First Step:  The FCC</h2>
				<p>If you're applying for a vanity callsign, that means that you already have a valid amateur radio license, and therefore a working relationship with the <abbr title="Federal Communications Commission">FCC</abbr> and an FCC Registration Number.  (Go find your FRN if you've forgotten it.)</p>
				<p>Next, log into the <a href="https://wireless2.fcc.gov/UlsEntry/licManager/narli/applicantquestions.jsp?action=actionVanity&amp;contWErrorInd=Y&amp;radioservice=HV&amp;purposeCode=MD">Universal Licensing System</a> and look for the option <b>Request a vanity callsign</b>.</p>
				<p>Now, you will be asked which option you want:  a callsign of your own choosing, a previous callsign of yours, or a relative's former callsign.  Pick whichever option is best for you.  In my case, I wanted to make up something, so I chose the first one, so I provided no more than 25 callsigns that I could potentially be assigned.</p>
				<figure itemscope="itemscope" itemtype="https://schema.org/ImageObject">
					<picture>
						<source type="image/avif" srcset="https://colincogle.name/blog/vanity-callsign-howto/callsignlist.avif"/>
						<source type="image/webp" srcset="https://colincogle.name/blog/vanity-callsign-howto/callsignlist.webp"/>
						<source type="image/jxl" srcset="https://colincogle.name/blog/vanity-callsign-howto/callsignlist.jxl"/>
						<source type="image/png" srcset="https://colincogle.name/blog/vanity-callsign-howto/callsignlist.png"/>
						<img src="https://colincogle.name/blog/vanity-callsign-howto/callsignlist.png" lowsrc="https://colincogle.name/blog/vanity-callsign-howto/callsignlist-lowsrc.jpg" alt="Applying for a vanity callsign with the FCC Universal Licensing System." itemprop="image url"/>
					</picture>
					<figcaption itemprop="description">
						Pick a new callsign or twenty-five.  You'll get the first one that's both unused <em>and</em> permitted by your license class.  (Makes you want to get that Amateur Extra, doesn't it?)
					</figcaption>
					<link itemprop="author copyrightHolder creator editor publisher" href="https://colincogle.name/#me"/>
					<meta itemprop="dateCreated" content="2022-12-07"/>
					<meta itemprop="datePublished" content="2022-12-07T21:33:26-05:00"/>
					<link itemprop="license" href="https://creativecommons.org/licenses/by-sa/4.0/"/>
					<meta itemprop="name" content="Vanity Callsign Application"/>
				</figure>
				<p>Click through the rest of the application, and don't forget to pay the FCC while you're here.</p>
				<figure>
					<iframe width="560" height="315" src="https://www.youtube-nocookie.com/embed/KwDPTThyfYc" title="YouTube video player" allow="accelerometer; autoplay; clipboard-write; encrypted-media; fullscreen; gyroscope; picture-in-picture; speaker-selection" fetchpriority="low" loading="lazy" referrerpolicy="no-referrer" longdesc="https://www.youtube.com/watch?v=KwDPTThyfYc">
						<a href="https://www.youtube.com/watch?v=KwDPTThyfYc">
							<picture>
								<source type="image/avif" src="https://colincogle.name/blog/vanity-callsign-howto/FamilyGuy.avif"/>
								<source type="image/webp" src="https://colincogle.name/blog/vanity-callsign-howto/FamilyGuy.webp"/>
								<source type="image/jxl" src="https://colincogle.name/blog/vanity-callsign-howto/FamilyGuy.jxl"/>
								<source type="image/jpg" src="https://colincogle.name/blog/vanity-callsign-howto/FamilyGuy.jpg"/>
								<img src="https://colincogle.name/blog/vanity-callsign-howto/FamilyGuy.jpg" lowsrc="https://colincogle.name/blog/vanity-callsign-howto/FamilyGuy-lowsrc.jpg" alt="Screenshot of the FCC song from the &quot;Family Guy&quot; episode &quot;PTV&quot;." longdesc="https://en.wikipedia.org/wiki/PTV_(Family_Guy)"/>
							</picture>
						</a>
					</iframe>
					<figcaption>Honestly, submitting the FCC application and payment is the <em>least</em> painful thing you're going to do today.</figcaption>
					<meta itemprop="dateCreated datePublished" content="2005-11-06"/>
					<meta itemprop="license" content="© 2005 Fox and/or Seth MacFarlane, idk."/>
					<link itemprop="sameAs url" href="https://en.wikipedia.org/wiki/PTV_(Family_Guy)"/>
				</figure>
				<p>The FCC will take several days to process your application. In my case, I filed the application on <time datetime="2022-11-14">November 14</time>, and by Thanksgiving, they had processed it.  As soon as they do, there is a ten-day waiting period.  On the morning of <time datetime="2022-12-02">December 2</time>, I received an email with a link to my new license grant.</p>
				<p>Just like when you got your Technician license, you weren't allowed to use your shiny new callsign until it showed up in the <abbr title="Universal Licensing System">ULS</abbr>.  This is no different.  Chill out and wait until you see it live.   Once you do, immediately start using your new callsign on the air; when your new callsign was formally assigned, your old callsign was automatically revoked.</p>
				<p>Now that you've updated your callsign with the FCC, you're probably realizing that you've been using your old callsign in a lot of places.  You might have a long contact list.  You might have <a href="https://www.qrz.com/db/w1dns">a QRZ page</a>.  You might have registered a DMR hotspot, or you might be using apps such as Winlink 2000 or Echolink.  This is the part of the process that I'm hoping to unpack and lay out, to save the next vain ham from a little bit of grief.</p>
				<h2>Notifying the ARRL: Surprisingly Difficult</h2>
				<p>If you're a member of the <a href="https://arrl.org">American Radio Relay League</a> (and you American hams should be), then you'd be surprised to hear that they have no way to update the callsign that is associated with your membership.</p>
				<p><b>Update:</b>  I logged in, and they quietly updated the callsign associated with my membership.  I'm not sure when or how, but they figured it out on their own.</p>
				<p>If you are a registered <abbr title="Volunteer Examiner">VE</abbr> with ARRL-VEC, luckily, that portion is much easier.  Simply <a href="mailto:VEC@arrl.org">email ARRL-VEC</a> and they'll update your record immediately.  They will also mail you a new badge with your new callsign.  However, you have no need to take a break from proctoring exams.  My <abbr title="Volunteer Examiner Coordinator">VEC</abbr> manager, <a href="https://www.qrz.com/db/ab1fm">Maria Somma, AB1FM</a>, let me know that I can still use my old badge and new callsign on paperwork such as VE reports, <abbr title="Certificate of Successful Completion of Examination">CSCE</abbr>s and <abbr title="National Conference of Volunteer Examiner Coordinators">NCVEC</abbr> forms.</p>
				<h2>Get (Back) on DMR:  Brandmeister, RadioID, and More</h2>
				<p>Your <abbr title="Digital Mobile Radio">DMR</abbr> ID number will not be changing, thankfully.  That being said, you still need to let the network operators know that your callsign has changed.</p>
				<p>RadioID.net is your first stop.  There is no automated way to do this, but it's easy enough.  <a href="https://radioid.net/support">Log into your account and click on Support.</a>  Submit a ticket, and provide your old and new callsigns.   While you wait for your RadioID account to be updated, fire up your radio's programming software, and update your callsign in your own radios.</p>
				<p>For Brandmeister, I'll save you the hassle of signing up for Jira Service Desk and give you an apple <a href="https://support.brandmeister.network/servicedesk/customer/user/login?destination=portals">from inside the walled garden</a>:  just create a new SelfCare account.  To expedite things, be sure to use the same DMR ID and email address.</p>
				<p>Once you've gone through all the steps, then you will have a brand-new account.  This means you will need to set the hotspot security password again.</p>
				<p>Speaking of hotspots, you will need to put your new information into yours, too.  I have a Pi-Star MMDVM hotspot, and all I needed to do was update my callsign.  Update your Brandmeister hotspot security password if that got changed, too.  How you do this will vary depending on your hardware and software.</p>
				<figure itemscope="itemscope" itemtype="https://schema.org/ImageObject">
					<picture>
						<source type="image/avif" srcset="https://colincogle.name/blog/vanity-callsign-howto/pistar.avif"/>
						<source type="image/webp" srcset="https://colincogle.name/blog/vanity-callsign-howto/pistar.webp"/>
						<source type="image/png" srcset="https://colincogle.name/blog/vanity-callsign-howto/pistar.png"/>
						<img src="pistar.png" lowsrc="pistar-lowsrc.jpg" alt="Screenshot of Pi-Star (in dark mode) where you can change your callsign." itemprop="image url"/>
					</picture>
					<figcaption itemprop="description">
						In the Pi-Star's configuration page, scroll down to General Configuration.
						Your callsign is the second text field from the top.  Edit that and click on Apply Changes.
						(The dark mode theme is my own creation, and <a href="https://github.com/AndyTaylorTweet/Pi-Star_DV_Dash/pull/173" rel="me">and is currently pending inclusion in the mainline sources</a>.)
					</figcaption>
					<link itemprop="author copyrightHolder creator editor publisher" href="https://colincogle.name/#me"/>
					<meta itemprop="dateCreated" content="2022-12-08T06:14:34-05:00"/>
					<meta itemprop="datePublished" content="2022-12-08T06:21:45-05:00"/>
					<link itemprop="license" href="https://creativecommons.org/licenses/by-sa/4.0/"/>
					<meta itemprop="name" content="Pi-Star General Configuration (in dark mode)"/>
				</figure>
				<p>Now for the bad news. DMR radios have a user-supplied contact list that doesn't update automatically.  Your old callsign will show up on every single DMR radio on the planet, until the operator manually updates their contact list.  That's just how it goes, sadly. Still, you are expected to identify yourself with your callsign on DMR, just like you have to do in analog modes, so this will only be a minor annoyance.  (Speaking of which, when is the last time you updated your contact lists?)</p>
				<h2>Fixing Echolink</h2>
				<p>Ah, the <abbr title="Voice over IP">VoIP</abbr> of the amateur radio world.  I use <a href="https://kd9cpb.com/qtel">the open-source qTel app</a> for my day-to-day Echolink usage. To change your callsign, you will need to make a new account,  which means you will need to install <a href="https://www.echolink.org/download.htm">the proprietary Windows Echolink client</a>; the official app contains some account management functions that aren't present in the <abbr title="free and open-source (software)">FOSS</abbr> alternatives.   Begrudgingly, I fired up my Windows virtual machine and got the app installed, then I logged in with my former callsign and password.  The next step was to click on <i>Tools &gt; Setup</i>, and change my callsign.</p>
				<p>Once that's all done, and they've validated your new callsign, <a href="https://www.echolink.org/validation/call_change.jsp">go to the Change Callsign page</a>.  Supply your old and new callsigns and Echolink passwords.</p>
				<h2>Relinking Winlink</h2>
				<p>I'll lead with this: your callsign is your email, ergo you will get a new email address, and forwarding is no longer supported.  Let your contacts know.</p>
				<p>Just like with Echolink, you're going to create a new account.   If you already use Winlink Express like I do (via WINE), then this is easy.  Open the app, and add a new callsign.  Complete the form and click on Update.</p>
				<p>Finally, if you've paid the Amateur Radio Safety Foundation to register Winlink Express, you'll notice the registration nagging is back.  Simply <a href="mailto:W3QA@ARSFI.org">email W3QA</a> and let them know that they need to transfer your registration to your new callsign.  (Or pay for Winlink Express again.  ARSFI could always use the money.)</p>
				<p>If you use another app besides Winlink Express, consult its documentation.  The article in the <a href="https://winlink.org/content/how_change_your_callsign_account">Winlink Book of Knowledge</a> contains general instructions.</p>
				<h2>QRZ, <span aria-label="easy">E-Z</span></h2>
				<p>You'll be glad to hear that all you need to do is wait. They will get a list of license changes from the FCC on the next business day.   QRZ will email you and let you know that they've updated your record. No action is needed on your part, though you might want to mention in your bio that you had a former callsign.</p>
				<h2>All About <abbr title="Automated Packet Reporting System">APRS</abbr></h2>
				<p>If you have any automated scripts (for example, a device or script that uses an <a href="https://colincogle.name/blog/aprs-weather-submit">aprs-weather-submit</a> command line) or anything else that has your callsign saved, be sure to update them.</p>
				<p>As far as the website <a href="https://APRS.fi">APRS.fi</a> is concerned, you can simply update your callsign under <a href="https://aprs.fi/account/">My Account</a>.  If you've used your callsign as your username, though, you'd have to delete your account and create a new one. If you use APRS.fi's API keys, deleting your account means you'll need to replace them all.</p>
				<h2>Seventy-Three For Now</h2>
				<p>This was everything I could think of.  Naturally, I'm sure I've forgotten a few things, so I will update this article as needed.  Changing your callsign should be a once-in-a-lifetime thing (unless you're indecisive). Hopefully, this guide made this task a little bit easier.</p>
			</div>
		</content>
	</entry>

	<entry>
		<title>Rescuing a UniFi Cloud Key Gen2 Plus</title>
		<id>urn:uuid:9bab46d6-a208-4888-b9e7-0a567acbd2b1</id>
		<category term="technology"/>
		<category term="UniFi"/>
		<category term="hacking"/>
		<category term="tutorials"/>
		<link rel="alternate" type="text/html" href="https://colincogle.name/blog/unifi-cloud-key-rescue/" length="53559"/>
		<link rel="alternate" type="text/markdown" href="https://colincogle.name/blog/unifi-cloud-key-rescue/index.md" length="7776"/>
		<link rel="alternate" type="text/gemini" href="gemini://colincogle.name/blog/unifi-cloud-key-rescue/" length="6981"/>
		<link rel="alternate" type="text/plain" href="https://colincogle.name/blog/unifi-cloud-key-rescue/unifi-cloud-key-rescue.txt" length="6678"/>
		<link rel="alternate" type="application/gopher-menu" href="gopher://colincogle.name/1/blog/unifi-cloud-key-rescue/" length="2879"/>
		<summary>A non-working eBay item gets saved from the scrap heap, and I get a cheap upgrade.</summary>
		<published>2022-10-17T08:41:26-04:00</published>
		<updated>2023-02-05T20:16:00-05:00</updated>
		<content type="xhtml">
			<div xmlns="http://www.w3.org/1999/xhtml">
				<p>When I found a non-working UniFi Cloud Key Gen2 Plus on eBay for 99 cents, I decided, <q>why not?</q>  (This was before I heard that <a href="https://community.ui.com/releases/UniFi-Network-Application-7-3-69/d801e00a-8d7d-4e52-b6db-d4d8d87835fb">UniFi Network App 7.3 will drop support for the now-vintage first-generation Cloud Key.</a>)</p>
				<p>The Cloud Key Gen2 would be sitting inside a closet, so I wasn't too concerned that this thing had been physically damaged, cracked and dented, and sold without the internal hard drive.  Fortunately, it arrived and looked better than I expected.</p>
				<figure itemscope="itemscope" itemtype="https://schema.org/ImageObject">
					<picture>
						<source type="image/avif" srcset="https://colincogle.name/blog/unifi-cloud-key-rescue/UCK-1@320w.avif 320w, https://colincogle.name/blog/unifi-cloud-key-rescue/UCK-1@640w.avif 640w, https://colincogle.name/blog/unifi-cloud-key-rescue/UCK-1@1920w.avif 1920w, https://colincogle.name/blog/unifi-cloud-key-rescue/UCK-1.avif 4032w"/>
						<source type="image/webp" srcset="https://colincogle.name/blog/unifi-cloud-key-rescue/UCK-1@320w.webp 320w, https://colincogle.name/blog/unifi-cloud-key-rescue/UCK-1@640w.webp 640w, https://colincogle.name/blog/unifi-cloud-key-rescue/UCK-1@1920w.webp 1920w, https://colincogle.name/blog/unifi-cloud-key-rescue/UCK-1.webp 4032w"/>
						<source type="image/jpg" srcset="https://colincogle.name/blog/unifi-cloud-key-rescue/UCK-1@320w.jpg  320w, https://colincogle.name/blog/unifi-cloud-key-rescue/UCK-1@640w.jpg  640w, https://colincogle.name/blog/unifi-cloud-key-rescue/UCK-1@1920w.jpg  1920w, https://colincogle.name/blog/unifi-cloud-key-rescue/UCK-1.jpg  4032w"/>
						<img src="https://colincogle.name/blog/unifi-cloud-key-rescue/UCK-1.jpg" alt="My new-to-me UniFi Cloud Key Gen2 Plus." itemprop="image url"/>
					</picture>
					<figcaption itemprop="description">
						My damaged and unbootable UniFi Cloud Key Gen2 Plus.  It looks fine from this angle, but there is cosmetic damage around the rear <span aria-label="USB Type-C">USB-C</span> power port.
					</figcaption>
					<link itemprop="author copyrightHolder creator editor publisher" href="http://colincogle.name/#me"/>
					<meta itemprop="dateCreated" content="2022-09-10"/>
					<meta itemprop="datePublished" content="2022-10-17T08:41:26-04:00"/>
					<link itemprop="license" href="https://creativecommons.org/licenses/by-sa/4.0/"/>
					<meta itemprop="name" content="UniFi Cloud Key Gen2 Plus"/>
				</figure>

				<h2>Disassembly</h2>
				<p>To start, remove the back plastic.  It's glued on, so use a spudger or guitar pick to break the adhesive.  Once you've gotten that off, there are seven Phillips-head screws underneath to remove.</p>
				<figure>
					<div>
						<picture itemscope="itemscope" itemtype="https://schema.org/ImageObject">
							<source type="image/avif" srcset="https://colincogle.name/blog/unifi-cloud-key-rescue/UCK-2@320wp.avif 320w, https://colincogle.name/blog/unifi-cloud-key-rescue/UCK-2@640wp.avif 640w, https://colincogle.name/blog/unifi-cloud-key-rescue/UCK-2@1920wp.avif 1920w, https://colincogle.name/blog/unifi-cloud-key-rescue/UCK-2@p.avif 4032w" media="(orientation:portrait)"/>
							<source type="image/webp" srcset="https://colincogle.name/blog/unifi-cloud-key-rescue/UCK-2@320wp.webp 320w, https://colincogle.name/blog/unifi-cloud-key-rescue/UCK-2@640wp.webp 640w, https://colincogle.name/blog/unifi-cloud-key-rescue/UCK-2@1920wp.webp 1920w, https://colincogle.name/blog/unifi-cloud-key-rescue/UCK-2@p.webp 4032w" media="(orientation:portrait)"/>
							<source type="image/jpg" srcset="https://colincogle.name/blog/unifi-cloud-key-rescue/UCK-2@320wp.jpg  320w, https://colincogle.name/blog/unifi-cloud-key-rescue/UCK-2@640wp.jpg  640w, https://colincogle.name/blog/unifi-cloud-key-rescue/UCK-2@1920wp.jpg  1920w, https://colincogle.name/blog/unifi-cloud-key-rescue/UCK-2@p.jpg  4032w" media="(orientation:portrait)"/>
							<source type="image/avif" srcset="https://colincogle.name/blog/unifi-cloud-key-rescue/UCK-2@320w.avif 320w, https://colincogle.name/blog/unifi-cloud-key-rescue/UCK-2@640w.avif 640w, https://colincogle.name/blog/unifi-cloud-key-rescue/UCK-2@1920w.avif 1920w, https://colincogle.name/blog/unifi-cloud-key-rescue/UCK-2.avif 4032w"/>
							<source type="image/webp" srcset="https://colincogle.name/blog/unifi-cloud-key-rescue/UCK-2@320w.webp 320w, https://colincogle.name/blog/unifi-cloud-key-rescue/UCK-2@640w.webp 640w, https://colincogle.name/blog/unifi-cloud-key-rescue/UCK-2@1920w.webp 1920w, https://colincogle.name/blog/unifi-cloud-key-rescue/UCK-2.webp 4032w"/>
							<source type="image/jpg" srcset="https://colincogle.name/blog/unifi-cloud-key-rescue/UCK-2@320w.jpg  320w, https://colincogle.name/blog/unifi-cloud-key-rescue/UCK-2@640w.jpg  640w, https://colincogle.name/blog/unifi-cloud-key-rescue/UCK-2@1920w.jpg  1920w, https://colincogle.name/blog/unifi-cloud-key-rescue/UCK-2.jpg  4032w"/>
							<img src="https://colincogle.name/blog/unifi-cloud-key-rescue/UCK-2.jpg" alt="Removing the back plastic of the UniFi Cloud Key Gen2 Plus." itemprop="image url"/>
							<link itemprop="author copyrightHolder creator editor publisher" href="http://colincogle.name/#me"/>
							<meta itemprop="dateCreated" content="2022-09-10"/>
							<meta itemprop="datePublished" content="2022-10-17T08:41:26-04:00"/>
							<meta itemprop="description" content="The rear of a UniFi Cloud Key Gen2 Plus, showing how to remove the back plastic cover."/>
							<link itemprop="license" href="https://creativecommons.org/licenses/by-sa/4.0/"/>
							<meta itemprop="name" content="UniFi Cloud Key Gen2 Plus Rear Cover Removal"/>
						</picture>
						<picture itemscope="itemscope" itemtype="https://schema.org/ImageObject">
							<source type="image/avif" srcset="https://colincogle.name/blog/unifi-cloud-key-rescue/UCK-3@320wp.avif 320w, https://colincogle.name/blog/unifi-cloud-key-rescue/UCK-3@640wp.avif 640w, https://colincogle.name/blog/unifi-cloud-key-rescue/UCK-3@1920wp.avif 1920w, https://colincogle.name/blog/unifi-cloud-key-rescue/UCK-3@p.avif 4032w" media="(orientation:portrait)"/>
							<source type="image/webp" srcset="https://colincogle.name/blog/unifi-cloud-key-rescue/UCK-3@320wp.webp 320w, https://colincogle.name/blog/unifi-cloud-key-rescue/UCK-3@640wp.webp 640w, https://colincogle.name/blog/unifi-cloud-key-rescue/UCK-3@1920wp.webp 1920w, https://colincogle.name/blog/unifi-cloud-key-rescue/UCK-3@p.webp 4032w" media="(orientation:portrait)"/>
							<source type="image/jpg" srcset="https://colincogle.name/blog/unifi-cloud-key-rescue/UCK-3@320wp.jpg  320w, https://colincogle.name/blog/unifi-cloud-key-rescue/UCK-3@640wp.jpg  640w, https://colincogle.name/blog/unifi-cloud-key-rescue/UCK-3@1920wp.jpg  1920w, https://colincogle.name/blog/unifi-cloud-key-rescue/UCK-3@p.jpg  4032w" media="(orientation:portrait)"/>
							<source type="image/avif" srcset="https://colincogle.name/blog/unifi-cloud-key-rescue/UCK-3@320w.avif 320w, https://colincogle.name/blog/unifi-cloud-key-rescue/UCK-3@640w.avif 640w, https://colincogle.name/blog/unifi-cloud-key-rescue/UCK-3@1920w.avif 1920w, https://colincogle.name/blog/unifi-cloud-key-rescue/UCK-3.avif 4032w"/>
							<source type="image/webp" srcset="https://colincogle.name/blog/unifi-cloud-key-rescue/UCK-3@320w.webp 320w, https://colincogle.name/blog/unifi-cloud-key-rescue/UCK-3@640w.webp 640w, https://colincogle.name/blog/unifi-cloud-key-rescue/UCK-3@1920w.webp 1920w, https://colincogle.name/blog/unifi-cloud-key-rescue/UCK-3.webp 4032w"/>
							<source type="image/jpg" srcset="https://colincogle.name/blog/unifi-cloud-key-rescue/UCK-3@320w.jpg  320w, https://colincogle.name/blog/unifi-cloud-key-rescue/UCK-3@640w.jpg  640w, https://colincogle.name/blog/unifi-cloud-key-rescue/UCK-3@1920w.jpg  1920w, https://colincogle.name/blog/unifi-cloud-key-rescue/UCK-3.jpg  4032w"/>
							<img src="https://colincogle.name/blog/unifi-cloud-key-rescue/UCK-3.jpg" alt="The UniFi Cloud Key Gen2 Plus once the back plastic has been removed.  Note the screws." itemprop="image url"/>
							<link itemprop="author copyrightHolder creator editor publisher" href="http://colincogle.name/#me"/>
							<meta itemprop="dateCreated" content="2022-09-10T07:58:08-04:00"/>
							<meta itemprop="datePublished" content="2022-10-17T08:41:26-04:00"/>
							<meta itemprop="description" content="The rear of a UniFi Cloud Key Gen2 Plus, once the back plastic has been removed.  Note the seven screws and Bluetooth antenna."/>
							<link itemprop="license" href="https://creativecommons.org/licenses/by-sa/4.0/"/>
							<meta itemprop="name" content="UniFi Cloud Key Gen2 Plus Rear"/>
							<span itemprop="exifData" itemscope="itemscope" itemtype="https://schema.org/PropertyValue">
								<meta itemprop="name" content="Aperture"/>
								<meta itemprop="value" content="f/1.8"/>
							</span>
							<span itemprop="exifData" itemscope="itemscope" itemtype="https://schema.org/PropertyValue">
								<meta itemprop="name" content="BrightnessValue"/>
								<meta itemprop="value" content="3.57002"/>
							</span>
							<span itemprop="exifData" itemscope="itemscope" itemtype="https://schema.org/PropertyValue">
								<meta itemprop="name" content="ExposureBiasValue"/>
								<meta itemprop="value" content="0 EV"/>
							</span>
							<span itemprop="exifData" itemscope="itemscope" itemtype="https://schema.org/PropertyValue">
								<meta itemprop="name" content="ExposureMode"/>
								<meta itemprop="value" content="Auto"/>
							</span>
							<span itemprop="exifData" itemscope="itemscope" itemtype="https://schema.org/PropertyValue">
								<meta itemprop="name" content="ExposureTime"/>
								<meta itemprop="value" content="0.009345794"/>
							</span>
							<span itemprop="exifData" itemscope="itemscope" itemtype="https://schema.org/PropertyValue">
								<meta itemprop="name" content="Flash"/>
								<meta itemprop="value" content="No, compulsory."/>
							</span>
							<span itemprop="exifData" itemscope="itemscope" itemtype="https://schema.org/PropertyValue">
								<meta itemprop="name" content="FNumber"/>
								<meta itemprop="value" content="f/1.8"/>
							</span>
							<span itemprop="exifData" itemscope="itemscope" itemtype="https://schema.org/PropertyValue">
								<meta itemprop="name" content="ISOSpeed"/>
								<meta itemprop="value" content="125"/>
							</span>
							<span itemprop="exifData" itemscope="itemscope" itemtype="https://schema.org/PropertyValue">
								<meta itemprop="name" content="WhiteBalance"/>
								<meta itemprop="value" content="Auto"/>
							</span>
						</picture>
					</div>
					<figcaption>
						Remove the black plastic on the rear of the UniFi Cloud Key Gen2 Plus.  You can see some damage on the black plastic around the <span aria-label="USB Type-C">USB-C</span> power port.
					</figcaption>
				</figure>

				<p>To continue disassembly, we will need to remove the hard drive and the latch itself.  Slide the latch over to remove the hard drive and the tray.  Then, use the end of a flat-head screwdriver or metal spudger, gently press on one of the tabs to pop it loose.  Hold the metal slider in position, then carefully remove the plastic tab.</p>
				<figure>
					<div>
						<picture itemscope="itemscope" itemtype="https://schema.org/ImageObject">
							<source type="image/avif" srcset="https://colincogle.name/blog/unifi-cloud-key-rescue/UCK-4@320w.avif 320w, https://colincogle.name/blog/unifi-cloud-key-rescue/UCK-4@640w.avif 640w, https://colincogle.name/blog/unifi-cloud-key-rescue/UCK-4@1920w.avif 1920w, https://colincogle.name/blog/unifi-cloud-key-rescue/UCK-4.avif 4032w"/>
							<source type="image/webp" srcset="https://colincogle.name/blog/unifi-cloud-key-rescue/UCK-4@320w.webp 320w, https://colincogle.name/blog/unifi-cloud-key-rescue/UCK-4@640w.webp 640w, https://colincogle.name/blog/unifi-cloud-key-rescue/UCK-4@1920w.webp 1920w, https://colincogle.name/blog/unifi-cloud-key-rescue/UCK-4.webp 4032w"/>
							<source type="image/jpg" srcset="https://colincogle.name/blog/unifi-cloud-key-rescue/UCK-4@320w.jpg  320w, https://colincogle.name/blog/unifi-cloud-key-rescue/UCK-4@640w.jpg  640w, https://colincogle.name/blog/unifi-cloud-key-rescue/UCK-4@1920w.jpg  1920w, https://colincogle.name/blog/unifi-cloud-key-rescue/UCK-4.jpg  4032w"/>
							<img src="https://colincogle.name/blog/unifi-cloud-key-rescue/UCK-4.jpg" alt="The hard drive bay and latching mechanism inside a UniFi Cloud Key Gen2 Plus." itemprop="image url"/>
							<link itemprop="author copyrightHolder creator editor publisher" href="http://colincogle.name/#me"/>
							<meta itemprop="dateCreated" content="2022-09-10T08:02:29-04:00"/>
							<meta itemprop="datePublished" content="2022-10-17T08:41:26-04:00"/>
							<meta itemprop="description" content="The hard drive bay and latching mechanism in a UniFi Cloud Key Gen2 Plus."/>
							<link itemprop="license" href="https://creativecommons.org/licenses/by-sa/4.0/"/>
							<meta itemprop="name" content="UniFi Cloud Key Gen2 Plus Hard Drive Bay"/>
							<span itemprop="exifData" itemscope="itemscope" itemtype="https://schema.org/PropertyValue">
								<meta itemprop="name" content="Aperture"/>
								<meta itemprop="value" content="f/1.8"/>
							</span>
							<span itemprop="exifData" itemscope="itemscope" itemtype="https://schema.org/PropertyValue">
								<meta itemprop="name" content="BrightnessValue"/>
								<meta itemprop="value" content="0.77805"/>
							</span>
							<span itemprop="exifData" itemscope="itemscope" itemtype="https://schema.org/PropertyValue">
								<meta itemprop="name" content="ExposureBiasValue"/>
								<meta itemprop="value" content="0 EV"/>
							</span>
							<span itemprop="exifData" itemscope="itemscope" itemtype="https://schema.org/PropertyValue">
								<meta itemprop="name" content="ExposureMode"/>
								<meta itemprop="value" content="Auto"/>
							</span>
							<span itemprop="exifData" itemscope="itemscope" itemtype="https://schema.org/PropertyValue">
								<meta itemprop="name" content="ExposureTime"/>
								<meta itemprop="value" content="0.016666667"/>
							</span>
							<span itemprop="exifData" itemscope="itemscope" itemtype="https://schema.org/PropertyValue">
								<meta itemprop="name" content="Flash"/>
								<meta itemprop="value" content="No, compulsory."/>
							</span>
							<span itemprop="exifData" itemscope="itemscope" itemtype="https://schema.org/PropertyValue">
								<meta itemprop="name" content="FNumber"/>
								<meta itemprop="value" content="f/1.8"/>
							</span>
							<span itemprop="exifData" itemscope="itemscope" itemtype="https://schema.org/PropertyValue">
								<meta itemprop="name" content="ISOSpeed"/>
								<meta itemprop="value" content="500"/>
							</span>
							<span itemprop="exifData" itemscope="itemscope" itemtype="https://schema.org/PropertyValue">
								<meta itemprop="name" content="WhiteBalance"/>
								<meta itemprop="value" content="Auto"/>
							</span>
						</picture>
						<picture itemscope="itemscope" itemtype="https://schema.org/ImageObject">
							<source type="image/avif" srcset="https://colincogle.name/blog/unifi-cloud-key-rescue/UCK-5@320w.avif 320w, https://colincogle.name/blog/unifi-cloud-key-rescue/UCK-5@640w.avif 640w, https://colincogle.name/blog/unifi-cloud-key-rescue/UCK-5@1920w.avif 1920w, https://colincogle.name/blog/unifi-cloud-key-rescue/UCK-5.avif 4032w"/>
							<source type="image/webp" srcset="https://colincogle.name/blog/unifi-cloud-key-rescue/UCK-5@320w.webp 320w, https://colincogle.name/blog/unifi-cloud-key-rescue/UCK-5@640w.webp 640w, https://colincogle.name/blog/unifi-cloud-key-rescue/UCK-5@1920w.webp 1920w, https://colincogle.name/blog/unifi-cloud-key-rescue/UCK-5.webp 4032w"/>
							<source type="image/jpg" srcset="https://colincogle.name/blog/unifi-cloud-key-rescue/UCK-5@320w.jpg  320w, https://colincogle.name/blog/unifi-cloud-key-rescue/UCK-5@640w.jpg  640w, https://colincogle.name/blog/unifi-cloud-key-rescue/UCK-5@1920w.jpg  1920w, https://colincogle.name/blog/unifi-cloud-key-rescue/UCK-5.jpg  4032w"/>
							<img src="https://colincogle.name/blog/unifi-cloud-key-rescue/UCK-5.jpg" alt="The hard drive latch removed from a UniFi Cloud Key Gen2 Plus." itemprop="image url"/>
							<link itemprop="author copyrightHolder creator editor publisher" href="http://colincogle.name/#me"/>
							<meta itemprop="dateCreated" content="2022-09-10T08:05:39-04:00"/>
							<meta itemprop="datePublished" content="2022-10-17T08:41:26-04:00"/>
							<meta itemprop="description" content="The hard drive latch removed from a UniFi Cloud Key Gen2 Plus."/>
							<link itemprop="license" href="https://creativecommons.org/licenses/by-sa/4.0/"/>
							<meta itemprop="name" content="UniFi Cloud Key Gen2 Plus Hard Drive Latch Removal"/>
							<span itemprop="exifData" itemscope="itemscope" itemtype="https://schema.org/PropertyValue">
								<meta itemprop="name" content="Aperture"/>
								<meta itemprop="value" content="f/1.8"/>
							</span>
							<span itemprop="exifData" itemscope="itemscope" itemtype="https://schema.org/PropertyValue">
								<meta itemprop="name" content="BrightnessValue"/>
								<meta itemprop="value" content="3.02877"/>
							</span>
							<span itemprop="exifData" itemscope="itemscope" itemtype="https://schema.org/PropertyValue">
								<meta itemprop="name" content="ExposureBiasValue"/>
								<meta itemprop="value" content="0 EV"/>
							</span>
							<span itemprop="exifData" itemscope="itemscope" itemtype="https://schema.org/PropertyValue">
								<meta itemprop="name" content="ExposureMode"/>
								<meta itemprop="value" content="Auto"/>
							</span>
							<span itemprop="exifData" itemscope="itemscope" itemtype="https://schema.org/PropertyValue">
								<meta itemprop="name" content="ExposureTime"/>
								<meta itemprop="value" content="0.008264463"/>
							</span>
							<span itemprop="exifData" itemscope="itemscope" itemtype="https://schema.org/PropertyValue">
								<meta itemprop="name" content="Flash"/>
								<meta itemprop="value" content="No, compulsory."/>
							</span>
							<span itemprop="exifData" itemscope="itemscope" itemtype="https://schema.org/PropertyValue">
								<meta itemprop="name" content="FNumber"/>
								<meta itemprop="value" content="f/1.8"/>
							</span>
							<span itemprop="exifData" itemscope="itemscope" itemtype="https://schema.org/PropertyValue">
								<meta itemprop="name" content="ISOSpeed"/>
								<meta itemprop="value" content="50"/>
							</span>
							<span itemprop="exifData" itemscope="itemscope" itemtype="https://schema.org/PropertyValue">
								<meta itemprop="name" content="WhiteBalance"/>
								<meta itemprop="value" content="Auto"/>
							</span>
						</picture>
					</div>
					<figcaption>
						Gently push the latch's tabs to pop it free.  Be careful not to break it.  I'm sure there's a better tool to use to remove this thing.
					</figcaption>
				</figure>

				<p>Now, we need to remove two screws underneath the screen.  The screen is held on by adhesive, like everything else these days.  Use a spudger or plastic opening tool to <em>carefully</em> pry it up.  Note that there is an unremovable ribbon cable on the bottom edge.  Take care not to sever it.  (Ubiquiti does not sell spare parts.  I've tried.)</p>
				<figure>
					<div>
						<picture itemscope="itemscope" itemtype="https://schema.org/ImageObject">
							<source type="image/avif" srcset="https://colincogle.name/blog/unifi-cloud-key-rescue/UCK-6@320w.avif 320w, https://colincogle.name/blog/unifi-cloud-key-rescue/UCK-6@640w.avif 640w, https://colincogle.name/blog/unifi-cloud-key-rescue/UCK-6@1920w.avif 1920w, https://colincogle.name/blog/unifi-cloud-key-rescue/UCK-6.avif 4032w"/>
							<source type="image/webp" srcset="https://colincogle.name/blog/unifi-cloud-key-rescue/UCK-6@320w.webp 320w, https://colincogle.name/blog/unifi-cloud-key-rescue/UCK-6@640w.webp 640w, https://colincogle.name/blog/unifi-cloud-key-rescue/UCK-6@1920w.webp 1920w, https://colincogle.name/blog/unifi-cloud-key-rescue/UCK-6.webp 4032w"/>
							<source type="image/jpg" srcset="https://colincogle.name/blog/unifi-cloud-key-rescue/UCK-6@320w.jpg  320w, https://colincogle.name/blog/unifi-cloud-key-rescue/UCK-6@640w.jpg  640w, https://colincogle.name/blog/unifi-cloud-key-rescue/UCK-6@1920w.jpg  1920w, https://colincogle.name/blog/unifi-cloud-key-rescue/UCK-6.jpg  4032w"/>
							<img src="https://colincogle.name/blog/unifi-cloud-key-rescue/UCK-6.jpg" alt="Breaking the screen adhesive on a UniFi Cloud Key Gen2 Plus." itemprop="image url"/>
							<link itemprop="author copyrightHolder creator editor publisher" href="http://colincogle.name/#me"/>
							<meta itemprop="dateCreated" content="2022-09-10T08:12:44-04:00"/>
							<meta itemprop="datePublished" content="2022-10-17T08:41:26-04:00"/>
							<meta itemprop="description" content="Breaking the screen adhesive on a UniFi Cloud Key Gen2 Plus."/>
							<link itemprop="license" href="https://creativecommons.org/licenses/by-sa/4.0/"/>
							<meta itemprop="name" content="UniFi Cloud Key Gen2 Plus Rackmount Connector Removal"/>
							<span itemprop="exifData" itemscope="itemscope" itemtype="https://schema.org/PropertyValue">
								<meta itemprop="name" content="Aperture"/>
								<meta itemprop="value" content="f/1.8"/>
							</span>
							<span itemprop="exifData" itemscope="itemscope" itemtype="https://schema.org/PropertyValue">
								<meta itemprop="name" content="BrightnessValue"/>
								<meta itemprop="value" content="3.02877"/>
							</span>
							<span itemprop="exifData" itemscope="itemscope" itemtype="https://schema.org/PropertyValue">
								<meta itemprop="name" content="ExposureBiasValue"/>
								<meta itemprop="value" content="0 EV"/>
							</span>
							<span itemprop="exifData" itemscope="itemscope" itemtype="https://schema.org/PropertyValue">
								<meta itemprop="name" content="ExposureMode"/>
								<meta itemprop="value" content="Auto"/>
							</span>
							<span itemprop="exifData" itemscope="itemscope" itemtype="https://schema.org/PropertyValue">
								<meta itemprop="name" content="ExposureTime"/>
								<meta itemprop="value" content="0.014285714"/>
							</span>
							<span itemprop="exifData" itemscope="itemscope" itemtype="https://schema.org/PropertyValue">
								<meta itemprop="name" content="Flash"/>
								<meta itemprop="value" content="No, compulsory."/>
							</span>
							<span itemprop="exifData" itemscope="itemscope" itemtype="https://schema.org/PropertyValue">
								<meta itemprop="name" content="FNumber"/>
								<meta itemprop="value" content="f/1.8"/>
							</span>
							<span itemprop="exifData" itemscope="itemscope" itemtype="https://schema.org/PropertyValue">
								<meta itemprop="name" content="ISOSpeed"/>
								<meta itemprop="value" content="125"/>
							</span>
							<span itemprop="exifData" itemscope="itemscope" itemtype="https://schema.org/PropertyValue">
								<meta itemprop="name" content="WhiteBalance"/>
								<meta itemprop="value" content="Auto"/>
							</span>
						</picture>
						<picture itemscope="itemscope" itemtype="https://schema.org/ImageObject">
							<source type="image/avif" srcset="https://colincogle.name/blog/unifi-cloud-key-rescue/UCK-7@320w.avif 320w, https://colincogle.name/blog/unifi-cloud-key-rescue/UCK-7@640w.avif 640w, https://colincogle.name/blog/unifi-cloud-key-rescue/UCK-7@1920w.avif 1920w, https://colincogle.name/blog/unifi-cloud-key-rescue/UCK-7.avif 4032w"/>
							<source type="image/webp" srcset="https://colincogle.name/blog/unifi-cloud-key-rescue/UCK-7@320w.webp 320w, https://colincogle.name/blog/unifi-cloud-key-rescue/UCK-7@640w.webp 640w, https://colincogle.name/blog/unifi-cloud-key-rescue/UCK-7@1920w.webp 1920w, https://colincogle.name/blog/unifi-cloud-key-rescue/UCK-7.webp 4032w"/>
							<source type="image/jpg" srcset="https://colincogle.name/blog/unifi-cloud-key-rescue/UCK-7@320w.jpg  320w, https://colincogle.name/blog/unifi-cloud-key-rescue/UCK-7@640w.jpg  640w, https://colincogle.name/blog/unifi-cloud-key-rescue/UCK-7@1920w.jpg  1920w, https://colincogle.name/blog/unifi-cloud-key-rescue/UCK-7.jpg  4032w"/>
							<img src="https://colincogle.name/blog/unifi-cloud-key-rescue/UCK-7.jpg" alt="The display ribbon cable of a UniFi Cloud Key Gen2 Plus." itemprop="image url"/>
							<link itemprop="author copyrightHolder creator editor publisher" href="http://colincogle.name/#me"/>
							<meta itemprop="dateCreated" content="2022-09-10T08:14:16-04:00"/>
							<meta itemprop="datePublished" content="2022-10-17T08:41:26-04:00"/>
							<meta itemprop="description" content="Removing the 13-pin rackmount port from the UniFi Cloud Key Gen2 Plus."/>
							<link itemprop="license" href="https://creativecommons.org/licenses/by-sa/4.0/"/>
							<meta itemprop="name" content="UniFi Cloud Key Gen2 Plus 13-Pin Rackmount Connector Removal"/>
							<span itemprop="exifData" itemscope="itemscope" itemtype="https://schema.org/PropertyValue">
								<meta itemprop="name" content="Aperture"/>
								<meta itemprop="value" content="f/1.8"/>
							</span>
							<span itemprop="exifData" itemscope="itemscope" itemtype="https://schema.org/PropertyValue">
								<meta itemprop="name" content="BrightnessValue"/>
								<meta itemprop="value" content="2.2863"/>
							</span>
							<span itemprop="exifData" itemscope="itemscope" itemtype="https://schema.org/PropertyValue">
								<meta itemprop="name" content="ExposureBiasValue"/>
								<meta itemprop="value" content="0 EV"/>
							</span>
							<span itemprop="exifData" itemscope="itemscope" itemtype="https://schema.org/PropertyValue">
								<meta itemprop="name" content="ExposureMode"/>
								<meta itemprop="value" content="Auto"/>
							</span>
							<span itemprop="exifData" itemscope="itemscope" itemtype="https://schema.org/PropertyValue">
								<meta itemprop="name" content="ExposureTime"/>
								<meta itemprop="value" content="0.016666667"/>
							</span>
							<span itemprop="exifData" itemscope="itemscope" itemtype="https://schema.org/PropertyValue">
								<meta itemprop="name" content="Flash"/>
								<meta itemprop="value" content="No, compulsory."/>
							</span>
							<span itemprop="exifData" itemscope="itemscope" itemtype="https://schema.org/PropertyValue">
								<meta itemprop="name" content="FNumber"/>
								<meta itemprop="value" content="f/1.8"/>
							</span>
							<span itemprop="exifData" itemscope="itemscope" itemtype="https://schema.org/PropertyValue">
								<meta itemprop="name" content="ISOSpeed"/>
								<meta itemprop="value" content="200"/>
							</span>
							<span itemprop="exifData" itemscope="itemscope" itemtype="https://schema.org/PropertyValue">
								<meta itemprop="name" content="WhiteBalance"/>
								<meta itemprop="value" content="Auto"/>
							</span>
						</picture>	
					</div>
					<figcaption>
						The display is glued on.  Carefully break the adhesive.  However, be careful not to break the display cable along the bottom edge.
					</figcaption>
				</figure>

				<p>Next, the 13-pin connector for the Cloud Key Gen2 Rack Mount Accessory needs to be removed.  There are four latches on the underside to make sure that it sits flush.  This also means that removing it is next to impossible.  You can try to carefully pry it up, but I had luck pushing it up from underneath.  If you try that, be sure to push up on the plastic, and not on the wires themselves!</p>
				<p>Once you have all four tabs disengaged, unplug the connector.  Be sure to mark it, or remember which way it goes so you can reassemble it later.</p>
				<figure>
					<picture itemscope="itemscope" itemtype="https://schema.org/ImageObject">
						<source type="image/avif" srcset="https://colincogle.name/blog/unifi-cloud-key-rescue/UCK-8@320w.avif 320w, https://colincogle.name/blog/unifi-cloud-key-rescue/UCK-8@640w.avif 640w, https://colincogle.name/blog/unifi-cloud-key-rescue/UCK-8@1920w.avif 1920w, https://colincogle.name/blog/unifi-cloud-key-rescue/UCK-8.avif 4032w"/>
						<source type="image/webp" srcset="https://colincogle.name/blog/unifi-cloud-key-rescue/UCK-8@320w.webp 320w, https://colincogle.name/blog/unifi-cloud-key-rescue/UCK-8@640w.webp 640w, https://colincogle.name/blog/unifi-cloud-key-rescue/UCK-8@1920w.webp 1920w, https://colincogle.name/blog/unifi-cloud-key-rescue/UCK-8.webp 4032w"/>
						<source type="image/jpg" srcset="https://colincogle.name/blog/unifi-cloud-key-rescue/UCK-8@320w.jpg  320w, https://colincogle.name/blog/unifi-cloud-key-rescue/UCK-8@640w.jpg  640w, https://colincogle.name/blog/unifi-cloud-key-rescue/UCK-8@1920w.jpg  1920w, https://colincogle.name/blog/unifi-cloud-key-rescue/UCK-8.jpg  4032w"/>
						<img src="https://colincogle.name/blog/unifi-cloud-key-rescue/UCK-8.jpg" alt="Removing the 13-pin rackmount port from the UniFi Cloud Key Gen2 Plus." itemprop="image url"/>
						<link itemprop="author copyrightHolder creator editor publisher" href="http://colincogle.name/#me"/>
						<meta itemprop="dateCreated" content="2022-09-10T08:21:53-04:00"/>
						<meta itemprop="datePublished" content="2022-10-17T08:41:26-04:00"/>
						<meta itemprop="description" content="Removing the 13-pin rackmount port from the UniFi Cloud Key Gen2 Plus."/>
						<link itemprop="license" href="https://creativecommons.org/licenses/by-sa/4.0/"/>
						<meta itemprop="name" content="UniFi Cloud Key Gen2 Plus Rackmount Connector Removal"/>
						<span itemprop="exifData" itemscope="itemscope" itemtype="https://schema.org/PropertyValue">
							<meta itemprop="name" content="Aperture"/>
							<meta itemprop="value" content="f/1.8"/>
						</span>
						<span itemprop="exifData" itemscope="itemscope" itemtype="https://schema.org/PropertyValue">
							<meta itemprop="name" content="BrightnessValue"/>
							<meta itemprop="value" content="2.15464"/>
						</span>
						<span itemprop="exifData" itemscope="itemscope" itemtype="https://schema.org/PropertyValue">
							<meta itemprop="name" content="ExposureBiasValue"/>
							<meta itemprop="value" content="0 EV"/>
						</span>
						<span itemprop="exifData" itemscope="itemscope" itemtype="https://schema.org/PropertyValue">
							<meta itemprop="name" content="ExposureMode"/>
							<meta itemprop="value" content="Auto"/>
						</span>
						<span itemprop="exifData" itemscope="itemscope" itemtype="https://schema.org/PropertyValue">
							<meta itemprop="name" content="ExposureTime"/>
							<meta itemprop="value" content="0.016666667"/>
						</span>
						<span itemprop="exifData" itemscope="itemscope" itemtype="https://schema.org/PropertyValue">
							<meta itemprop="name" content="Flash"/>
							<meta itemprop="value" content="No, compulsory."/>
						</span>
						<span itemprop="exifData" itemscope="itemscope" itemtype="https://schema.org/PropertyValue">
							<meta itemprop="name" content="FNumber"/>
							<meta itemprop="value" content="f/1.8"/>
						</span>
						<span itemprop="exifData" itemscope="itemscope" itemtype="https://schema.org/PropertyValue">
							<meta itemprop="name" content="ISOSpeed"/>
							<meta itemprop="value" content="200"/>
						</span>
						<span itemprop="exifData" itemscope="itemscope" itemtype="https://schema.org/PropertyValue">
							<meta itemprop="name" content="WhiteBalance"/>
							<meta itemprop="value" content="Auto"/>
						</span>
				</picture>
					<figcaption>
						The rack mounting port is exceedingly tough to remove.
					</figcaption>
				</figure>

				<p>Finally, the entire plastic unit can be slid out of the aluminum housing.  Normally, this will not be a problem.  However, these batteries do seem to be defective, because they tend to swell up and fail, so I hear—and now, so I see firsthand.</p>
				<p>If your battery is bad, let's grab a plastic, non-conductive tool and gently break the adhesive holding it to the plastic tray.</p>
				<aside>
					<b>Warning:</b> Piercing a battery can cause an electric shock or start a fire, causing injury or death.  <em>Be careful!</em>
				</aside>
				<p>Ubiquiti does not sell replacement batteries, instead asking you to spend $200 on a new Cloud Key.  They also refused to issue an RMA for this spicy pillow, so into the e-waste bin this little fire hazard goes.  Ubiquiti gave up on trying to fix the problem, instead <a href="https://community.ui.com/questions/Could-Key-Gen-2-Battery-DOA/7ccd440a-761f-40c4-8aea-1275f235639c#answer/8cbd5ae6-dca8-4235-8a09-84b78874f40d">removing the battery entirely from the latest revision of the Cloud Key Gen2 Plus</a>.</p>
				<figure>
					<div>
						<picture itemscope="itemscope" itemtype="https://schema.org/ImageObject">
							<source type="image/avif" srcset="https://colincogle.name/blog/unifi-cloud-key-rescue/UCK-9@320w.avif 320w, https://colincogle.name/blog/unifi-cloud-key-rescue/UCK-9@640w.avif 640w, https://colincogle.name/blog/unifi-cloud-key-rescue/UCK-9@1920w.avif 1920w, https://colincogle.name/blog/unifi-cloud-key-rescue/UCK-9.avif 4032w"/>
							<source type="image/webp" srcset="https://colincogle.name/blog/unifi-cloud-key-rescue/UCK-9@320w.webp 320w, https://colincogle.name/blog/unifi-cloud-key-rescue/UCK-9@640w.webp 640w, https://colincogle.name/blog/unifi-cloud-key-rescue/UCK-9@1920w.webp 1920w, https://colincogle.name/blog/unifi-cloud-key-rescue/UCK-9.webp 4032w"/>
							<source type="image/jpg" srcset="https://colincogle.name/blog/unifi-cloud-key-rescue/UCK-9@320w.jpg  320w, https://colincogle.name/blog/unifi-cloud-key-rescue/UCK-9@640w.jpg  640w, https://colincogle.name/blog/unifi-cloud-key-rescue/UCK-9@1920w.jpg  1920w, https://colincogle.name/blog/unifi-cloud-key-rescue/UCK-9.jpg  4032w"/>
							<img src="https://colincogle.name/blog/unifi-cloud-key-rescue/UCK-9.jpg" alt="The failed and swollen internal battery in a UniFi Cloud Key Gen2 Plus." itemprop="image url"/>
							<meta itemprop="accessMode" content="visual"/>
							<link itemprop="author copyrightHolder creator editor publisher" href="http://colincogle.name/#me"/>
							<meta itemprop="dateCreated" content="2022-09-10T08:23:52-04:00"/>
							<meta itemprop="datePublished" content="2022-10-17T08:41:26-04:00"/>
							<meta itemprop="description" content="The failed and swollen internal battery in a UniFi Cloud Key Gen2 Plus."/>
							<link itemprop="license" href="https://creativecommons.org/licenses/by-sa/4.0/"/>
							<meta itemprop="name" content="UniFi Cloud Key Gen2 Plus Failed Battery"/>
							<span itemprop="exifData" itemscope="itemscope" itemtype="https://schema.org/PropertyValue">
								<meta itemprop="name" content="Aperture"/>
								<meta itemprop="value" content="f/1.8"/>
							</span>
							<span itemprop="exifData" itemscope="itemscope" itemtype="https://schema.org/PropertyValue">
								<meta itemprop="name" content="BrightnessValue"/>
								<meta itemprop="value" content="2.49"/>
							</span>
							<span itemprop="exifData" itemscope="itemscope" itemtype="https://schema.org/PropertyValue">
								<meta itemprop="name" content="ExposureBiasValue"/>
								<meta itemprop="value" content="0 EV"/>
							</span>
							<span itemprop="exifData" itemscope="itemscope" itemtype="https://schema.org/PropertyValue">
								<meta itemprop="name" content="ExposureMode"/>
								<meta itemprop="value" content="Auto"/>
							</span>
							<span itemprop="exifData" itemscope="itemscope" itemtype="https://schema.org/PropertyValue">
								<meta itemprop="name" content="ExposureTime"/>
								<meta itemprop="value" content="0.016666667"/>
							</span>
							<span itemprop="exifData" itemscope="itemscope" itemtype="https://schema.org/PropertyValue">
								<meta itemprop="name" content="Flash"/>
								<meta itemprop="value" content="Flash did not fire."/>
							</span>
							<span itemprop="exifData" itemscope="itemscope" itemtype="https://schema.org/PropertyValue">
								<meta itemprop="name" content="FNumber"/>
								<meta itemprop="value" content="f/1.8"/>
							</span>
							<span itemprop="exifData" itemscope="itemscope" itemtype="https://schema.org/PropertyValue">
								<meta itemprop="name" content="ISOSpeed"/>
								<meta itemprop="value" content="160"/>
							</span>
							<span itemprop="exifData" itemscope="itemscope" itemtype="https://schema.org/PropertyValue">
								<meta itemprop="name" content="WhiteBalance"/>
								<meta itemprop="value" content="Auto"/>
							</span>
						</picture>
						<picture itemscope="itemscope" itemtype="https://schema.org/ImageObject">
							<source type="image/avif" srcset="https://colincogle.name/blog/unifi-cloud-key-rescue/UCK-10@320w.avif 320w, https://colincogle.name/blog/unifi-cloud-key-rescue/UCK-10@640w.avif 640w, https://colincogle.name/blog/unifi-cloud-key-rescue/UCK-10@1920w.avif 1920w, https://colincogle.name/blog/unifi-cloud-key-rescue/UCK-10.avif 4032w"/>
							<source type="image/webp" srcset="https://colincogle.name/blog/unifi-cloud-key-rescue/UCK-10@320w.webp 320w, https://colincogle.name/blog/unifi-cloud-key-rescue/UCK-10@640w.webp 640w, https://colincogle.name/blog/unifi-cloud-key-rescue/UCK-10@1920w.webp 1920w, https://colincogle.name/blog/unifi-cloud-key-rescue/UCK-10.webp 4032w"/>
							<source type="image/jpg" srcset="https://colincogle.name/blog/unifi-cloud-key-rescue/UCK-10@320w.jpg  320w, https://colincogle.name/blog/unifi-cloud-key-rescue/UCK-10@640w.jpg  640w, https://colincogle.name/blog/unifi-cloud-key-rescue/UCK-10@1920w.jpg  1920w, https://colincogle.name/blog/unifi-cloud-key-rescue/UCK-10.jpg  4032w"/>
							<img src="https://colincogle.name/blog/unifi-cloud-key-rescue/UCK-10.jpg" alt="The internal battery from a UniFi Cloud Key Gen2 Plus." itemprop="image url"/>
							<meta itemprop="accessMode" content="visual"/>
							<link itemprop="author copyrightHolder creator editor publisher" href="http://colincogle.name/#me"/>
							<meta itemprop="dateCreated" content="2022-09-10T08:26:55-04:00"/>
							<meta itemprop="datePublished" content="2022-10-17T08:41:26-04:00"/>
							<meta itemprop="description" content="The failed and swollen internal battery from a UniFi Cloud Key Gen2 Plus."/>
							<link itemprop="license" href="https://creativecommons.org/licenses/by-sa/4.0/"/>
							<meta itemprop="name" content="UniFi Cloud Key Gen2 Plus Failed Battery"/>
							<span itemprop="exifData" itemscope="itemscope" itemtype="https://schema.org/PropertyValue">
								<meta itemprop="name" content="Aperture"/>
								<meta itemprop="value" content="f/1.8"/>
							</span>
							<span itemprop="exifData" itemscope="itemscope" itemtype="https://schema.org/PropertyValue">
								<meta itemprop="name" content="BrightnessValue"/>
								<meta itemprop="value" content="4.17936"/>
							</span>
							<span itemprop="exifData" itemscope="itemscope" itemtype="https://schema.org/PropertyValue">
								<meta itemprop="name" content="ExposureBiasValue"/>
								<meta itemprop="value" content="0 EV"/>
							</span>
							<span itemprop="exifData" itemscope="itemscope" itemtype="https://schema.org/PropertyValue">
								<meta itemprop="name" content="ExposureMode"/>
								<meta itemprop="value" content="Auto"/>
							</span>
							<span itemprop="exifData" itemscope="itemscope" itemtype="https://schema.org/PropertyValue">
								<meta itemprop="name" content="ExposureTime"/>
								<meta itemprop="value" content="0.008264463"/>
							</span>
							<span itemprop="exifData" itemscope="itemscope" itemtype="https://schema.org/PropertyValue">
								<meta itemprop="name" content="Flash"/>
								<meta itemprop="value" content="Flash did not fire."/>
							</span>
							<span itemprop="exifData" itemscope="itemscope" itemtype="https://schema.org/PropertyValue">
								<meta itemprop="name" content="FNumber"/>
								<meta itemprop="value" content="f/1.8"/>
							</span>
							<span itemprop="exifData" itemscope="itemscope" itemtype="https://schema.org/PropertyValue">
								<meta itemprop="name" content="ISOSpeed"/>
								<meta itemprop="value" content="100"/>
							</span>
							<span itemprop="exifData" itemscope="itemscope" itemtype="https://schema.org/PropertyValue">
								<meta itemprop="name" content="WhiteBalance"/>
								<meta itemprop="value" content="Auto"/>
							</span>
						</picture>	
					</div>
					<figcaption>
						Remove the battery.  If it's bad, please recycle it safely and properly.
					</figcaption>
				</figure>

				<p>The Cloud Key is now fully disassembled.  If you were reading this to remove the battery, congratulations!  You're done.  Reverse these steps to put this back together (hopefully with a working battery).</p>

				<h2>Unflashable Firmware?</h2>
				<p>In my case, this Cloud Key wouldn't boot.  I booted it up in recovery mode and attempted to re-flash the firmware, but it refused to accept any firmware image;  it refused to accept an image of the same version 2.0.27, but it also refused to accept newer and older versions, too.</p>
				<p>Since I already had this thing apart, I hooked up my <abbr title="Transistor-Transistor Logic" aria-label="T-T-L">TTL</abbr> serial adapter to the three-pin header located at port J22.</p>
				<figure itemscope="itemscope" itemtype="https://schema.org/ImageObject">
					<picture>
						<source itemprop="contentUrl" type="image/avif" srcset="https://colincogle.name/blog/unifi-cloud-key-rescue/UCK-11@320w.avif 320w, https://colincogle.name/blog/unifi-cloud-key-rescue/UCK-11@640w.avif 640w, https://colincogle.name/blog/unifi-cloud-key-rescue/UCK-11@1920w.avif 1920w, https://colincogle.name/blog/unifi-cloud-key-rescue/UCK-11.avif 4032w"/>
						<source itemprop="contentUrl" type="image/webp" srcset="https://colincogle.name/blog/unifi-cloud-key-rescue/UCK-11@320w.webp 320w, https://colincogle.name/blog/unifi-cloud-key-rescue/UCK-11@640w.webp 640w, https://colincogle.name/blog/unifi-cloud-key-rescue/UCK-11@1920w.webp 1920w, https://colincogle.name/blog/unifi-cloud-key-rescue/UCK-11.webp 4032w"/>
						<source itemprop="contentUrl" type="image/jpg" srcset="https://colincogle.name/blog/unifi-cloud-key-rescue/UCK-11@320w.jpg  320w, https://colincogle.name/blog/unifi-cloud-key-rescue/UCK-11@640w.jpg  640w, https://colincogle.name/blog/unifi-cloud-key-rescue/UCK-11@1920w.jpg  1920w, https://colincogle.name/blog/unifi-cloud-key-rescue/UCK-11.jpg  4032w"/>
						<img src="https://colincogle.name/blog/unifi-cloud-key-rescue/UCK-11.jpg" alt="The internal serial port (J22, circled) inside the UniFi Cloud Key Gen2 Plus." itemprop="image url"/>
					</picture>
					<figcaption itemprop="caption">
						Header J22 is a 3.3<abbr title="volt">V</abbr> TTL serial port.  The other one seems to be, too, but I haven't figured out what that might be for.
					</figcaption>
					<meta itemprop="accessMode" content="visual"/>
					<link itemprop="author copyrightHolder creator editor publisher" href="http://colincogle.name/#me"/>
					<meta itemprop="dateCreated" content="2022-09-10T08:59:41-04:00"/>
					<meta itemprop="datePublished" content="2022-10-17T08:41:26-04:00"/>
					<meta itemprop="description" content="The internal serial port (J22, circled) inside of the UniFi Cloud Key Gen2 Plus."/>
					<link itemprop="license" href="https://creativecommons.org/licenses/by-sa/4.0/"/>
					<meta itemprop="name" content="UniFi Cloud Key Gen2 Plus Serial Port Location"/>
					<span itemprop="exifData" itemscope="itemscope" itemtype="https://schema.org/PropertyValue">
						<meta itemprop="name" content="Aperture"/>
						<meta itemprop="value" content="f/1.8"/>
					</span>
					<span itemprop="exifData" itemscope="itemscope" itemtype="https://schema.org/PropertyValue">
						<meta itemprop="name" content="BrightnessValue"/>
						<meta itemprop="value" content="3.30036"/>
					</span>
					<span itemprop="exifData" itemscope="itemscope" itemtype="https://schema.org/PropertyValue">
						<meta itemprop="name" content="ExposureBiasValue"/>
						<meta itemprop="value" content="0 EV"/>
					</span>
					<span itemprop="exifData" itemscope="itemscope" itemtype="https://schema.org/PropertyValue">
						<meta itemprop="name" content="ExposureMode"/>
						<meta itemprop="value" content="Auto"/>
					</span>
					<span itemprop="exifData" itemscope="itemscope" itemtype="https://schema.org/PropertyValue">
						<meta itemprop="name" content="ExposureTime"/>
						<meta itemprop="value" content="0.011363636"/>
					</span>
					<span itemprop="exifData" itemscope="itemscope" itemtype="https://schema.org/PropertyValue">
						<meta itemprop="name" content="Flash"/>
						<meta itemprop="value" content="Flash did not fire."/>
					</span>
					<span itemprop="exifData" itemscope="itemscope" itemtype="https://schema.org/PropertyValue">
						<meta itemprop="name" content="FNumber"/>
						<meta itemprop="value" content="f/1.8"/>
					</span>
					<span itemprop="exifData" itemscope="itemscope" itemtype="https://schema.org/PropertyValue">
						<meta itemprop="name" content="ISOSpeed"/>
						<meta itemprop="value" content="125"/>
					</span>
					<span itemprop="exifData" itemscope="itemscope" itemtype="https://schema.org/PropertyValue">
						<meta itemprop="name" content="WhiteBalance"/>
						<meta itemprop="value" content="Auto"/>
					</span>
				</figure>

				<p>After getting the pinout right, I was greeted with a serial console!</p>
				<figure>
					<pre>Please press Enter to activate this console. 

Boottime: 4.52s

cloudkey-apq8053 login: ubnt
Password: 
Login incorrect
cloudkey-apq8053 login: root
Password: 
				.--.__
	______ __ .--(    ) )-.   __ __
	|      |  (._____.__.___)_|  |  |__ _____ __ __
	|   ---|  ||  _  |  |  |  _  |    &lt;|  -__|  |  |
	|______|__||_____|_____|_____|__|__|_____|___  |
		(c) 2018 Ubiquiti Networks, Inc.  |_____|

		Welcome to the CloudKey Recovery!
</pre>
					<figcaption>Hey, look!  A serial console!  I figured the username and password would be one of the usual two.</figcaption>
				</figure>
				<p>
					Fortunately, <a href="https://help.ui.com/hc/en-us/articles/204909374-UniFi-Login-with-SSH-Advanced-" title="ubnt:ubnt, or I guess, root:ubnt via SSH.">the default usernames and password are well-known</a>.  Once I logged in, I began to browse the recovery filesystem.  I checked <a target="_blank" href="https://colincogle.name/blog/unifi-cloud-key-rescue/UCK-G2-PLUS%20boot%20messages%20v2.0.27.txt" title="In case you're curious">the boot messages and <kbd>dmesg</kbd> output</a> but found nothing of interest.
				</p>
				<p>
					However, I found an app in the filesystem called <kbd>ubnt-tool</kbd>, which has a mode called <kbd>fwupdate</kbd>.  I figured it'd be worth a shot.  I grabbed <a href="https://www.ui.com/download/unifi/unifi-cloud-key-gen2/uck-g2-plus">the URL of the latest firmware blob</a>, downloaded it to the device, and installed it.
				</p>
				<figure>
					<kbd class="code bash">
						<span>
							<samp class="prompt" aria-hidden="true">cloudkey-apq8053#</samp>
							<span class="app">cd</span>
							<span class="string">/tmp</span>
						</span><br/>
						<span>
							<samp class="prompt" aria-hidden="true">cloudkey-apq8053#</samp>
							<span class="app">wget</span>
							<span class="string" aria-label="[download URL]">https://fw-download.ubnt.com/data/unifi-cloudkey/6fac-UCKP-2.5.11-c5a57cf5d5344114a762782ab4d3a940.bin</span>
						</span><br/>
						<span>
							<samp class="prompt" aria-hidden="true">cloudkey-apq8053#</samp>
							<span class="app">ubnt-tool</span>
							<span class="switch">fwupdate</span>
							<span class="string" aria-label="[file name]">6fac-UCKP-2.5.11-c5a57cf5d5344114a762782ab4d3a940.bin</span>
						</span>
					</kbd>
					<details class="noprint">
						<summary>View the uninteresting output:</summary>
						<pre>Firmware file: '6fac-UCKP-2.5.11-c5a57cf5d5344114a762782ab4d3a940.bin'
DEBUG: Firmware version: 'UCKP.apq8053.v2.5.11.b2ebfc7.220801.1419'
DEBUG: Partition: sbl1 [0]
DEBUG:   Partition size: 0x80000
DEBUG:   Data length: 380572
DEBUG: Partition: devcfg [1]
DEBUG:   Partition size: 0x40000
DEBUG:   Data length: 37772
DEBUG: Partition: boot [2]
DEBUG:   Partition size: 0x4000000
DEBUG:   Data length: 11079680
DEBUG: Partition: rootfs [3]
DEBUG:   Partition size: 0x80000000
DEBUG:   Data length: 633630720
DEBUG: found ENDS at 0x2673e434 
DEBUG: Message Digest successfully verfied.
DEBUG: writing 'sbl1' to '/dev/mmcblk0'...
blk_size: 800000, to_verify: 1
DEBUG: 
Writing: 0x0005ce9c bytes with offset 0x00006800
[%0  ]DEBUG: 
DEBUG: Block at 00006800(len: 0005CE9C) has no changes.
[%100]DEBUG: 
DEBUG: writing 'devcfg' to '/dev/mmcblk0'...
blk_size: 800000, to_verify: 1
DEBUG: 
Writing: 0x0000938c bytes with offset 0x00606800
[%0  ]DEBUG: 
DEBUG: Block at 00606800(len: 0000938C) has no changes.
[%100]DEBUG: 
DEBUG: writing 'boot' to '/dev/mmcblk0'...
blk_size: 800000, to_verify: 1
DEBUG: 
Writing: 0x00a91000 bytes with offset 0x34200000
[%0  ]DEBUG: 
DEBUG: Block at 34200000(len: 00800000) has no changes.
[%75 ]DEBUG: 
DEBUG: Block at 34A00000(len: 00291000) has no changes.
[%100]DEBUG: 
DEBUG: writing 'rootfs' to '/dev/mmcblk0'...
blk_size: 800000, to_verify: 1
DEBUG: 
Writing: 0x25c47000 bytes with offset 0x3c200000
[%0  ]DEBUG: 
DEBUG: Block at 3C200000(len: 00800000) has no changes.
[%1  ]DEBUG: 
DEBUG: Block at 3CA00000(len: 00800000) has no changes.
[%2  ]DEBUG: 
DEBUG: Block at 3D200000(len: 00800000) has no changes.
[%3  ]DEBUG: 
DEBUG: Block at 3DA00000(len: 00800000) has no changes.
[%5  ]DEBUG: 
DEBUG: Block at 3E200000(len: 00800000) has no changes.
[%6  ]DEBUG: 
DEBUG: Block at 3EA00000(len: 00800000) has no changes.
[%7  ]DEBUG: 
DEBUG: Block at 3F200000(len: 00800000) has no changes.
[%9  ]DEBUG: 
DEBUG: Block at 3FA00000(len: 00800000) has no changes.
[%10 ]DEBUG: 
DEBUG: Block at 40200000(len: 00800000) has no changes.
[%11 ]DEBUG: 
DEBUG: Block at 40A00000(len: 00800000) has no changes.
[%13 ]DEBUG: 
DEBUG: Block at 41200000(len: 00800000) has no changes.
[%14 ]DEBUG: 
DEBUG: Block at 41A00000(len: 00800000) has no changes.
[%15 ]DEBUG: 
DEBUG: Block at 42200000(len: 00800000) has no changes.
[%17 ]DEBUG: 
DEBUG: Block at 42A00000(len: 00800000) has no changes.
[%18 ]DEBUG: 
DEBUG: Block at 43200000(len: 00800000) has no changes.
[%19 ]DEBUG: 
DEBUG: Block at 43A00000(len: 00800000) has no changes.
[%21 ]DEBUG: 
DEBUG: Block at 44200000(len: 00800000) has no changes.
[%22 ]DEBUG: 
DEBUG: Block at 44A00000(len: 00800000) has no changes.
[%23 ]DEBUG: 
DEBUG: Block at 45200000(len: 00800000) has no changes.
[%25 ]DEBUG: 
DEBUG: Block at 45A00000(len: 00800000) has no changes.
[%26 ]DEBUG: 
DEBUG: Block at 46200000(len: 00800000) has no changes.
[%27 ]DEBUG: 
DEBUG: Block at 46A00000(len: 00800000) has no changes.
[%29 ]DEBUG: 
DEBUG: Block at 47200000(len: 00800000) has no changes.
[%30 ]DEBUG: 
DEBUG: Block at 47A00000(len: 00800000) has no changes.
[%31 ]DEBUG: 
DEBUG: Block at 48200000(len: 00800000) has no changes.
[%33 ]DEBUG: 
DEBUG: Block at 48A00000(len: 00800000) has no changes.
[%34 ]DEBUG: 
DEBUG: Block at 49200000(len: 00800000) has no changes.
[%35 ]DEBUG: 
DEBUG: Block at 49A00000(len: 00800000) has no changes.
[%37 ]DEBUG: 
DEBUG: Block at 4A200000(len: 00800000) has no changes.
[%38 ]DEBUG: 
DEBUG: Block at 4AA00000(len: 00800000) has no changes.
[%39 ]DEBUG: 
DEBUG: Block at 4B200000(len: 00800000) has no changes.
[%41 ]DEBUG: 
DEBUG: Block at 4BA00000(len: 00800000) has no changes.
[%42 ]DEBUG: 
DEBUG: Block at 4C200000(len: 00800000) has no changes.
[%43 ]DEBUG: 
DEBUG: Block at 4CA00000(len: 00800000) has no changes.
[%45 ]DEBUG: 
DEBUG: Block at 4D200000(len: 00800000) has no changes.
[%46 ]DEBUG: 
DEBUG: Block at 4DA00000(len: 00800000) has no changes.
[%47 ]DEBUG: 
DEBUG: Block at 4E200000(len: 00800000) has no changes.
[%48 ]DEBUG: 
DEBUG: Block at 4EA00000(len: 00800000) has no changes.
[%50 ]DEBUG: 
DEBUG: Block at 4F200000(len: 00800000) has no changes.
[%51 ]DEBUG: 
DEBUG: Block at 4FA00000(len: 00800000) has no changes.
[%52 ]DEBUG: 
DEBUG: Block at 50200000(len: 00800000) has no changes.
[%54 ]DEBUG: 
DEBUG: Block at 50A00000(len: 00800000) has no changes.
[%55 ]DEBUG: 
DEBUG: Block at 51200000(len: 00800000) has no changes.
[%56 ]DEBUG: 
DEBUG: Block at 51A00000(len: 00800000) has no changes.
[%58 ]DEBUG: 
DEBUG: Block at 52200000(len: 00800000) has no changes.
[%59 ]DEBUG: 
DEBUG: Block at 52A00000(len: 00800000) has no changes.
[%60 ]DEBUG: 
DEBUG: Block at 53200000(len: 00800000) has no changes.
[%62 ]DEBUG: 
DEBUG: Block at 53A00000(len: 00800000) has no changes.
[%63 ]DEBUG: 
DEBUG: Block at 54200000(len: 00800000) has no changes.
[%64 ]DEBUG: 
DEBUG: Block at 54A00000(len: 00800000) has no changes.
[%66 ]DEBUG: 
DEBUG: Block at 55200000(len: 00800000) has no changes.
[%67 ]DEBUG: 
DEBUG: Block at 55A00000(len: 00800000) has no changes.
[%68 ]DEBUG: 
DEBUG: Block at 56200000(len: 00800000) has no changes.
[%70 ]DEBUG: 
DEBUG: Block at 56A00000(len: 00800000) has no changes.
[%71 ]DEBUG: 
DEBUG: Block at 57200000(len: 00800000) has no changes.
[%72 ]DEBUG: 
DEBUG: Block at 57A00000(len: 00800000) has no changes.
[%74 ]DEBUG: 
DEBUG: Block at 58200000(len: 00800000) has no changes.
[%75 ]DEBUG: 
DEBUG: Block at 58A00000(len: 00800000) has no changes.
[%76 ]DEBUG: 
DEBUG: Block at 59200000(len: 00800000) has no changes.
[%78 ]DEBUG: 
DEBUG: Block at 59A00000(len: 00800000) has no changes.
[%79 ]DEBUG: 
DEBUG: Block at 5A200000(len: 00800000) has no changes.
[%80 ]DEBUG: 
DEBUG: Block at 5AA00000(len: 00800000) has no changes.
[%82 ]DEBUG: 
DEBUG: Block at 5B200000(len: 00800000) has no changes.
[%83 ]DEBUG: 
DEBUG: Block at 5BA00000(len: 00800000) has no changes.
[%84 ]DEBUG: 
DEBUG: Block at 5C200000(len: 00800000) has no changes.
[%86 ]DEBUG: 
DEBUG: Block at 5CA00000(len: 00800000) has no changes.
[%87 ]DEBUG: 
DEBUG: Block at 5D200000(len: 00800000) has no changes.
[%88 ]DEBUG: 
DEBUG: Block at 5DA00000(len: 00800000) has no changes.
[%90 ]DEBUG: 
DEBUG: Block at 5E200000(len: 00800000) has no changes.
[%91 ]DEBUG: 
DEBUG: Block at 5EA00000(len: 00800000) has no changes.
[%92 ]DEBUG: 
DEBUG: Block at 5F200000(len: 00800000) has no changes.
[%93 ]DEBUG: 
DEBUG: Block at 5FA00000(len: 00800000) has no changes.
[%95 ]DEBUG: 
DEBUG: Block at 60200000(len: 00800000) has no changes.
[%96 ]DEBUG: 
DEBUG: Block at 60A00000(len: 00800000) has no changes.
[%97 ]DEBUG: 
DEBUG: Block at 61200000(len: 00800000) has no changes.
[%99 ]DEBUG: 
DEBUG: Block at 61A00000(len: 00447000) has no changes.
[%100]DEBUG:</pre>
					</details>
					<figcaption>
						The <kbd>ubnt-tool</kbd> app can be used to update the firmware via a console.  The copy of <kbd>wget</kbd> included with this old version of the recovery firmware didn't support TLS 1.2, so I had to change that URL to a plain HTTP one.
					</figcaption>
				</figure>
				<p>There were a lot of unchanged blocks for being so many years behind on firmware updates, but one <kbd>reboot</kbd> later, my Cloud Key was back up and running!</p>
			</div>
		</content>
	</entry>

	<entry>
		<title>SSHFP Records on Windows Server</title>
		<id>urn:uuid:57bdece4-264a-44a3-b5bd-5a5a6d4849fe</id>
		<link rel="alternate" type="text/html" href="https://colincogle.name/blog/sshfp/" length="29447"/>
		<link rel="alternate" type="text/markdown" href="https://colincogle.name/blog/sshfp/sshfp-records-on-windows-server.md" length="10649"/>
		<link rel="alternate" type="text/gemini" href="gemini://colincogle.name/blog/sshfp/" length="10363"/>
		<link rel="alternate" type="text/plain" href="https://colincogle.name/blog/sshfp/sshfp-records-on-windows-server.txt" length="11171"/>
		<link rel="alternate" type="application/gopher-menu" href="gopher://colincogle.name/1/blog/sshfp/" length="1388"/>
		<link rel="related" href="http://colincogle.name/blog/do-it-better/ssh"/>
		<category term="technology"/>
		<category term="sysadmin" label="System administration"/>
		<category term="Windows" label="Windows Server"/>
		<summary>SSHFP records are a vital part of securing SSH.  However, Microsoft's DNS Server doesn't give us an easy way to add them.  Here's how.</summary>
		<published>2022-09-24T19:35:54-04:00</published>
		<updated>2022-09-24T19:35:54-04:00</updated>
		<content type="xhtml">
			<div xmlns="http://www.w3.org/1999/xhtml">
				<section>
					<header><h2>A Review of SSH Fingerprints</h2></header>
					<p>
						<abbr title="Secure Shell">SSH</abbr> servers all have fingerprints to identify themselves.  These little hashes of the host's public key are exchanged with clients, and remembered in a Trust On First Use (TOFU) security model.
					</p>
					<figure>
						<samp class="code">
							<span>The authenticity of host 'www.someserver.net (2001:db8::49)' can't be established.</span><br/>
							<span>ED25519 key fingerprint is SHA256:1z0nm0KwN5cnOSA9HQ0VzjUR9VaPUd+/tB5FtTB1NdQ=.</span><br/>
							<span><strong>No matching host key fingerprint found in DNS.</strong></span><br/>
							<span>This key is not known by any other names</span><br/>
							<span>Are you sure you want to continue connecting (yes/no/[fingerprint])?</span>
						</samp>
						<figcaption>The default OpenSSH warning when connecting to an unknown server.</figcaption>
					</figure>

					<p>
						Now, let's be honest.  SSH is an incredibly high-value target, but how many of us have actually taken the time to manually verify an SSH key?  Raise your hands.  Yeah, I'm not raising mine, either.
					</p>
					<p>
						<abbr title="Trust on first use">TOFU</abbr> is a decent security model, because it protects all connections to the server—except for the very first one.
					</p>
					<p>
						You might have noticed that there is a line up there that reads, <q>No matching host key fingerprint found in DNS</q>.  Longtime Linux system administrators might know about the <i>SSHFP DNS record</i>, defined way back in <a href="https://www.rfc-editor.org/rfc/rfc4255" title="Wow, it's hard to be believe that was almost 5,000 RFCs ago!"><abbr title="Request for Comments">RFC</abbr> 4255</a>.  Adding one to a standard DNS server such as BIND9 is as simple as making the records and copying them into your zone file.
					</p>
					<figure>
						<code class="code bash">
							<span>
								<span class="prompt">#</span>
								<kbd>
									<span class="command">ssh-keygen</span>
									<span class="parameter">-r</span>
									<span class="string">myservername</span>
									<span class="operator">|</span>
									<span class="command">tee</span>
									<span class="string">ssh-keys.txt</span>
								</kbd>
							</span><br/>
							<span>
								<samp>myservername IN SSHFP 1 2 d73d279b42b037972739203d1d0d15ce3511f5568f51dfbfb41e45b5307535d4</samp>
							</span><br/>
							<span>
								<samp>myservername IN SSHFP 3 2 95941914e0c29ca8a104bf4b6c8890c7c172f7ce610bc331ea6aab1537852ead</samp>
							</span><br/>
							<span>
								<samp>myservername IN SSHFP 4 2 6c0461c9809836eb61b0e3a07b31a99522452a7e28499a39aa8423a17b8e2f2a</samp>
							</span><br/>
							<span>
								<span class="prompt">#</span>
								<kbd>
									<span class="string">ssh-keys.txt</span>
									<span class="operator">&gt;&gt;</span>
									<span class="string">/etc/bind9/myzonefile.dns</span>
								</kbd>
							</span>
						</code>
						<figcaption>
							SSHFP records can be generated with the <code>ssh-keygen</code> command, and appended to your zone file.  None of this is new.  (I'm using <code>tee</code> so we have something to look at.)
						</figcaption>
					</figure>
					<p>
						If you're lucky enough to be using the BIND DNS server, congratulations!  Your work is done.  However, if this was all I was writing about, it wouldn't make for a useful article.
					</p>
				</section>

				<section>
					<header><h2>Microsoft in the Mix</h2></header>
					<p>
						However, some of us administer Windows networks, which sometimes means that Active Directory Domain Services (AD DS) is in the mix;  and, if that be true, then one would be foolish not to use the Microsoft DNS Server alongside that.  Though it lags <em>far</em> behind BIND in terms of feature and resource record support, it does provide a <abbr title="Graphical User Interface">GUI</abbr> (albeit dated) and a robust PowerShell module.
					</p>
					<p>
						While it does not support SSHFP records natively, the DNS Server included with all versions of Windows Server will at least accept, store, and serve SSHFP records.  The problem, though, is how to get them saved, as neither the <abbr title="GUI" aria-label="gooey">GUI</abbr> nor the PowerShell cmdlets will let you input one.  (Neither will <code>dnscmd</code>, but that thing is deprecated, anyway.)
					</p>
					<p>
						You might be wondering, though.  What is the point of storing SSHFP records when you have a Windows-centric network?  Simple:  you gain the same benefits.
					</p>
					<ul>
						<li>
							If you have macOS or Linux machines on your network, they likely have SSH servers running.
						</li>
						<li>
							Your firewall, switches, and VMware hosts might have SSH daemons running, too.  Even if they only run <em>some</em> of the time, you can still have DNS-level protection.
						</li>
						<li>
							Notably, the OpenSSH Server is an installable feature in Windows 10, Windows 11, Windows Server 2019, and Windows Server 2022;  with <a href="https://github.com/PowerShell/Win32-OpenSSH">backports available for downlevel versions</a>.  (This may also be the replacement for PowerShell Remoting if <abbr title="Windows Remote Management">WinRM</abbr> ever becomes deprecated.)
						</li>
					</ul>
				</section>

				<section>
					<header><h2 id="skip-the-crap">Here's How</h2></header>
					<h3>Check Your DNS Server</h3>
					<p>
						You will need to be running Windows Server 2012 or later.  While this should work with any version of the Microsoft DNS Server, both the RFC—and common sense—strongly recommend you use <abbr title="Domain Name System Security Extensions">DNSSEC</abbr> to secure these records.
					</p>
					<p>
						If you are running Windows Server 2008 R2 or older, stop right here and evaluate your personal and professional life decisions.  Not only has been out of extended support for <time datetime="2020-01-14">quite a long time</time>, but its DNSSEC implementation is rudimentary at best.
					</p>

					<h3>Gather Your Fingerprints</h3>
					<p>
						You will need to gather the SSH fingerprints for all of your hosts.  You can log on and run <code>ssh-keygen -r</code> to generate them interactively, or for things like printers and other network devices, a tool like <code>ssh-keyscan</code> can read them remotely.
					</p>

					<h3>Download the BIND9 Tools</h3>
					<p>
						If you have a macOS or Linux machine with the <code>nsupdate</code> tool on there, you can skip this section.  Otherwise, download the <a href="https://downloads.isc.org/isc/bind9/9.16.48/BIND9.16.48.x64.zip" title="No, there is no newer binary available.  This is the last version ISC will make available as a pre-compiled binary.">BIND9 Tools for Windows</a> to obtain a copy of <code>nsupdate.exe</code>, which will allow us to spit arbitrary DNS records into our zone.
					</p>
					<figure>
						<figcaption>
							You can also use PowerShell to download and install the BIND9 Tools.  This is useful if you want to script this, or if you're lucky enough to be running a headless version of Windows Server.
						</figcaption>
						<code class="code powershell">
							<span>
								<span class="cmdlet">Set-Location</span>
								<span class="variable">$env:Temp</span>
							</span><br/>
							<span>
								<span class="cmdlet">Invoke-WebRequest</span>
								<span class="switch">-OutFile</span>
								<span class="string">'BIND.zip'</span>
								<span class="switch">-Uri</span>
								<span class="string">'https://downloads.isc.org/isc/bind9/9.16.32/BIND9.16.32.x64.zip'</span>
							</span><br/>
							<span>
								<span class="cmdlet">Expand-Archive</span>
								<span class="switch">-Path</span>
								<span class="string">'BIND.zip'</span>
							</span>
						</code>
					</figure>

					<h3>Create the NSUpdate Command</h3>
					<p>
						The <code>nsupdate</code> tool has its own syntax.  You can copy and paste all of the hostnames and fingerprints that you've gathered from across your network, and combine them into one big Notepad document.
					</p>
					<p>
						You can also use this PowerShell to turn your <code>ssh-keygen -r</code> output into a file that can be used by <code>nsupdate</code> (<a href="https://colincogle.name/blog/sshfp/sample-nsupdate.txt">here is a barebones example</a>):
					</p>
					<figure>
						<code class="code powershell">
							<span>
								<span class="comment"># Edit this next line with the name of your DNS zone!</span>
							</span><br/>
							<span>
								<span class="variable">$MyDomainName</span>
								<span class="operator">=</span>
								<span class="string">'example.com'</span>
							</span><br/>
							<span/><br/>
							<span>
								<span class="variable">$sshfp</span>
								<span class="operator">=</span>
								<span class="string">''</span>
							</span><br/>
							<span>
								<span class="cmdlet">Get-Content</span>
								<span class="variable">'Output of ssh-keygen -r.txt'</span>
								<span class="operator">|</span>
								<span class="cmdlet">ForEach-Object</span>
								<span class="parameter">-ScriptBlock</span>
								<span class="operator level1">{</span>
							</span><br/>
							<span>
								<span class="comment">
									    
									# Each line of the input file will need to be modified to add some more items.  It must be prefixed with "update add" and have a TTL inserted after the hostname (even though the DNS zone will likely override it).
								</span>
							</span><br/>
							<span>
								    
								<span class="variable">$x</span>
								<span class="operator">=</span>
								<span class="variable">$_</span>
								<span class="operator">-Split</span>
								<span class="variable">"[\t\s]"</span>
							</span><br/>
							<span>
								    
								<span class="variable">$sshfp</span>
								<span class="operator">+=</span>
								<span class="string">"update add
									<span class="operator">$<span class="level2">(</span><span class="variable">$x</span><span class="level3">[</span><span class="literal">0</span><span class="level3">]</span><span class="level2">)</span></span>.<span class="variable">$MyDomainName</span>
									3600
									<span class="operator">$<span class="level2">(</span><span class="variable">$x</span><span class="level3">[</span><span class="literal">1<span class="operator">..</span>5</span><span class="level3">]</span><span class="level2">)</span>.</span><span class="escape">`r`n</span>"
								</span>
							</span><br/>
							<span>
								<span class="operator level1">}</span>
							</span><br/>
							<span/><br/>
							<span>
								<span class="comment"># Prepare the NSUpdate command.</span>
							</span><br/>
							<span>
								<span class="variable">$NSUpdateCommand</span>
								<span class="operator">=</span>
								<span class="string">"server</span>
								<span class="variable">$DNSServer</span>
							</span><br/>
							<span>
								<span class="string">zone</span>
								<span class="variable">$MyDomainName</span>
							</span><br/>
							<span>
								<span class="variable">$sshfp</span>
							</span><br/>
							<span>
								<span class="string">send"</span>
							</span>
						</code>
						<figcaption>
							This PowerShell code can be used to convert <code>ssh-keygen -r</code> output into something <code>nsupdate</code> can understand.
						</figcaption>
					</figure>

					<h3>Relaxing Zone Security (For a Few Seconds)</h3>
					<p>
						Security-conscious people might be thinking that using freeware to inject random DNS records is a very bad thing, and they are correct.  Fortunately, by default, Windows-hosted zones default to only allowing secure dynamic updates (authenticated by Kerberos).  To accomplish our goal, we will need to temporarily relax security rules.
					</p>
					<ol>
						<li>In the DNS snap-in, right-click your zone and choose <b>Properties</b>.</li>
						<li>Under <b>Dynamic Updates</b>, choose <b>Secure and Nonsecure</b>.</li>
						<li>Click <b>OK</b>.</li>
					</ol>
					<figure>
						<div>
							<picture itemprop="image" itemscope="itemscope" itemtype="http://schema.org/ImageObject">
								<source type="image/avif" srcset="https://colincogle.name/blog/sshfp/ZoneProperties.avif"/>
								<source type="image/webp" srcset="https://colincogle.name/blog/sshfp/ZoneProperties.webp"/>
								<source type="image/wp2" srcset="https://colincogle.name/blog/sshfp/ZoneProperties.wp2"/>
								<source type="image/png" srcset="https://colincogle.name/blog/sshfp/ZoneProperties.png"/>
								<img src="https://colincogle.name/blog/sshfp/ZoneProperties.png" alt="Microsoft DNS Server's zone properties, showing the selections for the security drop-down:  Secure, Secure and Nonsecure, Disabled."/>
								<meta itemprop="accessMode" content="visual"/>
								<meta itemprop="caption" content="Microsoft DNS Server's zone properties, showing the selections for the security drop-down:  Secure, Secure and Nonsecure, Disabled."/>
								<meta itemprop="dateCreated" content="2022-09-08T07:24:09-04:00"/>
								<meta itemprop="description" content="Temporarily set your zone to &quot;Secure and Nonsecure&quot;, but don't forget to change it back."/>
								<meta itemprop="fileFormat" content="image/avif"/>
								<meta itemprop="fileFormat" content="image/wp2"/>
								<meta itemprop="fileFormat" content="image/webp"/>
								<meta itemprop="fileFormat" content="image/png"/>
								<meta itemprop="height" content="466"/>
								<meta itemprop="inLanguage" content="en-US"/>
								<meta itemprop="representativeOfPage" content="false"/>
								<meta itemprop="requiresSubscription" content="false"/>
								<meta itemprop="width" content="417"/>
							</picture>
							<code class="code powershell nocount">
								<span class="cmdlet">Set-DnsServerPrimaryZone</span>
								<span class="parameter">-Name</span>
								<span class="variable">$MyDomainName</span>
								<span class="parameter">-DynamicUpdate</span>
								<span class="string">'NonsecureAndSecure'</span>
							</code>
						</div>
						<figcaption>
							Temporarily set your zone update settings to "Secure and Nonsecure", but don't forget to change it back later.  You can point and click, or use PowerShell.
						</figcaption>
					</figure>
					<p>
						Now, don't linger, since we've left our zone open to exploit.
					</p>

					<h3><code>nsupdate</code>-ing</h3>
					<p>
						Now for the <i lang="fr">coup de grâce</i>.  You can copy and paste your file directly into <code>nsupdate.exe</code>.  Alternatively, if you've been following along with my PowerShell commands, you can simply do this:
					</p>
					<figure>
						<code class="code powershell nocount">
							<span class="variable">$NSUpdateCommand</span>
							<span class="operator">|</span>
							<span class="cmdlet">.\nsupdate.exe</span>
						</code>
						<figcaption>
							Send the last code block's work into <code>nsupdate.exe</code>.
						</figcaption>
					</figure>

					<p>
						Before you celebrate, we need to restore safety and sanity;  either skip back a section and undo your changes, or run this PowerShell command:
					</p>
					<figure>
						<code class="code powershell nocount">
							<span class="cmdlet">Set-DnsServerPrimaryZone</span>
							<span class="parameter">-Name</span>
							<span class="variable">$MyDomainName</span>
							<span class="parameter">-DynamicUpdate</span>
							<span class="string">'Secure'</span>
						</code>
						<figcaption>
							Please do not leave gaping security holes in your infrastructure.
						</figcaption>
					</figure>

					<h3>Verifying Your Work</h3>
					<p>
						Once this is done, you will see some unknown records listed in your list of DNS entries:
					</p>
					<figure itemprop="image" itemscope="itemscope" itemtype="http://schema.org/ImageObject">
						<picture>
							<source type="image/webp" srcset="https://colincogle.name/blog/sshfp/NewRecords.webp"/>
							<source type="image/wp2" srcset="https://colincogle.name/blog/sshfp/NewRecords.wp2"/>
							<source type="image/png" srcset="https://colincogle.name/blog/sshfp/NewRecords.png"/>
							<img src="https://colincogle.name/blog/sshfp/NewRecords.png" alt="Microsoft DNS Server's zone entries, showing the SSHFP         records.  They show up as an unknown type because the DNS Server service is an         afterthought to Microsoft.  Don't even get me started on TLSA."/>
						</picture>
						<figcaption itemprop="description">
							This is what you'll see in your DNS zone.  For this example, I had created a fictional <abbr title="domain controller">DC</abbr>, and these are the SSHFP records that I just assigned in the previous section.
						</figcaption>
						<meta itemprop="accessMode" content="visual"/>
						<meta itemprop="caption" content="SSHFP records in my fictional DNS zone."/>
						<meta itemprop="dateCreated" content="2022-09-08T07:04:30.095571-04:00"/>
						<meta itemprop="fileFormat" content="image/webp"/>
						<meta itemprop="fileFormat" content="image/wp2"/>
						<meta itemprop="fileFormat" content="image/png"/>
						<meta itemprop="height" content="173"/>
						<meta itemprop="inLanguage" content="en-US"/>
						<meta itemprop="representativeOfPage" content="false"/>
						<meta itemprop="requiresSubscription" content="false"/>
						<meta itemprop="width" content="549"/>
					</figure>

					<p>
						Unfortunately, because Microsoft's DNS Server service lags so far behind the curve, you will not be able to edit or properly view the record.  Just be happy we got this far.  You can, though, double-click on it and view the raw binary data, for what that's worth:
					</p>

					<figure itemprop="image" itemscope="itemscope" itemtype="http://schema.org/ImageObject" class="webfeedsFeaturedVisual">
						<picture class="webfeedsFeaturedVisual">
							<source type="image/avif" srcset="https://colincogle.name/blog/sshfp/SSHFPRecordProperties.avif"/>
							<source type="image/webp" srcset="https://colincogle.name/blog/sshfp/SSHFPRecordProperties.webp"/>
							<source type="image/wp2" srcset="https://colincogle.name/blog/sshfp/SSHFPRecordProperties.wp2"/>
							<source type="image/png" srcset="https://colincogle.name/blog/sshfp/SSHFPRecordProperties.png"/>
							<img src="https://colincogle.name/blog/sshfp/SSHFPRecordProperties.png" alt="Microsoft DNS Server showing an &quot;unknown&quot;         (SSHFP) record.  They show up uneditable because the DNS Server service is an afterthought         to Microsoft.  Don't even get me started on TLSA." class="webfeedsFeaturedVisual"/>
						</picture>
						<figcaption itemprop="description">
							This is what you'll see if you view the record properties (only available on Windows Server 2016 and newer).  There is nothing useful to see here, but it's better than the <em>literal nothing</em> you'd see in Server 2012 and older.
						</figcaption>
						<meta itemprop="accessMode" content="visual"/>
						<meta itemprop="caption" content="SSHFP records for my fictional server."/>
						<meta itemprop="dateCreated" content="2022-09-08T07:09:39.96849-04:00"/>
						<meta itemprop="fileFormat" content="image/avif"/>
						<meta itemprop="fileFormat" content="image/wp2"/>
						<meta itemprop="fileFormat" content="image/webp"/>
						<meta itemprop="fileFormat" content="image/png"/>
						<meta itemprop="height" content="466"/>
						<meta itemprop="inLanguage" content="en-US"/>
						<meta itemprop="representativeOfPage" content="true"/>
						<meta itemprop="requiresSubscription" content="false"/>
						<meta itemprop="width" content="417"/>
					</figure>

					<h3>Let's Try It</h3>
					<p>
						Now that your SSHFP DNS records are live (and hopefully secured), let's try connecting again.  If your records are present and correct, you will see output like this.
					</p>
					<figure>
						<samp class="code">
							<span>The authenticity of host 'www.someserver.net (2001:db8::49)' can't be established.</span><br/>
							<span>ED25519 key fingerprint is SHA256:1z0nm0KwN5cnOSA9HQ0VzjUR9VaPUd+/tB5FtTB1NdQ=.</span><br/>
							<span><strong>Matching host key fingerprint found in DNS.</strong></span><br/>
							<span>This key is not known by any other names</span><br/>
							<span>Are you sure you want to continue connecting (yes/no/[fingerprint])?</span>
						</samp>
						<figcaption>There we go!  Now the host key is verified.</figcaption>
					</figure>
					<p>
						It's a bit of a roundabout method, unfortunately.  It would be great if Microsoft's DNS Server gave us an easier way to add and modify SSHFP records (and <abbr title="DNS-based Authentication of Named Entities" aria-label="dane">DANE</abbr>/TLSA records, for that matter).  However, this will work, and this will help you secure your internal environment.
					</p>
					<p>
						Finally, bookmark this page.  This isn't a shameless plug, but a warning that, as you replace devices or regenerate SSH host keys, you will need to regenerate your SSHFP records.
					</p>
				</section>
			</div>
		</content>
	</entry>

	<entry>
		<title>A File Format to Aid in Security Vulnerability Disclosure</title>
		<id>urn:uuid:da37f49d-fe6b-46c5-9dd6-63d431dc80e0</id>
		<link rel="alternate" type="text/html" href="https://colincogle.name/blog/security-txt/" length="20914"/>
		<link rel="alternate" type="text/markdown" href="https://colincogle.name/blog/security-txt/security-txt.md" length="7264"/>
		<link rel="alternate" type="text/gemini" href="gemini://colincogle.name/blog/security-txt/" length="7368"/>
		<link rel="alternate" type="text/plain" href="https://colincogle.name/blog/security-txt/security-txt.txt" length="8061"/>
		<link rel="alternate" type="application/docbook+xml" href="https://colincogle.name/blog/security-txt/security-txt.xml" length="10426"/>
		<link rel="related" href="https://store.2600.com/collections/2020-2021"/>
		<summary>When security vulnerabilities are discovered by researchers, proper reporting channels are often lacking. As a result, vulnerabilities may be left unreported.</summary>
		<published>2021-06-19T00:00:00-04:00</published>
		<updated>2022-05-19T07:01:00-04:00</updated>
		<category term="technology"/>
		<category term="Hacking"/>
		<category term="Security research"/>
		<category term="2600" label="2600: The Hacker Quarterly"/>
		<category term="sysadmin" label="System administration"/>
		<content type="xhtml">
			<div xmlns="http://www.w3.org/1999/xhtml">
				<p>(This article was first published in the <time datetime="2021-06">Summer 2021</time> issue of <cite>2600:  The Hacker Quarterly</cite>. <a href="https://store.2600.com/collections/2020-2021">Please support the official release by buying a paper or PDF copy of the magazine.</a>)</p>
				<p>In an age where scoring bug bounties is some peoples' primary source of income, and responsible disclosure is the norm rather than the exception, it can be quite difficult to figure out where and how to report a security vulnerability. I ran into that problem with a vendor of mine.  I came across a problem involving unescaped input, and searched high and low for a way to securely report it. In the end, I opened a ticket with their help desk, where they had me just tell them the problem in a clear-text email.</p>
				<p>I'm not alone, either.  In fact, in <a href="https://store.2600.com/collections/2020-2021/products/new-issue-pdf-spring-2021">the Spring 2021 issue of <cite>2600: The Hacker Quarterly</cite></a>, fellow reader Keifer Chiang wrote about finding a bug in a municipal web portal, and the weeks-long ordeal of trying to get his report securely into the eyeballs of the right person.</p>
				<p>How many vulnerabilities have gone unreported, sold on the dark web, or simply <a href="https://www.forbes.com/sites/marcochiappetta/2018/08/29/depressed-security-researcher-drops-serious-0-day-windows-exploit-on-twitter/?sh=71359cc372b1">blurted out on Twitter</a>, only because getting in touch with the appropriate person was impossible?</p>
				<p>When a security issue needs to be reported, time is of the essence. There needs to be a quick, standard way to find the <em>right</em> contact information, their encryption keys, and the preferred way to file your report. Fortunately, <a href="https://datatracker.ietf.org/doc/rfc9116/">there is a standard, meekly called the <i>security.txt</i> file</a>.</p>
				<p><i>security.txt</i> is a plain, UTF-8 encoded text file that is designed to be both human- and machine-readable.  For ease of discovery, it lives in the well-known <code>.well-known</code> folder on the root of your Web server.</p>
				<p>In this article, let's assume we're looking at a <i>security.txt</i> file for the popular fictional company, Contoso:</p>
				<figure>
					<figcaption>Sample <i>security.txt</i> file for Contoso, Inc.</figcaption>
					<pre>----BEGIN PGP SIGNED MESSAGE----
Hash: SHA256

# This is the "security.txt" file for Contoso.com.
Canonical: https://contoso.com/.well-known/security.txt
Canonical: https://www.contoso.com/.well-known/security.txt
Canonical: https://webapp.contoso.com/.well-known/security.txt

# For security issues, please contact our security team.
# Email is preferred, but you may also call us or chat with us.
Contact: mailto:security@contoso.com
Contact: tel:+1-800-555-5555,123
Contact: MSTeams:/l/chat/0/0?users=alice@contoso.com,bob@contoso.com
Contact: https://contoso.com/contact-us#security-disclosures

# Our PGP key is available in a variety of places.
Encryption: https://contoso.com/pgp/securityteam.asc
Encryption: dns:5d2d3ceb7abe552344276d47d36a8175b7aeb250a9bf0bf00e850cd2._openpgpkey.contoso.com?type=OPENPGPKEY
Encryption: openpgp4fpr:1234567890ABCDEF1234567890ABCD

# We speak English, Spanish, and French.
Preferred-Languages: en, es, fr

# We welcome you to explore our site for bugs, but before you do, please
# read our disclosure agreement.
Policy: https://contoso.com/security-policy.html

# Thank you for your reports!  Why not join our security team?
Acknowledgments: https://contoso.com/humans.txt
Hiring: https://contoso.com/jobs#security

Expires: 2021-12-31T23:59:59Z

----BEGIN PGP SIGNATURE----

iQIzBAEBCAAdFiEE8QHuP28wHqb4E6Yt4H79M4zP+valid+signature+here=
----END PGP SIGNATURE----</pre>
</figure>

				<p>That's a lot to take in at once, so let's break it down. Aside from the comments, there are many fields you can use in a <i>security.txt</i> file. All fields can appear in any order, most fields are optional, and many of them can be repeated as many times as necessary. Most field values accept a URI, which can be of any scheme <em>except</em> non-secure HTTP.</p>
				<p>The first field is called <dfn>Canonical</dfn>. This should specify the URLs used to reach this <i>security.txt</i> file, to ensure that security researchers have found the correct file.</p>
				<p>Up next is <dfn>Contact</dfn>, and this one is mandatory. This is where you specify your points of contact, in <abbr title="Uniform Resource Indicator">URI</abbr> format, in order of preference. In this example, I've included an email address, a phone number, a link to start a Microsoft Teams chat with <a href="https://en.wikipedia.org/wiki/Alice_and_Bob">our old friends Alice and Bob</a>, as well as a webpage with contact information.  That should be enough for anyone.</p>
				<p>Next, we have the <dfn>Encryption</dfn> field, where you provide URIs to download or find an encryption key, usually an OpenPGP key or S/MIME certificate.  In this example, the contacts' PGP key can be downloaded from the web server or directly from a DNSSEC-signed DNS zone. The fingerprint is also provided, not only for reference, but in case the researcher wants to download it on their own.</p>
				<p><dfn>Preferred-Languages</dfn> is fairly obvious.  List all human languages that your contacts understand. This field can only appear once, so list them all in one line.</p>
				<p>You may want people to follow some ground rules when searching for or reporting bugs.  If you have a security policy, use the <dfn>Policy</dfn> field to link people to it.</p>
				<p>Of course, no standard would be complete without a few fun things. <dfn>Acknowledgments</dfn> links to a resource where this company will thank security researchers who have helped them out, and if you need to bolster your company's own red or blue teams, <dfn>Hiring</dfn> is a link to your security-related job postings.</p>
				<p>Finally, there is the required <dfn>Expires</dfn> field, to make sure that anyone who might be reading this file knows that they have fresh data.  The <i>security.txt</i> standard recommends that this timestamp be no more than one year in the future.</p>
				<p>Now that you have your <i>security.txt</i> file, it's recommended that you PGP-clearsign it, to prove to your reader that all of the data is authentic and correct. Once that's done, <a href="https://colincogle.name/.well-known/security.txt">upload it to your HTTPS-enabled web server</a>.  Now, you can sleep easier, knowing that if there <em>is</em> a problem, a security researcher will know how to reach you.</p>
				<p>Oh, and that vendor I mentioned at the top of the article?  They now have their own <i>security.txt</i> file.</p>
				<p>The <i>security.txt</i> standard exists as <a href="https://www.rfc-editor.org/info/rfc9116"><abbr title="Request for Comments">RFC</abbr> 9116</a>, developed by Edwin "EdOverflow" Foudil, Yakov Shafranovich, and the open-source community. To learn more, please visit <a href="https://securitytxt.org">securitytxt.org</a>.</p>
			</div>
		</content>
	</entry>

	<entry>
		<title>Hacking Haswell ThinkPads' Firmware</title>
		<id>urn:uuid:4187bb1e-d88c-4794-9734-7074c9d7bd08</id>
		<link rel="alternate" type="text/html" href="https://colincogle.name/blog/thinkpad-liberation/" length="32235"/>
		<link rel="alternate" type="text/gemini" href="gemini://colincogle.name/blog/thinkpad-liberation/" length="12066"/>
		<link rel="alternate" type="text/plain" href="https://colincogle.name/blog/thinkpad-liberation/thinkpad-liberation.txt" length="12671"/>
		<link rel="alternate" type="text/latex" href="https://colincogle.name/blog/thinkpad-liberation/thinkpad-liberation.tex" length="13665"/>
		<link rel="alternate" type="application/pdf" href="https://colincogle.name/blog/thinkpad-liberation/thinkpad-liberation.pdf" length="351429"/>
		<summary>A cheap Craigslist laptop gets its BIOS hacked and Intel Management Engine neutered.</summary>
		<published>2022-01-02T12:33:04-05:00</published>
		<updated>2022-02-15T22:15:31-05:00</updated>
		<category term="technology"/>
		<category term="hacking"/>
		<category term="open source"/>
		<category term="privacy"/>
		<content type="xhtml">
			<div xmlns="http://www.w3.org/1999/xhtml">
				<h2>A Brief History of Intel</h2>
				<p>The x86 <abbr title="Instruction Set Architecture">ISA</abbr> has been around since <time datetime="1978-06-08">the late 1970's</time>.  In the past fifty-plus years, this <abbr title="Complex Instruction Set Computer">CISC</abbr> architecture has only gotten more and more complicated.  It's gotten to the point where a separate computer needs to prepare the <em>real</em> computer to load an operating system.  Starting around 2006, Intel's chipsets (and later, processors) included a separate <q cite="https://en.wikipedia.org/wiki/Intel_Management_Engine">autonomous subsystem</q> known as the <a href="https://www.ptsecurity.com/ww-en/analytics/disabling-intel-me-11-via-undocumented-mode/">Intel Management Engine</a>.  This co-processor runs as long as the main computer is receiving power, even when the <em>actual</em> computer is turned off.  More troubling, the code is obfuscated, which means that security researchers are largely unable to examine it.</p>
				<p>Over the years, other features would be integrated into the Intel <abbr title="Management Engine">ME</abbr>: Intel Anti-Theft (now discontinued), Intel <abbr title="Active Management Technology">AMT</abbr>, Intel vPro, Intel Boot Guard, Protected Audio/Video Path, Serial-over-LAN, Intel Platform Trust Technology, and others  — still with the chip and its firmware largely invisible from independent security researchers.</p>
				<p>While there is a strong business case for many of these technologies  — save for <abbr title="Platform Trust Technology">PTT</abbr> being required to implement an <abbr title="firmware Trusted Platform Module">fTPM</abbr>  — the average home user will not need these, especially on this Lenovo ThinkPad T540p that I recently obtained;  it has a fourth-generation Intel Core processor, which is not compatible with Windows 11, so I don't need to worry about having a TPM.</p>
				
				<h2>The <abbr title="Federal Communications Commission">FCC</abbr> Is Also Involved</h2>
				<p>In the United States, manufacturers need to have their computers approved by the FCC if they contain any wireless radios (i.e., for Wi-Fi, Bluetooth, <abbr title="Near Field Communication">NFC</abbr>, or cellular data).  Each separate configuration needs to be certified.  To save them time and money, many BIOSes contain an allow-list of permitted Wi-Fi and <abbr title="Wireless Wide Area Network">WWAN</abbr> cards.</p>
				<p>That's understandable, but with Wi-Fi 6 and Wi-Fi 6E out, Wi-Fi 5  — particularly the pre-wave2 stuff  — is starting to get a little long in the tooth.  Plus, shouldn't we have the freedom to modify our hardware to suit our needs?</p>
				<figure>
					<picture>
						<source media="(min-width:954px)" type="image/avif" srcset="https://colincogle.name/blog/thinkpad-liberation/unauthorized@954w.avif 954w, https://colincogle.name/blog/thinkpad-liberation/unauthorized.avif 1904w"/>
						<source media="(min-width:954px)" type="image/jxl" srcset="https://colincogle.name/blog/thinkpad-liberation/unauthorized@954w.jxl  954w, https://colincogle.name/blog/thinkpad-liberation/unauthorized.jxl  1904w"/>
						<source media="(min-width:954px)" type="image/webp" srcset="https://colincogle.name/blog/thinkpad-liberation/unauthorized@954w.webp 954w, https://colincogle.name/blog/thinkpad-liberation/unauthorized.webp 1904w"/>
						<source media="(min-width:954px)" type="image/jpg" srcset="https://colincogle.name/blog/thinkpad-liberation/unauthorized@954w.jpg  954w, https://colincogle.name/blog/thinkpad-liberation/unauthorized.jpg  1904w"/>
						<source media="(max-width:953px)" type="image/avif" srcset="https://colincogle.name/blog/thinkpad-liberation/unauthorized-zoomed.avif"/>
						<source media="(max-width:953px)" type="image/webp" srcset="https://colincogle.name/blog/thinkpad-liberation/unauthorized-zoomed.webp"/>
						<source media="(max-width:953px)" type="image/jxl" srcset="https://colincogle.name/blog/thinkpad-liberation/unauthorized-zoomed.jxl"/>
						<source media="(max-width:953px)" type="image/jpg" srcset="https://colincogle.name/blog/thinkpad-liberation/unauthorized-zoomed.jpg"/>
						<img src="https://colincogle.name/blog/thinkpad-liberation/unauthorized.jpg" lowsrc="https://colincogle.name/blog/thinkpad-liberation/unauthorized@lowsrc.jpg" alt="A ThinkPad T440p with an unauthorized Wi-Fi card."/>
					</picture>
					<figcaption>
						If you install an unauthorized wireless card, the system will refuse to boot.<wbr/> (Photo credit: <a href="https://notthebe.ee/index.html">Wolfgang</a>)
					</figcaption>
				</figure>

				<h2>About Software Freedom</h2>
				<p>With all respect to Richard Stallman, the hardware and software you buy should respect <a href="https://www.gnu.org/philosophy/free-sw.html">the four essentials freedoms of software</a>: to run an app for any purpose, to study how an app works, to change it to make it do what you wish, and to redistribute and make copies to help others.</p>
				<p>Thus, let me show you how you can modify your "Intel Inside" laptop or desktop to run whatever code you want it to run, so that it behaves how you want it to behave.  (Since this is a firmware modification, it's far safer to show you how to modify yours, rather than give you a binary blob that might have unintended side effects.)</p>

				<h2>Preparation</h2>
				<p>You will need a ThinkPad based on the Intel Haswell platform, such as the T440p, T540p, W540, and W541.  I'm showing you a T540p.  For other models, you'll need to look at the motherboard and find your chips yourself.  Before we start, go ahead and download the latest Intel ME and Lenovo UEFI firmwares.  You won't be able to update these later without repeating all of these steps!</p>
				<p>The Lenovo flashing software will keep modified software far away from the chips.  Thus, you will need to purchase <a rel="nofollow" href="https://www.amazon.com/dp/B07WGXF12T">a chip programmer</a>. Order a CH341A-based programmer.</p>
				<p>While you wait for your new tool to arrive, expose your BIOS and ME chips.  I've heard that it's right under the memory access door on the T440p.  However, on my T540p, you'll need to completely remove the motherboard from the laptop.  Because I wound up with many leftover screws, I won't explain how to do that.  Instead, consult <a href="https://download.lenovo.com/ibmdl/pub/pc/pccbbs/mobiles_pdf/t540p_w540_w541_hmm_en_sp40a26003_03.pdf" title="Hardware Maintenance Manual: T540p, W540, and W541">Lenovo's Hardware Maintenance Manual</a> and follow their directions.  Fortunately, this and the reassembly are the toughest parts of this liberation (as is removing the keyboard without breaking any keycaps).</p>
				<p>Be sure to unplug the CMOS battery, too.  We need all power removed from the motherboard.</p>
				<p>When you get the motherboard free, you'll see two identically-shaped eight-pin chips over by the <abbr title="Subscriber Identity Module">SIM</abbr> card slot.  The one closest to the business end of the slot is a 64 <abbr title="megabit">Mb</abbr> Macronix 25L6473E chip that contains the Intel Management Engine, the Ethernet <abbr title="Preboot Execution Environment">PXE</abbr> option <abbr title="Read Only Memory">ROM</abbr>, and other related things.  The opposite chip is a 32 <abbr title="megabit">Mb</abbr> Macronix 25L3273E chip that contains the <abbr title="Unified Extensible Firmware Interface">UEFI</abbr> <abbr title="Basic Input/Output System">BIOS</abbr> partitions.</p>
				<figure itemscope="itemscope" itemtype="http://schema.org/ImageObject">
					<picture class="webfeedsFeaturedVisual">
						<source type="image/avif" srcset="https://colincogle.name/blog/thinkpad-liberation/flashprogrammer@257w.avif 257w, https://colincogle.name/blog/thinkpad-liberation/flashprogrammer@513w.avif 513w, https://colincogle.name/blog/thinkpad-liberation/flashprogrammer.avif 1026w"/>
						<source type="image/jxl" srcset="https://colincogle.name/blog/thinkpad-liberation/flashprogrammer@257w.jxl  257w, https://colincogle.name/blog/thinkpad-liberation/flashprogrammer@513w.jxl  513w, https://colincogle.name/blog/thinkpad-liberation/flashprogrammer.jxl  1026w"/>
						<source type="image/webp" srcset="https://colincogle.name/blog/thinkpad-liberation/flashprogrammer@257w.webp 257w, https://colincogle.name/blog/thinkpad-liberation/flashprogrammer@513w.webp 513w, https://colincogle.name/blog/thinkpad-liberation/flashprogrammer.webp 1026w"/>
						<source type="image/jpg" srcset="https://colincogle.name/blog/thinkpad-liberation/flashprogrammer@257w.jpg  257w, https://colincogle.name/blog/thinkpad-liberation/flashprogrammer@513w.jpg  513w, https://colincogle.name/blog/thinkpad-liberation/flashprogrammer.jpg  1026w"/>
						<img src="https://colincogle.name/blog/thinkpad-liberation/flashprogrammer.jpg" lowsrc="https://colincogle.name/blog/thinkpad-liberation/flashprogrammer@lowsrc.jpg" alt="A flash programmer hooked up to the BIOS chip of a Lenovo ThinkPad T540p." itemprop="image url contentUrl" class="webfeedsFeaturedVisual"/>
					</picture>
					<figcaption itemprop="caption description">
						There's more than one way to flash a BIOS.  Make sure your clip is attached properly and securely. Otherwise, you will probably turn your motherboard into a brick.
					</figcaption>
					<meta itemprop="accessMode" content="visual"/>
					<meta itemprop="author creator publisher rightsHolder" itemref="me"/>
					<meta itemprop="copyright" content="© 2021 Colin Cogle."/>
					<meta itemprop="dateCreated" content="2021-12-30T22:18:00-05:00"/>
					<meta itemprop="fileFormat" content="image/avif"/>
					<meta itemprop="fileFormat" content="image/jxl"/>
					<meta itemprop="fileFormat" content="image/webp"/>
					<meta itemprop="fileFormat" content="image/jpg"/>
					<meta itemprop="height" content="1026"/>
					<meta itemprop="representativeOfPage" content="true"/>
					<meta itemprop="requiresSubscription" content="false"/>
					<meta itemprop="width" content="1026"/>
				</figure>
				<p>You should also make sure the <code>flashrom</code> tool is installed, and you have a working copy of Python 3.  Your operating system's package manager can give you both of these.</p>
					
				<h2>Neutering the Intel Management Engine</h2>
				<p>The Intel ME cannot be removed entirely from any Intel Core platform, as it is required for initializing and booting the computer.  However, the three-lettered American intelligence agencies were not okay with a hidden operating system running on their computers, so Intel came up with a special operating mode for the ME.  As they stated <a href="https://www.zdnet.com/article/researchers-say-intels-management-engine-feature-can-be-switched-off/">in a press release</a>:</p>
				<blockquote cite="https://www.ptsecurity.com/ww-en/analytics/disabling-intel-me-11-via-undocumented-mode/">
					<p>In response to requests from customers with specialized requirements we sometimes explore the modification or disabling of certain features.  In this case, the modifications were made at the request of equipment manufacturers in support of their customer's evaluation of the <abbr title="United States">US</abbr> government's "High Assurance Platform" program.  These modifications underwent a limited validation cycle and are not an officially supported configuration.</p>
				</blockquote>
				<p>I will let you, dear reader, take their warning at face value.</p>
				<p>That being said, let's continue.  Here is what needs to happen with this chip:</p>
				<ol>
					<li>Read the Intel ME ROM.</li>
					<li>Run <code>me_cleaner</code> to remove unneeded modules and enable the High Assurance Platform mode.</li>
					<li>Write back the neutered ROM image.</li>
				</ol>
				<p>Let's get started.  Position your flash reader clip on the Intel ME chip (the one closest to the SIM card reader), connect your flash reader to your computer, then run <code>flashrom</code> to read the chip:</p>
				<figure>
					<code class="code bash">
						<span>
							<span class="app">flashrom</span>
							<span class="switch" aria-label="dash dash programmer">--programmer</span> ch341a_spi
							<span class="switch" aria-label="dash dash chip">--chip</span> "MX25L6436E/MX25L6445E/MX25L6465E/MX25L6473E/MX25L6473F"
							<span class="switch" aria-label="dash dash read">--read</span> upper.bin	
						</span>
					</code>
					<figcaption>Dump the Intel ME ROM.</figcaption>
				</figure>
				<p>(Tip: If you're not sure your programmer is attached firmly, read the chip a second time into <code>upper2.bin</code> and then <code>diff</code> the two files.  If the files differ, make sure your clip is firmly connected and try again.)</p>

				<p>Fortunately, we won't need to edit this file on our own.  Download a copy of <a href="https://github.com/corna/me_cleaner"><code>me_cleaner</code> from GitHub</a>.  This will set the ME into the High Assurance Platform/<span aria-label="Alt M E Disable">AltMeDisable</span> mode, so that once the bring-up phase is complete and the <abbr title="Power-On Self-Test">POST</abbr> begins, the ME will safely hang:</p>
				<figure>
					<code class="code bash">
						<span>
							<span class="app">git</span>
							<span class="switch">clone</span>
							<span class="string">https://github.com/corna/me_cleaner.git</span>
						</span><br/>
						<span>
							<span class="app">python</span>
							<span class="string">me_cleaner/me_cleaner.py</span>
							<span class="switch" aria-title="dash dash soft dash disable">--soft-disable</span>
							<span class="switch" aria-title="dash dash relocate">--relocate</span>
							<span class="switch" aria-title="dash dash truncate">--truncate</span>
							<span class="switch" aria-title="dash dash output dash file">--output-file</span> upper-cleaned.bin
							upper.bin
						</span>
					</code>
					<figcaption>
						Use <code>me_cleaner</code> to remove all but the bring-up and ROM code from the ME.  Using <code><span>--relocate</span> <span>--truncate</span></code> will free up space on the chip if you're feeling more adventurous than me.
					</figcaption>
				</figure>
				<p>That was easy, right?  Now, let's write back our cleaned image.  This step will take a while, so don't panic.  <code>flashrom</code> will be reading, writing, and verifying each block.</p>
				<figure>
					<code class="code bash">
						<span>
							<span class="app">flashrom</span>
							<span class="switch" aria-label="dash dash programmer">--programmer</span> ch341a_spi
							<span class="switch" aria-label="dash dash chip">--chip</span> "MX25L6436E/MX25L6445E/MX25L6465E/MX25L6473E/MX25L6473F"
							<span class="switch" aria-label="dash dash write">--write</span> upper-cleaned.bin
						</span>
					</code>
					<figcaption>
						<p>Write back the cleaned image to the Intel ME chip.</p>
						<p>I don't know about you, but I had to specify the <span><code class="bash switch">--chip</code></span> switch in order for it to recognize this particular ROM.</p>
					</figcaption>
				</figure>
				<p>Congratulations!  You can attach the screen, keyboard, and charging port to the motherboard and boot it up now, if you'd like to test.  When you go into the BIOS, you'll see that the listed "ME Version" is now blank.</p>
				<p>If that's all you wanted to do, you can stop reading and start re-assembling the laptop.</p>

				<hr/>

				<h2>Removing the <abbr title="PCI Express">PCIe</abbr> Allow-list and Unlocking More Firmware Options</h2>
				<p>While we have this thing open, we might as well upgrade it to Wi-Fi 6.  Hop on eBay and pick yourself up a newer <abbr title="Wireless Local Area Network">WLAN</abbr> card, such as the Intel AX200 (Wi-Fi 6) or AX201 (Wi-Fi 6E).  While those have their own proprietary firmwares, they are rock-solid under Linux.</p>
				<p>Before we begin this step, here is another reminder to download and install the latest firmware updates from Lenovo.  (For the T540p, BIOS version 2.39 is the latest.)</p>
				<p>Position your flash reader on the UEFI BIOS chip  — the one <em>furthest</em> from the
					SIM card slot  — then dump it:</p>
				<figure>
					<code class="code bash">
						<span>
							<span class="app">flashrom</span>
							<span class="switch" aria-label="dash dash programmer">--programmer</span> ch341a_spi
							<span class="switch" aria-label="dash dash chip">--chip</span> "MX25L3273E"
							<span class="switch" aria-label="dash dash read">--read</span> lower.bin	
						</span>
					</code>
					<figcaption>Read the UEFI BIOS chip.</figcaption>
				</figure>
				<p>Just like with the Intel ME, there are pre-made tools to unlock the BIOS.</p>
				<figure>
					<code class="code bash">
						<span class="comment"># Download and install UEFITool.</span><br/>
						<span class="comment"># It's in Ubuntu's repositories, but if that's not an option, grab it from</span><br/>
						<span class="comment"># GitHub; then, configure, build, and install it.  Make sure the UEFIPatch</span><br/>
						<span class="comment"># binary is in your PATH.</span><br/>
						<span>
							<span class="app">apt</span>
							<span class="switch">install</span>
							<span class="string">uefitool</span>
							<span class="operator">||</span>
							<span class="app">git</span>
							<span class="switch">clone</span>
							<span class="string">https://github.com/LongSoft/UEFITool.git</span>
						</span><br/>
						<span/><br/>

						<span class="comment"># Download and edit our firmware patches.</span><br/>
						<span>
							<span class="app">wget</span>
							<span class="string">https://raw.githubusercontent.com/digmorepaka/thinkpad-firmware-patches/master/xx40_xx50_patches_v7.txt</span>
						</span><br/>
						<span>
							<span class="variable">$EDITOR</span>
							<span class="string">xx40_xx50_patches_v7.txt</span>
						</span><br/>
					</code>
					<figcaption>Download the tools and information we need to patch the BIOS.</figcaption>
				</figure>
				<p>Read through the patch file.  Comment or uncomment any lines that apply or don't apply to your ThinkPad's make and model.  Save and exit when done, and we'll create a patched BIOS image.</p>
				<figure>
					<code class="code bash">
						<span class="comment"># Patch the BIOS image.</span><br/>
						<span>
							<span class="app">UEFIPatch</span>
							<span class="string">lower.bin</span>
							<span class="string">xx40_xx50_patches_v7.txt</span>
							<span class="switch"><span>-o</span> <span class="string">lower-patched.bin</span></span>
						</span>
					</code>
					<figcaption>Apply our changes!</figcaption>
				</figure>

				<p>While the ThinkPad will work if we flash this file back, it will beep like a madman. We need to sign the BIOS with an RSA key.  Fortunately, there is no <abbr title="Public Key Infrastructure">PKI</abbr> enforcement, so any key will do, even one that we generate on the fly.  Let's bring in another open-source tool:</p>
				<figure>
					<code class="code bash">
						<span class="comment"># Download and install this tool and its dependency.</span><br/>
						<span>
							<span class="app">git</span>
							<span class="switch">clone</span>
							<span class="string">https://github.com/thrimbor/thinkpad-uefi-sign.git</span>
						</span><br/>
						<span>
							<span class="app">pip3</span>
							<span class="switch">install</span>
							<span class="string">pycryptodome</span>
						</span><br/>
						<span/><br/>
						<span>
							<span class="app">python3 thinkpad-uefi-sign/sign.py</span>
							<span class="string">lower-patched.bin</span>
							<span class="switch">--output <span class="string">lower-patched-signed.bin</span></span>
						</span>
					</code>
					<figcaption>Download and run the tools needed to sign your new UEFI image.</figcaption>
				</figure>
				<p>That was almost too easy.  Let's write it back to the chip.  Again, this will take a while, so go do something else for a few minutes.</p>
				<figure>
					<code class="code bash">
						<span>
							<span class="app">flashrom</span>
							<span class="switch" aria-label="dash dash programmer">--programmer</span> ch341a_spi
							<span class="switch" aria-label="dash dash chip">--chip</span> "MX25L3273E"
							<span class="switch" aria-label="dash dash write">--write</span> lower-patched-signed.bin	
						</span>
					</code>
					<figcaption>Write the patched and signed UEFI ROM back to the BIOS chip.</figcaption>
				</figure>
				<p>Now, reassemble your laptop and start it up!  You'll get an error about the CMOS checksum being and the date/time being invalid.  That was because we disconnected the backup battery, not because we decided to rewrite the firmware.  If you go into the BIOS, you'll see a plethora of new settings under the new Advanced menu.</p>
				<p>Note that this Advanced menu takes the place of the Date/Time menu, so we'll have to boot our operating system and set the clock there.</p>

				<h2>In Conclusion</h2>
				<p>You've done it!  The spyware located inside the Intel Management Engine is now inoperable.  On top of this, you've modified your firmware to let you upgrade and tweak this laptop as much as you want. Hopefully this makes your older ThinkPad last even longer!</p>
				<p>Much credit goes to <a href="https://notthebe.ee/Removing-the-Wi-Fi-Whiteslit-on-Haswell-Thinkpads-T440p-W540-T540-etc.html">Wolfgang, for his excellent write-up about doing all this to a ThinkPad T440p</a>.  I'd also like to thank the developers of the various tools that we've used.</p>
			</div>
		</content>
	</entry>

	<entry>
		<title>PowerShell 7 for Programmers</title>
		<id>urn:uuid:cea89724-d279-494b-9265-0b6ed4d92459</id>
		<link rel="alternate" type="text/html" href="https://colincogle.name/blog/powershell-7/" length="40397"/>
		<link rel="alternate" type="text/gemini" href="gemini://colincogle.name/blog/powershell-7/" length="12032"/>
		<link rel="alternate" type="text/plain" href="https://colincogle.name/blog/powershell-7/powershell-7-for-programmers.txt" length="12204"/>
		<summary>A quick look at the new features in PowerShell 7 as they pertain to programmers.</summary>
		<published>2019-12-22T23:24:48-05:00</published>
		<updated>2021-11-16T09:24:15-05:00</updated>
		<category term="sysadmin" label="System administration"/>
		<category term="PowerShell"/>
		<category term="Windows"/>
		<category term="Apple" label="macOS"/>
		<category term="Linux"/>
		<category term="programming"/>
		<category term="technology"/>
		<content type="xhtml">
			<div xmlns="http://www.w3.org/1999/xhtml">
				<p>Microsoft's <a href="https://github.com/powershell">PowerShell Team</a> and countless members of the open-source community have worked hard on crafting and coding the seventh major version of PowerShell.  Its predecessor, PowerShell Core 6, was a massive rewrite of Windows PowerShell 5.1 that saw (most of) the codebase changed to run on the cross-platform <span aria-label="dot net">.NET</span> Core framework, which brought PowerShell to macOS and Linux for the first time, along with new features and performance enhancements.</p>
				<p><time datetime="2019-12-16T21:37:07Z">By December 2019</time>, work had all but completed on PowerShell 7, and <a href="https://github.com/PowerShell/PowerShell/releases/tag/v7.0.0">the final version is <time datetime="2020-03-04T17:00:08Z">now</time> available for download for supported Windows, macOS, and Linux systems</a>.  In addition to an optional long-term-servicing support model, Docker and NuGet inclusion, Desired State Configuration improvements, and good compatibility with modules that only claim to support Windows PowerShell, there are many improvements to the language and runtime that will benefit developers.</p>
				
				<h2><code class="powershell">pwsh</code> is now supported as a login shell</h2>
				<p>While this isn't a language change, it is great news for many developers who don't use Windows full-time or at all.  I tried to learn <a href="https://www.gnu.org/software/bash/">Bash</a> shell scripting, but I didn't get far and I was never very good at it.  Luckily for me, as of PowerShell 7.0.0-preview3, <code class="powershell">pwsh</code> is now fully supported <a href="https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_pwsh?view=powershell-7#-login---l">as a login shell</a> on macOS and Linux.</p>

				<h2 data-added-in="preview3">Parallel execution for for-each loops</h2>
				<p>Up until now, if you used the <a href="https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/foreach-object?view=powershell-7"><code class="powershell">ForEach-Object</code></a> cmdlet, it would operate on each item sequentially, one at a time.  New in PowerShell 7 is the <code class="powershell">-Parallel</code> switch and parameter set, which will operate on multiple items at once.  You can also use the <code class="powershell">-ThrottleLimit</code> parameter to tell PowerShell how many statement blocks should be run in parallel at any given time;  it defaults to five.</p>
				<p>While this will usually increase performance, using a parallel for-each loop means that your items will no longer be processed in order.  If order is important, use a normal for or for-each loop.</p>
				<p>Example:</p>
				<figure class="code powershell">
					<pre><span><span class="cmdlet">Get-ChildItem</span> | <span class="cmdlet">ForEach-Object</span> <span class="parameter">-ThrottleLimit <span class="number">4</span> -Parallel</span> {</span>
<span>    <span class="cmdlet">Write-Output</span> <span class="string">"Found the item <span class="operator">$(<span class="variable">$_</span><span class="operator">.</span><span class="variable">Name</span>)</span>."</span></span>
<span>}</span></pre>
				</figure>
					<p>However, there is no way for this to fail gracefully on earlier versions of PowerShell.  If you cannot guarantee your code will run on PowerShell 7, you'll have to wrap it in a try-catch block, or better yet, do an ugly version and edition check:</p>
				<figure class="code powershell"><pre>
<span>Function <span class="cmdlet">Out-Names</span> {</span>
<span>    Param(</span>
<span>        [<strong>PSObject[]</strong>] <span class="variable">$items</span></span>
<span>    )</span>
<span/>
<span>    <span class="variable">$code</span> = {<span class="cmdlet">Write-Output</span> <span class="string">"<span class="operator">$(<span class="variable">$_</span><span class="operator">.</span><span class="variable">Name</span>)</span>."</span>}</span>
<span/>
<span class="comment">    # Technically, this would fail on 7.0.0-preview1 and -preview2, but you</span>
<span class="comment">    # shouldn't concern yourselves with those obsolete beta versions.</span>
<span/>
<span>    If (<span class="variable">$PSVersionTable.PSVersion</span> <span class="operator">-ge</span> <span class="string">7.0.0</span>) {</span>
<span>        <span class="variable">$items</span> | <span class="cmdlet">ForEach-Object</span> <span class="parameter"><span>-Parallel</span> <span class="variable">$code</span></span> <span class="parameter"><span>-ThrottleLimit</span> <span class="number">4</span></span></span>
<span>    } Else {</span>
<span>        <span class="variable">$items</span> | <span class="cmdlet">ForEach-Object</span> <span class="parameter">-ScriptBlock <span class="variable">$code</span></span></span>
<span>    }</span>
<span>}</span></pre>
				</figure>
				<p>As far as I know, neither the <code class="powershell">.ForEach()</code> method nor the <code class="powershell">ForEach</code> statement/loop offer parallel execution.</p>
				<p><code>ForEach-Object -Parallel</code> is not enabled by default, nor will it be.  There are some times to use this, and some times to avoid it.  For more information and some use cases, I'll refer you to <a href="https://devblogs.microsoft.com/powershell/powershell-foreach-object-parallel-feature">Paul Higinbotham's blog post introducing it</a>.</p>
				<p>An earlier version of this article said that <code>ForEach-Object -Parallel</code> was only supported on Windows.  As of version 7.0.0-rc.2, it is indeed available on macOS and Linux.</p>

				<h2>Null coalescing operator</h2>
				<p>As someone who finds himself having to write a lot of checks for null values, this new operator is a major improvement, in my opinion.  If the variable before the operator is <code>$null</code>, the variable afterwards is returned; otherwise, the variable itself is returned.  Let's see it in action.</p>
				<figure>
					<table>
						<tr>
							<th scope="col">Before PowerShell 7</th>
							<th scope="col">In PowerShell 7</th>
						</tr>
						<tr>
							<td>
								<pre class="code powershell"><span>If (<span class="variable">$null</span> <span class="operator">-Eq</span> <span class="variable">$x</span>) {</span>
<span>    <span class="cmdlet">Write-Output</span> <span class="string">"nothing"</span></span>
<span>} Else {</span>
<span>    <span class="cmdlet">Write-Output</span> <span class="variable">$x</span></span>
<span>}</span></pre>
							</td>
							<td>
								<pre class="code powershell"><span><span class="cmdlet">Write-Output</span> (<span class="variable">$x</span> <span class="operator">??</span> <span class="string">"nothing"</span>)</span></pre>
							</td>
						</tr>
						<tr>
							<td>
								<pre class="code powershell">
<span><span class="variable">$name</span> <span class="operator">=</span> <span class="cmdlet">Read-Host</span> <span class="parameter">-Prompt <span class="string">"File name"</span></span></span>
<span><span class="variable">$file</span> <span class="operator">=</span> <span class="cmdlet">Get-Item</span> <span class="variable">$name</span></span>
<span>If (<span class="variable">$null</span> <span class="operator">-Eq</span> <span class="variable">$file</span>) {</span>
<span>    <span class="variable">$file</span> <span class="operator">=</span> <span class="cmdlet">Get-Item</span> <span class="string">"default.txt"</span></span>
<span>}</span></pre>
							</td>
							<td>
								<pre class="code powershell" title="Astute readers may note that this can be combined into one line.  I've left it as two lines for readability.">
<span><span class="variable">$name</span> <span class="operator">=</span> <span class="cmdlet">Read-Host</span> <span class="parameter">-Prompt <span class="string">"File name"</span></span></span>
<span><span class="variable">$file</span> <span class="operator">=</span> <span class="cmdlet">Get-Item</span> <span class="variable">$name</span> <span class="operator">??</span> <span class="cmdlet">Get-Item</span> <span class="string">"default.txt"</span></span></pre>
							</td>
						</tr>
					</table>
				</figure>
				
				<h2>Null assignment operator</h2>
				<p>Similar to the above, the new null assignment operator will assign a value to a variable if and only if it is equal to <code>$null</code>.</p>
				<figure>
					<pre class="code powershell"><span>PS /Users/colin&gt; <span class="variable">$input</span> <span class="operator">??=</span> <span class="string">"sane value"</span></span>
<span>PS /Users/colin&gt; <span class="variable">$input</span></span>
<span><output>sane value</output></span></pre>
				</figure>
				<br/>
				<figure>
					<table>
						<tr>
							<th scope="col">Before PowerShell 7</th>
							<th scope="col">In PowerShell 7</th>
						</tr>
						<tr>
							<td>
								<pre class="code powershell"><span><span class="variable">$name</span> <span class="operator">=</span> <span class="cmdlet">Read-Host</span> <span class="parameter">-Prompt <span class="string">"Enter a file name"</span></span></span>
<span>If (<span class="variable">$null</span> <span class="operator">-Eq</span> <span class="variable">$name</span>) {</span>
<span>    <span class="variable">$name</span> <span class="operator">=</span> <span class="string">"default.txt"</span></span>
<span>}</span>
<span><span class="cmdlet">Get-Item</span> <span class="variable">$name</span></span></pre>
							</td>
							<td>
								<pre class="code powershell"><span><span class="variable">$name</span> <span class="operator">=</span> <span class="cmdlet">Read-Host</span> <span class="parameter">-Prompt <span class="string">"Enter a file name"</span></span></span>
<span><span class="variable">$name</span> <span class="operator">??=</span> <span class="string">"default.txt"</span></span>
<span><span class="cmdlet">Get-Item</span> <span class="variable">$name</span></span></pre>
							</td>
						</tr>
					</table>
				</figure>
				
				<h2>Null conditional member property and method access (PowerShell 7.1)</h2>
				<p>In previous versions of PowerShell, you would have to check if a variable is <code>$null</code> before attempting to access its members, or wrap your code in try-catch blocks; if you failed to do so, your script might terminate unexpectedly when <code class="code powershell"><span class="parameter">-ErrorAction <span class="string">Stop</span></span></code> is set.  Now, put a question mark after your variable to silently continue and return <code>$null</code> if something does not exist.</p>
				<p>Unfortunately, because PowerShell allows question marks in variable names, using this operator means that you do have to include the optional braces around your variable name, so PowerShell knows where your variable name begins and ends.</p>
				<figure>
					<h3>Before PowerShell 7.1</h3>
					<pre class="code powershell"><span>If (<span class="variable">$null</span> <span class="operator">-ne</span> <span class="variable">$x</span>) {</span>
<span>    If (<span class="variable">$x</span> | <span class="cmdlet">Get-Member</span> | <span class="cmdlet">Where-Object</span> {<span class="variable">$_</span><span class="operator">.</span><span class="variable">Name</span> <span class="operator">-eq</span> <span class="string">"Prop"</span>}) {</span>
<span>        If (<span class="variable">$x</span><span class="operator">.</span><span class="variable">Prop</span> | <span class="cmdlet">Get-Member</span> | <span class="cmdlet">Where-Object</span> {<span class="variable">$_</span><span class="operator">.</span><span class="variable">Name</span> <span class="operator">-eq</span> <span class="string">"Method"</span>}) {</span>
<span>            <span class="variable">$x</span><span class="operator">.</span><span class="variable">Prop</span><span class="operator">.</span><span class="variable">Method()</span></span>
<span>        }</span>
<span>    }</span>
<span>}</span></pre>
					<h3>In PowerShell 7.1</h3>
					<pre class="code powershell"><span><span class="variable">${x}</span><span class="operator">?.</span><span class="variable">{Prop}</span><span class="operator">?.</span><span class="variable">Method()</span></span></pre>
				</figure>
				<hr width="50%"/>
				<figure>
					<h3>Before PowerShell 7.1</h3>
					<pre class="code powershell"><span><span class="variable">$filesInFolder</span> <span class="operator">=</span> <span class="cmdlet">Get-ChildItem</span></span>
<span><span class="cmdlet">Write-Output</span> <span class="string">"The third file in this folder is:"</span></span>
<span>If (<span class="variable">$filesInFolder</span><span class="operator">.</span>Count <span class="operator">-ge</span> <span class="number">3</span>) {</span>
<span>    <span class="variable">$filesInFolder</span><span class="operator">[2].</span>FullName</span>
<span>}</span></pre>
					<h3>In PowerShell 7.1</h3>
					<pre class="code powershell"><span><span class="cmdlet">Write-Output</span> <span class="string">"The third file in this folder is:"</span></span>
<span><span class="variable">${filesInFolder[2]}</span><span class="operator">?.</span>FullName</span></pre>
				</figure>
				
				<h2>Pipeline chaining operators</h2>
				<p>PowerShell 7 implements the pipeline chaining operators made famous by Bash.  Previously, to run a command based on if the previous operation succeeded or failed, you would have to check the return code or the automatic variable <code class="powershell variable">$?</code>.  Now, you can use <code class="powershell operator">&amp;&amp;</code> to run a second command if and only if the first one succeeds, and use <code class="powershell operator">||</code> to run a second command if and only if the first one fails.  For example:</p>
				<figure>
					<pre class="code powershell"><span><span class="cmdlet">Invoke-Thing1</span> <span class="operator">&amp;&amp;</span> <span class="cmdlet">Write-Output</span> <span class="string">"Thing1 worked!"</span></span>
<span><span class="cmdlet">Invoke-Thing2</span> <span class="operator">||</span> <span class="cmdlet">Write-Error</span>  <span class="string">"Thing2 didn't work."</span></span></pre>
				</figure>
				<p>No, you can't use <code class="powershell operator">&amp;&amp;</code> and <code class="powershell operator">||</code> together to emulate an if-else statement.  However, PowerShell 7 adds some popular shorthand:</p>
				
				<h2>Ternary operator</h2>
				<p>Many programming languages have what's called the ternary operator (sometimes called the conditional operator), which is just a shorter method of writing an if-else statement.  While I believe it can lead people to write messy code, sometimes it's much cleaner-looking and easier for a human to read.</p>
				<figure>
					<table>
						<tr>
							<th scope="col">Before PowerShell 7</th>
							<th scope="col">In PowerShell 7</th>
						</tr>
						<tr>
							<td>
								<pre class="code powershell"><span>If (<span class="variable">$flag</span> <span class="operator">-Eq</span> <span class="variable">$true</span>) {</span>
<span>    <span class="cmdlet">Write-Output</span> <span class="string">"Yes"</span></span>
<span>} Else {</span>
<span>    <span class="cmdlet">Write-Output</span> <span class="string">"No"</span></span>
<span>}</span></pre>
							</td>
							<td>
								<pre class="code powershell"><span><span class="cmdlet">Write-Output</span> (<span class="variable">$flag</span> <span class="operator">?</span> <span class="string">"Yes"</span> <span class="operator">:</span> <span class="string">"No"</span>)</span></pre>
							</td>
						</tr>
						<tr>
							<td>
								<pre class="code powershell"><span>If (<span class="variable">$user</span><span class="operator">.</span><span class="cmdlet">isMember()</span>) {</span>
<span>    <span class="variable">$price</span> <span class="operator">+=</span> <span class="number">2</span></span>
<span>}</span>
<span>Else {</span>
<span>    <span class="variable">$price</span> <span class="operator">+=</span> <span class="number">5</span></span>
<span>}</span></pre>
							</td>
							<td>
								<pre class="code powershell"><span><span class="variable">$price</span> <span class="operator">+=</span> <span class="variable">$user</span><span class="operator">.</span><span class="cmdlet">isMember()</span> <span class="operator">?</span> <span class="number">2</span> <span class="operator">:</span> <span class="number">5</span></span></pre>
							</td>
						</tr>
						<tr>
							<td>
								<pre class="code powershell"><span><span class="variable">$x</span> <span class="operator">=</span> <span class="variable">$items</span><span class="operator">.</span><span class="cmdlet">Count</span></span>
<span>If (<span class="variable">$x</span> <span class="operator">-Eq</span> <span class="number">1</span>) {</span>
<span>    <span class="variable">$msg</span> <span class="operator">=</span> <span class="string">"Found <span class="variable">$x</span> item."</span></span>
<span>} Else {</span>
<span>    <span class="variable">$msg</span> <span class="operator">=</span> <span class="string">"Found <span class="variable">$x</span> items."</span></span>
<span>}</span></pre>
							</td>
							<td>
								<pre class="code powershell"><span><span class="variable">$x</span>   <span class="operator">=</span> $items<span class="operator">.</span>Count</span>
<span><span class="variable">$msg</span> <span class="operator">=</span> <span class="string">"Found <span class="variable">$x</span> item<span class="operator">$(<span class="variable">$x</span> <span class="operator">-Eq</span> <span class="number">1</span> <span class="operator">?</span> <span class="string">'s'</span> <span class="operator">:</span> <span class="string">''</span>)</span>."</span></span></pre>
							</td>
						</tr>
					</table>
				</figure>
				
				
				<h2>Reverse operation for the <code class="powershell">-Split</code> operator</h2>
				<p>When you provide a matching limit to the <code class="powershell">-Split</code> operator, it normally works left-to-right.  Now, it can operate right-to-left instead.</p>
				<figure>
					<pre class="code powershell"><span>PS /Users/colin&gt; <span class="string">"split1 split2 split3 split4"</span> <span class="operator">-Split</span> <span class="string">" "</span>,<span class="number">3</span></span>
<output><span>split1</span>
<span>split2</span>
<span>split3 split4</span></output>

<span>PS /Users/colin&gt; <span class="string">"split1 split2 split3 split4"</span> <span class="operator">-Split</span> <span class="string">" "</span>,<span class="number">-3</span></span>
<output><span>split1 split2</span>
<span>split3</span>
<span>split4</span></output></pre>
				</figure>
				
				
				<h2>Skip error handling for web cmdlets</h2>
				<p>PowerShell does a pretty decent job of handling errors for you, but sometimes, you might want to do it yourself.  The <a href="https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.utility/invoke-webrequest?view=powershell-7"><code class="code powershell cmdlet">Invoke-WebRequest</code></a> and <a href="https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.utility/invoke-restmethod?view=powershell-7"><code class="code powershell cmdlet">Invoke-RestMethod</code></a> cmdlets now support a new switch, <code class="code powershell parameter">-SkipHttpErrorCheck</code>.</p>
				<p>Before this, the raw HTML code of the request would be returned, and you would have to parse the error object yourself.  Use this switch, and those two cmdlets will return a "success" even when an HTTP error occurred.  You, as the programmer, can now handle errors yourself without cumbersome try-catch blocks, by reading the response yourself.</p>
				<p><code class="code powershell cmdlet">Invoke-RestMethod</code> also includes a new parameter, <code>-StatusCodeVariable</code>, to which you pass the <em>name</em> of a variable (confusingly, a string with the variable name, not the variable itself) that will contain the HTTP response code.</p>
				<figure>
					<pre class="code powershell"><span><span class="cmdlet">Invoke-RestMethod</span><wbr/> <span class="parameter">-Uri <span class="string">"https://example.com/pagenotfound"</span></span> `<wbr/>
	-SkipHttpErrorCheck<wbr/> -StatusCodeVariable <span class="string">scv</span></span>
<span/>
<span>If (<span class="variable">$scv</span> <span class="operator">-ne</span> <span class="number">200</span>) {</span>
<span>    <span class="comment"># error handling goes here</span></span>
<span>} Else {</span>
<span>    <span class="comment"># your code continues here</span></span>
<span>}</span></pre>
				</figure>
								
				
				<h2>New <code class="powershell">$ErrorActionPreference</code>, <code>Break</code></h2>
				<p>If you change your <code class="powershell">$ErrorActionPreference</code> <a href="https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_preference_variables?view=powershell-7">preference variable</a> to the new value <code class="powershell string">"Break"</code>, you can then drop into a debugger as soon as an error happens.  For example, let's try dividing by zero.</p>
				<figure>
					<pre class="code powershell"><span>PS /Users/colin&gt; <span class="variable">$ErrorActionPreference</span> <span class="operator">=</span> <span class="string">"Stop"</span></span>
<span>PS /Users/colin&gt; <span class="number">1/0</span></span>
<output class="error">ParentContainsErrorRecordException: Attempted to divide by zero.</output>
</pre>

<pre class="code powershell"><span>PS /Users/colin&gt; <span class="variable">$ErrorActionPreference</span> <span class="operator">=</span> <span class="string">"Break"</span></span>
<span>PS /Users/colin&gt; <span class="number">1/0</span></span>
<output class="warning">Entering debug mode. Use h or ? for help. 

At line:1 char:1
+ 1/0
+ ~~~</output>
<span>[DBG]: PS /Users/colin&gt;&gt;</span></pre>
				</figure>
				<p>Neat!</p>
				
				
				<h2><code class="powershell">Get-Clipboard</code> and <code class="powershell">Set-Clipboard</code> are back</h2>
				<p>After a hiatus in PowerShell Core 6, the two cmdlets, <a href="https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.management/get-clipboard?view=powershell-7"><code class="code powershell cmdlet">Get-Clipboard</code></a> and <a href="https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.management/set-clipboard?view=powershell-7"><code class="code powershell cmdlet">Set-Clipboard</code></a>, return.  Though they can only manipulate plain text at this time, unlike their Windows PowerShell implementations, they are available for use on all platforms.</p>
				<p>Linux users must make sure <a href="https://github.com/astrand/xclip"><code>xclip</code></a> is installed.</p>

				
				<h2>Miscellaneous</h2>
				<p>There are many more little features you might find useful.</p>
				<ul>
					<li>After taking some time off during PowerShell Core 6, the following Windows PowerShell things return—for Windows users only:<ul>
						<li><code class="powershell cmdlet">Clear-RecycleBin</code></li>
						<li><code class="powershell cmdlet">Get-Help</code>'s <code class="powershell parameter">-ShowWindow</code> parameter</li>
						<li><code class="powershell cmdlet">Out-GridView</code></li>
						<li><code class="powershell cmdlet">Out-Printer</code></li>
						<li><code class="powershell cmdlet">Show-Command</code></li></ul></li>
					<li>Enumerating files in OneDrive works, and when using files on demand, doing so won't trigger an automatic download.</li>
					<li><code class="powershell cmdlet">Format-Hex</code> better handles custom types.</li>
					<li><code class="powershell cmdlet">Get-ChildItem</code>, when used on macOS or Linux, now returns the properties <code>UnixMode</code>, <code>User</code>, and <code>Group</code>.</li>
					<li><a href="https://github.com/dotnet/platform-compat/blob/master/docs/DE0005.md"><code class="powershell cmdlet">Send-MailMessage</code> is now deprecated.</a>  Unfortunately, there is no secure fix or replacement available.</li>
					<li><code class="powershell cmdlet">Test-Connection</code> never really went away, but it now behaves identically on Windows, macOS, and Linux.</li>
				</ul>
				<p>There are also many improvements to Desired State Configuration.  There is also a compatibility layer for loading modules not marked as compatible with Core editions; however, if you're a module developer, you should have already set <code>CompatiblePSEditions</code> appropriately!</p>
				<p>The final release of PowerShell 7 was released on <time datetime="2020-03-04T17:00:08Z" title="finally">March 4, 2020</time>, so download it, get coding, and happy developing!</p>
			</div>
		</content>
	</entry>

	<entry>
		<title>Replacing OpenDKIM with dkimpy-milter</title>
		<id>urn:uuid:852b87fd-e457-48d9-a663-7a25dd602371</id>
		<link rel="alternate" type="text/html" href="https://colincogle.name/blog/replacing-opendkim/" length="27139"/>
		<link rel="alternate" type="text/gemini" href="gemini://colincogle.name/blog/replacing-opendkim/" length="10178"/>
		<link rel="alternate" type="text/plain" href="https://colincogle.name/blog/replacing-opendkim/replacing_opendkim_with_dkimpy-milter.txt" length="10178"/>
		<summary>OpenDKIM might be the gold standard, but the DKIM standard is evolving without it, so it's time to retire it.</summary>
		<published>2019-08-29T00:55:09-04:00</published>
		<updated>2019-09-02T22:20:53-04:00</updated>
		<category term="sysadmin" label="System administration"/>
		<category term="Linux"/>
		<category term="open source"/>
		<category term="tutorials"/>
		<content type="xhtml">
			<div xmlns="http://www.w3.org/1999/xhtml">
				<figure itemscope="itemscope" itemtype="http://schema.org/ImageObject">
					<picture class="webfeedsFeaturedVisual">
						<source type="image/avif" srcset="https://colincogle.name/blog/replacing-opendkim/dkim@1x.avif 431w, https://colincogle.name/blog/replacing-opendkim/dkim@2x.avif 862w"/>
						<source type="image/webp" srcset="https://colincogle.name/blog/replacing-opendkim/dkim@1x.webp 431w, https://colincogle.name/blog/replacing-opendkim/dkim@2x.webp 862w"/>
						<source type="image/png" srcset="https://colincogle.name/blog/replacing-opendkim/dkim@1x.png 431w, https://colincogle.name/blog/replacing-opendkim/dkim@2x.png 862w"/>
						<img src="https://colincogle.name/blog/replacing-opendkim/dkim@2x.png" alt="DKIM is kind of a wax seal to email's envelope." itemprop="image url contentUrl" class="webfeedsFeaturedVisual"/>
					</picture>
					<figcaption itemprop="caption description">
						If you think of email as a letter in an envelope, DKIM would be the wax seal.
						<small>(Image credit: <cite title="Love their DMARC reports!"><a href="https://postmarkapp.com/guides/dkim">Postmark</a></cite>)</small>
					</figcaption>
					<meta itemprop="accessMode" content="visual"/>
					<meta itemprop="dateCreated" content="2016-04-21T21:05:28-04:00"/>
					<meta itemprop="fileFormat" content="image/webp"/>
					<meta itemprop="fileFormat" content="image/png"/>
					<meta itemprop="height" content="438"/>
					<meta itemprop="inLanguage" content="en-US"/>
					<meta itemprop="representativeOfPage" content="true"/>
					<meta itemprop="requiresSubscription" content="false"/>
					<link itemprop="sameAs" href="https://public-assets.postmarkapp.com/guides/dkim@2x.png"/>
					<meta itemprop="width" content="862"/>
				</figure>

				<h2>The History of DKIM</h2>
				<p>For almost a decade, <a href="https://en.wikipedia.org/wiki/DomainKeys_Identified_Mail"><abbr title="DomainKeys Identified Mail">DKIM</abbr></a> has been one of the most important anti-spam and anti-spoofing technologies available.  In that little window between someone sending an email and it going out to the Internet, a domain's email server sticks a little hidden signature in each message that says that the sender address is real and the message hasn't been modified.  Receiving email servers can verify the signature to prove this.</p>

				<p>However, DKIM's age was becoming apparent.  Its predecessor,<a href="https://en.wikipedia.org/wiki/DomainKeys">DomainKeys</a>, which dated back as far as <time datetime="2004-05-19">2004</time>, allowed RSA keys as small as 512 bits, and signatures with SHA-1.  Naturally, for compatibility reasons, both of these glaring weaknesses made it into <a href="https://tools.ietf.org/html/rfc6376.html" title="RFC 6376: DomainKeys Identified Mail (DKIM) Signatures">the final DKIM specification</a> in <time datetime="2011-09">2011</time> (though using either was discouraged).  1024-bit RSA keys were already considered weak at the time, but some people who tried to use 2048-bit (or larger) RSA keys found out that the resulting <span aria-label="text">TXT</span> record was too big for their registrar's DNS zone editor.</p>

				<h2>All of That Sucks. How Do We Fix It?</h2>
				<p>In <time datetime="2017-03-31">2017</time>, the <abbr title="Internet Engineering Task Force">IETF</abbr> created a working group to modernize DKIM, and they did (<a href="https://tools.ietf.org/html/rfc8301.html" title="Cryptographic Algorithm and Key Usage Update to DomainKeys Identified Mail (DKIM)">RFC 8301</a>): 512-bit RSA keys were <em>finally</em> banned, and likewise, SHA-1 signatures were declared <q cite="https://tools.ietf.org/html/rfc8301.html#section-5">historic</q> and <q cite="https://tools.ietf.org/html/rfc8301.html#section-3.1">MUST NOT be used for signing or verifying.</q> 4096-bit RSA keys were also permitted, but if you're one of the unlucky ones who can't fit a 2048-bit key into your DNS zone, this doesn't help you at all.</p>

				<p>More importantly, a new key type was added to DKIM in <a href="https://tools.ietf.org/html/rfc8463.html" title="A New Cryptographic Signature Method for DomainKeys Identified Mail (DKIM)">RFC 8463</a>, Curve25519.  The main advantage is that elliptic curve algorithms like this can provide the same or better security as RSA, while using shorter keys; for example, a 256-bit <abbr title="Elliptic Curve">EC</abbr> key is as strong as a 3072-bit RSA key, so everything is faster and uses less power.</p>

				<p>To support the old while phasing in the new, emails will be dual-signed with RSA and Ed25519, until RSA eventually falls out of style.  Verifiers only need to verify one signature, so old ones will check the RSA one, and newer verifiers will check the Ed25519 one.</p>

				<h2>And that Brings Us to OpenDKIM</h2>
				<p>Since 2010, <a href="http://www.opendkim.org/">the OpenDKIM app</a> has been one of the most popular DKIM signers and verifiers in the Linux world.  However, it's laid dormant since <time datetime="2015-05-12T18:55:00Z">2015</time>, with bug reports and feature requests being largely ignored.  I decided it was time to make the switch to a new app that is being actively developed, <a href="https://launchpad.net/dkimpy-milter" title="Official home page, I think."><code>dkimpy-milter</code></a>.</p>

				<h2>Installing <code>dkimpy-milter</code></h2>
				<p>Due to a bug in the <code>pip</code> version of this, I recommend building directly from source. Clone the Git repository to your server:</p>
				<figure>
					<figcaption>Install <code>dkimpy-milter</code> from source.</figcaption>
					<code class="code bash">
						<span class="app">git</span>
						<span class="switch">clone</span>
						<span><span class="switch">-b</span> <span class="string">master</span></span>
						<span class="string">https://git.launchpad.net/dkimpy-milter</span><br/>
						
						<span class="keyword">cd</span>
						<span class="path">dkimpy-milter</span><br/>
						
						<span class="app">python3</span>
						<span class="path">setup.py</span>
						<span class="switch">install</span>
						<span class="switch">--single-version-externally-managed</span>
						<span><span class="switch">--record</span><span class="operator">=</span><span class="path">/dev/null</span></span>
					</code>
				</figure> 

				<p>It installed under <code class="bash">/usr/local</code>, but that's fine.  Then, I used the code from their README to create a user account for it.</p>
				<figure>
					<figcaption>Create a user account for this app.</figcaption>
					<code class="code bash">
						<span class="app">sudo<wbr/> adduser</span>
						<span class="switch">--system</span>
						<span class="switch">--no-create-home</span>
						<span class="switch">--quiet</span>
						<span class="switch">--disabled-password</span>
						<span class="switch">--disabled-login</span>
						<span class="switch">--shell</span> <span class="string">/bin/false</span>
						<span class="switch">--group</span>
						<span class="switch">--home</span> <span class="string">/run/dkimpy-milter</span>
						<span class="string">dkimpy-milter</span>
					</code>
				</figure>
				<p>And now, set it to start up with your server.</p>
				<figure>
					<code class="code bash">
						<span>
							<span class="app">sudo<wbr/> systemctl</span><wbr/>
							<span class="switch">daemon-reload</span><wbr/>
						</span><br/>
						<span>
							<span class="app">sudo<wbr/> systemctl</span><wbr/>
							<span class="switch">enable</span><wbr/>
							<span class="string">dkimpy-milter</span><wbr/>
						</span><br/>
						<span>
							<span class="app">sudo<wbr/> systemctl</span><wbr/>
							<span class="switch">start</span><wbr/>
							<span class="string">dkimpy-milter</span><wbr/>
						</span><br/>
						<span>
							<span class="app">sudo<wbr/> systemctl</span><wbr/>
							<span class="switch">status</span><wbr/>
							<span class="string">dkimpy-milter</span><wbr/>
						</span>
					</code>
					<figcaption>
						(If you don't like <code>systemd</code>, I believe <code>dkimpy-milter</code> includes a classic SysV init script.)
					</figcaption>
				</figure>
				<p>Stop, check for errors, and continue.</p>

				<h2>Configuring <code>dkimpy-milter</code></h2>
				<p>I was reading that <code>dkimpy-milter</code> was developed to be a drop-in replacement for OpenDKIM.  So, I copied <code>opendkim.conf</code> over <code>dkimpy-milter.conf</code> and tried to start the service.  I was greeted with plenty of warnings about unknown or unsupported options.  Well, it looks like <code>dkimpy-milter</code> is still a work in progress on that front.  I removed all of the "offending" lines.</p>

				<p>I also adjusted permissions inside Postfix's <span aria-label="change-root">chroot</span> to make sure <code>dkimpy-milter</code> could put its socket there.</p>

				<h2>Importing your old keys?</h2>
				<p>The creators of <code>dkimpy-milter</code> stuck to OpenDKIM syntax.  Instead of overloading options like <code>KeyTable</code> and <code>SelectorTable</code>, there are new ones like <code>KeyTableEd25519</code> and <code>SelectorTableEd25519</code> that behave identically. I have multiple domains with multiple selectors, so I went ahead and created new tables, started <code>dkimpy-milter</code>, and…<br/><br/>…I got an error saying none of those were valid options.</p>

				<p>It turns out that OpenDKIM-style tables will be supported in the next version.  So, for now, it's back to the drawing board.</p>

				<h2>Generating new keys</h2>
				<p>I decided to create two keys for all of my domains to share, one RSA key and one Ed25519 key.  Go to whatever directory you keep your keys in, and create and secure some new keys:</p>
				<figure>
					<figcaption>Cut some DKIM keys.</figcaption>
					<code class="code bash">
						<span>
							<span class="app">dknewkey</span><wbr/>
							<span class="switch">-k</span> <span class="keyword">rsa</span><wbr/>
							<span class="string">boring-old-selector</span>
						</span><br/>
						<span>
							<span class="app">dknewkey</span><wbr/>
							<span class="switch">-k</span> <span class="keyword">ed25519</span><wbr/>
							<span class="string">cool-new-selector</span>
						</span><br/>
						<span>
							<span class="app">chown</span><wbr/>
							<span class="string">dkimpy-milter</span><span class="operator">:</span><span class="string">dkimpy-milter</span><wbr/>
							<span class="string">boring-old-selector.key</span>
						</span><br/>
						<span>
							<span class="app">chown</span><wbr/>
							<span class="string">dkimpy-milter</span><span class="operator">:</span><span class="string">dkimpy-milter</span><wbr/>
							<span class="string">cool-new-selector.key</span>
						</span><br/>
						<span>
							<span class="app">chmod</span><wbr/>
							<span class="number">440</span><wbr/>
							<span class="string">boring-old-selector.key</span>
						</span><br/>
						<span>
							<span class="app">chmod</span><wbr/>
							<span class="number">440</span><wbr/>
							<span class="string">cool-new-selector.key</span>
						</span><br/>
					</code>
				</figure>
				<p>You'll get two files, a <code aria-label="dot DNS">.dns</code> file with your DKIM DNS record—go deploy those now (preferably with DNSSEC)—and a <code aria-label="dot KEY">.key</code> file that contains your secret, that should only be readable by <code>dkimpy-milter</code>.</p>

				<h2><code>dkimpy-milter.conf</code> Configuration</h2>
				<p>Make your configuration file look something like mine.</p>
				<figure>
					<figcaption>Relevant content of <code>/usr/local/etc/dkimpy-milter.conf</code>:</figcaption>
					<pre class="code bash"><span class="comment"># List all of your domains.</span>
<span>Domain          colincogle.name, myotherdomain.com, another.site</span>
<span/>
<span class="comment"># Provide your RSA key information.</span>
<span>KeyFile         /etc/dkimkeys/boring-old-selector.key</span>
<span>Selector        boring-old-selector</span>
<span/>
<span class="comment"># Provide your Ed25519 key information.</span>
<span>KeyFileEd25519  /etc/dkimkeys/cool-new-selector.key</span>
<span>SelectorEd25519 cool-new-selector</span>
<span/>
<span class="comment">##### POSTFIX CONFIGURATION #####</span>
<span class="comment"># Copy whatever setup you had with OpenDKIM.</span>
<span>UserID          dkimpy-milter:postfix</span>
<span>UMask           007</span>
<span>PidFile         /var/run/dkimpy-milter/dkimpy-milter.pid</span>
<span>Socket          local:/var/spool/postfix/dkimpy-milter.sock</span>
<span/>
<span class="comment"># Make dkimpy-milter sign as well as verify, so</span>
<span class="comment"># Postfix can also check incoming DKIM signatures.</span>
<span>Mode sv</span>
<span/>
<span class="comment"># This Postfix variable will tell dkimpy-milter what to do.</span>
<span>MacroList       daemon_name|ORIGINATING</span>
<span>MacroListVerify daemon_name|VERIFYING</span></pre>
				</figure>
				<p>Restart <code>dkimpy-milter</code>.  It still won't do anything, though, until we have our <abbr title="Mail Transport Agent">MTA</abbr> send it some messages.</p>
	
				<h2>Postfix Configuration</h2>
				<p>Edit your <code aria-label="master dot CF">master.cf</code> file, and look for your SMTP and Submission services. Obviously, we'll change the socket name.  However, we need to add a macro name that will tell <code>dkimpy-milter</code> whether it will sign a message or verify one. This is new behavior in <code>dkimpy-milter</code> compared to OpenDKIM.  Fortunately, Postfix already has this functionality via <code>milter_macro_<em>name</em></code>:</p>
				<figure>
					<figcaption>Changes to your <code>/etc/postfix/master.cf</code> file.</figcaption>
					<pre class="code"><span>smtp      	inet	n	-	-	-	-	smtpd</span>
<span><del style="color:red">  -o smtpd_milters=sock:/opendmarc.sock</del></span>
<span><ins style="color:green">  -o smtpd_milters=sock:/dkimpy-milter.sock</ins></span>
<span>  -o milter_macro_daemon_name=VERIFYING</span>
<span/>
<span>submission	inet	n	-	-	-	-	smtpd</span>
<span><del style="color:red">  -o smtpd_milters=sock:/opendmarc.sock</del></span>
<span><ins style="color:green">  -o smtpd_milters=sock:/dkimpy-milter.sock</ins></span>
<span>  -o milter_macro_daemon_name=ORIGINATING</span></pre>
				</figure>
				<p>You should check your <code aria-label="main dot CF">main.cf</code> file to see if you've referenced OpenDKIM in there.  If so, go ahead and change it accordingly.  When you're all done, <code>postfix reload</code>.</p>

				<h2>We're done!</h2>
				<p>Send some email and read the source, or hop over to <a href="http://dkimvalidator.com" title="Well, right now.">my favorite DKIM testing site</a> and send it an email.  When it arrives, you should see two separate signatures, one RSA and one Ed25519.</p>
				<figure>
					<code>
						<h1>DKIM Information:</h1>
						<h2>DKIM Signature</h2><pre class="nobg" title="Line breaks added.">
Message contains this DKIM Signature:
DKIM-Signature: v=1;<wbr/> a=ed25519-sha256;<wbr/> c=relaxed/simple;
d=colincogle.name;<wbr/> i=@colincogle.name; <wbr/>q=dns/txt;<wbr/> s=colin-ed25519;
t=1567049647;<wbr/> h=from :<wbr/> content-type :<wbr/> mime-version :<wbr/> subject :
message-id :<wbr/> date :<wbr/> to :<wbr/> from;
bh=zrU0Ey8SLpTcRJGyugNEgYdAi2nzWHakc1f42rljNfg=;
b=7PieJLlpiMRV0DYkyMeTZWavJIRhjAF2irj2qRzjlQflkpluUvr3t97NDkjBhMq6JSH+N
z/DX1o2wVhQluJxAg==
DKIM-Signature: v=1;<wbr/> a=rsa-sha256;<wbr/> c=relaxed/simple;<wbr/> d=colincogle.name;
i=@colincogle.name;<wbr/> q=dns/txt;<wbr/> s=colin-rsa;<wbr/> t=1567049647;<wbr/> h=from :
content-type :<wbr/> mime-version :<wbr/> subject :<wbr/> message-id :<wbr/> date :<wbr/> to :<wbr/> from;
bh=zrU0Ey8SLpTcRJGyugNEgYdAi2nzWHakc1f42rljNfg=;
b=wnrPT8C+JVBUVdoTC3YKQM6CRlH6E0PAyqaUi7PBqCJfQuUpTWkaog6zNe0dxKF4AvY0Y
PXBGlGiGIp1jyizIIbA6hqdQ4IhzFuQ4JXB9k2vVTd5tqeSLUOIhWCt8kiry2ShQmIi0tcz
BuVBLxq59ovfmQKSwZVg3rhUBDfsYtbydUESlcoOkn9fpT6727HcMbGsfzf67itycfm8w/h
bjt7esWd5VMJ33wg8NYvte+mI/WpqNapwV8Reg5kQJ9FD3/vBOtKd8kM+DnzOciuqUZX0ak
Q2EwnujBEgHOVMqTKnYZUHT2Q1Pli31mSaXaAVxI2oVWIjIw82XfIEG5jK6Q==


<output>Signature Information:
v= Version:         1
a= Algorithm:       ed25519-sha256
c= Method:          relaxed/simple
d= Domain:          colincogle.name
s= Selector:        colin-ed25519
q= Protocol:        dns/txt
bh=                 zrU0Ey8SLpTcRJGyugNEgYdAi2nzWHakc1f42rljNfg=
h= Signed Headers:  from :<wbr/> content-type :<wbr/> mime-version :<wbr/> subject :<wbr/> message-id :<wbr/> date :<wbr/> to :<wbr/> from
b= Data:            7PieJLlpiMRV0DYkyMeTZWavJIRhjAF2irj2qRzjlQflkpluUvr3t97NDkjBhMq6JSH+Nz/DX1o2wVhQluJxAg==</output></pre>
						<h2>Public Key DNS Lookup</h2>
						Building DNS Query for <code>colin-ed25519._domainkey.colincogle.name</code><br/>
						Retrieved this publickey from DNS: v=DKIM1<wbr/>; k=ed25519;<wbr/> s=email;<wbr/> t=s;<wbr/> p=csY5YoFbP8dojeDjEIQwFmb88vdA8l6Ip7fESx39wNc=
						<h2>Validating Signature</h2>
						result = pass<br/>Details:
					</code>
					<figcaption>
						(No, there weren't any details.)  But, hey, look!  A dual-signed email! And this Ed25519-aware validator checked the newer of the two signatures.
					</figcaption>
				</figure>
				<p>Congratulations!  You're now helping to move the Internet forward, one tiny step at a time.  Hopefully your dual signatures will make another postmaster somewhere Google to find out what you're doing, and why.</p>
			</div>
		</content>
	</entry>

	<entry>
		<title>Much Ado about Electrons</title>
		<id>urn:uuid:a965bef2-3464-4601-b6b5-16d33dff4ec9</id>
		<link rel="alternate" type="text/html" href="https://colincogle.name/blog/much-ado-about-electrons" length="13235"/>
		<link rel="alternate" type="text/gemini" href="gemini://colincogle.name/blog/much-ado-about-electrons/" length="6814"/>
		<link rel="alternate" type="text/plain" href="https://colincogle.name/blog/much-ado-about-electrons/much-ado-about-electrons.txt" length="5698"/>
		<link rel="related" href="https://ctsierraclub.wixsite.com/sierraclub-ct/much-ado-about-electrons"/>
		<summary>Can building-scale batteries bolster Connecticut's fledgling solar industry?</summary>
		<published>2019-06-01T08:00:00-04:00</published>
		<updated>2019-05-02T01:01:15-04:00</updated>
		<contributor>
			<name>Sierra Club of Connecticut</name>
			<uri>https://ctsierraclub.wixsite.com</uri>
		</contributor>
		<category term="Connecticut"/>
		<category term="sustainability"/>
		<category term="solar energy"/>
		<category term="Sierra Club"/>
		<content type="xhtml">
			<div xmlns="http://www.w3.org/1999/xhtml">
				<p>For almost a year, the ink has been dry on <a href="https://www.cga.ct.gov/asp/cgabillstatus/cgabillstatus.asp?selBillType=Bill&amp;which_year=2018&amp;bill_num=9">Public Act 18-50</a>, also known by its more phlegmatic name, <cite>An Act Concerning Connecticut's Energy Future</cite>. With its passage last spring, Connecticut is now on track to walk away from <a href="https://www.ncsl.org/research/energy/net-metering-policy-overview-and-state-legislative-updates.aspx">the other forty-two states and territories that have legalized net metering</a>, the popular concept that lets consumers who generate their own electricity sell excess power back to the grid at the same price at which they buy it. Once <abbr title="Public Act">P.A.</abbr>18-50 goes into effect, the electric companies' customers will be forced to sell it back at less than the retail rate (although current residential solar owners will be grandfathered into net metering through 2039).</p>
				<p>Stephen Hartmann of the Danbury-based installer, <a rel="nofollow" href="https://rosssolar.com">Ross Solar Group</a>, said to <a href="https://www.newstimes.com/business/article/As-key-solar-perk-hits-sunset-CT-grapples-with-13744689.php">the Danbury News-Times</a>: <q cite="https://www.newstimes.com/business/article/As-key-solar-perk-hits-sunset-CT-grapples-with-13744689.php">Homeowners need to be aware that [the repeal is] premature and unnecessary — and based on faulty logic. […] People should be concerned about net metering going away — it's going to significantly diminish the value of what a solar-power energy system brings to a homeowner.</q></p>
				<p>In the new legislative session, <abbr title="Public Act">P.A.</abbr> 18-50 faces support and backlash, new and old, from members of both parties, making it tough to predict whether or not it will be amended or repealed before the state's 2,200 jobs in the solar industry are affected.</p>
				<p>In the meantime, though, the Connecticut General Assembly's Energy and Technology Committee has already taken a look at in-home batteries. These home energy storage devices are made by many companies worldwide, from small startups to tech giants; the better-known models include LG's RESU, sonnenBatterie's Eco Compact, and Tesla, Inc.'s home-sized Powerwall and commercial-grade Powerpack. These large batteries charge off of a home's solar panels during the day in order to power the home at night, with the added benefit of providing backup power in case of a brownout or blackout. (Connecticut does not allow time-of-day power pricing, but in other states that let utilities vary their electricity prices during the day, the battery can charge during off-peak hours and discharge during peak hours to reduce the homeowner's electric bill. This makes them an attractive investment even for homeowners without solar panels.)</p>
				<p>This legislative session, Rep. Jonathan Steinberg (<abbr title="Democrat, 136th District">D-136</abbr>) introduced <a href="https://www.cga.ct.gov/asp/cgabillstatus/cgabillstatus.asp?selBillType=Bill&amp;which_year=2019&amp;bill_num=6237">H.B. 6237, An Act Requiring a Study of Energy Storage Projects and Distributed Generation in the State</a> to call for "a study of energy storage projects and distributed generation". In <a href="https://www.cga.ct.gov/2019/etdata/tmy/2019SB-00468-R000221-Lafayette,%20Noel-Solar%20Connecticut-TMY.PDF">a supporting opinion, the company Solar Connecticut noted</a> that more than one-third of people shopping for solar panels were also interested in a house-scale battery, and felt a completed study could help <abbr title="Department of Energy and Environmental Protection">DEEP</abbr> make better energy policy decisions in the future. Regrettably, there has been no news about this bill since a February public hearing.</p>
				<p>Whether you're looking at a battery for smartwatch, cell phone, electric car, or a house; the technology is improving while prices are dropping. While net metering in Connecticut appears to be in hospice, in-home batteries are already providing tangible benefits to homeowners with or without solar panels.</p>
			</div>
		</content>
	</entry>

	<entry>
		<title>APRS Weather Reporting By Hand</title>
		<id>urn:uuid:2afc8aa3-5323-4567-bf5b-d057ecf72a19</id>
		<link rel="alternate" type="text/html" href="https://colincogle.name/blog/aprs-weather-submit/" length="16881"/>
		<link rel="alternate" type="text/gemini" href="gemini://colincogle.name/blog/aprs-weather-submit/" length="4874"/>
		<link rel="alternate" type="text/plain" href="http://colincogle.name/blog/aprs-weather-submit/aprs-weather-submit.txt" length="4647"/>
		<summary>You can use aprs-weather-submit to share weather data without a smart weather station.</summary>
		<published>2019-04-02T01:56:58-04:00</published>
		<updated>2023-12-10T22:13:05-05:00</updated>
		<category term="ham radio"/>
		<category term="weather"/>
		<category term="programming"/>
		<category term="C"/>
		<category term="hacking"/>
		<category term="Linux"/>
		<category term="open source"/>
		<content type="xhtml">
			<div xmlns="http://www.w3.org/1999/xhtml">
				<h2>Backstory</h2>
				<p>Ever since I got my amateur radio license back in <time datetime="2017-02-22">2017</time>, I've taken an interest in APRS, the Automatic Packet Reporting System, which allows hams to use a radio or an Internet connection to share useful data on a map, such as location tracking and weather data.  However, I don't have a fancy weather station that can automatically upload data.  Why should weather station owners or builders have all the fun? I set out to change that.</p> 
				<p>I already had the app <a href="https://koomasi.com/pocketpacket/">PocketPacket</a> on my phone, which can connect to the APRS network via a radio or via APRS-<abbr title="Internet Services">IS</abbr>.  The latter method connects to a server called an <abbr title="Internet Gateway">IGate</abbr> and uploads its data there, and I saw PocketPacket came with a list of APRS-IS servers.  Once I authenticated my callsign, I got a username and password, and was ready to start uploading data.</p>
				<p>I'm going to tell the story of how I wrote this app.  If you're just looking for directions on how to use it, scroll to the end of this article, or <a href="https://github.com/rhymeswithmogul/aprs-weather-submit">read its <code>man</code> page</a>.</p>
				
				<h2>Writing the App</h2>
				<p>First, I needed to learn how to make an APRS packet.  Between looking at raw packets on <a href="https://aprs.fi">APRS.fi</a>, <a href="http://www.aprs.org/doc/APRS101.PDF">reading the official APRS specification</a> and its addenda (<a href="http://www.aprs.org/aprs11.html">1.1</a> and <a href="http://www.aprs.org/aprs12.html">1.2</a>), and some example Python code that I came across, I figured it out and created a mock-up in PHP.</p>
				<p>However, I decided to make the final app a command-line app in the C programming language, so that it could run on almost anything with as few dependencies as possible, in case I should ever build my own weather station with an Arduino or Raspberry Pi.  (Plus, I wanted to shake off some of my <span title="Pun not intended">rust</span>, having not touched C since college.)</p>
				<p>I spent some time rediscovering old friends such as Xcode, <code>strncat()</code>, and <code>sprintf()</code>. The very first version of this app could only create the APRS packet and print it on the screen, which I pasted into raw PHP code which I then pasted into a terminal (<code>php -i</code>).  Once I saw my weather reports showing up on the map, the hard part was learning sockets programming.  Before long, it was complete.</p>
				<p>The following pieces of <a href="http://www.aprs.org/aprs12/weather-new.txt">weather data are defined in APRS 1.2.1</a>, all of which I was able to support in my app:</p>
				<ul>
					<li>Barometric pressure</li>
					<li>Humidity</li>
					<li>Luminosity (how strong the sunshine is)</li>
					<li>Radiation</li>
					<li>Rainfall (in the last hour, last 24 hours, and since midnight)</li>
					<li>Snowfall (in the last 24 hours)</li>
					<li>Temperature</li>
					<li>Weather station battery voltage</li>
					<li>Wind speed, gust speed, and direction</li>
				</ul>
				
				<h2>Examples</h2>
				<p>I looked at my "dumb" thermometer and saw it was 32°F outside.  My "dumb" rain gauge was as dry as my snow shovel, as both have been for a few days.  I reported both pieces of weather data with the following command:</p>
				<pre class="code bash nocount">
$ <span class="app">aprs-weather-submit</span>
<span class="switch">--callsign</span> <a class="string" href="https://www.qrz.com/db/KC1HBK" title="Why not check me out on QRZ?">KC1HBK</a>                       <span class="comment"># my call sign</span>
<span class="switch">--latitude</span> <span class="number">41.1234</span> <span class="switch">--longitude</span> <span class="number">-73.5678</span> <span class="comment"># my location</span>
<span class="switch">--server</span> <span class="string">igate.example.com</span> <span class="switch">--port</span> <span class="number">12345</span> <span class="comment"># IGate connection info</span>
<span class="switch">--username</span> <span class="string">colin</span> <span class="switch">--password</span> <span class="string">secret</span>      <span class="comment"># IGate authentication</span>
<span class="switch">--temperature</span> <span class="number">32</span>                        <span class="comment"># current temperature (°F)</span>
<span class="switch">--rainfall-since-midnight</span> <span class="number">0</span>             <span class="comment"># my rain gauge is empty</span>
<span class="switch">--rainfall-last-hour</span> <span class="number">0</span>                  <span class="comment"># it's dry</span>
<span class="switch">--rainfall-last-24-hours</span> <span class="number">0</span>              <span class="comment"># it's been dry</span>
<span class="switch">--snowfall-last-24-hours</span> <span class="number">0</span>              <span class="comment"># it also hasn't snowed</span></pre>
				<p>And that's it!</p>
				
				<h2>Get the App</h2>
				<p>If you use a Debian-based Linux distribution (such as Ubuntu), <a href="https://launchpad.net/~signofzeta/+archive/ubuntu/aprs-weather-submit">I now have a <abbr title="Personal Package Archive">PPA</abbr> available on Launchpad</a>.  To add it to your system and install <code>aprs-weather-submit</code>, do this:</p>
				<figure><code class="bash"><span><samp class="prompt">$</samp><kbd><span class="command">sudo add-apt-repository</span> <span class="string">ppa:signofzeta/aprs-weather-submit</span></kbd></span><br/><span><samp class="prompt">$</samp><kbd><span class="command">sudo apt</span> <span class="parameter">install</span> <span class="string">aprs-weather-submit</span></kbd></span></code><figcaption>Install my app using a PPA.  This way, it gets updated automatically.  If you're using another Debian-based distribution, click the link above to find the <code>deb</code> and <code>deb-src</code> URLs.</figcaption></figure>
				<p>You can download or contribute to the <a href="https://colincogle.name/blog/tags/open%20source" rel="tag">open source</a> code of <a href="https://github.com/rhymeswithmogul/aprs-weather-submit"><code>aprs-weather-submit</code> on GitHub</a>.  It compiles on <a href="https://colincogle.name/blog/tags/Apple" rel="tag">macOS</a>, <a href="https://colincogle.name/blog/tags/Linux" rel="tag">Linux</a>, and MS-DOS (the latter with some features disabled).  A future version might support Windows.</p>
				<p>73 and thanks for reading.</p>
			</div>
		</content>
	</entry>

	<entry>
		<title>A Kick in the Glass</title>
		<contributor>
			<name>Sierra Club Connecticut Chapter</name>
			<uri>https://ctsierraclub.wixsite.com/sierraclub-ct/</uri>
		</contributor>
		<id>urn:uuid:dd8c8a72-f4da-4637-9ff9-d4313b5b08ba</id>
		<link rel="alternate" type="text/html" href="https://colincogle.name/blog/recycling-glass/" length="16244"/>
		<link rel="alternate" type="text/gemini" href="gemini://colincogle.name/blog/recycling-glass/" length="4196"/>
		<link rel="alternate" type="text/plain" href="https://colincogle.name/blog/recycling-glass/a-kick-in-the-glass.txt" length="4463"/>
		<link rel="related" type="text/html" href="https://ctsierraclub.wixsite.com/sierraclub-ct/a-kick-in-the-glass"/>
		<summary>Single-stream recycling is great, but it has downsides.  Fortunately, there are steps you can take to help.</summary>
		<published>2018-11-01T00:00:00-04:00</published>
		<updated>2018-11-01T00:00:00-04:00</updated>
		<category term="Connecticut"/>
		<category term="Sierra Club"/>
		<category term="Recycling"/>
		<category term="Opinion"/>
		<content type="xhtml">
			<div xmlns="http://www.w3.org/1999/xhtml">
				<p>Written by Colin Cogle.  Edited by the Sierra Club Connecticut Chapter.<br/>This article was originally published in <a href="https://ctsierraclub.wixsite.com/sierraclub-ct/copy-of-newsletter">the <time datetime="2018-11">November 2018</time> issue of <em>The Quinnehtukqut</em></a>.</p>
				<figure itemscope="itemscope" itemtype="http://schema.org/ImageObject">
					<picture class="webfeedsFeaturedVisual">
						<source sizes="80vw" media="(prefers-reduced-data: reduce)" type="image/avif" srcset="https://colincogle.name/blog/recycling-glass/JarsForRecycling_Deasy@0.25x.avif"/>
						<source sizes="80vw" media="(prefers-reduced-data: reduce)" type="image/jxl" srcset="https://colincogle.name/blog/recycling-glass/JarsForRecycling_Deasy@0.25x.jxl"/>
						<source sizes="80vw" media="(prefers-reduced-data: reduce)" type="image/webp" srcset="https://colincogle.name/blog/recycling-glass/JarsForRecycling_Deasy@0.25x.webp"/>
						<source sizes="80vw" media="(prefers-reduced-data: reduce)" type="image/jpeg" srcset="https://colincogle.name/blog/recycling-glass/JarsForRecycling_Deasy@0.25x.jpg"/>
						<source sizes="80vw" type="image/avif" srcset="https://colincogle.name/blog/recycling-glass/JarsForRecycling_Deasy@0.25x.avif 572w, https://colincogle.name/blog/recycling-glass/JarsForRecycling_Deasy@0.5x.avif 1144w, https://colincogle.name/blog/recycling-glass/JarsForRecycling_Deasy.avif 2288w"/>
						<source sizes="80vw" type="image/jxl" srcset="https://colincogle.name/blog/recycling-glass/JarsForRecycling_Deasy@0.25x.jxl  572w, https://colincogle.name/blog/recycling-glass/JarsForRecycling_Deasy@0.5x.jxl  1144w, https://colincogle.name/blog/recycling-glass/JarsForRecycling_Deasy.jxl  2288w"/>
						<source sizes="80vw" type="image/webp" srcset="https://colincogle.name/blog/recycling-glass/JarsForRecycling_Deasy@0.25x.webp 572w, https://colincogle.name/blog/recycling-glass/JarsForRecycling_Deasy@0.5x.webp 1144w, https://colincogle.name/blog/recycling-glass/JarsForRecycling_Deasy.webp 2288w"/>
						<source sizes="80vw" type="image/jpeg" srcset="https://colincogle.name/blog/recycling-glass/JarsForRecycling_Deasy@0.25x.jpg  572w, https://colincogle.name/blog/recycling-glass/JarsForRecycling_Deasy@0.5x.jpg  1144w, https://colincogle.name/blog/recycling-glass/JarsForRecycling_Deasy.jpg  2288w"/>
						<img src="https://colincogle.name/blog/recycling-glass/JarsForRecycling_Deasy.jpg" alt="Glass jars ready for recycling." lowsrc="https://colincogle.name/blog/recycling-glass/JarsForRecycling_Deasy@lowsrc.jpg" class="webfeedsFeaturedVisual" longdesc="https://www.flickr.com/photos/7682623@N02/3357716065/"/>
					</picture>
					<figcaption itemprop="caption description">
						Glass jars to be recycled. (Photo credit: <a href="https://www.flickr.com/photos/7682623@N02/3357716065/" rel="nofollow">Jo Ann Deasy</a>)
					</figcaption>
					<meta itemprop="accessMode" content="visual"/>
					<span itemprop="author creator copyrightHolder" itemscope="itemscope" itemtype="http://schema.org/Person" class="h-card vcard">
						<meta itemprop="givenName" class="given-name p-given-name" content="Jo Ann"/>
						<meta itemprop="familyName" class="family-name p-family-name" content="Deasy"/>
						<link class="url u-url" itemprop="url" href="https://www.flickr.com/photos/7682623@N02/"/>
						<link class="image photo u-photo" itemprop="image" href="https://live.staticflickr.com/185/buddyicons/7682623@N02_r.jpg?1177546042#7682623@N02"/>
					</span>
					<link itemprop="contentUrl image" href="https://www.flickr.com/photos/7682623@N02/3357716065/sizes/l/"/>
					<meta itemprop="copyrightNotice" content="Creative Commons Attribution-NoDerivs 2.0 Generic (CC BY-ND 2.0)"/>
					<meta itemprop="copyrightYear" content="2009"/>
					<meta itemprop="dateCreated" content="2009-03-15T11:35:51-05:00"/>
					<meta itemprop="datePublished" content="2009-03-15"/>
					<meta itemprop="fileFormat" content="image/jpeg"/>
					<meta itemprop="height" content="1712"/>
					<meta itemprop="isAccessibleForFree" content="True"/>
					<meta itemprop="isFamilyFriendly" content="True"/>
					<link itemprop="license" href="https://creativecommons.org/licenses/by-nd/2.0/"/>
					<meta itemprop="name" content="Jars for Recycling"/>
					<meta itemprop="representativeOfPage" content="true"/>
					<meta itemprop="requiresSubscription" content="false"/>
					<link itemprop="sameAs url discussionUrl" href="https://www.flickr.com/photos/7682623@N02/3357716065/"/>
					<meta itemprop="width" content="2288"/>
				</figure>

				<p>In 2012, the <a href="https://hrra.org">Housatonic Resources Recovery Authority (HRRA)</a>, which represents eleven towns in western Connecticut, made the switch to single-stream recycling. That allows all recyclable materials to be mixed together in a single bin that is collected curbside or brought to a recycling center. Thus, instead of the homeowner sorting their recyclable waste prior to collection or drop-off, everything is sent as-is to a <span><dfn>materials recovery facility (MRF)</dfn>, where machinery, cameras, and humans handle the onus of separation: they sort paper, cardboard, cans, plastics #1 through #7, glass, metal, <abbr title="electronic waste">e-waste</abbr> (where accepted) and other materials so that a more-or-less pure pile of raw material can be shipped to its final destination.</span></p>

				<h2>Problems with Material Collections</h2>
				<p>Single-stream recycling, however, has a downside. Its convenience leads many people to try to be “green knights” and recycle dirty, mixed, or other items that may contaminate an MRF’s final products; for example, even a lone greasy pizza box or dirty glass jar could sully an otherwise acceptable pallet of the collected product. <a href="https://www.npr.org/2015/03/31/396319000/with-single-stream-recycling-convenience-comes-at-a-cost"><span title="Not to be confused with the Senator from Maine">Susan V. Collins, director of the Container Recycling Institute</span>, said in a <time datetime="2015-03-31T04:58:00-04:00">2015</time> interview with <abbr title="National Public Radio">NPR</abbr></a>, what single-stream wins in volume, it sacrifices in quality. <q cite="https://www.npr.org/2015/03/31/396319000/with-single-stream-recycling-convenience-comes-at-a-cost">As we often say, you can't unscramble an egg.</q>  One-fourth of material collected by recycling facilities has to be trashed.</p>
				<p>Under China’s Green Fence and National Sword policies, the once-bountiful import of recycled materials has been severely curtailed, and those materials that do pass their customs must be more pure than before; minutes from the <time datetime="2018-08-30">August 30</time> meeting of the HRRA say that recycled glass exported to China must be at least 99.5% pure. That leaves little room for labels, glue, caps and lids, and those little bits of ketchup that would have been rinsed out of the bottle if the consumer hadn't been in such a rush to get the kids off to school that morning. John Decker of Oak Ridge Waste and Recycling said succinctly during <a type="application/pdf" title="Meeting minutes" href="https://hrra.org/wp-content/uploads/2018/12/09-24-18notes.pdf">the HRRA’s <time datetime="2018-09-24">September 24</time> meeting</a>, <q cite="https://hrra.org/wp-content/uploads/2018/12/09-24-18notes.pdf">[T]he ability to sell glass is gone. […] Most of the glass today, unfortunately, because it is so dirty and contaminated, has to be disposed of.</q></p>

				<h2>Preparing your Glass for Recycling</h2>
				<p>Before you try to recycle glass (or anything), do your best to make sure that it’s clean, the label has been removed, and the plastic or metal cap or lid has been separated. Afterwards, place borosilicate glass (Pyrex) in the trash:  the changes it’s undergone to withstand high temperatures remain after being melted, making it non-recyclable by most facilities. Glass tends to retain its color after recycling, so sort by color if asked.</p>
				<p>Once separated and finely crushed, the resulting cullet can be used to make fiberglass, flux for brick manufacture, Astroturf, artificial sand, countertops, water filtration media, abrasives, a substitute for pea gravel or crushed rock, landscaping or construction fill, or — of course — new glass.</p>
				<p>Humans have been using glass for over six millennia. Let’s work together and make sure the same molecules are used for another six.</p>
			</div>
		</content>
	</entry>

	<entry>
		<title>Sunburned: The Unintended Effect of Senate Bill 9</title>
		<id>urn:uuid:956c6067-9bbf-448c-86b8-1ababa711b41</id>
		<link rel="alternate" type="text/html" href="https://colincogle.name/blog/ct-senate-bill-9/" length="14504"/>
		<link rel="alternate" type="text/gemini" href="gemini://colincogle.name/blog/ct-senate-bill-9/" length="4475"/>
		<link rel="alternate" type="text/plain" href="https://colincogle.name/blog/ct-senate-bill-9/sunburned-ct-senate-bill-9.txt" length="4417"/>
		<link rel="alternate" type="application/pdf" href="https://colincogle.name/blog/ct-senate-bill-9/Quinnehtukqut_June2018.pdf" length="3933015"/>
		<link rel="related" href="https://www.cga.ct.gov/2018/FC/2018SB-00009-R000460-FC.htm"/>
		<summary>While Connecticut Senate Bill 9 is a step forward for renewable energy, it includes a knife in the back for homeowners and small businesses.</summary>
		<published>2018-05-11T20:16:30-04:00</published>
		<updated>2018-06-05T12:47:00-04:00</updated>
		<category term="Connecticut"/>
		<category term="Sierra Club"/>
		<category term="sustainability"/>
		<category term="politics"/>
		<content type="xhtml">
			<div xmlns="http://www.w3.org/1999/xhtml">
				<p>While voters were asleep <time datetime="2018-05-09T02:53:00-04:00">hours before sunrise on May 9</time>, <a href="https://www.cga.ct.gov/2018/VOTE/h/2018HV-00274-R00SB00009-HV.htm" title="See how your representative voted.">Senate Bill 9 passed our House</a>.  It effectively undoes our state’s popular and successful net metering program.  <a href="https://www.cga.ct.gov/2018/FC/2018SB-00009-R000460-FC.htm">The text of the bill</a>, if signed into law, would require Connecticut’s energy usage to step up to being 40% from renewables by <time datetime="2030-01-01">2030</time>, as opposed to the current mandate of 28% by <time datetime="2020-01-01">2020</time>.  I’ll commend it that much.  I’m sure this is where our elected officials stopped reading.</p>
				<p>The remainder of <abbr title="Senate Bill">S.B.</abbr> 9 eliminates net metering, the promise where a customer with solar panels will pay for electricity by the kilowatt-hour like any other customer; however, when their home is generating more power than it’s consuming, the provider would buy the excess power at the same price.  <abbr title="Photovoltaic">PV</abbr> system owners have seen their electricity bills greened by the sun, making the investment pay for itself in a matter of years.</p>
				<p>Under <abbr title="Senate Bill">S.B.</abbr> 9, utility companies such as Eversource can set lower buyback rates during periods of “excessive generation.”  Its passage would all but gut our rooftop solar industry, laying waste to yet another of Connecticut’s fast-growing economies and threatening to send all 2,000 of our tax-paying solar jobs to greener pastures.  Case in point: when a similar bill passed in Nevada, and that sunny state lost thousands of jobs to their solar-friendly neighbors, it wasn’t long before their legislature backtracked and re-instated net metering.</p>
				<p><a href="https://votesolar.org/usa/connecticut/updates/press-statement-connecticut-passes-anti-solar-bill/">The advocacy group Vote Solar said</a> through their regional director, Sean Garren:  <q cite="https://votesolar.org/usa/connecticut/updates/press-statement-connecticut-passes-anti-solar-bill/#main">This bill is sadly misguided. Connecticut pays some of the highest electricity costs in the nation, and rooftop solar investment provides a much needed opportunity for families and businesses to manage those bills while lowering the overall cost of the utility system for everyone — and helping us fight climate change as well.</q></p>
				<p>Last year, residents of the towns of New Milford and Sherman stood against the Connecticut Siting Council under the banner of <a href="https://www.rescuecandlewoodmountain.org/">Rescue Candlewood Mountain</a> and staunchly opposed the “solar sprawl” of razing part of scenic Candlewood Mountain to build a large solar plant.  However, there is little if any opposition to homeowners buying a <abbr title="Photovoltaic">PV</abbr> system.  The removal of net metering, ironically, would undercut the higher renewable goals promised by <abbr title="Senate Bill">S.B.</abbr> 9.</p>
				<p>At least two out of three lawmakers voted on the side of your electric company, but this is a classic case of our elected representatives betraying the popular vote that sent them to Hartford in the first place.  <a href="https://votesolar.org/files/1415/0479/7454/ConnecticutResults_4.pdf">A recent poll by Public Policy Polling shows that 77% of Connecticut electors surveyed are in favor of expanding the role of solar energy in our state.</a>  Moreover, <a href="https://votesolar.org/usa/connecticut/updates/ct-voters-support-solar-climate-leadership/">splitting the numbers by party affiliation is an exercise in futility, with 71% of Republicans, 78% of Democrats, and 81% of Independents in favor of expanding access to solar energy.</a></p>
				<p>While <abbr title="Senate Bill">S.B.</abbr> 9 now sits on Governor Malloy’s desk, it originated from his office, so a veto seems unlikely.  All we can do is remind our readers of the significance of <time datetime="2018-11-06">the first Tuesday in November</time>.</p>
				<p>UPDATE:  Indeed, this bill was signed into law <time datetime="2018-05-24">May 24, 2018</time>.</p>
			</div>
		</content>
	</entry>

	<entry>
		<title>In Defense of the Great Indoors</title>
		<id>urn:uuid:a4fceb37-752c-430e-92c8-51c1d08b025d</id>
		<link rel="alternate" type="text/html" href="https://colincogle.name/blog/net-neutrality/" length="12988"/>
		<link rel="alternate" type="text/gemini" href="gemini://colincogle.name/blog/net-neutrality/" length="4221"/>
		<link rel="alternate" type="text/plain" href="https://colincogle.name/blog/net-neutrality/in-defense-of-the-great-indoors.txt" length="5101"/>
		<link rel="alternate" type="application/pdf" href="https://96e7a6df-8436-462c-81e0-90d862a5b1e6.filesusr.com/ugd/21115b_0648e54a771248e2b9994c8da01a69ff.pdf" length="3709618"/>
		<link rel="related" href="https://www.sierraclub.org/press-releases/2017/12/sierra-club-fcc-s-net-neutrality-ruling-american-people-will-not-be-silenced"/>
		<summary>The Sierra Club, the nation's most prominent environmental group, has a staunch opinion about net neutrality.  That's a sign that you should, too.</summary>
		<published>2018-05-11T08:00:00-04:00</published>
		<updated>2018-05-07T08:00:00-04:00</updated>
		<category term="net neutrality"/>
		<category term="technology"/>
		<category term="Sierra Club"/>
		<category term="opinion"/>
		<category term="politics"/>
		<content type="xhtml">
			<div xmlns="http://www.w3.org/1999/xhtml">
				<p>This article was originally published in the <time datetime="2018-05-01">May 2018</time> issue of <cite>The Quinnehtukqut</cite>.</p>
				<p>When you think of the Sierra Club, you think of the great outdoors. You might picture
					yourself in a redwood forest, watching one of the ancient trees stretch its limbs upward
					toward clean and clear skies, in the domains of lily white clouds, bald eagles and the
					occasional wind turbine; and all but feeling the venerable plant pushing its roots
					through clean soil, down into aquifers as pure as when John Muir walked over them.
					As you take a picture with your cell phone, you marvel that it reads <em>No Service</em>.</p>
				<p>It may surprise you that the Sierra Club also takes a stance on the great indoors, too;
					specifically, on the Federal Communication Commission's reversal of the "net neutrality"
					rules that required Internet service providers to treat all traffic without discrimination
					or prioritization. The Sierra Club's Executive Director, Michael Brune, spoke through
					<a href="https://www.sierraclub.org/press-releases/2017/12/sierra-club-fcc-s-net-neutrality-ruling-american-people-will-not-be-silenced">a
					press release issued <time datetime="2017-12-14">the same day as the repeal</time></a>:
					<q cite="https://www.sierraclub.org/press-releases/2017/12/sierra-club-fcc-s-net-neutrality-ruling-american-people-will-not-be-silenced">Today's
					ruling is nothing short of an assault on our democracy and the right to a free and open
					flow of information.  The fact of the matter is that the Trump administration will stop
					at nothing to give massive handouts to its biggest corporate supporters no matter the cost.</q></p>
				<p>The <abbr title="Federal Communications Commission">FCC</abbr> had a pro-net neutrality
					stance as early as 2005.  Finally, the <abbr title="Federal Communications Commission">
					FCC</abbr>'s <cite>Open Internet Order</cite> in 2015 officially reclassified
					<abbr title="Internet Service Provider">ISP</abbr>s as utilities instead of luxuries;
					that is, <q>common carrier telecommunications services</q> instead of <q>information
					services</q>.</p>
				<p>This order followed over ten years of incidents where <abbr title="Internet Service Provider">
					ISP</abbr>s were caught throttling or stopping certain traffic.  A few of many examples
					include:</p>
				<ul>
					<li>Comcast slowed file sharing apps and blocked <abbr title="Virtual Private Networks">VPN</abbr>s.</li>
					<li>Madison River Communications blocked access to their competitor, Vonage.</li>
					<li>AT&amp;T required users to buy a more expensive data plan to use Apple's free video chat service, FaceTime.</li>
					<li>Famously, Verizon was caught red-handed slowing down traffic from Netflix and YouTube, but not from its own paid video services.</li>
				</ul>
				<p>All the while, the ISP could do this without telling their own customers.  Unfortunately, 
					the 2017 <cite>Restoring Internet Freedom Act</cite> made these practices legal once more.</p>
				<p>Net neutrality was supported by the Sierra Club, the Electronic Frontier Foundation, Netflix, 
					Amazon, Reddit, Facebook, Google, Microsoft, AOL, and countless other Internet companies; 
					along with over 98% of the 1.3 million unique comments posted on FCC.gov (including this 
					author's) during the comment period.  Companies opposed to a free and open Internet included 
					Verizon, AT&amp;T, Comcast, Time Warner, and Cablevision;  as well as <abbr title="Federal Communications Commission">FCC</abbr>
					chairman, Ajit Pai.  An online poll by the software vendor Mozilla showed 73% of self-proclaimed
					Republicans supported net neutrality.  Regardless, the repeal passed across party lines.
					As Mr. Brune stated after the 3-2 ruling: <q cite="https://www.sierraclub.org/press-releases/2017/12/sierra-club-fcc-s-net-neutrality-ruling-american-people-will-not-be-silenced">The
					American people will not be silenced. The Sierra Club and our three million members and
					supporters stand with all those who will continue this fight to protect a free and open internet.</q></p>
				<p>Not all hope is lost.  Less than an hour after the <time datetime="2017-12-14">December 14, 2017</time> vote, the attorneys general of New York and Washington announced intent to sue the <abbr title="Federal Communications Commission">FCC</abbr>.  Since then, Connecticut's attorney general, George Jepsen, joined the lawsuit. The case is ongoing.</p>
			</div>
		</content>
	</entry>

	<entry>
		<title>New Milford Town Council Enacts Citizen-Led Fracking Waste Ban</title>
		<id>urn:uuid:4ea4f90c-7a1a-4393-84e4-6d0ed1f38f5d</id>
		<link rel="alternate" type="text/html" href="https://colincogle.name/blog/banning-fracking-waste/" length="14770"/>
		<link rel="alternate" type="text/gemini" href="gemini://colincogle.name/blog/banning-fracking-waste/" length="3804"/>
		<link rel="alternate" type="text/plain" href="https://colincogle.name/blog/banning-fracking-waste/new-milford-fracking-waste-ban.txt" length="3489"/>
		<summary>Town becomes the twenty-first in Connecticut to ban the sale, use, and import of fracking waste by-products.</summary>
		<published>2017-07-10T23:10:45-04:00</published>
		<updated>2017-09-11T22:10:45-04:00</updated>
		<category term="fracking"/>
		<category term="environment"/>
		<category term="hey-look-i-did-a-thing" label="Activism"/>
		<category term="Sierra Club"/>
		<category term="Connecticut"/>
		<category term="politics" label="local politics"/>
		<content type="xhtml">
			<div xmlns="http://www.w3.org/1999/xhtml">
				<figure itemscope="itemscope" itemtype="http://schema.org/ImageObject">
					<picture class="webfeedsFeaturedVisual">
						<source type="image/avif" srcset="https://colincogle.name/blog/banning-fracking-waste/committee.avif"/>
						<source type="image/webp" srcset="https://colincogle.name/blog/banning-fracking-waste/committee.webp"/>
						<source type="image/jxl" srcset="https://colincogle.name/blog/banning-fracking-waste/committee.jxl"/>
						<source type="image/jpeg" srcset="https://colincogle.name/blog/banning-fracking-waste/committee.jpg"/>
						<source type="image/gif" srcset="https://colincogle.name/blog/banning-fracking-waste/committee.gif"/>
						<img src="https://colincogle.name/blog/banning-fracking-waste/committee.jpg" alt="The Committee to Ban Fracking Waste from New Milford (with Mayor David Gronbach)" itemprop="image url contentUrl" class="webfeedsFeaturedVisual" title="Mayor David Gronbach (far right) with The Committee to Ban Fracking Waste from New Milford and townsfolk who testified at the Town Council meeting in support of the ordinance."/>
					</picture>
					<figcaption itemprop="caption description">Mayor David Gronbach (far right) poses with The Committee to Ban Fracking Waste from New Milford and townsfolk who testified at the Town Council meeting in support of the ordinance.</figcaption>
					<meta itemprop="accessMode" content="visual"/>
					<meta itemprop="dateCreated" content="2017-07-10"/>
					<meta itemprop="fileFormat" content="image/avif"/>
					<meta itemprop="fileFormat" content="image/jpeg"/>
					<meta itemprop="fileFormat" content="image/jxl"/>
					<meta itemprop="fileFormat" content="image/webp"/>
					<meta itemprop="height" content="1158"/>
					<meta itemprop="inLanguage" content="en-US"/>
					<meta itemprop="name" content="The Committee to Ban Fracking Waste from New Milford"/>
					<meta itemprop="representativeOfPage" content="true"/>
					<meta itemprop="requiresSubscription" content="false"/>
					<meta itemprop="width" content="1544"/>
				</figure>

				<p><q>We're not going to let <em>anything</em> into the town!</q> Councilman Tom Esposito
					staunchly promised to a full house of concerned citizens during the New Milford Town
					Council meeting on <time datetime="2017-07-10T19:00:00-04:00">Monday, July 10, 2017</time>.
					Esposito's impassioned support of a citizen-led initiative to ban fracking wastes from
					the town was matched in full by his fellow councilors, as well as the many commenters
					who spoke for nearly an hour during the public comment section of the meeting, and the
					dozens more in the room backing each speaker with thunderous applause.</p>

				<p>In the weeks leading up to this regularly-scheduled meeting, a group of townspeople known
					as The Committee to Ban Fracking Waste from New Milford used ordinance language that
					passed in nineteen other towns urging the Town Council to ban the use of by-products of
					hydraulic fracturing within town limits, and to require that contractors do the same.
					After the requisite 164 registered voters signed petitions in support, as per the Town
					Charter, the Town Council was set to tackle the subject.</p>

				<p>However, there would prove to be little debate, as the only contentious points were minor
					details such as wording. Democratic councilors Frank Wargo, Scott Chamberlain, and Mary
					Jane Lundgren — plus Mayor David Gronbach — joined Republicans Tom Esposito, Paul Szymanski,
					and Katy Francis in speaking out fervently in favor of the taxpayer-backed fracking waste
					ban. Two hours into the discussion, bookended by many speeches and a quick consult from
					the town's attorney, John Tower, a bipartisan and <a href="https://newmilford.org/filestorage/7526/7528/7807/8059/20170/07-10-2017_Minutes.pdf">
					unanimous 7-0 vote</a> made New Milford the twenty-first municipality in Connecticut to
					ban the use and import of fracking waste products. (Councilman Walter Bayer and
					Councilwoman Jessica Richardson were absent.)</p>

				<p>While the ordinance has passed, the town's attorney still needs to review the text and
					make whatever minor corrections deemed necessary for it to apply to New Milford.  The
					Town Council will ratify the final ordinance at their next meeting on
					<time datetime="2017-08-14T19:00:00-04:00">August 14</time>.</p>

				<p><em>(Author's note: The final ordinance was approved at
					<a href="https://newmilford.org/filestorage/7526/7528/7807/8059/20170/09-11-2017_Minutes_-_Revised.pdf">
					the Town Council's <time datetime="2017-09-11T19:00:00-04:00">September 11</time>
					meeting</a>, and the ordinance went into effect on
					<time datetime="2017-10-01T00:00:00-04:00">October 1</time>.)</em></p>

				<p><a rel="publisher" href="https://newmilfordgreens.wordpress.org">The Green Party of New
					Milford</a> would like to toast a glass of clean drinking water to The Committee to Ban
					Fracking Waste in New Milford for their tireless efforts in collecting signatures
					around town. We'd also like to thank <a href="https://ctsierraclub.wixsite.com/sierraclub-ct">
					The Sierra Club</a>, <a href="https://www.foodandwaterwatch.org/">Food &amp; Water Watch</a>,
					and <a href="https://350ct.org/">350CT</a> for their support of this ordinance.</p>

				<p>Green Party members and concerned citizens in other towns are welcome to contact
					Jennifer Siskind at Food &amp; Water Watch for ordinance information and free materials.</p>
			</div>
		</content>
	</entry>

	<entry>
		<title>An Interim Fix for GPGMail on Snow Leopard</title>
		<id>urn:uuid:e6801fa2-30db-432c-bedd-7f9cf10a0cb4</id>
		<link rel="alternate" type="text/html" href="https://colincogle.name/blog/gpgmail-snow-leopard/" length="12675"/>
		<link rel="alternate" type="text/gemini" href="gemini://colincogle.name/blog/gpgmail-snow-leopard/" length="3561"/>
		<link rel="alternate" type="text/plain" href="https://colincogle.name/blog/gpgmail-snow-leopard/an-interim-fix-for-gpgmail-on-snow-leopard.txt" length="3682"/>
		<summary>GPGMail has been an invaluable tool for users of both GPG and Apple’s Mail application.  Unfortunately, the marriage of GPG to Mail has been a bittersweet relationship.</summary>
		<published>2009-10-12T14:45:00-04:00</published>
		<updated>2021-11-22T21:22:52-05:00</updated>
		<category term="technology"/>
		<category term="privacy"/>
		<category term="PGP"/>
		<category term="Apple" label="macOS"/>
		<category term="security"/>
		<category term="sysadmin" label="System administration"/>
		<content type="xhtml">
			<div xmlns="http://www.w3.org/1999/xhtml">
				<aside role="note"><strong>Warning:</strong> It's <time datetime="2021-11-22T21:22:52-05:00">2021</time>.  Anyone reading this article with a Mac made in the past dozen years or so should be using <a href="https://gpgtools.org/">GPG Tools</a> instead.  This article is provided for historical reference for hobbyists only.</aside>
				<p><a href="http://www.sente.ch/software/GPGMail/English.lproj/GPGMail.html">GPGMail</a> has been an invaluable tool for users of both GnuPG and Apple’s Mail application. For those unfamiliar with GnuPG (and its commercial equivalent, <abbr title="Pretty Good Privacy">PGP</abbr>), it uses a set of keys — one public, one secret — to encrypt and/or attach digital signatures to email.</p>
				<p>Unfortunately, the marriage of GPG to <a href="https://support.apple.com/en-us/HT2500">Mail</a> has been a bittersweet relationship. Apple doesn’t publish the internal API’s of Mail, and has not provided much of a plug-in architecture for it. Therefore, GPGMail had to be developed by using undocumented functions, which Apple had no obligation to maintain between major releases of macOS.  Like all other major upgrades, Mac users upgrading to Snow Leopard were left to pick up the pieces. To add to the pain, the sole programmer behind this no longer has time to maintain the software.</p>
				<p>While the software is getting a long-overdue rewrite from new hands, <a title="Dead link" href="http://sourceforge.net/projects/gpgmail/forums/forum/801904/topic/3404718">two enterprising users</a> found a solution, which I’m reposting to spread the word.</p>
				<ol>
					<li>Download and install GPGMail and <a href="https://macgpg.sourceforge.io/">MacGPG</a>.</li>
					<li>Find Mail in the <code>/Applications</code> folder.</li>
					<li>From the File menu, choose Get Info.</li>
					<li>Check "Run in 32-bit mode". (64-bit support will have to wait until a new version of GPGMail is formally released.)</li>
					<li>Now, go to <code>~/Library/Mail/Bundles</code>; right-click on <code>GPGMail.mailbundle</code> and choose Show Package Contents.</li>
					<li>Add the following lines to <code>Info.plist</code>, depending on which version of macOS that you’re running:
						<dl>
							<dt>Mac OS X 10.6</dt>
							<dd>
								<pre><span>&lt;key&gt;SupportedPluginCompatibilityUUIDs&lt;/key&gt;</span>
<span>&lt;array&gt;</span>
<span>	&lt;string&gt;B3F3FC72-315D-4323-BE85-7AB76090224D&lt;/string&gt;</span>
<span>	&lt;string&gt;225E0A48-2CDB-44A6-8D99-A9BB8AF6BA04&lt;/string&gt;</span>
<span>&lt;/array&gt;</span></pre>
							</dd>
							<dt>Mac OS X 10.6.1</dt>
							<dd>
								<pre><span>&lt;key&gt;SupportedPluginCompatibilityUUIDs&lt;/key&gt;</span>
<span>&lt;array&gt;</span>
<span>	&lt;string&gt;2610F061-32C6-4C6B-B90A-7A3102F9B9C8&lt;/string&gt;</span>
<span>	&lt;string&gt;99BB3782-6C16-4C6F-B910-25ED1C1CB38B&lt;/string&gt;</span>
<span>&lt;/array&gt;</span></pre>
							</dd>
							<dt>Mac OS X 10.6.2 (beta)</dt>
							<dd>
								<pre><span>&lt;key&gt;SupportedPluginCompatibilityUUIDs&lt;/key&gt;</span>
<span>&lt;array&gt;</span>
<span>	&lt;string&gt;0CB5F2A0-A173-4809-86E3-9317261F1745&lt;/string&gt;</span>
<span>	&lt;string&gt;2F0CF6F9-35BA-4812-9CB2-155C0FDB9B0F&lt;/string&gt;</span>
<span>&lt;/array&gt;</span></pre>
							</dd>
						</dl>
					</li>
					<li>Save the file, and then open Mail.</li>
				</ol>

				<p>Everything should be working fine now!  Many thanks to detlefschmitt and pretemsteinmetz
					from the <a href="https://web.archive.org/web/20100421025758/http://sourceforge.net/projects/gpgmail/forums/forum/801904/topic/3404718">
					SourceForge.net forums</a> for this solution. If you found this helpful, please
					thank the original posters, and then urge Apple to do any of the following:</p>
				
				<ul>
					<li>Provide native support for GnuPG in Mail, as they do S/MIME.</li>
					<li>Publish a Mail plugin API, to make development of GPGMail easier.</li>
					<li>Assign one or more members of the Mail development team to the GPGMail project.</li>
				</ul>
			</div>
		</content>
	</entry>
</feed>
