<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:media="http://search.yahoo.com/mrss/"><channel><title><![CDATA[geekly.dev]]></title><description><![CDATA[Personal projects and the nerdliest of endeavors]]></description><link>https://geekly.dev/</link><image><url>https://geekly.dev/favicon.png</url><title>geekly.dev</title><link>https://geekly.dev/</link></image><generator>Ghost 5.37</generator><lastBuildDate>Thu, 16 Apr 2026 01:07:41 GMT</lastBuildDate><atom:link href="https://geekly.dev/rss/" rel="self" type="application/rss+xml"/><ttl>60</ttl><item><title><![CDATA[TP-Link Easy Smart Configuration Utility Patch Review]]></title><description><![CDATA[Pen test report on TP-Link Easy Smart encryption patch]]></description><link>https://geekly.dev/easy-smart-patch-test-report/</link><guid isPermaLink="false">638d8764b67571032015f628</guid><category><![CDATA[Pen Tests]]></category><dc:creator><![CDATA[Nad]]></dc:creator><pubDate>Wed, 01 Mar 2023 18:38:11 GMT</pubDate><content:encoded><![CDATA[<!--kg-card-begin: markdown--><h2 id="decompiled-code">Decompiled code</h2>
<p>Easy Smart Configuration Utility beta 14.0.0.162 was decompiled using Procyon and jd-gui. Previous encryption features (RC4 and TEA) are still present, but appear to have been supplanted by other encryption methods. New encryption features have replaced them, which appear to be a form of RSA (although further analysis would be required to determine the precise specifications). The most important addition is the use of pseudo random number generation (PRNG) to produce encryption keys. This is a substantial improvement.</p>
<h3 id="prng-strength">PRNG strength</h3>
<p>One factor to take into account in further analysis is whether the PRNG algorithm used can be considered &quot;secure&quot;. Use of a weak PRNG algorithm can lead to a exploitable condition even within a strong encrpytion algorithm. Verification of the strength of the PRNG algorithm should be taken into account but it should also be noted that regardless of PRNG strength, this new encyrption scheme appears to be a vast improvement over the original static key RC4.</p>
<h3 id="code-cleanup">Code cleanup</h3>
<p>In current Utility beta, <code>transfer.This</code> method <code>main</code> contains static key used for RC4 in plaintext. While this key no longers appears to be used for sensitive data transmission, it would be advisable to remove the reference. Other sections of altered code should be examined to ensure that excess information is not easily revealed through decompilation.</p>
<h2 id="patch-integrity">Patch integrity</h2>
<p>Installation of the Easy Smart Confuguration Utility patch 14.0.0.162 executed without error.<br>
Backwards compatibility between new Utility and existing switch firmware, as well as between existing Utility and new firmware, established connection without error.<br>
Firmware update of TL-SG105Ev5 to 1.0.0 Build 20221201 Rel.29985(Beta) succeeded without error.<br>
Original settings were retained.</p>
<h2 id="packet-captures">Packet captures</h2>
<p>Packet captures were performed using Wireshark and examined in raw hexadecimal. Output was run through Proof of Concept decoder.</p>
<h3 id="utility-communication">Utility communication</h3>
<p>Sequential logins captured in wireshark show different encryption used between different established sessions. Previous RC4/TEA encryption is still used for some packets, as the Proof of Concept does still decrypt portions of the communications. However, the login credentials are not decrypted by Proof of Concept.</p>
<h3 id="web-interface-communication">Web interface communication</h3>
<p>Web interface remains entirely unencrpyted. Given that encryption of login credentials is in a much more secure state when using the Utility, customers should be informed that the Utility is preferable for secure communications until (and if) HTTPS communication with the web interface becomes available.</p>
<h3 id="broadcast-connections">Broadcast connections</h3>
<p>As broadcast packets are received by all hosts within a network segment, it remains advisable to limit the scope of extended communications. Broadcast should be limited to discovery, while established connections should utilize protocols for more direct communication. Overuse of broadcast is mainly a security concern when using unecrypted or poorly encrypted communications, so with the improvement to encryption strength it is less of a security concern. However, consideration should be given to altering the connection model in future development, as it can be an inherently problematic design to communicate broadly with an entire network segment.</p>
<h3 id="management-interface-reponsiveness-in-vlans">Management interface reponsiveness in VLANs</h3>
<p>Management interface discovery can still occur regardless of VLAN, in spite of inter-VLAN routing and firewalling. It is strongly recommended that future development of VLAN-capable equipment adopt stricter handling of access management, and provide the user with the means of limiting management access to designated VLANs.</p>
<!--kg-card-end: markdown-->]]></content:encoded></item><item><title><![CDATA[Vulnerability in TP Link Easy Smart Configuration Utility v1.3.10 and Easy Smart Switches]]></title><description><![CDATA[Main report of Easy Smart encryption vulnerability and related issues. Includes information on previous related reports and mitigation notes.]]></description><link>https://geekly.dev/easy-smart-report-main/</link><guid isPermaLink="false">631dba381212161047e8f7c4</guid><category><![CDATA[Pen Tests]]></category><dc:creator><![CDATA[Nad]]></dc:creator><pubDate>Wed, 01 Mar 2023 18:37:06 GMT</pubDate><content:encoded><![CDATA[<!--kg-card-begin: markdown--><p>Static key encryption between TP Link&apos;s Easy Smart Configuration Utility v1.3.10 (and earlier) and Easy Smart Switch product line allows network attackers to decrypt captured packets to obtain administrator login credentials and subsequently gain control of network hardware to escape VLAN segmentation, perform denial of service, and access administrative capabilities of the listed devices.</p>
<h3 id="affected-hardware">Affected hardware</h3>
<p>The Easy Smart Configuration Utility is used to administratively interface with a range of devices in the Easy Smart product line. The following devices, per the compatibility list available at the <a href="https://www.tp-link.com/us/support/download/tl-sg108e/?ref=geekly-dev">Easy Smart Configuration Utility download page</a>, are susceptible to the attack as the utility performs the same static key encryption for all datastream transmissions.</p>
<ul>
<li>TL-SG1428PE(UN) V1/V1.2/V1.26/V2/V2.2</li>
<li>TL-SG1218MPE(UN) V1/V2/V3.2/V3.26/V4/V4.2</li>
<li>TL-SG1210MPE V2/V3</li>
<li>TL-SG1024DE(UN) V1/V2/V3/V4/V4.2/V4.26</li>
<li>TL-SG1016PE(UN) V1/V2/V3.2/V3.26/V4/V5</li>
<li>TL-SG1016DE(UN) V1/V2/V3/V4/V4.2</li>
<li>TL-SG116E(UN) V1/V1.2/V2/V2.6</li>
<li>TL-SG105E(UN) V1/V2/V3/V4/V5</li>
<li>TL-SG108E(UN) V1/V2/V3/V4/V5/V6</li>
<li>TL-SG108PE(UN) V1/V2/V3/V4/V5</li>
<li>TL-SG105PE(UN) V1/V2</li>
<li>TL-RP108GE(UN) V1</li>
</ul>
<h3 id="attack-conditions">Attack conditions</h3>
<ul>
<li>The attacker must have visibility to capture broadcast domain transmissions within LAN or VLAN.</li>
<li>A user of the Easy Smart Configuration Utility must log into the device while the attacker is observing network traffic.</li>
<li>The attacker requires no prior authorization to the hardware or utility in order to extract encryption key and read unencrypted packet data.</li>
</ul>
<h3 id="easy-smart-configuration-utility-packet-encryption">Easy Smart Configuration Utility packet encryption</h3>
<p>The utility uses RC4 encryption with a static key. The static key is stored internally in the utility, in the form of a byte array that is encrypted using TEA. When called upon, the key is decrypted with TEA, and RC4 is performed on the packet to be sent.</p>
<p>Obtaining the static key is possible due to the utility being readily decompiled. The encrypted key can be located and run through the TEA decryption process to obtain the unencrypted RC4 plaintext key. RC4 can then be performed on captured packets to obtain the login credentials&apos; plaintext.</p>
<p>As the encryption key is statically stored in the utility which is readily available from the manufacturer, an attacker can freely extract the key by reproducing the TEA method to output the plaintext key. This can be performed by rebuilding the decompiled java classes to output the key string. Proof of concept also shows that reproducing the TEA decryption in Python is possible despite differences of data types and usage of bitwise operations, and only requires the encrypted byte array from the decompiled java classes.</p>
<h3 id="vlan-escape-and-denial-of-service">VLAN escape and denial of service</h3>
<p>VLAN compatibility is a main feature of the Easy Smart Switch product line. An attacker who is able to obtain administrative credentials will be able to log into the hardware normally. VLAN access port and trunk line designations can be altered at-will. An attacker can then use the switch to pivot to target a new device by altering the access ports to the VLAN segment the attacker has access to. Alternatively, if the attacker is being served by one of the access ports of the target switch, the VLAN access port can be altered to a different VLAN or multiple VLANs (as a trunk line), possibly including the native VLAN.</p>
<p>Denial of service can be performed with administrator access simply by breaking key functionality. The attacker may also alter the login credentials to disable management login from legitimate administration. Resetting the switch would be limited to physical-based factory reset.</p>
<h3 id="encryption-use-across-devices">Encryption use across devices</h3>
<p>Decompiled utility data in <code>com.tplink.smb.easySmartUtility.transfer</code> classes <code>I.class</code> and <code>thing.class</code> show methods <code>I.ba</code> ( with <code>This.F</code>) and <code>thing.aT</code> (with <code>This.Code</code>) use the static key RC4 cipher on the data portion of the packets both sent and received. There are no known provisions to handle the encryption of the data portion of the packets any differently based off any other criteria, nor is there evidence of another cipher present in the codebase apart from the TEA cipher which is used solely for the encryption of the static key.</p>
<p>The obtained plaintext key can be used to decrypt all encrypted packets sent by the utility. It is for this reason that the list of compatible hardware is assumed to be vulnerable.</p>
<hr>
<h2 id="proof-of-concept">Proof of concept</h2>
<h3 id="java-rebuild">Java rebuild</h3>
<p>The Easy Smart Configuration Utility was decompiled using JD-gui and Procyon. The following dependencies were rebuilt from the decompiled code:</p>
<ul>
<li><code>com.tplink.smb.easySmartUtility.transfer.of</code></li>
<li><code>com.tplink.smb.easySmartUtility.transfer.This</code></li>
<li><code>com.tplink.smb.easySmartUtility.transfer.TLV</code></li>
</ul>
<p><code>Main.java</code> was created to break out methods to decrypt the key with TEA, then decrypt a given hexadecimal string obtained through Wireshark packet capture. The capture was performed on a secondary system on the same VLAN.</p>
<p>The Java proof of concept is available in this currently private github repository. Encrypted key byte array is redacted.</p>
<h3 id="with-python">With Python</h3>
<p>Proof of concept was ported to Python by emulating Java bitwise handling performed. Despite the two languages having different integers types and endianness, it was still possible to recreate the entire procedure in Python, including both TEA decryption and RC4 decryption.</p>
<p>The Python proof of concept is also available in this currently private github repository. Key is redacted. Included <code>dump.txt</code> file provides example packet capture including login credentials and device information.</p>
<hr>
<h2 id="compounding-issues">Compounding issues</h2>
<h3 id="broadcast-domain-communication-of-administrative-interface">Broadcast domain communication of administrative interface</h3>
<p>The utility and hardware with which it communicates transmit packets to the broadcast domain IPv4 destination address 255.255.255.255, and MAC desctination address ff:ff:ff:ff:ff:ff. These packets are readily and passively intercepted by any other device on the same VLAN segment. Use of a simple packet sniffer combined with decryption can passively log traffic to obtain credentials.</p>
<h3 id="administrative-interface-responds-regardless-of-vlan">Administrative interface responds regardless of VLAN</h3>
<p>With the TL-SG105Ev5 on which these tests were performed, the device would respond to utility queries regardless of the VLAN it received the queries from. There are no options to limit management access to specific VLANs. As such, once the administrative credentials are obtained from the attack, the attacker would be capable of gaining control of the device regardless of VLAN.</p>
<p>Even in the case of manually setting a static IP on the switch outside of the VLAN of the attacking device, it still responds and allows connection. There are no options available on the device configuration to prohibit administrative communication to or from a given VLAN.</p>
<p>A malicious user within a non-management VLAN could therefore potentially create a brute force script to gain access to the switch even in the case of being unable to capture a login session to decrypt.</p>
<h3 id="web-interface-alternative">Web interface alternative</h3>
<p>As previously reported in <a href="https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2017-8075&amp;ref=geekly-dev">CVE-2017-8075</a> for the TL-SG108E, the web interface for the TL-SG105E uses HTTP without encryption, and transmits the login credentials in plaintext. While the web interface does not utilize broadcast domain transmission, these packets are still obtainable by an attacker with visibility on the same VLAN segment.</p>
<hr>
<h2 id="previous-reports">Previous reports</h2>
<p>Previous reports have been submitted by <a href="https://chmod750.wordpress.com/2017/04/23/vulnerability-disclosure-tp-link/?ref=geekly-dev">chmod750</a>, <a href="https://www.pentestpartners.com/security-blog/how-i-can-gain-control-of-your-tp-link-home-switch/?ref=geekly-dev">PenTestPartners</a>, and <a href="https://goughlui.com/2018/11/03/not-so-smart-tp-link-tl-sg105e-v3-0-5-port-gigabit-easy-smart-switch/?ref=geekly-dev">DrGough&apos;s TechZone</a> to TP-Link. CVEs were generated for an earlier iteration of this vulnerability on the TL-SG108E, providing further confirmation that the static key encryption is used across the Smart Switch product line.</p>
<ul>
<li><a href="https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2017-8074&amp;ref=geekly-dev">CVE-2017-8074</a> - On the TP-Link TL-SG108E 1.0, a remote attacker could retrieve credentials from &quot;SEND data&quot; log lines where passwords are encoded in hexadecimal. This affects the 1.1.2 Build 20141017 Rel.50749 firmware.</li>
<li><a href="https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2017-8075&amp;ref=geekly-dev">CVE-2017-8075</a> - On the TP-Link TL-SG108E 1.0, a remote attacker could retrieve credentials from &quot;Switch Info&quot; log lines where passwords are in cleartext. This affects the 1.1.2 Build 20141017 Rel.50749 firmware.</li>
<li><a href="https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2017-8076&amp;ref=geekly-dev">CVE-2017-8076</a> - On the TP-Link TL-SG108E 1.0, admin network communications are RC4 encoded, even though RC4 is deprecated. This affects the 1.1.2 Build 20141017 Rel.50749 firmware.</li>
<li><a href="https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2017-8077&amp;ref=geekly-dev">CVE-2017-8077</a> - On the TP-Link TL-SG108E 1.0, there is a hard-coded ciphering key (a long string beginning with Ei2HNryt). This affects the 1.1.2 Build 20141017 Rel.50749 firmware.</li>
<li><a href="https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2017-8078&amp;ref=geekly-dev">CVE-2017-8078</a> - On the TP-Link TL-SG108E 1.0, the upgrade process can be requested remotely without authentication (httpupg.cgi with a parameter called cmd). This affects the 1.1.2 Build 20141017 Rel.50749 firmware.</li>
</ul>
<h3 id="encryption-patch">Encryption patch</h3>
<p>Since those reports, TP-Link has made an attempt to patch the encryption vulnerability by obfuscating the code of the utility and encrypting the key itself with TEA. While this patch increases the difficulty of performing the key extraction, it does not change the use of the static key. The key itself, in its TEA-decrypted plaintext form, has remained consistent per the description of CVE-2017-8077, &quot;a long string beginning with Ei2HNryt.&quot;</p>
<h3 id="amendment-of-scope">Amendment of scope</h3>
<p>Previous reports did not account for the use case of VLAN network topology. However, since the Smart Switch line of devices prominently feature VLAN capability, VLAN segmentation escape should be a primary consideration of this vulnerability as it enables an attacker to potentially gain additional access beyond the device itself.</p>
<h3 id="amendment-of-affected-products">Amendment of affected products</h3>
<p>Previous reports were specific to single devices being analyzed. However, since the vulnerability lies within the administration interface software utilized by a range of devices, the scope of affected hardware should be broadened to include the utility-compatible devices listed by TP-Link.</p>
<h2 id="mitigation-notes">Mitigation notes</h2>
<h3 id="for-the-end-user">For the end user</h3>
<p>In the current state of the Easy Smart Switch product line and Easy Smart Configuration Utility v1.3.10, it should be advised to take the following precautions for logging into the device to perform configuration changes.</p>
<ul>
<li>
<p>Switch can be physically isolated from network prior to logging in by disconnecting all trunk lines and access ports and then only connecting to device being used to log in. This will completely eliminate the potential for login credentials to be remotely captured.</p>
</li>
<li>
<p>It is unknown if session credential are retransmitted at any interval, so switch should remain isolated for the duration of the session.</p>
</li>
<li>
<p>Alternatively, as the communication between utility and device appear to be limited to the VLAN from which an user is connecting to the device, it may be possible to limit scope of a session&apos;s broadcast transmissions to a management VLAN by manually assigning a static IP address for the switch within the management VLAN and only logging in through a device on the management VLAN. However, packet captures should be performed in a test environment to ensure that no broadcast transmissions are leaked to non-management VLANs.</p>
</li>
</ul>
<p>As the switch cannot currently be configured to enforce limitations of response across different VLANs, the potential for brute force attacks against login credentials exists. A strong password that is resilient against brute force attacks should be configured on the switch.</p>
<p>The switch may be relegated to a &quot;dumb&quot; switch capacity by disabling the trunk line and only being served a single untagged VLAN. The attack potential will be limited to only switch access. DoS and other administrative functions through the compromised hardware can still be obtained, but will be limited in scope to the single VLAN.</p>
<p>For a highly security sensitive use case, the device should be replaced until the devices and utility are patched to sufficiently address the cryptographic weakness.</p>
<h3 id="for-the-manufacturer">For the manufacturer</h3>
<p>The encryption was patched <a href="https://chmod750.wordpress.com/2017/04/23/vulnerability-disclosure-tp-link/?ref=geekly-dev">after</a> <a href="https://goughlui.com/2018/11/03/not-so-smart-tp-link-tl-sg105e-v3-0-5-port-gigabit-easy-smart-switch/?ref=geekly-dev">previous</a> <a href="https://www.pentestpartners.com/security-blog/how-i-can-gain-control-of-your-tp-link-home-switch/?ref=geekly-dev">reports</a>, however it still uses a static key. Using a secondary encryption to store a static key in a different form is still a static key. Continued use of a static key, no matter how many times it&apos;s encrypted, will ultimately result in the same vulnerability across all devices that use it.</p>
<p>Use of a protocol that utilizes secure key exchanging, such as TLS, would eliminate the issue of static key storage (and the secondary encryption), as fresh keys could be generated per session and exchanged.</p>
<p>Beyond initial discovery, it is inadvisable to persist communication using broadcast domain transmissions. Not only are these communications easily and passively intercepted, but the communications are much more difficult to restrict using firewall rules or similar mechnisms.</p>
<p>Administrative access to the switch should be configurable to limit access and only respond within trusted VLANs.</p>
<p>HTTPS should be utilized for the web administration interface. Login credentials should be hashed or encrypted. Hashing would be limited to authentication, however, and could not be used for setting username and password. The temptation to use static key encryption for setting username and password should be dissuaded by the readability of the utility&apos;s code. Use of an established secure protocol such as HTTPS should therefore be the primary objective.</p>
<!--kg-card-end: markdown-->]]></content:encoded></item><item><title><![CDATA[Encryption problems of the TP-Link TL-SG105E v5 and Easy Smart Switches]]></title><description><![CDATA[The tale of my first CVE: finding a vulnerability in the Easy Smart product line and the role I played in helping to mitigate it.]]></description><link>https://geekly.dev/easy-smart/</link><guid isPermaLink="false">6313565e0d9927d03bc1f789</guid><category><![CDATA[Pen Tests]]></category><category><![CDATA[Projects]]></category><category><![CDATA[Networks]]></category><dc:creator><![CDATA[Nad]]></dc:creator><pubDate>Wed, 01 Mar 2023 00:17:21 GMT</pubDate><media:content url="https://geekly.dev/content/images/2023/03/IMG_6403-1.jpg" medium="image"/><content:encoded><![CDATA[<img src="https://geekly.dev/content/images/2023/03/IMG_6403-1.jpg" alt="Encryption problems of the TP-Link TL-SG105E v5 and Easy Smart Switches"><p>This write-up is an informal presentation of how I found an encryption vulnerability in a line of network equipment, developed an exploit to demonstrate proof of concept, reported the vulnerability to the company, tested their patch, and worked with them to issue an advisory. </p><p>For a more concise analysis, please refer to the formal report available on GitHub just below.</p><p>I originally wrote this up back when I was writing the proof of concept. It tells the story of how I ended up finding these vulnerabilities and explains the extent of the effects in the broader context of network security. Despite being built upon older reported vulnerabilities, the encryption vulnerability demonstrated here has not been previously published to my knowledge, nor have any of these vulnerabilities previously been framed in the context of breaching VLAN segmentation.</p><p>However, I wanted to keep all the updates to progress on this up here at the top. This steps a bit out of chronological flow, but all the relevant reports and patch updates will be up here at the top as they become available.</p><p>Proof of concept code included here and in the repository are for authorized testing purposes only. Encryption keys are redacted.</p><h2 id="disclosure-information-updates">Disclosure information updates</h2><p>My formal reports were disclosed directly to TP-Link via private repository which has now been made public.</p><figure class="kg-card kg-bookmark-card"><a class="kg-bookmark-container" href="https://github.com/geeklynad/TP-Link-ESCU?ref=geekly-dev"><div class="kg-bookmark-content"><div class="kg-bookmark-title">GitHub - geeklynad/TP-Link-ESCU</div><div class="kg-bookmark-description">Contribute to geeklynad/TP-Link-ESCU development by creating an account on GitHub.</div><div class="kg-bookmark-metadata"><img class="kg-bookmark-icon" src="https://github.com/fluidicon.png" alt="Encryption problems of the TP-Link TL-SG105E v5 and Easy Smart Switches"><span class="kg-bookmark-author">GitHub</span><span class="kg-bookmark-publisher">geeklynad</span></div></div><div class="kg-bookmark-thumbnail"><img src="https://opengraph.githubassets.com/94fab765af37eeaa48f45fa8a0b9f2fb5b5bdba69bd0ba702940f24713b5faa0/geeklynad/TP-Link-ESCU" alt="Encryption problems of the TP-Link TL-SG105E v5 and Easy Smart Switches"></div></a></figure><p>TP-Link verified the vulnerability and has released patches for the entire line of products. Follow the link below and search for the model number, or scroll down to the <code>Business &gt; Business Switches &gt; Easy Smart</code> section for a complete list. Both the Configuration Utility and device firmware must be patched in order to resolve the vulnerability.</p><figure class="kg-card kg-bookmark-card"><a class="kg-bookmark-container" href="https://www.tp-link.com/us/support/download/?ref=geekly-dev"><div class="kg-bookmark-content"><div class="kg-bookmark-title">Download Center | TP-Link</div><div class="kg-bookmark-description">TP Link - Download Center</div><div class="kg-bookmark-metadata"><img class="kg-bookmark-icon" src="https://static.tp-link.com/favicon.ico" alt="Encryption problems of the TP-Link TL-SG105E v5 and Easy Smart Switches"><span class="kg-bookmark-author">TP-Link</span></div></div><div class="kg-bookmark-thumbnail"><img src="https://static.tp-link.com/assets/images/icon/open_graph_logo.png" alt="Encryption problems of the TP-Link TL-SG105E v5 and Easy Smart Switches"></div></a></figure><p>Reports were also sent to MITRE for CVE reservation, and CVE-2022-44231 has been assigned to this vulnerability.</p><figure class="kg-card kg-bookmark-card"><a class="kg-bookmark-container" href="https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-44231&amp;ref=geekly-dev"><div class="kg-bookmark-content"><div class="kg-bookmark-title">CVE -CVE-2022-44231</div><div class="kg-bookmark-description">The mission of the CVE&#xAE; Program is to identify, define, and catalog publicly disclosed cybersecurity vulnerabilities.</div><div class="kg-bookmark-metadata"><img class="kg-bookmark-icon" src="https://cve.mitre.org/favicon.ico" alt="Encryption problems of the TP-Link TL-SG105E v5 and Easy Smart Switches"><span class="kg-bookmark-author">CVE-2022-44231</span></div></div><div class="kg-bookmark-thumbnail"><img src="https://cve.mitre.org/images/cvelogobanner.png" alt="Encryption problems of the TP-Link TL-SG105E v5 and Easy Smart Switches"></div></a></figure><p>As I explained to TP-Link, my intention of disclosure of this vulnerability is not to enable attacks on existing systems, but rather to inform network and security professionals of the attack vector in order for them to be able to take the necessary steps to mitigate it. </p><p>I have included notes on mitigation of the potential attack <em>without</em> patching in my formal report section, Mitigation Suggestions. Although this may prove inconvenient, the login credentials can only be captured during an active session with the device so isolating the device during configuration can be a surefire method to prevent the session from being captured. </p><p>However, since the patches are now available, this mitigation method should no longer be required for secure transmission of login credentials while using the Configuration Utility.</p><h2 id="a-brief-note-on-vlans">A brief note on VLANs</h2><p>When familiarizing oneself with VLANs, it&apos;s common to come across verbiage that indicates that VLANs might not be the most secure way to go. Many of the broad descriptions make allusions to problematic configurations that potentially lead to leakage between network segments. </p><p>This initially struck me as an issue of either user error in setting up inter-VLAN routing and firewalls, or possibly legacy hardware issues that have long since been sorted and resolved. I wasn&apos;t expecting to come across this issue in the form of current-patch, up-to-date firmware blatantly mishandling VLAN segmentation so soon into my VLAN misadventures.</p><p>For a basic run-down, VLANs can be set up in such a way as to make all of the network infrastructure accessible only through a management segment. This improves the security profile by limiting access <em>in addition</em> to control lists, accounts, and passwords. If a user isn&apos;t connected through the management segment, they can&apos;t log in to management interfaces. The access between VLANs is ultimately in control of the routers designated to perform inter-VLAN routing. Firewall rules can be as broad or as granular as needed depending on the requirements. But the main idea is to have <em>limited, controlled points</em> through which inter-VLAN traffic can flow. The rest of the VLAN traffic gets directed to those points. </p><p>There shouldn&apos;t be any traffic that exchanges <em>between</em> VLANs without having to run the gauntlet of the firewall rules and routes in those designated control points.</p><p>I previously put together a deep dive explanation of VLANs, topology, and the TCP/IP and OSI models using visualizations aimed at making the topics accessible to a wide audience. If you&apos;d like to know more about VLANs and what they can be used for, it might be worth a read.</p><figure class="kg-card kg-bookmark-card"><a class="kg-bookmark-container" href="https://geekly.dev/strangest-explanation-of-vlans/"><div class="kg-bookmark-content"><div class="kg-bookmark-title">The strangest explanation of VLANs you&#x2019;ve never heard</div><div class="kg-bookmark-description">Mental models rarely fit neatly into little boxes, yet we try to visualize them using overly simplistic means. For once, let&#x2019;s get a little nutty.</div><div class="kg-bookmark-metadata"><img class="kg-bookmark-icon" src="https://geekly.dev/content/images/2022/09/favicon-1.ico" alt="Encryption problems of the TP-Link TL-SG105E v5 and Easy Smart Switches"><span class="kg-bookmark-author">geekly.dev</span><span class="kg-bookmark-publisher">Nad</span></div></div><div class="kg-bookmark-thumbnail"><img src="https://geekly.dev/content/images/2022/11/vlan06.png" alt="Encryption problems of the TP-Link TL-SG105E v5 and Easy Smart Switches"></div></a></figure><h2 id="whats-in-the-box">What&apos;s in the box?</h2><p>When I first installed and configured my shiny new <a href="https://www.tp-link.com/us/business-networking/easy-smart-switch/tl-sg105e/?ref=geekly-dev">TL-SG105E v5</a>, I was briefly elated by the simplicity of the 802.1Q configuration. Tell it which access ports are members of which VLAN, tell it where to untag traffic going out to end points, tag traffic for the trunk line, and which PVIDs to use. Seemed to work like a charm!</p><figure class="kg-card kg-image-card"><img src="https://geekly.dev/content/images/2023/03/IMG_6357.jpg" class="kg-image" alt="Encryption problems of the TP-Link TL-SG105E v5 and Easy Smart Switches" loading="lazy" width="2000" height="1125" srcset="https://geekly.dev/content/images/size/w600/2023/03/IMG_6357.jpg 600w, https://geekly.dev/content/images/size/w1000/2023/03/IMG_6357.jpg 1000w, https://geekly.dev/content/images/size/w1600/2023/03/IMG_6357.jpg 1600w, https://geekly.dev/content/images/size/w2400/2023/03/IMG_6357.jpg 2400w" sizes="(min-width: 720px) 720px"></figure><p>But one thing was bothering me. It was fetching itself an IP address from the DHCP server (my pfSense from which the VLANs stem) that was <em>within</em> one of the VLANs. Not the native VLAN, and not the management VLAN. And it wasn&apos;t consistent upon reboots. It seemed to pick a VLAN at random, grab an address <em>in that VLAN</em>, and sit quite happily in the wrong place for the rest of its power-on cycle.</p><p>In other words, it was <em>not</em> fetching its own address from the native VLAN, the base network. And there was no way to limit which VLAN it would choose to run its DHCP client on. Because of its random assignment nature, it would be troublesome to secure the management interface to be accessed only through the management VLAN.</p><p><em>Why not have it self-assign a static address?</em></p><p>If this bouncing around were the only problem, that might actually work to resolve the issue. Instead, it just gets worse.</p><p>It took a while for it to sink in enough for me to realize what was going on. I thought that maybe I was making mistakes, failing to take things into account.</p><p>I set a static IP for it in the management VLAN, but I was able to access the management interface from non-management VLANs. From VLANs that were <em>not</em> the &quot;wrong seat&quot; that the little switch decided to rest in. I had no business being able to access something that resides in <em>that</em> VLAN from <em>this one</em>, and yet here I am, logging into this switch to try to figure out why it chooses to do what it does. I thought that maybe I had DHCP leases that were still active, or that my MAC was on an ARP table somewhere in the pipeline for a VLAN that I was previously logged into. These were not the case. The rest of the network was handling VLANs as intended. The bleed-through wasn&apos;t coming from somewhere else.</p><p><em>In short:</em> <strong>If this switch is plugged into a trunk line that contains the VLAN you&apos;re on, it&apos;ll respond.</strong></p><figure class="kg-card kg-image-card kg-card-hascaption"><img src="https://geekly.dev/content/images/2022/09/javaw_ysFRU3aTQq-1.png" class="kg-image" alt="Encryption problems of the TP-Link TL-SG105E v5 and Easy Smart Switches" loading="lazy" width="874" height="112" srcset="https://geekly.dev/content/images/size/w600/2022/09/javaw_ysFRU3aTQq-1.png 600w, https://geekly.dev/content/images/2022/09/javaw_ysFRU3aTQq-1.png 874w" sizes="(min-width: 720px) 720px"><figcaption>It shows up regardless of interVLAN routing rules.</figcaption></figure><p>In this instance, the switch fetched DHCP for VLAN99, the management VLAN. That segment is isolated from the rest of the network via interVLAN routing rules and firewall rules. However, because a trunk line extends to the network, the switch is able to disregard the rules present on other devices. It does what it wants. And what it wants is to ignore the way VLAN filtering works.</p><figure class="kg-card kg-image-card kg-card-hascaption"><img src="https://geekly.dev/content/images/2022/09/cmd_sgrIHjOtTz.png" class="kg-image" alt="Encryption problems of the TP-Link TL-SG105E v5 and Easy Smart Switches" loading="lazy" width="337" height="76"><figcaption>It has no qualms about responding to pings from different VLANs.</figcaption></figure><figure class="kg-card kg-image-card kg-card-hascaption"><img src="https://geekly.dev/content/images/2022/09/cmd_aTEUCLuoTH.png" class="kg-image" alt="Encryption problems of the TP-Link TL-SG105E v5 and Easy Smart Switches" loading="lazy" width="298" height="60"><figcaption>This is the expected behavior from another device on an isolated VLAN.</figcaption></figure><p>None of this bodes well.</p><hr><p>At this point, it was time for some forum scrubbing. I pretty much immediately came across this write-up, <a href="https://goughlui.com/2018/11/03/not-so-smart-tp-link-tl-sg105e-v3-0-5-port-gigabit-easy-smart-switch/?ref=geekly-dev">Not So Smart: TP-Link TL-SG105E V3.0 5-Port Gigabit Easy Smart Switch</a> by DrGough&apos;s TechZone.</p><p>And yes, it gets worse.</p><p>Not only does this switch advertise and accept connections from any VLAN with no option whatsoever to limit access, it transmits login credentials via HTTP in plaintext. </p><p>DrGough&apos;s TechZone found that it was possible to functionally brick log-ins by causing a buffer overflow, using curl to set credentials beyond the input validation limits set by the interface. This enables <em>some</em> degree of security. Set up the switch how you want it, brick the login, and if you ever need to change anything back, cycle the power to restore management login functionality. However, seeing as the &quot;fix&quot; becomes negated by a power outage, this shouldn&apos;t be categorized as a long term solution unless you really enjoy sending curls to your switch every time your power goes out.</p><p>That write-up also cited an older write-up, <a href="https://www.pentestpartners.com/security-blog/how-i-can-gain-control-of-your-tp-link-home-switch/?ref=geekly-dev">How I can gain control of your TP-LINK home switch</a> by PenTestPartners.</p><p>And yes, it gets worse.</p><p>In it, they specifically examined the management application offered as a sleeker alternative to the HTTP management interface, the <a href="https://www.tp-link.com/us/support/download/tl-sg105e/?ref=geekly-dev">Easy Smart Configuration Utility</a>.</p><p>PenTestPartners found that:</p><ul><li>The utility communicated with the switch (and vice versa) via broadcast (255.255.255.255) UDP.</li><li>The utility was in java, and readily decompiled to source code.</li><li>The encryption used was RC4 with a static key.</li><li>The static key was within the decompiled source code.</li></ul><p>Given these factors, it then becomes possible to intercept switch management traffic and decrypt it from elsewhere on the network.</p><p><strong>This is looking more and more like a really nice pivot point to get through VLAN segmentation. </strong></p><p><em>Let&apos;s say for the sake of fun you&apos;re on a network in a given VLAN segment trying to access a device on another VLAN segment. Switches and routers on the network adhere to the VLAN filters. Firewall rules strictly limit crosstalk. You can&apos;t see it on any network scans. You know it&apos;s there though. Luckily for you, it&apos;s behind an Easy Smart Switch. You gain access to the switch&apos;s management interface (because it&apos;s friends with everybody and still happily sitting in the wrong place) and reconfigure the target&apos;s access port to the VLAN of your choosing. You&apos;re now free to poke around at whatever open ports are listening on that device.</em></p><p>Such an attack wouldn&apos;t be limited to having both the attacker and the target behind the same switch. If the attacker is behind the switch but the target is elsewhere on the network, the attacker would be able to reconfigure the access ports of the switch to open up any VLAN being fed via trunk line to the switch. </p><p>If the switch&apos;s trunk includes the target&apos;s VLAN, the attacker can gain access to the target&apos;s VLAN, completely bypassing interVLAN routing and firewall rules.</p><p>Neither of the two write-ups really examined these possible attacks in the context of VLANs. However, since &quot;VLAN capable&quot; and &quot;802.1Q compatible&quot; are main selling points of this device, and that&apos;s what I wanted to use it for, that&apos;s the microscope I&apos;ll be putting this device under.</p><h2 id="how-much-of-this-is-still-a-problem">How much of this is still a problem?</h2><p>The two write-ups were sent in to TP-Link years ago. One for v1, one for v3. There have been patches made to both the switch firmware and to the management utility.</p><p>The short answer is: All of it.</p><p>They <em>did</em> try to mitigate the attack on the utility encryption. These attempts, however, were insufficient to solve the problem. They made it more difficult to achieve the same results, but it is absolutely possible to achieve significant results.</p><p>The HTTP unencrypted login problem still exists.</p><figure class="kg-card kg-image-card kg-width-wide kg-card-hascaption"><img src="https://geekly.dev/content/images/2022/09/Wireshark_6HQAFZSmir-1.png" class="kg-image" alt="Encryption problems of the TP-Link TL-SG105E v5 and Easy Smart Switches" loading="lazy" width="1020" height="248" srcset="https://geekly.dev/content/images/size/w600/2022/09/Wireshark_6HQAFZSmir-1.png 600w, https://geekly.dev/content/images/size/w1000/2022/09/Wireshark_6HQAFZSmir-1.png 1000w, https://geekly.dev/content/images/2022/09/Wireshark_6HQAFZSmir-1.png 1020w"><figcaption>Even with the best password ever, this is still a problem.</figcaption></figure><p>That rules out using the web browser as the management interface. What about the Easy Smart Configuration Utility?</p><ul><li>It still utilizes broadcast to communicate all packets.</li><li>It&apos;s still a java package that&apos;s readily decompiled.</li><li>It still utilizes static key RC4, albeit in a different form now.</li></ul><p>The login credentials remain obtainable, permitting an attacker to gain control of the VLAN configuration to bypass segmentation. <strong>If this device is offered a VLAN trunk line, or configured to be the root of VLANs, it is possible to break out of VLAN segmentation.</strong></p><h2 id="how-did-tp-link-respond-to-previous-reports">How did TP-Link respond to previous reports?</h2><p>Let&apos;s take a look back at TP-Link&apos;s response to <a href="https://www.pentestpartners.com/security-blog/how-i-can-gain-control-of-your-tp-link-home-switch/?ref=geekly-dev">PenTestPartner&apos;s report</a>.</p><!--kg-card-begin: html--><blockquote><p>I had a discussion with TP-LINK&#x2019;s support who were really responsive, and I&#x2019;ll quote them directly to ensure that I don&#x2019;t misphrase them:</p>
<br>
<p>1. Traffic between utility and switch is sent by broadcast</p>
<p>It is a common way for Utility to communicate with devices with broadcast in our industry, other productors like Netgear does it this way too.</p>
<p>Broadcast will have some shortcomings as you said and we will think about it too, but the premise is LAN is not safe.</p>
<p>In most scenes LAN is a relative safe environment. We will have NAT router and firewall in front of our LAN network, most attacks will be blocked. Firewall and secure software can protect our LAN&#x2019;s safety. But when LAN is not safe, even we don&#x2019;t use broadcast, other method like faked ARP can get traffics between utility and switch.</p>
<br>
<p>2. Decode of Utility exe and static encryption.</p>
<p>Our Easy Smart Switch is a product for home and small office, so chip is not powerful enough to ensure a very high security.</p>
<p>As you know, Utility is written in Java and it means decompilation is avoidless, anyone can do it if they know how. It is the cost of Java&#x2019;s universality and we can&#x2019;t change it. Our R&amp;D will think about add more covers to our codes to make our switch more safe in next Utility.</p></blockquote><!--kg-card-end: html--><p>Before talking about the mitigation measures they used, going over their response will help illustrate the reasoning behind the measures taken.</p><hr><blockquote><em><em>In most scenes LAN is a relative safe environment</em>.</em></blockquote><p>Because the report wasn&apos;t framed in terms of VLANs, VLANs weren&apos;t considered here. But even given that, I have to voice at least a little contention with the idea of LANs being considered a safe environment. In a wild logically fallacious leap, they cite ARP poisoning in some sort of equivocation to broadcast, ignoring the possibility of mitigating measures taken against such attacks.</p><p>But let&apos;s give them the benefit of the doubt that they consider LANs &quot;safe.&quot; How do they categorize VLANs? Because VLANs are widely used for segmentation of networks for security purposes. Most home users who put together a network of VLANs do so to separate network traffic based off of security profiles. IoT devices go on a separate segment than servers, which in turn on are on a separate network from daily driver devices, and so on. They are separate for a reason. They need to be able to remain separate.</p><p>Having a device that responds in complete disregard to VLAN protocols is how that separation gets broken.</p><hr><blockquote><em><em>Our Easy Smart Switch is a product for home and small office, so chip is not powerful enough to ensure a very high security.</em></em></blockquote><p>This may very well be a limiting factor of the device. I don&apos;t know what the chip is capable of performing and what it isn&apos;t. It <em>can</em> perform RC4. It seems to me that if it&apos;s capable of performing RC4, it should be capable of establishing a key exchange to base randomized keys for the RC4. But that&apos;s beyond the scope of my familiarity.</p><p>I will say that if the device is indeed incapable of performing anything other than RC4 with a static key (and even given that &quot;LANs are safe&quot;), it should not be used for VLANs. It should only be used for &quot;safe&quot; LANs.</p><hr><blockquote><em><em>As you know, Utility is written in Java and it means decompilation is avoidless, anyone can do it if they know how.</em></em></blockquote><p>Secure open source software exists. How? For a first clue, you&apos;d be hard pressed to find any open source software that utilizes static keys for RC4. <a href="https://en.wikipedia.org/wiki/Key_exchange?ref=geekly-dev#:~:text=Key%20exchange%20(also%20key%20establishment,use%20of%20a%20cryptographic%20algorithm.">Key exchanges</a> are used in protocols such as TLS to establish encryption keys to be used by either end of the connection. This can eliminate the need for unsecure local storage of key values, as new keys are made and exchanged on the fly.</p><p>Let&apos;s take a quick look through <a href="https://www.rfc-editor.org/rfc/rfc5246?ref=geekly-dev">RFC-5246</a>.</p><!--kg-card-begin: html--><blockquote><span style="font-family: &apos;Firacode&apos;,monotype;"><p> The TLS Record Protocol is used for encapsulation of various higher- level protocols.  One such encapsulated protocol, the TLS Handshake Protocol, allows the server and client to authenticate each other and to negotiate an encryption algorithm and cryptographic keys before the application protocol transmits or receives its first byte of data.  The TLS Handshake Protocol provides connection security that has three basic properties:</p>
<br>
<p> -  The peer&apos;s identity can be authenticated using asymmetric, or public key, cryptography (e.g., RSA [RSA], DSA [DSS], etc.).  This authentication can be made optional, but is generally required for at least one of the peers.</p>
<br>
<p> -  The negotiation of a shared secret is secure: the negotiated secret is unavailable to eavesdroppers, and for any authenticated connection the secret cannot be obtained, even by an attacker who can place himself in the middle of the connection.</p>
<br>
<p> -  The negotiation is reliable: no attacker can modify the negotiation communication without being detected by the parties to the communication.</p></span></blockquote><!--kg-card-end: html--><p>Key exchanges are a proven, very commonly used method of securely handling the overhead of the bulk encryption. Heavy duty, processor-intensive encryption isn&apos;t a necessity. RC4 can be argued as being problematic and many vendors are moving away from its use. But RC4 isn&apos;t the weakest link in this chain. The <em>static key</em> is. Key exchanges are what enable the use of ephemeral keys. Once the session is finished, the keys are retired. When a new session is initiated, new keys are created and exchanged. This is makes for a <em>much</em> more robust encryption.</p><p>Many devices are capable of TLS including a variety of IoT devices with limited processing capability. And TLS is one of a variety of tunneling protocols in widespread use. The fact that Java is readily decompiled should not be a limiting factor of utilizing any of a number of methods of secure transfer of data (including login credentials).</p><hr><blockquote><em><em>It is a common way for Utility to communicate with devices with broadcast in our industry, other productors like Netgear does it this way too.</em></em></blockquote><p>I want to conclude the dissection with this one because I feel like it nicely encompasses the problematic paradigm. Don&apos;t do things wrong just because others do them wrong. There are others that do things right. That&apos;s worth the effort.</p><h2 id="what-did-previous-patches-fix">What did previous patches fix?</h2><p>They used some code obfuscation (<a href="https://github.com/facebookarchive/proguard/blob/master/examples/dictionaries/shakespeare.txt?ref=geekly-dev">one that happened to use William Shakespeare quotes as a dictionary</a> - thank you to Constable for finding this gem), switched out the plaintext key in favor of a byte array, and scrambled it using TEA, the Tiny Encryption Algorithm.</p><p>This example of <a href="https://en.wikipedia.org/wiki/Tiny_Encryption_Algorithm?ref=geekly-dev">TEA</a> is written in C by its creators David Wheeler and Roger Needham. This is the very same algorithm used by the Easy Smart Configuration Utility to internally encrypt the key.</p><pre><code class="language-C">#include &lt;stdint.h&gt;

void encrypt (uint32_t v[2], const uint32_t k[4]) {
    uint32_t v0=v[0], v1=v[1], sum=0, i;           /* set up */
    uint32_t delta=0x9E3779B9;                     /* a key schedule constant */
    uint32_t k0=k[0], k1=k[1], k2=k[2], k3=k[3];   /* cache key */
    for (i=0; i&lt;32; i++) {                         /* basic cycle start */
        sum += delta;
        v0 += ((v1&lt;&lt;4) + k0) ^ (v1 + sum) ^ ((v1&gt;&gt;5) + k1);
        v1 += ((v0&lt;&lt;4) + k2) ^ (v0 + sum) ^ ((v0&gt;&gt;5) + k3);
    }                                              /* end cycle */
    v[0]=v0; v[1]=v1;
}

void decrypt (uint32_t v[2], const uint32_t k[4]) {
    uint32_t v0=v[0], v1=v[1], sum=0xC6EF3720, i;  /* set up; sum is (delta &lt;&lt; 5) &amp; 0xFFFFFFFF */
    uint32_t delta=0x9E3779B9;                     /* a key schedule constant */
    uint32_t k0=k[0], k1=k[1], k2=k[2], k3=k[3];   /* cache key */
    for (i=0; i&lt;32; i++) {                         /* basic cycle start */
        v1 -= ((v0&lt;&lt;4) + k2) ^ (v0 + sum) ^ ((v0&gt;&gt;5) + k3);
        v0 -= ((v1&lt;&lt;4) + k0) ^ (v1 + sum) ^ ((v1&gt;&gt;5) + k1);
        sum -= delta;
    }                                              /* end cycle */
    v[0]=v0; v[1]=v1;
}</code></pre><p>The plaintext string of 256 alphanumeric values is converted from UTF-8 to integers, and run through this encryption. From there, the integers are then split out into signed bytes (&quot;signed bytes&quot; meaning that one bit is used to signify whether the values are positive or negative; signed bytes range in value from -128 to +127) and statically stored within the code in a byte array.</p><p>When a packet needs to be sent or received, the byte array containing the encrypted key is sent back through the gauntlet of stacking signed bytes into integers, then piped into the other end of the Tiny Encryption Algorithm. From there, it&apos;s sent back to be turned into a string of 256 alphanumeric values. Then it&apos;s piped through the KSA phase of RC4, where it reaches its final form to be used in the PRGA phase where it&apos;s combined with the datastream to be either encrypted or decrypted. (In the case of RC4, encryption and decryption is the same operation since it uses bitwise <code>AND</code> between the key and the plaintext/ciphertext.)</p><p>The key, although obscured, is still static. </p><p>It doesn&apos;t change between uses. It doesn&apos;t change between clients. This key is consistently used across all hardware to which the Easy Smart Configuration Utility connects, as well as all copies of the utility.</p><h2 id="cracking-the-fix">Cracking the fix</h2><p>I&apos;ve never programmed Java before. I&apos;ve barely even <em>read</em> any Java before. I&apos;m not saying this out of pride for inexperience. I&apos;m saying this to illustrate a point.</p><p>Obfuscation is not a substitute for protocols.</p><p>Did it slow me down? Absolutely. It certainly didn&apos;t stop me. If anything, it only served to egg me on with the blooming realization that their resolution to a serious encryption flaw was to basically throw a tattered old (deprecated) rug over a rotting old foot bridge spanning a chasm of despair.</p><h3 id="in-java">In Java</h3><p>Because of the bitwise operations used in TEA, it was most feasible for me to do that by patching together the decompiled code, and making an endpoint for the key string itself to print out to console. Once I had the key, I was able to verify that the packets could be decrypted with RC4. </p><p>It&apos;s worth noting that decompiling with JD-gui gave me code that didn&apos;t perform the TEA decryption properly. I eventually tried using Procyon to decompile and got much better results. I&apos;m still scratching my head over why. But for anyone attempting to reproduce, I&apos;d recommend using Procyon for decompiling.</p><p>I was able to get the decryption working &#xA0;for both TEA and RC4 in Java by including the a few dependencies rebuilt from the decompiled source, <code>transfer.TLV</code>, <code>transfer.of</code> and <code>transfer.This</code>. The key has been redacted. Example raw hex Wireshark packet capture is included.</p><pre><code class="language-Java">package javadecrypt;

import java.util.Arrays;
import java.util.HexFormat;

public class main {

    // int array to store post-KSA key
    private static int[] mS = new int[256];
    
    // checks if TEA has already been performed
    private static boolean lC;

    public static void main(String[] args) {
        if (lC) {
            return;
        }

        // Send TEA-encrypted key to be decrypted
        final String h = new of().h(new byte[] {REDACTED});
        
        // KSA phase
        final byte[] array = new byte[256];
        int n = 0;
        for (int i = 0; i &lt; 256; ++i) {
            array[mS[i] = i] = (byte)h.charAt(i % h.length());
        }
        for (int j = 0; j &lt; 256; ++j) {
            n = (n + mS[j] + array[j]) % 256;
            final int n2 = mS[j];
            mS[j] = mS[n];
            mS[n] = n2;
        }
        lC = true;

        // Print key post-TEA
        System.out.println(&quot;Pre-KSA key plaintext: &quot; + h);
        // Pre-KSA in bytes can be enabled in Key.of.h()
        // Print key post-KSA
        System.out.println(&quot;Post-KSA Key in bytes: &quot; + Arrays.toString(mS));


        // Example packet captured from wireshark
        HexFormat hexFormat = HexFormat.of();
        byte[] arrayOfByte = hexFormat.parseHex(&quot;5d777eefcbb14f45bfc42eb9cd4d7e51422ba2f5d791aeed508f31d5c202909a591381c0464e465f27d942b5a44c2c4a3a03355a0b08fa1e541489f773e1&quot;);

        // Print UTF-8 and byte array of encrypted packet
        System.out.println(&quot;Encrypted: &quot; + new String(arrayOfByte));
        for (int length = arrayOfByte.length, i = 0; i &lt; length; ++i) {
            System.out.print(arrayOfByte[i] + &quot; &quot;);
        }
        System.out.println(&quot;\n&quot;);

        // PRGA phase
        This.Code(arrayOfByte, arrayOfByte.length);

        // TLV.g to build string with de-signed byte values
        System.out.println(&quot;Decrypted: &quot; + TLV.g(arrayOfByte));

        // Print de-signed byte values
        for (int length = arrayOfByte.length, i = 0; i &lt; length; ++i) {
            System.out.print((arrayOfByte[i] &amp; 0xFF) + &quot; &quot;);
        }
        System.out.println(&quot;\n&quot;);
    }
}</code></pre><h3 id="in-python">In Python</h3><p>From there, I was able to recreate these operations in Python. Some juggling was required to account for the fact that bitwise operations give different results for different data types. </p><p>The original Java code uses big endian signed bytes and unsigned integers, switching back and forth between the two during different part of the operations. The bitwise operations in TEA were difficult to reproduce in Python, but ultimately possible using <code>ctypes</code> conversions for specific steps.</p><p>Many of the functions in the &quot;tooling&quot; section are recreations of the included dependencies in the Java example to handle things like packing 8 bytes into 2 ints to pass into TEA, and converting between ints and UTF-8.</p><p>This can readily be expanded upon to be used in the context of a packet sniffer to decrypt a datastream as it is received.</p><pre><code class="language-python">#!/usr/bin/env python3
# python 3.10.7
# --------------------------------------------------------------------------------------
# Easy Smart Configuration Utility packet decryption
# nad@geekly.dev
#
# Requires key obtained through decompiling the utility
#
# Expected data type for packet capture is string of hexadecimal string
#   Example included in raw.txt file
#   Contains login credentials of user:admin with password:EncryptFail
#   
#
# Raw hex string can be obtained through wireshark using &quot;Follow UDP stream&quot;,
#   setting the output type to &quot;Raw&quot;, and pasting into a text file.
#   Each line of raw.txt to contain one packet to be decrypted independently
# 
# Proof of concept performed on TL-SG105E v5, Build 20220414 Rel.50349
#
# Affected hardware includes the following:
# * TL-SG1428PE(UN) V1/V1.2/V1.26/V2/V2.2
# * TL-SG1218MPE(UN) V1/V2/V3.2/V3.26/V4/V4.2
# * TL-SG1210MPE V2/V3
# * TL-SG1024DE(UN) V1/V2/V3/V4/V4.2/V4.26
# * TL-SG1016PE(UN) V1/V2/V3.2/V3.26/V4/V5
# * TL-SG1016DE(UN) V1/V2/V3/V4/V4.2
# * TL-SG116E(UN) V1/V1.2/V2/V2.6
# * TL-SG105E(UN) V1/V2/V3/V4/V5
# * TL-SG108E(UN) V1/V2/V3/V4/V5/V6
# * TL-SG108PE(UN) V1/V2/V3/V4/V5
# * TL-SG105PE(UN) V1/V2
# * TL-RP108GE(UN) V1
# --------------------------------------------------------------------------------------


import ctypes


# --------------------------------------------------------------------------------------
# Tooling for data type conversions
# --------------------------------------------------------------------------------------
#
# Original java used signed byte arrays for datagram stream and ints 0-255 for key
# Since RC4 doesn&apos;t use bitwise operations, there&apos;s no need to account for endianness
# TEA groups 8 bytes into 2x 32bit ints; ctypes handles bit order


def from_signed(a):
    b = a &amp; 0xFF
    return b


def to_signed(i, bits):
    if i &amp; (1 &lt;&lt; (bits - 1)):
        i -= 1 &lt;&lt; bits
    return i


def mod_sign(i, m):
    x = from_signed(i) % m
    x = to_signed(x, 8)
    return (x)


def raw_to_bytelist(raw):
    bl = []
    bits = 8
    for i in range(0, len(raw), 2):
        value = int(&quot;0x&quot; + raw[i:i+2], 16)
        if value &amp; (1 &lt;&lt; (bits - 1)):
            value -= 1 &lt;&lt; bits
        bl.append(value)
    return (bl)


def text_to_bytelist(s):
    bl = []
    for char in s:
        bl.append(ord(char))
    return (bl)


def bytelist_to_string(bl):
    str_out = &quot;&quot;
    for x in range(len(bl)):
        str_out += chr(bl[x])
    return (str_out)


# Pack 8 bytes into 2 ints

def chunks(v, i):
    chunk = [0 for a in range(i &gt;&gt; 2)]
    y = 0
    for x in range(0, len(v), 4):
        chunk[y] = (v[x + 3]) | (v[x + 2] &lt;&lt; 8) | (v[x + 1] &lt;&lt; 16) | (v[x] &lt;&lt; 24)
        y += 1
    return (chunk)


# Unpack 2 ints out to 8 bytes

def dechunks(v, i):
    chunk = [0 for a in range(i &lt;&lt; 2)]
    y = 0
    for x in range(len(v)):
        chunk[y + 3] = v[x] &amp; 0xFF
        chunk[y + 2] = v[x] &gt;&gt; 8 &amp; 0xFF
        chunk[y + 1] = v[x] &gt;&gt; 16 &amp; 0xFF
        chunk[y] = v[x] &gt;&gt; 24 &amp; 0xFF
        y += 4
    return (chunk)


# --------------------------------------------------------------------------------------
# TEA and RC4 algorithms
# --------------------------------------------------------------------------------------

# TEA key decryption
# y, z, and sum require ctypes.c_int wrapping

def TEA_decrypt(v, k):
    
    # vector ints
    y = ctypes.c_int(v[0])
    z = ctypes.c_int(v[1])
    
    # TEA constants
    sum = ctypes.c_int(0xC6EF3720)
    delta = 0x9E3779B9

    for n in range(32, 0, -1):
        z.value -= (y.value &lt;&lt; 4) + k[2] ^ y.value + sum.value ^ (y.value &gt;&gt; 5) + k[3]
        y.value -= (z.value &lt;&lt; 4) + k[0] ^ z.value + sum.value ^ (z.value &gt;&gt; 5) + k[1]
        sum.value -= delta

    return [y.value, z.value]


# RC4 key scheduling algorithm
# S initial values set as list 0-255, not as null list with length of 256

def KSA(key):

    keylength = len(key)
    S = [x for x in range(256)]
    j = 0

    for i in range(256):
        j = (j + S[i] + key[i % keylength]) % 256
        S[i], S[j] = S[j], S[i]

    return S


# RC4 psuedo-random generation algorithm
# mod_sign manages the modulo between signed byte values vs 0-255 int values

def PRGA(S, data):

    i = 0
    j = 0
    out = []

    for x in range(len(data)):
        i = mod_sign((i + 1), 256)
        j = mod_sign((j + S[i]), 256)
        S[i], S[j] = S[j], S[i]
        K = S[mod_sign((S[i] + S[j]), 256)]
        out.append(data[x] ^ S[mod_sign((S[i] + S[j]), 256)])

    return (out)


# --------------------------------------------------------------------------------------
# Functions called by main() to decrypt key and packet data
# --------------------------------------------------------------------------------------

# TEA key extraction
# v: Unsign bytes from original signed byte array
# w: Sort into larger chunks, recursive list of 2 ints per chunk
# x: Send each chunk of 2 ints to be decrypted
# y: Separate chunks back out to individual bytes, flatten list recursion
# z: Strip first 8 values (unused offset), Unsign bytes once again and convert to UTF-8

def key_extract(key):

    # TEA key and vector
    k = [2023708229, -158607964, -2120859654, 1167043672]
    v = []

    for i in range(len(key)):
        v.append(from_signed(key[i]))

    w = []
    for i in range(0, len(v), 8):
        w.append(chunks(v[i:i+8], 8))
    if log == True:
        print(&quot;Sorted chunks for key extraction: \n&quot;, w)

    x = []
    for i in range(len(w)):
        x.append(TEA_decrypt(w[i], k))
    if log == True:
        print(&quot;Decrypted chunks: \n&quot;, x)

    y = []
    for i in range(len(x)):
        y.append(dechunks(x[i], 2))
    y = [item for sublist in y for item in sublist]
    if log == True:
        print(&quot;Decrypted bytes: \n&quot;, y)

    z = []
    for i in range(8, len(y)):
        z.append(from_signed(y[i]))
    return (bytelist_to_string(z))


# RC4 decryption
# Set data types
# Run key mutation
# Decrypt
# Encode to UTF-8

def RC4(key, data):

    key_bl = text_to_bytelist(key)
    if log:
        print(&quot;Key bytelist: \n&quot;, key)

    data_bl = raw_to_bytelist(data)
    if log:
        print(&quot;Raw bytelist: \n&quot;, data_bl)

    kS = KSA(key_bl)
    if log:
        print(&quot;KSA key: \n&quot;, kS)

    t = PRGA(kS, data_bl)
    if log:
        print(&quot;Output bytelist: \n&quot;, t)

    u = []
    for i in range(len(t)):
        u.append(from_signed(t[i]))
    if log:
        print(&quot;Un-signed bytelist: \n&quot;, u)

    out = bytelist_to_string(u)
    return (out)


# --------------------------------------------------------------------------------------
# Main
# --------------------------------------------------------------------------------------
# Optional: Enable logging for debugging
# Toggle key_ext to true if TEA key extraction is not already stored in key.txt
# Toggle key_print to true if you would like to display the key string

log = False
key_ext = True
key_print = True


# Read files or use built-in
# Key text file expected format is alphanumeric string
#   * Enable logging to display extracted string
#   * Can be pasted into a file to store
#   
# Packet capture expected format is raw hexadecimal
#   * Hex characters only, no escape characters or 0x
#   * One packet per line
#   * Can pull from wireshark using &quot;follow UDP stream&quot;, view as &quot;RAW&quot; for hex values

def main():

    # To use built-in key extraction, define the value of key[] here
    # The encrypted byte array can be found in the decompiled source code of the utility
    # If decompiler fills certain values with &quot;Byte.MAX_VALUE&quot;,
    #   replace with 127 (max value of signed byte)
    
    if key_ext == True:
        key_bl = [REDACTED]
        key = key_extract(key_bl)
        if key_print == True:
            print(&quot;Key string: \n&quot;, key)

    # Alternatively, a key stored as a string of alphanumeric values can be imported here
    
    else:
        with open(&quot;key.txt&quot;, &quot;r&quot;) as f:
           lines = f.readlines()
           key = &quot;&quot;
           for line in lines:
              key += line.strip()
           f.close()


    # Load a packet capture file with expected format of RAW hex strings
    
    with open(&quot;raw.txt&quot;, &quot;r&quot;) as g:
        packets = g.readlines()
        g.close()

    # Process each line from raw packet capture as individual packet and print results
    
    for packet in packets:
        raw = packet.strip()
        output = RC4(key, raw)
        print(output)
    
if __name__ == &quot;__main__&quot;:
    main()</code></pre><p>Again, <strong>this decryption works for all these devices</strong>. For any of the devices the Easy Smart Configuration Utility communicates with, this applies. The TL-SG105E is not the only piece of hardware that uses this software. It&apos;s just the one I&apos;m looking at now.</p><h2 id="how-would-this-be-used-in-practice">How would this be used in practice?</h2><p>Since the utility and switch communicate using 255.255.255.255 broadcast, the packets are easily intercepted by anyone on the same network segment. In order to capture the login credentials, an attacker would have to capture an admin&apos;s login. This is made substantially easier with the fact that broadcast is used for all communications with the devices.</p><p>This capture can then be decrypted and the login credentials can be extracted. The switch can then be logged into, even from outside of a management VLAN, and reconfigured to either give the attacker access to other VLANs, or expose targets to other VLANs.</p><p>I performed my packet captures using Wireshark. However, since management access is not commonly needed on these devices after the initial configuration, logins would be rare. A socket listener can be tailored to wait for any traffic sent on the static port used. Then the attacker could created network traffic anomalies to create the need for an admin to see what&apos;s wrong.</p><p>That might sound time consuming, or that it would be more effort than worthwhile. In a lot of cases, it very well might be. However, if a network is worth securing then it&apos;s worth examining such vulnerabilities. Attacks can and do take place over long periods of time. One of the primary objectives in breaking into a network is to ensure that you&apos;ll be able to do so again to be able to spend as much time as required to achieve your objective. This vulnerability opens the possibility of an attacker using any of the Easy Smart Switches to pivot the attack across VLANs.</p><h2 id="reporting-and-mitigating-the-vulnerability">Reporting and mitigating the vulnerability</h2><p>Once I had my proofs of concept ready and a thorough report written, I submitted my findings to TP-Link&apos;s provided security address. Although they were initially a bit unresponsive at first, later in the process they became much more communicative and expressed gratitude for having worked with them to resolve the issue. I checked in with them periodically through the process to see what the remediation time period looked like and to offer any clarification needed.</p><p>About three months after initial disclosure, they provided a patch for me to test. I repeated the process of decompiling and reading through the source to find that they extensively reworked the encryption. While RC4 and TEA were still included for backwards compatibility purposes (a necessary step of being able to patch the firmware of the device), there was new code for entirely different session-based encryption. While I was unable to identify the specific encryption scheme, I believe it&apos;s a form of RSA. Don&apos;t quote me on that though.</p><p>After finding the new encryption and trying to poke at it a bit, I went ahead and flashed the firmware on my device and set about capturing some packets. I was very pleased to find that the encryption changed between sessions. No more static key! And while not all of the transmitted data seemed to use the new encryption, the login credentials were no longer crackable with my proofs of concept.</p><p>Other issues such as the use of broadcast transmission and lack of HTTPS were unaddressed yet, but the most crucial vulnerability had been addressed first. I hope they continue along with developing more fixes, as the quality of improvement in this patch is a world of difference from the previous attempt. </p><figure class="kg-card kg-image-card kg-width-wide"><img src="https://geekly.dev/content/images/2023/03/IMG_6401-1.jpg" class="kg-image" alt="Encryption problems of the TP-Link TL-SG105E v5 and Easy Smart Switches" loading="lazy" width="1920" height="1080" srcset="https://geekly.dev/content/images/size/w600/2023/03/IMG_6401-1.jpg 600w, https://geekly.dev/content/images/size/w1000/2023/03/IMG_6401-1.jpg 1000w, https://geekly.dev/content/images/size/w1600/2023/03/IMG_6401-1.jpg 1600w, https://geekly.dev/content/images/2023/03/IMG_6401-1.jpg 1920w" sizes="(min-width: 1200px) 1200px"></figure>]]></content:encoded></item><item><title><![CDATA[Securing Remote Access for Dedicated Servers]]></title><description><![CDATA[Remote server management with SSH, FTPS, and RDP through OpenVPN on a pfSense]]></description><link>https://geekly.dev/securing-remote-access-for-dedicated-servers/</link><guid isPermaLink="false">63978195b67571032015fc72</guid><category><![CDATA[Tutorials]]></category><category><![CDATA[Networks]]></category><dc:creator><![CDATA[Nad]]></dc:creator><pubDate>Sun, 05 Feb 2023 22:33:11 GMT</pubDate><content:encoded><![CDATA[<p>I recently put together a Linux machine to run some Valheim dedicated server Docker images.</p><figure class="kg-card kg-bookmark-card"><a class="kg-bookmark-container" href="https://geekly.dev/valheim-dedicated-servers-in-docker/"><div class="kg-bookmark-content"><div class="kg-bookmark-title">Valheim Dedicated Servers in Docker on Linux</div><div class="kg-bookmark-description">What better excuse to learn some Docker, and what better time than right now?</div><div class="kg-bookmark-metadata"><img class="kg-bookmark-icon" src="https://geekly.dev/content/images/2022/09/favicon-1.ico" alt><span class="kg-bookmark-author">geekly.dev</span><span class="kg-bookmark-publisher">Nad</span></div></div><div class="kg-bookmark-thumbnail"><img src="https://geekly.dev/content/images/2022/12/valheim_LHI4lMigGB.jpg" alt></div></a></figure><p>This is a follow-up to that article, but can be applicable to many other situations where you want to provide remote access to a machine without directly exposing myriad open ports to the internet at large. This approach can greatly minimize the attack surface and compartmentalize negative impact.</p><p>For my home network, my pfSense box is going to do the bulk of heavy lifting in this setup. It serves VLANs, performs all the inter-VLAN routing and firewalling, and can also serve OpenVPN including certificates.</p><p>Keep in mind though that these configurations can be done on other devices as well, although the specifics vary. So while some of the details that I&apos;ll be going over in this are specific to my own network configuration, this pattern of services can be a useful one to replicate for a wide range of remote access use-cases. </p><h3 id="y-tho">Y tho?</h3><p>Before setting this up, if I wanted to do any server maintenance I&apos;d have to physically be <em>at the server</em>. If any of the instances crashed, I&apos;d have to go to it, open up a terminal, and restart it. With this setup, I can do this now from anywhere. Not just from my own home network, but even while I&apos;m out and about. I have the VPN client installed on my phone, so I can pipe my phone connection through the VPN, start up a hotspot, and connect any ol&apos; computer to my network through it.</p><p>This also means that I can give access to a few trusted friends. If they notice any problems, or have something they want to change themselves, they don&apos;t even need to wait on me to take care of it for them.</p><p><em>As a note of caution, though</em>: The friends I have given access to are competent with this stuff. I can trust them to not do inexplicably strange things that break everything in unimaginable ways. I&apos;ve taken steps to limit access to only necessary parts, which also has the effect of limiting their liability for things going wrong. But ultimately, I&apos;m still placing trust in them to access my own personal equipment. This subject could be a whole rabbit hole of its own, so to keep it brief I&apos;ll just caution against giving out access to anyone and everyone.</p><hr><p>With every new port opened in a firewall, the potential attack surface increases. While we can&apos;t eliminate the need for the open ports for the game&apos;s dedicated server (at least not without requiring VPN connections for each client, which would be a fairly ridiculous requirement for a game), we <em>can</em> isolate the server to its own VLAN (or alternatively, its own subnet). </p><p>Although, this raises the question: If our server is on its own isolated network segment, is there a need for hiding the open ports of the other services? If we want to run SSH for shell access and FTPS for file transfers, can&apos;t we just make sure to use strong passwords and certificates for those connections?</p><p>The first reason is perception. If you&apos;re scanning through addresses to find worthwhile targets, a private <em>game</em> server might not be very high on your list. Private <em>shell access, remote desktop, and file transfer</em> servers, on the other hand, can paint a more tantalizing story. &quot;What do they have that&apos;s worth hiding? Why do they need remote access?&quot; To be fair, this probably sounds a bit hyperbolic. If you start thinking in terms of automation, though, you can start to see why having certain ports exposed can be unappealing. Take a look at this honeypot analysis for a better illustration.</p><figure class="kg-card kg-bookmark-card"><a class="kg-bookmark-container" href="https://hackertarget.com/cowrie-honeypot-analysis-24hrs/?ref=geekly-dev"><div class="kg-bookmark-content"><div class="kg-bookmark-title">Cowrie Honeypot Analysis - 24hrs of Attacks | HackerTarget.com</div><div class="kg-bookmark-description">A review of Cowrie Honeypot logs after 24 hours. Includes source analysis from over 200 unique connections and an animated attack map (pewpew).</div><div class="kg-bookmark-metadata"><img class="kg-bookmark-icon" src="https://hackertarget.com/wp-content/uploads/2018/03/hackertarget-logo-square.png" alt><span class="kg-bookmark-author">HackerTarget.com</span></div></div><div class="kg-bookmark-thumbnail"><img src="https://hackertarget.com/wp-content/uploads/2018/03/city-skyline.jpg" alt></div></a></figure><p>Using strong passwords and certificates for authentication will keep attackers at bay, but that won&apos;t stop them from constantly testing for weaknesses. The barrage of inbound connections only multiplies with each additional service added. Which brings us to the next reason.</p><p>Piping all of our remote access services through a VPN tunnel allows us to add or remove services as needed without having to worry about opening ports for each, and without having to worry as much about the security profile of exposing those ports. For starters, we&apos;ll only be implementing RDP, SSH, and FTPS. But down the line if we also want to deploy other services, we can spin them up without having to expose them directly to the web. </p><p>In short, it enables a direct encrypted tunnel solely to the server with whatever services it&apos;s running, while minimizing direct exposure to scanners and potential attackers.</p><h3 id="are-vlans-required">Are VLANs required?</h3><p>In short, no. Not VLANs specifically, although they are a convenient solution in my case.</p><p>The purpose that the VLAN serves in this situation is to segment the server access away from your local network traffic. </p><p>To ask another way though, <em>is network segmentation required</em>? That answer would be <em>maybe</em>.</p><p>The answer really depends on what trust factors to take into account. If the VPN is solely for your own use to remotely access your server, you have much less to worry about with limiting access. If you want to be able to have others remotely access the server, then you need to ask yourself if you also want them to be able to access the rest of your local network.</p><p>Using some sort of network segmentation allows for much more control of access. If the VPN is piped directly into a single LAN pool, the access through the VPN is equivalent to allowing access to the entire LAN. Setting up network segmentation enables strict limiting of what the VPN can and can&apos;t access.</p><p>Network segmentation can be accomplished with subnets and hardware configurations, or by using VLANs. &#xA0;In my own home network, hardware-based segmentation would be difficult as I would have to run an excessive amount of cable. VLANs made segmentation possible without having to spend the rest of my days in crawlspaces. If you&apos;re unfamiliar with them and would like to know more, I wrote a series describing VLANs that might be worth a read.</p><figure class="kg-card kg-bookmark-card"><a class="kg-bookmark-container" href="https://geekly.dev/strangest-explanation-of-vlans/"><div class="kg-bookmark-content"><div class="kg-bookmark-title">The strangest explanation of VLANs you&#x2019;ve never heard</div><div class="kg-bookmark-description">Mental models rarely fit neatly into little boxes, yet we try to visualize them using overly simplistic means. For once, let&#x2019;s get a little nutty.</div><div class="kg-bookmark-metadata"><img class="kg-bookmark-icon" src="https://geekly.dev/content/images/2022/09/favicon-1.ico" alt><span class="kg-bookmark-author">geekly.dev</span><span class="kg-bookmark-publisher">Nad</span></div></div><div class="kg-bookmark-thumbnail"><img src="https://geekly.dev/content/images/2022/11/vlan06.png" alt></div></a></figure><p>So if the remote access is just for you and you alone, don&apos;t worry about having to set up segmentation. But if you plan on having others be able to access it, I&apos;d strongly suggest looking into implementing some sort of access control methodology such as network segmentation.</p><h3 id="one-last-bit">One last bit...</h3><p>I originally wrote this out as a step-by-step walkthrough, but came to the realization that it would really only serve well as documentation of my own network and probably wouldn&apos;t be of much use to others. Instead, I&apos;m going to take a more broad-brush approach to illustrate the general principles involved with this setup. By and large, there are quite a few good tutorials out there for a lot of the specifics being covered and I will drop those breadcrumbs as we go along.</p><hr><h2 id="setting-up-the-services">Setting up the services</h2><p>Before we get into setting up the VPN, let&apos;s just start up the services we&apos;re going to want to host if you don&apos;t have them set up already. I mostly just use SSH. FTPS makes it quick and easy to copy files to and from the server. And RDP lets me use the desktop from anywhere on the rare occasion that I want to use an application that&apos;s GUI based like VS Code.</p><p>Thankfully, these are all relatively quick and painless to set up. </p><p>SSH is as easy as running <code>sudo apt install openssh-server</code>. You can double check that it&apos;s enabled in systemctl by running <code>sudo systemctl is-enabled ssh</code>. If it isn&apos;t for some reason, you can enable it with <code>sudo systemctl enable ssh</code> and start it up with <code>sudo systemctl start ssh</code>. When connecting to it the first time, you&apos;ll be asked if you want to trust the provided certificate. After you accept the first time, that warning shouldn&apos;t pop up again when logging in from the same machine.</p><p>For FTPS, I used vsftpd.</p><figure class="kg-card kg-bookmark-card"><a class="kg-bookmark-container" href="https://linuxhint.com/installing_ftp_server_linux_mint/?ref=geekly-dev"><div class="kg-bookmark-content"><div class="kg-bookmark-title">Install and configure FTP server on Linux Mint 20</div><div class="kg-bookmark-description">File Transfer Protocol is used to transfer files and information between two systems over a network. It is the most popular network protocol. However, the FTP by default does not encrypt the traffic, which is not a secure method and can result in an attack on a server. In this article, how to instal&#x2026;</div><div class="kg-bookmark-metadata"><img class="kg-bookmark-icon" src="https://linuxhint.com/wp-content/uploads/2021/09/cropped-512x512_linuxhint-180x180.png" alt><span class="kg-bookmark-author">&lt;img src=&quot;https://linuxhint.com/wp-content/uploads/2019/11/Logo-final.png&quot; alt=&quot;&quot;&gt;</span><span class="kg-bookmark-publisher">View all posts</span></div></div><div class="kg-bookmark-thumbnail"><img src="data:image/svg+xml,%3Csvg%20xmlns=&apos;http://www.w3.org/2000/svg&apos;%20viewBox=&apos;0%200%201123%20528&apos;%3E%3C/svg%3E" alt></div></a></figure><p>If you run into issues with a systemd error code <a href="https://unix.stackexchange.com/questions/181436/vsftpd-wont-start-systemd1-vsftpd-service-main-process-exited-code-exite?ref=geekly-dev"><code>systemd[1]: vsftpd.service: main process exited, code=exited, status=2/INVALIDARGUMENT</code></a>, check out the suggestions in <a href="systemd[1]: vsftpd.service: main process exited, code=exited, status=2/INVALIDARGUMENT">this thread</a>.</p><p>RDP gave me the most trouble out of all of them, but only because I didn&apos;t realize that I couldn&apos;t sign in as a user that was already signed in. Seems silly in retrospect, but it didn&apos;t give any errors or indication that it was an issue. It just immediately dropped the connection and left me scratching my head, trying all kinds of things. In the end, this was pretty much all I needed to actually get it to work.</p><pre><code class="language-sh">sudo apt install xrdp</code></pre><p>If you run into issues, you can take a look through this walkthrough.</p><figure class="kg-card kg-bookmark-card"><a class="kg-bookmark-container" href="https://www.digitalocean.com/community/tutorials/how-to-enable-remote-desktop-protocol-using-xrdp-on-ubuntu-22-04?ref=geekly-dev"><div class="kg-bookmark-content"><div class="kg-bookmark-title">How To Enable Remote Desktop Protocol Using xrdp on Ubuntu 22.04 | DigitalOcean</div><div class="kg-bookmark-description">Remote Desktop Protocol (RDP) is a network protocol developed by Microsoft that allows users to remotely access and interact with the graphical user interfac&#x2026;</div><div class="kg-bookmark-metadata"><img class="kg-bookmark-icon" src="https://www.digitalocean.com/_next/static/media/android-chrome-512x512.5f2e6221.png" alt><span class="kg-bookmark-author">DigitalOcean</span><span class="kg-bookmark-publisher">Raghav Aggarwal</span></div></div><div class="kg-bookmark-thumbnail"><img src="https://www.digitalocean.com/_next/static/media/intro-to-cloud.d49bc5f7.jpeg" alt></div></a></figure><p>There is also a wide variety of other options available for remote desktop. xrdp works well for me, but you can take a look through what&apos;s available and see if another might suit your needs better.</p><figure class="kg-card kg-bookmark-card"><a class="kg-bookmark-container" href="https://www.tecmint.com/best-remote-linux-desktop-sharing-software/?ref=geekly-dev"><div class="kg-bookmark-content"><div class="kg-bookmark-title">13 Best Tools to Access Remote Linux Desktop</div><div class="kg-bookmark-description">In this article, we will share a list software for accessing a remote Linux desktop: the list starts off with VNC applications.</div><div class="kg-bookmark-metadata"><img class="kg-bookmark-icon" src="https://www.tecmint.com/wp-content/uploads/2020/07/favicon.ico" alt><span class="kg-bookmark-author">13 Best Tools to Access Remote Linux Desktop</span><span class="kg-bookmark-publisher">Aaron Kili</span></div></div><div class="kg-bookmark-thumbnail"><img src="https://www.tecmint.com/wp-content/uploads/2018/03/Remote-Linux-Desktop-Sharing-Software.png" alt></div></a></figure><h2 id="setting-up-the-vpn">Setting up the VPN</h2><p>There are a few different options when it comes to setting up a VPN server. OpenVPN is the most logical choice for me for a number of reasons, not the least of which is that its functionality is readily available through my pfSense as an add-on package. For clients, an OpenVPN application is needed which is available for free. <a href="https://openvpn.net/cloud-docs/openvpn-compatible-routers-user-guides/?ref=geekly-dev">Other platforms</a> such as <a href="https://www.sparklabs.com/support/kb/article/setting-up-an-openvpn-server-with-opnsense-and-viscosity/?ref=geekly-dev">OPNSense</a>, <a href="https://help.firewalla.com/hc/en-us/articles/115004274633-Firewalla-VPN-Server?ref=geekly-dev">Firewalla</a>, <a href="https://openvpn.net/cloud-docs/using-openvpn-cloud-profile-to-configure-dd-wrt/?ref=geekly-dev">DD-WRT</a>, <a href="https://openvpn.net/cloud-docs/using-openvpn-cloud-profile-to-configure-openwrt/?ref=geekly-dev">OpenWRT</a>, <a href="https://openvpn.net/cloud-docs/deploying-connector-on-teltonika-rutos-compatible-router/?ref=geekly-dev">Teltonika</a>, <a href="https://openvpn.net/cloud-docs/deploying-connector-on-ubiquiti-edgemax-compatible-router/?ref=geekly-dev">Ubiquiti</a>, and <a href="https://help.mikrotik.com/docs/display/ROS/OpenVPN?ref=geekly-dev">Mikrotik</a> can readily deploy an OpenVPN server. <em>That&apos;s probably not even an exhaustive list.</em> Some SOHO gateway routers might come with OpenVPN functionality built in as well, so if you aren&apos;t sure just do a quick search to see whether it&apos;s available on your existing equipment.</p><p>OpenVPN can also be set up on a server other than the firewall machine. It&apos;s available as the <a href="https://community.openvpn.net/openvpn/wiki?ref=geekly-dev">Community Edition</a> or as the <a href="https://openvpn.net/access-server/?ref=geekly-dev">Access Server</a>, which is the enterprise offering which can be used in a limited fashion for free or as a paid service.</p><p>In my case, it&apos;s an easy choice to install the VPN server on my pfSense. It&apos;s free, it&apos;s well integrated, and overall feels like a much cleaner topology than running the VPN server off of the dedicated server machine.</p><p>The guide I followed got me most of the way there. It offers a good general purpose configuration.</p><figure class="kg-card kg-bookmark-card"><a class="kg-bookmark-container" href="https://www.comparitech.com/blog/vpn-privacy/openvpn-server-pfsense/?ref=geekly-dev"><div class="kg-bookmark-content"><div class="kg-bookmark-title">How to Setup your own OpenVPN Server in pfSense</div><div class="kg-bookmark-description">In this guide, we&#x2019;re going to give you our step-by-step guide on how to setup your own OpenVPN server using pfSense.</div><div class="kg-bookmark-metadata"><img class="kg-bookmark-icon" src="https://cdn.comparitech.com/wp-content/uploads/2018/12/cropped-favicon-1-270x270.jpg" alt><span class="kg-bookmark-author">Comparitech</span><span class="kg-bookmark-publisher">Marc Dahan</span></div></div><div class="kg-bookmark-thumbnail"><img src="https://cdn.comparitech.com/wp-content/uploads/2021/03/How-to-set-up-your-own-OpenVPN-server-in-pfSense.jpg" alt></div></a></figure><h3 id="tuntap-mode">TUN/TAP mode</h3><p>Unless you have strange use cases such as below, TUN mode is most likely the preferred mode. If you just want to be able to use things like SSH, FTPS, and RDP, go with TUN mode and feel free to skip this section.</p><p>The difference between TUN and TAP is similar to the difference between using layer 2 and layer 3 network communications. Kinda.</p><p>For TUN mode, a new subnet is created, and that subnet is then NATted to the destination network. Because it&apos;s based in a different subnet being piped through NAT, some protocols that only work within a local network&apos;s broadcast domain won&apos;t work properly.</p><p>In TAP mode, the VPN interface is bridged to an existing subnet and clients connecting in can obtain an address through DHCP to that subnet.</p><p>For the services I&apos;m using (FTPS, SSH, and RDP), TUN mode works fine. But if remote access ends up being a requirement for other services (ie management of network hardware that utilizes hardware addressing protocols such as MAC-telnet, or services that use broadcast domain transmissions to communicate), TAP mode might be a better option. But keep in mind that TAP mode is incompatible with Android clients. It also won&apos;t work with the OpenVPN Connect app, and needs the <a href="https://openvpn.net/community-downloads/?ref=geekly-dev">OpenVPN 2 GUI</a> to function properly. </p><p>The only reason I bring it up is that I <em>also</em> set up another management VPN so that I can access and maintain my network equipment remotely as well as access Windows network shares. I can even connect through just using my cell phone as a hotspot if I&apos;m out and about. I can connect my laptop to my hotspot, VPN into my network, and do whatever I need to from wherever I am. (This is a nice trick for getting around the limitation of Android not being able to use TAP mode, if you happen to have a laptop on hand.)</p><p>The configuration for TAP differs slightly from TUN because TAP is bridged to an existing subnet while TUN is assigned its own. pfSense&apos;s documentation on setting up OpenVPN with TAP mode should clarify things though.</p><figure class="kg-card kg-bookmark-card"><a class="kg-bookmark-container" href="https://docs.netgate.com/pfsense/en/latest/recipes/openvpn-bridged.html?ref=geekly-dev"><div class="kg-bookmark-content"><div class="kg-bookmark-title">pfSense&#xC2;&#xAE; software Configuration Recipes &#x2014; Bridging OpenVPN Connections to Local Networks | pfSense Documentation</div><div class="kg-bookmark-description"></div><div class="kg-bookmark-metadata"><img class="kg-bookmark-icon" src="https://docs.netgate.com/pfsense/en/latest/_static/favicon.ico" alt><span class="kg-bookmark-author">pfSense Documentation</span></div></div><div class="kg-bookmark-thumbnail"><img src="https://docs.netgate.com/pfsense/en/latest/_images/fa-plus.png" alt></div></a></figure><h3 id="firewall-rules">Firewall rules</h3><p>It can be difficult to keep things straight when planning out firewall rules that involve multiple interfaces. To that end, I put together a quick article on a simple diagram that helped me more effectively visualize what&apos;s going on. There are also some useful tips in general if you find yourself having issues sorting things out.</p><figure class="kg-card kg-bookmark-card"><a class="kg-bookmark-container" href="https://geekly.dev/simple-method-for-complex-firewalls/"><div class="kg-bookmark-content"><div class="kg-bookmark-title">Simple method for complex firewalls</div><div class="kg-bookmark-description">An easy diagram for visualizing firewalls with multiple interfaces across multiple different networks.</div><div class="kg-bookmark-metadata"><img class="kg-bookmark-icon" src="https://geekly.dev/content/images/2022/09/favicon-1.ico" alt><span class="kg-bookmark-author">geekly.dev</span><span class="kg-bookmark-publisher">Nad</span></div></div><div class="kg-bookmark-thumbnail"><img src="https://geekly.dev/content/images/2023/01/firewall6.png" alt></div></a></figure><p>From an allow/deny perspective, you&apos;re going to want to at least <em>allow</em> traffic from the VPN subnet to server subnet, as well as from the server subnet to the VPN (which may already be covered by an allow all rule). You&apos;re also going to want to set up <em>deny</em> rules for any networks that you don&apos;t want the VPN to be able to talk to.</p><p>If the number of VLANs/subnets involved is minimal, this can be done in an orderly fashion by just going down the checklist of each interface and creating the appropriate rules. <em>Note: Rules for the VPN&apos;s interface should go on the newly assigned interface itself, not on the OpenVPN interface.</em></p><p>If you find things starting to get unwieldy, you might want to consider mapping out some <em>floating rules</em> instead. In my case, having WAN, LAN, 4 VLANs, and 2 VPNs was the threshold where it became easier for me to to just use floating rules instead of mapping each interface individually.</p><figure class="kg-card kg-bookmark-card"><a class="kg-bookmark-container" href="https://docs.netgate.com/pfsense/en/latest/firewall/floating-rules.html?ref=geekly-dev"><div class="kg-bookmark-content"><div class="kg-bookmark-title">Firewall &#x2014; Floating Rules | pfSense Documentation</div><div class="kg-bookmark-description"></div><div class="kg-bookmark-metadata"><img class="kg-bookmark-icon" src="https://docs.netgate.com/pfsense/en/latest/_static/favicon.ico" alt><span class="kg-bookmark-author">pfSense Documentation</span></div></div></a></figure><h3 id="some-odd-stumbling-blocks">Some odd stumbling blocks</h3><p>In the trials and tribulations of getting my VPNs set up the way I wanted, I chewed through quite a few forum posts that were <em>almost but not quite</em> related. This took me down quite a few roads that turned out to be dead ends. I&apos;ll list out the ones I can remember.</p><p><strong>Pushing routes:</strong> manually defining the gateway and routes using <code>push &quot;route 10.10.0.0 255.255.255.0&quot;</code> and similar things were completely unnecessary with my setup. The gateway and routes should already defined in the server configuration. Sometimes I would get an error in connection attempts that would lead me to believe that I needed to manually set them, but every time it turned out to be another server setting somewhere that caused the conflict. </p><p><strong>Hybrid NAT:</strong> I&apos;ll be honest in that I don&apos;t even remember what initially set me down the road of manually defining Outbound NAT rules in pfSense for the VPN. Something about trying to track down why I couldn&apos;t get internet breakout, or perhaps difficulty connecting to other devices. In any case, while the manually defined rules didn&apos;t <em>hinder</em> things, they didn&apos;t solve any problems either. The automatic Outbound NAT rules were sufficient.</p><p><strong>Subnets and static routes:</strong> With the VPN hosted directly on the pfSense, its built in routing table is already aware of the subnets that it has generated. Setting up static routes might become necessary if the VPN server is <em>not</em> hosted directly from the pfSense though.</p><hr><p>By and large, figuring out the limitations of TUN mode, getting my firewall rules sorted, and setting up a TAP VPN for the things I needed it for solved the issues I was running into that led me down those roads in the first place. Hopefully I&apos;ve laid out enough breadcrumbs to help anyone else trying this out for the first time to avoid some of the same mistakes I ran into. </p>]]></content:encoded></item><item><title><![CDATA[Simple methods for complex firewalls]]></title><description><![CDATA[An easy diagram for visualizing firewalls with multiple interfaces across multiple different networks, and some useful firewalling tips!]]></description><link>https://geekly.dev/simple-method-for-complex-firewalls/</link><guid isPermaLink="false">63cf5dedb6757103201601ab</guid><category><![CDATA[Networks]]></category><dc:creator><![CDATA[Nad]]></dc:creator><pubDate>Tue, 24 Jan 2023 05:43:04 GMT</pubDate><media:content url="https://geekly.dev/content/images/2023/01/firewall6.png" medium="image"/><content:encoded><![CDATA[<img src="https://geekly.dev/content/images/2023/01/firewall6.png" alt="Simple methods for complex firewalls"><p>I wanted to share a simple visual aid I found useful when it comes to trying to disentangle firewall rules involving many interfaces.</p><p>With basic SoHo gateways, firewall rules are fairly easy to visualize. They&apos;re entirely designed around blocking unwanted traffic from the WAN interface, and statefully allow traffic from the LAN to go out as needed. There is only one direction to keep in mind, and only a single internal network to worry about.</p><p>Things get quite a bit more complicated when operating a more complicated firewall that has influence over multiple internal networks through multiple interfaces. When I first switched over to using a pfSense running quite a few VLANs in my home lab, I had a bit of experimenting to do to figure out which direction the firewall was enforcing for each network interface. Was every rule set on every interface acting bi-direcitonally? Was it only blocking downstream? Were some upstream and some downstream? What is the best way for me to be thinking about this?</p><p>I came across a very nice illustration somewhere in my searches. Unfortunately, I wasn&apos;t able to dig up the link to be able to share the original diagram. But the visualization stuck with me and has proven to greatly simplify the way I think about my firewall when I need to create new rules.</p><figure class="kg-card kg-image-card kg-card-hascaption"><img src="https://geekly.dev/content/images/2023/01/firewall4.png" class="kg-image" alt="Simple methods for complex firewalls" loading="lazy" width="1080" height="1080" srcset="https://geekly.dev/content/images/size/w600/2023/01/firewall4.png 600w, https://geekly.dev/content/images/size/w1000/2023/01/firewall4.png 1000w, https://geekly.dev/content/images/2023/01/firewall4.png 1080w" sizes="(min-width: 720px) 720px"><figcaption>Happy lil interface</figcaption></figure><p>Let&apos;s start with a single interface. The blue is the traffic coming from that network. The red is a unidirectional firewall. Unless specifically told to allow certain traffic types through, it will block all traffic coming from that network (implicit default deny). </p><p>If this is a WAN interface, it should be blocking everything by default.</p><p>If this is a LAN interface, there should be an allow rule to let the traffic out unless there is a good reason for the network to be isolated.</p><p>Let&apos;s put a bunch of different interfaces together, now. </p><figure class="kg-card kg-image-card kg-card-hascaption"><img src="https://geekly.dev/content/images/2023/01/firewall3.png" class="kg-image" alt="Simple methods for complex firewalls" loading="lazy" width="1080" height="1080" srcset="https://geekly.dev/content/images/size/w600/2023/01/firewall3.png 600w, https://geekly.dev/content/images/size/w1000/2023/01/firewall3.png 1000w, https://geekly.dev/content/images/2023/01/firewall3.png 1080w" sizes="(min-width: 720px) 720px"><figcaption>Gather round the circle</figcaption></figure><p>The new feature in the middle can be thought of as a &quot;trusted circle&quot;.</p><p>If traffic from one of the interfaces passes one of its firewall&apos;s rules, it is allowed to join the trusted circle. From there, it can be passed along to anywhere else. Because from the direction of the trusted circle, the unidirectional firewalls are not enforcing any rules from that direction. </p><p>This shift in perspective answered my internal dialogue about which directions firewalls were facing on which interfaces. It wasn&apos;t a matter of upstream to downstream, or from the external to the internal. It was a matter of thinking of each interface as being outside the firewall&apos;s trust, and whether or not it would let the traffic in to pass through.</p><h2 id="some-other-helpful-things-to-keep-in-mind">Some other helpful things to keep in mind</h2><p>That&apos;s it for the visualization. That&apos;s mainly what I wanted to share. But while you&apos;re here, I may as well list out a few other things that I&apos;ve helpful to keep in mind about firewall rules. [Should be noted that I haven&apos;t, by any means, worked with all varieties of firewalls. Thare general rules, but there may be exceptions. When in doubt, RTFM for your specific hardware.]</p><h3 id="if-nothing-else-there-is-always-implicit-deny">If nothing else, there is always implicit deny</h3><p>It&apos;s an unwritten (or at least undisplayed) law of firewalls that if no rules apply to the traffic, it will be denied trust. </p><h3 id="rule-order-is-top-to-bottom">Rule order is top to bottom</h3><p>Pretty straightforward. It goes down the list and checks the traffic against each rule until it finds one that applies. If none of the rules apply, it&apos;s saved from the spiraling descent into oblivion by the good grace of implicit deny, which banishes it from this plane of existence.</p><h3 id="the-first-rule-that-applies-is-the-rule-that-sticks">The first rule that applies is the rule that sticks</h3><p>Whether it&apos;s a deny or a pass, if it fits, it sits. So when going down the list from top to bottom, if the first rule that applies to the traffic is a deny rule, the traffic is denied even if there is another rule further down that would also pass it. This makes the order of rules important to keep in mind.</p><h3 id="once-traffic-is-trusted-there-isnt-a-second-chance">Once traffic is trusted, there isn&apos;t a second chance</h3><p>Unless there&apos;s a second firewall somewhere down the pipeline, of course. But speaking in terms of a single firewall handling traffic from multiple networks, the rules for each network interface must be designed around whatever traffic is expected from that network. If traffic from Network A to Network B must be blocked, it needs to be blocked on Network A&apos;s interface. Network B&apos;s unidirectional rules won&apos;t apply to that traffic. (Other means of disabling inter-network traffic can be utilized as well, but I&apos;m referring to the firewall-specific methodology of limiting network access here.)</p><h3 id="setting-a-source-port-is-rarely-ever-necessary">Setting a source port is rarely ever necessary</h3><p>If you find yourself setting a source port for something, odds are that you&apos;re attempting to do something unnecessary. Source ports are often randomly chosen by an application. The destination ports are the ones that stay static, but the source ports are not usually required to be the same. If you find yourself saying, &quot;But this port is always the same and I want to allow traffic to it,&quot; it&apos;s more than likely because the visualization of the flow of traffic through the firewall&apos;s interfaces got a bit muddled. </p><p>To explain a bit further, let&apos;s bring up an embarrassingly incorrect thing I tried to do before I realized what was going on. I set an allow rule for traffic on an internal network for a port on local computer running a server. I set the source address for the computer and the source port for the service. Doing this didn&apos;t break anything. But it was entirely useless because there was an allow rule immediately below it that would have also applied. But I thought that it might fix a problem I was having with connecting to that service because I was explicitly stating it. </p><p>So this hint is not so much about keeping anyone from breaking something. It&apos;s more of a bellwether. If you find yourself doing it, odds are good that it&apos;s because of an underlying misconception. (Most of the misconceptions that led me to making these types of errors were resolved by the visualization in this article.)</p><h3 id="allowing-traffic-for-a-port-is-not-the-same-as-port-forwarding">Allowing traffic for a port is not the same as port forwarding</h3><p>On SoHo gateways, port forwarding is generally a one-step deal. By creating a port forward, the gateway usually creates a firewall and a Network Address Translation (NAT) rule without the end user having to worry too much about the specifics. With more advanced features comes more requirements. Firewall rules and NAT are often handled separately on more capable network equipment.</p><p>Creating a firewall rule to allow traffic targeting a certain port doesn&apos;t necessarily do the trick for getting the traffic to its destination. That&apos;s because computers external to your network are not and should not be allowed to address computers in your local network directly (at least not with IPv4). The device that&apos;s connecting to WAN, usually your firewall, is the one that receives the traffic. For that device to know how to direct external traffic to an internal address, it needs to be told how. And that happens in the form of a NAT rule. NAT will actually change the information in the Frame and Packet layers to adjust destination accordingly. (Read here for more information on <a href="https://geekly.dev/tcp-ip-model/">network layers and TCP/IP</a>.)</p><p>It&apos;s not just NAT that does the trick, either. First a packet must pass a firewall rule and be considered trusted. Then it needs to be told where to go with NAT. </p><p>For local traffic, NAT is not as much of a concern (although it can still be relevant in some configurations). Most of the time, you&apos;re able to address another local computer even if it&apos;s on a different subnet. </p><p>More information about the differences between local and external addressing can be found in <a href="https://www.rfc-editor.org/rfc/rfc1918?ref=geekly-dev">RFC 1918</a>, which details the exhaustion of the IPv4 addressing scheme and designates reserved ranges for private use.</p><p>NAT is not usually needed for IPv6, but since most current internet traffic still involved IPv4, NAT is a necessary step in directing external traffic to internal resources.</p><h3 id="when-in-doubt-test-it-and-log-it">When in doubt, test it and log it</h3><p>For most of your rules, you probably aren&apos;t going to want to log the traffic. Enabling logs for allowed connections can rapidly fill up your logs, and even edge case deny rules can spam a surprising amount if there&apos;s an unruly device on your network that insists upon sending out that one annoying packet every thirty seconds.</p><p>But for troubleshooting purposes, the enabling logging can give you immediate x-ray vision to see how far through the network a given packet is getting before spiraling into oblivion. Simply set up a rule you want to test, enable logging, send the packet, and check the logs. If the rule generates a log entry, you&apos;ll have immediate verification that it&apos;s working as intended. If it fails to generate an entry, a different rule is applying to the traffic before meeting the rule you&apos;re logging. Check all the things listed above such as rule order and interface direction, change things around, and test again until you&apos;re able to generate a log entry.</p><p>Once you&apos;ve got it set up in a way that&apos;s working, you can disable logging so it&apos;s not clogging up the works with unnecessary verbosity.</p><hr><p>That&apos;s about it! If I come across more useful things, I might add them on. But I wanted to keep this one fairly short and sweet. Have a good one!</p><figure class="kg-card kg-image-card kg-width-full"><img src="https://geekly.dev/content/images/2023/01/firewall5.png" class="kg-image" alt="Simple methods for complex firewalls" loading="lazy" width="1920" height="1080" srcset="https://geekly.dev/content/images/size/w600/2023/01/firewall5.png 600w, https://geekly.dev/content/images/size/w1000/2023/01/firewall5.png 1000w, https://geekly.dev/content/images/size/w1600/2023/01/firewall5.png 1600w, https://geekly.dev/content/images/2023/01/firewall5.png 1920w"></figure>]]></content:encoded></item><item><title><![CDATA[Valheim Dedicated Servers in Docker on Linux]]></title><description><![CDATA[What better time to learn some Docker, and what excuse than to check out the mistlands?]]></description><link>https://geekly.dev/valheim-dedicated-servers-in-docker/</link><guid isPermaLink="false">638f42fbb67571032015f634</guid><category><![CDATA[Projects]]></category><category><![CDATA[Tutorials]]></category><dc:creator><![CDATA[Nad]]></dc:creator><pubDate>Sat, 10 Dec 2022 23:25:14 GMT</pubDate><media:content url="https://geekly.dev/content/images/2022/12/valheim_LHI4lMigGB.jpg" medium="image"/><content:encoded><![CDATA[<img src="https://geekly.dev/content/images/2022/12/valheim_LHI4lMigGB.jpg" alt="Valheim Dedicated Servers in Docker on Linux"><p>I&apos;ve kinda been itching for a good excuse to play around with Docker and learn the ropes a little bit. I&apos;m also crazy about Valheim, which just released a big new content update that has been in the works for the past year. I set up a dedicated server for some friends on a spare Windows machine I have lying around. But in my mind, this sort of thing (running servers) feels best in Linux. So I&apos;ll be wiping Windows clear off of it and running a few dedicated servers off of Linux.</p><p>I have a few criteria specific to my situation that I&apos;d like to accomplish with this setup.</p><ul><li>I want to be able to spin up multiple servers concurrently.</li><li>I want trusted friends to be able to VPN into the network segment to manage the servers as needed. (This machine will run within its own VLAN to suit that purpose.)</li><li>And I&apos;d like to automate a few things to make common administrative tasks quick and painless, even for friends who aren&apos;t savvy with command line.</li></ul><p>Obviously not all of these thing will be applicable to everyone wanting to run a Valheim dedicated server. So if you&apos;ve come across this page searching for a straightforward tutorial of Valheim dedicated server Docker images in Linux, I will still try to provide some helpful bits. I&apos;ll split up the article into two parts, covering my experience with getting the dedicated server up and running in Docker, then later we&apos;ll get into the criteria mentioned above.</p><h3 id="making-backups">Making backups</h3><p>I migrated this server from Windows to Linux, so I made a backup of all the server files since I&apos;ll be wiping the operating system completely. I won&apos;t be needing all of the files, since it&apos;s going to run as a Docker image, but backed up the entire dedicated server file tree regardless.</p><p>If you have an existing world you want to copy over, first determine whether it is stored locally or in the cloud. Since patch <a href="https://steamdb.info/patchnotes/8954338/?ref=geekly-dev">0.209.8</a>, there&apos;s an option to use Steam&apos;s cloud storage. More information about their cloud storage update can be found in this <a href="https://steamcommunity.com/app/892970/discussions/0/4615641483004444994/?ref=geekly-dev">Steam community post</a>.</p><p>Worlds stored locally will be in <code>%UserProfile%\AppData\LocalLow\IronGate\Valheim\worlds_local</code> in Windows or <code>~/.config/unity3d/IronGate/Valheim</code> in Linux.</p><p>Worlds saved on the cloud will be in <code>C:\Program Files(x86)\Steam\userdata\NUMERICSTEAMID\892970\remote</code> in Windows, or <code>~/.steam/steam/userdata/NUMERICSTEAMID/892970/remote</code> in Linux.</p><p>Worlds from a previous dedicated server will be in <code>C:\Program Files(x86)\Steam\steamapps\common\Valheim dedicated server\</code> in Windows, or <code>~/.config/unity3d/IronGate/Valheim/worlds</code> in Linux.</p><p>If you are unable to find the correct world files in any of those locations, it may only be available through Steam&apos;s online cloud storage. <a href="https://store.steampowered.com/account/remotestorageapp/?appid-892970=&amp;ref=geekly-dev">Follow this link</a> (<a href="https://store.steampowered.com/account/remotestorageapp/?appid-892970=&amp;ref=geekly-dev"><code>https://store.steampowered.com/account/remotestorageapp/?appid-892970</code></a>), login to your steam account, and you should get a list of all synced world files contained there.</p><h3 id="installing-linux">Installing Linux</h3><p>Now that I&apos;ve got backups of everything, I&apos;ll wipe the OS and get a fresh one up and running. I&apos;m going to go with a Linux Mint build. I&apos;ve put together a nice comfy look and feel for it that I&apos;ve grown accustomed to. I wrote a tutorial on putting it together if you&apos;re curious about the details.</p><figure class="kg-card kg-bookmark-card"><a class="kg-bookmark-container" href="https://geekly.dev/linux-mint-with-kali-theme/"><div class="kg-bookmark-content"><div class="kg-bookmark-title">Linux Mint with a Kali Themed Twist</div><div class="kg-bookmark-description">Some good ol fashioned customization to make Linux Mint just the way I like it... Like Kali.</div><div class="kg-bookmark-metadata"><img class="kg-bookmark-icon" src="https://geekly.dev/content/images/2022/09/favicon-1.ico" alt="Valheim Dedicated Servers in Docker on Linux"><span class="kg-bookmark-author">geekly.dev</span><span class="kg-bookmark-publisher">Nad</span></div></div><div class="kg-bookmark-thumbnail"><img src="https://geekly.dev/content/images/2022/09/IMG_6339n-1.jpg" alt="Valheim Dedicated Servers in Docker on Linux"></div></a></figure><p>I&apos;ll make one note here about swap space. I ran into issues having a large swap partition using ZFS. When spinning up servers beyond what could be supported by RAM, the system would freeze. This was likely due to ZFS compressing the swap space, and running into problems when large amounts of swap space were being utilized by Docker for the containers. There may be ways around this issue, but I opted to reinstall on LVM instead. If RAM is a limitation of your hardware and you foresee the necessity of using a large swap partition from time to time, I&apos;d recommend just using LVM instead of ZFS unless your have a good reason otherwise.</p><p>I do recommend setting up a large swap space if your RAM is limited. Swap size can be adjusted after-the-fact, but the method changes depending on if you&apos;re using traditional partitioning, LVM, or ZFS. My 8GB of RAM were pretty much entirely used upon initializing the first instance, and about 2-3GB of additional space were needed by each additional server after that.</p><figure class="kg-card kg-image-card kg-width-wide kg-card-hascaption"><img src="https://geekly.dev/content/images/2022/12/valheim_LUZUGpVv5B.jpg" class="kg-image" alt="Valheim Dedicated Servers in Docker on Linux" loading="lazy" width="1920" height="1080" srcset="https://geekly.dev/content/images/size/w600/2022/12/valheim_LUZUGpVv5B.jpg 600w, https://geekly.dev/content/images/size/w1000/2022/12/valheim_LUZUGpVv5B.jpg 1000w, https://geekly.dev/content/images/size/w1600/2022/12/valheim_LUZUGpVv5B.jpg 1600w, https://geekly.dev/content/images/2022/12/valheim_LUZUGpVv5B.jpg 1920w" sizes="(min-width: 1200px) 1200px"><figcaption>Surtling raids are purdy.</figcaption></figure><h3 id="installing-docker">Installing Docker</h3><p>With the new OS up and running the way I like, it&apos;s time to grab Docker.</p><figure class="kg-card kg-bookmark-card"><a class="kg-bookmark-container" href="https://docs.docker.com/engine/install/ubuntu/?ref=geekly-dev"><div class="kg-bookmark-content"><div class="kg-bookmark-title">Install Docker Engine on Ubuntu</div><div class="kg-bookmark-description">Instructions for installing Docker Engine on Ubuntu</div><div class="kg-bookmark-metadata"><img class="kg-bookmark-icon" src="https://docs.docker.com/assets/favicons/docs@2x.ico" alt="Valheim Dedicated Servers in Docker on Linux"><span class="kg-bookmark-author">Docker Documentation</span></div></div><div class="kg-bookmark-thumbnail"><img src="https://docs.docker.com/assets/favicons/docs@2x.ico" alt="Valheim Dedicated Servers in Docker on Linux"></div></a></figure><p>I followed the instructions of the official Docker installation guide, but quickly ran into some issues specific to Linux Mint. If you aren&apos;t running Mint, the instructions in the link above should work fine for you.</p><p>I ran the provided commands to add the Docker repository to apt.</p><pre><code class="language-bash"> curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
echo \
  &quot;deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
  $(lsb_release -cs) stable&quot; | sudo tee /etc/apt/sources.list.d/docker.list &gt; /dev/null</code></pre><p><br>However, when I ran <code>sudo apt-get update</code> I received the following error.</p><pre><code class="language-bash">Ign:7 https://download.docker.com/linux/ubuntu vanessa InRelease
Err:8 https://download.docker.com/linux/ubuntu vanessa Release
  404  Not Found [IP: 54.230.21.60 443]
Reading package lists ... Done
E: The repository &apos;https://download.docker.com/linux/ubuntu vanessa Release does not have a Release file.
N: Updating from such a repository can&apos;t be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.</code></pre><p>This issue is specific to Linux Mint 21, as <code>lsb_release -cs</code> in the command to write <code>docker.list</code> results in the output <code>vanessa</code> instead of <code>jammy</code>. Editing the <code>docker.list</code> file to change <code>vanessa</code> to <code>jammy</code> fixes the issue and allows <code>sudo apt-get update</code> to proceed as normal. Docker installed without a hitch and ran the hello-world container.</p><pre><code class="language-bash">sudo apt-get install docker-ce docker-ce-cli containerd.io docker-compose-plugin
sudo docker run hello-world</code></pre><p>Running the hello-world container is just a simple way to verify that the installation worked correctly.</p><p>I added my user to the docker group.</p><pre><code class="language-bash">sudo usermod -aG docker $USER</code></pre><p>A logout is recommended for this to take effect, followed by running <code>docker -v</code> to test that the permissions are working correctly.</p><p>With that working, I ultimately want a separate account for managing all things Valheim because I may want to run other servers on this machine in the future. I want an account that friends can use to run server maintenance when necessary, but I want to keep it separate from other services I may be running in the future. So I created a new user account, set things up the way I like them, and made sure to add the new user to the same docker group.</p><h3 id="setting-up-directories">Setting up directories</h3><p>I created folders in my new user&apos;s home directory for each of the Valheim servers I&apos;d like to run. Each server needs a <code>config</code> and a <code>data</code> directory, and since I&apos;ll be using pre-existing worlds, a <code>config/worlds/</code> folder. From the user&apos;s home directory, I ran:</p><pre><code class="language-bash">mkdir -p valheim-server1/config/worlds valheim-server1/data
mkdir -p valheim-server2/config/worlds valheim-server2/data
mkdir -p valheim-server3/config/worlds valheim-server3/data</code></pre><p>The -p argument tells mkdir to create parent directories if needed. Also, I didn&apos;t actually use this naming scheme, and opted for using the names of the worlds instead. Either way works fine. Just be sure to adjust any references as needed.</p><h3 id="migrating-worlds">Migrating worlds</h3><p>I copied the world data over from another computer with a USB stick. If you&apos;re starting a server with a fresh new world, you won&apos;t have to worry about this step. Otherwise, scoop up the backups you made earlier and find the world data you want to copy over.</p><p>You&apos;re going to want the <code>.db</code> and the <code>.fwl</code> files that coincide with the world name you want to copy over. Place the files for each separate world in the corresponding <code>~/valheim-server#/config/worlds</code> directory.</p><figure class="kg-card kg-image-card kg-width-wide kg-card-hascaption"><img src="https://geekly.dev/content/images/2022/12/valheim_XB4WR54OYz.jpg" class="kg-image" alt="Valheim Dedicated Servers in Docker on Linux" loading="lazy" width="1920" height="1080" srcset="https://geekly.dev/content/images/size/w600/2022/12/valheim_XB4WR54OYz.jpg 600w, https://geekly.dev/content/images/size/w1000/2022/12/valheim_XB4WR54OYz.jpg 1000w, https://geekly.dev/content/images/size/w1600/2022/12/valheim_XB4WR54OYz.jpg 1600w, https://geekly.dev/content/images/2022/12/valheim_XB4WR54OYz.jpg 1920w" sizes="(min-width: 1200px) 1200px"><figcaption>We needed a lot of portals for our world.</figcaption></figure><h3 id="creating-the-initialization-script">Creating the initialization script</h3><p>This can be done with a single command, but depending on what options you want to use for your server, it can get pretty unwieldy to write out. I wrote up a .sh script for each server so that I can edit the options and re-initialize as necessary.</p><pre><code class="language-bash">#! /bin/sh
docker run -d \
    --name Docker_Server_Name \
    --cap-add=sys_nice \
    --stop-timeout 120 \
    -p &apos;2456-2457:2456-2457/udp&apos; \
    -p &apos;9001:9001&apos; \
    -v $HOME/Server_Folder/config:/config \
    -v $HOME/Server_Folder/data:/opt/valheim \
    -e SERVER_PORT=&quot;2456&quot; \
    -e SERVER_NAME=&quot;Game_Server_Name&quot; \
    -e WORLD_NAME=&quot;worldfilename&quot; \
    -e SERVER_PASS=&quot;BestPasswordEver&quot; \
    -e SERVER_PUBLIC=&quot;false&quot; \
    -e RESTART_CRON=&quot;0 6 * * *&quot; \
    -e TZ=&quot;America/Los_Angeles&quot; \
    -e BEPINEX=&quot;true&quot; \
    -e SUPERVISOR_HTTP=&quot;true&quot; \
    -e SUPERVISOR_PASS=&quot;BestAdminPasswordEver&quot; \
    -e ADMINLIST_IDS=&quot;00000000000000000&quot; \
    -e BACKUPS_MAX_AGE=&quot;10000&quot; \
    -e BACKUPS_MAX_COUNT=&quot;50&quot; \
    -e BACKUPS_IF_IDLE=&quot;false&quot; \
    -e BACKUPS_CRON=&quot;0 0 * * *&quot; \
    -e BACKSUPS_IDLE_GRACE_PERIOD=&quot;86400&quot; \
    lloesche/valheim-server</code></pre><p>This is just an example configuration with a lot of details that will need to be altered in order to function properly. Here&apos;s basic rundown of why these settings are what they are. </p><p>The <code>--name</code> argument provides the reference name for the Docker container. This name can be used with Docker commands such as <code>docker restart name</code> or <code>docker stop name</code>, for example. </p><p>With <code>cap-add</code>, we add Linux capabilities to the container. The <code>sys-nice</code> value was provided by lloesche&apos;s documentation. More information about privileges and capabilities <a href="https://docs.docker.com/engine/reference/run/?ref=geekly-dev#runtime-privilege-and-linux-capabilities">can be found here</a>.</p><p>And <code>stop-timeout</code> sets the stop buffer time to give the container time to <a href="https://vsupalov.com/docker-compose-stop-slow/?ref=geekly-dev">shut down properly</a>. A maximum time is set to avoid indefinite hangs, but the default time of 10 seconds is insufficient for gracefully closing out all the components of the container.</p><p>Next up, we have port configurations with <code>-p</code>. The left hand side of the <code>:</code> is the outside, and right hand side is internal to the container. If running multiple instances, the internal port can remain default values with only the external port altered. For instance, <code>-p &apos;2456-2457:2456-2457/udp&apos;</code> for one instance and <code>-p &apos;2458-2459:2456:2457/udp&apos;</code> for another. The quotes surrounding the values are recommended by Docker&apos;s documentation, but not strictly necessary.</p><p>There is also a port mapping for <code>9001</code>, which is the supervisor HTTP interface (enabled further down). HTTP is a TCP protocol, and TCP is Docker&apos;s default value in port mappings unless otherwise specified, so <code>-p &apos;9001:9001&apos;</code> suffices.</p><p>Then we&apos;ll also want to pass volume arguments to Docker to let it know where it can map certain internal data to external directories. This gives us little windows into the container&apos;s filesystem where we can place things like configuration files, world data, plugins, and have persistent storage of the build data.</p><p>Setting &#xA0;the <code>-v $HOME/Server_Folder/config:/config</code> volume enables the container to find our world data (which should be located in <code>~/Server_Folder/config/worlds</code>) and create any necessary configuration files. Backup data will also be stored in a folder at this location.</p><p>Setting the <code>-v $HOME/Server_Folder/data:/opt/valheim</code> volume comes in handy in the case of shutting an instance down, removing it from docker, and re-initializing it with a different configuration. Instead of having to pull down updates from scratch to initialize, it can pull directly from the mounted volume.</p><p>Now if you scroll back up and take a look at the initialization script again, you&apos;ll see that we have a whole bunch of <code>-e</code> arguments in a row. These are the environment variables that will be used to set configurations of the server.</p><p>The first few environment variables are fairly self explanatory. Others, not as much.</p><ul><li><code>SERVER_PORT</code> doesn&apos;t ever really need to change, as it can be adjusted through the container&apos;s port settings with <code>-p</code>. </li><li><code>SERVER_NAME</code> is the name that can show up in-game. </li><li><code>WORLD_NAME</code> is the name of the files.</li><li><code>SERVER_PASS</code> needs to be a minimum of 5 characters.</li><li><code>SERVER_PUBLIC</code> allows for server discovery through Steam. I recommend setting this false unless you genuinely want a public server, as it seems that populating the server list in-game checks connection against each potential server on the list resulting in excessive amounts of connections. Think of it as getting pinged a few dozen times a minute. It&apos;s not a huge load, but it&apos;s unnecessary unless you actually want to be on the list.</li><li><code>RESTART_CRON</code> sets a restart timer using cron format. Daily restarts are useful for avoiding server errors and memory leaks that can build up over time. There is another environment variable <code>RESTART_IF_IDLE</code> which has a default value of <code>true</code>. So if players are currently connected during the scheduled restart time, it will skip the restart. I have my server set to restart at a time when people are not usually logged in, but allow the server to skip the restart (by leaving <code>RESTART_IF_IDLE</code> at default <code>true</code>) because missing a daily restart isn&apos;t as immediately awful as being caught in the middle of a build and losing progress. <em>If you&apos;re unfamiliar with cron&apos;s format, there&apos;s a <a href="https://crontab.guru/?ref=geekly-dev">handy web tool</a> for entering different values to see the results.</em></li><li><code>TZ</code> sets the server&apos;s time zone using <a href="https://en.wikipedia.org/wiki/List_of_tz_database_time_zones?ref=geekly-dev">tz database names</a>.</li><li><code>BEPINEX</code> is a mod framework. If you aren&apos;t using any mods, this can just be omitted completely as the default value is <code>false</code>. If you are using mods, either <code>BEPINEX</code> or <code>VALHEIM_PLUS</code> should be set to true, but not both at the same time. On the first initialization, plugin folders will be created where you can drop in whatever mods you want to install. (Either <code>config/bepinex/plugins</code> or <code>config/valheimplus/plugins</code> depending on which you use.) After copying your mods to the location, you can restart the server to load them with <code>docker restart container_name</code>.</li><li><code>SUPERVISOR_HTTP</code> and <code>SUPERVISOR_PASS</code> creates a simple web server and creates a password for it that allows you to manage certain functions and check log tails. I would not recommend opening this port to outside your LAN (for instance if you want friends to be able to restart the server) for security reasons. HTTP does not use encryption, and the password does not appear to actually be used even for restarting the server. Allowing external access to this feature will enable anyone on the wide open interwebs to check your logs (including snagging player IDs if present) and stop your server at will. <em>I have actually removed this function from my own servers, but left it in this list as an excuse to mention the vulnerability.</em> I will recommend other means of performing these same tasks instead of using this interface in the second part of this.</li><li><code>ADMINLIST_IDS</code> passes space separated user IDs to the adminlist.txt file to give admin permissions to users on your server. User IDs can be pulled from in-game using the F2 overlay which displays all currently connected users and their corresponding ID. These IDs can also be pulled from the logs by grepping lines with &quot;Got connection SteamID&quot;. Note that the adminlist uses SteamIDs and not in-game player IDs (ZDOID in log entries). Multiple IDs should be presented in the same &quot;&quot; block separated by a space. For example: <code>&quot;01234567890123456 12345678901234567&quot;</code>.</li></ul><p>Backup scheduling can be a bit of trick depending on your needs and your resources. In my case, I wanted it to mainly update when people are connected, and I have a fair amount of storage to throw at storing backups. Since we often go for months at a time without playing much, the <code>BACKUPS_MAX_AGE</code> is set to <code>&quot;10000&quot;</code> to effectively disable removal of older backups. Instead, I set <code>BACKUPS_MAX_COUNT</code> to store a total of 50. <code>BACKUPS_IF_IDLE=&quot;false&quot;</code> makes the backup only run if players are connected, and <code>BACKUPS_IDLE_GRACE_PERIOD=&quot;86400&quot;</code> (which is 24 hours in seconds) provides some wiggle room. So if a player has connected within the past 24 hours, the backup will run. <code>BACKUPS_CRON</code> defaults to every hour, but in my case I just want it to back up once a day at midnight so setting the value to <code>&quot;0 0 * * *&quot;</code> works fine.</p><p>It&apos;s also worth noting that these backups are a compressed archive of the entire world folder. The dedicated server itself makes autobackups on its own schedule, and this separate backup process makes a backup of all of those autosaves as well. For extra integrity, backups can be set to save to a custom location with <code>BACKUPS_DIRECTORY</code>. So backups can be saved directly to a separate drive, for instance. In my case, I will eventually be setting up my server with a RAID1 array to mirror the drive in case of failure.</p><p>Finally, the argument <code>lloesche/valheim-server</code> gives Docker the build we&apos;re going to use to create the container.</p><p><strong>For a full list of environment variables, check <a href="https://github.com/lloesche/valheim-server-docker?ref=geekly-dev">lloesche&apos;s documentation</a>.</strong> Configurations can get even more intricate and use things like log filters, event hooks, Discord webhooks, and configuring plugin variables, just to name a few.</p><h3 id="spin-it-up">Spin it up!</h3><p>Once you have a configuration you want to try out saved, make sure to give executable permissions with <code>chmod 744 server_init.sh</code>. It can then be run with <code>./server_init.sh</code>.</p><p>On the first run, the container will be downloaded and it will automatically run updates. Logs of the progress can be run with <code>docker logs Docker_Server_Name</code>. You also may have to <a href="https://www.digitalocean.com/community/tutorials/how-to-set-up-a-firewall-with-ufw-on-ubuntu-20-04?ref=geekly-dev">open ports in UFW</a>, but at this point you can test to make sure you can connect from another computer on your LAN. </p><p>If you find settings you need to change in the initialization, the container can be stopped, removed, and reinitialized.</p><pre><code class="language-bash">docker stop container_name
docker rm container_name
./server_init.sh</code></pre><p>This is where having the <code>data/</code> volume mount comes in handy because reinitialization will require a whole lot less.</p><p>If your server is set up the way you like it and connections are working locally, it&apos;s time to set up <a href="https://portforward.com/?ref=geekly-dev">port forwarding and firewall rules</a> and have your friends try it out! </p><hr><p>In the next part, I&apos;ll be going over my own network configuration to describe the other features I&apos;d like to have on my server. While some of them are very specific to my own network configuration, there may be some useful things in there for anyone who&apos;d like to set up remote administration in a more secure way using an OpenVPN server for remote tunnels, FTPS for file access, and SSH for shell access. Link will be added here once it&apos;s available.</p><p>As always, if you have any suggestions or corrections for me to take into account, please let me know!</p><figure class="kg-card kg-image-card kg-width-full"><img src="https://geekly.dev/content/images/2022/12/valheim_p95cd1GfMp.jpg" class="kg-image" alt="Valheim Dedicated Servers in Docker on Linux" loading="lazy" width="1920" height="1080" srcset="https://geekly.dev/content/images/size/w600/2022/12/valheim_p95cd1GfMp.jpg 600w, https://geekly.dev/content/images/size/w1000/2022/12/valheim_p95cd1GfMp.jpg 1000w, https://geekly.dev/content/images/size/w1600/2022/12/valheim_p95cd1GfMp.jpg 1600w, https://geekly.dev/content/images/2022/12/valheim_p95cd1GfMp.jpg 1920w"></figure>]]></content:encoded></item><item><title><![CDATA[Visualizing the Layers of the TCP/IP Model]]></title><description><![CDATA[Part 2 of The Strangest Explanation of VLANs You've Never Heard series, expanding on basic topological concepts  by adding dimensions to the TCP/IP stack.]]></description><link>https://geekly.dev/tcp-ip-model/</link><guid isPermaLink="false">63643cfd52370903947df617</guid><category><![CDATA[Musings]]></category><category><![CDATA[Networks]]></category><dc:creator><![CDATA[Nad]]></dc:creator><pubDate>Wed, 16 Nov 2022 00:31:48 GMT</pubDate><media:content url="https://geekly.dev/content/images/2022/11/NDev-04-all-2.png" medium="image"/><content:encoded><![CDATA[<img src="https://geekly.dev/content/images/2022/11/NDev-04-all-2.png" alt="Visualizing the Layers of the TCP/IP Model"><p>This is part 2 of a series, <strong>The Strangest Explanation of VLANs You&apos;ve Never Heard</strong>. While it should be largely capable of standing alone, it does build on some of the topological concepts discussed in that article. This should provide what I find to be a useful shift in perspective for understanding and better utilizing the concepts of the TCP/IP and OSI models. I&apos;d recommend reading through the series in order to get the most out of it, as I&apos;ve tried my best to present idea in the most linear way I could think of.</p><figure class="kg-card kg-bookmark-card"><a class="kg-bookmark-container" href="https://geekly.dev/strangest-explanation-of-vlans/"><div class="kg-bookmark-content"><div class="kg-bookmark-title">The strangest explanation of VLANs you&#x2019;ve never heard</div><div class="kg-bookmark-description">Mental models rarely fit neatly into little boxes, yet we try to visualize them using overly simplistic means. For once, let&#x2019;s get a little nutty.</div><div class="kg-bookmark-metadata"><img class="kg-bookmark-icon" src="https://geekly.dev/content/images/2022/09/favicon-1.ico" alt="Visualizing the Layers of the TCP/IP Model"><span class="kg-bookmark-author">geekly.dev</span><span class="kg-bookmark-publisher">Nad</span></div></div><div class="kg-bookmark-thumbnail"><img src="https://geekly.dev/content/images/2022/11/vlan06.png" alt="Visualizing the Layers of the TCP/IP Model"></div></a></figure><hr><h3 id="physical-and-logical">Physical and Logical</h3><p>Because networks don&apos;t just live in the more abstract world of programming, but also have tendrils that connect out to other physical devices, it&apos;s important to examine the concepts that are commonly utilized. Network diagrams, for example, can be designed to convey physical configuration of devices and wiring. Or they can be diagrams designed to convey crucial aspects of logic that define the network topology. It can be confusing to look at a diagram expecting a physical layout when it is in fact a logical diagram.</p><p>In a <em>physical</em> network diagram, a gateway router that also serves as a firewall and a wireless access point can be represented by a single node. But on a logical diagram, there might be good reason to want to break out those specific features to their own independent nodes. A device present on a physical diagram might not have any reason to be present on a logical diagram if it has no effect on the topology being described.</p><figure class="kg-card kg-image-card kg-width-wide kg-card-hascaption"><img src="https://geekly.dev/content/images/2022/11/flat2.png" class="kg-image" alt="Visualizing the Layers of the TCP/IP Model" loading="lazy" width="1920" height="1080" srcset="https://geekly.dev/content/images/size/w600/2022/11/flat2.png 600w, https://geekly.dev/content/images/size/w1000/2022/11/flat2.png 1000w, https://geekly.dev/content/images/size/w1600/2022/11/flat2.png 1600w, https://geekly.dev/content/images/2022/11/flat2.png 1920w" sizes="(min-width: 1200px) 1200px"><figcaption>Is the second router actually routing? If not, is there a reason that it has been labeled as a router instead of a switch?</figcaption></figure><p>Similarly, a router as a <em>physical</em> device can be employed in a use case where it serves the same <em>logical</em> function as a another type of device, such as the above example of a flat network where a router is being employed as a switch. Just because it is a router doesn&apos;t mean it has to route. This doesn&apos;t have much of an effect on a physical layout, but it can fundamentally alter the logical configuration. This can sometimes be described by referencing which &quot;layer&quot; a given device accesses.</p><p>So let&apos;s drill down through these so-called layers real quick to find some tools that will help us describe the logical arrangement of networks. For that, we&apos;re going to have to take a short dive into the TCP/IP and OSI models. </p><p>The TCP/IP model was created as a framework to implement a network protocol and was originally described in <a href="https://datatracker.ietf.org/doc/html/rfc1122?ref=geekly-dev">RFC 1122</a> and <a href="https://datatracker.ietf.org/doc/html/rfc1123?ref=geekly-dev">RFC 1123</a> (RFCs, Request For Comments, are publications through which many of the standards of the internet are established). The framework describes standards of communication across a network within <em>protocols</em>, and established a model of visualization using layers that is commonly referenced to communicate key features of those protocols.</p><p>The OSI model was developed as an updated version designed to break down TCP/IP&apos;s layers into more granular components. While the TCP/IP model is implemented in protocols, OSI is more for <em>reference</em> purposes. The numbering system of OSI is most commonly referenced because the extra delineations can be very useful. </p><p>Yes, this does indeed lead to confusion. To add to it, the numbering starts at the bottom, but the formation of data starts at the top. Hence my earlier phrasing of &quot;drill down&quot; and &quot;short dive&quot;, as the formation of data is the more crucial aspect when it comes to mapping the concepts out.</p><p>So how do TCP/IP and OSI stack up against each other?</p><figure class="kg-card kg-image-card kg-card-hascaption"><img src="https://geekly.dev/content/images/2022/10/OSI-TCP2c.png" class="kg-image" alt="Visualizing the Layers of the TCP/IP Model" loading="lazy" width="1161" height="1080" srcset="https://geekly.dev/content/images/size/w600/2022/10/OSI-TCP2c.png 600w, https://geekly.dev/content/images/size/w1000/2022/10/OSI-TCP2c.png 1000w, https://geekly.dev/content/images/2022/10/OSI-TCP2c.png 1161w" sizes="(min-width: 720px) 720px"><figcaption>OSI vs TCP/IP</figcaption></figure><p>This is the usual form that they are presented in. The idea behind these is that, starting at the top, an application needs to communicate with another device, and it packages the data it needs to send. More data is added to that to facilitate the transfer. The added data is broken up into groupings defined roughly on the spectrum of software to hardware, or logical to physical. We&apos;ll get into more detail on this soon.</p><p>I&apos;m not a fan of this representation because it doesn&apos;t lend itself well to visualizing how various steps along the way access the different layers. But the comparison <em>is</em> useful for noting the additional delineations of the OSI model, and how they correlate to the TCP/IP layers.</p><p>There are &quot;updated&quot; versions of the TCP/IP layers that attempt to add in aspects of the OSI model (differentiating between Data Link and Physical in particular), but in my opinion it&apos;s like trying to plug a leak in a swimming pool by throwing a blanket over the top of it. The solution does not address the problem and only succeeds in muddying the water.</p><p>The problem with this visualization is that it&apos;s layering things on top of each other like a sandwich. What we should be doing is visualizing it in terms of <em>encapsulation</em>. Matryoshka dolls come to mind.</p><figure class="kg-card kg-image-card kg-card-hascaption"><img src="https://geekly.dev/content/images/2022/10/Matryoshka_dolls_in_Harbin.jpg" class="kg-image" alt="Visualizing the Layers of the TCP/IP Model" loading="lazy" width="2000" height="1333" srcset="https://geekly.dev/content/images/size/w600/2022/10/Matryoshka_dolls_in_Harbin.jpg 600w, https://geekly.dev/content/images/size/w1000/2022/10/Matryoshka_dolls_in_Harbin.jpg 1000w, https://geekly.dev/content/images/size/w1600/2022/10/Matryoshka_dolls_in_Harbin.jpg 1600w, https://geekly.dev/content/images/size/w2400/2022/10/Matryoshka_dolls_in_Harbin.jpg 2400w" sizes="(min-width: 720px) 720px"><figcaption>Oh, well that&apos;s not creepy at all. Nope.<em> (Credit: <a href="https://commons.wikimedia.org/wiki/File:Matryoshka_dolls_in_Harbin.jpg?ref=geekly-dev">Wikipedia Commons</a>)</em></figcaption></figure><p>These nifty little doo-dads fit the bill nicely. They are layered. They can be readily disassembled, examined, and reassembled. Each of the layers can stand alone and contains its own unique information. Let&apos;s go with this. </p><figure class="kg-card kg-image-card kg-card-hascaption"><img src="https://geekly.dev/content/images/2022/10/TCP-mat.png" class="kg-image" alt="Visualizing the Layers of the TCP/IP Model" loading="lazy" width="1920" height="1080" srcset="https://geekly.dev/content/images/size/w600/2022/10/TCP-mat.png 600w, https://geekly.dev/content/images/size/w1000/2022/10/TCP-mat.png 1000w, https://geekly.dev/content/images/size/w1600/2022/10/TCP-mat.png 1600w, https://geekly.dev/content/images/2022/10/TCP-mat.png 1920w" sizes="(min-width: 720px) 720px"><figcaption>Granted, it doesn&apos;t bear all that much resemblance to those (totally not creepy) nested dolls. But hopefully the idea gets across.</figcaption></figure><p>The key concept here is <em>encapsulation</em>. When a program is called to communicate with another similar program through a connection, it will first form a payload to send to the remote program. Large chunks need to be broken up into smaller pieces. Those smaller pieces make up the core of a packet. In addition to that core, though, there needs to be additional information to provide to the network that will facilitate its journey. Information like where it&apos;s coming from, where it&apos;s going, which piece of the whole it is, and possibly some security features that might come in handy. In other words, it needs supplies for the trip. Around the core, these additional layers are <em>encapsulated</em> in a standardized way.</p><p>Referring over to the word-shenanigans in the companion VLAN article, <em>encapsulation</em> is akin to <em>envelopment</em>. We&apos;re taking a thing and <em>enclosing</em> it within another. And recalling back to our tools of topological tinkering, each subsequent layer of <em>encasement</em> can still maintain its own distinct <em>boundary manifold</em>.</p><hr><p>Ultimately, we want that package to travel down along a line, or wifi signal, or whatever other means of transportation is available to it, and find its destination. During the short stops along its passage, it needs to check in with, say, a ticket booth at yonder router. Or it might need to get its port number checked at a firewall. Thankfully, our packet is prepared and organized with all the bits in the right layers. The topological manifolds are consistently correct, otherwise the packet gets &quot;dropped.&quot;</p><p>In other words, the topology of the packet must be compatible with the topology of the interfaces it passes through. The &quot;shapes&quot; must correspond.</p><figure class="kg-card kg-image-card kg-width-wide"><img src="https://geekly.dev/content/images/2022/10/TCP-e2e-1.png" class="kg-image" alt="Visualizing the Layers of the TCP/IP Model" loading="lazy" width="1920" height="1080" srcset="https://geekly.dev/content/images/size/w600/2022/10/TCP-e2e-1.png 600w, https://geekly.dev/content/images/size/w1000/2022/10/TCP-e2e-1.png 1000w, https://geekly.dev/content/images/size/w1600/2022/10/TCP-e2e-1.png 1600w, https://geekly.dev/content/images/2022/10/TCP-e2e-1.png 1920w" sizes="(min-width: 1200px) 1200px"></figure><p>With this, we can visualize an <em>end to end</em> connection. On one end, starting with the core of application data, the packet is encapsulated with layers, sent down a line, received, decapsulated, and handed to the receiving application. What&apos;s more, if we shift perspectives a bit and lay this on its side, we can see that the layers still even resemble the classic representation of the stack. </p><figure class="kg-card kg-image-card kg-card-hascaption"><img src="https://geekly.dev/content/images/2022/11/TCP-e2e-hz-lbbox.png" class="kg-image" alt="Visualizing the Layers of the TCP/IP Model" loading="lazy" width="1920" height="1080" srcset="https://geekly.dev/content/images/size/w600/2022/11/TCP-e2e-hz-lbbox.png 600w, https://geekly.dev/content/images/size/w1000/2022/11/TCP-e2e-hz-lbbox.png 1000w, https://geekly.dev/content/images/size/w1600/2022/11/TCP-e2e-hz-lbbox.png 1600w, https://geekly.dev/content/images/2022/11/TCP-e2e-hz-lbbox.png 1920w" sizes="(min-width: 720px) 720px"><figcaption>Note the use of OSI numbering</figcaption></figure><p>So far, nothing in between the source and the destination is represented yet. But we can start imagining what might be required to fit in. And the taper in the middle, even though it&apos;s more of a stylistic feature, gives us another clue.</p><p>I&apos;ll refer back to the mesh topology exploration in the VLAN article (specifically, Getting Down to Brass Tacks). In that, we took a look at what topological effects would come from pinning a Post-It note to a cork board using a thumb tack. In doing so, the Post-It note and cork board were topologically transformed. Most notably, the note went from being basically scaled cube to having more in common topologically with a torus. It had its <em>boundary manifold</em> fundamentally altered by the process.</p><p>In this case, we can picture the <em>data being transmitted</em> as the pin (the topology that defines the rest), the <em>devices on either end</em> of the connection as cord boards (terminal end points that have topology that conforms to the defining topology), and <em>network devices</em> along the way as Post-It notes (acting as passthroughs).</p><hr><p>So what about frames and packets, then? These simply refer to the hierarchy of data within layers as they traverse through a network. Communication between devices on a network happens in a stream of bits. Different devices examine different aspects of the data and make decisions about what to do with it. </p><p>Some devices only look at a portion called a <em>frame</em>. Frames coincide with the Link/Data Link layer, on the TCP/IP and OSI models respectively. The frame contains <em>hardware address</em> information about where it&apos;s coming from and where it&apos;s going to. The hardware address is also called a MAC (Media Access Control) address. These addresses are used by layer 2 (using OSI numbering) devices. Layer 2 switches are one example, but physical interfaces in general are layer 2 devices meaning they access the stack <em>up to</em> and including layer 2. </p><p>Other devices are capable of examining the <em>packet</em> level, which corresponds with the Network/Internet layer. This layer contains <em>IP address</em> information. While hardware addresses aren&apos;t intended to leave a local network, IP addresses are used for routing through the internet as a whole. The key takeaway from the delineation is that two sets of addressing schemes are used. One for local, and one for global. Layer 3 (OSI numbering) devices are capable of inspecting these addresses in order to <em>route</em> traffic to the correct destination.</p><p>Firewalls need access to the transport layer, also known as <em>segments</em>, so they can be considered layer 4 devices. And there are even some network appliances that examine the application layer, such as some intrusion detection systems and certain types of proxies. So all the way through the stack, we can potentially have equipment that can interface with all of it. (Note that this doesn&apos;t necessarily imply that your data is being read every step along the way. The application layer is commonly encrypted, or at least should be. But use of encryption doesn&apos;t imply that data is unreadable. That&apos;s a topic for another article though.)</p><p>Let&apos;s take a quick look at how this is usually represented, and see if we can get it to mesh well with our working model.</p><figure class="kg-card kg-image-card"><img src="https://geekly.dev/content/images/2022/11/stack-fpsd.png" class="kg-image" alt="Visualizing the Layers of the TCP/IP Model" loading="lazy" width="1920" height="840" srcset="https://geekly.dev/content/images/size/w600/2022/11/stack-fpsd.png 600w, https://geekly.dev/content/images/size/w1000/2022/11/stack-fpsd.png 1000w, https://geekly.dev/content/images/size/w1600/2022/11/stack-fpsd.png 1600w, https://geekly.dev/content/images/2022/11/stack-fpsd.png 1920w" sizes="(min-width: 720px) 720px"></figure><p>The feature I&apos;d like to draw the most attention to is the usage of vertical columns. Starting at the top with the <em>Data</em> block, if we follow that down through the layers, we can see that it stays in place. It just becomes increasingly encapsulated as it goes. In the <em>Segment</em> layer, the UDP Header gets tacked on. In the <em>Packet</em> layer, it gets an IP Header. And in the <em>Frame</em> layer, it gets a Frame Header and Footer. But all through that process, the Data block persists in its place.</p><p>This view of the layers is actually what gave me the idea of Matryoshka dolls in the first place. It adds an extra dimension to the one-dimensional layer ordering by providing the columns to show the encapsulation. From this, I simply added another extra dimension to show transit of information. So this fits in nicely.</p><figure class="kg-card kg-image-card"><img src="https://geekly.dev/content/images/2022/11/stack-fpsd-new.png" class="kg-image" alt="Visualizing the Layers of the TCP/IP Model" loading="lazy" width="1920" height="840" srcset="https://geekly.dev/content/images/size/w600/2022/11/stack-fpsd-new.png 600w, https://geekly.dev/content/images/size/w1000/2022/11/stack-fpsd-new.png 1000w, https://geekly.dev/content/images/size/w1600/2022/11/stack-fpsd-new.png 1600w, https://geekly.dev/content/images/2022/11/stack-fpsd-new.png 1920w" sizes="(min-width: 720px) 720px"></figure><p>We do lose a little bit of information in the translation here. This is due to the principle mentioned in part 1, &quot;Simplistic diagrams are limited to simplistic concepts.&quot; We lose details about the frame containing both a header and a footer, for example. There are other details about the original diagram that lend themselves better to visualizing the encapsulation in terms of the bitstream, as well. For the purpose of this visualization, however, those details are somewhat extraneous. We are aiming to visualize the stack as it moves through a network.</p><p>So let&apos;s take a look at how this might fit into a network device.</p><figure class="kg-card kg-image-card kg-width-full"><img src="https://geekly.dev/content/images/2022/11/NDev-04-all-1.png" class="kg-image" alt="Visualizing the Layers of the TCP/IP Model" loading="lazy" width="1920" height="840" srcset="https://geekly.dev/content/images/size/w600/2022/11/NDev-04-all-1.png 600w, https://geekly.dev/content/images/size/w1000/2022/11/NDev-04-all-1.png 1000w, https://geekly.dev/content/images/size/w1600/2022/11/NDev-04-all-1.png 1600w, https://geekly.dev/content/images/2022/11/NDev-04-all-1.png 1920w"></figure><p>There&apos;s quite a bit to take in here. The main components to take note of are the data streams, outer ring, inner core, and linkages. These are just informal terms we&apos;ll temporarily use for the abstractions we&apos;re translating. Let&apos;s take another look from the top and break out the individual components.</p><figure class="kg-card kg-image-card kg-width-full"><img src="https://geekly.dev/content/images/2022/11/NDev-cmpts.png" class="kg-image" alt="Visualizing the Layers of the TCP/IP Model" loading="lazy" width="2000" height="1000" srcset="https://geekly.dev/content/images/size/w600/2022/11/NDev-cmpts.png 600w, https://geekly.dev/content/images/size/w1000/2022/11/NDev-cmpts.png 1000w, https://geekly.dev/content/images/size/w1600/2022/11/NDev-cmpts.png 1600w, https://geekly.dev/content/images/2022/11/NDev-cmpts.png 2160w"></figure><p>The data streams are easy enough. Those are all of the incoming/outgoing connections to other devices on this network. Even when we&apos;re looking at it from the top like this, we can still discern the stack of layers.</p><p>The inner core represents the connectivity between data streams. It&apos;s a way of showing that these data streams all have potential to be passed along. In other terms, this shows the connections are within the same broadcast domain. </p><p>The outer ring represents the device&apos;s interface to the data stream. All network devices perform some sort of programmatic operations on the given data stream to varying degrees, and this is where those operations are performed. For this example, our outer rings have four layers, implying they are accessing all layers of the stack. We&apos;ll look at other examples shortly.</p><p>The complicated looking tech-snowflake in the image above is comprised of the linkages. The linkages show how the data stream is interfaced by both the outer ring and the inner core. They&apos;re the topological features that connect everything together in an orderly fashion. And since the objective of this exercise is to visualize topology of the flow of data through the devices within a network, this strange little snowflake is the star of the show. </p><p>This &quot;completely decked out&quot; example of the device accessing <em>all the layers</em> isn&apos;t particularly common though, and feels a bit stifling. So let&apos;s take another look at it in a different context.</p><figure class="kg-card kg-image-card kg-width-wide"><img src="https://geekly.dev/content/images/2022/11/NDev-01-prsp.png" class="kg-image" alt="Visualizing the Layers of the TCP/IP Model" loading="lazy" width="1920" height="840" srcset="https://geekly.dev/content/images/size/w600/2022/11/NDev-01-prsp.png 600w, https://geekly.dev/content/images/size/w1000/2022/11/NDev-01-prsp.png 1000w, https://geekly.dev/content/images/size/w1600/2022/11/NDev-01-prsp.png 1600w, https://geekly.dev/content/images/2022/11/NDev-01-prsp.png 1920w" sizes="(min-width: 1200px) 1200px"></figure><p>In this example, the outer rings only access the <em>link</em> layer (layers 1 and 2 of the OSI model). So this could easily represent a network switch that only needs the link layer to do its job. &#xA0;There is only a single set of linkages connecting the data stream to a single set of outer rings.</p><p>But when we look at the inner core, we can still see that the information that gets passed through to other connections still contains <em>all layers</em> of the stack. The inner core itself retains the features for all of the layers, and the linkages are still present. That&apos;s because the data stream going through this node is not diminished by it. While the device might be able to read and possibly alter aspects of the link layer, the stack as a whole still passes through.</p><p>So let&apos;s take a look around what a layer 3 device would look like, and what it might be capable of doing.</p><figure class="kg-card kg-gallery-card kg-width-wide"><div class="kg-gallery-container"><div class="kg-gallery-row"><div class="kg-gallery-image"><img src="https://geekly.dev/content/images/2022/11/NDev-02-prsp1.png" width="1080" height="1080" loading="lazy" alt="Visualizing the Layers of the TCP/IP Model" srcset="https://geekly.dev/content/images/size/w600/2022/11/NDev-02-prsp1.png 600w, https://geekly.dev/content/images/size/w1000/2022/11/NDev-02-prsp1.png 1000w, https://geekly.dev/content/images/2022/11/NDev-02-prsp1.png 1080w" sizes="(min-width: 720px) 720px"></div><div class="kg-gallery-image"><img src="https://geekly.dev/content/images/2022/11/NDev-02-prsp2.png" width="1080" height="1080" loading="lazy" alt="Visualizing the Layers of the TCP/IP Model" srcset="https://geekly.dev/content/images/size/w600/2022/11/NDev-02-prsp2.png 600w, https://geekly.dev/content/images/size/w1000/2022/11/NDev-02-prsp2.png 1000w, https://geekly.dev/content/images/2022/11/NDev-02-prsp2.png 1080w" sizes="(min-width: 720px) 720px"></div><div class="kg-gallery-image"><img src="https://geekly.dev/content/images/2022/11/NDev-02-prsp3.png" width="1080" height="1080" loading="lazy" alt="Visualizing the Layers of the TCP/IP Model" srcset="https://geekly.dev/content/images/size/w600/2022/11/NDev-02-prsp3.png 600w, https://geekly.dev/content/images/size/w1000/2022/11/NDev-02-prsp3.png 1000w, https://geekly.dev/content/images/2022/11/NDev-02-prsp3.png 1080w" sizes="(min-width: 720px) 720px"></div></div></div></figure><p>The outer rings now have an additional feature to illustrate the addition of a layer, as well as another set of linkages to the data stream to match. This layer 3 device (again, up to and including layer 3 of the OSI model, coinciding with the Internet layer of the TCP/IP model) would be capable of accessing both the MAC hardware addressing information from the Link layer as well as the IP addressing information from the Internet layer. Such a device is likely performing some sort of routing function.</p><p>This model would work well within a flat network, but what about cases of networks using subnets or VLANs? Could we add in more central cores to illustrate network segmentation? Perhaps we could expand the design vertically and make a stack of stacks.</p><p>This vertical stack is an intriguing idea. We&apos;ll get more into that later though. First, let&apos;s go into a little bit more detail about the relationship between the outer rings and the inner core, the processes that we can attribute to them, and the limitations of this model.</p><hr><p>Broadcast domain interconnectivity is an essential component of network topology. That &quot;inner core&quot; of our imaginary network device is effectively acting as what&apos;s known as a <em>bridge</em>. Bridging is a mechanism for ganging <em>network interfaces</em> together into a pool. </p><p>This is where it gets tricky, using simplified models to represent what&apos;s going on though. Because we separated the concepts of <em>device logic</em> and <em>interconnection</em>, we also have the implication that the device doesn&apos;t perform logical operations on connection states, which is not at all the case.</p><p>Recalling back to a previous concept in the series, we went over the idea of a switch as a sprinkler head. I joked about hooking a hose up to a port and having water spray out of all of the other ports, and I mentioned the idea of &quot;gates&quot; controlling the flow into and out of the switch. </p><figure class="kg-card kg-image-card kg-card-hascaption"><img src="https://geekly.dev/content/images/2022/11/switch-chmb.png" class="kg-image" alt="Visualizing the Layers of the TCP/IP Model" loading="lazy" width="1920" height="1080" srcset="https://geekly.dev/content/images/size/w600/2022/11/switch-chmb.png 600w, https://geekly.dev/content/images/size/w1000/2022/11/switch-chmb.png 1000w, https://geekly.dev/content/images/size/w1600/2022/11/switch-chmb.png 1600w, https://geekly.dev/content/images/2022/11/switch-chmb.png 1920w" sizes="(min-width: 720px) 720px"><figcaption>I must once again caution against the use of a water hose in close proximity to electronic devices. <em>Switches aren&apos;t potted plants, okay? </em>There, I said it.</figcaption></figure><p>Hook up a hose, plug two of the holes, and the water will spray out of the remaining hole.</p><p>This is largely the logic being performed within the device. Whether and what to pass along, and where to pass it to. So while the block above can also be thought of as a bridge of sorts, it lacks any topological features to indicate the logic of functions.</p><p>Looking again at our imaginary network device monstrosity riddled with topological linkages, we <em>can</em> envision this process to a certain degree. Let&apos;s look at one last set of examples of it to simply things a bit more.</p><figure class="kg-card kg-image-card kg-width-wide"><img src="https://geekly.dev/content/images/2022/11/NDev-03-01.png" class="kg-image" alt="Visualizing the Layers of the TCP/IP Model" loading="lazy" width="1920" height="840" srcset="https://geekly.dev/content/images/size/w600/2022/11/NDev-03-01.png 600w, https://geekly.dev/content/images/size/w1000/2022/11/NDev-03-01.png 1000w, https://geekly.dev/content/images/size/w1600/2022/11/NDev-03-01.png 1600w, https://geekly.dev/content/images/2022/11/NDev-03-01.png 1920w" sizes="(min-width: 1200px) 1200px"></figure><p>This device is hooked into the all the layers up to the transport layer, so it would be referred to as a layer 4 device (layers 1-4 of the OSI model). So this could be a firewall, for example. Firewalls need to examine the transport layer for <em>port</em> data, which enables them to selectively allow or deny traffic based off the set of rules they use. </p><p>I depicted only two data stream connections here to simplify matters a bit so that we can visualize the flow of data in strictly linear terms. So let&apos;s say that the data coming into the firewall is from an upstream connection in the upper left. It is inspected by the device, accessing up to the transport layer, and passes the rule set to subsequently be passed along (if it didn&apos;t pass, it would be dropped right there and then). From the inner core, there is only one other connection it can go. On its way back out of the device to the lower right, it is then inspected again to ensure that it passes the set of rules.</p><figure class="kg-card kg-image-card kg-width-wide"><img src="https://geekly.dev/content/images/2022/11/NDev-03-02.png" class="kg-image" alt="Visualizing the Layers of the TCP/IP Model" loading="lazy" width="1920" height="840" srcset="https://geekly.dev/content/images/size/w600/2022/11/NDev-03-02.png 600w, https://geekly.dev/content/images/size/w1000/2022/11/NDev-03-02.png 1000w, https://geekly.dev/content/images/size/w1600/2022/11/NDev-03-02.png 1600w, https://geekly.dev/content/images/2022/11/NDev-03-02.png 1920w" sizes="(min-width: 1200px) 1200px"></figure><p>Now we&apos;ve got the same deal, but with two downstream connections. After the data is passed through to the inner core, it then goes out to both connections. Let&apos;s say the connection to the right is the correct destination, while the connection lower down is incorrect. The destination will be examined on the way out of the device. For the connection to the right, the destination will be verified to be correct and passed along to proceed to its destination. If it&apos;s incorrect, as in the case of that lower connection, it will get dropped, never be received by the far end of the connection.</p><hr><p>This explanation allows for the separation of those concepts of <em>device logic</em> and <em>interconnection</em>. It&apos;s important to note, though, that thinking of the <em>device logic</em> and the <em>bridge</em> as being separate does not always play nicely. </p><p><a href="https://wiki.mikrotik.com/wiki/Manual:Packet_Flow?ref=geekly-dev">Mikrotik&apos;s Packet Flow chart</a> is a great example of how these simplifications can be rendered insufficient in short order. But as a general mental model, this kind of visualization has helped me significantly to grapple with more complex details as I come across them. While simplified models are rarely ever perfect, they can be useful tools for understanding specific elements of a complex system. </p><p>In the next and final part, we&apos;ll head back to take another look at the SSFBSGLSWT (strange sci-fi Battlestar Galactica lookin&apos; sub-woofer thing) and why I made such an odd thing to begin with. Hopefully, you&apos;ve already got some guesses as to the meaning behind of some of its odd features.</p><figure class="kg-card kg-image-card kg-width-full kg-card-hascaption"><img src="https://geekly.dev/content/images/2022/11/vlan07-ts.png" class="kg-image" alt="Visualizing the Layers of the TCP/IP Model" loading="lazy" width="1920" height="1080" srcset="https://geekly.dev/content/images/size/w600/2022/11/vlan07-ts.png 600w, https://geekly.dev/content/images/size/w1000/2022/11/vlan07-ts.png 1000w, https://geekly.dev/content/images/size/w1600/2022/11/vlan07-ts.png 1600w, https://geekly.dev/content/images/2022/11/vlan07-ts.png 1920w"><figcaption>Tangled messes are the jam.</figcaption></figure><p>Link will be available here once it&apos;s published. Until then, and as always, if you have any suggestions or corrections for me to take into account, please let me know! I tried to make this as orderly as I could, but whether you&apos;re an experienced technical engineer, just starting out, or simply reading through out of curiosity, if you feel that there are any sections that need improvement I&apos;d appreciate the feedback.</p>]]></content:encoded></item><item><title><![CDATA[The strangest explanation of VLANs you've never heard]]></title><description><![CDATA[Mental models rarely fit neatly into little boxes, yet we try to visualize them using overly simplistic means. For once, let's get a little nutty. ]]></description><link>https://geekly.dev/strangest-explanation-of-vlans/</link><guid isPermaLink="false">632c41c55ccd8b07ec9e8557</guid><category><![CDATA[Musings]]></category><category><![CDATA[Networks]]></category><dc:creator><![CDATA[Nad]]></dc:creator><pubDate>Wed, 09 Nov 2022 23:37:59 GMT</pubDate><media:content url="https://geekly.dev/content/images/2022/11/vlan06.png" medium="image"/><content:encoded><![CDATA[<h2 id="bear-with-me-this-is-going-to-be-a-weird-one">Bear with me, this is going to be a weird one.</h2><img src="https://geekly.dev/content/images/2022/11/vlan06.png" alt="The strangest explanation of VLANs you&apos;ve never heard"><p>This is the first part in a series of odd explorations and exposition with the intent of providing a fresh take on the subjects of VLANs, subnets, cross-discipline topology, network protocols, and mental models by altering visualization techniques to make the concepts more approachable to the uninitiated and more engaging to experienced engineers.</p><hr><p>You might have a good idea of what VLANs are, already. You might know them more thoroughly than I do. Or perhaps you&apos;ve never even heard of them before. Whatever the case may be, I&apos;m fairly certain you will have never come across an explanation of them remotely as weird as what I&apos;m going to offer here.</p><p>I recently spent a decent amount of time deep diving on VLANs, and I got a bit frustrated with the explanations I came across. They did the job well enough. The explanations conveyed the concepts, but they felt incomplete. I had difficulty forming a mental representation of what was going on. And I noticed a disparity of information between the baseline explanations and the explanations that were so incredibly in-depth that they required hours of mulling over flow charts of hardware level packet handling in order to understand. There wasn&apos;t a whole lot in between. </p><p>I talked about this effect a bit more in another post, <a href="https://geekly.dev/many-labyrinths/">The Many Labyrinths Interpretation</a>. </p><figure class="kg-card kg-bookmark-card"><a class="kg-bookmark-container" href="https://geekly.dev/many-labyrinths/"><div class="kg-bookmark-content"><div class="kg-bookmark-title">The Many-Labyrinths Interpretation</div><div class="kg-bookmark-description">Bridging the gap between superficial knowledge and practical understanding can be downright overwhelming. Why?</div><div class="kg-bookmark-metadata"><img class="kg-bookmark-icon" src="https://geekly.dev/content/images/2022/09/favicon-1.ico" alt="The strangest explanation of VLANs you&apos;ve never heard"><span class="kg-bookmark-author">geekly.dev</span><span class="kg-bookmark-publisher">Nad</span></div></div><div class="kg-bookmark-thumbnail"><img src="https://geekly.dev/content/images/2022/09/mazecmb.jpg" alt="The strangest explanation of VLANs you&apos;ve never heard"></div></a></figure><p>In that, I suggested that offering the details of one&apos;s learning experience, though they may differ from others&apos;, can be a vital aspect of overcoming the disparity of information available in the void between superficial understanding and deeper comprehension. While a deeper comprehension of VLANs is beyond the scope of this strange little thought experiment, I hope to at least provide some context from my own experience in a way that would move that deeper comprehension within reach.</p><figure class="kg-card kg-image-card kg-width-wide"><img src="https://geekly.dev/content/images/2022/09/vlan02.png" class="kg-image" alt="The strangest explanation of VLANs you&apos;ve never heard" loading="lazy" width="1920" height="1080" srcset="https://geekly.dev/content/images/size/w600/2022/09/vlan02.png 600w, https://geekly.dev/content/images/size/w1000/2022/09/vlan02.png 1000w, https://geekly.dev/content/images/size/w1600/2022/09/vlan02.png 1600w, https://geekly.dev/content/images/2022/09/vlan02.png 1920w" sizes="(min-width: 1200px) 1200px"></figure><p>If you&apos;re new to VLANs and wondering what the heck is going on here, I will do my best to explain them as I understand them shortly. Before that though, I just want to lay some groundwork and provide some context as to why I would bother making a sci-fi rendering of a strange Battlestar-Galactica-lookin&apos;-subwoofer-thing.</p><p>Diagrams and charts enable succinct visual representation of concepts, but they have inherent limitations. In simplifying complex ideas into straightforward representations, a degree of complexity is summarily discarded. Often, that degree can be a significant amount. Sometimes complexity is unnecessary to convey the idea being presented. Other times, crucial information is lost in translation.</p><p>This leads to a simple measure: Simplistic diagrams are limited to simplistic concepts. </p><p>Making diagrams that contain more information leads to design issues. How can additional information be presented in a way that doesn&apos;t clutter and obfuscate? Our mental models of systems can process and contain a wild amount of information, but they largely consist of abstractions that prove difficult to communicate. </p><p>Learning something new requires building new mental models.</p><p>We tend to build those mental models using the descriptions, visual aids, and whatever scraps of information we can piece together into a coherent image. However, when the information available is scarce, the visual aids are overly simple, and the descriptions fail to paint a picture, it can be a frustrating experience.</p><p>What I&apos;d like to attempt in this bizarre exercise is to present the key concepts that helped me to understand underlying network structures using imagery and visualizations along common themes. If simplistic diagrams are limited to simplistic concepts, that&apos;s fine. We can break down complex ideas into simpler ones and visualize them as we go. Keeping consistent themes across the different types of visualizations will help transfer comprehension between concepts. At least, that&apos;s my hope.</p><figure class="kg-card kg-image-card kg-width-full"><img src="https://geekly.dev/content/images/2022/10/vlan03.png" class="kg-image" alt="The strangest explanation of VLANs you&apos;ve never heard" loading="lazy" width="1920" height="1080" srcset="https://geekly.dev/content/images/size/w600/2022/10/vlan03.png 600w, https://geekly.dev/content/images/size/w1000/2022/10/vlan03.png 1000w, https://geekly.dev/content/images/size/w1600/2022/10/vlan03.png 1600w, https://geekly.dev/content/images/2022/10/vlan03.png 1920w"></figure><p>In basic terms, VLANs (virtual local area networks) are a way to virtualize additional hardware connections with low level software. Creating VLANs is a way to divide the network into virtually isolated segments, and to enable rule based policies to determine how those network segments are allowed to communicate with each other. And it does so using a minimal amount of physical hardware and connections. A simple tag gets added to a packet within the frame that enables network appliances to make determinations about how the packet is handled on both the data link and network layers.</p><p>If anything in that explanation strikes you as <em>previously undefined</em> and confusing, don&apos;t worry. We&apos;ll get into the details of all of it. It&apos;s a juggling act to try to explain tech concepts from basic principles because there are inevitable junctions at which many ideas must be introduced concurrently. To some, it might feel unnecessary to explain the basics, while others might feel left behind by glossing over an idea too quickly. I will do my best to present these ideas in a way that&apos;s readily accessible for as many backgrounds as I can without using the same dry, rote explanations that experienced technicians are accustomed to. My hope is that providing an unconventional approach to a standard topic will provide something to chew on for all readers alike.</p><p>I&apos;m also going to include a quick disclaimer that the point of this exercise isn&apos;t to denigrate the value of existing explanations and models, but to try to offer a shift in perspective of how to think about them, and by extension, different considerations for network topology. While I offer my own interpretation of concepts that I feel are usually problematically presented, others might be able to come up with completely novel interpretations. Or they might not agree with the problematic premise to begin with. For all the myriad use cases and all of the different approaches to mapping them, some are going to be objectively good and some aren&apos;t. In other words, my offering here isn&apos;t of a solution to a problem, but rather an elaboration of my own mental model that helped me to understand certain concepts.</p><hr><blockquote class="kg-blockquote-alt">&#x201C;Begin at the beginning,&quot; the King said, very gravely, &quot;and go on till you come to the end: then stop.&#x201D;<br>- Lewis Carol, Alice in Wonderland</blockquote><p>The biggest stumbling block for me in learning about VLANs wasn&apos;t with the basic explanation. I understood the concepts and they&apos;re easy to convey. The thought that kept going through my head as I was banging my head against the wall was &quot;what&apos;s in the box?&quot; Those little boxes that represent a switch or a router, where lines are drawn to and from that represent connections contained no information about what happens to process those connections. And that&apos;s the part that varies heavily between implementations. My SSFBSGLSWT (strange sci-fi Battlestar Galactica lookin&apos; sub-woofer thing) is my attempt to convey the mental model that I developed to facilitate comprehension of those different implementations. </p><p>Hopefully it does the job a little better than this.</p><figure class="kg-card kg-image-card kg-card-hascaption"><img src="https://geekly.dev/content/images/2022/10/777px-Router_on_a_stick_concept-1.png" class="kg-image" alt="The strangest explanation of VLANs you&apos;ve never heard" loading="lazy" width="665" height="553" srcset="https://geekly.dev/content/images/size/w600/2022/10/777px-Router_on_a_stick_concept-1.png 600w, https://geekly.dev/content/images/2022/10/777px-Router_on_a_stick_concept-1.png 665w"><figcaption>What&apos;s in the box? <em>(Credit: <a href="https://commons.wikimedia.org/wiki/File:Router_on_a_stick_concept.png?ref=geekly-dev">Wikipedia Commons</a>)</em></figcaption></figure><p>Kidding aside, this is a useful diagram for describing what&apos;s known as a &quot;Router on a Stick&quot; (RoaS), and is almost a useful starting point for describing VLANs in general. But we still need context of what a VLAN is to begin with. So let&apos;s talk topology real quick.</p><hr><p>Topology is a whole field of study unto itself that has a staggering array of useful applications. A quick look through the introduction of the topic on Wikipedia gives the impression that this is the stuff of Escher-esque brain teasing visual anomalies and maniacal space-time continuum sci-fi shenanigans. It credits Leibniz&apos;s <a href="https://hal.archives-ouvertes.fr/hal-03059623/document?ref=geekly-dev"><em>Analysis situs</em> and <em>Geometria situs</em></a> as being foundational works upon which the field of topology was developed. </p><p>And as an interesting side note, Leibniz created the <a href="https://en.wikipedia.org/wiki/Stepped_reckoner?ref=geekly-dev">stepped reckoner</a>, a prototype mechanical calculator which could perform the four basic arithmetic operations, in the late 17th century. I&apos;m including this little &quot;fun fact&quot; because physical models of abstractions is the ongoing theme here, and the stepped reckoner is a great rabbit hole in that vein.</p><figure class="kg-card kg-image-card kg-card-hascaption"><img src="https://geekly.dev/content/images/2022/10/Leibniz_Stepped_Reckoner.png" class="kg-image" alt="The strangest explanation of VLANs you&apos;ve never heard" loading="lazy" width="1190" height="742" srcset="https://geekly.dev/content/images/size/w600/2022/10/Leibniz_Stepped_Reckoner.png 600w, https://geekly.dev/content/images/size/w1000/2022/10/Leibniz_Stepped_Reckoner.png 1000w, https://geekly.dev/content/images/2022/10/Leibniz_Stepped_Reckoner.png 1190w" sizes="(min-width: 720px) 720px"><figcaption>A true &quot;bare metal&quot; calculator (<em>Credit: <a href="https://commons.wikimedia.org/wiki/File:Leibniz_Stepped_Reckoner.png?ref=geekly-dev">Wikipedia Commons</a></em>)</figcaption></figure><p>In short, topology is the sort of thing to give you the means and methods to both completely lose yourself <em>and</em> find your way back out. I won&apos;t be going into much depth on the subject, but I want to introduce a few key concepts from it because there is relevance in both networking and 3d modeling. &quot;Network topology&quot; is used often and widely in networking to refer to the <em>in situ</em> configuration of devices and connections within a given network. And &quot;mesh topology&quot; is used often and widely in 3d modeling to refer to the <em>in situ</em> geometric features and &quot;flow&quot; of the polygons that compose a given object.</p><p>In both cases, the common usage is very informal. Which is to say that the concepts involved don&apos;t require getting into much mathematics in order to comprehend. Instead, let&apos;s start with an approach of play on words. Since it&apos;s <em>informal</em>, let&apos;s talk about <em>informing</em> and <em>deforming</em>.</p><p>The first thing that might come to your mind with <em>informing</em> is the concept of <em>being informed</em> of something. When <em>in</em>formed, you might <em>in</em>terpret, <em>in</em>corporate, and <em>in</em>tegrate the information. These words all share a common etymological root because they all deal with a similar concept of one distinct abstraction absorbing another. Maybe you have imagery floating around in your head now of one amoeba enveloping another to devour it. That is a useful visualization because it describes an <em>envelope,</em> a manifold encompassing another thing, as a boundary that exists between the two things prior to absorption.</p><p>This also gives rise to the concept that in order for the two abstractions to merge, there is <em>deformation</em> that occurs. And we can picture it happening both through the process of involution (as the boundary is obliterated and the abstractions intermingle) and within the final product (perhaps even being greater than the sum of its parts) by using that same amoeba imagery floating around in your head. </p><p>While <em>en</em>velopment describes closing something off within a boundary, <em>de</em>velopment describes the removal of that boundary and the <em>de</em>ployment of the contents. </p><p>Visualizing things in this way, we&apos;re able to start thinking about abstractions in terms of their manifold boundaries, what features define them, and what deformations are necessary to accommodate additions and subtractions to and from them.</p><hr><h2 id="getting-down-to-brass-tacks">Getting down to brass tacks</h2><h3 id="or-a-description-of-basic-topological-principles-using-the-geometry-of-pinning-a-post-it-note-to-a-cork-board">or, <em>A Description of Basic Topological Principles Using the Geometry of Pinning a Post-It Note to a Cork Board</em></h3><figure class="kg-card kg-image-card"><img src="https://geekly.dev/content/images/2022/10/Noteboard.png" class="kg-image" alt="The strangest explanation of VLANs you&apos;ve never heard" loading="lazy" width="1080" height="1080" srcset="https://geekly.dev/content/images/size/w600/2022/10/Noteboard.png 600w, https://geekly.dev/content/images/size/w1000/2022/10/Noteboard.png 1000w, https://geekly.dev/content/images/2022/10/Noteboard.png 1080w" sizes="(min-width: 720px) 720px"></figure><p>I like visualizations almost as much as I like to mess with idiomatic expressions. We&apos;ll be getting back around to applying all of this to VLANs soon, but I just want to put those topological tools to use in something a little less nebulous than amoebas. So let&apos;s take a closer look at these so-called &quot;brass tacks&quot; of infamy.</p><figure class="kg-card kg-image-card"><img src="https://geekly.dev/content/images/2022/10/tack1.png" class="kg-image" alt="The strangest explanation of VLANs you&apos;ve never heard" loading="lazy" width="1080" height="1080" srcset="https://geekly.dev/content/images/size/w600/2022/10/tack1.png 600w, https://geekly.dev/content/images/size/w1000/2022/10/tack1.png 1000w, https://geekly.dev/content/images/2022/10/tack1.png 1080w" sizes="(min-width: 720px) 720px"></figure><p>Right off the bat, we can see a few defining features of this tack. Mainly, a domed top with a lip around the edge, and an extrusion from the underside that tapers to a point to form the pin. We can also see the &quot;flow&quot; of the mesh. Because it&apos;s largely composed of concentric quadrilaterals, we can follow the order of vertices from one to the next in an orderly fashion along two axes. In turn, this provides the ability to form &quot;loops&quot; that can circumnavigate the object. For instance, the very outer ring can be clearly seen and visually followed. Along the other axis, you can follow a line traced originating from the top of the dome down to the tip of the pin.</p><figure class="kg-card kg-image-card"><img src="https://geekly.dev/content/images/2022/10/tack1-loops3.png" class="kg-image" alt="The strangest explanation of VLANs you&apos;ve never heard" loading="lazy" width="1550" height="750" srcset="https://geekly.dev/content/images/size/w600/2022/10/tack1-loops3.png 600w, https://geekly.dev/content/images/size/w1000/2022/10/tack1-loops3.png 1000w, https://geekly.dev/content/images/2022/10/tack1-loops3.png 1550w" sizes="(min-width: 720px) 720px"></figure><p>The topology of this object is straightforward, easy to read, easy to manipulate, and works well &quot;under the hood&quot; of the rendering engine.</p><p>Which leads to the question of what a messy topology might look like.</p><figure class="kg-card kg-image-card"><img src="https://geekly.dev/content/images/2022/10/tack1-decimate.png" class="kg-image" alt="The strangest explanation of VLANs you&apos;ve never heard" loading="lazy" width="1080" height="1080" srcset="https://geekly.dev/content/images/size/w600/2022/10/tack1-decimate.png 600w, https://geekly.dev/content/images/size/w1000/2022/10/tack1-decimate.png 1000w, https://geekly.dev/content/images/2022/10/tack1-decimate.png 1080w" sizes="(min-width: 720px) 720px"></figure><p>The object is still basically the same shape, but the mesh topology is now completely different. Orderly topology is starting to look very appealing in comparison. </p><blockquote>At the risk of ending up going off into the weeds, this sort of operation, called &quot;decimation&quot;, serves a purpose and can be used very effectively to reduce the amount of polygons used to define an object. But this is usually a final step once a mesh is complete, and not something to be done mid-project as it makes modification very difficult. This doesn&apos;t have much to do with where we&apos;re going and is only included for anyone asking <em>&quot;why on Earth would anyone want to do this?&quot;</em></blockquote><p>Now use this tack to pin a note to the board.</p><p>This involves three distinct objects. While the tack doesn&apos;t really become altered in this process, the note and the board both go through deformation and have fundamental changes made to them.</p><figure class="kg-card kg-image-card"><img src="https://geekly.dev/content/images/2022/10/note-hole-1.png" class="kg-image" alt="The strangest explanation of VLANs you&apos;ve never heard" loading="lazy" width="1080" height="1080" srcset="https://geekly.dev/content/images/size/w600/2022/10/note-hole-1.png 600w, https://geekly.dev/content/images/size/w1000/2022/10/note-hole-1.png 1000w, https://geekly.dev/content/images/2022/10/note-hole-1.png 1080w" sizes="(min-width: 720px) 720px"></figure><p>The note now has a hole punctured through its manifold boundary. What started off as basically a squished cube is now more akin to a torus because of that alteration. In order to visualize this, imagine being microscopic and walking along the surface of the piece of paper without the hole. When you get to the edge, you take a step and flip over to the other side. Now with the hole, there is an additional feature where if you step through, you&apos;ll flip to the other side. Topologically speaking, this surface now behaves more like a torus than a cube. All because of an alteration that we normally wouldn&apos;t even bother thinking about in the course of pinning a note to a board.</p><p>Something that&apos;s also noteworthy is the addition of geometric features surrounding the hole in order to reinforce and stabilize its local position. Without those added &quot;loops&quot;, the alteration would affect a much larger area and potentially distort the curvature or flatness of the surrounding area.</p><p>Let&apos;s take a look at how the cork board fared its alterations.</p><figure class="kg-card kg-image-card kg-card-hascaption"><img src="https://geekly.dev/content/images/2022/10/board-hole1.png" class="kg-image" alt="The strangest explanation of VLANs you&apos;ve never heard" loading="lazy" width="1080" height="1080" srcset="https://geekly.dev/content/images/size/w600/2022/10/board-hole1.png 600w, https://geekly.dev/content/images/size/w1000/2022/10/board-hole1.png 1000w, https://geekly.dev/content/images/2022/10/board-hole1.png 1080w" sizes="(min-width: 720px) 720px"><figcaption>That curve behind the pin is the post-it note. Because let&apos;s face it, those things never sit flat.</figcaption></figure><p>The hole made in the cork board doesn&apos;t extend all the way through, so we didn&apos;t end up with another torus this time. However, if we zoom way out and take a look at the whole board we&apos;ll find that the changes made to the simple squished cube extend all the way around it now. The &quot;loops&quot; required to define the feature add quite a bit of complexity to what was previously a simple geometric primitive.</p><figure class="kg-card kg-image-card kg-card-hascaption"><img src="https://geekly.dev/content/images/2022/10/board-hole2.png" class="kg-image" alt="The strangest explanation of VLANs you&apos;ve never heard" loading="lazy" width="1080" height="1080" srcset="https://geekly.dev/content/images/size/w600/2022/10/board-hole2.png 600w, https://geekly.dev/content/images/size/w1000/2022/10/board-hole2.png 1000w, https://geekly.dev/content/images/2022/10/board-hole2.png 1080w" sizes="(min-width: 720px) 720px"><figcaption>Geometric ramifications of adding a tiny pin hole in the center are evident even at a distance.</figcaption></figure><p>Let&apos;s take a step back now, because it probably feels as if we&apos;ve gone pretty far off the course of talking about the things that we&apos;d like to understand. Instead, we&apos;ve been talking about 3d models and idiosyncrasies of wireframe meshes. The important thing to keep in mind is that creating viable models of abstractions can be a bizarre and difficult undertaking, and that concepts can have more portability than what may seem immediately apparent. By that, I mean that lessons learned in one field can often be applied elsewhere if we just find the right perspective to view them from.</p><hr><h2 id="so-lets-talk-networks">So let&apos;s talk networks.</h2><p>Network topology is usually presented using a Visio diagram, or something similar, with maybe a few footnotes to act as mortar. Diagrams can be incredibly useful. But some can be outright baffling.</p><p>Also, let&apos;s face it: Most network diagrams are hideous to look at. Instead of scouring the interwebs for a suitable <a href="https://www.google.com/search?q=network+diagram+visio&amp;tbm=isch&amp;ref=geekly-dev">example</a>, I&apos;ve whipped up a homebrew set that suits my own tastes a bit better.</p><figure class="kg-card kg-image-card kg-card-hascaption"><img src="https://geekly.dev/content/images/2022/10/visio-1t-2.png" class="kg-image" alt="The strangest explanation of VLANs you&apos;ve never heard" loading="lazy" width="1920" height="1080" srcset="https://geekly.dev/content/images/size/w600/2022/10/visio-1t-2.png 600w, https://geekly.dev/content/images/size/w1000/2022/10/visio-1t-2.png 1000w, https://geekly.dev/content/images/size/w1600/2022/10/visio-1t-2.png 1600w, https://geekly.dev/content/images/2022/10/visio-1t-2.png 1920w" sizes="(min-width: 720px) 720px"><figcaption>Standard cookie-cutter network diagram starter pack</figcaption></figure><p>These are the most often seen components in a basic network diagram. There are a range of other symbols to denote other pieces of network appliances and nodes. Network diagrams can have extensive component sets, but this sampling should suffice for our purposes.</p><p>Starting with servers and hosts, these are normally simple end points. They share some similarity to the cork board. The additional feature created (the pin hole poked partway into them) is the connection to the network. But generally speaking, these devices don&apos;t act as &quot;passthroughs&quot;. They generally have a single point of connection through which all communications travel.</p><p>Next up are switches. Switches are similarly simple, except instead of a single point of connection, they have many. There isn&apos;t a lot of decision-making involved, though. A switch will retain a list of hardware addresses (also referred to as MAC addresses, which is a series of 6 bytes in hexadecimal that looks something like <code>aa:bb:cc:dd:ee:ff</code>) of the devices connected to it, and when it receives a packet with a MAC address it&apos;s familiar with, it sends it along to that device. </p><p>Topologically, the most complex of this set is the router. That&apos;s because routers are capable to varying degrees of defining and directing the flow of traffic. This is in contrast to switches because instead of just keeping track of MAC addresses, they are also capable of defining and keeping track of IP addresses (which is a series of 4 bytes of decimal that looks something like <code>255.255.255.255</code>). &#xA0;</p><hr><p>To visualize how a switch&apos;s topology might map out, tack a few pinholes into the switch (no, not literally!) that actually connect through to each other. So you could picture a chamber on the inside that the hole pierce through to.</p><figure class="kg-card kg-image-card"><img src="https://geekly.dev/content/images/2022/10/switch-chmb.png" class="kg-image" alt="The strangest explanation of VLANs you&apos;ve never heard" loading="lazy" width="1920" height="1080" srcset="https://geekly.dev/content/images/size/w600/2022/10/switch-chmb.png 600w, https://geekly.dev/content/images/size/w1000/2022/10/switch-chmb.png 1000w, https://geekly.dev/content/images/size/w1600/2022/10/switch-chmb.png 1600w, https://geekly.dev/content/images/2022/10/switch-chmb.png 1920w" sizes="(min-width: 720px) 720px"></figure><p>Say we pipe this form up to a water hose (no, don&apos;t connect your actual switch to a water hose!), and turn the water on full blast. It&apos;s easy enough to imagine a spray coming out of all the pinholes that aren&apos;t hooked up to the hose. Awesome. We have a sprinkler now.</p><p>Except this isn&apos;t exactly how switches work. For a more realistic interpretation, we should also visualize a set of gates that can control which pinholes are open at what times. Sometimes only a pair of gates are open, sometimes all of them can be open.</p><p>However, these extra gates aren&apos;t exactly a necessary visualization. For our purposes of defining network topologies, we&apos;re most interested in understanding the &quot;broadcast domains&quot; of the network. The times when all the gates are open are for packets being sent to the destination of broadcast domain. In plainer terms, it&apos;s possible to address <em>all devices</em> on a local network with this special destination address. In IP addressing, the reserved destination address for broadcast packets is <code>255.255.255.255</code>, and in MAC addressing is <code>ff:ff:ff:ff:ff:ff</code>.</p><p>Broadcast domain transmissions are sent to all devices within the network equally. Since any device can send broadcast domain addressed frames/packets, and a switch will readily allow their transmission, any devices located within the same broadcast domain should be considered part of the same flat network.</p><hr><p>For routers, we&apos;re not going to be able to make such a simple model. </p><p>While superficially they serve a very similar function to switches, concatenating multiple connections into a single upstream connection as well as passing local traffic to the appropriate destination, they are generally capable of performing many more functions. Those capabilities can be utilized on as as-needed basis. In certain situations they might be employed to function more or less the same duties as a switch, while in other situations they might be needed to host a significant array of services that add complexities to the network topology beyond what can be represented with a simple intersection of tubes.</p><p>This leads to black box scenarios where footnotes are needed for elaboration upon the details of the services present that may affect topology. And in a lot of network diagrams those footnotes are simply absent, leaving the interpreter guessing which of the myriad scenarios apply. So while network diagrams can be very effective and succinct at conveying network <em>structure</em>, organization, wiring configurations, and addressing schemata, they can easily fall short of the mark of truly conveying network <em>topology</em> to succinctly convey the configuration states of the devices.</p><p>Since routers are much more context dependent, let&apos;s look at some contexts, starting with a simple &quot;flat&quot; network.</p><figure class="kg-card kg-image-card"><img src="https://geekly.dev/content/images/2022/10/flat1.png" class="kg-image" alt="The strangest explanation of VLANs you&apos;ve never heard" loading="lazy" width="1920" height="1080" srcset="https://geekly.dev/content/images/size/w600/2022/10/flat1.png 600w, https://geekly.dev/content/images/size/w1000/2022/10/flat1.png 1000w, https://geekly.dev/content/images/size/w1600/2022/10/flat1.png 1600w, https://geekly.dev/content/images/2022/10/flat1.png 1920w" sizes="(min-width: 720px) 720px"></figure><p>Adding some mortar to the brick to make it stick and giving some quick footnotes is pretty easy with this one. The devices connected to the router are all on the same local network. Let&apos;s call it a <code>192.168.0.0/24</code> network. </p><p>The <code>/24</code> is a CIDR (<a href="https://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing?ref=geekly-dev">Classless Inter-Domain Routing</a>) designation used to simplify addressing schemata that means, in this context, that the devices will be assigned local IP addresses ranging from <code>192.168.0.1 - 192.168.0.254</code>. The addresses are assigned by the router itself with a DHCP server. A DHCP server is a decent example of one of the services that routers can perform that switches generally do not.</p><p>What&apos;s most important to our ability to define the topology is the knowledge that all of the devices are located within the same broadcast domain. Unless the router&apos;s firewall (another relevant service) has rules to specifically prohibit certain connections, each of these devices should be capable of finding and communicating with each other.</p><p>Also of note is that I used a different color to delineate the local network downstream from the router from the upstream connection. This may seem like an unnecessary distinction now, but it will become more relevant as we add more complexity into our examples.</p><figure class="kg-card kg-image-card kg-width-wide kg-card-hascaption"><img src="https://geekly.dev/content/images/2022/10/flat2.png" class="kg-image" alt="The strangest explanation of VLANs you&apos;ve never heard" loading="lazy" width="1920" height="1080" srcset="https://geekly.dev/content/images/size/w600/2022/10/flat2.png 600w, https://geekly.dev/content/images/size/w1000/2022/10/flat2.png 1000w, https://geekly.dev/content/images/size/w1600/2022/10/flat2.png 1600w, https://geekly.dev/content/images/2022/10/flat2.png 1920w" sizes="(min-width: 1200px) 1200px"><figcaption>Hang on, there&apos;s a second router? What&apos;s that doing there?</figcaption></figure><p>Already, our flat network is getting difficult to read, topologically speaking. If not for the fact that all of the local connections are labelled blue, we&apos;d be left wondering what the specific configuration of that second router might look like. Is it masquerading the devices behind it, performing NAT, and defining a different subnet? In this case, no. We still have a flat network. All of these devices are still on the same local network, and are all capable of discovering and communicating with one another. </p><p>Maybe the router is performing another service. Maybe it was included simply because it has the potential to perform another service. For whatever reason, the person who made the diagram (hey now, don&apos;t look at me like that!) decided to label the device in that location as a router even though <em>topologically</em> it&apos;s performing the same function as a switch. The intention underlying the formulation of the diagram may be obvious to the creator of it, but can easily lead to unintended ambiguity for the readers. </p><p>What would a network look like that isn&apos;t flat? For that, we&apos;re going to go back to our simple flat network and reconfigure the router to serve some different <em>subnets</em>.</p><figure class="kg-card kg-image-card kg-width-wide"><img src="https://geekly.dev/content/images/2022/11/subnet1-1.png" class="kg-image" alt="The strangest explanation of VLANs you&apos;ve never heard" loading="lazy" width="1920" height="1080" srcset="https://geekly.dev/content/images/size/w600/2022/11/subnet1-1.png 600w, https://geekly.dev/content/images/size/w1000/2022/11/subnet1-1.png 1000w, https://geekly.dev/content/images/size/w1600/2022/11/subnet1-1.png 1600w, https://geekly.dev/content/images/2022/11/subnet1-1.png 1920w" sizes="(min-width: 1200px) 1200px"></figure><p>Subnetting is a way to isolate networks from each other by defining different IP address ranges. This limits the scope of the broadcast domains for each subnet. It&apos;s then up to the router whether to allow or deny traffic between them.</p><p>In our example above, our subnets are delineated across the third octet. The red network uses 100, purple uses 110, and blue uses 120. Depending on the configuration of the router these devices might be able to talk to each other or not. For example, we might want the blue network to be able to provide services to both the red and purple networks, but not talk beyond the router to the green network. And we might also want to keep the red and purple networks from talking to each other at all, but to be be able to access the blue network and break out to the internet on the green connection.</p><p>Unfortunately, this diagram doesn&apos;t tell us much about the internal state of the router. We can determine that it&apos;s providing three different subnets, but we can&apos;t tell how those subnets mesh with each other. </p><p>Let&apos;s take this a step further and get a little wacky with this.</p><figure class="kg-card kg-image-card kg-width-full"><img src="https://geekly.dev/content/images/2022/11/subnet2o.png" class="kg-image" alt="The strangest explanation of VLANs you&apos;ve never heard" loading="lazy" width="1920" height="720" srcset="https://geekly.dev/content/images/size/w600/2022/11/subnet2o.png 600w, https://geekly.dev/content/images/size/w1000/2022/11/subnet2o.png 1000w, https://geekly.dev/content/images/size/w1600/2022/11/subnet2o.png 1600w, https://geekly.dev/content/images/2022/11/subnet2o.png 1920w"></figure><p>We&apos;ve got some devices grouped by physical proximity. And we have connections labelled according to subnet. The thing is though, we have some mixed and matched associations going on. The blue section is nice and straightforward, but the other two have devices connecting to each different subnet as needed. So in this case, we have to run those connections back to the appropriate switches that serve a given subnet. Another option might be to have a multitude of switches for each location. This might be a preferable approach if we have much more devices.</p><p>This is where VLANs come in handy. Remember that first diagram we briefly looked at of a Router on a Stick? Let&apos;s apply that to this scenario.</p><figure class="kg-card kg-image-card kg-width-full"><img src="https://geekly.dev/content/images/2022/11/visio-VLAN1.png" class="kg-image" alt="The strangest explanation of VLANs you&apos;ve never heard" loading="lazy" width="1920" height="720" srcset="https://geekly.dev/content/images/size/w600/2022/11/visio-VLAN1.png 600w, https://geekly.dev/content/images/size/w1000/2022/11/visio-VLAN1.png 1000w, https://geekly.dev/content/images/size/w1600/2022/11/visio-VLAN1.png 1600w, https://geekly.dev/content/images/2022/11/visio-VLAN1.png 1920w"></figure><p>This cleans things up quite a bit. Now we have <em>localized</em> wiring within each group while maintaining access to the variety of subnets. We have a hierarchy that is much easier to visually follow.</p><p>This also changes things up quite a bit. Now we have switches with different subnets being served from them, as opposed to routers as we&apos;d expect to see performing such a function. We also have strange rainbow colored connections between the switches and the router. </p><p>The thing that makes this all possible is the VLAN tag. This is a simple little mayfly of a sequence of 2 bytes tacked on ephemerally by routers and switches. This tag lets the other routers and switches know which VLAN the traffic is intended for. The tag only stays in place within our local network between the switches and the router. The presence of these tags create what are called &quot;trunk lines.&quot; On our diagram, the trunk lines are indicated with the rainbow colored connections.</p><p>The tags don&apos;t make it all the way to the host machines on the network. Nor do they leave to journey out into the wilds of the interwebs. These mayflies are created and removed by the switches and router, and never venture further than the trunk lines. Their lifespan is not much longer than a handful of milliseconds. Their sole purpose is to pass the VLAN information from one network device to the next.</p><p>So VLAN tags give us the ability to create trunk lines, and trunk lines allow us to drive multiple subnets through a single connection. This opens the door on a lot of possibilities that, while they may not have been previously <em>im</em>possible, would have been difficult or costly to implement. </p><hr><h3 id="oh-hey-youre-still-here">Oh hey, you&apos;re still here!</h3><p>That&apos;ll just about wrap up this section, but while we may now know what VLANs are, we still haven&apos;t gotten into how to fit these pieces together topologically. There is still plenty more ground to cover, so I&apos;ve decided to split this up into more manageable pieces before it gets away from me entirely.</p><p>The goal of Part 2 is to provide an explanation of the concepts of TCP/IP and OSI layers, frames, packets, and the distinction of physical and logical models. If any of these concepts are completely unfamiliar to you, it might be worth giving it a perusal before we dive into more details about VLANs. It uses the topological concepts we explored earlier to establish a visual model that integrates nicely into <em>all this VLAN stuff</em>.</p><figure class="kg-card kg-bookmark-card"><a class="kg-bookmark-container" href="https://geekly.dev/tcp-ip-model/"><div class="kg-bookmark-content"><div class="kg-bookmark-title">Visualizing the Layers of the TCP/IP Model</div><div class="kg-bookmark-description">This is part 2 of a series, The Strangest Explanation of VLANs You&#x2019;ve Never Heard. While it should be largely capable of standing alone, it does build on some of the topological concepts discussed in that article. This should provide what I find to be a useful shift in perspective</div><div class="kg-bookmark-metadata"><img class="kg-bookmark-icon" src="https://geekly.dev/content/images/2022/09/favicon-1.ico" alt="The strangest explanation of VLANs you&apos;ve never heard"><span class="kg-bookmark-author">geekly.dev</span><span class="kg-bookmark-publisher">Nad</span></div></div><div class="kg-bookmark-thumbnail"><img src="https://geekly.dev/content/images/2022/11/NDev-04-all-2.png" alt="The strangest explanation of VLANs you&apos;ve never heard"></div></a></figure><p>Part 3 will put a bow on this whole eccentric array of exposition by bringing in the Battlestar Galactica Subwoofer once more to tie it all together.</p><p>If you have any suggestions or corrections for me to take into account, please let me know! I tried to make this as orderly as I could, but whether you&apos;re an experienced technical engineer, just starting out, or simply reading through out of curiosity, if you feel that there are any sections that need improvement I&apos;d appreciate the feedback.</p>]]></content:encoded></item><item><title><![CDATA[Linux Mint with a Kali Themed Twist]]></title><description><![CDATA[Some good ol fashioned customization to make Linux Mint just the way I like it... Like Kali.]]></description><link>https://geekly.dev/linux-mint-with-kali-theme/</link><guid isPermaLink="false">632d65e35ccd8b07ec9e85d1</guid><category><![CDATA[Tutorials]]></category><dc:creator><![CDATA[Nad]]></dc:creator><pubDate>Mon, 26 Sep 2022 04:30:17 GMT</pubDate><media:content url="https://geekly.dev/content/images/2022/09/IMG_6339n-1.jpg" medium="image"/><content:encoded><![CDATA[<img src="https://geekly.dev/content/images/2022/09/IMG_6339n-1.jpg" alt="Linux Mint with a Kali Themed Twist"><p>I absolutely love working in Kali. I used to play around with it a lot back in the days of Backtrack, and it was much more rough around the edges. So when I jumped back into using the more modern Kali, I was blown away with how cleanly everything was laid out. <em>Especially</em> the terminal. It&apos;s beautiful and downright capable. But I don&apos;t always want to load up Kali just to work in a Linux environment I like.</p><p>When I made this site, I decided to make a new designated VM Linux build for handling everything related to managing Geekly. I decided to give Mint and spin, and liked it well enough. Except I really missed the look and feel of Kali (<em>especially</em> that terminal!). So I set out to bring over all the things that I liked from Kali, without the 1337hAxOr tools. The end result is a build of Mint Xfce that feels nice and comfy, where I can code away in peace and serenity.</p><p>If this sounds like your kinda jam, I&apos;ve put together a little tutorial to walk through the whole process. </p><h3 id="first-ingredient-fresh-mint">First ingredient: Fresh Mint</h3><p>First off, you&apos;re obviously gonna need to install Mint if you haven&apos;t already. Specifically, the Xfce Edition.</p><figure class="kg-card kg-bookmark-card"><a class="kg-bookmark-container" href="https://www.linuxmint.com/download.php?ref=geekly-dev"><div class="kg-bookmark-content"><div class="kg-bookmark-title">Download Linux Mint 21 - Linux Mint</div><div class="kg-bookmark-description">Linux Mint is an elegant, easy to use, up to date and comfortable desktop operating system.</div><div class="kg-bookmark-metadata"><img class="kg-bookmark-icon" src="https://www.linuxmint.com/web/img/favicon.ico" alt="Linux Mint with a Kali Themed Twist"><span class="kg-bookmark-author">Linux Mint</span><span class="kg-bookmark-publisher">Linux Mint</span></div></div><div class="kg-bookmark-thumbnail"><img src="https://www.linuxmint.com/web/img/logo-mono.svg" alt="Linux Mint with a Kali Themed Twist"></div></a></figure><p>This was all done on Mint 21, so your mileage may vary if there have been significant changes between when this was written and when you&apos;re reading it.</p><h3 id="guest-additions-for-virtualbox">Guest Additions for VirtualBox</h3><p>If you aren&apos;t running this Mint build as a VirtualBox VM, you can skip this section. It&apos;s not even strictly necessary even if you are (I&apos;ve included links to all the required files so that having a Kali machine isn&apos;t even necessary), but it just makes life a little easier and I like to do it right off the bat when I create a new VM (unless I want it to be sandboxed and isolated, but that&apos;s a whole different tutorial). But it&apos;s quick and painless enough to include here, so if you&apos;re running this build on VirtualBox, you&apos;ll probably want to install the VB Guest Additions to make your life a little easier. It will allow you to share folders and clipboard data between the host machine and the VM.</p><p>You can do this by going to the VM menu under Devices, and clicking the &quot;Insert Guest Additions CD Image&quot;.</p><figure class="kg-card kg-image-card"><img src="https://geekly.dev/content/images/2022/09/VirtualBoxVM_xMjm8rQyZ5.png" class="kg-image" alt="Linux Mint with a Kali Themed Twist" loading="lazy" width="254" height="200"></figure><p>Open up a terminal and locate the mount location. In my case (with a username &quot;mint&quot;) it was <code>/media/mint/VBox_GAs_6.1.38/</code>, in which case the command to install would be <code>sudo /media/mint/VBox_GAs_6.1.38/VBoxLinuxAdditions.run</code>. Restart after that and you should be able to enable clipboard copy/paste between host and guest, as well as shared folders. Those options are all available under the same Devices menu shown above.</p><h3 id="did-you-update-upgrade-yet">Did you update &amp;&amp; upgrade yet?</h3><p>Even after a fresh install of the latest release, there are usually still quite a few patches to go out and grab. A simple <code>sudo apt update &amp;&amp; sudo apt upgrade</code> will do the trick. </p><h3 id="main-kali-theme">Main Kali Theme</h3><p>Next, let&apos;s grab the Kali theme files. Download and extract to a location of your choice. We&apos;re just gonna pick through and grab a few select configurations.</p><figure class="kg-card kg-bookmark-card"><a class="kg-bookmark-container" href="https://gitlab.com/kalilinux/packages/kali-themes?ref=geekly-dev"><div class="kg-bookmark-content"><div class="kg-bookmark-title">Kali Linux / Packages / kali-themes &#xB7; GitLab</div><div class="kg-bookmark-description">kali-themes packaging for Kali Linux</div><div class="kg-bookmark-metadata"><img class="kg-bookmark-icon" src="https://gitlab.com/assets/favicon-72a2cad5025aa931d6ea56c3201d1f18e68a8cd39788c7c80d5b2b82aa5143ef.png" alt="Linux Mint with a Kali Themed Twist"><span class="kg-bookmark-author">GitLab</span></div></div><div class="kg-bookmark-thumbnail"><img src="https://gitlab.com/uploads/-/system/project/avatar/14611100/kali-logo.png" alt="Linux Mint with a Kali Themed Twist"></div></a></figure><p>I&apos;m going to assume you&apos;ve downloaded your copy to <code>Downloads</code> and extracted its contents to <code>kali-themes-kali-master</code>, so the path to the extracted files would be <code>~/Downloads/kali-themes-kali-master/</code>. &#xA0;You can put it anywhere you like, but the commands to copy files from this will have to be modified accordingly.</p><p>Copy the Kali-Dark theme and icons and set permissions: </p><pre><code class="language-sh">sudo cp -r ~/Downloads/kali-themes-kali-master/share/themes/Kali-Dark/ /usr/share/themes/Kali-Dark
sudo cp -r ~/Downloads/kali-themes-kali-master/share/icons/Flat-Remix-Blue-Dark/ /usr/share/icons/Flat-Remix-Blue-Dark/</code></pre><p>We want to set the permissions for files and directories separately.</p><pre><code class="language-sh">sudo chmod 755 $(sudo find /usr/share/themes/Kali-Dark -type d)
sudo chmod 644 $(sudo find /usr/share/themes/Kali-Dark -type f)
sudo chmod 755 $(sudo find /usr/share/icons/Flat-Remix-Blue-Dark -type d)
sudo chmod 644 $(sudo find /usr/share/icons/Flat-Remix-Blue-Dark -type f)</code></pre><p>Then we&apos;re going to want to update the icon cache.</p><pre><code class="language-sh">sudo gtk-update-icon-cache /usr/share/icons/Flat-Remix-Blue-Dark/</code></pre><p>Let&apos;s also grab the system fonts while we&apos;re at it.</p><pre><code class="language-sh">sudo apt install fonts-cantarell fonts-firacode</code></pre><p><em>Note: if apt is unable to locate the packages, you may need to add the universe depository and update with <code>sudo add-apt-repository universe</code> and <code>sudo apt update</code>.</em></p><p>Open up the Settings | Appearance menu, and select the Kali-Dark theme in the Style tab, Flat-Remix-Blue-Dark in the Icons, and Cantarell 11pt with Firacode Medium 10pt in the Fonts tab.</p><figure class="kg-card kg-image-card"><img src="https://geekly.dev/content/images/2022/09/VirtualBoxVM_GGa9U50lRv.png" class="kg-image" alt="Linux Mint with a Kali Themed Twist" loading="lazy" width="442" height="417"></figure><figure class="kg-card kg-image-card kg-card-hascaption"><img src="https://geekly.dev/content/images/2022/09/Photoshop_3UzMARzumV.png" class="kg-image" alt="Linux Mint with a Kali Themed Twist" loading="lazy" width="1169" height="500" srcset="https://geekly.dev/content/images/size/w600/2022/09/Photoshop_3UzMARzumV.png 600w, https://geekly.dev/content/images/size/w1000/2022/09/Photoshop_3UzMARzumV.png 1000w, https://geekly.dev/content/images/2022/09/Photoshop_3UzMARzumV.png 1169w" sizes="(min-width: 720px) 720px"><figcaption>I also liked the Adwaita icons and a 10pt Cantarell, but the choice is yours.</figcaption></figure><p>We&apos;ll also want to open up Settings | Desktop Settings and &quot;Configure Xfwm4&quot; to recognize the Kali-Dark theme.</p><figure class="kg-card kg-image-card kg-card-hascaption"><img src="https://geekly.dev/content/images/2022/09/VirtualBoxVM_ooegEcFjOA.png" class="kg-image" alt="Linux Mint with a Kali Themed Twist" loading="lazy" width="1165" height="559" srcset="https://geekly.dev/content/images/size/w600/2022/09/VirtualBoxVM_ooegEcFjOA.png 600w, https://geekly.dev/content/images/size/w1000/2022/09/VirtualBoxVM_ooegEcFjOA.png 1000w, https://geekly.dev/content/images/2022/09/VirtualBoxVM_ooegEcFjOA.png 1165w" sizes="(min-width: 720px) 720px"><figcaption>It&apos;s like a breath of fresh air... with mint.</figcaption></figure><h3 id="task-bar-layout">Task Bar Layout</h3><p>I&apos;ve liked the top-bar layout in Kali, but I also ended up liking the bottom-bar configuration for Mint. Maybe it helps me more readily differentiate what environment I&apos;m in when I&apos;m switching back and forth between VMs. But if you end up not liking the bottom layout, you can change it.</p><figure class="kg-card kg-image-card"><img src="https://geekly.dev/content/images/2022/09/VirtualBoxVM_FYQO2LPIJf.png" class="kg-image" alt="Linux Mint with a Kali Themed Twist" loading="lazy" width="346" height="185"></figure><p>Uncheck the <code>Lock panel</code> option and hit close. This will give you little handles on the far left and right sides with which you can drag the entire panel up to the top.</p><figure class="kg-card kg-image-card"><img src="https://geekly.dev/content/images/2022/09/VirtualBoxVM_h0IddoiB6U.png" class="kg-image" alt="Linux Mint with a Kali Themed Twist" loading="lazy" width="247" height="47"></figure><p>You can also add the workspace manager if you like working across multiple desktops to keep things organized. Just open up the panel menu again and hit Add New Items. Way down at the bottom, you want to add the Workspace Switcher. Once it&apos;s on there, move it into place where you like it.</p><p>Kali uses numbered buttons for the workspaces. </p><figure class="kg-card kg-image-card kg-card-hascaption"><img src="https://geekly.dev/content/images/2022/09/VirtualBoxVM_p5WTA5fOQ2.png" class="kg-image" alt="Linux Mint with a Kali Themed Twist" loading="lazy" width="147" height="33"><figcaption>Simple and clean.</figcaption></figure><p>To recreate that, right click on the workspace widget and open up the properties for it. </p><p>Set appearance to &quot;Buttons&quot; and rows to 1. Then open up the Workspace settings and replace the verbose names with just numbers.</p><figure class="kg-card kg-image-card"><img src="https://geekly.dev/content/images/2022/09/VirtualBoxVM_oJeC3GC5Pz.png" class="kg-image" alt="Linux Mint with a Kali Themed Twist" loading="lazy" width="1042" height="438" srcset="https://geekly.dev/content/images/size/w600/2022/09/VirtualBoxVM_oJeC3GC5Pz.png 600w, https://geekly.dev/content/images/size/w1000/2022/09/VirtualBoxVM_oJeC3GC5Pz.png 1000w, https://geekly.dev/content/images/2022/09/VirtualBoxVM_oJeC3GC5Pz.png 1042w" sizes="(min-width: 720px) 720px"></figure><p>I personally prefer a different setup using the miniature view because it shows me the window arrangements currently on the workspaces, and I can drag windows between them easily.</p><figure class="kg-card kg-image-card kg-card-hascaption"><img src="https://geekly.dev/content/images/2022/09/VirtualBoxVM_Wvs4r0vrMi.png" class="kg-image" alt="Linux Mint with a Kali Themed Twist" loading="lazy" width="74" height="33"><figcaption>So cute!</figcaption></figure><p>If you&apos;d prefer this setup as well, it&apos;s as simple as changing the properties over to Miniature View and setting the number of rows to 2. </p><figure class="kg-card kg-image-card"><img src="https://geekly.dev/content/images/2022/09/VirtualBoxVM_Srj6lOwYWx.png" class="kg-image" alt="Linux Mint with a Kali Themed Twist" loading="lazy" width="430" height="229"></figure><p>You can also add separators to your liking. Remember that when you add new components to the panel, they&apos;ll show up on the far right. So if you&apos;ve added a bunch of separators and they&apos;re just not showing up, be sure to check over there. They can be easy to overlook.</p><hr><h2 id="the-star-of-the-show">The star of the show</h2><p>The next bit is one of the main features that I wanted to bring over. I love the look and feel of the terminal in Kali. And I was a bit bummed that it didn&apos;t magically show up the way I liked it when I copied over the theme files. Bummed, but not surprised. </p><p>The default look of the Mint terminal just... ain&apos;t my thing. It&apos;s not that it&apos;s <em>bad</em>. But look at it next to the Kali terminal and tell me what you think. (Hint: I will only accept answers pontificating on the magnificent aesthetics of the Kali terminal over those of the Mint terminal.)</p><figure class="kg-card kg-image-card kg-width-wide kg-card-hascaption"><img src="https://geekly.dev/content/images/2022/09/terms.jpg" class="kg-image" alt="Linux Mint with a Kali Themed Twist" loading="lazy" width="1921" height="1043" srcset="https://geekly.dev/content/images/size/w600/2022/09/terms.jpg 600w, https://geekly.dev/content/images/size/w1000/2022/09/terms.jpg 1000w, https://geekly.dev/content/images/size/w1600/2022/09/terms.jpg 1600w, https://geekly.dev/content/images/2022/09/terms.jpg 1921w" sizes="(min-width: 1200px) 1200px"><figcaption>It doesn&apos;t feel like a fair fight.</figcaption></figure><p>I&apos;m glad you agree. Let&apos;s fix this.</p><p>Thankfully, I found <a href="https://www.linux.org/threads/kali-terminal-in-ubuntu.41410/?ref=geekly-dev">this thread</a> which led me in the right direction. Forum user <strong>f33dm3bits </strong>did most of the legwork on figuring this out. I&apos;m going to deviate a little bit from those instructions, but the gist is the same.</p><p>Getting Kali&apos;s terminal just right will take a few things. Qterminal, zsh, some files, and some tweaks to get it all clicking together.</p><p>That glorious font is called FiraCode. It&apos;s a monotype font with ligatures (meaning symbols like == and =/= have special renditions) and some very slick choices in text alignment that are <em>chef&apos;s kiss.</em> We already installed it earlier, so it&apos;ll be good to go. But if you&apos;re interested in what it does, you can read more about it here.</p><figure class="kg-card kg-bookmark-card"><a class="kg-bookmark-container" href="https://github.com/tonsky/FiraCode?ref=geekly-dev"><div class="kg-bookmark-content"><div class="kg-bookmark-title">GitHub - tonsky/FiraCode: Free monospaced font with programming ligatures</div><div class="kg-bookmark-description">Free monospaced font with programming ligatures. Contribute to tonsky/FiraCode development by creating an account on GitHub.</div><div class="kg-bookmark-metadata"><img class="kg-bookmark-icon" src="https://github.com/fluidicon.png" alt="Linux Mint with a Kali Themed Twist"><span class="kg-bookmark-author">GitHub</span><span class="kg-bookmark-publisher">tonsky</span></div></div><div class="kg-bookmark-thumbnail"><img src="https://repository-images.githubusercontent.com/26500787/bf313080-6b02-11ea-9cd5-c3dca880736d" alt="Linux Mint with a Kali Themed Twist"></div></a></figure><p>Now let&apos;s grab zsh and qterminal.</p><pre><code class="language-sh">sudo apt install zsh qterminal</code></pre><p>We&apos;ll want to grab <code>~/.zshrc</code> from Kali and bring it in to Mint. </p><figure class="kg-card kg-bookmark-card"><a class="kg-bookmark-container" href="https://gitlab.com/kalilinux/packages/kali-defaults/-/blob/kali/master/etc/skel/.zshrc?ref=geekly-dev"><div class="kg-bookmark-content"><div class="kg-bookmark-title">etc/skel/.zshrc &#xB7; kali/master &#xB7; Kali Linux / Packages / kali-defaults &#xB7; GitLab</div><div class="kg-bookmark-description">kali-defaults packaging for Kali Linux // https://kalilinux.gitlab.io/packages/kali-defaults/</div><div class="kg-bookmark-metadata"><img class="kg-bookmark-icon" src="https://gitlab.com/assets/favicon-72a2cad5025aa931d6ea56c3201d1f18e68a8cd39788c7c80d5b2b82aa5143ef.png" alt="Linux Mint with a Kali Themed Twist"><span class="kg-bookmark-author">GitLab</span><span class="kg-bookmark-publisher">daniruiz</span></div></div><div class="kg-bookmark-thumbnail"><img src="https://gitlab.com/assets/twitter_card-570ddb06edf56a2312253c5872489847a0f385112ddbcd71ccfa1570febab5d2.jpg" alt="Linux Mint with a Kali Themed Twist"></div></a></figure><p>You can do this by copy/pasting into an editor, or by downloading it and moving to the home directory. In my case, it downloaded as <code>index.zshrc</code> so I just did <code>mv ~/Downloads/index.zshrc ~/.zshrc</code> and <code>chmod 644 .zshrc</code> to set the correct permissions.</p><p>Then we&apos;ll want to change the shell over to zsh:</p><pre><code class="language-sh">chsh -s /bin/zsh</code></pre><p>Then log out and log back in.</p><figure class="kg-card kg-image-card kg-card-hascaption"><img src="https://geekly.dev/content/images/2022/09/VirtualBoxVM_uM2KwB86DL.png" class="kg-image" alt="Linux Mint with a Kali Themed Twist" loading="lazy" width="238" height="41"><figcaption>Your prompt should look something like this now.</figcaption></figure><p>Looking better already. Still got a bit left to do, however. </p><p>The forum post describes using the following lines at this point:</p><pre><code class="language-sh">autoload -Uz compinit promptinit
compinit
promptinit</code></pre><p>However, the <code>.zshrc</code> from Kali already contains <code>autoload -Uz compinit</code> and <code>compinit -d ~/.cache/zcompdump</code>. I&apos;m not sure if <code>promptinit</code> is required to achieve the same prompt behavior, but there&apos;s no harm in including those commands despite the presence of compinit in the config file.</p><p>We definitely want to grab the autosuggestions module though.</p><pre><code class="language-sh">sudo apt install zsh-autosuggestions</code></pre><p>Now let&apos;s get ready to switch over to qterminal. First, let&apos;s copy over the color scheme from the Kali theme files.</p><pre><code class="language-sh">sudo cp ~/Downloads/kali-themes-kali-master/share/qtermwidget5/color-schemes/Kali-Dark.colorscheme /usr/share/qtermwidget5/color-schemes/Kali-Dark.colorscheme</code></pre><p>Do a quick check with <code>ll /usr/share/qtermwidget5/color-schemes</code> (ll is an ls alias for ls -l which shows permissions) and make sure the copied file has the same permissions as the rest of the files. If not, you can run <code>sudo chmod 644 /usr/share/qtermwidget5/color-schemes/Kali-Dark.colorscheme</code>.</p><p>Let&apos;s get out of xfce terminal and switch the launcher over to qterminal.</p><figure class="kg-card kg-image-card kg-card-hascaption"><img src="https://geekly.dev/content/images/2022/09/VirtualBoxVM_HPNnUWy0Rh.png" class="kg-image" alt="Linux Mint with a Kali Themed Twist" loading="lazy" width="316" height="217"><figcaption>Right click to bring up the menu.</figcaption></figure><p>Go to the Properties for the terminal launcher and edit it to use qterminal instead.</p><figure class="kg-card kg-image-card"><img src="https://geekly.dev/content/images/2022/09/VirtualBoxVM_AiAIfu8FgR.png" class="kg-image" alt="Linux Mint with a Kali Themed Twist" loading="lazy" width="750" height="459" srcset="https://geekly.dev/content/images/size/w600/2022/09/VirtualBoxVM_AiAIfu8FgR.png 600w, https://geekly.dev/content/images/2022/09/VirtualBoxVM_AiAIfu8FgR.png 750w" sizes="(min-width: 720px) 720px"></figure><p>Save it and open up a new terminal!</p><figure class="kg-card kg-image-card kg-card-hascaption"><img src="https://geekly.dev/content/images/2022/09/VirtualBoxVM_DtvOwodB7E.png" class="kg-image" alt="Linux Mint with a Kali Themed Twist" loading="lazy" width="617" height="467" srcset="https://geekly.dev/content/images/size/w600/2022/09/VirtualBoxVM_DtvOwodB7E.png 600w, https://geekly.dev/content/images/2022/09/VirtualBoxVM_DtvOwodB7E.png 617w"><figcaption>Well this is awkward.</figcaption></figure><p>Don&apos;t worry, we&apos;ll set things right. Open up File | Preferences and change the font, color scheme, widget style, and other settings as shown below.</p><figure class="kg-card kg-image-card kg-card-hascaption"><img src="https://geekly.dev/content/images/2022/09/Photoshop_dnZwh2xnZ6.png" class="kg-image" alt="Linux Mint with a Kali Themed Twist" loading="lazy" width="1072" height="555" srcset="https://geekly.dev/content/images/size/w600/2022/09/Photoshop_dnZwh2xnZ6.png 600w, https://geekly.dev/content/images/size/w1000/2022/09/Photoshop_dnZwh2xnZ6.png 1000w, https://geekly.dev/content/images/2022/09/Photoshop_dnZwh2xnZ6.png 1072w" sizes="(min-width: 720px) 720px"><figcaption>Everything starts coming together.</figcaption></figure><figure class="kg-card kg-image-card kg-card-hascaption"><img src="https://geekly.dev/content/images/2022/09/Photoshop_8qVDT8yZod.png" class="kg-image" alt="Linux Mint with a Kali Themed Twist" loading="lazy" width="1062" height="669" srcset="https://geekly.dev/content/images/size/w600/2022/09/Photoshop_8qVDT8yZod.png 600w, https://geekly.dev/content/images/size/w1000/2022/09/Photoshop_8qVDT8yZod.png 1000w, https://geekly.dev/content/images/2022/09/Photoshop_8qVDT8yZod.png 1062w" sizes="(min-width: 720px) 720px"><figcaption>You can add shortcuts as well if you like.</figcaption></figure><figure class="kg-card kg-image-card kg-card-hascaption"><img src="https://geekly.dev/content/images/2022/09/VirtualBoxVM_67LXqRGDnQ.png" class="kg-image" alt="Linux Mint with a Kali Themed Twist" loading="lazy" width="616" height="462" srcset="https://geekly.dev/content/images/size/w600/2022/09/VirtualBoxVM_67LXqRGDnQ.png 600w, https://geekly.dev/content/images/2022/09/VirtualBoxVM_67LXqRGDnQ.png 616w"><figcaption><em>Now</em> we&apos;re talkin!</figcaption></figure><hr><h2 id="odds-and-ends">Odds and ends</h2><p>At this point, everything should be looking pretty decent. There are a few more loose ends and they&apos;re all entirely optional. (To be fair though, this entire endeavor is entirely optional, so we might as well keep playing around with it.)</p><h3 id="qt5-configuration-tool">Qt5 Configuration Tool</h3><p>Copy these files over real quick:</p><pre><code class="language-sh">sudo cp ~/Downloads/kali-themes-kali-master/share/qt5ct/colors/Kali-Dark.conf /usr/share/qt5ct/colors/Kali-Dark.conf
sudo cp ~/Downloads/kali-themes-kali-master/share/qt5ct/qss/fusion-simple-scrollbar.qss /usr/share/qt5ct/qss/fusion-simple-scrollbar.qss</code></pre><p>Again, you&apos;ll want to check the permissions and make sure they&apos;re correct. Assuming they&apos;re all good, let&apos;s open up the Qt5 Configuration Tool.</p><figure class="kg-card kg-image-card"><img src="https://geekly.dev/content/images/2022/09/VirtualBoxVM_m9Jqs4FYCK.png" class="kg-image" alt="Linux Mint with a Kali Themed Twist" loading="lazy" width="441" height="240"></figure><figure class="kg-card kg-image-card kg-card-hascaption"><img src="https://geekly.dev/content/images/2022/09/VirtualBoxVM_Oi2nrOcC0Z.png" class="kg-image" alt="Linux Mint with a Kali Themed Twist" loading="lazy" width="498" height="163"><figcaption>Set widget style and color scheme</figcaption></figure><figure class="kg-card kg-image-card kg-card-hascaption"><img src="https://geekly.dev/content/images/2022/09/VirtualBoxVM_mbSfPXoPsq.png" class="kg-image" alt="Linux Mint with a Kali Themed Twist" loading="lazy" width="495" height="92"><figcaption>Set the fonts</figcaption></figure><figure class="kg-card kg-image-card kg-card-hascaption"><img src="https://geekly.dev/content/images/2022/09/VirtualBoxVM_WhPlkwsN7X.png" class="kg-image" alt="Linux Mint with a Kali Themed Twist" loading="lazy" width="496" height="174"><figcaption>And enable the fusion scrollbar</figcaption></figure><p>This will bring over the nice slim profile scrollbar as well as the fonts and theme configurations for certain contexts. </p><h3 id="cpu-graph">CPU Graph</h3><p>Entirely unnecessary, but who doesn&apos;t like CPU graphs?</p><p>Kali uses this one in particular:</p><figure class="kg-card kg-bookmark-card"><a class="kg-bookmark-container" href="https://docs.xfce.org/panel-plugins/xfce4-cpugraph-plugin/start?ref=geekly-dev"><div class="kg-bookmark-content"><div class="kg-bookmark-title">panel-plugins:xfce4-cpugraph-plugin:start [Xfce Docs]</div><div class="kg-bookmark-description"></div><div class="kg-bookmark-metadata"><img class="kg-bookmark-icon" src="https://docs.xfce.org/lib/tpl/xfce/images/apple-touch-icon.png" alt="Linux Mint with a Kali Themed Twist"></div></div><div class="kg-bookmark-thumbnail"><img src="https://docs.xfce.org/_media/panel-plugins/xfce4-cpugraph-plugin-logo.png" alt="Linux Mint with a Kali Themed Twist"></div></a></figure><p>We can just install it with apt.</p><pre><code class="language-sh">sudo apt install xfce4-cpugraph-plugin</code></pre><p>Right click on the panel and add a new CPU Graph to it.</p><figure class="kg-card kg-image-card"><img src="https://geekly.dev/content/images/2022/09/VirtualBoxVM_8K8FYJH7Ct.png" class="kg-image" alt="Linux Mint with a Kali Themed Twist" loading="lazy" width="406" height="547"></figure><p>It&apos;ll pop up way in the corner, hiding behind the clock. Go ahead and move it to where you want it, then bring up the properties for it. We just want to alter something from default to make it create a configuration file for it.</p><figure class="kg-card kg-image-card kg-card-hascaption"><img src="https://geekly.dev/content/images/2022/09/VirtualBoxVM_mGqMLRC6zG.png" class="kg-image" alt="Linux Mint with a Kali Themed Twist" loading="lazy" width="522" height="575"><figcaption>Pick a color, any color. Make it extra hideous.</figcaption></figure><p>Head on over to your <code>~/.config/xfce4/panel</code> directory and edit the cpugraph file. For me it was <code>cpugraph-16.rc</code>, but the specific number may be different for you. The little trick involved here is that the panel config files are loaded when the panel is loaded and saved again when the panel is closed. So editing the file while the panel is running will just be replaced with the extra hideous config we just created. So have an extra terminal open to stop the panel and restart it. Whether you load the file up in a gui editor, nano, vim, or whatever else, make your edits, shut down the panel, save the config, then start the panel up again.</p><p>Replace everything in the file with the following:</p><pre><code>UpdateInterval=0
TimeScale=0
Size=128
Frame=0
Border=0
Bars=1
ColorMode=1
Foreground1=rgb(39,119,255)
Foreground2=rgb(0,255,224)
BarsColor=rgb(0,255,224)
PerCore=0
TrackedCore=0
InTerminal=1
StartupNotification=0</code></pre><p>Close down the panel before saving with <code>xfce4-panel -q</code>, save the edited config file, and start the panel back up with <code>xfce4-panel &amp;</code>. (The <code>&amp;</code> will let you get back to a prompt and shut the terminal down without losing the panel. If the prompt doesn&apos;t show up immediately once the panel is running again, just hit return and it should pop up.)</p><figure class="kg-card kg-image-card kg-card-hascaption"><img src="https://geekly.dev/content/images/2022/09/VirtualBoxVM_k40MhJ8a3L.png" class="kg-image" alt="Linux Mint with a Kali Themed Twist" loading="lazy" width="173" height="33"><figcaption>It&apos;s beautiful.</figcaption></figure><h3 id="spicy-root-optional">Spicy root (optional)</h3><p>This is completely optional (and entirely at your own risk), but you can also set the shell for root and enable a skull prompt as an additional visual indicator by copying over <code>.zshrc</code> to root&apos;s home and uncommenting the following line. </p><figure class="kg-card kg-image-card kg-card-hascaption"><img src="https://geekly.dev/content/images/2022/09/VirtualBoxVM_SZXCKpNlyD.png" class="kg-image" alt="Linux Mint with a Kali Themed Twist" loading="lazy" width="329" height="68"><figcaption>You can also change the normal prompt symbol for regular users.</figcaption></figure><figure class="kg-card kg-image-card kg-card-hascaption"><img src="https://geekly.dev/content/images/2022/09/VirtualBoxVM_3P7BFwijHl.png" class="kg-image" alt="Linux Mint with a Kali Themed Twist" loading="lazy" width="309" height="41"><figcaption>Spending too long in root means <em>doooooom</em></figcaption></figure><p>Again, it&apos;s up to you if you want to enable that. I thought it was nifty enough to share, and while I&apos;m not one to gatekeep it should still be noted that missteps as root can come with consequences. If you aren&apos;t sure how to log in as root, or haven&apos;t ever messed with it before, don&apos;t feel bad about giving this a pass.</p><hr><p>There are quite a few more configuration files for other contexts provided in the Kali theme files, and you can go as far down the rabbit hole as you&apos;d like. This is about as far as I wanted to take it, but you&apos;re free to take a stroll through the theme files and pick out what you want from them. For instance, if you prefer to use the Xfce4 Terminal, there are Kali theme files for it. Or if you want the Kali themed syntax highlighting for Xed, you can copy over the gtksourceview files and set the theme in Xed. </p><p>There&apos;s a lot in there to scope out. Keep in mind you can also always compare to Kali itself to find what settings it uses. Enjoy!</p>]]></content:encoded></item><item><title><![CDATA[The Many-Labyrinths Interpretation]]></title><description><![CDATA[Bridging the gap between superficial knowledge and practical understanding can be downright overwhelming. Why?]]></description><link>https://geekly.dev/many-labyrinths/</link><guid isPermaLink="false">631936161212161047e8f6c0</guid><category><![CDATA[Musings]]></category><dc:creator><![CDATA[Nad]]></dc:creator><pubDate>Sat, 17 Sep 2022 10:12:15 GMT</pubDate><media:content url="https://geekly.dev/content/images/2022/09/mazecmb.jpg" medium="image"/><content:encoded><![CDATA[<img src="https://geekly.dev/content/images/2022/09/mazecmb.jpg" alt="The Many-Labyrinths Interpretation"><p>When it comes to a lot of tech related stuff, there&apos;s divide between beginner level comprehension and practical implementation. There&apos;s simply something along the way that clicks into place in a way that makes so much sense that everything that came before the intuitive leap that enabled sudden comprehension seems to pale in comparison. All the rest of that junk you&apos;ve spent days reading through didn&apos;t help like that one last thing did, did it?</p><p>That <em>big intuitive leap</em>, the main bit of insight, seems pithy enough to be able to relate to others but it is ultimately just icing on a cake of frustrated and desperate scrounging-for-information. Or perhaps a better analogy would be a door at the end of a labyrinth. For those who have successfully traversed the labyrinth, the path through seems perfectly reasonable.</p><p>Describing the Big Intuitive Leap is often no better than telling someone stuck in the labyrinth, &quot;There&apos;s a door at the end. Just go through that.&quot;</p><p>As someone who has been stuck in the labyrinth more times than I&apos;d care to admit, it&apos;s great knowing that there&apos;s a door at the end and all, but it doesn&apos;t do a whole lot to help me get there.</p><p>Keeping with this analogy though, there&apos;s still hope. Because even though most people just want to point to the door at the end as their helpful deed for the day, occasionally they drop other tidbits of information. &quot;There&apos;s a door at the end just past a swampy pit filled with spikes and leeches.&quot; Now you know there&apos;s a pit of spikes and leeches, and that crossing that pit is necessary to reach the door. The more you scour the forum threads of oddly bad explanations, the more tidbits you can amalgamate into a rough map of how to <em>get to the door.</em></p><p>Then once you find the door, you can experience the struggle of trying to recollect and explain your path through the labyrinth to someone else trapped inside.</p><hr><p>One of the problems is that the labyrinth shifts. It&apos;s different for everyone because everyone is starting off from a different baseline of comprehension. Different backgrounds, different conceptualizations, and different fundamental mechanisms of learning. </p><p>Think of it as the Many-Labyrinth Interpretation. (And yes, I did enjoy this name so much that I made it the title of this post.)</p><p>The map for one person probably won&apos;t do the trick for someone else stuck in a different part of a similar, but ever-so-slightly different labyrinth. The swampy pit filled with spikes and leeches might still be there, but perhaps this time it&apos;s after the dancing skeleton that sings riddles instead of after the crow with a single white tail feather.</p><p>So even for those who put in monumental effort into their descriptions of escaping the labyrinth, the information may still not be the solution for someone else stuck inside.</p><blockquote class="kg-blockquote-alt">&quot;Don&apos;t let perfect be the enemy of good.&quot; </blockquote><p>Determining the state of someone else&apos;s labyrinth and interposing your own map onto theirs in order to provide a best-possible-explanation can require a significant investment of time and energy. And that&apos;s assuming that communication barriers don&apos;t get in the way, which is rarely the case.</p><p>However, my map through my own labyrinth can still hopefully help someone else in theirs, even if they aren&apos;t the same. It all goes back to the tidbits of information. The labyrinths don&apos;t need to be a no-mans-land of information where people only want to describe the door at the end. Those discrete bits of description can still be helpful to someone else to point them in the right direction.</p><p><em>Helping</em> someone doesn&apos;t necessarily entail <em>solving all of their problems for them.</em> Having been the person lost in the maze plenty of times, <em>I</em> certainly don&apos;t want people to hand me the solutions. Okay, maybe every once in a while it&apos;s a nice experience. But having a problem solved for me doesn&apos;t necessarily tell me how to solve a similar problem again in the future. </p><p>Most of the time, all it takes is to have my problems heard, and to be pointed in a direction. Even if that direction doesn&apos;t ultimately work out, I still value the direction because the things I learn along the way have intrinsic value. Not to mention that it helps to have that connection, and to not feel completely alone in an endeavor.</p><p>I believe that to be the case for most people seeking answers.</p>]]></content:encoded></item></channel></rss>