Dkim-add-domainkey: Difference between revisions
Created page with "==Create a DKIM key for a domain== Create a new folder and cd into it: mkdir -p /etc/opendkim/keys/mydomain.com cd /etc/opendkim/keys/mydomain.com Generate key: opendkim-genkey -r -d mydomain.com Delegate access to the opendkim user and group to access the key: chown opendkim:opendkim default.private Reference the key via OpenDKIM KeyTable: vi /etc/opendkim/KeyTable Add line to the file to define your selector. In this example, we will call the se..." |
|||
| Line 3: | Line 3: | ||
Create a new folder and cd into it: | Create a new folder and cd into it: | ||
mkdir -p /etc/opendkim/keys/mydomain.com | |||
cd /etc/opendkim/keys/mydomain.com | |||
Generate key: | Generate key: | ||
opendkim-genkey -r -d mydomain.com | |||
Delegate access to the opendkim user and group to access the key: | Delegate access to the opendkim user and group to access the key: | ||
chown opendkim:opendkim default.private | |||
Reference the key via OpenDKIM KeyTable: | Reference the key via OpenDKIM KeyTable: | ||
vi /etc/opendkim/KeyTable | |||
Add line to the file to define your selector. In this example, we will call the selector default, but if your domain requires multiple DKIM keys, ensure you make this unique. You can modify the file by pressing i to enter insert mode in vi: | Add line to the file to define your selector. In this example, we will call the selector default, but if your domain requires multiple DKIM keys, ensure you make this unique. You can modify the file by pressing i to enter insert mode in vi: | ||
| Line 24: | Line 24: | ||
Open the SigningTable file via vi | Open the SigningTable file via vi | ||
vi /etc/opendkim/SigningTable | |||
Add the following line to the file by pressing i to enter insert mode (changing default if specified a different selector earlier on): | Add the following line to the file by pressing i to enter insert mode (changing default if specified a different selector earlier on): | ||
| Line 30: | Line 30: | ||
mydomain.com default._domainkey.mydomain.com | mydomain.com default._domainkey.mydomain.com | ||
/etc/init.d/opendkim restart | |||
Update DNS: | Update DNS: | ||
cat /etc/opendkim/keys/mydomain.com/default.txt | |||
Create a new TXT record, name <code>default._domainkey</code> or <code>default._domainkey.subdomain</code> with the value between the quotes (don't include the quotes), e.g.: | Create a new TXT record, name <code>default._domainkey</code> or <code>default._domainkey.subdomain</code> with the value between the quotes (don't include the quotes), e.g.: | ||
v=DKIM1; h=sha256; k=rsa; s=email; p=ABCDEFG..... | v=DKIM1; h=sha256; k=rsa; s=email; p=ABCDEFG..... | ||
Latest revision as of 17:42, 18 March 2026
Create a DKIM key for a domain
Create a new folder and cd into it:
mkdir -p /etc/opendkim/keys/mydomain.com cd /etc/opendkim/keys/mydomain.com
Generate key:
opendkim-genkey -r -d mydomain.com
Delegate access to the opendkim user and group to access the key:
chown opendkim:opendkim default.private
Reference the key via OpenDKIM KeyTable:
vi /etc/opendkim/KeyTable
Add line to the file to define your selector. In this example, we will call the selector default, but if your domain requires multiple DKIM keys, ensure you make this unique. You can modify the file by pressing i to enter insert mode in vi:
default._domainkey.mydomain.com mydomain.com:default:/etc/opendkim/keys/mydomain.com/default.private
Open the SigningTable file via vi
vi /etc/opendkim/SigningTable
Add the following line to the file by pressing i to enter insert mode (changing default if specified a different selector earlier on):
mydomain.com default._domainkey.mydomain.com
/etc/init.d/opendkim restart
Update DNS:
cat /etc/opendkim/keys/mydomain.com/default.txt
Create a new TXT record, name default._domainkey or default._domainkey.subdomain with the value between the quotes (don't include the quotes), e.g.:
v=DKIM1; h=sha256; k=rsa; s=email; p=ABCDEFG.....