Skip to content

Instantly share code, notes, and snippets.

View jonzobrist's full-sized avatar

Jon Zobrist jonzobrist

View GitHub Profile
#!/usr/bin/env python3
"""
Name: send_logs.py
Description: Client test agent to generate and send unique lines to local syslog
"""
import time
import sys
import random
import syslog
@jonzobrist
jonzobrist / set challange-ack w script
Created August 13, 2016 21:02
CVE-2016-5696 mitigation
curl -O https://raw.githubusercontent.com/jonzobrist/Bash-Admin-Scripts/master/set-sysctl-challenge-ack.sh
chmod uog+x set-sysctl-challenge-ack.sh
sudo ./set-sysctl-challenge-ack.sh
@jonzobrist
jonzobrist / gist:7359165
Created November 7, 2013 18:07
cfengine weird output
cf3> -> Handling file existence constraints on /root/bin
cf3> -> Promise to skip base directory /root/bin
cf3> -> Basedir "/root/bin" not promising anything
cf3> -> Copy file /root/bin from /var/cfengine/masterfiles/inthinc/rootbin check
cf3> No existing connection to 192.168.8.5 is established...
cf3> Set cfengine port number to 5308 = 5308
cf3> Set connection timeout to 30
cf3> -> Connect to 192.168.8.5 = 192.168.8.5 on port 5308
cf3> !! Error connecting to server (timeout)
@jonzobrist
jonzobrist / reset-ssh-keys-prefix-suffix.sh
Last active March 29, 2019 11:19
reset-ssh-keys-prefix-suffix.sh Re-gather ssh public keys for current servers from live current instances and update local known hosts for given prefix / suffix list.
#!/bin/bash
#
# Purpose : This script takes a list of prefixes, and suffixes, creates a list of hostnames
# and deletes the local users key for those hosts and adds a new one.
# I created this for use on Amazon Web Services EC2 since we are re-using similar name aliases
# and need an easy way to update the ssh keys.
#
# WARNING : from man ssh-keyscan
# If an ssh_known_hosts file is constructed using ssh-keyscan without verifying the keys, users will be
# vulnerable to man in the middle attacks. On the other hand, if the security model allows such a risk,
@jonzobrist
jonzobrist / cf-sketch-runfile.cf
Last active December 24, 2015 10:49
promises.cf
# cat /var/cfengine/masterfiles/cf-sketch-runfile-standalone.cf
body common control
{
bundlesequence => { cfsketch_g, cfsketch_run };
inputs => { @(cfsketch_g.inputs) };
}
# environment common bundles
@jonzobrist
jonzobrist / gist:3428166
Created August 22, 2012 18:27
yale groupBundles.cf fixed for generic linux not redhat specific
###############################################################################
#
# Add a user to a group, if not already a member. If group does not exist,
# first create it.
#
# IMPORTANT: this bundle has only been tested against RHEL5 and AIX. It is
# known to fail at RHEL3, where usermod does not support the "-a" flag for
# appending, rather than overwriting, secondary groups to a user account. Test
# carefully before applying to other distros.
#
@jonzobrist
jonzobrist / gist:3383358
Created August 17, 2012 23:07
Example example_sysctl.cf file for CFEngine 3 Sketch System::sysctl
################################
#
# Setup sysctl.conf on servers using cf-sketch sysctl
#
# Download & Install cf-sketch and install Nick Anderson's System::sysctl sketch
# CFEngine Design Center https://github.com/cfengine/design-center
# Nick's System::syctl sketch branch
# https://github.com/nickanderson/design-center/tree/feature/sysctl/sketches/system/sysctl
#
# Include this in your bundlesequence {}
#########################################################################
#
# linux_sudoers.cf - Watch sudoers file for changes, overwrite with master if it changes
#
#
#
#
#########################################################################
bundle agent linux_sudoers {