Skip to content

Instantly share code, notes, and snippets.

Encrypting Dotfile Secrets with the Linux Kernel Key Retention Service

The Linux kernel key retention service (keyrings) lets you store secrets in kernel memory — never on disk, automatically discarded when your session ends. This makes it a solid backing store for the encryption key used to protect a dotfile like .app.conf.

How it works

The kernel exposes a hierarchy of keyrings tied to different lifetimes:

Keyring Lifetime Typical use
@daemonhorn
daemonhorn / debian_tmux_initscript.md
Created April 25, 2026 15:04
Debian tmux initscript

Auto-Run Shell Scripts in Tmux Sessions on Debian

This guide walks through creating a System V init script on Debian stable that launches a set of shell scripts in individual named tmux sessions, running as a non-privileged local user.

Configuration — including which user to run as — lives in /etc/default/tmux-sessions, the standard Debian location for externalizing init script settings. The init script itself contains no hardcoded usernames or paths.


Prerequisites

@daemonhorn
daemonhorn / mattermost-dl.py
Created November 20, 2025 13:03 — forked from RobertKrajewski/mattermost-dl.py
This script allows to export the content (text+files) of an interactively selected Mattermost channel (public, private, group, direct message) to files. Tested on Mattermost 5.27 using Python 3.7
import os
import sqlite3
from datetime import datetime, date
from typing import Tuple, Dict, List
import getpass
from mattermostdriver import Driver
import pathlib
import json
@daemonhorn
daemonhorn / zfs-boot-envirnments.md
Last active October 11, 2025 19:25
ZFS Boot Environments for FreeBSD-Current

Quick HOWTO on creating "known good" states using ZFS Boot Environments

One-time git setup

su -l root
pkg install git -y
cd /usr && git clone https://git.freebsd.org/src.git src/

Re-occuring steps

  • Update source code
@daemonhorn
daemonhorn / nagios_quickstart.md
Last active September 30, 2024 23:23
Nagios QuickStart on Debian

Setup Nagios to monitor basic services on Debian

Install

apt install nginx nagios4 php-fpm fcgiwrap -y
usermod -a -G nagios www-data
# Make a folder and symlink the native apache cgi into nginx

Auto-Update for Ubuntu/Debian using Unattended-Upgrades package

Install

Unattended-upgrades is installed by:

sudo apt install unattended-upgrades
sudo systemctl enable --now unattended-upgrades
sudo dpkg-reconfigure unattended-upgrades

Configure

The default config is reasonable, but should be inspected.

@daemonhorn
daemonhorn / PivKey_Taglio_Self-Signed_PIV_Setup.md
Last active April 13, 2026 18:15
PivKey_Taglio_Self-Signed_PIV_Setup

Use a Taglio PivKey smartcard with a self-signed certificate

The default instructions on the PivKey documentation site: https://pivkey.zendesk.com/hc/en-us do not provide any examples for configuring a self-signed certificate in any of the 25 slots. These instructions were tested with the PivKey C910 version, but likely most Taglio variants will work the same way.

Powershell New-SelfSignedCertificate

There is support in powershell 5.1+ on currently supported Windows OS (Server 2012+/Windows 10+) configurations for generating self-signed certificates with a wide variety of configuration parameters, including support for the Microsoft Smart Card Key Storage Provider to generate keys on a smartcard.

@daemonhorn
daemonhorn / Microsoft.PowerShell_profile.ps1
Last active August 10, 2024 23:57
Powershell $profile helper examples
# Place this file in our $profile location and restart powershell.
# e.g.: copy Downloads\example.ps1 $profile
# $profile defaults to $HOME\Documents\PowerShell\Microsoft.PowerShell_profile.ps1
# aka: c:\Users\username\Documents\PowerShell\Microsoft.PowerShell_profile.ps1
# If you want to sign it see function `user-sign-psscript` below for signing
# This enables the use of:
# set-executionPolicy -ExecutionPolicy AllSigned -Scope CurrentUser
# Or if you don't care about security on Powershell locally, you can ignore local signing, and just use:
# set-executionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
@daemonhorn
daemonhorn / pfsense-airgap-environment.md
Last active May 18, 2024 23:08
PfSense as an air-gapped router

PfSense Air-gapped configuration

In certain environments, it is useful to have a router and firewall between two private vlans. When the WAN interface of PfSense is not able to access the internet (e.g. DNS Resolution, Update Checks, etc.) it can become sluggish to boot and configure. This guide attempts to capture configuration knobs that can improve the usability in these environments, and was written with PfSense CE 2.7.2 configuration as a baseline.

TODO

  • Finish Documentation
  • tcpdump -nn -i XXX pfsense at steady state air-gapped {for em0 (WAN), em1 (LAN), lo0 (loopback)} Loopback will show you all of the items that would have being queried via root.hints or other pfsense internals. Start with udp port 53 capture filter to look for DNS traffic.
  • tcpdump pfsense at boot with WAN interface to look for extra ntp, dns, http, tls packets

Install

Installation from the PfSense CE ISO file can easily be done in these environments. Download the ISO from mirror (to avoid creatin