Skip to content

Instantly share code, notes, and snippets.

View jpawlowski's full-sized avatar

Julian Pawlowski jpawlowski

View GitHub Profile
@jpawlowski
jpawlowski / Invoke-EntraGuestExternalSponsorManagement.ps1
Last active July 3, 2026 14:37
Finds external sponsors of Entra ID guest users and optionally adds them to a group or transfers sponsorship to their manager.
#Requires -Version 7.4
# NOTE: Microsoft.Graph.Authentication is imported explicitly below rather than via
# '#Requires -Modules'. Under PowerShell 7.5 'pwsh -File <script>' SILENTLY DISCARDS the script's
# exit code (every 'exit N' becomes process exit 0) when the script carries a '#Requires -Modules'
# directive -- which would make every validation/error 'exit 1' look like success to a scheduler or
# wrapper that checks $LASTEXITCODE/%ERRORLEVEL. An explicit Import-Module keeps the same fail-fast
# prerequisite check while preserving correct exit codes.
<#
.SYNOPSIS
@jpawlowski
jpawlowski / zabbix_mibs_vendors_link.sh
Last active May 21, 2026 07:11
SNMP MIB and SNMPTT helper script for Zabbix integration
@jpawlowski
jpawlowski / PSFunction1_Test-HmacAuthorization.ps1
Last active March 16, 2026 13:37
Verify HMAC signature of incoming Azure Automation webhook requests.
function Test-HmacAuthorization {
<#
.SYNOPSIS
Verifies HMAC signature of incoming Azure Automation webhook requests.
.DESCRIPTION
Validates HMAC signature based on signed request headers (timestamp, nonce, content hash) and a shared secret.
Supports both HMACSHA256 and HMACSHA512 algorithms.
The shared secret is passed securely as a SecureString, converted as late as possible, and cleared from memory immediately after use.
@jpawlowski
jpawlowski / etc_nginx_sites-available_pdns-api
Last active February 8, 2026 09:34
PowerDNS API Proxy configuration for NGINX, including API navigation via RapiDoc and API key management.
# /etc/nginx/sites-available/pdns-api
#
# `ln -s /etc/nginx/sites-available/pdns-api /etc/nginx/sites-enabled/pdns-api`
map_hash_bucket_size 128;
# --- MAPS GO HERE ---
map $http_x_api_key:$remote_addr $internal_pdns_key {
default "";
include /etc/powerdns/api-keys.map;
@jpawlowski
jpawlowski / proxmox-create-hourly-rotating-snapshot.sh
Last active January 11, 2026 01:33
Proxmox Hourly Snapshot Rotation (JSON + Tag-Aware): A lightweight Bash script that creates hourly snapshots for running Proxmox guests (QEMU VMs and LXC containers) and automatically prunes older auto_YYYYMMDDHH snapshots to keep a fixed rotation. It queries the Proxmox API via pvesh in JSON (parsed with jq) for reliable guest discovery across …
#!/bin/bash
set -euo pipefail
PATH="/usr/sbin:/usr/bin:/sbin:/bin"
DATE="$(date +'%Y%m%d%H')"
DEFAULT_KEEP=24
DEFAULT_RETAIN_DAYS=7
DEFAULT_TIMEOUT="30m"
DEFAULT_SKIP_TAGS="nosnap"
@jpawlowski
jpawlowski / brew-sync.sh
Last active January 6, 2026 22:36
Sync Homebrew installations between Macs via Dropbox
#!/bin/bash
# Sync Homebrew installations between Macs via Dropbox
#
BREW="/usr/local/bin/brew"
# first get local settings
echo "Reading local settings ..."
rm -f /tmp/brew-sync.*
@jpawlowski
jpawlowski / automation_tibber_api.yaml
Last active November 12, 2025 20:04
HASS Tibber Price Information & Rating
alias: tibber_api_timer
description: ""
triggers:
- trigger: time_pattern
hours: "0"
minutes: "0"
seconds: "5"
- trigger: time_pattern
hours: "0"
minutes: "1"
@jpawlowski
jpawlowski / AzAutomationRunbook_New-TAP-for-Initial-MFA-Setup.ps1
Last active August 20, 2025 11:53
An Azure Automation Runbook that will help to generate new Temporary Access Pass codes for new employees in Microsoft Entra.
<#
.SYNOPSIS
Create a Temporary Access Pass code for new hires that have not set up any Authentication Methods so far
.DESCRIPTION
This script is intended to be run as an Azure Automation Runbook or as a standalone script.
Before generating a Temporary Access Pass, the script checks if the user has set up any Authentication Methods and has reached its hire date.
If the user has not set up any Authentication Methods, a Temporary Access Pass is created.
Depending on the configuration, the pass is output or sent to the user's manager via email.
#!/bin/bash
#
# see https://stribika.github.io/2015/01/04/secure-secure-shell.html
SSHD_VERSION=`/usr/sbin/sshd -v 2>&1 | grep OpenSSH | cut -d " " -f1 | cut -d "_" -f2 | cut -d"." -f2 | cut -d"p" -f1`
cat /etc/ssh/sshd_config | grep -v "KexAlgorithms" | grep -v "Ciphers" | grep -v "MACs" | grep -v "github.com" > /etc/ssh/sshd_config.new
cat /etc/ssh/ssh_config | grep -v "KexAlgorithms" | grep -v "Ciphers" | grep -v "MACs" | grep -v "github.com" > /etc/ssh/ssh_config.new
if [ "${SSHD_VERSION}" != "0" ]; then
# better algorithms only available on newer OpenSSH versions
echo "KexAlgorithms curve25519-sha256@libssh.org,diffie-hellman-group-exchange-sha256" >> /etc/ssh/sshd_config.new
@jpawlowski
jpawlowski / msys_hetzner-etc_network_interfaces
Created August 12, 2012 12:06
Debian network configuration for Proxmox VE server running on a Hetzner host
# /etc/network/interfaces
#
auto lo
iface lo inet loopback
# device: eth0
iface eth0 inet manual
# IPv4 bridge
# (connect ONLY your firewall/router KVM instance here, this is the WAN device!)