Skip to content

Instantly share code, notes, and snippets.

View rlaager's full-sized avatar

Richard Laager rlaager

View GitHub Profile
@rlaager
rlaager / ipsec2wireshark.py
Last active June 3, 2021 05:00 — forked from rectalogic/ipsec2wireshark.py
Parse spis and keys from "ip xfrm state" output and generate a Wireshark ESP decryption config that can decrypt an ESP capture.
Moved to https://github.com/rlaager/ipsec2wireshark
--- zfs.py.orig 2020-03-04 15:31:11.857503452 -0600
+++ zfs.py 2020-03-04 15:33:16.511328056 -0600
@@ -33,11 +33,11 @@
from json import loads as dejson
def zfsonlinux():
- sources = {'master':'https://raw.githubusercontent.com/zfsonlinux/zfs/master/man/man5/zpool-features.5'}
+ sources = {'master':'https://raw.githubusercontent.com/openzfs/zfs/master/man/man5/zpool-features.5'}
with urlopen('https://zfsonlinux.org') as web:
versions = findall(r'download/zfs-([0-9.]+)', web.read().decode('utf-8', 'ignore'))
--- zfs.py.orig 2020-02-29 22:33:35.944829078 -0600
+++ zfs.py 2020-02-29 22:43:04.105212366 -0600
@@ -98,14 +98,11 @@
return sources
sources = {
- 'ZFS on Linux': zfsonlinux(),
+ 'OpenZFS on Linux': zfsonlinux(),
'FreeBSD': freebsd(),
- 'OpenZFS on OSX': openzfsonosx(),
--- zfs.py.orig 2020-02-22 17:48:50.632095353 -0600
+++ zfs.py 2020-02-22 17:47:34.907137427 -0600
@@ -126,6 +126,7 @@
}
features = defaultdict(list)
+guids = dict()
readonly = dict()
for name, sub in sources.items():
@rlaager
rlaager / mail-tail.1
Last active November 24, 2019 04:34
rst Man Page Example
.\" Man page generated from reStructuredText.
.
.TH MAIL-TAIL 1 "2019-09-23" "Ansible mail role" "Wiktel Utilities"
.SH NAME
mail-tail \- tail the mail logs
.
.nr rst2man-indent-level 0
.
.de1 rstReportMargin
\\$1 \\n[an-margin]
@rlaager
rlaager / znc.sh
Created May 12, 2019 19:57
A certbot deploy hook for znc
#!/bin/sh
# This script goes in: /etc/letsencrypt/renewal-hooks/deploy
for domain in $RENEWED_DOMAINS
do
if [ "$domain" = "$(hostname --fqdn)" ]
then
cat "$RENEWED_LINEAGE/privkey.pem" "$RENEWED_LINEAGE/fullchain.pem" > /var/lib/znc/znc.pem
systemctl reload znc
fi
Using "Ubuntu 18.04 Root on ZFS" Instructions on Debian Buster (Testing Live DVD):
1) Must add contrib repository and run apt update before installing zfs-initramfs
2) Must run "modprobe zfs" before creating pool
3) /etc/netplan/01-netcfg.yaml doesn't exist on Debian
4) Different apt lists, must add contrib
5) apt install --yes locales is necessary before configuring locales
6) nano is already installed by debootstrap
7) Different package names for kernel so you need "apt install --yes dpkg-dev linux-headers-$(uname -r) linux-image-amd64" . However, "apt install --yes zfs-initramfs" works (the current debian instructions also include zfs-dkms but zfs-initramfs depends on zfs-dkms)
8) The 5.4 Grub instructions don't apply to Debian. The 5.3 instructions on the Debian guide are correct.
9) Instead of 8.2, you would just run tasksel on Debian
$ truncate -s 1G test.img && sudo zpool create -d -o feature@async_destroy=enabled -o feature@bookmarks=enabled -o feature@embedded_data=enabled -o feature@empty_bpobj=enabled -o feature@enabled_txg=enabled -o feature@extensible_dataset=enabled -o feature@filesystem_limits=enabled -o feature@hole_birth=enabled -o feature@large_blocks=enabled -o feature@lz4_compress=enabled -o feature@spacemap_histogram=enabled -o feature@userobj_accounting=enabled test `pwd`/test.img ; sudo zpool get all test | grep feature | sort
[sudo] password for rlaager:
test feature@async_destroy enabled local
test feature@bookmarks enabled local
test feature@edonr disabled local
test feature@embedded_data active local
test feature@empty_bpobj enabled local
test feature@enabled_txg active local
test feature@extensible_data
@rlaager
rlaager / ufw-insert
Created November 8, 2018 11:50
ufw-insert
#!/bin/sh -eu
# ufw does not allow IPv6 rules to be inserted before IPv4 rules. As a
# result, "ufw insert 1" does not work for IPv6 addresses. Replace the
# "ufw" in the actionban entry in /etc/fail2ban/action.d/ufw.conf with
# this script. Leave actionunban alone.
# Arguments:
# $1 is "insert"
insertpos=$2
blocktype=$3
@rlaager
rlaager / .quiltrc
Created April 9, 2018 19:04
Debian packaging .quilrc
dir=$PWD
while [ "$dir" != "/" ] ; do
if [ -e "$dir/debian/rules" -a -d "$dir/debian/patches" ] ; then
export QUILT_PATCHES=debian/patches
break
fi
dir="`dirname "$dir"`"
done
# Remove all useless formatting from the patches