DKIM Not Working On AlmaLinux 9 with CWP


INTRODUCTION

If DKIM signature isn’t working or showing when sending emails.

Make sure you have your DKIM TXT file in the DNS.
If it is, and DKIM still isn’t showing, the below will probably fix the error with CWP on AlmaLinux 9.


READ ME FIRST

This article is provided as a courtesy.
Installing, configuring, and troubleshooting third-party applications is outside the scope of basic support provided by Starburst Services.

We are not liable for any damages and/or data loss.


REQUIREMENTS

  • SSH credentials or File Manager access Logged In as Root
  • Text editor of your choice. (The example uses nano)

PROCEDURE

STEP 1

Make sure OpenDKIM and OpenDKIM-Tools are installed:

dnf install opendkim opendkim-tools

STEP 2

Make sure OpenDKIM is Started & Enabled at startup:

systemctl start opendkim
systemctl enable opendkim

STEP 3

Verify your /etc/opendkim.conf looks like:

nano /etc/opendkim.conf
AutoRestart             Yes
AutoRestartRate         10/1h
LogWhy                  Yes
Syslog                  Yes
SyslogSuccess           Yes
Mode                    sv
Canonicalization        relaxed/simple
ExternalIgnoreList      refile:/etc/opendkim/TrustedHosts
InternalHosts           refile:/etc/opendkim/TrustedHosts
KeyTable                refile:/etc/opendkim/KeyTable
SigningTable            refile:/etc/opendkim/SigningTable
SignatureAlgorithm      rsa-sha256
Socket                  inet:8891@localhost
PidFile                 /var/run/opendkim/opendkim.pid
UMask                   022
UserID                  opendkim:opendkim
TemporaryDirectory      /var/tmp

STEP 4

Now that you’ve made sure OpenDKIM is installed and running, it’s time to implement Postfix DKIM.
Let’s follow the Postfix OpenDKIM configuration process.

Edit Postfix main configuration file:

nano /etc/postfix/main.cf

Add the following lines at the end of the main.cf file, only if they are missing:

#In order to integrate OpenDKIM
smtpd_milters = inet:localhost:8891
non_smtpd_milters = inet:localhost:8891
milter_protocol = 6
milter_default_action = accept

Save and close the file.


STEP 5

Restart OpenDKIM and Postfix:

systemctl restart opendkim
systemctl restart postfix

Now, you’ve configured OpenDKIM with Postfix on AlmaLinux 9.


You can use a test site like mail-tester.com to send a test email to.

From the CLI:

echo "Test message" | s-nail -s "Test Email Subject" (Insert copied mail-tester email address here)

If you are having problem still sending email with DKIM, REPLACE the 4 lines in Step 4 with:

smtpd_milters = inet:127.0.0.1:8891
non_smtpd_milters = $smtpd_milters
milter_default_action = accept

If the server is having some confusion with localhost, this will force the localhost IP 127.0.0.1


Thanks for learning with Starburst Services.

Learn more about our services


Did you found this Knowledge Base Article useful?

Please considering thanking our SysOp Team.


KB Article ID: 795
KB Article Created: 2024-08-20
KB Article Last Modified: 2025-07-01

people found this article helpful. What about you?