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

<channel>
	<title>tech Archives | Walter&#039;s Little World</title>
	<atom:link href="https://walterstovall.online/category/tech/feed/" rel="self" type="application/rss+xml" />
	<link>https://walterstovall.online/category/tech/</link>
	<description>Personal interests</description>
	<lastBuildDate>Sat, 06 Jan 2024 17:11:13 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	

<image>
	<url>https://walterstovall.online/wp-content/uploads/2020/09/cropped-bikeicon-1-150x150.jpg</url>
	<title>tech Archives | Walter&#039;s Little World</title>
	<link>https://walterstovall.online/category/tech/</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>Split DNS done right using opnsense</title>
		<link>https://walterstovall.online/2024/01/06/split-dns-done-right-using-opnsense/</link>
					<comments>https://walterstovall.online/2024/01/06/split-dns-done-right-using-opnsense/#respond</comments>
		
		<dc:creator><![CDATA[Walter Stovall]]></dc:creator>
		<pubDate>Sat, 06 Jan 2024 16:45:25 +0000</pubDate>
				<category><![CDATA[tech]]></category>
		<guid isPermaLink="false">https://walterstovall.online/?p=30359</guid>

					<description><![CDATA[<p>I can&#8217;t get over how simple and powerful my OPNsense router is. It&#8217;s almost as easy to setup as any consumer router as long as you know to leave stuff alone that you don&#8217;t understand. I recently setup OPNsense on a Protectli VP420 and I&#8217;ve been real happy with it. Running a home lab with ... <a title="Split DNS done right using opnsense" class="read-more" href="https://walterstovall.online/2024/01/06/split-dns-done-right-using-opnsense/" aria-label="Read more about Split DNS done right using opnsense">Read more</a></p>
<p>The post <a href="https://walterstovall.online/2024/01/06/split-dns-done-right-using-opnsense/">Split DNS done right using opnsense</a> appeared first on <a href="https://walterstovall.online">Walter&#039;s Little World</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p class="wp-block-paragraph">I can&#8217;t get over how simple and powerful my <a href="https://opnsense.org/">OPNsense router</a> is. It&#8217;s almost as easy to setup as any consumer router as long as you know to leave stuff alone that you don&#8217;t understand. I recently setup OPNsense on a <a href="https://protectli.com/product/vp2420/">Protectli VP420</a> and I&#8217;ve been real happy with it.</p>



<p class="wp-block-paragraph">Running a <a href="https://linuxhandbook.com/homelab/">home lab</a> with public facing services, you run into the problem of <a href="https://networkinterview.com/split-domain-name-system-split-dns/">Split DNS</a>. Any name, like my home.stovallhut.online webpage, needs to be registered with a public IP address to reach it over the internet. Problem is, if you&#8217;re at home then you should be contacting a local address on your network (some routers let you use <a href="https://www.techtarget.com/searchunifiedcommunications/definition/hairpinning">reflection/hairpinning</a> to get around that but this has its own issues). My OPNsense router makes this pretty easy to manage with its <a href="https://docs.opnsense.org/manual/unbound.html">Unbound DNS service and dns overrides</a>.</p>



<p class="wp-block-paragraph">That all works pretty good but the icing on the cake came when I figured out (with the help of <a href="https://forum.opnsense.org/index.php?topic=9245.0">a Great Guide</a>) how to forward queries to my local DNS even when the client software specifically requested a different DNS server. Like if the client sends DNS queries to google&#8217;s public DNS at 8.8.8.8, then my router will now STILL handle the request if it can locally without contacting google. And if it does contact a public server, it won&#8217;t be google, and it will go out using <a href="https://homenetworkguy.com/how-to/configure-dns-over-tls-unbound-opnsense/">DNS over TLS</a> so my searches are private (at least to third parties like my ISP).</p>



<p class="wp-block-paragraph">Amazing device <img decoding="async" height="16" width="16" src="https://static.xx.fbcdn.net/images/emoji.php/v9/t4c/1/16/1f642.png" alt="&#x1f642;"></p>
<p>The post <a href="https://walterstovall.online/2024/01/06/split-dns-done-right-using-opnsense/">Split DNS done right using opnsense</a> appeared first on <a href="https://walterstovall.online">Walter&#039;s Little World</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://walterstovall.online/2024/01/06/split-dns-done-right-using-opnsense/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Automatically backup your opnsense router to a Synology NAS via SFTP</title>
		<link>https://walterstovall.online/2023/11/13/automatically-backup-your-opnsense-router-to-a-synology-nas-via-sftp/</link>
					<comments>https://walterstovall.online/2023/11/13/automatically-backup-your-opnsense-router-to-a-synology-nas-via-sftp/#respond</comments>
		
		<dc:creator><![CDATA[Walter Stovall]]></dc:creator>
		<pubDate>Mon, 13 Nov 2023 13:26:03 +0000</pubDate>
				<category><![CDATA[tech]]></category>
		<guid isPermaLink="false">https://walterstovall.online/?p=30025</guid>

					<description><![CDATA[<p>I recently setup an opnsense router to handle network traffic for my home lab. There&#8217;s a lot of configuration done at opnsense in terms of interfaces, IP reservations, unbound DNS, firewall settings, VPN, security certificates, and more. Aside from some manual backup options, how can all this configuration be preserved if the hardware fails? Well, ... <a title="Automatically backup your opnsense router to a Synology NAS via SFTP" class="read-more" href="https://walterstovall.online/2023/11/13/automatically-backup-your-opnsense-router-to-a-synology-nas-via-sftp/" aria-label="Read more about Automatically backup your opnsense router to a Synology NAS via SFTP">Read more</a></p>
<p>The post <a href="https://walterstovall.online/2023/11/13/automatically-backup-your-opnsense-router-to-a-synology-nas-via-sftp/">Automatically backup your opnsense router to a Synology NAS via SFTP</a> appeared first on <a href="https://walterstovall.online">Walter&#039;s Little World</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p class="wp-block-paragraph">I recently setup an <a href="https://opnsense.org/">opnsense router</a> to handle network traffic for my home lab. There&#8217;s a lot of configuration done at opnsense in terms of interfaces, IP reservations, unbound DNS, firewall settings, VPN, security certificates, and more. Aside from some manual backup options, how can all this configuration be preserved if the hardware fails? Well, opnsense has a <a href="https://docs.opnsense.org/manual/settingsmenu.html#cron">cron-job</a> facility that lets you schedule backups and other activity. This just doesn&#8217;t work for me &#8211; there&#8217;s an option there to create a Remote Backup job that will backup the opnsense settings to a <a href="https://en.wikipedia.org/wiki/GitHub">github server</a> and that&#8217;s it.</p>



<p class="wp-block-paragraph">I&#8217;m not running a github server in my lab, and I&#8217;d rather not store this on the <a href="https://github.com/">public github server</a> even if my account is supposedly secure (anything can be compromised). The configuration is very sensitive, including security certificates, user accounts and passwords, firewall rules and more. I&#8217;d prefer to backup the configuration to my <a href="https://www.synology.com/en-us">Synology NAS</a> via <a href="https://en.wikipedia.org/wiki/SSH_File_Transfer_Protocol">SFTP</a>. But the opnsense <em>Command</em> prompt offers no such selection. Github is it!</p>



<p class="wp-block-paragraph">Stuck right? <mark style="background-color:var(--accent)" class="has-inline-color has-base-3-color">No!</mark> While it looks like I&#8217;m captive to what&#8217;s available in the gui, I figured out how to pull this off after a good bit of hunting and educating myself on some internals of opnsense and the <a href="https://en.wikipedia.org/wiki/FreeBSD">FreeBSD</a> OS it runs on top of. One avenue (that is in fact a dead-end) is to make a SSH connection with the opnsense router and setup a cron job using the command line <em>crontab -e</em>. This will appear successful at first, <span style="text-decoration: underline;">but if you modify ANY cron job settings in the opnsense gui, your cron job will be removed!</span></p>



<p class="wp-block-paragraph">There&#8217;s actually a way to pretty easily extend the picklist of Commands you see in the opnsense GUI to include a custom job that does exactly what I want. This post describes the steps to do that.</p>



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



<p class="wp-block-paragraph">The steps I show below will first configure the Synology to accept SFTP connections for the purpose of sending it XML configuration backups from opnsense. We&#8217;ll setup a new user on the NAS called <em>opnsense_backup</em>. This user has limited privileges, allowing it only read/write access to a new folder where the backups will be stored. For security, the SFTP login that opnsense executes will authenticate thru <a href="https://www.ssh.com/academy/ssh-keys">SSH keys</a> (password prompts would not work, there&#8217;s nobody to type it in). The backup is done by a script that you can install on opnsense and register as a new cron-job type that the opnsense gui recognizes. Finally, <a href="https://docs.opnsense.org/manual/settingsmenu.html#cron">in the opnsense gui we&#8217;ll setup the cron job</a> to execute the backup with the desired frequency.</p>



<h2 class="wp-block-heading">Skills you need</h2>



<p class="wp-block-paragraph">To execute the steps in this post you need be just basically familiar with the <a href="https://www.synology.com/en-us/dsm">DSM</a> gui at the NAS, and also the <a href="https://docs.opnsense.org/">opnsense gui</a> for the router. You need to be able to make a <a href="https://en.wikipedia.org/wiki/Secure_Shell">SSH</a> connection to the NAS with admin privileges, and also a SSH connection to the opnsense router with root access. You need just a basic understanding of <a href="https://www.howtogeek.com/102468/a-beginners-guide-to-editing-text-files-with-vi/">using vi</a> (no editing of files, just create new ones).</p>



<h2 class="wp-block-heading">Create NAS backup destination and user account</h2>



<p class="wp-block-paragraph">In DSM at the NAS, go to <em>Control Panel -&gt; Shared Folder</em> and create a new shared folder called opnsense_backup. This folder will collect the XML backup files from opnsense. As shown later, the files are all time-stamped with unique names that identify the date/time of the backup, and we&#8217;ll setup file-rotation so backups older than 30 days get deleted. Remember to add this new share to your <a href="https://kb.synology.com/en-global/DSM/tutorial/Quick_Start_Hyper_Backup">HyperBackup</a>/other backup software to further protect these files.</p>



<p class="wp-block-paragraph">At <em>Control Panel -> File Services -> FTP</em> make sure the SFTP service is enabled. At <em>Control Panel -> Users and Groups</em> <a href="https://kb.synology.com/en-us/DSM/tutorial/user_enable_home_service">make sure user homes are enabled</a>, then create a new opnsense_backup user account. Give the user a strong password. For privileges, give this account access to its own home folder, the opnsense_backup share created above, and the SFTP application itself. This will all &#8220;limit the damage&#8221; should this login ever be compromised.</p>



<figure class="wp-block-image size-full"><img fetchpriority="high" decoding="async" width="847" height="430" src="https://walterstovall.online/wp-content/uploads/2023/11/image-1.png?x52476" alt="" class="wp-image-30033" srcset="https://walterstovall.online/wp-content/uploads/2023/11/image-1.png 847w, https://walterstovall.online/wp-content/uploads/2023/11/image-1-300x152.png 300w, https://walterstovall.online/wp-content/uploads/2023/11/image-1-768x390.png 768w" sizes="(max-width: 847px) 100vw, 847px" /></figure>



<p class="wp-block-paragraph">At a SSH prompt on the NAS, execute the following commands to create a destination for SSH keys.</p>



<pre class="wp-block-code"><code># Create location to store opnsense_backup user's keys
mkdir /var/services/homes/opnsense_backup/.ssh
touch /var/services/homes/opnsense_backup/.ssh/authorized_keys</code></pre>



<h2 class="wp-block-heading">Configure opnsense to make secure SFTP connections</h2>



<p class="wp-block-paragraph">At a SSH prompt on opnsense, generate a new SSH key using the keygen command.</p>



<pre class="wp-block-code"><code># Generate a key
ssh-keygen
# accept default filename /root/.ssh/id_rsa at prompt, supply no passphrase</code></pre>



<p class="wp-block-paragraph">When keygen runs it will prompt you for a filename to store the key in. I accepted the default of <em>/root/.ssh/id_rsa</em>. Take note of the name and use it below if yours is different. You&#8217;ll also be prompted to enter a passphrase. Do <strong>NOT</strong> do that &#8211; just press enter. Passphrases are generally a good idea, but not in this case where the job is automated, with nobody to anwer a passphrase-prompt.</p>



<p class="wp-block-paragraph">Now enter the following command to copy the generated key to the NAS. You&#8217;ll be prompted for a password &#8211; supply the password created on the NAS for the opnsense_backup user. Note my use of port 22 below &#8211; if your SFTP is configured with a different port then use that. Replace <em>&lt;your-NAS-hostname&gt;</em> with the hostname or IP address of your NAS.</p>



<pre class="wp-block-code"><code># Copy key to NAS
scp -P 22 /root/.ssh/id_rsa.pub opnsense_backup@<mark style="background-color:var(--accent)" class="has-inline-color has-base-3-color">&lt;your-NAS-hostname&gt;</mark>:/home/</code></pre>



<p class="wp-block-paragraph">When that command completes, you should find the id_rsa.pub file in the opnsense_backup user&#8217;s home folder on the NAS.</p>



<h2 class="wp-block-heading">Register SSH key at the NAS</h2>



<p class="wp-block-paragraph">We&#8217;ve stored the id_rsa.pub on the NAS above, now it needs to be properly registered as a SSH key for this user on the NAS.</p>



<p class="wp-block-paragraph">In a SSH session on the NAS, login as admin and execute the following commands to append the new key to the <em>authorized_keys</em> file we created earlier. Also, it&#8217;s critically important to set the file permissions and ownership (chmod/chown below). <strong>SFTP will NOT accept the connection if you don&#8217;t do this!</strong></p>



<pre class="wp-block-code"><code># Save the key into authorized_keys file then remove and set permissions
cat /volume1/homes/opnsense_backup/id_rsa.pub &gt;&gt; /volume1/homes/opnsense_backup/.ssh/authorized_keys
rm /volume1/homes/opnsense_backup/id_rsa.pub
chmod 700 /volume1/homes/opnsense_backup/.ssh
chmod 600 /volume1/homes/opnsense_backup/.ssh/authorized_keys
chown -R opnsense_backup:users /volume1/homes/opnsense_backup/.ssh</code></pre>



<p class="wp-block-paragraph"><em>Note that similar steps are shown in the Synology <a href="https://kb.synology.com/en-uk/DSM/tutorial/How_to_log_in_to_DSM_with_key_pairs_as_admin_or_root_permission_via_SSH_on_computers">knowledge-base article for managing SSH keys</a> where you just use File Station and no SSH work like I have above. The problem is <span style="text-decoration: underline;">the documented steps only work for SFTP logins by a admin user!</span> Do what I show above for preparing .ssh and authorized_keys, and it will work for <strong>any</strong> user.</em></p>



<h2 class="wp-block-heading">Test doing the backup</h2>



<p class="wp-block-paragraph">At a SSH prompt in opnsense, store the following script into a backup_opnsense.sh file. The location of the script is not important yet &#8211; just put it in your user home.</p>



<pre class="wp-block-code"><code>#!/bin/sh
DATE=$(date +%Y-%m-%d-%H%M)
BACKUP_FILE="/root/config-backup-$DATE.xml"
cp /conf/config.xml $BACKUP_FILE
scp $BACKUP_FILE opnsense_backup@stovallhut.online:/opnsense_backup/
rm $BACKUP_FILE</code></pre>



<p class="wp-block-paragraph">Remember to make the script executable:</p>



<pre class="wp-block-code"><code>chmod +x backup_opnsense.sh</code></pre>



<p class="wp-block-paragraph">Execute the script as a test.</p>



<pre class="wp-block-code"><code>./backup_opnsense.sh</code></pre>



<p class="wp-block-paragraph">On this first run you&#8217;ll probably see a warning about the unknown ssh signature &#8211; press enter to ignore the warning and accept the SSH connection. This won&#8217;t show when you run the script again in the future.</p>



<p class="wp-block-paragraph">You should <strong>NOT</strong> be prompted for a password. If you are, then something is not right with the above steps when it comes to properly registering the key on the NAS. Review and debug before moving forward.</p>



<p class="wp-block-paragraph">If all went well, you&#8217;ll find a new XML backup in the opnsense_backup share on your NAS!</p>



<h2 class="wp-block-heading">Add new cron job type recognized by the opnsense gui</h2>



<p class="wp-block-paragraph">We have a script that can backup the configuration now, but it does not run automatically on a schedule. Let&#8217;s fix that. We&#8217;ll use the above script as the basis for a new type of cron command we can schedule in the opnsense gui.</p>



<p class="wp-block-paragraph">At a SSH connection as root on opnsense, execute the steps below. This will relocate the script in the FreeBSD file system to the /usr/local/etc folder so it&#8217;s part of the opnsense environment. File permissions are set as required. Then we&#8217;ll create an actions_sftp_backup.conf file to register our script as a cron job.</p>



<pre class="wp-block-code"><code># Move script...
mv backup_opnsense.sh /usr/local/etc/backup_opnsense.sh
# Set file permissions
chmod 700 /usr/local/etc/backup_opnsense.sh
# Add as opnsense action
vi /usr/local/opnsense/service/conf/actions.d/actions_sftp_backup.conf</code></pre>



<p class="wp-block-paragraph">Paste the following content into the actions_sftp_backup.conf at the <em>vi</em> prompt.</p>



<pre class="wp-block-code"><code>&#91;sftp_backup]
command:/usr/local/etc/backup_opnsense.sh
parameters:
type:script
message:Starting backup script
description:Backup config to NAS
</code></pre>



<p class="wp-block-paragraph">Finally, restart the configd service so the new cron job will be recognized in the gui.</p>



<pre class="wp-block-code"><code># Restart configd service to expose new config
service configd restart
</code></pre>



<h2 class="wp-block-heading">Create cron job to periodically backup opnsense configuration</h2>



<p class="wp-block-paragraph">At this point we&#8217;re nearly done. In the opnsense web console, go to <em>System -&gt; Settings -&gt; Cron</em> and press the plus (+) button to add a new job.</p>



<p class="wp-block-paragraph">Fill in the time to run the job. In my example I&#8217;m executing the script at 11:28 every night.</p>



<figure class="wp-block-image size-full"><img decoding="async" width="570" height="410" src="https://walterstovall.online/wp-content/uploads/2023/11/image-2.png?x52476" alt="" class="wp-image-30034" srcset="https://walterstovall.online/wp-content/uploads/2023/11/image-2.png 570w, https://walterstovall.online/wp-content/uploads/2023/11/image-2-300x216.png 300w" sizes="(max-width: 570px) 100vw, 570px" /></figure>



<p class="wp-block-paragraph">On the above <em>Command</em> picklist, you should see a new <em>Backup config to NAS</em> you can pick. Choose that and it will execute the SFTP backup script we prepared above.</p>



<p class="wp-block-paragraph">To test the cron job, see in the gui how you can clone your job &#8211; this is an easy way to create a job that will run in about one minute so you can make sure this works. Let that happen, confirm you get a new backup in the opnsense_backup network share on the NAS. Then just delete your clone when you&#8217;ve seen it work.</p>



<h2 class="wp-block-heading">Trim the backups so only the last 30 days are saved</h2>



<p class="wp-block-paragraph">With backups happening every day, the opnsense_backup share on the NAS will consume more and more space over time. See steps below that will fix that by running a script on the NAS each day that deletes backups that are older than 30 days.</p>



<p class="wp-block-paragraph">On the NAS go to <em>Control Panel -&gt; Task Scheduler</em>. Create a new task based on a user-defined script. Select to execute the job as root. On the schedule tab, set the frequency you want to run the task such as daily. On the task tab, paste the following content:</p>



<pre class="wp-block-code"><code>#!/bin/sh
# Path to the backup directory
BACKUP_DIR="/volume1/opnsense_backup"

# Delete files older than 30 days
find $BACKUP_DIR -name "*.xml" -mtime +30 -exec rm {} \;
</code></pre>



<p class="wp-block-paragraph">We&#8217;re done! Like anything, test this for proper behavior. You should see backups getting saved every day into the new opnsense_backup share on the NAS. Make a point to come back later and make sure old ones are getting deleted as expected.</p>
<p>The post <a href="https://walterstovall.online/2023/11/13/automatically-backup-your-opnsense-router-to-a-synology-nas-via-sftp/">Automatically backup your opnsense router to a Synology NAS via SFTP</a> appeared first on <a href="https://walterstovall.online">Walter&#039;s Little World</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://walterstovall.online/2023/11/13/automatically-backup-your-opnsense-router-to-a-synology-nas-via-sftp/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>My early days grokking the wonder of microprocessors</title>
		<link>https://walterstovall.online/2023/10/12/my-early-days-grocking-the-wonder-of-microprocessors/</link>
					<comments>https://walterstovall.online/2023/10/12/my-early-days-grocking-the-wonder-of-microprocessors/#respond</comments>
		
		<dc:creator><![CDATA[Walter Stovall]]></dc:creator>
		<pubDate>Thu, 12 Oct 2023 14:28:28 +0000</pubDate>
				<category><![CDATA[personal]]></category>
		<category><![CDATA[tech]]></category>
		<guid isPermaLink="false">https://walterstovall.online/?p=29269</guid>

					<description><![CDATA[<p>I started programming computers in 1977 and was quickly addicted. It was simply amazing to me, the power that was available literally at my fingertips. I was limited only by my understanding. Making the computer do what I specifically wanted it to (at first even the most trivial things), took long days and nights as ... <a title="My early days grokking the wonder of microprocessors" class="read-more" href="https://walterstovall.online/2023/10/12/my-early-days-grocking-the-wonder-of-microprocessors/" aria-label="Read more about My early days grokking the wonder of microprocessors">Read more</a></p>
<p>The post <a href="https://walterstovall.online/2023/10/12/my-early-days-grocking-the-wonder-of-microprocessors/">My early days grokking the wonder of microprocessors</a> appeared first on <a href="https://walterstovall.online">Walter&#039;s Little World</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p class="wp-block-paragraph">I started programming computers in 1977 and was quickly addicted. It was simply amazing to me, the power that was available literally at my fingertips. I was limited only by my understanding. Making the computer do what I specifically wanted it to (at first even the most trivial things), took long days and nights as I struggled with all the new abstractions. I didn&#8217;t even know what was meant by a &#8220;variable&#8221;. I&#8217;m not joking either. I&#8217;m not talking about syntax, I&#8217;m talking about basic concepts. Defining one, giving it a value, inspecting its value, and especially using it to control the flow of a program were all brand new to me. I could stare at just one page of the little book that came with my <a href="https://en.wikipedia.org/wiki/TRS-80">TRS-80</a> for hours &#8211; and then do it again the next day. Once you&#8217;ve learned a programming language, they start falling like dominos. The first one was really hard though. It took me months to move beyond <a href="https://en.wikipedia.org/wiki/BASIC">BASIC</a>. But trying to write video games on a computer with 4K of RAM was motivation to do so!</p>



<p class="wp-block-paragraph">In the early &#8217;80s after a few years of obsessing at home writing video games and the like, I managed to get a job at <a href="https://en.wikipedia.org/wiki/Scientific_Atlanta">Scientific Atlanta</a> (2nd job) through a lab-tech friend of mine that I had been interacting with, learning more about digital electronics. At the time, Scientific Atlanta (and most of the world) was early in the process of using <a href="https://en.wikipedia.org/wiki/Microprocessor">microprocessor</a>s in the devices they manufactured. I was tasked with writing the <a href="https://en.wikipedia.org/wiki/Firmware">firmware</a> for a new antenna position tracking device. Like the name implies, this was a seemingly simple device with a digital display that showed the angle of rotation for a microwave antenna. Position indicators were used primarily during construction of new microwave antennas, where prototypes would receive signals while being positioned at virtually all possible <a href="https://en.wikipedia.org/wiki/Spherical_coordinate_system">azimuth and elevation</a> angles, while recording equipment would store <a href="https://en.wikipedia.org/wiki/Amplitude_modulation">amplitude modulation</a> data that was also correlated with the position in an <a href="https://en.wikipedia.org/wiki/Antenna_measurement">antenna test range</a><em>.</em></p>



<p class="wp-block-paragraph">The work was led primarily by Bob Hyers who was the <a href="https://www.indeed.com/career-advice/finding-a-job/principal-engineer-vs-senior-engineer">principal engineer</a>. Beyond Bob&#8217;s detailed work on the high level design, the real work was done by two engineers Steve and Charles. We quickly became good friends, and they taught me how to work with the prototypes they were building in the lab, as we worked on getting things working a little more every day. Steve and Charles were responsible for defining exactly what components to put in the unit, and they laid out circuit boards and all interconnections. Then came me &#8211; the unit was not going to do anything at all in the way of indicating or transmitting antenna positions without somebody to write the necessary software. I learned from the ground-up how to debug code in a lab environment with no user interface, just an oscilloscope and some pretty amazing debugging tools (<a href="https://en.wikipedia.org/wiki/Logic_analyzer">logic analyzer</a>) that were more powerful than anything I used before or since on traditional computers. My software handled every button press, changing display modes, actually calculating the position of the antenna as a decimal angle of degrees, and displaying the position or transmitting it to other test-range equipment in a timely manner.</p>



<p class="wp-block-paragraph">It was on the last point of having <em>timely</em> position that was at the heart of most of the complexity in the design. Scientific Atlanta already had a position indictor at the time and used it heavily. The positions it indicated were perfectly accurate too. The problem was that the position was not calculated frequently enough. Since the antenna in the test range is moving, by the time you get position data it&#8217;s already out of date due to <a href="https://en.wikipedia.org/wiki/Group_delay_and_phase_delay">group delay</a>. So to make a good graph of position vs. amplitude modulation, the antenna had to be moved very very slowly as thousands of data points were recorded. This took a long time to do. Then the antenna might undergo some changes to make improvements, and the whole process had to be repeated. The problem was further complicated when the signals being transmitted were distant from the antenna receiving the data. The new position indicator would radically improve on these problems.</p>



<p class="wp-block-paragraph">None of the engineers knew a thing about writing computer code. So in that sense I had a blank slate. But the algorithm was still well conceived before I came onboard. The goal was to generate accurate position data every 200 nanoseconds (ns). When I first heard this, it sounded like an impossible problem for a microprocessor of the day. The hardware design was based around an Intel CPU with a hardware clock ticking at 5 MHZ, which happens to be every 200 ns. But it was in fact impossible for the processor to calculate <em>anything</em> in just one tick of the clock! Even a single <a href="https://en.wikipedia.org/wiki/Microcode">microcode</a> instruction can&#8217;t execute in a single tick. But learning more, I discovered that the design was not as crazy as it sounded. It was also an opportunity for me to let my programming abilities expand a lot given the nontrivial behavior that would be called for to pull it off.</p>



<p class="wp-block-paragraph">The hardware of the <em>1885/86 Antenna Position Indicator</em> as this model was known, included a &#8220;rate counter&#8221;. This was a device that could indicate a changing angle, and steadily increment that value by perhaps a few thousands of a degree every 200 ns. &#8211; all with literally no action taken by the microprocessor. As intelligent as the rate counter was (including wrapping a 359.9999 position to 0.0000 at the next increment), the rate counter did not <em>know</em> what angle to display and did not know what increment to apply to it at the next clock tick. Telling the rate counter what to do was the job of the firmware I was to write. But in order to save manufacturing costs, my ability to control the rate counter was very limited. I could in fact not even tell the counter what angle to display! All my software could do was to change the increment that the rate counter would apply at each clock tick. Essentially, I could find out what position the counter was indicating &#8220;now&#8221; (more on that later). And I knew what increment it was currently applying at each tick (by remembering what I last told it to use). And finally, I knew the current position of the antenna. So I have these three inputs: <em>the angle being displayed, the actual angle of the antenna, and the increment being used currently</em>. It was up to my software to now generate one little piece of information &#8211; what should be the new increment the rate counter was using? That was my single means of controlling the position output. So it was up to me to see that the indicated position would reasonably quickly converge on an accurate indication of antenna angle.</p>



<p class="wp-block-paragraph">While the hardware seemingly tied my hands behind my back, this was my favorite kind of thing to code. I want nothing more than a seemingly impossible problem that in fact has a solution. Don&#8217;t get me wrong though, the problem had been figured out already, including very detailed mathematics that my software should apply in the solution. But as always, there&#8217;s a million miles between a concept and a working device. A successful project takes competent engineers building the device and for a reasonable cost that turns a profit for the manufacturer.</p>



<p class="wp-block-paragraph">The firmware I designed to do this was organized around a core software routine that was <a href="https://en.wikipedia.org/wiki/Interrupt">interrupt driven</a>. Every 16 milliseconds (ms) the hardware would raise the interrupt-line on the CPU. Doing so would cause the CPU to execute an INT instruction. This meant the CPU would save its current instruction address (i.e. the address of the next instruction it plans to execute) on the <a href="https://en.wikipedia.org/wiki/Call_stack">system stack</a>. Then it would immediately jump to the address of the interrupt handler (pointed to by a table in the first page of RAM). There, was a tight little piece of code I wrote in <a href="https://en.wikipedia.org/wiki/Assembly_language">assembly language</a> (but most of the code was written in <a href="https://en.wikipedia.org/wiki/C_(programming_language)">C-language</a>). The function of the interrupt handler was to schedule the most high priority task defined in my self-designed SAMOS (Scientific Atlanta <a href="https://en.wikipedia.org/wiki/Computer_multitasking">Multitasking Operating System</a>). There were various tasks for the software to regularly perform, including updating the display, responding to button presses by the operator, transmitting position output to the front panel or other devices on the serial I/O bus, and miscellaneous maintenance and diagnostics tasks.</p>



<p class="wp-block-paragraph">As its last step the interrupt handler transferred control to the SAMOS scheduler to execute the current highest-priority task and that happened to pretty much always be updating the position. To calculate the angle, the code would read a couple values from the <a href="https://en.wikipedia.org/wiki/Synchro">synchro</a> that was attached to the base of the antenna. These values were not in constant motion, like the antenna itself. Instead they were <a href="https://www.geeksforgeeks.org/latches-in-digital-logic/#">latched</a> at the time of the interrupt immediately beforehand. By applying some trigonometry to ratios from the synchro, it was possible to generate a digital angle in degrees. Like many things though, even that was a lot harder than it sounds given the <a href="https://en.wikipedia.org/wiki/Real-time_computing">real-time</a> requirements of the device. The trigonometry calculations could naturally be done with <a href="https://en.wikipedia.org/wiki/Floating-point_arithmetic">floating point math</a>. But to do that would mean using a floating point library, given the limits of the instruction set on the <a href="https://en.wikipedia.org/wiki/Intel_8088">8088</a> processor. That would have been way too slow. If, in the execution of this task, the software takes too long to calculate the angle and the new rate and along comes another interrupt signal then <strong>you&#8217;ve failed!</strong> That&#8217;s an overspeed-condition. It&#8217;s absolutely essential to prevent that. Downrange measurements will be wrong to a degree that&#8217;s supposed to be impossible.</p>



<p class="wp-block-paragraph">Various techniques were used to multiply or divide without using floating point arthmetic. In some cases the code just looked up a number in say a 1KB table stored in <a href="https://en.wikipedia.org/wiki/Read-only_memory">ROM</a> (truncating index bits as necessary, but also often using them to skew the looked-up table entry). Another simple example would be to use the processor&#8217;s <em>shift</em>-left instruction to shift a variable by a small number of bits (where each shift is a multiply-by-2), then multiply or divide integer variables (usually by a pre-calculated constant that&#8217;s also been shifted). That generates an integer result, then finally use the <em>shift-</em>right (divide by 2) to get the result back in the intended scale. It takes a lot of care with the scale of the numbers to avoid <a href="https://www.welivesecurity.com/2022/02/21/integer-overflow-how-it-occur-can-be-prevented/">overflow</a> conditions, while still achieving accuracy requirements.</p>



<p class="wp-block-paragraph">As always, <em>latching</em> was key to synchronizing the calculations done in the firmware with the time of the moving antenna. Input latching means that the software is always calculating using numbers that are now obsolete given the moving antenna, but were known to be accurate at a specific moment in the recent <em>past</em>. Output latching means the software calculates updated rate values the equipment should now apply, but the change is only applied at a well defined moment in the near <em>future</em>. All this makes it possible to make precise measurements and control, in spite of the variable response times in the software.</p>



<p class="wp-block-paragraph">As a point of real pride, I was named on the United States Patent 4,853,839 for <em>Antenna Position Tracking Apparatus and Methods</em>. The basis for calling this a new invention, is that for the first time this results in a position indicator with <span style="text-decoration: underline;">zero group delay</span> for an antenna moving at a constant velocity. It does that essentially by predicting where the antenna <span style="text-decoration: underline;">will be in the near future</span>, rather than always showing obsolete position data. I&#8217;m named as one of four inventors &#8211; Steven Nichols, Robert Hyers, Walter Stovall, and Charles Trawick. Good times I&#8217;ll always remember fondly.</p>


<div class="_3d-flip-book  fb3d-fullscreen-mode full-size" data-id="29275" data-mode="fullscreen" data-title="false" data-template="short-white-book-view" data-lightbox="dark-shadow" data-urlparam="fb3d-page" data-page-n="0" data-pdf="" data-tax="null" data-thumbnail="" data-cols="3" data-book-template="default" data-trigger=""></div><script type="text/javascript">window.FB3D_CLIENT_DATA = window.FB3D_CLIENT_DATA || [];FB3D_CLIENT_DATA.push('eyJwb3N0cyI6eyIyOTI3NSI6eyJJRCI6MjkyNzUsInRpdGxlIjoiVS5TLiBQYXRlbnQgLSBBbnRlbm5hIFBvc2l0aW9uIFRyYWNraW5nIEFwcGFyYXR1cyBhbmQgTWV0aG9kcyIsInR5cGUiOiJwZGYiLCJyZWFkeV9mdW5jdGlvbiI6IiIsImJvb2tfc3R5bGUiOiJmbGF0IiwiYm9va190ZW1wbGF0ZSI6Im5vbmUiLCJvdXRsaW5lIjpbXSwiZGF0YSI6eyJwb3N0X0lEIjoiMjkyNzYiLCJndWlkIjoiaHR0cHM6XC9cL3dhbHRlcnN0b3ZhbGwub25saW5lXC93cC1jb250ZW50XC91cGxvYWRzXC8yMDIzXC8xMFwvVS5TLi1QYXRlbnQtNDg1MzgzOS5wZGYiLCJwZGZfcGFnZXMiOiIzNyIsInBhZ2VzX2N1c3RvbWl6YXRpb24iOiJub25lIn0sInRodW1ibmFpbCI6eyJkYXRhIjp7InBvc3RfSUQiOiIwIn0sInR5cGUiOiJhdXRvIn0sInByb3BzIjp7ImJhY2tncm91bmRDb2xvciI6ImF1dG8iLCJiYWNrZ3JvdW5kSW1hZ2UiOiJhdXRvIiwiYmFja2dyb3VuZFN0eWxlIjoiYXV0byIsImhpZ2hsaWdodExpbmtzIjoiYXV0byIsImxpZ2h0aW5nIjoiYXV0byIsImNhY2hlZFBhZ2VzIjoiYXV0byIsInJlbmRlckluYWN0aXZlUGFnZXMiOiJhdXRvIiwicmVuZGVySW5hY3RpdmVQYWdlc09uTW9iaWxlIjoiYXV0byIsInJlbmRlcldoaWxlRmxpcHBpbmciOiJhdXRvIiwicHJlbG9hZFBhZ2VzIjoiYXV0byIsImF1dG9QbGF5RHVyYXRpb24iOiJhdXRvIiwicnRsIjoiYXV0byIsImludGVyYWN0aXZlQ29ybmVycyI6ImF1dG8iLCJtYXhEZXB0aCI6ImF1dG8iLCJzaGVldCI6eyJzdGFydFZlbG9jaXR5IjoiYXV0byIsIndhdmUiOiJhdXRvIiwic2hhcGUiOiJhdXRvIiwid2lkdGhUZXhlbHMiOiJhdXRvIiwiY29sb3IiOiJhdXRvIiwic2lkZSI6ImF1dG8iLCJjb3JuZXJEZXZpYXRpb24iOiJhdXRvIiwiZmxleGliaWxpdHkiOiJhdXRvIiwiZmxleGlibGVDb3JuZXIiOiJhdXRvIiwiYmVuZGluZyI6ImF1dG8iLCJoZWlnaHRUZXhlbHMiOiJhdXRvIn0sImNvdmVyIjp7IndhdmUiOiJhdXRvIiwiY29sb3IiOiJhdXRvIiwic2lkZSI6ImF1dG8iLCJiaW5kZXJUZXh0dXJlIjoiYXV0byIsImRlcHRoIjoiYXV0byIsInBhZGRpbmciOiJhdXRvIiwic3RhcnRWZWxvY2l0eSI6ImF1dG8iLCJmbGV4aWJpbGl0eSI6ImF1dG8iLCJmbGV4aWJsZUNvcm5lciI6ImF1dG8iLCJiZW5kaW5nIjoiYXV0byIsIndpZHRoVGV4ZWxzIjoiYXV0byIsImhlaWdodFRleGVscyI6ImF1dG8iLCJtYXNzIjoiYXV0byIsInNoYXBlIjoiYXV0byJ9LCJwYWdlIjp7IndhdmUiOiJhdXRvIiwiY29sb3IiOiJhdXRvIiwic2lkZSI6ImF1dG8iLCJkZXB0aCI6ImF1dG8iLCJzdGFydFZlbG9jaXR5IjoiYXV0byIsImZsZXhpYmlsaXR5IjoiYXV0byIsImZsZXhpYmxlQ29ybmVyIjoiYXV0byIsImJlbmRpbmciOiJhdXRvIiwid2lkdGhUZXhlbHMiOiJhdXRvIiwiaGVpZ2h0VGV4ZWxzIjoiYXV0byIsIm1hc3MiOiJhdXRvIiwic2hhcGUiOiJhdXRvIn0sImhlaWdodCI6ImF1dG8iLCJ3aWR0aCI6ImF1dG8iLCJncmF2aXR5IjoiYXV0byIsInBhZ2VzRm9yUHJlZGljdGluZyI6ImF1dG8ifSwiY29udHJvbFByb3BzIjp7ImFjdGlvbnMiOnsiY21kVG9jIjp7ImVuYWJsZWQiOiJhdXRvIiwiZW5hYmxlZEluTmFycm93IjoiYXV0byIsImFjdGl2ZSI6ImF1dG8iLCJkZWZhdWx0VGFiIjoiYXV0byJ9LCJjbWRBdXRvUGxheSI6eyJlbmFibGVkIjoiYXV0byIsImVuYWJsZWRJbk5hcnJvdyI6ImF1dG8iLCJhY3RpdmUiOiJhdXRvIn0sImNtZFNhdmUiOnsiZW5hYmxlZCI6ImF1dG8iLCJlbmFibGVkSW5OYXJyb3ciOiJhdXRvIn0sImNtZFByaW50Ijp7ImVuYWJsZWQiOiJhdXRvIiwiZW5hYmxlZEluTmFycm93IjoiYXV0byJ9LCJjbWRTaW5nbGVQYWdlIjp7ImVuYWJsZWQiOiJhdXRvIiwiZW5hYmxlZEluTmFycm93IjoiYXV0byIsImFjdGl2ZSI6ImF1dG8iLCJhY3RpdmVGb3JNb2JpbGUiOiJhdXRvIn0sIndpZFRvb2xiYXIiOnsiZW5hYmxlZCI6ImF1dG8iLCJlbmFibGVkSW5OYXJyb3ciOiJhdXRvIn19fSwiYXV0b1RodW1ibmFpbCI6Imh0dHBzOlwvXC93YWx0ZXJzdG92YWxsLm9ubGluZVwvd3AtY29udGVudFwvdXBsb2Fkc1wvM2QtZmxpcC1ib29rXC9hdXRvLXRodW1ibmFpbHNcLzI5Mjc1LnBuZyIsInBvc3RfbmFtZSI6InUtcy1wYXRlbnQtYW50ZW5uYS1wb3NpdGlvbi10cmFja2luZy1hcHBhcmF0dXMtYW5kLW1ldGhvZHMiLCJwb3N0X3R5cGUiOiIzZC1mbGlwLWJvb2sifX0sInBhZ2VzIjpbXSwiZmlyc3RQYWdlcyI6W119');window.FB3D_CLIENT_LOCALE && FB3D_CLIENT_LOCALE.render && FB3D_CLIENT_LOCALE.render();</script>



<p class="wp-block-paragraph"><em>(use the tool-bar for full-screen and zoom/turn pages, how it all works is on pages 20 &amp; 21)</em></p>
<p>The post <a href="https://walterstovall.online/2023/10/12/my-early-days-grocking-the-wonder-of-microprocessors/">My early days grokking the wonder of microprocessors</a> appeared first on <a href="https://walterstovall.online">Walter&#039;s Little World</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://walterstovall.online/2023/10/12/my-early-days-grocking-the-wonder-of-microprocessors/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>SpaceX is churning out a Raptor per day now</title>
		<link>https://walterstovall.online/2022/11/03/spacex-is-churning-out-a-raptor-per-day-now/</link>
					<comments>https://walterstovall.online/2022/11/03/spacex-is-churning-out-a-raptor-per-day-now/#respond</comments>
		
		<dc:creator><![CDATA[Walter Stovall]]></dc:creator>
		<pubDate>Thu, 03 Nov 2022 10:34:43 +0000</pubDate>
				<category><![CDATA[science]]></category>
		<category><![CDATA[tech]]></category>
		<category><![CDATA[space]]></category>
		<guid isPermaLink="false">https://walterstovall.online/?p=20786</guid>

					<description><![CDATA[<p>There&#8217;s more to a rocket than an engine, but a rocket without an engine is not a rocket. SpaceX is passing an important milestone by producing a fully assembled Raptor engine per day. The Raptor is key to building the SharShip rocket that NASA has contracted with SpaceX to build as part of the Artimis ... <a title="SpaceX is churning out a Raptor per day now" class="read-more" href="https://walterstovall.online/2022/11/03/spacex-is-churning-out-a-raptor-per-day-now/" aria-label="Read more about SpaceX is churning out a Raptor per day now">Read more</a></p>
<p>The post <a href="https://walterstovall.online/2022/11/03/spacex-is-churning-out-a-raptor-per-day-now/">SpaceX is churning out a Raptor per day now</a> appeared first on <a href="https://walterstovall.online">Walter&#039;s Little World</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p class="wp-block-paragraph">There&#8217;s more to a rocket than an engine, but a rocket without an engine is not a rocket. SpaceX is passing an important milestone by producing a fully assembled <a href="https://en.wikipedia.org/wiki/SpaceX_Raptor" title="Raptor engine">Raptor engine</a> per day. The Raptor is key to building the <a href="https://en.wikipedia.org/wiki/SpaceX_Starship" title="SharShip rocket">SharShip rocket</a> that <a href="https://www.yahoo.com/news/spacex-nasa-artemis-lunar-lander-contract-report-184448656.html" title="NASA has contracted with SpaceX">NASA has contracted with SpaceX</a> to build as part of the <a href="https://www.nasa.gov/artemisprogram" title="Artimis scope and status - NASA">Artimis program</a> for future Moon and Mars missions.</p>



<p class="wp-block-paragraph">It takes a lot of engines to power the StarShip &#8211; 33 engines in the first stage and then six more in the second stage. Producing an engine per day is a big confidence booster when it comes to the risks associated with using the StarShip as planned. For perspective on what that rate means, compare this to just a few years ago when production of a comparable engine was targeted at <span style="text-decoration: underline;">four per year</span>.</p>



<blockquote class="wp-block-quote is-layout-flow wp-block-quote-is-layout-flow">
<p class="wp-block-paragraph">In 2015,&nbsp;<a href="https://ir.aerojetrocketdyne.com/news-releases/news-release-details/nasa-and-aerojet-rocketdyne-sign-contract-restart-production-rs">NASA gave Aerojet Rocketdyne</a>&nbsp;a contract worth $1.16 billion to &#8220;restart the production line&#8221; for the RS-25 engine. Again, that was money just to reestablish manufacturing facilities, not actually build the engines. NASA is paying more than $100 million for each of those. With this startup funding, the goal was for Aerojet Rocketdyne to produce four of these engines&nbsp;<em>per year</em>.</p>
<cite><a href="https://arstechnica.com/science/2022/11/spacex-is-now-building-a-raptor-engine-a-day-nasa-says/" title="SpaceX is now building a Raptor engine a day, NASA says">arstechnica.com</a></cite></blockquote>



<h2 class="wp-block-heading">Moving ahead with StarShip testing and development</h2>



<p class="wp-block-paragraph">Production capabilities aside, the StarShip is far from proven. There&#8217;s yet to be an orbital launch. Although there have been <a href="https://www.space.com/spacex-starship-six-engine-static-fire-ship-24" title="successful static fire tests of the second stage">successful static fire tests of the second stage</a>, there&#8217;s yet to be a full static fire of all 33 engines in the first stage. When that will happen is guesswork, but any day now. <a href="https://teslanorth.com/2022/09/19/spacex-super-heavy-booster-to-test-33-engine-static-fire-in-few-weeks-says-musk/" title="any day now?">A few weeks ago, it was going to happen in a few weeks</a>.</p>



<p class="wp-block-paragraph">I can&#8217;t wait. Seeing the static fire and orbital launch of StarShip, a rocket big enough to pack cargo to Mars, that will be sweet!</p>



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



<p class="wp-block-paragraph"><mark style="background-color:var(--accent)" class="has-inline-color has-base-3-color">Late breaking news 11/3/2022&#8230;.</mark> SpaceX is pushing for an orbital test <span style="text-decoration: underline;">before the end of 2022</span> and NASA plans are in keeping with that!</p>



<figure class="wp-block-embed is-type-video is-provider-youtube wp-block-embed-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio"><div class="wp-block-embed__wrapper">
<iframe loading="lazy" title="SpaceX&#039;s NEW Orbital flight timeline announced and NEW Starship prototype testing..." width="900" height="506" src="https://www.youtube.com/embed/V4FeSoSxLGk?feature=oembed" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
</div><figcaption class="wp-element-caption">Launches tentatively predicted for this year.</figcaption></figure>
<p>The post <a href="https://walterstovall.online/2022/11/03/spacex-is-churning-out-a-raptor-per-day-now/">SpaceX is churning out a Raptor per day now</a> appeared first on <a href="https://walterstovall.online">Walter&#039;s Little World</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://walterstovall.online/2022/11/03/spacex-is-churning-out-a-raptor-per-day-now/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>The Security and Redundancy of Clustered Virtual Machines</title>
		<link>https://walterstovall.online/2022/11/01/the-security-and-redundancy-of-clustered-virtual-machines/</link>
					<comments>https://walterstovall.online/2022/11/01/the-security-and-redundancy-of-clustered-virtual-machines/#respond</comments>
		
		<dc:creator><![CDATA[Walter Stovall]]></dc:creator>
		<pubDate>Tue, 01 Nov 2022 15:30:47 +0000</pubDate>
				<category><![CDATA[tech]]></category>
		<category><![CDATA[nas]]></category>
		<guid isPermaLink="false">https://walterstovall.online/?p=20693</guid>

					<description><![CDATA[<p>This post explores some techniques I&#8217;ve been using to improve the security of some services on my home network and make it easier to recover them in the event of hardware/other disasters. Below, I&#8217;ll describe how and why I&#8217;m moving more and more services onto virtual machines (VM). This is better for security because you ... <a title="The Security and Redundancy of Clustered Virtual Machines" class="read-more" href="https://walterstovall.online/2022/11/01/the-security-and-redundancy-of-clustered-virtual-machines/" aria-label="Read more about The Security and Redundancy of Clustered Virtual Machines">Read more</a></p>
<p>The post <a href="https://walterstovall.online/2022/11/01/the-security-and-redundancy-of-clustered-virtual-machines/">The Security and Redundancy of Clustered Virtual Machines</a> appeared first on <a href="https://walterstovall.online">Walter&#039;s Little World</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p class="wp-block-paragraph">This post explores some techniques I&#8217;ve been using to improve the security of some services on my home network and make it easier to recover them in the event of hardware/other disasters. Below, I&#8217;ll describe how and why I&#8217;m moving more and more services onto <a href="https://www.vmware.com/topics/glossary/content/virtual-machine.html" target="_blank" rel="noopener" title="">virtual machines</a> (VM). This is better for security because you can pretty much bet that an attacker that exploits vulnerabilities in a VM probably won&#8217;t be able to do more than compromise the VM itself (not the whole host server). And at least with my <a href="https://www.synology.com/en-global" target="_blank" rel="noopener" title="">Synology</a> server, full &#8220;<a href="https://en.wikipedia.org/wiki/Bare-metal_restore" target="_blank" rel="noopener" title="">bare metal</a>&#8221; backups of the VMs are supported, including the ability to cluster servers so as to make <a href="https://en.wikipedia.org/wiki/Switchover" target="_blank" rel="noopener" title="">switchover</a> or <a href="https://en.wikipedia.org/wiki/Failover" target="_blank" rel="noopener" title="">failover</a> possible with just a few minutes of down time. This can make virtual computers a lot more recoverable and relocatable when compared to actual hardware.</p>



<p class="wp-block-paragraph">I&#8217;m going detail below some of how I&#8217;m managing this with a couple VMs I have deployed on a cluster of (two) servers. The details of how I do this on a Synology NAS are pretty specific to that hardware &#8211; the concepts are not.</p>



<p class="wp-block-paragraph">Highlights of this framework include:</p>



<ul class="wp-block-list">
<li>Packaging services in a VM contains the scope of the damage when the &#8220;server&#8221; is compromised.</li>



<li>Clustered hosts make it easy to move VMs to a new host or failover the VM if its host server is down.</li>



<li>Snapshots of VMs can be created instantly as scheduled and then replicated to other hosts in the cluster.</li>



<li>VMs can be exported to an external file system for off-site backup</li>
</ul>



<h2 class="wp-block-heading">How I put the pieces together</h2>



<p class="wp-block-paragraph">So much for the abstract, see below I&#8217;ll show you how I put this architecture together on my home network, clustering two servers that share two virtual machines.</p>



<p class="wp-block-paragraph">The purpose of the virtual machines is not hugely relevant but as you&#8217;ll see in the screenshots here, the two virtual computers I have are <em>hutbuddy_websites</em> and <em>Quicken_WindowsServer</em>. The first is a virtual computer that runs a copy of <a href="https://www.wundertech.net/how-to-setup-a-synology-dsm-virtual-machine-vdsm/" target="_blank" rel="noopener" title="">Virtual DSM</a> and hosts a few websites on my network. Websites can be notoriously vulnerable to attack. While I&#8217;m careful with security at those sites, it&#8217;s good to know that if the whole server went down it would still be only those websites and not my whole network. The second VM is something I use for running Quicken on a virtual Windows machine.</p>



<p class="wp-block-paragraph">Now let&#8217;s start with VMs that exist, but they aren&#8217;t protected like I&#8217;ll outline. On a Synology server and many others, backing up virtual computers can get tricky and some of it gets downright philosophical with certain camps touting that you should <em>just backup the VM from within the VM itself.</em> Yeah that&#8217;s possible but recovering from a disaster requires rebuilding that VM from scratch starting by installing an operating system. It&#8217;s going to take hours with anything complex, and maybe days. I&#8217;m not settling for that because I don&#8217;t have to&#8230;</p>



<h2 class="wp-block-heading">Clustering virtual computers</h2>



<p class="wp-block-paragraph">The redundancy starts by <a href="https://kb.synology.com/en-us/DSM/help/Virtualization/hosts?version=7" target="_blank" rel="noopener" title="">clustering hosts</a> that each share the same virtual machines. Only one host at a time is designated to be the one that runs a given VM. But with a simple action in the Protection Plan it is possible to move the VM to another host, either for better loading or because a host is down. <em>Note that on a Synology clustering requires a Virtual Machine Manager Pro license.</em></p>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="1024" height="595" src="https://walterstovall.online/wp-content/uploads/2022/11/VirtualMachineManagerCluster-1024x595.jpg?x52476" alt="" class="wp-image-20698" srcset="https://walterstovall.online/wp-content/uploads/2022/11/VirtualMachineManagerCluster-1024x595.jpg 1024w, https://walterstovall.online/wp-content/uploads/2022/11/VirtualMachineManagerCluster-300x174.jpg 300w, https://walterstovall.online/wp-content/uploads/2022/11/VirtualMachineManagerCluster-768x446.jpg 768w, https://walterstovall.online/wp-content/uploads/2022/11/VirtualMachineManagerCluster.jpg 1129w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /><figcaption class="wp-element-caption">Synology Virtual Machine Manager</figcaption></figure>



<p class="wp-block-paragraph">The key to redundancy is in the Protection Plan you choose for the VM. By clicking on <em>Protection</em> you get to this console.</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="891" height="438" src="https://walterstovall.online/wp-content/uploads/2022/11/VMM_ProtectionPlan.jpg?x52476" alt="" class="wp-image-20700" srcset="https://walterstovall.online/wp-content/uploads/2022/11/VMM_ProtectionPlan.jpg 891w, https://walterstovall.online/wp-content/uploads/2022/11/VMM_ProtectionPlan-300x147.jpg 300w, https://walterstovall.online/wp-content/uploads/2022/11/VMM_ProtectionPlan-768x378.jpg 768w" sizes="auto, (max-width: 891px) 100vw, 891px" /><figcaption class="wp-element-caption">Protection Plan Console</figcaption></figure>



<p class="wp-block-paragraph">In the <a href="https://kb.synology.com/en-us/DSM/help/Virtualization/data_protection?version=7" target="_blank" rel="noopener" title="">protection plan</a> you&#8217;ll schedule <em>snapshots</em>. A snapshot is a complete copy of the state of the virtual computer. Snapshots can be taken while the VM runs as <a href="https://kb.synology.com/en-us/DSM/tutorial/What_is_file_system_consistent_snapshot" target="_blank" rel="noopener" title="">filesystem-consistent snapshots</a> at a point in time. Then you define a Retention Policy that says exactly when you want to release the space for old snapshots.</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="673" height="426" src="https://walterstovall.online/wp-content/uploads/2022/11/VMMSnapshotRetentionPolicy.jpg?x52476" alt="" class="wp-image-20701" srcset="https://walterstovall.online/wp-content/uploads/2022/11/VMMSnapshotRetentionPolicy.jpg 673w, https://walterstovall.online/wp-content/uploads/2022/11/VMMSnapshotRetentionPolicy-300x190.jpg 300w" sizes="auto, (max-width: 673px) 100vw, 673px" /><figcaption class="wp-element-caption">VMM Retention Policy says when to delete old snapshots</figcaption></figure>



<p class="wp-block-paragraph">In the example policy above, the system retains snapshots for the last week and then keeps one snapshot per week for the last month.</p>



<p class="wp-block-paragraph">Now that sounds like a lot of diskspace. My websites VM takes up about 250GB and I&#8217;m storing 15 or so copies of that?? Not really. <a href="https://walterstovall.online/2021/09/16/a-new-level-of-redundancy-btrfs-and-snapshot-replication-under-the-hood/" title="">Snapshots take advantage of the BTRFS file system</a> and only store deltas. What it does mean is (unless you manually delete snapshots which you can do) if you delete a bunch of stuff it doesn&#8217;t go away immediately. That&#8217;s usually a good thing!</p>



<p class="wp-block-paragraph">The outcome of clustering hosts like this is that if a host goes down, I can failover its VMs to the other host in just a few minutes. And if the VM crashes/other then I can restore from a snapshot made at various times that day, or less frequently for up to a month.</p>



<h2 class="wp-block-heading">What&#8217;s missing?</h2>



<p class="wp-block-paragraph">OK so now we have two host servers that can each separately run the very same virtual machines. Not just sort of the same, but the same all the way down to the full content of the file system, the MAC address, everything. If a server goes down then I can almost instantly boot the VMs it hosted and they&#8217;re completely back in operation.</p>



<p class="wp-block-paragraph">The only remaining problem is <em>what if I lose both servers?</em>?  The two servers are in physical proximity. Theft, fire, or other might mean that both servers go down perhaps permanently. Obviously I won&#8217;t recover from that in just a few minutes, but the real problem is the fact that the servers were replicating snapshots to each other so now <strong>ALL the snapshots are gone!</strong></p>



<p class="wp-block-paragraph">One solution to this problem would be to periodically export the VM to a file. This is NOT a &#8220;snapshot&#8221; with only deltas, it&#8217;s a great big file that&#8217;s the whole state of the VM and everything in its internal file system.</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="640" height="295" src="https://walterstovall.online/wp-content/uploads/2022/11/VMMExport.jpg?x52476" alt="" class="wp-image-20703" srcset="https://walterstovall.online/wp-content/uploads/2022/11/VMMExport.jpg 640w, https://walterstovall.online/wp-content/uploads/2022/11/VMMExport-300x138.jpg 300w" sizes="auto, (max-width: 640px) 100vw, 640px" /><figcaption class="wp-element-caption">Export IF you shutdown the VM first</figcaption></figure>



<p class="wp-block-paragraph">The problems here are two-fold. For one thing, the export of a big VM might take several hours and the whole time it exports, <span style="text-decoration: underline;">you have to have your VM shutdown/offline</span>. The other problem is that this is a manual action! I&#8217;m loath to have manual procedures that I can automate. But can I?</p>



<p class="wp-block-paragraph">At first it seems like we&#8217;re stuck here &#8211; and that&#8217;s indeed where I stayed for months. But ultimately I got some help from a friend at reddit and found <a href="https://www.synology-forum.de/threads/virtual-machine-manager-vms-sichern.91952/page-3#post-944113" target="_blank" rel="noopener" title="">this German website</a> that details a solution that includes using an internal utility we find in DSM (good thing google translates).</p>



<p class="wp-block-paragraph"><em>(I&#8217;m fine with using this even though not publically documented &#8211; be your own judge)</em></p>



<p class="wp-block-paragraph">See my SSH session below (run it with root privilege i.e. <em>sudo -i</em>)</p>



<pre class="wp-block-preformatted">/volume1/@appstore/Virtualization/bin/vmm_backup_ova --help

Usage: /volume1/@appstore/Virtualization/bin/vmm_backup_ova [--dst] [--batch] [--host] [--guests] [--retent] [--retry]
        backup VM to shared folder on VMM

Options:
        --default       use default options to backup
        --dst           shared folder path for storing backup OVA
        --batch         the number of VMs exporting at a time (default: 5)
        --host|--guests mutually exclusive options
                        '--host' only backup VMs which repository is on the specified host (default: all)
                        '--guests' only backup specified VMs (default: not specified, use | for seperator if there are multiple targets)
        --retent        the number of backups for retention (default: 3)
        --retry         the number of times for backup retrying (default: 3)

Examples:
        Run backup script by default
                ./vmm_backup_ova --default
        Backup all guests which repository is on the host and store OVAs in certain shared folder
                ./vmm_backup_ova --dst=&lt;share-name&gt; --host="&lt;host-name&gt;"
        Backup all guests which repository is on the host and limit the number of VMs exporting at a time to avoid affecting performance
                ./vmm_backup_ova --batch=2 --host="&lt;host-name&gt;"
        Backup certain guests and store the last two OVAs per VM
                ./vmm_backup_ova --guests="&lt;guest_name_1&gt;|&lt;guest_name_2&gt;" --retent=2
root@HomeNAS2602:~#
</pre>



<p class="wp-block-paragraph">The vmm_backup_ova utility is the cat&#8217;s meow here. I launch the program with a ssh script that reads as follows:</p>



<pre class="wp-block-preformatted"># clone/export VMs on this host for disaster recovery
#!/bin/bash
set -e
/volume1/@appstore/Virtualization/bin/vmm_backup_ova --dst=VMBackups --host="HomeNAS2602" --retent=1</pre>



<p class="wp-block-paragraph">In this case I&#8217;m telling vmm_backup_ova to export every VM running on that host and store the export in a shared folder called <em>VMBackups</em> and retain only one backup. <em>A key advantage of this utility is that we do NOT have to shutdown the VM!</em> Instead, vmm_backup_ova starts by making a temporary clone of the running VM, which happens in nearly an instant. Then it proceeds to export that clone (which is never run) <span style="text-decoration: underline;">while the real VM continues to run</span>. The export of a large VM might take several hours, but it runs in the background while everything else continues to function and then the clone VM is automatically deleted.</p>



<p class="wp-block-paragraph"><em>Tip: Avoid spaces in your virtual computer names. My experience is the utility creates destination directories with the wrong names and then can&#8217;t populate them. See my use of underbars instead.</em></p>



<p class="wp-block-paragraph">In practice I run a script like that on each of the two hosts. It&#8217;s nice that in the GUI of Virtual Machine Manager I can see and monitor the snapshot/export process even though I didn&#8217;t initiate it there. And although each NAS exports to its own file system, the VMBackups shared folder is replicated to the other host too via <a href="https://kb.synology.com/en-global/DSM/help/SynologyDrive/drive_sharesync?version=7" target="_blank" rel="noopener" title="">ShareSync</a>, and the <a href="https://www.synology.com/en-us/dsm/feature/hyper_backup" target="_blank" rel="noopener" title="">Hyper Backup</a> program is used to make off-site copies of VMBackups. Finally, the VM backups share itself gets <a href="https://www.synology.com/en-us/dsm/feature/snapshot_replication" target="_blank" rel="noopener" title="">snapshot retaining content for up to a month</a> (I snapshot nearly everything to protect it from ransomware if nothing else).</p>



<p class="wp-block-paragraph">I&#8217;m currently exporting once per month as scheduled in the Task Scheduler. So if I lost BOTH hosts then I can still recover the VM from the latest export (with some hardware of course), then restore VM files from within the VM itself, as I&#8217;ll typically have made more recent file backups and not have to revert all the way back to the last export once I&#8217;m all done.</p>
<p>The post <a href="https://walterstovall.online/2022/11/01/the-security-and-redundancy-of-clustered-virtual-machines/">The Security and Redundancy of Clustered Virtual Machines</a> appeared first on <a href="https://walterstovall.online">Walter&#039;s Little World</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://walterstovall.online/2022/11/01/the-security-and-redundancy-of-clustered-virtual-machines/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>How to limit the possible damage done by docker container malware</title>
		<link>https://walterstovall.online/2022/09/10/how-to-limit-the-possible-damage-done-by-docker-container-malware/</link>
					<comments>https://walterstovall.online/2022/09/10/how-to-limit-the-possible-damage-done-by-docker-container-malware/#respond</comments>
		
		<dc:creator><![CDATA[Walter Stovall]]></dc:creator>
		<pubDate>Sat, 10 Sep 2022 12:42:36 +0000</pubDate>
				<category><![CDATA[tech]]></category>
		<category><![CDATA[nas]]></category>
		<guid isPermaLink="false">https://walterstovall.online/?p=19352</guid>

					<description><![CDATA[<p>For all the docker users out there, I thought I&#8217;d share a couple points about managing docker containers on your home server. These are important security issues that get commonly missed. The simple examples you see on the internet for installing docker containers won&#8217;t usually mention these things. But they might save your whole system ... <a title="How to limit the possible damage done by docker container malware" class="read-more" href="https://walterstovall.online/2022/09/10/how-to-limit-the-possible-damage-done-by-docker-container-malware/" aria-label="Read more about How to limit the possible damage done by docker container malware">Read more</a></p>
<p>The post <a href="https://walterstovall.online/2022/09/10/how-to-limit-the-possible-damage-done-by-docker-container-malware/">How to limit the possible damage done by docker container malware</a> appeared first on <a href="https://walterstovall.online">Walter&#039;s Little World</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p class="wp-block-paragraph">For all the <a href="https://docs.docker.com/get-started/overview/">docker</a> users out there, I thought I&#8217;d share a couple points about managing <a href="https://www.docker.com/resources/what-container/">docker containers</a> on your <a href="https://en.wikipedia.org/wiki/Home_server">home server</a>. These are important security issues that get commonly missed. The simple examples you see on the internet for installing docker containers won&#8217;t usually mention these things. But they might save your whole system from  being shutdown by malware/ransomware.</p>



<p class="wp-block-paragraph">What are these protections and why are they necessary? First let me cover a little background on how docker containers work. The code in the container executes as part of the <a href="https://docs.docker.com/engine/">docker engine</a>. The docker engine by necessity, executes with <a href="https://www.howtogeek.com/737563/what-is-root-on-linux/">root privilege</a> and can therefore read or write any data in the file system whatsoever. To cause damage, malware in the container need only successfully submit a request to delete critical system files etc.</p>



<p class="wp-block-paragraph">In addition to damaging the file system, containers can also carry out network attacks on other containers on your server. Containers normally run in the default <a href="https://docs.docker.com/network/bridge/">bridge network</a>. Being on the same <a href="https://www.cloudflare.com/learning/network-layer/what-is-a-subnet/">subnet</a>, the docker engine makes the containers visible to each other by name. So containers can discover other containers and get their IP address thru DNS. The requests they send to each other may be malicious and won&#8217;t be blocked by any firewall since they occur within the same docker subnet (which is not a real network &#8211; it&#8217;s a virtual LAN in the engine).</p>



<p class="wp-block-paragraph">I recently went digging in this area when I got interested in installing the <a href="https://js.wiki/">wiki.js</a> container on my system to hold a <a href="https://en.wikipedia.org/wiki/Wiki">wiki</a> site. Wiki.js is a fully fledged web site/web publishing framework. Its JavaScript architecture and interfaces make it particularly susceptible to injection attacks. There&#8217;s also a history of quite a few bugs, and I&#8217;m not sure the codebase is clean of malware or poor security practices. That might be a reason to have second thoughts about using it all, but IMO that&#8217;s a little drastic if things are managed well.</p>



<p class="wp-block-paragraph"><span style="text-decoration: underline;">But these concerns did spur me to learn about some controls that can be put in place, and how to use them</span>. What I&#8217;m looking for here is to see that the <a href="https://www.ibm.com/topics/attack-surface">attack surface</a> within the docker engine, is limited to the wiki.js website itself &#8211; not my whole server. This means that an attacker might bring down wiki.js and might gain access to any information that&#8217;s been published there. But potentially numerous other services like my password manager, websites/sql databases, financial software, online movies, etc. remain unaffected.</p>



<h2 class="wp-block-heading">Isolate Docker Containers</h2>



<p class="wp-block-paragraph">Docker provides a couple of ways to manage container security. You just have to make a point to use them when you have reason to be concerned about what a container might do (like uh&#8230;all the time I should have been doing this all along).</p>



<ul class="wp-block-list"><li><a href="https://docs.docker.com/engine/reference/commandline/network_create/">Give the container its own network</a>. Most people install containers on the default <em>bridge</em> network by simply not specifying otherwise. So usually examples you find on the web try to keep things simple and leave this out. Alternatively, you can isolate your container on its on network and this means it has its own subnet. Now, even if your container magically knew the IP address of another container, it would not be able to send it anything. The docker runtime would not route the request. This is why docker has this facility and why you should use it.</li><li><a href="https://github.com/linuxserver/docker-documentation/blob/master/general/understanding-puid-and-pgid.md">Limit the logical file-system privilege of the container</a>. As mentioned, the docker runtime runs with root privilege. That would seem to drive a nail into the coffin, for any goal of seeing your container have limited privileges as it executes file system code. But docker has a facility to address just this concern, that being the <em>PUID/PGID</em> arguments that tell docker to execute container requests <em>as-though</em> the request were executed by a specific user. So barring some kind of zero-day vulnerability in the runtime, this goes a long way to limiting the damage done by ill-formed or ill-intent code. Again, you don&#8217;t usually see these arguments getting used. They won&#8217;t protect you unless you use them.</li></ul>



<h2 class="wp-block-heading">How I went about container isolation by example</h2>



<p class="wp-block-paragraph">The details of applying the above docker facilities are system specific when you look at the details. But similar steps will apply regardless. In a broad sense, the problem is that of creating a dedicated bridge network for the container and then use that. Then also limit the file system privileges.</p>



<p class="wp-block-paragraph">These are the specific steps I took to deploy the wiki.js container on my <a href="https://www.synology.com/en-global/company/news/article/DS1520Plus_PR">DS-1520+ NAS</a>. There are lots of ways of doing the equivalent things, this is just a by-example for the steps I took based on what&#8217;s easy and familiar to me.</p>



<p class="wp-block-paragraph">The first thing I&#8217;m going to do is create a network that I&#8217;ll call &#8220;wiki&#8221; where I&#8217;ll isolate the wiki.js container. I do that by running portainer, select my host and go to Networks and click on Add. Fill in the name of the network as &#8220;wiki&#8221;. Confirm the Driver is &#8220;bridge&#8221; and accept defaults on everything else and save this as a new network.</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="625" height="401" src="https://walterstovall.online/wp-content/uploads/2022/09/image.png?x52476" alt="" class="wp-image-19354" srcset="https://walterstovall.online/wp-content/uploads/2022/09/image.png 625w, https://walterstovall.online/wp-content/uploads/2022/09/image-300x192.png 300w" sizes="auto, (max-width: 625px) 100vw, 625px" /><figcaption>portainer screenshot add network</figcaption></figure>



<p class="wp-block-paragraph">Now you can see your new network that&#8217;s setup on its own subnet.</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="718" height="372" src="https://walterstovall.online/wp-content/uploads/2022/09/image-1.png?x52476" alt="" class="wp-image-19355" srcset="https://walterstovall.online/wp-content/uploads/2022/09/image-1.png 718w, https://walterstovall.online/wp-content/uploads/2022/09/image-1-300x155.png 300w" sizes="auto, (max-width: 718px) 100vw, 718px" /><figcaption>portainer screenshot network list</figcaption></figure>



<p class="wp-block-paragraph">With the network ready, I&#8217;ll now setup a user account for limiting the container&#8217;s privileges.</p>



<p class="wp-block-paragraph">Start by creating a system user. On my system I just went to the Control Panel and setup a new user I call &#8220;docker_wikijs&#8221;. This user has file system privileges where the only directory it has any access to whatsoever, is the shared folder where the wiki.js maintains all its settings and data.</p>



<p class="wp-block-paragraph">Getting the PUID/PGID takes executing the linux <em>id</em> command. If you&#8217;re comfortable with using SSH and you have SSH enabled on your server etc. then you can open a SSH prompt and get the output as shown by this example where I execute &#8220;id docker_wikijs&#8221;.</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="634" height="248" src="https://walterstovall.online/wp-content/uploads/2022/09/image-2.png?x52476" alt="" class="wp-image-19358" srcset="https://walterstovall.online/wp-content/uploads/2022/09/image-2.png 634w, https://walterstovall.online/wp-content/uploads/2022/09/image-2-300x117.png 300w" sizes="auto, (max-width: 634px) 100vw, 634px" /><figcaption>SSH Terminal get PUID/PGID values</figcaption></figure>



<p class="wp-block-paragraph">So what if you&#8217;re NOT so comfortable with SSH and you don&#8217;t have it setup? Well on a Synology don&#8217;t despair. You can actually execute the <em>id</em> command by setting up a task to do that in the Control Panel. The output will come to you as email. <a href="https://mariushosting.com/synology-find-uid-userid-and-gid-groupid-in-5-seconds/">See this easy guide on doing that</a>. (by the way you can use this same trick to execute any task such as <a href="https://docs.docker.com/engine/reference/commandline/run/">docker run</a> as root, just know that you need to take proper care doing so)</p>



<p class="wp-block-paragraph">So take the <em>uid</em> and <em>gid</em> values that come from the <em>id</em> command and that&#8217;s all you need for making PUID and PGID arguments for the docker run command.</p>



<p class="wp-block-paragraph">Having prepared the shared folders that wiki.js specifically wants, now I&#8217;m ready to execute docker run to install the container. See the following docker run command with highlighted arguments that isolate the container.</p>



<p class="wp-block-paragraph"><kbd>docker run -d --name=wikijs \<br><mark style="background-color:#802f2f" class="has-inline-color has-base-3-color">--network=wiki \<br>-e PUID=</mark><mark style="background-color:#ff4545" class="has-inline-color has-base-3-color">&lt;uid value&gt;</mark><mark style="background-color:#802f2f" class="has-inline-color has-base-3-color"> \<br>-e PGID=</mark><mark style="background-color:#fa3d3d" class="has-inline-color has-base-3-color">&lt;gid value&gt;</mark><mark style="background-color:#802f2f" class="has-inline-color has-base-3-color"> \</mark><br>-p 3540:3000 \<br>-e TZ=America/New_York \<br>-v /volume1/docker/wikijs/config:/config \<br>-v /volume1/docker/wikijs/data:/data \<br>--restart always \<br>ghcr.io/linuxserver/wikij</kbd>s</p>



<p class="wp-block-paragraph">The <em>network</em> argument naturally puts the container on that bridge instead of the default. The PUID and PGID arguments look just like simple environment variables, but the docker runtime picks up on these and quietly applies those privileges.</p>



<p class="wp-block-paragraph"><mark style="background-color:var(--base)" class="has-inline-color">Like anything though, test it out. For example reduce the user to read-only privilege and observe the wiki website failing to save files when you tell it to.</mark></p>



<p class="wp-block-paragraph">I execute the above <em>docker run</em> and then go to portainer and find wikijs installed as requested. <img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f642.png" alt="🙂" class="wp-smiley" style="height: 1em; max-height: 1em;" /></p>
<p>The post <a href="https://walterstovall.online/2022/09/10/how-to-limit-the-possible-damage-done-by-docker-container-malware/">How to limit the possible damage done by docker container malware</a> appeared first on <a href="https://walterstovall.online">Walter&#039;s Little World</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://walterstovall.online/2022/09/10/how-to-limit-the-possible-damage-done-by-docker-container-malware/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>My site has moved &#8211; hopefully to a more secure home</title>
		<link>https://walterstovall.online/2022/07/23/my-site-has-moved-hopefully-to-a-more-secure-home-too/</link>
					<comments>https://walterstovall.online/2022/07/23/my-site-has-moved-hopefully-to-a-more-secure-home-too/#respond</comments>
		
		<dc:creator><![CDATA[Walter Stovall]]></dc:creator>
		<pubDate>Sat, 23 Jul 2022 21:04:56 +0000</pubDate>
				<category><![CDATA[tech]]></category>
		<category><![CDATA[nas]]></category>
		<category><![CDATA[wordpress]]></category>
		<guid isPermaLink="false">https://walterstovall.online/?p=18087</guid>

					<description><![CDATA[<p>Whew! It&#8217;s been a few intense months. I&#8217;ve been too engaged to stop and take note of any of it. But I&#8217;m taking a breather here to mention a couple things I&#8217;ve been working on and talk about the New Home for this blog and how that fits in. With my DS-1520+ server with its ... <a title="My site has moved &#8211; hopefully to a more secure home" class="read-more" href="https://walterstovall.online/2022/07/23/my-site-has-moved-hopefully-to-a-more-secure-home-too/" aria-label="Read more about My site has moved &#8211; hopefully to a more secure home">Read more</a></p>
<p>The post <a href="https://walterstovall.online/2022/07/23/my-site-has-moved-hopefully-to-a-more-secure-home-too/">My site has moved &#8211; hopefully to a more secure home</a> appeared first on <a href="https://walterstovall.online">Walter&#039;s Little World</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p class="wp-block-paragraph">Whew! It&#8217;s been a few intense months. I&#8217;ve been too engaged to stop and take note of any of it. But I&#8217;m taking a breather here to mention a couple things I&#8217;ve been working on and talk about the New Home for this blog and how that fits in.</p>



<p class="wp-block-paragraph">With my <a href="https://www.youtube.com/watch?v=MLEnjrBvXzg" target="_blank" rel="noopener">DS-1520+</a> server with its <a href="https://www.youtube.com/watch?v=MLEnjrBvXzg" target="_blank" rel="noopener">cloud</a> and <a href="https://www.youtube.com/watch?v=apE6eyQzHdg&amp;t=361s" target="_blank" rel="noopener">other functions</a> I keep using more, I&#8217;ve managed to put together a house of cards. I&#8217;ve added one service after another including various docker containers and applications for about a year now. That included lots of trials and tribulations. I don&#8217;t want to lose it all in a hardware failure. I keep backups, but they haven&#8217;t been validated and I know for a fact there are various things that won&#8217;t get restored by <a href="https://linuxhint.com/use-synology-hyper-backup/" target="_blank" rel="noopener">Hyper Backup</a>. So I need a procedure for doing a rebuild, and I need to be able to validate that it works when the time comes, and know what it takes to get a new system functional. And wouldn&#8217;t it be great if I could do that without buying new systems to try it out!?! I don&#8217;t want to break what I have.</p>



<p class="wp-block-paragraph">It dawned on me recently that I have all the tools at my disposal to develop and test backup recovery, and without buying any new hardware. On either of my <a href="https://en.wikipedia.org/wiki/Network-attached_storage" target="_blank" rel="noopener">NAS</a>es I can run virtual computers using the Virtual Machine Manager. On that virtual computer, I can install a variety of operating systems including <a href="https://www.wundertech.net/how-to-setup-a-synology-dsm-virtual-machine-vdsm/" target="_blank" rel="noopener">Virtual DSM</a>. This lets met build a NAS within a NAS. Now I can start with a fresh installation of DSM and try to restore functionality from a backup. Upon finding and fixing problems with my procedure or limitations in the scope of the backup, I can make various changes and then just throw that Virtual DSM away and start over.</p>



<p class="wp-block-paragraph">So I&#8217;ve been doing exactly that, and stumbled on an interesting thing to try out that I suspect substantially improves the security of my site and is otherwise just cool. In some of my testing I created a Virtual DSM and restored a backup of <a href="https://walterstovall.online">this web site</a> on it (naturally including databases etc that it needs to function). I got that working and that&#8217;s why you can see this web  page&#8230;the original site has been shut down at least for a while.</p>



<p class="wp-block-paragraph">The reason this is more secure is this: <em>If at attacker manages to infect the walterstovall.online host with malware, the damage that malware can cause is limited to the virtual computer.</em> If it did get compromised somehow then I could just restore that virtual computer from a saved snapshot. If for example the malware were to somehow delete every file on the hard disk and render the operating system unbootable, this would still be limited to the virtual computer that runs the site. The &#8220;hard disk&#8221; that got wiped is just a virtual hard disk that&#8217;s a small part of the storage on the hosting server.</p>



<h2 class="wp-block-heading">How I moved this site into a virtual computer</h2>



<p class="wp-block-paragraph">I went thru the process of creating a VM for my site several times before I ended up with a smooth and consolidated set of steps. I wanted to boil it down to the essentials so I can easily move things as I see fit. I think it worked out very nicely and I thought I&#8217;d record what I came up with here.</p>



<p class="wp-block-paragraph">To sum it up here&#8217;s what  I&#8217;ll do below. Setup a virtual NAS on my DS-918 using <a href="https://www.synology.com/en-us/dsm/feature/virtual_machine_manager" target="_blank" rel="noopener">Virtual Machine Manager</a>. Point that virtual NAS to a backup of my DS-1520 server where walterstovall.online is currently deployed. Restore from that backup, the services necessary for running the walterstovall.online blog along with the site files and SQL database etc. Shutdown the new site and startup the new one in the VM and make it accessible over the internet.</p>



<p class="wp-block-paragraph">Let&#8217;s get into it!</p>



<h2 class="wp-block-heading">Create Virtual DSM Computer to host my blog</h2>



<p class="wp-block-paragraph">On the DS-918 I&#8217;ll visit Virtual Machine Manager and tell it to create a new virtual computer.</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="558" height="359" src="https://walterstovall.online/wp-content/uploads/2022/07/image-8.png?x52476" alt="" class="wp-image-18096" srcset="https://walterstovall.online/wp-content/uploads/2022/07/image-8.png 558w, https://walterstovall.online/wp-content/uploads/2022/07/image-8-300x193.png 300w" sizes="auto, (max-width: 558px) 100vw, 558px" /><figcaption>Create virtual computer</figcaption></figure>



<p class="wp-block-paragraph">Stepping thru a few simple dialogs to allocate hardware resources, the VM gets created and I can connect to it at its assigned IP address. Now I give the computer a unique host name and login account.</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="836" height="294" src="https://walterstovall.online/wp-content/uploads/2022/07/image-9.png?x52476" alt="" class="wp-image-18097" srcset="https://walterstovall.online/wp-content/uploads/2022/07/image-9.png 836w, https://walterstovall.online/wp-content/uploads/2022/07/image-9-300x106.png 300w, https://walterstovall.online/wp-content/uploads/2022/07/image-9-768x270.png 768w" sizes="auto, (max-width: 836px) 100vw, 836px" /><figcaption>Name device and create a new login account</figcaption></figure>



<p class="wp-block-paragraph">That&#8217;s about all there is to that&#8230;now I login with the new admin account and I&#8217;m at a new DSM desktop.</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="158" height="535" src="https://walterstovall.online/wp-content/uploads/2022/07/image-10.png?x52476" alt="" class="wp-image-18098" srcset="https://walterstovall.online/wp-content/uploads/2022/07/image-10.png 158w, https://walterstovall.online/wp-content/uploads/2022/07/image-10-89x300.png 89w" sizes="auto, (max-width: 158px) 100vw, 158px" /><figcaption>Basic new desktop with no add-ons</figcaption></figure>



<h2 class="wp-block-heading">Install Web Backends</h2>



<p class="wp-block-paragraph">After downloading DSM updates I now go to the Package Center and tell it to download the backend services that my site needs. These are mostly provided by third parties and won&#8217;t be part of the backup we&#8217;re going to restore.</p>



<p class="wp-block-paragraph">By inspecting the Web Station setup on the source NAS where walterstovall.online resides, I see the following capabilities there.</p>



<figure class="wp-block-image size-full is-resized"><img loading="lazy" decoding="async" src="https://walterstovall.online/wp-content/uploads/2022/07/image-11.png?x52476" alt="" class="wp-image-18099" width="729" height="852" srcset="https://walterstovall.online/wp-content/uploads/2022/07/image-11.png 678w, https://walterstovall.online/wp-content/uploads/2022/07/image-11-257x300.png 257w" sizes="auto, (max-width: 729px) 100vw, 729px" /><figcaption>Based on that I just choose the right packages to install including (I know some of the above aren&#8217;t used anymore):</figcaption></figure>



<ul class="wp-block-list"><li>Apache HTTP 2.4</li><li>PHP 7.4</li><li>phpMyAdmin</li></ul>



<h2 class="wp-block-heading">Restore system configuration and web sites</h2>



<p class="wp-block-paragraph">Now I go to the Package Center and tell it to install Hyper Backup which I then launch and tell it to restore a data backup. I&#8217;ll point to a backup of the whole NAS.</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="653" height="327" src="https://walterstovall.online/wp-content/uploads/2022/07/image-12.png?x52476" alt="" class="wp-image-18100" srcset="https://walterstovall.online/wp-content/uploads/2022/07/image-12.png 653w, https://walterstovall.online/wp-content/uploads/2022/07/image-12-300x150.png 300w" sizes="auto, (max-width: 653px) 100vw, 653px" /><figcaption>Login to remote server where backup is stored</figcaption></figure>



<p class="wp-block-paragraph">Now I step thru a few dialogs telling it just what to restore from the backup and get down to this summary to confirm.</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="537" height="440" src="https://walterstovall.online/wp-content/uploads/2022/07/image-15.png?x52476" alt="" class="wp-image-18104" srcset="https://walterstovall.online/wp-content/uploads/2022/07/image-15.png 537w, https://walterstovall.online/wp-content/uploads/2022/07/image-15-300x246.png 300w" sizes="auto, (max-width: 537px) 100vw, 537px" /><figcaption>Selective restore of the web server and websites</figcaption></figure>



<p class="wp-block-paragraph">That kicks off and runs for a couple hours, loading a few hundred GB of applications and data into this virtual server.</p>



<p class="wp-block-paragraph">After running, that restores ALL network settings and user accounts from the DS-1520 server. This is great in most respects except that it also gives the server the same network and domain name as the stovallhut.online server I restored this backup from. So now it&#8217;s important to visit the network settings and login portal in the Virtual DSM and restore the correct settings. Also important, is to configure my local DNS so the IP address of the server is permanently reserved.</p>



<p class="wp-block-paragraph">Finally, I can visit <a href="https://walterstovall.online">https://walterstovall.online</a> and view the site! But not done quite yet&#8230;</p>



<h2 class="wp-block-heading">Fix inability to login at site</h2>



<p class="wp-block-paragraph">Even though I can view the site anonymously, I can&#8217;t login. The reason being that my site is setup for a <a href="https://en.wikipedia.org/wiki/Multi-factor_authentication" target="_blank" rel="noopener">2FA login</a> and after moving the site, I can&#8217;t seem to make that work (even though it is a <a href="https://en.wikipedia.org/wiki/Time-based_one-time_password" target="_blank" rel="noopener">TOTP code</a>, so it seems like it should work based on the same secret key).</p>



<p class="wp-block-paragraph">In any case I came up with the following solution that will let me login and get things working.</p>



<p class="wp-block-paragraph">Open a <a href="https://en.wikipedia.org/wiki/Secure_Shell" target="_blank" rel="noopener">SSH session</a> and navigate to the wordpress directory where I&#8217;ll temporarily hide the <a href="https://www.wordfence.com/" target="_blank" rel="noopener">wordfence plugin</a> which handles the 2FA login (and a lot of other security issues).</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="655" height="353" src="https://walterstovall.online/wp-content/uploads/2022/07/image-16.png?x52476" alt="" class="wp-image-18106" srcset="https://walterstovall.online/wp-content/uploads/2022/07/image-16.png 655w, https://walterstovall.online/wp-content/uploads/2022/07/image-16-300x162.png 300w" sizes="auto, (max-width: 655px) 100vw, 655px" /><figcaption>SSH session to rename/hide the wordfence plugin</figcaption></figure>



<p class="wp-block-paragraph">The <em>mv wordfence wordfence.bak</em> just renames the plugin directory and makes it unable to participate in the login which then becomes based only on username &amp; password.</p>



<p class="wp-block-paragraph">Now that I&#8217;m logged in I can then rename wordfence.bak, giving it the original name. This makes it possible to now get to wordfence and turn off 2FA logins. Now I can log out, log in, etc. And turning on 2FA makes that work again too.</p>



<h2 class="wp-block-heading">Secure internet access</h2>



<p class="wp-block-paragraph">At this point the site is fully functional except for one glaring problem. <a href="https://en.wikipedia.org/wiki/Public_key_certificate" target="_blank" rel="noopener">Security certificates</a> are not installed, so access in a web brower includes bypassing stern warnings about the site not being secure. It&#8217;s also not possible to reach the VM over the internet. I&#8217;ll solve both of those problems below.</p>



<p class="wp-block-paragraph">To reach the VM over the internet I&#8217;ll setup a <a href="https://en.wikipedia.org/wiki/Reverse_proxy" target="_blank" rel="noopener">reverse proxy</a> on stovallhut.online that will send walterstovall.online traffic to the right place on the LAN. The reverse proxy tells stovallhut.online that when it receives HTTPS traffic directed to walterstovall.online, that it should send that traffic to the IP address of the Virtual DSM where we&#8217;ve placed the site.</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="505" height="492" src="https://walterstovall.online/wp-content/uploads/2022/07/image-17.png?x52476" alt="" class="wp-image-18107" srcset="https://walterstovall.online/wp-content/uploads/2022/07/image-17.png 505w, https://walterstovall.online/wp-content/uploads/2022/07/image-17-300x292.png 300w" sizes="auto, (max-width: 505px) 100vw, 505px" /><figcaption>Create a reverse proxy to route internet traffic to the VM</figcaption></figure>



<p class="wp-block-paragraph"><em>(this reverse proxy needs to be associated to the walterstovall.online certificate too at the certificates settings page or browsers will still complain regardless of the certificate at the final destination)</em></p>



<p class="wp-block-paragraph">Now I&#8217;ll just pick the export-action on this certificate so I can import it at my new hutbuddy.online virtual server where the web site has been moved.</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="587" height="236" src="https://walterstovall.online/wp-content/uploads/2022/07/image-18.png?x52476" alt="" class="wp-image-18108" srcset="https://walterstovall.online/wp-content/uploads/2022/07/image-18.png 587w, https://walterstovall.online/wp-content/uploads/2022/07/image-18-300x121.png 300w" sizes="auto, (max-width: 587px) 100vw, 587px" /><figcaption>Import SSL Security Certificate</figcaption></figure>



<p class="wp-block-paragraph">With the certificate imported, I&#8217;ll then associate it with the walterstovall.online virtual host.</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="606" height="388" src="https://walterstovall.online/wp-content/uploads/2022/07/image-19.png?x52476" alt="" class="wp-image-18109" srcset="https://walterstovall.online/wp-content/uploads/2022/07/image-19.png 606w, https://walterstovall.online/wp-content/uploads/2022/07/image-19-300x192.png 300w" sizes="auto, (max-width: 606px) 100vw, 606px" /><figcaption>Pair the certificate with the website</figcaption></figure>



<p class="wp-block-paragraph">And that&#8217;s about it! If that seems like a lot of stuff to do, you should have seen my steps the first time <img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f642.png" alt="🙂" class="wp-smiley" style="height: 1em; max-height: 1em;" /></p>
<p>The post <a href="https://walterstovall.online/2022/07/23/my-site-has-moved-hopefully-to-a-more-secure-home-too/">My site has moved &#8211; hopefully to a more secure home</a> appeared first on <a href="https://walterstovall.online">Walter&#039;s Little World</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://walterstovall.online/2022/07/23/my-site-has-moved-hopefully-to-a-more-secure-home-too/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>The face detection in Synology Photos is too cool!</title>
		<link>https://walterstovall.online/2021/10/23/the-face-detection-in-synology-photos-is-too-cool/</link>
					<comments>https://walterstovall.online/2021/10/23/the-face-detection-in-synology-photos-is-too-cool/#respond</comments>
		
		<dc:creator><![CDATA[Walter Stovall]]></dc:creator>
		<pubDate>Sat, 23 Oct 2021 12:12:52 +0000</pubDate>
				<category><![CDATA[tech]]></category>
		<category><![CDATA[nas]]></category>
		<guid isPermaLink="false">https://walterstovall.online/?p=11352</guid>

					<description><![CDATA[<p>I started out with just thousands of picture files when I loaded it all into Synology Photos. I&#8217;ve been playing with what it can do for a while, but initially missed the face detection when I setup my account and just turned that on this morning. Initially my login showed a new People folder to ... <a title="The face detection in Synology Photos is too cool!" class="read-more" href="https://walterstovall.online/2021/10/23/the-face-detection-in-synology-photos-is-too-cool/" aria-label="Read more about The face detection in Synology Photos is too cool!">Read more</a></p>
<p>The post <a href="https://walterstovall.online/2021/10/23/the-face-detection-in-synology-photos-is-too-cool/">The face detection in Synology Photos is too cool!</a> appeared first on <a href="https://walterstovall.online">Walter&#039;s Little World</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p class="wp-block-paragraph">I started out with just thousands of picture files when I loaded it all into <a href="https://www.synology.com/en-global/DSM70/SynologyPhotos">Synology Photos.</a> I&#8217;ve been <a href="https://walterstovall.online/2021/10/10/synology-photos-is-a-serious-contender-for-google-photos/">playing with what it can do for a while</a>, but initially missed the face detection when I setup my account and just turned that on this morning.</p>



<hr class="wp-block-separator"/>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="567" height="261" src="https://walterstovall.online/wp-content/uploads/2021/10/auto-createAlbumSettings.jpg?x52476" alt="" class="wp-image-11355" srcset="https://walterstovall.online/wp-content/uploads/2021/10/auto-createAlbumSettings.jpg 567w, https://walterstovall.online/wp-content/uploads/2021/10/auto-createAlbumSettings-300x138.jpg 300w" sizes="auto, (max-width: 567px) 100vw, 567px" /><figcaption>Turn on and now you get a People folder</figcaption></figure>



<p class="wp-block-paragraph">Initially my login showed a new <em>People</em> folder to me with nothing in it. The server worked on indexing my thousands of images for at least an hour or so. Then I came back and now, when I view the people folder I see lots of sub-folders, one for each person the package thinks are the same individual. In each case I see a sample picture of the person. But instead of a person&#8217;s name, I see &#8220;who&#8217;s this?&#8221;.</p>



<p class="wp-block-paragraph">Fill in the person&#8217;s name, and hit enter. Repeat with each one. In a few cases I would come to somebody that I&#8217;ve already identified, but the software apparently thinks these are two different people. In that case I just type the same name again (auto-completed for me) and I&#8217;ll be prompted to merge the two into one.</p>



<p class="wp-block-paragraph">I&#8217;ve also seen where I can remove people from a folder if they&#8217;ve been wrongly recognized, but I&#8217;ve yet to witness that. What I&#8217;m on the lookout for, is a way for me to identify somebody that was not recognized at all, and say who they are. That may be missing feature? Or I&#8217;m too much of a newbie.</p>



<p class="wp-block-paragraph">Even though some people don&#8217;t get recognized, it&#8217;s often very surprising who it <span style="text-decoration: underline;">does</span> recognize. Like people in the background of the image. It also appears to me that it correlates separate images, combining clues from each. For example I have a case where it recognizes an image of my nephew. Then in another picture that it also recognizes of him (taken on the same day at the same gathering), there&#8217;s a clear shot of his body but he&#8217;s looking at the floor and instead of his face, the picture just shows the top his head. When <span style="text-decoration: underline;">I look at the pictures</span> I know who it is because of what he&#8217;s wearing.</p>



<p class="wp-block-paragraph">Now when I wish I could find some pictures of ??? I can do that.  And with <a href="https://www.synology.com/en-global/products/DS1520+">the NAS</a> just sitting here anyway, this comes at no extra cost <img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f642.png" alt="🙂" class="wp-smiley" style="height: 1em; max-height: 1em;" /></p>
<p>The post <a href="https://walterstovall.online/2021/10/23/the-face-detection-in-synology-photos-is-too-cool/">The face detection in Synology Photos is too cool!</a> appeared first on <a href="https://walterstovall.online">Walter&#039;s Little World</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://walterstovall.online/2021/10/23/the-face-detection-in-synology-photos-is-too-cool/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Keep your &#8220;online&#8221; life alive when the internet is down</title>
		<link>https://walterstovall.online/2021/10/16/keep-your-online-life-alive-when-the-internet-is-down/</link>
					<comments>https://walterstovall.online/2021/10/16/keep-your-online-life-alive-when-the-internet-is-down/#respond</comments>
		
		<dc:creator><![CDATA[Walter Stovall]]></dc:creator>
		<pubDate>Sat, 16 Oct 2021 12:44:06 +0000</pubDate>
				<category><![CDATA[tech]]></category>
		<category><![CDATA[nas]]></category>
		<guid isPermaLink="false">https://walterstovall.online/?p=11136</guid>

					<description><![CDATA[<p>I have several web sites and other information or entertainment resources on my local network. Since it&#8217;s all mine here, it seems silly to not be able to use my own stuff just because the internet is down! But that&#8217;s exactly what would normally happen, all because of just one thing&#8230;DNS lookups. Let&#8217;s say I ... <a title="Keep your &#8220;online&#8221; life alive when the internet is down" class="read-more" href="https://walterstovall.online/2021/10/16/keep-your-online-life-alive-when-the-internet-is-down/" aria-label="Read more about Keep your &#8220;online&#8221; life alive when the internet is down">Read more</a></p>
<p>The post <a href="https://walterstovall.online/2021/10/16/keep-your-online-life-alive-when-the-internet-is-down/">Keep your &#8220;online&#8221; life alive when the internet is down</a> appeared first on <a href="https://walterstovall.online">Walter&#039;s Little World</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p class="wp-block-paragraph">I have several web sites and other information or entertainment resources <a href="https://walterstovall.online/this-fine-server/">on my local network</a>. Since it&#8217;s all mine here, it seems silly to not be able to use my own stuff just because the internet is down! But that&#8217;s exactly what would normally happen, all because of just one thing&#8230;<a href="https://nlogn.in/what-is-dns-and-how-does-dns-lookup-work/">DNS lookups</a>.</p>



<p class="wp-block-paragraph">Let&#8217;s say I want to watch a movie on my smart tv and the internet is down. My tv is setup to let me play movies from my home server residing at hostname <em>video.stovallhut.online</em>. If I pickup my <a href="https://www.roku.com/">roku</a> and go to the <a href="https://www.synology.com/en-us/dsm/feature/video_station">DS Video app</a> to watch a movie, it will fail right off the bat because it can&#8217;t resolve the hostname to a IP address. Dead in the water.</p>



<p class="wp-block-paragraph">In my case the solution to this problem comes all in configuring <a href="https://www.synology.com/en-us/products/RT2600ac">my main router</a> for my local network by adding a DNS Server that knows the names of my home servers and will then resolve the name without contacting a server on the internet. This also means the names will resolve much faster here at my house.</p>



<p class="wp-block-paragraph">While this is a quick setup, it didn&#8217;t just fall in my lap. I was immediately hit with unfamiliar entities to setup and not knowing what <em>zones</em> are much less master zones vs. slave zones and why I might want one. But just resolving names on your local network is really pretty easy at least on my RT2600ac router. I captured the steps below in case this helps anybody else (or me later) dodge the complexity and just handle this simple scenario.</p>



<p class="wp-block-paragraph">Start by logging into the Synology router and go to the Package Center. Install the DNS Server package. Open DNS Server and create a Master Zone. You need one master zone for each domain you want to resolve. So in my case I have a server I get to as <em>stovallhut.online</em> and fill out the dialog like this.</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="600" height="566" src="https://walterstovall.online/wp-content/uploads/2021/10/createMasterZone.png?x52476" alt="" class="wp-image-11140" srcset="https://walterstovall.online/wp-content/uploads/2021/10/createMasterZone.png 600w, https://walterstovall.online/wp-content/uploads/2021/10/createMasterZone-300x283.png 300w" sizes="auto, (max-width: 600px) 100vw, 600px" /></figure>



<p class="wp-block-paragraph">To me it was not intuitive to think of the name I want to resolve to as a &#8220;Master DNS server&#8221;. Don&#8217;t think that you need to setup something on your server for that. This is just the IP of the computer you want to reach using that name. That computer does not participate in resolving the name (<em>I think the master-server concept is for the rare case where you would run your own nameserver</em>).</p>



<p class="wp-block-paragraph">Accept defaults for other choices and save the new Master Zone. To resolve the name though, you&#8217;re not quite done&#8230;</p>



<p class="wp-block-paragraph">Assuming you have a Windows computer connected to your router (and using the DNS server i.e. no manual override of <a href="https://support.microsoft.com/en-us/windows/change-tcp-ip-settings-bd0a07af-15f5-cd6a-363f-ca2b6f391ace#:~:text=To%20make%20it%20easier%20to,if%20your%20network%20supports%20it.">DHCP settings</a>), open a command prompt and try to resolve the name you just setup.</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="340" height="349" src="https://walterstovall.online/wp-content/uploads/2021/10/notReadyYet.png?x52476" alt="" class="wp-image-11141" srcset="https://walterstovall.online/wp-content/uploads/2021/10/notReadyYet.png 340w, https://walterstovall.online/wp-content/uploads/2021/10/notReadyYet-292x300.png 292w" sizes="auto, (max-width: 340px) 100vw, 340px" /><figcaption>Name resolution does not work anymore</figcaption></figure>



<p class="wp-block-paragraph">See above that no address at all shows when trying to resolve the new domain. Compare that to resolving cnn.com which comes back with several IPs.</p>



<p class="wp-block-paragraph">To resolve the name you need to add a &#8220;A&#8221; record to the master zone you just created. Visit the zone and double-click to edit.</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="667" height="375" src="https://walterstovall.online/wp-content/uploads/2021/10/createARecord.png?x52476" alt="" class="wp-image-11142" srcset="https://walterstovall.online/wp-content/uploads/2021/10/createARecord.png 667w, https://walterstovall.online/wp-content/uploads/2021/10/createARecord-300x169.png 300w" sizes="auto, (max-width: 667px) 100vw, 667px" /><figcaption>Create the &#8220;A Record&#8221; with a blank name to resolve the domain</figcaption></figure>



<p class="wp-block-paragraph">Fill in just the IP address and save the rule &#8211; that&#8217;s all there is to it. Now go back to your dos prompt and you should see the name resolve correctly now.</p>



<h2 class="wp-block-heading">Handle subdomains with more &#8220;A Records&#8221;</h2>



<p class="wp-block-paragraph">If you have any subdomains you&#8217;ll need A Records for each of them too. See below how I setup a few subdomains for my stovallhut.online domain.</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="673" height="270" src="https://walterstovall.online/wp-content/uploads/2021/10/subdomainsToo.png?x52476" alt="" class="wp-image-11143" srcset="https://walterstovall.online/wp-content/uploads/2021/10/subdomainsToo.png 673w, https://walterstovall.online/wp-content/uploads/2021/10/subdomainsToo-300x120.png 300w" sizes="auto, (max-width: 673px) 100vw, 673px" /><figcaption>You need a &#8220;A Record&#8221; for each subdomain too</figcaption></figure>



<p class="wp-block-paragraph">Now my smart tv can go find movies at video.stovallhut.online when my internet is disconnected <img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f642.png" alt="🙂" class="wp-smiley" style="height: 1em; max-height: 1em;" /></p>



<p class="wp-block-paragraph">Visit this site for more information on the <a href="https://kb.synology.com/en-my/DSM/tutorial/How_to_set_up_your_domain_with_Synology_DNS_Server">Synology DNS Server</a>. Note that I could have used CNAME records for my subdomains. That might be a little less maintenance especially if you change around your IP addresses. But I elected not to because of at least a minor performance issue in that CNAME records include the overhead of an additional query to the DNS Server during name resolution.</p>



<h2 class="wp-block-heading">Going further with DNS Records</h2>



<p class="wp-block-paragraph">My above focus on basic address resolution leaves a lot out of what you can do with a DNS Server. See this <a href="https://www.pbrumby.com/2018/05/09/dns-records-explained/">good reference</a> for what the various records in your DNS Server can do to help you manage a local network.</p>
<p>The post <a href="https://walterstovall.online/2021/10/16/keep-your-online-life-alive-when-the-internet-is-down/">Keep your &#8220;online&#8221; life alive when the internet is down</a> appeared first on <a href="https://walterstovall.online">Walter&#039;s Little World</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://walterstovall.online/2021/10/16/keep-your-online-life-alive-when-the-internet-is-down/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Do you want two factor authentication or passwordless login?</title>
		<link>https://walterstovall.online/2021/10/14/do-you-want-two-factor-authentication-or-passwordless-login/</link>
					<comments>https://walterstovall.online/2021/10/14/do-you-want-two-factor-authentication-or-passwordless-login/#respond</comments>
		
		<dc:creator><![CDATA[Walter Stovall]]></dc:creator>
		<pubDate>Thu, 14 Oct 2021 21:03:37 +0000</pubDate>
				<category><![CDATA[tech]]></category>
		<category><![CDATA[nas]]></category>
		<guid isPermaLink="false">https://walterstovall.online/?p=10907</guid>

					<description><![CDATA[<p>Either way the awesome tools in Synology DSM 7.0 have you covered completely for free and with minimal fuss 🙂 I&#8217;ve had a burr in my butt around the need for multifactor authentication on my server, especially for an admin account that if stolen, would be awful needless to say. It&#8217;s equally important for other ... <a title="Do you want two factor authentication or passwordless login?" class="read-more" href="https://walterstovall.online/2021/10/14/do-you-want-two-factor-authentication-or-passwordless-login/" aria-label="Read more about Do you want two factor authentication or passwordless login?">Read more</a></p>
<p>The post <a href="https://walterstovall.online/2021/10/14/do-you-want-two-factor-authentication-or-passwordless-login/">Do you want two factor authentication or passwordless login?</a> appeared first on <a href="https://walterstovall.online">Walter&#039;s Little World</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p class="wp-block-paragraph">Either way the awesome tools in<a href="https://www.windowscentral.com/synology-dsm-7"> Synology DSM 7.0</a> have you covered completely for free and with minimal fuss <img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f642.png" alt="🙂" class="wp-smiley" style="height: 1em; max-height: 1em;" /></p>



<p class="wp-block-paragraph">I&#8217;ve had a burr in my butt around the need for multifactor authentication on my server, especially for an admin account that if stolen, would be awful needless to say. It&#8217;s equally important for other accounts too depending on usage. But I come along kicking and screaming. I don&#8217;t login for good luck. I&#8217;m trying to do something and logging in is a distraction and a frustration if it takes much time or data entry. After setting up 2FA on my Synology <a href="https://www.synology.com/en-global/products/DS1520+">DS-1520+</a> I&#8217;ve been real pleased with the outcome.</p>



<p class="wp-block-paragraph">I&#8217;ll start with the outcome&#8230;let&#8217;s say I&#8217;m logging onto my <a href="https://en.wikipedia.org/wiki/Network-attached_storage">NAS</a> (directly or using one of my apps) and I&#8217;m prompted to authenticate. I enter my User Id and password and press enter. Now my web page tells me to approve the login at my phone.</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="356" height="433" src="https://walterstovall.online/wp-content/uploads/2021/10/PasswordlessGetApprovedMessage-1.png?x52476" alt="" class="wp-image-10917" srcset="https://walterstovall.online/wp-content/uploads/2021/10/PasswordlessGetApprovedMessage-1.png 356w, https://walterstovall.online/wp-content/uploads/2021/10/PasswordlessGetApprovedMessage-1-247x300.png 247w" sizes="auto, (max-width: 356px) 100vw, 356px" /><figcaption>My browser prompts for me to Approve at my phone</figcaption></figure>



<hr class="wp-block-separator"/>



<p class="wp-block-paragraph">I open the notice on my phone and hit Approve and I&#8217;m logged in <img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f642.png" alt="🙂" class="wp-smiley" style="height: 1em; max-height: 1em;" /></p>



<p class="wp-block-paragraph">While I don&#8217;t welcome the interruption of another prompt, with two factor authentication being the goal I can&#8217;t see how it gets much easier than this.</p>



<p class="wp-block-paragraph">The Secure Signin will also let you login using OTP codes.</p>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="1024" height="661" src="https://walterstovall.online/wp-content/uploads/2021/10/SecureSigninCodeDisplay-1024x661.png?x52476" alt="" class="wp-image-10912" srcset="https://walterstovall.online/wp-content/uploads/2021/10/SecureSigninCodeDisplay-1024x661.png 1024w, https://walterstovall.online/wp-content/uploads/2021/10/SecureSigninCodeDisplay-300x194.png 300w, https://walterstovall.online/wp-content/uploads/2021/10/SecureSigninCodeDisplay-768x496.png 768w, https://walterstovall.online/wp-content/uploads/2021/10/SecureSigninCodeDisplay.png 1194w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /><figcaption>Use OTP code for login</figcaption></figure>



<p class="wp-block-paragraph">It&#8217;s interesting to note that the security code can be generated and used even if your phone has no cell or internet connection. In fact you don&#8217;t even need a LAN connection to your NAS. The code is just good by itself since both the NAS and the phone have synchronized times and both of them know the secret key used to generate the code.</p>



<h2 class="wp-block-heading">What if you don&#8217;t care about 2FA and just want a easier login?</h2>



<p class="wp-block-paragraph">Do you want the security of some authentication, but don&#8217;t want to mess around finding and typing in your long cryptic password all the time? You can setup your account for what&#8217;s called <em>passwordless</em> login. This will enable you, while holding your unlocked phone, to authenticate with literally one button press (avoid giving the phone an unlock code by setting up biometrics on the phone).</p>



<p class="wp-block-paragraph">To see how easy this is let&#8217;s say I&#8217;m logging into the DS-1520 and I&#8217;m prompted to authenticate. I DO have to type in my user name.</p>



<hr class="wp-block-separator"/>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="401" height="354" src="https://walterstovall.online/wp-content/uploads/2021/10/PasswordlessPrompt-1.jpg?x52476" alt="" class="wp-image-10915" srcset="https://walterstovall.online/wp-content/uploads/2021/10/PasswordlessPrompt-1.jpg 401w, https://walterstovall.online/wp-content/uploads/2021/10/PasswordlessPrompt-1-300x265.jpg 300w" sizes="auto, (max-width: 401px) 100vw, 401px" /><figcaption>Type in user name</figcaption></figure>



<hr class="wp-block-separator"/>



<p class="wp-block-paragraph">Now when I click on the arrow I get this message in my browser window&#8230;</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="356" height="433" src="https://walterstovall.online/wp-content/uploads/2021/10/PasswordlessGetApprovedMessage-1.png?x52476" alt="" class="wp-image-10917" srcset="https://walterstovall.online/wp-content/uploads/2021/10/PasswordlessGetApprovedMessage-1.png 356w, https://walterstovall.online/wp-content/uploads/2021/10/PasswordlessGetApprovedMessage-1-247x300.png 247w" sizes="auto, (max-width: 356px) 100vw, 356px" /><figcaption>Login approval request sent</figcaption></figure>



<hr class="wp-block-separator"/>



<p class="wp-block-paragraph">Now I look at my previously sleeping and locked phone&#8230;</p>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="984" height="1024" src="https://walterstovall.online/wp-content/uploads/2021/10/sleepingPhoneShowsRequest-984x1024.png?x52476" alt="" class="wp-image-10918" srcset="https://walterstovall.online/wp-content/uploads/2021/10/sleepingPhoneShowsRequest-984x1024.png 984w, https://walterstovall.online/wp-content/uploads/2021/10/sleepingPhoneShowsRequest-288x300.png 288w, https://walterstovall.online/wp-content/uploads/2021/10/sleepingPhoneShowsRequest-768x800.png 768w, https://walterstovall.online/wp-content/uploads/2021/10/sleepingPhoneShowsRequest.png 1166w" sizes="auto, (max-width: 984px) 100vw, 984px" /><figcaption>Phone wakes up to show waiting approval request</figcaption></figure>



<hr class="wp-block-separator"/>



<p class="wp-block-paragraph">So I tap on that message, my phone unlocks based on facial recognition, and I can approve or deny my waiting browser login&#8230;</p>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="929" height="1024" src="https://walterstovall.online/wp-content/uploads/2021/10/phoneApproves-929x1024.png?x52476" alt="" class="wp-image-10919" srcset="https://walterstovall.online/wp-content/uploads/2021/10/phoneApproves-929x1024.png 929w, https://walterstovall.online/wp-content/uploads/2021/10/phoneApproves-272x300.png 272w, https://walterstovall.online/wp-content/uploads/2021/10/phoneApproves-768x847.png 768w, https://walterstovall.online/wp-content/uploads/2021/10/phoneApproves.png 1170w" sizes="auto, (max-width: 929px) 100vw, 929px" /><figcaption>Login by just pressing approve &#8211; the waiting app finishes the login immediately</figcaption></figure>



<hr class="wp-block-separator"/>



<p class="wp-block-paragraph">At this point I&#8217;m done <img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f642.png" alt="🙂" class="wp-smiley" style="height: 1em; max-height: 1em;" /></p>



<h2 class="wp-block-heading">OK so it works good but I bet setting it up is a nightmare right?</h2>



<p class="wp-block-paragraph">Nope &#8211; it was actually painless. As an administrator I didn&#8217;t have to do <span style="text-decoration: underline;">anything</span> more than the basic server configuration I had in place where the server knows its domain name, is configured with security certificates, etc. as need for normal operation.</p>



<p class="wp-block-paragraph">After that the setup of 2FA or passwordless login is all done by the user that wants that capability.</p>



<p class="wp-block-paragraph">At the DSM desktop the user edits their account settings and has the option of setting up these login options.</p>



<hr class="wp-block-separator"/>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="727" height="295" src="https://walterstovall.online/wp-content/uploads/2021/10/personalLoginSetup.png?x52476" alt="" class="wp-image-10926" srcset="https://walterstovall.online/wp-content/uploads/2021/10/personalLoginSetup.png 727w, https://walterstovall.online/wp-content/uploads/2021/10/personalLoginSetup-300x122.png 300w" sizes="auto, (max-width: 727px) 100vw, 727px" /><figcaption>Choose passwordless, 2-Factor, or stick with user/password</figcaption></figure>



<hr class="wp-block-separator"/>



<p class="wp-block-paragraph">With either passwordless or 2FA, now you point your phone at the QR code to download the app.</p>



<hr class="wp-block-separator"/>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="559" height="240" src="https://walterstovall.online/wp-content/uploads/2021/10/scanCodeSetupPhone.png?x52476" alt="" class="wp-image-10927" srcset="https://walterstovall.online/wp-content/uploads/2021/10/scanCodeSetupPhone.png 559w, https://walterstovall.online/wp-content/uploads/2021/10/scanCodeSetupPhone-300x129.png 300w" sizes="auto, (max-width: 559px) 100vw, 559px" /><figcaption>Scan the code and Secure SignIn will download to phone</figcaption></figure>



<p class="wp-block-paragraph">There&#8217;s one more code to scan in order to point the app to your server and then you&#8217;re done.</p>



<h2 class="wp-block-heading">More to think about</h2>



<p class="wp-block-paragraph">I personally think if you have the option of getting an <em>approve</em> prompt on your phone and just pressing it is nearly as secure as true &#8220;2FA&#8221; where you type in a code you see on the phone, assuming your phone doesn&#8217;t stay unlocked of course. <span style="text-decoration: underline;">I&#8217;m no expert</span>. It does mean that somebody that knows your user id and has your unlocked phone can login without your password. It also means somebody that knows your user id and password can login, which is what 2FA is there to prevent in the first place. Be your own judge.</p>



<ul class="wp-block-list"><li>See PC Mag for a <a href="https://www.pcmag.com/picks/the-best-authenticator-apps">great review of authenticator apps</a>. Using the Synology Secure Login app, I may not need any of these (not sure yet but the codes it generates should be usable anywhere given the standards).</li><li>If you decide to set this up then don&#8217;t lock yourself out! Consider what happens when your phone is broken or dead. Various 2FA systems have ways around this. Synology will let you get codes via e-mail. And what if your e-mail is down or inaccessible too? In my case I created another admin account that I don&#8217;t use for anything but recovering another account (I can login as a different admin and go turn off 2FA for my real account). You never lock yourself out with passwordless login since you can always use your password without having the phone.</li><li>If you use a verification code, understand using an authenticator app is <a href="https://www.freecodecamp.org/news/how-time-based-one-time-passwords-work-and-why-you-should-use-them-in-your-app-fdd2b9ed43c3/">distinctly better than getting sent a SMS text code</a>. The SMS text is not secure, it takes time for the text message to reach you, and you need to have cell coverage for one thing.</li><li>For Synology servers this is <a href="https://homeautomation.academy/synology/4-steps-to-make-your-synology-nas-ultra-secure/">great article on making the server secure in general</a> not just as related to authentication.</li></ul>
<p>The post <a href="https://walterstovall.online/2021/10/14/do-you-want-two-factor-authentication-or-passwordless-login/">Do you want two factor authentication or passwordless login?</a> appeared first on <a href="https://walterstovall.online">Walter&#039;s Little World</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://walterstovall.online/2021/10/14/do-you-want-two-factor-authentication-or-passwordless-login/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>

<!--
Performance optimized by W3 Total Cache. Learn more: https://www.boldgrid.com/w3-total-cache/?utm_source=w3tc&utm_medium=footer_comment&utm_campaign=free_plugin

Object Caching 0/243 objects using APC
Page Caching using Disk: Enhanced 
Lazy Loading (feed)
Minified using Disk
Database Caching using APC

Served from: walterstovall.online @ 2026-06-06 16:22:03 by W3 Total Cache
-->