Skip to content

Instantly share code, notes, and snippets.

@jeffgeiger
jeffgeiger / AIX_KRB5LDAP_In_A_Nutshell
Last active May 18, 2017 09:59
Rough outline of how I set up Kerberos and LDAP integration between Active Directory and IBM AIX using the KRB5LDAP load module.
Environment:
Tested with AIX 6.1 TL 8(6100-08-00-0000) and TL 6 (6100-06-01-1043) with Active Directory on 2008R2 domain controllers at the 2003 functional level.
Prerequisites:
DNS: A and PTR records for AIX host in Windows DNS server.
AD: Computer object matching AIX hostname in Active Directory.
AD: A target OU that will contain AIX objects.
AD: At least one “Unix enabled” user in the target OU. (Separate document)
AD: A service account user that will be used for LDAP binds to AD.
AIX: Ensure that the `hostname` command returns the FQDN of the AIX server.
@jeffgeiger
jeffgeiger / munin-node.sh
Last active April 7, 2022 20:05
A generic stand-in for munin-node written to run on AIX, may work elsewhere.
#!/bin/ksh
#Connected - echo basic info
echo "# munin node at `hostname`"
#watchdog timestamp
WD_TIME=$(perl -e 'print time')
@jeffgeiger
jeffgeiger / gatherlogs.samples.sh
Created May 23, 2013 18:51
Modified version of the stock gatherlogs.samples.sh GPFS script. Switched from RSH to SSH.
#!/bin/ksh
#
# Sample script to gather, merge and sort mmfs.log files
# from nodes listed in file /tmp/gpfs.allnodes
#
# /tmp/gpfs.allnodes has been created by the user of this script
# and contains the host names of the nodes that the
# mmfs.log files are required from. No blank lines.
#
# Output file is called: /tmp/logs.sorted on node script is executes from
@jeffgeiger
jeffgeiger / Imp_AD_to_SQLite.ps1
Created May 23, 2013 19:02
Dump AD user attributes into a SQLite database.
Import-Module ActiveDirectory
Import-Module SQLite #SQLite Module from http://psqlite.codeplex.com/
mount-sqlite -name db -dataSource H:\Papa\bp3_aix.sqlite
Get-ADUser -Filter { employeeID -like "*" } -Properties uid, employeeID, sAMAccountName, sn, givenName, Name | foreach {
$query = 'insert into ad_dump (uid, empID, sam, sn, gn, name) values ("'+$_.uid+'", "'+$_.employeeID+'", "'+$_.sAMAccountName+'", "'+$_.sn+'", "'+$_.givenName+'", "'+$_.Name+'");'
Invoke-Item db: -sql $query
}
@jeffgeiger
jeffgeiger / clone_ldap_to_local.ksh
Created July 22, 2013 19:17
Clone LDAP users/groups from AD into local users/groups. Probably.
#!/bin/sh
SCRIPT_NAME=$(basename $0)
usage() {
cat <<EOF
This script will query a set of given groups from the AIX LDAP registry using the AIX command line tools (lsuser, lsgroup), and it will create
them locally (mkgroup, mkuser).
Known Bugs:
# Postfix stuff
QUEUEID (?:[A-F0-9]{11}|NOQUEUE)
EMAILADDRESSPART [a-zA-Z0-9_.+-=:]+
EMAILADDRESS %{EMAILADDRESSPART:local}@%{EMAILADDRESSPART:remote}
RELAY (?:%{HOSTNAME:relayhost}(?:\[%{IP:relayip}\](?::[0-9]+(.[0-9]+)?)?)?)
#RELAY (?:%{HOSTNAME:relayhost}(?:\[%{IP:relayip}\](?:%{POSREAL:relayport})))
POSREAL [0-9]+(.[0-9]+)?
#DELAYS %{POSREAL:a}/%{POSREAL:b}/%{POSREAL:c}/%{POSREAL:d}
DELAYS (%{POSREAL}[/]*)+
DSN %{NONNEGINT}.%{NONNEGINT}.%{NONNEGINT}
@jeffgeiger
jeffgeiger / update_vulscan.sh
Created August 19, 2013 21:06
Simple script to update nmap VSE vulnerability scanner in Homebrew.
#!/bin/bash
echo "Updating vulscan database..."
cd /usr/local/Cellar/nmap/6.40/share/nmap/scripts/vulscan/
rm *.csv
wget http://www.computec.ch/projekte/vulscan/download/cve.csv
wget http://www.computec.ch/projekte/vulscan/download/exploitdb.csv
@jeffgeiger
jeffgeiger / spamstats.pl
Created August 22, 2013 03:52
Munin-node spamstats plugin - enhanced
#!/usr/bin/perl
# -*- perl -*-
=head1 NAME
spamstats - Plugin to graph spamassassin throughput
=head1 CONFIGURATION
This plugin does not have any configuration
@jeffgeiger
jeffgeiger / kibana
Last active December 21, 2015 22:58 — forked from nodesocket/kibana
Modified to use RVM.
#!/bin/bash
### BEGIN INIT INFO
# Provides: kibana
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Make sense of a mountain of logs.
### END INIT INFO
@jeffgeiger
jeffgeiger / brocolor.sh
Last active December 22, 2015 13:18
Colorize columns in bro logs
#!/bin/bash
cat $1 | sed 's/#fields\t\|#types\t/#/g' | awk 'BEGIN {FS="\t"};{for(i=1;i<=NF;i++) printf("\x1b[%sm %s \x1b[0m",(i%7)+31,$i);print ""}'