<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Posts on Barton Bytes</title><link>https://bartonbytes.com/posts/</link><description>Recent content in Posts on Barton Bytes</description><generator>Hugo -- gohugo.io</generator><language>en-us</language><lastBuildDate>Thu, 12 Oct 2023 10:52:05 -0700</lastBuildDate><atom:link href="https://bartonbytes.com/posts/index.xml" rel="self" type="application/rss+xml"/><item><title>How to Fix Aruba Clearpass Virtual Machine Losing IP Address on Restart</title><link>https://bartonbytes.com/posts/how-to-fix-aruba-clearpass-virtual-machine-losing-ip-address-on-restart/</link><pubDate>Thu, 12 Oct 2023 10:52:05 -0700</pubDate><guid>https://bartonbytes.com/posts/how-to-fix-aruba-clearpass-virtual-machine-losing-ip-address-on-restart/</guid><description>&lt;h2 id="resolve-aruba-clearpass-108-on-hyper-v-losing-its-ip-address-after-being-shut-down">Resolve Aruba Clearpass 10.8 on Hyper-V Losing It&amp;rsquo;s IP Address After Being Shut Down&lt;/h2>
&lt;hr>
&lt;p>We were running Aruba Clearpass version 10.8 as a Hyper-V virtual machine when we encountered the following problem: after the VM was shut down or restarted, the Clearpass server would lose it&amp;rsquo;s IP address, and it would have to be manually re-added.&lt;/p>
&lt;p>This caused some serious issues when it came to syncing, because for some reason, our Clearpass subscriber couldn&amp;rsquo;t connect to the publisher, and so would refuse to add the IP address. This would necessitate rolling the subscriber back to a previous snapshot in order to restore the IP address.&lt;/p>
&lt;p>I found some &lt;a href="https://community.arubanetworks.com/discussion/clearpass-hyper-v-loses-mgmt-ip-after-reboot">community support threads&lt;/a> about the issue, but the suggested fixes weren&amp;rsquo;t working. Finally I figured out that the suggested steps had to be done in a very specific order.&lt;/p>
&lt;p>Here are the steps I took to fix the issue of Aruba Clearpass losing it&amp;rsquo;s management IP address:&lt;/p>
&lt;ol>
&lt;li>
&lt;p>Drop subscribers from the publisher&lt;/p>
&lt;/li>
&lt;li>
&lt;p>Shut down Clearpass virtual machine&lt;/p>
&lt;/li>
&lt;li>
&lt;p>Delete the Hyper-V network interfaces on the virtual machine and re-add them&lt;/p>
&lt;/li>
&lt;li>
&lt;p>Start the VM and configure the management IP address&lt;/p>
&lt;/li>
&lt;li>
&lt;p>Shut down the VM and change the network interfaces from &lt;strong>Dynamic&lt;/strong> to &lt;strong>Static&lt;/strong> under &amp;ldquo;Advanced Features&amp;rdquo;&lt;/p>
&lt;/li>
&lt;li>
&lt;p>Start the VM and configure the management IP address&lt;/p>
&lt;/li>
&lt;li>
&lt;p>Run the following command: &lt;code>system refresh-network&lt;/code>&lt;/p>
&lt;/li>
&lt;li>
&lt;p>Restart the VM one last time&lt;/p>
&lt;/li>
&lt;/ol>
&lt;p>After doing the tasks in this specific order, our Aruba Clearpass virtual machines stopped losing their IP address on shutdown.&lt;/p></description></item><item><title>SPF Record Configuration</title><link>https://bartonbytes.com/posts/spf-record-configuration/</link><pubDate>Sun, 27 Aug 2023 15:07:05 -0700</pubDate><guid>https://bartonbytes.com/posts/spf-record-configuration/</guid><description>&lt;hr>
&lt;h2 id="title-mastering-spf-record-configuration-a-step-by-step-guide">&lt;strong>Title: Mastering SPF Record Configuration: A Step-by-Step Guide&lt;/strong>&lt;/h2>
&lt;hr>
&lt;p>In today&amp;rsquo;s digital landscape, email authentication has become a critical aspect of cybersecurity. Among the various techniques, SPF (Sender Policy Framework) stands out as an essential tool to prevent email spoofing and phishing attacks. By configuring SPF records correctly, you can safeguard your domain&amp;rsquo;s reputation and ensure that your legitimate emails reach their intended recipients. In this guide, we&amp;rsquo;ll take you through the process of configuring an SPF record step by step.&lt;/p>
&lt;p>&lt;strong>What is SPF?&lt;/strong>&lt;/p>
&lt;p>Sender Policy Framework (SPF) is an email authentication protocol that helps verify whether the sender of an email is authorized to send messages on behalf of a specific domain. It works by specifying which IP addresses or servers are allowed to send emails from your domain. When an email server receives a message, it checks the SPF record to determine if the sending server is allowed to send on behalf of the domain.&lt;/p>
&lt;h3 id="step-by-step-guide-to-configuring-spf-records">Step-by-Step Guide to Configuring SPF Records:&lt;/h3>
&lt;p>&lt;strong>Step 1: Understand Your Email Infrastructure&lt;/strong>&lt;/p>
&lt;p>Before configuring an SPF record, it&amp;rsquo;s important to understand your email infrastructure. Identify all the servers, services, and third-party applications that send emails from your domain. This could include your main email server, marketing automation platforms, and customer support tools.&lt;/p>
&lt;p>&lt;strong>Step 2: Create Your SPF Record&lt;/strong>&lt;/p>
&lt;ol>
&lt;li>
&lt;p>&lt;strong>Log in to Your DNS Hosting Provider:&lt;/strong> Access your domain&amp;rsquo;s DNS settings through your hosting provider&amp;rsquo;s control panel.&lt;/p>
&lt;/li>
&lt;li>
&lt;p>&lt;strong>Navigate to SPF Settings:&lt;/strong> Look for an option to manage DNS records or add SPF records. This might be labeled as &amp;ldquo;DNS Management,&amp;rdquo; &amp;ldquo;DNS Records,&amp;rdquo; or &amp;ldquo;Zone Editor.&amp;rdquo;&lt;/p>
&lt;/li>
&lt;li>
&lt;p>&lt;strong>Create a New SPF Record:&lt;/strong> Add a new TXT record. The Name/Host field can be left blank or set to &amp;ldquo;@&amp;rdquo; to signify your root domain.&lt;/p>
&lt;/li>
&lt;li>
&lt;p>&lt;strong>Configure the SPF Syntax:&lt;/strong> The SPF record is defined using a simple syntax. It typically begins with &amp;ldquo;v=spf1&amp;rdquo; (version 1 of the SPF protocol). After that, you specify the allowed sending mechanisms:&lt;/p>
&lt;ul>
&lt;li>
&lt;p>&lt;strong>IP Addresses:&lt;/strong> You can include specific IP addresses or ranges that are authorized to send emails on your behalf. For example: &amp;ldquo;ip4:192.168.1.1&amp;rdquo; or &amp;ldquo;ip6:2001:db8::1&amp;rdquo;.&lt;/p>
&lt;/li>
&lt;li>
&lt;p>&lt;strong>Include Mechanism:&lt;/strong> If you&amp;rsquo;re using third-party services to send emails, they might provide you with an include mechanism. For example: &amp;ldquo;include:_spf.example.com&amp;rdquo;.&lt;/p>
&lt;/li>
&lt;li>
&lt;p>&lt;strong>All Mechanism:&lt;/strong> You might conclude your SPF record with &amp;ldquo;-all&amp;rdquo;, which means that all other servers not explicitly mentioned are not allowed to send emails from your domain.&lt;/p>
&lt;/li>
&lt;/ul>
&lt;/li>
&lt;li>
&lt;p>&lt;strong>Putting It Together:&lt;/strong> Your SPF record might look something like this:&lt;/p>
&lt;pre tabindex="0">&lt;code>v=spf1 ip4:192.168.1.1 include:_spf.example.com -all
&lt;/code>&lt;/pre>&lt;/li>
&lt;li>
&lt;p>&lt;strong>Save the Record:&lt;/strong> Once you&amp;rsquo;ve entered the SPF syntax, save the DNS record.&lt;/p>
&lt;/li>
&lt;/ol>
&lt;p>&lt;strong>Step 3: Monitor and Test&lt;/strong>&lt;/p>
&lt;p>After configuring your SPF record, it&amp;rsquo;s important to monitor its effectiveness and test its functionality:&lt;/p>
&lt;ol>
&lt;li>
&lt;p>&lt;strong>Use SPF Testing Tools:&lt;/strong> There are online SPF testing tools available that can help you validate your SPF record&amp;rsquo;s correctness. These tools simulate how receiving mail servers will interpret your SPF record.&lt;/p>
&lt;/li>
&lt;li>
&lt;p>&lt;strong>Observe Email Delivery:&lt;/strong> Keep an eye on your email delivery after implementing the SPF record. If configured incorrectly, it might lead to email delivery issues. Make sure your legitimate emails are reaching recipients as expected.&lt;/p>
&lt;/li>
&lt;/ol>
&lt;p>&lt;strong>Conclusion: Secure Your Domain with SPF&lt;/strong>&lt;/p>
&lt;p>Configuring an SPF record is a crucial step in bolstering your domain&amp;rsquo;s email authentication and preventing unauthorized senders from using your domain name for phishing or spam. By following this step-by-step guide, you can establish a strong foundation for email security and ensure that your legitimate communications are trusted by email providers. Remember that email authentication is an ongoing process, and it&amp;rsquo;s important to regularly review and update your SPF record as your email infrastructure evolves.&lt;/p></description></item><item><title>How to Configure CoreDNS for DNS Over TLS</title><link>https://bartonbytes.com/posts/how-to-configure-coredns-for-dns-over-tls/</link><pubDate>Tue, 07 Jan 2020 21:59:57 -0800</pubDate><guid>https://bartonbytes.com/posts/how-to-configure-coredns-for-dns-over-tls/</guid><description>&lt;hr>
&lt;h2 id="coredns-makes-dns-over-tls-easy-to-implement">CoreDNS makes DNS-over-TLS easy to implement&lt;/h2>
&lt;hr>
&lt;!-- raw HTML omitted -->
&lt;p>In this tutorial, we&amp;rsquo;re going to run CoreDNS in Docker containers. One container will listen for standard DNS queries
on port 53, and it will resolve these queries using DNS-over-TLS upstream. Another container will listen for DNS-over-TLS
queries on port 853, and will resolve these queries using standard DNS.&lt;/p>
&lt;p>I&amp;rsquo;m going to assume that you have an intermediate DNS server, like a Pi-Hole, which will cache responses and filter out
ads. We&amp;rsquo;ll set everything up so that your Pi-Hole will forward queries to the container that encrypts our upstream
queries using DNS-over-TLS, and the container that listens for DoT will forward queries to our Pi-Hole for filtering.&lt;/p>
&lt;p>&lt;img src="https://bartonbytes.com/img/coredns/coredns.png" alt="Diagram">&lt;/p>
&lt;p>I would highly recommend running these containers on an x86_64 machine, since it will be much simpler than trying to
run them on an ARM machine like a Raspberry Pi. This guide will not work on a Raspberry Pi: you&amp;rsquo;ll need to make some
tweaks to get it functional.&lt;/p>
&lt;p>To start, make sure that both Docker and docker-compose are installed on your system. You can learn how to install
Docker &lt;a href="https://docs.docker.com/install/linux/docker-ce/debian/#install-using-the-convenience-script">here.&lt;/a>&lt;/p>
&lt;p>And, assuming that you&amp;rsquo;re on a Debian-based machine:&lt;/p>
&lt;p>&lt;code>sudo apt install -y docker-compose&lt;/code>&lt;/p>
&lt;p>Now, let&amp;rsquo;s clone the repository that contains some config files we&amp;rsquo;ll use:&lt;/p>
&lt;p>&lt;code>git clone https://github.com/gdbarton/simple-coredns-tls.git &amp;amp;&amp;amp; cd simple-coredns-tls&lt;/code>&lt;/p>
&lt;p>Let&amp;rsquo;s look through the config files and verify that everything is accurate for your purposes.&lt;/p>
&lt;p>First, the coreconfig-up file. You can change the upstream server if you&amp;rsquo;d like, or lengthen the cache if you&amp;rsquo;re not
using a Pi-Hole:&lt;/p>
&lt;pre tabindex="0">&lt;code>. {
forward . tls://9.9.9.9 tls://149.112.112.112 {
tls_servername dns.quad9.net
health_check 10s
}
cache 60
}
&lt;/code>&lt;/pre>&lt;p>Now the coreconfig-down file. Make sure to change the &amp;lsquo;forward&amp;rsquo; address to that of your Pi-Hole (or any other standard
DNS server):&lt;/p>
&lt;pre tabindex="0">&lt;code>tls://.:853 {
tls /etc/coredns/cert.pem /etc/coredns/key.pem /etc/coredns/ca.pem
forward . 192.168.0.2:53
log
}
&lt;/code>&lt;/pre>&lt;p>You&amp;rsquo;ll notice that the coreconfig-down contains a cert, key, and CA. You can follow a guide like &lt;a href="https://docs.oracle.com/cd/E17952_01/mysql-5.0-en/creating-ssl-files-using-openssl.html">this&lt;/a>
to make one, or you can generate it using the &lt;code>configure.sh&lt;/code> file that I provided (must be run with &lt;code>sudo&lt;/code>). You can hit Enter on all of the
prompts without entering any information.&lt;/p>
&lt;p>If you don&amp;rsquo;t use my &lt;code>configure.sh&lt;/code> script, make sure you move the coreconfig files and the three &lt;code>.pem&lt;/code> files into the
&lt;code>/etc/coredns&lt;/code> directory, and that they all have the correct names.&lt;/p>
&lt;p>Finally, check the docker-compose.yml file. If you&amp;rsquo;re running CoreDNS on the same server as another DNS server, you&amp;rsquo;ll
need to change the two 53s before the colons (on lines 6 and 7) to a different number, like 5553:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-yaml" data-lang="yaml">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f92672">version&lt;/span>: &lt;span style="color:#e6db74">&amp;#34;3&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f92672">services&lt;/span>:
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#f92672">forwarder&lt;/span>:
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#f92672">image&lt;/span>: &lt;span style="color:#e6db74">&amp;#34;coredns/coredns&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#f92672">ports&lt;/span>:
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> - &lt;span style="color:#e6db74">&amp;#34;53:53/udp&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> - &lt;span style="color:#e6db74">&amp;#34;53:53&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#f92672">volumes&lt;/span>:
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> - &lt;span style="color:#e6db74">&amp;#34;/etc/coredns/:/etc/coredns/&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#f92672">command&lt;/span>: -&lt;span style="color:#ae81ff">conf /etc/coredns/coreconfig-up&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#f92672">restart&lt;/span>: &lt;span style="color:#ae81ff">always&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#f92672">container_name&lt;/span>: &lt;span style="color:#ae81ff">coredns_up&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#f92672">listener&lt;/span>:
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#f92672">image&lt;/span>: &lt;span style="color:#e6db74">&amp;#34;coredns/coredns&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#f92672">ports&lt;/span>:
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> - &lt;span style="color:#e6db74">&amp;#34;853:853&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#f92672">volumes&lt;/span>:
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> - &lt;span style="color:#e6db74">&amp;#34;/etc/coredns/:/etc/coredns/&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#f92672">command&lt;/span>: -&lt;span style="color:#ae81ff">conf /etc/coredns/coreconfig-down&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#f92672">restart&lt;/span>: &lt;span style="color:#ae81ff">always&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#f92672">container_name&lt;/span>: &lt;span style="color:#ae81ff">coredns_down&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>Once everything is verified and in the right place, we can bring up the containers:&lt;/p>
&lt;p>&lt;code>docker-compose up -d&lt;/code>&lt;/p>
&lt;h3 id="verify-that-it-works">Verify That It Works&lt;/h3>
&lt;p>We need to start by installing the program &lt;code>kdig&lt;/code>, which will let us test our new DNS containers. On Debian, run:&lt;/p>
&lt;p>&lt;code>sudo apt install -y knot-dnsutils&lt;/code>&lt;/p>
&lt;p>Let&amp;rsquo;s verify that the forwarder is resolving DNS queries. From your client machine or Pi-hole, run this:&lt;/p>
&lt;p>&lt;code>kdig @IP -p PORT yahoo.jp&lt;/code>&lt;/p>
&lt;p>&amp;hellip;where IP is the IPv4 address of your CoreDNS machine, and PORT is the leftmost port you listed in the docker-compose
file for the forwarder container.&lt;/p>
&lt;p>If the DNS resolves correctly, we can point all of the machines on our network to the CoreDNS forwarder. In the Pi-hole
web GUI, hit &lt;code>Settings&lt;/code> on the left, followed by &lt;code>DNS&lt;/code> at the top. Under &lt;code>Upstream DNS Servers Custom 1&lt;/code>, enter the IP
address and port of your CoreDNS forwarder (the same IP and port we used in our dig command above):&lt;/p>
&lt;p>&lt;img src="https://bartonbytes.com/img/coredns/pihole_coredns.png" alt="Pihole">&lt;/p>
&lt;p>Finally, we need to test the listener container. Again from your client machine or Pi-hole, run a &lt;code>kdig&lt;/code> command:&lt;/p>
&lt;p>&lt;code>kdig @IP +tls example.com&lt;/code>&lt;/p>
&lt;p>You can configure DNS-over-TLS on your client by using a program like &lt;a href="https://github.com/AdguardTeam/dnsproxy">dnsproxy&lt;/a>&lt;/p>
&lt;p>If both of your &lt;code>kdig&lt;/code> commands return addresses, then congratulations, your CoreDNS containers are working properly!&lt;/p></description></item><item><title>Create a Free Website With Github Pages and Hugo</title><link>https://bartonbytes.com/posts/create-a-free-website-with-github-pages-and-hugo/</link><pubDate>Fri, 26 Jul 2019 16:52:25 -0700</pubDate><guid>https://bartonbytes.com/posts/create-a-free-website-with-github-pages-and-hugo/</guid><description>&lt;h2 id="a-quick-guide-to-writing-and-hosting-a-website-for-0-in-cost">A quick guide to writing and hosting a website for $0 in cost&lt;/h2>
&lt;hr>
&lt;p>Making your own website may seem like a lost art, but it&amp;rsquo;s easier than ever to create a free, no-strings-attached
website.&lt;/p>
&lt;p>We&amp;rsquo;ll be using the Hugo static site generator, which allows us to write Markdown that gets translated into HTML/CSS. Our
generated HTML/CSS get stored into a git repository on Github. &lt;a href="https://pages.github.com/">Github Pages&lt;/a> will make this
repository available as a fully-fledged website, complete with HTTPS and the option to add a custom domain name. We&amp;rsquo;ll go
through the process step-by-step.&lt;/p>
&lt;h4 id="installing-hugo-and-starting-our-project">Installing Hugo and Starting Our Project&lt;/h4>
&lt;p>I&amp;rsquo;ll be assuming that you&amp;rsquo;re using Debian GNU/Linux. Everything should be able to be done on Linux, Windows, and OS X, but
specific commands and configurations will vary.&lt;/p>
&lt;p>To begin, install Hugo server from your distro&amp;rsquo;s repositories:&lt;/p>
&lt;p>&lt;code>sudo apt install hugo -y&lt;/code>&lt;/p>
&lt;p>You can also download the binaries, which are likely a more recent version, from
the &lt;a href="https://github.com/gohugoio/hugo/releases">Hugo Github repo&lt;/a>.&lt;/p>
&lt;p>Navigate to the directory where we want to store our project, and then run this command:&lt;/p>
&lt;p>&lt;code>hugo new site yoursitename &amp;amp;&amp;amp; cd yoursitename&lt;/code>&lt;/p>
&lt;!-- raw HTML omitted -->
&lt;p>Now, we need to add a theme. Let&amp;rsquo;s go with the &lt;a href="https://github.com/enten/hyde-y">Hyde-Y theme&lt;/a> from Enten. Navigate into
the &lt;code>themes&lt;/code> directory of your project, and then clone the theme into this directory, using the following commands:&lt;/p>
&lt;p>&lt;code>cd themes &amp;amp;&amp;amp; git clone https://github.com/enten/hyde-y.git&lt;/code>&lt;/p>
&lt;p>Now, we need to edit our config.toml file to tell it our domain name and which theme to use. Here&amp;rsquo;s what mine looks like:&lt;/p>
&lt;!-- raw HTML omitted -->
&lt;p>At this point, we can check out what our site look like. From our project&amp;rsquo;s root directory, run &lt;code>hugo server&lt;/code>. Open up
a web browser and go to &lt;code>http://localhost:1313&lt;/code>&lt;/p>
&lt;!-- raw HTML omitted -->
&lt;p>Hmm, that doesn&amp;rsquo;t look quite right. Each Hugo theme is slightly different, and this one expects files at both &lt;code>data/Menu.toml&lt;/code>
and &lt;code>data/FootMenu.toml&lt;/code>, as well as some extra settings in &lt;code>config.toml&lt;/code>. Assuming we don&amp;rsquo;t cancel &lt;code>hugo server&lt;/code> while
we edit and save those files, the web page in our browser will automatically update with our changes.&lt;/p>
&lt;!-- raw HTML omitted -->
&lt;!-- raw HTML omitted -->
&lt;p>Much better! Let&amp;rsquo;s add one post before we share our website with the world. From the project root, run&lt;/p>
&lt;p>&lt;code>mkdir content/post &amp;amp;&amp;amp; hugo new content/post/&amp;quot;Welcome to My New Blog.md&amp;quot;&lt;/code>&lt;/p>
&lt;p>Add whatever text you&amp;rsquo;d like, and make sure to switch &lt;code>Draft: true&lt;/code> to &lt;code>Draft: false&lt;/code>. Here&amp;rsquo;s what my post looks like:&lt;/p>
&lt;!-- raw HTML omitted -->
&lt;p>If you&amp;rsquo;ve been checking out your site while running &lt;code>hugo server&lt;/code>, you may have noticed that your links, like About, lead
to a &amp;lsquo;404 not found&amp;rsquo; message. We can create this page in the same way we made the post, by running:&lt;/p>
&lt;p>&lt;code>hugo new about.md&lt;/code>&lt;/p>
&lt;p>The About page is created under content/. Like with our post, make sure to switch it to &lt;code>Draft: false&lt;/code>.&lt;/p>
&lt;h4 id="github-pages">Github Pages&lt;/h4>
&lt;p>Awesome! We&amp;rsquo;re done making our website, but no one can see it until we deploy using Github pages. Obviously, you want a
Github account. On the Github website, create a repository named &lt;code>your_github_username.github.io&lt;/code>. Clone this repo into
the root of our Hugo site. Then, run the following:&lt;/p>
&lt;p>&lt;code>hugo -d your_github_username.github.io&lt;/code>&lt;/p>
&lt;p>cd into that same repo, then commit &amp;amp; push.&lt;/p>
&lt;p>After that, then&amp;hellip; just kidding! That&amp;rsquo;s it; you&amp;rsquo;re done. Wait a few minutes, and your website will be online at
&lt;a href="http://your_github_username.github.io">http://your_github_username.github.io&lt;/a> . From here, you can enable HTTPS, add a custom domain name, and make new posts on
your blog!&lt;/p></description></item><item><title>Tmux for Beginners</title><link>https://bartonbytes.com/posts/tmux-for-beginners/</link><pubDate>Fri, 21 Dec 2018 11:22:27 -0800</pubDate><guid>https://bartonbytes.com/posts/tmux-for-beginners/</guid><description>&lt;h2 id="a-quick-intro-to-using-and-configuring-tmux">A quick intro to using and configuring tmux&lt;/h2>
&lt;hr>
&lt;!-- raw HTML omitted -->
&lt;p>Tmux, short for Terminal Multiplexer, is a wonderful program that many Linux novices are unfortunately unaware of. Learning how to use Tmux will greatly improve your comfort and efficacy at the command line.&lt;/p>
&lt;p>If you&amp;rsquo;re running Linux, Tmux should be available from your distribution&amp;rsquo;s repositories. On Debian / Ubuntu, you can run &lt;code>$ sudo apt install tmux -y&lt;/code> to install.&lt;/p>
&lt;h3 id="configuration">Configuration&lt;/h3>
&lt;hr>
&lt;!-- raw HTML omitted -->
&lt;p>&lt;code>$ vim ~/.tmux.conf&lt;/code>&lt;/p>
&lt;p>The following is my own tmux.conf file. If you want to pull the file, here&amp;rsquo;s the direct link:&lt;/p>
&lt;p>&lt;a href="https://bartonbytes.com/tmux.conf">https://bartonbytes.com/tmux.conf&lt;/a>&lt;/p>
&lt;pre tabindex="0">&lt;code class="language-#" data-lang="#">set-option -g prefix C-q
# alt prefix:
#set-option -g prefix C-e
unbind C-b
# rebind split pane commands
bind | split-window -h
bind - split-window -v
unbind &amp;#39;&amp;#34;&amp;#39;
unbind %
# move status bar to top of terminal
set-option -g status-position top
# set background to cyan
set-option -g status-bg cyan
# alt color:
#set-option -g status-bg red
#set-option -g status-fg white
# set current window background to yellow
set-window-option -g window-status-current-style bg=yellow
# alt color:
#set-window-option -g window-status-current-bg black
# increase history limit
set-option -g history-limit 500
# increase status message display time to 2 seconds
set-option -g display-time 2000
# set base index to 1 (instead of 0)
set-option -g base-index 1
set-window-option -g pane-base-index 1
# 256 color terminal
set -g default-terminal &amp;#34;screen-256color&amp;#34;
# add &amp;#34;control + r&amp;#34; keybinding to reload tmux config
unbind r
bind r source-file ~/.tmux.conf \; display &amp;#34;RE- RE- RELOADED!!!&amp;#34;
&lt;/code>&lt;/pre>&lt;p>The config file allows comments prefaced by the pound sign. My comments explain what each line does, but I&amp;rsquo;ll explain a bit more.&lt;/p>
&lt;p>By default, the preface to each Tmux command is Control-b. I prefer Control-q, but you should set this to whatever is most comfortable for you, since you&amp;rsquo;ll be using it a lot.&lt;/p>
&lt;p>The status-bg option sets the color of the Tmux status bar. The status-fg option sets the color of the text- by default, this is black. The window-status-current-bg sets the color of the current window, so it should be something that contrasts well with the status-bg.&lt;/p>
&lt;p>The final option sets our reload command. This means that we can hit Control-q + Control-r to reload Tmux after editing our config, rather than quitting and restarting.&lt;/p>
&lt;p>You&amp;rsquo;ll notice that I have a few commented-out lines marked &amp;ldquo;alt&amp;rdquo;. These are the configs that I use on servers that I ssh into. If we use the same prefix key on both machines, we&amp;rsquo;d have to hit Control-q twice before entering a command for the server, which is annoying. It&amp;rsquo;s also nice to use different colors so that we can easily tell the difference between each session.&lt;/p>
&lt;p>My config file only touches on a couple of the available options. For more inspiration, there are plenty of config file examples available online. Do a web search for &amp;ldquo;.tmux.conf&amp;rdquo; or &amp;ldquo;tmux configuration&amp;rdquo; to find some.&lt;/p>
&lt;h3 id="important-commands">Important Commands&lt;/h3>
&lt;hr>
&lt;!-- raw HTML omitted -->
&lt;p>After starting Tmux, our terminal will look like this: &lt;!-- raw HTML omitted -->&lt;/p>
&lt;p>&lt;img src="https://bartonbytes.com/img/tmuxintro/example1.png" alt="example1">&lt;/p>
&lt;p>This is our first window. We know that it&amp;rsquo;s currently active because the background is highlighted in a different color. We can run an arbitrary command here- let&amp;rsquo;s run &lt;code>htop&lt;/code>, so that we can keep track of our resource usage. Then, we should make a new window. This is done by hitting our prefix + c. For us, that means &lt;code>C-q + c&lt;/code> (remember, capital C refers to the control key).&lt;/p>
&lt;p>We can switch to a different window by hitting the prefix + # of the window. Since our htop window is window number 1, we should hit &lt;code>C-q + 1&lt;/code> to switch back to it.&lt;/p>
&lt;p>Now, we should see this: &lt;!-- raw HTML omitted -->&lt;/p>
&lt;p>&lt;img src="https://bartonbytes.com/img/tmuxintro/example2.png" alt="example2">&lt;/p>
&lt;p>Yeah, this is neat and all, but how do I split up my terminal so I can do stuff side-by-side like all those cool Linux power users?? Don&amp;rsquo;t worry, that&amp;rsquo;s also easy, especially since we changed our default commands to make them easier to remember.&lt;/p>
&lt;p>To split a window horizontally into two panes, hit &lt;code>C-q + |&lt;/code> - that&amp;rsquo;s the pipe character, probably located above your enter key. To split vertically, hit &lt;code>C-q + -&lt;/code> - that&amp;rsquo;s the dash key, between zero and the = sign.&lt;/p>
&lt;p>To switch back and forth between panes, hit the prefix plus an arrow key, the arrow key being the direction of the pane that we want to switch to. For example, after splitting horizontally, we can hit &lt;code>C-q + Left&lt;/code> to switch back to the left pane. Try switching back and forth between your panes.&lt;/p>
&lt;p>Once we&amp;rsquo;ve split a window, we can also adjust the sizes of each pane. To do so, hold down the prefix (C-q) while hitting the arrow key of the direction we want to move the pane. Try doing this a few times.&lt;/p>
&lt;p>We can make our window look something like below. The top right program is &lt;code>tmux clock&lt;/code>. The bottom right is &lt;code>cmatrix&lt;/code>, which is likely in your distro&amp;rsquo;s repository.&lt;/p>
&lt;p>&lt;img src="https://bartonbytes.com/img/tmuxintro/example3.png" alt="example3">&lt;/p>
&lt;p>To close a single pane, use &lt;code>C-q + x&lt;/code> while inside the pane. To kill the whole window, use &lt;code>C-q + &amp;amp;&lt;/code>.&lt;/p>
&lt;p>Try killing the two panes on the right. Now, kill the whole window.&lt;/p>
&lt;p>You&amp;rsquo;ll notice that our second window is still Window 2. If we open a new window using &lt;code>C-q + c&lt;/code>, it will place itself in the lowest available position- in this case, Window 1. Until then, there simply won&amp;rsquo;t be any Window 1.&lt;/p>
&lt;p>To kill all of our current tmux sessions and exit tmux, simply enter the command&lt;/p>
&lt;p>&lt;code>$ tmux kill-server&lt;/code>&lt;/p>
&lt;p>For more commands, check out &lt;a href="https://tmuxcheatsheet.com/" title="Tmux Cheatsheet">this useful site&lt;/a>. You can also refer to the Tmux manual; just run &lt;code>$ man tmux&lt;/code>&lt;/p>
&lt;h3 id="using-tmux-remotely">Using Tmux Remotely&lt;/h3>
&lt;hr>
&lt;!-- raw HTML omitted -->
&lt;p>Start off by running Tmux on our local host. Now, SSH into our remote server. Install Tmux and create a &lt;code>.tmux.conf&lt;/code> file, just like we did before. I highly recommend uncommenting my &amp;ldquo;alt&amp;rdquo; options, and commenting out the relevant older options. Now, we can finally start Tmux on our remote host. Our terminal will look something like this:&lt;/p>
&lt;p>&lt;img src="https://bartonbytes.com/img/tmuxintro/example4.png" alt="example4">&lt;/p>
&lt;p>Cool, our remote Tmux session is nested inside of our local session. I can hit &lt;code>C-q + c&lt;/code> to open up a new window on my local machine, or &lt;code>C-e + c&lt;/code> to open up a new window on my remote machine. If I use &lt;code>C-q + 1&lt;/code> to switch to a different window than my SSH session, then hitting &lt;code>C-e + anything&lt;/code> won&amp;rsquo;t have any effect, since we&amp;rsquo;re not focused on the remote Tmux session any more.&lt;/p>
&lt;p>If we forgot to edit our config file, and used the same one on both machines, we might be a bit confused. Since both of our Tmux sessions have the same prefix, we&amp;rsquo;ll have to enter it twice to pass through to the inside Tmux session. In order to open a new window in our remote session, we&amp;rsquo;d have to hit &lt;code>C-q + C-q + c&lt;/code>. Our terminal would also look something like this:&lt;/p>
&lt;p>&lt;img src="https://bartonbytes.com/img/tmuxintro/example5.png" alt="example5">&lt;/p>
&lt;p>We can still use Tmux like this, but it&amp;rsquo;s a lot simpler if we use different configurations on each machine.&lt;/p>
&lt;p>So, we&amp;rsquo;ve made sure to change our config, and we&amp;rsquo;ve done some work in our remote session, but now we have to take a break. With Tmux, it&amp;rsquo;s easy to save our session and return to it later.&lt;/p>
&lt;p>In our remote session, we can run the following command: &lt;!-- raw HTML omitted -->&lt;/p>
&lt;p>&lt;code>$ tmux detach-client&lt;/code>&lt;/p>
&lt;p>We can now exit our SSH session and re-connect later. To start up our saved Tmux session, we enter: &lt;!-- raw HTML omitted -->&lt;/p>
&lt;p>&lt;code>$ tmux attach-session -t 0&lt;/code>&lt;/p>
&lt;p>Notice that the session numbering began at zero. By default, the window numbering also begins at zero, but we changed this to one in our config file because the 1 key is easier to reach than the 0 key.&lt;/p>
&lt;p>As you might have guessed, we can have more than one session running at a time. To create a new session, run the following while not inside a Tmux session: &lt;!-- raw HTML omitted -->&lt;/p>
&lt;p>&lt;code>$ tmux new-session&lt;/code>&lt;/p>
&lt;p>We can see the name of our current session on the far right side of the status bar. It will be located between two square brackets []. Although sessions will default to being named a number, incrementing from zero, we can also set our own names by using the -s flag: &lt;!-- raw HTML omitted -->&lt;/p>
&lt;p>&lt;code>$ tmux new-session -s name&lt;/code>&lt;/p>
&lt;p>Here&amp;rsquo;s what this new session would look like: &lt;!-- raw HTML omitted -->&lt;!-- raw HTML omitted -->&lt;/p>
&lt;p>&lt;img src="https://bartonbytes.com/img/tmuxintro/example6.png" alt="example6">&lt;/p>
&lt;p>We can detach and re-attach this session the same way we did with session 0.&lt;/p>
&lt;p>If you forget what you&amp;rsquo;ve named your previous sessions, don&amp;rsquo;t worry. You can find them with this:&lt;/p>
&lt;p>&lt;code>$ tmux list-sessions&lt;/code>&lt;/p>
&lt;p>Killing a session is easy too. If you&amp;rsquo;re inside the session that you want to kill it&amp;rsquo;s as simple as&lt;/p>
&lt;p>&lt;code>$ tmux kill-session&lt;/code>&lt;/p>
&lt;p>If we want to kill a different session, use the -t flag:&lt;/p>
&lt;p>&lt;code>$ tmux kill-session -t name&lt;/code>&lt;/p>
&lt;p>To kill all sessions at once, we can simply kill the server:&lt;/p>
&lt;p>&lt;code>$ tmux kill-server&lt;/code>&lt;/p>
&lt;p>This is all you need to take advantage of Tmux, but there are many more commands and configuration options available. If you&amp;rsquo;re interested in a more detailed introduction, I highly recommend the book &lt;a href="https://www.packtpub.com/hardware-and-creative/getting-started-tmux" title="Getting Started with Tmux Packt Pub">Getting Started with Tmux&lt;/a> by Victor Quinn.&lt;/p></description></item><item><title>Configure Pi Hole for DNS Over TLS</title><link>https://bartonbytes.com/posts/configure-pi-hole-for-dns-over-tls/</link><pubDate>Thu, 02 Aug 2018 22:22:11 -0700</pubDate><guid>https://bartonbytes.com/posts/configure-pi-hole-for-dns-over-tls/</guid><description>&lt;h2 id="protect-your-dns-traffic-from-snooping-with-dot">Protect your DNS traffic from snooping with DoT&lt;/h2>
&lt;hr>
&lt;!-- raw HTML omitted -->
&lt;p>Pi-hole is a wonderful program for both technical and non-technical users to run a local DNS caching server, allowing you to block malicious and ad-serving domains.
One of the fundamental flaws of DNS is the lack of encryption or integrity, which allows your ISP to snoop DNS traffic or spoof a DNS response.
DNS-over-TLS will not completely solve these problems (see the end of this tutorial), but it provides a step in the right direction. Let&amp;rsquo;s get started.&lt;/p>
&lt;p>Pi-hole uses a fork of dnsmasq as it&amp;rsquo;s DNS server. To use DoT, we will actually need to run an additional DNS server,
Unbound, that provides this feature. (If you want to use CoreDNS instead, check out &lt;a href="https://bartonbytes.com/posts/how-to-configure-coredns-for-dns-over-tls/">my other guide&lt;/a>)
To install on a Debian-based system, run the following:&lt;/p>
&lt;p>&lt;code>sudo apt install -y unbound dnsutils&lt;/code>&lt;/p>
&lt;p>Once installed, run the following command to grab a configuration file:&lt;/p>
&lt;p>&lt;code>sudo wget https://bartonbytes.com/pihole.txt -O /etc/unbound/conf.d/pihole.conf&lt;/code>&lt;/p>
&lt;p>Here&amp;rsquo;s &lt;a href="../../pihole.txt">a link to the file&lt;/a>, and a copy of the contents here:&lt;/p>
&lt;pre tabindex="0">&lt;code>## DNS Over TLS, Simple ENCRYPTED recursive caching DNS, TCP port 853
## unbound.conf -- original at https://calomel.org/unbound\_dns.html
## tweaks by bartonbytes.com
server:
access-control: 127.0.0.0/8 allow
cache-max-ttl: 14400
cache-min-ttl: 600
do-tcp: yes
hide-identity: yes
hide-version: yes
interface: 127.0.0.1
minimal-responses: yes
prefetch: yes
qname-minimisation: yes
rrset-roundrobin: yes
ssl-upstream: yes
use-caps-for-id: yes
verbosity: 1
port: 5533
#
forward-zone:
name: &amp;#34;.&amp;#34;
forward-addr: 9.9.9.9@853 # quad9.net primary
forward-addr: 1.1.1.1@853 # cloudflare primary
forward-addr: 149.112.112.112@853 # quad9.net secondary
forward-addr: 1.0.0.1@853 # cloudflare secondary
&lt;/code>&lt;/pre>&lt;p>You&amp;rsquo;ll notice that this DNS server is configured to be accessible only on the local machine. It will open up port 5533. The config file includes the
Quad9 and Cloudflare upstream DNS servers, which you can change or add to if necessary.&lt;/p>
&lt;p>Make sure that Unbound is running:&lt;/p>
&lt;p>&lt;code>sudo systemctl restart unbound &amp;amp;&amp;amp; sudo systemctl enable unbound&lt;/code>&lt;/p>
&lt;p>To test that Unbound can fulfill your DNS requests, run the following &lt;code>dig&lt;/code> command:&lt;/p>
&lt;p>&lt;code>dig @127.0.0.1 example.com -p 5533&lt;/code>&lt;/p>
&lt;p>Now, we need to tell Pi-hole&amp;rsquo;s dnsmasq to use this local port as it&amp;rsquo;s upstream DNS server. In the GUI, go to Settings -&amp;gt; DNS,
and set a custom IPv4 server with the value &lt;code>127.0.0.1#5533&lt;/code>&lt;/p>
&lt;p>&lt;img src="https://bartonbytes.com/img/dot/dns_setting.png" alt="dns_setting">&lt;/p>
&lt;p>Now we must restart Pi-hole:&lt;/p>
&lt;p>&lt;code>sudo systemctl restart pihole-FTL&lt;/code>&lt;/p>
&lt;p>&amp;hellip; and voila! The upstream DNS requests sent from your Pi-hole will be encrypted using TLS.&lt;/p>
&lt;p>As mentioned earlier, DNS-over-TLS is not a perfect solution to your privacy concerns. No matter how you protect your DNS traffic,
the name of the websites that you visit will still be visible in the SNI of your HTTPS traffic, allowing your ISP (and any other intermediary)
to view it. DoT somewhat protects integrity by preventing intermediaries from manipulating your DNS requests or their responses. However,
you are still trusting the upstream DNS server- in our case, Quad9 and Cloudflare- to provide the correct responses.&lt;/p>
&lt;p>Another option to secure DNS traffic is DNS-over-HTTPS. I chose DoT because the &lt;code>cloudflared&lt;/code> program would not work on my Raspberry Pi 1 Model B+. DoH has the advantage of being harder to block or detect, because the DNS traffic is encapsulated inside of HTTPS traffic destined for port 443. This is also a slight disadvantage due to the additional traffic overhead of the HTTPS headers, which makes DoH somewhat slower than DoT.&lt;/p></description></item></channel></rss>