<?xml version="1.0" encoding="UTF-8" standalone="no"?><rss xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" version="2.0">

<channel>
	<title>Stubborn Fanatic - Full Feed</title>
	<atom:link href="https://techblog.viveksanghi.com/feed/" rel="self" type="application/rss+xml"/>
	<link>https://techblog.viveksanghi.com/</link>
	<description>This is a full posts feed to Vivek Sanghi's tech blog. Please take time to read the articles covering topics like Blogger add-ons/hack code, latest tech news, internet, computers, software and books</description>
	<lastBuildDate>Mon, 16 Nov 2026 09:58:52 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=7.1.5</generator>
<site xmlns="com-wordpress:feed-additions:1">5851209</site>	<item>
		<title>The fix that let phishing names through</title>
		<link>https://techblog.viveksanghi.com/2026/11/opnsense-allowlist-regex-hagezi-blocklists/</link>
					<comments>https://techblog.viveksanghi.com/2026/11/opnsense-allowlist-regex-hagezi-blocklists/#respond</comments>
		
		<dc:creator><![CDATA[Vivek Sanghi]]></dc:creator>
		<pubDate>Mon, 23 Nov 2026 10:30:00 +0000</pubDate>
				<category><![CDATA[home network]]></category>
		<category><![CDATA[sysadmin]]></category>
		<category><![CDATA[ai assisted]]></category>
		<category><![CDATA[dns]]></category>
		<category><![CDATA[hagezi]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[opnsense]]></category>
		<category><![CDATA[self-hosting]]></category>
		<category><![CDATA[stubborn fanatic]]></category>
		<category><![CDATA[unbound]]></category>
		<guid isPermaLink="false">https://techblog.viveksanghi.com/?p=305</guid>

					<description><![CDATA[<p>An OPNsense allowlist entry is a regex matched from the start of a name, so my "fixed" entries let lookalike names through. Plus eighteen blocklists, seven of them redundant.</p>
<p>The post <a href="https://techblog.viveksanghi.com/2026/11/opnsense-allowlist-regex-hagezi-blocklists/">The fix that let phishing names through</a> appeared first on <a href="https://techblog.viveksanghi.com">Stubborn Fanatic - Tech Blog</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<style>
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+Devanagari:wght@400;600&family=Noto+Sans+Telugu:wght@400;600&family=Noto+Sans+Thai:wght@400;600&display=swap');
.hbt-wrap { max-width: 720px; margin: 2em auto; line-height: 1.75; }
.hbt-wrap p { margin: 0 0 1.1em; }
.hbt-wrap h2 { margin: 0 0 .8em; font-size: 1.5em; line-height: 1.3; }
.hbt-wrap h3 { margin: 2em 0 .6em; font-size: 1.2em; font-weight: 600; line-height: 1.35; }
.hbt-wrap ul, .hbt-wrap ol { margin: 0 0 1.1em 1.3em; padding: 0; }
.hbt-wrap li { margin: 0 0 .45em; }
.hbt-wrap li > pre { margin-top: .6em; }
.hbt-wrap [lang="hi"] { font-family: "Noto Sans Devanagari", sans-serif; }
.hbt-wrap [lang="te"] { font-family: "Noto Sans Telugu", sans-serif; }
.hbt-wrap [lang="th"] { font-family: "Noto Sans Thai", sans-serif; }
.hbt-wrap pre { margin: 0 0 1.4em; padding: .9em 1.1em; overflow-x: auto; border-left: 3px solid currentColor; background: rgba(127,127,127,.12); font-size: .82em; line-height: 1.5; white-space: pre; }
.hbt-wrap code { font-family: ui-monospace, Consolas, "SFMono-Regular", Menlo, "DejaVu Sans Mono", monospace; font-size: .9em; font-variant-ligatures: none; }
.hbt-wrap pre code { font-size: 1em; }
.hbt-wrap a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.hbt-wrap table { width: 100%; border-collapse: collapse; margin: 0 0 1.4em; font-size: .92em; display: block; overflow-x: auto; }
.hbt-wrap th, .hbt-wrap td { padding: .45em .6em; border-bottom: 1px solid rgba(127,127,127,.35); text-align: left; vertical-align: top; }
.hbt-wrap th { font-weight: 600; }
.hbt-wrap .in-short { margin: 1.4em 0 1.8em; padding: 1em 1.2em; border: 1px solid rgba(127,127,127,.45); border-radius: 6px; }
.hbt-wrap .in-short p:first-child { margin-bottom: .5em; }
.hbt-wrap .in-short ul { margin-bottom: 0; }
.hbt-wrap .hbt-note { font-size: .9em; opacity: .8; margin-bottom: 1.4em; }
.hbt-wrap details { margin: 0 0 1.4em; padding: .2em 1em; border-left: 3px solid rgba(127,127,127,.5); background: rgba(127,127,127,.06); }
.hbt-wrap details[open] { padding-bottom: .6em; }
.hbt-wrap summary { cursor: pointer; font-weight: 600; padding: .6em 0; }
.hbt-wrap summary:focus-visible { outline: 2px solid currentColor; outline-offset: 2px; }
.hbt-visually-hidden { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.hbt-wrap > input[type="radio"] { position: absolute; opacity: 0; width: 1px; height: 1px; }
.hbt-tabs { display: flex; flex-wrap: wrap; gap: .3em 1.4em; margin: 0 0 1.6em; border-bottom: 1px solid rgba(127,127,127,.35); }
.hbt-tabs label { cursor: pointer; padding: .4em 0; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.hbt-tabs label[lang="hi"] { font-family: "Noto Sans Devanagari", sans-serif; }
.hbt-tabs label[lang="te"] { font-family: "Noto Sans Telugu", sans-serif; }
.hbt-tabs label[lang="th"] { font-family: "Noto Sans Thai", sans-serif; }
.hbt-panel { display: none; }
.hbt-wrap .sf-box pre { border-left: 0; background: none; margin: 0; white-space: pre; }
.hbt-wrap .sf-box code { font-size: inherit; }
.hbt-wrap .sf-legend { margin: 0 0 1.4em; }
#hbt-en:checked ~ .hbt-tabs label[for="hbt-en"], #hbt-hi:checked ~ .hbt-tabs label[for="hbt-hi"], #hbt-te:checked ~ .hbt-tabs label[for="hbt-te"], #hbt-th:checked ~ .hbt-tabs label[for="hbt-th"] { border-bottom-color: currentColor; font-weight: 600; }
#hbt-en:focus-visible ~ .hbt-tabs label[for="hbt-en"], #hbt-hi:focus-visible ~ .hbt-tabs label[for="hbt-hi"], #hbt-te:focus-visible ~ .hbt-tabs label[for="hbt-te"], #hbt-th:focus-visible ~ .hbt-tabs label[for="hbt-th"] { outline: 2px solid currentColor; outline-offset: 2px; }
#hbt-en:checked ~ .hbt-content #hbt-panel-en, #hbt-hi:checked ~ .hbt-content #hbt-panel-hi, #hbt-te:checked ~ .hbt-content #hbt-panel-te, #hbt-th:checked ~ .hbt-content #hbt-panel-th { display: block; }
</style>
<div class="hbt-wrap">
<input type="radio" name="hbt-lang" id="hbt-en" checked>
<input type="radio" name="hbt-lang" id="hbt-hi">
<input type="radio" name="hbt-lang" id="hbt-te">
<input type="radio" name="hbt-lang" id="hbt-th">
<div class="hbt-tabs" role="group" aria-label="Language"><label for="hbt-en" lang="en">English</label><label for="hbt-hi" lang="hi">हिन्दी</label><label for="hbt-te" lang="te">తెలుగు</label><label for="hbt-th" lang="th">ไทย</label></div>
<div class="hbt-content">
<div id="hbt-panel-en" class="hbt-panel" lang="en">
<h2 class="hbt-visually-hidden">In English</h2>
<p>On a Saturday in October I fixed four broken entries in my router&#8217;s DNS allowlist. A little over two weeks later I found that the fixed entries let through names on the threat feed built to look like the sites I meant to allow: a payment site&#8217;s domain followed by <code>.https.</code> and an unrelated domain, or a shop&#8217;s name with a hyphen where the dot should be. My router&#8217;s own tester passed them.</p>
<p>The same evening I had cut my blocklists from eighteen to ten; an LG TV list the next day made it eleven. Seven of them were covered by the rest of the set. One list I kept, Abuse.ch ThreatFox, stopped downloading when abuse.ch began to give out its host file only with a key. It downloads again since I put a free key in its address. And the ads inside YouTube and Instagram on my phone came through throughout, which no blocklist was going to change.</p>
<p>I then rewrote the allowlist entries. This post is about both clean-ups: what OPNsense does with an allowlist entry, how to check yours, and what eighteen overlapping lists added up to. I did the work with Claude over two sessions, one for each clean-up; the ThreatFox key went in during a third. It read the router through my browser; every change on the router was mine to approve. I approved the bare-name fix, so approval was no safeguard against that mistake.</p>
<aside class="in-short">
<p><strong>In short</strong></p>
<ul>
<li>On OPNsense an allowlist entry is a regular expression matched from the start of the name. A bare <code>example.com</code> also allows any name that begins with those characters, with any character in place of the dot: <code>example.com.evil.net</code>, <code>example-com.evil.net</code>. Write the exact name, anchored: <code>^www\.example\.com\.?$</code>.</li>
<li>Read the resolver log after a change. A list that fails to download, or an allowlist entry that is skipped, shows up there and nowhere on the blocklist page.</li>
<li>Pick one Hagezi tier, from Light to Ultimate, and add Threat Intelligence Feeds. On a router with memory to spare, use full lists, not Mini versions.</li>
<li>Check what your tier already contains before adding more. Fake, and all but three names of Pop-Up Ads, are inside Pro++.</li>
</ul>
</aside>
<details class="sf-legend"><summary><strong>New to the command line? How to read the boxes</strong></summary>
<p><strong>PS&gt;</strong> means: type this in <em>PowerShell</em> on Windows (Start menu → type <code>powershell</code> → Enter). <strong>$</strong> means: type this in a terminal on Linux or a Mac, or on the Pi after you have logged in with <code>ssh</code>. Do not type the <strong>$</strong> or <strong>PS&gt;</strong> itself.</p>
<p>Each line that starts with <strong>$</strong> or <strong>PS&gt;</strong> is one command. Click that <strong>$</strong> to copy just that line, paste it, press <strong>Enter</strong>, and wait for it to finish before the next. A box with a <strong>Copy</strong> button at the top holds one command (or one file), so copy it whole. A dashed box shows what you should see back; you do not type it.</p>
</details>
<h3>The allowlist</h3>
<p>My blocklist policy&#8217;s allowlist had 26 entries. On the day of the first clean-up four of them looked broken. Three had been pasted from the browser&#8217;s address bar as full addresses, in the form <code>https://example.org/</code>. The fourth had one space before the first letter of the name. I replaced all four with bare names such as <code>example.in</code>. I did not look at how the other 22 were written, and the router&#8217;s configuration history no longer goes back far enough to check. If they were bare names, as the router&#8217;s own Allow button writes them, the gap was there before my fix, and the fix extended it to the three entries that had matched nothing.</p>
<p>The router&#8217;s log showed a fifth, an entry written as <code>*.ntp.org</code>, since removed. Each nightly update had logged &#8220;skip invalid whitelist exclude pattern&#8221; for it. A leading <code>*</code> is not valid in Python&#8217;s regular expressions, so the router dropped the entry every night and said so only in the log. The form that does what was meant is <code>(.*\.)?ntp\.org\.?$</code>.</p>
<p>Later Claude read the code that applies the allowlist, in OPNsense 26.7. The leading space had done no harm: the code strips spaces from each entry. The bare names were the problem.</p>
<p>OPNsense treats each entry as a regular expression, case-insensitive, and checks it against the start of the name a device asks for. Nothing ties it to the end of the name, and an unescaped dot matches any character. So a bare <code>example.com</code> allows <code>example.com</code> but not <code>www.example.com</code>. It also allows any name that begins with those characters, with any character in place of each dot: <code>example.com.evil.net</code>, <code>example-com.evil.net</code>, <code>example.community</code>.</p>
<p>The threat feed carries names of exactly that shape: a well-known site&#8217;s name followed by <code>.https.</code> and an unrelated domain, or the site&#8217;s name with a hyphen for the dot. On the feed as I downloaded it for this check, seven of my 26 entries matched 43 such names; one entry matched 20. On my router&#8217;s tester, each of the five such names I tried passed, while the same name with <code>www.</code> in front, blocked by the same list entry, was blocked. A name I made up from an allowed site and a domain the threat feed blocks passed too. By the matching code, every bare entry allows any name that begins with it, whether or not a list blocks that name.</p>
<p>OPNsense&#8217;s own Allow button, in Reporting → Unbound DNS, saves the bare name in the same way. Entries added from there behave the same way.</p>
<p>The fix is to allow the exact name, anchored at both ends:</p>
<div class="sf-box" data-mode="file" data-where="Allowlist entry (an example, not a command)" data-how="paste it into the Allowlist Domains field"><pre><code>^www\.example\.com\.?$</code></pre></div>
<p>The backslashes make the dots literal, and <code>$</code> ties the pattern to the end of the name. <code>\.?</code> allows the trailing dot the name carries on one of the two paths the code checks (see the deep dive). <code>^</code> repeats what the code already does, so leaving it out would work too; I keep it so the pattern reads the same anywhere. The steps to check and rewrite your own entries are in the deep dives under &#8220;How to check yours&#8221;.</p>
<p>To allow a domain with all its subdomains, <code>(.*\.)?example\.com\.?$</code> works, but it also allows hosts the list blocks under that domain on purpose. On one of my entries, Pro++ blocks five hosts under the domain, with names such as <code>advertising</code> and <code>sponsored-ads</code>, and does not block the domain itself or its <code>www.</code> name. A subdomain-wide allow would let them back.</p>
<p>I ran OPNsense&#8217;s own parsing code and its matching call on a few names:</p>
<table>
<thead>
<tr>
<th>Allowlist entry</th>
<th>Name asked for</th>
<th>Allowed?</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>https://example.org/</code></td>
<td><code>example.org</code></td>
<td>no</td>
</tr>
<tr>
<td><code>example.in</code></td>
<td><code>example.in</code></td>
<td>yes</td>
</tr>
<tr>
<td><code>example.in</code></td>
<td><code>www.example.in</code></td>
<td>no</td>
</tr>
<tr>
<td><code>example.in</code></td>
<td><code>example.in.example.net</code></td>
<td>yes</td>
</tr>
<tr>
<td><code>example.in</code></td>
<td><code>example-info.de</code></td>
<td>yes</td>
</tr>
<tr>
<td><code>^www\.example\.in\.?$</code></td>
<td><code>www.example.in</code></td>
<td>yes</td>
</tr>
<tr>
<td><code>^www\.example\.in\.?$</code></td>
<td><code>advertising.example.in</code></td>
<td>no</td>
</tr>
<tr>
<td><code>^www\.example\.in\.?$</code></td>
<td><code>www.example.in.example.net</code></td>
<td>no</td>
</tr>
</tbody>
</table>
<p>I rewrote all 26 entries in that exact, anchored form and applied the change. Every name that had passed the tester was blocked afterwards. The one entry whose own name is on a list still passes, as intended. The exact names in the other 25 were not blocked by any list, so those entries did no work for the names they spell; their only effect was the prefix gap. I anchored them instead of deleting them, because a list can add a name later. If you have entries like that, deleting them is a fair choice.</p>
<details>
<summary>Deep dive: the code, and what my tests do and do not show</summary>
<p>The blocklist dialog has one &#8220;Allowlist Domains&#8221; field. Its help text says it takes domains, that regular expressions may be used, and that it applies only to matches in that policy. In 26.7:</p>
<ul>
<li><code>src/opnsense/service/templates/OPNsense/Unbound/core/blocklists.conf</code> writes the field as <code>excludes.patterns</code>, comma-separated.</li>
<li><code>src/opnsense/scripts/unbound/blocklists/default_bl.py</code> splits that value on commas, calls <code>strip()</code> on each entry, drops any entry that does not compile as a regular expression (with the &#8220;skip invalid&#8221; log line), and joins the rest, with a built-in <code>.*localhost$</code> entry, into one pattern with <code>|</code>.</li>
<li><code>src/opnsense/scripts/unbound-dnsbl/lib/__init__.py</code> compiles the pattern case-insensitively.</li>
<li><code>src/opnsense/scripts/unbound-dnsbl/lib/dnsbl.py</code> tests it with <code>r.match(domain)</code> after a blocklist hit. Python&#8217;s <code>match</code> is anchored at the start of the name, not at the end. The name is lower-cased and its trailing dot removed first.</li>
<li>When a CNAME target is blocked, the same function also tests the original name (<code>r.match(orig)</code>), so an allowlisted name still resolves through a blocked alias. That original name comes from Unbound with its trailing dot, <code>www.example.com.</code>, and is not cleaned. A pattern ending in a bare <code>$</code> fails there; <code>\.?$</code> passes on both paths.</li>
<li><code>src/opnsense/mvc/app/controllers/OPNsense/Unbound/Api/SettingsController.php</code>, <code>updateBlocklistAction</code>, is what the Allow button in Reporting calls. It removes a trailing dot (<code>rtrim($domain, '.')</code>) and saves the name as it is, unescaped and unanchored.</li>
</ul>
<p>OPNsense&#8217;s manual describes an allowlist entry as excluding blocklist items that contain the pattern. The code is narrower at the start, since it matches only from the first character, and just as open at the end. Under either reading, anchoring the end is left to the person writing the entry. I compared the same five files in the newest 26.7 release and in the development branch: the allowlist code is unchanged.</p>
<p>What the tests show: how the parser and the matching calls in the 26.7 source treat these entries, run outside a router, with the CNAME case simulated by adding the trailing dot; and, on my router, the tester&#8217;s verdict for each phishing name I tried, beside a control that differs only in not beginning with an allowlisted name, before and after the rewrite. The tester runs the same matching code on the lists the router has loaded, but only for a direct lookup, so it cannot show the CNAME path. The count of 43 names comes from the published lists, not from the router; all 43 are on TIF.</p>
</details>
<h3>How to check yours</h3>
<p>Four checks, all read-only until the last one:</p>
<ol>
<li>Read the resolver log for lists that failed to download and allowlist entries that were skipped.</li>
<li>In the blocklist tester, try a name that should be blocked and one that should pass, to see that the lists are loaded.</li>
<li>For each allowlist entry, test the entry followed by a domain your lists block, then the same name with <code>www.</code> in front. If the first passes and the second is blocked, the entry is open.</li>
<li>Rewrite each open entry anchored, apply, and test again.</li>
</ol>
<p>The click-by-click steps for checks 1 to 3 and for the rewrite are in the two deep dives below. They start from the sign-in page and say what each step changes.</p>
<details>
<summary>Deep dive: step by step, checking your allowlist</summary>
<p><strong>Before you start.</strong> You need a browser on a computer in your network, and the address and login of your router&#8217;s settings page. Steps 1 to 8 only read: they change nothing on the router, so you can stop at any point without undoing anything. Allow about ten minutes, plus about ten seconds for each test, because the tester loads the whole blocklist every time.</p>
<ol>
<li>Open a browser and enter the address you use to sign in to OPNsense. Sign in. You should see the Lobby page. If the page does not load, check that the computer is on your home network and that you used the same address as for any other change to the router.</li>
<li>In the menu on the left, click <strong>Services</strong>, then <strong>Unbound DNS</strong>, then <strong>Log File</strong>. You should see a table with the columns Date, Severity, Process and Line. Above it are a search box, a severity box (set to Warning) and a time box (set to Last day).</li>
<li>Click the search box, type <code>blocklist</code> and press Enter. Two kinds of line matter. &#8220;unable to download blocklist&#8221; means a list failed to load and contributes nothing. &#8220;skip invalid whitelist exclude pattern&#8221; means OPNsense dropped an allowlist entry. If the table is empty, nothing at Warning level was logged in the last day. Open the severity box and tick <strong>Informational</strong> as well to see the &#8220;blocklist loaded&#8221; lines; open the time box to look further back.</li>
<li>In the same menu click <strong>Blocklists</strong>, then the <strong>Tester</strong> tab at the top of the page. You should see a Domain box, a Source box and a <strong>Test</strong> button. Leave Source empty; the test then runs as the router itself. Source takes a device&#8217;s address, and matters only if you have a policy that applies to certain devices.</li>
<li>Type <code>googleads.g.doubleclick.net</code> in Domain and click <strong>Test</strong>. Wait about ten seconds. The result should be Block. Then test <code>www.youtube.com</code>; it should be Pass. If the first name passes, no list is loaded, or the name is on your own allowlist: go back to step 3 and read the errors, and if you have allowlisted that name, pick another name your lists block. The tester does not follow CNAMEs. A CNAME is a name that points to another name; the tester checks only the name you type.</li>
<li>Click the <strong>Blocklists</strong> tab. At the right end of your policy&#8217;s row, click the pencil (Edit). A window titled <strong>Edit Blocklist</strong> opens. <strong>Allowlist Domains</strong> shows your entries, one tag each. Read them, then click <strong>Cancel</strong>. Nothing is saved.</li>
<li>For each entry, test the entry followed by a domain your lists block. A name my lists block is <code>googleads.g.doubleclick.net</code>, the one from step 5. If yours do not block it, pick a name they do. So for an entry <code>example.com</code>, type <code>example.com.googleads.g.doubleclick.net</code> and click <strong>Test</strong>. Then test the same name with <code>www.</code> in front, <code>www.example.com.googleads.g.doubleclick.net</code>. If you load TIF, you can use a name from that list instead. An entry that already starts with <code>^</code> and ends with <code>$</code> is anchored; skip it.</li>
<li>Read the two results together. If the first passes and the second is blocked, the entry is open: it lets through every name that begins with it. Rewrite it anchored. A name that no list blocks passes whatever the allowlist says, so confirm in the tester that the name is blocked before you read a Pass as a fault.</li>
</ol>
</details>
<details>
<summary>Deep dive: step by step, rewriting your allowlist</summary>
<p><strong>Before you start.</strong> This changes your router&#8217;s filtering. Allow fifteen minutes. A mistake here most often shows as one allowed site failing to load. The rest of your internet should keep working. The router applies the change in about a minute (43 seconds on mine) and does not restart Unbound; the log shows the lists loading into the running process. Step 3 saves a copy of your old entries, and step 8 puts them back.</p>
<ol>
<li>Open the router&#8217;s settings page and sign in. Click <strong>Services</strong>, then <strong>Unbound DNS</strong>, then <strong>Blocklists</strong>.</li>
<li>At the right end of your policy&#8217;s row, click the pencil (Edit). The <strong>Edit Blocklist</strong> window opens. Under <strong>Allowlist Domains</strong>, click <strong>Text</strong>, the small link under the box. The tags turn into a plain box with one entry per line, and a <strong>Back</strong> link appears. If you have more than one policy, each has its own allowlist; do this for each.</li>
<li>Make the undo copy. Click inside the box, press <code>Ctrl</code> + <code>A</code>, then <code>Ctrl</code> + <code>C</code>. Open Notepad (Start menu, type <code>notepad</code>, press Enter), press <code>Ctrl</code> + <code>V</code>, and save the file as <code>allowlist-before.txt</code> in a folder you will find again. The file should hold one entry per line.</li>
<li>
<p>Rewrite each line in the box. This is for plain names; an entry that is already a pattern, such as one containing <code>(.*\.)?</code>, stays as it is. Write the exact name your devices ask for. Put a <code>\</code> before every dot, <code>^</code> at the start and <code>\.?$</code> at the end:</p>
<ul>
<li><code>example.in</code> becomes <code>^example\.in\.?$</code></li>
<li><code>www.example.com</code> becomes <code>^www\.example\.com\.?$</code></li>
</ul>
<p>Keep one entry per line, with no spaces and no commas. A name with <code>www.</code> and the same name without it are two names and need two lines. If you are not sure which one a device asks for, look in <strong>Reporting</strong>, <strong>Unbound DNS</strong>, or put both on the list.</p>
</li>
<li>
<p>Click <strong>Back</strong>. The lines return as tags. Check that every tag has the new form. Click <strong>Save</strong>. The window closes.</p>
</li>
<li>Click <strong>Apply</strong>, the orange button under the table. Wait about a minute.</li>
<li>Check the result. Open <strong>Services</strong>, <strong>Unbound DNS</strong>, <strong>Log File</strong>, search for <code>blocklist</code>, and tick <strong>Informational</strong> in the severity box. You should see &#8220;updating blocklist&#8221;, then &#8220;blocklist loaded. length is&#8221; and a number, and no &#8220;skip invalid&#8221; line. Then repeat the tester steps from above: the lookalike names should now be Block. An entry that allows a name a list blocks (on mine, one for a Google ad host) should still be Pass.</li>
<li>If a site stops loading after the change, undo it. Open <code>allowlist-before.txt</code> in Notepad, press <code>Ctrl</code> + <code>A</code>, then <code>Ctrl</code> + <code>C</code>. In the router, repeat steps 1 and 2, click inside the box, press <code>Ctrl</code> + <code>A</code>, then <code>Ctrl</code> + <code>V</code> to paste the old entries over the new ones, click <strong>Back</strong>, <strong>Save</strong> and <strong>Apply</strong>. A site that needs a name you did not list is blocked until you add that exact name.</li>
</ol>
</details>
<details>
<summary>Deep dive: testing an allowlist change from a computer</summary>
<p><strong>Before you start.</strong> This is for a Windows PC in the same network as the router. It asks the router&#8217;s DNS for one name and clears the PC&#8217;s own DNS cache; it changes nothing else. It takes two minutes. On a Mac or Linux the idea is the same (<code>nslookup name router-address</code>), but the cache-clearing command differs.</p>
<ol>
<li>Click the Start menu, type <code>powershell</code> and press Enter. A window opens with a prompt that starts with <code>PS</code>.</li>
<li>
<p>Find the router&#8217;s address. Type this and press Enter:</p>
<div class="sf-box" data-mode="one" data-shell="ps" data-effect="read" data-where="PowerShell on your PC"><pre><code>ipconfig</code></pre></div>
<p class="sf-after">Look for <strong>Default Gateway</strong> under the adapter you are using. That address is your router; the steps below call it <code>&lt;router-ip&gt;</code>. If your router sits behind another router, the default gateway may be that other device; use the address of the box that runs your DNS blocklists. If the line is empty, you are looking at an adapter that is not connected; scroll to the next one.</p>
</li>
<li>
<p>After you click <strong>Apply</strong> on the router and wait a minute, clear the PC&#8217;s cache. Blocked answers carry a one-hour lifetime, so without this the PC may keep an old answer:</p>
<div class="sf-box" data-mode="one" data-shell="ps" data-effect="change" data-effect-text="only clears the PC&#x27;s DNS cache" data-where="PowerShell on your PC"><pre><code>ipconfig /flushdns</code></pre></div>
</li>
<li>
<p>Ask the router for the name, replacing <code>&lt;router-ip&gt;</code> with the address from step 2. The final dot after the name stops Windows trying its search suffixes first:</p>
<div class="sf-box" data-mode="one" data-shell="ps" data-effect="read" data-where="PowerShell on your PC"><pre><code>nslookup www.example.com. &lt;router-ip&gt;</code></pre></div>
<p class="sf-after">A blocked name answers <code>0.0.0.0</code>, or &#8220;Non-existent domain&#8221; if Return NXDOMAIN is ticked on the policy. A name that is allowed answers with its real address. The first two lines show your router; the rest is the answer.</p>
</li>
</ol>
</details>
<h3>What eighteen lists added up to</h3>
<p>In the router&#8217;s resolver log, from its first entry until the first clean-up, every full nightly update was set to load the same eighteen lists (ThreatFox among them, see below):</p>
<ul>
<li>Hagezi Normal, plus the Mini versions of Pro, Pro++ and Ultimate</li>
<li>Threat Intelligence Feeds (TIF) in all three sizes: full, Medium and Mini</li>
<li>Gambling in all three sizes</li>
<li>Fake, Pop-Up Ads, Badware Hoster, DynDNS, Anti Piracy and &#8220;Safesearch not supported&#8221;</li>
<li>OISD NSFW and Abuse.ch ThreatFox</li>
</ul>
<p>Hagezi, who maintains most of these, gives these rules for combining his lists in his FAQ:</p>
<ol>
<li>The five Multi lists — Light, Normal, Pro, Pro++ and Ultimate — build on each other. Each contains the one below it. You pick one.</li>
<li>The size-optimised versions (Mini, and Medium for TIF and Gambling) are alternatives to their full list. They do not go on top of it.</li>
<li>TIF is the exception. It covers malware, cryptojacking, scams, spam and phishing and is meant to run alongside whichever tier you pick.</li>
</ol>
<p>The Pro, Pro++, Ultimate and Gambling Minis keep only the names that also appear on lists of the most-visited domains. TIF Mini and Gambling Mini are cut from the Medium list. Hagezi describes the Minis as made for blockers on devices with limited memory.</p>
<details>
<summary>Deep dive: which tier for whom, and what Ultimate costs</summary>
<p>Hagezi&#8217;s FAQ matches the tiers to the person who will deal with breakage:</p>
<table>
<thead>
<tr>
<th>Tier</th>
<th>For</th>
<th>Risk of breakage (Hagezi&#8217;s rating)</th>
</tr>
</thead>
<tbody>
<tr>
<td>Light</td>
<td>a blocker that cannot handle big lists, or a setting where even Normal is too much</td>
<td>minimal</td>
</tr>
<tr>
<td>Normal</td>
<td>unattended setups with no admin to unblock things</td>
<td>low</td>
</tr>
<tr>
<td>Pro</td>
<td>someone can unblock things; his default recommendation, with TIF</td>
<td>low to moderate</td>
</tr>
<tr>
<td>Pro++</td>
<td>experienced users with an admin</td>
<td>moderate</td>
</tr>
<tr>
<td>Ultimate</td>
<td>very experienced users with an admin available</td>
<td>high</td>
</tr>
</tbody>
</table>
<p>Each tier also carries a share of the native tracker lists: the telemetry built into TVs, phones and operating systems. Pro++ blocks nearly all of it; Ultimate blocks all of it. The README lists what Ultimate costs: some Facebook and Messenger functions, WhatsApp extras such as avatars and video effects, Windows Spotlight and Xbox achievement history, and location trackers some sites rely on, which can bring wrong regional settings and more CAPTCHAs.</p>
</details>
<p>My set broke the first two rules. I downloaded the lists once for this check and compared them name by name, to see which entries one list already blocks in another. I do not have the copies the router loaded earlier, and I did not measure ThreatFox, so seventeen lists were measured.</p>
<p>Seven of the seventeen were covered by the rest of the set, apart from each list&#8217;s one marker entry: Pro Mini, Pro++ Mini, TIF Medium, TIF Mini, Gambling Medium, Gambling Mini and Fake. Dropping all seven together would have lost 15 names that TIF Medium and Mini carry and the full TIF does not. Pop-Up Ads added 37 names of its 48,277 to the rest of the set (against Pro++ alone it adds three, below). DynDNS and Anti Piracy were different: on those lists they carried about 1,200 and about 55,000 names that no other list in the set did, and I dropped them by choice, not as duplicates.</p>
<p>The four tier lists together held 233,710 names, all but Hagezi&#8217;s four marker entries in Ultimate. Against Pro++ on its own, they missed 31,411 Pro++ entries, the ones not on the most-visited lists. In their place they carried 25,040 entries that only Ultimate blocks (25,041 with the Ultimate Mini marker), all from the most-visited lists. Hagezi rates Ultimate&#8217;s risk of breakage high. I kept no record of breakage from them and did not test for it, but by Hagezi&#8217;s rating the mix took on Ultimate&#8217;s risk and lacked Pro++&#8217;s coverage.</p>
<details>
<summary>Deep dive: how I measured, and why a plain comparison gets it wrong</summary>
<p>OPNsense uses Hagezi&#8217;s wildcard format, where a line such as <code>*.example.com</code> blocks example.com and every name under it. So an entry in list A is already blocked by list B if B holds the entry or any of its parent domains.</p>
<p>A plain text comparison misses that. <code>comm</code> reports 3,294 Pro++ Mini entries that are &#8220;not in&#8221; Ultimate Mini. All but one of them are covered, because Ultimate Mini blocks a parent domain instead. It has one line for the whole of <code>omtrdc.net</code>, an Adobe tracking domain, where Pro++ Mini lists 998 of its hosts one by one. The one left over is Hagezi&#8217;s marker entry, explained below.</p>
<p>The four tier lists, measured the same way:</p>
<table>
<thead>
<tr>
<th>Normal + Pro Mini + Pro++ Mini + Ultimate Mini</th>
<th></th>
</tr>
</thead>
<tbody>
<tr>
<td>Unique names</td>
<td>233,710</td>
</tr>
<tr>
<td>Of those, also in Ultimate</td>
<td>all but 4 (Hagezi&#8217;s marker entries)</td>
</tr>
<tr>
<td>Pro++ entries missing from the mix</td>
<td>31,411 of 223,551</td>
</tr>
<tr>
<td>Names in the mix that only Ultimate blocks</td>
<td>25,040</td>
</tr>
</tbody>
</table>
<p>The check I used walks up the parent domains. It is a Python 3 script with nothing to install beyond Python itself. The script comes first; the steps after it say how to save and run it.</p>
<div class="sf-box" data-mode="file" data-where="File: hagezi_overlap.py"><pre><code>#!/usr/bin/env python3
"""hagezi_overlap.py - how much of blocklist A is already blocked by blocklist B.

Reads two Hagezi lists in the wildcard format (the /wildcard/ files, the format
OPNsense uses). A line "*.example.com" blocks example.com and every name under
it, so an entry of A counts as covered when the entry itself, or one of its
parent domains, is in B. A plain text comparison (comm, diff) misses that and
reports too many differences.

Usage:  python3 hagezi_overlap.py A.txt B.txt
Author: Vivek Sanghi. Licence: CC BY-NC-SA 4.0, as the blog.
"""
import re
import sys

WILDCARD = re.compile(r"^\*\.[a-z0-9_-]+(\.[a-z0-9_-]+)+$")


def load(path):
    names = set()
    try:
        f = open(path, encoding="utf-8-sig")
    except OSError as e:
        sys.exit(f"{path}: cannot open ({e.strerror})")
    with f:
        for number, line in enumerate(f, 1):
            line = line.strip().lower()
            if not line or line.startswith("#"):
                continue
            if not WILDCARD.match(line):
                sys.exit(f"{path}, line {number}: not a wildcard-format line "
                         "('*.example.com'). Download the /wildcard/ version of the list.")
            names.add(line[2:])
    if not names:
        sys.exit(f"{path}: no entries found; check the download")
    return names


def covered(name, blocked):
    while True:
        if name in blocked:
            return True
        if "." not in name:
            return False
        name = name.split(".", 1)[1]


def main():
    if len(sys.argv) != 3:
        sys.exit("usage: hagezi_overlap.py A.txt B.txt")
    a, b = load(sys.argv[1]), load(sys.argv[2])
    missing = sorted(n for n in a if not covered(n, b))
    print(f"{sys.argv[1]}: {len(a):,} entries; {len(a) - len(missing):,} already "
          f"blocked by {sys.argv[2]}; {len(missing):,} not")
    for n in missing[:10]:
        print(f"  not covered: {n}")
    if len(missing) &gt; 10:
        print(f"  ... and {len(missing) - 10:,} more")


if __name__ == "__main__":
    main()
</code></pre></div>
<p><strong>Before you start.</strong> This is for a Windows PC. You need Python 3 (step 3 checks). The steps create one folder in your user folder, download two list files of a few megabytes into it, and read them; they change nothing else. Allow ten minutes. To undo, delete the folder in File Explorer. On a Mac or Linux, use Terminal, <code>python3</code> instead of <code>py</code>, and <code>curl</code> instead of <code>curl.exe</code>.</p>
<ol>
<li>Click the Start menu, type <code>powershell</code> and press Enter. A window opens with a prompt that starts with <code>PS</code>.</li>
<li>
<p>Make a folder and move into it. Each line takes a moment; run them one at a time:</p>
<div class="sf-box" data-mode="each" data-shell="ps" data-effect="change" data-effect-text="creates one folder" data-where="PowerShell on your PC"><pre><code>mkdir hagezi-check
cd hagezi-check</code></pre></div>
<p class="sf-after">The prompt should now end with <code>hagezi-check</code>. If the first line says the folder already exists, pick another name and use it in both lines.</p>
</li>
<li>
<p>Check that Python is installed:</p>
<div class="sf-box" data-mode="one" data-shell="ps" data-effect="read" data-where="PowerShell on your PC"><pre><code>py --version</code></pre></div>
<p class="sf-after">You should see a line such as <code>Python 3.12.4</code>. If PowerShell says it does not recognise <code>py</code>, install Python 3 from python.org (tick &#8220;Add python.exe to PATH&#8221; in the installer), close PowerShell and start again at step 1.</p>
</li>
<li>
<p>Create the script file. This opens Notepad:</p>
<div class="sf-box" data-mode="one" data-shell="ps" data-effect="change" data-effect-text="creates one file" data-where="PowerShell on your PC"><pre><code>notepad hagezi_overlap.py</code></pre></div>
<p class="sf-after">Notepad asks whether to create a new file; click <strong>Yes</strong>. Paste the script from the box above (click <strong>Copy</strong> on the box, then <code>Ctrl</code> + <code>V</code> in Notepad), press <code>Ctrl</code> + <code>S</code>, and close Notepad. If Notepad opens without asking, save with <strong>File</strong>, <strong>Save as</strong>, type <code>hagezi_overlap.py</code> in quotation marks as the file name, make sure the folder is <code>hagezi-check</code>, and click <strong>Save</strong>.</p>
</li>
<li>
<p>Download two lists into the folder. On Windows, type <code>curl.exe</code>, not <code>curl</code>, in PowerShell. Run the lines one at a time:</p>
<div class="sf-box" data-mode="each" data-shell="ps" data-effect="change" data-effect-text="downloads two files" data-where="PowerShell on your PC"><pre><code>curl.exe -o pro.plus.mini.txt https://cdn.jsdelivr.net/gh/hagezi/dns-blocklists@latest/wildcard/pro.plus.mini.txt
curl.exe -o ultimate.mini.txt https://cdn.jsdelivr.net/gh/hagezi/dns-blocklists@latest/wildcard/ultimate.mini.txt</code></pre></div>
<p class="sf-after">Each takes a few seconds and prints a progress table. If a line ends with an error, check the connection and run that line again.</p>
</li>
<li>
<p>Run the check:</p>
<div class="sf-box" data-mode="one" data-shell="ps" data-effect="read" data-where="PowerShell on your PC"><pre><code>py hagezi_overlap.py pro.plus.mini.txt ultimate.mini.txt</code></pre></div>
</li>
<li>
<p>On the lists I downloaded for this check it printed:</p>
<div class="sf-box" data-mode="output" data-where="What you should see"><pre><code>pro.plus.mini.txt: 98,704 entries; 98,703 already blocked by ultimate.mini.txt; 1 not
  not covered: h4g3z1-pro-plus-mini.web.app</code></pre></div>
<p class="sf-after">Your numbers will differ, because the lists change daily. If you see a message instead of numbers, the script stopped on purpose: read the message, since it names the file and the line.</p>
</li>
</ol>
<p>The one name left over in each comparison is a marker Hagezi puts in every list (<code>h4g3z1-&lt;list&gt;.web.app</code>), so you can tell which list is loaded. If a download fails, or the file is in another format, the script stops and says so instead of reporting a number.</p>
<p>What else it gave, on the same lists:</p>
<table>
<thead>
<tr>
<th>List A</th>
<th>List B</th>
<th>Entries of A already blocked by B</th>
</tr>
</thead>
<tbody>
<tr>
<td>Normal (171,454)</td>
<td>Pro++</td>
<td>all but the marker</td>
</tr>
<tr>
<td>Pro++ (223,551)</td>
<td>Ultimate</td>
<td>all but the marker</td>
</tr>
<tr>
<td>Pro Mini (86,842)</td>
<td>Ultimate Mini</td>
<td>all but the marker</td>
</tr>
<tr>
<td>TIF Mini (212,777)</td>
<td>TIF Medium</td>
<td>all but the marker</td>
</tr>
<tr>
<td>Gambling Mini (118,888)</td>
<td>Gambling Medium</td>
<td>all but the marker</td>
</tr>
<tr>
<td>Fake (17,622)</td>
<td>Pro++</td>
<td>all but the marker</td>
</tr>
<tr>
<td>Pop-Up Ads (48,277)</td>
<td>Pro++</td>
<td>all but 4 (the marker and 3 others)</td>
</tr>
<tr>
<td>Badware Hoster (1,088)</td>
<td>Pro++</td>
<td>966</td>
</tr>
<tr>
<td>Ultimate Mini (120,458)</td>
<td>Pro++</td>
<td>95,417</td>
</tr>
</tbody>
</table>
<p>The script was tested on these lists and on a missing file, an empty file, a comments-only file, a failed download, a web page, and lists in the adblock, hosts and plain-domain formats.</p>
</details>
<p>The count of names loaded did not follow my changes. On the day of the first clean-up the router loaded 2,840,117 names before it and 3,188,234 after it, with ten lists instead of eighteen: between two downloads that day, TIF had grown by 426,519 entries. With no change on my side, the count then moved from 2,739,044 to 3,229,041 in four days. On the list sizes I downloaded for this check, about two-thirds of the names were on TIF and about 7 per cent on Pro++.</p>
<details>
<summary>Deep dive: the router&#8217;s figures, with their caveats</summary>
<p>Names loaded, from the router&#8217;s log (&#8220;blocklist loaded. length is …&#8221;, the number of unique names):</p>
<table>
<thead>
<tr>
<th>When</th>
<th>Lists</th>
<th>Names loaded</th>
</tr>
</thead>
<tbody>
<tr>
<td>First clean-up day, before</td>
<td>the eighteen</td>
<td>2,840,117</td>
</tr>
<tr>
<td>First clean-up day, after</td>
<td>the new set</td>
<td>3,188,234</td>
</tr>
<tr>
<td>Five days later</td>
<td>same set</td>
<td>2,739,044</td>
</tr>
<tr>
<td>Nine days later</td>
<td>same set</td>
<td>3,229,041</td>
</tr>
<tr>
<td>Eighteen days later</td>
<td>same set</td>
<td>3,198,953</td>
</tr>
</tbody>
</table>
<p>Share of queries blocked, from Reporting → Unbound DNS:</p>
<table>
<thead>
<tr>
<th>Window</th>
<th>Queries</th>
<th>Blocked</th>
</tr>
</thead>
<tbody>
<tr>
<td>First clean-up day, as read that day</td>
<td>not recorded</td>
<td>12.9 per cent</td>
</tr>
<tr>
<td>A window of about 38 hours, read later</td>
<td>110,248</td>
<td>8,600 (7.80 per cent)</td>
</tr>
</tbody>
</table>
<p>The two percentages cover different lists, different days and whatever the network happened to be doing. They are not a before and after.</p>
</details>
<h3>What I tick now</h3>
<p>My router&#8217;s settings show:</p>
<ul>
<li>Hagezi Pro++ (full)</li>
<li>TIF (full)</li>
<li>Gambling (full)</li>
<li>Fake, Pop-Up Ads, Badware Hoster and &#8220;Safesearch not supported&#8221;</li>
<li>OISD NSFW</li>
<li>two Hagezi lists by URL: encrypted-DNS servers and LG TV trackers</li>
<li>Abuse.ch ThreatFox, by URL, with a free key (below)</li>
</ul>
<p>I chose Pro++ over Hagezi&#8217;s recommended Pro for device trackers, since Pro++ is where he blocks nearly all of them.</p>
<p>Two of these are duplicates. Hagezi&#8217;s cheat sheet marks Fake and Pop-Up Ads as inside Pro++. For Fake the measurement agrees, and it can come off with no change to what is blocked. Pop-Up Ads has three names, on the lists I downloaded, that none of Pro++, TIF, Gambling, Hoster or Fake carries; dropping it costs those three. I did not compare ThreatFox or the two URL lists. Fake and Pop-Up Ads are both still ticked.</p>
<p>ThreatFox stopped downloading and now downloads again. Each update had logged &#8220;unable to download blocklist … and no cache available&#8221;. The address OPNsense&#8217;s built-in entry used for it answers &#8220;410 Gone&#8221;, and abuse.ch&#8217;s export page asks for an Auth-Key before it gives out the host file. A later 26.7 release removed the built-in entry for that reason and points users to &#8220;URLs of Blocklists&#8221;. abuse.ch issues the key free through its authentication portal. I added the list by URL with the key in the address. abuse.ch&#8217;s export page asks for the key in the URL, and OPNsense&#8217;s downloader sends no headers. The steps below show the form of the address. The update that added it logged &#8220;blocklist download&#8221; with 28,889 lines for it, 28,869 of them names, and no error; the other lists loaded from cache in that update. By the router&#8217;s own count of loaded names, it rose from 2,765,172 to 2,782,246. So 17,074 of the 28,869 were not already loaded under that exact name, and about 11,800 were. The count compares names literally, so a name whose parent domain another list already blocks counts as new. Hagezi does not name ThreatFox as a source.</p>
<p>The key works like a password. The router stores it in its configuration, and each update writes the address, key included, to the resolver log. Keep it out of screenshots, shared logs, configuration backups and any remote log server that leave your hands. If it has leaked, get a new key from the same portal and change the address.</p>
<details>
<summary>Deep dive: adding ThreatFox with a key</summary>
<p><strong>Before you start.</strong> This adds one list to your policy. Allow ten minutes. Nothing is deleted. To undo it, remove the address from the same box and apply again.</p>
<ol>
<li>In a browser, open <code>https://auth.abuse.ch</code>, create an account if you have none, and get an Auth-Key. The key is free. Copy it into a text file only until step 4, where you paste it once, then delete the file.</li>
<li>Log in to the router. Click <strong>Services</strong>, then <strong>Unbound DNS</strong>, then <strong>Blocklists</strong>.</li>
<li>At the right end of your policy&#8217;s row, click the pencil (Edit). A window titled <strong>Edit Blocklist</strong> opens.</li>
<li>
<p>Click inside <strong>URLs of Blocklists</strong> and type the address below, with your key in place of <code>YOUR_KEY</code> and no spaces. Press Enter so it becomes a tag of its own (a tag is one entry shown as a small box in the field):</p>
<div class="sf-box" data-mode="file" data-where="ThreatFox list address (an example, not a command)" data-how="paste it into the URLs of Blocklists field, with your key in place of YOUR_KEY"><pre><code>https://threatfox-api.abuse.ch/v2/files/exports/YOUR_KEY/hostfile.txt</code></pre></div>
<p class="sf-after">The key sits between <code>exports/</code> and <code>/hostfile.txt</code>.</p>
</li>
<li>
<p>Click <strong>Save</strong>, then <strong>Apply</strong>. The router downloads the lists again; allow a minute or two.</p>
</li>
<li>Click <strong>Services</strong>, <strong>Unbound DNS</strong>, <strong>Log File</strong>, search for <code>download</code>, and tick <strong>Informational</strong> in the severity box. You should see &#8220;blocklist download:&#8221; and a number of lines for the ThreatFox address. If the line says &#8220;unable to download&#8221;, check the key and the address for a stray space.</li>
<li>Do not share that screen: the line shows the address with your key.</li>
</ol>
</details>
<details>
<summary>Deep dive: Badware Hoster and the two lists added by URL</summary>
<p>Badware Hoster is a standalone Hagezi list, and 966 of its 1,088 entries are already in Pro++. The rest blocks whole hosting providers that keep turning up in threat feeds. Hagezi warns that legitimate sites on those hosts are blocked with them, and leaves unblocking them to whoever runs the list.</p>
<p>The two lists added by URL are Hagezi&#8217;s, in the wildcard format:</p>
<div class="sf-box" data-mode="file" data-where="Two Hagezi list addresses" data-how="one address per line; shown for reference, nothing to run"><pre><code>https://cdn.jsdelivr.net/gh/hagezi/dns-blocklists@latest/wildcard/doh.txt
https://cdn.jsdelivr.net/gh/hagezi/dns-blocklists@latest/wildcard/native.lgwebos.txt</code></pre></div>
<p>The first lists encrypted-DNS servers by name, part of stopping devices from going around the router. The second lists LG webOS ad and tracking servers. Each has its own story, for separate posts.</p>
<p>The built-in Hagezi tick-boxes in OPNsense 26.7 download from Hagezi&#8217;s mirror, <code>hagezi-mirror.dnsbunker.org</code>, as the log shows. Hagezi says that mirror publishes a new build roughly every four to eight hours; the jsDelivr copies update once a day.</p>
</details>
<h3>What DNS cannot block</h3>
<p>In-app YouTube and Instagram ads come from the same domains as the videos and posts, so blocking them by name would block the content. Hagezi&#8217;s FAQ makes the general point: some ads load from the same domains as the content, and a content blocker in the browser, or an app-level blocker on a phone, is the layer that catches them. I accepted the in-app ads.</p>
<p>A DNS blocklist also filters only the devices that ask the router; devices with their own encrypted or hard-coded DNS go around it. That is a separate post.</p>
<h3>How this was done</h3>
<p>Claude read the documentation and the lists, compared them, and read my router through my logged-in browser session: settings, the resolver log and the tester. I decided what to change. In the allowlist session the only change on the router was the allowlist rewrite.</p>
<p>The model got things wrong. The bare-name allowlist fix came out of the first session, and in one of the sessions it also told me the nightly blocklist update flushes Unbound&#8217;s cache. The router&#8217;s log showed the update loading the lists into the running Unbound, with no restart. The manual says applying blocklist settings does not restart Unbound, and the source loads the new list into the running process. The flush setting applies only when Unbound stops.</p>
<p>A model with a logged-in session on a router is a risk of its own. The resolver log it reads holds names that any website can make a device look up, and a name can carry text written to steer a model. In the allowlist session I kept it to reading, apart from the allowlist change. That is an instruction to the model, not a control; a read-only OPNsense user would be one. The resolver log also holds the ThreatFox address with its key, so a session that reads the log sees the key. If you let a model read that log, replace the key afterwards.</p>
<p>In the first session I also changed five Unbound settings and one cron job. The router shows all six as set.</p>
<details>
<summary>Deep dive: each setting, and how to undo DNS over TLS</summary>
<table>
<thead>
<tr>
<th>Setting (page)</th>
<th>Before</th>
<th>After</th>
</tr>
</thead>
<tbody>
<tr>
<td>Flush DNS Cache during reload (General)</td>
<td>on</td>
<td>off</td>
</tr>
<tr>
<td>Prefetch Support (Advanced)</td>
<td>off</td>
<td>on</td>
</tr>
<tr>
<td>Serve Expired Responses (Advanced)</td>
<td>off</td>
<td>on; TTL for Expired Responses 86,400 s</td>
</tr>
<tr>
<td>Use System Nameservers (Query Forwarding)</td>
<td>on</td>
<td>off</td>
</tr>
<tr>
<td>DNS over TLS forwarders</td>
<td>none</td>
<td>Cloudflare and Quad9</td>
</tr>
<tr>
<td>Blocklist update job (System → Settings → Cron)</td>
<td>a slot shared with other jobs</td>
<td>a slot of its own</td>
</tr>
</tbody>
</table>
<p><strong>Prefetch</strong> refreshes popular entries before they expire. The manual puts the cost at about 10 per cent more DNS traffic.</p>
<p><strong>Serve Expired Responses</strong> answers from cache with an expired record instead of making the device wait. When it is on, more fields appear. &#8220;TTL for Expired Responses&#8221; limits how long after expiry a stale answer may be served; I set 86,400 seconds, the low end of the manual&#8217;s suggested 86,400 to 259,200.</p>
<p>One interaction I have not tested: with cache flushing off and stale answers allowed, a name that a list newly blocks may go on being answered from Unbound&#8217;s cache for a while. If a block does not take effect at once, that is the first thing I would look at.</p>
<p><strong>Use System Nameservers.</strong> The manual says the system nameservers are preferred over any catch-all entry in Query Forwarding and DNS over TLS. Turning it off lets the DNS over TLS entries carry the queries. The four entries, under Services → Unbound DNS → DNS over TLS:</p>
<table>
<thead>
<tr>
<th>Server IP</th>
<th>Port</th>
<th>Verify CN</th>
</tr>
</thead>
<tbody>
<tr>
<td>1.1.1.1</td>
<td>853</td>
<td>cloudflare-dns.com</td>
</tr>
<tr>
<td>1.0.0.1</td>
<td>853</td>
<td>cloudflare-dns.com</td>
</tr>
<tr>
<td>9.9.9.9</td>
<td>853</td>
<td>dns.quad9.net</td>
</tr>
<tr>
<td>149.112.112.112</td>
<td>853</td>
<td>dns.quad9.net</td>
</tr>
</tbody>
</table>
<p>The router&#8217;s own queries to these servers leave encrypted. A firewall rule that rejects port 853 from the LAN, to stop devices using their own encrypted DNS, does not touch them, because they leave from the router itself.</p>
<p><strong>The update time</strong> moved to a slot of its own so the update no longer shares a time with other scheduled jobs.</p>
<p>To undo the DNS over TLS change:</p>
<p><strong>Before you start.</strong> This changes your router&#8217;s DNS settings and takes five minutes. DNS keeps working through the settings that remain. Note the four entries first (the table above); you need them to put the change back.</p>
<ol>
<li>Open the router&#8217;s settings page and sign in. You should see the Lobby page.</li>
<li>Click <strong>Services</strong>, then <strong>Unbound DNS</strong>, then <strong>DNS over TLS</strong>. A table lists the entries.</li>
<li>At the right end of the first row, click the pencil (Edit). A window titled <strong>Edit server</strong> opens. Untick <strong>Enabled</strong> and click <strong>Save</strong>. Do the same for each of the other rows.</li>
<li>At the top of the same page, tick <strong>Use System Nameservers</strong>. The same box appears under <strong>Query Forwarding</strong>; it is one setting.</li>
<li>Click <strong>Apply</strong> at the bottom of the page. Unbound reloads in a few seconds.</li>
<li>Check: from a device on the network, open any website you have not visited today. It should load. If System, Settings, General has no nameservers, Unbound resolves from the root servers itself instead of forwarding; add your provider&#8217;s servers there if you want them used.</li>
<li>To put the change back, tick <strong>Enabled</strong> on each entry again, untick <strong>Use System Nameservers</strong>, and click <strong>Apply</strong>.</li>
</ol>
</details>
<h3>Sources</h3>
<ul>
<li><a href="https://github.com/hagezi/dns-blocklists">Hagezi, dns-blocklists README</a>, <a href="https://github.com/hagezi/dns-blocklists/blob/main/CHEATSHEET.md">cheat sheet</a> and <a href="https://github.com/hagezi/dns-blocklists/blob/main/FAQ.md">FAQ</a></li>
<li><a href="https://docs.opnsense.org/manual/unbound.html">OPNsense manual, Unbound DNS</a></li>
<li><a href="https://github.com/opnsense/core/tree/26.7.7">OPNsense core source code, tag 26.7.7</a>, compared with the newest 26.7 tag</li>
<li><a href="https://github.com/opnsense/core/issues/11091">OPNsense core, issue 11091: ThreatFox blocklist fails with HTTP 410, Auth-Key support required</a></li>
<li><a href="https://threatfox.abuse.ch/export/">abuse.ch ThreatFox, export page</a></li>
<li><a href="https://auth.abuse.ch">abuse.ch authentication portal</a></li>
</ul>
</div>
<div id="hbt-panel-hi" class="hbt-panel" lang="hi">
<h2>वह fix जिसने phishing नाम निकल जाने दिए</h2>
<p class="hbt-note">अंग्रेज़ी मूल से अनुवादित। Commands, code और technical terms अंग्रेज़ी में ही रखे गए हैं।</p>

<p>अक्टूबर के एक शनिवार को मैंने अपने router की DNS allowlist की चार टूटी हुई एंट्री ठीक कीं। दो हफ़्ते से कुछ ज़्यादा बाद मुझे पता चला कि ठीक की गई उन एंट्री ने threat feed के ऐसे नाम निकल जाने दिए, जो उन्हीं साइटों जैसे दिखने के लिए बनाए गए थे जिन्हें मैं allow करना चाहता था: किसी भुगतान वाली साइट का domain, उसके बाद <code>.https.</code> और कोई असंबंधित domain, या किसी दुकान का नाम जिसमें dot की जगह hyphen हो। मेरे router के अपने tester ने इन्हें पास कर दिया।</p>
<p>उसी शाम मैंने अपनी blocklist अठारह से घटाकर दस कर दी थीं; अगले दिन LG TV की एक सूची जुड़ने से ग्यारह हो गईं। इनमें से सात बाकी सेट में पहले से शामिल थीं। जो एक सूची मैंने रखी, Abuse.ch ThreatFox, वह तब download होना बंद हो गई जब abuse.ch ने अपनी host file सिर्फ़ key के साथ देना शुरू किया। मैंने उसके address में एक free key डाली, तब से वह फिर download होती है। और मेरे फ़ोन पर YouTube और Instagram के भीतर के ads पूरे समय आते रहे, जिसे कोई blocklist बदल नहीं सकती थी।</p>
<p>फिर मैंने allowlist की एंट्री दोबारा लिखीं। यह पोस्ट दोनों सफ़ाई के बारे में है: OPNsense allowlist की एंट्री के साथ क्या करता है, अपनी एंट्री कैसे जाँचें, और अठारह आपस में मिलती सूचियों का जोड़ क्या निकला। यह काम मैंने Claude के साथ दो sessions में किया, हर सफ़ाई के लिए एक; ThreatFox की key तीसरे session में डाली गई। उसने मेरे browser के ज़रिए router को पढ़ा; router पर हर बदलाव मेरी मंज़ूरी से हुआ। मैंने bare नाम वाला fix मंज़ूर किया था, इसलिए उस गलती के मामले में मंज़ूरी कोई सुरक्षा नहीं थी।</p>
<aside class="in-short">
<p><strong>संक्षेप में</strong></p>
<ul>
<li>OPNsense में allowlist की एंट्री एक regular expression है, जिसे नाम की शुरुआत से मिलाया जाता है। सिर्फ़ <code>example.com</code> लिखने पर वे सभी नाम भी allow हो जाते हैं जो इन्हीं अक्षरों से शुरू होते हैं, और जिनमें dot की जगह कोई भी अक्षर हो सकता है: <code>example.com.evil.net</code>, <code>example-com.evil.net</code>। पूरा नाम लिखें, anchor के साथ: <code>^www\.example\.com\.?$</code>।</li>
<li>बदलाव के बाद resolver log पढ़ें। जो सूची download नहीं हो पाती, या जो allowlist एंट्री छोड़ दी जाती है, वह वहीं दिखती है, blocklist पेज पर कहीं नहीं।</li>
<li>Hagezi का एक tier चुनें, Light से Ultimate तक, और Threat Intelligence Feeds जोड़ें। जिस router में memory बची हो, उस पर पूरी सूचियाँ लें, Mini versions नहीं।</li>
<li>और जोड़ने से पहले देखें कि आपके tier में पहले से क्या है। Fake, और Pop-Up Ads के तीन नामों को छोड़कर बाकी सब, Pro++ के अंदर हैं।</li>
</ul>
</aside>
<details class="sf-legend"><summary><strong>Command line में नए हैं? इन boxes को कैसे पढ़ें</strong></summary>
<p><strong>PS&gt;</strong> का मतलब है: इसे Windows पर <em>PowerShell</em> में type करें (Start menu → <code>powershell</code> type करें → Enter)। <strong>$</strong> का मतलब है: इसे Linux या Mac के terminal में type करें, या Pi पर <code>ssh</code> से log in करने के बाद। <strong>$</strong> या <strong>PS&gt;</strong> को खुद type न करें।</p>
<p><strong>$</strong> या <strong>PS&gt;</strong> से शुरू होने वाली हर लाइन एक command है। सिर्फ़ उस लाइन को copy करने के लिए उस <strong>$</strong> पर click करें, उसे paste करें, <strong>Enter</strong> दबाएँ, और अगले से पहले उसके पूरा होने का इंतज़ार करें। जिस box के ऊपरी हिस्से में <strong>Copy</strong> button है, वह एक command (या एक file) रखता है, इसलिए उसे पूरा copy करें। डैश वाली रेखाओं (- &#8211; -) से बना box दिखाता है कि आपको जवाब में क्या दिखना चाहिए; उसे आप type नहीं करते।</p>
</details>
<h3>Allowlist</h3>
<p>मेरी blocklist policy की allowlist में 26 एंट्री थीं। पहली सफ़ाई के दिन उनमें से चार टूटी हुई लगीं। तीन browser की address bar से पूरे address के रूप में चिपकाई गई थीं, जैसे <code>https://example.org/</code>। चौथी में नाम के पहले अक्षर से पहले एक space था। मैंने चारों को <code>example.in</code> जैसे bare नामों से बदल दिया। बाकी 22 कैसे लिखी गई थीं, यह मैंने नहीं देखा, और router की configuration history अब इतनी पीछे नहीं जाती कि जाँच हो सके। अगर वे bare नाम थीं, जैसे router का अपना Allow button लिखता है, तो यह कमी मेरे fix से पहले भी थी, और fix ने उसे उन तीन एंट्री तक बढ़ा दिया जो पहले किसी चीज़ से मेल नहीं खाती थीं।</p>
<p>Router के log में पाँचवीं एंट्री दिखी, <code>*.ntp.org</code> के रूप में लिखी हुई, जो अब हटा दी गई है। हर रात के update ने उसके लिए &#8220;skip invalid whitelist exclude pattern&#8221; लिखा था। Python की regular expressions में शुरू का <code>*</code> मान्य नहीं है, इसलिए router हर रात वह एंट्री छोड़ देता था और इसकी सूचना सिर्फ़ log में देता था। जो रूप वही करता है जो मैं चाहता था, वह है <code>(.*\.)?ntp\.org\.?$</code>।</p>
<p>बाद में Claude ने वह code पढ़ा जो allowlist लागू करता है, OPNsense 26.7 में। शुरू के space से कोई नुकसान नहीं हुआ था: code हर एंट्री से space हटा देता है। समस्या bare नामों की थी।</p>
<p>OPNsense हर एंट्री को regular expression मानता है, case-insensitive, और उसे उस नाम की शुरुआत से मिलाता है जो कोई device पूछता है। कुछ भी उसे नाम के अंत से नहीं बाँधता, और बिना escape किया हुआ dot किसी भी अक्षर से मेल खाता है। इसलिए सिर्फ़ <code>example.com</code> लिखने पर <code>example.com</code> allow होता है, पर <code>www.example.com</code> नहीं। साथ ही वह हर उस नाम को allow करता है जो इन्हीं अक्षरों से शुरू हो, हर dot की जगह कोई भी अक्षर रखकर: <code>example.com.evil.net</code>, <code>example-com.evil.net</code>, <code>example.community</code>।</p>
<p>Threat feed में ठीक इसी आकार के नाम हैं: किसी जाने-माने साइट का नाम, उसके बाद <code>.https.</code> और कोई असंबंधित domain, या dot की जगह hyphen वाला साइट का नाम। इस जाँच के लिए मैंने जो feed download किया, उस पर मेरी 26 एंट्री में से सात ऐसे 43 नामों से मेल खाती थीं; एक एंट्री 20 से। मेरे router के tester पर, ऐसे जो पाँच नाम मैंने आज़माए, हर एक पास हुआ, जबकि blocklist की उसी एंट्री से block होने वाला वही नाम, आगे <code>www.</code> लगाकर, block हो गया। मैंने खुद एक नाम बनाया, एक allow की गई साइट और एक ऐसे domain से जिसे threat feed block करता है; वह भी पास हुआ। Matching code के अनुसार, हर bare एंट्री उस हर नाम को allow करती है जो उससे शुरू होता है, चाहे कोई सूची उस नाम को block करे या न करे।</p>
<p>OPNsense का अपना Allow button, Reporting → Unbound DNS में, bare नाम को उसी तरह save करता है। वहाँ से जोड़ी गई एंट्री भी उसी तरह चलती हैं।</p>
<p>इसका हल है ठीक वही नाम allow करना, दोनों सिरों पर anchor के साथ:</p>
<div class="sf-box" data-mode="file" data-where="Allowlist एंट्री (एक उदाहरण, command नहीं)" data-how="इसे Allowlist Domains field में paste करें"><pre><code>^www\.example\.com\.?$</code></pre></div>
<p>Backslash dot को सिर्फ़ dot ही रहने देते हैं, किसी भी अक्षर से मेल खाने वाला नहीं, और <code>$</code> pattern को नाम के अंत से बाँध देता है। <code>\.?</code> वह अंतिम dot allow करता है जो code की जाँच के दो रास्तों में से एक पर नाम में रहता है (गहराई वाला हिस्सा देखें)। <code>^</code> वही दोहराता है जो code पहले से करता है, इसलिए उसे छोड़ने पर भी काम चलेगा; मैं उसे रखता हूँ ताकि pattern कहीं भी एक जैसा दिखे। अपनी एंट्री जाँचने और दोबारा लिखने के steps &#8220;अपनी एंट्री कैसे जाँचें&#8221; के नीचे के &#8216;गहराई में&#8217; वाले हिस्सों में हैं।</p>
<p>किसी domain को उसके सभी subdomains के साथ allow करने के लिए <code>(.*\.)?example\.com\.?$</code> चलता है, पर वह उन hosts को भी allow कर देता है जिन्हें सूची उसी domain के नीचे जान-बूझकर block करती है। मेरी एक एंट्री पर, Pro++ उस domain के नीचे पाँच hosts block करती है, <code>advertising</code> और <code>sponsored-ads</code> जैसे नामों वाले, और domain को या उसके <code>www.</code> नाम को block नहीं करती। पूरे subdomain वाला allow उन्हें वापस आने देगा।</p>
<p>मैंने OPNsense का अपना parsing code और उसकी matching call कुछ नामों पर चलाई:</p>
<table>
<thead>
<tr>
<th>Allowlist एंट्री</th>
<th>पूछा गया नाम</th>
<th>Allow हुआ?</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>https://example.org/</code></td>
<td><code>example.org</code></td>
<td>नहीं</td>
</tr>
<tr>
<td><code>example.in</code></td>
<td><code>example.in</code></td>
<td>हाँ</td>
</tr>
<tr>
<td><code>example.in</code></td>
<td><code>www.example.in</code></td>
<td>नहीं</td>
</tr>
<tr>
<td><code>example.in</code></td>
<td><code>example.in.example.net</code></td>
<td>हाँ</td>
</tr>
<tr>
<td><code>example.in</code></td>
<td><code>example-info.de</code></td>
<td>हाँ</td>
</tr>
<tr>
<td><code>^www\.example\.in\.?$</code></td>
<td><code>www.example.in</code></td>
<td>हाँ</td>
</tr>
<tr>
<td><code>^www\.example\.in\.?$</code></td>
<td><code>advertising.example.in</code></td>
<td>नहीं</td>
</tr>
<tr>
<td><code>^www\.example\.in\.?$</code></td>
<td><code>www.example.in.example.net</code></td>
<td>नहीं</td>
</tr>
</tbody>
</table>
<p>मैंने सभी 26 एंट्री उसी सटीक, anchor वाले रूप में दोबारा लिखीं और बदलाव apply किया। जो हर नाम tester से पास हुआ था, वह बाद में block हुआ। जिस एंट्री का अपना नाम किसी सूची में है, वह आज भी पास होती है, जैसा चाहा था। बाकी 25 के सटीक नाम किसी सूची ने block नहीं किए थे, इसलिए उन एंट्री का अपने नामों के लिए कोई काम नहीं था; उनका एकमात्र असर prefix वाली कमी था। मैंने उन्हें हटाने की जगह anchor किया, क्योंकि कोई सूची बाद में कोई नाम जोड़ सकती है। अगर आपके पास ऐसी एंट्री हैं, तो उन्हें हटाना भी ठीक विकल्प है।</p>
<details>
<summary>गहराई में: code, और मेरे tests क्या दिखाते हैं और क्या नहीं</summary>
<p>Blocklist dialog में एक ही &#8220;Allowlist Domains&#8221; field है। उसके help text में लिखा है कि वह domains लेता है, regular expressions इस्तेमाल हो सकती हैं, और वह सिर्फ़ उसी policy के matches पर लागू होता है। 26.7 में:</p>
<ul>
<li><code>src/opnsense/service/templates/OPNsense/Unbound/core/blocklists.conf</code> इस field को <code>excludes.patterns</code> के रूप में, comma से अलग करके लिखता है।</li>
<li><code>src/opnsense/scripts/unbound/blocklists/default_bl.py</code> उस value को commas पर बाँटता है, हर एंट्री पर <code>strip()</code> बुलाता है, जो एंट्री regular expression के रूप में compile नहीं होती उसे छोड़ देता है (&#8220;skip invalid&#8221; log लाइन के साथ), और बाकी को, एक built-in <code>.*localhost$</code> एंट्री के साथ, <code>|</code> से जोड़कर एक pattern बना देता है।</li>
<li><code>src/opnsense/scripts/unbound-dnsbl/lib/__init__.py</code> pattern को case-insensitive रूप में compile करता है।</li>
<li><code>src/opnsense/scripts/unbound-dnsbl/lib/dnsbl.py</code> blocklist hit के बाद उसे <code>r.match(domain)</code> से जाँचता है। Python का <code>match</code> नाम की शुरुआत पर anchored है, अंत पर नहीं। नाम पहले lower-case किया जाता है और उसका अंतिम dot हटाया जाता है।</li>
<li>जब किसी CNAME target को block किया जाता है, वही function मूल नाम को भी जाँचता है (<code>r.match(orig)</code>), इसलिए allowlist किया हुआ नाम blocked alias के रास्ते भी resolve हो जाता है। वह मूल नाम Unbound से अंतिम dot के साथ आता है, <code>www.example.com.</code>, और साफ़ नहीं किया जाता। सिर्फ़ <code>$</code> पर ख़त्म होने वाला pattern वहाँ fail होता है; <code>\.?$</code> दोनों रास्तों पर पास होता है।</li>
<li><code>src/opnsense/mvc/app/controllers/OPNsense/Unbound/Api/SettingsController.php</code>, <code>updateBlocklistAction</code>, वही है जिसे Reporting का Allow button बुलाता है। वह अंतिम dot हटाता है (<code>rtrim($domain, '.')</code>) और नाम को जैसा है वैसा save कर देता है, बिना escape और बिना anchor के।</li>
</ul>
<p>OPNsense की manual allowlist एंट्री को ऐसा बताती है जो उन blocklist items को बाहर करती है जिनमें pattern आता है। Code शुरुआत पर इससे संकरा है, क्योंकि वह सिर्फ़ पहले अक्षर से मिलाता है, और अंत पर उतना ही खुला है। दोनों तरह पढ़ने पर अंत को anchor करना एंट्री लिखने वाले पर छोड़ा गया है। मैंने यही पाँच files 26.7 की सबसे नई release में और development branch में मिलाईं: allowlist code वैसा ही है।</p>
<p>Tests क्या दिखाते हैं: 26.7 source का parser और matching calls इन एंट्री को कैसे लेते हैं, router के बाहर चलाकर, CNAME वाला मामला अंतिम dot जोड़कर simulate किया हुआ; और, मेरे router पर, मैंने जो हर phishing नाम आज़माया उसके लिए tester का फ़ैसला, एक control के बगल में जो सिर्फ़ इसमें अलग है कि वह allowlist की किसी एंट्री से शुरू नहीं होता, rewrite से पहले और बाद। Tester वही matching code उन सूचियों पर चलाता है जो router ने load की हैं, पर सिर्फ़ सीधे lookup के लिए, इसलिए वह CNAME वाला रास्ता नहीं दिखा सकता। 43 नामों की गिनती प्रकाशित सूचियों से आती है, router से नहीं; सभी 43 TIF पर हैं।</p>
</details>
<h3>अपनी एंट्री कैसे जाँचें</h3>
<p>चार जाँचें, आख़िरी को छोड़कर सब सिर्फ़ पढ़ने वाली:</p>
<ol>
<li>Resolver log में देखें कि कौन-सी सूचियाँ download नहीं हुईं और कौन-सी allowlist एंट्री छोड़ी गईं।</li>
<li>Blocklist tester में एक ऐसा नाम आज़माएँ जो block होना चाहिए और एक जो पास होना चाहिए, ताकि दिखे कि सूचियाँ load हैं।</li>
<li>हर allowlist एंट्री के लिए, एंट्री के बाद ऐसा domain लगाकर test करें जिसे आपकी सूचियाँ block करती हैं, फिर वही नाम आगे <code>www.</code> लगाकर। अगर पहला पास हो और दूसरा block हो, तो एंट्री खुली है।</li>
<li>हर खुली एंट्री को anchor के साथ दोबारा लिखें, apply करें, और फिर test करें।</li>
</ol>
<p>जाँच 1 से 3 और rewrite के click-by-click steps नीचे के दो &#8216;गहराई में&#8217; वाले हिस्सों में हैं। वे sign-in पेज से शुरू होते हैं और बताते हैं कि हर step क्या बदलता है।</p>
<details>
<summary>गहराई में: step by step, अपनी allowlist की जाँच</summary>
<p><strong>शुरू करने से पहले।</strong> आपको अपने network के किसी computer पर एक browser चाहिए, और अपने router के settings पेज का address और login। Steps 1 से 8 सिर्फ़ पढ़ते हैं: वे router पर कुछ नहीं बदलते, इसलिए आप किसी भी जगह रुक सकते हैं, कुछ वापस करने की ज़रूरत नहीं। लगभग दस मिनट रखें, और हर test के लिए लगभग दस सेकंड अलग से, क्योंकि tester हर बार पूरी blocklist load करता है।</p>
<ol>
<li>एक browser खोलें और वह address डालें जिससे आप OPNsense में sign in करते हैं। Sign in करें। आपको Lobby पेज दिखना चाहिए। अगर पेज load न हो, तो देखें कि computer आपके home network पर है और आपने वही address डाला है जो आप router में किसी भी दूसरे बदलाव के लिए डालते हैं।</li>
<li>बाईं ओर के menu में <strong>Services</strong> पर click करें, फिर <strong>Unbound DNS</strong>, फिर <strong>Log File</strong>। आपको एक table दिखेगी जिसके columns Date, Severity, Process और Line हैं। उसके ऊपर एक search box, एक severity box (Warning पर set) और एक time box (Last day पर set) हैं।</li>
<li>Search box में click करें, <code>blocklist</code> type करें और Enter दबाएँ। दो तरह की लाइनें मायने रखती हैं। &#8220;unable to download blocklist&#8221; का मतलब है कि एक सूची load नहीं हुई और उसका कोई योगदान नहीं है। &#8220;skip invalid whitelist exclude pattern&#8221; का मतलब है कि OPNsense ने एक allowlist एंट्री छोड़ दी। अगर table खाली है, तो पिछले एक दिन में Warning level पर कुछ log नहीं हुआ। &#8220;blocklist loaded&#8221; वाली लाइनें देखने के लिए severity box खोलें और <strong>Informational</strong> भी tick करें; और पीछे देखने के लिए time box खोलें।</li>
<li>उसी menu में <strong>Blocklists</strong> पर click करें, फिर पेज के ऊपर <strong>Tester</strong> tab पर। आपको एक Domain box, एक Source box और एक <strong>Test</strong> button दिखेगा। Source खाली छोड़ें; तब test router खुद के रूप में चलता है। Source किसी device का address लेता है, और तभी काम आता है जब आपके पास ऐसी policy हो जो कुछ ही devices पर लागू होती हो।</li>
<li>Domain में <code>googleads.g.doubleclick.net</code> type करें और <strong>Test</strong> पर click करें। लगभग दस सेकंड रुकें। नतीजा Block होना चाहिए। फिर <code>www.youtube.com</code> test करें; वह Pass होना चाहिए। अगर पहला नाम पास हो जाए, तो या कोई सूची load नहीं है, या वह नाम आपकी अपनी allowlist में है: step 3 पर लौटकर errors पढ़ें, और अगर आपने वह नाम allowlist किया है, तो कोई दूसरा नाम चुनें जिसे आपकी सूचियाँ block करती हैं। Tester CNAME को follow नहीं करता। CNAME ऐसा नाम है जो किसी दूसरे नाम की ओर इशारा करता है; tester सिर्फ़ वही नाम जाँचता है जो आप type करते हैं।</li>
<li><strong>Blocklists</strong> tab पर click करें। अपनी policy की row के दाएँ सिरे पर pencil (Edit) पर click करें। <strong>Edit Blocklist</strong> नाम की एक window खुलती है। <strong>Allowlist Domains</strong> में आपकी एंट्री दिखती हैं, हर एक अलग tag के रूप में। उन्हें पढ़ें, फिर <strong>Cancel</strong> पर click करें। कुछ save नहीं होता।</li>
<li>हर एंट्री के लिए, एंट्री के बाद ऐसा domain लगाकर test करें जिसे आपकी सूचियाँ block करती हैं। मेरी सूचियाँ जिस नाम को block करती हैं, वह <code>googleads.g.doubleclick.net</code> है, वही जो step 5 में था। अगर आपकी सूचियाँ उसे block नहीं करतीं, तो कोई ऐसा नाम चुनें जिसे वे करती हैं। इसलिए एंट्री <code>example.com</code> के लिए <code>example.com.googleads.g.doubleclick.net</code> type करें और <strong>Test</strong> पर click करें। फिर वही नाम आगे <code>www.</code> लगाकर test करें, <code>www.example.com.googleads.g.doubleclick.net</code>। अगर आप TIF load करते हैं, तो उसकी जगह उस सूची का कोई नाम इस्तेमाल कर सकते हैं। जो एंट्री पहले से <code>^</code> से शुरू और <code>$</code> पर ख़त्म होती है, वह anchored है; उसे छोड़ दें।</li>
<li>दोनों नतीजे साथ पढ़ें। अगर पहला पास हो और दूसरा block हो, तो एंट्री खुली है: वह हर उस नाम को निकलने देती है जो उससे शुरू होता है। उसे anchor के साथ दोबारा लिखें। जिस नाम को कोई सूची block नहीं करती, वह allowlist चाहे जो कहे, पास होता है, इसलिए Pass को गलती मानने से पहले tester में पक्का कर लें कि नाम block होता है।</li>
</ol>
</details>
<details>
<summary>गहराई में: step by step, अपनी allowlist को दोबारा लिखना</summary>
<p><strong>शुरू करने से पहले।</strong> यह आपके router की filtering बदलता है। पंद्रह मिनट रखें। यहाँ की गलती ज़्यादातर इसी रूप में दिखती है कि एक allow की हुई साइट load नहीं होती। आपका बाकी internet चलता रहना चाहिए। Router बदलाव लगभग एक मिनट में लागू करता है (मेरे router पर 43 सेकंड) और Unbound को restart नहीं करता; log दिखाता है कि सूचियाँ चलते हुए process में load हो रही हैं। Step 3 आपकी पुरानी एंट्री की एक copy save करता है, और step 8 उन्हें वापस रख देता है।</p>
<ol>
<li>Router का settings पेज खोलें और sign in करें। <strong>Services</strong> पर click करें, फिर <strong>Unbound DNS</strong>, फिर <strong>Blocklists</strong>।</li>
<li>अपनी policy की row के दाएँ सिरे पर pencil (Edit) पर click करें। <strong>Edit Blocklist</strong> window खुलती है। <strong>Allowlist Domains</strong> के नीचे, box के नीचे के छोटे link <strong>Text</strong> पर click करें। Tags एक सादे box में बदल जाते हैं जिसमें हर लाइन पर एक एंट्री होती है, और एक <strong>Back</strong> link दिखता है। अगर आपके पास एक से ज़्यादा policy हैं, तो हर एक की अपनी allowlist है; हर एक के लिए यह करें।</li>
<li>Undo copy बनाएँ। Box के अंदर click करें, <code>Ctrl</code> + <code>A</code> दबाएँ, फिर <code>Ctrl</code> + <code>C</code>। Notepad खोलें (Start menu, <code>notepad</code> type करें, Enter दबाएँ), <code>Ctrl</code> + <code>V</code> दबाएँ, और file को <code>allowlist-before.txt</code> नाम से किसी ऐसे folder में save करें जो आपको फिर मिल जाए। File में हर लाइन पर एक एंट्री होनी चाहिए।</li>
<li>
<p>Box की हर लाइन दोबारा लिखें। यह सादे नामों के लिए है; जो एंट्री पहले से pattern है, जैसे जिसमें <code>(.*\.)?</code> हो, वह वैसी ही रहती है। वही सटीक नाम लिखें जो आपके devices पूछते हैं। हर dot से पहले <code>\</code> लगाएँ, शुरू में <code>^</code> और अंत में <code>\.?$</code>:</p>
<ul>
<li><code>example.in</code> बन जाता है <code>^example\.in\.?$</code></li>
<li><code>www.example.com</code> बन जाता है <code>^www\.example\.com\.?$</code></li>
</ul>
<p>हर लाइन पर एक एंट्री रखें, कोई space नहीं और कोई comma नहीं। <code>www.</code> वाला नाम और वही नाम उसके बिना, दो अलग नाम हैं और उन्हें दो लाइनें चाहिए। अगर आपको पक्का नहीं है कि कोई device कौन-सा पूछता है, तो <strong>Reporting</strong>, <strong>Unbound DNS</strong> में देखें, या दोनों सूची में रख दें।</p>
</li>
<li>
<p><strong>Back</strong> पर click करें। लाइनें फिर tags बन जाती हैं। जाँचें कि हर tag नए रूप में है। <strong>Save</strong> पर click करें। Window बंद हो जाती है।</p>
</li>
<li><strong>Apply</strong> पर click करें, table के नीचे का नारंगी button। लगभग एक मिनट रुकें।</li>
<li>नतीजा जाँचें। <strong>Services</strong>, <strong>Unbound DNS</strong>, <strong>Log File</strong> खोलें, <code>blocklist</code> खोजें, और severity box में <strong>Informational</strong> tick करें। आपको &#8220;updating blocklist&#8221;, फिर &#8220;blocklist loaded. length is&#8221; और एक संख्या दिखनी चाहिए, और कोई &#8220;skip invalid&#8221; लाइन नहीं। फिर ऊपर के tester वाले steps दोहराएँ: lookalike नाम अब Block होने चाहिए। जो एंट्री किसी ऐसे नाम को allow करती है जिसे कोई सूची block करती है (मेरे यहाँ, Google के एक ad host वाली), वह अब भी Pass होनी चाहिए।</li>
<li>अगर बदलाव के बाद कोई साइट load होना बंद हो जाए, तो उसे undo करें। Notepad में <code>allowlist-before.txt</code> खोलें, <code>Ctrl</code> + <code>A</code>, फिर <code>Ctrl</code> + <code>C</code> दबाएँ। Router में steps 1 और 2 दोहराएँ, box के अंदर click करें, <code>Ctrl</code> + <code>A</code>, फिर <code>Ctrl</code> + <code>V</code> दबाकर पुरानी एंट्री नई एंट्री के ऊपर paste करें, <strong>Back</strong>, <strong>Save</strong> और <strong>Apply</strong> पर click करें। जिस साइट को ऐसा नाम चाहिए जो आपने सूची में नहीं डाला, वह तब तक block रहती है जब तक आप वही सटीक नाम नहीं जोड़ते।</li>
</ol>
</details>
<details>
<summary>गहराई में: computer से allowlist के बदलाव को test करना</summary>
<p><strong>शुरू करने से पहले।</strong> यह उस Windows PC के लिए है जो router वाले ही network में है। यह router के DNS से एक नाम पूछता है और PC का अपना DNS cache साफ़ करता है; इसके अलावा कुछ नहीं बदलता। इसमें दो मिनट लगते हैं। Mac या Linux पर विचार वही है (<code>nslookup name router-address</code>), पर cache साफ़ करने का command अलग होता है।</p>
<ol>
<li>Start menu पर click करें, <code>powershell</code> type करें और Enter दबाएँ। एक window खुलती है जिसके prompt की शुरुआत <code>PS</code> से होती है।</li>
<li>
<p>Router का address खोजें। यह type करें और Enter दबाएँ:</p>
<div class="sf-box" data-mode="one" data-shell="ps" data-effect="read" data-effect-text="सिर्फ़ देखता है — आज़माना सुरक्षित है" data-where="आपके PC पर PowerShell" data-how="1 command — इसे paste करें, फिर Enter दबाएँ"><pre><code>ipconfig</code></pre></div>
<p class="sf-after">उस adapter के नीचे <strong>Default Gateway</strong> देखें जो आप इस्तेमाल कर रहे हैं। वही address आपका router है; नीचे के steps उसे <code>&lt;router-ip&gt;</code> कहते हैं। अगर आपका router किसी दूसरे router के पीछे है, तो default gateway वह दूसरा device हो सकता है; उस box का address इस्तेमाल करें जो आपकी DNS blocklist चलाता है। अगर लाइन खाली है, तो आप ऐसे adapter को देख रहे हैं जो connected नहीं है; अगले adapter तक scroll करें।</p>
</li>
<li>
<p>Router पर <strong>Apply</strong> पर click करने और एक मिनट रुकने के बाद, PC का cache साफ़ करें। Blocked जवाब एक घंटे तक cache में रहते हैं, इसलिए इसके बिना PC पुराना जवाब रखे रह सकता है:</p>
<div class="sf-box" data-mode="one" data-shell="ps" data-effect="change" data-effect-text="सिर्फ़ PC का DNS cache साफ़ करता है" data-where="आपके PC पर PowerShell" data-how="1 command — इसे paste करें, फिर Enter दबाएँ"><pre><code>ipconfig /flushdns</code></pre></div>
</li>
<li>
<p>Router से नाम पूछें, <code>&lt;router-ip&gt;</code> की जगह step 2 का address डालकर। नाम के बाद का आख़िरी dot Windows को पहले अपने search suffixes आज़माने से रोकता है:</p>
<div class="sf-box" data-mode="one" data-shell="ps" data-effect="read" data-effect-text="सिर्फ़ देखता है — आज़माना सुरक्षित है" data-where="आपके PC पर PowerShell" data-how="1 command — इसे paste करें, फिर Enter दबाएँ"><pre><code>nslookup www.example.com. &lt;router-ip&gt;</code></pre></div>
<p class="sf-after">Blocked नाम <code>0.0.0.0</code> का जवाब देता है, या अगर policy पर Return NXDOMAIN tick है तो &#8220;Non-existent domain&#8221; का। जो नाम allowed है, वह अपने असली address के साथ जवाब देता है। पहली दो लाइनें आपका router दिखाती हैं; बाकी जवाब है।</p>
</li>
</ol>
</details>
<h3>अठारह सूचियों का जोड़</h3>
<p>Router के resolver log में, उसकी पहली एंट्री से लेकर पहली सफ़ाई तक, हर पूरा रात का update यही अठारह सूचियाँ load करने के लिए set था (ThreatFox उनमें शामिल है, नीचे देखें):</p>
<ul>
<li>Hagezi Normal, साथ में Pro, Pro++ और Ultimate के Mini versions</li>
<li>Threat Intelligence Feeds (TIF) तीनों आकारों में: full, Medium और Mini</li>
<li>Gambling तीनों आकारों में</li>
<li>Fake, Pop-Up Ads, Badware Hoster, DynDNS, Anti Piracy और &#8220;Safesearch not supported&#8221;</li>
<li>OISD NSFW और Abuse.ch ThreatFox</li>
</ul>
<p>Hagezi, जो इनमें से ज़्यादातर सूचियाँ बनाए रखते हैं, अपने FAQ में अपनी सूचियों को मिलाने के ये नियम देते हैं:</p>
<ol>
<li>पाँच Multi सूचियाँ — Light, Normal, Pro, Pro++ और Ultimate — एक-दूसरे पर बनी हैं। हर एक में उसके नीचे वाली शामिल है। आप एक चुनते हैं।</li>
<li>आकार घटाए हुए versions (Mini, और TIF तथा Gambling के लिए Medium) अपनी पूरी सूची के विकल्प हैं। वे उसके ऊपर नहीं लगते।</li>
<li>TIF अपवाद है। वह malware, cryptojacking, scams, spam और phishing को कवर करती है और जो भी tier आप चुनें, उसके साथ चलने के लिए बनी है।</li>
</ol>
<p>Pro, Pro++, Ultimate और Gambling के Mini सिर्फ़ वे नाम रखते हैं जो सबसे ज़्यादा देखे जाने वाले domains की सूचियों में भी आते हैं। TIF Mini और Gambling Mini, Medium सूची से काटे गए हैं। Hagezi Mini को सीमित memory वाले devices पर चलने वाले blockers के लिए बने बताते हैं।</p>
<details>
<summary>गहराई में: किसके लिए कौन-सा tier, और Ultimate की क़ीमत क्या है</summary>
<p>Hagezi का FAQ tiers को उस व्यक्ति से मिलाता है जो गड़बड़ी सँभालेगा:</p>
<table>
<thead>
<tr>
<th>Tier</th>
<th>किसके लिए</th>
<th>गड़बड़ी का जोखिम (Hagezi की रेटिंग)</th>
</tr>
</thead>
<tbody>
<tr>
<td>Light</td>
<td>ऐसा blocker जो बड़ी सूचियाँ नहीं सँभाल सकता, या ऐसी setting जहाँ Normal भी ज़्यादा है</td>
<td>बहुत कम</td>
</tr>
<tr>
<td>Normal</td>
<td>बिना देखरेख वाले setups, जहाँ चीज़ें unblock करने वाला कोई admin नहीं</td>
<td>कम</td>
</tr>
<tr>
<td>Pro</td>
<td>जहाँ कोई चीज़ें unblock कर सकता है; उनकी default सिफ़ारिश, TIF के साथ</td>
<td>कम से मध्यम</td>
</tr>
<tr>
<td>Pro++</td>
<td>admin वाले अनुभवी users</td>
<td>मध्यम</td>
</tr>
<tr>
<td>Ultimate</td>
<td>बहुत अनुभवी users, जिनके पास admin उपलब्ध है</td>
<td>ज़्यादा</td>
</tr>
</tbody>
</table>
<p>हर tier में native tracker सूचियों का एक हिस्सा भी है: TVs, फ़ोन और operating systems में बनी telemetry। Pro++ लगभग सारी block करता है; Ultimate सारी। README बताती है कि Ultimate की क़ीमत क्या है: Facebook और Messenger के कुछ functions, WhatsApp के extras जैसे avatars और video effects, Windows Spotlight और Xbox achievement history, और वे location trackers जिन पर कुछ साइटें निर्भर हैं, जिससे गलत क्षेत्रीय settings और ज़्यादा CAPTCHAs आ सकते हैं।</p>
</details>
<p>मेरे सेट ने पहले दो नियम तोड़े। मैंने इस जाँच के लिए सूचियाँ एक बार download कीं और नाम-दर-नाम मिलाईं, यह देखने के लिए कि एक सूची की कौन-सी एंट्री दूसरी में पहले से block हैं। Router ने पहले जो copies load की थीं, वे मेरे पास नहीं हैं, और मैंने ThreatFox नहीं नापा, इसलिए सत्रह सूचियाँ नापी गईं।</p>
<p>सत्रह में से सात बाकी सेट में शामिल थीं, हर सूची की एक marker एंट्री को छोड़कर: Pro Mini, Pro++ Mini, TIF Medium, TIF Mini, Gambling Medium, Gambling Mini और Fake। सातों को साथ हटाने पर वे 15 नाम खो जाते जो TIF Medium और Mini में हैं और पूरे TIF में नहीं हैं। Pop-Up Ads ने अपने 48,277 नामों में से 37 बाकी सेट में जोड़े (अकेले Pro++ के मुक़ाबले वह तीन जोड़ती है, नीचे देखें)। DynDNS और Anti Piracy अलग थीं: उन सूचियों में लगभग 1,200 और लगभग 55,000 ऐसे नाम थे जो सेट की किसी और सूची में नहीं थे, और मैंने उन्हें duplicate मानकर नहीं, अपनी पसंद से हटाया।</p>
<p>चारों tier सूचियों में मिलाकर 233,710 नाम थे; Hagezi की चार marker एंट्री को छोड़कर सब Ultimate में थे। अकेले Pro++ के मुक़ाबले, वे Pro++ की 31,411 एंट्री से चूक गईं, यानी वे जो सबसे ज़्यादा देखे जाने वाली सूचियों में नहीं हैं। उनकी जगह उनमें 25,040 एंट्री थीं जो सिर्फ़ Ultimate block करता है (Ultimate Mini के marker के साथ 25,041), सब सबसे ज़्यादा देखे जाने वाली सूचियों से। Hagezi Ultimate की गड़बड़ी का जोखिम ज़्यादा रेट करते हैं। मैंने उनसे होने वाली किसी गड़बड़ी का record नहीं रखा और उसके लिए test नहीं किया, पर Hagezi की रेटिंग के अनुसार इस मिश्रण ने Ultimate का जोखिम लिया और उसमें Pro++ की coverage की कमी थी।</p>
<details>
<summary>गहराई में: मैंने कैसे नापा, और सादी तुलना गलत क्यों निकलती है</summary>
<p>OPNsense Hagezi का wildcard format इस्तेमाल करता है, जिसमें <code>*.example.com</code> जैसी लाइन example.com को और उसके नीचे के हर नाम को block करती है। इसलिए सूची A की कोई एंट्री सूची B में पहले से blocked है, अगर B में वह एंट्री या उसका कोई parent domain हो।</p>
<p>सादी text तुलना इसे चूक जाती है। <code>comm</code> बताता है कि Pro++ Mini की 3,294 एंट्री Ultimate Mini में &#8220;नहीं हैं&#8221;। उनमें से एक को छोड़कर सब covered हैं, क्योंकि Ultimate Mini कोई parent domain block करता है। उसमें पूरे <code>omtrdc.net</code> के लिए, जो Adobe का tracking domain है, एक ही लाइन है, जबकि Pro++ Mini उसके 998 hosts एक-एक करके लिखता है। बचा हुआ एक Hagezi की marker एंट्री है, जो नीचे समझाई गई है।</p>
<p>चारों tier सूचियाँ, उसी तरह नापी गईं:</p>
<table>
<thead>
<tr>
<th>Normal + Pro Mini + Pro++ Mini + Ultimate Mini</th>
<th></th>
</tr>
</thead>
<tbody>
<tr>
<td>अलग-अलग नाम</td>
<td>233,710</td>
</tr>
<tr>
<td>इनमें से, Ultimate में भी</td>
<td>4 को छोड़कर सब (Hagezi की marker एंट्री)</td>
</tr>
<tr>
<td>मिश्रण में न आने वाली Pro++ की एंट्री</td>
<td>223,551 में से 31,411</td>
</tr>
<tr>
<td>मिश्रण के वे नाम जो सिर्फ़ Ultimate block करता है</td>
<td>25,040</td>
</tr>
</tbody>
</table>
<p>मैंने जो जाँच इस्तेमाल की, वह parent domains पर ऊपर की ओर चलती है। यह एक Python 3 script है, जिसके लिए Python के अलावा कुछ install नहीं करना पड़ता। पहले script है; उसके बाद के steps बताते हैं कि उसे कैसे save और run करें।</p>
<div class="sf-box" data-mode="file" data-where="File: hagezi_overlap.py" data-how="इसे file के रूप में save करें — चलाएँ नहीं"><pre><code>#!/usr/bin/env python3
"""hagezi_overlap.py - how much of blocklist A is already blocked by blocklist B.

Reads two Hagezi lists in the wildcard format (the /wildcard/ files, the format
OPNsense uses). A line "*.example.com" blocks example.com and every name under
it, so an entry of A counts as covered when the entry itself, or one of its
parent domains, is in B. A plain text comparison (comm, diff) misses that and
reports too many differences.

Usage:  python3 hagezi_overlap.py A.txt B.txt
Author: Vivek Sanghi. Licence: CC BY-NC-SA 4.0, as the blog.
"""
import re
import sys

WILDCARD = re.compile(r"^\*\.[a-z0-9_-]+(\.[a-z0-9_-]+)+$")


def load(path):
    names = set()
    try:
        f = open(path, encoding="utf-8-sig")
    except OSError as e:
        sys.exit(f"{path}: cannot open ({e.strerror})")
    with f:
        for number, line in enumerate(f, 1):
            line = line.strip().lower()
            if not line or line.startswith("#"):
                continue
            if not WILDCARD.match(line):
                sys.exit(f"{path}, line {number}: not a wildcard-format line "
                         "('*.example.com'). Download the /wildcard/ version of the list.")
            names.add(line[2:])
    if not names:
        sys.exit(f"{path}: no entries found; check the download")
    return names


def covered(name, blocked):
    while True:
        if name in blocked:
            return True
        if "." not in name:
            return False
        name = name.split(".", 1)[1]


def main():
    if len(sys.argv) != 3:
        sys.exit("usage: hagezi_overlap.py A.txt B.txt")
    a, b = load(sys.argv[1]), load(sys.argv[2])
    missing = sorted(n for n in a if not covered(n, b))
    print(f"{sys.argv[1]}: {len(a):,} entries; {len(a) - len(missing):,} already "
          f"blocked by {sys.argv[2]}; {len(missing):,} not")
    for n in missing[:10]:
        print(f"  not covered: {n}")
    if len(missing) &gt; 10:
        print(f"  ... and {len(missing) - 10:,} more")


if __name__ == "__main__":
    main()
</code></pre></div>
<p><strong>शुरू करने से पहले।</strong> यह एक Windows PC के लिए है। आपको Python 3 चाहिए (step 3 जाँचता है)। Steps आपके user folder में एक folder बनाते हैं, उसमें कुछ megabytes की दो सूची files download करते हैं, और उन्हें पढ़ते हैं; इसके अलावा कुछ नहीं बदलते। दस मिनट रखें। undo करने के लिए File Explorer में वह folder delete कर दें। Mac या Linux पर Terminal इस्तेमाल करें, <code>py</code> की जगह <code>python3</code>, और <code>curl.exe</code> की जगह <code>curl</code>।</p>
<ol>
<li>Start menu पर click करें, <code>powershell</code> type करें और Enter दबाएँ। एक window खुलती है जिसके prompt की शुरुआत <code>PS</code> से होती है।</li>
<li>
<p>एक folder बनाएँ और उसमें जाएँ। हर लाइन में थोड़ा समय लगता है; उन्हें एक-एक करके चलाएँ:</p>
<div class="sf-box" data-mode="each" data-shell="ps" data-effect="change" data-effect-text="एक folder बनाता है" data-where="आपके PC पर PowerShell" data-how="2 commands — एक-एक करके, क्रम से चलाएँ; उस लाइन को copy करने के लिए PS&gt; पर click करें"><pre><code>mkdir hagezi-check
cd hagezi-check</code></pre></div>
<p class="sf-after">अब prompt का अंत <code>hagezi-check</code> से होना चाहिए। अगर पहली लाइन कहे कि folder पहले से है, तो कोई दूसरा नाम चुनें और दोनों लाइनों में वही इस्तेमाल करें।</p>
</li>
<li>
<p>जाँचें कि Python install है:</p>
<div class="sf-box" data-mode="one" data-shell="ps" data-effect="read" data-effect-text="सिर्फ़ देखता है — आज़माना सुरक्षित है" data-where="आपके PC पर PowerShell" data-how="1 command — इसे paste करें, फिर Enter दबाएँ"><pre><code>py --version</code></pre></div>
<p class="sf-after">आपको <code>Python 3.12.4</code> जैसी एक लाइन दिखनी चाहिए। अगर PowerShell कहे कि वह <code>py</code> को नहीं पहचानता, तो python.org से Python 3 install करें (installer में &#8220;Add python.exe to PATH&#8221; पर tick करें), PowerShell बंद करें और step 1 से फिर शुरू करें।</p>
</li>
<li>
<p>Script file बनाएँ। इससे Notepad खुलता है:</p>
<div class="sf-box" data-mode="one" data-shell="ps" data-effect="change" data-effect-text="एक file बनाता है" data-where="आपके PC पर PowerShell" data-how="1 command — इसे paste करें, फिर Enter दबाएँ"><pre><code>notepad hagezi_overlap.py</code></pre></div>
<p class="sf-after">Notepad पूछता है कि नई file बनानी है या नहीं; <strong>Yes</strong> पर click करें। ऊपर के box से script paste करें (box पर <strong>Copy</strong> पर click करें, फिर Notepad में <code>Ctrl</code> + <code>V</code>), <code>Ctrl</code> + <code>S</code> दबाएँ, और Notepad बंद करें। अगर Notepad बिना पूछे खुल जाए, तो <strong>File</strong>, <strong>Save as</strong> से save करें, file के नाम के रूप में <code>hagezi_overlap.py</code> को quotation marks में type करें, पक्का करें कि folder <code>hagezi-check</code> है, और <strong>Save</strong> पर click करें।</p>
</li>
<li>
<p>दो सूचियाँ folder में download करें। Windows पर PowerShell में <code>curl</code> नहीं, <code>curl.exe</code> type करें। लाइनें एक-एक करके चलाएँ:</p>
<div class="sf-box" data-mode="each" data-shell="ps" data-effect="change" data-effect-text="दो files download करता है" data-where="आपके PC पर PowerShell" data-how="2 commands — एक-एक करके, क्रम से चलाएँ; उस लाइन को copy करने के लिए PS&gt; पर click करें"><pre><code>curl.exe -o pro.plus.mini.txt https://cdn.jsdelivr.net/gh/hagezi/dns-blocklists@latest/wildcard/pro.plus.mini.txt
curl.exe -o ultimate.mini.txt https://cdn.jsdelivr.net/gh/hagezi/dns-blocklists@latest/wildcard/ultimate.mini.txt</code></pre></div>
<p class="sf-after">हर एक में कुछ सेकंड लगते हैं और एक progress table छपती है। अगर कोई लाइन error पर ख़त्म हो, तो connection जाँचें और वह लाइन फिर चलाएँ।</p>
</li>
<li>
<p>जाँच चलाएँ:</p>
<div class="sf-box" data-mode="one" data-shell="ps" data-effect="read" data-effect-text="सिर्फ़ देखता है — आज़माना सुरक्षित है" data-where="आपके PC पर PowerShell" data-how="1 command — इसे paste करें, फिर Enter दबाएँ"><pre><code>py hagezi_overlap.py pro.plus.mini.txt ultimate.mini.txt</code></pre></div>
</li>
<li>
<p>जो सूचियाँ मैंने इस जाँच के लिए download कीं, उन पर इसने यह छापा:</p>
<div class="sf-box" data-mode="output" data-where="आपको क्या दिखना चाहिए" data-how="इसे आप type नहीं करते"><pre><code>pro.plus.mini.txt: 98,704 entries; 98,703 already blocked by ultimate.mini.txt; 1 not
  not covered: h4g3z1-pro-plus-mini.web.app</code></pre></div>
<p class="sf-after">आपके numbers अलग होंगे, क्योंकि सूचियाँ रोज़ बदलती हैं। अगर आपको numbers की जगह कोई संदेश दिखे, तो script जान-बूझकर रुका है: संदेश पढ़ें, वह file और लाइन बताता है।</p>
</li>
</ol>
<p>हर तुलना में बचा हुआ एक नाम वह marker है जो Hagezi हर सूची में डालते हैं (<code>h4g3z1-&lt;list&gt;.web.app</code>), ताकि पता चले कि कौन-सी सूची load है। अगर download fail हो, या file किसी और format में हो, तो script कोई number बताने की जगह रुक जाता है और यह कह देता है।</p>
<p>उन्हीं सूचियों पर इसने और क्या दिया:</p>
<table>
<thead>
<tr>
<th>सूची A</th>
<th>सूची B</th>
<th>A की वे एंट्री जो B से पहले ही blocked हैं</th>
</tr>
</thead>
<tbody>
<tr>
<td>Normal (171,454)</td>
<td>Pro++</td>
<td>marker को छोड़कर सब</td>
</tr>
<tr>
<td>Pro++ (223,551)</td>
<td>Ultimate</td>
<td>marker को छोड़कर सब</td>
</tr>
<tr>
<td>Pro Mini (86,842)</td>
<td>Ultimate Mini</td>
<td>marker को छोड़कर सब</td>
</tr>
<tr>
<td>TIF Mini (212,777)</td>
<td>TIF Medium</td>
<td>marker को छोड़कर सब</td>
</tr>
<tr>
<td>Gambling Mini (118,888)</td>
<td>Gambling Medium</td>
<td>marker को छोड़कर सब</td>
</tr>
<tr>
<td>Fake (17,622)</td>
<td>Pro++</td>
<td>marker को छोड़कर सब</td>
</tr>
<tr>
<td>Pop-Up Ads (48,277)</td>
<td>Pro++</td>
<td>4 को छोड़कर सब (marker और 3 दूसरी)</td>
</tr>
<tr>
<td>Badware Hoster (1,088)</td>
<td>Pro++</td>
<td>966</td>
</tr>
<tr>
<td>Ultimate Mini (120,458)</td>
<td>Pro++</td>
<td>95,417</td>
</tr>
</tbody>
</table>
<p>Script का test इन सूचियों पर किया गया, और इन पर भी: missing file, खाली file, सिर्फ़ comments वाली file, failed download, एक web page, और adblock, hosts और plain-domain formats की सूचियाँ।</p>
</details>
<p>load हुए नामों की गिनती मेरे बदलावों के अनुसार नहीं बदली। पहली सफ़ाई के दिन router ने उससे पहले 2,840,117 नाम load किए और उसके बाद 3,188,234, अठारह की जगह दस सूचियों के साथ: उस दिन दो downloads के बीच TIF में 426,519 एंट्री बढ़ गई थीं। मेरी ओर से बिना किसी बदलाव के, गिनती चार दिन में 2,739,044 से 3,229,041 हो गई। जो सूची sizes मैंने इस जाँच के लिए download कीं, उन पर लगभग दो-तिहाई नाम TIF पर थे और लगभग 7 प्रतिशत Pro++ पर।</p>
<details>
<summary>गहराई में: router के आँकड़े, उनकी सीमाओं के साथ</summary>
<p>लोड हुए नाम, router के log से (&#8220;blocklist loaded. length is …&#8221;, unique नामों की संख्या):</p>
<table>
<thead>
<tr>
<th>कब</th>
<th>सूचियाँ</th>
<th>लोड हुए नाम</th>
</tr>
</thead>
<tbody>
<tr>
<td>पहली सफ़ाई का दिन, पहले</td>
<td>अठारह</td>
<td>2,840,117</td>
</tr>
<tr>
<td>पहली सफ़ाई का दिन, बाद में</td>
<td>नया सेट</td>
<td>3,188,234</td>
</tr>
<tr>
<td>पाँच दिन बाद</td>
<td>वही सेट</td>
<td>2,739,044</td>
</tr>
<tr>
<td>नौ दिन बाद</td>
<td>वही सेट</td>
<td>3,229,041</td>
</tr>
<tr>
<td>अठारह दिन बाद</td>
<td>वही सेट</td>
<td>3,198,953</td>
</tr>
</tbody>
</table>
<p>Block हुई queries का हिस्सा, Reporting → Unbound DNS से:</p>
<table>
<thead>
<tr>
<th>अवधि</th>
<th>Queries</th>
<th>Blocked</th>
</tr>
</thead>
<tbody>
<tr>
<td>पहली सफ़ाई का दिन, उसी दिन पढ़ा गया</td>
<td>दर्ज नहीं</td>
<td>12.9 प्रतिशत</td>
</tr>
<tr>
<td>लगभग 38 घंटे की अवधि, बाद में पढ़ी गई</td>
<td>110,248</td>
<td>8,600 (7.80 प्रतिशत)</td>
</tr>
</tbody>
</table>
<p>दोनों प्रतिशत अलग सूचियों, अलग दिनों और उस समय network जो भी कर रहा था, उसे कवर करते हैं। वे पहले और बाद की तुलना नहीं हैं।</p>
</details>
<h3>अब मैं क्या tick रखता हूँ</h3>
<p>मेरे router की settings में यह है:</p>
<ul>
<li>Hagezi Pro++ (full)</li>
<li>TIF (full)</li>
<li>Gambling (full)</li>
<li>Fake, Pop-Up Ads, Badware Hoster और &#8220;Safesearch not supported&#8221;</li>
<li>OISD NSFW</li>
<li>URL से जोड़ी गई दो Hagezi सूचियाँ: encrypted-DNS servers और LG TV trackers</li>
<li>Abuse.ch ThreatFox, URL से, एक free key के साथ (नीचे)</li>
</ul>
<p>मैंने Hagezi के सुझाए Pro की जगह Pro++ चुना, device trackers के लिए, क्योंकि Pro++ वह जगह है जहाँ वे लगभग सारे trackers block करते हैं।</p>
<p>इनमें से दो duplicate हैं। Hagezi की cheat sheet Fake और Pop-Up Ads को Pro++ के अंदर बताती है। Fake के लिए नाप भी यही कहती है, और उसे हटाया जा सकता है; इससे जो block होता है वह नहीं बदलता। Pop-Up Ads में, मेरी download की हुई सूचियों पर, तीन नाम हैं जो Pro++, TIF, Gambling, Hoster या Fake में से किसी में नहीं हैं; उसे हटाने पर वे तीन जाते हैं। मैंने ThreatFox या दोनों URL सूचियों की तुलना नहीं की। Fake और Pop-Up Ads दोनों अब भी tick हैं।</p>
<p>ThreatFox download होना बंद हो गई थी और अब फिर download होती है। हर update ने &#8220;unable to download blocklist … and no cache available&#8221; लिखा था। OPNsense की built-in एंट्री ने उसके लिए जो address इस्तेमाल किया, वह &#8220;410 Gone&#8221; का जवाब देता है, और abuse.ch का export पेज host file देने से पहले Auth-Key माँगता है। 26.7 की एक बाद की release ने इसी कारण built-in एंट्री हटा दी और users को &#8220;URLs of Blocklists&#8221; की ओर भेजा। abuse.ch अपने authentication portal से key free देता है। मैंने सूची URL से जोड़ी, key को address में रखकर। abuse.ch का export पेज key URL में माँगता है, और OPNsense का downloader कोई headers नहीं भेजता। नीचे के steps address का रूप दिखाते हैं। जिस update ने इसे जोड़ा, उसने इसके लिए 28,889 लाइनों के साथ &#8220;blocklist download&#8221; लिखा, जिनमें 28,869 नाम थे, और कोई error नहीं; उस update में बाकी सूचियाँ cache से load हुईं। Router की अपनी load हुए नामों की गिनती के अनुसार, वह 2,765,172 से बढ़कर 2,782,246 हुई। इसलिए 28,869 में से 17,074 उस सटीक नाम से पहले load नहीं थे, और लगभग 11,800 थे। गिनती नामों की अक्षर-दर-अक्षर तुलना करती है, इसलिए जिस नाम के parent domain को कोई और सूची पहले से block करती है, वह भी नया गिना जाता है। Hagezi ThreatFox को source के रूप में नाम नहीं देते।</p>
<p>Key password की तरह काम करती है। Router उसे अपनी configuration में रखता है, और हर update key समेत address को resolver log में लिखता है। उसे उन screenshots, shared logs, configuration backups और किसी भी remote log server से बाहर रखें जो आपके हाथ से निकल जाते हैं। अगर वह leak हो गई हो, तो उसी portal से नई key लें और address बदल दें।</p>
<details>
<summary>गहराई में: key के साथ ThreatFox जोड़ना</summary>
<p><strong>शुरू करने से पहले।</strong> यह आपकी policy में एक सूची जोड़ता है। दस मिनट रखें। कुछ delete नहीं होता। इसे undo करने के लिए, उसी box से address हटाएँ और फिर apply करें।</p>
<ol>
<li>Browser में <code>https://auth.abuse.ch</code> खोलें, अगर account नहीं है तो बनाएँ, और एक Auth-Key लें। Key free है। उसे सिर्फ़ step 4 तक किसी text file में copy रखें, जहाँ आप उसे एक बार paste करते हैं, फिर वह file delete कर दें।</li>
<li>Router में log in करें। <strong>Services</strong> पर click करें, फिर <strong>Unbound DNS</strong>, फिर <strong>Blocklists</strong>।</li>
<li>अपनी policy की row के दाएँ सिरे पर pencil (Edit) पर click करें। <strong>Edit Blocklist</strong> नाम की एक window खुलती है।</li>
<li>
<p><strong>URLs of Blocklists</strong> के अंदर click करें और नीचे का address type करें, <code>YOUR_KEY</code> की जगह अपनी key के साथ और बिना किसी space के। Enter दबाएँ ताकि वह अपना एक अलग tag बन जाए (tag वह एक एंट्री है जो field में छोटे box के रूप में दिखती है):</p>
<div class="sf-box" data-mode="file" data-where="ThreatFox सूची का address (एक उदाहरण, command नहीं)" data-how="इसे URLs of Blocklists field में paste करें, YOUR_KEY की जगह अपनी key के साथ"><pre><code>https://threatfox-api.abuse.ch/v2/files/exports/YOUR_KEY/hostfile.txt</code></pre></div>
<p class="sf-after">Key <code>exports/</code> और <code>/hostfile.txt</code> के बीच बैठती है।</p>
</li>
<li>
<p><strong>Save</strong> पर click करें, फिर <strong>Apply</strong>। Router सूचियाँ फिर download करता है; एक-दो मिनट रखें।</p>
</li>
<li><strong>Services</strong>, <strong>Unbound DNS</strong>, <strong>Log File</strong> पर click करें, <code>download</code> खोजें, और severity box में <strong>Informational</strong> tick करें। आपको &#8220;blocklist download:&#8221; और ThreatFox address के लिए लाइनों की संख्या दिखनी चाहिए। अगर लाइन &#8220;unable to download&#8221; कहे, तो key और address में किसी फ़ालतू space की जाँच करें।</li>
<li>वह screen share न करें: लाइन में आपकी key के साथ address दिखता है।</li>
</ol>
</details>
<details>
<summary>गहराई में: Badware Hoster और URL से जोड़ी गई दो सूचियाँ</summary>
<p>Badware Hoster Hagezi की एक अलग सूची है, और उसकी 1,088 एंट्री में से 966 पहले से Pro++ में हैं। बाकी वे पूरे hosting providers block करती है जो threat feeds में बार-बार आते हैं। Hagezi चेताते हैं कि उन hosts पर मौजूद वैध साइटें उनके साथ block हो जाती हैं, और उन्हें unblock करना वे सूची चलाने वाले पर छोड़ते हैं।</p>
<p>URL से जोड़ी गई दो सूचियाँ Hagezi की हैं, wildcard format में:</p>
<div class="sf-box" data-mode="file" data-where="दो Hagezi सूचियों के address" data-how="हर लाइन पर एक address; संदर्भ के लिए दिखाए गए हैं, चलाने के लिए कुछ नहीं"><pre><code>https://cdn.jsdelivr.net/gh/hagezi/dns-blocklists@latest/wildcard/doh.txt
https://cdn.jsdelivr.net/gh/hagezi/dns-blocklists@latest/wildcard/native.lgwebos.txt</code></pre></div>
<p>पहली encrypted-DNS servers को नाम से सूचीबद्ध करती है, devices को router को बायपास करने से रोकने का एक हिस्सा। दूसरी LG webOS के ad और tracking servers सूचीबद्ध करती है। हर एक की अपनी कहानी है, अलग पोस्टों के लिए।</p>
<p>OPNsense 26.7 के built-in Hagezi tick-boxes Hagezi के mirror, <code>hagezi-mirror.dnsbunker.org</code>, से download करते हैं, जैसा log दिखाता है। Hagezi कहते हैं कि वह mirror लगभग हर चार से आठ घंटे में नई build प्रकाशित करता है; jsDelivr की copies दिन में एक बार update होती हैं।</p>
</details>
<h3>DNS क्या block नहीं कर सकता</h3>
<p>YouTube और Instagram के in-app ads उन्हीं domains से आते हैं जिनसे videos और posts आते हैं, इसलिए उन्हें नाम से block करने पर content भी block हो जाएगा। Hagezi का FAQ सामान्य बात कहता है: कुछ ads content वाले ही domains से load होते हैं, और browser में content blocker, या फ़ोन पर app-level blocker, वह परत है जो उन्हें पकड़ती है। मैंने in-app ads को स्वीकार कर लिया।</p>
<p>DNS blocklist सिर्फ़ उन्हीं devices को filter करती है जो router से पूछते हैं; जिन devices का अपना encrypted या hard-coded DNS है, वे उसे बायपास कर जाते हैं। वह एक अलग पोस्ट है।</p>
<h3>यह कैसे किया गया</h3>
<p>Claude ने documentation और सूचियाँ पढ़ीं, उनकी तुलना की, और मेरे logged-in browser session के ज़रिए मेरा router पढ़ा: settings, resolver log और tester। क्या बदलना है, यह मैंने तय किया। Allowlist वाले session में router पर एकमात्र बदलाव allowlist का rewrite था।</p>
<p>Model ने गलतियाँ कीं। bare नाम वाला allowlist fix पहले session से निकला, और एक session में उसने मुझे यह भी बताया कि रात का blocklist update Unbound का cache flush करता है। Router के log में दिखा कि update सूचियों को चल रहे Unbound में load करता है, restart के बिना। Manual कहती है कि blocklist settings apply करने से Unbound restart नहीं होता, और source नई सूची को चल रहे process में load करता है। Flush वाली setting सिर्फ़ तब लागू होती है जब Unbound रुकता है।</p>
<p>Router पर logged-in session वाला model अपने आप में एक जोखिम है। जो resolver log वह पढ़ता है, उसमें ऐसे नाम हैं जिन्हें कोई भी website किसी device से lookup करवा सकती है, और कोई नाम model को दिशा देने के लिए लिखा text ले जा सकता है। Allowlist वाले session में मैंने उसे सिर्फ़ पढ़ने तक रखा, allowlist के बदलाव को छोड़कर। यह model को दिया गया निर्देश है, कोई control नहीं; read-only OPNsense user एक control होता। Resolver log में key समेत ThreatFox address भी है, इसलिए जो session log पढ़ता है वह key देख लेता है। अगर आप किसी model को वह log पढ़ने देते हैं, तो बाद में key बदल दें।</p>
<p>पहले session में मैंने पाँच Unbound settings और एक cron job भी बदले। Router छहों को set दिखाता है।</p>
<details>
<summary>गहराई में: हर setting, और DNS over TLS को undo कैसे करें</summary>
<table>
<thead>
<tr>
<th>Setting (पेज)</th>
<th>पहले</th>
<th>बाद में</th>
</tr>
</thead>
<tbody>
<tr>
<td>Flush DNS Cache during reload (General)</td>
<td>चालू</td>
<td>बंद</td>
</tr>
<tr>
<td>Prefetch Support (Advanced)</td>
<td>बंद</td>
<td>चालू</td>
</tr>
<tr>
<td>Serve Expired Responses (Advanced)</td>
<td>बंद</td>
<td>चालू; TTL for Expired Responses 86,400 s</td>
</tr>
<tr>
<td>Use System Nameservers (Query Forwarding)</td>
<td>चालू</td>
<td>बंद</td>
</tr>
<tr>
<td>DNS over TLS forwarders</td>
<td>कोई नहीं</td>
<td>Cloudflare और Quad9</td>
</tr>
<tr>
<td>Blocklist update job (System → Settings → Cron)</td>
<td>दूसरे jobs के साथ साझा slot</td>
<td>अपना अलग slot</td>
</tr>
</tbody>
</table>
<p><strong>Prefetch</strong> लोकप्रिय एंट्री को उनके expire होने से पहले refresh करता है। Manual इसकी क़ीमत लगभग 10 प्रतिशत ज़्यादा DNS traffic बताती है।</p>
<p><strong>Serve Expired Responses</strong> device को इंतज़ार कराने की जगह cache से expired record के साथ जवाब देता है। जब यह चालू होता है, तो और fields दिखते हैं। &#8220;TTL for Expired Responses&#8221; सीमित करता है कि expiry के कितनी देर बाद तक पुराना जवाब दिया जा सकता है; मैंने 86,400 सेकंड रखे, जो manual के सुझाए 86,400 से 259,200 का निचला सिरा है।</p>
<p>एक interaction जिसे मैंने test नहीं किया: cache flushing बंद और पुराने जवाब allowed होने पर, जिस नाम को कोई सूची नया block करती है, उसे Unbound के cache से कुछ देर तक जवाब मिलते रह सकते हैं। अगर कोई block तुरंत असर न करे, तो मैं सबसे पहले यही देखूँगा।</p>
<p><strong>Use System Nameservers.</strong> Manual कहती है कि Query Forwarding और DNS over TLS की किसी भी catch-all एंट्री से system nameservers को प्राथमिकता मिलती है। इसे बंद करने पर DNS over TLS की एंट्री queries ले जाती हैं। चारों एंट्री, Services → Unbound DNS → DNS over TLS के नीचे:</p>
<table>
<thead>
<tr>
<th>Server IP</th>
<th>Port</th>
<th>Verify CN</th>
</tr>
</thead>
<tbody>
<tr>
<td>1.1.1.1</td>
<td>853</td>
<td>cloudflare-dns.com</td>
</tr>
<tr>
<td>1.0.0.1</td>
<td>853</td>
<td>cloudflare-dns.com</td>
</tr>
<tr>
<td>9.9.9.9</td>
<td>853</td>
<td>dns.quad9.net</td>
</tr>
<tr>
<td>149.112.112.112</td>
<td>853</td>
<td>dns.quad9.net</td>
</tr>
</tbody>
</table>
<p>Router की अपनी queries, जो इन servers को जाती हैं, encrypted निकलती हैं। जो firewall rule LAN से port 853 को reject करता है, devices को अपना encrypted DNS इस्तेमाल करने से रोकने के लिए, वह इन्हें नहीं छूता, क्योंकि ये router से ही निकलती हैं।</p>
<p><strong>Update का समय</strong> एक अलग slot में चला गया ताकि update अब दूसरे scheduled jobs के समय पर न चले।</p>
<p>DNS over TLS का बदलाव undo करने के लिए:</p>
<p><strong>शुरू करने से पहले।</strong> यह आपके router की DNS settings बदलता है और इसमें पाँच मिनट लगते हैं। बाकी बची settings से DNS चलता रहता है। पहले चारों एंट्री note कर लें (ऊपर की table); बदलाव को दोबारा लागू करने के लिए आपको वे चाहिए।</p>
<ol>
<li>Router का settings पेज खोलें और sign in करें। आपको Lobby पेज दिखना चाहिए।</li>
<li><strong>Services</strong> पर click करें, फिर <strong>Unbound DNS</strong>, फिर <strong>DNS over TLS</strong>। एक table में एंट्री सूचीबद्ध हैं।</li>
<li>पहली row के दाएँ सिरे पर pencil (Edit) पर click करें। <strong>Edit server</strong> नाम की एक window खुलती है। <strong>Enabled</strong> का tick हटाएँ और <strong>Save</strong> पर click करें। बाकी हर row के लिए यही करें।</li>
<li>उसी पेज के ऊपर <strong>Use System Nameservers</strong> पर tick करें। वही box <strong>Query Forwarding</strong> के नीचे भी दिखता है; यह एक ही setting है।</li>
<li>पेज के नीचे <strong>Apply</strong> पर click करें। Unbound कुछ सेकंड में reload होता है।</li>
<li>जाँचें: network के किसी device से कोई ऐसी website खोलें जो आपने आज नहीं खोली। वह load होनी चाहिए। अगर System, Settings, General में कोई nameservers नहीं हैं, तो Unbound forward करने की जगह root servers से खुद resolve करता है; अगर आप चाहते हैं कि आपके provider के servers इस्तेमाल हों, तो उन्हें वहाँ जोड़ें।</li>
<li>बदलाव को दोबारा लागू करने के लिए, हर एंट्री पर फिर <strong>Enabled</strong> tick करें, <strong>Use System Nameservers</strong> का tick हटाएँ, और <strong>Apply</strong> पर click करें।</li>
</ol>
</details>
<h3>स्रोत</h3>
<ul>
<li><a href="https://github.com/hagezi/dns-blocklists">Hagezi, dns-blocklists README</a>, <a href="https://github.com/hagezi/dns-blocklists/blob/main/CHEATSHEET.md">cheat sheet</a> और <a href="https://github.com/hagezi/dns-blocklists/blob/main/FAQ.md">FAQ</a></li>
<li><a href="https://docs.opnsense.org/manual/unbound.html">OPNsense manual, Unbound DNS</a></li>
<li><a href="https://github.com/opnsense/core/tree/26.7.7">OPNsense core source code, tag 26.7.7</a>, सबसे नए 26.7 tag से मिलाया गया</li>
<li><a href="https://github.com/opnsense/core/issues/11091">OPNsense core, issue 11091: ThreatFox blocklist HTTP 410 से fail, Auth-Key support ज़रूरी</a></li>
<li><a href="https://threatfox.abuse.ch/export/">abuse.ch ThreatFox, export पेज</a></li>
<li><a href="https://auth.abuse.ch">abuse.ch authentication portal</a></li>
</ul>
</div>
<div id="hbt-panel-te" class="hbt-panel" lang="te">
<h2>ఫిషింగ్ పేర్లను లోపలికి పంపిన సవరణ</h2>
<p class="hbt-note">ఆంగ్ల మూలం నుండి అనువదించినది. కమాండ్లు, కోడ్, సాంకేతిక పదాలు ఆంగ్లంలోనే ఉంచాను.</p>

<p>అక్టోబర్‌లో ఒక శనివారం నా రూటర్ DNS allowlistలో పాడైన నాలుగు ఎంట్రీలను సరిచేశాను. రెండు వారాలకు కొంచెం ఎక్కువ రోజుల తర్వాత, సరిచేసిన ఎంట్రీలు threat feedలోని కొన్ని పేర్లను లోపలికి పంపుతున్నాయని కనుగొన్నాను. ఆ పేర్లు నేను అనుమతించదలచిన సైట్లలా కనిపించేలా తయారుచేసినవి: ఒక చెల్లింపు సైట్ domain తర్వాత <code>.https.</code> మరియు సంబంధం లేని మరో domain, లేదా చుక్క ఉండాల్సిన చోట హైఫన్ ఉన్న ఒక షాప్ పేరు. నా రూటర్ సొంత tester వాటిని Pass చేసింది.</p>
<p>అదే సాయంత్రం నా blocklistలను పద్దెనిమిది నుండి పదికి తగ్గించాను; మరుసటి రోజు ఒక LG TV list చేరి పదకొండు అయింది. వాటిలో ఏడింటిని మిగతా సెట్ ఇప్పటికే కవర్ చేస్తోంది. నేను ఉంచిన ఒక list, Abuse.ch ThreatFox, abuse.ch తన host fileను key ఉన్నవారికే ఇవ్వడం మొదలుపెట్టినప్పుడు download కావడం ఆగిపోయింది. దాని addressలో ఒక ఉచిత key పెట్టినప్పటి నుండి మళ్లీ download అవుతోంది. నా ఫోన్‌లో YouTube, Instagram లోపలి ప్రకటనలు మొత్తం సమయంలో వస్తూనే ఉన్నాయి; ఏ blocklist కూడా దాన్ని మార్చగలిగేది కాదు.</p>
<p>ఆ తర్వాత allowlist ఎంట్రీలను తిరిగి రాశాను. ఈ పోస్ట్ రెండు శుభ్రతల గురించి: allowlist ఎంట్రీని OPNsense ఏం చేస్తుంది, మీది ఎలా తనిఖీ చేయాలి, ఒకదానిపై ఒకటి ఉన్న పద్దెనిమిది lists చివరికి ఏమి చేర్చాయి. ఈ పనిని Claudeతో రెండు సెషన్లలో చేశాను, ఒక్కో శుభ్రతకు ఒకటి; ThreatFox key మూడో సెషన్‌లో వేశాను. అది నా browser ద్వారా రూటర్‌ను చదివింది; రూటర్‌పై ప్రతి మార్పునూ నేనే ఆమోదించాలి. bare name (యాంకర్ లేని సాదా పేరు) సవరణను నేనే ఆమోదించాను, కాబట్టి ఆ పొరపాటు విషయంలో ఆమోదం రక్షణ కాలేదు.</p>
<aside class="in-short">
<p><strong>సంక్షిప్తంగా</strong></p>
<ul>
<li>OPNsenseలో allowlist ఎంట్రీ అంటే పేరు మొదటి నుండి సరిపోల్చే regular expression. సాదా <code>example.com</code> ఎంట్రీ, ఆ అక్షరాలతో మొదలయ్యే ఏ పేరునైనా, చుక్క స్థానంలో ఏ అక్షరమున్నా, అనుమతిస్తుంది: <code>example.com.evil.net</code>, <code>example-com.evil.net</code>. ఖచ్చితమైన పేరును anchor చేసి రాయండి: <code>^www\.example\.com\.?$</code>.</li>
<li>మార్పు తర్వాత resolver log చదవండి. download కాని list, లేదా skip అయిన allowlist ఎంట్రీ అక్కడే కనిపిస్తాయి; blocklist పేజీలో ఎక్కడా కనిపించవు.</li>
<li>ఒక Hagezi tierను ఎంచుకోండి, Light నుండి Ultimate వరకు, దానికి Threat Intelligence Feeds కలపండి. మెమరీ మిగిలి ఉన్న రూటర్‌లో Mini versions కాకుండా full lists వాడండి.</li>
<li>మీ tier లో ఇప్పటికే ఏముందో చూసి, ఆ తర్వాతే మరిన్ని చేర్చండి. Fake, మరియు Pop-Up Adsలో మూడు పేర్లు తప్ప మిగతావన్నీ, Pro++ లోపలే ఉన్నాయి.</li>
</ul>
</aside>
<details class="sf-legend"><summary><strong>కమాండ్ లైన్ మీకు కొత్తా? boxes ను ఎలా చదవాలి</strong></summary>
<p><strong>PS&gt;</strong> అంటే: Windowsలో <em>PowerShell</em> లో దీన్ని type చేయండి (Start menu → <code>powershell</code> అని type చేయండి → Enter). <strong>$</strong> అంటే: Linux లేదా Mac లోని terminal లో, లేదా Pi లో <code>ssh</code> తో login అయిన తర్వాత దీన్ని type చేయండి. <strong>$</strong> లేదా <strong>PS&gt;</strong> ను మీరు type చేయవద్దు.</p>
<p><strong>$</strong> లేదా <strong>PS&gt;</strong> తో మొదలయ్యే ప్రతి line ఒక కమాండ్. ఆ line ను మాత్రమే copy చేయడానికి ఆ <strong>$</strong> ను click చేసి, paste చేసి, <strong>Enter</strong> నొక్కి, తర్వాతి దానికి ముందు అది పూర్తయ్యే వరకు వేచి ఉండండి. పైన <strong>Copy</strong> button ఉన్న box ఒక కమాండ్ (లేదా ఒక ఫైల్) కలిగి ఉంటుంది, కాబట్టి దాన్ని మొత్తం copy చేయండి. చుక్కల అంచు ఉన్న box మీకు తిరిగి కనిపించాల్సినదాన్ని చూపుతుంది; దాన్ని మీరు type చేయరు.</p>
</details>
<h3>Allowlist</h3>
<p>నా blocklist policy allowlistలో 26 ఎంట్రీలు ఉన్నాయి. మొదటి శుభ్రత రోజున వాటిలో నాలుగు పాడైనట్లు కనిపించాయి. మూడింటిని browser address bar నుండి పూర్తి address రూపంలో, అంటే <code>https://example.org/</code> రూపంలో, paste చేశారు. నాలుగో దానిలో పేరు మొదటి అక్షరానికి ముందు ఒక space ఉంది. ఆ నాలుగింటినీ <code>example.in</code> వంటి bare namesతో మార్చాను. మిగతా 22 ఎలా రాసి ఉన్నాయో నేను చూడలేదు, రూటర్ configuration history ఇప్పుడు తనిఖీ చేసేంత వెనక్కి వెళ్లదు. అవి రూటర్ సొంత Allow button రాసినట్లు bare names అయి ఉంటే, నా సవరణకు ముందే ఈ లోపం ఉంది, సవరణ దాన్ని ఇంతవరకు దేనికీ సరిపోని మూడు ఎంట్రీలకూ విస్తరించింది.</p>
<p>రూటర్ log ఐదో ఎంట్రీని చూపింది, <code>*.ntp.org</code> అని రాసినది, దాన్ని తర్వాత తొలగించాను. ప్రతి nightly update దాని గురించి &#8220;skip invalid whitelist exclude pattern&#8221; అని log చేసింది. Python regular expressionsలో ప్రారంభంలో <code>*</code> చెల్లదు, కాబట్టి రూటర్ ప్రతి రాత్రి ఆ ఎంట్రీని వదిలేసింది, ఆ విషయం log లో మాత్రమే చెప్పింది. ఉద్దేశించినది చేసే రూపం <code>(.*\.)?ntp\.org\.?$</code>.</p>
<p>తర్వాత Claude, OPNsense 26.7లో allowlistను వర్తింపజేసే codeను చదివింది. ప్రారంభంలోని space ఏ హానీ చేయలేదు: code ప్రతి ఎంట్రీ నుండి spaces తొలగిస్తుంది. సమస్య bare names.</p>
<p>OPNsense ప్రతి ఎంట్రీని regular expressionగా తీసుకుంటుంది, case-insensitiveగా, మరియు ఒక device అడిగే పేరు ప్రారంభంతో సరిపోల్చుతుంది. ఎంట్రీ పేరు చివరకు కట్టబడి ఉండదు, escape చేయని చుక్క ఏ అక్షరానికైనా సరిపోతుంది. కాబట్టి bare <code>example.com</code>, <code>example.com</code>ను అనుమతిస్తుంది కానీ <code>www.example.com</code>ను కాదు. అది ఆ అక్షరాలతో మొదలయ్యే ఏ పేరునైనా కూడా అనుమతిస్తుంది, ప్రతి చుక్క స్థానంలో ఏ అక్షరమున్నా: <code>example.com.evil.net</code>, <code>example-com.evil.net</code>, <code>example.community</code>.</p>
<p>Threat feedలో సరిగ్గా అలాంటి ఆకృతి గల పేర్లు ఉన్నాయి: ప్రసిద్ధ సైట్ పేరు తర్వాత <code>.https.</code> మరియు సంబంధం లేని domain, లేదా చుక్కకు బదులు హైఫన్ ఉన్న సైట్ పేరు. ఈ పరిశీలన కోసం నేను download చేసిన feedలో, నా 26 ఎంట్రీలలో ఏడు అలాంటి 43 పేర్లకు సరిపోయాయి; ఒక ఎంట్రీ 20కి సరిపోయింది. నా రూటర్ testerలో, నేను ప్రయత్నించిన అలాంటి ఐదు పేర్లూ Pass అయ్యాయి, అదే list ఎంట్రీ బ్లాక్ చేసే, ముందు <code>www.</code> ఉన్న అదే పేరు మాత్రం blocked అయింది. అనుమతించిన సైట్ పేరుతో, threat feed బ్లాక్ చేసే domainతో నేను తయారుచేసిన పేరు కూడా Pass అయింది. matching code ప్రకారం, ప్రతి bare ఎంట్రీ, దానితో మొదలయ్యే ఏ పేరునైనా అనుమతిస్తుంది, ఏదైనా list ఆ పేరును బ్లాక్ చేసినా, చేయకపోయినా.</p>
<p>OPNsense సొంత Allow button, Reporting → Unbound DNSలో, bare nameను అదే విధంగా save చేస్తుంది. అక్కడి నుండి చేర్చిన ఎంట్రీలు కూడా అదే విధంగా పనిచేస్తాయి.</p>
<p>సవరణ ఏమిటంటే, ఖచ్చితమైన పేరును రెండు చివరలా anchor చేసి అనుమతించడం:</p>
<div class="sf-box" data-mode="file" data-where="Allowlist ఎంట్రీ (ఉదాహరణ, కమాండ్ కాదు)" data-how="Allowlist Domains field లో paste చేయండి"><pre><code>^www\.example\.com\.?$</code></pre></div>
<p>backslashలు చుక్కలను అక్షరార్థంగా చేస్తాయి, <code>$</code> pattern ను పేరు చివరికి కట్టేస్తుంది. <code>\.?</code> అనేది code తనిఖీ చేసే రెండు మార్గాలలో ఒక దానిలో పేరుకు ఉండే చివరి చుక్కను అనుమతిస్తుంది (లోతైన పరిశీలన చూడండి). <code>^</code> code ఇప్పటికే చేసే పనినే పునరావృతం చేస్తుంది, కాబట్టి దాన్ని వదిలేసినా పనిచేస్తుంది; pattern ఎక్కడైనా ఒకేలా చదవబడేలా నేను దాన్ని ఉంచుతాను. మీ ఎంట్రీలను తనిఖీ చేసి తిరిగి రాసే దశలు &#8220;మీది ఎలా తనిఖీ చేయాలి&#8221; కింద ఉన్న లోతైన పరిశీలనలలో ఉన్నాయి.</p>
<p>ఒక domainను దాని అన్ని subdomainలతో అనుమతించాలంటే <code>(.*\.)?example\.com\.?$</code> పనిచేస్తుంది, కానీ list ఉద్దేశపూర్వకంగా ఆ domain కింద బ్లాక్ చేసే hostలను కూడా అది అనుమతిస్తుంది. నా ఎంట్రీలలో ఒకదానిపై, Pro++ ఆ domain కింద <code>advertising</code>, <code>sponsored-ads</code> వంటి పేర్లున్న ఐదు hostలను బ్లాక్ చేస్తుంది, domainను గానీ దాని <code>www.</code> పేరును గానీ బ్లాక్ చేయదు. subdomain అంతటికీ allow ఇస్తే అవి తిరిగి లోపలికి వస్తాయి.</p>
<p>OPNsense సొంత parsing code, matching call ను కొన్ని పేర్లపై నడిపాను:</p>
<table>
<thead>
<tr>
<th>Allowlist ఎంట్రీ</th>
<th>అడిగిన పేరు</th>
<th>అనుమతి?</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>https://example.org/</code></td>
<td><code>example.org</code></td>
<td>కాదు</td>
</tr>
<tr>
<td><code>example.in</code></td>
<td><code>example.in</code></td>
<td>అవును</td>
</tr>
<tr>
<td><code>example.in</code></td>
<td><code>www.example.in</code></td>
<td>కాదు</td>
</tr>
<tr>
<td><code>example.in</code></td>
<td><code>example.in.example.net</code></td>
<td>అవును</td>
</tr>
<tr>
<td><code>example.in</code></td>
<td><code>example-info.de</code></td>
<td>అవును</td>
</tr>
<tr>
<td><code>^www\.example\.in\.?$</code></td>
<td><code>www.example.in</code></td>
<td>అవును</td>
</tr>
<tr>
<td><code>^www\.example\.in\.?$</code></td>
<td><code>advertising.example.in</code></td>
<td>కాదు</td>
</tr>
<tr>
<td><code>^www\.example\.in\.?$</code></td>
<td><code>www.example.in.example.net</code></td>
<td>కాదు</td>
</tr>
</tbody>
</table>
<p>ఆ 26 ఎంట్రీలన్నీ ఆ ఖచ్చితమైన, anchor చేసిన రూపంలో తిరిగి రాసి మార్పును apply చేశాను. tester ద్వారా Pass అయిన ప్రతి పేరు ఆ తర్వాత blocked అయింది. తన పేరే ఒక list లో ఉన్న ఒక్క ఎంట్రీ మాత్రం ఉద్దేశించినట్లే ఇప్పటికీ Pass అవుతోంది. మిగతా 25 లోని ఖచ్చితమైన పేర్లను ఏ list బ్లాక్ చేయలేదు, కాబట్టి అవి తాము రాసిన పేర్లకు ఏ పనీ చేయలేదు; వాటి ఏకైక ప్రభావం prefix లోపమే. వాటిని తొలగించకుండా anchor చేశాను, ఎందుకంటే ఒక list తర్వాత ఒక పేరును చేర్చవచ్చు. మీకూ అలాంటి ఎంట్రీలు ఉంటే, వాటిని తొలగించడం కూడా సముచితమైన ఎంపికే.</p>
<details>
<summary>లోతైన పరిశీలన: code, మరియు నా పరీక్షలు ఏమి చూపిస్తాయి, ఏమి చూపవు</summary>
<p>blocklist dialogలో ఒకే &#8220;Allowlist Domains&#8221; field ఉంది. దాని help text ప్రకారం అది domains తీసుకుంటుంది, regular expressions వాడవచ్చు, మరియు ఆ policyలోని matchesకు మాత్రమే వర్తిస్తుంది. 26.7లో:</p>
<ul>
<li><code>src/opnsense/service/templates/OPNsense/Unbound/core/blocklists.conf</code> ఆ fieldను <code>excludes.patterns</code>గా, commaలతో వేరు చేసి రాస్తుంది.</li>
<li><code>src/opnsense/scripts/unbound/blocklists/default_bl.py</code> ఆ విలువను commaల వద్ద విభజిస్తుంది, ప్రతి ఎంట్రీపై <code>strip()</code> పిలుస్తుంది, regular expressionగా compile కాని ఎంట్రీని వదిలేస్తుంది (&#8220;skip invalid&#8221; log line తో), మిగతావాటిని, built-in <code>.*localhost$</code> ఎంట్రీతో కలిపి, <code>|</code> తో ఒకే patternగా కలుపుతుంది.</li>
<li><code>src/opnsense/scripts/unbound-dnsbl/lib/__init__.py</code> ఆ patternను case-insensitiveగా compile చేస్తుంది.</li>
<li><code>src/opnsense/scripts/unbound-dnsbl/lib/dnsbl.py</code> blocklist hit తర్వాత దాన్ని <code>r.match(domain)</code> తో పరీక్షిస్తుంది. Python <code>match</code> పేరు ప్రారంభం వద్ద anchor అవుతుంది, చివర కాదు. పేరును ముందుగా lower-case చేసి, దాని చివరి చుక్కను తొలగిస్తారు.</li>
<li>CNAME target blocked అయినప్పుడు, అదే function అసలు పేరును కూడా (<code>r.match(orig)</code>) పరీక్షిస్తుంది, కాబట్టి allowlist చేసిన పేరు blocked alias ద్వారా కూడా resolve అవుతుంది. ఆ అసలు పేరు Unbound నుండి చివరి చుక్కతో, <code>www.example.com.</code> గా వస్తుంది, శుభ్రం చేయబడదు. చివర కేవలం <code>$</code> ఉన్న pattern అక్కడ విఫలమవుతుంది; <code>\.?$</code> రెండు మార్గాల్లోనూ Pass అవుతుంది.</li>
<li><code>src/opnsense/mvc/app/controllers/OPNsense/Unbound/Api/SettingsController.php</code>, <code>updateBlocklistAction</code>, Reportingలోని Allow button పిలిచేది. అది చివరి చుక్కను తొలగించి (<code>rtrim($domain, '.')</code>), పేరును ఉన్నది ఉన్నట్లు, escape చేయకుండా, anchor చేయకుండా save చేస్తుంది.</li>
</ul>
<p>OPNsense manual allowlist ఎంట్రీని, pattern ఉన్న blocklist items ను మినహాయించేదిగా వివరిస్తుంది. code ప్రారంభంలో మరింత ఇరుకుగా ఉంది, ఎందుకంటే మొదటి అక్షరం నుండి మాత్రమే సరిపోల్చుతుంది, చివర మాత్రం అంతే తెరిచి ఉంది. ఏ అర్థం తీసుకున్నా, చివరను anchor చేయడం ఎంట్రీ రాసేవారికే వదిలేశారు. అవే ఐదు ఫైళ్లను 26.7 తాజా release లో, development branch లో పోల్చాను: allowlist code మారలేదు.</p>
<p>పరీక్షలు చూపేవి: 26.7 source లోని parser, matching calls ఈ ఎంట్రీలను ఎలా చూస్తాయో, రూటర్ బయట నడిపినవి, CNAME కేసును చివరి చుక్క చేర్చి simulate చేసినవి; మరియు నా రూటర్‌లో, నేను ప్రయత్నించిన ప్రతి phishing పేరుకు tester తీర్పు, allowlist చేసిన పేరుతో మొదలుకాకపోవడమే తేడా అయిన control తో పాటు, rewrite కు ముందు, తర్వాత. tester రూటర్ load చేసిన lists పై అదే matching code నడుపుతుంది, కానీ direct lookup కు మాత్రమే, కాబట్టి CNAME మార్గాన్ని అది చూపలేదు. 43 పేర్ల లెక్క రూటర్ నుండి కాదు, ప్రచురించిన lists నుండి వచ్చింది; ఆ 43 అన్నీ TIFలో ఉన్నాయి.</p>
</details>
<h3>మీది ఎలా తనిఖీ చేయాలి</h3>
<p>నాలుగు తనిఖీలు, చివరిది తప్ప అన్నీ చదవడానికి మాత్రమే:</p>
<ol>
<li>resolver logలో download కాని lists కోసం, skip అయిన allowlist ఎంట్రీల కోసం చదవండి.</li>
<li>blocklist testerలో, blocked కావలసిన ఒక పేరును, Pass కావలసిన ఒక పేరును ప్రయత్నించి, lists load అయ్యాయో చూడండి.</li>
<li>ప్రతి allowlist ఎంట్రీకి, ఆ ఎంట్రీ తర్వాత మీ lists బ్లాక్ చేసే domain చేర్చిన పేరును test చేయండి, తర్వాత ముందు <code>www.</code> ఉన్న అదే పేరును. మొదటిది Pass అయి రెండోది blocked అయితే, ఆ ఎంట్రీ తెరిచి ఉంది.</li>
<li>తెరిచి ఉన్న ప్రతి ఎంట్రీని anchor చేసి తిరిగి రాయండి, apply చేసి, మళ్లీ test చేయండి.</li>
</ol>
<p>1 నుండి 3 వరకు తనిఖీల click-by-click దశలు, rewrite దశలు కింద ఉన్న రెండు లోతైన పరిశీలనలలో ఉన్నాయి. అవి sign-in పేజీ నుండి మొదలై, ప్రతి దశ ఏమి మారుస్తుందో చెబుతాయి.</p>
<details>
<summary>లోతైన పరిశీలన: దశలవారీగా, మీ allowlist తనిఖీ</summary>
<p><strong>మొదలుపెట్టే ముందు.</strong> మీ నెట్‌వర్క్‌లోని ఒక కంప్యూటర్‌లో browser, మరియు మీ రూటర్ settings పేజీ address, login కావాలి. 1 నుండి 8 దశలు చదవడం మాత్రమే: రూటర్‌లో ఏదీ మార్చవు, కాబట్టి ఎక్కడ ఆపినా ఏదీ వెనక్కి తీసుకోనక్కర్లేదు. సుమారు పది నిమిషాలు పడుతుంది, దానికి తోడు ప్రతి test కు సుమారు పది సెకన్లు, ఎందుకంటే tester ప్రతిసారీ మొత్తం blocklistను load చేస్తుంది.</p>
<ol>
<li>browser తెరిచి, OPNsense లోకి sign in అవడానికి మీరు వాడే addressను type చేయండి. Sign in అవండి. Lobby page కనిపించాలి. page load కాకపోతే, కంప్యూటర్ మీ ఇంటి నెట్‌వర్క్‌లో ఉందో లేదో, రూటర్‌కు ఏ ఇతర మార్పు కోసమైనా వాడే అదే addressను వాడారో లేదో చూడండి.</li>
<li>ఎడమవైపు menuలో <strong>Services</strong>, తర్వాత <strong>Unbound DNS</strong>, తర్వాత <strong>Log File</strong> click చేయండి. Date, Severity, Process, Line columns ఉన్న table కనిపించాలి. దానికి పైన search box, severity box (Warning కు set చేసి), time box (Last day కు set చేసి) ఉన్నాయి.</li>
<li>search boxను click చేసి, <code>blocklist</code> అని type చేసి Enter నొక్కండి. రెండు రకాల lines ముఖ్యం. &#8220;unable to download blocklist&#8221; అంటే ఒక list load కాలేదు, అది ఏమీ చేర్చదు. &#8220;skip invalid whitelist exclude pattern&#8221; అంటే OPNsense ఒక allowlist ఎంట్రీని వదిలేసింది. table ఖాళీగా ఉంటే, గత ఒక రోజులో Warning స్థాయిలో ఏదీ log కాలేదు. &#8220;blocklist loaded&#8221; lines చూడటానికి severity boxను తెరిచి <strong>Informational</strong> ను కూడా tick చేయండి; ఇంకా వెనక్కి చూడటానికి time boxను తెరవండి.</li>
<li>అదే menuలో <strong>Blocklists</strong> click చేసి, తర్వాత పేజీ పైన ఉన్న <strong>Tester</strong> tab click చేయండి. Domain box, Source box, <strong>Test</strong> button కనిపించాలి. Sourceను ఖాళీగా వదిలేయండి; అప్పుడు test రూటర్ స్వయంగా అడిగినట్లు నడుస్తుంది. Source ఒక device address తీసుకుంటుంది, కొన్ని devicesకు మాత్రమే వర్తించే policy మీకు ఉంటేనే అది అవసరం.</li>
<li>Domain లో <code>googleads.g.doubleclick.net</code> type చేసి <strong>Test</strong> click చేయండి. సుమారు పది సెకన్లు వేచి ఉండండి. ఫలితం Block అయి ఉండాలి. తర్వాత <code>www.youtube.com</code> test చేయండి; అది Pass కావాలి. మొదటి పేరు Pass అయితే, ఏ list కూడా load కాలేదు, లేదా ఆ పేరు మీ సొంత allowlistలో ఉంది: 3వ దశకు వెళ్లి errors చదవండి, ఆ పేరును మీరు allowlist చేసి ఉంటే, మీ lists బ్లాక్ చేసే మరో పేరును ఎంచుకోండి. tester CNAMEలను అనుసరించదు. CNAME అంటే మరో పేరును చూపే పేరు; tester మీరు type చేసిన పేరును మాత్రమే తనిఖీ చేస్తుంది.</li>
<li><strong>Blocklists</strong> tab click చేయండి. మీ policy row కుడి చివర, పెన్సిల్ (Edit) click చేయండి. <strong>Edit Blocklist</strong> అనే window తెరుచుకుంటుంది. <strong>Allowlist Domains</strong> మీ ఎంట్రీలను, ఒక్కో tag గా చూపుతుంది. వాటిని చదివి, <strong>Cancel</strong> click చేయండి. ఏదీ save కాదు.</li>
<li>ప్రతి ఎంట్రీకి, ఆ ఎంట్రీ తర్వాత మీ lists బ్లాక్ చేసే domain చేర్చిన పేరును test చేయండి. నా lists బ్లాక్ చేసే పేరు <code>googleads.g.doubleclick.net</code>, 5వ దశలోనిదే. మీ lists దాన్ని బ్లాక్ చేయకపోతే, అవి బ్లాక్ చేసే పేరును ఎంచుకోండి. కాబట్టి <code>example.com</code> ఎంట్రీకి, <code>example.com.googleads.g.doubleclick.net</code> type చేసి <strong>Test</strong> click చేయండి. తర్వాత ముందు <code>www.</code> ఉన్న అదే పేరును, <code>www.example.com.googleads.g.doubleclick.net</code>, test చేయండి. మీరు TIF load చేస్తే, బదులుగా ఆ list లోని ఒక పేరును వాడవచ్చు. ఇప్పటికే <code>^</code> తో మొదలై <code>$</code> తో ముగిసే ఎంట్రీ anchor చేసినదే; దాన్ని వదిలేయండి.</li>
<li>రెండు ఫలితాలను కలిపి చదవండి. మొదటిది Pass అయి రెండోది blocked అయితే, ఆ ఎంట్రీ తెరిచి ఉంది: దానితో మొదలయ్యే ప్రతి పేరునూ అది లోపలికి పంపుతుంది. దాన్ని anchor చేసి తిరిగి రాయండి. ఏ list బ్లాక్ చేయని పేరు allowlist ఏం చెప్పినా Pass అవుతుంది, కాబట్టి Pass ను లోపంగా చదివే ముందు, ఆ పేరు blocked అవుతుందని testerలో నిర్ధారించుకోండి.</li>
</ol>
</details>
<details>
<summary>లోతైన పరిశీలన: దశలవారీగా, మీ allowlist తిరిగి రాయడం</summary>
<p><strong>మొదలుపెట్టే ముందు.</strong> ఇది మీ రూటర్ filteringను మారుస్తుంది. పదిహేను నిమిషాలు పడుతుంది. ఇక్కడ పొరపాటు చాలావరకు, అనుమతించిన ఒక సైట్ load కాకపోవడంగా కనిపిస్తుంది. మీ ఇంటర్నెట్ మిగతా భాగం పనిచేస్తూనే ఉండాలి. రూటర్ మార్పును సుమారు ఒక నిమిషంలో apply చేస్తుంది (నా దానిపై 43 సెకన్లు), Unboundను restart చేయదు; నడుస్తున్న process లోకి lists load అవుతున్నట్లు log చూపుతుంది. 3వ దశ మీ పాత ఎంట్రీల కాపీని save చేస్తుంది, 8వ దశ వాటిని తిరిగి పెడుతుంది.</p>
<ol>
<li>రూటర్ settings పేజీ తెరిచి sign in అవండి. <strong>Services</strong>, తర్వాత <strong>Unbound DNS</strong>, తర్వాత <strong>Blocklists</strong> click చేయండి.</li>
<li>మీ policy row కుడి చివర, పెన్సిల్ (Edit) click చేయండి. <strong>Edit Blocklist</strong> window తెరుచుకుంటుంది. <strong>Allowlist Domains</strong> కింద, box కింద ఉన్న చిన్న link <strong>Text</strong> click చేయండి. tags ఒక్కో line కు ఒక ఎంట్రీ ఉన్న సాదా boxగా మారతాయి, <strong>Back</strong> link కనిపిస్తుంది. మీకు ఒకటికంటే ఎక్కువ policy ఉంటే, ప్రతిదానికి దాని సొంత allowlist ఉంటుంది; ప్రతిదానికీ ఇలా చేయండి.</li>
<li>undo కోసం ఒక కాపీ తయారుచేయండి. box లోపల click చేసి, <code>Ctrl</code> + <code>A</code>, తర్వాత <code>Ctrl</code> + <code>C</code> నొక్కండి. Notepad తెరిచి (Start menu, <code>notepad</code> అని type చేసి, Enter నొక్కండి), <code>Ctrl</code> + <code>V</code> నొక్కి, ఫైల్‌ను <code>allowlist-before.txt</code> పేరుతో మీకు మళ్లీ దొరికే ఫోల్డర్‌లో save చేయండి. ఫైల్‌లో ఒక్కో line కు ఒక ఎంట్రీ ఉండాలి.</li>
<li>
<p>box లోని ప్రతి line ను తిరిగి రాయండి. ఇది సాదా పేర్ల కోసం; ఇప్పటికే pattern అయిన ఎంట్రీ, అంటే <code>(.*\.)?</code> ఉన్నది, అలాగే ఉంటుంది. మీ devices అడిగే ఖచ్చితమైన పేరును రాయండి. ప్రతి చుక్క ముందు <code>\</code>, మొదట <code>^</code>, చివర <code>\.?$</code> పెట్టండి:</p>
<ul>
<li><code>example.in</code> అనేది <code>^example\.in\.?$</code> అవుతుంది</li>
<li><code>www.example.com</code> అనేది <code>^www\.example\.com\.?$</code> అవుతుంది</li>
</ul>
<p>ప్రతి line కు ఒక ఎంట్రీ ఉంచండి, spaces లేకుండా, commas లేకుండా. <code>www.</code> ఉన్న పేరు, అది లేని అదే పేరు రెండు వేర్వేరు పేర్లు, రెండు lines కావాలి. device ఏది అడుగుతుందో మీకు తెలియకపోతే, <strong>Reporting</strong>, <strong>Unbound DNS</strong> లో చూడండి, లేదా రెండూ list లో పెట్టండి.</p>
</li>
<li>
<p><strong>Back</strong> click చేయండి. lines tags గా తిరిగి వస్తాయి. ప్రతి tag కొత్త రూపంలో ఉందో చూడండి. <strong>Save</strong> click చేయండి. window మూసుకుంటుంది.</p>
</li>
<li>table కింద ఉన్న నారింజ రంగు button <strong>Apply</strong> click చేయండి. సుమారు ఒక నిమిషం వేచి ఉండండి.</li>
<li>ఫలితాన్ని తనిఖీ చేయండి. <strong>Services</strong>, <strong>Unbound DNS</strong>, <strong>Log File</strong> తెరిచి, <code>blocklist</code> కోసం search చేసి, severity boxలో <strong>Informational</strong> tick చేయండి. &#8220;updating blocklist&#8221;, తర్వాత &#8220;blocklist loaded. length is&#8221; మరియు ఒక సంఖ్య కనిపించాలి, &#8220;skip invalid&#8221; line ఉండకూడదు. తర్వాత పైన చెప్పిన tester దశలను మళ్లీ చేయండి: lookalike పేర్లు ఇప్పుడు Block అవ్వాలి. ఒక list బ్లాక్ చేసే పేరును అనుమతించే ఎంట్రీ (నా దానిలో, ఒక Google ad host కోసం ఉన్నది) ఇప్పటికీ Pass అవ్వాలి.</li>
<li>మార్పు తర్వాత ఒక సైట్ load కావడం ఆగితే, దాన్ని undo చేయండి. Notepadలో <code>allowlist-before.txt</code> తెరిచి, <code>Ctrl</code> + <code>A</code>, తర్వాత <code>Ctrl</code> + <code>C</code> నొక్కండి. రూటర్‌లో 1, 2 దశలను మళ్లీ చేసి, box లోపల click చేసి, <code>Ctrl</code> + <code>A</code>, తర్వాత <code>Ctrl</code> + <code>V</code> నొక్కి పాత ఎంట్రీలను కొత్తవాటిపై paste చేసి, <strong>Back</strong>, <strong>Save</strong>, <strong>Apply</strong> click చేయండి. మీరు list చేయని పేరు అవసరమైన సైట్, ఆ ఖచ్చితమైన పేరును మీరు చేర్చే వరకు blocked గా ఉంటుంది.</li>
</ol>
</details>
<details>
<summary>లోతైన పరిశీలన: కంప్యూటర్ నుండి allowlist మార్పును పరీక్షించడం</summary>
<p><strong>మొదలుపెట్టే ముందు.</strong> ఇది రూటర్ ఉన్న నెట్‌వర్క్‌లోని Windows PC కోసం. ఇది రూటర్ DNSను ఒక పేరు అడుగుతుంది, PC సొంత DNS cacheను clear చేస్తుంది; ఇంకేదీ మార్చదు. రెండు నిమిషాలు పడుతుంది. Mac లేదా Linuxలో ఆలోచన అదే (<code>nslookup name router-address</code>), కానీ cache-clear కమాండ్ వేరుగా ఉంటుంది.</p>
<ol>
<li>Start menu click చేసి, <code>powershell</code> అని type చేసి Enter నొక్కండి. <code>PS</code> తో మొదలయ్యే prompt ఉన్న window తెరుచుకుంటుంది.</li>
<li>
<p>రూటర్ addressను కనుక్కోండి. ఇది type చేసి Enter నొక్కండి:</p>
<div class="sf-box" data-mode="one" data-shell="ps" data-effect="read" data-effect-text="చూడటమే — ప్రయత్నించడం సురక్షితం" data-where="మీ PC లోని PowerShell" data-how="1 కమాండ్ — paste చేసి, Enter నొక్కండి"><pre><code>ipconfig</code></pre></div>
<p class="sf-after">మీరు వాడుతున్న adapter కింద <strong>Default Gateway</strong> కోసం చూడండి. ఆ address మీ రూటర్; కింది దశలు దాన్ని <code>&lt;router-ip&gt;</code> అంటాయి. మీ రూటర్ మరో రూటర్ వెనుక ఉంటే, default gateway ఆ ఇతర device కావచ్చు; మీ DNS blocklists నడిపే box address వాడండి. line ఖాళీగా ఉంటే, మీరు connect కాని adapter చూస్తున్నారు; తర్వాతి దాని వద్దకు scroll చేయండి.</p>
</li>
<li>
<p>రూటర్‌లో <strong>Apply</strong> click చేసి ఒక నిమిషం వేచిన తర్వాత, PC cacheను clear చేయండి. Blocked answers PC cache లో ఒక గంట వరకు ఉంటాయి, కాబట్టి ఇది చేయకపోతే PC పాత answerను ఉంచుకోవచ్చు:</p>
<div class="sf-box" data-mode="one" data-shell="ps" data-effect="change" data-effect-text="PC DNS cache ను మాత్రమే clear చేస్తుంది" data-where="మీ PC లోని PowerShell" data-how="1 కమాండ్ — paste చేసి, Enter నొక్కండి"><pre><code>ipconfig /flushdns</code></pre></div>
</li>
<li>
<p><code>&lt;router-ip&gt;</code> స్థానంలో 2వ దశలోని addressను పెట్టి, రూటర్‌ను ఆ పేరు అడగండి. పేరు తర్వాత ఉన్న చివరి చుక్క Windows తన search suffixes ను ముందుగా ప్రయత్నించకుండా ఆపుతుంది:</p>
<div class="sf-box" data-mode="one" data-shell="ps" data-effect="read" data-effect-text="చూడటమే — ప్రయత్నించడం సురక్షితం" data-where="మీ PC లోని PowerShell" data-how="1 కమాండ్ — paste చేసి, Enter నొక్కండి"><pre><code>nslookup www.example.com. &lt;router-ip&gt;</code></pre></div>
<p class="sf-after">blocked పేరుకు <code>0.0.0.0</code> సమాధానం వస్తుంది, లేదా policyలో Return NXDOMAIN tick చేసి ఉంటే &#8220;Non-existent domain&#8221;. అనుమతించిన పేరుకు దాని నిజమైన address వస్తుంది. మొదటి రెండు lines మీ రూటర్‌ను చూపుతాయి; మిగతాది సమాధానం.</p>
</li>
</ol>
</details>
<h3>పద్దెనిమిది lists చివరికి ఏమి చేర్చాయి</h3>
<p>రూటర్ resolver logలో, దాని మొదటి ఎంట్రీ నుండి మొదటి శుభ్రత వరకు, ప్రతి పూర్తి nightly update అదే పద్దెనిమిది lists ను load చేసేలా set చేసి ఉంది (వాటిలో ThreatFox కూడా, కింద చూడండి):</p>
<ul>
<li>Hagezi Normal, దానికి తోడు Pro, Pro++, Ultimate Mini versions</li>
<li>Threat Intelligence Feeds (TIF) మూడు పరిమాణాలలోనూ: full, Medium, Mini</li>
<li>Gambling మూడు పరిమాణాలలోనూ</li>
<li>Fake, Pop-Up Ads, Badware Hoster, DynDNS, Anti Piracy, &#8220;Safesearch not supported&#8221;</li>
<li>OISD NSFW, Abuse.ch ThreatFox</li>
</ul>
<p>వీటిలో చాలావాటిని నిర్వహించే Hagezi, తన lists ను కలపడానికి తన FAQలో ఈ నియమాలు ఇస్తాడు:</p>
<ol>
<li>ఐదు Multi lists — Light, Normal, Pro, Pro++, Ultimate — ఒకదానిపై ఒకటి నిర్మితమై ఉంటాయి. ప్రతిదానిలో దాని కింది list ఉంటుంది. మీరు ఒకదాన్ని ఎంచుకోవాలి.</li>
<li>పరిమాణం తగ్గించిన versions (Mini, మరియు TIF, Gambling కు Medium) వాటి full list కు ప్రత్యామ్నాయాలు. వాటిని full list పైన పెట్టరు.</li>
<li>TIF మినహాయింపు. ఇది malware, cryptojacking, scams, spam, phishing లను కవర్ చేస్తుంది, మీరు ఎంచుకునే tier తో పాటు నడపడానికే ఉద్దేశించినది.</li>
</ol>
<p>Pro, Pro++, Ultimate, Gambling Minis ఎక్కువగా సందర్శించే domains lists లో కూడా ఉన్న పేర్లను మాత్రమే ఉంచుతాయి. TIF Mini, Gambling Mini Medium list నుండి కత్తిరించినవి. Minis ను పరిమిత మెమరీ ఉన్న devices లోని blockers కోసం తయారు చేసినవిగా Hagezi వివరిస్తాడు.</p>
<details>
<summary>లోతైన పరిశీలన: ఏ tier ఎవరికి, Ultimate ఖరీదు ఏమిటి</summary>
<p>సైట్లు పనిచేయకపోతే దాన్ని ఎవరు చూసుకుంటారో ఆ వ్యక్తికి Hagezi FAQ tiers ను జత చేస్తుంది:</p>
<table>
<thead>
<tr>
<th>Tier</th>
<th>ఎవరికి</th>
<th>పనిచేయకపోయే ప్రమాదం (Hagezi రేటింగ్)</th>
</tr>
</thead>
<tbody>
<tr>
<td>Light</td>
<td>పెద్ద lists ను తట్టుకోలేని blocker, లేదా Normal కూడా ఎక్కువైన సెట్టింగ్</td>
<td>కనిష్టం</td>
</tr>
<tr>
<td>Normal</td>
<td>ఎవరూ unblock చేయడానికి లేని, పర్యవేక్షణ లేని setups</td>
<td>తక్కువ</td>
</tr>
<tr>
<td>Pro</td>
<td>ఎవరైనా unblock చేయగలిగే చోట; TIF తో కలిపి అతని default సిఫార్సు</td>
<td>తక్కువ నుండి మధ్యస్థం</td>
</tr>
<tr>
<td>Pro++</td>
<td>admin ఉన్న అనుభవజ్ఞులైన వినియోగదారులు</td>
<td>మధ్యస్థం</td>
</tr>
<tr>
<td>Ultimate</td>
<td>admin అందుబాటులో ఉన్న, చాలా అనుభవజ్ఞులైన వినియోగదారులు</td>
<td>ఎక్కువ</td>
</tr>
</tbody>
</table>
<p>ప్రతి tier లో native tracker lists వాటా కూడా ఉంటుంది: TVలు, ఫోన్లు, operating systems లో అంతర్నిర్మితంగా ఉన్న telemetry. Pro++ దాదాపు అన్నింటినీ బ్లాక్ చేస్తుంది; Ultimate అన్నింటినీ బ్లాక్ చేస్తుంది. Ultimate వల్ల కలిగే నష్టాలను README జాబితా చేస్తుంది: కొన్ని Facebook, Messenger functions, avatars, video effects వంటి WhatsApp అదనపు సౌకర్యాలు, Windows Spotlight, Xbox achievement history, మరియు కొన్ని సైట్లు ఆధారపడే location trackers, వీటివల్ల తప్పు regional settings, ఎక్కువ CAPTCHAs రావచ్చు.</p>
</details>
<p>నా సెట్ మొదటి రెండు నియమాలను ఉల్లంఘించింది. ఈ పరిశీలన కోసం lists ను ఒకసారి download చేసి, ఒక list లోని ఏ ఎంట్రీలను మరో list ఇప్పటికే బ్లాక్ చేస్తోందో చూడటానికి వాటిని పేరు పేరుగా పోల్చాను. రూటర్ ఇంతకుముందు load చేసిన కాపీలు నా దగ్గర లేవు, ThreatFox ను నేను కొలవలేదు, కాబట్టి పదిహేడు lists ను కొలిచాను.</p>
<p>ఆ పదిహేడింటిలో ఏడు, ప్రతి list లోని ఒక్క marker ఎంట్రీ మినహా, మిగతా సెట్ ద్వారా కవర్ అయ్యాయి: Pro Mini, Pro++ Mini, TIF Medium, TIF Mini, Gambling Medium, Gambling Mini, Fake. ఆ ఏడింటినీ కలిపి తొలగిస్తే, TIF Medium, Mini లో ఉండి full TIF లో లేని 15 పేర్లు పోయేవి. Pop-Up Ads తన 48,277 పేర్లలో 37 ను మిగతా సెట్‌కు చేర్చింది (Pro++ ఒక్కదానితో పోలిస్తే అది మూడింటిని చేర్చుతుంది, కింద చూడండి). DynDNS, Anti Piracy భిన్నమైనవి: ఆ lists లో సెట్‌లోని మరే list లో లేని సుమారు 1,200, సుమారు 55,000 పేర్లు ఉన్నాయి, వాటిని duplicates గా కాక, నా ఎంపికతో తొలగించాను.</p>
<p>ఆ నాలుగు tier lists కలిసి 233,710 పేర్లు కలిగి ఉన్నాయి, అవన్నీ Ultimate లో ఉన్నాయి, Hagezi నాలుగు marker ఎంట్రీలు తప్ప. Pro++ ఒక్కదానితో పోలిస్తే, అవి 31,411 Pro++ ఎంట్రీలను కోల్పోయాయి, అవి ఎక్కువగా సందర్శించే lists లో లేనివి. వాటి స్థానంలో Ultimate మాత్రమే బ్లాక్ చేసే 25,040 ఎంట్రీలను (Ultimate Mini marker తో 25,041) అవి కలిగి ఉన్నాయి, అన్నీ ఎక్కువగా సందర్శించే lists నుండి. Hagezi Ultimate పనిచేయకపోయే ప్రమాదాన్ని &#8220;ఎక్కువ&#8221; అని రేట్ చేస్తాడు. వాటివల్ల కలిగిన అంతరాయాల రికార్డు నా దగ్గర లేదు, దాని కోసం నేను పరీక్షించనూ లేదు, కానీ Hagezi రేటింగ్ ప్రకారం ఆ మిశ్రమం Ultimate ప్రమాదాన్ని తీసుకుంది, Pro++ కవరేజీని కోల్పోయింది.</p>
<details>
<summary>లోతైన పరిశీలన: నేను ఎలా కొలిచాను, సాదా పోలిక ఎందుకు తప్పు ఫలితం ఇస్తుంది</summary>
<p>OPNsense Hagezi wildcard formatను వాడుతుంది, అందులో <code>*.example.com</code> వంటి line example.com ను, దాని కింది ప్రతి పేరును బ్లాక్ చేస్తుంది. కాబట్టి list A లోని ఎంట్రీ, list B లో ఆ ఎంట్రీ లేదా దాని parent domains ఏవైనా ఉంటే, B ద్వారా ఇప్పటికే blocked అయినట్లే.</p>
<p>సాదా text పోలిక దాన్ని గుర్తించదు. <code>comm</code> Ultimate Mini లో &#8220;లేవు&#8221; అని 3,294 Pro++ Mini ఎంట్రీలను చూపిస్తుంది. వాటిలో ఒకటి తప్ప అన్నీ కవర్ అయ్యాయి, ఎందుకంటే Ultimate Mini బదులుగా parent domain ను బ్లాక్ చేస్తుంది. Adobe tracking domain అయిన <code>omtrdc.net</code> మొత్తానికి దానికి ఒకే line ఉంది, Pro++ Mini దాని 998 hosts ను ఒక్కొక్కటిగా జాబితా చేస్తుంది. మిగిలిన ఒకటి Hagezi marker ఎంట్రీ, కింద వివరించాను.</p>
<p>అదే విధంగా కొలిచిన నాలుగు tier lists:</p>
<table>
<thead>
<tr>
<th>Normal + Pro Mini + Pro++ Mini + Ultimate Mini</th>
<th></th>
</tr>
</thead>
<tbody>
<tr>
<td>ప్రత్యేక పేర్లు</td>
<td>233,710</td>
</tr>
<tr>
<td>వాటిలో, Ultimate లో కూడా ఉన్నవి</td>
<td>4 తప్ప అన్నీ (Hagezi marker ఎంట్రీలు)</td>
</tr>
<tr>
<td>మిశ్రమంలో లేని Pro++ ఎంట్రీలు</td>
<td>223,551 లో 31,411</td>
</tr>
<tr>
<td>మిశ్రమంలోని, Ultimate మాత్రమే బ్లాక్ చేసే పేర్లు</td>
<td>25,040</td>
</tr>
</tbody>
</table>
<p>నేను వాడిన తనిఖీ parent domains ను పైకి నడుస్తూ చూస్తుంది. ఇది Python 3 script, Python తప్ప ఇన్‌స్టాల్ చేయాల్సినదేదీ లేదు. script మొదట ఉంది; దాన్ని save చేసి నడపడానికి దశలు ఆ తర్వాత ఉన్నాయి.</p>
<div class="sf-box" data-mode="file" data-where="ఫైల్: hagezi_overlap.py" data-how="దీన్ని ఫైల్‌గా save చేయండి — నడపవద్దు"><pre><code>#!/usr/bin/env python3
"""hagezi_overlap.py - how much of blocklist A is already blocked by blocklist B.

Reads two Hagezi lists in the wildcard format (the /wildcard/ files, the format
OPNsense uses). A line "*.example.com" blocks example.com and every name under
it, so an entry of A counts as covered when the entry itself, or one of its
parent domains, is in B. A plain text comparison (comm, diff) misses that and
reports too many differences.

Usage:  python3 hagezi_overlap.py A.txt B.txt
Author: Vivek Sanghi. Licence: CC BY-NC-SA 4.0, as the blog.
"""
import re
import sys

WILDCARD = re.compile(r"^\*\.[a-z0-9_-]+(\.[a-z0-9_-]+)+$")


def load(path):
    names = set()
    try:
        f = open(path, encoding="utf-8-sig")
    except OSError as e:
        sys.exit(f"{path}: cannot open ({e.strerror})")
    with f:
        for number, line in enumerate(f, 1):
            line = line.strip().lower()
            if not line or line.startswith("#"):
                continue
            if not WILDCARD.match(line):
                sys.exit(f"{path}, line {number}: not a wildcard-format line "
                         "('*.example.com'). Download the /wildcard/ version of the list.")
            names.add(line[2:])
    if not names:
        sys.exit(f"{path}: no entries found; check the download")
    return names


def covered(name, blocked):
    while True:
        if name in blocked:
            return True
        if "." not in name:
            return False
        name = name.split(".", 1)[1]


def main():
    if len(sys.argv) != 3:
        sys.exit("usage: hagezi_overlap.py A.txt B.txt")
    a, b = load(sys.argv[1]), load(sys.argv[2])
    missing = sorted(n for n in a if not covered(n, b))
    print(f"{sys.argv[1]}: {len(a):,} entries; {len(a) - len(missing):,} already "
          f"blocked by {sys.argv[2]}; {len(missing):,} not")
    for n in missing[:10]:
        print(f"  not covered: {n}")
    if len(missing) &gt; 10:
        print(f"  ... and {len(missing) - 10:,} more")


if __name__ == "__main__":
    main()
</code></pre></div>
<p><strong>మొదలుపెట్టే ముందు.</strong> ఇది Windows PC కోసం. మీకు Python 3 కావాలి (3వ దశ తనిఖీ చేస్తుంది). ఈ దశలు మీ user folder లో ఒక ఫోల్డర్ సృష్టిస్తాయి, అందులో కొన్ని megabytes ఉన్న రెండు list ఫైళ్లను download చేసి, వాటిని చదువుతాయి; ఇంకేదీ మార్చవు. పది నిమిషాలు పడుతుంది. Undo చేయడానికి, File Explorer లో ఆ ఫోల్డర్‌ను delete చేయండి. Mac లేదా Linuxలో Terminal వాడండి, <code>python3</code> వాడండి (<code>py</code> బదులు), <code>curl</code> వాడండి (<code>curl.exe</code> బదులు).</p>
<ol>
<li>Start menu click చేసి, <code>powershell</code> అని type చేసి Enter నొక్కండి. <code>PS</code> తో మొదలయ్యే prompt ఉన్న window తెరుచుకుంటుంది.</li>
<li>
<p>ఒక ఫోల్డర్ చేసి దానిలోకి వెళ్లండి. ప్రతి line కు కొంత సమయం పడుతుంది; వాటిని ఒక్కొక్కటిగా నడపండి:</p>
<div class="sf-box" data-mode="each" data-shell="ps" data-effect="change" data-effect-text="ఒక ఫోల్డర్ సృష్టిస్తుంది" data-where="మీ PC లోని PowerShell" data-how="2 కమాండ్లు — ఒక్కొక్కటిగా, వరుసగా నడపండి; ఆ line ను copy చేయడానికి PS&gt; ను click చేయండి"><pre><code>mkdir hagezi-check
cd hagezi-check</code></pre></div>
<p class="sf-after">prompt ఇప్పుడు <code>hagezi-check</code> తో ముగియాలి. మొదటి line ఆ ఫోల్డర్ ఇప్పటికే ఉందని చెబితే, మరో పేరు ఎంచుకుని రెండు lines లోనూ వాడండి.</p>
</li>
<li>
<p>Python ఇన్‌స్టాల్ అయి ఉందో తనిఖీ చేయండి:</p>
<div class="sf-box" data-mode="one" data-shell="ps" data-effect="read" data-effect-text="చూడటమే — ప్రయత్నించడం సురక్షితం" data-where="మీ PC లోని PowerShell" data-how="1 కమాండ్ — paste చేసి, Enter నొక్కండి"><pre><code>py --version</code></pre></div>
<p class="sf-after"><code>Python 3.12.4</code> వంటి line కనిపించాలి. PowerShell <code>py</code> ను గుర్తించలేదని చెబితే, python.org నుండి Python 3 ను ఇన్‌స్టాల్ చేయండి (installer లో &#8220;Add python.exe to PATH&#8221; tick చేయండి), PowerShell మూసి 1వ దశ నుండి మళ్లీ మొదలుపెట్టండి.</p>
</li>
<li>
<p>script ఫైల్ సృష్టించండి. ఇది Notepad ను తెరుస్తుంది:</p>
<div class="sf-box" data-mode="one" data-shell="ps" data-effect="change" data-effect-text="ఒక ఫైల్ సృష్టిస్తుంది" data-where="మీ PC లోని PowerShell" data-how="1 కమాండ్ — paste చేసి, Enter నొక్కండి"><pre><code>notepad hagezi_overlap.py</code></pre></div>
<p class="sf-after">Notepad కొత్త ఫైల్ సృష్టించాలా అని అడుగుతుంది; <strong>Yes</strong> click చేయండి. పై box లోని script ను paste చేయండి (box లో <strong>Copy</strong> click చేసి, Notepad లో <code>Ctrl</code> + <code>V</code>), <code>Ctrl</code> + <code>S</code> నొక్కి, Notepad మూసివేయండి. Notepad అడగకుండా తెరుచుకుంటే, <strong>File</strong>, <strong>Save as</strong> తో save చేయండి, ఫైల్ పేరుగా కొటేషన్ మార్కుల్లో <code>hagezi_overlap.py</code> type చేసి, ఫోల్డర్ <code>hagezi-check</code> అని చూసుకుని, <strong>Save</strong> click చేయండి.</p>
</li>
<li>
<p>రెండు lists ను ఫోల్డర్‌లోకి download చేయండి. Windowsలో, PowerShell లో <code>curl.exe</code> type చేయండి, <code>curl</code> కాదు. lines ను ఒక్కొక్కటిగా నడపండి:</p>
<div class="sf-box" data-mode="each" data-shell="ps" data-effect="change" data-effect-text="రెండు ఫైళ్లను download చేస్తుంది" data-where="మీ PC లోని PowerShell" data-how="2 కమాండ్లు — ఒక్కొక్కటిగా, వరుసగా నడపండి; ఆ line ను copy చేయడానికి PS&gt; ను click చేయండి"><pre><code>curl.exe -o pro.plus.mini.txt https://cdn.jsdelivr.net/gh/hagezi/dns-blocklists@latest/wildcard/pro.plus.mini.txt
curl.exe -o ultimate.mini.txt https://cdn.jsdelivr.net/gh/hagezi/dns-blocklists@latest/wildcard/ultimate.mini.txt</code></pre></div>
<p class="sf-after">ప్రతిదానికి కొన్ని సెకన్లు పడుతుంది, progress table ను చూపుతుంది. ఒక line error తో ముగిస్తే, connection ను చూసి ఆ line ను మళ్లీ నడపండి.</p>
</li>
<li>
<p>తనిఖీని నడపండి:</p>
<div class="sf-box" data-mode="one" data-shell="ps" data-effect="read" data-effect-text="చూడటమే — ప్రయత్నించడం సురక్షితం" data-where="మీ PC లోని PowerShell" data-how="1 కమాండ్ — paste చేసి, Enter నొక్కండి"><pre><code>py hagezi_overlap.py pro.plus.mini.txt ultimate.mini.txt</code></pre></div>
</li>
<li>
<p>ఈ పరిశీలన కోసం నేను download చేసిన lists పై ఇది ఇలా print చేసింది:</p>
<div class="sf-box" data-mode="output" data-where="మీకు కనిపించాల్సినది" data-how="దీన్ని మీరు type చేయరు"><pre><code>pro.plus.mini.txt: 98,704 entries; 98,703 already blocked by ultimate.mini.txt; 1 not
  not covered: h4g3z1-pro-plus-mini.web.app</code></pre></div>
<p class="sf-after">lists రోజూ మారుతాయి కాబట్టి మీ సంఖ్యలు వేరుగా ఉంటాయి. సంఖ్యలకు బదులు ఒక సందేశం కనిపిస్తే, script ఉద్దేశపూర్వకంగా ఆగింది: ఆ సందేశాన్ని చదవండి, అది ఫైల్‌ను, line ను పేర్కొంటుంది.</p>
</li>
</ol>
<p>ప్రతి పోలికలో మిగిలిపోయే ఒక పేరు, Hagezi ప్రతి list లో ఉంచే marker (<code>h4g3z1-&lt;list&gt;.web.app</code>), ఏ list load అయిందో తెలుసుకోవడానికి. download విఫలమైతే, లేదా ఫైల్ మరో format లో ఉంటే, script సంఖ్యను చెప్పకుండా ఆగి ఆ విషయం చెబుతుంది.</p>
<p>అవే lists పై అది ఇంకా ఇచ్చినవి:</p>
<table>
<thead>
<tr>
<th>List A</th>
<th>List B</th>
<th>B ద్వారా ఇప్పటికే blocked అయిన A ఎంట్రీలు</th>
</tr>
</thead>
<tbody>
<tr>
<td>Normal (171,454)</td>
<td>Pro++</td>
<td>marker తప్ప అన్నీ</td>
</tr>
<tr>
<td>Pro++ (223,551)</td>
<td>Ultimate</td>
<td>marker తప్ప అన్నీ</td>
</tr>
<tr>
<td>Pro Mini (86,842)</td>
<td>Ultimate Mini</td>
<td>marker తప్ప అన్నీ</td>
</tr>
<tr>
<td>TIF Mini (212,777)</td>
<td>TIF Medium</td>
<td>marker తప్ప అన్నీ</td>
</tr>
<tr>
<td>Gambling Mini (118,888)</td>
<td>Gambling Medium</td>
<td>marker తప్ప అన్నీ</td>
</tr>
<tr>
<td>Fake (17,622)</td>
<td>Pro++</td>
<td>marker తప్ప అన్నీ</td>
</tr>
<tr>
<td>Pop-Up Ads (48,277)</td>
<td>Pro++</td>
<td>4 తప్ప అన్నీ (marker, మరో 3)</td>
</tr>
<tr>
<td>Badware Hoster (1,088)</td>
<td>Pro++</td>
<td>966</td>
</tr>
<tr>
<td>Ultimate Mini (120,458)</td>
<td>Pro++</td>
<td>95,417</td>
</tr>
</tbody>
</table>
<p>script ను ఈ lists పై, అలాగే లేని ఫైల్, ఖాళీ ఫైల్, comments మాత్రమే ఉన్న ఫైల్, విఫలమైన download, ఒక web page, adblock, hosts, plain-domain formats లోని lists పై పరీక్షించాను.</p>
</details>
<p>load అయిన పేర్ల సంఖ్య నా మార్పులను అనుసరించలేదు. మొదటి శుభ్రత రోజున రూటర్ దానికి ముందు 2,840,117 పేర్లను, తర్వాత 3,188,234 పేర్లను load చేసింది, పద్దెనిమిదికి బదులు పది lists తో: ఆ రోజు రెండు downloads మధ్య TIF 426,519 ఎంట్రీలు పెరిగింది. నా వైపు మార్పు లేకుండానే, ఆ సంఖ్య నాలుగు రోజుల్లో 2,739,044 నుండి 3,229,041 కు మారింది. ఈ పరిశీలన కోసం నేను download చేసిన list పరిమాణాల ప్రకారం, పేర్లలో సుమారు మూడింట రెండు వంతులు TIF లో, సుమారు 7 శాతం Pro++ లో ఉన్నాయి.</p>
<details>
<summary>లోతైన పరిశీలన: రూటర్ గణాంకాలు, వాటి పరిమితులు</summary>
<p>load అయిన పేర్లు, రూటర్ log నుండి (&#8220;blocklist loaded. length is …&#8221;, ప్రత్యేక పేర్ల సంఖ్య):</p>
<table>
<thead>
<tr>
<th>ఎప్పుడు</th>
<th>Lists</th>
<th>load అయిన పేర్లు</th>
</tr>
</thead>
<tbody>
<tr>
<td>మొదటి శుభ్రత రోజు, ముందు</td>
<td>ఆ పద్దెనిమిది</td>
<td>2,840,117</td>
</tr>
<tr>
<td>మొదటి శుభ్రత రోజు, తర్వాత</td>
<td>కొత్త సెట్</td>
<td>3,188,234</td>
</tr>
<tr>
<td>ఐదు రోజుల తర్వాత</td>
<td>అదే సెట్</td>
<td>2,739,044</td>
</tr>
<tr>
<td>తొమ్మిది రోజుల తర్వాత</td>
<td>అదే సెట్</td>
<td>3,229,041</td>
</tr>
<tr>
<td>పద్దెనిమిది రోజుల తర్వాత</td>
<td>అదే సెట్</td>
<td>3,198,953</td>
</tr>
</tbody>
</table>
<p>blocked అయిన queries వాటా, Reporting → Unbound DNS నుండి:</p>
<table>
<thead>
<tr>
<th>కాలం</th>
<th>Queries</th>
<th>Blocked అయినవి</th>
</tr>
</thead>
<tbody>
<tr>
<td>మొదటి శుభ్రత రోజు, ఆ రోజే చదివినది</td>
<td>నమోదు చేయలేదు</td>
<td>12.9 శాతం</td>
</tr>
<tr>
<td>సుమారు 38 గంటల కాలం, తర్వాత చదివినది</td>
<td>110,248</td>
<td>8,600 (7.80 శాతం)</td>
</tr>
</tbody>
</table>
<p>ఆ రెండు శాతాలు వేర్వేరు lists, వేర్వేరు రోజులు, ఆ సమయంలో నెట్‌వర్క్ ఏం చేస్తూ ఉందో దాని మీద ఆధారపడినవి. అవి ముందు-తర్వాత పోలిక కావు.</p>
</details>
<h3>ఇప్పుడు నేను tick చేసినవి</h3>
<p>నా రూటర్ settings ఇవి చూపుతాయి:</p>
<ul>
<li>Hagezi Pro++ (full)</li>
<li>TIF (full)</li>
<li>Gambling (full)</li>
<li>Fake, Pop-Up Ads, Badware Hoster మరియు &#8220;Safesearch not supported&#8221;</li>
<li>OISD NSFW</li>
<li>URL ద్వారా రెండు Hagezi lists: encrypted-DNS servers, LG TV trackers</li>
<li>Abuse.ch ThreatFox, URL ద్వారా, ఉచిత key తో (కింద)</li>
</ul>
<p>device trackers కోసం Hagezi సిఫార్సు చేసిన Pro కంటే Pro++ ను ఎంచుకున్నాను, ఎందుకంటే వాటిలో దాదాపు అన్నింటినీ అతను Pro++ లోనే బ్లాక్ చేస్తాడు.</p>
<p>వీటిలో రెండు duplicates. Fake, Pop-Up Ads Pro++ లోపలే ఉన్నాయని Hagezi cheat sheet గుర్తిస్తుంది. Fake విషయంలో కొలత ఏకీభవిస్తుంది, ఏది బ్లాక్ అవుతుందో మారకుండా దాన్ని తొలగించవచ్చు. నేను download చేసిన lists లో, Pop-Up Ads లో Pro++, TIF, Gambling, Hoster, Fake లో దేనిలోనూ లేని మూడు పేర్లు ఉన్నాయి; దాన్ని తొలగిస్తే ఆ మూడూ పోతాయి. ThreatFox ను, URL ద్వారా చేర్చిన రెండు lists ను నేను పోల్చలేదు. Fake, Pop-Up Ads రెండూ ఇప్పటికీ tick చేసి ఉన్నాయి.</p>
<p>ThreatFox download కావడం ఆగిపోయి, ఇప్పుడు మళ్లీ download అవుతోంది. ప్రతి update &#8220;unable to download blocklist … and no cache available&#8221; అని log చేసింది. దాని కోసం OPNsense built-in ఎంట్రీ వాడిన address &#8220;410 Gone&#8221; అని సమాధానమిస్తుంది, abuse.ch export పేజీ host file ఇవ్వడానికి ముందు Auth-Key అడుగుతుంది. తర్వాతి 26.7 release అందుకే built-in ఎంట్రీని తొలగించి, వినియోగదారులను &#8220;URLs of Blocklists&#8221; వైపు చూపుతుంది. abuse.ch key ను తన authentication portal ద్వారా ఉచితంగా ఇస్తుంది. నేను key ను addressలో పెట్టి list ను URL ద్వారా చేర్చాను. abuse.ch export పేజీ key ను URLలో అడుగుతుంది, OPNsense downloader ఎలాంటి headers పంపదు. address రూపాన్ని కింది దశలు చూపుతాయి. దాన్ని చేర్చిన update దాని కోసం 28,889 lines తో &#8220;blocklist download&#8221; అని log చేసింది, వాటిలో 28,869 పేర్లు, error లేదు; ఆ update లో మిగతా lists cache నుండి load అయ్యాయి. load అయిన పేర్ల రూటర్ సొంత లెక్క ప్రకారం, అది 2,765,172 నుండి 2,782,246 కు పెరిగింది. కాబట్టి ఆ 28,869 లో 17,074, ఆ ఖచ్చితమైన పేరుతో ఇంతకుముందే load అయి లేవు, సుమారు 11,800 అయి ఉన్నాయి. ఈ లెక్క పేర్లను అక్షరాలా పోలుస్తుంది, కాబట్టి దాని parent domain ను మరో list ఇప్పటికే బ్లాక్ చేస్తున్న పేరు కూడా కొత్తగా లెక్కలోకి వస్తుంది. Hagezi ThreatFox ను source గా పేర్కొనడు.</p>
<p>key పాస్‌వర్డ్ లాగా పనిచేస్తుంది. రూటర్ దాన్ని తన configuration లో నిల్వ చేస్తుంది, ప్రతి update key తో సహా addressను resolver logకు రాస్తుంది. మీ చేతి నుండి బయటకు వెళ్లే screenshots, shared logs, configuration backups, remote log server లలో దాన్ని ఉంచకండి. అది leak అయి ఉంటే, అదే portal నుండి కొత్త key తీసుకుని addressను మార్చండి.</p>
<details>
<summary>లోతైన పరిశీలన: key తో ThreatFox ను చేర్చడం</summary>
<p><strong>మొదలుపెట్టే ముందు.</strong> ఇది మీ policy కి ఒక list ను చేర్చుతుంది. పది నిమిషాలు పడుతుంది. ఏదీ delete కాదు. Undo చేయడానికి, అదే box నుండి addressను తొలగించి మళ్లీ apply చేయండి.</p>
<ol>
<li>browser లో <code>https://auth.abuse.ch</code> తెరిచి, account లేకపోతే సృష్టించి, Auth-Key తీసుకోండి. key ఉచితం. దాన్ని ఒక text ఫైల్‌లో 4వ దశ వరకు మాత్రమే ఉంచండి; 4వ దశలో మీరు దాన్ని ఒకసారి paste చేస్తారు, ఆ తర్వాత ఆ text ఫైల్‌ను delete చేయండి.</li>
<li>రూటర్‌లోకి login అవండి. <strong>Services</strong>, తర్వాత <strong>Unbound DNS</strong>, తర్వాత <strong>Blocklists</strong> click చేయండి.</li>
<li>మీ policy row కుడి చివర, పెన్సిల్ (Edit) click చేయండి. <strong>Edit Blocklist</strong> అనే window తెరుచుకుంటుంది.</li>
<li>
<p><strong>URLs of Blocklists</strong> లోపల click చేసి, కింది addressను type చేయండి, <code>YOUR_KEY</code> స్థానంలో మీ key పెట్టి, spaces లేకుండా. Enter నొక్కండి, అప్పుడు అది ఒక tag గా మారుతుంది (tag అంటే field లో చిన్న boxగా కనిపించే ఒక ఎంట్రీ):</p>
<div class="sf-box" data-mode="file" data-where="ThreatFox list address (ఉదాహరణ, కమాండ్ కాదు)" data-how="దాన్ని URLs of Blocklists field లో paste చేయండి, YOUR_KEY స్థానంలో మీ key తో"><pre><code>https://threatfox-api.abuse.ch/v2/files/exports/YOUR_KEY/hostfile.txt</code></pre></div>
<p class="sf-after">key <code>exports/</code> మరియు <code>/hostfile.txt</code> మధ్య ఉంటుంది.</p>
</li>
<li>
<p><strong>Save</strong>, తర్వాత <strong>Apply</strong> click చేయండి. రూటర్ lists ను మళ్లీ download చేస్తుంది; ఒకటి రెండు నిమిషాలు వేచి ఉండండి.</p>
</li>
<li><strong>Services</strong>, <strong>Unbound DNS</strong>, <strong>Log File</strong> click చేసి, <code>download</code> కోసం search చేసి, severity boxలో <strong>Informational</strong> tick చేయండి. ThreatFox address కోసం &#8220;blocklist download:&#8221; అనే line, దానితో పాటు lines సంఖ్య, కనిపించాలి. line &#8220;unable to download&#8221; అంటే, key ను, addressలో అదనపు space ఉందేమో చూడండి.</li>
<li>ఆ screen ను share చేయవద్దు: ఆ line మీ key తో పాటు addressను చూపుతుంది.</li>
</ol>
</details>
<details>
<summary>లోతైన పరిశీలన: Badware Hoster, URL ద్వారా చేర్చిన రెండు lists</summary>
<p>Badware Hoster Hagezi సొంతంగా నిలిచే list, దాని 1,088 ఎంట్రీలలో 966 ఇప్పటికే Pro++ లో ఉన్నాయి. మిగతావి threat feeds లో పదే పదే కనిపించే మొత్తం hosting providers ను బ్లాక్ చేస్తాయి. ఆ hosts లోని చట్టబద్ధమైన సైట్లు కూడా వాటితో పాటు blocked అవుతాయని Hagezi హెచ్చరిస్తాడు, వాటిని unblock చేయడాన్ని list నడిపే వారికి వదిలేస్తాడు.</p>
<p>URL ద్వారా చేర్చిన రెండు lists Hagezi వే, wildcard format లో:</p>
<div class="sf-box" data-mode="file" data-where="రెండు Hagezi list addresses" data-how="ఒక్కో line కు ఒక address; సూచన కోసం చూపినవి, నడపడానికి ఏమీ లేదు"><pre><code>https://cdn.jsdelivr.net/gh/hagezi/dns-blocklists@latest/wildcard/doh.txt
https://cdn.jsdelivr.net/gh/hagezi/dns-blocklists@latest/wildcard/native.lgwebos.txt</code></pre></div>
<p>మొదటిది encrypted-DNS servers ను పేరు ద్వారా జాబితా చేస్తుంది, devices రూటర్‌ను తప్పించుకోకుండా ఆపడంలో భాగం. రెండోది LG webOS ad, tracking servers ను జాబితా చేస్తుంది. ప్రతిదానికి దాని సొంత కథ ఉంది, అవి వేరే పోస్ట్‌లకు.</p>
<p>OPNsense 26.7 లోని built-in Hagezi tick-boxes, log చూపినట్లు, Hagezi mirror <code>hagezi-mirror.dnsbunker.org</code> నుండి download చేస్తాయి. ఆ mirror సుమారు ప్రతి నాలుగు నుండి ఎనిమిది గంటలకు కొత్త build ప్రచురిస్తుందని Hagezi చెబుతాడు; jsDelivr కాపీలు రోజుకు ఒకసారి update అవుతాయి.</p>
</details>
<h3>DNS బ్లాక్ చేయలేనివి</h3>
<p>YouTube, Instagram app లోపలి ప్రకటనలు వీడియోలు, పోస్ట్‌లు వచ్చే domains నుండే వస్తాయి, కాబట్టి పేరుతో బ్లాక్ చేస్తే కంటెంట్ కూడా బ్లాక్ అవుతుంది. Hagezi FAQ సాధారణ విషయాన్ని చెబుతుంది: కొన్ని ప్రకటనలు కంటెంట్ వచ్చే domains నుండే load అవుతాయి, వాటిని పట్టేది browser లోని content blocker, లేదా ఫోన్‌లో app-level blocker. app లోపలి ప్రకటనలను నేను అంగీకరించాను.</p>
<p>DNS blocklist రూటర్‌ను అడిగే devices ను మాత్రమే filter చేస్తుంది; తమ సొంత encrypted లేదా hard-coded DNS ఉన్న devices దాన్ని తప్పించుకుంటాయి. అది వేరే పోస్ట్.</p>
<h3>ఇది ఎలా చేశాను</h3>
<p>Claude documentation, lists ను చదివి, వాటిని పోల్చి, నా logged-in browser session ద్వారా నా రూటర్‌ను చదివింది: settings, resolver log, tester. ఏం మార్చాలో నేను నిర్ణయించాను. allowlist సెషన్‌లో రూటర్‌పై జరిగిన ఏకైక మార్పు allowlist rewrite.</p>
<p>model తప్పులు చేసింది. bare-name allowlist సవరణ మొదటి సెషన్ నుండి వచ్చింది, మరియు ఒక సెషన్‌లో nightly blocklist update Unbound cache ను flush చేస్తుందని కూడా అది నాకు చెప్పింది. రూటర్ log, update lists ను నడుస్తున్న Unbound లోకి, restart లేకుండా, load చేస్తున్నట్లు చూపింది. blocklist settings ను apply చేయడం Unbound ను restart చేయదని manual చెబుతుంది, source కొత్త list ను నడుస్తున్న process లోకి load చేస్తుంది. flush setting Unbound ఆగినప్పుడు మాత్రమే వర్తిస్తుంది.</p>
<p>రూటర్‌పై logged-in session ఉన్న model ఒక ప్రమాదమే. అది చదివే resolver log లో, ఏ వెబ్‌సైట్ అయినా ఒక device చేత look up చేయించగల పేర్లు ఉంటాయి, ఒక పేరులో model ను నడిపించడానికి రాసిన text ఉండవచ్చు. allowlist సెషన్‌లో, allowlist మార్పు తప్ప, దాన్ని చదవడానికే పరిమితం చేశాను. అది model కు ఇచ్చిన సూచన, నియంత్రణ కాదు; read-only OPNsense user నియంత్రణ అవుతుంది. resolver log లో ThreatFox address కూడా key తో ఉంటుంది, కాబట్టి log చదివే సెషన్ key ను చూస్తుంది. మీరు ఒక model ను ఆ log చదవనిస్తే, ఆ తర్వాత key ను మార్చండి.</p>
<p>మొదటి సెషన్‌లో నేను ఐదు Unbound settings, ఒక cron job ను కూడా మార్చాను. ఆరూ set అయి ఉన్నట్లు రూటర్ చూపుతుంది.</p>
<details>
<summary>లోతైన పరిశీలన: ప్రతి setting, DNS over TLS ను ఎలా undo చేయాలి</summary>
<table>
<thead>
<tr>
<th>Setting (పేజీ)</th>
<th>ముందు</th>
<th>తర్వాత</th>
</tr>
</thead>
<tbody>
<tr>
<td>Flush DNS Cache during reload (General)</td>
<td>on</td>
<td>off</td>
</tr>
<tr>
<td>Prefetch Support (Advanced)</td>
<td>off</td>
<td>on</td>
</tr>
<tr>
<td>Serve Expired Responses (Advanced)</td>
<td>off</td>
<td>on; TTL for Expired Responses 86,400 s</td>
</tr>
<tr>
<td>Use System Nameservers (Query Forwarding)</td>
<td>on</td>
<td>off</td>
</tr>
<tr>
<td>DNS over TLS forwarders</td>
<td>ఏవీ లేవు</td>
<td>Cloudflare, Quad9</td>
</tr>
<tr>
<td>Blocklist update job (System → Settings → Cron)</td>
<td>ఇతర jobs తో పంచుకునే slot</td>
<td>దాని సొంత slot</td>
</tr>
</tbody>
</table>
<p><strong>Prefetch</strong> popular entries expire కావడానికి ముందే refresh చేస్తుంది. manual ఖరీదును సుమారు 10 శాతం ఎక్కువ DNS traffic గా చెబుతుంది.</p>
<p><strong>Serve Expired Responses</strong> device ను వేచి ఉంచే బదులు cache నుండి expired record తో సమాధానం ఇస్తుంది. అది on అయినప్పుడు మరిన్ని fields కనిపిస్తాయి. &#8220;TTL for Expired Responses&#8221; గడువు ముగిసిన తర్వాత ఎంతసేపు stale answer ఇవ్వవచ్చో పరిమితం చేస్తుంది; నేను 86,400 సెకన్లు పెట్టాను, manual సూచించే 86,400 నుండి 259,200 లో కనిష్ట చివర.</p>
<p>నేను పరీక్షించని ఒక పరస్పర ప్రభావం: cache flushing off గా, stale answers అనుమతించి ఉన్నప్పుడు, ఒక list కొత్తగా బ్లాక్ చేసిన పేరుకు Unbound cache నుండి కొంతకాలం సమాధానం వస్తూనే ఉండవచ్చు. ఒక block వెంటనే అమలు కాకపోతే, నేను మొదట చూసేది అదే.</p>
<p><strong>Use System Nameservers.</strong> Query Forwarding, DNS over TLS లోని ఏ catch-all ఎంట్రీ కంటే system nameservers కే ప్రాధాన్యత ఉంటుందని manual చెబుతుంది. దాన్ని off చేస్తే DNS over TLS ఎంట్రీలు queries ను పంపుతాయి. ఆ నాలుగు ఎంట్రీలు, Services → Unbound DNS → DNS over TLS కింద:</p>
<table>
<thead>
<tr>
<th>Server IP</th>
<th>Port</th>
<th>Verify CN</th>
</tr>
</thead>
<tbody>
<tr>
<td>1.1.1.1</td>
<td>853</td>
<td>cloudflare-dns.com</td>
</tr>
<tr>
<td>1.0.0.1</td>
<td>853</td>
<td>cloudflare-dns.com</td>
</tr>
<tr>
<td>9.9.9.9</td>
<td>853</td>
<td>dns.quad9.net</td>
</tr>
<tr>
<td>149.112.112.112</td>
<td>853</td>
<td>dns.quad9.net</td>
</tr>
</tbody>
</table>
<p>ఈ servers కు రూటర్ సొంత queries encrypted గా వెళ్తాయి. devices తమ సొంత encrypted DNS వాడకుండా ఆపడానికి LAN నుండి port 853 ను reject చేసే firewall rule వాటిని ఏమీ చేయదు, ఎందుకంటే అవి రూటర్ నుండే బయలుదేరతాయి.</p>
<p><strong>update సమయం</strong> దాని సొంత slot కు మారింది, కాబట్టి update ఇకపై ఇతర scheduled jobs తో సమయాన్ని పంచుకోదు.</p>
<p>DNS over TLS మార్పును undo చేయడానికి:</p>
<p><strong>మొదలుపెట్టే ముందు.</strong> ఇది మీ రూటర్ DNS settings ను మారుస్తుంది, ఐదు నిమిషాలు పడుతుంది. మిగిలిన settings ద్వారా DNS పనిచేస్తూనే ఉంటుంది. ముందు ఆ నాలుగు ఎంట్రీలను (పై table) నోట్ చేసుకోండి; మార్పును తిరిగి పెట్టడానికి అవి కావాలి.</p>
<ol>
<li>రూటర్ settings పేజీ తెరిచి sign in అవండి. Lobby page కనిపించాలి.</li>
<li><strong>Services</strong>, తర్వాత <strong>Unbound DNS</strong>, తర్వాత <strong>DNS over TLS</strong> click చేయండి. ఒక table ఎంట్రీలను జాబితా చేస్తుంది.</li>
<li>మొదటి row కుడి చివర, పెన్సిల్ (Edit) click చేయండి. <strong>Edit server</strong> అనే window తెరుచుకుంటుంది. <strong>Enabled</strong> ను untick చేసి <strong>Save</strong> click చేయండి. మిగతా ప్రతి row కూ ఇలాగే చేయండి.</li>
<li>అదే పేజీ పైన, <strong>Use System Nameservers</strong> ను tick చేయండి. అదే box <strong>Query Forwarding</strong> కింద కూడా కనిపిస్తుంది; అది ఒకే setting.</li>
<li>పేజీ అడుగున <strong>Apply</strong> click చేయండి. Unbound కొన్ని సెకన్లలో reload అవుతుంది.</li>
<li>తనిఖీ: నెట్‌వర్క్‌లోని ఒక device నుండి, ఈ రోజు మీరు సందర్శించని ఏ వెబ్‌సైట్‌నైనా తెరవండి. అది load కావాలి. System, Settings, General లో nameservers లేకపోతే, Unbound forwarding చేయకుండా root servers నుండి స్వయంగా resolve చేస్తుంది; మీ provider servers వాడాలంటే వాటిని అక్కడ చేర్చండి.</li>
<li>మార్పును తిరిగి పెట్టడానికి, ప్రతి ఎంట్రీపై <strong>Enabled</strong> ను మళ్లీ tick చేసి, <strong>Use System Nameservers</strong> ను untick చేసి, <strong>Apply</strong> click చేయండి.</li>
</ol>
</details>
<h3>మూలాలు</h3>
<ul>
<li><a href="https://github.com/hagezi/dns-blocklists">Hagezi, dns-blocklists README</a>, <a href="https://github.com/hagezi/dns-blocklists/blob/main/CHEATSHEET.md">cheat sheet</a>, <a href="https://github.com/hagezi/dns-blocklists/blob/main/FAQ.md">FAQ</a></li>
<li><a href="https://docs.opnsense.org/manual/unbound.html">OPNsense మాన్యువల్, Unbound DNS</a></li>
<li><a href="https://github.com/opnsense/core/tree/26.7.7">OPNsense core source code, tag 26.7.7</a>, తాజా 26.7 tag తో పోల్చినది</li>
<li><a href="https://github.com/opnsense/core/issues/11091">OPNsense core, issue 11091: ThreatFox blocklist HTTP 410 తో విఫలమవుతోంది, Auth-Key మద్దతు అవసరం</a></li>
<li><a href="https://threatfox.abuse.ch/export/">abuse.ch ThreatFox, export పేజీ</a></li>
<li><a href="https://auth.abuse.ch">abuse.ch authentication portal</a></li>
</ul>
</div>
<div id="hbt-panel-th" class="hbt-panel" lang="th">
<h2>การแก้ไขที่ปล่อยให้ชื่อ phishing ผ่านเข้ามา</h2>
<p class="hbt-note">แปลจากต้นฉบับภาษาอังกฤษ คำสั่ง โค้ด และศัพท์เทคนิคคงเป็นภาษาอังกฤษไว้</p>

<p>ในวันเสาร์วันหนึ่งของเดือนตุลาคม ผมแก้ 4 รายการที่เสียใน allowlist ของ DNS บน router ของผม หลังจากนั้นสองสัปดาห์เศษ ผมพบว่ารายการที่แก้แล้วปล่อยให้ชื่อใน threat feed ผ่านเข้ามา ซึ่งเป็นชื่อที่ถูกสร้างให้ดูเหมือนเว็บไซต์ที่ผมตั้งใจ allow ไว้ คือโดเมนของเว็บชำระเงินตามด้วย <code>.https.</code> และโดเมนอื่นที่ไม่เกี่ยวกัน หรือชื่อร้านค้าที่ใช้ขีดกลางแทนจุด tester ของ router เองก็ปล่อยชื่อเหล่านี้ผ่าน</p>
<p>ในเย็นวันเดียวกัน ผมลด blocklist จาก 18 เหลือ 10 วันรุ่งขึ้นผมเพิ่ม list ของ LG TV อีกหนึ่ง ทำให้เป็น 11 7 list ในจำนวนนั้นมีชุดที่เหลือครอบคลุมอยู่แล้ว list หนึ่งที่ผมเก็บไว้คือ Abuse.ch ThreatFox หยุดดาวน์โหลดเมื่อ abuse.ch เริ่มแจก host file ให้เฉพาะผู้ที่มี key ตอนนี้มันดาวน์โหลดได้อีกครั้ง หลังจากผมใส่ key ฟรีไว้ในที่อยู่ของมัน ส่วนโฆษณาภายใน YouTube และ Instagram บนโทรศัพท์ของผมเข้ามาตลอด ซึ่ง blocklist ใดก็เปลี่ยนไม่ได้</p>
<p>จากนั้นผมเขียนรายการ allowlist ใหม่ โพสต์นี้เล่าถึงการล้างทั้งสองครั้ง ได้แก่ OPNsense ทำอะไรกับรายการ allowlist วิธีตรวจรายการของคุณเอง และ list 18 รายการที่ซ้อนกันรวมกันแล้วได้อะไร ผมทำงานนี้กับ Claude ใน 2 session หนึ่ง session ต่อการล้างหนึ่งครั้ง ส่วน key ของ ThreatFox ใส่ไปใน session ที่สาม Claude อ่าน router ผ่าน browser ของผม ทุกการเปลี่ยนแปลงบน router ผมเป็นผู้อนุมัติ ผมอนุมัติการแก้ด้วยชื่อเปล่า (bare name) การอนุมัติจึงไม่ได้ป้องกันความผิดพลาดนั้น</p>
<aside class="in-short">
<p><strong>โดยสรุป</strong></p>
<ul>
<li>บน OPNsense รายการ allowlist คือ regular expression ที่จับคู่จากต้นชื่อ <code>example.com</code> เปล่า ๆ จะอนุญาตชื่อใดก็ตามที่ขึ้นต้นด้วยตัวอักษรเหล่านั้นด้วย โดยมีอักขระใดก็ได้แทนจุด: <code>example.com.evil.net</code>, <code>example-com.evil.net</code> ให้เขียนชื่อที่ตรงทั้งหมดและผูกหัวท้าย (anchored): <code>^www\.example\.com\.?$</code></li>
<li>อ่าน resolver log หลังเปลี่ยนค่า list ที่ดาวน์โหลดไม่สำเร็จ หรือรายการ allowlist ที่ถูกข้าม จะปรากฏที่นั่น และไม่ปรากฏบนหน้า blocklist เลย</li>
<li>เลือก tier ของ Hagezi 1 tier ตั้งแต่ Light ถึง Ultimate แล้วเพิ่ม Threat Intelligence Feeds บน router ที่มีหน่วยความจำเหลือ ให้ใช้ list เต็ม ไม่ใช่รุ่น Mini</li>
<li>ตรวจดูว่า tier ของคุณมีอะไรอยู่แล้วก่อนเพิ่ม list อื่น Fake อยู่ใน Pro++ ทั้งหมด ส่วน Pop-Up Ads อยู่ใน Pro++ ทั้งหมดยกเว้น 3 ชื่อ</li>
</ul>
</aside>
<details class="sf-legend"><summary><strong>ไม่คุ้นกับ command line? วิธีอ่านกล่องต่าง ๆ</strong></summary>
<p><strong>PS&gt;</strong> หมายถึง พิมพ์คำสั่งนี้ใน <em>PowerShell</em> บน Windows (เมนู Start → พิมพ์ <code>powershell</code> → Enter) <strong>$</strong> หมายถึง พิมพ์ใน terminal บน Linux หรือ Mac หรือบน Pi หลังจากคุณล็อกอินด้วย <code>ssh</code> แล้ว อย่าพิมพ์ <strong>$</strong> หรือ <strong>PS&gt;</strong> เอง</p>
<p>แต่ละบรรทัดที่ขึ้นต้นด้วย <strong>$</strong> หรือ <strong>PS&gt;</strong> คือคำสั่ง 1 คำสั่ง คลิกที่ <strong>$</strong> นั้นเพื่อคัดลอกเฉพาะบรรทัดนั้น วาง กด <strong>Enter</strong> และรอจนเสร็จก่อนทำบรรทัดถัดไป กล่องที่มีปุ่ม <strong>Copy</strong> ด้านบนมี 1 คำสั่ง (หรือ 1 ไฟล์) ให้คัดลอกทั้งกล่อง กล่องเส้นประแสดงสิ่งที่คุณควรเห็นตอบกลับมา คุณไม่ต้องพิมพ์มัน</p>
</details>
<h3>Allowlist</h3>
<p>allowlist ของ blocklist policy ของผมมี 26 รายการ ในวันที่ล้างครั้งแรก 4 รายการดูเหมือนเสีย สามรายการถูกวางมาจากแถบที่อยู่ของ browser เป็นที่อยู่เต็ม ในรูป <code>https://example.org/</code> รายการที่สี่มีช่องว่างหนึ่งช่องหน้าตัวอักษรแรกของชื่อ ผมแทนที่ทั้ง 4 รายการด้วยชื่อเปล่า เช่น <code>example.in</code> ผมไม่ได้ดูว่า 22 รายการที่เหลือเขียนไว้อย่างไร และประวัติ configuration ของ router ย้อนกลับไปไม่ไกลพอที่จะตรวจได้อีก ถ้ารายการเหล่านั้นเป็นชื่อเปล่า ตามที่ปุ่ม Allow ของ router เองเขียนไว้ ช่องโหว่ก็มีอยู่ก่อนที่ผมแก้ และการแก้ของผมขยายช่องโหว่ไปถึง 3 รายการที่เดิมไม่จับคู่กับชื่อใดเลย</p>
<p>log ของ router แสดงรายการที่ห้า เป็นรายการที่เขียนเป็น <code>*.ntp.org</code> ซึ่งลบไปแล้ว การอัปเดตทุกคืนบันทึก &#8220;skip invalid whitelist exclude pattern&#8221; ไว้สำหรับรายการนี้ เครื่องหมาย <code>*</code> นำหน้าใช้ไม่ได้ใน regular expression ของ Python router จึงทิ้งรายการนั้นทุกคืนและแจ้งไว้ใน log เท่านั้น รูปแบบที่ทำสิ่งที่ตั้งใจไว้คือ <code>(.*\.)?ntp\.org\.?$</code></p>
<p>ต่อมา Claude อ่านโค้ดที่ใช้ allowlist ใน OPNsense 26.7 ช่องว่างนำหน้าไม่ได้ก่อความเสียหาย โค้ดตัดช่องว่างออกจากทุกรายการ ปัญหาอยู่ที่ชื่อเปล่า</p>
<p>OPNsense ถือแต่ละรายการเป็น regular expression ไม่สนใจตัวพิมพ์เล็กใหญ่ และตรวจกับส่วนต้นของชื่อที่อุปกรณ์ถาม ไม่มีสิ่งใดผูกรายการกับท้ายชื่อ และจุดที่ไม่ได้ escape จับคู่กับอักขระใดก็ได้ ดังนั้น <code>example.com</code> เปล่า ๆ อนุญาต <code>example.com</code> แต่ไม่อนุญาต <code>www.example.com</code> และยังอนุญาตชื่อใดก็ตามที่ขึ้นต้นด้วยตัวอักษรเหล่านั้น โดยมีอักขระใดก็ได้แทนแต่ละจุด: <code>example.com.evil.net</code>, <code>example-com.evil.net</code>, <code>example.community</code></p>
<p>threat feed มีชื่อที่มีรูปแบบนั้นพอดี คือชื่อของเว็บไซต์ที่รู้จักกันดีตามด้วย <code>.https.</code> และโดเมนที่ไม่เกี่ยวกัน หรือชื่อเว็บไซต์นั้นโดยใช้ขีดกลางแทนจุด บน feed ที่ผมดาวน์โหลดมาสำหรับการตรวจครั้งนี้ 7 จาก 26 รายการของผมจับคู่กับชื่อแบบนี้ 43 ชื่อ รายการหนึ่งจับคู่ 20 ชื่อ บน tester ของ router ผม ชื่อแบบนี้ 5 ชื่อที่ผมลองผ่านทุกชื่อ ขณะที่ชื่อเดียวกันที่มี <code>www.</code> นำหน้า ซึ่งถูกบล็อกโดยรายการเดียวกันใน list ก็ถูกบล็อก ชื่อที่ผมประกอบเองจากเว็บไซต์ที่ allow ไว้กับโดเมนที่ threat feed บล็อกก็ผ่านเช่นกัน ตามโค้ดที่จับคู่ ทุกรายการชื่อเปล่าอนุญาตชื่อใดก็ตามที่ขึ้นต้นด้วยมัน ไม่ว่ามี list ใดบล็อกชื่อนั้นหรือไม่</p>
<p>ปุ่ม Allow ของ OPNsense เอง ใน Reporting → Unbound DNS บันทึกชื่อเปล่าแบบเดียวกัน รายการที่เพิ่มจากที่นั่นจึงทำงานแบบเดียวกัน</p>
<p>วิธีแก้คือ allow ชื่อที่ตรงทุกตัว โดยผูกทั้งสองปลาย:</p>
<div class="sf-box" data-mode="file" data-where="รายการ allowlist (ตัวอย่าง ไม่ใช่คำสั่ง)" data-how="วางลงในช่อง Allowlist Domains"><pre><code>^www\.example\.com\.?$</code></pre></div>
<p>เครื่องหมาย backslash ทำให้จุดเป็นจุดจริง และ <code>$</code> ผูก pattern กับท้ายชื่อ <code>\.?</code> อนุญาตจุดท้ายที่ชื่อมีอยู่ใน 1 จาก 2 เส้นทางที่โค้ดตรวจ (ดูส่วนเจาะลึก) <code>^</code> ทำซ้ำสิ่งที่โค้ดทำอยู่แล้ว การละไว้จึงใช้ได้เช่นกัน ผมคงไว้เพื่อให้ pattern อ่านเหมือนกันทุกที่ ขั้นตอนตรวจและเขียนรายการของคุณใหม่อยู่ในส่วนเจาะลึกภายใต้ &#8220;วิธีตรวจของคุณ&#8221;</p>
<p>การ allow โดเมนพร้อม subdomain ทั้งหมด ใช้ <code>(.*\.)?example\.com\.?$</code> ได้ แต่ก็อนุญาต host ที่ list จงใจบล็อกไว้ใต้โดเมนนั้นด้วย ในรายการหนึ่งของผม Pro++ บล็อก 5 host ใต้โดเมน ด้วยชื่อเช่น <code>advertising</code> และ <code>sponsored-ads</code> และไม่บล็อกโดเมนเอง หรือชื่อ <code>www.</code> ของมัน การ allow ทั้ง subdomain จะปล่อย host เหล่านั้นกลับเข้ามา</p>
<p>ผมรันโค้ด parsing ของ OPNsense เองและ call ที่ใช้จับคู่ กับชื่อบางชื่อ:</p>
<table>
<thead>
<tr>
<th>รายการ allowlist</th>
<th>ชื่อที่ถูกถาม</th>
<th>อนุญาตหรือไม่</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>https://example.org/</code></td>
<td><code>example.org</code></td>
<td>ไม่</td>
</tr>
<tr>
<td><code>example.in</code></td>
<td><code>example.in</code></td>
<td>ใช่</td>
</tr>
<tr>
<td><code>example.in</code></td>
<td><code>www.example.in</code></td>
<td>ไม่</td>
</tr>
<tr>
<td><code>example.in</code></td>
<td><code>example.in.example.net</code></td>
<td>ใช่</td>
</tr>
<tr>
<td><code>example.in</code></td>
<td><code>example-info.de</code></td>
<td>ใช่</td>
</tr>
<tr>
<td><code>^www\.example\.in\.?$</code></td>
<td><code>www.example.in</code></td>
<td>ใช่</td>
</tr>
<tr>
<td><code>^www\.example\.in\.?$</code></td>
<td><code>advertising.example.in</code></td>
<td>ไม่</td>
</tr>
<tr>
<td><code>^www\.example\.in\.?$</code></td>
<td><code>www.example.in.example.net</code></td>
<td>ไม่</td>
</tr>
</tbody>
</table>
<p>ผมเขียนทั้ง 26 รายการใหม่ในรูปแบบที่ตรงและผูกหัวท้ายนั้น แล้ว apply การเปลี่ยนแปลง ทุกชื่อที่เคยผ่าน tester ถูกบล็อกหลังจากนั้น รายการหนึ่งที่ชื่อของมันเองอยู่ใน list ยังผ่านตามที่ตั้งใจ ชื่อที่ตรงใน 25 รายการที่เหลือไม่ถูก list ใดบล็อก รายการเหล่านั้นจึงไม่ได้ทำงานให้กับชื่อที่มันสะกด ผลอย่างเดียวของมันคือช่องโหว่คำนำหน้า ผมผูกหัวท้ายแทนที่จะลบ เพราะ list อาจเพิ่มชื่อนั้นเข้ามาภายหลัง ถ้าคุณมีรายการแบบนั้น การลบก็เป็นทางเลือกที่สมเหตุสมผล</p>
<details>
<summary>เจาะลึก: โค้ด และสิ่งที่การทดสอบของผมแสดงและไม่แสดง</summary>
<p>dialog ของ blocklist มีช่อง &#8220;Allowlist Domains&#8221; ช่องเดียว ข้อความช่วยเหลือของช่องบอกว่ารับโดเมน ใช้ regular expression ได้ และใช้กับรายการที่ตรงใน policy นั้นเท่านั้น ใน 26.7:</p>
<ul>
<li><code>src/opnsense/service/templates/OPNsense/Unbound/core/blocklists.conf</code> เขียนช่องนี้เป็น <code>excludes.patterns</code> คั่นด้วยจุลภาค</li>
<li><code>src/opnsense/scripts/unbound/blocklists/default_bl.py</code> แยกค่านั้นที่เครื่องหมายจุลภาค เรียก <code>strip()</code> กับแต่ละรายการ ทิ้งรายการที่ compile เป็น regular expression ไม่ได้ (พร้อมบรรทัด log &#8220;skip invalid&#8221;) และรวมรายการที่เหลือ พร้อมรายการ <code>.*localhost$</code> ที่มีมาในตัว เป็น pattern เดียวด้วย <code>|</code></li>
<li><code>src/opnsense/scripts/unbound-dnsbl/lib/__init__.py</code> compile pattern โดยไม่สนใจตัวพิมพ์เล็กใหญ่</li>
<li><code>src/opnsense/scripts/unbound-dnsbl/lib/dnsbl.py</code> ทดสอบด้วย <code>r.match(domain)</code> หลังจากพบชื่อใน blocklist <code>match</code> ของ Python ผูกที่ต้นชื่อ ไม่ผูกที่ท้าย ชื่อถูกแปลงเป็นตัวพิมพ์เล็กและตัดจุดท้ายออกก่อน</li>
<li>เมื่อเป้าหมายของ CNAME ถูกบล็อก ฟังก์ชันเดียวกันจะทดสอบชื่อเดิม (<code>r.match(orig)</code>) ด้วย ชื่อที่อยู่ใน allowlist จึงยัง resolve ผ่าน alias ที่ถูกบล็อกได้ ชื่อเดิมนั้นมาจาก Unbound พร้อมจุดท้าย <code>www.example.com.</code> และไม่ถูกตัดจุดท้ายออก pattern ที่ลงท้ายด้วย <code>$</code> เปล่า ๆ ล้มเหลวที่นั่น <code>\.?$</code> ผ่านทั้งสองเส้นทาง</li>
<li><code>src/opnsense/mvc/app/controllers/OPNsense/Unbound/Api/SettingsController.php</code>, <code>updateBlocklistAction</code> คือสิ่งที่ปุ่ม Allow ใน Reporting เรียก มันลบจุดท้าย (<code>rtrim($domain, '.')</code>) และบันทึกชื่อตามที่เป็น ไม่ escape และไม่ผูกหัวท้าย</li>
</ul>
<p>คู่มือของ OPNsense อธิบายรายการ allowlist ว่าเป็นการยกเว้นรายการ blocklist ที่มี pattern อยู่ในนั้น โค้ดแคบกว่าที่ต้นชื่อ เพราะจับคู่จากอักขระแรกเท่านั้น และเปิดกว้างเท่ากันที่ปลาย ไม่ว่าจะอ่านแบบใด การผูกปลายเป็นหน้าที่ของผู้เขียนรายการ ผมเทียบไฟล์ 5 ไฟล์เดิมนี้ใน release 26.7 ล่าสุดกับ development branch โค้ด allowlist ไม่เปลี่ยน</p>
<p>สิ่งที่การทดสอบแสดง คือ parser และ matching call ใน source 26.7 จัดการรายการเหล่านี้อย่างไร รันนอก router โดยจำลองกรณี CNAME ด้วยการเติมจุดท้าย และบน router ของผม ผลของ tester สำหรับแต่ละชื่อ phishing ที่ผมลอง เทียบกับตัวควบคุมที่ต่างกันเพียงไม่ได้ขึ้นต้นด้วยชื่อที่อยู่ใน allowlist ทั้งก่อนและหลังการเขียนใหม่ tester รันโค้ดจับคู่เดียวกันกับ list ที่ router โหลดไว้ แต่ใช้ได้เฉพาะกับการ lookup ตรง จึงแสดงเส้นทาง CNAME ไม่ได้ จำนวน 43 ชื่อมาจาก list ที่เผยแพร่ ไม่ได้มาจาก router ทั้ง 43 ชื่ออยู่บน TIF</p>
</details>
<h3>วิธีตรวจของคุณ</h3>
<p>ตรวจ 4 อย่าง ทั้งหมดอ่านอย่างเดียวจนถึงอย่างสุดท้าย:</p>
<ol>
<li>อ่าน resolver log เพื่อหา list ที่ดาวน์โหลดไม่สำเร็จ และรายการ allowlist ที่ถูกข้าม</li>
<li>ใน tester ของ blocklist ลองชื่อที่ควรถูกบล็อกหนึ่งชื่อ และชื่อที่ควรผ่านหนึ่งชื่อ เพื่อดูว่า list โหลดอยู่</li>
<li>สำหรับแต่ละรายการ allowlist ให้ทดสอบรายการนั้นตามด้วยโดเมนที่ list ของคุณบล็อก แล้วทดสอบชื่อเดียวกันโดยมี <code>www.</code> นำหน้า ถ้าชื่อแรกผ่านและชื่อที่สองถูกบล็อก รายการนั้นเปิดอยู่</li>
<li>เขียนแต่ละรายการที่เปิดอยู่ใหม่แบบผูกหัวท้าย apply แล้วทดสอบอีกครั้ง</li>
</ol>
<p>ขั้นตอนคลิกทีละขั้นสำหรับข้อ 1 ถึง 3 และสำหรับการเขียนใหม่อยู่ในส่วนเจาะลึก 2 ส่วนด้านล่าง ขั้นตอนเริ่มจากหน้า sign-in และบอกว่าแต่ละขั้นเปลี่ยนอะไร</p>
<details>
<summary>เจาะลึก: ทีละขั้น การตรวจ allowlist ของคุณ</summary>
<p><strong>ก่อนเริ่ม</strong> คุณต้องมี browser บนคอมพิวเตอร์ในเครือข่ายของคุณ และที่อยู่กับข้อมูลล็อกอินของหน้าตั้งค่า router ขั้นที่ 1 ถึง 8 อ่านอย่างเดียว ไม่เปลี่ยนอะไรบน router คุณจึงหยุดตรงไหนก็ได้โดยไม่ต้องย้อนอะไร ใช้เวลาประมาณ 10 นาที บวกประมาณ 10 วินาทีต่อการทดสอบหนึ่งครั้ง เพราะ tester โหลด blocklist ทั้งชุดทุกครั้ง</p>
<ol>
<li>เปิด browser และพิมพ์ที่อยู่ที่คุณใช้ sign in เข้า OPNsense แล้ว sign in คุณควรเห็นหน้า Lobby ถ้าหน้าไม่โหลด ให้ตรวจว่าคอมพิวเตอร์อยู่ในเครือข่ายบ้านของคุณ และคุณใช้ที่อยู่เดียวกับที่ใช้เปลี่ยนค่าอื่นของ router</li>
<li>ในเมนูทางซ้าย คลิก <strong>Services</strong> แล้ว <strong>Unbound DNS</strong> แล้ว <strong>Log File</strong> คุณควรเห็นตารางที่มีคอลัมน์ Date, Severity, Process และ Line ด้านบนมีช่องค้นหา ช่อง severity (ตั้งเป็น Warning) และช่องเวลา (ตั้งเป็น Last day)</li>
<li>คลิกช่องค้นหา พิมพ์ <code>blocklist</code> แล้วกด Enter บรรทัดที่สำคัญมี 2 แบบ &#8220;unable to download blocklist&#8221; หมายความว่า list โหลดไม่สำเร็จและไม่ได้ช่วยอะไรเลย &#8220;skip invalid whitelist exclude pattern&#8221; หมายความว่า OPNsense ทิ้งรายการ allowlist ถ้าตารางว่าง แปลว่าในวันที่ผ่านมาไม่มีการบันทึกระดับ Warning เปิดช่อง severity แล้วติ๊ก <strong>Informational</strong> เพิ่มเพื่อดูบรรทัด &#8220;blocklist loaded&#8221; เปิดช่องเวลาเพื่อดูย้อนไปไกลกว่านั้น</li>
<li>ในเมนูเดียวกัน คลิก <strong>Blocklists</strong> แล้วแท็บ <strong>Tester</strong> ที่ด้านบนของหน้า คุณควรเห็นช่อง Domain ช่อง Source และปุ่ม <strong>Test</strong> ปล่อยช่อง Source ว่างไว้ การทดสอบจะรันในฐานะตัว router เอง ช่อง Source รับที่อยู่ของอุปกรณ์ และสำคัญเฉพาะเมื่อคุณมี policy ที่ใช้กับอุปกรณ์บางเครื่อง</li>
<li>พิมพ์ <code>googleads.g.doubleclick.net</code> ในช่อง Domain แล้วคลิก <strong>Test</strong> รอประมาณ 10 วินาที ผลควรเป็น Block จากนั้นทดสอบ <code>www.youtube.com</code> ควรเป็น Pass ถ้าชื่อแรกผ่าน แปลว่าไม่มี list ใดโหลดอยู่ หรือชื่อนั้นอยู่ใน allowlist ของคุณเอง ให้กลับไปขั้นที่ 3 และอ่านข้อผิดพลาด และถ้าคุณ allow ชื่อนั้นไว้ ให้เลือกชื่ออื่นที่ list ของคุณบล็อก tester ไม่ตาม CNAME CNAME คือชื่อที่ชี้ไปยังอีกชื่อหนึ่ง tester ตรวจเฉพาะชื่อที่คุณพิมพ์</li>
<li>คลิกแท็บ <strong>Blocklists</strong> จากนั้นที่ปลายด้านขวาของแถว policy ของคุณ คลิกไอคอนดินสอ (Edit) หน้าต่างชื่อ <strong>Edit Blocklist</strong> เปิดขึ้น <strong>Allowlist Domains</strong> แสดงรายการของคุณ รายการละ 1 tag อ่านแล้วคลิก <strong>Cancel</strong> ไม่มีอะไรถูกบันทึก</li>
<li>สำหรับแต่ละรายการ ให้ทดสอบรายการนั้นตามด้วยโดเมนที่ list ของคุณบล็อก ชื่อที่ list ของผมบล็อกคือ <code>googleads.g.doubleclick.net</code> ตัวเดียวกับในขั้นที่ 5 ถ้า list ของคุณไม่บล็อกชื่อนี้ ให้เลือกชื่อที่ list ของคุณบล็อก ดังนั้นสำหรับรายการ <code>example.com</code> พิมพ์ <code>example.com.googleads.g.doubleclick.net</code> แล้วคลิก <strong>Test</strong> จากนั้นทดสอบชื่อเดียวกันโดยมี <code>www.</code> นำหน้า <code>www.example.com.googleads.g.doubleclick.net</code> ถ้าคุณโหลด TIF คุณใช้ชื่อจาก list นั้นแทนได้ รายการที่ขึ้นต้นด้วย <code>^</code> และลงท้ายด้วย <code>$</code> อยู่แล้วคือรายการที่ผูกหัวท้ายแล้ว ให้ข้ามไป</li>
<li>อ่านผลทั้งสองร่วมกัน ถ้าชื่อแรกผ่านและชื่อที่สองถูกบล็อก รายการนั้นเปิดอยู่ มันปล่อยผ่านทุกชื่อที่ขึ้นต้นด้วยมัน ให้เขียนใหม่แบบผูกหัวท้าย ชื่อที่ไม่มี list ใดบล็อกจะผ่านไม่ว่า allowlist จะระบุอย่างไร ดังนั้นให้ยืนยันใน tester ว่าชื่อนั้นถูกบล็อกก่อนจะอ่านผล Pass เป็นข้อบกพร่อง</li>
</ol>
</details>
<details>
<summary>เจาะลึก: ทีละขั้น การเขียน allowlist ของคุณใหม่</summary>
<p><strong>ก่อนเริ่ม</strong> ขั้นตอนนี้เปลี่ยนการกรองของ router ควรเผื่อเวลา 15 นาที ความผิดพลาดที่นี่ส่วนใหญ่แสดงเป็นเว็บไซต์ที่ allow ไว้ 1 แห่งโหลดไม่ขึ้น อินเทอร์เน็ตส่วนที่เหลือควรยังทำงานอยู่ router ใช้การเปลี่ยนแปลงภายในประมาณ 1 นาที (43 วินาทีบนเครื่องผม) และไม่ restart Unbound log แสดง list โหลดเข้าสู่ process ที่กำลังรันอยู่ ขั้นที่ 3 เก็บสำเนารายการเก่าของคุณ และขั้นที่ 8 ใส่กลับคืน</p>
<ol>
<li>เปิดหน้าตั้งค่าของ router แล้ว sign in คลิก <strong>Services</strong> แล้ว <strong>Unbound DNS</strong> แล้ว <strong>Blocklists</strong></li>
<li>ที่ปลายด้านขวาของแถว policy ของคุณ คลิกไอคอนดินสอ (Edit) หน้าต่าง <strong>Edit Blocklist</strong> เปิดขึ้น ใต้ <strong>Allowlist Domains</strong> คลิก <strong>Text</strong> ซึ่งเป็นลิงก์เล็ก ๆ ใต้ช่อง tag จะกลายเป็นช่องธรรมดาที่มี 1 รายการต่อบรรทัด และลิงก์ <strong>Back</strong> ปรากฏขึ้น ถ้าคุณมี policy มากกว่า 1 อัน แต่ละอันมี allowlist ของตัวเอง ให้ทำกับทุกอัน</li>
<li>ทำสำเนาไว้เผื่อย้อนกลับ คลิกในช่อง กด <code>Ctrl</code> + <code>A</code> แล้ว <code>Ctrl</code> + <code>C</code> เปิด Notepad (เมนู Start พิมพ์ <code>notepad</code> กด Enter) กด <code>Ctrl</code> + <code>V</code> และบันทึกไฟล์เป็น <code>allowlist-before.txt</code> ในโฟลเดอร์ที่คุณจะหาเจออีก ไฟล์ควรมี 1 รายการต่อบรรทัด</li>
<li>
<p>เขียนแต่ละบรรทัดในช่องใหม่ ขั้นนี้ใช้กับชื่อธรรมดา รายการที่เป็น pattern อยู่แล้ว เช่นรายการที่มี <code>(.*\.)?</code> คงไว้ตามเดิม เขียนชื่อที่ตรงตามที่อุปกรณ์ของคุณถาม ใส่ <code>\</code> หน้าทุกจุด ใส่ <code>^</code> ที่ต้น และ <code>\.?$</code> ที่ท้าย:</p>
<ul>
<li><code>example.in</code> กลายเป็น <code>^example\.in\.?$</code></li>
<li><code>www.example.com</code> กลายเป็น <code>^www\.example\.com\.?$</code></li>
</ul>
<p>ให้มี 1 รายการต่อบรรทัด ไม่มีช่องว่าง และไม่มีจุลภาค ชื่อที่มี <code>www.</code> กับชื่อเดียวกันที่ไม่มีเป็น 2 ชื่อ และต้องใช้ 2 บรรทัด ถ้าคุณไม่แน่ใจว่าอุปกรณ์ถามชื่อไหน ให้ดูใน <strong>Reporting</strong> → <strong>Unbound DNS</strong> หรือใส่ทั้งสองชื่อไว้ในรายการ</p>
</li>
<li>
<p>คลิก <strong>Back</strong> บรรทัดจะกลับเป็น tag ตรวจว่าทุก tag อยู่ในรูปแบบใหม่ คลิก <strong>Save</strong> หน้าต่างปิด</p>
</li>
<li>คลิก <strong>Apply</strong> ซึ่งเป็นปุ่มสีส้มใต้ตาราง รอประมาณ 1 นาที</li>
<li>ตรวจผล เปิด <strong>Services</strong>, <strong>Unbound DNS</strong>, <strong>Log File</strong> ค้นหา <code>blocklist</code> และติ๊ก <strong>Informational</strong> ในช่อง severity คุณควรเห็น &#8220;updating blocklist&#8221; แล้ว &#8220;blocklist loaded. length is&#8221; และตัวเลข และไม่มีบรรทัด &#8220;skip invalid&#8221; จากนั้นทำขั้นตอนของ tester ซ้ำจากข้างต้น ชื่อที่หน้าตาคล้ายกันควรเป็น Block แล้ว รายการที่ allow ชื่อที่ list บล็อก (บนเครื่องผมคือรายการสำหรับ ad host ของ Google) ควรยังเป็น Pass</li>
<li>ถ้าเว็บไซต์หยุดโหลดหลังการเปลี่ยนแปลง ให้ย้อนกลับ เปิด <code>allowlist-before.txt</code> ใน Notepad กด <code>Ctrl</code> + <code>A</code> แล้ว <code>Ctrl</code> + <code>C</code> ใน router ทำขั้นที่ 1 และ 2 ซ้ำ คลิกในช่อง กด <code>Ctrl</code> + <code>A</code> แล้ว <code>Ctrl</code> + <code>V</code> เพื่อวางรายการเก่าทับรายการใหม่ คลิก <strong>Back</strong>, <strong>Save</strong> และ <strong>Apply</strong> เว็บไซต์ที่ต้องการชื่อที่คุณไม่ได้ใส่ไว้จะถูกบล็อกจนกว่าคุณจะเพิ่มชื่อที่ตรงนั้น</li>
</ol>
</details>
<details>
<summary>เจาะลึก: ทดสอบการเปลี่ยน allowlist จากคอมพิวเตอร์</summary>
<p><strong>ก่อนเริ่ม</strong> ส่วนนี้สำหรับ Windows PC ในเครือข่ายเดียวกับ router มันถาม DNS ของ router หา 1 ชื่อ และล้าง DNS cache ของ PC เอง ไม่เปลี่ยนอย่างอื่น ใช้เวลา 2 นาที บน Mac หรือ Linux แนวคิดเหมือนกัน (<code>nslookup name router-address</code>) แต่คำสั่งล้าง cache ต่างกัน</p>
<ol>
<li>คลิกเมนู Start พิมพ์ <code>powershell</code> แล้วกด Enter หน้าต่างเปิดขึ้นพร้อม prompt ที่ขึ้นต้นด้วย <code>PS</code></li>
<li>
<p>หาที่อยู่ของ router พิมพ์คำสั่งนี้แล้วกด Enter:</p>
<div class="sf-box" data-mode="one" data-shell="ps" data-effect="read" data-effect-text="ดูอย่างเดียว — ลองได้อย่างปลอดภัย" data-where="PowerShell บน PC ของคุณ" data-how="1 คำสั่ง — วางแล้วกด Enter"><pre><code>ipconfig</code></pre></div>
<p class="sf-after">มองหา <strong>Default Gateway</strong> ใต้ adapter ที่คุณใช้ ที่อยู่นั้นคือ router ของคุณ ขั้นตอนด้านล่างเรียกมันว่า <code>&lt;router-ip&gt;</code> ถ้า router ของคุณอยู่หลัง router อีกตัว default gateway อาจเป็นอุปกรณ์อีกตัวนั้น ให้ใช้ที่อยู่ของกล่องที่รัน DNS blocklist ของคุณ ถ้าบรรทัดว่าง คุณกำลังดู adapter ที่ไม่ได้เชื่อมต่อ ให้เลื่อนไปอันถัดไป</p>
</li>
<li>
<p>หลังคลิก <strong>Apply</strong> บน router และรอ 1 นาที ให้ล้าง cache ของ PC คำตอบที่ถูกบล็อกมีอายุ 1 ชั่วโมง ถ้าไม่ล้าง PC อาจเก็บคำตอบเก่าไว้:</p>
<div class="sf-box" data-mode="one" data-shell="ps" data-effect="change" data-effect-text="ล้างเฉพาะ DNS cache ของ PC" data-where="PowerShell บน PC ของคุณ" data-how="1 คำสั่ง — วางแล้วกด Enter"><pre><code>ipconfig /flushdns</code></pre></div>
</li>
<li>
<p>ถาม router หาชื่อ โดยแทน <code>&lt;router-ip&gt;</code> ด้วยที่อยู่จากขั้นที่ 2 จุดสุดท้ายหลังชื่อกันไม่ให้ Windows ลอง search suffix ก่อน:</p>
<div class="sf-box" data-mode="one" data-shell="ps" data-effect="read" data-effect-text="ดูอย่างเดียว — ลองได้อย่างปลอดภัย" data-where="PowerShell บน PC ของคุณ" data-how="1 คำสั่ง — วางแล้วกด Enter"><pre><code>nslookup www.example.com. &lt;router-ip&gt;</code></pre></div>
<p class="sf-after">ชื่อที่ถูกบล็อกตอบ <code>0.0.0.0</code> หรือ &#8220;Non-existent domain&#8221; ถ้าติ๊ก Return NXDOMAIN บน policy ชื่อที่ allow ตอบด้วยที่อยู่จริงของมัน 2 บรรทัดแรกแสดง router ของคุณ ที่เหลือคือคำตอบ</p>
</li>
</ol>
</details>
<h3>18 list รวมกันได้อะไร</h3>
<p>ใน resolver log ของ router ตั้งแต่บรรทัดแรกจนถึงการล้างครั้งแรก ทุกการอัปเดตเต็มตอนกลางคืนถูกตั้งให้โหลด 18 list ชุดเดียวกัน (รวม ThreatFox ดูด้านล่าง):</p>
<ul>
<li>Hagezi Normal บวกรุ่น Mini ของ Pro, Pro++ และ Ultimate</li>
<li>Threat Intelligence Feeds (TIF) ทั้ง 3 ขนาด: full, Medium และ Mini</li>
<li>Gambling ทั้ง 3 ขนาด</li>
<li>Fake, Pop-Up Ads, Badware Hoster, DynDNS, Anti Piracy และ &#8220;Safesearch not supported&#8221;</li>
<li>OISD NSFW และ Abuse.ch ThreatFox</li>
</ul>
<p>Hagezi ผู้ดูแล list เหล่านี้ส่วนใหญ่ ให้กฎการรวม list ของเขาไว้ใน FAQ:</p>
<ol>
<li>Multi list ทั้ง 5 ได้แก่ Light, Normal, Pro, Pro++ และ Ultimate ต่อยอดกัน แต่ละ list มี list ระดับล่างรวมอยู่ คุณเลือก 1 list</li>
<li>รุ่นที่ปรับขนาด (Mini และ Medium สำหรับ TIF และ Gambling) เป็นทางเลือกแทน list เต็มของมัน ไม่ใช่สิ่งที่วางซ้อนบน list เต็ม</li>
<li>TIF เป็นข้อยกเว้น มันครอบคลุม malware, cryptojacking, scam, spam และ phishing และตั้งใจให้รันควบคู่กับ tier ใดก็ตามที่คุณเลือก</li>
</ol>
<p>Mini ของ Pro, Pro++, Ultimate และ Gambling เก็บเฉพาะชื่อที่ปรากฏอยู่ใน list ของโดเมนที่ถูกเข้าชมมากที่สุดด้วย TIF Mini และ Gambling Mini ตัดมาจาก list Medium Hagezi อธิบายว่า Mini ทำมาสำหรับตัวบล็อกบนอุปกรณ์ที่มีหน่วยความจำจำกัด</p>
<details>
<summary>เจาะลึก: tier ไหนเหมาะกับใคร และ Ultimate มีต้นทุนอะไร</summary>
<p>FAQ ของ Hagezi จับคู่ tier กับคนที่จะจัดการเมื่อมีสิ่งใช้งานไม่ได้:</p>
<table>
<thead>
<tr>
<th>Tier</th>
<th>เหมาะกับ</th>
<th>ความเสี่ยงที่ใช้งานไม่ได้ (การจัดระดับของ Hagezi)</th>
</tr>
</thead>
<tbody>
<tr>
<td>Light</td>
<td>blocker ที่รับ list ใหญ่ไม่ไหว หรือการตั้งค่าที่แม้ Normal ก็มากเกินไป</td>
<td>น้อยที่สุด</td>
</tr>
<tr>
<td>Normal</td>
<td>การตั้งค่าที่ไม่มีคนดูแล และไม่มี admin คอยปลดบล็อก</td>
<td>ต่ำ</td>
</tr>
<tr>
<td>Pro</td>
<td>มีคนปลดบล็อกให้ได้ เป็นคำแนะนำเริ่มต้นของเขา คู่กับ TIF</td>
<td>ต่ำถึงปานกลาง</td>
</tr>
<tr>
<td>Pro++</td>
<td>ผู้ใช้ที่มีประสบการณ์และมี admin</td>
<td>ปานกลาง</td>
</tr>
<tr>
<td>Ultimate</td>
<td>ผู้ใช้ที่มีประสบการณ์มากและมี admin อยู่</td>
<td>สูง</td>
</tr>
</tbody>
</table>
<p>แต่ละ tier ยังมีส่วนแบ่งของ list tracker ในตัวอุปกรณ์ (native tracker) คือ telemetry ที่ฝังอยู่ใน TV โทรศัพท์ และระบบปฏิบัติการ Pro++ บล็อกเกือบทั้งหมด Ultimate บล็อกทั้งหมด README ระบุสิ่งที่ Ultimate ต้องแลก ได้แก่ บางฟังก์ชันของ Facebook และ Messenger; ส่วนเสริมของ WhatsApp เช่น avatar และเอฟเฟกต์วิดีโอ; Windows Spotlight และประวัติความสำเร็จของ Xbox; และ tracker ตำแหน่งที่บางเว็บไซต์พึ่งพา ซึ่งอาจทำให้ได้การตั้งค่าภูมิภาคผิดและเจอ CAPTCHA มากขึ้น</p>
</details>
<p>ชุดของผมฝ่าฝืนกฎ 2 ข้อแรก ผมดาวน์โหลด list ครั้งเดียวสำหรับการตรวจนี้และเทียบกันทีละชื่อ เพื่อดูว่ารายการใดที่ list หนึ่งบล็อกอยู่แล้วใน list อื่น ผมไม่มีสำเนาที่ router โหลดไว้ก่อนหน้า และผมไม่ได้วัด ThreatFox จึงวัด 17 list</p>
<p>7 จาก 17 list ถูกชุดที่เหลือครอบคลุม ยกเว้นรายการ marker หนึ่งรายการของแต่ละ list ได้แก่ Pro Mini, Pro++ Mini, TIF Medium, TIF Mini, Gambling Medium, Gambling Mini และ Fake การทิ้งทั้ง 7 พร้อมกันจะเสีย 15 ชื่อที่ TIF Medium และ Mini มี แต่ TIF เต็มไม่มี Pop-Up Ads เพิ่ม 37 ชื่อจาก 48,277 ชื่อของมันให้กับชุดที่เหลือ (เทียบกับ Pro++ อย่างเดียวมันเพิ่ม 3 ชื่อ ดูด้านล่าง) DynDNS และ Anti Piracy ต่างออกไป บน list เหล่านั้นมีประมาณ 1,200 และประมาณ 55,000 ชื่อที่ไม่มี list อื่นในชุดมี และผมทิ้งไปโดยเลือกเอง ไม่ใช่เพราะซ้ำ</p>
<p>tier list ทั้ง 4 รวมกันมี 233,710 ชื่อ ซึ่งอยู่ใน Ultimate ทั้งหมดยกเว้นรายการ marker 4 รายการของ Hagezi เมื่อเทียบกับ Pro++ อย่างเดียว ชุดนี้ขาด 31,411 รายการของ Pro++ ซึ่งเป็นรายการที่ไม่อยู่ใน list ของโดเมนที่ถูกเข้าชมมากที่สุด แทนที่นั้นมันมี 25,040 รายการที่มีเพียง Ultimate บล็อก (25,041 เมื่อรวม marker ของ Ultimate Mini) ทั้งหมดมาจาก list ของโดเมนที่ถูกเข้าชมมากที่สุด Hagezi จัดความเสี่ยงที่ Ultimate ทำให้ใช้งานไม่ได้ว่าสูง ผมไม่ได้เก็บบันทึกว่ามีสิ่งใดใช้งานไม่ได้จาก list เหล่านั้น และไม่ได้ทดสอบ แต่ตามการจัดระดับของ Hagezi ชุดผสมนี้รับความเสี่ยงของ Ultimate และขาดความครอบคลุมของ Pro++</p>
<details>
<summary>เจาะลึก: ผมวัดอย่างไร และทำไมการเทียบแบบธรรมดาจึงให้ผลผิด</summary>
<p>OPNsense ใช้รูปแบบ wildcard ของ Hagezi ซึ่งบรรทัดอย่าง <code>*.example.com</code> บล็อก example.com และทุกชื่อใต้มัน ดังนั้นรายการใน list A ถูก list B บล็อกอยู่แล้ว ถ้า B มีรายการนั้นหรือโดเมนแม่ของมันรายการใดรายการหนึ่ง</p>
<p>การเทียบข้อความธรรมดาพลาดเรื่องนี้ <code>comm</code> รายงานว่า 3,294 รายการของ Pro++ Mini &#8220;ไม่อยู่ใน&#8221; Ultimate Mini ทั้งหมดยกเว้น 1 รายการถูกครอบคลุม เพราะ Ultimate Mini บล็อกโดเมนแม่แทน มีบรรทัดเดียวสำหรับ <code>omtrdc.net</code> ทั้งโดเมน ซึ่งเป็นโดเมน tracking ของ Adobe ขณะที่ Pro++ Mini ระบุ host ของมัน 998 รายการทีละตัว รายการที่เหลือ 1 รายการคือ marker ของ Hagezi ซึ่งอธิบายด้านล่าง</p>
<p>tier list ทั้ง 4 วัดด้วยวิธีเดียวกัน:</p>
<table>
<thead>
<tr>
<th>Normal + Pro Mini + Pro++ Mini + Ultimate Mini</th>
<th></th>
</tr>
</thead>
<tbody>
<tr>
<td>ชื่อที่ไม่ซ้ำ</td>
<td>233,710</td>
</tr>
<tr>
<td>ในจำนวนนั้น อยู่ใน Ultimate ด้วย</td>
<td>ทั้งหมดยกเว้น 4 (รายการ marker ของ Hagezi)</td>
</tr>
<tr>
<td>รายการของ Pro++ ที่ขาดจากชุดผสม</td>
<td>31,411 จาก 223,551</td>
</tr>
<tr>
<td>ชื่อในชุดผสมที่มีเพียง Ultimate บล็อก</td>
<td>25,040</td>
</tr>
</tbody>
</table>
<p>การตรวจที่ผมใช้ไล่ขึ้นไปตามโดเมนแม่ เป็น script Python 3 ที่ไม่ต้องติดตั้งอะไรนอกจาก Python เอง script อยู่ก่อน ขั้นตอนหลังจากนั้นบอกวิธีบันทึกและรัน</p>
<div class="sf-box" data-mode="file" data-where="ไฟล์: hagezi_overlap.py" data-how="บันทึกเป็นไฟล์ — อย่ารัน"><pre><code>#!/usr/bin/env python3
"""hagezi_overlap.py - how much of blocklist A is already blocked by blocklist B.

Reads two Hagezi lists in the wildcard format (the /wildcard/ files, the format
OPNsense uses). A line "*.example.com" blocks example.com and every name under
it, so an entry of A counts as covered when the entry itself, or one of its
parent domains, is in B. A plain text comparison (comm, diff) misses that and
reports too many differences.

Usage:  python3 hagezi_overlap.py A.txt B.txt
Author: Vivek Sanghi. Licence: CC BY-NC-SA 4.0, as the blog.
"""
import re
import sys

WILDCARD = re.compile(r"^\*\.[a-z0-9_-]+(\.[a-z0-9_-]+)+$")


def load(path):
    names = set()
    try:
        f = open(path, encoding="utf-8-sig")
    except OSError as e:
        sys.exit(f"{path}: cannot open ({e.strerror})")
    with f:
        for number, line in enumerate(f, 1):
            line = line.strip().lower()
            if not line or line.startswith("#"):
                continue
            if not WILDCARD.match(line):
                sys.exit(f"{path}, line {number}: not a wildcard-format line "
                         "('*.example.com'). Download the /wildcard/ version of the list.")
            names.add(line[2:])
    if not names:
        sys.exit(f"{path}: no entries found; check the download")
    return names


def covered(name, blocked):
    while True:
        if name in blocked:
            return True
        if "." not in name:
            return False
        name = name.split(".", 1)[1]


def main():
    if len(sys.argv) != 3:
        sys.exit("usage: hagezi_overlap.py A.txt B.txt")
    a, b = load(sys.argv[1]), load(sys.argv[2])
    missing = sorted(n for n in a if not covered(n, b))
    print(f"{sys.argv[1]}: {len(a):,} entries; {len(a) - len(missing):,} already "
          f"blocked by {sys.argv[2]}; {len(missing):,} not")
    for n in missing[:10]:
        print(f"  not covered: {n}")
    if len(missing) &gt; 10:
        print(f"  ... and {len(missing) - 10:,} more")


if __name__ == "__main__":
    main()
</code></pre></div>
<p><strong>ก่อนเริ่ม</strong> ส่วนนี้สำหรับ Windows PC คุณต้องมี Python 3 (ขั้นที่ 3 ตรวจให้) ขั้นตอนสร้างโฟลเดอร์ 1 โฟลเดอร์ในโฟลเดอร์ผู้ใช้ของคุณ ดาวน์โหลดไฟล์ list 2 ไฟล์ขนาดไม่กี่เมกะไบต์ลงไป และอ่านไฟล์เหล่านั้น ไม่เปลี่ยนอย่างอื่น ควรเผื่อเวลา 10 นาที เพื่อย้อนกลับ ให้ลบโฟลเดอร์ใน File Explorer บน Mac หรือ Linux ใช้ Terminal, <code>python3</code> แทน <code>py</code> และ <code>curl</code> แทน <code>curl.exe</code></p>
<ol>
<li>คลิกเมนู Start พิมพ์ <code>powershell</code> แล้วกด Enter หน้าต่างเปิดขึ้นพร้อม prompt ที่ขึ้นต้นด้วย <code>PS</code></li>
<li>
<p>สร้างโฟลเดอร์และเข้าไปในโฟลเดอร์นั้น แต่ละบรรทัดใช้เวลาครู่หนึ่ง รันทีละบรรทัด:</p>
<div class="sf-box" data-mode="each" data-shell="ps" data-effect="change" data-effect-text="สร้าง 1 โฟลเดอร์" data-where="PowerShell บน PC ของคุณ" data-how="2 คำสั่ง — รันทีละคำสั่งตามลำดับ คลิก PS&gt; เพื่อคัดลอกบรรทัดนั้น"><pre><code>mkdir hagezi-check
cd hagezi-check</code></pre></div>
<p class="sf-after">prompt ควรลงท้ายด้วย <code>hagezi-check</code> ถ้าบรรทัดแรกบอกว่ามีโฟลเดอร์อยู่แล้ว ให้เลือกชื่ออื่นและใช้ในทั้งสองบรรทัด</p>
</li>
<li>
<p>ตรวจว่าติดตั้ง Python แล้ว:</p>
<div class="sf-box" data-mode="one" data-shell="ps" data-effect="read" data-effect-text="ดูอย่างเดียว — ลองได้อย่างปลอดภัย" data-where="PowerShell บน PC ของคุณ" data-how="1 คำสั่ง — วางแล้วกด Enter"><pre><code>py --version</code></pre></div>
<p class="sf-after">คุณควรเห็นบรรทัดเช่น <code>Python 3.12.4</code> ถ้า PowerShell บอกว่าไม่รู้จัก <code>py</code> ให้ติดตั้ง Python 3 จาก python.org (ติ๊ก &#8220;Add python.exe to PATH&#8221; ใน installer) ปิด PowerShell และเริ่มใหม่ที่ขั้นที่ 1</p>
</li>
<li>
<p>สร้างไฟล์ script ขั้นนี้จะเปิด Notepad:</p>
<div class="sf-box" data-mode="one" data-shell="ps" data-effect="change" data-effect-text="สร้าง 1 ไฟล์" data-where="PowerShell บน PC ของคุณ" data-how="1 คำสั่ง — วางแล้วกด Enter"><pre><code>notepad hagezi_overlap.py</code></pre></div>
<p class="sf-after">Notepad ถามว่าจะสร้างไฟล์ใหม่หรือไม่ คลิก <strong>Yes</strong> วาง script จากกล่องด้านบน (คลิก <strong>Copy</strong> บนกล่อง แล้ว <code>Ctrl</code> + <code>V</code> ใน Notepad) กด <code>Ctrl</code> + <code>S</code> แล้วปิด Notepad ถ้า Notepad เปิดโดยไม่ถาม ให้บันทึกด้วย <strong>File</strong>, <strong>Save as</strong> พิมพ์ <code>hagezi_overlap.py</code> โดยใส่ในเครื่องหมายคำพูด เป็นชื่อไฟล์ ตรวจว่าโฟลเดอร์คือ <code>hagezi-check</code> แล้วคลิก <strong>Save</strong></p>
</li>
<li>
<p>ดาวน์โหลด list 2 รายการลงโฟลเดอร์ บน Windows พิมพ์ <code>curl.exe</code> ไม่ใช่ <code>curl</code> ใน PowerShell รันทีละบรรทัด:</p>
<div class="sf-box" data-mode="each" data-shell="ps" data-effect="change" data-effect-text="ดาวน์โหลด 2 ไฟล์" data-where="PowerShell บน PC ของคุณ" data-how="2 คำสั่ง — รันทีละคำสั่งตามลำดับ คลิก PS&gt; เพื่อคัดลอกบรรทัดนั้น"><pre><code>curl.exe -o pro.plus.mini.txt https://cdn.jsdelivr.net/gh/hagezi/dns-blocklists@latest/wildcard/pro.plus.mini.txt
curl.exe -o ultimate.mini.txt https://cdn.jsdelivr.net/gh/hagezi/dns-blocklists@latest/wildcard/ultimate.mini.txt</code></pre></div>
<p class="sf-after">แต่ละบรรทัดใช้เวลาไม่กี่วินาทีและพิมพ์ตารางความคืบหน้า ถ้าบรรทัดใดลงท้ายด้วยข้อผิดพลาด ให้ตรวจการเชื่อมต่อและรันบรรทัดนั้นอีกครั้ง</p>
</li>
<li>
<p>รันการตรวจ:</p>
<div class="sf-box" data-mode="one" data-shell="ps" data-effect="read" data-effect-text="ดูอย่างเดียว — ลองได้อย่างปลอดภัย" data-where="PowerShell บน PC ของคุณ" data-how="1 คำสั่ง — วางแล้วกด Enter"><pre><code>py hagezi_overlap.py pro.plus.mini.txt ultimate.mini.txt</code></pre></div>
</li>
<li>
<p>บน list ที่ผมดาวน์โหลดสำหรับการตรวจนี้ มันพิมพ์ว่า:</p>
<div class="sf-box" data-mode="output" data-where="สิ่งที่คุณควรเห็น" data-how="คุณไม่ต้องพิมพ์สิ่งนี้"><pre><code>pro.plus.mini.txt: 98,704 entries; 98,703 already blocked by ultimate.mini.txt; 1 not
  not covered: h4g3z1-pro-plus-mini.web.app</code></pre></div>
<p class="sf-after">ตัวเลขของคุณจะต่างออกไป เพราะ list เปลี่ยนทุกวัน ถ้าคุณเห็นข้อความแทนตัวเลข แปลว่า script หยุดโดยตั้งใจ ให้อ่านข้อความนั้น เพราะมันระบุชื่อไฟล์และบรรทัด</p>
</li>
</ol>
<p>ชื่อที่เหลือ 1 ชื่อในแต่ละการเทียบคือ marker ที่ Hagezi ใส่ในทุก list (<code>h4g3z1-&lt;list&gt;.web.app</code>) เพื่อให้คุณรู้ว่าโหลด list ใดอยู่ ถ้าการดาวน์โหลดล้มเหลว หรือไฟล์อยู่ในรูปแบบอื่น script จะหยุดและบอกเช่นนั้น แทนที่จะรายงานตัวเลข</p>
<p>สิ่งอื่นที่มันให้ บน list ชุดเดียวกัน:</p>
<table>
<thead>
<tr>
<th>List A</th>
<th>List B</th>
<th>รายการของ A ที่ B บล็อกอยู่แล้ว</th>
</tr>
</thead>
<tbody>
<tr>
<td>Normal (171,454)</td>
<td>Pro++</td>
<td>ทั้งหมดยกเว้น marker</td>
</tr>
<tr>
<td>Pro++ (223,551)</td>
<td>Ultimate</td>
<td>ทั้งหมดยกเว้น marker</td>
</tr>
<tr>
<td>Pro Mini (86,842)</td>
<td>Ultimate Mini</td>
<td>ทั้งหมดยกเว้น marker</td>
</tr>
<tr>
<td>TIF Mini (212,777)</td>
<td>TIF Medium</td>
<td>ทั้งหมดยกเว้น marker</td>
</tr>
<tr>
<td>Gambling Mini (118,888)</td>
<td>Gambling Medium</td>
<td>ทั้งหมดยกเว้น marker</td>
</tr>
<tr>
<td>Fake (17,622)</td>
<td>Pro++</td>
<td>ทั้งหมดยกเว้น marker</td>
</tr>
<tr>
<td>Pop-Up Ads (48,277)</td>
<td>Pro++</td>
<td>ทั้งหมดยกเว้น 4 (marker และอีก 3 รายการ)</td>
</tr>
<tr>
<td>Badware Hoster (1,088)</td>
<td>Pro++</td>
<td>966</td>
</tr>
<tr>
<td>Ultimate Mini (120,458)</td>
<td>Pro++</td>
<td>95,417</td>
</tr>
</tbody>
</table>
<p>script ถูกทดสอบกับ list เหล่านี้ และกับไฟล์ที่หายไป ไฟล์ว่าง ไฟล์ที่มีแต่ comment การดาวน์โหลดที่ล้มเหลว หน้าเว็บ และ list ในรูปแบบ adblock, hosts และ plain-domain</p>
</details>
<p>จำนวนชื่อที่โหลดเข้ามาไม่ได้เปลี่ยนไปตามสิ่งที่ผมทำ ในวันที่ล้างครั้งแรก router โหลด 2,840,117 ชื่อก่อนล้าง และ 3,188,234 ชื่อหลังล้าง โดยใช้ 10 list แทน 18 list: ระหว่างการดาวน์โหลด 2 ครั้งในวันนั้น TIF โตขึ้น 426,519 รายการ ต่อมา โดยที่ผมไม่ได้เปลี่ยนอะไร จำนวนนี้เคลื่อนจาก 2,739,044 ไปเป็น 3,229,041 ใน 4 วัน จากขนาด list ที่ผมดาวน์โหลดสำหรับการตรวจนี้ ประมาณสองในสามของชื่ออยู่บน TIF และประมาณร้อยละ 7 อยู่บน Pro++</p>
<details>
<summary>เจาะลึก: ตัวเลขจาก router พร้อมข้อควรระวัง</summary>
<p>ชื่อที่โหลด จาก log ของ router (&#8220;blocklist loaded. length is …&#8221; คือจำนวนชื่อที่ไม่ซ้ำ):</p>
<table>
<thead>
<tr>
<th>เมื่อใด</th>
<th>List</th>
<th>ชื่อที่โหลด</th>
</tr>
</thead>
<tbody>
<tr>
<td>วันล้างครั้งแรก ก่อนล้าง</td>
<td>18 list เดิม</td>
<td>2,840,117</td>
</tr>
<tr>
<td>วันล้างครั้งแรก หลังล้าง</td>
<td>ชุดใหม่</td>
<td>3,188,234</td>
</tr>
<tr>
<td>5 วันต่อมา</td>
<td>ชุดเดิม</td>
<td>2,739,044</td>
</tr>
<tr>
<td>9 วันต่อมา</td>
<td>ชุดเดิม</td>
<td>3,229,041</td>
</tr>
<tr>
<td>18 วันต่อมา</td>
<td>ชุดเดิม</td>
<td>3,198,953</td>
</tr>
</tbody>
</table>
<p>สัดส่วนของ query ที่ถูกบล็อก จาก Reporting → Unbound DNS:</p>
<table>
<thead>
<tr>
<th>ช่วงเวลา</th>
<th>Query</th>
<th>ถูกบล็อก</th>
</tr>
</thead>
<tbody>
<tr>
<td>วันล้างครั้งแรก อ่านในวันนั้น</td>
<td>ไม่ได้บันทึก</td>
<td>ร้อยละ 12.9</td>
</tr>
<tr>
<td>ช่วงประมาณ 38 ชั่วโมง อ่านภายหลัง</td>
<td>110,248</td>
<td>8,600 (ร้อยละ 7.80)</td>
</tr>
</tbody>
</table>
<p>ค่าร้อยละทั้งสองครอบคลุม list ต่างกัน วันต่างกัน และสิ่งใดก็ตามที่เครือข่ายทำอยู่ในช่วงนั้น จึงไม่ใช่ก่อนและหลัง</p>
</details>
<h3>สิ่งที่ผมติ๊กตอนนี้</h3>
<p>การตั้งค่าบน router ของผมแสดง:</p>
<ul>
<li>Hagezi Pro++ (full)</li>
<li>TIF (full)</li>
<li>Gambling (full)</li>
<li>Fake, Pop-Up Ads, Badware Hoster และ &#8220;Safesearch not supported&#8221;</li>
<li>OISD NSFW</li>
<li>list ของ Hagezi 2 รายการตาม URL ได้แก่เซิร์ฟเวอร์ encrypted-DNS และ tracker ของ LG TV</li>
<li>Abuse.ch ThreatFox ตาม URL พร้อม key ฟรี (ดูด้านล่าง)</li>
</ul>
<p>ผมเลือก Pro++ แทน Pro ที่ Hagezi แนะนำ เพื่อ tracker ของอุปกรณ์ เพราะ Pro++ คือที่ที่เขาบล็อกเกือบทั้งหมด</p>
<p>2 รายการในนี้ซ้ำกัน cheat sheet ของ Hagezi ระบุว่า Fake และ Pop-Up Ads อยู่ใน Pro++ สำหรับ Fake ผลการวัดตรงกัน และเอาออกได้โดยไม่เปลี่ยนสิ่งที่ถูกบล็อก บน list ที่ผมดาวน์โหลด Pop-Up Ads มี 3 ชื่อที่ไม่มีใน Pro++, TIF, Gambling, Hoster หรือ Fake การทิ้งมันจะทำให้เสีย 3 ชื่อนั้น ผมไม่ได้เทียบ ThreatFox หรือ list 2 รายการที่ใส่ตาม URL Fake และ Pop-Up Ads ยังติ๊กอยู่ทั้งคู่</p>
<p>ThreatFox หยุดดาวน์โหลด และตอนนี้ดาวน์โหลดได้อีกครั้ง ทุกการอัปเดตบันทึก &#8220;unable to download blocklist … and no cache available&#8221; ที่อยู่ที่รายการในตัวของ OPNsense ใช้สำหรับมันตอบ &#8220;410 Gone&#8221; และหน้า export ของ abuse.ch ขอ Auth-Key ก่อนจะให้ host file release 26.7 รุ่นหลังลบรายการในตัวออกด้วยเหตุนี้ และชี้ผู้ใช้ไปที่ &#8220;URLs of Blocklists&#8221; abuse.ch ออก key ให้ฟรีผ่านพอร์ทัลยืนยันตัวตนของตน ผมเพิ่ม list ด้วย URL โดยใส่ key ไว้ในที่อยู่ หน้า export ของ abuse.ch ขอ key ใน URL และตัวดาวน์โหลดของ OPNsense ไม่ส่ง header ใดเลย ขั้นตอนด้านล่างแสดงรูปแบบของที่อยู่ การอัปเดตที่เพิ่มมันบันทึก &#8220;blocklist download&#8221; ด้วย 28,889 บรรทัดสำหรับมัน เป็นชื่อ 28,869 ชื่อ และไม่มีข้อผิดพลาด list อื่นโหลดจาก cache ในการอัปเดตนั้น จากจำนวนชื่อที่โหลดตามที่ router นับเอง จำนวนเพิ่มจาก 2,765,172 เป็น 2,782,246 ดังนั้น 17,074 จาก 28,869 ชื่อยังไม่ได้ถูกโหลดอยู่แล้วภายใต้ชื่อที่ตรงตัวนั้น และประมาณ 11,800 ชื่อถูกโหลดอยู่แล้ว การนับเทียบชื่อตามตัวอักษร ชื่อที่โดเมนแม่ถูก list อื่นบล็อกอยู่แล้วจึงนับเป็นชื่อใหม่ Hagezi ไม่ระบุว่า ThreatFox เป็นแหล่งที่มา</p>
<p>key ทำงานเหมือนรหัสผ่าน router เก็บมันไว้ใน configuration และทุกการอัปเดตเขียนที่อยู่ รวมทั้ง key ลงใน resolver log อย่าให้ key ปรากฏใน screenshot, log ที่แชร์, ไฟล์สำรอง configuration หรือ remote log server ที่ออกจากมือคุณไป ถ้ามันรั่ว ให้ขอ key ใหม่จากพอร์ทัลเดียวกันและเปลี่ยนที่อยู่</p>
<details>
<summary>เจาะลึก: เพิ่ม ThreatFox ด้วย key</summary>
<p><strong>ก่อนเริ่ม</strong> ขั้นตอนนี้เพิ่ม list 1 รายการให้ policy ของคุณ ควรเผื่อเวลา 10 นาที ไม่มีอะไรถูกลบ เพื่อย้อนกลับ ให้ลบที่อยู่ออกจากช่องเดิมแล้ว apply อีกครั้ง</p>
<ol>
<li>ใน browser เปิด <code>https://auth.abuse.ch</code> สร้างบัญชีถ้ายังไม่มี และขอ Auth-Key key ใช้ได้ฟรี คัดลอกมันลงไฟล์ข้อความเฉพาะจนถึงขั้นที่ 4 ซึ่งคุณวางมันครั้งเดียว แล้วลบไฟล์นั้น</li>
<li>ล็อกอินเข้า router คลิก <strong>Services</strong> แล้ว <strong>Unbound DNS</strong> แล้ว <strong>Blocklists</strong></li>
<li>ที่ปลายด้านขวาของแถว policy ของคุณ คลิกไอคอนดินสอ (Edit) หน้าต่างชื่อ <strong>Edit Blocklist</strong> เปิดขึ้น</li>
<li>
<p>คลิกใน <strong>URLs of Blocklists</strong> และพิมพ์ที่อยู่ด้านล่าง โดยใส่ key ของคุณแทน <code>YOUR_KEY</code> และไม่มีช่องว่าง กด Enter เพื่อให้มันเป็น tag ของตัวเอง (tag คือ 1 รายการที่แสดงเป็นกล่องเล็กในช่อง):</p>
<div class="sf-box" data-mode="file" data-where="ที่อยู่ list ของ ThreatFox (ตัวอย่าง ไม่ใช่คำสั่ง)" data-how="วางลงในช่อง URLs of Blocklists โดยใส่ key ของคุณแทน YOUR_KEY"><pre><code>https://threatfox-api.abuse.ch/v2/files/exports/YOUR_KEY/hostfile.txt</code></pre></div>
<p class="sf-after">key อยู่ระหว่าง <code>exports/</code> และ <code>/hostfile.txt</code></p>
</li>
<li>
<p>คลิก <strong>Save</strong> แล้ว <strong>Apply</strong> router ดาวน์โหลด list ใหม่อีกครั้ง รอ 1 ถึง 2 นาที</p>
</li>
<li>คลิก <strong>Services</strong>, <strong>Unbound DNS</strong>, <strong>Log File</strong> ค้นหา <code>download</code> และติ๊ก <strong>Informational</strong> ในช่อง severity คุณควรเห็น &#8220;blocklist download:&#8221; และจำนวนบรรทัดสำหรับที่อยู่ ThreatFox ถ้าบรรทัดบอก &#8220;unable to download&#8221; ให้ตรวจ key และที่อยู่ว่ามีช่องว่างหลงอยู่หรือไม่</li>
<li>อย่าแชร์หน้าจอนั้น บรรทัดนั้นแสดงที่อยู่พร้อม key ของคุณ</li>
</ol>
</details>
<details>
<summary>เจาะลึก: Badware Hoster และ list 2 รายการที่เพิ่มด้วย URL</summary>
<p>Badware Hoster เป็น list เดี่ยวของ Hagezi และ 966 จาก 1,088 รายการของมันอยู่ใน Pro++ แล้ว ส่วนที่เหลือบล็อกผู้ให้บริการ hosting ทั้งรายที่โผล่ใน threat feed ซ้ำ ๆ Hagezi เตือนว่าเว็บไซต์ที่ถูกต้องบน host เหล่านั้นถูกบล็อกไปด้วย และปล่อยให้ผู้ที่รัน list เป็นคนปลดบล็อกเอง</p>
<p>list 2 รายการที่เพิ่มด้วย URL เป็นของ Hagezi ในรูปแบบ wildcard:</p>
<div class="sf-box" data-mode="file" data-where="ที่อยู่ list ของ Hagezi 2 รายการ" data-how="1 ที่อยู่ต่อบรรทัด แสดงไว้เพื่ออ้างอิง ไม่มีอะไรต้องรัน"><pre><code>https://cdn.jsdelivr.net/gh/hagezi/dns-blocklists@latest/wildcard/doh.txt
https://cdn.jsdelivr.net/gh/hagezi/dns-blocklists@latest/wildcard/native.lgwebos.txt</code></pre></div>
<p>list แรกระบุเซิร์ฟเวอร์ encrypted-DNS ตามชื่อ เป็นส่วนหนึ่งของการกันไม่ให้อุปกรณ์เลี่ยง router list ที่สองระบุเซิร์ฟเวอร์โฆษณาและ tracking ของ LG webOS แต่ละรายการมีเรื่องของตัวเอง สำหรับโพสต์แยกต่างหาก</p>
<p>tick-box ของ Hagezi ในตัวของ OPNsense 26.7 ดาวน์โหลดจาก mirror ของ Hagezi <code>hagezi-mirror.dnsbunker.org</code> ตามที่ log แสดง Hagezi บอกว่า mirror นั้นเผยแพร่ build ใหม่ราวทุก 4 ถึง 8 ชั่วโมง สำเนาจาก jsDelivr อัปเดตวันละครั้ง</p>
</details>
<h3>สิ่งที่ DNS บล็อกไม่ได้</h3>
<p>โฆษณาในแอป YouTube และ Instagram มาจากโดเมนเดียวกับวิดีโอและโพสต์ การบล็อกด้วยชื่อจึงบล็อกเนื้อหาไปด้วย FAQ ของ Hagezi กล่าวประเด็นทั่วไปไว้ว่า โฆษณาบางส่วนโหลดจากโดเมนเดียวกับเนื้อหา และ content blocker ใน browser หรือ blocker ระดับแอปบนโทรศัพท์คือชั้นที่จับมันได้ ผมยอมให้โฆษณาในแอปผ่านเข้ามา</p>
<p>นอกจากนี้ DNS blocklist กรองเฉพาะอุปกรณ์ที่ถาม router อุปกรณ์ที่มี DNS แบบเข้ารหัสหรือ hard-coded ของตัวเองจะเลี่ยงมันไป นั่นเป็นอีกโพสต์หนึ่ง</p>
<h3>งานนี้ทำอย่างไร</h3>
<p>Claude อ่านเอกสารและ list เปรียบเทียบกัน และอ่าน router ของผมผ่าน session ใน browser ที่ผมล็อกอินไว้ ได้แก่การตั้งค่า resolver log และ tester ผมตัดสินว่าจะเปลี่ยนอะไร ใน session เรื่อง allowlist การเปลี่ยนแปลงเดียวบน router คือการเขียน allowlist ใหม่</p>
<p>โมเดลผิดพลาดหลายเรื่อง การแก้ allowlist ด้วยชื่อเปล่ามาจาก session แรก และใน session หนึ่งมันยังบอกผมว่าการอัปเดต blocklist ตอนกลางคืนล้าง cache ของ Unbound log ของ router แสดงว่าการอัปเดตโหลด list เข้า Unbound ที่กำลังรันอยู่ โดยไม่ restart คู่มือบอกว่าการ apply การตั้งค่า blocklist ไม่ restart Unbound และ source โหลด list ใหม่เข้า process ที่กำลังรันอยู่ การตั้งค่า flush มีผลเฉพาะตอนที่ Unbound หยุด</p>
<p>โมเดลที่มี session ล็อกอินบน router เป็นความเสี่ยงในตัวมันเอง resolver log ที่มันอ่านมีชื่อที่เว็บไซต์ใดก็ทำให้อุปกรณ์ lookup ได้ และชื่อหนึ่งอาจมีข้อความที่เขียนขึ้นเพื่อชักนำโมเดล ใน session เรื่อง allowlist ผมให้มันอ่านอย่างเดียว นอกจากการเปลี่ยน allowlist นั่นเป็นคำสั่งถึงโมเดล ไม่ใช่การควบคุม ผู้ใช้ OPNsense แบบอ่านอย่างเดียวจะเป็นการควบคุม resolver log ยังมีที่อยู่ ThreatFox พร้อม key ดังนั้น session ที่อ่าน log จะเห็น key ถ้าคุณให้โมเดลอ่าน log นั้น ให้เปลี่ยน key ภายหลัง</p>
<p>ใน session แรก ผมยังเปลี่ยนการตั้งค่า Unbound 5 อย่างและ cron job 1 งาน router แสดงว่าทั้ง 6 อย่างตั้งค่าไว้</p>
<details>
<summary>เจาะลึก: แต่ละการตั้งค่า และวิธีย้อน DNS over TLS</summary>
<table>
<thead>
<tr>
<th>การตั้งค่า (หน้า)</th>
<th>ก่อน</th>
<th>หลัง</th>
</tr>
</thead>
<tbody>
<tr>
<td>Flush DNS Cache during reload (General)</td>
<td>เปิด</td>
<td>ปิด</td>
</tr>
<tr>
<td>Prefetch Support (Advanced)</td>
<td>ปิด</td>
<td>เปิด</td>
</tr>
<tr>
<td>Serve Expired Responses (Advanced)</td>
<td>ปิด</td>
<td>เปิด; TTL for Expired Responses 86,400 s</td>
</tr>
<tr>
<td>Use System Nameservers (Query Forwarding)</td>
<td>เปิด</td>
<td>ปิด</td>
</tr>
<tr>
<td>DNS over TLS forwarders</td>
<td>ไม่มี</td>
<td>Cloudflare และ Quad9</td>
</tr>
<tr>
<td>งานอัปเดต blocklist (System → Settings → Cron)</td>
<td>ช่วงเวลาที่ใช้ร่วมกับงานอื่น</td>
<td>ช่วงเวลาของตัวเอง</td>
</tr>
</tbody>
</table>
<p><strong>Prefetch</strong> รีเฟรชรายการยอดนิยมก่อนที่มันจะหมดอายุ คู่มือระบุต้นทุนไว้ที่ DNS traffic เพิ่มขึ้นประมาณร้อยละ 10</p>
<p><strong>Serve Expired Responses</strong> ตอบจาก cache ด้วย record ที่หมดอายุแล้ว แทนที่จะให้อุปกรณ์รอ เมื่อเปิด จะมีช่องเพิ่มขึ้น ช่อง &#8220;TTL for Expired Responses&#8221; จำกัดว่าหลังหมดอายุนานเท่าใดจึงยังให้คำตอบเก่าได้ ผมตั้ง 86,400 วินาที ซึ่งเป็นขอบล่างของช่วง 86,400 ถึง 259,200 ที่คู่มือแนะนำ</p>
<p>ผลร่วมกันของสองการตั้งค่าที่ผมไม่ได้ทดสอบ เมื่อปิดการ flush cache และอนุญาตคำตอบที่เก่า ชื่อที่ list เพิ่งบล็อกอาจยังถูกตอบจาก cache ของ Unbound ต่อไปอีกระยะหนึ่ง ถ้าการบล็อกไม่มีผลทันที นั่นคือสิ่งแรกที่ผมจะดู</p>
<p><strong>Use System Nameservers</strong> คู่มือบอกว่า system nameserver ถูกเลือกก่อนรายการ catch-all ใด ๆ ใน Query Forwarding และ DNS over TLS การปิดมันทำให้รายการ DNS over TLS รับ query ไปแทน รายการทั้ง 4 ใต้ Services → Unbound DNS → DNS over TLS:</p>
<table>
<thead>
<tr>
<th>Server IP</th>
<th>Port</th>
<th>Verify CN</th>
</tr>
</thead>
<tbody>
<tr>
<td>1.1.1.1</td>
<td>853</td>
<td>cloudflare-dns.com</td>
</tr>
<tr>
<td>1.0.0.1</td>
<td>853</td>
<td>cloudflare-dns.com</td>
</tr>
<tr>
<td>9.9.9.9</td>
<td>853</td>
<td>dns.quad9.net</td>
</tr>
<tr>
<td>149.112.112.112</td>
<td>853</td>
<td>dns.quad9.net</td>
</tr>
</tbody>
</table>
<p>query ที่ router ส่งไปยังเซิร์ฟเวอร์เหล่านี้ออกไปแบบเข้ารหัส firewall rule ที่ปฏิเสธ port 853 จาก LAN เพื่อกันไม่ให้อุปกรณ์ใช้ DNS แบบเข้ารหัสของตัวเอง ไม่กระทบมัน เพราะมันออกจากตัว router เอง</p>
<p><strong>เวลาอัปเดต</strong> ถูกย้ายไปอยู่ในช่วงเวลาของตัวเอง เพื่อให้การอัปเดตไม่ใช้เวลาเดียวกับงานตามกำหนดอื่นอีก</p>
<p>หากต้องการย้อนการเปลี่ยนแปลง DNS over TLS:</p>
<p><strong>ก่อนเริ่ม</strong> ขั้นตอนนี้เปลี่ยนการตั้งค่า DNS ของ router และใช้เวลา 5 นาที DNS ยังทำงานผ่านการตั้งค่าที่เหลืออยู่ จดรายการทั้ง 4 ไว้ก่อน (ตารางด้านบน) คุณต้องใช้มันเพื่อใส่การเปลี่ยนแปลงกลับคืน</p>
<ol>
<li>เปิดหน้าตั้งค่าของ router แล้ว sign in คุณควรเห็นหน้า Lobby</li>
<li>คลิก <strong>Services</strong> แล้ว <strong>Unbound DNS</strong> แล้ว <strong>DNS over TLS</strong> ตารางแสดงรายการ</li>
<li>ที่ปลายด้านขวาของแถวแรก คลิกไอคอนดินสอ (Edit) หน้าต่างชื่อ <strong>Edit server</strong> เปิดขึ้น เอาเครื่องหมายติ๊กออกจาก <strong>Enabled</strong> แล้วคลิก <strong>Save</strong> ทำเช่นเดียวกันกับแถวอื่นทุกแถว</li>
<li>ที่ด้านบนของหน้าเดียวกัน ติ๊ก <strong>Use System Nameservers</strong> ช่องเดียวกันนี้ปรากฏใต้ <strong>Query Forwarding</strong> ด้วย มันเป็นการตั้งค่าเดียว</li>
<li>คลิก <strong>Apply</strong> ที่ด้านล่างของหน้า Unbound โหลดใหม่ภายในไม่กี่วินาที</li>
<li>ตรวจ จากอุปกรณ์ในเครือข่าย เปิดเว็บไซต์ใดก็ได้ที่คุณยังไม่ได้เข้าวันนี้ มันควรโหลดได้ ถ้าใน System → Settings → General ไม่มี nameserver เลย Unbound จะ resolve จาก root server เองแทนที่จะ forward ถ้าต้องการให้ใช้เซิร์ฟเวอร์ของผู้ให้บริการของคุณ ให้เพิ่มไว้ที่นั่น</li>
<li>เพื่อใส่การเปลี่ยนแปลงกลับ ให้ติ๊ก <strong>Enabled</strong> ที่แต่ละรายการอีกครั้ง เอาเครื่องหมายติ๊กออกจาก <strong>Use System Nameservers</strong> และคลิก <strong>Apply</strong></li>
</ol>
</details>
<h3>แหล่งที่มา</h3>
<ul>
<li><a href="https://github.com/hagezi/dns-blocklists">Hagezi, dns-blocklists README</a>, <a href="https://github.com/hagezi/dns-blocklists/blob/main/CHEATSHEET.md">cheat sheet</a> และ <a href="https://github.com/hagezi/dns-blocklists/blob/main/FAQ.md">FAQ</a></li>
<li><a href="https://docs.opnsense.org/manual/unbound.html">คู่มือ OPNsense, Unbound DNS</a></li>
<li><a href="https://github.com/opnsense/core/tree/26.7.7">source code แกนหลักของ OPNsense, tag 26.7.7</a> เทียบกับ tag 26.7 ล่าสุด</li>
<li><a href="https://github.com/opnsense/core/issues/11091">OPNsense core, issue 11091: blocklist ThreatFox ล้มเหลวด้วย HTTP 410 ต้องรองรับ Auth-Key</a></li>
<li><a href="https://threatfox.abuse.ch/export/">abuse.ch ThreatFox, หน้า export</a></li>
<li><a href="https://auth.abuse.ch">พอร์ทัลยืนยันตัวตนของ abuse.ch</a></li>
</ul>
</div>
</div>
</div>
<p>The post <a href="https://techblog.viveksanghi.com/2026/11/opnsense-allowlist-regex-hagezi-blocklists/">The fix that let phishing names through</a> appeared first on <a href="https://techblog.viveksanghi.com">Stubborn Fanatic - Tech Blog</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://techblog.viveksanghi.com/2026/11/opnsense-allowlist-regex-hagezi-blocklists/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">305</post-id>	</item>
		<item>
		<title>Tailscale’s default policy allows root SSH. Tailworm made me read it.</title>
		<link>https://techblog.viveksanghi.com/2026/11/tailworm-tailscale-default-policy/</link>
					<comments>https://techblog.viveksanghi.com/2026/11/tailworm-tailscale-default-policy/#respond</comments>
		
		<dc:creator><![CDATA[Vivek Sanghi]]></dc:creator>
		<pubDate>Mon, 16 Nov 2026 10:30:00 +0000</pubDate>
				<category><![CDATA[home network]]></category>
		<category><![CDATA[sysadmin]]></category>
		<category><![CDATA[ai assisted]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[opnsense]]></category>
		<category><![CDATA[security]]></category>
		<category><![CDATA[self-hosting]]></category>
		<category><![CDATA[stubborn fanatic]]></category>
		<category><![CDATA[tailscale]]></category>
		<category><![CDATA[tailworm]]></category>
		<guid isPermaLink="false">https://techblog.viveksanghi.com/?p=298</guid>

					<description><![CDATA[<p>Tailscale fixed the Tailworm SSH flaws in 1.104.4. Checking my own tailnet against the report, I found something the patch does not change: the default policy allows a root SSH session on your own devices. What the attack needs, what I changed, and a five-minute check for yours, with copy-ready commands.</p>
<p>The post <a href="https://techblog.viveksanghi.com/2026/11/tailworm-tailscale-default-policy/">Tailscale&#8217;s default policy allows root SSH. Tailworm made me read it.</a> appeared first on <a href="https://techblog.viveksanghi.com">Stubborn Fanatic - Tech Blog</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<style>
.tw-wrap { max-width: 720px; margin: 1.5em auto 2em; line-height: 1.75; }
.tw-wrap p { margin: 0 0 1.1em; }
.tw-wrap h2 { margin: 1.9em 0 .6em; font-size: 1.35em; font-weight: 600; line-height: 1.3; }
.tw-wrap h3 { margin: 1.6em 0 .5em; font-size: 1.12em; font-weight: 600; }
.tw-wrap ul, .tw-wrap ol { margin: 0 0 1.1em 1.3em; padding: 0; }
.tw-wrap li { margin: 0 0 .7em; }
.tw-wrap a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.tw-wrap code { font-family: Consolas, "SFMono-Regular", Menlo, "DejaVu Sans Mono", monospace; font-size: .9em; font-variant-ligatures: none; }
.tw-wrap pre { margin: 0 0 1.4em; padding: .9em 1.1em; overflow-x: auto; border-left: 3px solid currentColor;
  background: rgba(127,127,127,.12); font-size: .85em; line-height: 1.5; white-space: pre; }
.tw-wrap pre code { font-size: 1em; }
.tw-wrap .sf-box pre { border-left: 0; background: none; }
.tw-box { margin: 0 0 1.6em; padding: 1em 1.2em; border: 1px solid currentColor; border-left-width: 4px; border-radius: 4px; }
.tw-box p:last-child { margin-bottom: 0; }
.tw-tablewrap { overflow-x: auto; margin: 0 0 1.4em; }
.tw-wrap table { border-collapse: collapse; width: 100%; font-size: .92em; }
.tw-wrap th, .tw-wrap td { border: 1px solid rgba(127,127,127,.45); padding: .5em .65em; vertical-align: top; text-align: left; }
.tw-wrap th { background: rgba(127,127,127,.12); }
.tw-wrap details { margin: 0 0 1.4em; padding: .2em 1em; border: 1px dashed rgba(127,127,127,.7); border-radius: 4px; }
.tw-wrap details.sf-legend { border-style: solid; border-color: #7a9cc6; }
.tw-wrap details[open] { padding-bottom: .6em; }
.tw-wrap summary { cursor: pointer; font-weight: 600; padding: .55em 0; }
.tw-wrap summary::marker { content: "▸  "; }
.tw-wrap details[open] > summary::marker { content: "▾  "; }
.tw-read { font-size: .85em; opacity: .75; margin: 0 0 1.2em; }
.tw-wrap p, .tw-wrap li, .tw-wrap td { overflow-wrap: anywhere; }

@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+Devanagari:wght@400;600&family=Noto+Sans+Telugu:wght@400;600&family=Noto+Sans+Thai:wght@400;600&display=swap');
.tw-wrap [lang="hi"] { font-family: "Noto Sans Devanagari", sans-serif; }
.tw-wrap [lang="te"] { font-family: "Noto Sans Telugu", sans-serif; line-height: 1.9; }
.tw-wrap [lang="th"] { font-family: "Noto Sans Thai", sans-serif; line-height: 1.9; }
.tw-wrap [lang] code, .tw-wrap [lang] pre { font-family: Consolas, "SFMono-Regular", Menlo, "DejaVu Sans Mono", monospace; }
.tw-note { font-size: .85em; opacity: .8; }
.tw-tabs { display: flex; flex-wrap: wrap; gap: .4em 1.6em; margin: 0 0 1.2em; border-bottom: 1px solid currentColor; }
.tw-tabs label { cursor: pointer; padding: .4em 0; font-weight: 600; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tw-tabs label[lang="hi"] { font-family: "Noto Sans Devanagari", sans-serif; }
.tw-tabs label[lang="te"] { font-family: "Noto Sans Telugu", sans-serif; }
.tw-tabs label[lang="th"] { font-family: "Noto Sans Thai", sans-serif; }
input[name="tw-lang"] { position: absolute; opacity: 0; pointer-events: none; }
input[name="tw-lang"]:focus-visible ~ .tw-tabs { outline: 2px solid currentColor; outline-offset: 4px; }
.tw-panel { display: none; }
#tw-en:checked ~ .tw-tabs label[for="tw-en"] { border-bottom-color: currentColor; }
#tw-en:checked ~ .tw-content #tw-panel-en { display: block; }
#tw-hi:checked ~ .tw-tabs label[for="tw-hi"] { border-bottom-color: currentColor; }
#tw-hi:checked ~ .tw-content #tw-panel-hi { display: block; }
#tw-te:checked ~ .tw-tabs label[for="tw-te"] { border-bottom-color: currentColor; }
#tw-te:checked ~ .tw-content #tw-panel-te { display: block; }
#tw-th:checked ~ .tw-tabs label[for="tw-th"] { border-bottom-color: currentColor; }
#tw-th:checked ~ .tw-content #tw-panel-th { display: block; }</style>
<div class="tw-wrap">
<input type="radio" name="tw-lang" id="tw-en" checked>
<input type="radio" name="tw-lang" id="tw-hi">
<input type="radio" name="tw-lang" id="tw-te">
<input type="radio" name="tw-lang" id="tw-th">
<div class="tw-tabs" role="group" aria-label="Language">
<label for="tw-en" lang="en">English</label>
<label for="tw-hi" lang="hi">हिन्दी</label>
<label for="tw-te" lang="te">తెలుగు</label>
<label for="tw-th" lang="th">ไทย</label>
</div>
<div class="tw-content">
<div id="tw-panel-en" class="tw-panel" lang="en">
<p class="tw-read">11 min read</p>
<div class="tw-box">
<p><strong>Are you affected?</strong> Tailworm&#8217;s SSH findings only matter on a device that runs Tailscale SSH, and a device runs it only if someone turned it on, with <code>tailscale set --ssh</code> or with a switch in an app that wraps it. Windows, iPhone, Android, the Mac app and Synology and QNAP devices cannot run it. Tailscale&#8217;s documentation lists the server for Linux and, in the open-source command-line build, for macOS; the source code also builds it for FreeBSD and OpenBSD. Some NAS and router software has a switch for it: the admin console&#8217;s Machines page shows which devices report running it (step 2 of the check). Version 1.104.4 or later fixes the vulnerabilities Tailscale&#8217;s own post describes; some of the report&#8217;s eleven findings concern headscale or unreleased code. If a device runs the server, update that device.</p>
<p><strong>Separately:</strong> if you have never edited your Tailscale access controls, the default policy lets you open a Tailscale SSH session <strong>as root</strong> (the administrator account) on any of your own devices that runs the server, after signing in again in a browser. Anyone who takes over one of your untagged devices (a tag is a label such as <code>tag:server</code>; most home devices have none) may be able to do the same; the default rule does not cover tagged devices. If no device runs the server, the rule has nothing to act on today; this is housekeeping, not an emergency. Deleting the <code>ssh</code> section closes it. The <a href="#five-minute-check">five-minute check</a> below shows how, in a safe order.</p>
</div>
<p>The access policy Tailscale wrote when I created my tailnet (my Tailscale network) allowed a root SSH session on my own devices. I had never opened it. Claude, an AI model, pointed it out in its review of my first draft of this post, while we checked my network against Tailworm.</p>
<p>Tailworm is a report published over the weekend of 24 October 2026: eleven findings across Tailscale and headscale, the most serious in Tailscale&#8217;s built-in SSH server. In the researcher&#8217;s lab, an attacker who controlled one device became root on other machines that ran Tailscale SSH under a rule allowing that device in. Tailscale had not released a fix when the report appeared.</p>
<p>Below is a five-minute check for your own tailnet. What the attack needs, and what I found, follow it.</p>
<details class="sf-legend"><summary><strong>New to the command line? How to read the boxes</strong></summary>
<p><strong>PS&gt;</strong> means: type this in <em>PowerShell</em> on Windows (Start menu → type <code>powershell</code> → Enter). <strong>$</strong> means: type this in a terminal on Linux or a Mac, or on a remote machine after you have logged in with <code>ssh</code> (a command that logs you in to another machine). Do not type the <strong>$</strong> or <strong>PS&gt;</strong> itself.</p>
<p>Each line that starts with <strong>$</strong> or <strong>PS&gt;</strong> is one command. Click that <strong>$</strong> to copy just that line, paste it, press <strong>Enter</strong>, and wait for it to finish before the next. A box with a <strong>Copy</strong> button at the top holds one command (or one file), so copy it whole. A dashed box shows what you should see back; you do not type it.</p>
</details>

<h2 id="five-minute-check">A five-minute check for your own tailnet</h2>

<p><strong>Before you start</strong></p>
<ul>
<li><strong>You need:</strong> a computer (the steps are awkward on a phone), a browser and a sign-in to your tailnet with the Owner or Admin role (a Network admin cannot remove devices; an IT admin cannot edit the policy).</li>
<li><strong>How long, and how to undo:</strong> about five minutes for &#8220;Look&#8221;, which changes nothing. Every change to the policy starts with a saved copy of it, and every box says whether it only looks or changes something.</li>
</ul>
<h3>Look: nothing changes</h3>
<ol>
<li><strong>Open the admin console.</strong> Open a web browser, go to <code>console.tailscale.com/admin/machines</code> and sign in with the account that owns your tailnet. This only opens a page and takes about a minute. You should see a table of your devices. If you cannot open the page, your account may lack the Owner or Admin role; ask whoever has it.</li>
<li><strong>Find devices that run Tailscale SSH.</strong> Above the table, click <strong>Filters</strong>, choose <strong>Property</strong>, then <strong>Tailscale SSH</strong>. The table shrinks to the devices that report running the server. An empty table means none does. If you cannot find <strong>Filters</strong>, see Tailscale&#8217;s <a href="https://tailscale.com/docs/features/access-control/device-management/how-to/filter">page on filtering devices</a>.</li>
<li><strong>Optional: confirm on one device.</strong> The collapsed block under this list shows how, on Linux or on a Mac with the command-line build.</li>
<li><strong>Read your policy.</strong> In the console&#8217;s top menu, click <strong>Access controls</strong>. If the visual editor opens, switch to the <strong>JSON editor</strong>. Click inside the text, press Ctrl+F (Cmd+F on a Mac), type <code>"ssh"</code> and press Enter. No match means the policy has no SSH rule, and you can skip to &#8220;For everyone&#8221; below. A match that looks like the rule shown under &#8220;The policy I never wrote&#8221; below means your policy allows root sessions on your own devices; if it looks different, read its <code>"users"</code> line: <code>root</code> in it allows root sessions. If step 2 showed devices, go to &#8220;If you do use Tailscale SSH&#8221; below; if its table was empty, go to &#8220;If you do not use Tailscale SSH&#8221;.</li>
</ol>
<details>
<summary>Optional: confirm on one device (Linux, or a Mac with the command-line build)</summary>
<p>Open a terminal: on a Mac press Cmd+Space, type <code>terminal</code> and press Enter; on Linux open your terminal app, or log in to a remote machine with <code>ssh &lt;your-user&gt;@&lt;device-address&gt;</code> (<code>ssh</code> also works in PowerShell on Windows). Then run the command below. <code>grep -i runssh</code> keeps only the line that mentions <code>RunSSH</code>.</p>
<div class="sf-box" data-mode="one" data-shell="sh" data-effect="read" data-where="Terminal on the device"><pre><code>tailscale debug prefs | grep -i runssh</code></pre></div>
<p class="sf-after">It answers at once.</p>
<div class="sf-box" data-mode="output" data-where="What you should see if the server is off"><pre><code>"RunSSH": false,</code></pre></div>
<p class="sf-after"><code>true</code> means the device runs the server. If nothing is printed or the shell says <code>tailscale: command not found</code>, rely on step 2: the Mac app and Windows cannot run the server.</p>
</details>
<h2>What Tailworm needs</h2>
<p>I listed what the attack needs and checked each item against my own setup.</p>
<p>The devices on one Tailscale account form a <em>tailnet</em>, and a policy file in the admin console decides which device may reach which.</p>
<p>Tailscale SSH is an SSH server inside the Tailscale service, started on a device by <code>tailscale set --ssh</code>. The policy file, not a password or a key, decides who may log in and as which local account. According to the report, when such a session forwarded a Unix socket (a file-like channel that programs on one machine use to talk to each other), the Tailscale service did the work with root&#8217;s rights, and a gap between the check and the use of the socket got past the checks meant to limit it. A session allowed in as an ordinary user could act as root.</p>
<p>The SSH attack needs three things:</p>
<ol>
<li>A target device running Tailscale SSH.</li>
<li>A rule in the policy file that lets the attacker&#8217;s device open an SSH session on that target, with forwarding allowed.</li>
<li>An attacker who already controls a device the rule covers.</li>
</ol>
<p>Tailworm does not provide the third; the attacker brings it: a vulnerable web application, a malicious package, phishing, stolen passwords. It is not an attack from the open internet.</p>
<h2>What I found</h2>
<div class="tw-tablewrap"><table>
<thead>
<tr>
<th>What the attack needs</th>
<th>What I found</th>
<th>Where to look on yours</th>
</tr>
</thead>
<tbody>
<tr>
<td>Tailscale SSH running on the target</td>
<td>Not running on any of my devices when I checked</td>
<td>The admin console&#8217;s Machines page, filtered by property &#8220;Tailscale SSH&#8221; (step 2 of the check)</td>
</tr>
<tr>
<td>A policy rule allowing an SSH session</td>
<td>Yes: the default rule. Root or an ordinary account, on my own devices, after signing in again</td>
<td>The policy file (step 4 of the check)</td>
</tr>
<tr>
<td>A foothold on a device the rule covers</td>
<td>Possible, as on any network</td>
<td>—</td>
</tr>
<tr>
<td>The other findings</td>
<td>Apply to the features they involve: app connectors, <code>tailscale serve</code>, the relay connection every client makes and headscale (an open-source replacement for Tailscale&#8217;s hosted control server)</td>
<td>The admin console</td>
</tr>
</tbody>
</table></div>
<p>So the first thing the attack needs was missing. The second, a rule allowing a session, was in place by default. Tailscale&#8217;s documentation does not say whether the default rule allows forwarding, which the socket attack needs.</p>
<details>
<summary>Deep dive: other ways to check each item</summary>
<ul>
<li><strong>If you run OPNsense.</strong> The Tailscale plugin keeps its settings behind an API. The read-only call <code>GET /api/tailscale/settings/get</code> returns <code>"enableSSH":"0"</code> when the SSH server is off. Tailscale&#8217;s documentation lists the SSH server for Linux and macOS only, but its source code builds it for FreeBSD and OpenBSD too, and the OPNsense plugin has a switch for it.</li>
<li><strong>Every device.</strong> In the admin console: Machines → Filters → Property → Tailscale SSH. If no device matches, none reports running the server.</li>
<li><strong>A Linux device, from the inside.</strong> The <code>--ssh</code> switch sets a preference called <code>RunSSH</code>. <code>tailscale debug prefs | grep -i runssh</code> shows <code>"RunSSH": false</code> when the server is off. <code>tailscale set --ssh=false</code> turns it off.</li>
<li><strong>Versions.</strong> The report tested 1.104.2 and says nothing about earlier versions. Tailscale&#8217;s fix is in 1.104.4.</li>
</ul>
</details>
<details>
<summary>Deep dive: what the report found, and what Tailscale said</summary>
<ul>
<li><strong>What was tested.</strong> Tailscale 1.104.2 and headscale 0.29.5 (an open-source replacement for Tailscale&#8217;s hosted control server), unmodified, in a lab, from 22 to 24 October 2026.</li>
<li><strong>Findings 1 to 3, SSH socket forwarding.</strong> Local and remote forwarding of Unix sockets (<code>ssh -L</code> and <code>ssh -R</code>) were carried out by the root-run Tailscale service. A path check was made at one moment and the socket used at another, and a fast loop inside the session won the gap. In the lab this gave root through the Docker socket, replaced root-owned sockets with the attacker&#8217;s own, and captured a key used to enrol new devices, which then joined an attacker&#8217;s machine to the network. The report showed that last step end to end only with Tailnet Lock off. With Tailnet Lock on, it captured the material needed to disable the lock but did not use it.</li>
<li><strong>Finding 5, SSH memory exhaustion.</strong> A logged-in session could make the root-run Tailscale service keep allocating memory.</li>
<li><strong>What Tailscale said.</strong> It said the issues &#8220;require urgent attention&#8221; and that the SSH vulnerabilities &#8220;primarily concerned how permissions were enforced&#8221; after a connection had been authorized; it disputes that the issues amount to a worm and calls this lateral movement limited to connections the policy already allows.</li>
<li><strong>Wormability.</strong> In the lab, one compromised device reached every device the policy allowed, in under a second per step. The report names one control that stopped the spread: rules written as one source to one destination. Keys held in hardware (a TPM or Secure Enclave) stopped a stolen device identity from lasting.</li>
<li><strong>Among the other findings.</strong> An app-connector design that does not check where traffic is going (Tailscale says this version, Conn25, has not been released); <code>tailscale serve</code> forwarding to the service&#8217;s own control socket; memory exhaustion in the relay client (I found no bulletin for it); and denial of service against headscale.</li>
<li><strong>The bulletins.</strong> Tailscale published four, dated 26 October, all fixed in 1.104.4: TS-2026-014 (SSH socket forwarding; Tailscale now forwards as the logged-in user, not as root), TS-2026-015 (SSH memory exhaustion), TS-2026-016 (<code>tailscale serve</code> reaching privileged sockets) and TS-2026-017 (Serve over HTTP/2 could pass one mount&#8217;s <code>Tailscale-App-Capabilities</code> values to another mount on the same node). Until a device is updated, Tailscale&#8217;s mitigation for the forwarding flaw is <code>TS_SSH_DISABLE_FORWARDING=1</code> in the Tailscale service&#8217;s environment; the stopgap under &#8220;Then change what you found&#8221; shows how.</li>
<li><strong>Earlier fixes in the same area.</strong> The bulletins of June and July already covered SSH socket forwarding that did not respect symlink permissions (TS-2026-004, 3 June) and a way round <code>autogroup:nonroot</code> (TS-2026-009, 13 July), both fixed in 1.98.9.</li>
<li><strong>Forwarding and the default rule.</strong> Tailscale&#8217;s SSH server forwards only when the matched rule carries a forwarding permission from Tailscale&#8217;s coordination server (<code>allowLocalPortForwarding</code> and <code>allowRemotePortForwarding</code> in the source code). Tailscale&#8217;s public documentation does not say how a policy grants that or whether the default rule does. The report says to set per-rule forwarding fields to false on Tailscale&#8217;s hosted service but does not name them; I could not find them in Tailscale&#8217;s policy documentation. Bulletin TS-2026-014 says the issue affects users who &#8220;allow local or remote forwarding in their access policies&#8221;.</li>
<li><strong>Disclosure.</strong> Tailscale says it received the report on the morning of Saturday 24 October and the report was published two hours later; it was already investigating related issues. The Hacker News reported that the researcher described it as &#8220;reported but not coordinated&#8221;.</li>
</ul>
</details>
<h2>The policy I never wrote</h2>
<p>When you create a tailnet, Tailscale gives it a default policy. Its documentation describes it: every device may reach every other device on every port (I call this allow-all below), and every user may open a Tailscale SSH session on their own devices, in check mode, as root or as an ordinary user. The SSH part looks like this:</p>
<div class="sf-box" data-mode="output" data-where="The default ssh rule, as it appears in the policy file"><pre><code>"ssh": [
  {
    "action": "check",
    "src":    ["autogroup:member"],
    "dst":    ["autogroup:self"],
    "users":  ["autogroup:nonroot", "root"]
  }
]</code></pre></div>
<p>Any user of the tailnet (<code>autogroup:member</code>) may connect to the devices that user owns (<code>autogroup:self</code>; tagged devices are not included), as any local account except root (<code>autogroup:nonroot</code>), or as root. Mine had this rule, and allow-all with it. Tailscale&#8217;s policy-file page describes the default <code>ssh</code> rule with <code>autogroup:nonroot</code> and does not mention root; its SSH page and its example policies include root, as shown above.</p>
<p>The rule cannot tell me apart from someone who has taken over one of my devices. To Tailscale, a connection from one of my devices is me. If a Linux device on the tailnet ran <code>tailscale set --ssh</code>, someone who had taken over another of my devices could open a root session on it. That is the rule working as designed, not a flaw. Check mode asks for a browser sign-in of mine, and one approval can stay in force for 12 hours (see below).</p>
<p>Check mode asks for a fresh sign-in in the browser before the session starts. With the default check period, Tailscale&#8217;s documentation says one check-mode sign-in lets you reach that device and any other device in the tailnet for 12 hours without signing in again. It does not say whether that also covers a session opened from a different device. The report describes how an attacker on a device can wait for your next approval or prompt you for one, so check mode slows this down and does not stop it.</p>
<p>Tailworm needed socket forwarding to turn an ordinary account into root. The default rule needed none, only a check-mode approval. That is documented behaviour, not a vulnerability. Updating to 1.104.4 does not change it either: a session allowed in as root is root by design.</p>
<h2>What I changed</h2>
<p><strong>The policy.</strong> The new one has no <code>ssh</code> section. Tailscale&#8217;s documentation says that removing the SSH rules disables Tailscale SSH across the tailnet. Grants can replace allow-all with only what is needed, for example:</p>
<ol>
<li>Exit nodes, if you use them: access to <code>autogroup:internet</code>.</li>
<li>The few devices you must manage, and nothing more. Keep this grant narrow: any device it covers stays reachable.</li>
</ol>
<p>Replacing allow-all has a cost: anything that relied on devices reaching each other stops, such as file sharing, a media server or a subnet route. Give each its own grant first.</p>
<p><strong>Then tests.</strong> A policy file can carry tests: statements such as &#8220;this user may reach this port&#8221; that Tailscale checks every time the file changes. It refuses the change if one fails. Tests can say what must work and what must be refused, for example that SSH, file sharing and remote desktop (ports 22, 445 and 3389) are refused on a device that does not need them.</p>
<details>
<summary>Deep dive: an example policy</summary>
<p>This is a shape, not a template. It cuts off everything except exit nodes; pasted as it is, it would cut you off from your own NAS or media server. Addresses and the e-mail are placeholders.</p>
<div class="sf-box" data-mode="file" data-where="Example policy for the JSON editor" data-how="an example: adapt it before you paste it"><pre><code>{
  "grants": [
    // 1. Use exit nodes.
    {"src": ["autogroup:member"], "dst": ["autogroup:internet"], "ip": ["*"]},

    // 2. Add a grant for each device you must reach, and no more.

    // Nothing else: other devices accept no inbound tailnet traffic.
  ],

  // An empty "acls" list: Tailscale's documentation gives this form for deny-all;
  // omitting the section is documented as allow-all.
  "acls": [],

  // No "ssh" section: no Tailscale SSH session is allowed anywhere.

  "tests": [
    {
      "src":    "you@example.com",
      // "accept": ["100.x.y.2:445"],  one line like this for each thing that must work.
      "deny":   ["100.x.y.3:22", "100.x.y.3:445", "100.x.y.3:3389"], // a device that must refuse these
    },
  ],
}</code></pre></div>
<p>A grant for a NAS that should serve file shares to the users of your tailnet, and nothing else, would look like this (the port is an example, and you add one <code>tcp:</code> entry for each other service it must serve; <code>nas</code> is a name you define in the policy&#8217;s <code>hosts</code> section, for example <code>"hosts": {"nas": "100.x.y.2"}</code>):</p>
<div class="sf-box" data-mode="file" data-where="Example grant for a NAS" data-how="an example: adapt it before you paste it"><pre><code>{"src": ["autogroup:member"], "dst": ["nas"], "ip": ["tcp:445"]},</code></pre></div>
<p>Notes:</p>
<ul>
<li>Only devices with access to <code>autogroup:internet</code> can use exit nodes, which is why grant 1 is written that way.</li>
<li>Tests check the rules, not the network: a passing test does not prove that a device answers.</li>
<li><strong>Why <code>"acls": []</code> stays.</strong> Tailscale&#8217;s documentation says that omitting the <code>acls</code> section is equivalent to the default allow-all policy, and its deny-all example is <code>"acls": []</code>. It does not say what omission means in a policy that has grants. Keep the empty list and let tests decide: a deny test for a port that allow-all would open fails while allow-all is in force.</li>
<li>Keep a copy of the old policy before saving (step 1 of &#8220;If you do not use Tailscale SSH: switch it off everywhere&#8221; below does this). Tailscale also lets you revert a change from the Configuration logs page.</li>
</ul>
</details>
<details>
<summary>Deep dive: the method I would use again</summary>
<p>List what the attack needs; check each item on your own devices and note how; look for what is wrong even where the attack does not apply; and sort the rest into what to change, what to watch and what risk to accept.</p>
</details>
<h2>Then change what you found</h2>
<h3>If you do not use Tailscale SSH: switch it off everywhere</h3>
<p><strong>Before you start:</strong> this changes your policy so that no device accepts a Tailscale SSH session. Do not do it if Tailscale SSH is your only way into some machine. It takes about three minutes. To undo it, paste the saved copy back (step 1) and save, or revert the change from the Configuration logs page.</p>
<ol>
<li><strong>Save a copy of the policy.</strong> In the <strong>JSON editor</strong> click inside the text and press Ctrl+A (Cmd+A on a Mac), then Ctrl+C (Cmd+C). Open Notepad (Start menu → type <code>notepad</code> → Enter) or TextEdit on a Mac (Format → Make Plain Text first), paste with Ctrl+V (Cmd+V), and save the file as <code>policy-backup.json</code> in your Documents folder. The file should hold the whole policy, starting with <code>{</code>.</li>
<li><strong>Delete the <code>ssh</code> section.</strong> Back in the console, select everything from <code>"ssh": [</code> down to the <code>]</code> that lines up under it (not the <code>]</code> inside the rule), with the comma after it if there is one, and press Delete. The policy file allows a spare comma. Leave the other sections as they were.</li>
<li><strong>Save.</strong> Click <strong>Save</strong>. Tailscale checks the policy, and any tests in it, before it applies the change. You should see the console confirm the save. If it reports a syntax error, a comma or bracket is out of place: paste the saved copy back and repeat from step 2. If it names an <code>sshTests</code> entry, delete that test as well.</li>
<li><strong>Check.</strong> Reload the page, press Ctrl+F (Cmd+F) and search for <code>"ssh"</code>. There should be no match. A device that opted in keeps running the server until you run <code>tailscale set --ssh=false</code> on it.</li>
</ol>
<h3>If you do use Tailscale SSH: update, then narrow the rule</h3>
<p><strong>Before you start:</strong> updating ends every open Tailscale SSH session on that device. Do not run the update from a Tailscale SSH session. Use another way in: a keyboard and screen on the machine, or an ordinary <code>ssh</code> login on your local network. An <code>ssh</code> login to the device&#8217;s Tailscale address (100.…) also drops when Tailscale restarts, and a drop mid-update can interrupt the install. The commands below are for Debian, Ubuntu and Raspberry Pi OS with Tailscale&#8217;s own package repository. For other systems, see Tailscale&#8217;s <a href="https://tailscale.com/docs/features/client/update">page on updating</a>.</p>
<ol>
<li><strong>Log in to the device by another way</strong> and open a terminal on it. You should see its shell prompt.</li>
<li><strong>See what version it runs.</strong></li>
</ol>
<div class="sf-box" data-mode="one" data-shell="sh" data-effect="read" data-where="Terminal on the device"><pre><code>tailscale version</code></pre></div>
<p class="sf-after">The first line is the version number. 1.104.4 or later has the fixes. Anything lower needs the update.</p>
<ol start="3">
<li><strong>Update.</strong> <code>sudo</code> runs a command as administrator and may ask for your password; nothing shows as you type, so type it and press Enter.</li>
</ol>
<div class="sf-box" data-mode="each" data-shell="sh" data-effect="change" data-where="Terminal on the device"><pre><code>sudo apt update
sudo apt install --only-upgrade tailscale</code></pre></div>
<p class="sf-after">Each takes under a minute. Tailscale restarts for a few seconds. If an update is cut off part-way, <code>sudo dpkg --configure -a</code> finishes it. If <code>apt</code> says tailscale is already the newest version, the device either has the fix or did not get Tailscale from Tailscale&#8217;s repository.</p>
<ol start="4">
<li><strong>Check again</strong> with <code>tailscale version</code>. The first line should read 1.104.4 or later.</li>
<li><strong>Narrow the rule.</strong> If you log in as root on some host, such as a Proxmox server, or on a host where no other account has <code>sudo</code>, this removes that access: check first. Save a copy of the policy (step 1 of &#8220;If you do not use Tailscale SSH: switch it off everywhere&#8221;) before you edit. Then in the console go to <strong>Access controls</strong>, <strong>JSON editor</strong>, find the <code>"users"</code> line of your <code>ssh</code> rule and delete <code>, "root"</code> from it:</li>
</ol>
<div class="sf-box" data-mode="output" data-where="Before"><pre><code>"users":  ["autogroup:nonroot", "root"]</code></pre></div>
<div class="sf-box" data-mode="output" data-where="After"><pre><code>"users":  ["autogroup:nonroot"]</code></pre></div>
<p class="sf-after">Click <strong>Save</strong>. The rule no longer hands out root sessions; use <code>sudo</code> after you log in. On a host where your account has passwordless <code>sudo</code>, this slows an intruder down and does not stop one. This does not replace the update: the July bulletin TS-2026-009 was a way round <code>autogroup:nonroot</code>. Also limit <code>src</code> and <code>dst</code> to the people and devices that need SSH.</p>
<details>
<summary>Stopgap: switch off SSH forwarding on a device you cannot update yet</summary>
<p>Use this only where the package source you use does not yet offer 1.104.4 or later. Tailscale&#8217;s mitigation for the forwarding flaw is the setting <code>TS_SSH_DISABLE_FORWARDING=1</code> in the Tailscale service&#8217;s environment. On Debian-style installs the service reads <code>/etc/default/tailscaled</code> (the <code>tailscaled.service</code> file in Tailscale&#8217;s source names it as <code>EnvironmentFile</code>). I tested the commands below against copies of that file, not against a running Tailscale service. The restart ends open Tailscale SSH sessions, so run these from another way in. The commands assume systemd.</p>
<ol>
<li><strong>Back up the file.</strong> If the command says <code>No such file or directory</code>, this device keeps the setting elsewhere; stop and read Tailscale&#8217;s page for your install. Run it once: a second run replaces the backup with the edited file.</li>
</ol>
<div class="sf-box" data-mode="one" data-shell="sh" data-effect="change" data-where="Terminal on the device, from another way in"><pre><code>sudo cp /etc/default/tailscaled /etc/default/tailscaled.bak</code></pre></div>
<ol start="2">
<li><strong>Add the setting.</strong> The line starts with a blank line so it cannot join the last line of the file.</li>
</ol>
<div class="sf-box" data-mode="one" data-shell="sh" data-effect="change" data-where="Terminal on the device"><pre><code>printf '\nTS_SSH_DISABLE_FORWARDING=1\n' | sudo tee -a /etc/default/tailscaled</code></pre></div>
<p class="sf-after">It prints what it added. Run it once: a second run adds the line twice.</p>
<ol start="3">
<li><strong>Restart the service.</strong></li>
</ol>
<div class="sf-box" data-mode="one" data-shell="sh" data-effect="change" data-where="Terminal on the device"><pre><code>sudo systemctl restart tailscaled</code></pre></div>
<ol start="4">
<li><strong>Check that the running service has it.</strong></li>
</ol>
<div class="sf-box" data-mode="one" data-shell="sh" data-effect="read" data-where="Terminal on the device"><pre><code>sudo cat /proc/$(systemctl show -p MainPID --value tailscaled)/environ | tr '\0' '\n' | grep TS_SSH</code></pre></div>
<div class="sf-box" data-mode="output" data-where="What you should see"><pre><code>TS_SSH_DISABLE_FORWARDING=1</code></pre></div>
<p class="sf-after">No output means the service did not pick the setting up: check that the line is in the file with <code>grep TS_SSH /etc/default/tailscaled</code>, then repeat step 3. <code>/proc/0/environ: No such file or directory</code> means the service is not running.</p>
<ol start="5">
<li><strong>To undo it,</strong> remove the line and restart. Do this too once the device runs 1.104.4 or later; the setting is a stopgap. Removing the line is safe even if a package upgrade has replaced the file since step 1; the backup stays as a record. An upgrade may ask whether to keep your edited file:</li>
</ol>
<div class="sf-box" data-mode="each" data-shell="sh" data-effect="change" data-where="Terminal on the device"><pre><code>sudo sed -i '/^TS_SSH_DISABLE_FORWARDING=1$/d' /etc/default/tailscaled
sudo systemctl restart tailscaled</code></pre></div>
<p class="sf-after">If <code>sed</code> says it cannot read the file, there is nothing to undo on this device.</p>
</details>
<h3>For everyone</h3>
<ol>
<li><strong>Remove devices you no longer look after,</strong> before they leave your hands. Do not remove a device you can reach only over Tailscale: you would need to be at the machine to add it back. In the console open <strong>Machines</strong>, find the device by name in the search bar, open the menu next to it, choose <strong>Remove</strong> and then <strong>Remove machine</strong> in the dialog. The device disappears from the list. If you remove one by mistake, sign the device in again to add it back; if your tailnet requires device approval, an admin must approve it.</li>
<li><strong>Look again at allow-all.</strong> Search <strong>Access controls</strong> for <code>"acls"</code> and <code>"grants"</code>. A rule whose source is <code>*</code> and whose destination is <code>*</code> or <code>*:*</code> is allow-all: every device may reach every other on every port. The steps to replace it follow.</li>
</ol>
<details>
<summary>Replace allow-all, step by step</summary>
<p><strong>Before you start:</strong> this changes your policy and can cut devices off from each other. Do it when you can test each service afterwards. It takes 15 to 30 minutes. To undo it, paste the saved copy of the policy back (step 1 of &#8220;If you do not use Tailscale SSH: switch it off everywhere&#8221;) and save, or revert the change from the Configuration logs page. If a phone or laptop of yours uses an exit node, test its internet access after each save: a wrong exit-node grant cuts it off.</p>
<ol>
<li><strong>Write down what your devices need from each other:</strong> file shares, a media server, a subnet route, a printer. Use paper or a text file.</li>
<li><strong>Save a copy of the policy</strong> as described above.</li>
<li><strong>Add one grant for each need</strong> in the <code>"grants"</code> section (add the section if there is none; allow-all is in <code>"acls"</code>), like the NAS example in &#8220;an example policy&#8221; earlier. Use the NAS&#8217;s Tailscale address (the Machines page shows it) in place of <code>nas</code> if you have not defined that name. Add a grant for exit nodes if you use them.</li>
<li><strong>Add tests for what must work,</strong> as in the same example. Click <strong>Save</strong>. If a test fails, Tailscale refuses the change and names the test.</li>
<li><strong>Delete the allow-all rule</strong> but keep the <code>"acls"</code> section as <code>"acls": []</code>: Tailscale&#8217;s documentation gives that form for deny-all and says omitting the section is equivalent to allow-all. Add tests for what must not work (such as ports 22, 445 and 3389 on a device that should not accept them), and click <strong>Save</strong> again. Those tests fail while allow-all is still there, which is why they come now.</li>
<li><strong>Test each service</strong> from a device that uses it. If one fails, add its grant, or paste the saved copy back.</li>
</ol>
</details>
<h2>Status</h2>
<p>Version 1.104.4 was tagged late on 27 October 2026 (UTC); Tailscale&#8217;s changelog dates it 28 October. Version 1.104.5, released on 2 November 2026, fixes Tailscale SSH connection stalls and restart hangs, and stops check-mode sessions disconnecting when an approval expires; update to the current release. On 10 November 2026 the bulletins page (TS-2026-014 to TS-2026-017, dated 26 October) showed no CVE numbers.</p>
<h2>How this was done</h2>
<p>I did the checking with Claude, Anthropic&#8217;s AI model. It drafted the replacement policy and its tests, and this post. Claude&#8217;s review of my first draft pointed out that the default rule already allows root. Claude then checked that against Tailscale&#8217;s documentation; the open-source code does not contain the default policy.</p>
<details>
<summary>Glossary</summary>
<ul>
<li><strong>Tailscale:</strong> a mesh VPN built on WireGuard, with a hosted service that handles sign-in and keys.</li>
<li><strong>Tailnet:</strong> the set of devices on one Tailscale account.</li>
<li><strong>Policy file:</strong> the tailnet&#8217;s access rules, edited in the admin console. <em>Grants</em> decide which devices may reach which; the <code>ssh</code> section decides who may open Tailscale SSH sessions; <em>tests</em> check the rules every time they change.</li>
<li><strong>Allow-all:</strong> the default <code>acls</code> rule that lets every device reach every other device on every port.</li>
<li><strong>Tag:</strong> a label such as <code>tag:server</code> that gives a device an identity of its own instead of a user&#8217;s; tagged devices are not covered by <code>autogroup:self</code>.</li>
<li><strong>autogroup:member / self / nonroot:</strong> any user of the tailnet; the devices a user owns (not tagged ones); any local account except root.</li>
<li><strong>Tailscale SSH:</strong> an SSH server built into the Tailscale service, which decides who may log in from the policy file instead of passwords or keys.</li>
<li><strong>Check mode:</strong> an <code>ssh</code> rule action that asks the user to sign in again before a session starts; one sign-in lasts 12 hours by default.</li>
<li><strong>Exit node:</strong> a device on the tailnet that other devices can send their internet traffic through.</li>
<li><strong>root:</strong> the administrator account on Linux and macOS, which can do anything on the machine.</li>
<li><strong>Subnet route:</strong> a device that lets the tailnet reach a whole local network behind it.</li>
<li><strong>Unix socket:</strong> a file-like endpoint that programs on the same machine use to talk to each other, such as Docker&#8217;s control socket.</li>
<li><strong>Port forwarding (in SSH):</strong> carrying another connection, such as one to a socket, through an SSH session.</li>
<li><strong>Tailnet Lock:</strong> a Tailscale feature that requires trusted devices to sign every new device before it can join.</li>
<li><strong>Foothold:</strong> a device an attacker already controls, from which further attacks start.</li>
<li><strong>headscale:</strong> an open-source replacement for Tailscale&#8217;s hosted control server.</li>
<li><strong>CVE:</strong> a public identifier for a specific vulnerability.</li>
<li><strong>sudo:</strong> a command prefix that runs the command as administrator; it may ask for your password.</li>
<li><strong>ssh:</strong> a command that logs you in to another machine.</li>
</ul>
</details>
<h2>Sources</h2>
<ul>
<li>Tailworm report, Cyberdione Labs (24 October 2026, the date Tailscale gives; the report itself shows only &#8220;2026-10&#8221;): <a href="https://tailworm.com/">https://tailworm.com/</a></li>
<li>Tailscale, &#8220;Tailscale SSH: Findings and fixes&#8221;, 28 October 2026: <a href="https://tailscale.com/blog/tailscale-ssh-findings-fixes">https://tailscale.com/blog/tailscale-ssh-findings-fixes</a></li>
<li>Tailscale, &#8220;Tailscale SSH: Investigation&#8221;: <a href="https://tailscale.com/ssh-investigation-update">https://tailscale.com/ssh-investigation-update</a></li>
<li>Tailscale security bulletins, TS-2026-004, TS-2026-009 and TS-2026-014 to TS-2026-017 (read again 10 November 2026): <a href="https://tailscale.com/security-bulletins">https://tailscale.com/security-bulletins</a></li>
<li>The Hacker News, &#8220;Unpatched Tailscale SSH Flaws Could Let a Hacked Device Reach Root on Other Servers&#8221;, 25 October 2026: <a href="https://thehackernews.com/2026/10/unpatched-tailscale-ssh-flaws-could-let.html">https://thehackernews.com/2026/10/unpatched-tailscale-ssh-flaws-could-let.html</a></li>
<li>Tailscale docs, Tailscale SSH (check mode, disabling): <a href="https://tailscale.com/docs/features/tailscale-ssh">https://tailscale.com/docs/features/tailscale-ssh</a></li>
<li>Tailscale docs, the default policy (&#8220;Allow all&#8221;): <a href="https://tailscale.com/docs/reference/examples/acls">https://tailscale.com/docs/reference/examples/acls</a></li>
<li>Tailscale docs, policy file syntax and tests: <a href="https://tailscale.com/docs/reference/syntax/policy-file">https://tailscale.com/docs/reference/syntax/policy-file</a></li>
<li>Tailscale docs, grants syntax: <a href="https://tailscale.com/docs/reference/syntax/grants">https://tailscale.com/docs/reference/syntax/grants</a></li>
<li>Tailscale docs, filtering devices in the admin console: <a href="https://tailscale.com/docs/features/access-control/device-management/how-to/filter">https://tailscale.com/docs/features/access-control/device-management/how-to/filter</a></li>
<li>Tailscale docs, removing a device: <a href="https://tailscale.com/docs/features/access-control/device-management/how-to/remove">https://tailscale.com/docs/features/access-control/device-management/how-to/remove</a></li>
<li>Tailscale docs, updating Tailscale: <a href="https://tailscale.com/docs/features/client/update">https://tailscale.com/docs/features/client/update</a></li>
<li>Tailscale docs, the <code>tailscaled</code> service: <a href="https://tailscale.com/docs/reference/tailscaled">https://tailscale.com/docs/reference/tailscaled</a></li>
<li>Tailscale source code (SSH server, netstack, peer API, <code>tailscaled.service</code>) and the v1.104.4 tag: <a href="https://github.com/tailscale/tailscale">https://github.com/tailscale/tailscale</a></li>
</ul>
</div>
<div id="tw-panel-hi" class="tw-panel" lang="hi">
<h2 class="tw-ptitle">Tailscale की default policy root SSH की अनुमति देती है। Tailworm ने मुझसे उसे पढ़वाया।</h2>
<p class="tw-read">पढ़ने का समय: 17 मिनट</p>
<p class="tw-note">Code, commands और technical terms अंग्रेज़ी में ही रखे गए हैं।</p>
<div class="tw-box">
<p><strong>क्या आप प्रभावित हैं?</strong> Tailworm की SSH findings सिर्फ़ उस device पर मायने रखती हैं जिस पर Tailscale SSH चलता है, और कोई device इसे तभी चलाता है जब किसी ने इसे चालू किया हो, <code>tailscale set --ssh</code> से या इसे अपने अंदर चलाने वाले किसी app के switch से। Windows, iPhone, Android, Mac app और Synology व QNAP devices इसे नहीं चला सकते। Tailscale के documentation में यह server Linux के लिए और, open-source command-line build में, macOS के लिए दर्ज है; source code इसे FreeBSD और OpenBSD के लिए भी build करता है। कुछ NAS और router software में इसके लिए एक switch होता है: admin console का Machines page दिखाता है कि कौन-से devices इसे चलाने की report देते हैं (जाँच का चरण 2)। Version 1.104.4 या उसके बाद का version उन vulnerabilities को fix करता है जिन्हें Tailscale की अपनी post बताती है; report की ग्यारह findings में से कुछ headscale या unreleased code से जुड़ी हैं। अगर किसी device पर यह server चलता है, तो उस device को update करें।</p>
<p><strong>इससे अलग:</strong> अगर आपने अपने Tailscale access controls कभी edit नहीं किए, तो default policy आपको अपने किसी भी ऐसे device पर, जिस पर यह server चलता है, browser में फिर से sign in करने के बाद <strong>root</strong> (administrator account) के रूप में Tailscale SSH session खोलने देती है। जो कोई आपके किसी untagged device पर कब्ज़ा कर ले (tag <code>tag:server</code> जैसा एक label है; ज़्यादातर घरेलू devices में कोई tag नहीं होता), वह भी शायद ऐसा कर सके; default rule tagged devices को कवर नहीं करता। अगर किसी device पर server नहीं चलता, तो आज इस rule के पास करने को कुछ नहीं है; यह रखरखाव का काम है, आपात स्थिति नहीं। <code>ssh</code> section हटाने से यह बंद हो जाता है। नीचे दी गई <a href="#five-minute-check-hi">पाँच मिनट की जाँच</a> सुरक्षित क्रम में यह करना बताती है।</p>
</div>
<p>जब मैंने अपना tailnet (मेरा Tailscale network) बनाया, तब Tailscale ने जो access policy लिखी, उसमें मेरे अपने devices पर root SSH session की अनुमति थी। मैंने उसे कभी खोला नहीं था। Claude, एक AI model, ने मेरे इस post के पहले draft की अपनी समीक्षा में इसकी ओर इशारा किया, जब हम मेरे network को Tailworm की findings से मिलाकर जाँच रहे थे।</p>
<p>Tailworm एक report है जो 24 अक्टूबर 2026 वाले weekend पर प्रकाशित हुई: Tailscale और headscale में ग्यारह findings, जिनमें सबसे गंभीर Tailscale के built-in SSH server में है। Researcher की lab में, जिस attacker के नियंत्रण में एक device था, वह उन दूसरी machines पर root बन गया जो Tailscale SSH चला रही थीं और जिन पर उस device को आने देने वाला rule मौजूद था। Report आने के समय Tailscale ने कोई fix release नहीं किया था।</p>
<p>नीचे आपके अपने tailnet के लिए पाँच मिनट की जाँच है। Attack को क्या चाहिए, और मुझे क्या मिला, यह उसके बाद आता है।</p>
<details class="sf-legend"><summary><strong>Command line में नए हैं? Boxes कैसे पढ़ें</strong></summary>
<p><strong>PS&gt;</strong> का मतलब: इसे Windows में <em>PowerShell</em> में type करें (Start menu → <code>powershell</code> type करें → Enter)। <strong>$</strong> का मतलब: इसे Linux या Mac के terminal में type करें, या किसी remote machine पर, जब आप <code>ssh</code> (दूसरी machine में login करने वाली command) से login कर चुके हों। <strong>$</strong> या <strong>PS&gt;</strong> को खुद type न करें।</p>
<p>हर वह line जो <strong>$</strong> या <strong>PS&gt;</strong> से शुरू होती है, एक command है। सिर्फ़ वह line copy करने के लिए उस <strong>$</strong> पर click करें, उसे paste करें, <strong>Enter</strong> दबाएँ, और अगली command से पहले उसके पूरा होने का इंतज़ार करें। ऊपर <strong>Copy</strong> button वाला box एक command (या एक file) रखता है, इसलिए उसे पूरा copy करें। Dashed box दिखाता है कि जवाब में आपको क्या दिखना चाहिए; उसे आप type नहीं करते।</p>
</details>

<h2 id="five-minute-check-hi">अपने tailnet के लिए पाँच मिनट की जाँच</h2>

<p><strong>शुरू करने से पहले</strong></p>
<ul>
<li><strong>आपको चाहिए:</strong> एक computer (phone पर ये चरण असुविधाजनक हैं), एक browser और आपके tailnet में Owner या Admin role वाला sign-in (Network admin devices नहीं हटा सकता; IT admin policy edit नहीं कर सकता)।</li>
<li><strong>कितना समय लगेगा, और undo कैसे करें:</strong> &#8220;देखें&#8221; में लगभग पाँच मिनट, जो कुछ नहीं बदलता। Policy में हर बदलाव उसकी सहेजी हुई copy से शुरू होता है, और हर box बताता है कि वह सिर्फ़ देखता है या कुछ बदलता है।</li>
</ul>
<h3>देखें: कुछ नहीं बदलता</h3>
<ol>
<li><strong>Admin console खोलें।</strong> Web browser खोलें, <code>console.tailscale.com/admin/machines</code> पर जाएँ और उस account से sign in करें जो आपके tailnet का मालिक है। इसमें सिर्फ़ एक page खुलता है और लगभग एक मिनट लगता है। आपको अपने devices की table दिखनी चाहिए। अगर page नहीं खुलता, तो हो सकता है आपके account के पास Owner या Admin role न हो; जिसके पास हो उससे पूछें।</li>
<li><strong>Tailscale SSH चलाने वाले devices खोजें।</strong> Table के ऊपर <strong>Filters</strong> पर click करें, <strong>Property</strong> चुनें, फिर <strong>Tailscale SSH</strong>। Table उन devices तक सिमट जाती है जो server चलाने की report देते हैं। खाली table का मतलब है कि कोई नहीं देता। अगर <strong>Filters</strong> नहीं मिलता, तो Tailscale का <a href="https://tailscale.com/docs/features/access-control/device-management/how-to/filter">devices को filter करने वाला page</a> देखें।</li>
<li><strong>वैकल्पिक: एक device पर पुष्टि करें।</strong> इस list के नीचे का collapsed block बताता है कि Linux पर, या command-line build वाले Mac पर, कैसे।</li>
<li><strong>अपनी policy पढ़ें।</strong> Console के top menu में <strong>Access controls</strong> पर click करें। अगर visual editor खुले, तो <strong>JSON editor</strong> पर switch करें। Text के अंदर click करें, Ctrl+F (Mac पर Cmd+F) दबाएँ, <code>"ssh"</code> type करें और Enter दबाएँ। कोई match नहीं मिला तो policy में कोई SSH rule नहीं है, और आप नीचे &#8220;सबके लिए&#8221; पर जा सकते हैं। नीचे &#8220;वह policy जो मैंने कभी लिखी नहीं&#8221; में दिखाए rule जैसा match मिला तो आपकी policy आपके अपने devices पर root sessions की अनुमति देती है; अगर वह अलग दिखे, तो उसकी <code>"users"</code> line पढ़ें: उसमें <code>root</code> हो तो root sessions की अनुमति है। अगर चरण 2 में devices दिखे थे, तो नीचे &#8220;अगर आप Tailscale SSH इस्तेमाल करते हैं&#8221; पर जाएँ; अगर उसकी table खाली थी, तो &#8220;अगर आप Tailscale SSH इस्तेमाल नहीं करते&#8221; पर जाएँ।</li>
</ol>
<details>
<summary>वैकल्पिक: एक device पर पुष्टि करें (Linux, या command-line build वाला Mac)</summary>
<p>Terminal खोलें: Mac पर Cmd+Space दबाएँ, <code>terminal</code> type करें और Enter दबाएँ; Linux पर अपना terminal app खोलें, या <code>ssh &lt;your-user&gt;@&lt;device-address&gt;</code> से किसी remote machine में login करें (<code>ssh</code> Windows के PowerShell में भी चलता है)। फिर नीचे की command चलाएँ। <code>grep -i runssh</code> सिर्फ़ वही line रखता है जिसमें <code>RunSSH</code> है।</p>
<div class="sf-box" data-mode="one" data-shell="sh" data-effect="read" data-effect-text="सिर्फ़ देखता है — आज़माना सुरक्षित है" data-where="Device पर Terminal" data-how="1 command — इसे paste करें, फिर Enter दबाएँ"><pre><code>tailscale debug prefs | grep -i runssh</code></pre></div>
<p class="sf-after">यह तुरंत जवाब देता है।</p>
<div class="sf-box" data-mode="output" data-where="Server बंद हो तो आपको क्या दिखना चाहिए" data-how="आप इसे type नहीं करते"><pre><code>"RunSSH": false,</code></pre></div>
<p class="sf-after"><code>true</code> का मतलब है कि device server चलाता है। अगर कुछ print नहीं होता या shell कहता है <code>tailscale: command not found</code>, तो चरण 2 पर भरोसा करें: Mac app और Windows server नहीं चला सकते।</p>
</details>
<h2>Tailworm को क्या चाहिए</h2>
<p>मैंने सूची बनाई कि attack को क्या चाहिए, और हर चीज़ को अपने setup से मिलाकर देखा।</p>
<p>एक Tailscale account के devices मिलकर एक <em>tailnet</em> बनाते हैं, और admin console में एक policy file तय करती है कि कौन-सा device किस device तक पहुँच सकता है।</p>
<p>Tailscale SSH, Tailscale service के अंदर का एक SSH server है, जो किसी device पर <code>tailscale set --ssh</code> से शुरू होता है। कौन login कर सकता है और किस local account के रूप में, यह कोई password या key नहीं, policy file तय करती है। Report के अनुसार, जब ऐसा कोई session किसी Unix socket (file जैसा एक channel, जिसे एक ही machine के programs आपस में बात करने के लिए इस्तेमाल करते हैं) को forward करता था, तो Tailscale service यह काम root के अधिकारों से करती थी, और socket की जाँच और उसके इस्तेमाल के बीच का एक अंतराल उन checks से निकल गया जो इसे सीमित करने के लिए थे। जिस session को साधारण user के रूप में आने दिया गया था, वह root की तरह काम कर सकता था।</p>
<p>SSH attack को तीन चीज़ें चाहिए:</p>
<ol>
<li>एक target device जिस पर Tailscale SSH चल रहा हो।</li>
<li>Policy file में एक rule जो attacker के device को उस target पर SSH session खोलने दे, forwarding की अनुमति के साथ।</li>
<li>एक attacker जिसके नियंत्रण में पहले से कोई ऐसा device हो जो उस rule के दायरे में आता है।</li>
</ol>
<p>तीसरी चीज़ Tailworm नहीं देता; attacker उसे खुद लाता है: कोई vulnerable web application, कोई malicious package, phishing, चोरी हुए passwords। यह खुले internet से होने वाला attack नहीं है।</p>
<h2>मुझे क्या मिला</h2>
<div class="tw-tablewrap"><table>
<thead>
<tr>
<th>Attack को क्या चाहिए</th>
<th>मुझे क्या मिला</th>
<th>आपके यहाँ कहाँ देखें</th>
</tr>
</thead>
<tbody>
<tr>
<td>Target पर Tailscale SSH चलना</td>
<td>जब मैंने जाँच की, मेरे किसी device पर नहीं चल रहा था</td>
<td>Admin console का Machines page, property &#8220;Tailscale SSH&#8221; से filter किया हुआ (जाँच का चरण 2)</td>
</tr>
<tr>
<td>SSH session की अनुमति देने वाला policy rule</td>
<td>हाँ: default rule। मेरे अपने devices पर root या साधारण account, फिर से sign in करने के बाद</td>
<td>Policy file (जाँच का चरण 4)</td>
</tr>
<tr>
<td>Rule के दायरे में आने वाले device पर foothold</td>
<td>संभव है, जैसा किसी भी network में</td>
<td>—</td>
</tr>
<tr>
<td>बाकी findings</td>
<td>उन features पर लागू होती हैं जिनसे वे जुड़ी हैं: app connectors, <code>tailscale serve</code>, वह relay connection जो हर client बनाता है, और headscale (Tailscale के hosted control server का open-source विकल्प)</td>
<td>Admin console</td>
</tr>
</tbody>
</table></div>
<p>तो attack को जिस पहली चीज़ की ज़रूरत है, वह मौजूद नहीं थी। दूसरी, session की अनुमति देने वाला rule, default रूप से मौजूद था। Tailscale का documentation नहीं बताता कि default rule forwarding की अनुमति देता है या नहीं, जो socket attack को चाहिए।</p>
<details>
<summary>विस्तार से: हर चीज़ को जाँचने के दूसरे तरीके</summary>
<ul>
<li><strong>अगर आप OPNsense चलाते हैं।</strong> Tailscale plugin अपनी settings एक API के पीछे रखता है। Read-only call <code>GET /api/tailscale/settings/get</code> SSH server बंद होने पर <code>"enableSSH":"0"</code> लौटाता है। Tailscale का documentation SSH server सिर्फ़ Linux और macOS के लिए बताता है, पर उसका source code इसे FreeBSD और OpenBSD के लिए भी build करता है, और OPNsense plugin में इसका एक switch है।</li>
<li><strong>हर device।</strong> Admin console में: Machines → Filters → Property → Tailscale SSH। अगर कोई device match नहीं करता, तो किसी device ने server चलाने की report नहीं दी।</li>
<li><strong>Linux device, अंदर से।</strong> <code>--ssh</code> switch <code>RunSSH</code> नाम की एक preference सेट करता है। <code>tailscale debug prefs | grep -i runssh</code> server बंद होने पर <code>"RunSSH": false</code> दिखाता है। <code>tailscale set --ssh=false</code> इसे बंद करता है।</li>
<li><strong>Versions।</strong> Report ने 1.104.2 को test किया और उससे पहले के versions के बारे में कुछ नहीं कहती। Tailscale का fix 1.104.4 में है।</li>
</ul>
</details>
<details>
<summary>विस्तार से: report में क्या मिला, और Tailscale ने क्या कहा</summary>
<ul>
<li><strong>क्या test हुआ।</strong> Tailscale 1.104.2 और headscale 0.29.5 (Tailscale के hosted control server का open-source विकल्प), बिना किसी बदलाव के, एक lab में, 22 से 24 अक्टूबर 2026 तक।</li>
<li><strong>Findings 1 से 3, SSH socket forwarding।</strong> Unix sockets की local और remote forwarding (<code>ssh -L</code> और <code>ssh -R</code>) root के रूप में चलने वाली Tailscale service करती थी। Path की जाँच एक क्षण पर हुई और socket दूसरे क्षण पर इस्तेमाल हुआ, और session के अंदर एक तेज़ loop उस अंतराल में race जीत गया। Lab में इससे Docker socket के ज़रिए root मिला, root के स्वामित्व वाले sockets की जगह attacker के अपने sockets रख दिए गए, और नए devices को enrol करने वाली एक key पकड़ ली गई, जिससे attacker की एक machine network में जुड़ गई। Report ने यह आख़िरी चरण पूरा सिर्फ़ तब दिखाया जब Tailnet Lock बंद था। Tailnet Lock चालू होने पर, उसने lock बंद करने के लिए ज़रूरी सामग्री पकड़ी, पर उसका इस्तेमाल नहीं किया।</li>
<li><strong>Finding 5, SSH memory exhaustion।</strong> Login किया हुआ session root के रूप में चलने वाली Tailscale service से लगातार memory allocate करवा सकता था।</li>
<li><strong>Tailscale ने क्या कहा।</strong> उसने कहा कि इन issues पर &#8220;require urgent attention&#8221; (यानी तुरंत ध्यान चाहिए), और SSH vulnerabilities &#8220;primarily concerned how permissions were enforced&#8221; (मुख्यतः यह कि connection के authorize होने के बाद permissions कैसे लागू हुईं); वह इससे असहमत है कि ये issues किसी worm के बराबर हैं, और इसे lateral movement कहता है जो उन connections तक सीमित है जिन्हें policy पहले से अनुमति देती है।</li>
<li><strong>Wormability।</strong> Lab में एक compromised device उन सभी devices तक पहुँचा जिन्हें policy ने अनुमति दी थी, हर चरण में एक सेकंड से कम समय में। Report एक control का नाम बताती है जिसने फैलाव रोका: एक source से एक destination तक लिखे गए rules। Hardware में रखी keys (TPM या Secure Enclave) ने चोरी हुई device identity को टिकने से रोका।</li>
<li><strong>बाकी findings में।</strong> एक app-connector design जो यह नहीं जाँचता कि traffic कहाँ जा रहा है (Tailscale के अनुसार यह version, Conn25, release नहीं हुआ है); <code>tailscale serve</code> का service के अपने control socket तक forward करना; relay client में memory exhaustion (मुझे इसके लिए कोई bulletin नहीं मिला); और headscale पर denial of service।</li>
<li><strong>Bulletins।</strong> Tailscale ने चार प्रकाशित किए, 26 अक्टूबर की तारीख़ के, सब 1.104.4 में fix हुए: TS-2026-014 (SSH socket forwarding; Tailscale अब login किए हुए user के रूप में forward करता है, root के रूप में नहीं), TS-2026-015 (SSH memory exhaustion), TS-2026-016 (<code>tailscale serve</code> का privileged sockets तक पहुँचना) और TS-2026-017 (HTTP/2 पर Serve एक mount के <code>Tailscale-App-Capabilities</code> values को उसी node के किसी दूसरे mount तक पहुँचा सकता था)। जब तक device update नहीं होता, forwarding की खामी के लिए Tailscale का mitigation Tailscale service के environment में <code>TS_SSH_DISABLE_FORWARDING=1</code> है; &#8220;फिर जो मिला, उसे बदलें&#8221; में दिया गया stopgap बताता है कि कैसे।</li>
<li><strong>उसी क्षेत्र के पहले के fixes।</strong> जून और जुलाई के bulletins में पहले ही उस SSH socket forwarding खामी का समाधान था जो symlink permissions का सम्मान नहीं करती थी (TS-2026-004, 3 जून) और <code>autogroup:nonroot</code> को पार करने के एक रास्ते का (TS-2026-009, 13 जुलाई); दोनों 1.98.9 में fix हुए।</li>
<li><strong>Forwarding और default rule।</strong> Tailscale का SSH server तभी forward करता है जब मेल खाने वाले rule के साथ Tailscale के coordination server की ओर से forwarding की permission हो (source code में <code>allowLocalPortForwarding</code> और <code>allowRemotePortForwarding</code>)। Tailscale का public documentation नहीं बताता कि policy यह permission कैसे देती है या default rule देता है या नहीं। Report कहती है कि Tailscale की hosted service पर प्रति-rule forwarding fields को false करें, पर उनके नाम नहीं बताती; मुझे वे Tailscale के policy documentation में नहीं मिले। Bulletin TS-2026-014 कहता है कि यह issue उन users पर लागू होता है जो &#8220;allow local or remote forwarding in their access policies&#8221; (यानी अपनी access policies में local या remote forwarding की अनुमति देते हैं)।</li>
<li><strong>Disclosure।</strong> Tailscale के अनुसार उसे report शनिवार 24 अक्टूबर की सुबह मिली और report दो घंटे बाद प्रकाशित हो गई; वह पहले से ही संबंधित issues की जाँच कर रहा था। The Hacker News ने बताया कि researcher ने इसे &#8220;reported but not coordinated&#8221; बताया।</li>
</ul>
</details>
<h2>वह policy जो मैंने कभी लिखी नहीं</h2>
<p>जब आप tailnet बनाते हैं, Tailscale उसे एक default policy देता है। उसका documentation इसे बताता है: हर device बाकी हर device तक हर port पर पहुँच सकता है (नीचे मैं इसे allow-all कहता हूँ), और हर user अपने devices पर check mode में, root या साधारण user के रूप में, Tailscale SSH session खोल सकता है। SSH वाला हिस्सा ऐसा दिखता है:</p>
<div class="sf-box" data-mode="output" data-where="Policy file में default ssh rule, जैसा वह दिखता है" data-how="आप इसे type नहीं करते"><pre><code>"ssh": [
  {
    "action": "check",
    "src":    ["autogroup:member"],
    "dst":    ["autogroup:self"],
    "users":  ["autogroup:nonroot", "root"]
  }
]</code></pre></div>
<p>Tailnet का कोई भी user (<code>autogroup:member</code>) उन devices से connect कर सकता है जो उस user के हैं (<code>autogroup:self</code>; tagged devices शामिल नहीं हैं), root को छोड़कर किसी भी local account के रूप में (<code>autogroup:nonroot</code>), या root के रूप में। मेरे पास यही rule था, और उसके साथ allow-all भी। Tailscale का policy-file page default <code>ssh</code> rule को <code>autogroup:nonroot</code> के साथ बताता है और root का ज़िक्र नहीं करता; उसका SSH page और उसकी example policies में root शामिल है, जैसा ऊपर दिखाया गया है।</p>
<p>यह rule मुझमें और उस व्यक्ति में फ़र्क नहीं कर सकता जिसने मेरे किसी device पर कब्ज़ा कर लिया हो। Tailscale के लिए मेरे device से आया connection मैं ही हूँ। अगर tailnet का कोई Linux device <code>tailscale set --ssh</code> चला लेता, तो मेरे किसी दूसरे device पर कब्ज़ा करने वाला उस पर root session खोल सकता था। यह rule का design के अनुसार काम करना है, कोई खामी नहीं। Check mode मेरा browser sign-in माँगता है, और एक मंज़ूरी 12 घंटे तक लागू रह सकती है (नीचे देखें)।</p>
<p>Check mode session शुरू होने से पहले browser में नया sign-in माँगता है। Default check period के साथ, Tailscale का documentation कहता है कि check mode का एक sign-in आपको उस device तक और tailnet के बाकी किसी भी device तक 12 घंटे के लिए बिना फिर sign in किए पहुँचने देता है। वह यह नहीं बताता कि यह किसी दूसरे device से खोले गए session को भी कवर करता है या नहीं। Report बताती है कि किसी device पर बैठा attacker आपकी अगली मंज़ूरी का इंतज़ार कर सकता है या आपसे उसे माँग सकता है, इसलिए check mode इसे धीमा करता है, रोकता नहीं।</p>
<p>Tailworm को साधारण account को root बनाने के लिए socket forwarding चाहिए थी। Default rule को कुछ नहीं चाहिए था, सिर्फ़ check-mode की मंज़ूरी। यह documentation में बताया गया व्यवहार है, कोई vulnerability नहीं। 1.104.4 पर update करने से भी यह नहीं बदलता: जिस session को root के रूप में आने दिया गया, वह design से root है।</p>
<h2>मैंने क्या बदला</h2>
<p><strong>Policy।</strong> नई policy में <code>ssh</code> section नहीं है। Tailscale का documentation कहता है कि SSH rules हटाने से पूरे tailnet में Tailscale SSH बंद हो जाता है। Grants से allow-all की जगह सिर्फ़ वही दिया जा सकता है जिसकी ज़रूरत है, जैसे:</p>
<ol>
<li>Exit nodes, अगर आप उन्हें इस्तेमाल करते हैं: <code>autogroup:internet</code> तक access।</li>
<li>वे थोड़े devices जिन्हें आपको manage करना ही है, और कुछ नहीं। इस grant को संकरा रखें: जो भी device इसके दायरे में है, वह पहुँच में रहता है।</li>
</ol>
<p>Allow-all को बदलने की एक कीमत है: जो कुछ devices के एक-दूसरे तक पहुँचने पर टिका था, वह रुक जाता है, जैसे file sharing, media server या subnet route। पहले हर एक को उसका अपना grant दें।</p>
<p><strong>फिर tests।</strong> Policy file में tests हो सकते हैं: ऐसे कथन जैसे &#8220;यह user इस port तक पहुँच सकता है&#8221;, जिन्हें Tailscale file बदलने पर हर बार जाँचता है। कोई test fail हो तो वह बदलाव को मना कर देता है। Tests कह सकते हैं कि क्या चलना चाहिए और क्या मना होना चाहिए, जैसे कि जिस device को SSH, file sharing और remote desktop (ports 22, 445 और 3389) की ज़रूरत नहीं, उस पर ये मना हों।</p>
<details>
<summary>विस्तार से: एक example policy</summary>
<p>यह एक ढाँचा है, template नहीं। यह exit nodes को छोड़कर बाकी सब कुछ काट देता है; जैसा है वैसा paste करने पर यह आपको आपके अपने NAS या media server से काट देगा। Addresses और e-mail placeholders हैं।</p>
<div class="sf-box" data-mode="file" data-where="JSON editor के लिए example policy" data-how="एक example: paste करने से पहले इसे अपने अनुसार बदलें"><pre><code>{
  "grants": [
    // 1. Use exit nodes.
    {"src": ["autogroup:member"], "dst": ["autogroup:internet"], "ip": ["*"]},

    // 2. Add a grant for each device you must reach, and no more.

    // Nothing else: other devices accept no inbound tailnet traffic.
  ],

  // An empty "acls" list: Tailscale's documentation gives this form for deny-all;
  // omitting the section is documented as allow-all.
  "acls": [],

  // No "ssh" section: no Tailscale SSH session is allowed anywhere.

  "tests": [
    {
      "src":    "you@example.com",
      // "accept": ["100.x.y.2:445"],  one line like this for each thing that must work.
      "deny":   ["100.x.y.3:22", "100.x.y.3:445", "100.x.y.3:3389"], // a device that must refuse these
    },
  ],
}</code></pre></div>
<p>NAS के लिए एक grant, जो आपके tailnet के users को file shares दे और कुछ नहीं, ऐसा दिखेगा (port एक example है, और जितनी दूसरी services उसे देनी हों, उनमें से हर एक के लिए एक <code>tcp:</code> entry जोड़ें; <code>nas</code> वह नाम है जो आप policy के <code>hosts</code> section में परिभाषित करते हैं, जैसे <code>"hosts": {"nas": "100.x.y.2"}</code>):</p>
<div class="sf-box" data-mode="file" data-where="NAS के लिए example grant" data-how="एक example: paste करने से पहले इसे अपने अनुसार बदलें"><pre><code>{"src": ["autogroup:member"], "dst": ["nas"], "ip": ["tcp:445"]},</code></pre></div>
<p>टिप्पणियाँ:</p>
<ul>
<li>सिर्फ़ वे devices exit nodes इस्तेमाल कर सकते हैं जिनके पास <code>autogroup:internet</code> की access है, इसीलिए grant 1 ऐसे लिखा गया है।</li>
<li>Tests rules को जाँचते हैं, network को नहीं: test का पास होना यह साबित नहीं करता कि कोई device जवाब देता है।</li>
<li><strong><code>"acls": []</code> क्यों रहता है।</strong> Tailscale का documentation कहता है कि <code>acls</code> section छोड़ देना default allow-all policy के बराबर है, और उसका deny-all example <code>"acls": []</code> है। यह नहीं बताता कि जिस policy में grants हैं, उसमें section छोड़ने का क्या मतलब है। खाली list रखें और tests को तय करने दें: जिस port को allow-all खोल देता, उसके लिए deny test तब तक fail होता है जब तक allow-all लागू है।</li>
<li>Save करने से पहले पुरानी policy की एक copy रखें (नीचे &#8220;अगर आप Tailscale SSH इस्तेमाल नहीं करते: उसे हर जगह बंद कर दें&#8221; का चरण 1 यह करता है)। Tailscale आपको Configuration logs page से कोई बदलाव revert करने भी देता है।</li>
</ul>
</details>
<details>
<summary>विस्तार से: वह तरीका जो मैं फिर अपनाऊँगा</summary>
<p>सूची बनाएँ कि attack को क्या चाहिए; हर चीज़ को अपने devices पर जाँचें और लिखें कैसे; वह भी देखें जो attack लागू न होने पर भी गलत है; और बाकी को छाँटें: क्या बदलना है, किस पर नज़र रखनी है और कौन-सा जोखिम स्वीकार करना है।</p>
</details>
<h2>फिर जो मिला, उसे बदलें</h2>
<h3>अगर आप Tailscale SSH इस्तेमाल नहीं करते: उसे हर जगह बंद कर दें</h3>
<p><strong>शुरू करने से पहले:</strong> यह आपकी policy इस तरह बदलता है कि कोई device Tailscale SSH session स्वीकार नहीं करता। अगर Tailscale SSH किसी machine में जाने का आपका अकेला रास्ता है, तो यह न करें। इसमें लगभग तीन मिनट लगते हैं। Undo करने के लिए सहेजी हुई copy वापस paste करें (चरण 1) और save करें, या Configuration logs page से बदलाव को revert करें।</p>
<ol>
<li><strong>Policy की copy सहेजें।</strong> <strong>JSON editor</strong> में text के अंदर click करें और Ctrl+A (Mac पर Cmd+A), फिर Ctrl+C (Cmd+C) दबाएँ। Notepad खोलें (Start menu → <code>notepad</code> type करें → Enter) या Mac पर TextEdit (पहले Format → Make Plain Text), Ctrl+V (Cmd+V) से paste करें, और file को अपने Documents folder में <code>policy-backup.json</code> नाम से सहेजें। File में पूरी policy होनी चाहिए, जो <code>{</code> से शुरू होती है।</li>
<li><strong><code>ssh</code> section हटाएँ।</strong> Console में लौटकर <code>"ssh": [</code> से लेकर उस <code>]</code> तक सब कुछ चुनें जो उसके ठीक नीचे सीध में है (rule के अंदर वाला <code>]</code> नहीं), और अगर उसके बाद comma हो तो उसे भी, फिर Delete दबाएँ। Policy file में फ़ालतू comma चल जाता है। बाकी sections को जैसा था वैसा रहने दें।</li>
<li><strong>Save करें।</strong> <strong>Save</strong> पर click करें। बदलाव लागू करने से पहले Tailscale policy को और उसके किसी भी tests को जाँचता है। आपको console में save की पुष्टि दिखनी चाहिए। अगर वह syntax error बताए, तो कोई comma या bracket गलत जगह है: सहेजी हुई copy वापस paste करें और चरण 2 से दोहराएँ। अगर वह किसी <code>sshTests</code> entry का नाम ले, तो उस test को भी हटा दें।</li>
<li><strong>जाँचें।</strong> Page reload करें, Ctrl+F (Cmd+F) दबाएँ और <code>"ssh"</code> खोजें। कोई match नहीं होना चाहिए। जिस device ने opt in किया था, वह तब तक server चलाता रहता है जब तक आप उस पर <code>tailscale set --ssh=false</code> नहीं चलाते।</li>
</ol>
<h3>अगर आप Tailscale SSH इस्तेमाल करते हैं: update करें, फिर rule को सीमित करें</h3>
<p><strong>शुरू करने से पहले:</strong> update करने से उस device पर हर खुला Tailscale SSH session खत्म हो जाता है। Update को Tailscale SSH session से न चलाएँ। कोई दूसरा रास्ता इस्तेमाल करें: machine पर keyboard और screen, या अपने local network पर साधारण <code>ssh</code> login। Device के Tailscale address (100.…) पर <code>ssh</code> login भी तब टूट जाता है जब Tailscale restart होता है, और update के बीच में टूटना install में बाधा डाल सकता है। नीचे की commands Debian, Ubuntu और Raspberry Pi OS के लिए हैं, जिनमें Tailscale की अपनी package repository हो। दूसरे systems के लिए Tailscale का <a href="https://tailscale.com/docs/features/client/update">update करने वाला page</a> देखें।</p>
<ol>
<li><strong>किसी दूसरे रास्ते से device में login करें</strong> और उस पर terminal खोलें। आपको उसका shell prompt दिखना चाहिए।</li>
<li><strong>देखें कि वह कौन-सा version चला रहा है।</strong></li>
</ol>
<div class="sf-box" data-mode="one" data-shell="sh" data-effect="read" data-effect-text="सिर्फ़ देखता है — आज़माना सुरक्षित है" data-where="Device पर Terminal" data-how="1 command — इसे paste करें, फिर Enter दबाएँ"><pre><code>tailscale version</code></pre></div>
<p class="sf-after">पहली line version number है। 1.104.4 या उससे ऊपर में fixes हैं। उससे नीचे वाले को update चाहिए।</p>
<ol start="3">
<li><strong>Update करें।</strong> <code>sudo</code> एक command को administrator के रूप में चलाता है और आपका password माँग सकता है; type करते समय कुछ दिखता नहीं, इसलिए उसे type करें और Enter दबाएँ।</li>
</ol>
<div class="sf-box" data-mode="each" data-shell="sh" data-effect="change" data-effect-text="आपके system को बदलता है" data-where="Device पर Terminal" data-how="2 commands — एक-एक करके, क्रम से चलाएँ; उस line को copy करने के लिए $ पर click करें"><pre><code>sudo apt update
sudo apt install --only-upgrade tailscale</code></pre></div>
<p class="sf-after">हर एक में एक मिनट से कम लगता है। Tailscale कुछ सेकंड के लिए restart होता है। अगर update बीच में कट जाए, तो <code>sudo dpkg --configure -a</code> उसे पूरा करता है। अगर <code>apt</code> कहता है कि tailscale पहले से सबसे नया version है, तो device में या तो fix है या device पर Tailscale, Tailscale की अपनी repository से install नहीं हुआ था।</p>
<ol start="4">
<li><strong>फिर जाँचें,</strong> <code>tailscale version</code> से। पहली line में 1.104.4 या उससे ऊपर का version होना चाहिए।</li>
<li><strong>Rule को सीमित करें।</strong> अगर आप किसी host पर root के रूप में login करते हैं, जैसे Proxmox server पर, या ऐसे host पर जहाँ किसी दूसरे account के पास <code>sudo</code> नहीं है, तो यह वह access हटा देता है: पहले जाँच लें। Edit करने से पहले policy की copy सहेजें (&#8220;अगर आप Tailscale SSH इस्तेमाल नहीं करते: उसे हर जगह बंद कर दें&#8221; का चरण 1)। फिर console में <strong>Access controls</strong>, <strong>JSON editor</strong> पर जाएँ, अपने <code>ssh</code> rule की <code>"users"</code> line खोजें और उसमें से <code>, "root"</code> हटा दें:</li>
</ol>
<div class="sf-box" data-mode="output" data-where="पहले" data-how="आप इसे type नहीं करते"><pre><code>"users":  ["autogroup:nonroot", "root"]</code></pre></div>
<div class="sf-box" data-mode="output" data-where="बाद में" data-how="आप इसे type नहीं करते"><pre><code>"users":  ["autogroup:nonroot"]</code></pre></div>
<p class="sf-after"><strong>Save</strong> पर click करें। Rule अब root sessions नहीं देता; login के बाद <code>sudo</code> इस्तेमाल करें। जिस host पर आपके account के पास बिना password का <code>sudo</code> है, वहाँ यह intruder को धीमा करता है, रोकता नहीं। यह update की जगह नहीं लेता: जुलाई का bulletin TS-2026-009 <code>autogroup:nonroot</code> को पार करने का एक रास्ता था। <code>src</code> और <code>dst</code> को भी सिर्फ़ उन लोगों और devices तक सीमित करें जिन्हें SSH चाहिए।</p>
<details>
<summary>Stopgap: जिस device को आप अभी update नहीं कर सकते, उस पर SSH forwarding बंद करें</summary>
<p>इसे सिर्फ़ वहाँ इस्तेमाल करें जहाँ आपका package source अभी 1.104.4 या उसके बाद का version नहीं देता। Forwarding की खामी के लिए Tailscale का mitigation Tailscale service के environment में <code>TS_SSH_DISABLE_FORWARDING=1</code> setting है। Debian जैसे installs पर service <code>/etc/default/tailscaled</code> पढ़ती है (Tailscale के source में <code>tailscaled.service</code> file इसे <code>EnvironmentFile</code> के रूप में नाम देती है)। मैंने नीचे की commands उस file की copies पर test कीं, चलती Tailscale service पर नहीं। Restart से खुले Tailscale SSH sessions खत्म हो जाते हैं, इसलिए इन्हें किसी दूसरे रास्ते से चलाएँ। ये commands मानकर चलती हैं कि system systemd चलाता है।</p>
<ol>
<li><strong>File का backup लें।</strong> अगर command <code>No such file or directory</code> कहती है, तो इस device पर setting कहीं और रखी जाती है; रुकें और अपने install के लिए Tailscale का page पढ़ें। इसे एक बार चलाएँ: दूसरी बार चलाने पर backup की जगह edit की हुई file आ जाती है।</li>
</ol>
<div class="sf-box" data-mode="one" data-shell="sh" data-effect="change" data-effect-text="आपके system को बदलता है" data-where="Device पर Terminal, किसी दूसरे रास्ते से" data-how="1 command — इसे paste करें, फिर Enter दबाएँ"><pre><code>sudo cp /etc/default/tailscaled /etc/default/tailscaled.bak</code></pre></div>
<ol start="2">
<li><strong>Setting जोड़ें।</strong> Line एक खाली line से शुरू होती है ताकि वह file की आख़िरी line से जुड़ न जाए।</li>
</ol>
<div class="sf-box" data-mode="one" data-shell="sh" data-effect="change" data-effect-text="आपके system को बदलता है" data-where="Device पर Terminal" data-how="1 command — इसे paste करें, फिर Enter दबाएँ"><pre><code>printf '\nTS_SSH_DISABLE_FORWARDING=1\n' | sudo tee -a /etc/default/tailscaled</code></pre></div>
<p class="sf-after">यह छापता है कि उसने क्या जोड़ा। इसे एक बार चलाएँ: दूसरी बार चलाने पर line दो बार जुड़ जाती है।</p>
<ol start="3">
<li><strong>Service को restart करें।</strong></li>
</ol>
<div class="sf-box" data-mode="one" data-shell="sh" data-effect="change" data-effect-text="आपके system को बदलता है" data-where="Device पर Terminal" data-how="1 command — इसे paste करें, फिर Enter दबाएँ"><pre><code>sudo systemctl restart tailscaled</code></pre></div>
<ol start="4">
<li><strong>जाँचें कि चलती service में यह setting है।</strong></li>
</ol>
<div class="sf-box" data-mode="one" data-shell="sh" data-effect="read" data-effect-text="सिर्फ़ देखता है — आज़माना सुरक्षित है" data-where="Device पर Terminal" data-how="1 command — इसे paste करें, फिर Enter दबाएँ"><pre><code>sudo cat /proc/$(systemctl show -p MainPID --value tailscaled)/environ | tr '\0' '\n' | grep TS_SSH</code></pre></div>
<div class="sf-box" data-mode="output" data-where="आपको क्या दिखना चाहिए" data-how="आप इसे type नहीं करते"><pre><code>TS_SSH_DISABLE_FORWARDING=1</code></pre></div>
<p class="sf-after">कोई output नहीं मिला तो service ने setting लागू नहीं की: <code>grep TS_SSH /etc/default/tailscaled</code> से जाँचें कि line file में है, फिर चरण 3 दोहराएँ। <code>/proc/0/environ: No such file or directory</code> का मतलब है कि service चल नहीं रही।</p>
<ol start="5">
<li><strong>Undo करने के लिए,</strong> line हटाएँ और restart करें। Device के 1.104.4 या उसके बाद के version पर आने के बाद भी ऐसा करें; यह setting एक stopgap है। Line हटाना तब भी सुरक्षित है जब चरण 1 के बाद किसी package upgrade ने file बदल दी हो; backup एक record के रूप में बना रहता है। Upgrade पूछ सकता है कि आपकी edit की हुई file रखनी है या नहीं:</li>
</ol>
<div class="sf-box" data-mode="each" data-shell="sh" data-effect="change" data-effect-text="आपके system को बदलता है" data-where="Device पर Terminal" data-how="2 commands — एक-एक करके, क्रम से चलाएँ; उस line को copy करने के लिए $ पर click करें"><pre><code>sudo sed -i '/^TS_SSH_DISABLE_FORWARDING=1$/d' /etc/default/tailscaled
sudo systemctl restart tailscaled</code></pre></div>
<p class="sf-after">अगर <code>sed</code> कहता है कि वह file पढ़ नहीं सकता, तो इस device पर undo करने को कुछ नहीं है।</p>
</details>
<h3>सबके लिए</h3>
<ol>
<li><strong>जिन devices की आप अब देखभाल नहीं करते उन्हें हटाएँ,</strong> उनके आपके हाथ से निकलने से पहले। जिस device तक आप सिर्फ़ Tailscale से पहुँच सकते हैं, उसे न हटाएँ: उसे वापस जोड़ने के लिए आपको machine के पास होना पड़ेगा। Console में <strong>Machines</strong> खोलें, search bar में device को नाम से खोजें, उसके बगल का menu खोलें, <strong>Remove</strong> चुनें और फिर dialog में <strong>Remove machine</strong>। Device list से गायब हो जाता है। अगर आपने गलती से कोई device हटा दिया, तो उस device को फिर से sign in करें ताकि वह वापस जुड़ जाए; अगर आपके tailnet में device approval ज़रूरी है, तो admin को उसे मंज़ूर करना होगा।</li>
<li><strong>Allow-all को फिर से देखें।</strong> <strong>Access controls</strong> में <code>"acls"</code> और <code>"grants"</code> खोजें। जिस rule का source <code>*</code> है और destination <code>*</code> या <code>*:*</code>, वह allow-all है: हर device बाकी हर device तक हर port पर पहुँच सकता है। इसे बदलने के चरण आगे हैं।</li>
</ol>
<details>
<summary>Allow-all को बदलें, चरण दर चरण</summary>
<p><strong>शुरू करने से पहले:</strong> यह आपकी policy बदलता है और devices को एक-दूसरे से काट सकता है। इसे तब करें जब आप बाद में हर service को test कर सकें। इसमें 15 से 30 मिनट लगते हैं। Undo करने के लिए policy की सहेजी हुई copy वापस paste करें (&#8220;अगर आप Tailscale SSH इस्तेमाल नहीं करते: उसे हर जगह बंद कर दें&#8221; का चरण 1) और save करें, या Configuration logs page से बदलाव को revert करें। अगर आपका कोई phone या laptop exit node इस्तेमाल करता है, तो हर save के बाद उसका internet access test करें: exit node का गलत grant उसे काट देता है।</p>
<ol>
<li><strong>लिख लें कि आपके devices को एक-दूसरे से क्या चाहिए:</strong> file shares, एक media server, एक subnet route, एक printer। Paper या एक text file इस्तेमाल करें।</li>
<li><strong>Policy की copy सहेजें,</strong> जैसा ऊपर बताया गया है।</li>
<li><strong>हर ज़रूरत के लिए एक grant जोड़ें</strong> <code>"grants"</code> section में (अगर कोई नहीं है तो section जोड़ें; allow-all <code>"acls"</code> में है), जैसे पहले &#8220;एक example policy&#8221; में NAS का example। अगर आपने वह नाम परिभाषित नहीं किया है, तो <code>nas</code> की जगह NAS का Tailscale address (Machines page उसे दिखाता है) इस्तेमाल करें। अगर आप exit nodes इस्तेमाल करते हैं, तो उनके लिए एक grant जोड़ें।</li>
<li><strong>जो चलना चाहिए उसके tests जोड़ें,</strong> जैसे उसी example में। <strong>Save</strong> पर click करें। अगर कोई test fail हो, तो Tailscale बदलाव को मना कर देता है और उस test का नाम बताता है।</li>
<li><strong>Allow-all rule हटाएँ,</strong> पर <code>"acls"</code> section को <code>"acls": []</code> के रूप में रखें: Tailscale का documentation deny-all के लिए यही form देता है और कहता है कि section छोड़ना allow-all के बराबर है। जो नहीं चलना चाहिए उसके tests जोड़ें (जैसे उस device पर ports 22, 445 और 3389, जिसे इन्हें नहीं लेना चाहिए), और <strong>Save</strong> फिर से करें। Allow-all के रहते वे tests fail होते हैं, इसीलिए इन्हें इसी चरण में जोड़ा जाता है।</li>
<li><strong>हर service को test करें</strong> उस device से जो उसे इस्तेमाल करता है। अगर कोई fail हो, तो उसका grant जोड़ें, या सहेजी हुई copy वापस paste करें।</li>
</ol>
</details>
<h2>स्थिति</h2>
<p>Version 1.104.4 को 27 अक्टूबर 2026 (UTC) की देर रात tag किया गया; Tailscale का changelog इसे 28 अक्टूबर की तारीख़ देता है। Version 1.104.5, जो 2 नवंबर 2026 को release हुआ, Tailscale SSH connection stalls और restart hangs को fix करता है, और approval की अवधि खत्म होने पर check-mode sessions का disconnect होना रोकता है; मौजूदा release पर update करें। 10 नवंबर 2026 को bulletins page (TS-2026-014 से TS-2026-017, 26 अक्टूबर की तारीख़ के) पर कोई CVE number नहीं था।</p>
<h2>यह कैसे किया गया</h2>
<p>मैंने यह जाँच Claude, Anthropic के AI model, के साथ की। उसने replacement policy और उसके tests का draft बनाया, और यह post भी। मेरे पहले draft की Claude की समीक्षा ने बताया कि default rule पहले से root की अनुमति देता है। Claude ने फिर इसे Tailscale के documentation से जाँचा; open-source code में default policy नहीं है।</p>
<details>
<summary>शब्दावली</summary>
<ul>
<li><strong>Tailscale:</strong> WireGuard पर बना एक mesh VPN, जिसके साथ एक hosted service है जो sign-in और keys सँभालती है।</li>
<li><strong>Tailnet:</strong> एक Tailscale account के devices का समूह।</li>
<li><strong>Policy file:</strong> tailnet के access rules, जो admin console में edit होते हैं। <em>Grants</em> तय करते हैं कि कौन-सा device किस तक पहुँच सकता है; <code>ssh</code> section तय करता है कि Tailscale SSH sessions कौन खोल सकता है; <em>tests</em> हर बदलाव पर rules को जाँचते हैं।</li>
<li><strong>Allow-all:</strong> default <code>acls</code> rule जो हर device को बाकी हर device तक हर port पर पहुँचने देता है।</li>
<li><strong>Tag:</strong> <code>tag:server</code> जैसा label, जो device को user की जगह अपनी एक अलग पहचान देता है; tagged devices <code>autogroup:self</code> के दायरे में नहीं आते।</li>
<li><strong>autogroup:member / self / nonroot:</strong> tailnet का कोई भी user; वे devices जो किसी user के हैं (tagged वाले नहीं); root को छोड़कर कोई भी local account।</li>
<li><strong>Tailscale SSH:</strong> Tailscale service में बना एक SSH server, जो passwords या keys की जगह policy file से तय करता है कि कौन login कर सकता है।</li>
<li><strong>Check mode:</strong> <code>ssh</code> rule की एक action जो session शुरू होने से पहले user से फिर sign in करवाती है; एक sign-in default रूप से 12 घंटे चलता है।</li>
<li><strong>Exit node:</strong> tailnet का एक device जिसके ज़रिए दूसरे devices अपना internet traffic भेज सकते हैं।</li>
<li><strong>root:</strong> Linux और macOS का administrator account, जो machine पर कुछ भी कर सकता है।</li>
<li><strong>Subnet route:</strong> एक device जो tailnet को अपने पीछे के पूरे local network तक पहुँचने देता है।</li>
<li><strong>Unix socket:</strong> file जैसा एक endpoint जिसे एक ही machine के programs आपस में बात करने के लिए इस्तेमाल करते हैं, जैसे Docker का control socket।</li>
<li><strong>Port forwarding (SSH में):</strong> किसी दूसरे connection को, जैसे socket तक के connection को, SSH session के ज़रिए ले जाना।</li>
<li><strong>Tailnet Lock:</strong> Tailscale का एक feature जो माँगता है कि भरोसेमंद devices हर नए device पर sign करें, तभी वह जुड़ सकता है।</li>
<li><strong>Foothold:</strong> वह device जिस पर attacker का पहले से नियंत्रण है, और जहाँ से आगे के attacks शुरू होते हैं।</li>
<li><strong>headscale:</strong> Tailscale के hosted control server का open-source विकल्प।</li>
<li><strong>CVE:</strong> किसी ख़ास vulnerability का public identifier।</li>
<li><strong>sudo:</strong> एक command prefix जो command को administrator के रूप में चलाता है; वह आपका password माँग सकता है।</li>
<li><strong>ssh:</strong> एक command जो आपको दूसरी machine में login कराती है।</li>
</ul>
</details>
<h2>स्रोत</h2>
<ul>
<li>Tailworm report, Cyberdione Labs (24 अक्टूबर 2026, वह तारीख़ जो Tailscale देता है; report खुद सिर्फ़ &#8220;2026-10&#8221; दिखाती है): <a href="https://tailworm.com/">https://tailworm.com/</a></li>
<li>Tailscale, &#8220;Tailscale SSH: Findings and fixes&#8221;, 28 अक्टूबर 2026: <a href="https://tailscale.com/blog/tailscale-ssh-findings-fixes">https://tailscale.com/blog/tailscale-ssh-findings-fixes</a></li>
<li>Tailscale, &#8220;Tailscale SSH: Investigation&#8221;: <a href="https://tailscale.com/ssh-investigation-update">https://tailscale.com/ssh-investigation-update</a></li>
<li>Tailscale security bulletins, TS-2026-004, TS-2026-009 और TS-2026-014 से TS-2026-017 (10 नवंबर 2026 को फिर पढ़े गए): <a href="https://tailscale.com/security-bulletins">https://tailscale.com/security-bulletins</a></li>
<li>The Hacker News, &#8220;Unpatched Tailscale SSH Flaws Could Let a Hacked Device Reach Root on Other Servers&#8221;, 25 अक्टूबर 2026: <a href="https://thehackernews.com/2026/10/unpatched-tailscale-ssh-flaws-could-let.html">https://thehackernews.com/2026/10/unpatched-tailscale-ssh-flaws-could-let.html</a></li>
<li>Tailscale docs, Tailscale SSH (check mode, बंद करना): <a href="https://tailscale.com/docs/features/tailscale-ssh">https://tailscale.com/docs/features/tailscale-ssh</a></li>
<li>Tailscale docs, default policy (&#8220;Allow all&#8221;): <a href="https://tailscale.com/docs/reference/examples/acls">https://tailscale.com/docs/reference/examples/acls</a></li>
<li>Tailscale docs, policy file syntax और tests: <a href="https://tailscale.com/docs/reference/syntax/policy-file">https://tailscale.com/docs/reference/syntax/policy-file</a></li>
<li>Tailscale docs, grants syntax: <a href="https://tailscale.com/docs/reference/syntax/grants">https://tailscale.com/docs/reference/syntax/grants</a></li>
<li>Tailscale docs, admin console में devices को filter करना: <a href="https://tailscale.com/docs/features/access-control/device-management/how-to/filter">https://tailscale.com/docs/features/access-control/device-management/how-to/filter</a></li>
<li>Tailscale docs, device हटाना: <a href="https://tailscale.com/docs/features/access-control/device-management/how-to/remove">https://tailscale.com/docs/features/access-control/device-management/how-to/remove</a></li>
<li>Tailscale docs, Tailscale को update करना: <a href="https://tailscale.com/docs/features/client/update">https://tailscale.com/docs/features/client/update</a></li>
<li>Tailscale docs, <code>tailscaled</code> service: <a href="https://tailscale.com/docs/reference/tailscaled">https://tailscale.com/docs/reference/tailscaled</a></li>
<li>Tailscale source code (SSH server, netstack, peer API, <code>tailscaled.service</code>) और v1.104.4 tag: <a href="https://github.com/tailscale/tailscale">https://github.com/tailscale/tailscale</a></li>
</ul>
</div>
<div id="tw-panel-te" class="tw-panel" lang="te">
<h2 class="tw-ptitle">Tailscale default policy root SSH ని అనుమతిస్తుంది. Tailworm నన్ను దాన్ని చదివేలా చేసింది.</h2>
<p class="tw-read">చదవడానికి 15 నిమిషాలు</p>
<p class="tw-note">Code, commands, సాంకేతిక పదాలను ఇంగ్లీష్‌లోనే ఉంచాను.</p>
<div class="tw-box">
<p><strong>మీ మీద ప్రభావం ఉందా?</strong> Tailworm SSH findings, Tailscale SSH నడిపే device మీద మాత్రమే వర్తిస్తాయి; ఏ device అయినా దాన్ని నడిపేది, ఎవరైనా <code>tailscale set --ssh</code> తో, లేదా దాన్ని wrap చేసే app లోని switch తో, on చేసినప్పుడు మాత్రమే. Windows, iPhone, Android, Mac app, Synology, QNAP devices దాన్ని నడపలేవు. Tailscale documentation ఆ server ని Linux కోసం, open-source command-line build లో macOS కోసం కూడా పేర్కొంటుంది; source code దాన్ని FreeBSD, OpenBSD కోసం కూడా build చేస్తుంది. కొన్ని NAS, router software లో దానికి ఒక switch ఉంటుంది: ఏ devices దాన్ని నడుపుతున్నట్లు report చేస్తున్నాయో admin console లోని Machines page చూపిస్తుంది (చెక్ లో 2వ step). Tailscale తన సొంత post లో వివరించిన vulnerabilities ని version 1.104.4 లేదా ఆ తర్వాతిది fix చేస్తుంది; report లోని పదకొండు findings లో కొన్ని headscale కు లేదా విడుదల కాని code కు సంబంధించినవి. ఏ device అయినా server నడిపితే, ఆ device ని update చేయండి.</p>
<p><strong>ఇది వేరే విషయం:</strong> మీరు మీ Tailscale access controls ని ఎప్పుడూ edit చేయకపోతే, default policy వల్ల server నడిపే మీ సొంత devices లో దేని మీదైనా, browser లో మళ్ళీ sign in అయిన తర్వాత, <strong>root గా</strong> (administrator account) Tailscale SSH session తెరవగలరు. Tag లేని మీ devices లో ఒకదాన్ని (tag అంటే <code>tag:server</code> వంటి label; చాలా home devices కి ఏదీ ఉండదు) ఆక్రమించిన ఎవరైనా అదే చేయగలిగే అవకాశం ఉంది; default rule tagged devices కి వర్తించదు. ఏ device కూడా server నడపకపోతే, ఈ రోజు ఆ rule కి పని చేయడానికి ఏమీ లేదు; ఇది చక్కదిద్దే పని, అత్యవసరం కాదు. <code>ssh</code> section ని delete చేస్తే అది మూసుకుపోతుంది. కింద ఉన్న <a href="#five-minute-check-te">ఐదు నిమిషాల చెక్</a> దీన్ని సురక్షితమైన క్రమంలో ఎలా చేయాలో చూపిస్తుంది.</p>
</div>
<p>నేను నా tailnet (నా Tailscale network) ని సృష్టించినప్పుడు Tailscale రాసిన access policy, నా సొంత devices మీద root SSH session ని అనుమతించింది. దాన్ని నేను ఎప్పుడూ తెరిచి చూడలేదు. AI model అయిన Claude, ఈ post యొక్క నా మొదటి draft ని review చేసినప్పుడు దాన్ని ఎత్తి చూపింది; అప్పుడు మేము నా network ని Tailworm report తో పోల్చి చెక్ చేస్తున్నాము.</p>
<p>Tailworm అనేది 24 అక్టోబర్ 2026 వారాంతంలో ప్రచురితమైన ఒక report: Tailscale, headscale లలో పదకొండు findings; వాటిలో అత్యంత తీవ్రమైనది Tailscale లోని built-in SSH server లో. Researcher lab లో, ఒక device ని అదుపులో ఉంచుకున్న attacker, ఆ device ని లోపలికి అనుమతించే rule కింద Tailscale SSH నడిపే ఇతర machines మీద root అయ్యాడు. Report వచ్చినప్పుడు Tailscale ఇంకా fix విడుదల చేయలేదు.</p>
<p>కింద మీ సొంత tailnet కోసం ఐదు నిమిషాల చెక్ ఉంది. Attack కి ఏం కావాలో, నేను ఏం కనుగొన్నానో దాని తర్వాత వస్తాయి.</p>
<details class="sf-legend"><summary><strong>Command line కొత్తా? Boxes ని ఎలా చదవాలి</strong></summary>
<p><strong>PS&gt;</strong> అంటే: Windows లో <em>PowerShell</em> లో టైప్ చేయండి (Start menu → <code>powershell</code> అని టైప్ చేయండి → Enter). <strong>$</strong> అంటే: Linux లేదా Mac లోని terminal లో, లేదా <code>ssh</code> (వేరే machine లోకి login చేయించే command) తో login అయిన తర్వాత remote machine లో టైప్ చేయండి. <strong>$</strong> లేదా <strong>PS&gt;</strong> ని టైప్ చేయకండి.</p>
<p><strong>$</strong> లేదా <strong>PS&gt;</strong> తో మొదలయ్యే ప్రతి line ఒక command. ఆ <strong>$</strong> ని click చేస్తే ఆ line మాత్రమే copy అవుతుంది; దాన్ని paste చేసి, <strong>Enter</strong> నొక్కి, అది పూర్తయ్యే వరకు ఆగి, ఆ తర్వాతే తదుపరిదానికి వెళ్ళండి. పైన <strong>Copy</strong> button ఉన్న box లో ఒక command (లేదా ఒక file) ఉంటుంది, కాబట్టి దాన్ని మొత్తం copy చేయండి. Dashed box మీకు తిరిగి కనిపించాల్సిన దాన్ని చూపిస్తుంది; దాన్ని మీరు టైప్ చేయరు.</p>
</details>

<h2 id="five-minute-check-te">మీ సొంత tailnet కోసం ఐదు నిమిషాల చెక్</h2>

<p><strong>మొదలుపెట్టే ముందు</strong></p>
<ul>
<li><strong>మీకు కావాల్సినవి:</strong> ఒక computer (phone మీద ఈ steps ఇబ్బందిగా ఉంటాయి), ఒక browser, Owner లేదా Admin role తో మీ tailnet కి sign-in (Network admin devices ని remove చేయలేరు; IT admin policy ని edit చేయలేరు).</li>
<li><strong>ఎంత సమయం, ఎలా undo చేయాలి:</strong> &#8220;చూడండి&#8221; కి సుమారు ఐదు నిమిషాలు; అది ఏదీ మార్చదు. Policy లో ప్రతి మార్పు దాని saved copy తో మొదలవుతుంది, ప్రతి box అది చూడటం మాత్రమేనా లేక ఏదైనా మారుస్తుందా అని చెబుతుంది.</li>
</ul>
<h3>చూడండి: ఏదీ మారదు</h3>
<ol>
<li><strong>Admin console ని తెరవండి.</strong> Web browser తెరిచి, <code>console.tailscale.com/admin/machines</code> కి వెళ్ళి, మీ tailnet కి యజమాని అయిన account తో sign in అవ్వండి. ఇది ఒక page ని మాత్రమే తెరుస్తుంది, సుమారు ఒక నిమిషం పడుతుంది. మీ devices table కనిపించాలి. Page తెరవకపోతే, మీ account కి Owner లేదా Admin role లేకపోవచ్చు; ఆ role ఉన్నవారిని అడగండి.</li>
<li><strong>Tailscale SSH నడిపే devices ని కనుగొనండి.</strong> Table పైన <strong>Filters</strong> ని click చేసి, <strong>Property</strong> ని, ఆ తర్వాత <strong>Tailscale SSH</strong> ని ఎంచుకోండి. Server నడుపుతున్నట్లు report చేసే devices కి మాత్రమే table తగ్గుతుంది. Table ఖాళీగా ఉంటే ఏ device నడపడం లేదని అర్థం. <strong>Filters</strong> కనిపించకపోతే, Tailscale యొక్క <a href="https://tailscale.com/docs/features/access-control/device-management/how-to/filter">devices ని filter చేయడం గురించిన page</a> చూడండి.</li>
<li><strong>ఐచ్ఛికం: ఒక device మీద నిర్ధారించుకోండి.</strong> ఈ list కింద ఉన్న collapsed block, Linux లో లేదా command-line build ఉన్న Mac లో ఎలా చేయాలో చూపిస్తుంది.</li>
<li><strong>మీ policy ని చదవండి.</strong> Console పై menu లో <strong>Access controls</strong> ని click చేయండి. Visual editor తెరిస్తే <strong>JSON editor</strong> కి మారండి. Text లోపల click చేసి, Ctrl+F (Mac లో Cmd+F) నొక్కి, <code>"ssh"</code> అని టైప్ చేసి Enter నొక్కండి. Match లేకపోతే policy లో SSH rule లేదని అర్థం, మీరు కింద ఉన్న &#8220;అందరికీ&#8221; కి వెళ్ళవచ్చు. కింద &#8220;నేను ఎప్పుడూ రాయని policy&#8221; లో చూపిన rule లా కనిపించే match ఉంటే, మీ policy మీ సొంత devices మీద root sessions ని అనుమతిస్తున్నట్లు; అది వేరేగా కనిపిస్తే, దాని <code>"users"</code> line ని చదవండి: దానిలో <code>root</code> ఉంటే root sessions ని అనుమతిస్తుంది. 2వ step లో devices కనిపిస్తే, కింద ఉన్న &#8220;మీరు Tailscale SSH వాడితే&#8221; కి వెళ్ళండి; దాని table ఖాళీగా ఉంటే, &#8220;మీరు Tailscale SSH వాడకపోతే&#8221; కి వెళ్ళండి.</li>
</ol>
<details>
<summary>ఐచ్ఛికం: ఒక device మీద నిర్ధారించుకోండి (Linux, లేదా command-line build ఉన్న Mac)</summary>
<p>Terminal తెరవండి: Mac లో Cmd+Space నొక్కి, <code>terminal</code> అని టైప్ చేసి Enter నొక్కండి; Linux లో మీ terminal app ని తెరవండి, లేదా <code>ssh &lt;your-user&gt;@&lt;device-address&gt;</code> తో remote machine లోకి login అవ్వండి (Windows లోని PowerShell లో కూడా <code>ssh</code> పని చేస్తుంది). ఆ తర్వాత కింది command ని నడపండి. <code>grep -i runssh</code> <code>RunSSH</code> ని పేర్కొనే line ని మాత్రమే ఉంచుతుంది.</p>
<div class="sf-box" data-mode="one" data-shell="sh" data-effect="read" data-effect-text="చూడటం మాత్రమే — ప్రయత్నించడం సురక్షితం" data-where="Device మీద terminal" data-how="1 command — దాన్ని paste చేసి, ఆ తర్వాత Enter నొక్కండి"><pre><code>tailscale debug prefs | grep -i runssh</code></pre></div>
<p class="sf-after">వెంటనే జవాబు ఇస్తుంది.</p>
<div class="sf-box" data-mode="output" data-where="Server off గా ఉంటే మీకు కనిపించాల్సినది" data-how="దీన్ని మీరు టైప్ చేయరు"><pre><code>"RunSSH": false,</code></pre></div>
<p class="sf-after"><code>true</code> అంటే device server ని నడుపుతోంది. ఏమీ print కాకపోతే, లేదా shell <code>tailscale: command not found</code> అని చెబితే, 2వ step ని ఆధారం చేసుకోండి: Mac app, Windows server ని నడపలేవు.</p>
</details>
<h2>Tailworm కి ఏం కావాలి</h2>
<p>Attack కి ఏమేం కావాలో లిస్ట్ చేసి, ప్రతి అంశాన్ని నా సొంత setup తో చెక్ చేశాను.</p>
<p>ఒక Tailscale account లోని devices కలిసి ఒక <em>tailnet</em> అవుతాయి; ఏ device ఏ device ని చేరుకోవచ్చో admin console లోని policy file నిర్ణయిస్తుంది.</p>
<p>Tailscale SSH అనేది Tailscale service లోపల ఉండే SSH server; <code>tailscale set --ssh</code> తో device మీద అది మొదలవుతుంది. ఎవరు login కావచ్చో, ఏ local account గా కావచ్చో password గానీ key గానీ కాదు, policy file నిర్ణయిస్తుంది. Report ప్రకారం, అలాంటి session ఒక Unix socket (ఒకే machine లోని programs ఒకదానితో ఒకటి మాట్లాడుకోవడానికి వాడే file లాంటి ఒక మార్గం) ని forward చేసినప్పుడు, ఆ పనిని Tailscale service root హక్కులతో చేసింది; check కి, socket వాడకానికి మధ్య ఉన్న సమయం, దాన్ని పరిమితం చేయడానికి పెట్టిన checks ని దాటేసింది. సాధారణ user గా లోపలికి అనుమతి పొందిన session root గా పని చేయగలిగింది.</p>
<p>SSH attack కి మూడు విషయాలు కావాలి:</p>
<ol>
<li>Tailscale SSH నడుపుతున్న ఒక target device.</li>
<li>Attacker device ఆ target మీద SSH session తెరవడానికి, forwarding అనుమతితో సహా, అనుమతించే policy file లోని ఒక rule.</li>
<li>ఆ rule కిందకు వచ్చే ఒక device ని ఇప్పటికే అదుపులో ఉంచుకున్న attacker.</li>
</ol>
<p>మూడోది Tailworm ఇవ్వదు; attacker దాన్ని తానే తెచ్చుకుంటాడు: లోపం ఉన్న web application, హానికరమైన package, phishing, దొంగిలించిన passwords. ఇది open internet నుంచి వచ్చే attack కాదు.</p>
<h2>నేను కనుగొన్నది</h2>
<div class="tw-tablewrap"><table>
<thead>
<tr>
<th>Attack కి కావాల్సింది</th>
<th>నేను కనుగొన్నది</th>
<th>మీ దాంట్లో ఎక్కడ చూడాలి</th>
</tr>
</thead>
<tbody>
<tr>
<td>Target మీద Tailscale SSH నడుస్తుండటం</td>
<td>నేను చెక్ చేసినప్పుడు నా devices లో దేని మీదా నడవడం లేదు</td>
<td>Admin console లోని Machines page, &#8220;Tailscale SSH&#8221; property తో filter చేసి (చెక్ లో 2వ step)</td>
</tr>
<tr>
<td>SSH session ని అనుమతించే policy rule</td>
<td>ఉంది: default rule. నా సొంత devices మీద root గా లేదా సాధారణ account గా, మళ్ళీ sign in అయిన తర్వాత</td>
<td>Policy file (చెక్ లో 4వ step)</td>
</tr>
<tr>
<td>Rule కిందకు వచ్చే device మీద foothold</td>
<td>ఏ network లోనైనా లాగే సాధ్యమే</td>
<td>—</td>
</tr>
<tr>
<td>ఇతర findings</td>
<td>అవి సంబంధించిన features కే వర్తిస్తాయి: app connectors, <code>tailscale serve</code>, ప్రతి client చేసే relay connection, headscale (Tailscale hosted control server కి open-source ప్రత్యామ్నాయం)</td>
<td>Admin console</td>
</tr>
</tbody>
</table></div>
<p>అంటే attack కి కావాల్సిన మొదటిది లేదు. రెండోది, session ని అనుమతించే rule, default గానే ఉంది. Socket attack కి కావాల్సిన forwarding ని default rule అనుమతిస్తుందో లేదో Tailscale documentation చెప్పదు.</p>
<details>
<summary>లోతుగా: ప్రతి అంశాన్ని చెక్ చేయడానికి ఇతర మార్గాలు</summary>
<ul>
<li><strong>మీరు OPNsense నడిపితే.</strong> Tailscale plugin తన settings ని ఒక API వెనుక ఉంచుతుంది. Read-only call <code>GET /api/tailscale/settings/get</code>, SSH server off గా ఉన్నప్పుడు <code>"enableSSH":"0"</code> ఇస్తుంది. Tailscale documentation SSH server ని Linux, macOS కోసం మాత్రమే పేర్కొంటుంది, కానీ దాని source code FreeBSD, OpenBSD కోసం కూడా build చేస్తుంది, OPNsense plugin లో దానికి ఒక switch ఉంది.</li>
<li><strong>ప్రతి device.</strong> Admin console లో: Machines → Filters → Property → Tailscale SSH. ఏ device కూడా సరిపోకపోతే, ఏ device కూడా server నడుపుతున్నట్లు report చేయడం లేదు.</li>
<li><strong>Linux device, లోపలి నుంచి.</strong> <code>--ssh</code> switch <code>RunSSH</code> అనే preference ని set చేస్తుంది. Server off గా ఉన్నప్పుడు <code>tailscale debug prefs | grep -i runssh</code> <code>"RunSSH": false</code> చూపిస్తుంది. <code>tailscale set --ssh=false</code> దాన్ని off చేస్తుంది.</li>
<li><strong>Versions.</strong> Report 1.104.2 ని test చేసింది; అంతకంటే ముందు versions గురించి ఏమీ చెప్పదు. Tailscale fix 1.104.4 లో ఉంది.</li>
</ul>
</details>
<details>
<summary>లోతుగా: report ఏం కనుగొంది, Tailscale ఏం చెప్పింది</summary>
<ul>
<li><strong>ఏం test చేశారు.</strong> Tailscale 1.104.2, headscale 0.29.5 (Tailscale hosted control server కి open-source ప్రత్యామ్నాయం), ఏ మార్పూ లేకుండా, ఒక lab లో, 22 నుంచి 24 అక్టోబర్ 2026 వరకు.</li>
<li><strong>Findings 1 నుంచి 3, SSH socket forwarding.</strong> Unix sockets యొక్క local, remote forwarding (<code>ssh -L</code>, <code>ssh -R</code>) ని root గా నడిచే Tailscale service చేసింది. Path check ఒక క్షణంలో జరిగింది, socket ని వాడింది మరో క్షణంలో; ఆ రెండింటి మధ్య ఉన్న సమయంలో జరిగిన race ని session లోపల వేగంగా తిరిగే ఒక loop గెలిచింది. Lab లో దీని వల్ల Docker socket ద్వారా root దొరికింది, root కి చెందిన sockets ని attacker వాటితో మార్చారు, కొత్త devices ని enrol చేయడానికి వాడే ఒక key ని పట్టుకున్నారు; ఆ key తో attacker machine network లో చేరింది. ఆ చివరి step ని Tailnet Lock off గా ఉన్నప్పుడు మాత్రమే report మొదటి నుంచి చివరి వరకు చూపించింది. Tailnet Lock on గా ఉన్నప్పుడు, lock ని disable చేయడానికి కావాల్సిన material ని పట్టుకుంది, కానీ దాన్ని వాడలేదు.</li>
<li><strong>Finding 5, SSH memory exhaustion.</strong> Login అయిన ఒక session, root గా నడిచే Tailscale service ని memory ని allocate చేస్తూనే ఉండేలా చేయగలిగింది.</li>
<li><strong>Tailscale ఏం చెప్పింది.</strong> ఈ issues కి &#8220;require urgent attention&#8221; (తక్షణ శ్రద్ధ అవసరం) అని, SSH vulnerabilities &#8220;primarily concerned how permissions were enforced&#8221; (ప్రధానంగా permissions ని ఎలా అమలు చేశారన్నదానికి సంబంధించినవి) అని, అది connection authorize అయిన తర్వాత జరిగేదని చెప్పింది; ఈ issues worm కిందకు వస్తాయన్నదాన్ని అంగీకరించదు; దీన్ని policy ఇప్పటికే అనుమతించే connections కి పరిమితమైన lateral movement అంటుంది.</li>
<li><strong>Worm లాగా వ్యాపించే అవకాశం.</strong> Lab లో, ఒక compromised device, policy అనుమతించిన ప్రతి device ని, ఒక్కో step కి ఒక సెకనులోపే చేరుకుంది. వ్యాప్తిని ఆపిన ఒక control ని report పేర్కొంటుంది: ఒక source నుంచి ఒక destination కి అని రాసిన rules. Hardware లో ఉంచిన keys (TPM లేదా Secure Enclave) దొంగిలించిన device identity ఎక్కువ కాలం నిలవకుండా ఆపాయి.</li>
<li><strong>ఇతర findings లో.</strong> Traffic ఎక్కడికి వెళ్తోందో check చేయని ఒక app-connector design (ఈ version, Conn25, ఇంకా విడుదల కాలేదని Tailscale చెబుతోంది); service యొక్క సొంత control socket కి <code>tailscale serve</code> forward చేయడం; relay client లో memory exhaustion (దానికి bulletin నాకు కనిపించలేదు); headscale మీద denial of service.</li>
<li><strong>Bulletins.</strong> Tailscale నాలుగు ప్రచురించింది, అన్నీ 26 అక్టోబర్ తేదీతో, అన్నీ 1.104.4 లో fix అయ్యాయి: TS-2026-014 (SSH socket forwarding; Tailscale ఇప్పుడు root గా కాకుండా login అయిన user గా forward చేస్తుంది), TS-2026-015 (SSH memory exhaustion), TS-2026-016 (privileged sockets ని చేరుకునే <code>tailscale serve</code>), TS-2026-017 (HTTP/2 మీద Serve, ఒక mount యొక్క <code>Tailscale-App-Capabilities</code> values ని అదే node మీద ఉన్న మరో mount కి పంపగలిగేది). Device ని update చేసే వరకు, forwarding లోపానికి Tailscale సూచించే mitigation, Tailscale service యొక్క environment లో <code>TS_SSH_DISABLE_FORWARDING=1</code> పెట్టడం; &#8220;ఆ తర్వాత, మీరు కనుగొన్నదాన్ని మార్చండి&#8221; లోని stopgap అది ఎలాగో చూపిస్తుంది.</li>
<li><strong>ఇదే ప్రాంతంలో ముందటి fixes.</strong> జూన్, జూలై bulletins ఇప్పటికే symlink permissions ని పాటించని SSH socket forwarding (TS-2026-004, 3 జూన్), <code>autogroup:nonroot</code> ని దాటే ఒక మార్గం (TS-2026-009, 13 జూలై) ని కవర్ చేశాయి; రెండూ 1.98.9 లో fix అయ్యాయి.</li>
<li><strong>Forwarding, default rule.</strong> Tailscale SSH server, సరిపోలిన rule లో Tailscale coordination server నుంచి వచ్చిన forwarding permission ఉన్నప్పుడు మాత్రమే forward చేస్తుంది (source code లో <code>allowLocalPortForwarding</code>, <code>allowRemotePortForwarding</code>). Policy దాన్ని ఎలా ఇస్తుందో, default rule ఇస్తుందో లేదో Tailscale public documentation చెప్పదు. Tailscale hosted service లో per-rule forwarding fields ని false గా set చేయమని report చెబుతుంది కానీ వాటి పేర్లు చెప్పదు; Tailscale policy documentation లో నాకు అవి కనిపించలేదు. ఈ issue &#8220;allow local or remote forwarding in their access policies&#8221; (తమ access policies లో local లేదా remote forwarding ని అనుమతించే) users ని ప్రభావితం చేస్తుందని bulletin TS-2026-014 చెబుతోంది.</li>
<li><strong>Disclosure.</strong> శనివారం 24 అక్టోబర్ ఉదయం report అందిందని, రెండు గంటల తర్వాత report ప్రచురితమైందని Tailscale చెబుతోంది; అప్పటికే అది సంబంధిత issues ని పరిశీలిస్తోంది. Researcher దీన్ని &#8220;reported but not coordinated&#8221; (report చేశారు కానీ సమన్వయం చేయలేదు) అని వర్ణించినట్లు The Hacker News రాసింది.</li>
</ul>
</details>
<h2>నేను ఎప్పుడూ రాయని policy</h2>
<p>మీరు tailnet సృష్టించినప్పుడు, Tailscale దానికి ఒక default policy ఇస్తుంది. దాని documentation దాన్ని ఇలా వివరిస్తుంది: ప్రతి device ప్రతి ఇతర device ని ప్రతి port మీద చేరుకోవచ్చు (దీన్ని కింద allow-all అంటాను), ప్రతి user తన సొంత devices మీద check mode లో root గా లేదా సాధారణ user గా Tailscale SSH session తెరవవచ్చు. SSH భాగం ఇలా ఉంటుంది:</p>
<div class="sf-box" data-mode="output" data-where="Policy file లో కనిపించే default ssh rule" data-how="దీన్ని మీరు టైప్ చేయరు"><pre><code>"ssh": [
  {
    "action": "check",
    "src":    ["autogroup:member"],
    "dst":    ["autogroup:self"],
    "users":  ["autogroup:nonroot", "root"]
  }
]</code></pre></div>
<p>Tailnet లోని ఏ user అయినా (<code>autogroup:member</code>) తనకు చెందిన devices కి (<code>autogroup:self</code>; tagged devices చేరవు), root తప్ప ఏ local account గా (<code>autogroup:nonroot</code>) అయినా, లేదా root గా connect కావచ్చు. నా దాంట్లో ఈ rule ఉంది, దానితో పాటు allow-all కూడా. Tailscale యొక్క policy-file page default <code>ssh</code> rule ని <code>autogroup:nonroot</code> తో వివరిస్తుంది, root ని పేర్కొనదు; దాని SSH page, దాని ఉదాహరణ policies లో root ఉంది, పైన చూపినట్లు.</p>
<p>నన్ను, నా devices లో ఒకదాన్ని ఆక్రమించిన వ్యక్తిని ఈ rule వేరు చేసి చూడలేదు. Tailscale దృష్టిలో నా devices లో ఒకదాని నుంచి వచ్చే connection నేనే. Tailnet లోని ఒక Linux device లో <code>tailscale set --ssh</code> నడిచి ఉంటే, నా మరో device ని ఆక్రమించిన వ్యక్తి ఆ device మీద root session తెరవగలడు. అది rule design ప్రకారం పని చేయడమే, లోపం కాదు. Check mode నా browser sign-in ని అడుగుతుంది, ఒక approval 12 గంటల పాటు అమలులో ఉండవచ్చు (కింద చూడండి).</p>
<p>Session మొదలవక ముందు check mode browser లో కొత్త sign-in అడుగుతుంది. Default check period తో, ఒక check-mode sign-in తో ఆ device ని, tailnet లోని ఇతర ఏ device ని అయినా మళ్ళీ sign in కాకుండానే 12 గంటల పాటు చేరుకోవచ్చని Tailscale documentation చెబుతుంది. అది వేరే device నుంచి తెరిచిన session కి కూడా వర్తిస్తుందో లేదో అది చెప్పదు. ఒక device మీద ఉన్న attacker మీ తదుపరి approval కోసం ఎలా వేచి ఉండవచ్చో, లేదా దాన్ని ఇవ్వమని మిమ్మల్ని ఎలా prompt చేయవచ్చో report వివరిస్తుంది; కాబట్టి check mode దీన్ని నెమ్మదింపజేస్తుంది, ఆపదు.</p>
<p>సాధారణ account ని root గా మార్చడానికి Tailworm కి socket forwarding కావాల్సి వచ్చింది. Default rule కి ఏదీ అక్కర్లేదు, ఒక check-mode approval చాలు. ఇది documentation లో ఉన్న ప్రవర్తనే, vulnerability కాదు. 1.104.4 కి update చేయడం కూడా దీన్ని మార్చదు: root గా లోపలికి అనుమతించిన session design ప్రకారమే root.</p>
<h2>నేను ఏం మార్చాను</h2>
<p><strong>Policy.</strong> కొత్త దాంట్లో <code>ssh</code> section లేదు. SSH rules ని తొలగిస్తే tailnet అంతటా Tailscale SSH disable అవుతుందని Tailscale documentation చెబుతుంది. Allow-all స్థానంలో అవసరమైనది మాత్రమే grants తో ఇవ్వవచ్చు, ఉదాహరణకు:</p>
<ol>
<li>Exit nodes వాడితే: <code>autogroup:internet</code> కి access.</li>
<li>మీరు manage చేయాల్సిన కొన్ని devices, అంతకు మించి ఏమీ కాదు. ఈ grant ని పరిమితంగా ఉంచండి: అది కవర్ చేసే ప్రతి device చేరుకునేలానే ఉంటుంది.</li>
</ol>
<p>Allow-all ని మార్చడానికి ఒక మూల్యం ఉంది: devices ఒకదాన్ని ఒకటి చేరుకోవడం మీద ఆధారపడిన ప్రతిదీ ఆగిపోతుంది, ఉదాహరణకు file sharing, media server, subnet route. ముందుగా వాటిలో ప్రతిదానికి సొంత grant ఇవ్వండి.</p>
<p><strong>ఆ తర్వాత tests.</strong> Policy file లో tests ఉండవచ్చు: &#8220;ఈ user ఈ port ని చేరుకోవచ్చు&#8221; వంటి statements; file మారినప్పుడల్లా Tailscale వాటిని check చేస్తుంది. ఏదైనా test fail అయితే ఆ మార్పును తిరస్కరిస్తుంది. ఏది పని చేయాలో, ఏది తిరస్కరించబడాలో tests చెప్పగలవు; ఉదాహరణకు అవసరం లేని device మీద SSH, file sharing, remote desktop (ports 22, 445, 3389) తిరస్కరించబడాలని.</p>
<details>
<summary>లోతుగా: ఒక ఉదాహరణ policy</summary>
<p>ఇది ఒక ఆకృతి, template కాదు. Exit nodes తప్ప మిగతావన్నీ కట్ చేస్తుంది; ఉన్నది ఉన్నట్లు paste చేస్తే, మీ సొంత NAS నుంచి, media server నుంచి మిమ్మల్ని కట్ చేస్తుంది. Addresses, e-mail placeholders మాత్రమే.</p>
<div class="sf-box" data-mode="file" data-where="JSON editor కోసం ఉదాహరణ policy" data-how="ఇది ఒక ఉదాహరణ: paste చేసే ముందు దాన్ని మీ అవసరానికి మార్చుకోండి"><pre><code>{
  "grants": [
    // 1. Use exit nodes.
    {"src": ["autogroup:member"], "dst": ["autogroup:internet"], "ip": ["*"]},

    // 2. Add a grant for each device you must reach, and no more.

    // Nothing else: other devices accept no inbound tailnet traffic.
  ],

  // An empty "acls" list: Tailscale's documentation gives this form for deny-all;
  // omitting the section is documented as allow-all.
  "acls": [],

  // No "ssh" section: no Tailscale SSH session is allowed anywhere.

  "tests": [
    {
      "src":    "you@example.com",
      // "accept": ["100.x.y.2:445"],  one line like this for each thing that must work.
      "deny":   ["100.x.y.3:22", "100.x.y.3:445", "100.x.y.3:3389"], // a device that must refuse these
    },
  ],
}</code></pre></div>
<p>మీ tailnet లోని users కి file shares అందించాల్సిన, అంతకు మించి ఏమీ చేయని NAS కోసం grant ఇలా ఉంటుంది (port ఒక ఉదాహరణ; అది అందించాల్సిన ప్రతి ఇతర service కోసం ఒక <code>tcp:</code> entry ని చేర్చండి; <code>nas</code> అనేది policy యొక్క <code>hosts</code> section లో మీరు నిర్వచించే పేరు, ఉదాహరణకు <code>"hosts": {"nas": "100.x.y.2"}</code>):</p>
<div class="sf-box" data-mode="file" data-where="NAS కోసం ఉదాహరణ grant" data-how="ఇది ఒక ఉదాహరణ: paste చేసే ముందు దాన్ని మీ అవసరానికి మార్చుకోండి"><pre><code>{"src": ["autogroup:member"], "dst": ["nas"], "ip": ["tcp:445"]},</code></pre></div>
<p>గమనికలు:</p>
<ul>
<li><code>autogroup:internet</code> కి access ఉన్న devices మాత్రమే exit nodes ని వాడగలవు; అందుకే grant 1 అలా రాసి ఉంది.</li>
<li>Tests rules ని check చేస్తాయి, network ని కాదు: test pass అయినంత మాత్రాన device స్పందిస్తుందని రుజువు కాదు.</li>
<li><strong><code>"acls": []</code> ఎందుకు ఉంచాలి.</strong> <code>acls</code> section ని వదిలేస్తే అది default allow-all policy తో సమానమని Tailscale documentation చెబుతుంది, దాని deny-all ఉదాహరణ <code>"acls": []</code>. Grants ఉన్న policy లో వదిలేయడానికి అర్థం ఏమిటో అది చెప్పదు. ఖాళీ list ని ఉంచి tests నిర్ణయించనివ్వండి: allow-all తెరిచే port కోసం deny test, allow-all అమలులో ఉన్నంత వరకు fail అవుతుంది.</li>
<li>Save చేసే ముందు పాత policy కాపీ ఉంచుకోండి (కింద &#8220;మీరు Tailscale SSH వాడకపోతే: అన్ని చోట్లా off చేయండి&#8221; లోని 1వ step ఇది చేస్తుంది). Configuration logs page నుంచి ఒక మార్పును revert చేయడానికి కూడా Tailscale అనుమతిస్తుంది.</li>
</ul>
</details>
<details>
<summary>లోతుగా: నేను మళ్ళీ వాడే పద్ధతి</summary>
<p>Attack కి ఏం కావాలో list చేయండి; ప్రతి అంశాన్ని మీ సొంత devices మీద check చేసి, ఎలా చేశారో రాసుకోండి; attack వర్తించని చోట కూడా ఏది తప్పుగా ఉందో వెతకండి; మిగిలిన వాటిని ఏం మార్చాలి, ఏం గమనించాలి, ఏ risk ని అంగీకరించాలి అని విభజించండి.</p>
</details>
<h2>ఆ తర్వాత, మీరు కనుగొన్నదాన్ని మార్చండి</h2>
<h3>మీరు Tailscale SSH వాడకపోతే: అన్ని చోట్లా off చేయండి</h3>
<p><strong>మొదలుపెట్టే ముందు:</strong> ఇది మీ policy ని మారుస్తుంది, తద్వారా ఏ device కూడా Tailscale SSH session ని అంగీకరించదు. ఏదైనా machine లోకి Tailscale SSH ఒక్కటే మీ దారి అయితే దీన్ని చేయకండి. సుమారు మూడు నిమిషాలు పడుతుంది. Undo చేయడానికి, saved copy ని తిరిగి paste చేసి (1వ step) save చేయండి, లేదా Configuration logs page నుంచి ఆ మార్పును revert చేయండి.</p>
<ol>
<li><strong>Policy కాపీ save చేయండి.</strong> <strong>JSON editor</strong> లో text లోపల click చేసి Ctrl+A (Mac లో Cmd+A) నొక్కి, ఆ తర్వాత Ctrl+C (Cmd+C) నొక్కండి. Notepad (Start menu → <code>notepad</code> అని టైప్ చేయండి → Enter) లేదా Mac లో TextEdit (ముందు Format → Make Plain Text) తెరిచి, Ctrl+V (Cmd+V) తో paste చేసి, ఫైల్ ని మీ Documents folder లో <code>policy-backup.json</code> గా save చేయండి. File లో మొత్తం policy ఉండాలి, అది <code>{</code> తో మొదలవుతుంది.</li>
<li><strong><code>ssh</code> section ని delete చేయండి.</strong> Console కి తిరిగి వచ్చి, <code>"ssh": [</code> నుంచి దాని కింద వరుసలో ఉన్న <code>]</code> వరకు (rule లోపలి <code>]</code> కాదు), దాని తర్వాత comma ఉంటే దానితో సహా, అన్నీ select చేసి Delete నొక్కండి. Policy file ఒక అదనపు comma ని అనుమతిస్తుంది. మిగిలిన sections ని ఉన్నట్లే వదిలేయండి.</li>
<li><strong>Save.</strong> <strong>Save</strong> ని click చేయండి. మార్పును అమలు చేసే ముందు Tailscale policy ని, దానిలోని tests ని check చేస్తుంది. Save అయిందని console నిర్ధారించడం కనిపించాలి. Syntax error అని చెబితే, ఏదో comma లేదా bracket చోటు తప్పింది: saved copy ని తిరిగి paste చేసి 2వ step నుంచి మళ్ళీ చేయండి. అది ఒక <code>sshTests</code> entry ని పేర్కొంటే, ఆ test ని కూడా delete చేయండి.</li>
<li><strong>Check.</strong> Page ని reload చేసి, Ctrl+F (Cmd+F) నొక్కి <code>"ssh"</code> కోసం వెతకండి. Match ఉండకూడదు. Opt in అయిన device మీద మీరు <code>tailscale set --ssh=false</code> నడిపే వరకు అది server ని నడుపుతూనే ఉంటుంది.</li>
</ol>
<h3>మీరు Tailscale SSH వాడితే: update చేసి, ఆ తర్వాత rule ని కుదించండి</h3>
<p><strong>మొదలుపెట్టే ముందు:</strong> update చేస్తే ఆ device మీద తెరిచి ఉన్న ప్రతి Tailscale SSH session ముగుస్తుంది. Tailscale SSH session నుంచి update ని నడపకండి. లోపలికి వేరే దారి వాడండి: machine కి keyboard, screen కలిపి, లేదా మీ local network లో సాధారణ <code>ssh</code> login. Device యొక్క Tailscale address (100.…) కి చేసిన <code>ssh</code> login కూడా Tailscale restart అయినప్పుడు తెగిపోతుంది, update మధ్యలో తెగిపోతే install కి అంతరాయం కలగవచ్చు. కింది commands Tailscale యొక్క సొంత package repository ఉన్న Debian, Ubuntu, Raspberry Pi OS కోసం. ఇతర systems కోసం, Tailscale యొక్క <a href="https://tailscale.com/docs/features/client/update">update చేయడం గురించిన page</a> చూడండి.</p>
<ol>
<li><strong>వేరే దారిలో device లోకి login అవ్వండి</strong>, దానిపై terminal తెరవండి. దాని shell prompt కనిపించాలి.</li>
<li><strong>అది ఏ version నడుపుతోందో చూడండి.</strong></li>
</ol>
<div class="sf-box" data-mode="one" data-shell="sh" data-effect="read" data-effect-text="చూడటం మాత్రమే — ప్రయత్నించడం సురక్షితం" data-where="Device మీద terminal" data-how="1 command — దాన్ని paste చేసి, ఆ తర్వాత Enter నొక్కండి"><pre><code>tailscale version</code></pre></div>
<p class="sf-after">మొదటి line version number. 1.104.4 లేదా ఆ తర్వాతి దాంట్లో fixes ఉన్నాయి. అంతకంటే తక్కువైతే update కావాలి.</p>
<ol start="3">
<li><strong>Update.</strong> <code>sudo</code> ఒక command ని administrator గా నడుపుతుంది, మీ password అడగవచ్చు; టైప్ చేస్తున్నప్పుడు ఏదీ కనిపించదు, కాబట్టి టైప్ చేసి Enter నొక్కండి.</li>
</ol>
<div class="sf-box" data-mode="each" data-shell="sh" data-effect="change" data-effect-text="మీ system ని మారుస్తుంది" data-where="Device మీద terminal" data-how="2 commands — ఒక్కొక్కటిగా, వరుస క్రమంలో నడపండి; ఆ line ని copy చేయడానికి $ ని click చేయండి"><pre><code>sudo apt update
sudo apt install --only-upgrade tailscale</code></pre></div>
<p class="sf-after">ప్రతిదానికి ఒక నిమిషం లోపు పడుతుంది. Tailscale కొన్ని సెకన్ల పాటు restart అవుతుంది. Update మధ్యలో ఆగిపోతే, <code>sudo dpkg --configure -a</code> దాన్ని పూర్తి చేస్తుంది. tailscale ఇప్పటికే newest version అని <code>apt</code> చెబితే, ఆ device లో fix ఉంది, లేదా అది Tailscale ని Tailscale repository నుంచి తీసుకోలేదు.</p>
<ol start="4">
<li><code>tailscale version</code> తో <strong>మళ్ళీ check చేయండి.</strong> మొదటి line లో 1.104.4 లేదా ఆ తర్వాతిది ఉండాలి.</li>
<li><strong>Rule ని కుదించండి.</strong> మీరు ఏదైనా host లో, ఉదాహరణకు Proxmox server లో, root గా login అవుతుంటే, లేదా <code>sudo</code> ఉన్న మరో account లేని host లో, ఇది ఆ access ని తొలగిస్తుంది: ముందు check చేయండి. Edit చేసే ముందు policy కాపీ save చేయండి (&#8220;మీరు Tailscale SSH వాడకపోతే: అన్ని చోట్లా off చేయండి&#8221; లోని 1వ step). ఆ తర్వాత console లో <strong>Access controls</strong>, <strong>JSON editor</strong> కి వెళ్ళి, మీ <code>ssh</code> rule లోని <code>"users"</code> line ని కనుగొని, దాని నుంచి <code>, "root"</code> ని delete చేయండి:</li>
</ol>
<div class="sf-box" data-mode="output" data-where="ముందు" data-how="దీన్ని మీరు టైప్ చేయరు"><pre><code>"users":  ["autogroup:nonroot", "root"]</code></pre></div>
<div class="sf-box" data-mode="output" data-where="తర్వాత" data-how="దీన్ని మీరు టైప్ చేయరు"><pre><code>"users":  ["autogroup:nonroot"]</code></pre></div>
<p class="sf-after"><strong>Save</strong> ని click చేయండి. ఇప్పుడు rule root sessions ని ఇవ్వదు; login అయిన తర్వాత <code>sudo</code> వాడండి. మీ account కి password లేని <code>sudo</code> ఉన్న host లో, ఇది attacker ని నెమ్మదింపజేస్తుంది, ఆపదు. ఇది update కి ప్రత్యామ్నాయం కాదు: జూలై bulletin TS-2026-009 <code>autogroup:nonroot</code> ని దాటే మార్గం. అలాగే <code>src</code>, <code>dst</code> లను SSH అవసరమైన వ్యక్తులకు, devices కు పరిమితం చేయండి.</p>
<details>
<summary>Stopgap: update చేయలేని device మీద SSH forwarding ని off చేయండి</summary>
<p>మీరు వాడే package source ఇంకా 1.104.4 లేదా ఆ తర్వాతిది ఇవ్వని చోట మాత్రమే దీన్ని వాడండి. Forwarding లోపానికి Tailscale సూచించే mitigation, Tailscale service యొక్క environment లో <code>TS_SSH_DISABLE_FORWARDING=1</code> setting. Debian-style installs లో service <code>/etc/default/tailscaled</code> ని చదువుతుంది (Tailscale source లోని <code>tailscaled.service</code> file దాన్ని <code>EnvironmentFile</code> గా పేర్కొంటుంది). కింది commands ని ఆ file కాపీల మీద test చేశాను, నడుస్తున్న Tailscale service మీద కాదు. Restart వల్ల తెరిచి ఉన్న Tailscale SSH sessions ముగుస్తాయి, కాబట్టి వీటిని లోపలికి వేరే దారి నుంచి నడపండి. ఈ commands systemd ఉందని ఊహిస్తాయి.</p>
<ol>
<li><strong>File ని back up చేయండి.</strong> Command <code>No such file or directory</code> అని చెబితే, ఈ device ఆ setting ని వేరే చోట ఉంచుతుంది; ఆగి, మీ install కోసం Tailscale page ని చదవండి. ఒక్కసారే నడపండి: రెండోసారి నడిపితే backup, edit చేసిన file తో మారిపోతుంది.</li>
</ol>
<div class="sf-box" data-mode="one" data-shell="sh" data-effect="change" data-effect-text="మీ system ని మారుస్తుంది" data-where="Device మీద terminal, లోపలికి వేరే దారి నుంచి" data-how="1 command — దాన్ని paste చేసి, ఆ తర్వాత Enter నొక్కండి"><pre><code>sudo cp /etc/default/tailscaled /etc/default/tailscaled.bak</code></pre></div>
<ol start="2">
<li><strong>Setting ని చేర్చండి.</strong> File లోని చివరి line తో కలిసిపోకుండా ఉండటానికి ఈ line ఒక ఖాళీ line తో మొదలవుతుంది.</li>
</ol>
<div class="sf-box" data-mode="one" data-shell="sh" data-effect="change" data-effect-text="మీ system ని మారుస్తుంది" data-where="Device మీద terminal" data-how="1 command — దాన్ని paste చేసి, ఆ తర్వాత Enter నొక్కండి"><pre><code>printf '\nTS_SSH_DISABLE_FORWARDING=1\n' | sudo tee -a /etc/default/tailscaled</code></pre></div>
<p class="sf-after">ఇది చేర్చినదాన్ని print చేస్తుంది. ఒక్కసారే నడపండి: రెండోసారి నడిపితే line రెండుసార్లు చేరుతుంది.</p>
<ol start="3">
<li><strong>Service ని restart చేయండి.</strong></li>
</ol>
<div class="sf-box" data-mode="one" data-shell="sh" data-effect="change" data-effect-text="మీ system ని మారుస్తుంది" data-where="Device మీద terminal" data-how="1 command — దాన్ని paste చేసి, ఆ తర్వాత Enter నొక్కండి"><pre><code>sudo systemctl restart tailscaled</code></pre></div>
<ol start="4">
<li><strong>నడుస్తున్న service కి అది ఉందో check చేయండి.</strong></li>
</ol>
<div class="sf-box" data-mode="one" data-shell="sh" data-effect="read" data-effect-text="చూడటం మాత్రమే — ప్రయత్నించడం సురక్షితం" data-where="Device మీద terminal" data-how="1 command — దాన్ని paste చేసి, ఆ తర్వాత Enter నొక్కండి"><pre><code>sudo cat /proc/$(systemctl show -p MainPID --value tailscaled)/environ | tr '\0' '\n' | grep TS_SSH</code></pre></div>
<div class="sf-box" data-mode="output" data-where="మీకు కనిపించాల్సినది" data-how="దీన్ని మీరు టైప్ చేయరు"><pre><code>TS_SSH_DISABLE_FORWARDING=1</code></pre></div>
<p class="sf-after">Output లేకపోతే service ఆ setting ని తీసుకోలేదని అర్థం: ఆ line file లో ఉందో <code>grep TS_SSH /etc/default/tailscaled</code> తో check చేసి, ఆ తర్వాత 3వ step ని మళ్ళీ చేయండి. <code>/proc/0/environ: No such file or directory</code> అంటే service నడవడం లేదు.</p>
<ol start="5">
<li><strong>Undo చేయడానికి,</strong> ఆ line ని తొలగించి restart చేయండి. Device 1.104.4 లేదా ఆ తర్వాతిది నడిపినప్పుడు కూడా ఇలా చేయండి; ఆ setting ఒక stopgap. 1వ step తర్వాత package upgrade ఆ file ని మార్చేసినా, line ని తొలగించడం సురక్షితమే; backup ఒక record గా మిగులుతుంది. Upgrade, మీరు edit చేసిన file ని ఉంచాలా అని అడగవచ్చు:</li>
</ol>
<div class="sf-box" data-mode="each" data-shell="sh" data-effect="change" data-effect-text="మీ system ని మారుస్తుంది" data-where="Device మీద terminal" data-how="2 commands — ఒక్కొక్కటిగా, వరుస క్రమంలో నడపండి; ఆ line ని copy చేయడానికి $ ని click చేయండి"><pre><code>sudo sed -i '/^TS_SSH_DISABLE_FORWARDING=1$/d' /etc/default/tailscaled
sudo systemctl restart tailscaled</code></pre></div>
<p class="sf-after"><code>sed</code> file ని చదవలేనని చెబితే, ఈ device లో undo చేయాల్సింది ఏమీ లేదు.</p>
</details>
<h3>అందరికీ</h3>
<ol>
<li><strong>ఇక మీరు చూసుకోని devices ని,</strong> అవి మీ చేతుల్లోంచి వెళ్ళే ముందే, remove చేయండి. Tailscale ద్వారా మాత్రమే చేరగలిగే device ని remove చేయకండి: దాన్ని తిరిగి add చేయడానికి మీరు ఆ machine దగ్గర ఉండాలి. Console లో <strong>Machines</strong> ని తెరిచి, search bar లో పేరుతో device ని కనుగొని, దాని పక్కన menu ని తెరిచి, <strong>Remove</strong> ని, ఆ తర్వాత dialog లో <strong>Remove machine</strong> ని ఎంచుకోండి. Device list నుంచి మాయమవుతుంది. పొరపాటున ఒకదాన్ని remove చేస్తే, తిరిగి add చేయడానికి ఆ device ని మళ్ళీ sign in చేయండి; మీ tailnet కి device approval అవసరమైతే, admin approve చేయాలి.</li>
<li><strong>Allow-all ని మళ్ళీ చూడండి.</strong> <strong>Access controls</strong> లో <code>"acls"</code>, <code>"grants"</code> కోసం వెతకండి. Source <code>*</code> గా, destination <code>*</code> లేదా <code>*:*</code> గా ఉన్న rule allow-all: ప్రతి device ప్రతి ఇతర device ని ప్రతి port మీద చేరుకోవచ్చు. దాన్ని మార్చే steps కింద ఉన్నాయి.</li>
</ol>
<details>
<summary>Allow-all ని మార్చడం, step by step</summary>
<p><strong>మొదలుపెట్టే ముందు:</strong> ఇది మీ policy ని మారుస్తుంది, devices ని ఒకదాని నుంచి ఒకటి కట్ చేయవచ్చు. ఆ తర్వాత ప్రతి service ని test చేయగలిగినప్పుడు చేయండి. 15 నుంచి 30 నిమిషాలు పడుతుంది. Undo చేయడానికి, policy యొక్క saved copy ని తిరిగి paste చేసి (&#8220;మీరు Tailscale SSH వాడకపోతే: అన్ని చోట్లా off చేయండి&#8221; లోని 1వ step) save చేయండి, లేదా Configuration logs page నుంచి ఆ మార్పును revert చేయండి. మీ phone లేదా laptop exit node ని వాడితే, ప్రతి save తర్వాత దాని internet access ని test చేయండి: exit-node grant తప్పుగా ఉంటే అది తెగిపోతుంది.</p>
<ol>
<li><strong>మీ devices కి ఒకదాని నుంచి ఒకటి ఏం కావాలో రాసుకోండి:</strong> file shares, media server, subnet route, printer. కాగితం లేదా text file వాడండి.</li>
<li>పైన చెప్పినట్లు <strong>policy కాపీ save చేయండి.</strong></li>
<li><strong>ప్రతి అవసరానికి ఒక grant ని</strong> <code>"grants"</code> section లో చేర్చండి (section లేకపోతే చేర్చండి; allow-all <code>"acls"</code> లో ఉంది), పైన &#8220;ఒక ఉదాహరణ policy&#8221; లోని NAS ఉదాహరణ లాగా. ఆ పేరును మీరు నిర్వచించకపోతే <code>nas</code> బదులు NAS యొక్క Tailscale address (Machines page లో కనిపిస్తుంది) ని వాడండి. Exit nodes వాడితే వాటికి ఒక grant చేర్చండి.</li>
<li>అదే ఉదాహరణలో లాగా, <strong>పని చేయాల్సిన వాటికి tests చేర్చండి.</strong> <strong>Save</strong> ని click చేయండి. ఏదైనా test fail అయితే, Tailscale ఆ మార్పును తిరస్కరించి ఆ test పేరు చెబుతుంది.</li>
<li><strong>Allow-all rule ని delete చేయండి,</strong> కానీ <code>"acls"</code> section ని <code>"acls": []</code> గా ఉంచండి: deny-all కోసం Tailscale documentation ఆ రూపాన్ని ఇస్తుంది, section ని వదిలేస్తే అది allow-all తో సమానమని చెబుతుంది. పని చేయకూడని వాటికి tests చేర్చండి (వాటిని అంగీకరించకూడని device మీద ports 22, 445, 3389 వంటివి), మళ్ళీ <strong>Save</strong> ని click చేయండి. Allow-all ఇంకా ఉన్నంత వరకు ఆ tests fail అవుతాయి, అందుకే వాటిని ఈ step లోనే చేర్చాలి.</li>
<li>ప్రతి service ని దాన్ని వాడే device నుంచి <strong>test చేయండి.</strong> ఏదైనా fail అయితే, దాని grant ని చేర్చండి, లేదా saved copy ని తిరిగి paste చేయండి.</li>
</ol>
</details>
<h2>స్థితి</h2>
<p>Version 1.104.4 ని 27 అక్టోబర్ 2026 (UTC) రోజు చివర్లో tag చేశారు; Tailscale changelog దానికి 28 అక్టోబర్ తేదీ ఇచ్చింది. 2 నవంబర్ 2026 న విడుదలైన version 1.104.5, Tailscale SSH connection stalls ని, restart hangs ని fix చేస్తుంది, approval గడువు ముగిసినప్పుడు check-mode sessions disconnect కాకుండా ఆపుతుంది; ప్రస్తుత release కి update చేయండి. 10 నవంబర్ 2026 న bulletins page (TS-2026-014 నుంచి TS-2026-017 వరకు, 26 అక్టోబర్ తేదీతో) లో CVE numbers కనిపించలేదు.</p>
<h2>ఇది ఎలా చేశాను</h2>
<p>ఈ checking ని Anthropic యొక్క AI model అయిన Claude తో కలిసి చేశాను. Replacement policy ని, దాని tests ని, ఈ post ని అది draft చేసింది. నా మొదటి draft ని Claude review చేసినప్పుడు default rule ఇప్పటికే root ని అనుమతిస్తుందని చూపింది. ఆ తర్వాత Claude దాన్ని Tailscale documentation తో check చేసింది; open-source code లో default policy లేదు.</p>
<details>
<summary>పదకోశం</summary>
<ul>
<li><strong>Tailscale:</strong> WireGuard మీద నిర్మించిన mesh VPN; sign-in, keys ని చూసుకునే hosted service తో.</li>
<li><strong>Tailnet:</strong> ఒక Tailscale account లోని devices సమూహం.</li>
<li><strong>Policy file:</strong> Tailnet యొక్క access rules, admin console లో edit చేస్తారు. <em>Grants</em> ఏ device ఏ device ని చేరుకోవచ్చో నిర్ణయిస్తాయి; <code>ssh</code> section ఎవరు Tailscale SSH sessions తెరవవచ్చో నిర్ణయిస్తుంది; <em>tests</em> rules మారినప్పుడల్లా వాటిని check చేస్తాయి.</li>
<li><strong>Allow-all:</strong> ప్రతి device ప్రతి ఇతర device ని ప్రతి port మీద చేరుకోనిచ్చే default <code>acls</code> rule.</li>
<li><strong>Tag:</strong> <code>tag:server</code> వంటి label; ఇది device కి user గుర్తింపు బదులు దాని సొంత గుర్తింపు ఇస్తుంది; tagged devices <code>autogroup:self</code> కిందకు రావు.</li>
<li><strong>autogroup:member / self / nonroot:</strong> Tailnet లోని ఏ user అయినా; user కి చెందిన devices (tagged వి కాదు); root తప్ప ఏ local account అయినా.</li>
<li><strong>Tailscale SSH:</strong> Tailscale service లో built-in గా ఉన్న SSH server; ఎవరు login కావచ్చో passwords లేదా keys బదులు policy file నుంచి నిర్ణయిస్తుంది.</li>
<li><strong>Check mode:</strong> Session మొదలవక ముందు user ని మళ్ళీ sign in చేయమని అడిగే <code>ssh</code> rule action; ఒక sign-in default గా 12 గంటలు ఉంటుంది.</li>
<li><strong>Exit node:</strong> ఇతర devices తమ internet traffic ని పంపగలిగే tailnet లోని device.</li>
<li><strong>root:</strong> Linux, macOS లోని administrator account; machine మీద ఏదైనా చేయగలదు.</li>
<li><strong>Subnet route:</strong> దాని వెనుక ఉన్న మొత్తం local network ని tailnet చేరుకునేలా చేసే device.</li>
<li><strong>Unix socket:</strong> ఒకే machine లోని programs ఒకదానితో ఒకటి మాట్లాడుకోవడానికి వాడే file లాంటి endpoint, ఉదాహరణకు Docker యొక్క control socket.</li>
<li><strong>Port forwarding (SSH లో):</strong> ఒక socket కి connection వంటి మరో connection ని SSH session ద్వారా మోసుకెళ్ళడం.</li>
<li><strong>Tailnet Lock:</strong> కొత్త device చేరే ముందు నమ్మదగిన devices దానిపై sign చేయాలని కోరే Tailscale feature.</li>
<li><strong>Foothold:</strong> Attacker ఇప్పటికే అదుపులో ఉంచుకున్న device; తదుపరి attacks దాని నుంచి మొదలవుతాయి.</li>
<li><strong>headscale:</strong> Tailscale hosted control server కి open-source ప్రత్యామ్నాయం.</li>
<li><strong>CVE:</strong> ఒక నిర్దిష్ట vulnerability కి public identifier.</li>
<li><strong>sudo:</strong> Command ని administrator గా నడిపే command prefix; password అడగవచ్చు.</li>
<li><strong>ssh:</strong> మరో machine లోకి login చేయించే command.</li>
</ul>
</details>
<h2>మూలాలు</h2>
<ul>
<li>Tailworm report, Cyberdione Labs (24 అక్టోబర్ 2026, Tailscale ఇచ్చే తేదీ; report లో &#8220;2026-10&#8221; మాత్రమే కనిపిస్తుంది): <a href="https://tailworm.com/">https://tailworm.com/</a></li>
<li>Tailscale, &#8220;Tailscale SSH: Findings and fixes&#8221;, 28 అక్టోబర్ 2026: <a href="https://tailscale.com/blog/tailscale-ssh-findings-fixes">https://tailscale.com/blog/tailscale-ssh-findings-fixes</a></li>
<li>Tailscale, &#8220;Tailscale SSH: Investigation&#8221;: <a href="https://tailscale.com/ssh-investigation-update">https://tailscale.com/ssh-investigation-update</a></li>
<li>Tailscale security bulletins, TS-2026-004, TS-2026-009, TS-2026-014 నుంచి TS-2026-017 వరకు (10 నవంబర్ 2026 న మళ్ళీ చదివాను): <a href="https://tailscale.com/security-bulletins">https://tailscale.com/security-bulletins</a></li>
<li>The Hacker News, &#8220;Unpatched Tailscale SSH Flaws Could Let a Hacked Device Reach Root on Other Servers&#8221;, 25 అక్టోబర్ 2026: <a href="https://thehackernews.com/2026/10/unpatched-tailscale-ssh-flaws-could-let.html">https://thehackernews.com/2026/10/unpatched-tailscale-ssh-flaws-could-let.html</a></li>
<li>Tailscale docs, Tailscale SSH (check mode, disable చేయడం): <a href="https://tailscale.com/docs/features/tailscale-ssh">https://tailscale.com/docs/features/tailscale-ssh</a></li>
<li>Tailscale docs, default policy (&#8220;Allow all&#8221;): <a href="https://tailscale.com/docs/reference/examples/acls">https://tailscale.com/docs/reference/examples/acls</a></li>
<li>Tailscale docs, policy file syntax, tests: <a href="https://tailscale.com/docs/reference/syntax/policy-file">https://tailscale.com/docs/reference/syntax/policy-file</a></li>
<li>Tailscale docs, grants syntax: <a href="https://tailscale.com/docs/reference/syntax/grants">https://tailscale.com/docs/reference/syntax/grants</a></li>
<li>Tailscale docs, admin console లో devices ని filter చేయడం: <a href="https://tailscale.com/docs/features/access-control/device-management/how-to/filter">https://tailscale.com/docs/features/access-control/device-management/how-to/filter</a></li>
<li>Tailscale docs, device ని remove చేయడం: <a href="https://tailscale.com/docs/features/access-control/device-management/how-to/remove">https://tailscale.com/docs/features/access-control/device-management/how-to/remove</a></li>
<li>Tailscale docs, Tailscale ని update చేయడం: <a href="https://tailscale.com/docs/features/client/update">https://tailscale.com/docs/features/client/update</a></li>
<li>Tailscale docs, <code>tailscaled</code> service: <a href="https://tailscale.com/docs/reference/tailscaled">https://tailscale.com/docs/reference/tailscaled</a></li>
<li>Tailscale source code (SSH server, netstack, peer API, <code>tailscaled.service</code>), v1.104.4 tag: <a href="https://github.com/tailscale/tailscale">https://github.com/tailscale/tailscale</a></li>
</ul>
</div>
<div id="tw-panel-th" class="tw-panel" lang="th">
<h2 class="tw-ptitle">Policy แบบ default ของ Tailscale อนุญาต root SSH. Tailworm ทำให้ผมต้องอ่านมัน</h2>
<p class="tw-read">อ่าน 11 นาที</p>
<p class="tw-note">โค้ด คำสั่ง และศัพท์เทคนิคคงไว้เป็นภาษาอังกฤษ</p>
<div class="tw-box">
<p><strong>คุณได้รับผลกระทบหรือไม่?</strong> ข้อค้นพบด้าน SSH ของ Tailworm มีผลเฉพาะกับอุปกรณ์ที่รัน Tailscale SSH และอุปกรณ์จะรัน server นี้ก็ต่อเมื่อมีคนเปิด ด้วย <code>tailscale set --ssh</code> หรือด้วยสวิตช์ในแอปที่ครอบมันไว้ Windows, iPhone, Android, แอป Mac และอุปกรณ์ Synology กับ QNAP รัน server นี้ไม่ได้ เอกสารของ Tailscale ระบุว่า server นี้มีให้บน Linux และบน macOS เฉพาะรุ่น command-line แบบ open-source ส่วน source code ยัง build ให้ FreeBSD และ OpenBSD ด้วย ซอฟต์แวร์ NAS และ router บางตัวมีสวิตช์สำหรับมัน: หน้า Machines ใน admin console แสดงว่าอุปกรณ์ไหนรายงานว่ารัน server นี้ (ข้อ 2 ของการตรวจ) เวอร์ชัน 1.104.4 หรือใหม่กว่าแก้ช่องโหว่ที่โพสต์ของ Tailscale เองอธิบายไว้ ข้อค้นพบ 11 ข้อของรายงานบางข้อเกี่ยวกับ headscale หรือโค้ดที่ยังไม่ได้เผยแพร่ ถ้าอุปกรณ์เครื่องใดรัน server นี้ ให้อัปเดตเครื่องนั้น</p>
<p><strong>อีกเรื่องหนึ่ง:</strong> ถ้าคุณไม่เคยแก้ access controls ของ Tailscale เลย policy แบบ default ให้คุณเปิด session ของ Tailscale SSH <strong>ในฐานะ root</strong> (บัญชีผู้ดูแลระบบ) บนอุปกรณ์ของคุณเองเครื่องใดก็ได้ที่รัน server นี้ หลังจากล็อกอินซ้ำใน browser ใครก็ตามที่ยึดอุปกรณ์ของคุณเครื่องที่ไม่มี tag (tag คือป้ายชื่ออย่าง <code>tag:server</code> อุปกรณ์ที่บ้านส่วนใหญ่ไม่มี) อาจทำแบบเดียวกันได้ กฎ default ไม่ครอบคลุมอุปกรณ์ที่มี tag ถ้าไม่มีอุปกรณ์ใดรัน server นี้ กฎนั้นยังไม่มีเครื่องให้มีผลในตอนนี้ นี่เป็นงานดูแลความเรียบร้อย ไม่ใช่เหตุฉุกเฉิน การลบส่วน <code>ssh</code> ปิดช่องนี้ <a href="#five-minute-check-th">การตรวจ 5 นาที</a> ด้านล่างแสดงวิธีทำตามลำดับที่ปลอดภัย</p>
</div>
<p>access policy ที่ Tailscale เขียนให้ตอนผมสร้าง tailnet (เครือข่าย Tailscale ของผม) อนุญาตให้เปิด SSH session แบบ root บนอุปกรณ์ของผมเอง ผมไม่เคยเปิดดูมันเลย Claude ซึ่งเป็นโมเดล AI ชี้เรื่องนี้ให้เห็นในการตรวจร่างแรกของผมสำหรับโพสต์นี้ ระหว่างที่เราตรวจเครือข่ายของผมเทียบกับ Tailworm</p>
<p>Tailworm คือรายงานที่เผยแพร่ช่วงสุดสัปดาห์ของวันที่ 24 ตุลาคม 2026 มีข้อค้นพบ 11 ข้อใน Tailscale และ headscale ข้อที่ร้ายแรงที่สุดอยู่ใน SSH server ที่ติดมากับ Tailscale ในแล็บของนักวิจัย ผู้โจมตีที่ควบคุมอุปกรณ์หนึ่งเครื่องได้สิทธิ์ root บนเครื่องอื่นที่รัน Tailscale SSH ภายใต้กฎที่อนุญาตให้อุปกรณ์นั้นเข้ามา ตอนที่รายงานออก Tailscale ยังไม่ได้ปล่อยการแก้ไข</p>
<p>ด้านล่างคือการตรวจ 5 นาทีสำหรับ tailnet ของคุณเอง ส่วนสิ่งที่การโจมตีต้องใช้ และสิ่งที่ผมพบ อยู่ถัดจากนั้น</p>
<details class="sf-legend"><summary><strong>เพิ่งเริ่มใช้ command line? วิธีอ่านกล่องคำสั่ง</strong></summary>
<p><strong>PS&gt;</strong> หมายถึง: พิมพ์ใน <em>PowerShell</em> บน Windows (เมนู Start → พิมพ์ <code>powershell</code> → Enter) <strong>$</strong> หมายถึง: พิมพ์ใน terminal บน Linux หรือ Mac หรือบนเครื่องระยะไกลหลังจากที่คุณล็อกอินด้วย <code>ssh</code> (คำสั่งที่ใช้ล็อกอินเข้าเครื่องอื่น) อย่าพิมพ์ <strong>$</strong> หรือ <strong>PS&gt;</strong> เอง</p>
<p>แต่ละบรรทัดที่ขึ้นต้นด้วย <strong>$</strong> หรือ <strong>PS&gt;</strong> คือคำสั่งหนึ่งคำสั่ง คลิกที่ <strong>$</strong> เพื่อคัดลอกเฉพาะบรรทัดนั้น วางลงไป กด <strong>Enter</strong> และรอให้ทำงานเสร็จก่อนจะไปคำสั่งถัดไป กล่องที่มีปุ่ม <strong>Copy</strong> อยู่ด้านบนเก็บคำสั่งเดียว (หรือไฟล์เดียว) จึงต้องคัดลอกทั้งกล่อง กล่องเส้นประแสดงสิ่งที่คุณควรเห็นตอบกลับมา คุณไม่ต้องพิมพ์มัน</p>
</details>

<h2 id="five-minute-check-th">ตรวจ tailnet ของคุณเองใน 5 นาที</h2>

<p><strong>ก่อนเริ่ม</strong></p>
<ul>
<li><strong>สิ่งที่ต้องมี:</strong> คอมพิวเตอร์ (ขั้นตอนเหล่านี้ทำบนโทรศัพท์ได้ยาก), browser และบัญชีที่ล็อกอินเข้า tailnet ของคุณได้ด้วย role Owner หรือ Admin (role Network admin ลบอุปกรณ์ไม่ได้ role IT admin แก้ policy ไม่ได้)</li>
<li><strong>ใช้เวลาเท่าไร และย้อนกลับอย่างไร:</strong> ประมาณ 5 นาทีสำหรับส่วน &#8220;ดู&#8221; ซึ่งไม่เปลี่ยนอะไร ทุกการเปลี่ยน policy เริ่มด้วยการเก็บสำเนา และทุกกล่องบอกว่าแค่ดูหรือเปลี่ยนอะไร</li>
</ul>
<h3>ดู: ไม่มีอะไรเปลี่ยน</h3>
<ol>
<li><strong>เปิด admin console</strong> เปิด web browser ไปที่ <code>console.tailscale.com/admin/machines</code> และล็อกอินด้วยบัญชีที่เป็นเจ้าของ tailnet ของคุณ ขั้นนี้แค่เปิดหน้าเว็บ ใช้เวลาประมาณ 1 นาที คุณควรเห็นตารางอุปกรณ์ของคุณ ถ้าเปิดหน้านี้ไม่ได้ บัญชีของคุณอาจไม่มี role Owner หรือ Admin ให้ถามคนที่มี</li>
<li><strong>หาอุปกรณ์ที่รัน Tailscale SSH</strong> เหนือตาราง คลิก <strong>Filters</strong> เลือก <strong>Property</strong> แล้วเลือก <strong>Tailscale SSH</strong> ตารางจะเหลือเฉพาะอุปกรณ์ที่รายงานว่ารัน server นี้ ตารางว่างหมายความว่าไม่มีเครื่องไหนรัน ถ้าหา <strong>Filters</strong> ไม่เจอ ดู <a href="https://tailscale.com/docs/features/access-control/device-management/how-to/filter">หน้าว่าด้วยการกรองอุปกรณ์</a> ของ Tailscale</li>
<li><strong>ไม่บังคับ: ยืนยันบนอุปกรณ์หนึ่งเครื่อง</strong> กล่องที่พับอยู่ใต้รายการนี้แสดงวิธี บน Linux หรือบน Mac ที่ใช้ รุ่น command-line</li>
<li><strong>อ่าน policy ของคุณ</strong> ในเมนูด้านบนของ console คลิก <strong>Access controls</strong> ถ้าเปิดเป็น visual editor ให้สลับไปที่ <strong>JSON editor</strong> คลิกในข้อความ กด Ctrl+F (Cmd+F บน Mac) พิมพ์ <code>"ssh"</code> แล้วกด Enter ถ้าไม่พบ แสดงว่า policy ไม่มีกฎ SSH และคุณข้ามไปที่ &#8220;สำหรับทุกคน&#8221; ด้านล่างได้ ถ้าพบส่วนที่หน้าตาเหมือนกฎที่แสดงไว้ใต้หัวข้อ &#8220;Policy ที่ผมไม่เคยเขียน&#8221; ด้านล่าง แสดงว่า policy ของคุณอนุญาต root session บนอุปกรณ์ของคุณเอง ถ้าหน้าตาต่างไป ให้อ่านบรรทัด <code>"users"</code> ของมัน: ถ้ามี <code>root</code> อยู่ในนั้น แสดงว่าอนุญาต root session ถ้าข้อ 2 แสดงอุปกรณ์ ให้ไปที่ &#8220;ถ้าคุณใช้ Tailscale SSH&#8221; ด้านล่าง ถ้าตารางของข้อ 2 ว่าง ให้ไปที่ &#8220;ถ้าคุณไม่ใช้ Tailscale SSH&#8221;</li>
</ol>
<details>
<summary>ไม่บังคับ: ยืนยันบนอุปกรณ์หนึ่งเครื่อง (Linux หรือ Mac ที่ใช้รุ่น command-line)</summary>
<p>เปิด terminal: บน Mac กด Cmd+Space พิมพ์ <code>terminal</code> แล้วกด Enter บน Linux เปิดแอป terminal หรือล็อกอินเข้าเครื่องระยะไกลด้วย <code>ssh &lt;your-user&gt;@&lt;device-address&gt;</code> (<code>ssh</code> ใช้ได้ใน PowerShell บน Windows ด้วย) จากนั้นรันคำสั่งด้านล่าง <code>grep -i runssh</code> เก็บไว้เฉพาะบรรทัดที่มีคำว่า <code>RunSSH</code></p>
<div class="sf-box" data-mode="one" data-shell="sh" data-effect="read" data-effect-text="แค่ดูเท่านั้น — ลองได้อย่างปลอดภัย" data-where="Terminal บนอุปกรณ์" data-how="1 คำสั่ง — วางลงไป แล้วกด Enter"><pre><code>tailscale debug prefs | grep -i runssh</code></pre></div>
<p class="sf-after">ตอบกลับทันที</p>
<div class="sf-box" data-mode="output" data-where="สิ่งที่คุณควรเห็นถ้า server ปิดอยู่" data-how="คุณไม่ต้องพิมพ์ส่วนนี้"><pre><code>"RunSSH": false,</code></pre></div>
<p class="sf-after"><code>true</code> หมายความว่าอุปกรณ์รัน server นี้ ถ้าไม่มีอะไรแสดงออกมา หรือ shell ขึ้นว่า <code>tailscale: command not found</code> ให้ใช้ผลจากข้อ 2 แทน เพราะแอป Mac และ Windows รัน server นี้ไม่ได้</p>
</details>
<h2>สิ่งที่ Tailworm ต้องใช้</h2>
<p>ผมไล่รายการสิ่งที่การโจมตีนี้ต้องใช้ และตรวจทีละข้อเทียบกับระบบของผมเอง</p>
<p>อุปกรณ์ในบัญชี Tailscale เดียวกันรวมกันเป็น <em>tailnet</em> และ policy file ใน admin console เป็นตัวกำหนดว่าอุปกรณ์ไหนเข้าถึงอุปกรณ์ไหนได้</p>
<p>Tailscale SSH คือ SSH server ที่อยู่ภายใน service ของ Tailscale เริ่มทำงานบนอุปกรณ์ด้วย <code>tailscale set --ssh</code> ตัวที่กำหนดว่าใครล็อกอินได้ และในฐานะบัญชีไหนในเครื่อง คือ policy file ไม่ใช่รหัสผ่านหรือ key ตามรายงาน เมื่อ session แบบนี้ทำ forwarding ของ Unix socket (จุดเชื่อมต่อที่มีลักษณะคล้ายไฟล์ ซึ่งโปรแกรมบนเครื่องเดียวกันใช้คุยกัน) service ของ Tailscale ทำงานนั้นด้วยสิทธิ์ของ root และช่องว่างระหว่างการตรวจกับการใช้ socket ทำให้ผ่านการตรวจที่มีไว้จำกัดมันไปได้ session ที่ได้รับอนุญาตให้เข้ามาในฐานะ user ธรรมดาจึงทำงานในฐานะ root ได้</p>
<p>การโจมตีผ่าน SSH ต้องมีสามอย่าง:</p>
<ol>
<li>อุปกรณ์เป้าหมายที่รัน Tailscale SSH</li>
<li>กฎใน policy file ที่ให้อุปกรณ์ของผู้โจมตีเปิด SSH session บนเป้าหมายนั้นได้ โดยอนุญาต forwarding ด้วย</li>
<li>ผู้โจมตีที่ควบคุมอุปกรณ์ที่กฎนั้นครอบคลุมอยู่แล้ว</li>
</ol>
<p>Tailworm ไม่ได้ให้ข้อที่สาม ผู้โจมตีต้องหามาเอง: web application ที่มีช่องโหว่, package ที่เป็นอันตราย, phishing, รหัสผ่านที่ถูกขโมย นี่ไม่ใช่การโจมตีที่มาจาก internet สาธารณะ</p>
<h2>สิ่งที่ผมพบ</h2>
<div class="tw-tablewrap"><table>
<thead>
<tr>
<th>สิ่งที่การโจมตีต้องใช้</th>
<th>สิ่งที่ผมพบ</th>
<th>ตรวจที่ไหนบนระบบของคุณ</th>
</tr>
</thead>
<tbody>
<tr>
<td>Tailscale SSH รันอยู่บนเป้าหมาย</td>
<td>ตอนที่ผมตรวจ ไม่ได้รันบนอุปกรณ์เครื่องใดของผมเลย</td>
<td>หน้า Machines ใน admin console กรองด้วย property &#8220;Tailscale SSH&#8221; (ข้อ 2 ของการตรวจ)</td>
</tr>
<tr>
<td>กฎใน policy ที่อนุญาต SSH session</td>
<td>มี: กฎ default ซึ่งให้เข้าได้ทั้งแบบ root และบัญชีธรรมดา บนอุปกรณ์ของผมเอง หลังล็อกอินซ้ำ</td>
<td>policy file (ข้อ 4 ของการตรวจ)</td>
</tr>
<tr>
<td>foothold บนอุปกรณ์ที่กฎครอบคลุม</td>
<td>เป็นไปได้ เหมือนเครือข่ายทั่วไป</td>
<td>—</td>
</tr>
<tr>
<td>ข้อค้นพบอื่น ๆ</td>
<td>ใช้กับฟีเจอร์ที่เกี่ยวข้อง: app connector, <code>tailscale serve</code>, การเชื่อมต่อ relay ที่ client ทุกตัวทำ และ headscale (ตัวแทนแบบ open-source ของ control server แบบ hosted ของ Tailscale)</td>
<td>admin console</td>
</tr>
</tbody>
</table></div>
<p>ดังนั้น สิ่งแรกที่การโจมตีต้องใช้จึงไม่มีอยู่ ส่วนสิ่งที่สอง คือกฎที่อนุญาต session มีอยู่แล้วโดย default เอกสารของ Tailscale ไม่ได้บอกว่ากฎ default อนุญาต forwarding หรือไม่ ซึ่งเป็นสิ่งที่การโจมตีผ่าน socket ต้องใช้</p>
<details>
<summary>เจาะลึก: วิธีตรวจแต่ละข้อแบบอื่น</summary>
<ul>
<li><strong>ถ้าคุณใช้ OPNsense</strong> plugin Tailscale เก็บค่าตั้งไว้หลัง API การเรียกแบบอ่านอย่างเดียว <code>GET /api/tailscale/settings/get</code> คืนค่า <code>"enableSSH":"0"</code> เมื่อ SSH server ปิดอยู่ เอกสารของ Tailscale ระบุ SSH server เฉพาะ Linux และ macOS แต่ source code ของ Tailscale build server นี้สำหรับ FreeBSD และ OpenBSD ด้วย และ plugin ของ OPNsense มีสวิตช์สำหรับมัน</li>
<li><strong>ทุกอุปกรณ์</strong> ใน admin console: Machines → Filters → Property → Tailscale SSH ถ้าไม่มีอุปกรณ์ใดตรงเงื่อนไข แสดงว่าไม่มีเครื่องไหนรายงานว่ารัน server นี้</li>
<li><strong>อุปกรณ์ Linux ตรวจจากภายในเครื่อง</strong> สวิตช์ <code>--ssh</code> ตั้งค่า preference ชื่อ <code>RunSSH</code> คำสั่ง <code>tailscale debug prefs | grep -i runssh</code> แสดง <code>"RunSSH": false</code> เมื่อ server ปิดอยู่ ส่วน <code>tailscale set --ssh=false</code> ใช้ปิดมัน</li>
<li><strong>เวอร์ชัน</strong> รายงานทดสอบ 1.104.2 และไม่ได้พูดถึงเวอร์ชันก่อนหน้า การแก้ไขของ Tailscale อยู่ใน 1.104.4</li>
</ul>
</details>
<details>
<summary>เจาะลึก: รายงานพบอะไร และ Tailscale ว่าอย่างไร</summary>
<ul>
<li><strong>สิ่งที่ทดสอบ</strong> Tailscale 1.104.2 และ headscale 0.29.5 (ตัวแทนแบบ open-source ของ control server แบบ hosted ของ Tailscale) โดยไม่ได้ดัดแปลง ในแล็บ ระหว่างวันที่ 22 ถึง 24 ตุลาคม 2026</li>
<li><strong>ข้อค้นพบที่ 1 ถึง 3: SSH socket forwarding</strong> การ forwarding ของ Unix socket ทั้งแบบ local และ remote (<code>ssh -L</code> และ <code>ssh -R</code>) ทำโดย service ของ Tailscale ที่รันด้วยสิทธิ์ root การตรวจ path ทำในจังหวะหนึ่ง แต่ใช้ socket ในอีกจังหวะหนึ่ง และ loop ที่วนเร็วภายใน session แย่งใช้ช่องว่างนั้นได้ก่อน (race) ในแล็บ วิธีนี้ได้ root ผ่าน Docker socket, แทนที่ socket ที่ root เป็นเจ้าของด้วย socket ของผู้โจมตีเอง และดักจับ key ที่ใช้ลงทะเบียนอุปกรณ์ใหม่ ซึ่งหลังจากนั้นพาเครื่องของผู้โจมตีเข้าร่วมเครือข่าย รายงานแสดงขั้นสุดท้ายนี้ตั้งแต่ต้นจนจบเฉพาะเมื่อ Tailnet Lock ปิดอยู่ เมื่อ Tailnet Lock เปิดอยู่ รายงานดักจับข้อมูลที่ต้องใช้เพื่อปิด lock ได้ แต่ไม่ได้นำไปใช้</li>
<li><strong>ข้อค้นพบที่ 5: SSH ทำให้หน่วยความจำหมด</strong> session ที่ล็อกอินแล้วทำให้ service ของ Tailscale ที่รันด้วยสิทธิ์ root จองหน่วยความจำเพิ่มไปเรื่อย ๆ ได้</li>
<li><strong>สิ่งที่ Tailscale บอก</strong> Tailscale บอกว่าปัญหาเหล่านี้ &#8220;require urgent attention&#8221; (ต้องได้รับความสนใจโดยเร่งด่วน) และช่องโหว่ SSH &#8220;primarily concerned how permissions were enforced&#8221; (เกี่ยวกับวิธีบังคับใช้สิทธิ์เป็นหลัก) หลังจากที่การเชื่อมต่อได้รับอนุญาตแล้ว Tailscale โต้แย้งว่าปัญหาเหล่านี้ถือเป็น worm ไม่ได้ และเรียกสิ่งนี้ว่าการเคลื่อนที่ไปยังเครื่องอื่น (lateral movement) ที่จำกัดอยู่แค่การเชื่อมต่อที่ policy อนุญาตอยู่แล้ว</li>
<li><strong>Wormability</strong> ในแล็บ อุปกรณ์ที่ถูกเจาะหนึ่งเครื่องเข้าถึงทุกอุปกรณ์ที่ policy อนุญาต ใช้เวลาไม่ถึงหนึ่งวินาทีต่อขั้น รายงานระบุมาตรการหนึ่งที่หยุดการแพร่ได้ คือกฎที่เขียนแบบต้นทางหนึ่งไปปลายทางหนึ่ง key ที่เก็บในฮาร์ดแวร์ (TPM หรือ Secure Enclave) ป้องกันไม่ให้ตัวตนของอุปกรณ์ที่ถูกขโมยใช้ได้ต่อไป</li>
<li><strong>ข้อค้นพบอื่น ๆ บางข้อ</strong> การออกแบบ app connector ที่ไม่ตรวจว่า traffic กำลังไปที่ไหน (Tailscale บอกว่าเวอร์ชันนี้ คือ Conn25 ยังไม่ได้เผยแพร่); <code>tailscale serve</code> ที่ forward ไปยัง control socket ของ service เอง; หน่วยความจำหมดใน relay client (ผมไม่พบ bulletin สำหรับข้อนี้); และ denial of service ต่อ headscale</li>
<li><strong>Bulletin</strong> Tailscale เผยแพร่สี่ฉบับ ลงวันที่ 26 ตุลาคม ทั้งหมดแก้แล้วใน 1.104.4: TS-2026-014 (SSH socket forwarding ตอนนี้ Tailscale ทำ forwarding ในฐานะ user ที่ล็อกอิน ไม่ใช่ในฐานะ root), TS-2026-015 (SSH ทำให้หน่วยความจำหมด), TS-2026-016 (<code>tailscale serve</code> เข้าถึง socket ที่มีสิทธิ์สูง) และ TS-2026-017 (Serve ผ่าน HTTP/2 อาจส่งค่า <code>Tailscale-App-Capabilities</code> ของ mount หนึ่งไปให้อีก mount หนึ่งบน node เดียวกัน) ระหว่างที่อุปกรณ์ยังไม่ได้อัปเดต มาตรการบรรเทาของ Tailscale สำหรับช่องโหว่ด้าน forwarding คือ <code>TS_SSH_DISABLE_FORWARDING=1</code> ใน environment ของ service Tailscale ส่วนมาตรการชั่วคราวใต้หัวข้อ &#8220;จากนั้นเปลี่ยนสิ่งที่คุณพบ&#8221; ด้านล่างแสดงวิธีทำ</li>
<li><strong>การแก้ไขก่อนหน้านี้ในส่วนเดียวกัน</strong> bulletin ของเดือนมิถุนายนและกรกฎาคมครอบคลุมเรื่อง SSH socket forwarding ที่ไม่เคารพสิทธิ์ของ symlink (TS-2026-004, 3 มิถุนายน) และวิธีเลี่ยง <code>autogroup:nonroot</code> (TS-2026-009, 13 กรกฎาคม) ไว้แล้ว ทั้งสองข้อแก้แล้วใน 1.98.9</li>
<li><strong>Forwarding กับกฎ default</strong> SSH server ของ Tailscale จะทำ forwarding เฉพาะเมื่อกฎที่ตรงกันมีสิทธิ์ forwarding ที่ได้มาจาก coordination server ของ Tailscale (<code>allowLocalPortForwarding</code> และ <code>allowRemotePortForwarding</code> ใน source code) เอกสารสาธารณะของ Tailscale ไม่ได้บอกว่า policy ให้สิทธิ์นี้อย่างไร หรือกฎ default ให้สิทธิ์นี้หรือไม่ รายงานบอกให้ตั้ง field ของ forwarding รายกฎเป็น false บน hosted service ของ Tailscale แต่ไม่ได้ระบุชื่อ field เหล่านั้น ผมหา field เหล่านั้นในเอกสาร policy ของ Tailscale ไม่พบ Bulletin TS-2026-014 ระบุว่าปัญหานี้กระทบผู้ใช้ที่ &#8220;allow local or remote forwarding in their access policies&#8221; (อนุญาต local หรือ remote forwarding ใน access policy ของตน)</li>
<li><strong>การเปิดเผยข้อมูล</strong> Tailscale บอกว่าได้รับรายงานในเช้าวันเสาร์ที่ 24 ตุลาคม และรายงานถูกเผยแพร่สองชั่วโมงหลังจากนั้น ขณะนั้น Tailscale กำลังสืบสวนปัญหาที่เกี่ยวข้องอยู่แล้ว The Hacker News รายงานว่านักวิจัยอธิบายเรื่องนี้ว่า &#8220;reported but not coordinated&#8221; (แจ้งแล้วแต่ไม่ได้ประสานงาน)</li>
</ul>
</details>
<h2>Policy ที่ผมไม่เคยเขียน</h2>
<p>เมื่อคุณสร้าง tailnet Tailscale จะให้ policy แบบ default มาด้วย เอกสารของ Tailscale อธิบายไว้ว่า ทุกอุปกรณ์เข้าถึงอุปกรณ์อื่นได้ทุกเครื่องทุก port (ข้างล่างผมเรียกส่วนนี้ว่า allow-all) และผู้ใช้ทุกคนเปิด session ของ Tailscale SSH บนอุปกรณ์ของตัวเองได้ใน check mode ในฐานะ root หรือ user ธรรมดา ส่วน SSH มีหน้าตาแบบนี้:</p>
<div class="sf-box" data-mode="output" data-where="กฎ ssh แบบ default ตามที่ปรากฏใน policy file" data-how="คุณไม่ต้องพิมพ์ส่วนนี้"><pre><code>"ssh": [
  {
    "action": "check",
    "src":    ["autogroup:member"],
    "dst":    ["autogroup:self"],
    "users":  ["autogroup:nonroot", "root"]
  }
]</code></pre></div>
<p>ผู้ใช้คนใดก็ตามของ tailnet (<code>autogroup:member</code>) เชื่อมต่อกับอุปกรณ์ที่ผู้ใช้คนนั้นเป็นเจ้าของ (<code>autogroup:self</code> ไม่รวมอุปกรณ์ที่มี tag) ได้ในฐานะบัญชีในเครื่องบัญชีใดก็ได้ ยกเว้น root (<code>autogroup:nonroot</code>) หรือในฐานะ root ก็ได้ ของผมมีกฎนี้ และมี allow-all ร่วมด้วย หน้า policy file ของ Tailscale อธิบายกฎ <code>ssh</code> แบบ default ด้วย <code>autogroup:nonroot</code> และไม่ได้พูดถึง root ส่วนหน้า SSH และ policy ตัวอย่างของ Tailscale มี root ดังที่แสดงไว้ข้างบน</p>
<p>กฎนี้แยกผมออกจากคนที่ยึดอุปกรณ์เครื่องหนึ่งของผมไม่ได้ สำหรับ Tailscale การเชื่อมต่อจากอุปกรณ์ของผมเครื่องใดก็คือผม ถ้าอุปกรณ์ Linux เครื่องหนึ่งใน tailnet รัน <code>tailscale set --ssh</code> คนที่ยึดอุปกรณ์อีกเครื่องของผมได้ก็เปิด root session บนเครื่องนั้นได้ นั่นคือกฎที่ทำงานตามการออกแบบ ไม่ใช่ช่องโหว่ Check mode ขอให้ผมล็อกอินใน browser และการอนุมัติหนึ่งครั้งอาจมีผลอยู่ 12 ชั่วโมง (ดูข้างล่าง)</p>
<p>Check mode ขอให้ล็อกอินใหม่ใน browser ก่อนที่ session จะเริ่ม ด้วย check period แบบ default เอกสารของ Tailscale ระบุว่าการล็อกอินใน check mode หนึ่งครั้งทำให้คุณเข้าเครื่องนั้นและอุปกรณ์เครื่องอื่นใน tailnet ได้เป็นเวลา 12 ชั่วโมงโดยไม่ต้องล็อกอินอีก เอกสารไม่ได้บอกว่าครอบคลุม session ที่เปิดจากอุปกรณ์อีกเครื่องด้วยหรือไม่ รายงานอธิบายว่าผู้โจมตีที่อยู่บนอุปกรณ์เครื่องหนึ่งรอให้คุณอนุมัติครั้งถัดไป หรือกระตุ้นให้คุณอนุมัติได้ ดังนั้น check mode ทำให้ช้าลงแต่ไม่ได้หยุดการโจมตี</p>
<p>Tailworm ต้องอาศัย socket forwarding เพื่อเปลี่ยนบัญชีธรรมดาให้เป็น root กฎ default ไม่ต้องใช้ socket forwarding เลย ใช้เพียงการอนุมัติใน check mode นี่เป็นพฤติกรรมที่เอกสารระบุไว้ ไม่ใช่ช่องโหว่ การอัปเดตเป็น 1.104.4 ก็ไม่ได้เปลี่ยนเรื่องนี้ session ที่ได้รับอนุญาตให้เข้ามาในฐานะ root ก็คือ root ตามการออกแบบ</p>
<h2>สิ่งที่ผมเปลี่ยน</h2>
<p><strong>Policy</strong> ฉบับใหม่ไม่มีส่วน <code>ssh</code> เอกสารของ Tailscale ระบุว่าการลบกฎ SSH ทำให้ Tailscale SSH ถูกปิดทั้ง tailnet grant ใช้แทนที่ allow-all ได้ โดยให้เฉพาะสิ่งที่จำเป็น เช่น:</p>
<ol>
<li>Exit node ถ้าคุณใช้: สิทธิ์เข้าถึง <code>autogroup:internet</code></li>
<li>อุปกรณ์ไม่กี่เครื่องที่คุณต้องดูแล และไม่มีอะไรเกินนั้น ให้ grant นี้แคบไว้ อุปกรณ์ใดที่ grant ครอบคลุมจะยังเข้าถึงได้</li>
</ol>
<p>การแทนที่ allow-all มีต้นทุน: สิ่งที่พึ่งพาการที่อุปกรณ์เข้าถึงกันได้จะหยุดทำงาน เช่น การแชร์ไฟล์, media server หรือ subnet route ให้ grant แยกของแต่ละอย่างก่อน</p>
<p><strong>จากนั้นเป็น test</strong> policy file ใส่ test ได้ คือข้อความอย่างเช่น &#8220;ผู้ใช้คนนี้เข้าถึง port นี้ได้&#8221; ที่ Tailscale ตรวจทุกครั้งที่ไฟล์เปลี่ยน ถ้า test ข้อใดไม่ผ่าน Tailscale จะไม่รับการเปลี่ยนแปลงนั้น test ระบุได้ว่าอะไรต้องใช้ได้และอะไรต้องถูกปฏิเสธ เช่น SSH, การแชร์ไฟล์ และ remote desktop (port 22, 445 และ 3389) ถูกปฏิเสธบนอุปกรณ์ที่ไม่ต้องใช้</p>
<details>
<summary>เจาะลึก: ตัวอย่าง policy</summary>
<p>นี่เป็นเพียงรูปแบบ ไม่ใช่แม่แบบ มันตัดทุกอย่างยกเว้น exit node ถ้านำไปวางตามที่เป็นอยู่ มันจะตัดคุณออกจาก NAS หรือ media server ของคุณเอง address และอีเมลเป็นค่าตัวอย่างแทนของจริง</p>
<div class="sf-box" data-mode="file" data-where="ตัวอย่าง policy สำหรับ JSON editor" data-how="ตัวอย่าง: ปรับให้เข้ากับของคุณก่อนวาง"><pre><code>{
  "grants": [
    // 1. Use exit nodes.
    {"src": ["autogroup:member"], "dst": ["autogroup:internet"], "ip": ["*"]},

    // 2. Add a grant for each device you must reach, and no more.

    // Nothing else: other devices accept no inbound tailnet traffic.
  ],

  // An empty "acls" list: Tailscale's documentation gives this form for deny-all;
  // omitting the section is documented as allow-all.
  "acls": [],

  // No "ssh" section: no Tailscale SSH session is allowed anywhere.

  "tests": [
    {
      "src":    "you@example.com",
      // "accept": ["100.x.y.2:445"],  one line like this for each thing that must work.
      "deny":   ["100.x.y.3:22", "100.x.y.3:445", "100.x.y.3:3389"], // a device that must refuse these
    },
  ],
}</code></pre></div>
<p>grant สำหรับ NAS ที่ควรให้บริการไฟล์แชร์แก่ผู้ใช้ของ tailnet ของคุณ และไม่ทำอย่างอื่น จะมีหน้าตาแบบนี้ (port เป็นตัวอย่าง และให้เพิ่มรายการ <code>tcp:</code> หนึ่งรายการสำหรับแต่ละบริการอื่นที่ NAS ต้องให้บริการ และ <code>nas</code> เป็นชื่อที่คุณกำหนดเองในส่วน <code>hosts</code> ของ policy เช่น <code>"hosts": {"nas": "100.x.y.2"}</code>):</p>
<div class="sf-box" data-mode="file" data-where="ตัวอย่าง grant สำหรับ NAS" data-how="ตัวอย่าง: ปรับให้เข้ากับของคุณก่อนวาง"><pre><code>{"src": ["autogroup:member"], "dst": ["nas"], "ip": ["tcp:445"]},</code></pre></div>
<p>หมายเหตุ:</p>
<ul>
<li>เฉพาะอุปกรณ์ที่มีสิทธิ์เข้าถึง <code>autogroup:internet</code> เท่านั้นที่ใช้ exit node ได้ grant ข้อ 1 จึงเขียนแบบนั้น</li>
<li>test ตรวจกฎ ไม่ได้ตรวจเครือข่าย test ที่ผ่านไม่ได้พิสูจน์ว่าอุปกรณ์ตอบสนอง</li>
<li><strong>ทำไมต้องคง <code>"acls": []</code> ไว้</strong> เอกสารของ Tailscale ระบุว่าการไม่ใส่ส่วน <code>acls</code> เทียบเท่ากับ policy allow-all แบบ default และตัวอย่าง deny-all ของเอกสารคือ <code>"acls": []</code> เอกสารไม่ได้บอกว่าการไม่ใส่หมายถึงอะไรใน policy ที่มี grant ให้คงรายการว่างไว้ แล้วให้ test เป็นตัวตัดสิน: test แบบ deny สำหรับ port ที่ allow-all จะเปิดให้ จะไม่ผ่านตราบที่ allow-all ยังมีผลอยู่</li>
<li>เก็บสำเนา policy เดิมไว้ก่อนบันทึก (ข้อ 1 ของ &#8220;ถ้าคุณไม่ใช้ Tailscale SSH: ปิดให้หมดทุกเครื่อง&#8221; ด้านล่างทำสิ่งนี้) Tailscale ยังให้ย้อนการเปลี่ยนแปลงได้จากหน้า Configuration logs</li>
</ul>
</details>
<details>
<summary>เจาะลึก: วิธีที่ผมจะใช้อีก</summary>
<p>ไล่รายการสิ่งที่การโจมตีต้องใช้ ตรวจทีละข้อบนอุปกรณ์ของคุณเองและจดวิธีตรวจไว้ มองหาสิ่งที่ผิดแม้ในจุดที่การโจมตีไม่ได้ใช้ แล้วแบ่งที่เหลือเป็นสิ่งที่ต้องเปลี่ยน สิ่งที่ต้องเฝ้าดู และความเสี่ยงที่จะยอมรับ</p>
</details>
<h2>จากนั้นเปลี่ยนสิ่งที่คุณพบ</h2>
<h3>ถ้าคุณไม่ใช้ Tailscale SSH: ปิดให้หมดทุกเครื่อง</h3>
<p><strong>ก่อนเริ่ม:</strong> ขั้นตอนนี้เปลี่ยน policy ของคุณเพื่อไม่ให้อุปกรณ์ใดรับ Tailscale SSH session อย่าทำถ้า Tailscale SSH เป็นทางเดียวที่คุณเข้าเครื่องใดเครื่องหนึ่งได้ ใช้เวลาประมาณ 3 นาที ถ้าจะย้อนกลับ ให้วางสำเนาที่เก็บไว้กลับเข้าไป (ข้อ 1) แล้วบันทึก หรือย้อนการเปลี่ยนแปลงจากหน้า Configuration logs</p>
<ol>
<li><strong>เก็บสำเนา policy</strong> ใน <strong>JSON editor</strong> คลิกในข้อความ แล้วกด Ctrl+A (Cmd+A บน Mac) จากนั้นกด Ctrl+C (Cmd+C) เปิด Notepad (เมนู Start → พิมพ์ <code>notepad</code> → Enter) หรือ TextEdit บน Mac (เลือก Format → Make Plain Text ก่อน) วางด้วย Ctrl+V (Cmd+V) และบันทึกไฟล์เป็น <code>policy-backup.json</code> ในโฟลเดอร์ Documents ไฟล์ควรมี policy ทั้งหมด โดยขึ้นต้นด้วย <code>{</code></li>
<li><strong>ลบส่วน <code>ssh</code></strong> กลับมาที่ console เลือกทุกอย่างตั้งแต่ <code>"ssh": [</code> ลงไปถึง <code>]</code> ที่ตรงแนวกับมันด้านล่าง (ไม่ใช่ <code>]</code> ที่อยู่ในกฎ) รวมถึง comma ที่ตามมาถ้ามี แล้วกด Delete policy file ยอมให้มี comma เกินได้ ส่วนอื่นให้คงไว้ตามเดิม</li>
<li><strong>บันทึก</strong> คลิก <strong>Save</strong> Tailscale ตรวจ policy และ test ที่อยู่ในนั้นก่อนจะใช้การเปลี่ยนแปลง คุณควรเห็น console ยืนยันว่าบันทึกแล้ว ถ้ามีรายงาน syntax error แสดงว่ามี comma หรือวงเล็บอยู่ผิดที่ ให้วางสำเนาที่เก็บไว้กลับเข้าไป แล้วทำซ้ำตั้งแต่ข้อ 2 ถ้ามันระบุรายการ <code>sshTests</code> ให้ลบ test นั้นด้วย</li>
<li><strong>ตรวจ</strong> โหลดหน้าใหม่ กด Ctrl+F (Cmd+F) แล้วค้นหา <code>"ssh"</code> ไม่ควรพบ อุปกรณ์ที่เคยเปิดใช้ไว้เองจะยังรัน server ต่อไปจนกว่าคุณจะรัน <code>tailscale set --ssh=false</code> บนเครื่องนั้น</li>
</ol>
<h3>ถ้าคุณใช้ Tailscale SSH: อัปเดต แล้วจำกัดกฎให้แคบลง</h3>
<p><strong>ก่อนเริ่ม:</strong> การอัปเดตทำให้ Tailscale SSH session ที่เปิดอยู่ทุกอันบนเครื่องนั้นสิ้นสุดลง อย่ารันการอัปเดตจาก Tailscale SSH session ให้เข้าเครื่องด้วยทางอื่น: ใช้คีย์บอร์ดและจอที่ตัวเครื่อง หรือล็อกอินด้วย <code>ssh</code> ธรรมดาใน local network ของคุณ การล็อกอินด้วย <code>ssh</code> ไปยัง address Tailscale ของอุปกรณ์ (100.…) ก็หลุดเช่นกันเมื่อ Tailscale restart และการหลุดกลางทางระหว่างอัปเดตอาจทำให้การติดตั้งสะดุด คำสั่งด้านล่างใช้กับ Debian, Ubuntu และ Raspberry Pi OS ที่ใช้ package repository ของ Tailscale เอง สำหรับระบบอื่น ดู <a href="https://tailscale.com/docs/features/client/update">หน้าว่าด้วยการอัปเดต</a> ของ Tailscale</p>
<ol>
<li><strong>ล็อกอินเข้าเครื่องด้วยทางอื่น</strong> แล้วเปิด terminal บนเครื่องนั้น คุณควรเห็น shell prompt ของเครื่อง</li>
<li><strong>ดูว่าเครื่องรันเวอร์ชันอะไร</strong></li>
</ol>
<div class="sf-box" data-mode="one" data-shell="sh" data-effect="read" data-effect-text="แค่ดูเท่านั้น — ลองได้อย่างปลอดภัย" data-where="Terminal บนอุปกรณ์" data-how="1 คำสั่ง — วางลงไป แล้วกด Enter"><pre><code>tailscale version</code></pre></div>
<p class="sf-after">บรรทัดแรกคือเลขเวอร์ชัน ถ้าเป็น 1.104.4 หรือใหม่กว่า แสดงว่ามีการแก้ไขแล้ว ถ้าต่ำกว่านั้นต้องอัปเดต</p>
<ol start="3">
<li><strong>อัปเดต</strong> <code>sudo</code> รันคำสั่งในฐานะผู้ดูแลระบบ และอาจขอรหัสผ่านของคุณ ขณะพิมพ์จะไม่มีอะไรแสดงบนจอ ให้พิมพ์ให้ครบแล้วกด Enter</li>
</ol>
<div class="sf-box" data-mode="each" data-shell="sh" data-effect="change" data-effect-text="เปลี่ยนแปลงระบบของคุณ" data-where="Terminal บนอุปกรณ์" data-how="2 คำสั่ง — รันทีละคำสั่งตามลำดับ คลิก $ เพื่อคัดลอกบรรทัดนั้น"><pre><code>sudo apt update
sudo apt install --only-upgrade tailscale</code></pre></div>
<p class="sf-after">แต่ละคำสั่งใช้เวลาไม่ถึงนาที Tailscale restart ไม่กี่วินาที ถ้าการอัปเดตหยุดกลางคัน คำสั่ง <code>sudo dpkg --configure -a</code> จะทำต่อให้เสร็จ ถ้า <code>apt</code> ขึ้นว่า tailscale เป็นเวอร์ชันล่าสุดอยู่แล้ว แสดงว่าอุปกรณ์มีการแก้ไขแล้ว หรือไม่ได้รับ Tailscale มาจาก repository ของ Tailscale</p>
<ol start="4">
<li><strong>ตรวจอีกครั้ง</strong> ด้วย <code>tailscale version</code> บรรทัดแรกควรเป็น 1.104.4 หรือใหม่กว่า</li>
<li><strong>จำกัดกฎให้แคบลง</strong> ถ้าคุณล็อกอินเป็น root บน host บางเครื่อง เช่น Proxmox server หรือบน host ที่ไม่มีบัญชีอื่นใดใช้ <code>sudo</code> ได้ การทำขั้นนี้จะตัดการเข้าถึงนั้น ให้ตรวจก่อน เก็บสำเนา policy (ข้อ 1 ของ &#8220;ถ้าคุณไม่ใช้ Tailscale SSH: ปิดให้หมดทุกเครื่อง&#8221;) ก่อนแก้ จากนั้นใน console ไปที่ <strong>Access controls</strong>, <strong>JSON editor</strong> หาบรรทัด <code>"users"</code> ของกฎ <code>ssh</code> และลบ <code>, "root"</code> ออกจากบรรทัดนั้น:</li>
</ol>
<div class="sf-box" data-mode="output" data-where="ก่อน" data-how="คุณไม่ต้องพิมพ์ส่วนนี้"><pre><code>"users":  ["autogroup:nonroot", "root"]</code></pre></div>
<div class="sf-box" data-mode="output" data-where="หลัง" data-how="คุณไม่ต้องพิมพ์ส่วนนี้"><pre><code>"users":  ["autogroup:nonroot"]</code></pre></div>
<p class="sf-after">คลิก <strong>Save</strong> กฎนี้จะไม่ให้ root session อีกต่อไป ให้ใช้ <code>sudo</code> หลังล็อกอิน บน host ที่บัญชีของคุณใช้ <code>sudo</code> ได้โดยไม่ต้องใส่รหัสผ่าน ขั้นนี้ทำให้ผู้บุกรุกช้าลงแต่หยุดไม่ได้ ขั้นนี้ไม่ได้ใช้แทนการอัปเดต: bulletin เดือนกรกฎาคม TS-2026-009 เป็นวิธีเลี่ยง <code>autogroup:nonroot</code> นอกจากนี้ให้จำกัด <code>src</code> และ <code>dst</code> เฉพาะคนและอุปกรณ์ที่ต้องใช้ SSH</p>
<details>
<summary>มาตรการชั่วคราว: ปิด SSH forwarding บนอุปกรณ์ที่ยังอัปเดตไม่ได้</summary>
<p>ใช้ขั้นตอนนี้เฉพาะเมื่อ package source ที่คุณใช้ยังไม่มี 1.104.4 หรือใหม่กว่า มาตรการบรรเทาของ Tailscale สำหรับช่องโหว่ด้าน forwarding คือการตั้งค่า <code>TS_SSH_DISABLE_FORWARDING=1</code> ใน environment ของ service Tailscale บนการติดตั้งแบบ Debian service อ่านไฟล์ <code>/etc/default/tailscaled</code> (ไฟล์ <code>tailscaled.service</code> ใน source ของ Tailscale ระบุไฟล์นี้เป็น <code>EnvironmentFile</code>) ผมทดสอบคำสั่งด้านล่างกับสำเนาของไฟล์นั้น ไม่ได้ทดสอบกับ service Tailscale ที่กำลังรันอยู่ การ restart ทำให้ Tailscale SSH session ที่เปิดอยู่สิ้นสุดลง จึงให้รันคำสั่งเหล่านี้จากทางเข้าอื่น คำสั่งเหล่านี้ถือว่าระบบใช้ systemd</p>
<ol>
<li><strong>สำรองไฟล์</strong> ถ้าคำสั่งขึ้นว่า <code>No such file or directory</code> แสดงว่าอุปกรณ์นี้เก็บค่าตั้งไว้ที่อื่น ให้หยุดและอ่านหน้าของ Tailscale สำหรับการติดตั้งแบบของคุณ รันครั้งเดียวพอ: การรันครั้งที่สองจะเขียนทับไฟล์สำรองด้วยไฟล์ที่แก้แล้ว</li>
</ol>
<div class="sf-box" data-mode="one" data-shell="sh" data-effect="change" data-effect-text="เปลี่ยนแปลงระบบของคุณ" data-where="Terminal บนอุปกรณ์ จากทางเข้าอื่น" data-how="1 คำสั่ง — วางลงไป แล้วกด Enter"><pre><code>sudo cp /etc/default/tailscaled /etc/default/tailscaled.bak</code></pre></div>
<ol start="2">
<li><strong>เพิ่มค่าตั้ง</strong> บรรทัดที่เพิ่มเริ่มด้วยบรรทัดว่าง เพื่อไม่ให้ไปต่อกับบรรทัดสุดท้ายของไฟล์</li>
</ol>
<div class="sf-box" data-mode="one" data-shell="sh" data-effect="change" data-effect-text="เปลี่ยนแปลงระบบของคุณ" data-where="Terminal บนอุปกรณ์" data-how="1 คำสั่ง — วางลงไป แล้วกด Enter"><pre><code>printf '\nTS_SSH_DISABLE_FORWARDING=1\n' | sudo tee -a /etc/default/tailscaled</code></pre></div>
<p class="sf-after">คำสั่งแสดงสิ่งที่เพิ่ม รันครั้งเดียวพอ: การรันครั้งที่สองจะทำให้ในไฟล์มีบรรทัดนี้สองบรรทัด</p>
<ol start="3">
<li><strong>Restart service</strong></li>
</ol>
<div class="sf-box" data-mode="one" data-shell="sh" data-effect="change" data-effect-text="เปลี่ยนแปลงระบบของคุณ" data-where="Terminal บนอุปกรณ์" data-how="1 คำสั่ง — วางลงไป แล้วกด Enter"><pre><code>sudo systemctl restart tailscaled</code></pre></div>
<ol start="4">
<li><strong>ตรวจว่า service ที่กำลังรันได้ค่านี้</strong></li>
</ol>
<div class="sf-box" data-mode="one" data-shell="sh" data-effect="read" data-effect-text="แค่ดูเท่านั้น — ลองได้อย่างปลอดภัย" data-where="Terminal บนอุปกรณ์" data-how="1 คำสั่ง — วางลงไป แล้วกด Enter"><pre><code>sudo cat /proc/$(systemctl show -p MainPID --value tailscaled)/environ | tr '\0' '\n' | grep TS_SSH</code></pre></div>
<div class="sf-box" data-mode="output" data-where="สิ่งที่คุณควรเห็น" data-how="คุณไม่ต้องพิมพ์ส่วนนี้"><pre><code>TS_SSH_DISABLE_FORWARDING=1</code></pre></div>
<p class="sf-after">ถ้าไม่มี output แสดงว่า service ไม่ได้รับค่าตั้งนี้: ให้ตรวจว่าบรรทัดนี้อยู่ในไฟล์ด้วย <code>grep TS_SSH /etc/default/tailscaled</code> แล้วทำข้อ 3 ซ้ำ <code>/proc/0/environ: No such file or directory</code> หมายความว่า service ไม่ได้รันอยู่</p>
<ol start="5">
<li><strong>ถ้าจะย้อนกลับ</strong> ให้ลบบรรทัดนั้นออกและ restart ทำเช่นนี้ด้วยเมื่ออุปกรณ์รัน 1.104.4 หรือใหม่กว่าแล้ว เพราะค่าตั้งนี้เป็นมาตรการชั่วคราว การลบบรรทัดทำได้อย่างปลอดภัยแม้การอัปเดต package จะแทนที่ไฟล์ไปแล้วหลังข้อ 1 ไฟล์สำรองยังอยู่เป็นบันทึก การอัปเดตอาจถามว่าจะเก็บไฟล์ที่คุณแก้ไว้หรือไม่:</li>
</ol>
<div class="sf-box" data-mode="each" data-shell="sh" data-effect="change" data-effect-text="เปลี่ยนแปลงระบบของคุณ" data-where="Terminal บนอุปกรณ์" data-how="2 คำสั่ง — รันทีละคำสั่งตามลำดับ คลิก $ เพื่อคัดลอกบรรทัดนั้น"><pre><code>sudo sed -i '/^TS_SSH_DISABLE_FORWARDING=1$/d' /etc/default/tailscaled
sudo systemctl restart tailscaled</code></pre></div>
<p class="sf-after">ถ้า <code>sed</code> ขึ้นว่าอ่านไฟล์ไม่ได้ แสดงว่าไม่มีอะไรให้ย้อนกลับบนอุปกรณ์นี้</p>
</details>
<h3>สำหรับทุกคน</h3>
<ol>
<li><strong>ลบอุปกรณ์ที่คุณไม่ได้ดูแลแล้ว</strong> ก่อนที่อุปกรณ์นั้นจะหลุดจากมือคุณ อย่าลบอุปกรณ์ที่คุณเข้าถึงได้ทาง Tailscale เท่านั้น เพราะคุณต้องไปอยู่ที่เครื่องนั้นเพื่อเพิ่มกลับ ใน console เปิด <strong>Machines</strong> หาอุปกรณ์ตามชื่อในช่องค้นหา เปิดเมนูข้างอุปกรณ์ เลือก <strong>Remove</strong> แล้วเลือก <strong>Remove machine</strong> ในหน้าต่างยืนยัน อุปกรณ์จะหายไปจากรายการ ถ้าลบผิดเครื่อง ให้ล็อกอินอุปกรณ์นั้นอีกครั้งเพื่อเพิ่มกลับ ถ้า tailnet ของคุณกำหนดให้ต้องอนุมัติอุปกรณ์ ผู้ดูแล (admin) ต้องเป็นคนอนุมัติ</li>
<li><strong>ดู allow-all อีกครั้ง</strong> ค้นหา <code>"acls"</code> และ <code>"grants"</code> ใน <strong>Access controls</strong> กฎที่ต้นทางเป็น <code>*</code> และปลายทางเป็น <code>*</code> หรือ <code>*:*</code> คือ allow-all: ทุกอุปกรณ์เข้าถึงอุปกรณ์อื่นได้ทุกเครื่องทุก port ขั้นตอนการแทนที่อยู่ถัดไป</li>
</ol>
<details>
<summary>แทนที่ allow-all ทีละขั้น</summary>
<p><strong>ก่อนเริ่ม:</strong> ขั้นตอนนี้เปลี่ยน policy ของคุณและอาจตัดอุปกรณ์ออกจากกัน ให้ทำเมื่อคุณทดสอบแต่ละ service ได้หลังจากนั้น ใช้เวลา 15 ถึง 30 นาที ถ้าจะย้อนกลับ ให้วางสำเนา policy ที่เก็บไว้กลับเข้าไป (ข้อ 1 ของ &#8220;ถ้าคุณไม่ใช้ Tailscale SSH: ปิดให้หมดทุกเครื่อง&#8221;) แล้วบันทึก หรือย้อนการเปลี่ยนแปลงจากหน้า Configuration logs ถ้าโทรศัพท์หรือแล็ปท็อปของคุณใช้ exit node ให้ทดสอบการใช้ internet ของเครื่องนั้นหลังบันทึกแต่ละครั้ง: grant ของ exit node ที่ผิดจะทำให้เครื่องนั้นใช้ internet ไม่ได้</p>
<ol>
<li><strong>จดว่าอุปกรณ์ของคุณต้องใช้อะไรจากกัน:</strong> ไฟล์แชร์, media server, subnet route, เครื่องพิมพ์ ใช้กระดาษหรือไฟล์ข้อความ</li>
<li><strong>เก็บสำเนา policy</strong> ตามที่อธิบายไว้ข้างบน</li>
<li><strong>เพิ่ม grant หนึ่งรายการต่อความต้องการหนึ่งอย่าง</strong> ในส่วน <code>"grants"</code> (ถ้ายังไม่มีส่วนนี้ให้เพิ่มเข้าไป กฎ allow-all อยู่ในส่วน <code>"acls"</code>) เหมือนตัวอย่าง NAS ใน &#8220;ตัวอย่าง policy&#8221; ก่อนหน้านี้ ใช้ address Tailscale ของ NAS (หน้า Machines แสดงไว้) แทน <code>nas</code> ถ้าคุณยังไม่ได้กำหนดชื่อนั้น เพิ่ม grant สำหรับ exit node ถ้าคุณใช้</li>
<li><strong>เพิ่ม test สำหรับสิ่งที่ต้องใช้ได้</strong> ตามตัวอย่างเดียวกัน คลิก <strong>Save</strong> ถ้า test ไม่ผ่าน Tailscale จะไม่รับการเปลี่ยนแปลงและระบุชื่อ test นั้น</li>
<li><strong>ลบกฎ allow-all</strong> แต่คงส่วน <code>"acls"</code> ไว้เป็น <code>"acls": []</code> เอกสารของ Tailscale ใช้รูปแบบนั้นสำหรับ deny-all และระบุว่าการไม่ใส่ส่วนนี้เทียบเท่า allow-all เพิ่ม test สำหรับสิ่งที่ต้องใช้ไม่ได้ (เช่น port 22, 445 และ 3389 บนอุปกรณ์ที่ไม่ควรรับ) แล้วคลิก <strong>Save</strong> อีกครั้ง test เหล่านั้นจะไม่ผ่านตราบที่ allow-all ยังอยู่ จึงเพิ่มในตอนนี้</li>
<li><strong>ทดสอบแต่ละ service</strong> จากอุปกรณ์ที่ใช้มัน ถ้าอันไหนไม่ทำงาน ให้เพิ่ม grant ของมัน หรือวางสำเนาที่เก็บไว้กลับเข้าไป</li>
</ol>
</details>
<h2>สถานะ</h2>
<p>เวอร์ชัน 1.104.4 ถูก tag เมื่อช่วงดึกวันที่ 27 ตุลาคม 2026 (UTC) changelog ของ Tailscale ลงวันที่ 28 ตุลาคม เวอร์ชัน 1.104.5 ซึ่งออกเมื่อวันที่ 2 พฤศจิกายน 2026 แก้ปัญหา Tailscale SSH connection ค้าง และการค้างตอน restart และทำให้ session แบบ check-mode ไม่ถูกตัดการเชื่อมต่อเมื่อการอนุมัติหมดอายุ ให้อัปเดตเป็นรุ่นปัจจุบัน เมื่อวันที่ 10 พฤศจิกายน 2026 หน้า bulletin (TS-2026-014 ถึง TS-2026-017 ลงวันที่ 26 ตุลาคม) ไม่แสดงหมายเลข CVE</p>
<h2>วิธีทำงานนี้</h2>
<p>ผมตรวจด้วย Claude ซึ่งเป็นโมเดล AI ของ Anthropic Claude ร่าง policy ที่ใช้แทนและ test ของมัน รวมทั้งบทความนี้ การที่ Claude ตรวจร่างแรกของผมทำให้เห็นว่ากฎ default อนุญาต root อยู่แล้ว จากนั้น Claude ตรวจเรื่องนี้เทียบกับเอกสารของ Tailscale (open-source code ไม่มี policy แบบ default อยู่)</p>
<details>
<summary>ศัพท์</summary>
<ul>
<li><strong>Tailscale:</strong> mesh VPN ที่สร้างบน WireGuard มี hosted service ที่จัดการการล็อกอินและ key</li>
<li><strong>Tailnet:</strong> กลุ่มอุปกรณ์ในบัญชี Tailscale เดียวกัน</li>
<li><strong>Policy file:</strong> กฎการเข้าถึงของ tailnet แก้ใน admin console <em>Grants</em> กำหนดว่าอุปกรณ์ไหนเข้าถึงอุปกรณ์ไหนได้ ส่วน <code>ssh</code> กำหนดว่าใครเปิด Tailscale SSH session ได้ <em>tests</em> ตรวจกฎทุกครั้งที่กฎเปลี่ยน</li>
<li><strong>Allow-all:</strong> กฎ <code>acls</code> แบบ default ที่ให้ทุกอุปกรณ์เข้าถึงอุปกรณ์อื่นได้ทุกเครื่องทุก port</li>
<li><strong>Tag:</strong> ป้ายชื่ออย่าง <code>tag:server</code> ที่ให้อุปกรณ์มีตัวตนของตัวเองแทนที่จะเป็นตัวตนของผู้ใช้ อุปกรณ์ที่มี tag ไม่ถูกครอบคลุมโดย <code>autogroup:self</code></li>
<li><strong>autogroup:member / self / nonroot:</strong> ผู้ใช้คนใดก็ได้ของ tailnet; อุปกรณ์ที่ผู้ใช้เป็นเจ้าของ (ไม่รวมอุปกรณ์ที่มี tag); บัญชีในเครื่องบัญชีใดก็ได้ยกเว้น root</li>
<li><strong>Tailscale SSH:</strong> SSH server ที่ติดมากับ service ของ Tailscale ซึ่งตัดสินว่าใครล็อกอินได้จาก policy file แทนรหัสผ่านหรือ key</li>
<li><strong>Check mode:</strong> action ของกฎ <code>ssh</code> ที่ให้ผู้ใช้ล็อกอินใหม่ก่อนที่ session จะเริ่ม การล็อกอินหนึ่งครั้งมีผล 12 ชั่วโมงโดย default</li>
<li><strong>Exit node:</strong> อุปกรณ์ใน tailnet ที่อุปกรณ์อื่นส่ง traffic ออก internet ผ่านได้</li>
<li><strong>root:</strong> บัญชีผู้ดูแลระบบบน Linux และ macOS ซึ่งทำอะไรก็ได้บนเครื่อง</li>
<li><strong>Subnet route:</strong> อุปกรณ์ที่ให้ tailnet เข้าถึง local network ทั้งวงที่อยู่หลังมัน</li>
<li><strong>Unix socket:</strong> จุดเชื่อมต่อที่มีลักษณะคล้ายไฟล์ ซึ่งโปรแกรมบนเครื่องเดียวกันใช้คุยกัน เช่น control socket ของ Docker</li>
<li><strong>Port forwarding (ใน SSH):</strong> การส่งการเชื่อมต่ออื่น เช่นการเชื่อมต่อไปยัง socket ผ่าน SSH session</li>
<li><strong>Tailnet Lock:</strong> ฟีเจอร์ของ Tailscale ที่กำหนดให้อุปกรณ์ที่เชื่อถือได้ต้องเซ็นรับรองอุปกรณ์ใหม่ทุกเครื่องก่อนที่จะเข้าร่วมได้</li>
<li><strong>Foothold:</strong> อุปกรณ์ที่ผู้โจมตีควบคุมอยู่แล้ว และใช้เป็นจุดเริ่มโจมตีต่อ</li>
<li><strong>headscale:</strong> ตัวแทนแบบ open-source ของ control server แบบ hosted ของ Tailscale</li>
<li><strong>CVE:</strong> หมายเลขสาธารณะที่ระบุช่องโหว่เฉพาะรายการ</li>
<li><strong>sudo:</strong> คำนำหน้าคำสั่งที่รันคำสั่งในฐานะผู้ดูแลระบบ อาจขอรหัสผ่านของคุณ</li>
<li><strong>ssh:</strong> คำสั่งที่ใช้ล็อกอินเข้าเครื่องอื่น</li>
</ul>
</details>
<h2>แหล่งอ้างอิง</h2>
<ul>
<li>รายงาน Tailworm, Cyberdione Labs (24 ตุลาคม 2026 ซึ่งเป็นวันที่ Tailscale ระบุ ตัวรายงานเองแสดงเพียง &#8220;2026-10&#8221;): <a href="https://tailworm.com/">https://tailworm.com/</a></li>
<li>Tailscale, &#8220;Tailscale SSH: Findings and fixes&#8221;, 28 ตุลาคม 2026: <a href="https://tailscale.com/blog/tailscale-ssh-findings-fixes">https://tailscale.com/blog/tailscale-ssh-findings-fixes</a></li>
<li>Tailscale, &#8220;Tailscale SSH: Investigation&#8221;: <a href="https://tailscale.com/ssh-investigation-update">https://tailscale.com/ssh-investigation-update</a></li>
<li>Tailscale security bulletins, TS-2026-004, TS-2026-009 และ TS-2026-014 ถึง TS-2026-017 (อ่านซ้ำเมื่อ 10 พฤศจิกายน 2026): <a href="https://tailscale.com/security-bulletins">https://tailscale.com/security-bulletins</a></li>
<li>The Hacker News, &#8220;Unpatched Tailscale SSH Flaws Could Let a Hacked Device Reach Root on Other Servers&#8221;, 25 ตุลาคม 2026: <a href="https://thehackernews.com/2026/10/unpatched-tailscale-ssh-flaws-could-let.html">https://thehackernews.com/2026/10/unpatched-tailscale-ssh-flaws-could-let.html</a></li>
<li>เอกสาร Tailscale, Tailscale SSH (check mode, การปิด): <a href="https://tailscale.com/docs/features/tailscale-ssh">https://tailscale.com/docs/features/tailscale-ssh</a></li>
<li>เอกสาร Tailscale, policy แบบ default (&#8220;Allow all&#8221;): <a href="https://tailscale.com/docs/reference/examples/acls">https://tailscale.com/docs/reference/examples/acls</a></li>
<li>เอกสาร Tailscale, syntax ของ policy file และ test: <a href="https://tailscale.com/docs/reference/syntax/policy-file">https://tailscale.com/docs/reference/syntax/policy-file</a></li>
<li>เอกสาร Tailscale, syntax ของ grants: <a href="https://tailscale.com/docs/reference/syntax/grants">https://tailscale.com/docs/reference/syntax/grants</a></li>
<li>เอกสาร Tailscale, การกรองอุปกรณ์ใน admin console: <a href="https://tailscale.com/docs/features/access-control/device-management/how-to/filter">https://tailscale.com/docs/features/access-control/device-management/how-to/filter</a></li>
<li>เอกสาร Tailscale, การลบอุปกรณ์: <a href="https://tailscale.com/docs/features/access-control/device-management/how-to/remove">https://tailscale.com/docs/features/access-control/device-management/how-to/remove</a></li>
<li>เอกสาร Tailscale, การอัปเดต Tailscale: <a href="https://tailscale.com/docs/features/client/update">https://tailscale.com/docs/features/client/update</a></li>
<li>เอกสาร Tailscale, service <code>tailscaled</code>: <a href="https://tailscale.com/docs/reference/tailscaled">https://tailscale.com/docs/reference/tailscaled</a></li>
<li>source code ของ Tailscale (SSH server, netstack, peer API, <code>tailscaled.service</code>) และ tag v1.104.4: <a href="https://github.com/tailscale/tailscale">https://github.com/tailscale/tailscale</a></li>
</ul>
</div>
</div>
</div>
<p>The post <a href="https://techblog.viveksanghi.com/2026/11/tailworm-tailscale-default-policy/">Tailscale&#8217;s default policy allows root SSH. Tailworm made me read it.</a> appeared first on <a href="https://techblog.viveksanghi.com">Stubborn Fanatic - Tech Blog</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://techblog.viveksanghi.com/2026/11/tailworm-tailscale-default-policy/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">298</post-id>	</item>
		<item>
		<title>The paste is still in its box</title>
		<link>https://techblog.viveksanghi.com/2026/11/fanless-router-overheating-fan-vs-repaste/</link>
					<comments>https://techblog.viveksanghi.com/2026/11/fanless-router-overheating-fan-vs-repaste/#respond</comments>
		
		<dc:creator><![CDATA[Vivek Sanghi]]></dc:creator>
		<pubDate>Tue, 10 Nov 2026 11:17:51 +0000</pubDate>
				<category><![CDATA[home network]]></category>
		<category><![CDATA[sysadmin]]></category>
		<category><![CDATA[ai assisted]]></category>
		<category><![CDATA[cooling]]></category>
		<category><![CDATA[debugging]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[opnsense]]></category>
		<category><![CDATA[stubborn fanatic]]></category>
		<guid isPermaLink="false">https://techblog.viveksanghi.com/?p=276</guid>

					<description><![CDATA[<p>A fanless OPNsense router in a closed cabinet touched 91 °C. Before opening it to repaste, I fitted one 120 mm fan and read the router's own temperature record. The paste is still in its box.</p>
<p>The post <a href="https://techblog.viveksanghi.com/2026/11/fanless-router-overheating-fan-vs-repaste/">The paste is still in its box</a> appeared first on <a href="https://techblog.viveksanghi.com">Stubborn Fanatic - Tech Blog</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<style>
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+Devanagari:wght@400;600&family=Noto+Sans+Telugu:wght@400;600&family=Noto+Sans+Thai:wght@400;600&family=Sarabun:wght@400;600&display=swap');
.fvr-wrap { max-width: 720px; margin: 2em auto; line-height: 1.75; }
.fvr-wrap p { margin: 0 0 1.1em; }
.fvr-wrap h2 { margin: 1.9em 0 .6em; font-size: 1.35em; font-weight: 600; line-height: 1.3; }
.fvr-wrap ul, .fvr-wrap ol { margin: 0 0 1.1em 1.2em; padding: 0; }
.fvr-wrap li { margin: 0 0 .4em; }
.fvr-wrap [lang="hi"] { font-family: "Noto Sans Devanagari", sans-serif; }
.fvr-wrap [lang="te"] { font-family: "Noto Sans Telugu", sans-serif; line-height: 1.9; }
.fvr-wrap [lang="th"] { font-family: "Noto Sans Thai", "Sarabun", sans-serif; line-height: 1.85; }
.fvr-wrap pre { margin: 0 0 1.4em; padding: .9em 1.1em; overflow-x: auto; border-left: 3px solid currentColor; background: rgba(127,127,127,.12); font-size: .85em; line-height: 1.5; white-space: pre; }
.fvr-wrap code { font-family: Consolas, "SFMono-Regular", Menlo, "DejaVu Sans Mono", monospace; font-size: .92em; font-variant-ligatures: none; }
.fvr-wrap pre code { font-size: 1em; }
.fvr-wrap .sf-box pre { border-left: 0; background: none; }
.fvr-wrap a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.fvr-wrap table { width: 100%; border-collapse: collapse; margin: 0 0 1.4em; font-size: .9em; line-height: 1.45; display: block; overflow-x: auto; }
.fvr-wrap th, .fvr-wrap td { padding: .45em .6em; border-bottom: 1px solid rgba(127,127,127,.35); text-align: left; vertical-align: top; }
.fvr-wrap th { font-weight: 600; border-bottom-width: 2px; }
.fvr-wrap img { max-width: 100%; height: auto; display: block; margin: 0 0 1.4em; }
.fvr-wrap details { margin: 0 0 1.4em; padding: .6em 1em; border: 1px solid rgba(127,127,127,.4); border-radius: 6px; }
.fvr-wrap details[open] { padding-bottom: .2em; }
.fvr-wrap summary { cursor: pointer; font-weight: 600; }
.fvr-wrap details > *:nth-child(2) { margin-top: .8em; }
.fvr-wrap .fvr-title { font-size: 1.6em; font-weight: 600; line-height: 1.35; margin: 0 0 .9em; }
.fvr-visually-hidden { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.fvr-tabs { display: flex; flex-wrap: wrap; gap: 1.4em; margin: 0 0 1.4em; border-bottom: 1px solid currentColor; opacity: .9; }
.fvr-tabs label { cursor: pointer; padding: .4em 0; font-weight: 600; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.fvr-tabs label[lang="hi"] { font-family: "Noto Sans Devanagari", sans-serif; }
.fvr-tabs label[lang="te"] { font-family: "Noto Sans Telugu", sans-serif; }
.fvr-tabs label[lang="th"] { font-family: "Noto Sans Thai", "Sarabun", sans-serif; }
input[name="fvr-lang"] { position: absolute; opacity: 0; pointer-events: none; }
.fvr-panel { display: none; }
#fvr-en:checked ~ .fvr-tabs label[for="fvr-en"], #fvr-hi:checked ~ .fvr-tabs label[for="fvr-hi"], #fvr-te:checked ~ .fvr-tabs label[for="fvr-te"], #fvr-th:checked ~ .fvr-tabs label[for="fvr-th"] { border-bottom-color: currentColor; }
#fvr-en:checked ~ .fvr-content #fvr-panel-en, #fvr-hi:checked ~ .fvr-content #fvr-panel-hi, #fvr-te:checked ~ .fvr-content #fvr-panel-te, #fvr-th:checked ~ .fvr-content #fvr-panel-th { display: block; }
#fvr-en:focus-visible ~ .fvr-tabs label[for="fvr-en"], #fvr-hi:focus-visible ~ .fvr-tabs label[for="fvr-hi"], #fvr-te:focus-visible ~ .fvr-tabs label[for="fvr-te"], #fvr-th:focus-visible ~ .fvr-tabs label[for="fvr-th"] { outline: 2px solid currentColor; outline-offset: 3px; }
</style>
<div class="fvr-wrap">
<span class="fvr-visually-hidden">Choose a language: English, Hindi, Telugu or Thai.</span>
<input type="radio" name="fvr-lang" id="fvr-en" checked>
<input type="radio" name="fvr-lang" id="fvr-hi">
<input type="radio" name="fvr-lang" id="fvr-te">
<input type="radio" name="fvr-lang" id="fvr-th">
<div class="fvr-tabs" role="presentation"><label for="fvr-en" lang="en">English</label><label for="fvr-hi" lang="hi">हिन्दी</label><label for="fvr-te" lang="te">తెలుగు</label><label for="fvr-th" lang="th">ไทย</label></div>
<div class="fvr-content">
<div class="fvr-panel" id="fvr-panel-en" lang="en">
<p>On 15 October 2026 I had two fixes for one problem on my desk: a 4 g tube of ARCTIC MX-7 thermal paste and a 120 mm Noctua fan. The problem was my router, a fanless mini PC running OPNsense in a closed plywood cabinet. The day before, its CPU had touched 91 °C.</p>
<p>The advice I found online was to open the case and replace the paste. I fitted the fan first, because it needed no screwdriver. Before I did, I decided which result would send me back for the paste.</p>
<p>I never needed it. The router had been logging its own temperature all along. Between 16 September and the evening of 15 October, no hour averaged below 60 °C. In the four days after the fan went on, no hour averaged above 49 °C. The paste is still in its box.</p>
<p>I did this work with Claude, Anthropic&#8217;s AI model, which could read my router through my own browser session. I chose the parts, fitted the fan and set the rule. Claude pulled the temperature records and did the arithmetic, and on 28 October it read back the router&#8217;s hourly data for this post.</p>
<h2 id="fvr-en-s1">The box and the cabinet</h2>
<p>The router is a six-port fanless mini PC sold under the name &#8220;Shenzhen Weibu&#8221;. Inside is an Intel Pentium Gold 8505: one performance core and four efficient cores, six threads, 15 W base power and up to 55 W in turbo, according to <a href="https://www.intel.com/content/www/us/en/products/sku/226265/intel-pentium-gold-processor-8505-8m-cache-up-to-4-40-ghz-with-ipu/specifications.html" rel="noopener">Intel&#8217;s specification page</a>. It has 20 GB of RAM and six Intel I226-V 2.5 GbE ports, and runs OPNsense 26.7. The case is the heatsink. Its top is a block of fins.</p>
<p>It sits in a closed plywood cabinet with other network gear. A slotted grille in the cabinet&#8217;s side panel is the only planned way out for warm air.</p>
<img src="https://techblog.viveksanghi.com/wp-content/uploads/2026/10/router-before-fan-crop-grille.jpg" alt="The router before the fan, seen from its USB end: a black case whose top is a block of fins, beside the slotted grille in the cabinet's side panel" loading="lazy" decoding="async">
<p>Was 91 °C dangerous? Not by Intel&#8217;s numbers. The same page lists the chip&#8217;s maximum junction temperature (TJUNCTION) as 100 °C, and a processor at that limit slows itself down rather than failing. The 91 °C was also only the highest sampled reading; the router reads the sensor once a minute, so the peaks in between went unrecorded. Even so, the heat had become a reason to look at a new router. The hourly average sat near 70 °C day and night, and the SSD, the memory and the network chips share the same hot case. Heat shortens the life of electronics in general, though I measured neither that nor the SSD&#8217;s temperature on this box.</p>
<h2 id="fvr-en-s2">Why the fan went first</h2>
<p>A repaste is the usual advice for a hot mini PC, and it may well have helped. It would also have meant:</p>
<ul>
<li>a configuration backup first;</li>
<li>99 per cent isopropyl alcohol and lint-free wipes;</li>
<li>45 to 60 minutes with the network offline;</li>
<li>opening a sealed case whose screws and thermal pads I had never seen.</li>
</ul>
<p>A fan lying on the fins needed none of that, and could come off in a second. It has costs of its own. It gives up what a fanless box is for: no noise, no dust drawn in, no moving part to wear out.</p>
<p>So I set the rule before fitting it: <strong>repaste only if the overnight readings still reach the 80s with the fan in place.</strong></p>
<h2 id="fvr-en-s3">The fan</h2>
<p>I chose a Noctua NF-F12 5V PWM. Noctua&#8217;s <a href="https://www.noctua.at/en/products/nf-f12-5v-pwm/specifications" rel="noopener">specification</a> gives 120 mm, 5 V, up to 1,500 rpm, 0.65 W typical and 22.4 dB(A) at full speed, with a USB power cable in the box. Mine plugs into one of the router&#8217;s own USB ports. Powered from USB, the fan gets no speed signal, and Noctua&#8217;s <a href="https://www.noctua.at/en/support/faqs/microcontroller-guide-pwm-setup-and-rpm-monitoring" rel="noopener">own guide</a> says a PWM fan with no signal runs at full speed. Noctua marks it &#8220;5V PWM version, not for use in PCs&#8221;: a PC&#8217;s 12 V fan header is the wrong supply for it.</p>
<p>On my router, the 120 mm fan covers most of the top. Pick a fan about the size of the router&#8217;s top. Noctua also sells 5 V versions in smaller sizes, such as the 80 mm NF-A8 5V PWM. A cheaper 5 V USB fan would also move air; I have not tried one.</p>
<p>I fitted it at about 17:30 on 15 October. It lies flat on the top fins, not screwed down, blowing down into them. Reading a photo, Claude first had the airflow the wrong way round; I checked the arrow moulded into the frame. Either direction should help, but I wanted to know which one I was measuring.</p>
<img src="https://techblog.viveksanghi.com/wp-content/uploads/2026/10/fan-on-router-top-crop.jpg" alt="The Noctua fan lying flat on the router's finned top, seen from above" loading="lazy" decoding="async">
<img src="https://techblog.viveksanghi.com/wp-content/uploads/2026/10/fan-on-router-front-crop.jpg" alt="The router from its network-port end, cabled, with the fan resting on top" loading="lazy" decoding="async">
<h2 id="fvr-en-s4">What the router recorded</h2>
<p>OPNsense reads the CPU temperature once a minute and keeps hourly averages for weeks. How to read yours is further down.</p>
<img src="https://techblog.viveksanghi.com/wp-content/uploads/2026/11/cpu0-hourly-sep-oct-2026.v2.png" alt="Line chart of the router's hourly average CPU temperature from 16 September 2026 to four days after the fan was fitted. It runs between about 65 and 74 °C until 9 October, peaks at 77 °C during the clean-up on 10 October, settles between about 60 and 71 °C, and falls to about 46 °C in the hour after the fan was fitted at 17:30 on 15 October, where it stays." loading="lazy" decoding="async">
<p>Hourly averages of <code>cpu0</code>, from the router&#8217;s hourly archive:</p>
<table>
<thead>
<tr>
<th>Period</th>
<th>Hours</th>
<th>Average</th>
<th>Lowest hour</th>
<th>Highest hour</th>
</tr>
</thead>
<tbody>
<tr>
<td>16 September – 9 October</td>
<td>567</td>
<td>69.7 °C</td>
<td>65.3 °C</td>
<td>73.7 °C</td>
</tr>
<tr>
<td>11 October – 15 October, until the fan</td>
<td>114</td>
<td>66.2 °C</td>
<td>60.5 °C</td>
<td>70.9 °C</td>
</tr>
<tr>
<td>15 October, after the fan (four days)</td>
<td>100</td>
<td>46.4 °C</td>
<td>42.6 °C</td>
<td>48.6 °C</td>
</tr>
</tbody>
</table>
<p>I left out 10 October, the day of a configuration clean-up described below. Against the days just before it, the fan took about 20 °C off the average. The before and after ranges do not overlap: the coolest hour before the fan was 12 °C warmer than the warmest hour after it.</p>
<p>The rule I had set was about the overnight readings. On 15 October I read the 03:00–10:00 window from the per-minute record, and on 16 October I read the same window again:</p>
<table>
<thead>
<tr>
<th><code>cpu0</code>, 03:00–10:00</th>
<th>15 October, no fan</th>
<th>16 October, fan</th>
</tr>
</thead>
<tbody>
<tr>
<td>Average</td>
<td>65.6 °C</td>
<td>46.7 °C</td>
</tr>
<tr>
<td>Maximum</td>
<td>90.3 °C</td>
<td>73.6 °C</td>
</tr>
<tr>
<td>Readings at 80 °C or above</td>
<td>19</td>
<td>0</td>
</tr>
</tbody>
</table>
<p>No reading reached the 80s. The rule said leave the case shut.</p>
<p>My rule used single readings, and single readings jump. Each is one instant: on 28 October consecutive minutes read 35.3, 68.2, 69.0 and 35.7 °C. An average over hours would have made a better test. By hourly averages the gap is wider still: no hour after the fan went above 48.6 °C.</p>
<details>
<summary>Deep dive: the 15 October per-minute windows</summary>
<p>Read from the per-minute record on 15 October.</p>
<table>
<thead>
<tr>
<th>Window, 15 October 2026</th>
<th>Readings</th>
<th>Average</th>
<th>Median</th>
<th>95th percentile</th>
<th>Maximum</th>
<th>At 80 °C or above</th>
</tr>
</thead>
<tbody>
<tr>
<td>03:00–10:00, no fan</td>
<td>420</td>
<td>65.6 °C</td>
<td>69.0 °C</td>
<td>79.8 °C</td>
<td>90.3 °C</td>
<td>19</td>
</tr>
<tr>
<td>12:00–17:20, no fan</td>
<td>320</td>
<td>65.5 °C</td>
<td>68.7 °C</td>
<td>80.1 °C</td>
<td>90.7 °C</td>
<td>16</td>
</tr>
<tr>
<td>17:31–19:12, fan</td>
<td>101</td>
<td>46.0 °C</td>
<td>48.7 °C</td>
<td>60.5 °C</td>
<td>69.6 °C</td>
<td>0</td>
</tr>
<tr>
<td>19:20–19:37, after a firmware update and reboot</td>
<td>17</td>
<td>54.1 °C</td>
<td>57.1 °C</td>
<td>70.8 °C</td>
<td>70.8 °C</td>
<td>0</td>
</tr>
</tbody>
</table>
<p>The last row is higher because the router had just rebooted after a firmware update and was loading about 2.7 million blocklist entries. It is not a resting figure.</p>
</details>
<h2 id="fvr-en-s5">What this does and does not show</h2>
<p>It shows that a fan was enough here. It does not show that a repaste would not also have helped; I never tried one. The fan does not take heat out of the cabinet. It forces cabinet air through the router&#8217;s fins. The closed cabinet made the starting point worse, so the gain here is probably larger than it would be in open air.</p>
<ul>
<li><strong>I did not measure the room temperature.</strong> The drop came within one hour, and a room does not cool 20 °C in an hour. The router also reacts little to the daily cycle: from 16 September to 9 October, the average for each hour of the day stayed between 69.2 and 70.3 °C, a swing of about 1 °C.</li>
<li><strong>The firmware changed the same evening.</strong> The router installed a firmware update at 19:12 on 15 October. The drop came first: the 101 minutes between fitting the fan and the update averaged 46.0 °C.</li>
<li><strong>A configuration clean-up came five days earlier.</strong> On 10 October I removed a WireGuard VPN client, an unused proxy stack (Squid, ClamAV, Redis and their companions) and the NAT rules that fed it, trimmed my DNS blocklists, and unplugged a USB network adapter. The hourly average was 69.7 °C from 16 September to 9 October and 66.2 °C from 11 October until the fan. That fall came in steps over three or four days, and I cannot separate those changes from the weather. It is why the comparison above uses only the days just before the fan.</li>
<li><strong>No power settings changed.</strong> The router&#8217;s configuration history goes back to 13 October (30 revisions) and shows no change to power settings, thermal settings or tunables in that time.</li>
<li><strong>I did not control the load.</strong> These are ordinary days on a home network.</li>
<li><strong>It is one router in one cabinet.</strong></li>
</ul>
<details>
<summary>A hunch I did not prove: the dashboard</summary>
<p>On 13 October, with about 20 hours of uptime, I compared CPU time by process. Unbound, the DNS resolver, had used 16 seconds, about 0.02 per cent of one core, while answering about 10,000 unwanted lookups a day from devices on the network. The PHP processes that serve the web interface and the API had used 5 minutes 9 seconds, about 20 times as much, and that snapshot misses PHP workers that had already exited.</p>
<p>Even so, 5 minutes in 20 hours is about 0.4 per cent of one core. If the open dashboard, whose widgets refresh every few seconds, raised the temperature, it did so in short bursts. I suspected those bursts behind some 78 °C spikes I saw that week. I did not test it.</p>
</details>
<h2 id="fvr-en-s6">Reading your own router</h2>
<p>OPNsense draws its health records under <strong>Reporting → Health</strong>. To look at the CPU temperature graph:</p>
<ol>
<li>Open the router&#8217;s web interface in a browser: type the address you use to manage the router into the address bar, press <strong>Enter</strong>, and log in. If you do not know the address, ask whoever set the router up. A router uses its own security certificate, so the browser may warn that the connection is not private; for your own router&#8217;s address that is expected. Click <strong>Advanced</strong>, then the link that continues to the address (<strong>Proceed</strong> in Chrome, <strong>Accept the Risk and Continue</strong> in Firefox).</li>
<li>In the menu, open <strong>Reporting → Health</strong>. The page loads in a few seconds and changes nothing. It lists its reports by topic.</li>
<li>Find the CPU temperature report in the page&#8217;s list of reports. If there is none, open <strong>System → Settings → Miscellaneous → Thermal Sensors</strong>; mine is set to &#8220;Intel Core<em> CPU on-die thermal sensor (coretemp)&#8221;. Changing that setting changes the router: write down the old value first, press </em><em>Save</em>*, and wait a few minutes while the router takes its readings. To undo it, choose the old value again; setting it back to none needs a reboot.</li>
</ol>
<p>The same data comes from the router&#8217;s API, at <code>GET /api/diagnostics/systemhealth/get_system_health/cputemp-system/0</code>. The number at the end picks an archive: <code>/0</code> is one value a minute, and higher numbers are coarser. How long each lasts depends on when the router&#8217;s temperature database was created:</p>
<table>
<thead>
<tr>
<th>Archive</th>
<th>My router (database from an older OPNsense)</th>
<th>A new OPNsense 26.x install</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>/0</code></td>
<td>1 minute, 1,000 slots: 16 hours 40 minutes</td>
<td>1 minute, 1,200 slots: 20 hours</td>
</tr>
<tr>
<td><code>/1</code></td>
<td>5 minutes, 1,000 slots: about 3½ days</td>
<td>5 minutes, 720 slots: 60 hours</td>
</tr>
<tr>
<td><code>/2</code></td>
<td>1 hour, 1,000 slots: about 6 weeks</td>
<td>1 hour, 1,860 slots: about 11 weeks</td>
</tr>
<tr>
<td><code>/3</code></td>
<td>12 hours, 3,000 slots: about 4 years</td>
<td>1 day, 2,284 slots: about 6 years</td>
</tr>
</tbody>
</table>
<p>OPNsense keeps an existing database through upgrades, so an older router keeps the older layout. The last column is from the 26.7 source code; I have not seen a new install.</p>
<p>Two things follow. Read last night&#8217;s per-minute record this morning; by the evening those minutes are gone, and only the coarser averages remain. And the hourly archive is long enough for a before-and-after you did not plan. Mine already held a month of &#8220;before&#8221; when I fitted the fan.</p>
<details>
<summary>Deep dive: what the archives hold, and why hourly figures hide spikes</summary>
<p>The API serves only averages. OPNsense&#8217;s <a href="https://github.com/opnsense/core/blob/master/src/opnsense/scripts/health/fetchData.py" rel="noopener"><code>fetchData.py</code></a> processes only the round-robin archives whose consolidation function is <code>AVERAGE</code>, and builds one &#8220;set&#8221; per archive. The router stores one instant reading of the sensor each minute; each hourly value is the average of those readings. A single reading of 91 °C barely moves it.</p>
<p>Slots with no reading come back as empty values. The same script drops empty slots only at the start of a series. So the count of slots understates the archive&#8217;s length when its oldest slots are empty, as on a young database. The snippet below reports readings and empty slots separately.</p>
</details>
<details>
<summary>Deep dive: a console snippet to summarise your own router (for a PC)</summary>
<p>The Health graph shows the shape. This prints the numbers: the average, median, 95th percentile and maximum, and how many readings reached 80 °C, for one archive. It sends one read request (a GET) to the router&#8217;s own health API and changes nothing.</p>
<p><strong>Before you start</strong></p>
<ul>
<li>You need a PC with Chrome or Firefox, and a login to the router&#8217;s web interface that can open Reporting → Health.</li>
<li>You type in the browser&#8217;s developer console, on the router&#8217;s own page. You install nothing.</li>
<li>It takes two to three minutes.</li>
<li>It changes nothing on the router or the PC, so there is nothing to undo. Close the console when you finish.</li>
<li>In the boxes below, <strong>Copy</strong> copies the whole box. A dashed box shows what you should see; you do not type it.</li>
</ul>
<p><strong>Steps</strong></p>
<ol>
<li>Open the router&#8217;s web interface in Chrome or Firefox: type the address you use to manage the router into the address bar, press <strong>Enter</strong>, and log in. You should see the OPNsense dashboard. If no login page appears, check the address and that the PC is on the home network. If the browser warns that the connection is not private, see the note in step 1 of the graph steps above.</li>
<li>Stay on any OPNsense page and open the browser console: <strong>Ctrl+Shift+J</strong> in Chrome or <strong>Ctrl+Shift+K</strong> in Firefox on Windows and Linux; <strong>Cmd+Option+J</strong> or <strong>Cmd+Option+K</strong> on a Mac. A panel opens beside or below the page, with a line to type on. If it opens on another tab, click the <strong>Console</strong> tab.</li>
<li>
<p>Click <strong>Copy</strong> in the box below. It copies the whole snippet.</p>
<div class="sf-box" data-mode="file" data-effect="read" data-effect-text="only looks — safe to try" data-where="Browser console on an OPNsense page" data-how="paste all of it into the console, then press Enter"><pre><code>// Paste into the browser console on any OPNsense page while logged in.
// Read-only: one GET to the router's own health API. Changes nothing.
(async () =&gt; {
  const LEVEL = 0; // archive: 0 is the finest (one value a minute); higher numbers are coarser. How many exist depends on the router.
  const url = '/api/diagnostics/systemhealth/get_system_health/cputemp-system/' + LEVEL;
  let d;
  try {
    const r = await fetch(url);
    if (r.status === 401) { console.log('HTTP 401: not logged in. Log in to the OPNsense web interface in this browser, then paste again.'); return; }
    if (r.status === 403) { console.log('HTTP 403: logged in, but this user may not read Reporting &gt; Health. Use an account with that privilege.'); return; }
    if (!r.ok) { console.log('HTTP ' + r.status + ' from ' + url); return; }
    d = await r.json();
  } catch (e) {
    console.log('No JSON came back (' + e.message + '). Run this on an OPNsense page while logged in.'); return;
  }
  const series = d &amp;&amp; d.set &amp;&amp; d.set.data &amp;&amp; d.set.data[0];
  if (!series || !Array.isArray(series.values)) { console.log('No temperature series at LEVEL ' + LEVEL + '. A higher LEVEL may not exist on this router; at LEVEL 0, check that Reporting &gt; Health shows a CPU temperature graph.'); return; }
  const pts = series.values.filter(p =&gt; p[1] !== null &amp;&amp; !isNaN(p[1]));
  const empty = series.values.length - pts.length;
  if (pts.length === 0) { console.log('The series ' + series.key + ' has no readings at this level.'); return; }
  const v = pts.map(p =&gt; p[1]).sort((a, b) =&gt; a - b);
  const n = v.length;
  const median = n % 2 ? v[(n - 1) / 2] : (v[n / 2 - 1] + v[n / 2]) / 2;
  const p95 = v[Math.min(n - 1, Math.ceil(0.95 * n) - 1)]; // nearest-rank
  const when = t =&gt; new Date(t).toLocaleString(); // your browser's time zone; each time marks the end of its interval
  console.log('Series ' + series.key + ', one value every ' + d.set.step_size + ' s');
  console.log('From ' + when(pts[0][0]) + ' to ' + when(pts[n - 1][0]) + ': ' + n + ' readings, ' + empty + ' empty slots');
  console.log('Average ' + (v.reduce((a, b) =&gt; a + b, 0) / n).toFixed(1) + ' °C, median ' + median.toFixed(1) +
    ', 95th percentile ' + p95.toFixed(1) + ', maximum ' + v[n - 1].toFixed(1));
  console.log('Readings at 80 °C or above: ' + v.filter(x =&gt; x &gt;= 80).length);
})();</code></pre></div>
</li>
<li>
<p>Click the line in the console, paste with <strong>Ctrl+V</strong> (<strong>Cmd+V</strong> on a Mac) and press <strong>Enter</strong>. Browsers may block pasting into the console, because pasting a stranger&#8217;s code into a logged-in page is a known trick. Read the snippet before you allow it. If the browser asks you to type &#8220;allow pasting&#8221;, do what its message says, then paste again.</p>
</li>
<li>
<p>Within a second or two you should see four lines (ignore a line that starts with &#8220;Promise&#8221;): the series name, the time range with the number of readings and empty slots, the summary figures, and the count of readings at 80 °C or above. Times are in your browser&#8217;s time zone, and each marks the end of its interval. On my router, on 28 October 2026, it printed this (I left out the times; their format follows your browser&#8217;s settings):</p>
<div class="sf-box" data-mode="output" data-where="What you should see"><pre><code>Series cpu0temp, one value every 60 s
From &lt;start time&gt; to &lt;end time&gt;: 1000 readings, 0 empty slots
Average 43.9 °C, median 47.7, 95th percentile 57.8, maximum 72.5
Readings at 80 °C or above: 0</code></pre></div>
</li>
<li>
<p>&#8220;HTTP 401&#8221; means the browser is not logged in to OPNsense: log in and repeat step 4. &#8220;HTTP 403&#8221; means you are logged in as a user without access to Reporting → Health.</p>
</li>
<li>To read the hourly archive, paste the snippet into a plain text editor first (Notepad on Windows, TextEdit set to plain text on a Mac), change <code>const LEVEL = 0;</code> to <code>const LEVEL = 2;</code>, copy all of it from there, and repeat steps 4 and 5.</li>
<li>Compare the average with the level of the Reporting → Health graph for the same archive. They should agree.</li>
<li>When you finish, close the panel with the <strong>×</strong> at its top right. Nothing was changed on the router.</li>
</ol>
</details>
<h2 id="fvr-en-s7">The verdict</h2>
<p>The case stays shut and the paste stays in its box.</p>
<p>What is left is small. Fasten the fan, and lift it: rubber feet of 10 to 15 mm would hold it in place and let air reach the fins under its hub, which a fan lying flat starves. That is general practice for fans over heatsinks; I have not measured it here. Keep the side grille clear. The cabinet as a whole is a separate problem: the fan can cool the router only towards the temperature of the cabinet air, which is warmer than the room. I worked through that separately and may write it up.</p>
<p>Before the fan, the heat was a reason to look at a new router. It is not any more.</p>
<h2 id="fvr-en-s8">What I would tell someone with a fanless box in a warm cupboard</h2>
<ol>
<li><strong>Read what the router already records</strong> before you open anything. On OPNsense that is Reporting → Health, or the API above.</li>
<li><strong>Check how long each archive lasts on your router.</strong> It depends on when its database was created.</li>
<li><strong>Decide which result sends you to the next step,</strong> before you change anything.</li>
<li><strong>Judge averages, not single readings.</strong> Consecutive minute readings can differ by 30 °C.</li>
<li><strong>Try the cheap, reversible fix first,</strong> and weigh what it costs: a fan brings noise and dust to a box bought to have neither.</li>
</ol>
<details>
<summary>Glossary</summary>
<ul>
<li><strong>Fanless (passive) cooling:</strong> the case is the heatsink; heat leaves by conduction and natural airflow, with no fan.</li>
<li><strong>Thermal paste / repaste:</strong> the compound between the CPU and the heatsink that fills microscopic gaps. Repasting means cleaning off the old compound and applying new.</li>
<li><strong>P-core / E-core:</strong> Intel&#8217;s performance and efficient cores in one chip. The Pentium Gold 8505 has one of the first and four of the second.</li>
<li><strong>TJUNCTION:</strong> the highest temperature Intel allows at the chip itself. For the 8505 it is 100 °C.</li>
<li><strong>PWM:</strong> pulse-width modulation; a signal wire that tells a fan how fast to spin.</li>
<li><strong>Round-robin database (RRD):</strong> a fixed-size store that keeps recent data at fine resolution and older data as coarser averages, overwriting the oldest.</li>
<li><strong>Median / 95th percentile:</strong> the median is the middle reading (or the average of the two middle readings); 95 per cent of readings are at or below the 95th percentile.</li>
<li><strong>API:</strong> the router&#8217;s programming interface; the same data the web pages show, returned as JSON.</li>
<li><strong>Tunables:</strong> kernel settings that OPNsense applies at boot, listed under System → Settings → Tunables.</li>
</ul>
</details>
</div>
<div class="fvr-panel" id="fvr-panel-hi" lang="hi">
<p class="fvr-title">Paste अब भी अपने डिब्बे में है</p>
<p>15 अक्टूबर 2026 को मेरी मेज़ पर एक ही समस्या के दो इलाज रखे थे: ARCTIC MX-7 thermal paste की 4 g की ट्यूब और 120 mm का एक Noctua fan। समस्या मेरा router था: एक fanless mini PC, जो बंद plywood कैबिनेट में OPNsense चलाता है। एक दिन पहले उसका CPU 91 °C तक पहुँच गया था।</p>
<p>ऑनलाइन जो सलाह मिली, वह यही थी कि case खोलो और paste बदल दो। मैंने पहले fan लगाया, क्योंकि उसके लिए screwdriver नहीं चाहिए था। लगाने से पहले मैंने तय कर लिया कि कौन-सा नतीजा मुझे वापस paste की ओर भेजेगा।</p>
<p>उसकी ज़रूरत नहीं पड़ी। Router शुरू से अपना तापमान खुद दर्ज कर रहा था। 16 सितंबर से 15 अक्टूबर की शाम तक किसी भी घंटे का औसत 60 °C से नीचे नहीं गया। Fan लगने के बाद के चार दिनों में किसी भी घंटे का औसत 49 °C से ऊपर नहीं गया। Paste अब भी अपने डिब्बे में है।</p>
<p>यह काम मैंने Anthropic के AI मॉडल Claude के साथ किया, जो मेरे अपने browser session के ज़रिए मेरा router पढ़ सकता था। Parts मैंने चुने, fan मैंने लगाया और नियम मैंने तय किया। तापमान के रिकॉर्ड Claude ने निकाले और हिसाब उसी ने लगाया। 28 अक्टूबर को इस पोस्ट के लिए उसने router का hourly data दोबारा पढ़ा।</p>
<h2 id="fvr-hi-s1">Box और कैबिनेट</h2>
<p>यह router छह port वाला fanless mini PC है, जो &#8220;Shenzhen Weibu&#8221; नाम से बिकता है। अंदर Intel Pentium Gold 8505 है: एक performance core और चार efficient cores, छह threads, 15 W base power और turbo में 55 W तक, <a href="https://www.intel.com/content/www/us/en/products/sku/226265/intel-pentium-gold-processor-8505-8m-cache-up-to-4-40-ghz-with-ipu/specifications.html" rel="noopener">Intel के specification पेज</a> के अनुसार। इसमें 20 GB RAM और छह Intel I226-V 2.5 GbE ports हैं, और यह OPNsense 26.7 चलाता है। इसका case ही heatsink है। ऊपर का हिस्सा fins का एक ब्लॉक है।</p>
<p>यह दूसरे network उपकरणों के साथ एक बंद plywood कैबिनेट में रखा है। कैबिनेट के साइड पैनल में झिरियों वाली एक ग्रिल ही गर्म हवा के निकलने का तय रास्ता है।</p>
<img src="https://techblog.viveksanghi.com/wp-content/uploads/2026/10/router-before-fan-crop-grille.jpg" alt="Fan लगने से पहले router, USB वाले सिरे से: काला case, जिसका ऊपरी हिस्सा fins का ब्लॉक है, और बगल में कैबिनेट के साइड पैनल की झिरियों वाली ग्रिल" loading="lazy" decoding="async">
<p>क्या 91 °C ख़तरनाक था? Intel के आँकड़ों के हिसाब से नहीं। उसी पेज पर chip का अधिकतम junction तापमान (TJUNCTION) 100 °C दिया है, और उस सीमा पर processor ख़राब होने के बजाय अपनी रफ़्तार घटा लेता है। एक बात और: 91 °C सिर्फ़ उन readings में सबसे ऊँचा था जो router ने लीं; router sensor को मिनट में एक बार पढ़ता है, इसलिए बीच के peaks दर्ज नहीं हुए। फिर भी यह गर्मी नया router देखने की एक वजह बन गई थी। Hourly औसत दिन-रात 70 °C के आसपास रहता था, और SSD, memory और network chips उसी गर्म case में हैं। गर्मी आम तौर पर electronics की उम्र घटाती है, हालाँकि इस box पर मैंने न यह नापा, न SSD का तापमान।</p>
<h2 id="fvr-hi-s2">Fan पहले क्यों</h2>
<p>गर्म mini PC के लिए repaste आम सलाह है, और काफ़ी मुमकिन है कि उससे फ़ायदा होता। पर उसके लिए यह सब करना पड़ता:</p>
<ul>
<li>पहले configuration का backup;</li>
<li>99 प्रतिशत isopropyl alcohol और रेशे न छोड़ने वाले wipes;</li>
<li>45 से 60 मिनट तक network बंद;</li>
<li>एक sealed case खोलना, जिसके screws और thermal pads मैंने कभी नहीं देखे थे।</li>
</ul>
<p>Fins पर रखे fan के लिए इनमें से कुछ नहीं चाहिए था, और उसे एक सेकंड में हटाया जा सकता था। उसके अपने नुक़सान भी हैं। वह वही छीन लेता है जिसके लिए fanless box लिया जाता है: न शोर, न खिंचकर आती धूल, न घिसने वाला कोई हिस्सा।</p>
<p>इसलिए लगाने से पहले मैंने नियम तय किया: <strong>repaste तभी, जब fan लगे होने पर भी रात की readings 80 या उससे ऊपर पहुँचें।</strong></p>
<h2 id="fvr-hi-s3">Fan</h2>
<p>मैंने Noctua NF-F12 5V PWM चुना। Noctua के <a href="https://www.noctua.at/en/products/nf-f12-5v-pwm/specifications" rel="noopener">specification</a> के अनुसार यह 120 mm, 5 V, अधिकतम 1,500 rpm, सामान्यतः 0.65 W और पूरी रफ़्तार पर 22.4 dB(A) का है, और डिब्बे में USB power cable आती है। मेरा fan router के अपने ही एक USB port में लगा है। USB से चलाने पर fan को रफ़्तार का कोई signal नहीं मिलता, और Noctua की <a href="https://www.noctua.at/en/support/faqs/microcontroller-guide-pwm-setup-and-rpm-monitoring" rel="noopener">अपनी guide</a> कहती है कि बिना signal के PWM fan पूरी रफ़्तार पर चलता है। Noctua इस पर &#8220;5V PWM version, not for use in PCs&#8221; लिखता है, यानी यह 5V PWM संस्करण है, PC में इस्तेमाल के लिए नहीं: PC का 12 V fan header इसके लिए ग़लत supply है।</p>
<p>मेरे router पर 120 mm का fan ऊपरी सतह का ज़्यादातर हिस्सा ढक लेता है। Router के ऊपरी हिस्से के लगभग बराबर आकार का fan चुनें। Noctua छोटे आकारों में भी 5 V संस्करण बेचता है, जैसे 80 mm का NF-A8 5V PWM। कोई सस्ता 5 V USB fan भी हवा चलाएगा; मैंने ऐसा कोई fan आज़माया नहीं।</p>
<p>मैंने इसे 15 अक्टूबर को लगभग 17:30 पर लगाया। यह ऊपर के fins पर सपाट रखा है, screws से कसा नहीं है, और हवा नीचे fins में फेंकता है। एक फ़ोटो पढ़ते हुए Claude ने पहले हवा की दिशा उल्टी बताई; मैंने frame पर बना तीर देखा। किसी भी दिशा में हवा चले, मदद मिलनी चाहिए, पर मैं जानना चाहता था कि मैं किस दिशा को नाप रहा हूँ।</p>
<img src="https://techblog.viveksanghi.com/wp-content/uploads/2026/10/fan-on-router-top-crop.jpg" alt="Router के fins वाले ऊपरी हिस्से पर सपाट रखा Noctua fan, ऊपर से देखने पर" loading="lazy" decoding="async">
<img src="https://techblog.viveksanghi.com/wp-content/uploads/2026/10/fan-on-router-front-crop.jpg" alt="Network ports वाले सिरे से router: ports में cables लगे हैं और ऊपर fan रखा है" loading="lazy" decoding="async">
<h2 id="fvr-hi-s4">Router ने क्या दर्ज किया</h2>
<p>OPNsense CPU तापमान मिनट में एक बार पढ़ता है और hourly औसत हफ़्तों तक रखता है। अपने router का तापमान कैसे पढ़ें, यह आगे है।</p>
<img src="https://techblog.viveksanghi.com/wp-content/uploads/2026/11/cpu0-hourly-sep-oct-2026.v2.png" alt="16 सितंबर 2026 से fan लगने के चार दिन बाद तक router के CPU तापमान के hourly औसत का line chart। 9 अक्टूबर तक यह लगभग 65 से 74 °C के बीच रहता है, 10 अक्टूबर की configuration की सफ़ाई के दौरान 77 °C तक जाता है, फिर लगभग 60 से 71 °C के बीच टिकता है, और 15 अक्टूबर को 17:30 पर fan लगने के बाद वाले घंटे में लगभग 46 °C पर गिरकर वहीं रहता है।" loading="lazy" decoding="async">
<p><code>cpu0</code> के hourly औसत, router के hourly archive से:</p>
<table>
<thead>
<tr>
<th>अवधि</th>
<th>घंटे</th>
<th>औसत</th>
<th>सबसे ठंडा घंटा</th>
<th>सबसे गर्म घंटा</th>
</tr>
</thead>
<tbody>
<tr>
<td>16 सितंबर – 9 अक्टूबर</td>
<td>567</td>
<td>69.7 °C</td>
<td>65.3 °C</td>
<td>73.7 °C</td>
</tr>
<tr>
<td>11 अक्टूबर – 15 अक्टूबर, fan लगने तक</td>
<td>114</td>
<td>66.2 °C</td>
<td>60.5 °C</td>
<td>70.9 °C</td>
</tr>
<tr>
<td>15 अक्टूबर, fan के बाद (चार दिन)</td>
<td>100</td>
<td>46.4 °C</td>
<td>42.6 °C</td>
<td>48.6 °C</td>
</tr>
</tbody>
</table>
<p>10 अक्टूबर मैंने छोड़ दिया है; उस दिन की configuration की सफ़ाई का ज़िक्र नीचे है। ठीक पहले के दिनों की तुलना में fan ने औसत लगभग 20 °C घटाया। पहले और बाद के दायरे एक-दूसरे को छूते नहीं: fan से पहले का सबसे ठंडा घंटा, बाद के सबसे गर्म घंटे से 12 °C ज़्यादा गर्म था।</p>
<p>मैंने जो नियम तय किया था, वह रात की readings के बारे में था। 15 अक्टूबर को मैंने per-minute रिकॉर्ड से 03:00–10:00 का समय पढ़ा, और 16 अक्टूबर को वही समय फिर पढ़ा:</p>
<table>
<thead>
<tr>
<th><code>cpu0</code>, 03:00–10:00</th>
<th>15 अक्टूबर, बिना fan</th>
<th>16 अक्टूबर, fan के साथ</th>
</tr>
</thead>
<tbody>
<tr>
<td>औसत</td>
<td>65.6 °C</td>
<td>46.7 °C</td>
</tr>
<tr>
<td>अधिकतम</td>
<td>90.3 °C</td>
<td>73.6 °C</td>
</tr>
<tr>
<td>80 °C या उससे ऊपर की readings</td>
<td>19</td>
<td>0</td>
</tr>
</tbody>
</table>
<p>कोई reading 80 या उससे ऊपर नहीं पहुँची। नियम के मुताबिक़ case बंद ही रहना था।</p>
<p>मेरा नियम अकेली readings पर टिका था, और अकेली readings उछलती हैं। हर reading एक पल की होती है: 28 अक्टूबर को लगातार मिनटों में 35.3, 68.2, 69.0 और 35.7 °C दर्ज हुए। घंटों का औसत बेहतर कसौटी होता। Hourly औसत के हिसाब से अंतर और भी बड़ा है: fan के बाद कोई घंटा 48.6 °C से ऊपर नहीं गया।</p>
<details>
<summary>गहराई से: 15 अक्टूबर के per-minute समय-खंड</summary>
<p>15 अक्टूबर को per-minute रिकॉर्ड से पढ़ा गया।</p>
<table>
<thead>
<tr>
<th>समय, 15 अक्टूबर 2026</th>
<th>Readings</th>
<th>औसत</th>
<th>Median</th>
<th>95th percentile</th>
<th>अधिकतम</th>
<th>80 °C या ऊपर</th>
</tr>
</thead>
<tbody>
<tr>
<td>03:00–10:00, बिना fan</td>
<td>420</td>
<td>65.6 °C</td>
<td>69.0 °C</td>
<td>79.8 °C</td>
<td>90.3 °C</td>
<td>19</td>
</tr>
<tr>
<td>12:00–17:20, बिना fan</td>
<td>320</td>
<td>65.5 °C</td>
<td>68.7 °C</td>
<td>80.1 °C</td>
<td>90.7 °C</td>
<td>16</td>
</tr>
<tr>
<td>17:31–19:12, fan के साथ</td>
<td>101</td>
<td>46.0 °C</td>
<td>48.7 °C</td>
<td>60.5 °C</td>
<td>69.6 °C</td>
<td>0</td>
</tr>
<tr>
<td>19:20–19:37, firmware update और reboot के बाद</td>
<td>17</td>
<td>54.1 °C</td>
<td>57.1 °C</td>
<td>70.8 °C</td>
<td>70.8 °C</td>
<td>0</td>
</tr>
</tbody>
</table>
<p>आख़िरी पंक्ति ज़्यादा है, क्योंकि router अभी-अभी firmware update के बाद reboot हुआ था और लगभग 27 लाख blocklist entries लोड कर रहा था। यह आराम की स्थिति का आँकड़ा नहीं है।</p>
</details>
<h2 id="fvr-hi-s5">यह क्या दिखाता है और क्या नहीं</h2>
<p>यह दिखाता है कि यहाँ एक fan काफ़ी था। इससे यह साबित नहीं होता कि repaste से भी फ़ायदा न होता; मैंने उसे कभी आज़माया नहीं। Fan कैबिनेट से गर्मी बाहर नहीं निकालता। वह कैबिनेट की हवा को router के fins के बीच से धकेलता है। बंद कैबिनेट ने शुरुआती स्थिति को और बिगाड़ा था, इसलिए यहाँ का फ़ायदा शायद खुली हवा में होने वाले फ़ायदे से ज़्यादा है।</p>
<ul>
<li><strong>मैंने कमरे का तापमान नहीं नापा।</strong> गिरावट एक घंटे के भीतर आई, और कोई कमरा एक घंटे में 20 °C ठंडा नहीं होता। साथ ही, router पर दिन-रात के चक्र का असर कम पड़ता है: 16 सितंबर से 9 अक्टूबर तक दिन के हर घंटे का औसत 69.2 और 70.3 °C के बीच रहा, यानी लगभग 1 °C का उतार-चढ़ाव।</li>
<li><strong>उसी शाम firmware बदला।</strong> Router पर 15 अक्टूबर को 19:12 पर firmware update हुआ। गिरावट पहले आई: fan लगने और update के बीच के 101 मिनटों का औसत 46.0 °C था।</li>
<li><strong>Configuration की सफ़ाई पाँच दिन पहले हुई थी।</strong> 10 अक्टूबर को मैंने एक WireGuard VPN client हटाया, बिना इस्तेमाल पड़ा एक proxy stack (Squid, ClamAV, Redis और उनके साथी) और उसे traffic भेजने वाले NAT rules हटाए, अपनी DNS blocklists छाँटीं, और एक USB network adapter निकाल दिया। Hourly औसत 16 सितंबर से 9 अक्टूबर तक 69.7 °C था और 11 अक्टूबर से fan लगने तक 66.2 °C। यह गिरावट तीन-चार दिनों में क़दम-दर-क़दम आई, और मैं उन बदलावों के असर को मौसम से अलग नहीं कर सकता। इसी वजह से ऊपर की तुलना में सिर्फ़ fan से ठीक पहले के दिन लिए गए हैं।</li>
<li><strong>कोई power settings नहीं बदलीं।</strong> Router का configuration history 13 अक्टूबर से शुरू होता है (30 revisions) और तब से power settings, thermal settings या tunables में कोई बदलाव नहीं दिखाता।</li>
<li><strong>मैंने load को नियंत्रित नहीं किया।</strong> ये घर के network के आम दिन हैं।</li>
<li><strong>यह सिर्फ़ एक router है, एक ही कैबिनेट में।</strong></li>
</ul>
<details>
<summary>एक अनुमान जो मैंने साबित नहीं किया: dashboard</summary>
<p>13 अक्टूबर को, लगभग 20 घंटे के uptime पर, मैंने process के हिसाब से CPU time की तुलना की। DNS resolver Unbound ने 16 सेकंड लिए थे, यानी एक core का लगभग 0.02 प्रतिशत, जबकि वह network के devices से रोज़ आने वाले लगभग 10,000 अनचाहे lookups का जवाब दे रहा था। Web interface और API चलाने वाले PHP processes ने 5 मिनट 9 सेकंड लिए थे, लगभग 20 गुना, और उस snapshot में वे PHP workers नहीं गिने गए जो तब तक बंद हो चुके थे।</p>
<p>फिर भी, 20 घंटों में 5 मिनट एक core का लगभग 0.4 प्रतिशत है। अगर खुले dashboard ने, जिसके widgets हर कुछ सेकंड में refresh होते हैं, तापमान बढ़ाया, तो छोटे-छोटे झटकों में बढ़ाया। उस हफ़्ते दिखे कुछ 78 °C वाले spikes के पीछे मुझे इन्हीं झटकों का शक था। मैंने इसकी जाँच नहीं की।</p>
</details>
<h2 id="fvr-hi-s6">अपने router को पढ़ना</h2>
<p>OPNsense अपने health रिकॉर्ड <strong>Reporting → Health</strong> में ग्राफ़ के रूप में दिखाता है। CPU तापमान का ग्राफ़ देखने के लिए:</p>
<ol>
<li>Browser में router का web interface खोलें: address bar में वह पता लिखें जिससे आप router का प्रबंधन करते हैं, <strong>Enter</strong> दबाएँ, और log in करें। अगर आपको पता न मालूम हो, तो जिसने router लगाया था उससे पूछ लें। Router अपना ही security certificate इस्तेमाल करता है, इसलिए browser चेतावनी दे सकता है कि connection private नहीं है; आपके अपने router के पते के लिए यह अपेक्षित है। <strong>Advanced</strong> पर click करें, फिर उस link पर जो पते पर आगे बढ़ाता है (Chrome में <strong>Proceed</strong>, Firefox में <strong>Accept the Risk and Continue</strong>)।</li>
<li>Menu में <strong>Reporting → Health</strong> खोलें। पेज कुछ सेकंड में लोड होता है और कुछ नहीं बदलता। यह अपनी reports को विषय के हिसाब से सूचीबद्ध करता है।</li>
<li>पेज की reports की सूची में CPU तापमान की report ढूँढें। अगर कोई न हो, तो <strong>System → Settings → Miscellaneous → Thermal Sensors</strong> खोलें; मेरे यहाँ यह &#8220;Intel Core<em> CPU on-die thermal sensor (coretemp)&#8221; पर सेट है। इस setting को बदलने से router बदल जाता है: पहले पुराना मान लिख लें, </em><em>Save</em>* दबाएँ, और कुछ मिनट रुकें जब तक router अपनी readings न ले ले। इसे पलटने के लिए पुराना मान फिर चुनें; इस setting को वापस none पर करने के लिए reboot चाहिए।</li>
</ol>
<p>यही data router के API से भी मिलता है, <code>GET /api/diagnostics/systemhealth/get_system_health/cputemp-system/0</code> पर। आख़िर का अंक एक archive चुनता है: <code>/0</code> में हर मिनट का एक मान है, और बड़े अंकों वाले archives में मान लंबे अंतराल पर होते हैं, यानी कम बारीक। हर archive कितनी देर का है, यह इस पर निर्भर है कि router का तापमान database कब बना था:</p>
<table>
<thead>
<tr>
<th>Archive</th>
<th>मेरा router (पुराने OPNsense से बना database)</th>
<th>नया OPNsense 26.x install</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>/0</code></td>
<td>1 मिनट, 1,000 slots: 16 घंटे 40 मिनट</td>
<td>1 मिनट, 1,200 slots: 20 घंटे</td>
</tr>
<tr>
<td><code>/1</code></td>
<td>5 मिनट, 1,000 slots: लगभग 3½ दिन</td>
<td>5 मिनट, 720 slots: 60 घंटे</td>
</tr>
<tr>
<td><code>/2</code></td>
<td>1 घंटा, 1,000 slots: लगभग 6 हफ़्ते</td>
<td>1 घंटा, 1,860 slots: लगभग 11 हफ़्ते</td>
</tr>
<tr>
<td><code>/3</code></td>
<td>12 घंटे, 3,000 slots: लगभग 4 साल</td>
<td>1 दिन, 2,284 slots: लगभग 6 साल</td>
</tr>
</tbody>
</table>
<p>OPNsense upgrade के बाद भी मौजूदा database को बनाए रखता है, इसलिए पुराना router पुराना layout ही रखता है। आख़िरी कॉलम 26.7 के source code से है; मैंने कोई नया install नहीं देखा।</p>
<p>इससे दो बातें निकलती हैं। पिछली रात का per-minute रिकॉर्ड आज सुबह पढ़ें; शाम तक वे मिनट जा चुके होते हैं और सिर्फ़ लंबे अंतराल के औसत बचते हैं। और hourly archive इतना लंबा है कि बिना योजना के भी पहले-और-बाद की तुलना हो जाती है। Fan लगाते समय मेरे archive में एक महीने का &#8220;पहले&#8221; दर्ज हो चुका था।</p>
<details>
<summary>गहराई से: archives में क्या रहता है, और hourly आँकड़े spikes क्यों छिपा लेते हैं</summary>
<p>API सिर्फ़ औसत देता है। OPNsense की <a href="https://github.com/opnsense/core/blob/master/src/opnsense/scripts/health/fetchData.py" rel="noopener"><code>fetchData.py</code></a> केवल उन round-robin archives को process करती है जिनका consolidation function <code>AVERAGE</code> है, और हर archive का एक &#8220;set&#8221; बनाती है। Router हर मिनट sensor की एक तात्कालिक reading रखता है; हर hourly मान उन readings का औसत है। 91 °C की एक अकेली reading उसे मुश्किल से हिलाती है।</p>
<p>जिन slots में कोई reading नहीं है, वे ख़ाली मानों के रूप में लौटते हैं। यही script ख़ाली slots को सिर्फ़ series की शुरुआत में हटा देती है। इसलिए जब archive के सबसे पुराने slots ख़ाली हों, जैसे नए database में, तो slots की गिनती archive की लंबाई को कम करके दिखाती है। नीचे का snippet readings और ख़ाली slots अलग-अलग बताता है।</p>
</details>
<details>
<summary>गहराई से: अपने router का सार निकालने के लिए एक console snippet (PC के लिए)</summary>
<p>Health ग्राफ़ उतार-चढ़ाव का रूप दिखाता है। यह snippet आँकड़े छापता है: एक archive के लिए औसत, median, 95th percentile और अधिकतम, और कितनी readings 80 °C तक पहुँचीं। यह router के अपने health API को एक read request (एक GET) भेजता है और कुछ नहीं बदलता।</p>
<p><strong>शुरू करने से पहले</strong></p>
<ul>
<li>आपको Chrome या Firefox वाला PC चाहिए, और router के web interface का ऐसा login जो Reporting → Health खोल सके।</li>
<li>आप browser के developer console में, router के अपने पेज पर टाइप करते हैं। कुछ install नहीं करना पड़ता।</li>
<li>इसमें दो से तीन मिनट लगते हैं।</li>
<li>यह router या PC पर कुछ नहीं बदलता, इसलिए वापस करने को कुछ नहीं है। काम पूरा होने पर console बंद कर दें।</li>
<li>नीचे के डिब्बों में <strong>Copy</strong> पूरे डिब्बे को copy करता है। टूटी रेखाओं वाला डिब्बा वह दिखाता है जो आपको दिखना चाहिए; उसे आप टाइप नहीं करते।</li>
</ul>
<p><strong>चरण</strong></p>
<ol>
<li>Chrome या Firefox में router का web interface खोलें: address bar में वह पता लिखें जिससे आप router का प्रबंधन करते हैं, <strong>Enter</strong> दबाएँ, और log in करें। आपको OPNsense का dashboard दिखना चाहिए। अगर login पेज न दिखे, तो पता जाँचें और देखें कि PC घर के network पर है। अगर browser चेतावनी दे कि connection private नहीं है, तो ऊपर graph के चरणों के चरण 1 में दिया note देखें।</li>
<li>किसी भी OPNsense पेज पर रहते हुए browser console खोलें: Windows और Linux पर Chrome में <strong>Ctrl+Shift+J</strong> या Firefox में <strong>Ctrl+Shift+K</strong>; Mac पर <strong>Cmd+Option+J</strong> या <strong>Cmd+Option+K</strong>। पेज के बगल में या नीचे एक panel खुलता है, जिसमें टाइप करने के लिए एक पंक्ति होती है। अगर वह किसी दूसरे tab पर खुले, तो <strong>Console</strong> tab पर click करें।</li>
<li>
<p>नीचे के डिब्बे में <strong>Copy</strong> दबाएँ। यह पूरा snippet copy कर लेता है।</p>
<div class="sf-box" data-mode="file" data-effect="read" data-effect-text="सिर्फ़ देखता है — आज़माना सुरक्षित है" data-where="OPNsense के पेज पर Browser console" data-how="पूरा snippet console में paste करें, फिर Enter दबाएँ"><pre><code>// Paste into the browser console on any OPNsense page while logged in.
// Read-only: one GET to the router's own health API. Changes nothing.
(async () =&gt; {
  const LEVEL = 0; // archive: 0 is the finest (one value a minute); higher numbers are coarser. How many exist depends on the router.
  const url = '/api/diagnostics/systemhealth/get_system_health/cputemp-system/' + LEVEL;
  let d;
  try {
    const r = await fetch(url);
    if (r.status === 401) { console.log('HTTP 401: not logged in. Log in to the OPNsense web interface in this browser, then paste again.'); return; }
    if (r.status === 403) { console.log('HTTP 403: logged in, but this user may not read Reporting &gt; Health. Use an account with that privilege.'); return; }
    if (!r.ok) { console.log('HTTP ' + r.status + ' from ' + url); return; }
    d = await r.json();
  } catch (e) {
    console.log('No JSON came back (' + e.message + '). Run this on an OPNsense page while logged in.'); return;
  }
  const series = d &amp;&amp; d.set &amp;&amp; d.set.data &amp;&amp; d.set.data[0];
  if (!series || !Array.isArray(series.values)) { console.log('No temperature series at LEVEL ' + LEVEL + '. A higher LEVEL may not exist on this router; at LEVEL 0, check that Reporting &gt; Health shows a CPU temperature graph.'); return; }
  const pts = series.values.filter(p =&gt; p[1] !== null &amp;&amp; !isNaN(p[1]));
  const empty = series.values.length - pts.length;
  if (pts.length === 0) { console.log('The series ' + series.key + ' has no readings at this level.'); return; }
  const v = pts.map(p =&gt; p[1]).sort((a, b) =&gt; a - b);
  const n = v.length;
  const median = n % 2 ? v[(n - 1) / 2] : (v[n / 2 - 1] + v[n / 2]) / 2;
  const p95 = v[Math.min(n - 1, Math.ceil(0.95 * n) - 1)]; // nearest-rank
  const when = t =&gt; new Date(t).toLocaleString(); // your browser's time zone; each time marks the end of its interval
  console.log('Series ' + series.key + ', one value every ' + d.set.step_size + ' s');
  console.log('From ' + when(pts[0][0]) + ' to ' + when(pts[n - 1][0]) + ': ' + n + ' readings, ' + empty + ' empty slots');
  console.log('Average ' + (v.reduce((a, b) =&gt; a + b, 0) / n).toFixed(1) + ' °C, median ' + median.toFixed(1) +
    ', 95th percentile ' + p95.toFixed(1) + ', maximum ' + v[n - 1].toFixed(1));
  console.log('Readings at 80 °C or above: ' + v.filter(x =&gt; x &gt;= 80).length);
})();</code></pre></div>
</li>
<li>
<p>Console की पंक्ति पर click करें, <strong>Ctrl+V</strong> (Mac पर <strong>Cmd+V</strong>) से paste करें और <strong>Enter</strong> दबाएँ। Browsers console में paste करना रोक सकते हैं, क्योंकि logged-in पेज में किसी अजनबी का code paste करवाना एक जानी-पहचानी चाल है। अनुमति देने से पहले snippet पढ़ लें। अगर browser &#8220;allow pasting&#8221; टाइप करने को कहे, तो उसके संदेश के अनुसार करें, फिर दोबारा paste करें।</p>
</li>
<li>
<p>एक-दो सेकंड में चार पंक्तियाँ दिखनी चाहिए (&#8220;Promise&#8221; से शुरू होने वाली पंक्ति को छोड़ दें): series का नाम, readings और ख़ाली slots की संख्या के साथ समय की अवधि, सार के आँकड़े, और 80 °C या उससे ऊपर की readings की गिनती। समय आपके browser के time zone में होते हैं, और हर समय अपने अंतराल का अंत बताता है। 28 अक्टूबर 2026 को मेरे router पर इसने यह छापा (मैंने समय छोड़ दिए हैं; उनका रूप आपके browser की settings पर निर्भर करता है):</p>
<div class="sf-box" data-mode="output" data-where="आपको क्या दिखना चाहिए"><pre><code>Series cpu0temp, one value every 60 s
From &lt;start time&gt; to &lt;end time&gt;: 1000 readings, 0 empty slots
Average 43.9 °C, median 47.7, 95th percentile 57.8, maximum 72.5
Readings at 80 °C or above: 0</code></pre></div>
</li>
<li>
<p>&#8220;HTTP 401&#8221; का मतलब है कि browser OPNsense में logged in नहीं है: log in करें और चरण 4 दोहराएँ। &#8220;HTTP 403&#8221; का मतलब है कि आप ऐसे user से logged in हैं जिसे Reporting → Health की अनुमति नहीं है।</p>
</li>
<li>Hourly archive पढ़ने के लिए snippet को पहले किसी plain text editor में paste करें (Windows पर Notepad, Mac पर plain text पर सेट TextEdit), <code>const LEVEL = 0;</code> को <code>const LEVEL = 2;</code> करें, वहाँ से पूरा copy करें, और चरण 4 और 5 दोहराएँ।</li>
<li>औसत की तुलना उसी archive के Reporting → Health ग्राफ़ के level से करें। दोनों मेल खाने चाहिए।</li>
<li>काम पूरा होने पर panel को उसके ऊपर दाईं ओर के <strong>×</strong> से बंद करें। Router पर कुछ नहीं बदला गया।</li>
</ol>
</details>
<h2 id="fvr-hi-s7">फ़ैसला</h2>
<p>Case बंद रहेगा और paste अपने डिब्बे में।</p>
<p>जो बचा है वह छोटा है। Fan को अपनी जगह पर पक्का करें, और उसे ऊपर उठाएँ: 10 से 15 mm के rubber feet उसे जगह पर रखेंगे और उसके hub के नीचे के fins तक हवा पहुँचने देंगे, जिन्हें सपाट पड़ा fan हवा से वंचित रखता है। Heatsinks के ऊपर लगे fans के लिए यह आम तरीका है; मैंने इसे यहाँ नापा नहीं। साइड की ग्रिल खुली रखें। पूरा कैबिनेट एक अलग समस्या है: fan router को ठंडा तो करता है, पर सिर्फ़ कैबिनेट की हवा के तापमान के क़रीब तक; और कैबिनेट की हवा कमरे की हवा से गर्म है। उस पर मैंने अलग से काम किया और शायद उस पर लिखूँ।</p>
<p>Fan से पहले यह गर्मी नया router देखने की एक वजह थी। अब नहीं है।</p>
<h2 id="fvr-hi-s8">गर्म अलमारी में fanless box रखने वाले से मैं क्या कहूँगा</h2>
<ol>
<li><strong>पहले वह पढ़ें जो router पहले से दर्ज करता है,</strong> कुछ भी खोलने से पहले। OPNsense पर यह Reporting → Health है, या ऊपर वाला API।</li>
<li><strong>देखें कि आपके router पर हर archive कितनी देर का है।</strong> यह इस पर निर्भर है कि उसका database कब बना था।</li>
<li><strong>कुछ भी बदलने से पहले तय करें कि कौन-सा नतीजा आपको अगले कदम पर भेजेगा।</strong></li>
<li><strong>अकेली readings पर नहीं, औसत पर फ़ैसला करें।</strong> लगातार मिनटों की readings में 30 °C का अंतर हो सकता है।</li>
<li><strong>पहले सस्ता और वापस लिया जा सकने वाला उपाय आज़माएँ,</strong> और उसकी क़ीमत भी तौलें: fan उस box में शोर और धूल लाता है जो इन दोनों से बचने के लिए लिया गया था।</li>
</ol>
<details>
<summary>शब्दावली</summary>
<ul>
<li><strong>Fanless (passive) cooling:</strong> case ही heatsink है; गर्मी बिना fan के, चालन और हवा के प्राकृतिक बहाव से निकलती है।</li>
<li><strong>Thermal paste / repaste:</strong> CPU और heatsink के बीच का वह पदार्थ जो सूक्ष्म खाली जगहें भरता है। Repaste का मतलब पुराना पदार्थ साफ़ करके नया लगाना।</li>
<li><strong>P-core / E-core:</strong> एक ही chip में Intel के performance और efficient cores। Pentium Gold 8505 में पहले वाला एक और दूसरे वाले चार हैं।</li>
<li><strong>TJUNCTION:</strong> ख़ुद chip के भीतर Intel द्वारा अनुमत सबसे ऊँचा तापमान। 8505 के लिए यह 100 °C है।</li>
<li><strong>PWM:</strong> pulse-width modulation; एक signal तार जो fan को बताता है कि कितनी तेज़ घूमे।</li>
<li><strong>Round-robin database (RRD):</strong> तय आकार का भंडार, जो हाल का data बारीक रूप में और पुराना data लंबे अंतराल के औसत के रूप में रखता है, और सबसे पुराने को मिटाकर लिखता है।</li>
<li><strong>Median / 95th percentile:</strong> median बीच की reading है (या दो बीच वाली readings का औसत); 95 प्रतिशत readings 95th percentile के बराबर या उससे नीचे होती हैं।</li>
<li><strong>API:</strong> router का programming interface; वही data जो web पेज दिखाते हैं, JSON के रूप में।</li>
<li><strong>Tunables:</strong> kernel settings जिन्हें OPNsense boot के समय लागू करता है; ये System → Settings → Tunables में सूचीबद्ध हैं।</li>
</ul>
</details>
</div>
<div class="fvr-panel" id="fvr-panel-te" lang="te">
<p class="fvr-title">Paste ఇంకా దాని పెట్టెలోనే ఉంది</p>
<p>15 అక్టోబర్ 2026న నా డెస్క్ మీద ఒకే సమస్యకు రెండు పరిష్కారాలు ఉన్నాయి: 4 g ARCTIC MX-7 thermal paste ట్యూబ్ ఒకటి, 120 mm Noctua fan ఒకటి. సమస్య నా router. అది మూసి ఉన్న ప్లైవుడ్ క్యాబినెట్‌లో OPNsense నడుపుతున్న ఒక fanless mini PC. అంతకు ముందు రోజు దాని CPU 91 °C ను తాకింది.</p>
<p>ఆన్‌లైన్‌లో నాకు దొరికిన సలహా కేస్ తెరిచి paste మార్చమని. స్క్రూడ్రైవర్ అవసరం లేదు కాబట్టి నేను ముందు fan పెట్టాను. పెట్టే ముందే, ఏ ఫలితం వస్తే paste దగ్గరకు తిరిగి వెళ్ళాలో నిర్ణయించుకున్నాను.</p>
<p>ఆ అవసరం రాలేదు. Router మొదటి నుంచీ తన ఉష్ణోగ్రతను తానే నమోదు చేసుకుంటూ ఉంది. 16 సెప్టెంబర్ నుంచి 15 అక్టోబర్ సాయంత్రం వరకు, ఏ గంట సగటూ 60 °C కంటే తక్కువ లేదు. Fan పెట్టిన తర్వాతి నాలుగు రోజుల్లో, ఏ గంట సగటూ 49 °C దాటలేదు. Paste ఇంకా దాని పెట్టెలోనే ఉంది.</p>
<p>ఈ పని నేను Anthropic తయారుచేసిన AI మోడల్ Claude తో కలిసి చేశాను. అది నా సొంత బ్రౌజర్ సెషన్ ద్వారా నా router ను చదవగలిగింది. పార్టులు నేను ఎంచుకున్నాను, fan నేను పెట్టాను, నియమం నేను పెట్టాను. Claude ఉష్ణోగ్రత రికార్డులు తీసి లెక్కలు చేసింది. 28 అక్టోబర్‌న ఈ పోస్ట్ కోసం router గంటవారీ డేటాను మళ్ళీ చదివి చెప్పింది.</p>
<h2 id="fvr-te-s1">బాక్స్, క్యాబినెట్</h2>
<p>ఈ router ఆరు పోర్టులు ఉన్న ఒక fanless mini PC. దీన్ని &#8220;Shenzhen Weibu&#8221; పేరుతో అమ్ముతారు. లోపల Intel Pentium Gold 8505 ఉంది. <a href="https://www.intel.com/content/www/us/en/products/sku/226265/intel-pentium-gold-processor-8505-8m-cache-up-to-4-40-ghz-with-ipu/specifications.html" rel="noopener">Intel స్పెసిఫికేషన్ పేజీ</a> ప్రకారం దానిలో ఒక పెర్ఫార్మెన్స్ కోర్, నాలుగు ఎఫిషియెంట్ కోర్లు, ఆరు థ్రెడ్లు ఉన్నాయి; బేస్ పవర్ 15 W, టర్బోలో 55 W వరకు. దీనికి 20 GB RAM, ఆరు Intel I226-V 2.5 GbE పోర్టులు ఉన్నాయి. ఇది OPNsense 26.7 నడుపుతుంది. కేసే heatsink. దాని పైభాగం fins ఉన్న ఒక బ్లాక్.</p>
<p>ఇది ఇతర నెట్‌వర్క్ పరికరాలతో కలిసి మూసి ఉన్న ఒక ప్లైవుడ్ క్యాబినెట్‌లో ఉంటుంది. క్యాబినెట్ పక్క ప్యానెల్‌లోని చీలికల గ్రిల్ ఒక్కటే వేడి గాలి బయటకు పోవడానికి అనుకున్న దారి.</p>
<img src="https://techblog.viveksanghi.com/wp-content/uploads/2026/10/router-before-fan-crop-grille.jpg" alt="Fan పెట్టక ముందు router, USB వైపు నుంచి: పైభాగం fins బ్లాక్‌గా ఉన్న నల్లటి కేస్, పక్కనే క్యాబినెట్ పక్క ప్యానెల్‌లోని చీలికల గ్రిల్" loading="lazy" decoding="async">
<p>91 °C ప్రమాదకరమా? Intel అంకెల ప్రకారం కాదు. అదే పేజీ చిప్ గరిష్ఠ junction ఉష్ణోగ్రత (TJUNCTION) 100 °C అని చెబుతుంది. ఆ పరిమితికి చేరిన ప్రాసెసర్ పాడవడానికి బదులు తన వేగాన్ని తానే తగ్గించుకుంటుంది. పైగా 91 °C అనేది నమోదైన రీడింగుల్లో అత్యధికం మాత్రమే; router సెన్సార్‌ను నిమిషానికి ఒకసారి చదువుతుంది, కాబట్టి రెండు రీడింగుల మధ్య వచ్చిన గరిష్ఠాలు నమోదు కాలేదు. అయినా, ఈ వేడి కొత్త router చూడడానికి ఒక కారణంగా మారింది. గంటవారీ సగటు పగలూ రాత్రీ 70 °C దగ్గరే ఉంది, SSD, మెమరీ, నెట్‌వర్క్ చిప్‌లు అదే వేడి కేస్‌లో ఉంటాయి. సాధారణంగా వేడి ఎలక్ట్రానిక్స్ ఆయుష్షును తగ్గిస్తుంది, కానీ ఆ ప్రభావాన్ని గానీ SSD ఉష్ణోగ్రతను గానీ ఈ బాక్స్ మీద నేను కొలవలేదు.</p>
<h2 id="fvr-te-s2">Fan ఎందుకు ముందు</h2>
<p>వేడెక్కే mini PC కి repaste అనేది మామూలుగా ఇచ్చే సలహా, అది సహాయపడి ఉండవచ్చు కూడా. కానీ దానికి ఇవి కూడా అవసరమయ్యేవి:</p>
<ul>
<li>ముందుగా ఒక కాన్ఫిగరేషన్ బ్యాకప్;</li>
<li>99 శాతం ఐసోప్రొపైల్ ఆల్కహాల్, పోగులు వదలని వైప్స్;</li>
<li>నెట్‌వర్క్ 45 నుంచి 60 నిమిషాలు ఆఫ్‌లైన్‌లో ఉండడం;</li>
<li>నేను ఎప్పుడూ చూడని స్క్రూలు, thermal pads ఉన్న సీల్ చేసిన కేస్‌ను తెరవడం.</li>
</ul>
<p>Fins మీద పడుకోబెట్టిన fan కి అవేవీ అవసరం లేదు, దాన్ని ఒక్క క్షణంలో తీసేయొచ్చు కూడా. దానికీ దాని నష్టాలు ఉన్నాయి. Fanless బాక్స్ దేనికోసమో దాన్నే ఇది వదులుకుంటుంది: శబ్దం లేకపోవడం, దుమ్ము లోపలికి రాకపోవడం, అరిగిపోయే కదిలే భాగం లేకపోవడం.</p>
<p>అందుకే పెట్టే ముందే నియమం పెట్టుకున్నాను: <strong>fan ఉన్నా రాత్రి రీడింగులు ఇంకా 80ల్లోకి వెళ్తేనే repaste.</strong></p>
<h2 id="fvr-te-s3">Fan</h2>
<p>నేను Noctua NF-F12 5V PWM ఎంచుకున్నాను. Noctua <a href="https://www.noctua.at/en/products/nf-f12-5v-pwm/specifications" rel="noopener">స్పెసిఫికేషన్</a> ప్రకారం ఇది 120 mm, 5 V, 1,500 rpm వరకు, సాధారణంగా 0.65 W, పూర్తి వేగంలో 22.4 dB(A); బాక్స్‌లో ఒక USB పవర్ కేబుల్ ఉంటుంది. నా fan router లోని ఒక USB పోర్టుకు కనెక్ట్ అయి ఉంది. USB నుంచి పవర్ ఇస్తే fan కి వేగాన్ని చెప్పే సిగ్నల్ ఏదీ అందదు. సిగ్నల్ లేని PWM fan పూర్తి వేగంతో తిరుగుతుందని Noctua <a href="https://www.noctua.at/en/support/faqs/microcontroller-guide-pwm-setup-and-rpm-monitoring" rel="noopener">సొంత గైడ్</a> చెబుతుంది. Noctua దీని మీద &#8220;5V PWM version, not for use in PCs&#8221; అని గుర్తు పెడుతుంది, అంటే ఇది 5V PWM వెర్షన్, PC లలో వాడడానికి కాదు: PC లోని 12 V fan header దీనికి తగిన సప్లై కాదు.</p>
<p>నా router మీద 120 mm fan పైభాగంలో ఎక్కువ భాగాన్ని కప్పుతుంది. Router పైభాగం పరిమాణానికి దగ్గరగా ఉండే fan ను ఎంచుకోండి. Noctua చిన్న పరిమాణాల్లోనూ 5 V వెర్షన్లు అమ్ముతుంది, ఉదాహరణకు 80 mm NF-A8 5V PWM. చౌకైన 5 V USB fan కూడా గాలిని కదిలిస్తుంది; నేను అలాంటిది ప్రయత్నించలేదు.</p>
<p>15 అక్టోబర్‌న సుమారు 17:30కి దీన్ని పెట్టాను. ఇది పై fins మీద స్క్రూలు లేకుండా సమతలంగా పడుకుని ఉంది, వాటిలోకి కిందికి గాలి ఊదుతుంది. ఫోటో చూసి చదివినప్పుడు Claude మొదట గాలి దిశను తారుమారుగా చెప్పింది; ఫ్రేమ్‌లో అచ్చుపోసిన బాణాన్ని నేను చెక్ చేశాను. ఏ దిశ అయినా సహాయపడాలి, కానీ నేను కొలుస్తున్నది ఏ దిశనో తెలుసుకోవాలనుకున్నాను.</p>
<img src="https://techblog.viveksanghi.com/wp-content/uploads/2026/10/fan-on-router-top-crop.jpg" alt="router fins ఉన్న పైభాగం మీద సమతలంగా పడుకున్న Noctua fan, పై నుంచి చూసినప్పుడు" loading="lazy" decoding="async">
<img src="https://techblog.viveksanghi.com/wp-content/uploads/2026/10/fan-on-router-front-crop.jpg" alt="నెట్‌వర్క్ పోర్టుల వైపు నుంచి router, పోర్టులకు కేబుల్స్ ఉన్నాయి, పైన fan ఉంది" loading="lazy" decoding="async">
<h2 id="fvr-te-s4">Router ఏమి నమోదు చేసింది</h2>
<p>OPNsense నిమిషానికి ఒకసారి CPU ఉష్ణోగ్రతను చదువుతుంది, గంటవారీ సగటులను వారాల తరబడి ఉంచుతుంది. మీ router ది ఎలా చదవాలో కింద ఉంది.</p>
<img src="https://techblog.viveksanghi.com/wp-content/uploads/2026/11/cpu0-hourly-sep-oct-2026.v2.png" alt="16 సెప్టెంబర్ 2026 నుంచి fan పెట్టిన నాలుగు రోజుల తర్వాత వరకు router గంటవారీ సగటు CPU ఉష్ణోగ్రత లైన్ చార్ట్. 9 అక్టోబర్ వరకు ఇది సుమారు 65 నుంచి 74 °C మధ్య ఉంటుంది, 10 అక్టోబర్ క్లీన్-అప్ సమయంలో 77 °C గరిష్ఠానికి చేరుతుంది, తర్వాత సుమారు 60 నుంచి 71 °C మధ్య స్థిరపడుతుంది, 15 అక్టోబర్ 17:30కి fan పెట్టిన తర్వాతి గంటలో సుమారు 46 °C కి పడిపోయి అక్కడే ఉంటుంది." loading="lazy" decoding="async">
<p>Router గంటవారీ archive నుంచి, <code>cpu0</code> గంటవారీ సగటులు:</p>
<table>
<thead>
<tr>
<th>కాలం</th>
<th>గంటలు</th>
<th>సగటు</th>
<th>అతి తక్కువ గంట సగటు</th>
<th>అతి ఎక్కువ గంట సగటు</th>
</tr>
</thead>
<tbody>
<tr>
<td>16 సెప్టెంబర్ – 9 అక్టోబర్</td>
<td>567</td>
<td>69.7 °C</td>
<td>65.3 °C</td>
<td>73.7 °C</td>
</tr>
<tr>
<td>11 అక్టోబర్ – 15 అక్టోబర్, fan పెట్టే వరకు</td>
<td>114</td>
<td>66.2 °C</td>
<td>60.5 °C</td>
<td>70.9 °C</td>
</tr>
<tr>
<td>15 అక్టోబర్, fan పెట్టిన తర్వాత (నాలుగు రోజులు)</td>
<td>100</td>
<td>46.4 °C</td>
<td>42.6 °C</td>
<td>48.6 °C</td>
</tr>
</tbody>
</table>
<p>10 అక్టోబర్‌ను వదిలేశాను; కింద వివరించిన కాన్ఫిగరేషన్ క్లీన్-అప్ జరిగిన రోజు అది. Fan కి వెంటనే ముందున్న రోజులతో పోలిస్తే, fan సగటు నుంచి సుమారు 20 °C తగ్గించింది. ముందు, తర్వాత పరిధులు ఒకదానితో ఒకటి కలవవు: fan కి ముందు అత్యంత చల్లని గంట, fan తర్వాత అత్యంత వేడి గంట కంటే 12 °C ఎక్కువ వేడిగా ఉంది.</p>
<p>నేను పెట్టిన నియమం రాత్రి రీడింగుల గురించి. 15 అక్టోబర్‌న నిమిషవారీ రికార్డు నుంచి 03:00–10:00 విండోను చదివాను, 16 అక్టోబర్‌న అదే విండోను మళ్ళీ చదివాను:</p>
<table>
<thead>
<tr>
<th><code>cpu0</code>, 03:00–10:00</th>
<th>15 అక్టోబర్, fan లేకుండా</th>
<th>16 అక్టోబర్, fan తో</th>
</tr>
</thead>
<tbody>
<tr>
<td>సగటు</td>
<td>65.6 °C</td>
<td>46.7 °C</td>
</tr>
<tr>
<td>గరిష్ఠం</td>
<td>90.3 °C</td>
<td>73.6 °C</td>
</tr>
<tr>
<td>80 °C లేదా అంతకు పైన ఉన్న రీడింగులు</td>
<td>19</td>
<td>0</td>
</tr>
</tbody>
</table>
<p>ఏ రీడింగూ 80ల్లోకి చేరలేదు. నియమం ప్రకారం కేస్ మూసే ఉంచాలి.</p>
<p>నా నియమం ఒక్కొక్క రీడింగును వాడింది, ఒక్కొక్క రీడింగు ఎగుడుదిగుడుగా ఉంటుంది. ప్రతి రీడింగూ ఒక క్షణం విలువ మాత్రమే: 28 అక్టోబర్‌న వరుస నిమిషాల్లో 35.3, 68.2, 69.0, 35.7 °C వచ్చాయి. కొన్ని గంటల సగటు అయితే మెరుగైన పరీక్ష అయ్యేది. గంటవారీ సగటుల ప్రకారం తేడా ఇంకా ఎక్కువ: fan తర్వాత ఏ గంట సగటూ 48.6 °C దాటలేదు.</p>
<details>
<summary>లోతైన వివరణ: 15 అక్టోబర్ నిమిషవారీ విండోలు</summary>
<p>15 అక్టోబర్‌న నిమిషవారీ రికార్డు నుంచి చదివినవి.</p>
<table>
<thead>
<tr>
<th>విండో, 15 అక్టోబర్ 2026</th>
<th>రీడింగులు</th>
<th>సగటు</th>
<th>మీడియన్</th>
<th>95వ పర్సెంటైల్</th>
<th>గరిష్ఠం</th>
<th>80 °C లేదా పైన</th>
</tr>
</thead>
<tbody>
<tr>
<td>03:00–10:00, fan లేకుండా</td>
<td>420</td>
<td>65.6 °C</td>
<td>69.0 °C</td>
<td>79.8 °C</td>
<td>90.3 °C</td>
<td>19</td>
</tr>
<tr>
<td>12:00–17:20, fan లేకుండా</td>
<td>320</td>
<td>65.5 °C</td>
<td>68.7 °C</td>
<td>80.1 °C</td>
<td>90.7 °C</td>
<td>16</td>
</tr>
<tr>
<td>17:31–19:12, fan తో</td>
<td>101</td>
<td>46.0 °C</td>
<td>48.7 °C</td>
<td>60.5 °C</td>
<td>69.6 °C</td>
<td>0</td>
</tr>
<tr>
<td>19:20–19:37, firmware అప్‌డేట్, రీబూట్ తర్వాత</td>
<td>17</td>
<td>54.1 °C</td>
<td>57.1 °C</td>
<td>70.8 °C</td>
<td>70.8 °C</td>
<td>0</td>
</tr>
</tbody>
</table>
<p>చివరి వరుస ఎక్కువగా ఉంది, ఎందుకంటే router అప్పుడే firmware update తర్వాత రీబూట్ అయి, ఆ సమయంలో సుమారు 2.7 మిలియన్ blocklist ఎంట్రీలను లోడ్ చేస్తూ ఉంది. అది విశ్రాంతి స్థితిలోని అంకె కాదు.</p>
</details>
<h2 id="fvr-te-s5">ఇది ఏమి చూపిస్తుంది, ఏమి చూపించదు</h2>
<p>ఇక్కడ fan సరిపోయిందని ఇది చూపిస్తుంది. Repaste కూడా సహాయపడేది కాదని ఇది చూపించదు; నేను repaste ప్రయత్నించలేదు. Fan క్యాబినెట్ నుంచి వేడిని బయటకు తీయదు. అది క్యాబినెట్ గాలిని router fins గుండా బలవంతంగా పంపుతుంది. మూసిన క్యాబినెట్ వల్ల మొదలుపెట్టిన స్థితి మరింత చెడ్డగా ఉండింది, కాబట్టి ఇక్కడ వచ్చిన మెరుగుదల బహిరంగ గాలిలో వచ్చేదానికంటే బహుశా ఎక్కువ.</p>
<ul>
<li><strong>గది ఉష్ణోగ్రతను నేను కొలవలేదు.</strong> తగ్గుదల ఒక్క గంటలోనే వచ్చింది, ఒక గది ఒక గంటలో 20 °C చల్లబడదు. Router రోజువారీ పగలు-రాత్రి చక్రానికి కూడా కొద్దిగానే స్పందిస్తుంది: 16 సెప్టెంబర్ నుంచి 9 అక్టోబర్ వరకు, రోజులోని ప్రతి గంట సగటు 69.2, 70.3 °C మధ్యే ఉంది, అంటే సుమారు 1 °C హెచ్చుతగ్గు.</li>
<li><strong>అదే సాయంత్రం firmware మారింది.</strong> 15 అక్టోబర్ 19:12కి router firmware అప్‌డేట్ అయింది. తగ్గుదల ముందే వచ్చింది: fan పెట్టడానికీ అప్‌డేట్‌కీ మధ్య ఉన్న 101 నిమిషాల సగటు 46.0 °C.</li>
<li><strong>ఐదు రోజుల ముందు ఒక కాన్ఫిగరేషన్ క్లీన్-అప్ జరిగింది.</strong> 10 అక్టోబర్‌న నేను ఒక WireGuard VPN క్లయింట్‌ను, వాడని ఒక ప్రాక్సీ స్టాక్‌ను (Squid, ClamAV, Redis, వాటితో పాటు ఉండేవి), దానికి ట్రాఫిక్ పంపే NAT రూల్స్‌ను తీసేశాను; నా DNS blocklists ను కుదించాను; ఒక USB నెట్‌వర్క్ అడాప్టర్ ప్లగ్ తీసేశాను. గంటవారీ సగటు 16 సెప్టెంబర్ నుంచి 9 అక్టోబర్ వరకు 69.7 °C, 11 అక్టోబర్ నుంచి fan వరకు 66.2 °C. ఆ తగ్గుదల మూడు నాలుగు రోజుల్లో దశలవారీగా వచ్చింది; ఆ మార్పుల ప్రభావాన్ని వాతావరణం ప్రభావం నుంచి నేను వేరు చేయలేను. అందుకే పైన ఉన్న పోలిక fan కి వెంటనే ముందున్న రోజులను మాత్రమే వాడుతుంది.</li>
<li><strong>పవర్ సెట్టింగులు ఏవీ మారలేదు.</strong> Router కాన్ఫిగరేషన్ చరిత్ర 13 అక్టోబర్ నుంచి ఉంది (30 రివిజన్లు). ఆ కాలంలో పవర్ సెట్టింగులు, thermal సెట్టింగులు, tunables లో ఏ మార్పూ అది చూపించదు.</li>
<li><strong>లోడ్‌ను నేను నియంత్రించలేదు.</strong> ఇవి ఇంటి నెట్‌వర్క్ మీద మామూలు రోజులు.</li>
<li><strong>ఇది ఒక క్యాబినెట్‌లోని ఒక router మాత్రమే.</strong></li>
</ul>
<details>
<summary>నేను నిరూపించని ఒక అనుమానం: dashboard</summary>
<p>13 అక్టోబర్‌న, సుమారు 20 గంటల అప్‌టైమ్ తర్వాత, ప్రాసెస్ వారీగా CPU సమయాన్ని పోల్చాను. DNS రిసాల్వర్ అయిన Unbound 16 సెకన్లు వాడింది, అంటే ఒక కోర్‌లో సుమారు 0.02 శాతం; ఆ సమయంలో అది నెట్‌వర్క్‌లోని పరికరాల నుంచి వచ్చే రోజుకు సుమారు 10,000 అనవసరమైన లుకప్‌లకు సమాధానం ఇస్తోంది. వెబ్ ఇంటర్‌ఫేస్‌ను, API ని నడిపే PHP ప్రాసెస్‌లు 5 నిమిషాల 9 సెకన్లు వాడాయి, సుమారు 20 రెట్లు ఎక్కువ; అప్పటికే ముగిసిపోయిన PHP workers ను ఆ స్నాప్‌షాట్ లెక్కలోకి తీసుకోలేదు.</p>
<p>అయినా, 20 గంటల్లో 5 నిమిషాలు అంటే ఒక కోర్‌లో సుమారు 0.4 శాతం. కొన్ని సెకన్లకు ఒకసారి రిఫ్రెష్ అయ్యే విడ్జెట్‌లు ఉన్న dashboard తెరిచి ఉండడం ఉష్ణోగ్రతను పెంచి ఉంటే, అది చిన్న బర్స్ట్‌లలోనే. ఆ వారం నేను చూసిన కొన్ని 78 °C స్పైక్‌ల వెనుక ఆ బర్స్ట్‌లు ఉన్నాయని అనుమానించాను. దాన్ని నేను పరీక్షించలేదు.</p>
</details>
<h2 id="fvr-te-s6">మీ సొంత router ను చదవడం</h2>
<p>OPNsense తన health రికార్డులను <strong>Reporting → Health</strong> కింద గ్రాఫ్‌లుగా చూపిస్తుంది. CPU ఉష్ణోగ్రత గ్రాఫ్‌ను చూడడానికి:</p>
<ol>
<li>బ్రౌజర్‌లో router వెబ్ ఇంటర్‌ఫేస్ తెరవండి: router ను నిర్వహించడానికి మీరు వాడే చిరునామాను అడ్రస్ బార్‌లో టైప్ చేసి, <strong>Enter</strong> నొక్కి, లాగిన్ అవ్వండి. చిరునామా మీకు తెలియకపోతే, router ను సెటప్ చేసిన వారిని అడగండి. router తన సొంత సెక్యూరిటీ సర్టిఫికెట్‌ను వాడుతుంది, కాబట్టి కనెక్షన్ ప్రైవేట్ కాదని బ్రౌజర్ హెచ్చరించవచ్చు; మీ router చిరునామాకు అది సాధారణమే. <strong>Advanced</strong> క్లిక్ చేయండి, తర్వాత ఆ చిరునామాకు కొనసాగించే లింక్‌ను క్లిక్ చేయండి (Chrome లో <strong>Proceed</strong>, Firefox లో <strong>Accept the Risk and Continue</strong>).</li>
<li>మెనూలో <strong>Reporting → Health</strong> తెరవండి. పేజీ కొన్ని సెకన్లలో లోడ్ అవుతుంది, ఏదీ మార్చదు. అది తన రిపోర్ట్‌లను అంశాల వారీగా జాబితా చేస్తుంది.</li>
<li>CPU ఉష్ణోగ్రత రిపోర్ట్‌ను పేజీలోని రిపోర్ట్‌ల జాబితాలో కనుగొనండి. అది లేకపోతే, <strong>System → Settings → Miscellaneous → Thermal Sensors</strong> తెరవండి; నాది &#8220;Intel Core<em> CPU on-die thermal sensor (coretemp)&#8221; కు సెట్ అయి ఉంది. ఆ సెట్టింగ్ మార్చడం router ను మారుస్తుంది: ముందు పాత విలువను రాసి పెట్టుకోండి, </em><em>Save</em>* నొక్కండి, router రీడింగులు తీసుకునే వరకు కొన్ని నిమిషాలు వేచి ఉండండి. దాన్ని వెనక్కి తీసుకోవడానికి, పాత విలువను మళ్ళీ ఎంచుకోండి; ఈ సెట్టింగ్‌ను తిరిగి none కు పెట్టడానికి reboot అవసరం.</li>
</ol>
<p>అదే డేటా router API నుంచి <code>GET /api/diagnostics/systemhealth/get_system_health/cputemp-system/0</code> వద్ద వస్తుంది. చివరి అంకె ఒక archive ను ఎంచుకుంటుంది: <code>/0</code> అంటే నిమిషానికి ఒక విలువ, అంతకంటే పెద్ద అంకెల archives మరింత స్థూలంగా ఉంటాయి. ఒక్కొక్కటి ఎంత కాలం ఉంటుందనేది router ఉష్ణోగ్రత డేటాబేస్ ఎప్పుడు సృష్టించారనే దాని మీద ఆధారపడుతుంది:</p>
<table>
<thead>
<tr>
<th>Archive</th>
<th>నా router (పాత OPNsense నుంచి వచ్చిన డేటాబేస్)</th>
<th>కొత్త OPNsense 26.x ఇన్‌స్టాల్</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>/0</code></td>
<td>1 నిమిషం, 1,000 స్లాట్లు: 16 గంటల 40 నిమిషాలు</td>
<td>1 నిమిషం, 1,200 స్లాట్లు: 20 గంటలు</td>
</tr>
<tr>
<td><code>/1</code></td>
<td>5 నిమిషాలు, 1,000 స్లాట్లు: సుమారు 3½ రోజులు</td>
<td>5 నిమిషాలు, 720 స్లాట్లు: 60 గంటలు</td>
</tr>
<tr>
<td><code>/2</code></td>
<td>1 గంట, 1,000 స్లాట్లు: సుమారు 6 వారాలు</td>
<td>1 గంట, 1,860 స్లాట్లు: సుమారు 11 వారాలు</td>
</tr>
<tr>
<td><code>/3</code></td>
<td>12 గంటలు, 3,000 స్లాట్లు: సుమారు 4 సంవత్సరాలు</td>
<td>1 రోజు, 2,284 స్లాట్లు: సుమారు 6 సంవత్సరాలు</td>
</tr>
</tbody>
</table>
<p>అప్‌గ్రేడ్‌ల సమయంలో OPNsense ఉన్న డేటాబేస్‌ను అలాగే ఉంచుతుంది, కాబట్టి పాత router పాత అమరికనే కొనసాగిస్తుంది. చివరి కాలమ్ 26.7 సోర్స్ కోడ్ నుంచి తీసుకున్నది; కొత్త ఇన్‌స్టాల్‌ను నేను చూడలేదు.</p>
<p>దీని నుంచి రెండు విషయాలు తెలుస్తాయి. నిన్న రాత్రి నిమిషవారీ రికార్డును ఈ ఉదయమే చదవండి; సాయంత్రానికి ఆ నిమిషాలు పోతాయి, స్థూల సగటులు మాత్రమే మిగులుతాయి. ఇంకా, గంటల archive ఎంత పొడవుగా ఉంటుందంటే, మీరు ప్లాన్ చేయని ముందు-తర్వాత పోలికకు కూడా అది సరిపోతుంది. నేను fan పెట్టేనాటికే నా router లో ఒక నెల &#8220;ముందు&#8221; డేటా ఉంది.</p>
<details>
<summary>లోతైన వివరణ: archives లో ఏముంటుంది, గంటవారీ అంకెలు స్పైక్‌లను ఎందుకు దాచేస్తాయి</summary>
<p>API సగటులను మాత్రమే ఇస్తుంది. OPNsense లోని <a href="https://github.com/opnsense/core/blob/master/src/opnsense/scripts/health/fetchData.py" rel="noopener"><code>fetchData.py</code></a> consolidation function <code>AVERAGE</code> గా ఉన్న round-robin archives ను మాత్రమే ప్రాసెస్ చేస్తుంది, ప్రతి archive కి ఒక &#8220;set&#8221; తయారుచేస్తుంది. Router ప్రతి నిమిషం సెన్సార్ నుంచి ఆ క్షణపు రీడింగ్ ఒకటి నిల్వ చేస్తుంది; ప్రతి గంటవారీ విలువ ఆ రీడింగుల సగటు. 91 °C అనే ఒక్క రీడింగ్ దాన్ని దాదాపు కదిలించదు.</p>
<p>రీడింగ్ లేని స్లాట్లు ఖాళీ విలువలుగా వస్తాయి. అదే స్క్రిప్ట్ ఖాళీ స్లాట్లను ఒక సిరీస్ మొదట్లో మాత్రమే తొలగిస్తుంది. కాబట్టి archive లోని అన్నిటికంటే పాత స్లాట్లు ఖాళీగా ఉన్నప్పుడు, అంటే కొత్త డేటాబేస్‌లో, స్లాట్ల లెక్క archive పొడవును తక్కువగా చూపిస్తుంది. కింది snippet రీడింగులను, ఖాళీ స్లాట్లను వేరువేరుగా చూపిస్తుంది.</p>
</details>
<details>
<summary>లోతైన వివరణ: మీ router సారాంశం చూపించే ఒక console snippet (PC కోసం)</summary>
<p>Health గ్రాఫ్ ఆకారాన్ని చూపిస్తుంది. ఇది అంకెలను ప్రింట్ చేస్తుంది: ఒక archive కి సగటు, మీడియన్, 95వ పర్సెంటైల్, గరిష్ఠం, 80 °C కి చేరిన రీడింగులు ఎన్ని. ఇది router సొంత health API కి ఒక చదివే అభ్యర్థనను (ఒక GET) పంపుతుంది, ఏమీ మార్చదు.</p>
<p><strong>ప్రారంభించే ముందు</strong></p>
<ul>
<li>మీకు Chrome లేదా Firefox ఉన్న ఒక PC, Reporting → Health తెరవగల router వెబ్ ఇంటర్‌ఫేస్ లాగిన్ కావాలి.</li>
<li>మీరు బ్రౌజర్ డెవలపర్ console లో, router సొంత పేజీలో టైప్ చేస్తారు. ఏదీ ఇన్‌స్టాల్ చేయరు.</li>
<li>దీనికి రెండు మూడు నిమిషాలు పడుతుంది.</li>
<li>ఇది router లో గానీ PC లో గానీ ఏమీ మార్చదు, కాబట్టి వెనక్కి తీసుకోవాల్సింది ఏమీ లేదు. పూర్తయ్యాక console ను మూసివేయండి.</li>
<li>కింది పెట్టెల్లో <strong>Copy</strong> పెట్టె మొత్తాన్ని కాపీ చేస్తుంది. గీతల అంచు ఉన్న పెట్టె మీకు కనిపించవలసినది చూపిస్తుంది; దాన్ని మీరు టైప్ చేయరు.</li>
</ul>
<p><strong>దశలు</strong></p>
<ol>
<li>Chrome లేదా Firefox లో router వెబ్ ఇంటర్‌ఫేస్ తెరవండి: router ను నిర్వహించడానికి మీరు వాడే చిరునామాను అడ్రస్ బార్‌లో టైప్ చేసి, <strong>Enter</strong> నొక్కి, లాగిన్ అవ్వండి. మీకు OPNsense dashboard కనిపించాలి. లాగిన్ పేజీ రాకపోతే, చిరునామాను, PC హోమ్ నెట్‌వర్క్‌లో ఉందో లేదో చూడండి. బ్రౌజర్ కనెక్షన్ ప్రైవేట్ కాదని హెచ్చరిస్తే, పైన గ్రాఫ్ దశల్లోని 1వ దశలోని గమనికను చూడండి.</li>
<li>ఏదైనా OPNsense పేజీలోనే ఉండి బ్రౌజర్ console తెరవండి: Windows, Linux లో Chrome అయితే <strong>Ctrl+Shift+J</strong>, Firefox అయితే <strong>Ctrl+Shift+K</strong>; Mac లో <strong>Cmd+Option+J</strong> లేదా <strong>Cmd+Option+K</strong>. పేజీ పక్కన లేదా కింద ఒక ప్యానెల్ తెరుచుకుంటుంది, టైప్ చేయడానికి ఒక లైన్‌తో. అది వేరే ట్యాబ్‌లో తెరుచుకుంటే, <strong>Console</strong> ట్యాబ్‌ను క్లిక్ చేయండి.</li>
<li>
<p>కింది పెట్టెలో <strong>Copy</strong> క్లిక్ చేయండి. అది snippet మొత్తాన్ని కాపీ చేస్తుంది.</p>
<div class="sf-box" data-mode="file" data-effect="read" data-effect-text="చూడడం మాత్రమే చేస్తుంది — ప్రయత్నించడం సురక్షితం" data-where="OPNsense పేజీలో బ్రౌజర్ console" data-how="అంతా console లో పేస్ట్ చేసి, ఆపై Enter నొక్కండి"><pre><code>// Paste into the browser console on any OPNsense page while logged in.
// Read-only: one GET to the router's own health API. Changes nothing.
(async () =&gt; {
  const LEVEL = 0; // archive: 0 is the finest (one value a minute); higher numbers are coarser. How many exist depends on the router.
  const url = '/api/diagnostics/systemhealth/get_system_health/cputemp-system/' + LEVEL;
  let d;
  try {
    const r = await fetch(url);
    if (r.status === 401) { console.log('HTTP 401: not logged in. Log in to the OPNsense web interface in this browser, then paste again.'); return; }
    if (r.status === 403) { console.log('HTTP 403: logged in, but this user may not read Reporting &gt; Health. Use an account with that privilege.'); return; }
    if (!r.ok) { console.log('HTTP ' + r.status + ' from ' + url); return; }
    d = await r.json();
  } catch (e) {
    console.log('No JSON came back (' + e.message + '). Run this on an OPNsense page while logged in.'); return;
  }
  const series = d &amp;&amp; d.set &amp;&amp; d.set.data &amp;&amp; d.set.data[0];
  if (!series || !Array.isArray(series.values)) { console.log('No temperature series at LEVEL ' + LEVEL + '. A higher LEVEL may not exist on this router; at LEVEL 0, check that Reporting &gt; Health shows a CPU temperature graph.'); return; }
  const pts = series.values.filter(p =&gt; p[1] !== null &amp;&amp; !isNaN(p[1]));
  const empty = series.values.length - pts.length;
  if (pts.length === 0) { console.log('The series ' + series.key + ' has no readings at this level.'); return; }
  const v = pts.map(p =&gt; p[1]).sort((a, b) =&gt; a - b);
  const n = v.length;
  const median = n % 2 ? v[(n - 1) / 2] : (v[n / 2 - 1] + v[n / 2]) / 2;
  const p95 = v[Math.min(n - 1, Math.ceil(0.95 * n) - 1)]; // nearest-rank
  const when = t =&gt; new Date(t).toLocaleString(); // your browser's time zone; each time marks the end of its interval
  console.log('Series ' + series.key + ', one value every ' + d.set.step_size + ' s');
  console.log('From ' + when(pts[0][0]) + ' to ' + when(pts[n - 1][0]) + ': ' + n + ' readings, ' + empty + ' empty slots');
  console.log('Average ' + (v.reduce((a, b) =&gt; a + b, 0) / n).toFixed(1) + ' °C, median ' + median.toFixed(1) +
    ', 95th percentile ' + p95.toFixed(1) + ', maximum ' + v[n - 1].toFixed(1));
  console.log('Readings at 80 °C or above: ' + v.filter(x =&gt; x &gt;= 80).length);
})();</code></pre></div>
</li>
<li>
<p>console లోని లైన్‌ను క్లిక్ చేసి, <strong>Ctrl+V</strong> తో (Mac లో <strong>Cmd+V</strong>) పేస్ట్ చేసి <strong>Enter</strong> నొక్కండి. బ్రౌజర్లు console లో పేస్ట్ చేయడాన్ని ఆపవచ్చు, ఎందుకంటే లాగిన్ అయిన పేజీలో తెలియని వ్యక్తి కోడ్‌ను పేస్ట్ చేయించడం ఒక తెలిసిన మోసం. అనుమతించే ముందు snippet ను చదవండి. బ్రౌజర్ &#8220;allow pasting&#8221; అని టైప్ చేయమని అడిగితే, దాని సందేశం చెప్పినట్టు చేసి, మళ్ళీ పేస్ట్ చేయండి.</p>
</li>
<li>
<p>ఒకటి రెండు సెకన్లలో మీకు నాలుగు లైన్లు కనిపించాలి (&#8220;Promise&#8221; తో మొదలయ్యే లైన్‌ను పట్టించుకోకండి): సిరీస్ పేరు, రీడింగులు ఎన్ని, ఖాళీ స్లాట్లు ఎన్ని అనే వివరాలతో సమయ పరిధి, సారాంశ అంకెలు, 80 °C లేదా అంతకంటే ఎక్కువ ఉన్న రీడింగుల లెక్క. సమయాలు మీ బ్రౌజర్ టైమ్ జోన్‌లో ఉంటాయి; ప్రతి సమయం దాని వ్యవధి ముగిసిన క్షణాన్ని సూచిస్తుంది. నా router లో, 28 అక్టోబర్ 2026న, ఇది ఇలా ప్రింట్ చేసింది (సమయాలను నేను వదిలేశాను; వాటి ఫార్మాట్ మీ బ్రౌజర్ సెట్టింగ్‌లను బట్టి ఉంటుంది):</p>
<div class="sf-box" data-mode="output" data-where="మీకు కనిపించవలసినది"><pre><code>Series cpu0temp, one value every 60 s
From &lt;start time&gt; to &lt;end time&gt;: 1000 readings, 0 empty slots
Average 43.9 °C, median 47.7, 95th percentile 57.8, maximum 72.5
Readings at 80 °C or above: 0</code></pre></div>
</li>
<li>
<p>&#8220;HTTP 401&#8221; అంటే బ్రౌజర్ OPNsense లో లాగిన్ అయి లేదు: లాగిన్ అయి 4వ దశను మళ్ళీ చేయండి. &#8220;HTTP 403&#8221; అంటే Reporting → Health చూసే అనుమతి లేని యూజర్‌గా మీరు లాగిన్ అయ్యారు.</p>
</li>
<li>గంటవారీ archive చదవడానికి, snippet ను ముందు ఒక సాధారణ టెక్స్ట్ ఎడిటర్‌లో పేస్ట్ చేయండి (Windows లో Notepad, Mac లో plain text కు సెట్ చేసిన TextEdit), <code>const LEVEL = 0;</code> ను <code>const LEVEL = 2;</code> కు మార్చండి, అక్కడి నుంచి మొత్తాన్ని కాపీ చేసి, 4, 5 దశలను మళ్ళీ చేయండి.</li>
<li>ఆ సగటును అదే archive కు సంబంధించిన Reporting → Health గ్రాఫ్ స్థాయితో పోల్చండి. రెండూ సరిపోలాలి.</li>
<li>పూర్తయ్యాక, ప్యానెల్‌ను దాని కుడి పైన ఉన్న <strong>×</strong> తో మూసివేయండి. router లో ఏదీ మార్చబడలేదు.</li>
</ol>
</details>
<h2 id="fvr-te-s7">తీర్పు</h2>
<p>కేస్ మూసే ఉంటుంది, paste దాని పెట్టెలోనే ఉంటుంది.</p>
<p>మిగిలింది చిన్న పని. Fan ను బిగించండి, పైకి లేపండి: 10 నుంచి 15 mm రబ్బర్ కాళ్ళు దాన్ని స్థానంలో పట్టి ఉంచగలవు, దాని hub కింద ఉన్న fins కు గాలి చేరనివ్వగలవు; సమతలంగా పడుకున్న fan ఆ fins కు గాలి సరిగా అందనివ్వదు. Heatsinks మీద పెట్టే fans కు ఇది సాధారణ పద్ధతి; ఇక్కడ నేను దీన్ని కొలవలేదు. పక్క గ్రిల్‌కు అడ్డు లేకుండా చూడండి. క్యాబినెట్ మొత్తం వేరే సమస్య: fan router ను క్యాబినెట్ గాలి ఉష్ణోగ్రతకు దగ్గరగా మాత్రమే చల్లబరచగలదు, ఆ గాలి గది కంటే వేడిగా ఉంటుంది. దాన్ని నేను వేరుగా పరిశీలించాను, దాని గురించి తర్వాత రాస్తానేమో.</p>
<p>Fan కి ముందు, ఈ వేడి కొత్త router చూడడానికి ఒక కారణంగా ఉండేది. ఇప్పుడు కాదు.</p>
<h2 id="fvr-te-s8">వేడి అల్మరాలో fanless బాక్స్ ఉన్నవారికి నేను చెప్పేది</h2>
<ol>
<li><strong>Router ఇప్పటికే ఏమి నమోదు చేస్తుందో చదవండి,</strong> ఏదైనా తెరిచే ముందు. OPNsense లో అది Reporting → Health, లేదా పైన చెప్పిన API.</li>
<li><strong>మీ router లో ప్రతి archive ఎంత కాలం ఉంటుందో చెక్ చేసుకోండి.</strong> అది దాని డేటాబేస్ ఎప్పుడు సృష్టించారనే దాని మీద ఆధారపడుతుంది.</li>
<li><strong>ఏ ఫలితం వస్తే తర్వాతి దశకు వెళ్ళాలో నిర్ణయించుకోండి,</strong> ఏదైనా మార్చే ముందే.</li>
<li><strong>ఒక్కొక్క రీడింగును కాదు, సగటులను బట్టి తేల్చండి.</strong> వరుస నిమిషాల రీడింగుల మధ్య 30 °C తేడా ఉండవచ్చు.</li>
<li><strong>చౌకైన, వెనక్కి తీసుకోగల పరిష్కారాన్ని ముందు ప్రయత్నించండి,</strong> దాని నష్టాన్నీ బేరీజు వేయండి: శబ్దం, దుమ్ము లేకుండా ఉండాలని కొన్న బాక్స్‌కు fan ఆ రెండింటినీ తెస్తుంది.</li>
</ol>
<details>
<summary>పదకోశం</summary>
<ul>
<li><strong>Fanless (passive) cooling:</strong> కేసే heatsink; fan లేకుండా, ఉష్ణ వహనం, సహజ గాలి ప్రవాహం ద్వారా వేడి బయటకు పోతుంది.</li>
<li><strong>Thermal paste / repaste:</strong> CPU కీ heatsink కీ మధ్య ఉండి, సూక్ష్మమైన ఖాళీలను నింపే పదార్థం. Repaste అంటే పాత పదార్థాన్ని శుభ్రంగా తుడిచి కొత్తది పూయడం.</li>
<li><strong>P-core / E-core:</strong> ఒకే చిప్‌లో ఉండే Intel పెర్ఫార్మెన్స్ కోర్లు, ఎఫిషియెంట్ కోర్లు. Pentium Gold 8505 లో మొదటి రకం ఒకటి, రెండో రకం నాలుగు ఉన్నాయి.</li>
<li><strong>TJUNCTION:</strong> చిప్‌లోనే Intel అనుమతించే అత్యధిక ఉష్ణోగ్రత. 8505 కి అది 100 °C.</li>
<li><strong>PWM:</strong> pulse-width modulation; fan ఎంత వేగంగా తిరగాలో చెప్పే ఒక సిగ్నల్ వైర్.</li>
<li><strong>Round-robin database (RRD):</strong> స్థిర పరిమాణం ఉన్న ఒక నిల్వ. ఇటీవలి డేటాను సూక్ష్మ వివరంగా, పాత డేటాను స్థూల సగటులుగా ఉంచుతుంది, అన్నిటికంటే పాత డేటాను తుడిచి దాని మీద రాస్తుంది.</li>
<li><strong>మీడియన్ / 95వ పర్సెంటైల్:</strong> మీడియన్ అంటే మధ్యలో ఉండే రీడింగ్ (లేదా మధ్యలో ఉండే రెండు రీడింగుల సగటు); 95 శాతం రీడింగులు 95వ పర్సెంటైల్ వద్ద గానీ దాని కంటే కింద గానీ ఉంటాయి.</li>
<li><strong>API:</strong> router ప్రోగ్రామింగ్ ఇంటర్‌ఫేస్; వెబ్ పేజీలు చూపించే డేటానే JSON గా ఇస్తుంది.</li>
<li><strong>Tunables:</strong> OPNsense బూట్ సమయంలో వర్తింపజేసే kernel సెట్టింగులు; ఇవి System → Settings → Tunables కింద కనిపిస్తాయి.</li>
</ul>
</details>
</div>
<div class="fvr-panel" id="fvr-panel-th" lang="th">
<p class="fvr-title">Thermal paste ยังอยู่ในกล่อง</p>
<p>เมื่อวันที่ 15 ตุลาคม 2026 ผมมีทางแก้สองทางสำหรับปัญหาเดียววางอยู่บนโต๊ะ: thermal paste ARCTIC MX-7 หนึ่งหลอดขนาด 4 g และ fan Noctua ขนาด 120 mm ปัญหาคือ router ของผม ซึ่งเป็น mini PC แบบ fanless ที่รัน OPNsense อยู่ในตู้ไม้อัดแบบปิด วันก่อนหน้านั้น CPU ของมันขึ้นไปแตะ 91 °C</p>
<p>คำแนะนำที่ผมเจอในอินเทอร์เน็ตคือให้เปิดเคสแล้วเปลี่ยน paste ใหม่ ผมติด fan ก่อน เพราะไม่ต้องใช้ไขควง ก่อนติด ผมตัดสินใจไว้ว่าผลแบบไหนจะทำให้ผมต้องกลับไปใช้ paste</p>
<p>ผมไม่เคยต้องใช้มัน router บันทึกอุณหภูมิของตัวเองไว้ตลอดอยู่แล้ว ระหว่างวันที่ 16 กันยายนถึงช่วงเย็นของวันที่ 15 ตุลาคม ไม่มีชั่วโมงไหนที่ค่าเฉลี่ยต่ำกว่า 60 °C ในสี่วันหลังติด fan ไม่มีชั่วโมงไหนที่ค่าเฉลี่ยสูงกว่า 49 °C ตอนนี้ paste ยังอยู่ในกล่อง</p>
<p>ผมทำงานนี้ร่วมกับ Claude ซึ่งเป็นโมเดล AI ของ Anthropic โดย Claude อ่านข้อมูลจาก router ผ่าน browser session ของผมเองได้ ผมเป็นคนเลือกชิ้นส่วน ติด fan และตั้งเกณฑ์ Claude ดึงบันทึกอุณหภูมิและคำนวณตัวเลข และเมื่อวันที่ 28 ตุลาคม ก็ดึงข้อมูลรายชั่วโมงของ router มาอีกครั้งสำหรับโพสต์นี้</p>
<h2 id="fvr-th-s1">ตัวเครื่องและตู้</h2>
<p>router ตัวนี้เป็น mini PC แบบ fanless หกพอร์ต ขายภายใต้ชื่อ &#8220;Shenzhen Weibu&#8221; ข้างในเป็น Intel Pentium Gold 8505: performance core หนึ่งคอร์และ efficient core สี่คอร์ หก thread กำลังไฟพื้นฐาน 15 W และสูงสุด 55 W ในโหมด turbo ตาม<a href="https://www.intel.com/content/www/us/en/products/sku/226265/intel-pentium-gold-processor-8505-8m-cache-up-to-4-40-ghz-with-ipu/specifications.html" rel="noopener">หน้าสเปกของ Intel</a> มี RAM 20 GB และพอร์ต Intel I226-V 2.5 GbE หกพอร์ต รัน OPNsense 26.7 ตัวเคสคือ heatsink ด้านบนทั้งแผ่นเป็น fins</p>
<p>มันอยู่ในตู้ไม้อัดแบบปิดร่วมกับอุปกรณ์เครือข่ายอื่น ตะแกรงแบบช่องบนแผงข้างตู้เป็นทางระบายลมร้อนทางเดียวที่ตั้งใจทำไว้</p>
<img src="https://techblog.viveksanghi.com/wp-content/uploads/2026/10/router-before-fan-crop-grille.jpg" alt="router ก่อนติด fan มองจากด้านที่มีพอร์ต USB: ตัวเคสสีดำที่ด้านบนเป็นแผง fins อยู่ข้างตะแกรงแบบช่องบนแผงข้างของตู้" loading="lazy" decoding="async">
<p>91 °C อันตรายไหม? ตามตัวเลขของ Intel ไม่อันตราย หน้าเดียวกันระบุอุณหภูมิ junction สูงสุดของชิป (TJUNCTION) ไว้ที่ 100 °C และโปรเซสเซอร์ที่แตะขีดนั้นจะลดความเร็วตัวเองลง ไม่ใช่พัง อีกอย่าง 91 °C เป็นแค่ค่าสูงสุดในบรรดาค่าที่อ่านตามรอบ router อ่าน sensor นาทีละครั้ง ค่าที่พุ่งขึ้นระหว่างนั้นจึงไม่ถูกบันทึก ถึงอย่างนั้น ความร้อนก็กลายเป็นเหตุผลให้ผมมองหา router ตัวใหม่ ค่าเฉลี่ยรายชั่วโมงอยู่ราว 70 °C ทั้งกลางวันและกลางคืน และ SSD หน่วยความจำ และชิปเครือข่าย อยู่ในเคสร้อนอันเดียวกัน โดยทั่วไปความร้อนทำให้อุปกรณ์อิเล็กทรอนิกส์อายุสั้นลง แต่ผมไม่ได้วัดทั้งเรื่องนั้นและอุณหภูมิของ SSD บนเครื่องนี้</p>
<h2 id="fvr-th-s2">ทำไมเลือก fan ก่อน</h2>
<p>การ repaste เป็นคำแนะนำปกติสำหรับ mini PC ที่ร้อน และก็อาจช่วยได้จริง แต่ถ้าทำ ก็จะต้อง:</p>
<ul>
<li>สำรอง configuration ไว้ก่อน</li>
<li>แอลกอฮอล์ไอโซโพรพิล 99 เปอร์เซ็นต์ และผ้าเช็ดที่ไม่ทิ้งขุย</li>
<li>45 ถึง 60 นาทีที่เครือข่ายออฟไลน์</li>
<li>เปิดเคสที่ปิดผนึกไว้ ซึ่งผมไม่เคยเห็นสกรูและ thermal pad ข้างในมาก่อน</li>
</ul>
<p>fan ที่วางบน fins ไม่ต้องใช้อะไรในรายการนั้นเลย และถอดออกได้ในวินาทีเดียว แต่มันก็มีต้นทุนของมันเอง มันทำให้เสียสิ่งที่เป็นเหตุผลของการมีเครื่อง fanless ไป: ไม่มีเสียง ไม่ดูดฝุ่นเข้า ไม่มีชิ้นส่วนเคลื่อนไหวที่สึกหรอ</p>
<p>ผมจึงตั้งเกณฑ์ไว้ก่อนติด: <strong>จะ repaste ก็ต่อเมื่อค่าที่อ่านได้ช่วงกลางคืนยังขึ้นไปถึงระดับ 80 กว่า °C ทั้งที่ติด fan แล้ว</strong></p>
<h2 id="fvr-th-s3">ตัว fan</h2>
<p>ผมเลือก Noctua NF-F12 5V PWM <a href="https://www.noctua.at/en/products/nf-f12-5v-pwm/specifications" rel="noopener">สเปก</a> ของ Noctua ระบุขนาด 120 mm ไฟ 5 V ความเร็วสูงสุด 1,500 rpm กินไฟปกติ 0.65 W และดัง 22.4 dB(A) ที่ความเร็วสูงสุด มีสาย USB สำหรับจ่ายไฟมาในกล่อง ตัวของผมเสียบอยู่กับพอร์ต USB ช่องหนึ่งของ router เอง เมื่อจ่ายไฟจาก USB fan จะไม่ได้รับสัญญาณความเร็ว และ<a href="https://www.noctua.at/en/support/faqs/microcontroller-guide-pwm-setup-and-rpm-monitoring" rel="noopener">คู่มือของ Noctua เอง</a> บอกว่า fan แบบ PWM ที่ไม่มีสัญญาณจะหมุนที่ความเร็วสูงสุด Noctua ระบุว่ารุ่นนี้เป็น &#8220;5V PWM version, not for use in PCs&#8221; ซึ่งหมายความว่า เป็นรุ่น 5V PWM ไม่ได้มีไว้ใช้กับ PC: fan header 12 V ของ PC เป็นแหล่งจ่ายไฟที่ผิดสำหรับมัน</p>
<p>บน router ของผม fan ขนาด 120 mm คลุมด้านบนส่วนใหญ่ เลือก fan ที่มีขนาดใกล้เคียงกับด้านบนของ router Noctua ยังขายรุ่น 5 V ขนาดเล็กกว่านี้ด้วย เช่น NF-A8 5V PWM ขนาด 80 mm fan USB 5 V ที่ราคาถูกกว่าก็น่าจะเป่าลมได้เช่นกัน แต่ผมยังไม่เคยลอง</p>
<p>ผมติดตั้งมันราว 17:30 ของวันที่ 15 ตุลาคม มันวางราบอยู่บน fins ด้านบน ไม่ได้ขันสกรูยึด และเป่าลมลงไปใน fins ตอนอ่านจากรูปถ่าย Claude เข้าใจทิศทางลมกลับด้านในตอนแรก ผมจึงดูลูกศรที่ขึ้นรูปไว้บนกรอบ แบบไหนก็น่าจะช่วยได้ แต่ผมอยากรู้ว่ากำลังวัดแบบไหนอยู่</p>
<img src="https://techblog.viveksanghi.com/wp-content/uploads/2026/10/fan-on-router-top-crop.jpg" alt="fan Noctua วางราบบน fins ด้านบนของ router มองจากด้านบน" loading="lazy" decoding="async">
<img src="https://techblog.viveksanghi.com/wp-content/uploads/2026/10/fan-on-router-front-crop.jpg" alt="router มองจากด้านพอร์ตเครือข่าย มีสายเสียบอยู่ และมี fan วางอยู่ด้านบน" loading="lazy" decoding="async">
<h2 id="fvr-th-s4">สิ่งที่ router บันทึกไว้</h2>
<p>OPNsense อ่านอุณหภูมิ CPU นาทีละครั้ง และเก็บค่าเฉลี่ยรายชั่วโมงไว้หลายสัปดาห์ วิธีอ่านข้อมูลของ router คุณเองอยู่ด้านล่าง</p>
<img src="https://techblog.viveksanghi.com/wp-content/uploads/2026/11/cpu0-hourly-sep-oct-2026.v2.png" alt="กราฟเส้นของอุณหภูมิ CPU เฉลี่ยรายชั่วโมงของ router ตั้งแต่ 16 กันยายน 2026 ถึงสี่วันหลังติด fan เส้นอยู่ระหว่างราว 65 ถึง 74 °C จนถึง 9 ตุลาคม ขึ้นสูงสุดที่ 77 °C ระหว่างการเก็บกวาด configuration เมื่อ 10 ตุลาคม จากนั้นทรงตัวระหว่างราว 60 ถึง 71 °C และลดลงเหลือราว 46 °C ในชั่วโมงหลังติด fan เวลา 17:30 ของวันที่ 15 ตุลาคม แล้วอยู่ที่ระดับนั้น" loading="lazy" decoding="async">
<p>ค่าเฉลี่ยรายชั่วโมงของ <code>cpu0</code> จาก archive รายชั่วโมงของ router:</p>
<table>
<thead>
<tr>
<th>ช่วงเวลา</th>
<th>จำนวนชั่วโมง</th>
<th>ค่าเฉลี่ย</th>
<th>ชั่วโมงที่ต่ำสุด</th>
<th>ชั่วโมงที่สูงสุด</th>
</tr>
</thead>
<tbody>
<tr>
<td>16 กันยายน – 9 ตุลาคม</td>
<td>567</td>
<td>69.7 °C</td>
<td>65.3 °C</td>
<td>73.7 °C</td>
</tr>
<tr>
<td>11 ตุลาคม – 15 ตุลาคม ก่อนติด fan</td>
<td>114</td>
<td>66.2 °C</td>
<td>60.5 °C</td>
<td>70.9 °C</td>
</tr>
<tr>
<td>15 ตุลาคม หลังติด fan (สี่วัน)</td>
<td>100</td>
<td>46.4 °C</td>
<td>42.6 °C</td>
<td>48.6 °C</td>
</tr>
</tbody>
</table>
<p>ผมไม่นับวันที่ 10 ตุลาคม ซึ่งเป็นวันเก็บกวาด configuration ที่เล่าไว้ด้านล่าง เมื่อเทียบกับไม่กี่วันก่อนติด fan ตัว fan ลดค่าเฉลี่ยลงราว 20 °C ช่วงค่าก่อนและหลังไม่ซ้อนทับกัน: ชั่วโมงที่เย็นที่สุดก่อนติด fan ยังร้อนกว่าชั่วโมงที่ร้อนที่สุดหลังติด fan อยู่ 12 °C</p>
<p>เกณฑ์ที่ผมตั้งไว้ดูจากค่าที่อ่านได้ช่วงกลางคืน วันที่ 15 ตุลาคม ผมอ่านช่วง 03:00–10:00 จากข้อมูลรายนาที และวันที่ 16 ตุลาคม ผมอ่านช่วงเดียวกันอีกครั้ง:</p>
<table>
<thead>
<tr>
<th><code>cpu0</code>, 03:00–10:00</th>
<th>15 ตุลาคม ไม่มี fan</th>
<th>16 ตุลาคม มี fan</th>
</tr>
</thead>
<tbody>
<tr>
<td>ค่าเฉลี่ย</td>
<td>65.6 °C</td>
<td>46.7 °C</td>
</tr>
<tr>
<td>ค่าสูงสุด</td>
<td>90.3 °C</td>
<td>73.6 °C</td>
</tr>
<tr>
<td>จำนวนค่าที่ 80 °C ขึ้นไป</td>
<td>19</td>
<td>0</td>
</tr>
</tbody>
</table>
<p>ไม่มีค่าไหนขึ้นไปถึงระดับ 80 กว่า เกณฑ์บอกว่าให้ปิดเคสไว้ตามเดิม</p>
<p>เกณฑ์ของผมใช้ค่าเดี่ยว และค่าเดี่ยวกระโดดไปมา แต่ละค่าคือค่า ณ ขณะเดียว: วันที่ 28 ตุลาคม นาทีที่ต่อกันอ่านได้ 35.3, 68.2, 69.0 และ 35.7 °C ถ้าใช้ค่าเฉลี่ยหลายชั่วโมงจะเป็นการทดสอบที่ดีกว่า เมื่อดูจากค่าเฉลี่ยรายชั่วโมง ความต่างยิ่งมากขึ้นอีก: หลังติด fan ไม่มีชั่วโมงไหนสูงกว่า 48.6 °C</p>
<details>
<summary>เจาะลึก: ช่วงเวลารายนาทีของวันที่ 15 ตุลาคม</summary>
<p>อ่านจากข้อมูลรายนาทีเมื่อวันที่ 15 ตุลาคม</p>
<table>
<thead>
<tr>
<th>ช่วงเวลา วันที่ 15 ตุลาคม 2026</th>
<th>จำนวนค่า</th>
<th>ค่าเฉลี่ย</th>
<th>ค่ามัธยฐาน</th>
<th>เปอร์เซ็นไทล์ที่ 95</th>
<th>ค่าสูงสุด</th>
<th>จำนวนค่าที่ 80 °C ขึ้นไป</th>
</tr>
</thead>
<tbody>
<tr>
<td>03:00–10:00 ไม่มี fan</td>
<td>420</td>
<td>65.6 °C</td>
<td>69.0 °C</td>
<td>79.8 °C</td>
<td>90.3 °C</td>
<td>19</td>
</tr>
<tr>
<td>12:00–17:20 ไม่มี fan</td>
<td>320</td>
<td>65.5 °C</td>
<td>68.7 °C</td>
<td>80.1 °C</td>
<td>90.7 °C</td>
<td>16</td>
</tr>
<tr>
<td>17:31–19:12 มี fan</td>
<td>101</td>
<td>46.0 °C</td>
<td>48.7 °C</td>
<td>60.5 °C</td>
<td>69.6 °C</td>
<td>0</td>
</tr>
<tr>
<td>19:20–19:37 หลังอัปเดต firmware และ reboot</td>
<td>17</td>
<td>54.1 °C</td>
<td>57.1 °C</td>
<td>70.8 °C</td>
<td>70.8 °C</td>
<td>0</td>
</tr>
</tbody>
</table>
<p>แถวสุดท้ายสูงกว่าเพราะ router เพิ่ง reboot หลังอัปเดต firmware และกำลังโหลดรายการ blocklist ราว 2.7 ล้านรายการ ไม่ใช่ตัวเลขตอนที่เครื่องอยู่ตัวแล้ว</p>
</details>
<h2 id="fvr-th-s5">สิ่งที่ผลนี้แสดง และไม่ได้แสดง</h2>
<p>ผลนี้แสดงว่า fan เพียงพอสำหรับกรณีนี้ แต่ไม่ได้แสดงว่าการ repaste จะไม่ช่วยด้วย เพราะผมไม่เคยลอง fan ไม่ได้นำความร้อนออกจากตู้ มันบังคับให้อากาศในตู้ไหลผ่าน fins ของ router ตู้ที่ปิดทำให้จุดเริ่มต้นแย่กว่าปกติ ผลที่ได้ตรงนี้จึงน่าจะมากกว่าตอนที่ router ตั้งอยู่ในที่โล่ง</p>
<ul>
<li><strong>ผมไม่ได้วัดอุณหภูมิห้อง</strong> อุณหภูมิลดลงภายในหนึ่งชั่วโมง และห้องไม่เย็นลง 20 °C ในชั่วโมงเดียว นอกจากนี้ router ยังตอบสนองต่อรอบกลางวันกลางคืนเพียงเล็กน้อย: ตั้งแต่ 16 กันยายนถึง 9 ตุลาคม ค่าเฉลี่ยของแต่ละชั่วโมงในรอบวันอยู่ระหว่าง 69.2 ถึง 70.3 °C ต่างกันราว 1 °C</li>
<li><strong>firmware เปลี่ยนในเย็นวันเดียวกัน</strong> router อัปเดต firmware เวลา 19:12 ของวันที่ 15 ตุลาคม อุณหภูมิลดลงก่อน: 101 นาทีระหว่างติด fan กับการอัปเดตมีค่าเฉลี่ย 46.0 °C</li>
<li><strong>มีการเก็บกวาด configuration ห้าวันก่อนหน้านั้น</strong> วันที่ 10 ตุลาคม ผมลบ WireGuard VPN client, proxy stack ที่ไม่ได้ใช้ (Squid, ClamAV, Redis และส่วนประกอบที่มาด้วยกัน) และ NAT rule ที่ส่งทราฟฟิกเข้าไปหามัน ลดขนาด DNS blocklist และถอด USB network adapter ออก ค่าเฉลี่ยรายชั่วโมงอยู่ที่ 69.7 °C ตั้งแต่ 16 กันยายนถึง 9 ตุลาคม และ 66.2 °C ตั้งแต่ 11 ตุลาคมจนถึงตอนติด fan การลดลงนั้นเกิดเป็นขั้นๆ ในสามถึงสี่วัน และผมแยกผลของการเปลี่ยนแปลงเหล่านั้นออกจากผลของสภาพอากาศไม่ได้ นี่คือเหตุผลที่การเปรียบเทียบด้านบนใช้เฉพาะไม่กี่วันก่อนติด fan</li>
<li><strong>การตั้งค่าพลังงานไม่ได้เปลี่ยน</strong> ประวัติ configuration ของ router ย้อนไปถึงวันที่ 13 ตุลาคม (30 revision) และไม่มีการเปลี่ยนการตั้งค่าพลังงาน การตั้งค่าความร้อน หรือ tunables ในช่วงนั้น</li>
<li><strong>ผมไม่ได้ควบคุมโหลด</strong> นี่คือวันปกติของเครือข่ายในบ้าน</li>
<li><strong>นี่คือ router ตัวเดียวในตู้ใบเดียว</strong></li>
</ul>
<details>
<summary>ข้อสันนิษฐานที่ผมไม่ได้พิสูจน์: dashboard</summary>
<p>วันที่ 13 ตุลาคม ตอน uptime ราว 20 ชั่วโมง ผมเปรียบเทียบ CPU time ของแต่ละ process Unbound ซึ่งเป็น DNS resolver ใช้ไป 16 วินาที ราว 0.02 เปอร์เซ็นต์ของหนึ่งคอร์ ระหว่างที่ตอบ lookup ที่ไม่ต้องการราว 10,000 ครั้งต่อวันจากอุปกรณ์ในเครือข่าย ส่วน process ของ PHP ที่ให้บริการ web interface และ API ใช้ไป 5 นาที 9 วินาที ซึ่งเป็นราว 20 เท่าของ Unbound และ snapshot นั้นไม่ได้นับ PHP worker ที่จบการทำงานไปแล้ว</p>
<p>ถึงอย่างนั้น 5 นาทีใน 20 ชั่วโมงก็เป็นราว 0.4 เปอร์เซ็นต์ของหนึ่งคอร์ ถ้า dashboard ที่เปิดค้างไว้ ซึ่ง widget ของมันรีเฟรชทุกไม่กี่วินาที ทำให้อุณหภูมิสูงขึ้น ก็เกิดเป็นช่วงสั้นๆ ที่โหลดพุ่ง ผมสงสัยว่าช่วงโหลดพุ่งเหล่านั้นอยู่เบื้องหลังค่าพุ่ง 78 °C บางครั้งที่ผมเห็นในสัปดาห์นั้น ผมไม่ได้ทดสอบ</p>
</details>
<h2 id="fvr-th-s6">อ่านข้อมูลจาก router ของคุณเอง</h2>
<p>OPNsense แสดงบันทึกสถานะของระบบเป็นกราฟที่ <strong>Reporting → Health</strong> วิธีดูกราฟอุณหภูมิ CPU:</p>
<ol>
<li>เปิด web interface ของ router ใน browser: พิมพ์ที่อยู่ที่คุณใช้จัดการ router ลงในแถบที่อยู่ กด <strong>Enter</strong> แล้ว log in ถ้าคุณไม่ทราบที่อยู่ ให้ถามคนที่ตั้งค่า router ให้คุณ ตัว router ใช้ใบรับรองความปลอดภัยของตัวเอง browser จึงอาจเตือนว่าการเชื่อมต่อไม่เป็นส่วนตัว สำหรับที่อยู่ของ router ของคุณเอง นั่นเป็นเรื่องที่คาดไว้ได้ คลิก <strong>Advanced</strong> แล้วคลิกลิงก์ที่ไปต่อยังที่อยู่นั้น (<strong>Proceed</strong> ใน Chrome, <strong>Accept the Risk and Continue</strong> ใน Firefox)</li>
<li>ในเมนู เปิด <strong>Reporting → Health</strong> หน้านี้โหลดภายในไม่กี่วินาทีและไม่เปลี่ยนแปลงอะไร หน้านี้แสดงรายการ report แยกตามหัวข้อ</li>
<li>หา report อุณหภูมิ CPU ในรายการ report ของหน้านั้น ถ้าไม่มี ให้เปิด <strong>System → Settings → Miscellaneous → Thermal Sensors</strong> ของผมตั้งไว้เป็น &#8220;Intel Core<em> CPU on-die thermal sensor (coretemp)&#8221; การเปลี่ยนค่านี้เป็นการเปลี่ยน router: จดค่าเดิมไว้ก่อน กด </em><em>Save</em>* แล้วรอไม่กี่นาทีระหว่างที่ router อ่านค่า ถ้าจะยกเลิก ให้เลือกค่าเดิมอีกครั้ง ถ้าตั้งกลับเป็น none ต้อง reboot</li>
</ol>
<p>ข้อมูลชุดเดียวกันดึงได้จาก API ของ router ที่ <code>GET /api/diagnostics/systemhealth/get_system_health/cputemp-system/0</code> ตัวเลขท้ายสุดใช้เลือก archive: <code>/0</code> คือค่าหนึ่งค่าต่อนาที และตัวเลขที่สูงขึ้นจะหยาบขึ้น แต่ละ archive เก็บได้นานแค่ไหนขึ้นกับว่าฐานข้อมูลอุณหภูมิของ router ถูกสร้างเมื่อไร:</p>
<table>
<thead>
<tr>
<th>Archive</th>
<th>router ของผม (ฐานข้อมูลจาก OPNsense รุ่นเก่า)</th>
<th>OPNsense 26.x ที่ติดตั้งใหม่</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>/0</code></td>
<td>1 นาที, 1,000 ช่อง: 16 ชั่วโมง 40 นาที</td>
<td>1 นาที, 1,200 ช่อง: 20 ชั่วโมง</td>
</tr>
<tr>
<td><code>/1</code></td>
<td>5 นาที, 1,000 ช่อง: ราว 3½ วัน</td>
<td>5 นาที, 720 ช่อง: 60 ชั่วโมง</td>
</tr>
<tr>
<td><code>/2</code></td>
<td>1 ชั่วโมง, 1,000 ช่อง: ราว 6 สัปดาห์</td>
<td>1 ชั่วโมง, 1,860 ช่อง: ราว 11 สัปดาห์</td>
</tr>
<tr>
<td><code>/3</code></td>
<td>12 ชั่วโมง, 3,000 ช่อง: ราว 4 ปี</td>
<td>1 วัน, 2,284 ช่อง: ราว 6 ปี</td>
</tr>
</tbody>
</table>
<p>OPNsense เก็บฐานข้อมูลเดิมไว้ตลอดการอัปเกรด ดังนั้น router ที่ติดตั้งมาตั้งแต่ OPNsense รุ่นเก่าจึงยังใช้รูปแบบเดิม คอลัมน์สุดท้ายมาจาก source code ของ 26.7 ผมยังไม่เคยเห็นเครื่องที่ติดตั้งใหม่</p>
<p>จากตรงนี้ได้สองเรื่อง ให้อ่านข้อมูลรายนาทีของเมื่อคืนภายในเช้านี้ พอถึงตอนเย็น ข้อมูลนาทีเหล่านั้นหายไปแล้ว เหลือแต่ค่าเฉลี่ยที่หยาบกว่า และ archive รายชั่วโมงก็ยาวพอสำหรับการเทียบก่อนและหลังที่คุณไม่ได้วางแผนไว้ ของผมมีข้อมูล &#8220;ก่อน&#8221; อยู่แล้วหนึ่งเดือนตอนที่ผมติด fan</p>
<details>
<summary>เจาะลึก: archive เก็บอะไรไว้ และทำไมตัวเลขรายชั่วโมงจึงซ่อนค่าที่พุ่งขึ้นชั่วครู่</summary>
<p>API ส่งให้แค่ค่าเฉลี่ย <a href="https://github.com/opnsense/core/blob/master/src/opnsense/scripts/health/fetchData.py" rel="noopener"><code>fetchData.py</code></a> ของ OPNsense ประมวลผลเฉพาะ round-robin archive ที่มี consolidation function เป็น <code>AVERAGE</code> และสร้าง &#8220;set&#8221; หนึ่งชุดต่อหนึ่ง archive router เก็บค่าที่อ่านจาก sensor ณ ขณะหนึ่งไว้นาทีละหนึ่งค่า ค่ารายชั่วโมงแต่ละค่าคือค่าเฉลี่ยของค่าที่อ่านได้เหล่านั้น ค่าที่อ่านได้ 91 °C เพียงค่าเดียวแทบไม่ทำให้ค่านี้ขยับ</p>
<p>ช่องที่ไม่มีค่า จะส่งกลับมาเป็นค่าว่าง สคริปต์เดียวกันตัดช่องที่ไม่มีค่าออกเฉพาะที่จุดเริ่มต้นของ series ดังนั้นจำนวนช่องจะน้อยกว่าความยาวของ archive เมื่อช่องที่เก่าที่สุดว่าง เช่นในฐานข้อมูลที่เพิ่งสร้าง snippet ด้านล่างรายงานจำนวนค่าที่อ่านได้และจำนวนช่องที่ไม่มีค่าแยกกัน</p>
</details>
<details>
<summary>เจาะลึก: console snippet สำหรับสรุปข้อมูล router ของคุณเอง (สำหรับ PC)</summary>
<p>กราฟ Health แสดงรูปร่างของข้อมูล snippet นี้พิมพ์ตัวเลขออกมา: ค่าเฉลี่ย ค่ามัธยฐาน เปอร์เซ็นไทล์ที่ 95 และค่าสูงสุด และจำนวนค่าที่อ่านได้ที่ถึง 80 °C ของ archive หนึ่ง snippet นี้ส่งคำขออ่านหนึ่งครั้ง (GET) ไปที่ health API ของ router เอง และไม่เปลี่ยนแปลงอะไร</p>
<p><strong>ก่อนเริ่ม</strong></p>
<ul>
<li>คุณต้องมี PC ที่มี Chrome หรือ Firefox และ login เข้า web interface ของ router ที่เปิด Reporting → Health ได้</li>
<li>คุณพิมพ์ใน developer console ของ browser บนหน้าของ router เอง คุณไม่ต้องติดตั้งอะไร</li>
<li>ใช้เวลาสองถึงสามนาที</li>
<li>ไม่เปลี่ยนแปลงอะไรบน router หรือ PC จึงไม่มีอะไรต้องย้อนกลับ ปิด console เมื่อทำเสร็จ</li>
<li>ในกล่องด้านล่าง ปุ่ม <strong>Copy</strong> จะคัดลอกทั้งกล่อง กล่องเส้นประแสดงสิ่งที่คุณควรเห็น คุณไม่ต้องพิมพ์มัน</li>
</ul>
<p><strong>ขั้นตอน</strong></p>
<ol>
<li>เปิด web interface ของ router ใน Chrome หรือ Firefox: พิมพ์ที่อยู่ที่คุณใช้จัดการ router ลงในแถบที่อยู่ กด <strong>Enter</strong> แล้ว log in คุณควรเห็น dashboard ของ OPNsense ถ้าไม่มีหน้า login ขึ้นมา ให้ตรวจที่อยู่ และตรวจว่า PC อยู่ในเครือข่ายภายในบ้าน ถ้า browser เตือนว่าการเชื่อมต่อไม่เป็นส่วนตัว ดูหมายเหตุในข้อ 1 ของขั้นตอนดูกราฟด้านบน</li>
<li>อยู่ในหน้าใดก็ได้ของ OPNsense แล้วเปิด console ของ browser: กด <strong>Ctrl+Shift+J</strong> ใน Chrome หรือ <strong>Ctrl+Shift+K</strong> ใน Firefox บน Windows และ Linux หรือกด <strong>Cmd+Option+J</strong> หรือ <strong>Cmd+Option+K</strong> บน Mac แผงจะเปิดขึ้นข้างหรือใต้หน้าเว็บ พร้อมบรรทัดสำหรับพิมพ์ ถ้ามันเปิดที่แท็บอื่น ให้คลิกแท็บ <strong>Console</strong></li>
<li>
<p>คลิก <strong>Copy</strong> ในกล่องด้านล่าง มันคัดลอก snippet ทั้งหมด</p>
<div class="sf-box" data-mode="file" data-effect="read" data-effect-text="ดูอย่างเดียว — ลองได้อย่างปลอดภัย" data-where="Console ของ browser บนหน้าของ OPNsense" data-how="วางทั้งหมดลงใน console แล้วกด Enter"><pre><code>// Paste into the browser console on any OPNsense page while logged in.
// Read-only: one GET to the router's own health API. Changes nothing.
(async () =&gt; {
  const LEVEL = 0; // archive: 0 is the finest (one value a minute); higher numbers are coarser. How many exist depends on the router.
  const url = '/api/diagnostics/systemhealth/get_system_health/cputemp-system/' + LEVEL;
  let d;
  try {
    const r = await fetch(url);
    if (r.status === 401) { console.log('HTTP 401: not logged in. Log in to the OPNsense web interface in this browser, then paste again.'); return; }
    if (r.status === 403) { console.log('HTTP 403: logged in, but this user may not read Reporting &gt; Health. Use an account with that privilege.'); return; }
    if (!r.ok) { console.log('HTTP ' + r.status + ' from ' + url); return; }
    d = await r.json();
  } catch (e) {
    console.log('No JSON came back (' + e.message + '). Run this on an OPNsense page while logged in.'); return;
  }
  const series = d &amp;&amp; d.set &amp;&amp; d.set.data &amp;&amp; d.set.data[0];
  if (!series || !Array.isArray(series.values)) { console.log('No temperature series at LEVEL ' + LEVEL + '. A higher LEVEL may not exist on this router; at LEVEL 0, check that Reporting &gt; Health shows a CPU temperature graph.'); return; }
  const pts = series.values.filter(p =&gt; p[1] !== null &amp;&amp; !isNaN(p[1]));
  const empty = series.values.length - pts.length;
  if (pts.length === 0) { console.log('The series ' + series.key + ' has no readings at this level.'); return; }
  const v = pts.map(p =&gt; p[1]).sort((a, b) =&gt; a - b);
  const n = v.length;
  const median = n % 2 ? v[(n - 1) / 2] : (v[n / 2 - 1] + v[n / 2]) / 2;
  const p95 = v[Math.min(n - 1, Math.ceil(0.95 * n) - 1)]; // nearest-rank
  const when = t =&gt; new Date(t).toLocaleString(); // your browser's time zone; each time marks the end of its interval
  console.log('Series ' + series.key + ', one value every ' + d.set.step_size + ' s');
  console.log('From ' + when(pts[0][0]) + ' to ' + when(pts[n - 1][0]) + ': ' + n + ' readings, ' + empty + ' empty slots');
  console.log('Average ' + (v.reduce((a, b) =&gt; a + b, 0) / n).toFixed(1) + ' °C, median ' + median.toFixed(1) +
    ', 95th percentile ' + p95.toFixed(1) + ', maximum ' + v[n - 1].toFixed(1));
  console.log('Readings at 80 °C or above: ' + v.filter(x =&gt; x &gt;= 80).length);
})();</code></pre></div>
</li>
<li>
<p>คลิกที่บรรทัดใน console วางด้วย <strong>Ctrl+V</strong> (<strong>Cmd+V</strong> บน Mac) แล้วกด <strong>Enter</strong> browser อาจบล็อกการวางลงใน console เพราะการวางโค้ดของคนแปลกหน้าลงในหน้าที่ log in อยู่เป็นกลลวงที่รู้จักกัน อ่าน snippet ก่อนจะอนุญาต ถ้า browser ขอให้พิมพ์ &#8220;allow pasting&#8221; ให้ทำตามข้อความนั้น แล้ววางอีกครั้ง</p>
</li>
<li>
<p>ภายในหนึ่งหรือสองวินาที คุณควรเห็นสี่บรรทัด (ไม่ต้องสนใจบรรทัดที่ขึ้นต้นด้วย &#8220;Promise&#8221;): ชื่อ series ช่วงเวลาพร้อมจำนวนค่าที่อ่านได้และจำนวนช่องที่ไม่มีค่า ตัวเลขสรุป และจำนวนค่าที่อ่านได้ที่ 80 °C ขึ้นไป เวลาที่แสดงเป็นเขตเวลาของ browser ของคุณ และแต่ละเวลาคือจุดสิ้นสุดของช่วงนั้น บน router ของผม เมื่อวันที่ 28 ตุลาคม 2026 มันพิมพ์ออกมาว่า (ผมตัดเวลาออก รูปแบบของเวลาเป็นไปตามการตั้งค่าของ browser ของคุณ):</p>
<div class="sf-box" data-mode="output" data-where="สิ่งที่คุณควรเห็น"><pre><code>Series cpu0temp, one value every 60 s
From &lt;start time&gt; to &lt;end time&gt;: 1000 readings, 0 empty slots
Average 43.9 °C, median 47.7, 95th percentile 57.8, maximum 72.5
Readings at 80 °C or above: 0</code></pre></div>
</li>
<li>
<p>&#8220;HTTP 401&#8221; แปลว่า browser ยังไม่ได้ log in เข้า OPNsense: ให้ log in แล้วทำข้อ 4 ซ้ำ &#8220;HTTP 403&#8221; แปลว่าคุณ log in ด้วย user ที่ไม่มีสิทธิ์เข้า Reporting → Health</p>
</li>
<li>หากต้องการอ่าน archive รายชั่วโมง ให้วาง snippet ลงใน text editor ธรรมดาก่อน (Notepad บน Windows, TextEdit ที่ตั้งเป็น plain text บน Mac) เปลี่ยน <code>const LEVEL = 0;</code> เป็น <code>const LEVEL = 2;</code> คัดลอกทั้งหมดจากตรงนั้น แล้วทำข้อ 4 และ 5 ซ้ำ</li>
<li>เทียบค่าเฉลี่ยกับระดับของเส้นกราฟ Reporting → Health ของ archive เดียวกัน ทั้งสองควรตรงกัน</li>
<li>เมื่อทำเสร็จ ให้ปิดแผงด้วย <strong>×</strong> ที่มุมขวาบน router ไม่ถูกเปลี่ยนแปลงอะไร</li>
</ol>
</details>
<h2 id="fvr-th-s7">คำตัดสิน</h2>
<p>เคสยังปิดอยู่ และ paste ก็ยังอยู่ในกล่อง</p>
<p>สิ่งที่เหลือเป็นงานเล็ก ยึด fan และยกมันขึ้น: ขายางสูง 10 ถึง 15 mm จะยึด fan ไว้กับที่ และให้ลมไปถึง fins ที่อยู่ใต้ดุมของมัน ซึ่ง fan ที่วางราบทำให้ขาดลม นั่นเป็นวิธีปฏิบัติทั่วไปสำหรับ fan ที่วางเหนือ heatsink ผมยังไม่ได้วัดผลกับเครื่องนี้ ดูแลไม่ให้มีอะไรบังตะแกรงข้างตู้ ตัวตู้ทั้งตู้เป็นอีกปัญหาหนึ่ง: fan ทำให้ router เย็นลงได้แค่เข้าใกล้อุณหภูมิของอากาศในตู้ ซึ่งอุ่นกว่าห้อง ผมไล่คิดเรื่องนั้นแยกต่างหาก และอาจเขียนเล่าทีหลัง</p>
<p>ก่อนติด fan ความร้อนเป็นเหตุผลให้ผมมองหา router ตัวใหม่ ตอนนี้ไม่ใช่แล้ว</p>
<h2 id="fvr-th-s8">สิ่งที่ผมจะบอกคนที่มีเครื่อง fanless อยู่ในตู้ที่อุ่น</h2>
<ol>
<li><strong>อ่านสิ่งที่ router บันทึกไว้อยู่แล้ว</strong> ก่อนจะเปิดอะไร บน OPNsense คือ Reporting → Health หรือ API ด้านบน</li>
<li><strong>ตรวจว่าแต่ละ archive บน router ของคุณเก็บข้อมูลได้นานแค่ไหน</strong> ขึ้นกับว่าฐานข้อมูลของมันถูกสร้างเมื่อไร</li>
<li><strong>ตัดสินใจไว้ก่อนว่าผลแบบไหนจะพาคุณไปขั้นต่อไป</strong> ก่อนจะเปลี่ยนอะไร</li>
<li><strong>ตัดสินจากค่าเฉลี่ย ไม่ใช่ค่าเดี่ยว</strong> ค่ารายนาทีที่ต่อกันอาจต่างกันได้ 30 °C</li>
<li><strong>ลองวิธีที่ต้นทุนต่ำและย้อนกลับได้ก่อน</strong> และชั่งดูว่ามันมีต้นทุนอะไร: fan นำเสียงและฝุ่นมาสู่เครื่องที่ซื้อมาเพื่อไม่ให้มีทั้งสองอย่าง</li>
</ol>
<details>
<summary>อภิธานศัพท์</summary>
<ul>
<li><strong>การระบายความร้อนแบบ fanless (passive):</strong> ตัวเคสคือ heatsink ความร้อนออกไปทางการนำความร้อนและการไหลเวียนของอากาศตามธรรมชาติ โดยไม่มี fan</li>
<li><strong>Thermal paste / repaste:</strong> สารที่อยู่ระหว่าง CPU กับ heatsink ซึ่งเติมช่องว่างระดับจุลภาค การ repaste คือการเช็ดสารเก่าออกแล้วทาสารใหม่</li>
<li><strong>P-core / E-core:</strong> performance core และ efficient core ของ Intel ในชิปตัวเดียว Pentium Gold 8505 มีแบบแรกหนึ่งคอร์และแบบหลังสี่คอร์</li>
<li><strong>TJUNCTION:</strong> อุณหภูมิสูงสุดที่ Intel อนุญาตที่ตัวชิป สำหรับ 8505 คือ 100 °C</li>
<li><strong>PWM:</strong> pulse-width modulation สายสัญญาณที่บอก fan ว่าต้องหมุนเร็วแค่ไหน</li>
<li><strong>Round-robin database (RRD):</strong> ที่เก็บข้อมูลขนาดคงที่ ซึ่งเก็บข้อมูลล่าสุดแบบละเอียด และเก็บข้อมูลเก่าเป็นค่าเฉลี่ยที่หยาบกว่า โดยเขียนทับข้อมูลที่เก่าที่สุด</li>
<li><strong>ค่ามัธยฐาน / เปอร์เซ็นไทล์ที่ 95:</strong> ค่ามัธยฐานคือค่าที่อยู่ตรงกลาง (หรือค่าเฉลี่ยของสองค่าที่อยู่ตรงกลาง) ค่าที่อ่านได้ 95 เปอร์เซ็นต์อยู่ที่หรือต่ำกว่าเปอร์เซ็นไทล์ที่ 95</li>
<li><strong>API:</strong> ส่วนเชื่อมต่อของ router ที่ให้โปรแกรมอื่นเรียกใช้ได้ ให้ข้อมูลชุดเดียวกับที่หน้าเว็บแสดง ในรูป JSON</li>
<li><strong>Tunables:</strong> การตั้งค่า kernel ที่ OPNsense ใช้ตอน boot อยู่ในรายการที่ System → Settings → Tunables</li>
</ul>
</details>
</div>
</div>
</div>
<p>The post <a href="https://techblog.viveksanghi.com/2026/11/fanless-router-overheating-fan-vs-repaste/">The paste is still in its box</a> appeared first on <a href="https://techblog.viveksanghi.com">Stubborn Fanatic - Tech Blog</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://techblog.viveksanghi.com/2026/11/fanless-router-overheating-fan-vs-repaste/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">276</post-id>	</item>
		<item>
		<title>The Pi-hole that wasn’t dead: getting back in without a password</title>
		<link>https://techblog.viveksanghi.com/2026/10/pihole-admin-page-not-loading-port-8080/</link>
					<comments>https://techblog.viveksanghi.com/2026/10/pihole-admin-page-not-loading-port-8080/#respond</comments>
		
		<dc:creator><![CDATA[Vivek Sanghi]]></dc:creator>
		<pubDate>Tue, 27 Oct 2026 16:35:20 +0000</pubDate>
				<category><![CDATA[home network]]></category>
		<category><![CDATA[raspberry pi]]></category>
		<category><![CDATA[sysadmin]]></category>
		<category><![CDATA[ai assisted]]></category>
		<category><![CDATA[debian]]></category>
		<category><![CDATA[debugging]]></category>
		<category><![CDATA[dns]]></category>
		<category><![CDATA[ntfy]]></category>
		<category><![CDATA[pi-hole]]></category>
		<category><![CDATA[self-hosting]]></category>
		<category><![CDATA[stubborn fanatic]]></category>
		<category><![CDATA[tailscale]]></category>
		<guid isPermaLink="false">https://techblog.viveksanghi.com/?p=269</guid>

					<description><![CDATA[<p>My Pi-hole's web page had been "dead" for over a year. DNS and blocking were fine all along: the v6 upgrade had moved the page to port 8080. How I got back in without a password, read the logs, upgraded in place and made the Pi watch itself.</p>
<p>The post <a href="https://techblog.viveksanghi.com/2026/10/pihole-admin-page-not-loading-port-8080/">The Pi-hole that wasn&#8217;t dead: getting back in without a password</a> appeared first on <a href="https://techblog.viveksanghi.com">Stubborn Fanatic - Tech Blog</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p class="wp-block-paragraph"><strong>If your Pi-hole admin page stopped loading after the v6 upgrade:</strong> try <code>http://&lt;pi-address&gt;:8080/admin</code>, or <code>https://&lt;pi-address&gt;/admin</code> and accept the certificate warning. That was my whole problem. If neither loads, <a href="#step-5">Step 5</a> shows how to find the port in a minute. The rest of this post is how I found it the long way round, and what I changed while I was in there.</p>



<p class="wp-block-paragraph">On 25 October 2026 the Pi-hole admin page would not load. The browser said the site could not be reached and that the Pi had refused to connect. It had said the same when I last tried, in 2025, and I had let it go.</p>



<p class="wp-block-paragraph">This time I also found I had forgotten both passwords: the one for the Pi-hole web page and the one for the Pi&#8217;s own login. SSH answered, but <code>pi</code> / <code>raspberry</code> was refused. That is expected. Raspberry Pi OS images have shipped without a default user since 2022.</p>



<p class="wp-block-paragraph">One thing did not fit. The internet in the house still worked, and ads were still blocked.</p>



<p class="wp-block-paragraph">I did the work over two days with Claude. I made the decisions and ran every command on the Pi; the diagnosis plan, the scripts and some of the wrong turns came from the model. The wrong turns are in here as well, because they were the useful part.</p>



<details class="sf-legend"><summary><strong>New to the command line? How to read the boxes</strong></summary>
<p><strong>PS&gt;</strong> means: type this in <em>PowerShell</em> on Windows (Start menu → type <code>powershell</code> → Enter). <strong>$</strong> means: type this in a terminal on Linux or a Mac, or on the Pi after you have logged in with <code>ssh</code>. Do not type the <strong>$</strong> or <strong>PS&gt;</strong> itself.</p>
<p>Each line that starts with <strong>$</strong> or <strong>PS&gt;</strong> is one command. Click that <strong>$</strong> to copy just that line, paste it, press <strong>Enter</strong>, and wait for it to finish before the next. A box with a <strong>Copy</strong> button at the top holds one command (or one file), so copy it whole. A dashed box shows what you should see back; you do not type it.</p>
</details>



<h2 class="wp-block-heading">The setup</h2>



<ul class="wp-block-list">
<li>Raspberry Pi 4 Model B, on the official Raspberry Pi 15 W USB-C supply (5.1 V, 3 A).</li>



<li>SanDisk 128 GB microSD card, made in February 2024.</li>



<li>Wired by Ethernet to a mesh Wi-Fi router. The ISP&#8217;s fibre router sits in front of it.</li>



<li>Raspberry Pi OS Bookworm, desktop edition, installed in May 2024. Pi-hole v5 installed the same month, upgraded to v6 in July 2025.</li>



<li>The router hands out the Pi as the only DNS server. That is what makes ad-blocking cover every device in the house, and it is also why the Pi matters more than its size suggests.</li>
</ul>



<p class="wp-block-paragraph">In this article the Pi is <code>192.168.x.51</code> and the router is <code>192.168.x.1</code>.</p>



<h2 class="wp-block-heading">Test DNS before you decide Pi-hole is down</h2>



<p class="wp-block-paragraph">A dead web page and a dead Pi-hole are different things. From a Windows laptop:</p>



<div class="sf-box" data-mode="each" data-shell="ps" data-effect="read" data-where="PowerShell or Command Prompt on your PC"><pre><code>nslookup doubleclick.net 192.168.x.51</code></pre></div>



<p class="wp-block-paragraph">The answer was <code>0.0.0.0</code>. The Pi was answering DNS queries and blocking an ad domain. Pi-hole was working. Only its web page looked dead.</p>



<p class="wp-block-paragraph">That changed the job. I was not repairing an outage. I was getting back into a box that worked, without breaking it on the way in.</p>



<h2 class="wp-block-heading">Step 1: protect the house before touching the Pi</h2>



<p class="wp-block-paragraph">With the Pi as the only DNS server, pulling its card stops name resolution for every phone, TV and laptop in the house.</p>



<p class="wp-block-paragraph">Changing the router&#8217;s DNS a few minutes before the work is not enough. Devices keep the DNS server they were given until their DHCP lease renews, which can take hours. So on the night of 25 October I set the router&#8217;s primary DNS to <code>1.1.1.1</code>. By morning every device had picked it up and the Pi could go offline without anyone noticing.</p>



<p class="wp-block-paragraph">I kept one rollback rule through the whole job: the original card, untouched, goes back in and the house is as it was.</p>



<p class="wp-block-paragraph">When the work was done, I set the router&#8217;s primary DNS back to the Pi. The lease delay works the same way in reverse: each device returns to the Pi when its lease renews. To hurry a Windows laptop, run <code>ipconfig /renew</code>; on a phone, turn Wi-Fi off and on. Then <code>nslookup doubleclick.net</code> with no server named should answer <code>0.0.0.0</code>.</p>



<h2 class="wp-block-heading">Step 2: image the card first</h2>



<p class="wp-block-paragraph">I had no spare card, so any change would be made on the original. A full image came first.</p>



<p class="wp-block-paragraph">On Windows I used Win32 Disk Imager:</p>



<ol class="wp-block-list">
<li>Choose a file name for the image on a drive with 130 GB free.</li>



<li>Select the card&#8217;s drive letter.</li>



<li>Tick <strong>Read Only Allocated Partitions</strong>.</li>



<li>Press <strong>Read</strong>. Not <strong>Write</strong>. Write copies the image file onto the card and destroys what is on it.</li>
</ol>



<p class="wp-block-paragraph">128 GB at about 28 MB/s took roughly 75 minutes.</p>



<p class="wp-block-paragraph">I then checked the image&#8217;s structure:</p>



<ul class="wp-block-list">
<li>MBR signature <code>55aa</code> present.</li>



<li>Partition 1: FAT, labelled <code>bootfs</code>.</li>



<li>Partition 2: ext4, labelled <code>rootfs</code>, ext4 magic number <code>0xEF53</code> in the right place, and its end matches the end of the image file, so the copy was not cut short.</li>
</ul>



<p class="wp-block-paragraph">That proves the layout, not every byte. Win32 Disk Imager&#8217;s <strong>Verify Only</strong> button compares the whole image with the card; it takes about as long again.</p>



<p class="wp-block-paragraph">One side lesson. The image was the full 128 GB though the card turned out to be 6% used. &#8220;Read Only Allocated Partitions&#8221; stops at the end of the last partition, and on a Pi the root partition expands to fill the card at first boot. The size of the image says nothing about how full the card is.</p>



<p class="wp-block-paragraph">I also copied the files from the boot partition, which Windows shows as a drive called <code>bootfs</code>. Those are the files I was about to edit.</p>



<h2 class="wp-block-heading">Step 3: getting in without a password</h2>



<p class="wp-block-paragraph">By then I had a screen and a keyboard on the Pi, and it booted to its desktop. I did not try them. On Raspberry Pi OS the desktop user can often run <code>sudo</code> without a password, so a terminal there may have been enough to reset the password. I wanted SSH from the laptop, by key, for everything that followed: commands I could paste, files I could copy, and no password to remember. So I took the longer route.</p>



<p class="wp-block-paragraph">Raspberry Pi Imager has the mechanism built in, for Bookworm images. When you set a user name or Wi-Fi in Imager, it writes a script to the boot partition and asks systemd to run it once at first boot, from the kernel command line. I used the same mechanism with my own script.</p>



<p class="wp-block-paragraph">The reset needs three files on the boot partition: the script, <code>pi_reset.sh</code>; the laptop&#8217;s SSH <strong>public</strong> key, saved as <code>pi_key.pub</code>; and an edited <code>cmdline.txt</code>. <code>cmdline.txt</code> is a single line. The edit appends this to its end, with one space before it and no line break:</p>



<div class="sf-box" data-mode="file" data-where="Added to the end of cmdline.txt" data-how="one addition to the single line — the helper in The kit makes it for you"><pre><code>systemd.run=/boot/firmware/pi_reset.sh systemd.run_success_action=reboot systemd.unit=kernel-command-line.target</code></pre></div>



<p class="wp-block-paragraph">Bookworm mounts the boot partition at <code>/boot/firmware</code>; older images use <code>/boot</code>. I made the edit with a short Python helper that refuses to touch a line that already carries such an entry.</p>



<p class="wp-block-paragraph">At boot the script adds the key for root and for every login user, enables SSH, writes <code>pi_reset.log</code> to the boot partition, removes its own entry from <code>cmdline.txt</code> and deletes itself. systemd then reboots the Pi. The script, the helper and the copy steps are in <a href="#the-kit">The kit</a> at the end.</p>



<p class="wp-block-paragraph">Three cautions:</p>



<ul class="wp-block-list">
<li><strong>Public key only.</strong> The private key never leaves the laptop.</li>



<li><strong>Line endings.</strong> A script saved with Windows (CRLF) line endings does not run at all. Then nothing reboots the Pi and nothing removes the entry from <code>cmdline.txt</code>, so the Pi stops at the same point on every boot, with no network. The helper converts the script to Unix (LF) endings for you. If a Pi does hang this way, put the card in the laptop and copy your original <code>cmdline.txt</code> back.</li>



<li><strong>Test the cleanup.</strong> If the cleanup damages <code>cmdline.txt</code>, the Pi will not boot. Before I put the card back, I ran the script&#8217;s cleanup against the edited <code>cmdline.txt</code> and compared the result with my copy of the original. It matched byte for byte. The kit has the one-line test.</li>
</ul>



<p class="wp-block-paragraph">The Pi booted, ran the script, rebooted, and this worked with no password:</p>



<div class="sf-box" data-mode="each" data-shell="ps" data-effect="read" data-where="PowerShell on your PC"><pre><code>ssh root@192.168.x.51</code></pre></div>



<p class="wp-block-paragraph">Debian&#8217;s default SSH setting, <code>PermitRootLogin prohibit-password</code>, refuses root passwords but allows root login by key. The log on the boot partition named my old user. The kit&#8217;s version of the script also writes the cleaned <code>cmdline.txt</code> line into the log, so the cleanup can be confirmed without opening the file.</p>



<p class="wp-block-paragraph">One distraction: on the desktop edition a Wi-Fi password prompt appeared on the screen after the reboot. On a wired Pi it does not matter. Cancel it.</p>



<h2 class="wp-block-heading">Step 4: diagnosis from the logs</h2>



<p class="wp-block-paragraph">Before changing anything I ran one script, <code>pi_diag.sh</code> (in <a href="#the-kit">The kit</a>), that changes no settings. If the page had stopped answering, I wanted to know whether power, the card or the software was failing. The script gathers everything below into one report and removes hardware addresses from it.</p>



<p class="wp-block-paragraph"><strong>Power.</strong> <code>vcgencmd get_throttled</code> returns a bit field of power and heat events since boot. It read <code>0x0</code>. I then loaded all four cores for 60 seconds:</p>



<div class="sf-box" data-mode="each" data-shell="sh" data-effect="read" data-where="On the Pi, after ssh"><pre><code>for i in 1 2 3 4; do timeout 60 sh -c 'while :; do :; done' &amp; done; wait
vcgencmd get_throttled
vcgencmd measure_temp</code></pre></div>



<p class="wp-block-paragraph">Still <code>0x0</code>, and no &#8220;Undervoltage&#8221; lines in the journal, which held entries back to May 2026. The supply passes. The temperature reached 73 °C; a GPIO fan overlay in <code>config.txt</code> switches the fan on at 70 °C, so that is the fan doing its job.</p>



<p class="wp-block-paragraph"><strong>Card.</strong> The kernel reports the card&#8217;s identity:</p>



<div class="sf-box" data-mode="each" data-shell="sh" data-effect="read" data-where="On the Pi, after ssh"><pre><code>cat /sys/block/mmcblk0/device/{name,manfid,oemid,date}</code></pre></div>



<p class="wp-block-paragraph"><code>SN128</code>, SanDisk, made 02/2024. No mmc or ext4 errors in the logs. <code>df -h</code> showed 6.5 GB used of 117 GB. The card passes.</p>



<p class="wp-block-paragraph"><strong>Where the space went.</strong> <code>/var/log</code> held 785 MB. Pi-hole&#8217;s query database held 325 MB, a year of history. <code>gravity.db</code> and <code>gravity_old.db</code> were about 145 MB each. The rest was the desktop: Chromium, Firefox, VLC, CUPS, VNC. A DNS server needs none of them.</p>



<p class="wp-block-paragraph"><strong>Restarts.</strong> About 20 boots since May. The times are unreliable, because the Pi has no clock battery and restores the last saved time at boot. Power cuts are the likely cause, and I found no damage from them. A plug that sits loose in its socket is worth checking if your count is higher than your power cuts.</p>



<p class="wp-block-paragraph"><strong>Pi-hole.</strong> <code>pihole -v</code> showed v6 (Core 6.1.4, Web 6.2.1, FTL 6.2.3). The apt history dates the upgrade to July 2025. <code>lighttpd</code> was inactive and disabled. In v5 that would be the fault. In v6 it is correct, because FTL now serves the web page itself.</p>



<p class="wp-block-paragraph">Before I changed anything I took a settings backup:</p>



<div class="sf-box" data-mode="each" data-shell="sh" data-effect="read" data-where="On the Pi, as root" data-effect-text="only writes a backup file"><pre><code>pihole-FTL --teleporter</code></pre></div>



<p class="wp-block-paragraph">That writes a Teleporter zip in the current folder. The v5 command, <code>pihole -a -t</code>, no longer exists in v6.</p>



<h2 id="step-5" class="wp-block-heading">Step 5: why the Pi-hole admin page was not loading</h2>



<div class="sf-box" data-mode="each" data-shell="sh" data-effect="read" data-where="On the Pi, after ssh"><pre><code>pihole-FTL --config webserver.port</code></pre></div>



<p class="wp-block-paragraph">returned:</p>



<div class="sf-box" data-mode="output" data-where="What it returned"><pre><code>8080o,443os,[::]:8080o,[::]:443os</code></pre></div>



<p class="wp-block-paragraph">and <code>ss -tlnp | grep -i ftl</code> showed FTL listening on 8080, 443 and 53.</p>



<p class="wp-block-paragraph">When Pi-hole upgraded from v5 to v6 in July 2025, its new web server ended up on port 8080. That is a <a href="https://discourse.pi-hole.net/t/cannot-access-admin-website-after-v6-upgrade/75871">known outcome</a> of v5-to-v6 upgrades; the cause is not settled. <code>http://192.168.x.51:8080/admin</code> had worked the whole time.</p>



<p class="wp-block-paragraph">Nothing was broken. The page had not died twice. It had been on 8080 since July 2025, and I had looked at port 80 twice. My bookmark pointed at port 80, and nothing listens there any more.</p>



<p class="wp-block-paragraph"><strong>What would have found this in a minute.</strong> I did not need the card image or the reset to see it. From the laptop, in PowerShell:</p>



<div class="sf-box" data-mode="each" data-shell="ps" data-effect="read" data-where="PowerShell on your PC"><pre><code>Test-NetConnection 192.168.x.51 -Port 80
Test-NetConnection 192.168.x.51 -Port 8080</code></pre></div>



<p class="wp-block-paragraph"><code>TcpTestSucceeded : False</code> on 80 and <code>True</code> on 8080 tells the whole story. On Linux or a Mac, <code>nc -zv 192.168.x.51 8080</code> does the same. I would still have needed a way in for the forgotten passwords. But I would have gone in knowing the box was healthy, and the morning would have been shorter.</p>



<p class="wp-block-paragraph">I kept 8080 and changed the bookmark. To move it back to 80, first make sure nothing else holds port 80, then change the setting and check:</p>



<div class="sf-box" data-mode="each" data-shell="sh" data-effect="change" data-where="On the Pi, after ssh"><pre><code>sudo systemctl disable --now lighttpd
sudo pihole-FTL --config webserver.port '80o,443os,[::]:80o,[::]:443os'
sudo systemctl restart pihole-FTL
sudo ss -tlnp | grep ':80 '</code></pre></div>



<p class="wp-block-paragraph">The last line should show <code>pihole-FTL</code>. The <code>o</code> in <code>80o</code> makes the port optional: if something else holds it, FTL skips it without an error. If you use the health check in the kit, set its <code>WEB_URL</code> to the new port.</p>



<h2 class="wp-block-heading">Step 6: modernise in place, no reflash</h2>



<p class="wp-block-paragraph">The power, the card and the software were all healthy. A clean reinstall would have fixed nothing and cost a morning. Bookworm is still supported: Debian handed security support for it to the Debian LTS team in July 2026, and LTS runs to 30 June 2028.</p>



<p class="wp-block-paragraph"><strong>Boot to the console, not the desktop.</strong></p>



<div class="sf-box" data-mode="each" data-shell="sh" data-effect="change" data-where="On the Pi, after ssh"><pre><code>sudo systemctl set-default multi-user.target</code></pre></div>



<p class="wp-block-paragraph"><strong>Update the OS and keep security updates coming.</strong></p>



<div class="sf-box" data-mode="each" data-shell="sh" data-effect="change" data-where="On the Pi, after ssh"><pre><code>sudo apt-get update &amp;&amp; sudo apt-get -y full-upgrade
sudo apt-get install -y unattended-upgrades</code></pre></div>



<p class="wp-block-paragraph">In <code>/etc/apt/apt.conf.d/20auto-upgrades</code>:</p>



<div class="sf-box" data-mode="file" data-where="File: /etc/apt/apt.conf.d/20auto-upgrades"><pre><code>APT::Periodic::Update-Package-Lists "1";
APT::Periodic::Unattended-Upgrade "1";</code></pre></div>



<p class="wp-block-paragraph">I left automatic reboots off. I would rather reboot a DNS server when I choose.</p>



<p class="wp-block-paragraph">This Pi runs 64-bit Raspberry Pi OS. Its Debian packages match the default rule in <code>unattended-upgrades</code>, so Debian security fixes install themselves. The kernel and firmware come from Raspberry Pi&#8217;s own archive and still need <code>sudo apt full-upgrade</code> by hand; the monthly report below says when a reboot is due. To see what would install on your own Pi: <code>sudo unattended-upgrade --dry-run -d</code>.</p>



<p class="wp-block-paragraph"><strong>Cap the journal</strong> at 64 MB. My Pi already kept its logs on disk; the setting makes that explicit. The folder may not exist yet:</p>



<div class="sf-box" data-mode="each" data-shell="sh" data-effect="change" data-where="On the Pi, after ssh"><pre><code>sudo mkdir -p /etc/systemd/journald.conf.d</code></pre></div>



<p class="wp-block-paragraph">Then, in <code>/etc/systemd/journald.conf.d/size.conf</code>:</p>



<div class="sf-box" data-mode="file" data-where="File: /etc/systemd/journald.conf.d/size.conf"><pre><code>[Journal]
Storage=persistent
SystemMaxUse=64M</code></pre></div>



<p class="wp-block-paragraph">then <code>sudo systemctl restart systemd-journald</code>.</p>



<p class="wp-block-paragraph"><strong>Update Pi-hole.</strong></p>



<div class="sf-box" data-mode="each" data-shell="sh" data-effect="change" data-where="On the Pi, after ssh"><pre><code>sudo pihole -up</code></pre></div>



<p class="wp-block-paragraph">This took it to the current v6 release, and then printed &#8220;Everything is up to date!&#8221;, which reads as if nothing had happened. Confirm with <code>pihole -v</code> and <code>cat /etc/pihole/versions</code> rather than trusting the last line.</p>



<p class="wp-block-paragraph"><strong>Keep 30 days of query history, not a year.</strong></p>



<div class="sf-box" data-mode="each" data-shell="sh" data-effect="change" data-where="On the Pi, after ssh"><pre><code>sudo pihole-FTL --config database.maxDBdays 30</code></pre></div>



<p class="wp-block-paragraph">Old rows are deleted daily. SQLite reuses the space rather than shrinking the file, so the database stops growing instead of getting smaller.</p>



<p class="wp-block-paragraph"><strong>Set a new web password.</strong></p>



<div class="sf-box" data-mode="each" data-shell="sh" data-effect="change" data-where="On the Pi, after ssh"><pre><code>sudo pihole setpassword</code></pre></div>



<p class="wp-block-paragraph">Save the password in a password manager <em>before</em> you type it. I did not, forgot it within minutes, and reset it the same way.</p>



<h2 class="wp-block-heading">Step 7: make it look after itself</h2>



<p class="wp-block-paragraph">The page had been &#8220;dead&#8221; for months without my knowing what was wrong. I wanted the Pi to tell me, and to fix the one failure a restart can fix, without making anything worse.</p>



<p class="wp-block-paragraph"><strong>A health check every 15 minutes</strong>, run by a systemd timer. In order:</p>



<ul class="wp-block-list">
<li><strong>Pause during updates.</strong> If Pi-hole is updating itself or rebuilding its block lists, it may stop its own DNS on purpose, so the check stands aside. If that lasts over 30 minutes, it alerts and checks anyway.</li>



<li><strong>Is DNS answering at all?</strong> It asks Pi-hole for <code>pi.hole</code>. Any reply counts, even &#8220;no such name&#8221;. Only no reply at all is a DNS failure. A failed check is repeated once after 5 seconds, so one dropped packet changes nothing.</li>



<li><strong>If DNS is not answering:</strong> restart <code>pihole-FTL</code>, wait up to 60 seconds for it, and report whether it came back. At most two restarts in six hours; after that it only alerts, so a fault a restart cannot fix does not keep cutting the house&#8217;s DNS.</li>



<li><strong>If DNS answers</strong>, three more checks, each of which only alerts: the test domain (added once with <code>pihole deny health.blocked.test</code>) must come back <code>0.0.0.0</code>, or ad-blocking may have stopped; the admin page at <code>WEB_URL</code> must answer, where a redirect or a login prompt counts as alive; and an outside name must resolve, or the internet is down. None of these is fixed by a restart, and a restart would cut DNS for the whole house.</li>



<li><strong>The card and the power.</strong> An alert when the card passes 80%. An alert when the under-voltage or throttling flags first appear (<code>get_throttled</code> bits 16 and 18, mask <code>0x50000</code>), not again every day.</li>



<li><strong>Limits.</strong> Every run has a five-minute ceiling, so a stuck command cannot quietly end all monitoring. State lives in <code>/run</code>, in RAM; the only writes to the card are systemd&#8217;s log lines for each run.</li>
</ul>



<p class="wp-block-paragraph">Notifications go through <a href="https://ntfy.sh/">ntfy</a>, a free phone app that needs no account. You subscribe to a topic, and anything posted to that topic arrives on the phone:</p>



<div class="sf-box" data-mode="each" data-shell="sh" data-effect="read" data-where="On the Pi, after ssh" data-effect-text="sends a test alert"><pre><code>curl -s -d "Pi-hole DNS failed after restart" https://ntfy.sh/&lt;your-long-random-topic&gt;</code></pre></div>



<p class="wp-block-paragraph">Anyone who knows the topic name can read it and post to it, so make it long and random and treat it like a password. Repeat alerts are suppressed: once an hour for DNS down, every six hours for the web page and the internet, once a day for the card.</p>



<p class="wp-block-paragraph">The worst-case message says how to restore the house without me: open the router, go to DHCP settings, set the primary DNS to <code>1.1.1.1</code>. Whoever reads it does not need to know what a Pi-hole is. The check cannot see what the router hands out, so it will not notice a house left on <code>1.1.1.1</code>; <code>ipconfig /all</code> on a laptop shows which DNS server it was given.</p>



<p class="wp-block-paragraph"><strong>One trap, and it was real on my Pi.</strong> That worst-case alert is sent when DNS is down, and <code>curl</code> has to look up <code>ntfy.sh</code> before it can send anything. My Pi uses Pi-hole as its own resolver, so in that moment the lookup would fail and the alert would never leave. To see whether your Pi is in the same position:</p>



<div class="sf-box" data-mode="each" data-shell="sh" data-effect="read" data-where="On the Pi, after ssh"><pre><code>cat /etc/resolv.conf</code></pre></div>



<p class="wp-block-paragraph">A <code>nameserver</code> line of <code>127.0.0.1</code>, <code>::1</code> or the Pi&#8217;s own address means it is. The kit closes it twice. The alert helper looks up <code>ntfy.sh</code> through <code>1.1.1.1</code>, or <code>9.9.9.9</code> if that fails, and hands the address to <code>curl</code>. And, optionally, the Pi&#8217;s own lookups get a fallback: Pi-hole first, then <code>1.1.1.1</code>. That keeps updates, Tailscale and alerts working on the Pi when Pi-hole is down. The house still uses only the Pi.</p>



<p class="wp-block-paragraph">Why every 15 minutes? The check takes well under a second of CPU, so cost is not the limit. The interval sets how long the house can be without DNS before the Pi repairs itself. I started at 5 minutes and settled on 15. Choose 5 if you want faster repair.</p>



<p class="wp-block-paragraph"><strong>A monthly report</strong> to the phone on the 1st: Pi-hole versions and whether an update waits, OS packages waiting, whether automatic security updates are switched on, whether a reboot is due (the running kernel against the installed one), the Pi&#8217;s own DNS servers, the date of the last backup, card use, database size, power flags and uptime. Pi-hole itself I update by hand on that prompt. Pi-hole&#8217;s developers advise against unattended Pi-hole updates, and I agree with them for a box everything depends on.</p>



<p class="wp-block-paragraph"><strong>A weekly settings backup</strong> every Sunday with <code>pihole-FTL --teleporter</code>, keeping the last four, readable by root only because they hold the web password hash. One warning that cost nothing to learn: with no argument, <code>--teleporter</code> exports a backup; given a file name, it <em>imports</em> that file and overwrites your settings. The backups sit on the same card, so I copy them to the laptop now and then.</p>



<p class="wp-block-paragraph"><strong>How it was tested.</strong> Every failure path ran against mock versions of the Pi&#8217;s commands: healthy, web page down, test domain not blocked, internet down, a single brief failure, DNS dead and recovering, DNS dead for good, a third failure within six hours, an update in progress, and the power flags. The tests passed and still missed the trap above: a mocked <code>curl</code> never looks anything up. A review also found that an earlier version restarted Pi-hole when only the web page failed, which would have cut the house&#8217;s DNS to fix a page. That is why only &#8220;no reply at all&#8221; now leads to a restart.</p>



<p class="wp-block-paragraph">The scripts, their timers and the install steps are in <a href="#the-kit">The kit</a>.</p>



<h2 class="wp-block-heading">Step 8: remote administration with Tailscale</h2>



<p class="wp-block-paragraph">The last piece was reaching the Pi to administer it from outside the house. I used Tailscale:</p>



<div class="sf-box" data-mode="each" data-shell="sh" data-effect="change" data-where="On the Pi, after ssh"><pre><code>curl -fsSL https://tailscale.com/install.sh | sh
sudo tailscale up --accept-dns=false
sudo tailscale set --auto-update</code></pre></div>



<p class="wp-block-paragraph"><code>--accept-dns=false</code> matters on a Pi-hole. Without it, Tailscale rewrites the Pi&#8217;s own DNS settings.</p>



<p class="wp-block-paragraph">In the Tailscale admin console I disabled key expiry for the Pi. By default a device&#8217;s key expires after about 180 days and the device drops off the network. That will happen when you are furthest from it.</p>



<p class="wp-block-paragraph">SSH now works from anywhere through the Pi&#8217;s Tailscale address. Port forwarding looked like a dead end: the ISP appears to use carrier-grade NAT, because its public hostname contains &#8220;cgn&#8221;. The firmer test is the internet-side address on the ISP router; one in <code>100.64.0.0/10</code> means carrier-grade NAT, and there is no public address to forward. A mesh VPN is the practical route.</p>



<p class="wp-block-paragraph">Tailscale warned that &#8220;UDP GRO forwarding is suboptimally configured on eth0&#8221;. That matters only if the Pi forwards heavy UDP traffic as a subnet router or exit node. For SSH, ignore it.</p>



<p class="wp-block-paragraph"><strong>Note, 27 October 2026.</strong> On 25 October a researcher published &#8220;Tailworm&#8221;, a <a href="https://www.scworld.com/brief/security-researcher-identifies-potential-privilege-escalation-in-tailscale-ssh">report of 11 flaws</a> in Tailscale 1.104.2, the current version at the time. The serious ones are in Tailscale SSH, Tailscale&#8217;s own SSH server, and need an attacker who already controls a device that is allowed to log in. This Pi does not run Tailscale SSH. I reach it with ordinary OpenSSH over the tailnet, which the report does not touch. Auto-update is on, so the fix will arrive when Tailscale ships one. At the time of writing Tailscale had issued no bulletin, CVE or fixed version.</p>



<p class="wp-block-paragraph">To check your own devices, run <code>tailscale debug prefs</code> on each one. <code>"RunSSH": false</code> means Tailscale SSH is off.</p>



<h2 class="wp-block-heading">Two network surprises</h2>



<p class="wp-block-paragraph"><strong>1. A second, unfiltered Wi-Fi.</strong> At one point the laptop could not reach the Pi by its LAN address though everything looked right. <code>ipconfig</code> showed an address in a different range from the mesh, with the ISP&#8217;s DNS servers. The laptop had joined the ISP fibre router&#8217;s own Wi-Fi, not the mesh. Every device on that network bypasses Pi-hole. The fix: move anything that still uses that Wi-Fi to the mesh or to a cable, then switch off the ISP router&#8217;s Wi-Fi. If you run a mesh behind an ISP router, check that the ISP router&#8217;s Wi-Fi is off.</p>



<p class="wp-block-paragraph"><strong>2. The wrong window.</strong> <code>Test-NetConnection</code> is a PowerShell command. In Command Prompt it fails with &#8220;not recognized&#8221;. Several of my &#8220;commands not working&#8221; moments were the right command in the wrong window.</p>



<h2 class="wp-block-heading">What I thought, and what it was</h2>



<p class="wp-block-paragraph">I thought the Pi-hole had died twice. It had moved its web page once, during an upgrade, and I had been knocking on the old door.</p>



<p class="wp-block-paragraph">The morning of 26 October 2026 went on imaging the card, getting back in and reading logs. By noon the Pi was updated, watching itself, and serving the house again. By the afternoon I could reach it from anywhere.</p>



<p class="wp-block-paragraph">What I would tell anyone with a Pi-hole whose page has vanished:</p>



<ol class="wp-block-list">
<li>Test DNS first. <code>nslookup</code> an ad domain against the Pi.</li>



<li>Check which ports answer (<code>Test-NetConnection &lt;pi&gt; -Port 8080</code>), then try <code>:8080/admin</code>.</li>



<li>Move the house off the Pi&#8217;s DNS the night before you touch it.</li>



<li>Image the card and check the image before you edit anything.</li>



<li>Save the new password before you type it.</li>



<li>Point the router back at the Pi when you are done.</li>
</ol>



<h2 id="the-kit" class="wp-block-heading">The kit</h2>



<p class="wp-block-paragraph">Every script in this post, ready to copy. The names carry a <code>pi_</code> prefix; rename them if you like, but keep the names the same across scripts, units and commands. The scripts on the Pi run as root.</p>



<h3 class="wp-block-heading">1. Reset: back in without a password</h3>



<p class="wp-block-paragraph">You need a laptop that can read the card&#8217;s boot partition (Windows can), a card reader, an SSH key pair on the laptop, and Python 3 for the helper.</p>



<ol class="wp-block-list">
<li>Check for an SSH key on the laptop. In PowerShell: <code>Test-Path $env:USERPROFILE\.ssh\id_ed25519.pub</code>. If it says <code>False</code>, create one with <code>ssh-keygen -t ed25519</code>, accept the default file and set a passphrase. If it says <code>True</code>, do not create another: a new key replaces the old one and breaks anything that uses it.</li>



<li>Make a folder for the kit. Save <code>pi_reset.sh</code> and <code>pi_make_cmdline.py</code> (below) in it. Check that Windows has not added <code>.txt</code> to either name. Copy the <strong>public</strong> key in beside them: <code>Copy-Item $env:USERPROFILE\.ssh\id_ed25519.pub .\pi_key.pub</code></li>



<li>Power the Pi off and put its card in the reader. If Windows offers to format a drive, click <strong>Cancel</strong>: that is the Linux partition, which Windows cannot read.</li>



<li>Copy the whole boot drive (labelled <code>bootfs</code>, or <code>boot</code> on older images) to a backup folder. Copy its <code>cmdline.txt</code> into the kit folder as <code>cmdline_old.txt</code>.</li>



<li>In the kit folder run <code>python pi_make_cmdline.py cmdline_old.txt bootfs</code> (use <code>boot</code> for an older image). It prints the old and new line, writes a new <code>cmdline.txt</code>, and converts <code>pi_reset.sh</code> to Unix (LF) line endings. Your <code>cmdline_old.txt</code> is not changed.</li>



<li>Test the cleanup before you trust it. This applies the script&#8217;s cleanup to the new line and compares the result with the original:</li>
</ol>



<div class="sf-box" data-mode="each" data-shell="ps" data-effect="read" data-where="PowerShell, in the kit folder"><pre><code>python -c "import re;a=open('cmdline_old.txt',newline='').read();b=re.sub(r' systemd\.run.*','',open('cmdline.txt',newline='').read());print(a==b)"</code></pre></div>



<p class="wp-block-paragraph">It must print <code>True</code>. If it prints <code>False</code>, stop and compare the two files by eye.</p>



<ol start="7" class="wp-block-list">
<li>Copy <code>pi_reset.sh</code>, <code>pi_key.pub</code> and the new <code>cmdline.txt</code> to the boot drive. Let it replace <code>cmdline.txt</code>; the original is in your backup.</li>



<li>Eject the drive, put the card back and power on. Wait about four minutes: boot, script, reboot, boot. Then <code>ssh root@192.168.x.51</code>.</li>
</ol>



<ul class="wp-block-list">
<li>If the key is refused, power off, put the card in the laptop and read <code>pi_reset.log</code> on the boot drive. It lists the users the key was added for.</li>



<li>If the Pi does not answer at all after ten minutes, the script did not run and the Pi stops at the same point on every boot. Power off, put the card in the laptop, and copy <code>cmdline_old.txt</code> from your kit folder onto the boot drive as <code>cmdline.txt</code>. That returns the card to where it started.</li>
</ul>



<ol start="9" class="wp-block-list">
<li>Once in, give your own user a password and save it in a password manager, so access no longer depends on one laptop&#8217;s key: <code>passwd &lt;your-user&gt;</code>. If you would rather not leave root login open, first open a second window and check that <code>ssh &lt;your-user&gt;@192.168.x.51</code> and <code>sudo -v</code> both work. Then:</li>
</ol>



<div class="sf-box" data-mode="each" data-shell="sh" data-effect="change" data-where="On the Pi, as root"><pre><code>echo 'PermitRootLogin no' &gt; /etc/ssh/sshd_config.d/no-root.conf
systemctl restart ssh</code></pre></div>



<p class="wp-block-paragraph">Keep the first window open until a new login as your user works. With root login off, the later commands in this kit change: log in as <code>&lt;your-user&gt;@</code>, run the diagnosis with <code>sudo bash</code>, and copy backups with <code>sudo cp</code> into your home folder before <code>scp</code>.</p>



<p class="wp-block-paragraph"><code>pi_reset.sh</code>:</p>



<div class="sf-box" data-mode="file" data-where="File: pi_reset.sh (kit folder on your laptop)"><pre><code>#!/bin/bash
# pi_reset.sh - one-shot, headless access fix for the Pi.
# Run once by systemd at boot via cmdline.txt "systemd.run=...". It:
#   - appends the laptop's PUBLIC key (pi_key.pub on the boot partition) to
#     root's and every login user's authorized_keys (no password is read or set);
#   - enables ssh; writes pi_reset.log on the boot partition (user names, OS);
#   - removes its own cmdline entry and itself. systemd then reboots the Pi.
set +e
B=/boot/firmware
[ -f "$B/cmdline.txt" ] || B=/boot
LOG="$B/pi_reset.log"
addkey() {  # append the key on its own line, even if the file lacks a final newline
  [ -s "$1" ] &amp;&amp; [ -n "$(tail -c1 "$1")" ] &amp;&amp; echo &gt;&gt; "$1"
  cat "$B/pi_key.pub" &gt;&gt; "$1"
}
{
  echo "pi_reset start $(date -Is)"
  echo "boot dir: $B"
  if [ -s "$B/pi_key.pub" ]; then
    install -d -m 700 /root/.ssh
    addkey /root/.ssh/authorized_keys
    chmod 600 /root/.ssh/authorized_keys
    echo "key added for root"
    getent passwd | awk -F: '$3&gt;=1000 &amp;&amp; $3&lt;60000 {print $1 ":" $6}' |
    while IFS=: read -r u h; do
      [ -d "$h" ] || continue
      g=$(id -gn "$u")
      install -d -m 700 -o "$u" -g "$g" "$h/.ssh"
      addkey "$h/.ssh/authorized_keys"
      chown "$u:$g" "$h/.ssh/authorized_keys"
      chmod 600 "$h/.ssh/authorized_keys"
      echo "key added for user: $u"
    done
  else
    echo "ERROR: $B/pi_key.pub missing or empty - nothing changed"
  fi
  systemctl enable ssh
  echo "sshd PermitRootLogin lines (none = Debian default prohibit-password, key login allowed):"
  grep -hiE '^[[:space:]]*PermitRootLogin' /etc/ssh/sshd_config /etc/ssh/sshd_config.d/*.conf 2&gt;/dev/null
  # shellcheck disable=SC1091
  echo "os: $(. /etc/os-release; echo "$PRETTY_NAME")"
  echo "pi_reset end $(date -Is)"
} &gt;&gt; "$LOG" 2&gt;&amp;1
sed -i 's| systemd.run.*||g' "$B/cmdline.txt"
echo "cmdline.txt after cleanup: $(cat "$B/cmdline.txt")" &gt;&gt; "$LOG"
rm -f "$B/pi_reset.sh"
sync
exit 0</code></pre></div>



<p class="wp-block-paragraph"><code>pi_make_cmdline.py</code>:</p>



<div class="sf-box" data-mode="file" data-where="File: pi_make_cmdline.py (kit folder on your laptop)"><pre><code>#!/usr/bin/env python3
# pi_make_cmdline.py - build the reset cmdline.txt.
# usage: python3 pi_make_cmdline.py cmdline_old.txt bootfs|boot
# Reads the old card's cmdline.txt copy, appends the one-shot systemd.run entry,
# writes cmdline.txt next to it (LF ending). The original copy is not changed.
# If pi_reset.sh sits in the same folder, it is converted to Unix (LF) line endings.
import sys, os, hashlib
src, label = sys.argv[1], sys.argv[2]
base = {"bootfs": "/boot/firmware", "boot": "/boot"}[label]
raw = open(src, "rb").read()
line = raw.decode("ascii").replace("\r", "").strip()
if "\n" in line:
    sys.exit("STOP: cmdline has more than one line - check it by hand")
if "systemd.run" in line or "init=/bin/sh" in line:
    sys.exit("STOP: cmdline already carries a run/init entry - check it by hand")
new = line + f" systemd.run={base}/pi_reset.sh systemd.run_success_action=reboot systemd.unit=kernel-command-line.target\n"
out = os.path.join(os.path.dirname(os.path.abspath(src)), "cmdline.txt")
open(out, "wb").write(new.encode("ascii"))
print("old :", line)
print("new :", new.rstrip())
rs = os.path.join(os.path.dirname(os.path.abspath(src)), "pi_reset.sh")
if os.path.exists(rs):
    b = open(rs, "rb").read()
    if b"\r" in b:
        open(rs, "wb").write(b.replace(b"\r\n", b"\n"))
        print("pi_reset.sh: converted to LF line endings")
    else:
        print("pi_reset.sh: line endings already LF")
else:
    print("WARNING: pi_reset.sh not found next to", src)
print("sha256 old copy", hashlib.sha256(raw).hexdigest()[:16], "new", hashlib.sha256(new.encode()).hexdigest()[:16])</code></pre></div>



<h3 class="wp-block-heading">2. Diagnosis (changes no settings)</h3>



<p class="wp-block-paragraph">One run collects power, card, log, disk and Pi-hole facts into a report in <code>/root</code>, with hardware addresses removed. It also writes a Teleporter backup and a copy of <code>/etc/pihole</code> without the query database, both to the card itself; on my Pi that copy was about 130 MB, because it includes the blocklist databases. It takes about 70 seconds, most of it the 60-second load test. From the laptop:</p>



<div class="sf-box" data-mode="each" data-shell="ps" data-effect="change" data-where="PowerShell, in the kit folder"><pre><code>scp pi_diag.sh root@192.168.x.51:/root/
ssh root@192.168.x.51 "bash /root/pi_diag.sh"</code></pre></div>



<p class="wp-block-paragraph"><code>pi_diag.sh</code>:</p>



<div class="sf-box" data-mode="file" data-where="File: pi_diag.sh (kit folder on your laptop)"><pre><code>#!/bin/bash
# pi_diag.sh - diagnosis of a Pi-hole card. Changes no settings.
# Run as root:  bash /root/pi_diag.sh
# Writes /root/pi_diag_&lt;date&gt;.txt (hardware addresses scrubbed), a Pi-hole
# Teleporter backup and a copy of /etc/pihole (without the query database) in /root.
# Changes no settings. Includes a 60-second full-CPU load test to check the power supply.
set +e
TS=$(date +%Y%m%d_%H%M)
OUT=/root/pi_diag_$TS.txt
scrub() { sed -E 's/([0-9A-Fa-f]{2}[:-]){5}[0-9A-Fa-f]{2}/[hw-addr removed]/g'; }
sec() { echo; echo "===== $* ====="; }
logs() { dmesg 2&gt;/dev/null; journalctl -k --no-pager 2&gt;/dev/null; zcat -f /var/log/kern.log* /var/log/syslog* /var/log/messages* 2&gt;/dev/null; }
{
  sec "when"; date -Is; uptime
  sec "os"; cat /etc/os-release; uname -a
  sec "model"; tr -d '\0' &lt; /proc/device-tree/model; echo
  sec "power: throttled flags since this boot (0x0 = never)"; vcgencmd get_throttled; vcgencmd measure_volts core; vcgencmd measure_temp
  sec "power: undervoltage lines in kept logs"; logs | grep -iE 'under-?voltage|voltage normali[sz]ed' | sort | uniq -c | tail -40
  sec "card: identity"; for f in name manfid oemid date type; do printf '%s: ' "$f"; cat "/sys/block/mmcblk0/device/$f" 2&gt;/dev/null; done
  sec "card: errors in kept logs"; logs | grep -iE 'mmc0|mmcblk|I/O error|EXT4-fs (error|warning)|Buffer I/O|remount.*read-only' | sort | uniq -c | sort -rn | head -60
  sec "journal boots kept"; journalctl --list-boots --no-pager 2&gt;/dev/null | tail -20
  sec "reboots and shutdowns"; last -x reboot shutdown 2&gt;/dev/null | head -20
  sec "disk"; df -h; du -sh /var/log /etc/pihole /var/log/pihole 2&gt;/dev/null; ls -la /etc/pihole
  sec "pihole version and status"; pihole -v 2&gt;&amp;1; pihole status 2&gt;&amp;1
  sec "failed services"; systemctl --no-pager --failed
  for s in pihole-FTL lighttpd; do sec "service $s"; systemctl --no-pager -l status "$s" 2&gt;&amp;1 | head -30; done
  sec "lighttpd error logs"; tail -60 /var/log/lighttpd/error*.log 2&gt;/dev/null
  sec "php"; php -v 2&gt;&amp;1 | head -2; ls /etc/php 2&gt;/dev/null; grep -rh php /etc/lighttpd/conf-enabled/ 2&gt;/dev/null | head -20
  sec "apt history (dates, commands, php, lighttpd, pihole)"; zcat -f /var/log/apt/history.log* 2&gt;/dev/null | grep -E '^(Start-Date|Commandline)|php|lighttpd|pihole' | tail -150
  sec "FTL log tail"; tail -40 /var/log/pihole/FTL.log /var/log/pihole-FTL.log 2&gt;/dev/null
} 2&gt;&amp;1 | scrub &gt; "$OUT"
cd /root || exit 1
{
  sec "teleporter backup"
  if pihole -v 2&gt;/dev/null | grep -q 'version is v6'; then pihole-FTL --teleporter; else pihole -a -t; fi
  tar czf "/root/pihole_etc_$TS.tgz" --exclude='pihole-FTL.db*' --exclude='macvendor.db' /etc/pihole /etc/dnsmasq.d 2&gt;&amp;1
  sec "power: 60-second full-CPU load test"
  echo "before: $(vcgencmd get_throttled)"
  for i in 1 2 3 4; do timeout 60 sh -c 'while :; do :; done' &amp; done; wait
  echo "after:  $(vcgencmd get_throttled)  $(vcgencmd measure_volts core)  $(vcgencmd measure_temp)"
  sec "files in /root"; ls -la /root
} 2&gt;&amp;1 | scrub &gt;&gt; "$OUT"
echo "REPORT WRITTEN: $OUT"</code></pre></div>



<h3 class="wp-block-heading">3. Health check, monthly report and weekly backup</h3>



<p class="wp-block-paragraph">All commands run on the Pi over SSH.</p>



<p class="wp-block-paragraph"><strong>Tools.</strong> The scripts use <code>dig</code> and <code>curl</code>:</p>



<div class="sf-box" data-mode="each" data-shell="sh" data-effect="change" data-where="On the Pi, after ssh"><pre><code>sudo apt-get install -y dnsutils curl</code></pre></div>



<p class="wp-block-paragraph"><strong>Settings file.</strong> This reads the port your admin page uses (the first plain-HTTP entry, skipping the HTTPS ones), makes a random ntfy topic, and writes both, with the test domain, to <code>/etc/pi-health.conf</code>. The scripts read it from there, so they hold no secret.</p>



<div class="sf-box" data-mode="each" data-shell="sh" data-effect="change" data-where="On the Pi, after ssh — same window for all four"><pre><code>P=$(sudo pihole-FTL --config webserver.port | tr ',' '\n' | grep -v 's' | grep -oE '^[0-9]+' | head -1)
T="pihole-$(tr -dc a-z0-9 &lt; /dev/urandom | head -c 20)"
printf 'TOPIC=%s\nHC_DOMAIN=health.blocked.test\nWEB_URL=http://127.0.0.1:%s/admin/\n' "$T" "$P" | sudo tee /etc/pi-health.conf
sudo chmod 600 /etc/pi-health.conf</code></pre></div>



<p class="wp-block-paragraph"><code>tee</code> prints the three lines. Check that <code>WEB_URL</code> shows your port (80 on a fresh v6 install, 8080 on many upgraded ones). Subscribe to the topic in the ntfy app. Running these lines again makes a new topic and replaces the old one, so your phone would need to subscribe again. If you later move the admin page to another port, change <code>WEB_URL</code> to match.</p>



<p class="wp-block-paragraph">Optional: an outside &#8220;dead man&#8217;s switch&#8221; service gives you a ping address and alerts you when the pings stop, which covers a Pi that loses power or its internet. Add <code>PING_URL=&lt;that address&gt;</code> to the same file.</p>



<p class="wp-block-paragraph"><strong>Test domain.</strong> Block it and check the answer:</p>



<div class="sf-box" data-mode="each" data-shell="sh" data-effect="change" data-where="On the Pi, after ssh"><pre><code>sudo pihole deny health.blocked.test
dig +short @127.0.0.1 health.blocked.test</code></pre></div>



<p class="wp-block-paragraph">The second line must print <code>0.0.0.0</code>. If it prints nothing, the health check will report that blocking has stopped on every run; fix this first.</p>



<p class="wp-block-paragraph"><strong>Scripts.</strong> Save each one with <code>sudo nano /usr/local/bin/&lt;name&gt;</code> (paste, then Ctrl + O, Enter, Ctrl + X), then make them executable:</p>



<div class="sf-box" data-mode="each" data-shell="sh" data-effect="change" data-where="On the Pi, after ssh"><pre><code>sudo chmod 755 /usr/local/bin/pi_ntfy.sh /usr/local/bin/pi_health.sh /usr/local/bin/pi_report.sh /usr/local/bin/pi_backup.sh</code></pre></div>



<p class="wp-block-paragraph"><code>pi_ntfy.sh</code>, the alert helper the other scripts call:</p>



<div class="sf-box" data-mode="file" data-where="File: /usr/local/bin/pi_ntfy.sh"><pre><code>#!/bin/bash
# pi_ntfy.sh - send one phone notification through ntfy.sh.
# Usage: pi_ntfy.sh "Title" "message"     Exit 0 only if ntfy accepted it.
# ntfy.sh is looked up through 1.1.1.1, then 9.9.9.9 - not through Pi-hole - so alerts
# still go out when Pi-hole's DNS has failed. Falls back to a normal lookup if both fail.
set -u
# shellcheck disable=SC1091
. /etc/pi-health.conf          # TOPIC=...
ip="" r=()
for ns in 1.1.1.1 9.9.9.9; do
  ip=$(dig +short +time=3 +tries=1 @"$ns" ntfy.sh A 2&gt;/dev/null | grep -m1 -E '^[0-9]+(\.[0-9]+){3}$')
  [ -n "$ip" ] &amp;&amp; break
done
[ -n "$ip" ] &amp;&amp; r=(--resolve "ntfy.sh:443:$ip")
curl -fsS -m 15 "${r[@]}" -H "Title: $1" -d "$2" "https://ntfy.sh/$TOPIC" &gt;/dev/null</code></pre></div>



<p class="wp-block-paragraph"><code>pi_health.sh</code>:</p>



<div class="sf-box" data-mode="file" data-where="File: /usr/local/bin/pi_health.sh"><pre><code>#!/bin/bash
# pi_health.sh - Pi-hole health check, run every 15 minutes by pi-health.timer.
#  - pihole-FTL is restarted ONLY when DNS gives no reply at all. A web-page-only fault,
#    a test domain that is no longer blocked, or an odd answer is reported, never
#    "fixed" by a restart (a restart cuts the house's DNS).
#  - at most 2 restarts in 6 hours; after that it alerts only.
#  - a failed check is repeated once after 5 s before anything is done;
#  - after a restart, waits up to 60 s for DNS instead of a fixed 20 s;
#  - pauses while Pi-hole is updating itself or rebuilding its block lists, but alerts
#    and resumes checking if that has lasted over 30 minutes;
#  - alerts go through pi_ntfy.sh (ntfy.sh looked up via 1.1.1.1 / 9.9.9.9);
#  - the admin page address comes from WEB_URL in /etc/pi-health.conf;
#  - power alert only when the throttle flags change, not every day;
#  - optional PING_URL in /etc/pi-health.conf: pinged every run, so an outside
#    monitor can alert when the Pi goes silent (power, card or home-internet failure).
# State lives in /run (RAM); nothing is written to the card except the journal line.
set -u
# shellcheck disable=SC1091
. /etc/pi-health.conf          # TOPIC=..., HC_DOMAIN=..., WEB_URL=..., optional PING_URL=...
WEB_URL=${WEB_URL:-http://127.0.0.1:8080/admin/}
ST=/run/pi-health; mkdir -p "$ST"
now=$(date +%s)
notify() {  # key, seconds-between-repeats, message
  local f="$ST/$1" last
  last=$(cat "$f" 2&gt;/dev/null || echo 0)
  if (( now - last &gt;= $2 )); then
    /usr/local/bin/pi_ntfy.sh "Pi-hole" "$3" &amp;&amp; echo "$now" &gt; "$f"
  fi
}
q()          { dig +short +time=2 +tries=1 @127.0.0.1 "$1" A 2&gt;/dev/null; }
# Any reply at all (NOERROR, NXDOMAIN, REFUSED...) means FTL is answering; dig exits 9
# only when no reply came back. Answered locally, so it needs no internet.
dns_alive()  { dig +time=2 +tries=1 @127.0.0.1 pi.hole A &gt;/dev/null 2&gt;&amp;1; }
blocking_ok(){ [ "$(q "$HC_DOMAIN")" = "0.0.0.0" ]; }
web_ok()     { case "$(curl -s -o /dev/null -m 5 -w '%{http_code}' "$WEB_URL")" in 200|301|302|303|307|308|401) return 0;; esac; return 1; }
net_ok()     { q google.com | grep -qE '^[0-9]+(\.[0-9]+){3}$'; }
retry()      { "$@" || { sleep 5; "$@"; }; }

# Pi-hole updating itself or rebuilding block lists: FTL may be stopped on purpose.
# Matches only bash running Pi-hole's own gravity.sh / update.sh / basic-install.sh.
if pgrep -f '^(/usr)?(/bin/)?bash .*(/opt/pihole/(gravity|update)|basic-install)\.sh' &gt;/dev/null; then
  [ -f "$ST/skip_since" ] || echo "$now" &gt; "$ST/skip_since"
  if (( now - $(cat "$ST/skip_since") &lt; 1800 )); then exit 0; fi
  notify skiplong 21600 "A Pi-hole update or block-list rebuild has been running over 30 minutes. Checking anyway."
else
  rm -f "$ST/skip_since"
fi

if ! retry dns_alive; then
  # restarts in the last 6 hours (timestamps kept in RAM)
  touch "$ST/restarts"
  recent=$(awk -v c=$((now - 21600)) '$1 &gt;= c' "$ST/restarts" | wc -l)
  if (( recent &gt;= 2 )); then
    notify down 3600 "Pi-hole DNS NOT answering; already restarted twice in 6 hours, not restarting again. House internet may be down. Fix now: router settings &gt; DHCP &gt; Primary DNS 1.1.1.1 &gt; Save."
  else
    echo "$now" &gt;&gt; "$ST/restarts"
    systemctl restart pihole-FTL
    ok=""
    for _ in $(seq 12); do sleep 5; dns_alive &amp;&amp; { ok=1; break; }; done
    if [ -n "$ok" ]; then
      notify recovered 3600 "Pi-hole DNS had stopped answering and recovered after a restart."
    else
      notify down 3600 "Pi-hole DNS NOT working after restart. House internet may be down. Fix now: router settings &gt; DHCP &gt; Primary DNS 1.1.1.1 &gt; Save."
    fi
  fi
else
  retry blocking_ok || notify noblock 86400 "Pi-hole answers, but the blocked test domain ($HC_DOMAIN) is not blocked. Ad-blocking may not be working. No restart made."
  retry web_ok      || notify webdown 21600 "Pi-hole web page ($WEB_URL) not answering; DNS and ad-blocking still work. No restart made (it would cut the house's DNS). Fix: ssh in and run: systemctl restart pihole-FTL"
  retry net_ok      || notify net 21600 "Pi-hole is up but cannot reach the internet (ISP or router problem)."
fi

use=$(df --output=pcent / | tail -1 | tr -dc 0-9)
(( ${use:-0} &gt;= 80 )) &amp;&amp; notify disk 86400 "Card is ${use}% full."
thr=$(vcgencmd get_throttled 2&gt;/dev/null | cut -d= -f2)
if [ -n "$thr" ] &amp;&amp; (( (thr &amp; 0x50000) != 0 )) &amp;&amp; [ "$thr" != "$(cat "$ST/thr_seen" 2&gt;/dev/null)" ]; then
  notify power 0 "Under-voltage or throttling has occurred since boot ($thr). Check the power supply." &amp;&amp; echo "$thr" &gt; "$ST/thr_seen"
fi
[ -n "${PING_URL:-}" ] &amp;&amp; curl -fsS -m 10 -o /dev/null "$PING_URL"
exit 0</code></pre></div>



<p class="wp-block-paragraph"><code>pi_report.sh</code>:</p>



<div class="sf-box" data-mode="file" data-where="File: /usr/local/bin/pi_report.sh"><pre><code>#!/bin/bash
# pi_report.sh - monthly status to the phone (pi-report.timer).
# Sends through pi_ntfy.sh (works even if Pi-hole DNS is down);
# reports whether the running kernel is older than the installed one (reboot needed),
# whether automatic security updates are switched on, the Pi's own DNS servers and the
# last weekly backup; strips colour codes from Pi-hole's update check.
# shellcheck disable=SC1091
. /etc/pi-health.conf
apt-get -qq update &gt;/dev/null 2&gt;&amp;1
upg=$(apt list --upgradable 2&gt;/dev/null | grep -c upgradable)
ph=$(pihole -up --check-only 2&gt;&amp;1 | sed 's/\x1b\[[0-9;]*[A-Za-z]//g' | grep -iE 'update available|up to date|everything is up' | head -3 | tr -s ' \n' ' ')
k=$(uname -r); newest=$(ls -1dt /lib/modules/*"${k##*+rpt-}" 2&gt;/dev/null | head -1)
if [ -n "$newest" ] &amp;&amp; [ "$(basename "$newest")" != "$k" ]; then
  rb="YES (running $k, installed $(basename "$newest")) - run: systemctl reboot (back in about 2 min)"
else rb="no"; fi
au="$(apt-config dump 2&gt;/dev/null | grep -E '^APT::Periodic::Unattended-Upgrade ' | grep -q '"1"' &amp;&amp; echo on || echo OFF)"
bk=$(ls -1t /var/backups/pihole/*.zip 2&gt;/dev/null | head -1)
if [ -n "$bk" ]; then bk="$(basename "$bk") ($(date -r "$bk" +%d/%m/%Y))"; else bk="NONE"; fi
msg="Monthly report $(date +%d/%m/%Y)
Pi-hole: $(pihole -v 2&gt;&amp;1 | tr '\n' ' ')
Pi-hole updates: ${ph:-unknown}
OS packages waiting: $upg. Debian security fixes install themselves (automatic: $au);
Raspberry Pi kernel/firmware and other updates need, by hand: apt update &amp;&amp; apt full-upgrade
Reboot needed: $rb
Tailscale: $(tailscale status --json 2&gt;/dev/null | grep -q '"BackendState": *"Running"' &amp;&amp; echo connected || echo 'NOT connected')
Pi's own DNS: $(grep -E '^nameserver' /etc/resolv.conf | awk '{print $2}' | tr '\n' ' ')
Last backup: $bk
Card used: $(df -h --output=pcent / | tail -1 | tr -d ' ')
Query DB: $(du -h /etc/pihole/pihole-FTL.db 2&gt;/dev/null | cut -f1)
Power flags since boot: $(vcgencmd get_throttled 2&gt;/dev/null)
Up: $(uptime -p)"
/usr/local/bin/pi_ntfy.sh "Pi-hole monthly" "$msg"</code></pre></div>



<p class="wp-block-paragraph"><code>pi_backup.sh</code>:</p>



<div class="sf-box" data-mode="file" data-where="File: /usr/local/bin/pi_backup.sh"><pre><code>#!/bin/bash
# pi_backup.sh - weekly Pi-hole Teleporter export, keeps the last 4 (pi-backup.timer).
# Files: /var/backups/pihole/*.zip, readable by root only (they hold the web password hash).
set -e
umask 077
D=/var/backups/pihole
mkdir -p "$D"; chmod 700 "$D"; cd "$D"
# WARNING: with NO argument, --teleporter EXPORTS a zip into the current directory
# (hence the cd above). With a file argument it IMPORTS that zip and overwrites the
# Pi-hole settings. Never add an argument here.
pihole-FTL --teleporter &gt;/dev/null
ls -1t ./*.zip 2&gt;/dev/null | tail -n +5 | xargs -r rm -f --</code></pre></div>



<p class="wp-block-paragraph">To copy the backups off now and then, from the laptop: <code>scp "root@192.168.x.51:/var/backups/pihole/*.zip" .</code></p>



<p class="wp-block-paragraph"><strong>Units.</strong> Save these six files in <code>/etc/systemd/system/</code> the same way. The times in the two timers are examples; set your own.</p>



<p class="wp-block-paragraph"><code>pi-health.service</code>:</p>



<div class="sf-box" data-mode="file" data-where="File: /etc/systemd/system/pi-health.service"><pre><code>[Unit]
Description=Pi-hole health check
[Service]
Type=oneshot
TimeoutStartSec=5min
ExecStart=/usr/local/bin/pi_health.sh</code></pre></div>



<p class="wp-block-paragraph"><code>pi-health.timer</code>:</p>



<div class="sf-box" data-mode="file" data-where="File: /etc/systemd/system/pi-health.timer"><pre><code>[Unit]
Description=Pi-hole health check every 15 minutes
[Timer]
OnBootSec=5min
OnUnitActiveSec=15min
AccuracySec=30s
[Install]
WantedBy=timers.target</code></pre></div>



<p class="wp-block-paragraph"><code>pi-report.service</code>:</p>



<div class="sf-box" data-mode="file" data-where="File: /etc/systemd/system/pi-report.service"><pre><code>[Unit]
Description=Pi-hole monthly report
Wants=network-online.target
After=network-online.target
[Service]
Type=oneshot
TimeoutStartSec=15min
ExecStart=/usr/local/bin/pi_report.sh</code></pre></div>



<p class="wp-block-paragraph"><code>pi-report.timer</code>:</p>



<div class="sf-box" data-mode="file" data-where="File: /etc/systemd/system/pi-report.timer"><pre><code>[Unit]
Description=Pi-hole monthly report, 1st of the month 10:00
[Timer]
OnCalendar=*-*-01 10:00
Persistent=true
[Install]
WantedBy=timers.target</code></pre></div>



<p class="wp-block-paragraph"><code>pi-backup.service</code>:</p>



<div class="sf-box" data-mode="file" data-where="File: /etc/systemd/system/pi-backup.service"><pre><code>[Unit]
Description=Pi-hole weekly Teleporter backup
[Service]
Type=oneshot
TimeoutStartSec=5min
ExecStart=/usr/local/bin/pi_backup.sh</code></pre></div>



<p class="wp-block-paragraph"><code>pi-backup.timer</code>:</p>



<div class="sf-box" data-mode="file" data-where="File: /etc/systemd/system/pi-backup.timer"><pre><code>[Unit]
Description=Pi-hole weekly backup, Sunday 11:00
[Timer]
OnCalendar=Sun 11:00
Persistent=true
[Install]
WantedBy=timers.target</code></pre></div>



<p class="wp-block-paragraph"><strong>Start and test.</strong></p>



<div class="sf-box" data-mode="each" data-shell="sh" data-effect="change" data-where="On the Pi, after ssh"><pre><code>sudo systemctl daemon-reload
sudo systemctl enable --now pi-health.timer pi-report.timer pi-backup.timer
systemctl list-timers 'pi-*' --no-pager
sudo /usr/local/bin/pi_backup.sh &amp;&amp; sudo ls -la /var/backups/pihole
sudo /usr/local/bin/pi_report.sh
sudo systemctl start pi-health.service
systemctl status pi-health.service --no-pager</code></pre></div>



<p class="wp-block-paragraph">Expect three timers with their next run times, one backup zip, the monthly report on your phone within a minute, and <code>status=0/SUCCESS</code> for the health check. That status only says the check ran; it exits cleanly whatever it found. A healthy Pi sends no health alert, so the report is your proof that notifications reach the phone. The report runs <code>apt-get update</code> and Pi-hole&#8217;s update check; it installs nothing.</p>



<h3 class="wp-block-heading">4. Optional: a fallback for the Pi&#8217;s own lookups</h3>



<p class="wp-block-paragraph">This gives the Pi itself a second DNS server, <code>1.1.1.1</code>, after Pi-hole. The router still hands out only the Pi, so the house is unchanged. It applies to Raspberry Pi OS Bookworm, where NetworkManager writes <code>/etc/resolv.conf</code>; check that first:</p>



<div class="sf-box" data-mode="each" data-shell="sh" data-effect="read" data-where="On the Pi, after ssh"><pre><code>grep 'Generated by NetworkManager' /etc/resolv.conf</code></pre></div>



<p class="wp-block-paragraph">If that prints nothing, skip this section. Otherwise, save this as <code>pi_nm_dns.conf</code> in your home folder:</p>



<div class="sf-box" data-mode="file" data-where="File: pi_nm_dns.conf (your home folder on the Pi)"><pre><code># /etc/NetworkManager/conf.d/90-pi-dns.conf
# The Pi's OWN lookups (apt, Tailscale, alerts) use Pi-hole first, then 1.1.1.1 if
# Pi-hole is not answering. Affects only the Pi itself, not the house (the router still
# hands out the Pi as the only DNS server). Undo: move this file away and run
#   nmcli general reload
[global-dns-domain-*]
servers=127.0.0.1,1.1.1.1</code></pre></div>



<p class="wp-block-paragraph">A DNS change over SSH can cut you off, so arm an automatic undo first, then apply it:</p>



<div class="sf-box" data-mode="each" data-shell="sh" data-effect="change" data-where="On the Pi, after ssh"><pre><code>sudo systemd-run --unit=pi-dns-undo --on-active=10min /bin/sh -c 'mv /etc/NetworkManager/conf.d/90-pi-dns.conf /root/ &amp;&amp; nmcli general reload'
sudo install -m 644 ~/pi_nm_dns.conf /etc/NetworkManager/conf.d/90-pi-dns.conf
sudo nmcli general reload
grep nameserver /etc/resolv.conf</code></pre></div>



<p class="wp-block-paragraph">The last line should show <code>127.0.0.1</code> and then <code>1.1.1.1</code>. If your SSH session still works and that is what you see, keep it by cancelling the undo:</p>



<div class="sf-box" data-mode="each" data-shell="sh" data-effect="change" data-where="On the Pi, after ssh"><pre><code>sudo systemctl stop pi-dns-undo.timer</code></pre></div>



<p class="wp-block-paragraph">If anything looks wrong, do nothing: ten minutes later the file is moved to <code>/root</code> and the old settings return.</p>
<p>The post <a href="https://techblog.viveksanghi.com/2026/10/pihole-admin-page-not-loading-port-8080/">The Pi-hole that wasn&#8217;t dead: getting back in without a password</a> appeared first on <a href="https://techblog.viveksanghi.com">Stubborn Fanatic - Tech Blog</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://techblog.viveksanghi.com/2026/10/pihole-admin-page-not-loading-port-8080/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">269</post-id>	</item>
		<item>
		<title>The law I cannot read · กฎหมายที่ผมอ่านไม่ออก</title>
		<link>https://techblog.viveksanghi.com/2026/10/thai-law-corpus/</link>
					<comments>https://techblog.viveksanghi.com/2026/10/thai-law-corpus/#respond</comments>
		
		<dc:creator><![CDATA[Vivek Sanghi]]></dc:creator>
		<pubDate>Thu, 01 Oct 2026 08:06:42 +0000</pubDate>
				<category><![CDATA[legal tech]]></category>
		<category><![CDATA[software]]></category>
		<category><![CDATA[ai assisted]]></category>
		<category><![CDATA[data quality]]></category>
		<category><![CDATA[legal research]]></category>
		<category><![CDATA[machine translation]]></category>
		<category><![CDATA[ocr]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[search]]></category>
		<category><![CDATA[stubborn fanatic]]></category>
		<category><![CDATA[thai law]]></category>
		<category><![CDATA[unicode]]></category>
		<guid isPermaLink="false">https://techblog.viveksanghi.com/?p=265</guid>

					<description><![CDATA[<p>I am studying Thai law and cannot read Thai. Building a searchable library of Thai law on my own machine with an AI agent: every English word labelled by how far it can be trusted, PDFs that show one thing and say another, and 27,000 sections machine-translated on a local GPU.</p>
<p>The post <a href="https://techblog.viveksanghi.com/2026/10/thai-law-corpus/">The law I cannot read · กฎหมายที่ผมอ่านไม่ออก</a> appeared first on <a href="https://techblog.viveksanghi.com">Stubborn Fanatic - Tech Blog</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<!--
  The law I cannot read / กฎหมายที่ผมอ่านไม่ออก  (techblog.viveksanghi.com)
  Paste this whole block into a WordPress "Custom HTML" block (or the Classic
  editor's Text/HTML mode). Both languages sit in the page's HTML at all times,
  so crawlers index both; the tabs only change what is shown. The switch is
  CSS-only (no JavaScript), same pattern as the Pushp Ki Abhilasha post, with
  its own "tlc-" prefix so the two posts' styles never collide.
  Default open tab: English (the "checked" attribute on #tlc-en). Move
  "checked" to #tlc-th to open in Thai instead.
-->
<style>
  @import url('https://fonts.googleapis.com/css2?family=Noto+Sans+Thai:wght@400;600&family=Sarabun:wght@400;600&display=swap');
  .tlc-wrap { max-width: 700px; margin: 2em auto; line-height: 1.75; }
  .tlc-wrap p { margin: 0 0 1.1em; }
  .tlc-wrap h3 { margin: 1.8em 0 .6em; font-size: 1.15em; font-weight: 600; }
  .tlc-wrap ul, .tlc-wrap ol { margin: 0 0 1.1em 1.2em; padding: 0; }
  .tlc-wrap li { margin: 0 0 .4em; }
  .tlc-wrap [lang="th"] { font-family: "Noto Sans Thai", "Sarabun", sans-serif; }
  .tlc-wrap pre {
    margin: 0 0 1.4em; padding: .9em 1.1em; overflow-x: auto;
    border-left: 3px solid currentColor; background: rgba(127,127,127,.12);
    font-size: .85em; line-height: 1.5; white-space: pre;
  }
  .tlc-wrap a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
  .tlc-wrap code { font-family: Consolas, "SFMono-Regular", Menlo, "DejaVu Sans Mono", monospace; font-size: .92em; }
  .tlc-wrap pre code { font-size: 1em; }

  .tlc-visually-hidden {
    position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
    overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
  }

  .tlc-tabs { display: flex; gap: 1.5em; margin: 0 0 1.4em; border-bottom: 1px solid currentColor; opacity: .9; }
  .tlc-tabs label {
    cursor: pointer; padding: .4em 0; font-weight: 600;
    border-bottom: 2px solid transparent; margin-bottom: -1px;
  }
  input[name="tlc-lang"] { position: absolute; opacity: 0; pointer-events: none; }
  .tlc-panel { display: none; }

  #tlc-en:checked ~ .tlc-tabs label[for="tlc-en"],
  #tlc-th:checked ~ .tlc-tabs label[for="tlc-th"] {
    border-bottom-color: currentColor;
  }
  #tlc-en:checked ~ .tlc-content #tlc-panel-en,
  #tlc-th:checked ~ .tlc-content #tlc-panel-th {
    display: block;
  }
</style>

<div class="tlc-wrap">
  <input type="radio" name="tlc-lang" id="tlc-en" checked>
  <input type="radio" name="tlc-lang" id="tlc-th">

  <div class="tlc-tabs">
    <label for="tlc-en">English</label>
    <label for="tlc-th" lang="th">ไทย</label>
  </div>

  <div class="tlc-content">

    <div id="tlc-panel-en" class="tlc-panel" lang="en">
      <h2 class="tlc-visually-hidden">The law I cannot read</h2>
      <p>I am studying Thai law, and I cannot read Thai.</p>
      <p>That is an awkward position for a lawyer. Thailand&#8217;s statutes are published in Thai, and the Thai text is the law. Anything in English is somebody&#8217;s reading of it. For the Codes that govern property, family and succession, the Thai government&#8217;s own legal drafting office holds no English text at all. I checked, and how I checked is part of this post.</p>
      <p>So I built a second law library on my own computer. The first one, of Indian statutes and judgments, is <a href="https://techblog.viveksanghi.com/2026/09/building-a-local-indian-law-corpus/">a separate project</a>. This one holds Thai law in Thai, with every line of English labelled by how far it can be trusted, and it answers a search in a fraction of a second.</p>
      <p>I built it with Claude, Anthropic&#8217;s AI model, working as an agent: it could run programs on my computer and use my Chrome browser, under rules I set. I made the decisions. The scripts and most of the investigation came from the model, and so did a good number of the mistakes. The work started on 4 September 2026; most of it ran in the last week of September.</p>
      <p>One thing to say before anything else: I am an Indian advocate, not a Thai lawyer. This is a post about building a research tool, not advice on Thai law. There is a fuller note at the end.</p>
      <h3>Every English word gets a label</h3>
      <p>The first decision was a rule about English.</p>
      <p>Thailand is a civil law country. Thai courts are not formally bound by earlier decisions, the Supreme Court&#8217;s included, though those decisions carry weight. The statute book matters more than case law, and the statute book is Thai. If I am going to rely on any of this, every English sentence has to say where it came from.</p>
      <p>So there are four tiers:</p>
      <pre><code>T1  Thai official text, or English the agency published as part of the instrument
T2  English published by a Thai agency, marked unofficial
T3  third-party English: commercial translations, law firm sites
T4  machine output, ours: for finding and reading only, never quoted, never cited</code></pre>
      <p>Every text file carries a <code>tier:</code> line in its header, and the search tool prints the tier beside every result. Machine English comes out as <code>T4 machine translation - NEVER quote or cite</code>, in capitals, every time. That label is what stops a fluent sentence from turning into a citation.</p>
      <h3>Finding the statute book</h3>
      <p>The Office of the Council of State publishes the official consolidated text of Thai laws. Its old address, krisdika.go.th, no longer served it; the office had moved to ocs.go.th.</p>
      <p>The new site&#8217;s search page is backed by a form-encoded endpoint, <code>POST /searchlaw/indexs/list_table_search</code>. Two things stood between it and a clean list.</p>
      <p>The first was TLS. The server does not send its intermediate certificate. A browser fetches the missing certificate itself; Python&#8217;s <code>requests</code> does not, and fails. Setting <code>verify=False</code> would have silenced the error by switching the check off. The fix used instead was <code>truststore</code>, which hands verification to Windows&#8217; own certificate chain building, and Windows can find the missing intermediate. The check still happens.</p>
      <p>The second was a filter. The site&#8217;s own search page sends the parameter <code>query[lawCategoryName]</code> with the value <code>1B,1C</code>. Sent that way, the index hid 7 of 147 records. Sent empty, all 147 came back. I would not have known without counting both ways.</p>
      <p>That gave titles and PDFs, not text. The text sits behind a viewer, an Angular single-page app, and five guessed endpoints returned 404. What worked was opening the viewer in a browser and reading how the page itself asks the server for a law, from its network traffic and its JavaScript bundle. The viewer uses a public JSON endpoint:</p>
      <pre><code>POST https://searchlaw.ocs.go.th/ocs-api/public/doc/getLawDoc
Content-Type: application/json

{ "reqHeader": { ...request id, channel, timestamp, service name... },
  "reqBody":   { "timelineId": "&lt;id from the index&gt;", "isTransEng": false,
                 "sectionIds": [], "sectionAndExplains": [] } }</code></pre>
      <p>What comes back is structured: each section with its number, label and HTML content, plus every version of that law. For the Civil and Commercial Code that was 2,254 entries and 605,706 characters, in force from 25 March 2025. File downloads on the same site go through a route that needs a token the viewer holds. The token was never read or reused: the English PDFs mentioned below were saved through the viewer&#8217;s own download button, as any reader would save them.</p>
      <h3>The English that was not there</h3>
      <p>The same request has a flag, <code>isTransEng</code>. Set to true, it asks for English.</p>
      <p>For all eight Thai Codes, the answer was <code>SUCCESS</code> with zero sections. The system knows the English names of the Codes. It holds none of their English text.</p>
      <p>There was one exception. The Civil and Commercial Code&#8217;s timeline has 73 versions, and one of them, the original 1925 text, is marked as having a translation: a 242 KB file. For a week the working assumption was that this was an English translation of the 1925 Code. When the file came down and was read, its title page said otherwise. It is the Act Amending the Civil and Commercial Code (No. 20), B.E. 2557 (2014): one amending Act, filed against the original version.</p>
      <p>The note was corrected with the date of the correction, and the earlier reading left on record. A timeline entry tells you a file exists. Only the file tells you what it is.</p>
      <p>The Council of State does hold English for other laws, and 70 such PDFs, covering 57 laws, are now in the library. They are T2, and they say on their face that the Thai is the sole authority. Many turned out to be amending Acts rather than the main Act, which is one more reason the library reads the Thai consolidation first.</p>
      <h3>A section 2 that appeared 36 times</h3>
      <p>With the endpoint working, the eight Codes came down as structured text: 5,526 entries, of which 4,453 are numbered provisions. Then the counting started, and the counting is where the bugs were.</p>
      <p>Section 2 appeared 36 times in the Civil and Commercial Code file. Each Code&#8217;s file carries the Acts that amended it, appended at the end, and each of those Acts numbers its own sections from 1. Left as it was, a search for section 2 would find 36 candidates and one of them would be right. Every entry now carries a flag saying whether it belongs to the Code itself. That is how the 2,254 entries in the Civil and Commercial Code file come down to its 1,850 provisions; the rest are headings and the appended Acts.</p>
      <p>Some of the others:</p>
      <ul>
        <li>The Land Code has eight entries in a row all labelled section 105. They are 105, 105 bis, ter and on to octies. The label field cuts the number short, so the real reference is parsed from the text.</li>
        <li>The same ordinal is spelled two ways: <code>อัฎฐ</code> with ฎ in the Civil Procedure Code, <code>อัฏฐ</code> with ฏ in the Land Code.</li>
        <li>The site served escaped HTML comments, <code>&amp;lt;!--[endif]--&amp;gt;</code>, which only became comments after unescaping, so the comment-stripper never saw them. The selftest had passed because its fixture used a real comment: it was written from the fix, not from the data.</li>
      </ul>
      <p>Once all of these were fixed, no reference in any of the eight Codes appeared twice.</p>
      <h3>When a repealed law is still current</h3>
      <p>Each version in a law&#8217;s timeline carries a <code>stateId</code>. <code>01</code> looked like &#8220;in force&#8221; and <code>00</code> like &#8220;superseded&#8221;.</p>
      <p>Of the 652 index rows whose titles carry the repeal marker <code>(ยกเลิก)</code>, 638 sit at <code>01</code>. The last version of a repealed law is still that law&#8217;s current version. So repeal is read from the title marker, never from the state.</p>
      <p>A probe on 24 September found a third state, <code>02</code>: published but not yet in force, with a fifth version type, a future consolidation showing the law as it will read once a pending amendment starts. On 30 September that turned up a trap. A value-added tax decree showed a future consolidation in force from 1 October 2026, and it left out a separate amending decree of the same date that keeps the reduced rate for another year. Read alone, the future text would have given the wrong rate. The library now holds the amending decree separately and flags any future version that matches the current one.</p>
      <p>That same day the whole library was checked against the Council of State: 837 timeline entries under the parent laws held, and all 773 laws unchanged since they were fetched. The consolidations themselves can trail behind amendments. The Revenue Code&#8217;s latest consolidation on the site is dated 9 November 2021. The site cannot show an amendment it has not yet worked in, so the issuing department is the cross-check.</p>
      <h3>Working with an agent that can be wrong</h3>
      <p>An agent that can run programs on my computer and drive my browser can do a great deal in an afternoon. It can also be wrong about a file it has not looked at, and it writes fluent explanations of things that did not happen. The rules I work under came out of incidents.</p>
      <p>The separation rule came first. The Thai library sits beside the Indian one on the same disk, and early on a Thai backup was written into the Indian backup folder. Nothing was lost, but since then a guard refuses any path under the Indian backups, and a checker audits every script for where it can reach. Building that checker produced two of the stranger moments of the month:</p>
      <ul>
        <li><code>io.open(path, "w", newline=...)</code> empties the file before it raises on a bad <code>newline</code> argument. The checker truncated itself to zero bytes that way. Everything now writes to a temporary file and <code>os.replace</code>s it.</li>
        <li>A Windows path such as <code>D:\...\Thai_Backup</code> is, to a Linux program, an ordinary file name. Run from the agent&#8217;s side, a backup created a folder whose name was the whole Windows path, inside the library. It looked like a successful backup.</li>
      </ul>
      <p>The second rule is that every claim has to be shown. If the agent says a backup exists, it shows the listing. If it asks me to run a file, it first opens that file and quotes the line that does the work. That rule came after a session with five errors of this kind, one of which was a recommendation to run a batch file that would have thrown away three days of work.</p>
      <p>The third is a backup before anything that rewrites a file. Once, a batch file suggested in passing rewrote a file another script had written its OCR results into, and hours of machine time went with it. Now a copy comes first, and both checksums are shown. On 1 October that rule ran on something small: one translation cache file carried 1,443 NUL bytes left over from an interrupted run on 29 September. Nothing was lost, since the work had been redone, but the copy was taken, the bad line removed and all 776 cache files scanned before the index was rebuilt.</p>
      <p>The agent works within limits I set. It uses the sites&#8217; public pages and endpoints only, respects robots.txt, does not solve CAPTCHAs, enter passwords or handle login tokens, and anything I have to do myself comes as numbered steps from the first click. When it saves a file from a page, the page builds the file and a click on a link saves it to my Downloads folder.</p>
      <h3>PDFs that show one thing and say another</h3>
      <p>Not everything comes through the endpoint. Ministerial regulations, schedules and forms come as PDFs, and a PDF can look perfect on screen while its text layer says something else. The page is drawn from the glyph outlines in the embedded font; text extraction goes through a separate mapping from character codes to Unicode (the ToUnicode map, or the font&#8217;s encoding and glyph names when there is no map). If that mapping is wrong, the screen is right and the text is junk.</p>
      <p>Three faults turned up.</p>
      <p>Broken glyph maps. The outlines were intact; only the map was broken. So every glyph outline was hashed, hash-to-character was learned from pages whose maps are sound, and the junk glyphs were looked up by shape. On the first 29 junk pages that gave 27,277 glyphs and 88 distinct shapes, all decoded. One bug worth remembering: the font cache was keyed by PDF object id, and object ids repeat across files.</p>
      <p>Mac Thai. Seven files decoded at 0% through the glyph table. All used one font pair, and the glyph names inside were Mac Roman names standing at the positions of Apple&#8217;s old Mac OS Thai encoding. The text was Thai written in Mac Thai and read back as Mac Roman. The repair is a table:</p>
      <pre><code># simplified; Python has no mac_thai codec
MAC_EXTRA = {0x83: "\u0E48", 0x88: "\u0E48", 0x89: "\u0E49", 0x8C: "\u0E4C",
             0x92: "\u0E31", 0x93: "\u0E47", 0x94: "\u0E34", 0x95: "\u0E35",
             0x97: "\u0E37", 0x8D: "\u201C", 0x8E: "\u201D"}

def macthai_decode(s):
    out = []
    for ch in s:
        try:
            b = ch.encode("mac_roman")[0]
        except UnicodeEncodeError:
            out.append("\uFFFD"); continue
        if b &lt; 0x80:
            out.append(ch)
        elif 0xA1 &lt;= b &lt;= 0xFB:            # Thai letters as in TIS-620; Apple's dashes and
                                           # symbols in this range differ and come out unknown
            out.append(bytes([b]).decode("cp874", errors="replace"))
        elif b in MAC_EXTRA:               # Apple's extra bytes, read from the pages
            out.append(MAC_EXTRA[b])
        else:
            out.append("\uFFFD")           # counted as unknown, never guessed
    return "".join(out)</code></pre>
      <p>The first trial dropped every ส. Mac Roman 0xCA is a no-break space; in Mac Thai, 0xCA is ส, and the first trial read it as a space. A wrong decode can also come out looking like Thai, so a decoded page is accepted only if Thai spelling holds: a vowel or tone mark must follow a consonant, the leading vowels must precede one, and the violation rate must be under 1%.</p>
      <p>Sara aa written as sara am. Ten PDFs, 30 pages, wrote every า as ำ, and every real ำ with a space in front of it: <code>กำร</code> for <code>การ</code>, <code>ก ำหนด</code> for <code>กำหนด</code>. The page test called them Thai, because they are Thai letters. The repair is exact:</p>
      <pre><code># simplified
import re
MARK = "\uE000"
def fix_sara_aa(t):
    t = re.sub(r" ([\u0E48-\u0E4B]?)\u0E33", lambda m: m.group(1) + MARK, t)  # " ำ" is the real ำ
    return t.replace("\u0E33", "\u0E32").replace(MARK, "\u0E33")             # every other ำ is า</code></pre>
      <p>Detection is by impossible spellings, <code>กำร</code>, <code>ตำม</code>, <code>จำก</code> and a few more, appearing at least twice with none of the correct forms on the page. On the PDF folder it selected exactly those 30 pages. One of the ten files was the Land Code regulation on registration fees for transfers and mortgages.</p>
      <p>Then a check against the official source became possible. Seventy-three regulations under the main Acts came back as official text through the endpoint, with the same identifiers as PDFs already read. The measure is the share of each PDF page&#8217;s Thai letters found, in order, in the official text:</p>
      <pre><code>method     pages   median
macthai      24    0.984
glyph        31    0.978
pua          38    0.978
layer       108    0.942
ocr         160    0.717</code></pre>
      <p><code>layer</code> is a text layer taken as it is, <code>pua</code> a layer using the Unicode private-use area. Every page below 0.8 that was not one of the sara aa pages was a form or an annex: the official text holds the operative regulation only, and the PDF is the only source for forms and schedules. The 0.717 median for Tesseract on scanned Thai is why OCR text sits at T4. Thai numerals are the worst of it.</p>
      <h3>Machine English I will not quote</h3>
      <p>Accurate Thai I cannot read is of limited use to me. So every section has a machine English rendering, made locally by Google&#8217;s open Gemma model (<code>gemma3:27b</code>) through Ollama on a desktop graphics card. The 26,978 sections were split into 27,198 pieces for translation, and the run log records about 36 hours of model time between the evening of 28 September and the afternoon of 30 September.</p>
      <p>All of it is T4. The checks were there to make it good enough to search with and to read beside the Thai.</p>
      <ol>
        <li>Refusal at translation time: an answer is refused if it is empty, mostly Thai, far too short or far too long for the Thai it came from.</li>
        <li>Mechanical checks on every piece after every run: numbers in the Thai missing from the English; a section number that differs; a suffix section (<code>มาตรา ๓ ตรี</code>) not rendered as &#8220;3 ter&#8221;; fewer numbered items than the Thai; runaway repetition; chatter such as &#8220;Here is the translation&#8221;. A failure goes back with the reason written into the retry prompt, at most twice; after that it is listed for reading.</li>
        <li>A sample sheet of 30 random pieces, Thai beside English, at the end of every report.</li>
        <li>A termbase adherence table: for each fixed legal term, how often the English used the agreed rendering, and the Thai contexts the term turned up in.</li>
      </ol>
      <p>The fourth caught the best mistake of the month. The termbase said <code>อาศัย</code> means &#8220;habitation&#8221;, as in a right of habitation. Only 24% of pieces followed it, and the commonest context was <code>อาศัยอำนาจ</code>, &#8220;by virtue of the power&#8221;. The word inside other words was being translated as habitation. Land Code section 96 bis came out as aliens obtaining land &#8220;through habitation based on a treaty&#8221;; the Thai says by virtue of a treaty. The entry was narrowed to <code>สิทธิอาศัย</code>, right of habitation, and the bad renderings fell from 202 to 6, each of the 6 a proper use.</p>
      <p>Flagged pieces fell from 83 on the first pass to 7 on the last. Claude read those 7 against the Thai: six are real omissions of a number or a cross-reference and are listed as known defects, and one is a typo in the source. That is a machine checking a machine, which is the reason none of it is ever quoted.</p>
      <h3>One file, a fifth of a second</h3>
      <p>The Indian library runs on parquet files and DuckDB, because a million judgments need it. This one is a single SQLite file with two FTS5 indexes.</p>
      <ul>
        <li>Thai uses the <code>trigram</code> tokenizer (SQLite 3.34 or later). Thai is written without spaces between words, and trigram matching needs no word-splitting. A query term shorter than three code points cannot use the trigram index, so it falls back to <code>LIKE</code>. Thai vowels and tone marks are separate code points, so ที่ is three of them.</li>
        <li>English uses Porter stemming with prefix matching, a small synonym list (sale/sell, land/immovable, wife/spouse, foreigner/alien), and the termbase: an English phrase that matches a termbase rendering also searches the Thai term, at half weight.</li>
      </ul>
      <p>SQLite could not write its database file on the folder as the agent&#8217;s environment mounts it; the first attempt failed with <code>disk I/O error</code>. So the index is built in memory and written out in one go:</p>
      <pre><code># simplified; serialize() needs Python 3.11+
import os, sqlite3
mem = sqlite3.connect(":memory:")
mem.execute("CREATE VIRTUAL TABLE fts_th USING fts5(text_th, tokenize='trigram')")
# ... load sections, agency texts, notes ...
with open(tmp_path, "wb") as f:
    f.write(mem.serialize())
os.replace(tmp_path, index_path)   # the old index survives until the new one is complete</code></pre>
      <p>A search looks like this. The square brackets mark the words that matched:</p>
      <pre><code>python3 th_ask.py "matrimonial property"

Civil and Commercial Code, section 1474
  TH  [T1 Thai, Council of State consolidation, in force from 2025-03-25]
      มาตรา ๑๔๗๔ สินสมรสได้แก่ทรัพย์สิน (๑) ที่คู่สมรสได้มาระหว่างสมรส ...
  EN  [T4 machine translation - NEVER quote or cite]
      Section 1474 [Matrimonial] [property] consists of [property] (1) which
      the spouses obtained during marriage. ...</code></pre>
      <p>As of 1 October 2026: 26,978 sections, all with machine English; 1,218 third-party English pages; about 8,400 chunks of agency, tax, OCR, treaty and note text. The index is 146 MB, a full rebuild takes about 11 seconds, and a search returns in 0.1 to 0.2 seconds. I looked at moving it to the parquet-and-DuckDB layout of the Indian library and left it as it is. That layout exists for a 5.8 GB judgment index; an 11-second rebuild gains nothing from it.</p>
      <h3>Case law, later</h3>
      <p>Thai Supreme Court decisions are not in the library yet. That is a choice of order. In a civil law system a Supreme Court decision is not a precedent that binds; it carries persuasive weight and helps in reading the Code. The statute book had to come first. Case law is on the list for later, as a targeted set of decisions on property, family and succession rather than a bulk download.</p>
      <h3>What I check before relying on it</h3>
      <ul>
        <li>The machine English. It is for finding and reading. Anything to be acted on needs an official English text where one exists, or a reading of the Thai by someone who reads it.</li>
        <li>The consolidations. They trail behind amendments; the issuing department is the cross-check.</li>
        <li>OCR text. It finds the page; then the page is read.</li>
        <li>Forms and schedules. They exist only in the PDFs, and some of those PDFs are still unread.</li>
        <li>The Bank of Thailand&#8217;s PDFs. 1,821 pages with junk text layers are measured and not solved. An improved glyph method can hash 98% of their glyphs, but more than half of those glyphs never appear on a clean page to learn from.</li>
      </ul>
      <h3>What this is for</h3>
      <p>I wanted to start any question of Thai law I study from the Thai text, with an honest label on every English word I lean on. The library does that now. A search gives me a Thai section, a T4 rendering to tell me what it says, and an official source to confirm it in.</p>
      <h3>A note on what this is not</h3>
      <p>I am an advocate enrolled in India. I am not a Thai lawyer, I do not practise Thai law, and as a foreign national I could not. Thai law allows only Thai nationals to register as lawyers (Lawyers Act B.E. 2528, section 35), and legal and litigation services are among the work Thai law reserves to Thai nationals, with narrow exceptions for arbitration. This library is a personal research tool for my own study. Nothing in this post is advice on Thai law. For any Thai-law matter, consult a lawyer licensed in Thailand.</p>
      <p>The texts in the library are public: Thai legislation, regulations, official notices and judgments, and translations of them made by Thai state agencies, are outside copyright under the Thai Copyright Act (section 7). Third-party English is held for private research only and is not reproduced here.</p>
      <h3>Glossary</h3>
      <p><strong>B.E.</strong>: Buddhist Era. Thai dates count from it; B.E. = C.E. + 543, so B.E. 2569 is 2026.</p>
      <p><strong>Council of State (ocs.go.th)</strong>: the Thai government&#8217;s legal drafting office, which publishes consolidated texts of Thai laws.</p>
      <p><strong>Consolidation</strong>: the text of a law with its amendments worked in. A convenience; the law itself is what was published in the Royal Gazette.</p>
      <p><strong>Royal Gazette</strong>: the official gazette in which Thai laws are published and from which they take effect.</p>
      <p><strong>มาตรา</strong>: section. <strong>bis, ter, quater</strong>: inserted sections numbered after an existing one.</p>
      <p><strong>Termbase</strong>: a fixed list of Thai legal terms and their agreed English renderings, used to keep the machine translation consistent.</p>
      <p><strong>FTS5</strong>: SQLite&#8217;s full-text search extension. <strong>Trigram tokenizer</strong>: indexes every run of three characters, so text without word boundaries can be searched without splitting it into words.</p>
      <p><strong>ToUnicode map</strong>: the table inside a PDF that tells software which Unicode character each character code stands for. When it is wrong, a page looks right and extracts as nonsense.</p>
      <p><strong>Mac Thai</strong>: Apple&#8217;s old 8-bit encoding for Thai, close to TIS-620 for the letters, with extra bytes for tone marks and vowels.</p>
      <p><strong>OCR</strong>: optical character recognition. Tesseract is the open-source OCR engine used here.</p>
    </div>

    <div id="tlc-panel-th" class="tlc-panel" lang="th">
      <h2 class="tlc-visually-hidden">กฎหมายที่ผมอ่านไม่ออก</h2>
      <p>ผมกำลังศึกษากฎหมายไทย แต่ผมอ่านภาษาไทยไม่ออก</p>
      <p>สำหรับคนเป็นนักกฎหมาย นี่เป็นสถานการณ์ที่ลำบากใจ กฎหมายไทยประกาศใช้เป็นภาษาไทย และตัวบทภาษาไทยคือตัวกฎหมาย ฉบับภาษาอังกฤษใด ๆ เป็นเพียงการอ่านของใครคนหนึ่ง สำหรับประมวลกฎหมายที่ว่าด้วยทรัพย์สิน ครอบครัว และมรดก หน่วยงานยกร่างกฎหมายของรัฐบาลไทยเองไม่มีตัวบทภาษาอังกฤษเลย ผมตรวจสอบแล้ว และวิธีที่ผมตรวจสอบก็เป็นส่วนหนึ่งของบทความนี้</p>
      <p>ผมจึงสร้างห้องสมุดกฎหมายแห่งที่สองขึ้นในคอมพิวเตอร์ของตัวเอง แห่งแรกเป็นตัวบทและคำพิพากษาของอินเดีย ซึ่งเป็น<a href="https://techblog.viveksanghi.com/2026/09/building-a-local-indian-law-corpus/">อีกโครงการหนึ่ง</a> แห่งนี้เก็บกฎหมายไทยเป็นภาษาไทย ภาษาอังกฤษทุกบรรทัดมีป้ายบอกว่าเชื่อถือได้แค่ไหน และค้นหาได้ในเสี้ยววินาที</p>
      <p>ผมสร้างมันร่วมกับ Claude โมเดล AI ของ Anthropic ซึ่งทำงานในฐานะเอเจนต์ คือสั่งรันโปรแกรมบนคอมพิวเตอร์ของผมและใช้เบราว์เซอร์ Chrome ของผมได้ ภายใต้กฎที่ผมกำหนด การตัดสินใจเป็นของผม สคริปต์และการสืบค้นส่วนใหญ่มาจากโมเดล และความผิดพลาดจำนวนไม่น้อยก็เช่นกัน งานเริ่มเมื่อวันที่ 4 กันยายน 2026 และส่วนใหญ่ทำในสัปดาห์สุดท้ายของเดือนกันยายน</p>
      <p>ขอกล่าวไว้ก่อนเรื่องอื่น ผมเป็นทนายความอินเดีย ไม่ใช่ทนายความไทย บทความนี้เล่าเรื่องการสร้างเครื่องมือค้นคว้า ไม่ใช่คำแนะนำเกี่ยวกับกฎหมายไทย รายละเอียดอยู่ในหมายเหตุท้ายบทความ</p>
      <h3>ภาษาอังกฤษทุกคำต้องมีป้าย</h3>
      <p>การตัดสินใจแรกคือกฎว่าด้วยภาษาอังกฤษ</p>
      <p>ประเทศไทยใช้ระบบซีวิลลอว์ ศาลไทยไม่ผูกพันตามคำพิพากษาก่อนหน้าอย่างเป็นทางการ รวมถึงคำพิพากษาศาลฎีกา แม้คำพิพากษาเหล่านั้นจะมีน้ำหนักก็ตาม ตัวบทกฎหมายจึงสำคัญกว่าคำพิพากษา และตัวบทเป็นภาษาไทย ถ้าผมจะพึ่งพาสิ่งเหล่านี้ ประโยคภาษาอังกฤษทุกประโยคต้องบอกได้ว่ามาจากไหน</p>
      <p>จึงแบ่งเป็นสี่ระดับ:</p>
      <pre><code>T1  ตัวบทภาษาไทยที่เป็นทางการ หรือภาษาอังกฤษที่หน่วยงานเผยแพร่เป็นส่วนหนึ่งของตัวกฎหมาย
T2  ภาษาอังกฤษที่หน่วยงานรัฐของไทยเผยแพร่ โดยระบุว่าไม่เป็นทางการ
T3  ภาษาอังกฤษจากบุคคลภายนอก เช่น คำแปลเชิงพาณิชย์ เว็บไซต์สำนักงานกฎหมาย
T4  ผลงานแปลด้วยเครื่องของเราเอง ใช้เพื่อค้นหาและอ่านเท่านั้น ห้ามยกอ้าง ห้ามอ้างอิง</code></pre>
      <p>ไฟล์ข้อความทุกไฟล์มีบรรทัด <code>tier:</code> ในส่วนหัว และเครื่องมือค้นหาพิมพ์ระดับไว้ข้างผลลัพธ์ทุกรายการ ภาษาอังกฤษที่แปลด้วยเครื่องจะขึ้นป้าย <code>T4 machine translation - NEVER quote or cite</code> เป็นตัวพิมพ์ใหญ่ทุกครั้ง ป้ายนี้คือสิ่งที่กันไม่ให้ประโยคที่อ่านลื่นไหลกลายเป็นข้อความที่ถูกนำไปอ้างอิง</p>
      <h3>ตามหาตัวบท</h3>
      <p>สำนักงานคณะกรรมการกฤษฎีกาเผยแพร่ตัวบทกฎหมายไทยฉบับปรับปรุงอย่างเป็นทางการ ที่อยู่เดิม krisdika.go.th ไม่ได้ให้บริการแล้ว หน่วยงานย้ายไปที่ ocs.go.th</p>
      <p>หน้าค้นหาของเว็บไซต์ใหม่ทำงานบน endpoint แบบ form-encoded คือ <code>POST /searchlaw/indexs/list_table_search</code> มีสองเรื่องที่ขวางอยู่ก่อนจะได้รายการที่ครบถ้วน</p>
      <p>เรื่องแรกคือ TLS เซิร์ฟเวอร์ไม่ส่งใบรับรองระดับกลาง (intermediate certificate) มาด้วย เบราว์เซอร์ไปดึงใบรับรองที่ขาดมาเองได้ แต่ไลบรารี <code>requests</code> ของ Python ทำไม่ได้และล้มเหลว การตั้ง <code>verify=False</code> จะทำให้ข้อผิดพลาดหายไปด้วยการปิดการตรวจสอบ วิธีที่ใช้แทนคือ <code>truststore</code> ซึ่งส่งงานตรวจสอบไปให้ระบบสร้างสายการรับรองของ Windows เอง และ Windows หาใบรับรองระดับกลางที่ขาดได้ การตรวจสอบจึงยังคงเกิดขึ้น</p>
      <p>เรื่องที่สองคือตัวกรอง หน้าค้นหาของเว็บไซต์ส่งพารามิเตอร์ <code>query[lawCategoryName]</code> ด้วยค่า <code>1B,1C</code> เมื่อส่งแบบนั้น ดัชนีซ่อนไป 7 รายการจาก 147 รายการ เมื่อส่งเป็นค่าว่าง ได้ครบทั้ง 147 รายการ ถ้าไม่นับทั้งสองแบบ ผมคงไม่รู้</p>
      <p>ผลที่ได้คือชื่อกฎหมายและไฟล์ PDF แต่ยังไม่ใช่ตัวบท ตัวบทอยู่หลังหน้าแสดงผลซึ่งเป็นแอป Angular แบบหน้าเดียว และ endpoint ห้าแห่งที่ลองเดาได้ผล 404 ทั้งหมด สิ่งที่ได้ผลคือเปิดหน้าแสดงผลในเบราว์เซอร์ แล้วอ่านดูว่าหน้าเว็บขอตัวบทจากเซิร์ฟเวอร์อย่างไร จากการรับส่งข้อมูลบนเครือข่ายและจาก JavaScript bundle ของมัน หน้าแสดงผลใช้ endpoint JSON สาธารณะ:</p>
      <pre><code>POST https://searchlaw.ocs.go.th/ocs-api/public/doc/getLawDoc
Content-Type: application/json

{ "reqHeader": { ...request id, channel, timestamp, service name... },
  "reqBody":   { "timelineId": "&lt;id from the index&gt;", "isTransEng": false,
                 "sectionIds": [], "sectionAndExplains": [] } }</code></pre>
      <p>คำตอบที่ได้เป็นข้อมูลมีโครงสร้าง แต่ละมาตรามีเลขมาตรา ป้าย และเนื้อหา HTML พร้อมทุกฉบับของกฎหมายนั้น สำหรับประมวลกฎหมายแพ่งและพาณิชย์ ได้ 2,254 รายการ 605,706 ตัวอักษร ใช้บังคับตั้งแต่วันที่ 25 มีนาคม 2025 การดาวน์โหลดไฟล์บนเว็บไซต์เดียวกันใช้อีกเส้นทางหนึ่งที่ต้องมีโทเคนซึ่งหน้าแสดงผลถืออยู่ โทเคนนั้นไม่เคยถูกอ่านหรือนำไปใช้ซ้ำ ไฟล์ PDF ภาษาอังกฤษที่กล่าวถึงด้านล่างบันทึกผ่านปุ่มดาวน์โหลดของหน้าแสดงผลเอง เหมือนผู้อ่านทั่วไปบันทึกไฟล์</p>
      <h3>ภาษาอังกฤษที่ไม่มีอยู่จริง</h3>
      <p>คำขอเดียวกันนี้มีแฟล็ก <code>isTransEng</code> เมื่อตั้งเป็น true จะเป็นการขอภาษาอังกฤษ</p>
      <p>สำหรับประมวลกฎหมายไทยทั้งแปดฉบับ คำตอบคือ <code>SUCCESS</code> แต่มีศูนย์มาตรา ระบบรู้จักชื่อภาษาอังกฤษของประมวลกฎหมายเหล่านี้ แต่ไม่มีตัวบทภาษาอังกฤษเลย</p>
      <p>มีข้อยกเว้นอยู่หนึ่งกรณี ไทม์ไลน์ของประมวลกฎหมายแพ่งและพาณิชย์มี 73 ฉบับ และหนึ่งในนั้น คือตัวบทดั้งเดิมปี 1925 มีเครื่องหมายว่ามีคำแปล เป็นไฟล์ขนาด 242 KB ตลอดหนึ่งสัปดาห์ สมมติฐานในการทำงานคือไฟล์นี้เป็นคำแปลภาษาอังกฤษของประมวลฯ ฉบับปี 1925 เมื่อดาวน์โหลดไฟล์มาอ่าน หน้าปกบอกไว้อีกอย่าง มันคือพระราชบัญญัติแก้ไขเพิ่มเติมประมวลกฎหมายแพ่งและพาณิชย์ (ฉบับที่ 20) พ.ศ. 2557 เป็นพระราชบัญญัติแก้ไขเพิ่มเติมเพียงฉบับเดียว ที่ถูกจัดเก็บไว้กับฉบับดั้งเดิม</p>
      <p>บันทึกจึงได้รับการแก้ไข พร้อมวันที่แก้ และการอ่านเดิมยังคงถูกเก็บไว้ รายการในไทม์ไลน์บอกได้เพียงว่ามีไฟล์อยู่ ตัวไฟล์เองเท่านั้นที่บอกว่ามันคืออะไร</p>
      <p>สำนักงานคณะกรรมการกฤษฎีกามีภาษาอังกฤษสำหรับกฎหมายฉบับอื่น และตอนนี้ PDF เหล่านั้น 70 ไฟล์ ครอบคลุมกฎหมาย 57 ฉบับ อยู่ในห้องสมุดแล้ว จัดอยู่ในระดับ T2 และระบุไว้ในตัวเองว่าภาษาไทยเป็นฉบับที่มีผลบังคับแต่ผู้เดียว หลายไฟล์กลายเป็นพระราชบัญญัติแก้ไขเพิ่มเติม ไม่ใช่ตัวพระราชบัญญัติหลัก ซึ่งเป็นอีกเหตุผลหนึ่งที่ห้องสมุดนี้อ่านตัวบทฉบับปรับปรุงภาษาไทยก่อนเสมอ</p>
      <h3>มาตรา 2 ที่ปรากฏ 36 ครั้ง</h3>
      <p>เมื่อ endpoint ใช้งานได้ ประมวลกฎหมายทั้งแปดฉบับก็ถูกดึงลงมาเป็นข้อความมีโครงสร้าง ได้ 5,526 รายการ ในจำนวนนี้เป็นบทบัญญัติที่มีเลขกำกับ 4,453 รายการ จากนั้นการนับก็เริ่มขึ้น และบั๊กอยู่ในการนับนั่นเอง</p>
      <p>มาตรา 2 ปรากฏ 36 ครั้งในไฟล์ประมวลกฎหมายแพ่งและพาณิชย์ ไฟล์ของประมวลกฎหมายแต่ละฉบับมีพระราชบัญญัติที่แก้ไขประมวลฯ นั้นต่อท้ายไว้ และพระราชบัญญัติแต่ละฉบับก็นับมาตราของตัวเองเริ่มจาก 1 ถ้าปล่อยไว้อย่างนั้น การค้นหามาตรา 2 จะพบ 36 รายการ และมีเพียงรายการเดียวที่ถูก ตอนนี้ทุกรายการมีแฟล็กระบุว่าเป็นของตัวประมวลฯ เองหรือไม่ นี่คือเหตุที่ 2,254 รายการในไฟล์ประมวลกฎหมายแพ่งและพาณิชย์ เหลือเป็นบทบัญญัติของประมวลฯ 1,850 มาตรา ส่วนที่เหลือคือหัวข้อและพระราชบัญญัติที่ต่อท้าย</p>
      <p>ตัวอย่างอื่น ๆ:</p>
      <ul>
        <li>ประมวลกฎหมายที่ดินมีแปดรายการติดกันที่ป้ายเขียนว่ามาตรา 105 ทั้งหมด ความจริงคือมาตรา 105, 105 ทวิ, ตรี ไปจนถึงอัฏฐ ฟิลด์ป้ายตัดเลขมาตราให้สั้นลง จึงต้องแยกเลขมาตราจริงจากตัวข้อความ</li>
        <li>เลขลำดับคำเดียวกันสะกดได้สองแบบ คือ <code>อัฎฐ</code> ใช้ ฎ ในประมวลกฎหมายวิธีพิจารณาความแพ่ง และ <code>อัฏฐ</code> ใช้ ฏ ในประมวลกฎหมายที่ดิน</li>
        <li>เว็บไซต์ส่งคอมเมนต์ HTML ที่ถูก escape มา คือ <code>&amp;lt;!--[endif]--&amp;gt;</code> ซึ่งจะกลายเป็นคอมเมนต์ก็ต่อเมื่อ unescape แล้ว ตัวลบคอมเมนต์จึงมองไม่เห็น selftest ผ่านเพราะ fixture ใช้คอมเมนต์จริง มันถูกเขียนจากวิธีแก้ ไม่ใช่จากข้อมูล</li>
      </ul>
      <p>เมื่อแก้ทั้งหมดนี้แล้ว ไม่มีเลขมาตราใดในประมวลกฎหมายทั้งแปดฉบับที่ซ้ำกันอีก</p>
      <h3>เมื่อกฎหมายที่ถูกยกเลิกแล้วยังเป็น &#8220;ฉบับปัจจุบัน&#8221;</h3>
      <p>แต่ละฉบับในไทม์ไลน์ของกฎหมายมี <code>stateId</code> กำกับ <code>01</code> ดูเหมือนแปลว่า &#8220;มีผลใช้บังคับ&#8221; และ <code>00</code> ดูเหมือนแปลว่า &#8220;ถูกแทนที่แล้ว&#8221;</p>
      <p>ในแถวดัชนี 652 แถวที่ชื่อมีคำว่า <code>(ยกเลิก)</code> มีถึง 638 แถวที่อยู่ในสถานะ <code>01</code> ฉบับสุดท้ายของกฎหมายที่ถูกยกเลิกแล้ว ยังคงเป็นฉบับปัจจุบันของกฎหมายนั้น การยกเลิกจึงอ่านจากเครื่องหมายในชื่อ ไม่ใช่จากสถานะ</p>
      <p>การทดสอบเมื่อวันที่ 24 กันยายน พบสถานะที่สาม คือ <code>02</code> ประกาศแล้วแต่ยังไม่มีผลใช้บังคับ พร้อมประเภทฉบับที่ห้า คือฉบับปรับปรุงล่วงหน้าที่แสดงว่ากฎหมายจะเป็นอย่างไรเมื่อการแก้ไขที่รออยู่มีผล วันที่ 30 กันยายน เรื่องนี้ทำให้เจอกับดัก พระราชกฤษฎีกาว่าด้วยภาษีมูลค่าเพิ่มฉบับหนึ่งแสดงฉบับปรับปรุงล่วงหน้าที่มีผลตั้งแต่วันที่ 1 ตุลาคม 2026 และไม่ได้รวมพระราชกฤษฎีกาแก้ไขอีกฉบับที่ลงวันที่เดียวกัน ซึ่งคงอัตราที่ลดลงไว้อีกหนึ่งปี ถ้าอ่านฉบับล่วงหน้านั้นเพียงลำพัง จะได้อัตราที่ผิด ตอนนี้ห้องสมุดเก็บพระราชกฤษฎีกาแก้ไขฉบับนั้นแยกไว้ และติดธงเตือนฉบับล่วงหน้าใดก็ตามที่เหมือนฉบับปัจจุบัน</p>
      <p>ในวันเดียวกัน ห้องสมุดทั้งหมดได้รับการตรวจเทียบกับสำนักงานคณะกรรมการกฤษฎีกา 837 รายการในไทม์ไลน์ของกฎหมายแม่บทที่เก็บไว้ และกฎหมาย 773 ฉบับไม่มีฉบับใดเปลี่ยนแปลงนับจากวันที่ดึงมา แต่ตัวบทฉบับปรับปรุงเองอาจตามหลังการแก้ไขกฎหมาย ฉบับปรับปรุงล่าสุดของประมวลรัษฎากรบนเว็บไซต์ลงวันที่ 9 พฤศจิกายน 2021 เว็บไซต์ไม่สามารถแสดงการแก้ไขที่ยังไม่ได้นำมารวม หน่วยงานที่ออกกฎหมายจึงเป็นแหล่งตรวจสอบซ้ำ</p>
      <h3>ทำงานกับเอเจนต์ที่ผิดพลาดได้</h3>
      <p>เอเจนต์ที่รันโปรแกรมบนคอมพิวเตอร์ของผมและควบคุมเบราว์เซอร์ของผมได้ ทำงานได้มากในบ่ายวันเดียว แต่มันก็ผิดได้เกี่ยวกับไฟล์ที่มันไม่ได้เปิดดู และมันเขียนคำอธิบายที่อ่านลื่นไหลถึงสิ่งที่ไม่ได้เกิดขึ้นจริง กฎที่ผมใช้ทำงานล้วนเกิดจากเหตุการณ์จริง</p>
      <p>กฎเรื่องการแยกส่วนมาก่อน ห้องสมุดไทยอยู่ข้างห้องสมุดอินเดียบนดิสก์เดียวกัน และในช่วงแรก ข้อมูลสำรองของฝั่งไทยถูกเขียนลงในโฟลเดอร์สำรองของฝั่งอินเดีย ไม่มีอะไรสูญหาย แต่นับจากนั้น มีตัวป้องกันที่ปฏิเสธทุกเส้นทางที่อยู่ใต้โฟลเดอร์สำรองของอินเดีย และมีตัวตรวจที่ตรวจทุกสคริปต์ว่าเข้าถึงที่ใดได้บ้าง การสร้างตัวตรวจนี้ทำให้เกิดเหตุการณ์แปลก ๆ สองครั้งในเดือนนั้น:</p>
      <ul>
        <li><code>io.open(path, "w", newline=...)</code> ล้างไฟล์ก่อนที่จะแจ้งข้อผิดพลาดเมื่ออาร์กิวเมนต์ <code>newline</code> ไม่ถูกต้อง ตัวตรวจลบเนื้อหาตัวเองจนเหลือศูนย์ไบต์ด้วยวิธีนี้ ตอนนี้ทุกอย่างเขียนลงไฟล์ชั่วคราวก่อน แล้วจึงใช้ <code>os.replace</code> สลับเข้าที่</li>
        <li>เส้นทางแบบ Windows อย่าง <code>D:\...\Thai_Backup</code> สำหรับโปรแกรมบน Linux เป็นเพียงชื่อไฟล์ธรรมดา เมื่อสั่งจากฝั่งเอเจนต์ การสำรองข้อมูลจึงสร้างโฟลเดอร์ที่ชื่อเป็นเส้นทาง Windows ทั้งเส้นขึ้นมาในห้องสมุด ดูเผิน ๆ เหมือนการสำรองข้อมูลสำเร็จ</li>
      </ul>
      <p>กฎข้อที่สองคือทุกคำกล่าวอ้างต้องแสดงหลักฐาน ถ้าเอเจนต์บอกว่ามีไฟล์สำรองอยู่ มันต้องแสดงรายการไฟล์ ถ้ามันขอให้ผมรันไฟล์ใด มันต้องเปิดไฟล์นั้นก่อนและยกบรรทัดที่ทำงานจริงมาให้ดู กฎนี้เกิดหลังเซสชันหนึ่งที่มีข้อผิดพลาดแบบนี้ห้าครั้ง หนึ่งในนั้นคือคำแนะนำให้รันไฟล์ batch ที่จะทิ้งงานสามวันไป</p>
      <p>กฎข้อที่สามคือต้องสำรองข้อมูลก่อนทำอะไรก็ตามที่เขียนทับไฟล์ ครั้งหนึ่ง ไฟล์ batch ที่ถูกแนะนำมาแบบผ่าน ๆ ได้เขียนทับไฟล์ที่อีกสคริปต์หนึ่งบันทึกผล OCR ไว้ และเวลาประมวลผลของเครื่องหลายชั่วโมงก็หายไปด้วย ตอนนี้ต้องทำสำเนาก่อนเสมอ และต้องแสดงค่า checksum ทั้งสองค่า เมื่อวันที่ 1 ตุลาคม กฎนี้ถูกใช้กับเรื่องเล็ก ๆ ไฟล์แคชคำแปลไฟล์หนึ่งมีไบต์ NUL 1,443 ไบต์ที่หลงเหลือจากการทำงานที่หยุดกลางคันเมื่อวันที่ 29 กันยายน ไม่มีอะไรสูญหาย เพราะงานส่วนนั้นถูกทำใหม่แล้ว แต่ก็ทำสำเนาก่อน ลบบรรทัดที่เสีย และสแกนไฟล์แคชทั้ง 776 ไฟล์ก่อนสร้างดัชนีใหม่</p>
      <p>เอเจนต์ทำงานภายในขอบเขตที่ผมกำหนด มันใช้เฉพาะหน้าเว็บและ endpoint สาธารณะของเว็บไซต์ เคารพ robots.txt ไม่แก้ CAPTCHA ไม่กรอกรหัสผ่าน ไม่จัดการโทเคนสำหรับล็อกอิน และงานใดที่ผมต้องทำเอง จะมาเป็นขั้นตอนมีเลขกำกับตั้งแต่การคลิกครั้งแรก เมื่อมันบันทึกไฟล์จากหน้าเว็บ หน้าเว็บจะสร้างไฟล์ขึ้น แล้วการคลิกลิงก์จะบันทึกไฟล์ลงในโฟลเดอร์ Downloads ของผม</p>
      <h3>PDF ที่แสดงอย่างหนึ่งแต่บอกอีกอย่างหนึ่ง</h3>
      <p>ไม่ใช่ทุกอย่างที่มาทาง endpoint กฎกระทรวง บัญชีท้าย และแบบฟอร์ม มาในรูป PDF และ PDF อาจดูสมบูรณ์บนหน้าจอ ขณะที่ชั้นข้อความของมันบอกอีกอย่างหนึ่ง หน้ากระดาษวาดจากโครงร่าง glyph ในฟอนต์ที่ฝังไว้ ส่วนการดึงข้อความผ่านการจับคู่อีกชุดหนึ่งจากรหัสอักขระไปเป็น Unicode (ตาราง ToUnicode หรือ encoding และชื่อ glyph ของฟอนต์เมื่อไม่มีตาราง) ถ้าการจับคู่นั้นผิด หน้าจอจะถูก แต่ข้อความจะเป็นขยะ</p>
      <p>พบข้อผิดพลาดสามแบบ</p>
      <p>ตาราง glyph เสีย โครงร่างยังสมบูรณ์ มีแต่ตารางที่เสีย จึงแฮชโครงร่างของทุก glyph เรียนรู้การจับคู่แฮชกับตัวอักษรจากหน้าที่ตารางถูกต้อง แล้วค้นหา glyph ที่เสียด้วยรูปร่าง ใน 29 หน้าแรกที่เสีย ได้ 27,277 glyph จากรูปร่างที่ไม่ซ้ำกัน 88 รูป ถอดได้ทั้งหมด บั๊กหนึ่งที่ควรจำไว้ แคชฟอนต์ใช้ object id ของ PDF เป็นคีย์ และ object id ซ้ำกันข้ามไฟล์ได้</p>
      <p>Mac Thai เจ็ดไฟล์ถอดได้ 0% ผ่านตาราง glyph ทุกไฟล์ใช้ฟอนต์คู่เดียวกัน และชื่อ glyph ข้างในเป็นชื่อแบบ Mac Roman ที่วางอยู่ตามตำแหน่งของรหัส Mac OS Thai เก่าของ Apple ข้อความเป็นภาษาไทยที่เขียนด้วย Mac Thai แต่ถูกอ่านกลับเป็น Mac Roman วิธีซ่อมคือตาราง:</p>
      <pre><code># simplified; Python has no mac_thai codec
MAC_EXTRA = {0x83: "\u0E48", 0x88: "\u0E48", 0x89: "\u0E49", 0x8C: "\u0E4C",
             0x92: "\u0E31", 0x93: "\u0E47", 0x94: "\u0E34", 0x95: "\u0E35",
             0x97: "\u0E37", 0x8D: "\u201C", 0x8E: "\u201D"}

def macthai_decode(s):
    out = []
    for ch in s:
        try:
            b = ch.encode("mac_roman")[0]
        except UnicodeEncodeError:
            out.append("\uFFFD"); continue
        if b &lt; 0x80:
            out.append(ch)
        elif 0xA1 &lt;= b &lt;= 0xFB:            # Thai letters as in TIS-620; Apple's dashes and
                                           # symbols in this range differ and come out unknown
            out.append(bytes([b]).decode("cp874", errors="replace"))
        elif b in MAC_EXTRA:               # Apple's extra bytes, read from the pages
            out.append(MAC_EXTRA[b])
        else:
            out.append("\uFFFD")           # counted as unknown, never guessed
    return "".join(out)</code></pre>
      <p>ความพยายามครั้งแรกทำ ส หายไปทุกตัว ไบต์ 0xCA ใน Mac Roman คือช่องว่างไม่ตัดบรรทัด แต่ใน Mac Thai 0xCA คือ ส และครั้งแรกอ่านมันเป็นช่องว่าง การถอดรหัสที่ผิดก็อาจออกมาดูเหมือนภาษาไทยได้ หน้าที่ถอดแล้วจึงยอมรับเฉพาะเมื่อการสะกดแบบไทยถูกต้อง คือสระหรือวรรณยุกต์ต้องตามหลังพยัญชนะ สระหน้าต้องนำหน้าพยัญชนะ และอัตราการผิดต้องต่ำกว่า 1%</p>
      <p>สระอา ที่เขียนเป็นสระอำ PDF สิบไฟล์ 30 หน้า เขียน า ทุกตัวเป็น ำ และ ำ ตัวจริงทุกตัวมีช่องว่างนำหน้า เช่น <code>กำร</code> แทน <code>การ</code> และ <code>ก ำหนด</code> แทน <code>กำหนด</code> การตรวจหน้ากระดาษบอกว่าเป็นภาษาไทย เพราะเป็นตัวอักษรไทยจริง วิธีซ่อมแม่นยำ:</p>
      <pre><code># simplified
import re
MARK = "\uE000"
def fix_sara_aa(t):
    t = re.sub(r" ([\u0E48-\u0E4B]?)\u0E33", lambda m: m.group(1) + MARK, t)  # " ำ" is the real ำ
    return t.replace("\u0E33", "\u0E32").replace(MARK, "\u0E33")             # every other ำ is า</code></pre>
      <p>การตรวจจับใช้การสะกดที่ภาษาไทยไม่มี เช่น <code>กำร</code> <code>ตำม</code> <code>จำก</code> และอีกเล็กน้อย ที่ปรากฏอย่างน้อยสองครั้ง โดยไม่มีรูปที่ถูกต้องเลยในหน้านั้น ในโฟลเดอร์ PDF วิธีนี้เลือกได้ตรง 30 หน้านั้นพอดี หนึ่งในสิบไฟล์คือกฎกระทรวงตามประมวลกฎหมายที่ดินว่าด้วยค่าธรรมเนียมจดทะเบียนการโอนและการจำนอง</p>
      <p>จากนั้นก็สามารถตรวจเทียบกับแหล่งทางการได้ กฎกระทรวงและพระราชกฤษฎีกา 73 ฉบับภายใต้พระราชบัญญัติหลักได้ตัวบททางการกลับมาผ่าน endpoint โดยมีรหัสเดียวกับ PDF ที่อ่านไปแล้ว ตัววัดคือสัดส่วนของตัวอักษรไทยในแต่ละหน้า PDF ที่พบเรียงตามลำดับในตัวบททางการ:</p>
      <pre><code>method     pages   median
macthai      24    0.984
glyph        31    0.978
pua          38    0.978
layer       108    0.942
ocr         160    0.717</code></pre>
      <p><code>layer</code> คือชั้นข้อความที่ใช้ตามที่เป็น <code>pua</code> คือชั้นข้อความที่ใช้พื้นที่ private-use ของ Unicode ทุกหน้าที่ได้ต่ำกว่า 0.8 ซึ่งไม่ใช่หน้าที่มีปัญหาสระอา เป็นแบบฟอร์มหรือภาคผนวก ตัวบททางการมีเฉพาะบทบัญญัติที่ใช้บังคับ และ PDF เป็นแหล่งเดียวของแบบฟอร์มและบัญชีท้าย ค่ามัธยฐาน 0.717 ของ Tesseract กับภาษาไทยที่สแกนมา คือเหตุผลที่ข้อความจาก OCR อยู่ในระดับ T4 ตัวเลขไทยแย่ที่สุด</p>
      <h3>ภาษาอังกฤษจากเครื่องที่ผมจะไม่ยกอ้าง</h3>
      <p>ตัวบทไทยที่ถูกต้องแต่ผมอ่านไม่ออกมีประโยชน์กับผมไม่มากนัก ทุกมาตราจึงมีคำแปลภาษาอังกฤษด้วยเครื่อง ทำบนเครื่องของผมเองด้วยโมเดลเปิด Gemma ของ Google (<code>gemma3:27b</code>) ผ่าน Ollama บนการ์ดจอของเครื่องเดสก์ท็อป มาตรา 26,978 มาตราถูกแบ่งเป็น 27,198 ชิ้นเพื่อแปล และบันทึกการทำงานแสดงเวลาประมวลผลของโมเดลราว 36 ชั่วโมง ระหว่างค่ำวันที่ 28 กันยายน ถึงบ่ายวันที่ 30 กันยายน</p>
      <p>ทั้งหมดอยู่ในระดับ T4 การตรวจสอบมีไว้ให้มันดีพอสำหรับใช้ค้นหาและอ่านเคียงข้างภาษาไทย</p>
      <ol>
        <li>ปฏิเสธตั้งแต่ตอนแปล: คำตอบจะถูกปฏิเสธถ้าว่างเปล่า เป็นภาษาไทยเสียส่วนใหญ่ หรือสั้นหรือยาวเกินไปมากเมื่อเทียบกับภาษาไทยต้นทาง</li>
        <li>การตรวจด้วยโปรแกรมกับทุกชิ้นหลังการแปลทุกรอบ: ตัวเลขในภาษาไทยที่หายไปจากภาษาอังกฤษ เลขมาตราที่ไม่ตรงกัน มาตราที่มีคำต่อท้าย (<code>มาตรา ๓ ตรี</code>) ที่ไม่ได้แปลเป็น &#8220;3 ter&#8221; จำนวนรายการที่น้อยกว่าภาษาไทย ข้อความวนซ้ำ และคำพูดเกินเลยอย่าง &#8220;Here is the translation&#8221; ชิ้นที่ไม่ผ่านถูกส่งกลับไปพร้อมเหตุผลที่เขียนไว้ในคำสั่งแปลใหม่ ไม่เกินสองครั้ง หลังจากนั้นจะถูกจดไว้ให้อ่านตรวจ</li>
        <li>แผ่นตัวอย่าง 30 ชิ้นสุ่ม ภาษาไทยเคียงภาษาอังกฤษ ท้ายรายงานทุกฉบับ</li>
        <li>ตารางการใช้ศัพท์: สำหรับศัพท์กฎหมายแต่ละคำที่กำหนดไว้ ภาษาอังกฤษใช้คำแปลที่ตกลงไว้บ่อยแค่ไหน และศัพท์นั้นปรากฏในบริบทภาษาไทยแบบใด</li>
      </ol>
      <p>ข้อที่สี่จับความผิดพลาดที่ดีที่สุดของเดือนได้ รายการศัพท์กำหนดว่า <code>อาศัย</code> แปลว่า &#8220;habitation&#8221; อย่างในคำว่าสิทธิอาศัย แต่มีเพียง 24% ของชิ้นงานที่ทำตาม และบริบทที่พบบ่อยที่สุดคือ <code>อาศัยอำนาจ</code> ซึ่งแปลว่า &#8220;by virtue of the power&#8221; คำนี้เมื่ออยู่ในคำอื่นถูกแปลเป็น habitation มาตรา 96 ทวิ แห่งประมวลกฎหมายที่ดินออกมาเป็นคนต่างด้าวได้ที่ดิน &#8220;through habitation based on a treaty&#8221; ขณะที่ภาษาไทยหมายถึงโดยอาศัยบทสนธิสัญญา ศัพท์จึงถูกจำกัดให้แคบลงเป็น <code>สิทธิอาศัย</code> = right of habitation และคำแปลที่ผิดลดลงจาก 202 เหลือ 6 ซึ่งทั้ง 6 เป็นการใช้ที่ถูกต้อง</p>
      <p>ชิ้นที่ถูกติดธงลดลงจาก 83 ในรอบแรก เหลือ 7 ในรอบสุดท้าย Claude อ่านทั้ง 7 ชิ้นเทียบกับภาษาไทย หกชิ้นเป็นการตกหล่นของตัวเลขหรือการอ้างอิงมาตราจริง และถูกบันทึกไว้เป็นข้อบกพร่องที่ทราบแล้ว อีกหนึ่งชิ้นเป็นการพิมพ์ผิดในต้นฉบับ นี่คือเครื่องตรวจเครื่อง ซึ่งเป็นเหตุผลที่ไม่มีส่วนใดของมันถูกยกอ้างเลย</p>
      <h3>ไฟล์เดียว เสี้ยววินาที</h3>
      <p>ห้องสมุดฝั่งอินเดียใช้ไฟล์ parquet กับ DuckDB เพราะคำพิพากษาหนึ่งล้านฉบับต้องการเช่นนั้น แห่งนี้เป็นไฟล์ SQLite ไฟล์เดียวที่มีดัชนี FTS5 สองชุด</p>
      <ul>
        <li>ภาษาไทยใช้ tokenizer แบบ <code>trigram</code> (SQLite 3.34 ขึ้นไป) ภาษาไทยเขียนโดยไม่เว้นวรรคระหว่างคำ และการจับคู่แบบ trigram ไม่ต้องตัดคำ คำค้นที่สั้นกว่าสาม code point ใช้ดัชนี trigram ไม่ได้ จึงถอยไปใช้ <code>LIKE</code> สระและวรรณยุกต์ไทยเป็น code point แยกกัน ดังนั้น ที่ จึงมีสาม code point</li>
        <li>ภาษาอังกฤษใช้ Porter stemming กับการจับคู่คำนำหน้า รายการคำพ้องสั้น ๆ (sale/sell, land/immovable, wife/spouse, foreigner/alien) และรายการศัพท์ วลีภาษาอังกฤษที่ตรงกับคำแปลในรายการศัพท์จะค้นหาศัพท์ภาษาไทยด้วย โดยให้น้ำหนักครึ่งหนึ่ง</li>
      </ul>
      <p>SQLite เขียนไฟล์ฐานข้อมูลลงในโฟลเดอร์ตามที่สภาพแวดล้อมของเอเจนต์ mount ไว้ไม่ได้ ความพยายามครั้งแรกล้มเหลวด้วย <code>disk I/O error</code> ดัชนีจึงถูกสร้างในหน่วยความจำ แล้วเขียนออกมาครั้งเดียว:</p>
      <pre><code># simplified; serialize() needs Python 3.11+
import os, sqlite3
mem = sqlite3.connect(":memory:")
mem.execute("CREATE VIRTUAL TABLE fts_th USING fts5(text_th, tokenize='trigram')")
# ... load sections, agency texts, notes ...
with open(tmp_path, "wb") as f:
    f.write(mem.serialize())
os.replace(tmp_path, index_path)   # the old index survives until the new one is complete</code></pre>
      <p>การค้นหาหน้าตาเป็นแบบนี้ วงเล็บเหลี่ยมคือคำที่ค้นเจอ:</p>
      <pre><code>python3 th_ask.py "matrimonial property"

Civil and Commercial Code, section 1474
  TH  [T1 Thai, Council of State consolidation, in force from 2025-03-25]
      มาตรา ๑๔๗๔ สินสมรสได้แก่ทรัพย์สิน (๑) ที่คู่สมรสได้มาระหว่างสมรส ...
  EN  [T4 machine translation - NEVER quote or cite]
      Section 1474 [Matrimonial] [property] consists of [property] (1) which
      the spouses obtained during marriage. ...</code></pre>
      <p>ณ วันที่ 1 ตุลาคม 2026: 26,978 มาตรา ทุกมาตรามีคำแปลภาษาอังกฤษด้วยเครื่อง หน้าภาษาอังกฤษจากบุคคลภายนอก 1,218 หน้า และข้อความจากหน่วยงาน ภาษี OCR สนธิสัญญา และบันทึก ราว 8,400 ส่วน ดัชนีมีขนาด 146 MB สร้างใหม่ทั้งหมดในราว 11 วินาที และการค้นหาใช้เวลา 0.1 ถึง 0.2 วินาที ผมพิจารณาจะย้ายไปใช้โครงสร้าง parquet และ DuckDB แบบห้องสมุดอินเดีย แล้วก็คงไว้อย่างเดิม โครงสร้างนั้นมีไว้สำหรับดัชนีคำพิพากษาขนาด 5.8 GB การสร้างใหม่ที่ใช้เวลา 11 วินาทีไม่ได้ประโยชน์อะไรจากมัน</p>
      <h3>คำพิพากษา ไว้ทีหลัง</h3>
      <p>คำพิพากษาศาลฎีกาของไทยยังไม่อยู่ในห้องสมุดนี้ นี่เป็นการเลือกลำดับงาน ในระบบซีวิลลอว์ คำพิพากษาศาลฎีกาไม่ใช่บรรทัดฐานที่มีผลผูกพัน แต่มีน้ำหนักในการโน้มน้าวและช่วยในการตีความประมวลกฎหมาย ตัวบทกฎหมายจึงต้องมาก่อน คำพิพากษาอยู่ในรายการงานภายหลัง โดยจะเลือกเฉพาะคำพิพากษาเรื่องทรัพย์สิน ครอบครัว และมรดก ไม่ใช่ดาวน์โหลดทั้งหมด</p>
      <h3>สิ่งที่ผมตรวจสอบก่อนจะพึ่งพา</h3>
      <ul>
        <li>ภาษาอังกฤษจากเครื่อง ใช้เพื่อค้นหาและอ่าน สิ่งใดที่จะนำไปใช้ดำเนินการ ต้องมีตัวบทภาษาอังกฤษที่เป็นทางการถ้ามี หรือต้องมีผู้ที่อ่านภาษาไทยได้อ่านตัวบทภาษาไทย</li>
        <li>ตัวบทฉบับปรับปรุง อาจตามหลังการแก้ไขกฎหมาย หน่วยงานที่ออกกฎหมายคือแหล่งตรวจสอบซ้ำ</li>
        <li>ข้อความจาก OCR ใช้หาหน้าที่ต้องการ แล้วจึงอ่านหน้านั้น</li>
        <li>แบบฟอร์มและบัญชีท้าย มีอยู่ใน PDF เท่านั้น และ PDF บางไฟล์ยังไม่ได้อ่าน</li>
        <li>PDF ของธนาคารแห่งประเทศไทย มี 1,821 หน้าที่ชั้นข้อความเสีย วัดแล้วแต่ยังแก้ไม่ได้ วิธี glyph ที่ปรับปรุงแล้วแฮช glyph ได้ 98% แต่มากกว่าครึ่งของ glyph เหล่านั้นไม่เคยปรากฏในหน้าที่สมบูรณ์ให้เรียนรู้</li>
      </ul>
      <h3>ทำไปเพื่ออะไร</h3>
      <p>ผมต้องการเริ่มต้นคำถามทางกฎหมายไทยใดก็ตามที่ผมศึกษาจากตัวบทภาษาไทย โดยภาษาอังกฤษทุกคำที่ผมพึ่งพามีป้ายบอกที่มาอย่างตรงไปตรงมา ตอนนี้ห้องสมุดทำได้แล้ว การค้นหาให้มาตราภาษาไทย คำแปลระดับ T4 ที่บอกว่ามาตรานั้นว่าอย่างไร และแหล่งทางการให้ไปตรวจยืนยัน</p>
      <h3>หมายเหตุ: สิ่งที่บทความนี้ไม่ใช่</h3>
      <p>ผมเป็นทนายความที่จดทะเบียนในอินเดีย ผมไม่ใช่ทนายความไทย ผมไม่ได้ประกอบวิชาชีพกฎหมายไทย และในฐานะคนต่างชาติ ผมก็ทำไม่ได้ กฎหมายไทยให้เฉพาะผู้มีสัญชาติไทยจดทะเบียนเป็นทนายความได้ (พระราชบัญญัติทนายความ พ.ศ. 2528 มาตรา 35) และงานให้บริการทางกฎหมายหรืออรรถคดีเป็นงานที่กฎหมายไทยสงวนไว้สำหรับคนไทย โดยมีข้อยกเว้นแคบ ๆ สำหรับงานอนุญาโตตุลาการ ห้องสมุดนี้เป็นเครื่องมือค้นคว้าส่วนตัวสำหรับการศึกษาของผมเอง ไม่มีส่วนใดในบทความนี้เป็นคำแนะนำเกี่ยวกับกฎหมายไทย สำหรับเรื่องกฎหมายไทยใด ๆ โปรดปรึกษาทนายความที่ได้รับใบอนุญาตในประเทศไทย</p>
      <p>ตัวบทในห้องสมุดเป็นเอกสารสาธารณะ กฎหมาย ระเบียบ ประกาศ คำสั่ง และคำพิพากษาของไทย รวมทั้งคำแปลที่หน่วยงานรัฐของไทยจัดทำ ไม่ถือเป็นงานอันมีลิขสิทธิ์ตามพระราชบัญญัติลิขสิทธิ์ (มาตรา 7) ภาษาอังกฤษจากบุคคลภายนอกเก็บไว้เพื่อการค้นคว้าส่วนตัวเท่านั้น และไม่ได้นำมาเผยแพร่ในที่นี้</p>
      <h3>อภิธานศัพท์</h3>
      <p><strong>พ.ศ.</strong>: พุทธศักราช ไทยนับปีตามนี้ พ.ศ. = ค.ศ. + 543 ดังนั้น พ.ศ. 2569 คือ ค.ศ. 2026</p>
      <p><strong>สำนักงานคณะกรรมการกฤษฎีกา (ocs.go.th)</strong>: หน่วยงานยกร่างกฎหมายของรัฐบาลไทย ผู้เผยแพร่ตัวบทกฎหมายไทยฉบับปรับปรุง</p>
      <p><strong>ฉบับปรับปรุง (consolidation)</strong>: ตัวบทกฎหมายที่รวมการแก้ไขเพิ่มเติมไว้แล้ว ใช้เพื่อความสะดวก ตัวกฎหมายจริงคือสิ่งที่ประกาศในราชกิจจานุเบกษา</p>
      <p><strong>ราชกิจจานุเบกษา</strong>: หนังสือราชการที่ใช้ประกาศกฎหมายไทย กฎหมายเริ่มมีผลนับจากการประกาศนี้</p>
      <p><strong>ทวิ ตรี จัตวา</strong>: มาตราที่แทรกเพิ่มต่อจากมาตราเดิม เทียบได้กับ bis, ter, quater</p>
      <p><strong>รายการศัพท์ (termbase)</strong>: รายการศัพท์กฎหมายไทยพร้อมคำแปลภาษาอังกฤษที่ตกลงกันไว้ ใช้ให้คำแปลด้วยเครื่องสม่ำเสมอ</p>
      <p><strong>FTS5</strong>: ส่วนขยายการค้นหาข้อความเต็มของ SQLite <strong>Trigram tokenizer</strong>: สร้างดัชนีจากทุกช่วงสามตัวอักษร ทำให้ค้นหาข้อความที่ไม่มีการแบ่งคำได้โดยไม่ต้องตัดคำ</p>
      <p><strong>ตาราง ToUnicode</strong>: ตารางใน PDF ที่บอกซอฟต์แวร์ว่ารหัสอักขระแต่ละตัวคือตัวอักษร Unicode ใด ถ้าตารางผิด หน้าจะดูถูกต้องแต่ดึงข้อความออกมาเป็นขยะ</p>
      <p><strong>Mac Thai</strong>: รหัสอักขระภาษาไทยแบบ 8 บิตรุ่นเก่าของ Apple ตัวอักษรใกล้เคียง TIS-620 โดยมีไบต์เพิ่มสำหรับวรรณยุกต์และสระ</p>
      <p><strong>OCR</strong>: ซอฟต์แวร์รู้จำตัวอักษร Tesseract คือเครื่องมือ OCR แบบโอเพนซอร์สที่ใช้ในงานนี้</p>
    </div>

  </div>
</div>



<p class="wp-block-paragraph"></p>
<p>The post <a href="https://techblog.viveksanghi.com/2026/10/thai-law-corpus/">The law I cannot read · กฎหมายที่ผมอ่านไม่ออก</a> appeared first on <a href="https://techblog.viveksanghi.com">Stubborn Fanatic - Tech Blog</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://techblog.viveksanghi.com/2026/10/thai-law-corpus/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">265</post-id>	</item>
		<item>
		<title>The section that wasn’t there</title>
		<link>https://techblog.viveksanghi.com/2026/09/building-a-local-indian-law-corpus/</link>
					<comments>https://techblog.viveksanghi.com/2026/09/building-a-local-indian-law-corpus/#respond</comments>
		
		<dc:creator><![CDATA[Vivek Sanghi]]></dc:creator>
		<pubDate>Fri, 04 Sep 2026 11:30:00 +0000</pubDate>
				<category><![CDATA[legal tech]]></category>
		<category><![CDATA[software]]></category>
		<category><![CDATA[sysadmin]]></category>
		<category><![CDATA[ai assisted]]></category>
		<category><![CDATA[data quality]]></category>
		<category><![CDATA[duckdb]]></category>
		<category><![CDATA[indian law]]></category>
		<category><![CDATA[legal research]]></category>
		<category><![CDATA[ocr]]></category>
		<category><![CDATA[parquet]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[search]]></category>
		<category><![CDATA[stubborn fanatic]]></category>
		<category><![CDATA[telangana]]></category>
		<guid isPermaLink="false">https://techblog.viveksanghi.com/?p=261</guid>

					<description><![CDATA[<p>I asked my own law database for section 5 of the HMDA Act and it said there was no such section. There is. Building a searchable corpus of Indian statutes and judgments on my own machine, and what auditing it taught me about trusting legal text.</p>
<p>The post <a href="https://techblog.viveksanghi.com/2026/09/building-a-local-indian-law-corpus/">The section that wasn&#8217;t there</a> appeared first on <a href="https://techblog.viveksanghi.com">Stubborn Fanatic - Tech Blog</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p class="wp-block-paragraph">I asked my own law database for section 5 of the Hyderabad Metropolitan Development Authority Act, 2008. It told me there was no such section.</p>



<p class="wp-block-paragraph">There is. It is on the printed page in front of me. The database had the text, all of it, and could not find it, because the text was filed under a different number.</p>



<p class="wp-block-paragraph">This is a post about building a searchable corpus of Indian statutes and case law on my own machine, and about the fact that the dangerous failure is never the database that says nothing. It is the one that answers with confidence and is wrong.</p>



<p class="wp-block-paragraph">I built it over several weeks with Claude. I made the decisions, ran everything on my own hardware, and checked the law myself; the scripts and most of the analysis came from the model. The mistakes are in here as well, because on a project of this shape the mistakes are the content. Nearly every genuine improvement came from something being printed to screen that looked wrong.</p>



<h2 class="wp-block-heading">Why hold law locally at all</h2>



<p class="wp-block-paragraph">I am an advocate. My practice is property, title due diligence, drafting. The work needs the text of statutes, rules, government orders and judgments, constantly, and mostly for a narrow set of jurisdictions: Central Acts, Telangana, and the Andhra Pradesh that Telangana inherited.</p>



<p class="wp-block-paragraph">The obvious answer is a subscription database. They work. But two things pushed me the other way.</p>



<p class="wp-block-paragraph">The first is cost and dependence. The second matters more: I cannot audit what I cannot see inside. When a subscription database returns nothing for a section, I have no way of knowing whether the section does not exist, or whether their ingestion mangled it the way mine mangled HMDA section 5. When my own corpus does that, I can go and look.</p>



<p class="wp-block-paragraph">There is also a speed argument that turns out to be real. Searching a million judgments on my own machine takes about a second.</p>



<h2 class="wp-block-heading">What the corpus is made of</h2>



<p class="wp-block-paragraph">The whole thing lives on a Windows desktop workstation. The pipeline is deliberately dull: scrape original sources, convert to markdown, write parquet, query with DuckDB. No database server, no index server, nothing to keep running. Files on a disk.</p>



<p class="wp-block-paragraph">An early decision shaped everything after it. There is a bulk dataset of Indian legislation on Hugging Face, and I downloaded it. Then I decided not to use it for statutes, and to scrape India Code and the Telangana Law Department fresh instead. Not because the dataset is bad, but because I wanted to know the provenance of every section I might cite, and to be able to go back to the page it came from. I kept the dataset to cross-check against, once.</p>



<p class="wp-block-paragraph">What the Act surface holds today, counted this morning:</p>



<pre class="wp-block-code"><code>58,381 rows across eight parquet files

  India Code       828 Central Acts     35,390 sections
                   112 Telangana Acts    1,542 sections
  Telangana Law Dept   184 Acts
  Schedules            380 Acts          1,484 schedule rows
  Act-level PDFs       452 Acts
      196  Andhra Pradesh, pre-2014, applies in Telangana
      179  Telangana
       56  Andhra Pradesh, post-2014, residuary AP only
       18  Central
  Harvested G.O.s, circulars, orders   757 rows</code></pre>



<p class="wp-block-paragraph">Separately there is a read-only index of my own prior work, so a search can turn up a deed I drafted alongside the section it relied on.</p>



<p class="wp-block-paragraph">That AP split is not decorative. Andhra Pradesh was bifurcated on 2 June 2014, and an AP Act from before that date still applies in Telangana while one from after it does not. Every result line says which, because an Act that does not apply is still an Act, and the distinction has to survive into whatever is filed.</p>



<h2 class="wp-block-heading">Counting is not checking</h2>



<p class="wp-block-paragraph">Here is the mistake that reshaped how I check this corpus.</p>



<p class="wp-block-paragraph">The corpus held the HMDA Act with 58 sections, numbered up to 58. That looks complete. It is not. Sections 5, 6 and 8 were absent, and their text was inside the row filed as section 9, a row that opens with the repeal of a 1988 water-rates ordinance and runs to 10,362 characters, having swallowed several sections that come before it.</p>



<p class="wp-block-paragraph">The cause is visible on the printed page. HMDA prints its section headings as marginal notes, in a column beside the body text. Extract a text layer from that PDF and the headings interleave with the sentences, so <code>5.</code> never begins a line, and a splitter looking for a number at the start of a line never sees one.</p>



<p class="wp-block-paragraph">So I stopped trusting counts and audited numbering continuity instead: for every Act holding eight or more numbered sections, is the run of numbers unbroken?</p>



<p class="wp-block-paragraph">When that ran, on 27 August 2026, it found <strong>1,151 Acts</strong> with eight or more sections and <strong>99 with a gap</strong>. Most gaps are honest: sections repealed, or omitted from the source. But in 38 of them the missing section&#8217;s heading was present <em>inside another row</em>. The text was in the corpus, filed under the wrong number.</p>



<p class="wp-block-paragraph">Re-running the same audit today gives 1,158 Acts and <strong>86 gaps</strong>. The difference is the repair described below.</p>



<p class="wp-block-paragraph">The consequence is worth stating plainly. Full-text search reaches misfiled text without difficulty. It is a lookup by section number that fails, and it fails by reporting that a section does not exist when it does. That is the wrong direction to fail in.</p>



<h2 class="wp-block-heading">repair.py, and five ways it nearly filed the wrong text</h2>



<p class="wp-block-paragraph">Recovering misfiled sections sounds simple: find the missing number used as a heading inside another row, cut from there to the next heading, file it under its own number.</p>



<p class="wp-block-paragraph">It is not simple, and the first version was wrong in five separate ways. All five were found by running it in a sandbox and reading the output before it touched anything.</p>



<p class="wp-block-paragraph"><strong>It missed the section it was written for.</strong> The heading pattern required text to continue on the same line. India Code prints <code>5.</code> alone, with <code>(1) There shall be...</code> on the line below. HMDA section 5, the whole reason the script existed, did not match.</p>



<p class="wp-block-paragraph"><strong>Cuts ran to the end of the host row.</strong> A recovered section 8 swallowed section 9 and everything after it. Cuts now end at the next heading of any number.</p>



<p class="wp-block-paragraph"><strong>Footnotes were recovered as sections.</strong> <code>54. Section 43 substituted by Act No.11 of 1969</code> is a footnote. It looks exactly like a section heading.</p>



<p class="wp-block-paragraph"><strong>Page-group rows were used as hosts.</strong> Where an Act could not be split reliably it is stored as page groups, which contain the entire text, so every number appears in them. Recovering from those produces nonsense.</p>



<p class="wp-block-paragraph"><strong>The same number was recovered from six different rows</strong> of the Wealth-tax Act.</p>



<p class="wp-block-paragraph">The gate that did most of the work is a structural one: a row can only have swallowed sections that <em>precede</em> it. So a recovered number must be lower than its host&#8217;s number and within 40 of it. Without that gate, the Greater Hyderabad Municipal Corporation Act &#8220;recovered&#8221; section 19 out of a row filed as section 687, which is a schedule of cycle-rickshaw fees.</p>



<p class="wp-block-paragraph">Ungated, the pass proposed 34 Acts and 133 sections. Gated, it proposed 23 Acts and 49 sections, and the 23 rejected candidates each carry a stated reason.</p>



<p class="wp-block-paragraph">Today <code>repairs_acts.parquet</code> holds <strong>49 recovered sections across 23 Acts</strong>, each labelled with the row it was cut from and marked medium confidence. It never edits another script&#8217;s file. The recovered rows join the same glob the reader already reads.</p>



<h2 class="wp-block-heading">A correction</h2>



<p class="wp-block-paragraph">An earlier note of mine recorded that the GHMC Act had &#8220;37 of 53 gaps recoverable&#8221;. That was wrong, and it came from a crude heading search with none of the gates above.</p>



<p class="wp-block-paragraph">A properly gated pass recovers <strong>nothing</strong> from GHMC. Its numbering gaps are footnote markers and schedule item numbers, not missing sections. Today the audit still shows GHMC with 635 sections present and 52 numbers missing, and that is the correct answer: they were never sections.</p>



<p class="wp-block-paragraph">I am recording the wrong figure as well as the right one because a corpus you cannot correct in public is a corpus nobody should trust, including you.</p>



<h2 class="wp-block-heading">Heuristics that fail interestingly</h2>



<p class="wp-block-paragraph">Three gates keep schedules and tables out of the recovery pass, and each was calibrated against real documents.</p>



<p class="wp-block-paragraph"><strong>Digit density.</strong> Statutory prose runs 3 to 4 per cent digits. Schedules run 24 per cent and up. The threshold sits at 18. This caught a recovered &#8220;section&#8221; of <strong>247,454 characters</strong> that was the Telangana Panchayat Raj Act&#8217;s schedule of village names.</p>



<p class="wp-block-paragraph"><strong>Line length.</strong> Text laid out as a table puts each field on its own line. Village schedules average 9 characters per line; statutory prose averages 75.</p>



<p class="wp-block-paragraph">That second gate was first set at 28 characters, and it rejected HMDA sections 5 and 8. India Code wraps its prose at about 27, and a section that is a list of committee members has short lines. A threshold tuned on the wrong sample rejected precisely the sections the whole exercise existed to recover. Moved to 15, the pass went from 44 sections to 49, the five additions being HMDA sections 5 and 8, Telangana Municipalities section 32, and two sections of the Telangana State Private Universities Act.</p>



<p class="wp-block-paragraph"><strong>Capture ratio.</strong> Any split that captures under 92 per cent of a document&#8217;s text is rejected in favour of page chunks. This exists because of a specific failure: an Act splitter applied to a Government Order treats the numbered list of earlier G.O.s it cites as the sections. G.O.Ms.No.59 came out as a single &#8220;section 4&#8221; holding 47 per cent of the document, with the abstract and the operative order silently gone. Instruments that are not Acts, Rules or Regulations are no longer split at all.</p>



<h2 class="wp-block-heading">Fifty gigabytes of judgments, and what they do not carry</h2>



<p class="wp-block-paragraph">Judgments come from the open-india-law dataset: <strong>63 parquet files, 53.7 GB</strong>. I hold all of them.</p>



<p class="wp-block-paragraph">The indexed corpus covers the courts that matter to my practice:</p>



<pre class="wp-block-code"><code>  telangana        1,005,147 judgments
  andhra-pradesh     261,778
  supreme-court       37,014</code></pre>



<p class="wp-block-paragraph">Now the part that decides how you use this data. Metadata completeness, measured this morning:</p>



<pre class="wp-block-code"><code>  court            judgments    no citation   no judges
  telangana        1,005,147        100.0%       81.9%
  andhra-pradesh     261,778        100.0%       88.3%
  supreme-court       37,014          0.0%        0.0%</code></pre>



<p class="wp-block-paragraph">Every Supreme Court judgment carries a citation and a bench. <strong>Not one High Court judgment in over 1.26 million carries a citation.</strong> You get the text and the case number and nothing you can put in a plaint.</p>



<p class="wp-block-paragraph">That is not a defect in the dataset so much as a fact about what is freely available, and it changes the workflow rather than ending it. The corpus is where I find the case and read the reasoning. The citation comes from elsewhere, and it comes before anything is filed.</p>



<p class="wp-block-paragraph">The dates need care too. Telangana decision dates in this data run from 23 October 1952 to <strong>27 December 2079</strong>. Twelve judgments are dated in the future. The <code>year</code> column in the Andhra Pradesh file tracks ingestion rather than decision and cannot be used for anything.</p>



<h2 class="wp-block-heading">Which court binds</h2>



<p class="wp-block-paragraph">For a matter in Telangana, a Supreme Court judgment binds, the Telangana High Court binds, and the Andhra Pradesh High Court binds only for the period before bifurcation. Bombay and Madras are persuasive, and worth reading, and they are not the same thing. The distinction has to survive into the document.</p>



<p class="wp-block-paragraph">The dataset splits along that line almost exactly, which was a pleasant surprise:</p>



<pre class="wp-block-code"><code>  telangana, decided before 01.01.2019          707,308
  andhra-pradesh, decided before 01.01.2019       1,011
  andhra-pradesh, decided 01.01.2019 onwards    259,200</code></pre>



<p class="wp-block-paragraph">The <code>in_telangana</code> file is the predecessor court&#8217;s whole corpus going back to 1952. The <code>in_andhra-pradesh</code> file is overwhelmingly the reconstituted court at Amaravati. So the default tier applies a date predicate to the AP file alone, and the binding tier comes to <strong>1,043,172 judgments</strong>. Every result line is labelled BINDING or persuasive, and a binding search says on its face that the other High Courts were not searched.</p>



<p class="wp-block-paragraph">This nearly went wrong in a way worth describing, because it is the most dangerous class of bug in the whole project.</p>



<p class="wp-block-paragraph">DuckDB&#8217;s <code>regexp_extract(string, pattern)</code> returns the <strong>whole match</strong>, not the capture group. The build stored <code>in_telangana_judgments</code> where it meant <code>telangana</code>. Every comparison against a bare court name then failed silently. The effect was that <strong>260,766 post-2019 Amaravati judgments sat in the binding tier, labelled BINDING</strong>, and the authority ranking collapsed to plain date order.</p>



<p class="wp-block-paragraph">Nothing errored. Nothing looked broken. A one-argument mistake quietly relabelled persuasive authority as binding, which in a document going to court is exactly the sort of error you do not get to explain away. The build now passes the group index, and the reader normalises whatever form it finds, so a stale index cannot mislabel authority even if it is rebuilt wrongly.</p>



<h2 class="wp-block-heading">Search without a search engine</h2>



<p class="wp-block-paragraph">The obvious way to search a million judgments is a full-text index. I could not use one, for a reason that is specific and worth explaining, because it shaped the design.</p>



<p class="wp-block-paragraph">The environment Claude reaches my machine through is a small sandbox: 2 CPUs, 3 GB of RAM. My workstation reports 32 CPUs. A full scan of the 9.1 GB binding tier takes seconds on the workstation and over three minutes in the sandbox, which is past the timeout on a single call. DuckDB&#8217;s full-text extension cannot be installed in that sandbox at all: the extension installer has no network route it can use there.</p>



<p class="wp-block-paragraph">So an index that needed the extension would have been unreadable by the one reader that most needed it. The answer was plain sorted parquet, built natively on the fast machine, read cheaply by anything.</p>



<p class="wp-block-paragraph">Four files:</p>



<pre class="wp-block-code"><code>  cases.parquet      one row per judgment            0.05 GB
  text.parquet       chunks, sorted by case          4.24 GB
  vocab.parquet      words and their ids             0.10 GB
  postings.parquet   (token, case, chunk)            0.91 GB
                                            total    5.31 GB</code></pre>



<p class="wp-block-paragraph">Over <strong>1,303,939 judgments</strong>, <strong>15,057,895 distinct indexed words</strong>, and <strong>397,445,969 postings</strong>.</p>



<p class="wp-block-paragraph">Two calibration decisions matter more than the structure.</p>



<p class="wp-block-paragraph"><strong>Minimum word length is 4, not 5.</strong> Sale, deed, gift, rent and lien all carry legal phrases. Three-letter words are lost, so <em>lis pendens</em> is found on <code>pendens</code> alone, which is fine because the rarer half of a phrase does the work.</p>



<p class="wp-block-paragraph"><strong>The commonness cut is 10 per cent, not 1.</strong> Words appearing in more than that share of cases are not indexed, because indexing them costs enormously and narrows nothing. The first threshold chosen was 1 per cent. Measured against 17,684 Supreme Court cases:</p>



<pre class="wp-block-code"><code>  possession      5.3%
  registration    1.9%
  performance     1.8%
  adverse         1.6%
  injunction      1.1%
  mortgage        1.0%</code></pre>



<p class="wp-block-paragraph">A 1 per cent cut would have excluded <strong>every one of them</strong>. It would have produced a technically excellent index, of a corpus of property judgments, that could not search for possession, registration, performance, adverse or mortgage. Only 375 words are common enough to exclude at 10 per cent, and when a search hits one it is reported by name, so a search for &#8220;part performance&#8221; says it searched on <code>performance</code> alone.</p>



<p class="wp-block-paragraph">Matching is by <strong>proximity</strong>, not merely co-occurrence. Postings carry the chunk as well as the case, so intersecting on chunk requires the words to fall within the same passage of roughly 2,000 characters. It does not prove the phrase appears in that order. It is much better than &#8220;both words are somewhere in this judgment&#8221;, and the phrase still has to be confirmed by reading.</p>



<h2 class="wp-block-heading">Three performance facts</h2>



<p class="wp-block-paragraph"><strong>Row group size is the difference between a skip and a scan.</strong> At 50,000 rows per group, each group in <code>text.parquet</code> held about 80 MB of text, so fetching 200 scattered cases decompressed most of the file and took 29 seconds. At 1,000 rows a group is under a megabyte and the reader skips almost everything.</p>



<p class="wp-block-paragraph"><strong>An IN-list of literals is pushed down; a JOIN is not.</strong> The same 200 lookups written as a join against a temporary table read the entire file: 0.1 seconds became over 40.</p>



<p class="wp-block-paragraph"><strong>A warm cache lied to me twice.</strong> Verifying a phrase by reading the text costs about 20 seconds cold, however few cases it asks for, because a 4 GB store cannot stay resident in 3 GB of RAM. Two earlier measurements of 2.5 seconds were a warm cache, and they misled the design twice before the proximity approach removed the need to read text at query time at all.</p>



<p class="wp-block-paragraph">Where it landed, on 2 threads:</p>



<pre class="wp-block-code"><code>  specific performance   1.02s   8,466 cases
  adverse possession     0.91s
  lis pendens            0.85s
  pattadar pass book     0.92s</code></pre>



<p class="wp-block-paragraph">Against over three minutes before any of this.</p>



<p class="wp-block-paragraph">One further thing had to be designed rather than discovered. Ordering strictly by authority, a window on &#8220;specific performance&#8221; returned 400 Supreme Court cases and nothing at all from 11,429 Telangana candidates. Telangana is the court I appear before. Display slots are now shared between courts, allocated smallest tier first so slack flows onward.</p>



<h2 class="wp-block-heading">What I still do not trust</h2>



<p class="wp-block-paragraph">A corpus is only as useful as its own account of where it is weak.</p>



<p class="wp-block-paragraph"><strong>Two Central Acts cannot be completed from India Code.</strong> The Income-tax Act 1961 and the EPF Act 1952. India Code holds no Act-level PDF for them and only a fraction of the sections. Both are fetched separately.</p>



<p class="wp-block-paragraph"><strong>The Hindu Succession (Andhra Pradesh Amendment) Act 1986</strong> matters for coparcenary devolution before 9 September 2005, and the only copy I have is from PRS Legislative Research, which prints its own disclaimer that the text is unverified. It is deliberately kept off the Act surface and findable only in my own-work index. The real text has to come from the Law Department before it is cited.</p>



<p class="wp-block-paragraph"><strong>Every HMDA document arrived over an unvalidated TLS connection.</strong> All 75 are stamped <code>tls=unverified</code>, because hmda.gov.in&#8217;s certificate chain does not validate. They are usable and they are flagged, and any one of them is checked against the browser copy before it is cited.</p>



<p class="wp-block-paragraph"><strong>OCR misreads digits.</strong> 522 scanned PDFs, 6,738 pages, English and Telugu, banded 222 high confidence, 193 medium, 107 low. A document number came back as <code>NO,P 2418/2013-14</code>. Any survey number, extent or consideration taken from OCR text is checked against the original PDF. Results drawn from OCR print a warning saying so. And the opening pages of a registered deed are the stamp paper, which OCRs as ornament noise, so an OCR&#8217;d deed is judged by its body and not its first lines.</p>



<p class="wp-block-paragraph"><strong>Some sources cannot be harvested at all.</strong> The CCLA site renders a page header and stops: <code>viewActs.do</code>, <code>viewGO.do</code> and <code>viewCirculars.do</code> each return two links and no table. That is not a selector problem, the pages are empty. And <code>goir.telangana.gov.in</code> is an ASP.NET WebForms application with view-state and cascading postbacks, where a result set only exists after a POST carrying the view-state the server has just issued. A listing-page harvester cannot touch it.</p>



<p class="wp-block-paragraph"><strong>A naming rule learned the hard way.</strong> A document&#8217;s title becomes its act name, and lookups match that name loosely. A document titled &#8220;Registration Rules, Telangana — rules under the Registration Act, 1908&#8221; shadowed the Registration Act itself, so asking for section 49 of the Registration Act returned rule 49 instead of section 49, which is the provision on the effect of non-registration. A title must never contain another instrument&#8217;s name.</p>



<p class="wp-block-paragraph"><strong>And one Act answers twice, by design.</strong> HMDA section 5 exists in the corpus in two forms: the Act as originally enacted, naming APIIC, APHB and APSRTC, hand-read by me from printed pages; and the India Code text as adapted for Telangana by G.O.Ms.No.45, Law (F) Department, dated 1 June 2016, naming TSIIC, the Telangana Housing Board and TSTRANSCO. Both are correct. For the composition of the Executive Committee as it stands today, the adapted text governs.</p>



<h2 class="wp-block-heading">What this is actually for</h2>



<p class="wp-block-paragraph">It is not a product and I am not proposing that anyone else run one. It is a tool with a known shape, whose weaknesses are written down where I can see them, which answers in about a second, and which does not stop working if a subscription lapses or a website is redesigned.</p>



<p class="wp-block-paragraph">The thing I did not expect was how much of the work would be auditing rather than building. The scraping was a weekend. The gates, the calibration, the gap analysis, the five defects in the recovery pass and the one-argument bug that mislabelled a quarter of a million judgments as binding — that was the actual project.</p>



<p class="wp-block-paragraph">Which brings it back to HMDA section 5. It was in the corpus the whole time. The lesson is not that the pipeline was bad. It is that a lookup which answers &#8220;no such section&#8221; and a lookup which answers &#8220;here is section 5&#8221; can both be produced by a database that holds the same bytes, and the only thing standing between them is whether anyone checked.</p>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h2 class="wp-block-heading">Glossary</h2>



<p class="wp-block-paragraph">This post has two audiences, and each will find half of it obvious. The terms below are defined in the order they appear, on the assumption that no reader knows both halves.</p>



<p class="wp-block-paragraph"><strong>Act surface</strong> — my term for the set of files a section lookup searches, as distinct from the full-text library. A document promoted to the Act surface can be asked for by section number. One left in the library can only be found by searching its words.</p>



<p class="wp-block-paragraph"><strong>Parquet</strong> — a file format for storing tables in columns rather than rows, compressed, with statistics recorded for blocks of rows. A reader can consult those statistics and skip blocks that cannot contain what it wants, without decompressing them.</p>



<p class="wp-block-paragraph"><strong>Row group</strong> — a block of rows inside a parquet file, and the unit that a reader skips or reads. Their size is a design decision, discussed above.</p>



<p class="wp-block-paragraph"><strong>DuckDB</strong> — a database engine that runs inside your program rather than as a server, and reads parquet files directly from disk. No installation to maintain, no daemon running.</p>



<p class="wp-block-paragraph"><strong>Predicate pushdown</strong> — the behaviour that makes the above work: the filter is handed down to the file reader so it can skip data, instead of the reader returning everything and the filter discarding most of it afterwards. An IN-list of literal values is pushed down. A join against another table generally is not.</p>



<p class="wp-block-paragraph"><strong>Full-text index / FTS</strong> — the conventional machinery for searching text at speed, usually a database extension. Not used here, for the sandbox reasons set out above.</p>



<p class="wp-block-paragraph"><strong>Vocabulary and postings</strong> — the two halves of any word index. The vocabulary maps each word to a number. The postings list records, for each word number, where it occurs. Searching is intersecting postings lists.</p>



<p class="wp-block-paragraph"><strong>Posting</strong> — one entry in that list. Here each posting is a triple of word, case and chunk, which is what makes proximity matching possible.</p>



<p class="wp-block-paragraph"><strong>Chunk</strong> — a passage of a judgment, roughly 2,000 characters. Judgments are stored in chunks so that &#8220;these two words appear in the same chunk&#8221; can stand in for &#8220;these two words appear near each other&#8221;.</p>



<p class="wp-block-paragraph"><strong>Proximity matching</strong> — requiring search terms to fall within the same chunk, rather than merely somewhere in the same document. It does not prove the words appear as a phrase in that order.</p>



<p class="wp-block-paragraph"><strong>MINLEN</strong> — the shortest word the index will store. Set to 4 here.</p>



<p class="wp-block-paragraph"><strong>Commonness cut</strong> — the share of documents above which a word is too common to be worth indexing. Set to 10 per cent here, for the reasons measured above.</p>



<p class="wp-block-paragraph"><strong>OCR</strong> — optical character recognition, deriving text from a scanned image. Reliable for prose, unreliable for digits, which is why numbers taken from OCR are checked against the original.</p>



<p class="wp-block-paragraph"><strong>Text layer</strong> — the machine-readable text embedded in a PDF. A PDF produced from a word processor has a good one. A PDF that is a photograph of a page has none, and needs OCR.</p>



<p class="wp-block-paragraph"><strong>Marginal note</strong> — a section heading printed in the margin beside the body text rather than above it. The cause of the HMDA failure: in the text layer the marginal notes interleave with the sentences.</p>



<p class="wp-block-paragraph"><strong>Splitter</strong> — the code that divides a statute into its sections. Most of the failures described here are splitter failures.</p>



<p class="wp-block-paragraph"><strong>Page group</strong> — the fallback when a document cannot be split reliably: it is stored as groups of pages, flagged as unsplit, rather than given section numbers that might be wrong.</p>



<p class="wp-block-paragraph"><strong>Capture ratio</strong> — the proportion of a document&#8217;s text that a split accounts for. Below 92 per cent the split is rejected, so no document can silently lose text.</p>



<p class="wp-block-paragraph"><strong>Digit density</strong> — the proportion of characters in a block that are digits. Prose runs 3 to 4 per cent, schedules 24 per cent and up.</p>



<p class="wp-block-paragraph"><strong>Harvester</strong> — the script that fetches documents from government websites, driven by a manifest describing each source, rather than a separate scraper per site.</p>



<p class="wp-block-paragraph"><strong>Manifest</strong> — the configuration file listing each source, its pages, and how to treat what it returns.</p>



<p class="wp-block-paragraph"><strong>G.O.</strong> — Government Order. A departmental instrument. G.O.Ms. is an Ordinary Order; the number and date identify it.</p>



<p class="wp-block-paragraph"><strong>India Code</strong> — the Government of India&#8217;s official repository of Central and State legislation.</p>



<p class="wp-block-paragraph"><strong>Bifurcation</strong> — the division of Andhra Pradesh on 2 June 2014, creating Telangana. An Andhra Pradesh Act from before that date continues to apply in Telangana; one from after it does not.</p>



<p class="wp-block-paragraph"><strong>Binding and persuasive</strong> — a judgment of a court above you in your own hierarchy binds. A judgment of a court of equal standing elsewhere is persuasive: worth reading, worth citing, but it does not compel a result.</p>



<p class="wp-block-paragraph"><strong>Pattadar pass book</strong> — the Telangana land record document evidencing a cultivator&#8217;s rights. Used above as a search example because it is a phrase of exactly the shape this index handles well.</p>



<p class="wp-block-paragraph"><strong>Coparcenary</strong> — in Hindu law, the body of family members who take an interest in ancestral property by birth. Relevant here because devolution before 9 September 2005 turns on statutory amendments that must be sourced accurately.</p>



<p class="wp-block-paragraph"><strong>Sandbox</strong> — the constrained environment the AI assistant reaches my machine through: 2 CPUs, 3 GB of RAM, restricted network. Several design decisions exist only because of it.</p>



<p class="wp-block-paragraph"><strong>TLS validation</strong> — the check that a website&#8217;s certificate chains to a trusted authority. <code>tls=unverified</code> on a stored document means the download was made without that check succeeding, and the document should be confirmed against the browser copy before it is relied upon.</p>

<p>The post <a href="https://techblog.viveksanghi.com/2026/09/building-a-local-indian-law-corpus/">The section that wasn&#8217;t there</a> appeared first on <a href="https://techblog.viveksanghi.com">Stubborn Fanatic - Tech Blog</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://techblog.viveksanghi.com/2026/09/building-a-local-indian-law-corpus/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">261</post-id>	</item>
		<item>
		<title>A parse error, a stalled upgrade, and fifteen years of silence</title>
		<link>https://techblog.viveksanghi.com/2026/09/parse-error-stalled-upgrade-fifteen-years-of-silence/</link>
					<comments>https://techblog.viveksanghi.com/2026/09/parse-error-stalled-upgrade-fifteen-years-of-silence/#respond</comments>
		
		<dc:creator><![CDATA[Vivek Sanghi]]></dc:creator>
		<pubDate>Thu, 03 Sep 2026 19:29:58 +0000</pubDate>
				<category><![CDATA[blogging]]></category>
		<category><![CDATA[software]]></category>
		<category><![CDATA[sysadmin]]></category>
		<category><![CDATA[wordpress]]></category>
		<category><![CDATA[ai assisted]]></category>
		<category><![CDATA[debugging]]></category>
		<category><![CDATA[dreamhost]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[restore]]></category>
		<category><![CDATA[stubborn fanatic]]></category>
		<category><![CDATA[wp-cli]]></category>
		<guid isPermaLink="false">https://techblog.viveksanghi.com/?p=254</guid>

					<description><![CDATA[<p>My tech blog died in 2011. A stalled WordPress 3.2 upgrade, then a PHP 7 parse error that had been repeating in the logs ever since. What the restore turned up, and the four bugs in the script meant to fix it.</p>
<p>The post <a href="https://techblog.viveksanghi.com/2026/09/parse-error-stalled-upgrade-fifteen-years-of-silence/">A parse error, a stalled upgrade, and fifteen years of silence</a> appeared first on <a href="https://techblog.viveksanghi.com">Stubborn Fanatic - Tech Blog</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p class="wp-block-paragraph">I knew this site was broken. I did not know for how long, or why, and for years I did not look. It sat at techblog.viveksanghi.com returning nothing, and every year that passed made it a slightly larger thing to open.</p>



<p class="wp-block-paragraph">When I finally opened it, the server turned out to have been keeping a precise record of what happened.</p>



<p class="wp-block-paragraph">I did the work over one evening with Claude, which matters to how this reads. I made the decisions and ran every command on my own server; the diagnosis, the scripts and several confident wrong turns came from the model. The wrong turns are in here too, because they were the useful part. Tech is a hobby for me. Law is what earns my living, and a fifteen-year-old broken WordPress had long since stopped being a thing I could justify an evening on. Having something that would grind through log files and SQL dumps without getting bored changed that arithmetic.</p>



<h2 class="wp-block-heading">What the server was saying</h2>



<p class="wp-block-paragraph">The first question was whether anything was alive at all. The domain resolved to my host&#8217;s IP, same as my other sites, so DNS was fine. HTTPS failed on a certificate error. Over plain HTTP I got a 301 to the www hostname, then a 500 Internal Server Error with an empty response body.</p>



<p class="wp-block-paragraph">An empty 500 is a particular kind of unhelpful. No error on the page, no stack trace, nothing to search for. It means PHP died before producing output, with <code>display_errors</code> off, which on a production host it should be.</p>



<p class="wp-block-paragraph">The useful clue came from the access log rather than the error log:</p>



<pre class="wp-block-code"><code>2026-09-02 21:24:28   200   /favicon.ico</code></pre>



<p class="wp-block-paragraph">A 200. Static files were being served. That one line rules out most of what an empty 500 can mean. Apache was healthy, the virtual host was configured, the document root pointed at the right folder. Only PHP was dying.</p>



<p class="wp-block-paragraph">Which meant anything on the site that was not PHP could still be read. So we asked for the file every WordPress install ships and nobody ever deletes:</p>



<pre class="wp-block-code"><code>curl http://techblog.viveksanghi.com/readme.html</code></pre>



<pre class="wp-block-code"><code>Version 3.1.2
Semantic Personal Publishing Platform</code></pre>



<p class="wp-block-paragraph">WordPress 3.1.2, released April 2011.</p>



<h2 class="wp-block-heading">The one-line cause</h2>



<p class="wp-block-paragraph">The error log had been recording the same entry for years:</p>



<pre class="wp-block-code"><code>[techblog.viveksanghi.com] [warn] mod_fcgid: stderr: PHP Parse error:
syntax error, unexpected token &quot;new&quot; in
/home/&lt;user&gt;/techblog.viveksanghi.com/wp-settings.php on line 219</code></pre>



<p class="wp-block-paragraph">Line 219 of WordPress 3.1.2 reads:</p>



<pre class="wp-block-code"><code>$wp_the_query =&amp; new WP_Query();</code></pre>



<p class="wp-block-paragraph">That <code>=&</code> is assignment by reference to a newly created object. It was correct in PHP 4, where objects were copied on assignment and the reference avoided the copy. PHP 5 made objects handle-based and the construction became pointless. It was deprecated in PHP 5.3 and removed in PHP 7.0.</p>



<p class="wp-block-paragraph">Removed, not deprecated. In PHP 7 and later this is not a warning or a runtime error. It is a parse error. PHP refuses to compile the file, so nothing in it executes, no error handler runs, no output is produced, and Apache has nothing to return but a bare 500.</p>



<p class="wp-block-paragraph">The site did not break from anything I did. It broke when my host moved past PHP 5, and it has been serving 500s to search engines and bots ever since.</p>



<p class="wp-block-paragraph">Could it be patched? The construction appears <strong>252 times</strong> across WordPress core. PHP stops at the first one, but fixing that line only exposes the next. This is not a bug you repair. It is a language incompatibility, and the only answer is a newer WordPress.</p>



<h2 class="wp-block-heading">The timestamp in the root directory</h2>



<p class="wp-block-paragraph">Sitting in the web root was a file called <code>.maintenance</code>, containing one line:</p>



<pre class="wp-block-code"><code>&lt;?php $upgrading = 1309848013; ?&gt;</code></pre>



<p class="wp-block-paragraph">WordPress writes that file when it begins a core update and deletes it when the update finishes. This one was never deleted.</p>



<p class="wp-block-paragraph">That Unix timestamp is <strong>05/07/2011, 06:40 UTC</strong>.</p>



<p class="wp-block-paragraph">WordPress 3.2 was released on 04/07/2011. Alongside <code>.maintenance</code> were two directories in <code>wp-content</code> called <code>wordpress-3.tmp</code> and <code>wordpress-31.tmp</code>, the staging folders the updater uses while unpacking.</p>



<p class="wp-block-paragraph">So: the day after 3.2 came out, I clicked update. It stalled. It left the lock file, the temp directories, and a site still running 3.1.2.</p>



<p class="wp-block-paragraph">The lock file did no harm. WordPress ignores a <code>.maintenance</code> older than ten minutes, a sensible piece of defensive design and the reason the site kept serving afterwards. But it dates the incident to the minute.</p>



<p class="wp-block-paragraph">What the logs cannot tell you is what the site looked like when it stopped.</p>



<p class="wp-block-paragraph">It was running Grid Focus, a theme I had modified by hand over several years until not much of the original remained, with a stack of plugins I had chosen one at a time. The update took it down. I troubleshot for a while. Then life happened, and I lost interest the way you do when a thing stops being fun and starts being a chore.</p>



<p class="wp-block-paragraph">So I let it sit. Somewhere between 2020 and 2022 I paid a freelancer on Fiverr to bring it back, and for a while it worked. That did not last either.</p>



<p class="wp-block-paragraph">Both theme folders were still on the server when I finally went looking. <code>grid_focus_public</code> and <code>gridfocus-v1.5.1b</code>, sitting among fifty other themes I had collected and forgotten, exactly where I left them in 2011.</p>



<h2 class="wp-block-heading">Five years of nobody noticing</h2>



<p class="wp-block-paragraph">The site did not go down in 2011. It went stale in 2011 and died some years later when PHP moved on. The first half is provable.</p>



<p class="wp-block-paragraph">An old <code>wp-dbmanager</code> install had been taking weekly database backups and leaving them in <code>wp-content</code>. There were 134 of them, 2.7 GB in total, running from 29/05/2011 to 31/07/2016.</p>



<p class="wp-block-paragraph">Comparing the oldest against the newest, by table:</p>



<pre class="wp-block-code"><code>techblog_..._20110612.sql   posts: 274,916 bytes   comments: 370,174 bytes
techblog_..._20160731.sql   posts: 274,916 bytes   comments: 370,174 bytes</code></pre>



<p class="wp-block-paragraph">Byte for byte identical. Not a single post or comment changed between June 2011 and July 2016. The blog stopped in 2011 and the backups kept copying the same corpse every Sunday until they stopped too.</p>



<p class="wp-block-paragraph">But the dumps grew from 1.4 MB to 37 MB over those years. Something was expanding. Breaking the 2016 file down by table:</p>



<pre class="wp-block-code"><code>12,549,505  wp_usermeta
   370,174  wp_comments
   342,650  wp_options
   274,916  wp_posts
    79,785  wp_postmeta</code></pre>



<p class="wp-block-paragraph">Twelve and a half megabytes of user metadata against 275 KB of actual writing, reaching about 35 MB by the final backups. Open registration on an unpatched WordPress 3.1.2, and five years of bots signing up. The comments stayed clean, which I put down to Akismet and the captcha plugin, though I cannot prove that from the data. Nothing at all was guarding the registration form.</p>



<p class="wp-block-paragraph">Ninety per cent of my database was junk accounts.</p>



<h2 class="wp-block-heading">Deciding not to repair</h2>



<p class="wp-block-paragraph">Reviving the 3.1.2 install was never really available. There is no supported upgrade path across fifteen years, and the parse error fires before WordPress prints a byte, so I could not reach an admin screen to start one.</p>



<p class="wp-block-paragraph">Rebuilding felt right for a less technical reason. The install carried 44 plugins and 51 themes. Among the plugins were <code>disable-wordpress-core-update</code> and <code>disable-wordpress-plugin-updates</code>, which explains a good deal about why it was still on 3.1.2. Copies of <code>wordpress-28.zip</code> through <code>wordpress-284.zip</code> sat in <code>wp-content</code>, publicly readable. There was a <code>forum</code> directory, empty, and two bbPress integration plugins pointing at it.</p>



<p class="wp-block-paragraph">A WordPress 3.1.2 install had been exposed to the open internet for roughly eight years before PHP killed it, and that version has a long published list of vulnerabilities. There is an irony worth sitting with: the parse error that took the site down has probably been protecting it since about 2019.</p>



<p class="wp-block-paragraph">So: current WordPress, content carried across, nothing else.</p>



<h2 class="wp-block-heading">Getting the content out</h2>



<p class="wp-block-paragraph">The live database was reachable but not trustworthy, and I had 134 dumps provably unchanged since 2011. We took the last one and parsed it directly rather than restoring it anywhere.</p>



<p class="wp-block-paragraph">Two things came out of that which looking at the site would never have shown.</p>



<p class="wp-block-paragraph"><strong>The comments were duplicated.</strong> The table held 840. After normalising whitespace and stripping tags, only 606 were distinct. 234 were exact duplicates of another comment on the same post by the same author, each pair differing only in whether the <code><br /></code> tags had survived:</p>



<pre class="wp-block-code"><code>id=7    2006-09-06 16:54   &#x27;Thanks for viewing my Blog. Well... I must say...&#x27;
id=505  2006-09-06 11:24   &#x27;Thanks for viewing my Blog. Well... I must say...&#x27;</code></pre>



<p class="wp-block-paragraph">The second copies sit in a contiguous block of IDs above 500. The database name pointed to Blogger, and the install had a <code>blogger-blogspot-redirect</code> plugin. A Blogger import run twice in 2006, once preserving HTML and once stripping it. Twenty years, and I never noticed, because on the page a duplicate comment just looks like somebody posting twice.</p>



<p class="wp-block-paragraph"><strong>The spam was not where anyone expected.</strong> Given the state of the usermeta table, the assumption was that comments would be full of pharma and casino links. A pattern search for the usual vocabulary returned zero matches. The volume by year decays the way real traffic does, 571 in 2006, 208 in 2007, then single and double digits as the blog went quiet, rather than flooding the way a farmed table does.</p>



<p class="wp-block-paragraph">The first attempt to find spam scored comments by link density. On a blog about Blogger and WordPress hacks that is a terrible signal, and it flagged 43 comments, most of them my own replies containing four or five links to code examples. Claude had produced that heuristic, run it, looked at the output and thrown it away unprompted, which was the right call and not one I would have caught if it had not shown me the list.</p>



<p class="wp-block-paragraph">The second pass went by author name and destination domain and found the real thing: thirteen keyword-anchor link drops, the kind where the author name is the product. &#8220;Mens Suit&#8221; linking to a suit retailer. &#8220;Website Design Atlanta&#8221;, three times. &#8220;beats for sale&#8221;. &#8220;laptop battery&#8221;. Short, on-topic enough, easy to approve by accident in 2010.</p>



<p class="wp-block-paragraph">That left 593 comments, all genuine, threading intact.</p>



<p class="wp-block-paragraph">There was also a post dated 26/12/2020 in a database dumped in 2016. A draft whose <code>post_date</code> carried a mistyped year, its <code>post_modified</code> correctly reading 27/12/2010. It had been sitting ten years in the future for a decade.</p>



<h2 class="wp-block-heading">What the rehearsal caught</h2>



<p class="wp-block-paragraph">Rather than trust the import, we rehearsed it: MariaDB and WP-CLI in a throwaway container, the same WordPress version, a replica of the uploads folder, the real import file.</p>



<p class="wp-block-paragraph">Every expected number came back right except one. <strong>Attachments came out as zero instead of eighteen.</strong></p>



<p class="wp-block-paragraph">The WordPress importer does not simply create attachment records. For each attachment it <em>downloads</em> the file from the URL in <code>wp:attachment_url</code>. In the container that URL was unreachable, so every attachment failed silently.</p>



<p class="wp-block-paragraph">On a real server it is worse than a clean failure. The URL points at the site being restored, over HTTPS, at a moment when the certificate has not been issued. And if the download does succeed, it writes a second copy of every file beside the ones already sitting in <code>wp-content/uploads</code>.</p>



<p class="wp-block-paragraph">The fix is to tell it not to:</p>



<pre class="wp-block-code"><code>wp import export.xml --authors=create --skip=attachment</code></pre>



<p class="wp-block-paragraph">and then register the files already on disk, in place:</p>



<pre class="wp-block-code"><code>find wp-content/uploads -type f \( -iname &#x27;*.jpg&#x27; -o -iname &#x27;*.gif&#x27; \) \
  | grep -vE -- &#x27;-[0-9]+x[0-9]+\.[A-Za-z]+$&#x27; \
  | while read -r f; do wp media import &quot;$f&quot; --skip-copy; done</code></pre>



<p class="wp-block-paragraph">The <code>grep -v</code> matters. Of 56 files in the uploads folder, 36 were WordPress&#8217;s own generated thumbnails. Without that filter every <code>-150x150</code> crop becomes its own media library entry.</p>



<p class="wp-block-paragraph">Nobody would have found this by reading the script. It appeared only by running the whole thing end to end against a real database.</p>



<h2 class="wp-block-heading">Four ways the deploy script was wrong</h2>



<p class="wp-block-paragraph">This is the part I would not have predicted before the evening started. The script that rebuilt the site was written for me to paste into an SSH session, and it had to be fixed four times before it ran clean. Every failure was caught by the script&#8217;s own preflight, before anything on my server was touched.</p>



<p class="wp-block-paragraph"><strong><code>getent</code> does not exist on my host&#8217;s shell.</strong> The DNS check used it. The script would have aborted in preflight with a confusing error. Replaced with a PHP lookup, since PHP is guaranteed present there.</p>



<p class="wp-block-paragraph"><strong><code>pipefail</code> and <code>head</code> do not mix.</strong> The script ran <code>wp --info | head -3</code>. <code>head</code> closes the pipe after three lines, <code>wp</code> gets SIGPIPE and exits 141, and <code>set -o pipefail</code> with <code>set -e</code> turns that into a silent abort. The three lines of output on my screen were the last thing the script printed before killing itself, and the failure looked like nothing at all.</p>



<p class="wp-block-paragraph"><strong>A <code>$</code> in a password.</strong> My admin password was randomly generated and contained a dollar sign. Inside double quotes bash reads a <code>$</code> followed by a digit or a name as a parameter; this one did not exist, and <code>set -u</code> correctly aborted. The config block now uses single quotes.</p>



<p class="wp-block-paragraph"><strong><code>--raw</code> wrote an undefined constant.</strong> This one actually reached my server. The script ran <code>wp config set WP_AUTO_UPDATE_CORE minor --raw</code>, which writes <code>define('WP_AUTO_UPDATE_CORE', minor);</code> without quotes. In PHP 8 an undefined constant is a fatal error, so WordPress could not load at all, and the script reported it as &#8220;cannot reach the database&#8221; — which was wrong and sent me looking in the wrong place.</p>



<p class="wp-block-paragraph">There was a fifth, structural, caught before I ran anything: the original script tested the database connection <em>after</em> renaming my site directory. If the database had been unreachable, it would have moved my entire site aside and then died. That ordering was reversed so every destructive step sits behind a check that has already passed.</p>



<p class="wp-block-paragraph">I record these because the honest version of &#8220;an AI helped me fix my site&#8221; includes the four times it handed me something broken. What made it work was not that the output was right first time. It was that each failure was cheap, legible, and caught before it cost anything.</p>



<h2 class="wp-block-heading">The redirect loop I caused myself</h2>



<p class="wp-block-paragraph">With WordPress installed and content imported, the site returned a redirect loop. <code>techblog.viveksanghi.com</code> redirected to <code>www.techblog.viveksanghi.com</code>, which redirected straight back, forever.</p>



<p class="wp-block-paragraph">We assumed the host was misconfigured. I opened a support ticket saying so. One command showed we were half wrong:</p>



<pre class="wp-block-code"><code>curl -sI http://techblog.viveksanghi.com/readme.html      → 301
curl -sI http://www.techblog.viveksanghi.com/readme.html  → 200 OK</code></pre>



<p class="wp-block-paragraph">A static file that exists on disk gets redirected at the bare hostname and served at www. That first redirect happens above <code>.htaccess</code>, in the host&#8217;s virtual host configuration, and nothing on my side could override it. That half was the host&#8217;s, and they removed it inside a couple of hours when asked properly.</p>



<p class="wp-block-paragraph">The second redirect was mine. Static files at www served fine and only WordPress-handled paths bounced. That is <code>redirect_canonical</code> doing its job, because <code>siteurl</code> and <code>home</code> were set to the bare hostname while the server was serving www. Each half behaved correctly. Together they were an infinite loop.</p>



<p class="wp-block-paragraph">Testing a static file rather than the homepage is what separated them. On the homepage both redirects are in play and the trace tells you nothing about which layer owns which. I cancelled the first ticket and filed a more accurate one.</p>



<h2 class="wp-block-heading">What I would tell someone with a site in this state</h2>



<p class="wp-block-paragraph"><strong>Test a static file first.</strong> Whether <code>readme.html</code> serves tells you in one request whether the web server is broken or only PHP is. Almost everything that followed came out of that one 200.</p>



<p class="wp-block-paragraph"><strong>The error log is the whole answer, and it is not in the panel.</strong> The hosting control panel showed access logs and traffic graphs for days. The actual parse error, repeating identically for years, was in a file on disk.</p>



<p class="wp-block-paragraph"><strong>Check whether your content changed before you value your backups.</strong> 134 weekly backups sound like excellent hygiene. Comparing the first against the last showed 134 copies of the same 2011 content, with only the spam growing. Backup count measures nothing.</p>



<p class="wp-block-paragraph"><strong>Rehearse the restore.</strong> A throwaway database and a full dry run took under an hour and caught a defect that would have cost the entire media library, silently, with a success message.</p>



<p class="wp-block-paragraph"><strong>Suspect your own configuration before your host&#8217;s.</strong> I was three quarters of the way to blaming my host for a redirect loop I had created myself.</p>



<p class="wp-block-paragraph"><strong>If you are working with a model, make it show you its output, not just its conclusions.</strong> Every one of the four script defects and the bad spam heuristic surfaced because something got printed and looked wrong. None of them surfaced from reading the code.</p>



<p class="wp-block-paragraph">The site is back. Seventy-five posts, 17/04/2006 to 25/05/2011, and 593 comments, on WordPress 7.1 with a clean database and no plugins carried across.</p>



<p class="wp-block-paragraph">Sixty-eight images in the older posts still point at <code>photos1.blogger.com</code> and the <code>bp1</code> to <code>bp3</code> hosts, which Google retired years ago. Those have been broken far longer than the site was, and there is nothing left to restore them from. I am inclined to leave them, with a note. A blog that ran from 2006 should be allowed to show its age somewhere.</p>

<p>The post <a href="https://techblog.viveksanghi.com/2026/09/parse-error-stalled-upgrade-fifteen-years-of-silence/">A parse error, a stalled upgrade, and fifteen years of silence</a> appeared first on <a href="https://techblog.viveksanghi.com">Stubborn Fanatic - Tech Blog</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://techblog.viveksanghi.com/2026/09/parse-error-stalled-upgrade-fifteen-years-of-silence/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">254</post-id>	</item>
		<item>
		<title>ipad 2 – My App List and usage in India</title>
		<link>https://techblog.viveksanghi.com/2011/05/ipad-2-my-app-list-and-usage-in-india/</link>
		
		<dc:creator><![CDATA[Vivek Sanghi]]></dc:creator>
		<pubDate>Wed, 25 May 2011 09:46:35 +0000</pubDate>
				<category><![CDATA[apple]]></category>
		<category><![CDATA[ipad]]></category>
		<guid isPermaLink="false">https://techblog.viveksanghi.com/?p=219</guid>

					<description><![CDATA[<p>Hi, seems like an eternity has passed since my last post. However I was really away from the tech world building a career for my self. While I am still engaged in a business of my own, I did want to write today. It&#8217;s been over a month and a half since I have been [&#8230;]</p>
<p>The post <a href="https://techblog.viveksanghi.com/2011/05/ipad-2-my-app-list-and-usage-in-india/">ipad 2 &#8211; My App List and usage in India</a> appeared first on <a href="https://techblog.viveksanghi.com">Stubborn Fanatic - Tech Blog</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>Hi, seems like an eternity has passed since my last post. However I was really away from the tech world building a career for my self. While I am still engaged in a business of my own, I did want to write today.</p>
<p>It&#8217;s been over a month and a half since I have been using ipad 2 (3g+wifi 64 GB) here in India. Thankfully I have a good wifi setup at home where I could use and update ipad after my work hours. ipad is an impressive device and very easy to use as well. Once you learn how to get your way around ipad&#8217;s app store, itunes etc you might actually end up spending more time on your ipad and less on your notebook.</p>
<p>I have found ipad to be a great device for almost all basic work such as browsing, sending emails. listening to music, watching movies, videos etc However it isn&#8217;t a great option for reading books, magazines etc. Long periods of reading on ipad are tiring for a couple of reasons:</p>
<p>1. Screen brightness causes eye fatigue<br />
2. ipad is kind of heavy of holding in hand (esp while travelling and in bed) and reading for a long time<br />
3. Lack of a single store or app for meeting all my book/magazine/newspaper reading requirements</p>
<p>However I&#8217;d still give ipad a very high score for all the other things that it can do. Below is a list of various apps I use regularly</p>
<p><strong>Reading</strong></p>
<p>Flipad<br />
Zinio<br />
Kindle<br />
iBooks</p>
<p>&nbsp;</p>
<p><strong>News</strong></p>
<p>CNN<br />
NDTV<br />
TOI (Times of India app)</p>
<p>&nbsp;</p>
<p><strong>Games</strong></p>
<p>Trade Nations<br />
Contract Killer<br />
Can Knockdown<br />
Overkill<br />
tictac free</p>
<p><strong>Video Player</strong></p>
<p>Azul Media Player</p>
<p>&nbsp;</p>
<p><strong>File Transfer</strong></p>
<p>USB Disk<br />
Dropbox</p>
<p>&nbsp;</p>
<p><strong>Fitness</strong></p>
<p>Dailyburn</p>
<p>&nbsp;</p>
<p><strong>Other Apps</strong></p>
<p>Compass<br />
Truphone<br />
xmarks (bookmark synchronization)</p>
<p>Some of these apps esp the games contain in-app purchases and can be pretty addictive.</p>
<p><strong>3G Usage</strong></p>
<p>I have used BSNL 3G on my ipad and found it to be pretty impressive and fast. I had to cut up my regular SIM into a micro SIM and use it on ipad. However, BSNL now offers ipad plans (prepaid and postpaid). Unfortunately pre-paid SIMs for iPad are currently unavailable and post paid as only one plan i.e. Rs 999/- unlimited</p>
<p>Other players such as airtel, Tata Docomo etc do not seem to have any inexpensive data plans for 3g. I hope they come out with some good competitive plans for 3G data users.</p>
<p>The post <a href="https://techblog.viveksanghi.com/2011/05/ipad-2-my-app-list-and-usage-in-india/">ipad 2 &#8211; My App List and usage in India</a> appeared first on <a href="https://techblog.viveksanghi.com">Stubborn Fanatic - Tech Blog</a>.</p>
]]></content:encoded>
					
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">219</post-id>	</item>
		<item>
		<title>Disqus Comment System for WordPress</title>
		<link>https://techblog.viveksanghi.com/2010/03/disqus-comment-system-for-wordpress/</link>
					<comments>https://techblog.viveksanghi.com/2010/03/disqus-comment-system-for-wordpress/#comments</comments>
		
		<dc:creator><![CDATA[Vivek Sanghi]]></dc:creator>
		<pubDate>Wed, 17 Mar 2010 12:43:52 +0000</pubDate>
				<category><![CDATA[social]]></category>
		<category><![CDATA[software]]></category>
		<category><![CDATA[wordpress]]></category>
		<category><![CDATA[comment]]></category>
		<guid isPermaLink="false">https://techblog.viveksanghi.com/?p=214</guid>

					<description><![CDATA[<p>This blog is now using an interesting new comment system called DISQUS. I like Disqus for the following reasons: 1. It allows users to log in via multiple sites such as Twitter, Facebook, Open Id, Yahoo and Disqus itself 2. It allows users to track all their comments made across multiple sites, at a single [&#8230;]</p>
<p>The post <a href="https://techblog.viveksanghi.com/2010/03/disqus-comment-system-for-wordpress/">Disqus Comment System for WordPress</a> appeared first on <a href="https://techblog.viveksanghi.com">Stubborn Fanatic - Tech Blog</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>This blog is now using an interesting new comment system called <a title="DISQUS Comments" href="http://disqus.com/" target="_blank">DISQUS</a>. I like Disqus for the following reasons:</p>
<p>1. It allows users to log in via multiple sites such as Twitter, Facebook, Open Id, Yahoo and Disqus itself</p>
<p>2. It allows users to track all their comments made across multiple sites, at a single place</p>
<p>3. When users manage their comments through Disqus and / or log into Disqus via one of their social networking accounts, the comment they make also gets published in their social networking feed resulting in greater propagation of the source post where the comment was made</p>
<p>4. Incredibly easy and smooth <a href="http://disqus.com/comments/wordpress/" target="_blank">integration</a> with wordpress</p>
<p>The post <a href="https://techblog.viveksanghi.com/2010/03/disqus-comment-system-for-wordpress/">Disqus Comment System for WordPress</a> appeared first on <a href="https://techblog.viveksanghi.com">Stubborn Fanatic - Tech Blog</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://techblog.viveksanghi.com/2010/03/disqus-comment-system-for-wordpress/feed/</wfw:commentRss>
			<slash:comments>4</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">214</post-id>	</item>
		<item>
		<title>bbPress: Installation and Deep Integration with WordPress</title>
		<link>https://techblog.viveksanghi.com/2009/12/bbpress-installation-and-deep-integration-with-wordpress/</link>
					<comments>https://techblog.viveksanghi.com/2009/12/bbpress-installation-and-deep-integration-with-wordpress/#comments</comments>
		
		<dc:creator><![CDATA[Vivek Sanghi]]></dc:creator>
		<pubDate>Sat, 19 Dec 2009 17:00:07 +0000</pubDate>
				<category><![CDATA[bbpress]]></category>
		<category><![CDATA[blogging]]></category>
		<category><![CDATA[software]]></category>
		<category><![CDATA[wordpress]]></category>
		<category><![CDATA[forum]]></category>
		<guid isPermaLink="false">https://techblog.viveksanghi.com/?p=186</guid>

					<description><![CDATA[<p>bbPress is a very easy to use forum or bulletin board software from the creators of wordpress. This article will cover installation of bbpress for a wordpress blog and its deep integration with wordpress blog such that the blog and the forum share common logins, cookies and user databases.</p>
<p>The post <a href="https://techblog.viveksanghi.com/2009/12/bbpress-installation-and-deep-integration-with-wordpress/">bbPress: Installation and Deep Integration with WordPress</a> appeared first on <a href="https://techblog.viveksanghi.com">Stubborn Fanatic - Tech Blog</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>Hello friends. It&#8217;s been a long time since I have posted any new articles here. This is because I have been keeping very busy with my work life and find no time to research and explore blogger/wordpress code.</p>
<p>Recently I learnt about a forum software by name bbpress which can integrate well with wordpress blogs. I decided to squeeze time out of my schedule to try this software and write about it.</p>
<p><a href="https://techblog.viveksanghi.com/wp-content/uploads/2009/12/bbwp.jpg"><img decoding="async" class="aligncenter size-medium wp-image-203" title="bbPress is a forum software launched by makers of wordpress" src="https://techblog.viveksanghi.com/wp-content/uploads/2009/12/bbwp-300x54.jpg" alt="" width="300" height="54" /></a></p>
<p>bbPress is a very easy to use forum or bulletin board software from the creators of wordpress. To quote their website:</p>
<p>&#8220;bbPress is focused on web standards, ease of use, ease of integration, and speed. We’re keeping things as small and light as possible while still allowing for great add-on features through our extensive plugin system.&#8221;</p>
<p>This article will cover installation of bbpress for a wordpress blog and its deep integration with wordpress blog such that the blog and the forum share common logins, cookies and user databases. Make a note of the versions used before you proceed to read the installation/integration tutorial:</p>
<p>bbPress version: 1.0.2<br />
Wordpress version: 2.8.9</p>
<p><strong>bbPress download and server setup</strong></p>
<p>&#8211; As a first step you need to download bbpress from <a title="bbpress download" href="http://bbpress.org/download/" target="_blank">here</a>. Unzip and rename the folder to what ever you like. Whatever name you choose will also become a part of your forum URL in the following format:</p>
<p>&lt;wordpress blog URL&gt;/&lt;bbPress folder name&gt;</p>
<p>&#8211; Now upload this folder under you main wordpress directory on the server where you are hosting your blog. For example, I had renamed my bbPress directory to &#8220;forum&#8221; and uploaded it under the folder techblog.viveksanghi.com on the webserver such that my forum url become:</p>
<p>https://techblog.viveksanghi.com/forum</p>
<p><strong>WordPress Setup</strong></p>
<p><span style="text-decoration: underline;">bbPress Integration Plugin</span></p>
<p>&#8211; Now login into you wordpress admin panel, install the plugin <a title="bbPress Integration plugin for wordpress" href="http://wordpress.org/extend/plugins/bbpress-integration/" target="_blank">bbpress integration</a> into wordpress and activate the plugin. On the plugin’s configuration page enter the URL of your bbpress forum which will be in the following format as already explained earlier:</p>
<p>&lt;yourblog URL&gt;/&lt;bbpress folder name&gt;.</p>
<p><a href="https://techblog.viveksanghi.com/wp-content/uploads/2009/12/bbintegration-wpplugin.jpg" target="_blank"><img decoding="async" class="aligncenter size-medium wp-image-188" title="click to view an enlarged image" src="https://techblog.viveksanghi.com/wp-content/uploads/2009/12/bbintegration-wpplugin-300x108.jpg" alt="" width="300" height="108" /></a></p>
<p>Do not change anything else and hit the save button. Scroll down on the same page and you will be shown some code that you need to enter into your wordpress config file. Make a note of this code as we will require it in the next step.</p>
<p><span style="text-decoration: underline;">WordPress Config</span></p>
<p>&#8211; Apart from the above-mentioned piece of code from the previous step, there are some additional changes that you need to make to your wordpress config file. Let’s looks are what additions are to be made to the wordpress configuration file. Download and edit your wordpress config file. This will be located under your main wordpress folder by the name <em>wp-config.php</em></p>
<p>You have to enter the following values in the wp-config.php file:</p>
<p>AUTH_KEY<br />
SECURE_AUTH_KEY<br />
LOGGED_IN_KEY</p>
<p>Go <a title="Generate random Secret keys" href="http://api.wordpress.org/secret-key/1.1/" target="_blank">here</a> to generate complex keys for the above mentioned items. Then paste these keys in the wp-config.php file as shown below:</p>
<p><a href="https://techblog.viveksanghi.com/wp-content/uploads/2009/12/wp-config-01.jpg"><img fetchpriority="high" decoding="async" class="aligncenter size-medium wp-image-195" title="wp-config-01" src="https://techblog.viveksanghi.com/wp-content/uploads/2009/12/wp-config-01-300x209.jpg" alt="" width="300" height="209" /></a></p>
<p>Also paste the code we generated earlier from the bbpress integration plugin of wordpress as shown in the image above.</p>
<p>Now its time to start your bbPress installation. However make sure to have the following details about your wordpress database handy as we will use the same database for wordpress and bbpress.</p>
<p>&#8211; WordPress database name<br />
&#8211; WordPress database hostname (Note that it will not be “localhost” if you are hosting on dreamhost or other such hosting site)<br />
&#8211; WordPress database username<br />
&#8211; WordPress database password<br />
&#8211; WordPress table prefix</p>
<p>In case you are new to using databases and/or are not sure where to find the above mentioned details, then you might want to install the <a title="WP DB Manager" href="http://wordpress.org/extend/plugins/wp-dbmanager/" target="_blank">WP-DBManager</a> plugin in wordpress and should be able to view all these above details from within wordpress.</p>
<p>Once these details are ready, you may start the installation by proceeding to the following link:</p>
<p>[your bbPress forum URL]/bb-admin/options-wordpress.php</p>
<p><strong>Step 1 – Database configuration</strong></p>
<p>First you will be presented with the following screen:</p>
<p><a href="https://techblog.viveksanghi.com/wp-content/uploads/2009/12/bbpress-step01-01.jpg"><img loading="lazy" decoding="async" class="aligncenter size-medium wp-image-190" title="Click on the image to view an enlarged image" src="https://techblog.viveksanghi.com/wp-content/uploads/2009/12/bbpress-step01-01-300x210.jpg" alt="" width="300" height="210" /></a></p>
<p>Now enter the database details you collated earlier, as shown in the image below. You may also use the question mark symbols to learn more about each of these fields.</p>
<p><a href="https://techblog.viveksanghi.com/wp-content/uploads/2009/12/bbpress-step01-02.jpg"><img loading="lazy" decoding="async" class="aligncenter size-medium wp-image-191" title="Click on the image to view an enlarged image" src="https://techblog.viveksanghi.com/wp-content/uploads/2009/12/bbpress-step01-02-300x239.jpg" alt="" width="300" height="239" /></a></p>
<p>And then proceed to step 2.</p>
<p><strong>Step 2 – WordPress Integration Settings</strong></p>
<p>To fill in the details required for step 2, load the options screen of your wordpress blog using the following link:</p>
<p><a href="http://www.diary.viveksanghi.com/wp-admin/options.php"></a></p>
<p>[wordpress link]/wp-admin/options.php</p>
<p>On the bbpress installation page check integration and cookie integration settings as shown in the image. Now add the auth cookie, secure auth cookie and logged in key values (we created these values earlier before starting installation of bbpress) from the <em>wp-config.php</em> file. The salt values will be available from the wordpress options screen we loaded a while ago.</p>
<p><a href="https://techblog.viveksanghi.com/wp-content/uploads/2009/12/bbpress-Step02-01.jpg"><img loading="lazy" decoding="async" class="aligncenter size-medium wp-image-192" title="Click on the image to view an enlarged image" src="https://techblog.viveksanghi.com/wp-content/uploads/2009/12/bbpress-Step02-01-300x260.jpg" alt="" width="300" height="260" /></a></p>
<p>If you do not find the secure auth cookie salt value, you may leave it blank and it should not be a problem. Then scroll down and also check user database integration settings. Fill in the values from the database values that you noted earlier. Most of you will only require the wordpress database table prefix. Now save the integration settings and you will be prompted to proceed to step three.</p>
<p><a href="https://techblog.viveksanghi.com/wp-content/uploads/2009/12/bbpress-Step02-02.jpg"><img loading="lazy" decoding="async" class="aligncenter size-medium wp-image-193" title="Click on the image to view an enlarged image" src="https://techblog.viveksanghi.com/wp-content/uploads/2009/12/bbpress-Step02-02-300x129.jpg" alt="" width="300" height="129" /></a></p>
<p><strong>Step 3 &#8211; Site settings</strong></p>
<p>Fill in a name for your forum and the site URL as shown below. Site URL will depend on the folder name you gave to the bbpress folder before uploading it under wordpress folder.</p>
<p><a href="https://techblog.viveksanghi.com/wp-content/uploads/2009/12/bbpress-Step03-01.jpg"><img loading="lazy" decoding="async" class="aligncenter size-medium wp-image-194" title="Click on the image to view an enlarged version" src="https://techblog.viveksanghi.com/wp-content/uploads/2009/12/bbpress-Step03-01-300x205.jpg" alt="" width="300" height="205" /></a></p>
<p>Select the wordpress admin name from the drop down as the bbpress keymaster unless you wish to alot this supreme role to anyone else. Give a name for your first forum, then hit the save site settings button and you should be ready to proceed to your forum page.</p>
<p>Now go to the admin panel of your forum and select wordpress integration under the settings tab as shown in the image below.  Here you have to map user roles between wordpress and bbPress users as the user list is now synchronized and/or common between the two.</p>
<p><a href="https://techblog.viveksanghi.com/wp-content/uploads/2009/12/bbpress-integration.jpg"><img loading="lazy" decoding="async" class="aligncenter size-medium wp-image-189" title="Click on the image to view an enlarged image" src="https://techblog.viveksanghi.com/wp-content/uploads/2009/12/bbpress-integration-300x124.jpg" alt="" width="300" height="124" /></a></p>
<p>Once you save these settings, your wordpress and bbPress will be integrated and you are ready to go.</p>
<p>I am also planning to research into a system/plugin such that the wordpress posts become topics and the comments on each wordpress post become forum posts under these topics. If I find out some thing on these lines, I will definitely update this post or create a second post on this topic.</p>
<p><strong>References</strong>: I researched the bbPress forums extensively and did a lot of hands on tinkering to learn how to install bbPress and integrate it with wordpress. This <a title="bbPress Forums" href="http://bbpress.org/forums/topic/wordpress-and-bbpress-integration-101" target="_blank">link</a> was particularly helpful in my learning process.</p>
<p>The post <a href="https://techblog.viveksanghi.com/2009/12/bbpress-installation-and-deep-integration-with-wordpress/">bbPress: Installation and Deep Integration with WordPress</a> appeared first on <a href="https://techblog.viveksanghi.com">Stubborn Fanatic - Tech Blog</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://techblog.viveksanghi.com/2009/12/bbpress-installation-and-deep-integration-with-wordpress/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">186</post-id>	</item>
	</channel>
</rss>