-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgenerate-dkim
More file actions
executable file
·45 lines (31 loc) · 725 Bytes
/
generate-dkim
File metadata and controls
executable file
·45 lines (31 loc) · 725 Bytes
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
43
44
#!/bin/bash
# Copyright 2015 Richard Russon (FlatCap)
# Licensed under the GPLv3
SUFFIX="dkim.inc"
PATH="/var/named/bin:/usr/bin:/usr/sbin"
source log.sh
export TZ="UTC"
set -o errexit # set -e
set -o nounset # set -u
renice --priority 19 --pid $$ > /dev/null
ionice --class 3 --pid $$ > /dev/null
shopt -s nullglob
function finish()
{
local RETVAL=$?
[ $RETVAL = 0 ] || log_error "${0##*/} failed: $RETVAL"
}
trap finish EXIT
cd /var/named
[ $# = 0 ] && exit 2
log_info "Generate DKIM Records for Services"
for ZONE in $@; do
FILE="$ZONE.$SUFFIX"
if [ -f "$FILE" ]; then
log_warning "\t$ZONE already exists"
continue
fi
cp /etc/opendkim/keys/$ZONE/mail.txt "$FILE"
echo -e "\t$ZONE"
done
exit 0