Skip to content

Instantly share code, notes, and snippets.

View fvoges's full-sized avatar
:octocat:

Federico Voges fvoges

:octocat:
View GitHub Profile
@fvoges
fvoges / low-battery-level-detection-notification-for-all-battery-sensors.yaml
Last active April 27, 2024 18:50 — forked from sbyx/low-battery-level-detection-notification-for-all-battery-sensors.yaml
Home Assistant Blueprint: Low battery level detection & notification for all battery sensors
blueprint:
name: Low battery level detection & notification for all battery sensors (remix)
description: Regularly test all sensors with 'battery' device-class for crossing
a certain battery level threshold and if so execute an action.
domain: automation
input:
threshold:
name: Battery warning level threshold
description: Battery sensors below threshold are assumed to be low-battery (as
well as binary battery sensors with value 'on').

Yubikey GPG inside WSL2

  1. Install GPG4Win.
  2. Start up Kleopatra (a UI tool from 1) and make sure your YubiKey is loaded there.
    • You can also add GPG4Win to Startup folder using a link with this Target:
      "C:\Program Files (x86)\GnuPG\bin\gpg-connect-agent.exe" /bye
      
      This will only load the agent at Startup, and you won't be bothered by any UI or tray agent.
  3. Download wsl2-ssh-pageant into your Windows %userprofile%/.ssh directory (Windows dir is important for performance).
@fvoges
fvoges / 10_custom_dns.sh
Last active July 14, 2023 15:03
UniFi UDM Pro SE custom DNS
#!/bin/bash
# Get DataDir location
DATA_DIR="/data"
case "$(ubnt-device-info firmware || true)" in
1*)
DATA_DIR="/mnt/data"
;;
2*)
DATA_DIR="/data"
;;
@fvoges
fvoges / README.md
Created May 2, 2023 08:00
Vault list/revoke tokens

List all root tokens

vault list -format json auth/token/accessors | jq -r .[] | xargs -I '{}' vault token lookup -format json -accessor '{}' | jq -r 'select(.data.policies | any(. == "root"))'

List all tokens

vault list auth/token/accessors
@fvoges
fvoges / rkhunter
Created April 22, 2023 08:17
Gentoo rkhunter cron job script
#!/bin/bash
# original author: Aaron Walker <ka0ttic@gentoo.org>
########################## Begin Configuration ###############################
# Default options - more options may be added depending on the
# configuration variables you set below
# --cronjob implies -c, --nocolor, --sk
RKHUNTER_OPTS="--cronjob --summary"
@fvoges
fvoges / ns-user.acl
Created April 18, 2023 14:24
Example Vault namespace user policy
# Allow tokens to look up their own properties
path "acme/auth/token/lookup-self" {
capabilities = ["read"]
}
# Allow a token to look up its own capabilities on a path
path "acme/sys/capabilities-self" {
capabilities = ["update"]
}
@fvoges
fvoges / office365_uninstall.sh
Last active March 24, 2023 10:38
Uninstall macOS Office365
#!/bin/bash
# Source: https://community.jamf.com/t5/jamf-pro/how-to-remove-office-365-completely/m-p/254634/highlight/true#M236360
consoleuser=$(ls -l /dev/console | awk '{ print $3 }')
echo "logged in user is" $consoleuser
echo "Kill Microsoft Office Process..."
pkill -f Microsoft
@fvoges
fvoges / allow_k8s_auth.hcl
Created March 1, 2023 14:58
Vault ACL Policy to allow enabling only k8s auth method
path "sys/auth/*" {
capabilities = ["create","update"]
allowed_parameters = {
"type" = ["kubernetes"]
"*" = []
}
}
@fvoges
fvoges / haproxy.conf.j2
Created February 27, 2023 13:49
Ansible template fro HAProxy LB for Vault
global
log /dev/log local0
log /dev/log local1 notice
chroot /var/lib/haproxy
stats socket /run/haproxy/admin.sock mode 660 level admin expose-fd listeners
stats timeout 30s
user haproxy
group haproxy
daemon
@fvoges
fvoges / README.md
Created February 22, 2023 14:33
Simple CA for Vault

Example: Provision certs with OpenSSL

If you need to generate a CA and signed certificate and private key to test with, the following steps can be followed:

# Generate the CA private key
$ openssl genrsa -out ca-key.pem 4096

# Create a configuration file for the CA certificate
$ cat <<EOF > ca_cert_config.txt