retire da-backup checks
[mirror/dsa-nagios.git] / dsa-nagios-checks / checks / dsa-check-unbound-anchors
1 #!/bin/bash
2
3 set -e
4 set -u
5
6 not_valid=""
7 for key in $(find /var/lib/unbound -type f) ; do
8         if ! grep -v '^;' "$key" | grep -q '\[  VALID  \]'; then
9                 not_valid="$not_valid $(basename "$key" .key)"
10         fi
11 done
12 if [ -n "$not_valid" ]; then
13         echo "Warning: no valid trust anchors found for$not_valid."
14         exit 1
15 fi
16
17 old_anchors=$(find /var/lib/unbound -type f -mtime +5)
18 if [ -n "$old_anchors" ]; then
19         echo "Warning: Some keys are old: $old_anchors."
20         exit 1
21 fi
22
23
24 echo "OK: All keys in /var/lib/unbound recent and valid"
25 exit 0