Skip to content

Instantly share code, notes, and snippets.

View dlangille's full-sized avatar

Dan Langille dlangille

View GitHub Profile
@dlangille
dlangille / pkg audit
Created January 21, 2015 17:55
old pkg and new pkg give different results for pkg audit
$ sudo pkg info -r libevent
libevent-1.4.14b_3:
tmux-1.9.a_1
$ sudo pkg audit -F
Vulnxml file up-to-date.
libevent-1.4.14b_3 is vulnerable:
libevent -- integer overflow in evbuffers
CVE: CVE-2014-6272
WWW: http://portaudit.FreeBSD.org/daa8a49b-99b9-11e4-8f66-3085a9a4510d.html
This isn't working:
svnadmin dump pgcon.org > pgcon.dump
svndumpfilter --drop-empty-revs exclude \
pgcon.org/branches/PGCON_2014_BRANCH/LettersOfInvitation \
< pgcon.dump > pgcon.dump.invoice.free
svnadmin create new.pgcon
svnadmin load new.pgcon < pgcon.dump.invoice.free
@dlangille
dlangille / gist:df1a3adde29d9d0d64b8
Last active August 29, 2015 14:15
Converting from gmirror to zfs
CPU: Intel(R) Atom(TM) CPU D525 @ 1.80GHz (1800.04-MHz K8-class CPU)
Origin = "GenuineIntel" Id = 0x106ca Family = 0x6 Model = 0x1c Stepping = 10
Features=0xbfebfbff<FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CLFLUSH,DTS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE>
Features2=0x40e31d<SSE3,DTES64,MON,DS_CPL,TM2,SSSE3,CX16,xTPR,PDCM,MOVBE>
AMD Features=0x20100800<SYSCALL,NX,LM>
AMD Features2=0x1<LAHF>
TSC: P-state invariant, performance statistics
real memory = 4294967296 (4096 MB)
avail memory = 4081803264 (3892 MB)
@dlangille
dlangille / install.sh
Last active December 21, 2018 09:04
ZFS root install
# Based on http://www.aisecure.net/2012/01/16/rootzfs/ and
# @vermaden's guide on the forums
# set your disks here
DISKS="ada0 ada1"
# where will we fetch the install from?
FTPURL="ftp://ftp.freebsd.org/pub/FreeBSD/releases/amd64/10.1-RELEASE"
# the hostname this computer will have:
@dlangille
dlangille / gist:bf9d76e6ab14274e5256
Created February 25, 2015 21:27
Deleting MAILER DAEMON emails from a postfix mailq
mailq | grep MAILER-DAEMON | cut -f 1 -d ' ' | xargs -n 1 sudo postsuper -d
@dlangille
dlangille / btape
Last active August 29, 2015 14:16
FreeBSD 11 - new sa(4) code
[root@cuppy:/usr/home/dan] # btape -c /usr/local/etc/bacula/bacula-sd.conf /dev/nsa1
Tape block granularity is 1024 bytes.
btape: butil.c:287-0 Using device: "/dev/nsa1" for writing.
btape: btape.c:469-0 open device "DLT" (/dev/nsa1): OK
*test
=== Write, rewind, and re-read test ===
I'm going to write 10000 records and an EOF
then write 10000 records and an EOF, then rewind,
@dlangille
dlangille / poudriere-builds.sh
Created March 5, 2015 20:19
daily poudriere builds
#!/bin/sh
POUDRIERE="/usr/local/bin/poudriere"
TREES="default testing"
AMD64_SETS="master-list master-list-php5"
I386_SETS="master-list-i386"
@dlangille
dlangille / example
Last active October 8, 2022 13:52
New script for snapshots of iocage jails for backups
This is example output from the script below. I have since amended the script from example, to full functional.
Recents changes mean that umounted datasets will not be backed up.
You should read this in conjunction with https://gist.github.com/dlangille/dac3b6d138bb12874f9a which outlines the Bacula job.
$ zfs list system/iocage/jails
NAME USED AVAIL REFER MOUNTPOINT
system/iocage/jails 31.8G 344G 104K /iocage/jails
@dlangille
dlangille / gist:191c7dc1b29bab8cfefd
Created March 27, 2015 14:07
zfs destroy -r FS@snapshot example
An example of how zfs destroy -r will remove snapshots on child datasets.
[root@slocum:~] # zfs create system/SnapShotTesting
[root@slocum:~] # zfs create system/SnapShotTesting/A
[root@slocum:~] # zfs create system/SnapShotTesting/B
[root@slocum:~] # zfs create system/SnapShotTesting/B
cannot create 'system/SnapShotTesting/B': dataset already exists
[root@slocum:~] # zfs create system/SnapShotTesting/C
[root@slocum:~] # zfs create system/SnapShotTesting/C/CC
[root@slocum:~] # zfs snapshot -r system/SnapShotTesting@TEST
@dlangille
dlangille / check_host_vs_jails.sh
Last active August 29, 2015 14:17
Compare iocage jail version against the host - nagios check
#!/bin/sh
HOSTVERSION=`/usr/bin/file /bin/sh`
JAILS=`/usr/local/sbin/iocage list | /usr/bin/egrep -v '^JID' | /usr/bin/cut -f 2 -w`
ERRORS=''
for jail in ${JAILS}
do
JAILVERSION=`/usr/local/sbin/iocage chroot ${jail} 'file /bin/sh'`
if [ "${JAILVERSION}" != "${HOSTVERSION}" ]