summary refs log tree commit diff stats
path: root/system/services/taskserver/certs/generate.crl
blob: e9f6715a43326a92c545066b3dd9b1e087c9c337 (plain) (blame)
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
40
41
42
#!/bin/sh

# Take the correct binary to create the certificates
CERTTOOL=$(command -v gnutls-certtool 2>/dev/null || command -v certtool 2>/dev/null)
if [ -z "$CERTTOOL" ]
then
  echo "ERROR: No certtool found" >&2
  exit 1
fi

. ./vars

if ! [ -f crl.template ]
then
  # CRL - Certificate Revocation List
  cat <<EOF >crl.template
expiration_days = $EXPIRATION_DAYS
EOF
fi

if ! [ -f server.crl.pem ]
then
  $CERTTOOL \
    --generate-crl \
    --load-ca-privkey ca.key.pem \
    --load-ca-certificate ca.cert.pem \
    --template crl.template \
    --outfile server.crl.pem
fi

chmod 600 server.crl.pem

# To create a CRL that contains some revoked certificates, place the
# certificates in a file and use --load-certificate as follows:
# $CERTTOOL \
#   --generate-crl \
#   --load-ca-privkey ca.key.pem \
#   --load-ca-certificate ca.cert.pem \
#   --load-certificate revoked-certs.pem

# To verify a CRL:
#   $CERTTOOL --verify-crl --load-ca-certificate ca.cert.pem --infile server.crl.pem