vmailpasswd
[hcoop/domtool2.git] / scripts / domtool-addcert-daemon
CommitLineData
25c93232
AC
1#!/bin/sh -e
2
3 KEYDIR=/afs/hcoop.net/common/etc/domtool/keys/$1
4 KEYFILE=$KEYDIR/key.pem
5CERTFILE=/afs/hcoop.net/common/etc/domtool/certs/$1.pem
6 NEWREQ=~/.newreq.pem
7 NEW=~/.new.pem
8 KEYIN=~/.keyin
9
10mkdir $KEYDIR || echo Already exists
11openssl genrsa -out $KEYFILE
12chown -R domtool.domtool $KEYDIR
13echo "." >$KEYIN
14echo "." >>$KEYIN
15echo "." >>$KEYIN
16echo "." >>$KEYIN
17echo "." >>$KEYIN
18echo "$1" >>$KEYIN
19echo "$1@hcoop.net" >>$KEYIN
20echo "" >>$KEYIN
21echo "" >>$KEYIN
22openssl req -new -key $KEYFILE -out $NEWREQ -days 365 <$KEYIN
23rm $KEYIN
24cat $NEWREQ $KEYFILE >$NEW
25rm $NEWREQ
26openssl ca -batch -config /etc/domtool/openssl.cnf -policy policy_anything -out $CERTFILE -infiles $NEW
27rm $NEW
28chown domtool.domtool $CERTFILE