Skip to content

Instantly share code, notes, and snippets.

View FlorianHeigl's full-sized avatar

Florian Heigl FlorianHeigl

View GitHub Profile
# Powershell refuses to connect to the Netbox API on our setup without this.
add-type @"
using System.Net;
using System.Security.Cryptography.X509Certificates;
public class TrustAllCertsPolicy : ICertificatePolicy {
public bool CheckValidationResult(
ServicePoint srvPoint, X509Certificate certificate,
WebRequest request, int certificateProblem) {
return true;
}
@FlorianHeigl
FlorianHeigl / configure_apcupsd.md
Last active November 6, 2020 16:47 — forked from gschora/configure_apcupsd
configuring apcupsd to suspend all running VM and then shutdown the esxi 5.5 u1 host

Instructions

Description

these are instructions for automating the suspend and shutdown of ESXi VMs and host in case of a power failure. works with APC/Schneider SmartUPS 750xl and ESXi 5.5u1

Steps

  1. make a new VM and install Ubuntu-Server on it
@FlorianHeigl
FlorianHeigl / configure_apcupsd
Created November 6, 2020 16:08 — forked from gschora/configure_apcupsd
configuring apcupsd to suspend all running VM and then shutdown the esxi 5.5 u1 host
###############################################################################################################
# these are instructions for automating the suspend and shutdown of esxi vm's and host in case of a
# power failure.
# works with apc smartups 750xl and esxi 5.5u1
###############################################################################################################
0# make a new VM and install Ubuntu-Server on it
1# install apcupsd
apt-get install apcupsd
@FlorianHeigl
FlorianHeigl / jail.local
Created October 23, 2020 19:53 — forked from pida42/jail.local
Fail2Ban - SMTP fiters that helps me resolve attacked mail server with Postfix and Dovecot
## content of: /etc/fail2ban/jail.local
[mail-smtp]
enabled = true
logpath = /var/log/mail.log
filter = mail-smtp
maxretry = 1
action = iptables-multiport[name=mail-smtp, port="25,587", protocol=tcp]
@FlorianHeigl
FlorianHeigl / icinga.sh
Last active June 25, 2019 20:27 — forked from jpmens/icinga.sh
#!/bin/sh
OK=0
CRIT=2
tics=$(date +%s)
if [ "$tics" -gt 1561741200 -a "$tics" -lt 1561914000 ]; then
# From Friday 17:00Z to Sunday: STFU
echo "OK - Please do not disturb; party in progress"
exit $OK
@FlorianHeigl
FlorianHeigl / pgist.sh
Created May 23, 2019 09:21 — forked from rubo77/create-gist.sh
Post GIST
#!/bin/bash
GITHUB_USERNAME=rubo77
if [[ "$1" == "" ]]; then
echo 'usage: gistfile-post.sh filename [gistname]'
exit 0
fi
# 0. file name for the Gist
@FlorianHeigl
FlorianHeigl / git-clearHistory
Last active December 25, 2019 01:04 — forked from stephenhardy/git-clearHistory
Steps to clear out the history of a git/github repository
## Remove the history from
rm -rf .git
## recreate the repos from the current content only
git init
git add .
git commit -m "Initial commit"
## push to the github remote repos ensuring you overwrite history
git remote add origin [email protected]:deepthinkag/curl2bash.git
@FlorianHeigl
FlorianHeigl / audit.rules
Created July 19, 2018 13:15 — forked from Neo23x0/audit.rules
Linux Auditd Best Practice Configuration
# ___ ___ __ __
# / | __ ______/ (_) /_____/ /
# / /| |/ / / / __ / / __/ __ /
# / ___ / /_/ / /_/ / / /_/ /_/ /
# /_/ |_\__,_/\__,_/_/\__/\__,_/
#
# Linux Audit Daemon - Best Practice Configuration
# /etc/audit/audit.rules
#
# Compiled by Florian Roth
@FlorianHeigl
FlorianHeigl / ssh.md
Created August 13, 2017 02:39 — forked from spuder/ssh.md
logstash-grok-ssh ignore root user

I have ssh connections from multiple users. I want to log all connectsion except those from the user 'git'. How dow you create an exception to a filter ?

input {

  file {
     path => "/var/log/auth.log"
     type => "syslog"
  }
}
@FlorianHeigl
FlorianHeigl / dm-cache-status
Last active March 19, 2017 12:06 — forked from oernii/dm-cache-status
fragile as fuck but keep around
#!/bin/bash -e
# $Id: dm-cache-status,v 1.1 2014/08/19 09:02:46 oernii Exp $
# Status
# ------
#
# <metadata block size> <#used metadata blocks>/<#total metadata blocks>
# <cache block size> <#used cache blocks>/<#total cache blocks>
# <#read hits> <#read misses> <#write hits> <#write misses>
# <#demotions> <#promotions> <#dirty> <#features> <features>*