Shared Fail2Ban Puppet

Written by

I’ve written a very simple Puppet module for the Shared Fail2Ban system we use at work.

I’ve sanitised and uploaded the module to github under the name Shared Fail2Ban Puppet.

The module is fairly simple and depends on the puppet labs mysql module on puppet forge. It may clash with other peoples fail2ban modules.

The shared installation will install ssh iptables with shared iptables on the clients with an option of mysql or api on the shared fail2ban server. You can however change the files it pushes for your own jails.

re3-nx Linux Audio Fix

Written by

GTA3 build for the Nintendo Switch was recently released but there is an audio issue with the WAV files on some releases, the developers provided a Windows batch script and not a Linux script.

It requires ffpmeg which is typically in your favourite distros package manager.


function check_bin() {
  which $1 1>/dev/null 2>&1
  if [[ $? -ne 0 ]]; then
    echo "$1 cannot be found. Please install it or add it to your path. Exiting."
    exit 1

check_bin ffmpeg
check_bin grep

mkdir audio
for file in $(ls | grep wav); do
  ffmpeg -i $file audio/$file

Just copy and paste the code above, save it in the same directory as your GTA audio files and execute it (chmod +x && ./

List NFS Clients on Server

Written by

I was looking for a simple and easy way to view the NFS Clients connected to my NFS Server, there’s many guides on how to view the mounts available and people say to run various client side commands but that doesn’t help for the opposite way.

This is a little Linux bash script to show the currently connected NFS clients to your server; it uses a dig lookup to get the hostname, which may not work if you dont have rDNS for internal addressing.

# A little bash script to show currently connected NFS clients.
# Adam Boutcher - Jul 2020
# IPPP, Durham University

# Function to check that a binary exists
function check_bin() {
  which $1 1>/dev/null 2>&1
  if [[ $? -ne 0 ]]; then
    echo "$1 cannot be found. Please install it or add it to the path. Exiting."
    exit 1

check_bin which
check_bin netstat
check_bin grep
check_bin awk
check_bin echo
check_bin dig

NCLIENTS=$(netstat -plna | grep 2049 | awk '{print $5}' | grep -v "*" | awk -F ":" '{print $1}')
echo ""
echo "NFS clients currently connected:"
for CLIENT in ${NCLIENTS}; do
  CNAME=$(dig +short -x $CLIENT);
  echo - $CLIENT ($CNAME)
echo ""
exit 0;

There are other tools available like nfstat to help show other NFS information, specifically for servers use:

nfsatst -s

Fedora Linux LUKS Encryption with TPM Unlock

Written by

Windows has BitLocker, Linux has LUKS as Full Disk Encryption, but by default LUKS doesn’t unlock via the TPM and requires a password.

There are many guides out there that show a very complex setup but for the basic encrypt the root partition and unlock it with a TPM, its actually fairly simple.

The following commands will setup your Fedora Linux (Tested with Fedora 32) LUKS boot volume to unlock automatically with the TPM.

dnf install clevis clevis-dracut clevis-luks
clevis luks bind -d /dev/sda3 tpm2 '{"pcr_ids":"7"}'
dracut -f

This was tested with non-Secure booting EFI.

These guides were very helpful:

How to Re-Address a Docker Swarm Master

Written by

Docker Swarm; the simple and quick way to build a docker cluster. That is until you need to re-address the cluster especially the master.

According to the Docker website, it is not really possible (warning: my vague interpretation of their documentation) and that you should be running your masters with static IP Addresses. Although workers are perfectly fine with dynamic addressing. This is great but what happens when your “test” environment is suddenly your “production” environment?

Option 1:

Create a second master on the new address. This is what I ended up doing – Learn from my mistakes.

Option 2:

If for some reason you can’t create a second master, then you can really hack up docker and force it to do what you want; technically once the swarm is initialised, you can’t change any of these via the docker command line but this will force some changes. This was highly unstable for me.

Within the directory /var/lib/docker/swarm there are two json files that you need to edit, state and docker-state.

On the master node you need to edit the “LocalAddr”, the “ListenAddr” and “AdvertiseAddr” in the docker-state.json, you also need to edit the “addr” in state.json.

On any worker nodes, you need to edit the “RemoteAddr” in the docker-state.json and the “addr” in stat.json.

Then simply restart docker; you may have to remove nodes and rejoin them.