Skip to content

Instantly share code, notes, and snippets.

View ppmathis's full-sized avatar

Pascal Mathis ppmathis

View GitHub Profile
@ppmathis
ppmathis / portknocker.ps1
Last active March 15, 2024 21:13
PowerShell Portknocker
# Remove old readonly constants from session
Remove-Variable -Name KNOCK_DESTINATION -Force -ErrorAction SilentlyContinue
Remove-Variable -Name KNOCK_VALID_TYPES -Force -ErrorAction SilentlyContinue
Remove-Variable -Name KNOCK_PORTS -Force -ErrorAction SilentlyContinue
Remove-Variable -Name KNOCK_EXE_TARGET -Force -ErrorAction SilentlyContinue
# === SCRIPT CONFIGURATION ===
Set-Variable KNOCK_DESTINATION -Option ReadOnly -Value "1.2.3.4"
Set-Variable KNOCK_VALID_TYPES -Option ReadOnly -Value ("TCP", "UDP")
Set-Variable KNOCK_PORTS -Option ReadOnly -Value ((1, "TCP"), (2, "TCP"), (3, "UDP"), (4, "UDP"))
openvswitch:
image: quay.io/snapserv/openvswitch:latest
restart: always
privileged: true
net: host
volumes:
- /lib/modules:/lib/modules
labels:
io.rancher.os.scope: system
io.rancher.os.after: network
This file has been truncated, but you can view the full file.
/*
This file is part of Ext JS 6.0.1.250
Copyright (c) 2011-2015 Sencha Inc
Contact: http://www.sencha.com/contact
GNU General Public License Usage
This file may be used under the terms of the GNU General Public License version 3.0 as
published by the Free Software Foundation and appearing in the file LICENSE included in the
#!/bin/bash
MYSQL_HOSTNAME="42.42.42.42"
MYSQL_DATABASE="pdns"
MYSQL_USERNAME="pdns"
MYSQL_PASSWORD="pdns"
CERT_FILE_USER="root"
CERT_FILE_GROUP="root"
@ppmathis
ppmathis / debian-stretch-fde.md
Last active January 30, 2022 15:26
Guide which explains an installation of Debian Stretch with full disk encryption (including "/boot" partition, containing initramfs+kernel) by using Debian Jessie Live.

Debian Stretch - Full Disk Encryption

This documents guides you through the process to install Debian Stretch with Full Disk Encryption. The following requirements exist:

  • Mainboard with UEFI-Support
  • Debian Stretch Live CD booted from UEFI
  • Two unformatted, unpartitioned HDDs/SSDs for Software RAID1 with mdmadm

After following this guide, you will end up with a setup like this:

  • Redundant GRUB Standalone EFI installation on both disks
@ppmathis
ppmathis / _modules\ssx.py
Last active January 25, 2022 12:23
SaltStack: Custom state and execution module for ansible-like 'assemble' function
import os
import salt.loader
import salt.utils
import salt.utils.jinja
import salt.utils.files
from salt.exceptions import SaltInvocationError, CommandExecutionError
def get_assemble_fragments(fragments_path, include_pattern=None, exclude_pattern=None):
-std=c++20
@ppmathis
ppmathis / duo_auth.sh
Created October 14, 2012 13:19
Improved two factor authentication with DuoSecurity
###########################################################
# Two factor authentication with DuoSecurity #
# #
# (c) 2012 P. Mathis <pmathis@snapserv.net> #
###########################################################
# This script will improve the normal UNIX integration #
# of DuoSecurity. You can specify for each SSH subsystem #
# if the two factor authentication is required. #
# #
# I am not responsible for lost or breached servers, #
package nagopher
import "github.com/markphelps/optional"
type thresholdModule struct{}
type thresholdOpt func(*threshold)
type threshold struct {
inverted bool
lowerBound optional.Float64
upperBound optional.Float64
@ppmathis
ppmathis / screenshot.sh
Last active August 4, 2018 18:51
Linux screenshot script, can be used together with a custom shortcut. Based on notify-send, shutter, scp and xclip.
#!/bin/sh
# Options
RANDOM_CHARS=$(< /dev/urandom tr -dc a-z0-9 | head -c10)
FILE_DESTINATION='/home/pmathis/Pictures/Screenshots'
FILE_FORMAT=$RANDOM_CHARS'_%Y-%m-%d_%H.%M.%S.png'
SSH_ALIAS='trinity'
SSH_FOLDER='/home/pmathis/public/screens.snapserv.net'
HTTP_URL='https://screens.snapserv.net'
SUCCESS_ICON='/usr/share/icons/gnome/32x32/status/stock_dialog-info.png'
FAILURE_ICON='/usr/share/icons/gnome/32x32/status/stock_dialog-error.png'