Skip to content

Instantly share code, notes, and snippets.

View dlangille's full-sized avatar

Dan Langille dlangille

View GitHub Profile
@dlangille
dlangille / manage.py migrate
Created August 9, 2024 12:05
Updating bsdcan (mine) from 0.0.20221126_11 to 0.0.20240809
[12:02 www dvl /usr/local/etc/pgeu-system] % pkg info --pkg-message pgeu-system-www-0.0.20240809
pgeu-system-www-0.0.20240809:
On install:
When upgrading from version to version run this command:
cd /usr/local/www/pgeu-system
sudo ./manage.py migrate
[12:02 www dvl /usr/local/etc/pgeu-system] % cd /usr/local/www/pgeu-system
@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 / 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 / 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
@dlangille
dlangille / e8cc50a10937e2df4b591c87217bf3dc6334c6d1
Created March 24, 2023 11:15
SQL injection against FreshSource
[pro03 dan ~] % grep e8cc50a10937e2df4b591c87217bf3dc6334c6d1 freshsource.org-access.log
141.98.83.236 - - [23/Mar/2023:04:26:07 +0000] "GET /commit.php?message_id=e8cc50a10937e2df4b591c87217bf3dc6334c6d1 HTTP/1.1" 301 169 "-" "Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US) AppleWebKit/532.2 (KHTML, like Gecko) Chrome/4.0.222.12 Safari/532.2"
141.98.83.236 - - [23/Mar/2023:04:26:22 +0000] "GET /commit.php?message_id=e8cc50a10937e2df4b591c87217bf3dc6334c6d1 HTTP/1.1" 200 6506 "-" "Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US) AppleWebKit/532.2 (KHTML, like Gecko) Chrome/4.0.222.12 Safari/532.2"
141.98.83.236 - - [23/Mar/2023:04:26:33 +0000] "GET /commit.php?message_id=e8cc50a10937e2df4b591c87217bf3dc6334c6d1&UeCa%3D3347%20AND%201%3D1%20UNION%20ALL%20SELECT%201%2CNULL%2C%27%3Cscript%3Ealert%28%22XSS%22%29%3C%2Fscript%3E%27%2Ctable_name%20FROM%20information_schema.tables%20WHERE%202%3E1--%2F%2A%2A%2F%3B%20EXEC%20xp_cmdshell%28%27cat%20..%2F..%2F..%2Fetc%2Fpasswd%27%29%23 HTTP/1.1" 301 169 "-" "Mozilla/5.0 (Wi
@dlangille
dlangille / gist:7b20809e30d6066f5e5a259e3e67d6d5
Created January 23, 2023 15:00
Building vendor directory for librenms 22.12.0
[empty dan ~/librenms] % ./scripts/composer_wrapper.php install --no-dev 14:57:36
Deprecated: trim(): Passing null to parameter #1 ($string) of type string is deprecated in /usr/home/dan/librenms/scripts/composer_wrapper.php on line 40
Deprecated: trim(): Passing null to parameter #1 ($string) of type string is deprecated in /usr/home/dan/librenms/scripts/composer_wrapper.php on line 43
Could not scan for classes inside "vendor/dapphp/radius" which does not appear to be a file nor a folder
> LibreNMS\ComposerHelper::preInstall
Installing dependencies from lock file
Verifying lock file contents can be installed on current platform.
Package operations: 114 installs, 0 updates, 0 removals
[slocum dan ~] % vm list 21:29:05
/usr/local/sbin/vm: ERROR: virtual machines can only be managed by root
[slocum dan ~] % sudo vm list 21:29:06
NAME DATASTORE LOADER CPU MEMORY VNC AUTO STATE
hass default uefi 4 4GB - No Running (72577)
home-assistant default uefi 1 1GB - No Stopped
myguest default bhyveload 1 768M - No Stopped
Dec 26 21:09:17 r720-01 kernel: mps1: mpssas_prepare_remove: Sending reset for target ID 21
Dec 26 21:09:17 r720-01 kernel: da12 at mps1 bus 0 scbus8 target 21 lun 0
Dec 26 21:09:17 r720-01 kernel: da12: <ATA Samsung SSD 850 3B6Q> s/n S3PTNF0JA70159T detached
Dec 26 21:09:17 r720-01 kernel: mps1: No pending commands: starting remove_device
Dec 26 21:09:18 r720-01 kernel: (da12:mps1:0:21:0): Periph destroyed
Dec 26 21:09:18 r720-01 ZFS[67733]: vdev state changed, pool_guid=1975810868733347630 vdev_guid=8716406602783665762
Dec 26 21:09:18 r720-01 ZFS[67737]: vdev is removed, pool_guid=1975810868733347630 vdev_guid=8716406602783665762
Dec 26 21:09:19 r720-01 kernel: da12 at mps1 bus 0 scbus8 target 21 lun 0
Dec 26 21:09:19 r720-01 kernel: da12: <ATA Samsung SSD 850 3B6Q> Fixed Direct Access SPC-4 SCSI device
Dec 26 21:09:19 r720-01 kernel: da12: Serial Number S3PTNF0JA70159T