<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Posts on Blade Server - A Homelabber&#39;s Blog</title>
    <link>http://blog.bladewdr.xyz/posts/</link>
    <description>Recent content in Posts on Blade Server - A Homelabber&#39;s Blog</description>
    <generator>Hugo -- gohugo.io</generator>
    <language>en-us</language>
    <lastBuildDate>Sat, 10 Feb 2024 14:58:56 -0500</lastBuildDate><atom:link href="http://blog.bladewdr.xyz/posts/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>How I set up ZFS replication backups in TrueNAS Scale</title>
      <link>http://blog.bladewdr.xyz/posts/zfs-pull-truenas/</link>
      <pubDate>Sat, 10 Feb 2024 14:58:56 -0500</pubDate>
      
      <guid>http://blog.bladewdr.xyz/posts/zfs-pull-truenas/</guid>
      <description>How I set up ZFS replication backups in TrueNAS Scale When I set out to configure my ZFS replication backups, I knew that I wanted 2 things:
I wanted to do my replications with an unprivileged user. I wanted the backups to be pulled from the backup server from the primary. The benefits of using a user without root privileges are obvious, but the benefits of a pull backup may be less so.</description>
      <content>&lt;h2 id=&#34;how-i-set-up-zfs-replication-backups-in-truenas-scale&#34;&gt;How I set up ZFS replication backups in TrueNAS Scale&lt;/h2&gt;
&lt;p&gt;When I set out to configure my ZFS replication backups, I knew that I wanted 2 things:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;I wanted to do my replications with an unprivileged user.&lt;/li&gt;
&lt;li&gt;I wanted the backups to be &lt;em&gt;pulled&lt;/em&gt; from the backup server from the primary.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;The benefits of using a user without root privileges are obvious, but the benefits of a pull backup may be less so.&lt;/p&gt;
&lt;p&gt;Backing up with a pull instead of a push means that your production machine, which by definition has to be less secure than the backup, has no access to the backup server.&lt;/p&gt;
&lt;p&gt;So, if somehow your production machine gets compromised - the attacker has no way of accessing the backup server, and possibly taking those hostage too!&lt;/p&gt;
&lt;p&gt;Of course, you should make sure that you take steps to lock down your backup server.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Make sure that SSH login only accepts public key authentication, instead of passwords.&lt;/li&gt;
&lt;li&gt;Goes without saying that your production machine &lt;em&gt;should not have the the private key for this&lt;/em&gt;.&lt;/li&gt;
&lt;li&gt;Set up firewall rules to prevent anything from connecting to the machine that isn&amp;rsquo;t supposed to. You probably want to poke holes for DNS resolution, and let the server get out to the internet for updates, but apart from that and a hole for your monitoring solution, the backup server should be totally isolated from everything else on your network!&lt;/li&gt;
&lt;/ul&gt;
&lt;h4 id=&#34;step-1-create-your-user-accounts&#34;&gt;Step 1: Create your user accounts.&lt;/h4&gt;
&lt;p&gt;You need to create a user on each side. On the &lt;em&gt;sending&lt;/em&gt; side, or in other words, your production server, you&amp;rsquo;ll need to add an SSH authorized key, and enable a home directory.
I recommend disabling password login entirely, and disabling samba authentication. You won&amp;rsquo;t be using this user for anything but the backups.&lt;/p&gt;
&lt;p&gt;Create another user on the backup server. I recommend matching usernames, just for clarity, but it&amp;rsquo;s not 100% necessary.&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;http://blog.bladewdr.xyz/truenasuser.png&#34; alt=&#34;user creation panel&#34;&gt;&lt;/p&gt;
&lt;h4 id=&#34;step-2-assign-privileges&#34;&gt;Step 2: Assign privileges.&lt;/h4&gt;
&lt;p&gt;In order to let this user account run zfs commands without root, you&amp;rsquo;ll need to drop to the shell. There are options in the TrueNAS web UI for allowing certain sudo commands without a password, but it&amp;rsquo;s better to do this on the command line, as it gives you more control over what specific rights your user has.&lt;/p&gt;
&lt;p&gt;On the receiving side, your user needs the receive, create, and mount privileges.&lt;/p&gt;
&lt;p&gt;&lt;code&gt;zfs allow pirate receive,create,mount pool&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;On the sending side, your user needs the send and hold privileges.&lt;/p&gt;
&lt;p&gt;&lt;code&gt;zfs allow pirate send,hold pool&lt;/code&gt;&lt;/p&gt;
&lt;h4 id=&#34;step-3-create-your-backup-credentials-in-truenas&#34;&gt;Step 3: Create your backup credentials in TrueNAS.&lt;/h4&gt;
&lt;p&gt;Head back to the TrueNAS web UI and click on Credentials &amp;mdash;&amp;gt; Backup Credentials. You want to add a new SSH connection.&lt;/p&gt;
&lt;p&gt;Choose manual as your setup method.&lt;/p&gt;
&lt;p&gt;Fill in as below.&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;http://blog.bladewdr.xyz/truenas_ssh.png&#34; alt=&#34;backup credentials&#34;&gt;&lt;/p&gt;
&lt;h4 id=&#34;step-4-create-your-zfs-replication-task&#34;&gt;Step 4: Create your ZFS replication task.&lt;/h4&gt;
&lt;p&gt;In the TrueNAS web UI, go to Data Protection and expand Replication Tasks.&lt;/p&gt;
&lt;p&gt;You&amp;rsquo;ll want to choose your &amp;ldquo;SSH Connection&amp;rdquo; first. Pick the one that you created in Step 3.&lt;/p&gt;
&lt;p&gt;Next, choose your source location. You&amp;rsquo;ll want to pick &amp;ldquo;On a different system&amp;rdquo;, then choose the dataset or pool you want to replicate below.&lt;/p&gt;
&lt;p&gt;Do the same for your destination, which should be on a local ZFS pool.&lt;/p&gt;
&lt;p&gt;If you want to copy child datasets, make sure you check off &amp;ldquo;Recursive&amp;rdquo;. In my case, this dataset doesn&amp;rsquo;t have any children, so I left it unchecked.&lt;/p&gt;
&lt;p&gt;If at any point you get the below prompt - make sure you click &amp;ldquo;Cancel&amp;rdquo;. You&amp;rsquo;ll need to hit Cancel twice. We don&amp;rsquo;t need sudo, since we manually allowed our user account to run the needed zfs commands using &lt;code&gt;zfs allow&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;http://blog.bladewdr.xyz/sudo_cancel.png&#34; alt=&#34;sudo prompt&#34;&gt;&lt;/p&gt;
&lt;p&gt;Click Next when you&amp;rsquo;re ready. Choose a schedule. I chose &amp;ldquo;Daily&amp;rdquo;, as it&amp;rsquo;s not a big deal for this dataset if I lose a single day.&lt;/p&gt;
&lt;p&gt;And there you have it. You now have a much more secure method of replicating your data from one ZFS pool to another.&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;http://blog.bladewdr.xyz/replication_wizard.png&#34; alt=&#34;zfs replication wizard&#34;&gt;&lt;/p&gt;
&lt;h4 id=&#34;some-additional-notes&#34;&gt;Some additional notes.&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;Remember that you&amp;rsquo;ll need to have some snapshots on the source system for this to work. ZFS replication works based off of &lt;em&gt;snapshots&lt;/em&gt;, because they are a consistent, immutable reference at a point in time. I recommend setting up automatic snapshot tasks for the datasets you want to back up.&lt;/li&gt;
&lt;li&gt;Once you&amp;rsquo;ve completed the initial replication job, any subsequent jobs will be incrementals - as long as you have a common snapshot between the two hosts.&lt;/li&gt;
&lt;/ul&gt;
</content>
    </item>
    
    <item>
      <title>Setting up a Wireguard VPN server on Ubuntu 22.04</title>
      <link>http://blog.bladewdr.xyz/posts/wireguard-server-setup/</link>
      <pubDate>Tue, 27 Jun 2023 14:39:45 -0400</pubDate>
      
      <guid>http://blog.bladewdr.xyz/posts/wireguard-server-setup/</guid>
      <description>I recently went through the process of setting up my own Wireguard VPN server up in a cloud server.
You can do this on any Ubuntu server with internet access, as long as you have the ability to open ports on the firewall, but I do recommend setting this up at a cloud hosting provider such as Linode or Digital Ocean.
The lowest tier of server will do - Wireguard is a pretty light VPN to run.</description>
      <content>&lt;p&gt;I recently went through the process of setting up my own Wireguard VPN server up in a cloud server.&lt;/p&gt;
&lt;p&gt;You can do this on any Ubuntu server with internet access, as long as you have the ability to open ports on the firewall, but I do recommend setting this up at a cloud hosting provider such as Linode or Digital Ocean.&lt;/p&gt;
&lt;p&gt;The lowest tier of server will do - Wireguard is a pretty light VPN to run. I&amp;rsquo;m using a Linode &amp;ldquo;Nanode&amp;rdquo; plan, which is one shared CPU core and 2GB of RAM. Plenty enough for our purposes.&lt;/p&gt;
&lt;p&gt;I won&amp;rsquo;t go over how to create the server and connect to it over SSH, as there are plenty of guides on that topic already. Come back when you&amp;rsquo;re logged into the server over SSH.&lt;/p&gt;
&lt;h5 id=&#34;1-first-things-first---updates&#34;&gt;1. First things first - updates!&lt;/h5&gt;
&lt;p&gt;&lt;code&gt;sudo apt update &amp;amp;&amp;amp; sudo apt dist-upgrade&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;You can reboot at this step, or wait, since we&amp;rsquo;ll need to reboot in a minute anyway.&lt;/p&gt;
&lt;h5 id=&#34;2-edit-etcsysctlconf-and-enable-ipv4-forwarding&#34;&gt;2. Edit &lt;code&gt;/etc/sysctl.conf&lt;/code&gt; and enable ipv4 forwarding&lt;/h5&gt;
&lt;p&gt;This is needed for Wireguard to be able to pass the traffic on and act as an intermediary between you and the sites you&amp;rsquo;re trying to route to through the VPN.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;code&gt;sudo vim /etc/sysctl.conf&lt;/code&gt; or &lt;code&gt;sudo nano /etc/sysctl.conf&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Uncomment the line that says &lt;em&gt;net.ipv4.ip_forward=1&lt;/em&gt;&lt;/li&gt;
&lt;li&gt;Reboot if you have pending kernel updates or run &lt;code&gt;sysctl -p&lt;/code&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;h5 id=&#34;3-allow-port-for-the-wireguard-server-in-your-firewall-of-choice&#34;&gt;3. Allow port for the Wireguard server in your firewall of choice&lt;/h5&gt;
&lt;p&gt;Once your server is up, log back in. Now we&amp;rsquo;ll need to open the port that Wireguard will be listening on.&lt;/p&gt;
&lt;p&gt;I use port 444 but the default is 51820.&lt;/p&gt;
&lt;p&gt;You can use either one - 444 is in the well-known ports range, but it&amp;rsquo;s for a pager service that I hadn&amp;rsquo;t heard of until I googled it. I think I&amp;rsquo;m safe.&lt;/p&gt;
&lt;p&gt;Here&amp;rsquo;s how to open the port with iptables:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;sudo iptables -I INPUT 1 -p udp --dport 444 -j ACCEPT&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Install the iptables-persistent package to make the rule survive reboots.&lt;/p&gt;
&lt;p&gt;&lt;code&gt;sudo apt install iptables-persistent&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Save your rules. (You&amp;rsquo;ll need to redo this every time you make a change to your iptables rules.)&lt;/p&gt;
&lt;p&gt;&lt;code&gt;netfilter-persistent save&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Here&amp;rsquo;s how to do the same thing with ufw:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;sudo ufw allow 444&lt;/code&gt;&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;&lt;strong&gt;Remember that if you have an upstream firewall (i.e. your router at home - you&amp;rsquo;ll need to forward the ports there too!&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h5 id=&#34;4-generate-the-keys-for-the-wireguard-server&#34;&gt;4. Generate the keys for the Wireguard server.&lt;/h5&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;cd /etc/wireguard
sudo wg genkey | tee privatekey | wg pubkey &amp;gt; publickey
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;This will generate 2 files in /etc/wireguard.&lt;/p&gt;
&lt;p&gt;You can check their contents by running the &lt;code&gt;cat&lt;/code&gt; command.&lt;/p&gt;
&lt;p&gt;&lt;code&gt;cat /etc/wireguard/privatekey&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;code&gt;cat /etc/wireguard/publickey&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Remember to keep your private key &lt;em&gt;private&lt;/em&gt;. It&amp;rsquo;s like a password.&lt;/p&gt;
&lt;p&gt;Keep these handy, we&amp;rsquo;ll need them for the next part.&lt;/p&gt;
&lt;h5 id=&#34;5-create-config-file-for-the-server&#34;&gt;5. Create config file for the server.&lt;/h5&gt;
&lt;p&gt;Pick an address range for your wireguard tunnel. It should be a private IP address range, but it can be anything you want.&lt;/p&gt;
&lt;p&gt;I chose 10.200.0.0/24.&lt;/p&gt;
&lt;p&gt;I&amp;rsquo;ve provided an example configuration below.&lt;/p&gt;
&lt;p&gt;Open &lt;code&gt;/etc/wireguard/wg0.conf&lt;/code&gt; with your favorite editor and paste it in.&lt;/p&gt;
&lt;p&gt;Remember to enter the private key you generated here earlier, and watch out for trailing whitespaces on the end of the key!&lt;/p&gt;
&lt;p&gt;Example server config:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;[Interface]  
Address = 10.200.0.1/24  
SaveConfig = true  
PostUp = iptables -A FORWARD -i %i -j ACCEPT; iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE; iptables -A FORWARD -o %i -j ACCEPT  
PostDown = iptables -D FORWARD -i %i -j ACCEPT; iptables -t nat -D POSTROUTING -o eth0 -j MASQUERADE; iptables -D FORWARD -o %i -j ACCEPT  
ListenPort = 444  
PrivateKey = privatekeyhere
&lt;/code&gt;&lt;/pre&gt;&lt;h5 id=&#34;6-bring-up-the-wireguard-tunnel&#34;&gt;6. Bring up the Wireguard tunnel&lt;/h5&gt;
&lt;p&gt;&lt;code&gt;wg-quick up wg0&lt;/code&gt;&lt;/p&gt;
&lt;h5 id=&#34;7-create-client-config&#34;&gt;7. Create client config&lt;/h5&gt;
&lt;p&gt;On mobile and windows generally the private and public keys will be created for you. On Linux, just re-run the same commands you used to generate your server keys.&lt;/p&gt;
&lt;p&gt;For cleanliness you can create a &lt;code&gt;/etc/wireguard/clients&lt;/code&gt; subdirectory to hold all of your keys.&lt;/p&gt;
&lt;p&gt;Example Client config:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;[Interface]
PrivateKey = clientprivatekey
Address = 10.200.0.2/24
DNS = 9.9.9.9    

[Peer]
PublicKey = serverpublickey
AllowedIPs = 0.0.0.0/0 #can change this depending on if you want full tunnel or split tunnel.
Endpoint = public-ip-of-server:444
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;For the &lt;code&gt;Endpoint&lt;/code&gt; field you can either use the public IP of the server, or a DNS name that you&amp;rsquo;ve created for it. Remember to specify the port.&lt;/p&gt;
&lt;p&gt;For the &lt;code&gt;PublicKey&lt;/code&gt; field - this is the public key that you generated earlier on the &lt;em&gt;server&lt;/em&gt;.&lt;/p&gt;
&lt;p&gt;For &lt;code&gt;DNS&lt;/code&gt; it can be any DNS server you like. I usually set my Pi-Hole servers at home as my DNS on the tunnel to provide adblocking.
For this example, I&amp;rsquo;ve just set it to use Quad9.&lt;/p&gt;
&lt;p&gt;For &lt;code&gt;AllowedIPs&lt;/code&gt; - set this to 0.0.0.0/0 only if you want to route &lt;em&gt;all&lt;/em&gt; traffic through the VPN tunnel. If you only want to use this as a remote access VPN, then leave it as only the Wireguard subnet.&lt;/p&gt;
&lt;p&gt;&lt;code&gt;AllowedIPs = 10.200.0.0/24&lt;/code&gt;&lt;/p&gt;
&lt;h5 id=&#34;8-configure-the-server-to-bring-up-wireguards-interface-on-boot&#34;&gt;8. Configure the server to bring up wireguard&amp;rsquo;s interface on boot&lt;/h5&gt;
&lt;p&gt;On the server, set the tunnel to come up automatically after a reboot.&lt;/p&gt;
&lt;p&gt;&lt;code&gt;systemctl enable wg-quick@wg0&lt;/code&gt;&lt;/p&gt;
&lt;h5 id=&#34;9-add-your-new-wireguard-peer&#34;&gt;9. Add your new wireguard peer&lt;/h5&gt;
&lt;p&gt;Now it&amp;rsquo;s time to add the client that you set up as a peer.&lt;/p&gt;
&lt;p&gt;Wireguard uses public and private key pairs to authenticate peers, so you&amp;rsquo;ll need the public key of your chosen client to enter below.&lt;/p&gt;
&lt;p&gt;&lt;code&gt;wg set wg0 peer publickeyhere allowed-ips 10.200.0.2&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Once you have this set, it&amp;rsquo;s a good idea to restart wireguard to make sure it knows about the new peer.&lt;/p&gt;
&lt;p&gt;&lt;code&gt;sudo wg-quick down wg0&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;code&gt;sudo wg-quick up wg0&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Now, you should be able to see it handshake.&lt;/p&gt;
&lt;p&gt;&lt;code&gt;sudo wg show&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;If you don&amp;rsquo;t see a handshake happening - try sending some traffic across the tunnel.&lt;/p&gt;
&lt;p&gt;&lt;code&gt;ping 10.200.0.2&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;That should be it! If you set this up as a full tunnel, try going to a site such as &lt;a href=&#34;https://dnsleaktest.com/&#34;&gt;dnsleaktest.com&lt;/a&gt; and make sure it shows the IP of the wireguard server rather than your actual public IP.&lt;/p&gt;
&lt;p&gt;If you set it up as a split tunnel, see if you can access resources on the other side of the tunnel.&lt;/p&gt;
&lt;h5 id=&#34;10-optional---set-up-your-router-as-a-wireguard-peer&#34;&gt;10. OPTIONAL - set up your router as a Wireguard peer!&lt;/h5&gt;
&lt;p&gt;If you&amp;rsquo;d like to use your wireguard server to route traffic back to your local network, it&amp;rsquo;s pretty simple to do so with firewalls like PfSense and OpnSense, that have Wireguard support baked in.&lt;/p&gt;
&lt;p&gt;I&amp;rsquo;m using OpnSense, so I&amp;rsquo;ll provide those steps here.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Steps for setting up opnsense as a client&lt;/strong&gt;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Install the &lt;code&gt;os-wireguard-go&lt;/code&gt; plugin. You can find it under System &amp;gt; Firmware &amp;gt; Plugins.&lt;/li&gt;
&lt;li&gt;Enable wireguard. VPN &amp;gt; Wireguard.&lt;/li&gt;
&lt;li&gt;Configure the remote server as an Endpoint. The PSK field is optional for more security and can be left blank. Enter a name, the public key for your wireguard server, and the endpoint address and port.&lt;/li&gt;
&lt;li&gt;Configure the &amp;ldquo;Local&amp;rdquo; server. Generate key pairs for it, pick an IP in your Wireguard subnet. Add the remote endpoint as a peer. &lt;code&gt;wg set wg0 peer publickeyhere allowed-ips 10.200.0.3&lt;/code&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Next we&amp;rsquo;ll need to add routes to tell Wireguard where to find your local subnets.&lt;/p&gt;
&lt;h5 id=&#34;adding-routes&#34;&gt;Adding routes&lt;/h5&gt;
&lt;p&gt;In the wireguard server config (/etc/wireguard/wg0.conf in this case):&lt;/p&gt;
&lt;p&gt;Add each subnet you want to go through the VPN tunnel to the allowed IP list for that peer.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example&lt;/strong&gt;&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;[Interface]
Address = 10.200.0.1/24
SaveConfig = true
PostUp = iptables -A FORWARD -i %i -j ACCEPT; iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE; iptables -A FORWARD -o %i -j ACCEPT
PostDown = iptables -D FORWARD -i %i -j ACCEPT; iptables -t nat -D POSTROUTING -o eth0 -j MASQUERADE; iptables -D FORWARD -o %i -j ACCEPT
ListenPort = 444
PrivateKey = privatekeyhere 

#config for opnsense peer
[Peer]
PublicKey = publickeyhere 
AllowedIPs = 10.200.0.3/32, 192.168.1.0/24 #192.168.1.0/24 being a subnet on the local network for this peer.
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Test it out! If you&amp;rsquo;re not using the full tunnel option on your client (0.0.0.0/0 for AllowedIPs) you&amp;rsquo;ll need to add the local subnet to your allowed IPs list there, too.&lt;/p&gt;
</content>
    </item>
    
    <item>
      <title>Shut down your laptop automatically when clamshelled using systemd</title>
      <link>http://blog.bladewdr.xyz/posts/clamshell-shutdown/</link>
      <pubDate>Fri, 23 Jun 2023 21:11:41 -0400</pubDate>
      
      <guid>http://blog.bladewdr.xyz/posts/clamshell-shutdown/</guid>
      <description>Set laptop to shut down automatically on lid close in Linux This applies specifically to Linux systems running systemd - though that covers most distros currently available. I&amp;rsquo;m doing this on Ubuntu 23.04.
Some background - I currently work at a very small MSP in New York State as general IT tech / system admin / network engineer / floor polisher. As a part of my job I&amp;rsquo;m constantly in and out from different job sites, often requiring the use of my laptop.</description>
      <content>&lt;h4 id=&#34;set-laptop-to-shut-down-automatically-on-lid-close-in-linux&#34;&gt;Set laptop to shut down automatically on lid close in Linux&lt;/h4&gt;
&lt;p&gt;This applies specifically to Linux systems running systemd - though that covers most distros currently available. I&amp;rsquo;m doing this on Ubuntu 23.04.&lt;/p&gt;
&lt;p&gt;Some background - I currently work at a very small MSP in New York State as general IT tech / system admin / network engineer / floor polisher. As a part of my job I&amp;rsquo;m constantly in and out from different job sites, often requiring the use of my laptop.&lt;/p&gt;
&lt;p&gt;I constantly run into the issue, as I&amp;rsquo;m sure many of you have, of my laptop simply having a dead or nearly dead battery after pulling it out of my go bag.&lt;/p&gt;
&lt;p&gt;Frustratingly, most if not all manufacturers in recent years have not properly implemented sleep functionality, resulting in more battery drain while suspended.&lt;/p&gt;
&lt;p&gt;I decided to look into how I could fix this problem by having my laptop automatically shut down when I clamshell it.&lt;/p&gt;
&lt;p&gt;Unfortunately, GNOME as of time of writing does not have power management features built in to accomplish this task, so we must venture into the terminal.&lt;/p&gt;
&lt;p&gt;To accomplish this task, we will be overriding the systemd-logind service configuration file &lt;code&gt;/etc/logind.conf&lt;/code&gt;. You could also edit the file directly, but it&amp;rsquo;s better practice to use an override, so that an update does not erase your changes by overwriting the file.&lt;/p&gt;
&lt;h4 id=&#34;create-a-new-file-using-your-text-editor-choice-called-usrlibsystemdlogindconfdoverridesconf&#34;&gt;Create a new file using your text editor choice called &lt;code&gt;/usr/lib/systemd/logind.conf.d/overrides.conf&lt;/code&gt;&lt;/h4&gt;
&lt;pre&gt;&lt;code&gt;`sudo vim /usr/lib/systemd/logind.conf.d/overrides.conf`
&lt;/code&gt;&lt;/pre&gt;
&lt;h4 id=&#34;edit-the-file-to-contain-these-lines-the-second-line-is-optional&#34;&gt;Edit the file to contain these lines. The second line is optional.&lt;/h4&gt;
&lt;pre&gt;&lt;code&gt;HandleLidSwitch=poweroff
HandleLidSwitchExternalPower=ignore
&lt;/code&gt;&lt;/pre&gt;
&lt;h5 id=&#34;restart-systemd-logindservice&#34;&gt;Restart systemd-logind.service.&lt;/h5&gt;
&lt;blockquote&gt;
&lt;p&gt;Note that the following will log you out!&lt;/p&gt;
&lt;/blockquote&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;sudo systemctl restart systemd-logind
&lt;/code&gt;&lt;/pre&gt;&lt;h4 id=&#34;try-it-out&#34;&gt;Try it out&lt;/h4&gt;
&lt;p&gt;Log back in and clamshell your laptop. Did it shut down?&lt;/p&gt;
&lt;h4 id=&#34;troubleshooting&#34;&gt;Troubleshooting&lt;/h4&gt;
&lt;p&gt;If, like me, you run into problems where your laptop is not following the behavior that you set, here are some basic troubleshooting steps.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Check for syntax errors. These files are case sensitive, did you spell things correct, do you have the correct case?&lt;/li&gt;
&lt;li&gt;And the one that I personally ran up against - other programs inhibiting &lt;code&gt;handle-lid-switch&lt;/code&gt;.
&lt;ul&gt;
&lt;li&gt;Run &lt;code&gt;systemd-inhibit --list&lt;/code&gt;. Look for any programs listing &lt;code&gt;What&lt;/code&gt; as &lt;code&gt;handle-lid-switch&lt;/code&gt; or something similar to it.&lt;/li&gt;
&lt;li&gt;In my case, it was GNOME tweaks. I had set a preference in earlier attempts to resolve this problem to not suspend when clamshelling the laptop, and it was taking priority over my settings for systemd-logind.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;
</content>
    </item>
    
    <item>
      <title>Geoip Blocking in Ubuntu 22.04 using iptables</title>
      <link>http://blog.bladewdr.xyz/posts/geoip-blocking-ubuntu/</link>
      <pubDate>Mon, 10 Apr 2023 20:55:05 -0400</pubDate>
      
      <guid>http://blog.bladewdr.xyz/posts/geoip-blocking-ubuntu/</guid>
      <description>Blocking connections based on geolocation in Ubuntu 22.04, using iptables and xtables-addons Steps: First note: all of these steps assume you&amp;rsquo;re logged in as root. Make sure you give it the &amp;lsquo;ol sudo su if you&amp;rsquo;re not already root.
1. First, update your system. apt-get update &amp;amp;&amp;amp; apt-get upgrade
2. Now install some dependencies. apt-get install libxtables-dev xtables-addons-common libtext-csv-xs-perl pkg-config
Note: on older versions of Ubuntu, substitute libxtables-dev for iptables-dev.</description>
      <content>&lt;h1 id=&#34;blocking-connections-based-on-geolocation-in-ubuntu-2204-using-iptables-and-xtables-addons&#34;&gt;Blocking connections based on geolocation in Ubuntu 22.04, using iptables and xtables-addons&lt;/h1&gt;
&lt;h3 id=&#34;steps&#34;&gt;Steps:&lt;/h3&gt;
&lt;p&gt;First note: all of these steps assume you&amp;rsquo;re logged in as root. Make sure you give it the &amp;lsquo;ol &lt;code&gt;sudo su&lt;/code&gt; if you&amp;rsquo;re not already root.&lt;/p&gt;
&lt;h3 id=&#34;1-first-update-your-system&#34;&gt;1. First, update your system.&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;apt-get update &amp;amp;&amp;amp; apt-get upgrade&lt;/code&gt;&lt;/p&gt;
&lt;h3 id=&#34;2-now-install-some-dependencies&#34;&gt;2. Now install some dependencies.&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;apt-get install libxtables-dev xtables-addons-common libtext-csv-xs-perl pkg-config&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Note: on older versions of Ubuntu, substitute &lt;code&gt;libxtables-dev&lt;/code&gt; for &lt;code&gt;iptables-dev&lt;/code&gt;.&lt;/p&gt;
&lt;h3 id=&#34;3-download-xtables-addon-untar-and-configure-replace&#34;&gt;3. Download xtables addon, untar and configure. Replace&lt;/h3&gt;
&lt;p&gt;Get the latest version of the xtables-addons package from here &lt;a href=&#34;https://inai.de/files/xtables-addons/&#34;&gt;https://inai.de/files/xtables-addons/&lt;/a&gt;&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;wget https://inai.de/files/xtables-addons/xtables-addons-3.23.tar.xz
tar xf xtables-addons-3.23.tar.xz
cd xtables-addons-3.23
./configure
make
make install
&lt;/code&gt;&lt;/pre&gt;&lt;h3 id=&#34;4-download-and-build-db-ip-definitions&#34;&gt;4. Download and build DB-IP definitions.&lt;/h3&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;cd geoip
./xt_geoip_dl
mkdir /usr/share/xt_geoip
./xt_geoip_build -D /usr/share/xt_geoip *.csv
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Okay, we&amp;rsquo;re ready to use the geoip matching in iptables.&lt;/p&gt;
&lt;h3 id=&#34;5-allow-or-deny-traffic-based-on-geolocation&#34;&gt;5. Allow or deny traffic based on geolocation!&lt;/h3&gt;
&lt;p&gt;My favorite way to do this is to have the default DENY policy for the INPUT chain be DROP, and whitelist only the countries I want to be able to access my servers. In my case, the US.&lt;/p&gt;
&lt;p&gt;Add a command at the top of your INPUT chain to allow responses from outgoing connections. (only required if you want to set your default policy to DROP)&lt;/p&gt;
&lt;p&gt;This is because when you set the default policy to DROP, even the responses from outgoing connections that YOU made will get dropped.&lt;/p&gt;
&lt;p&gt;&lt;code&gt;iptables -I INPUT 1 -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;I&amp;rsquo;d make sure you set a rule to allow your ssh connection before changing the default policy (to avoid getting kicked out and not being able to get back in.)&lt;/p&gt;
&lt;p&gt;&lt;code&gt;iptables -I INPUT -p tcp --dport 22 -m geoip --src-cc US -j ACCEPT&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Set the default policy&lt;/p&gt;
&lt;p&gt;&lt;code&gt;iptables --policy INPUT DROP&lt;/code&gt;&lt;/p&gt;
&lt;h3 id=&#34;6-install-the-iptables-persistent-package-to-make-your-iptables-rules-survive-reboots&#34;&gt;6. Install the iptables-persistent package to make your iptables rules survive reboots.&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;sudo apt install iptables-persistent&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Don&amp;rsquo;t forget that if you make a change later on, you&amp;rsquo;ll need to save again!&lt;/p&gt;
&lt;p&gt;&lt;code&gt;netfilter-persistent save&lt;/code&gt;&lt;/p&gt;
</content>
    </item>
    
    <item>
      <title>How to install an Ubuntu based OS on the Framework Laptop</title>
      <link>http://blog.bladewdr.xyz/framework-ubuntu-install/</link>
      <pubDate>Thu, 23 Feb 2023 22:15:57 -0500</pubDate>
      
      <guid>http://blog.bladewdr.xyz/framework-ubuntu-install/</guid>
      <description></description>
      <content>&lt;h1 id=&#34;how-to-configure-framework-laptop-for-ubuntu-based-os&#34;&gt;How to configure Framework laptop for Ubuntu based OS&lt;/h1&gt;
&lt;p&gt;Created: 2023-02-23 21:57&lt;/p&gt;
&lt;p&gt;The below is stolen from the official guide provided by framework on their website - cited below.&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;# This is for 12th Gen ONLY.

# Copy the entire text block below, paste into the terminal, press enter and type your

user&amp;#39;s password as prompted.

# This will:

# - Update your Ubuntu install&amp;#39;s packages.

# - Install the recommended OEM kernel.

# - Workaround needed to get the best suspend battery life for SSD power drain.

# - Disable the ALS sensor so that your brightness keys work.

# - Enable improved fractional scaling support for Ubuntu&amp;#39;s GNOME environment using Wayland.

# - Enable headset mic input.

## *****COPY AND PASTE THIS CODE BELOW*****

sudo apt update &amp;amp;&amp;amp; sudo apt upgrade -y &amp;amp;&amp;amp; sudo apt-get install linux-oem-22.04 &amp;amp;&amp;amp; echo &amp;#34;options snd-hda-intel model=dell-headset-multi&amp;#34; | sudo tee -a /etc/modprobe.d/alsa-base.conf &amp;amp;&amp;amp; gsettings set org.gnome.mutter experimental-features &amp;#34;[&amp;#39;scale-monitor-framebuffer&amp;#39;]&amp;#34; &amp;amp;&amp;amp; sudo sed -i &amp;#39;s/^GRUB_CMDLINE_LINUX_DEFAULT.*/GRUB_CMDLINE_LINUX_DEFAULT=&amp;#34;quiet splash module_blacklist=hid_sensor_hub nvme.noacpi=1&amp;#34;/g&amp;#39; /etc/default/grub &amp;amp;&amp;amp; sudo update-grub &amp;amp;&amp;amp;

echo &amp;#34;[connection]&amp;#34; | sudo tee /etc/NetworkManager/conf.d/default-wifi-powersave-on.conf &amp;amp;&amp;amp; echo &amp;#34;wifi.powersave = 2&amp;#34; | sudo tee -a /etc/NetworkManager/conf.d/default-wifi-powersave-on.conf

## *****COPY AND PASTE THIS CODE ABOVE*****

## then press enter key, password, reboot.

# If you would rather enter the commands individually instead:

## Updating packages.

sudo apt update &amp;amp;&amp;amp; sudo apt upgrade -y

## Install the recommended OEM kernel.

sudo apt install linux-oem-22.04

## Enable headset mic input.

echo &amp;#34;options snd-hda-intel model=dell-headset-multi&amp;#34; | sudo tee -a /etc/modprobe.d/alsa-base.conf

## Enable improved fractional scaling support for Ubuntu&amp;#39;s GNOME environment using Wayland.

gsettings set org.gnome.mutter experimental-features &amp;#34;[&amp;#39;scale-monitor-framebuffer&amp;#39;]&amp;#34;

## Disable the ALS sensor so that your brightness keys work, 12th gen only.

sudo gedit /etc/default/grub

## Append the following to the GRUB_CMDLINE_LINUX_DEFAULT=&amp;#34;quiet splash section.

GRUB_CMDLINE_LINUX_DEFAULT=&amp;#34;quiet splash module_blacklist=hid_sensor_hub&amp;#34;

## Workaround needed to get the best suspend battery life for SSD power drain.

sudo gedit /etc/default/grub

## Append the following to the GRUB_CMDLINE_LINUX_DEFAULT=&amp;#34;quiet splash section.

GRUB_CMDLINE_LINUX_DEFAULT=&amp;#34;quiet splash nvme.noacpi=1&amp;#34;

# Sudo with your fingerprints.

## To run sudo in a terminal with the fingerprint reader, you need to run this command in a terminal and follow the prompts.

sudo pam-auth-update

## Also, if you&amp;#39;ve previously enrolled fingerprints in Windows or another Linux distro, you may find that fingerprint enrollment errors until you manually force clear the stored fingerprints.

https://knowledgebase.frame.work/en_us/fingerprint-enrollment-rkG6YP7xF

## Additional ways to extend battery life can be found at this link: https://community.frame.work/t/linux-battery-life-tuning/6665.
&lt;/code&gt;&lt;/pre&gt;&lt;h4 id=&#34;for-distros-other-than-ubuntu-you-may-also-need-to-disable-panel-screen-refresh&#34;&gt;For distros other than Ubuntu you may also need to disable panel screen refresh&lt;/h4&gt;
&lt;p&gt;Only use this if you run into freezing / stuttering issues.
I ran into this on Pop_OS 22.04 specifically.&lt;/p&gt;
&lt;p&gt;&lt;code&gt;sudo kernelstub -o &amp;quot;i915.enable_psr=0&amp;quot;&lt;/code&gt;&lt;/p&gt;
&lt;h2 id=&#34;links&#34;&gt;Links&lt;/h2&gt;
&lt;p&gt;&lt;a href=&#34;https://guides.frame.work/Guide/Ubuntu+22.04+LTS+Installation+on+the+Framework+Laptop/109&#34;&gt;https://guides.frame.work/Guide/Ubuntu+22.04+LTS+Installation+on+the+Framework+Laptop/109&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href=&#34;https://www.reddit.com/r/framework/comments/10zeoyu/anyone_experiencing_random_freezing_on_pop_os_2204/&#34;&gt;https://www.reddit.com/r/framework/comments/10zeoyu/anyone_experiencing_random_freezing_on_pop_os_2204/&lt;/a&gt;&lt;/p&gt;</content>
    </item>
    
    <item>
      <title>How to install Graylog 5.0 on Debian 11 (single node)</title>
      <link>http://blog.bladewdr.xyz/posts/graylog-debian-install/</link>
      <pubDate>Tue, 17 Jan 2023 23:00:46 -0500</pubDate>
      
      <guid>http://blog.bladewdr.xyz/posts/graylog-debian-install/</guid>
      <description>This was tested on 1/17/2023 on Debian 11 and Graylog 5.0 Using OpenSearch instead of ElasticSearch which is deprecated now. This is for a single node&amp;hellip; multiple nodes is something that I have yet to look into.
Install prerequisites MongoDB sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv f5679a222c647c87527c2f8cb00a0bd1e2c63c11echo &amp;#34;deb [ arch=amd64 ] https://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/5.0 multiverse&amp;#34; |sudo tee /etc/apt/sources.list.d/mongodb-org-5.x.listsudo apt-get updatesudo apt-get install -y mongodb-org Enable MongoDB on system startup sudo systemctl daemon-reloadsudo systemctl enable mongod.</description>
      <content>&lt;p&gt;This was tested on 1/17/2023 on Debian 11 and Graylog 5.0
Using OpenSearch instead of ElasticSearch which is deprecated now.
This is for a single node&amp;hellip; multiple nodes is something that I have yet to look into.&lt;/p&gt;
&lt;h3 id=&#34;install-prerequisites&#34;&gt;Install prerequisites&lt;/h3&gt;
&lt;h4 id=&#34;mongodb&#34;&gt;MongoDB&lt;/h4&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv f5679a222c647c87527c2f8cb00a0bd1e2c63c11
echo &amp;#34;deb [ arch=amd64 ] https://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/5.0 multiverse&amp;#34; |
sudo tee /etc/apt/sources.list.d/mongodb-org-5.x.list
sudo apt-get update
sudo apt-get install -y mongodb-org
&lt;/code&gt;&lt;/pre&gt;&lt;h5 id=&#34;enable-mongodb-on-system-startup&#34;&gt;Enable MongoDB on system startup&lt;/h5&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;sudo systemctl daemon-reload
sudo systemctl enable mongod.service
sudo systemctl restart mongod.service
sudo systemctl --type=service --state=active | grep mongod
&lt;/code&gt;&lt;/pre&gt;&lt;h4 id=&#34;opensearch&#34;&gt;OpenSearch&lt;/h4&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;wget https://artifacts.opensearch.org/releases/bundle/opensearch/1.3.4/opensearch-1.3.4-linux-x64.tar.gz
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Disable memory paging and swapping to improve performance.&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;sudo swapoff -a
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Increase the number of memory maps available to OpenSearch.&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;# Edit the sysctl config file
sudo vi /etc/sysctl.conf

# Add a line to define the desired value
# or change the value if the key exists,
# and then save your changes.
vm.max_map_count=262144

# Reload the kernel parameters using sysctl
sudo sysctl -p

# Verify that the change was applied by checking the value
cat /proc/sys/vm/max_map_count
&lt;/code&gt;&lt;/pre&gt;&lt;h4 id=&#34;create-opensearch-user&#34;&gt;Create OpenSearch User&lt;/h4&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;sudo adduser --system --disabled-password --disabled-login --home /var/empty --no-create-home --quiet --force-badname --group opensearch
&lt;/code&gt;&lt;/pre&gt;&lt;h4 id=&#34;create-directories-and-extract-the-opensearch-archive-you-downloaded-earlier&#34;&gt;Create directories and extract the OpenSearch archive you downloaded earlier&lt;/h4&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;sudo mkdir -p /graylog/opensearch/data
sudo mkdir /var/log/opensearch

tar -xzvf opensearch-1.3.4-linux-x64.tar.gz
sudo mv opensearch-1.3.4/* /graylog/opensearch


#Set Permissions
sudo chown -R opensearch:opensearch /graylog/opensearch/
sudo chown -R opensearch:opensearch /var/log/opensearch
sudo chmod -R 2750 /graylog/opensearch/
sudo chmod -R 2750 /var/log/opensearch

#Create empty log file
sudo -u opensearch touch /var/log/opensearch/graylog.log
&lt;/code&gt;&lt;/pre&gt;&lt;h4 id=&#34;create-a-system-service-for-opensearch&#34;&gt;Create a system service for opensearch&lt;/h4&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;
sudo su

cat &amp;gt; /etc/systemd/system/opensearch.service &amp;lt;&amp;lt;EOF
[Unit]
Description=Opensearch
Documentation=https://opensearch.org/docs/latest
Requires=network.target remote-fs.target
After=network.target remote-fs.target
ConditionPathExists=/graylog/opensearch
ConditionPathExists=/graylog/opensearch/data
[Service]
Environment=OPENSEARCH_HOME=/graylog/opensearch
Environment=OPENSEARCH_PATH_CONF=/graylog/opensearch/config
ReadWritePaths=/var/log/opensearch
User=opensearch
Group=opensearch
WorkingDirectory=/graylog/opensearch
ExecStart=/graylog/opensearch/bin/opensearch
# Specifies the maximum file descriptor number that can be opened by this process
LimitNOFILE=65535
# Specifies the maximum number of processes
LimitNPROC=4096
# Specifies the maximum size of virtual memory
LimitAS=infinity
# Specifies the maximum file size
LimitFSIZE=infinity
# Disable timeout logic and wait until process is stopped
TimeoutStopSec=0
# SIGTERM signal is used to stop the Java process
KillSignal=SIGTERM
# Send the signal only to the JVM rather than its control group
KillMode=process
# Java process is never killed
SendSIGKILL=no
# When a JVM receives a SIGTERM signal it exits with code 143
SuccessExitStatus=143
# Allow a slow startup before the systemd notifier module kicks in to extend the timeout
TimeoutStartSec=180
[Install]
WantedBy=multi-user.target
EOF
&lt;/code&gt;&lt;/pre&gt;&lt;h4 id=&#34;create-opensearch-configuration-file&#34;&gt;Create opensearch configuration file&lt;/h4&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;nano /graylog/opensearch/config/opensearch.yml
&lt;/code&gt;&lt;/pre&gt;&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;cluster.name: graylog
node.name: ${HOSTNAME}
path.data: /graylog/opensearch/data
path.logs: /var/log/opensearch
network.host: ${HOSTNAME}
discovery.seed_hosts: [&amp;#34;SERVERNAME01&amp;#34;, &amp;#34;SERVERNAME02&amp;#34;, &amp;#34;SERVERNAME03&amp;#34;]
cluster.initial_master_nodes: [&amp;#34;SERVERNAME01&amp;#34;, &amp;#34;SERVERNAME02&amp;#34;, &amp;#34;SERVERNAME03&amp;#34;]
action.auto_create_index: false
plugins.security.disabled: true
&lt;/code&gt;&lt;/pre&gt;&lt;h4 id=&#34;enable-opensearch-system-service&#34;&gt;Enable OpenSearch system service&lt;/h4&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;sudo systemctl daemon-reload
sudo systemctl enable opensearch.service
sudo systemctl start opensearch.service
&lt;/code&gt;&lt;/pre&gt;&lt;h3 id=&#34;install-graylog&#34;&gt;Install Graylog&lt;/h3&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;wget https://packages.graylog2.org/repo/packages/graylog-5.0-repository_latest.deb
sudo dpkg -i graylog-5.0-repository_latest.deb
sudo apt-get update &amp;amp;&amp;amp; sudo apt-get install graylog-server 
&lt;/code&gt;&lt;/pre&gt;&lt;h5 id=&#34;generate-a-password-secret-and-a-root-passwordo&#34;&gt;Generate a password secret and a root password.o&lt;/h5&gt;
&lt;p&gt;Keep these handy as we&amp;rsquo;ll use them in the next step.&lt;/p&gt;
&lt;h5 id=&#34;password-secret&#34;&gt;Password Secret&lt;/h5&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;mkpassword -m sha-512 &amp;lt;password&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;h5 id=&#34;root-password&#34;&gt;root password&lt;/h5&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;echo -n &amp;#34;Enter Password: &amp;#34; &amp;amp;&amp;amp; head -1 &amp;lt;/dev/stdin | tr -d &amp;#39;\n&amp;#39; | sha256sum | cut -d&amp;#34; &amp;#34; -f1
&lt;/code&gt;&lt;/pre&gt;&lt;h3 id=&#34;edit-the-configuration-file-for-graylog&#34;&gt;Edit the configuration file for Graylog&lt;/h3&gt;
&lt;p&gt;Enter the password secret and the root password into the relevant fields &lt;code&gt;/etc/graylog/server/server.conf&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Change the &lt;code&gt;http_bind_address&lt;/code&gt; to the ip address or domain name of the server.&lt;/p&gt;
&lt;h4 id=&#34;enable-graylog-to-run-at-startup&#34;&gt;Enable Graylog to run at startup.&lt;/h4&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;sudo systemctl daemon-reload
sudo systemctl enable graylog-server.service
sudo systemctl start graylog-server.service
sudo systemctl --type=service --state=active | grep graylog
&lt;/code&gt;&lt;/pre&gt;&lt;h4 id=&#34;connect-to-graylog-web-interface&#34;&gt;Connect to Graylog web interface&lt;/h4&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;&amp;lt;ip-address&amp;gt;:9000
&lt;/code&gt;&lt;/pre&gt;</content>
    </item>
    
  </channel>
</rss>
