Skip to content

Instantly share code, notes, and snippets.

View troyfontaine's full-sized avatar

Troy Fontaine troyfontaine

View GitHub Profile
@troyfontaine
troyfontaine / myserver.xml
Created January 25, 2016 02:23
KVM Virtual Machine Template XML
<domain type='kvm'>
<name>MyServer</name>
<memory unit='KiB'>4194304</memory>
<currentMemory unit='KiB'>4194304</currentMemory>
<vcpu placement='static'>4</vcpu>
<os>
<type arch='x86_64' machine='pc-i440fx-wily'>hvm</type>
<boot dev='hd'/>
</os>
<features>
@troyfontaine
troyfontaine / README.md
Last active August 7, 2020 12:56
Yubikey for AWS-Vault

How to Set up Yubikey for AWS-Vault

Tired of using a password for aws-vault? Want to use that lovely touch pad on your Yubikey? Here is how! (Shamelessly borrowed from this comment by Frederico Araujo). Note, this is not the same as configuring your terminal to use a Yubikey setup to be used as TOTP for AWS-instead of an app!

NOTE: These steps are for use on macOS and should be similar for Linux

  1. Remove existing credential from AWS Vault Run only if you already have it setup before:

aws-vault remove myprofile

@troyfontaine
troyfontaine / README.md
Created August 13, 2020 12:50
Fixed Close All RabbitMQ Connections

Fixed command to close connections to RabbitMQ

rabbitmqctl list_connections pid port state user vhost recv_cnt send_cnt send_pend name| grep -vP 'Listing|pid' | awk '{print "rabbitmqctl close_connection \"" $1 "\" \"manually closing idle connection\"" | "sh" }'
@troyfontaine
troyfontaine / Docker-Compose.yml
Created November 29, 2019 05:58
Pihole Docker Container with IPv6 Support
version: "3"
# More info at https://github.com/pi-hole/docker-pi-hole/ and https://docs.pi-hole.net/
services:
pihole:
container_name: pihole
image: pihole/pihole:latest
ports:
- "53:53/tcp"
- "53:53/udp"
@troyfontaine
troyfontaine / README.md
Created February 6, 2018 06:39
High Sierra SSH Issue with Cisco iOS (ssh_dispatch_run_fatal Invalid key length)

Overview

You must connect to your Cisco device from another machine using an earlier version of OpenSSH as the reason for this error is:

  1. The new version of OpenSSH does not support RSA Host Keys less than 1024 bits in length
  2. The switch by default has an RSA Host Key of less than 1024 bits

The solution is as follows:

Step 1. Connect from another device

You can actually get away with (for now) using Bitvise SSH on Windows and enabling the disabled Algorithms, etc. to allow you to connect to the Cisco device.

@troyfontaine
troyfontaine / README.md
Last active October 13, 2021 19:53
Unifi Guest Network Secure Hotspot Portal Setup with USG

Configuring the Unifi Guest Network Secure Hotspot Portal to use SSL

Requirements:

  • Unifi Controller v5 running on a Unifi CloudKey (UCK)
  • A Unifi USG
  • A Unifi Access Point such as the UAP-AC-LR, UAP-AC-Lite, UAP-AC-Pro (UAP)
  • Your own valid purchased Domain Name (in order to purchase an SSL Certificate)
  • Your own DNS Provider (This can be through your domain registrar or through a third party such as CloudFlare or Hurricane Electric)
  • The ability to purchase SSL Certificates (or use Let's Encrypt with DNS Validation)

This document is written for Unifi Controller Software v5. Configuring the Unifi Controller Guest Network, the Hotspot Portal and SSL is actually fairly involved and requires modifying the configuration in several locations-as well as adding the SSL certificate via SSH. So this will consist of several discrete procedures to achieve the end goal.

@troyfontaine
troyfontaine / install.sh
Last active February 8, 2022 18:20
Install Hashicorp Vault on Raspberry Pi 4 with 64-bit Raspberry Pi OS
#!/usr/bin/env bash
# Install Dependencies
sudo apt-get update && sudo apt-get install software-properties-common wget -y
# Add the gpg key
wget -O- https://apt.releases.hashicorp.com/gpg | gpg --dearmor | sudo tee /usr/share/keyrings/hashicorp-archive-keyring.gpg
# Add the repository and set where the key is to validate the packages
echo 'deb [arch=arm64 signed-by=/usr/share/keyrings/hashicorp-archive-keyring.gpg] https://apt.releases.hashicorp.com $(lsb_release -cs) main' | sudo tee /etc/apt/sources.list.d/hashicorp.list
@troyfontaine
troyfontaine / install.sh
Created February 10, 2022 03:59
Install Docker Compose V2 on 64-bit Raspberry Pi OS
#!/usr/bin/env bash
# Download the binary
sudo curl -SL https://github.com/docker/compose/releases/download/v2.2.3/docker-compose-linux-aarch64 \
-o /usr/local/lib/docker/cli-plugins/
# Set the binary to be executable
chmod +x /usr/local/lib/docker/cli-plugins/docker-compose
@troyfontaine
troyfontaine / README.md
Created March 19, 2022 14:45
Resize Ubuntu VM Disk on TrueNAS Scale

Resize an Ubuntu VM Disk on TrueNAS Scale

  1. Shutdown the target VM
  2. Locate the zvol where the storage is allocated in the Storage blade in the TrueNAS Scale Web UI
  3. Resize the zvol by editing it-this can ONLY be increased, not shrunk!
  4. Save your changes
  5. Start your target VM up again
  6. Log in to the VM
  7. Execute the growpart command, ie. sudo growpart /dev/vda 2
  8. Execute the resize2fs command, ie. sudo resize2fs /dev/vda2
@troyfontaine
troyfontaine / README.md
Last active March 24, 2022 13:59
Running Badblocks on External USB Drives attached to a TrueNAS Scale Machine

Badblocks on TrueNAS Scale

  1. Connect your USB drive to the machine
  2. Navigate to the TrueNAS Scale shell by opening the menu, going to System Settings and then clicking on Shell
  3. Locate the drive's device ID using the lsblk command
  4. Check the recommended block size using the command blockdev --getbsz /dev/<YOUR BLOCK DEVICE ID>
  5. Note the block size you got from the last command
  6. STOP! Have you ensured that the USB device does NOT have any important data on it? If it does, stop now, unplug it from the TrueNAS Scale machine and back it up elsewhere! Running the specific badblocks command we'll use will destroy data on the drive!
  7. Okay, you've confirmed there is no data on the drive you need? Good!
  8. Fire up a new tmux session tmux new -s badblocks_