Skip to content

Instantly share code, notes, and snippets.

@hcooper
hcooper / new-openvpn-client.sh
Created February 7, 2011 11:01
Script to automate creating new OpenVPN client certificates and make them easy to download
#! /bin/bash
# Script to automate creating new OpenVPN clients
# The client cert and key, along with the CA cert is
# zipped up and placed somewhere to download securely
#
# H Cooper - 05/02/11
#
# Usage: new-openvpn-client.sh <common-name>
# Set where we're working from
@hcooper
hcooper / new-apache2-site.sh
Created February 7, 2011 11:03
Script to automate creating new apache2 virtual hosts
#! /bin/bash
# Script to automate creating new apache2 virtual hosts.
# Logs go in /var/log/apache2/$SN
# DocRt is /var/www-vhosts/$SN
# SN = shortname -- used for directory names etc.
# DN = domainname -- used only in apache config file
#
# H Cooper - 18/10/06
#
@hcooper
hcooper / ping_tcp.pl
Created February 8, 2011 15:24
Script to ping tcp connections, which gets round firewall ICMP blocks. Taken from the Backuppc mailing list here: http://www.mail-archive.com/backuppc-users@lists.sourceforge.net/msg07903.html
#!/usr/bin/perl -w
use strict;
use Net::Ping;
die "usage: $0 port hostname\n" unless(@ARGV == 2);
my $serv = shift @ARGV;
my $host = shift @ARGV;
my $p = Net::Ping->new("tcp", 30);
@hcooper
hcooper / mysql_rep.sh
Created June 16, 2011 19:16
A mysql replication plugin for the check_mk nagios system
moved into my main check_mk plugin repo...
@hcooper
hcooper / check_mk_sun_hw_windows.bat
Created October 4, 2011 14:08
check_mk script to query Sun Hardware alerts via IPMI on Windows (2003)
moved into main check_mk plugin repo....
@hcooper
hcooper / gist:1267869
Created October 6, 2011 16:30
check_mk tcp check
moved into my main check_mk plugin repo...
@hcooper
hcooper / proxy.py
Created November 9, 2011 19:36
A simple threaded caching HTTP proxy
#!/usr/bin/python
"""
A simple threaded caching HTTP proxy.
Hereward Cooper <coops@fawk.eu>
v0.1
"""
LISTENPORT = 8000
LISTENINT = '127.0.0.1'
@hcooper
hcooper / ciphertest.sh
Created September 6, 2012 11:09
Report what ciphers are support by a given host (using openssl)
#!/usr/bin/env bash
# ciphertest.sh
# Hereward Cooper <coops@fawk.eu> - 6th Sept 2012
# Report what ciphers are support by a given host
# Modifed from code found here: http://superuser.com/questions/109213/
# Do we want to pause between each cipher?
DELAY=0
@hcooper
hcooper / savenetconfig.sh
Created September 14, 2012 08:42
Saving running network config to sysconfig
#!/bin/bash
# Hack to quickly save the running network config to sysconfig
DEV=eth0
IPDATA=`ip addr show dev $DEV | tr -s " " | grep -m 1 inet | cut -d " " -f 3`
IP=`echo $IPDATA | cut -d "/" -f 1`
NM=`echo $IPDATA | cut -d "/" -f 2`
MAC=`ip addr show dev $DEV | tr -s " " | grep 'link/ether' | cut -d " " -f 3`
@hcooper
hcooper / xinetd_remove_only_from.sh
Created September 14, 2012 08:48
Remove any access restrictions for xinetd services
## Remove any access restrictions for xinetd services
# Our list of services
SERVICES="nrpe check_mk"
# $RUN determines is we need to do a restart afterwards
RUN=0
for service in $SERVICES; do