aboutsummaryrefslogtreecommitdiff
path: root/lib/keyringer/actions/check
blob: 83401b809a5994cf3a421a7dc77f9a006d6c830e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/bin/bash
#
# Check a keyring.
#
# See also some useful OpenPGP maintenance scripts:
#
#   - git://lair.fifthhorseman.net/~mjgoins/cur
#   - https://gitorious.org/key-report
#   - https://github.com/ilf/gpg-maintenance.git
#   - https://gaffer.ptitcanardnoir.org/intrigeri/code/parcimonie/
#
# This script can run from a crontab, client or server side to check
# keyringer health status.

# Load functions
LIB="`dirname $0`/../functions"
source "$LIB" || exit 1

# The following should run automatically from keyringer_check_recipients:
#
# TODO: Pull the keyring repository.
# TODO: Fetch absent keys from all recipients.
# TODO: Check if keys in all recipients files are about to expire.
# TODO: Time to expire can be configured via repository options.
# TODO: Users can be alerted by mail if configured by user preferences.
# TODO: Outgoing emails can be encrypted.

# This should be done here:
# TODO: Check canaries' timestamps, warning by mail if configured by user preferences.

# Git maintenance operations.
if [ -d "$BASEDIR/.git" ]; then
  echo "Running git maintenance operations..."
  keyringer_exec git "$BASEDIR" fsck
  keyringer_exec git "$BASEDIR" gc --prune=all
else
  echo "Fatal: not a git repository: $BASEDIR"
  exit 1
fi