Skip to content

Instantly share code, notes, and snippets.

View dlangille's full-sized avatar

Dan Langille dlangille

View GitHub Profile
@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 / 0 - get the right version
Last active April 1, 2024 15:25
librenms reported problems
I run this on my server called 'empty'.
Assuming you've done a git clone or a git pull of the code...
Switch to the release you want to build:
[dan@empty:~/librenms] $ export RELEASE=1.56
[dan@empty:~/librenms] $ git checkout master
[dan@empty:~/librenms] $ git pull
[dan@empty:~/librenms] $ git checkout tags/$RELEASE
@dlangille
dlangille / 1 - I plan to turn these off
Last active March 21, 2024 13:25
Periodic things to turn off in FreeBSD jails
# after reviewing /etc/defaults/periodic.conf I have decided
# to disable these items in jails
daily_status_disks_enable="NO"
daily_status_network_enable="NO"
daily_status_uptime_enable="NO"
# not needed on jails
daily_ntpd_leapfile_enable="NO"
@dlangille
dlangille / report-package-notifications.php
Created February 19, 2024 14:33
FreshPorts - subscribe to package notifications
<!DOCTYPE html>
<html lang="en">
<head>
<title>FreshPorts -- Package Notifications</title>
<link rel="stylesheet" href="/css/freshports.css?v=a112636a" type="text/css">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="description" content="Package Notifications">
47.76.35.19 - - [09/Jan/2024:00:00:02 +0000] "GET /commit.php?files=yes&message_id=200809240908.m8O98gWf053619%40repoman.freebsd.org HTTP/1.1" 200 4156 "-" "Mozilla/5.0 (Windows NT 6.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.2013.169 Safari/537.36"
47.76.35.19 - - [09/Jan/2024:00:00:02 +0000] "HEAD /commit.php?category=graphics&files=yes&message_id=201502211511.t1LFBrkF003830%40svn.freebsd.org&port=gthumb HTTP/1.1" 301 0 "-" "Mozilla/5.0 (Windows NT 6.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.2975.4 Safari/537.36"
47.76.35.19 - - [09/Jan/2024:00:00:03 +0000] "HEAD /commit.php?category=x11-toolkits&files=yes&message_id=200412132012.iBDKCF3f073228%40repoman.freebsd.org&port=qt33 HTTP/1.1" 301 0 "-" "Mozilla/5.0 (Windows NT 6.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3405.157 Safari/537.36"
47.76.35.19 - - [09/Jan/2024:00:00:03 +0000] "HEAD /search.php?method=match&query=databases%2Fpecl-cassandra&stype=depends_all HTTP/1.1" 301 0 "-" "Mozil
@dlangille
dlangille / create.sh
Last active December 26, 2023 22:01
snmp v3 clients for LibreNMS
For more up to date information, see https://dan.langille.org/2023/08/16/configuration-of-net-mgmt-net-snmpd-on-freebsd/
Do this on the snmpd client:
service snmpd stop
net-snmp-config --create-snmpv3-user -ro -A 'AuthPass' -X 'PrivPass' -a SHA -x AES MyRoGroup
chmod go-rwx /var/net-snmp/snmpd.conf /usr/local/share/snmp/snmpd.conf
verify MyRoGroup is in /usr/local/share/snmp/snmpd.conf
@dlangille
dlangille / 1 - background
Created October 25, 2023 01:08
Let's test the timeout option for /etc/resolv.conf (note host(8) is not a valid test; it does not honor options)
I have N nameservers. If one, or more, of them are down, I still want DNS to resolve quickly.
I could use carp or vrrp. But I'm not there yet.
The pro of carp/vrrp - no changes to clients.
THe pro of /etc/resolv.conf - don't have to set up carp/vrrp - easy to test
@dlangille
dlangille / grep memory
Created October 19, 2023 19:01
I can't get Librenms to display memory usage for FreeBSD hosts at home - but I can at work and I can't see why.
[18:57 empty dan ~] % snmpwalk -v3 -l authPriv -u roDVL -a SHA -A foobarfoo -x AES -X barfoobar empty.int.unixathome.org | grep -i memory
DISMAN-EVENT-MIB::mteTriggerComment."snmpd.conf".'memory' = STRING:
DISMAN-EVENT-MIB::mteTriggerTest."snmpd.conf".'memory' = BITS: 40 boolean(1)
DISMAN-EVENT-MIB::mteTriggerSampleType."snmpd.conf".'memory' = INTEGER: absoluteValue(1)
DISMAN-EVENT-MIB::mteTriggerValueID."snmpd.conf".'memory' = OID: UCD-SNMP-MIB::memSwapError
DISMAN-EVENT-MIB::mteTriggerValueIDWildcard."snmpd.conf".'memory' = INTEGER: true(1)
DISMAN-EVENT-MIB::mteTriggerTargetTag."snmpd.conf".'memory' = STRING:
DISMAN-EVENT-MIB::mteTriggerContextName."snmpd.conf".'memory' = STRING:
DISMAN-EVENT-MIB::mteTriggerContextNameWildcard."snmpd.conf".'memory' = INTEGER: false(2)
DISMAN-EVENT-MIB::mteTriggerFrequency."snmpd.conf".'memory' = Gauge32: 600 seconds
@dlangille
dlangille / periodic.conf
Last active September 23, 2023 23:41
A Nagios check for FreeBSD systems which have https://www.freshports.org/ports-mgmt/pkg installed
# I use these settings in /etc/periodic.conf
# for security/405.pkg-base-audit and others
security_status_baseaudit_enable="YES"
security_status_baseaudit_jails="*"
security_status_pkgaudit_expiry=1
pkg_jails='*'
@dlangille
dlangille / 1 - test script
Last active May 28, 2023 13:05
I want to ignore jail names which start with pkg01.131amd64 etc - see https://github.com/freebsd/pkg/pull/2146
[11:39 r730-01 dvl ~] % cat ~/tmp/test-security_status_pkgaudit_jails_ignore.sh
#!/bin/sh
security_status_baseaudit_jails_ignore="pkg01"
jails="stage-nginx01.int.unixathome pg03.int.unixathome.org 131amd64-default-wikis-job-07 pkg01.131i386-default-gelt-job-02"
for j in ${jails} ; do
# ignore some jails
# we iterate to get exact matches because we want substring matches