Page Menu
Home
DevCentral
Search
Configure Global Search
Log In
Files
F56914792
add-dkim-domain.sh
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
add-dkim-domain.sh
View Options
#!/bin/sh
# -------------------------------------------------------------
# Add a new domain for OpenDKIM
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Project: Nasqueron
# License: BSD-2-Clause
# Source file: roles/mailserver/dkim/files/bin/add-dkim-domain.sh
# -------------------------------------------------------------
#
# <auto-generated>
# This file is managed by our rOPS SaltStack repository.
#
# Changes to this file may cause incorrect behavior
# and will be lost if the state is redeployed.
# </auto-generated>
set
-e
DIR_ETC_DKIM
=
"{{ dirs.etc }}/opendkim"
KEY_SIZE
=
2048
# -------------------------------------------------------------
# Ensure user is opendkim
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
if
[
"
$(
id
-un
)
"
!
=
"opendkim"
]
;
then
echo
"This command must be run as the opendkim user."
>
&
2
exit
1
fi
# -------------------------------------------------------------
# Parse arguments
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
if
[
$#
-eq
0
]
||
[
$#
-gt
2
]
;
then
echo
"Usage:
$(
basename
"
$0
"
)
<domain> [selector]"
>
&
2
exit
1
fi
DOMAIN
=
$1
if
[
$#
-eq
2
]
;
then
SELECTOR
=
$2
else
SELECTOR
=
unium
fi
# -------------------------------------------------------------
# Generate domain key
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
mkdir
"
$DIR_ETC_DKIM
/keys/
$DOMAIN
"
cd
"
$DIR_ETC_DKIM
/keys/
$DOMAIN
"
opendkim-genkey
-s
"
$SELECTOR
"
-b
$KEY_SIZE
-d
"
$DOMAIN
"
# -------------------------------------------------------------
# Document DNS record
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
get-dkim-dns-entries
$DOMAIN
# -------------------------------------------------------------
# Refresh DKIM tables
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
cd
"
$DIR_ETC_DKIM
"
make
clean
all
File Metadata
Details
Attached
Mime Type
text/x-shellscript
Expires
Thu, Nov 12, 18:32 (1 w, 5 h ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
4167524
Default Alt Text
add-dkim-domain.sh (1 KB)
Attached To
Mode
rOPS Nasqueron Operations
Attached
Detach File
Event Timeline
Log In to Comment