Linux

Last month, my homelab experienced an incident that resulted in service disruption for 3 hours and 8 minutes, and because I like to cosplay as a sysadmin in my free time this is a post-incident analysis. The effects of the disruption were mostly external, mainly affecting the main site and ytrss, internal systems remained unaffected. A virtual machine hosted on Linode needed to be moved between physical hosts for urgent and unplanned maintenance. A similar situation has happened in the past both as planned and unplanned events, so I had opportunities to prepare, but this still resulted in a failure to automatically recover this time. Several improvements were made to my infrastructure and deployment strategy, which resulted in this disruption being shorter than most but still longer than expected. Read more...

This post details how to update a domain record entry on Linode based on the public IP of a machine running Linux. We will create a python script and use the Linode API to accomplish this. Create a personal token in Linode From your Linode console under My Profile > API Tokens you can create a personal access token. The script only requires read/write access to the Domains scope. From here you can also set your desired expiration time. Read more...

Install exiftool. sudo apt install exiftool # sudo apt install libimage-exiftool-perl Remove all tags. exiftool -all= image.jpg Remove only EXIF tags exiftool -EXIF= image.jpg

Server and client setup Install Wireguard on both server and client sudo apt install wireguard Create the public and private key on both server and client. Store the private keys in a secure place. wg genkey | tee privatekey | wg pubkey > publickey Server configuration Create and open the file /etc/wireguard/wg0.conf. Insert the following block and view the examples on the table below. Read more...

Grabbing just an IP address from a network interface can be useful for scripting. In the example below the assumed interface is eth0. ip a show eth0 | grep "inet " | cut -d' ' -f6 | cut -d/ -f1 You can then save this into a variable and use it in other commands. local_ip=$(ip a show eth0 | grep "inet " | cut -d' ' -f6 | cut -d/ -f1) python3 -m http.server 8000 --bind $local_ip hugo server --bind $local_ip --baseURL=http://$local_ip

Install the NFS client pacakge. For distros that use yum install nfs-utils. sudo apt install nfs-common Manually mount the share in a directory. Replace the following with your own values: server with your NFS server /data with your exported directory /mnt/data with your mount point sudo mount -t nfs server:/data /mnt/data To automatically mount the NFS share edit /etc/fstab with the following: # <file system> <mount point> <type> <options> <dump> <pass> server:/data /mnt/data nfs defaults 0 0 To reload fstab verbosely use the following command: Read more...

Introduction These are tar commands that I use often but need help remembering. Contents Introduction Create an archive Create a gzip compressed archive Extract an archive Extract a gzip compressed tar archive List files in an archive List files in a compressed archive Extract a specific file from an archive Create an archive tar -cvf send.tar send/ -c Create an archive -v Verbose -f Specify filename Create a gzip compressed archive tar -czvf send.tar.gz send/ -c Create an archive -z Compress archive with gzip -v Verbose -f Specify filename Extract an archive tar -xvf send.tar -x Extract an archive -v Verbose -f Specify filename Extract a gzip compressed tar archive tar -xvzf send.tar -x Extract an archive -v Verbose -z Decompress using gzip -f Specify filename List files in an archive tar -tvf send.tar -t List contents -v Verbose -f Specify filename List files in a compressed archive tar -tzvf send.tar.gz -t List contents -z Decompress using gzip -v Verbose -f Specify filename Extract a specific file from an archive tar -xvf send.tar my_taxes.xlsx scan.pdf -x Extract an archive -v Verbose -f Specify filename :)