My TrueNAS Scale server recently started throwing the following zfs module kernel panic on boot:
PANIC at space_map.c:405:space_map_load_callback()
What follows are the steps I took to retrieve the data from the corrupted zfs pool.
| package main | |
| import ( | |
| "encoding/binary" | |
| "fmt" | |
| "math/rand" | |
| "net" | |
| ) | |
| func main() { |
I was configuring a Centos6 box to receive syslog from remote hosts. I wanted that log to be written to a non-standard path: /data/syslog
On my first attempt, this failed with the following log in /var/log/messages:
Nov 26 11:26:24 localhost rsyslogd-3000: Could not open dynamic file '/data/syslog/10.10.1.252/2014-11/26/syslog.log' [state -3000] - discarding message [try http://www.rsyslog.com/e/3000 ]
I then set the context of /data/syslog to match /var/log with:
| #!/bin/bash | |
| # Given a list of IP addresses (in file 'ips') find what the SSL CN (subject) is for each one. | |
| echo -en "IP\tSSL CN\n" | |
| for i in `cat ips`; do | |
| echo -en "$i\t" | |
| out=`timeout 2 bash -c "openssl s_client -showcerts -connect $i:443 < /dev/null 2> /dev/null | openssl x509 -noout -subject 2> /dev/null | grep 'subject=' | sed -rn 's/.*CN=([^ /]+).*/\1/p'"` | |
| if [ $? -eq 124 ]; then | |
| echo "(timeout)" |
Retrieve hosted zones with aws route53 list-hosted-zones then enter the zone Id below:
aws route53 list-resource-record-sets --hosted-zone-id "/hostedzone/xxxxxxxxxxx" | \
jq -r '.ResourceRecordSets[] | [.Name, .Type, (.ResourceRecords[]? | .Value), .AliasTarget.DNSName?] | @tsv'| #!/bin/bash | |
| # | |
| # Update the ipset that iptables references for allowing/blocking based on country. | |
| # Takes 2 parameters: ipset name (no spaces), country name e.g. 'Australia' | |
| # | |
| # iptables should have an existing '--match-set' rule e.g | |
| # $ iptables -I INPUT -p tcp --dport 22 -m set --match-set australia4 src -j ACCEPT | |
| # $ ip6tables -I INPUT -p tcp --dport 22 -m set --match-set australia6 src -j ACCEPT | |
| # |