Skip to content

Instantly share code, notes, and snippets.

@katrinafyi
katrinafyi / luks-tpm2-dracut-systemd-cryptenroll.md
Last active April 7, 2024 20:37
Setting up TPM2-backed encryption on LUKS with systemd-cryptenroll and dracut.

luks-tpm2-dracut-systemd-cryptenroll.md

This documents how to add a TPM2-backed key to an existing LUKS root partition, first done with EndeavourOS in June 2023. In particular, it covers the dracut (instead of mkinitcpio) and systemd-cryptenroll (instead of clevis). Previously, we used clevis but this was slow to act while booting.

  1. Have a LUKS partition using LUKS2. If you're using LUKS1, this can be upgraded with sudo cryptsetup convert --type luks2 /dev/nvme. If you've previously used clevis, this may leave metadata which breaks the upgrade. This can be removed with sudo luksmeta nuke -d /dev/nvme.
  2. Add the tpm2-tss module to dracut by creating /etc/drcaut.conf.d/tpm.conf with the following content:
@leesh3288
leesh3288 / vm2_3.9.19_sandbox_escape_1.md
Last active April 8, 2024 16:37
Sandbox Escape in vm2@3.9.19 via `Promise[@@species]`

Sandbox Escape in vm2@3.9.19 via Promise[@@species]

Summary

In vm2 for versions up to 3.9.19, Promise handler sanitization can be bypassed with @@species accessor property allowing attackers to escape the sandbox and run arbitrary code.

Proof of Concept

@xgp
xgp / openapi.yaml
Last active April 22, 2024 16:45
OpenAPI specification for Keycloak account API
openapi: 3.0.2
info:
title: Keycloak Account API
version: 20.0.3
description: |
Derived from the code at https://github.com/keycloak/keycloak/blob/main/services/src/main/java/org/keycloak/services/resources/account/AccountRestService.java
components:
securitySchemes:
access_token:
type: http
@utkuozdemir
utkuozdemir / migrate.sh
Created November 14, 2022 21:09
pv-migrate in a loop
#!/usr/bin/env bash
set -euo pipefail
IFS=$'\n\t'
PVCS=(
"src-kubeconfig1/src-ctx1/src-ns1/src-pvc1:dest-kubeconfig1/dest-ctx1/dest-ns1/dest-pvc1"
"src-kubeconfig2/src-ctx2/src-ns2/src-pvc2:dest-kubeconfig2/dest-ctx2/dest-ns2/dest-pvc2"
"src-kubeconfig3/src-ctx3/src-ns3/src-pvc3:dest-kubeconfig3/dest-ctx3/dest-ns3/dest-pvc3"
)
@zOrg1331
zOrg1331 / wireguard_layer2.md
Last active April 26, 2024 16:04
wireguard, wireguard layer 2, wireguard over TCP

Intro

This note describes how to connect two networks/devices/VMs over public network using Wireguard with Layer 2 support (ARP, IPv6 link-local, etc).

This can also be achieved using SSH and its "tap" tunnel, however, it does not provide the same level of latency and bandwidth as full-blown VPN such as Wireguard.

In addition, this note describes how to tunnel Wireguard over TCP connection. This may be of use if you encounter firewall in-between so, for instance, you can use TCP port 443 only.

Objective

@MaxXor
MaxXor / btrfs-guide.md
Last active May 2, 2024 20:08
Btrfs guide to set up an LUKS-encrypted btrfs raid volume with included maintenance & recovery guide

Encrypted Btrfs storage setup and maintenance guide

Initial setup with LUKS/dm-crypt

This exemplary initial setup uses two devices /dev/sdb and /dev/sdc but can be applied to any amount of devices by following the steps with additional devices.

Create keyfile:

dd bs=64 count=1 if=/dev/urandom of=/etc/cryptkey iflag=fullblock
chmod 600 /etc/cryptkey
@giannivh
giannivh / keycloak_impex.sh
Last active September 18, 2020 06:57 — forked from unguiculus/keycloak_impex.sh
Import/Export Keycloak Config running on Kubernetes
#!/usr/bin/env bash
set -e
set -u
set -o pipefail
show_help() {
cat << EOF
Usage: $(basename "$0") <options>
-h, --help Display help
@MawKKe
MawKKe / cryptsetup-with-luks2-and-integrity-demo.sh
Last active April 29, 2024 21:19
dm-crypt + dm-integrity + dm-raid = awesome!
#!/usr/bin/env bash
#
# Author: Markus (MawKKe) ekkwam@gmail.com
# Date: 2018-03-19
#
#
# What?
#
# Linux dm-crypt + dm-integrity + dm-raid (RAID1)
#
#!/bin/sh
libressl_version=libressl-2.5.1
libressl_archive=${libressl_version}.tar.gz
if [ -f ${libressl_archive} ]
then
:
else
wget -O ${libressl_archive} https://ftp.openbsd.org/pub/OpenBSD/LibreSSL/${libressl_archive}
@jkullick
jkullick / headless-luks-encrypted-ubuntu-server.md
Last active March 15, 2024 21:08
Headless LUKS encrypted Ubuntu Server on Hetzner
# stop active raid
mdadm --stop /dev/md[01]

# destroy partition table on hdds
dd if=/dev/zero of=/dev/sda bs=1M count=512
dd if=/dev/zero of=/dev/sdb bs=1M count=512

# create new partition table
sgdisk -og /dev/sda