Bobcares

6 Steps to Fix Sendmail Error “reason=dh key too small”

by | May 16, 2024

The error “reason=dh key too small” in Sendmail occurs due to the use of an insufficiently large DH key during the creation of a secure connection via TLS. Bobcares, as a part of our Server Management Service offers solutions to every query that comes our way.

Fixing error “reason=dh key too small” in Sendmail

Sendmail is a popular Mail Transfer Agent (MTA) that routes and delivers emails on Unix-based machines. The “dh keys too small” error happened on a newly updated sendmail client, and the server to which it was sending required the dhparams fix. Sites facing these problems may need to stop TLS or revert the OpenSSL update. This method violates the goal of improving DH security.

sendmail reason=dh key too small

Here, we’ll look into the troubleshooting steps for the error.

1. In the new NSS library, minimum key lengths are set as follows:

The minimum modulus size for RSA keys is now 512 bits, the minimum modulus size for DSA keys is now 1023 bits, and the minimum modulus size for Diffie-Hellman keys is now 1023 bits.

2. The number of bits must be at least 2048. The 2048-bit length was chosen to improve the security of DH. The following command creates the required dhparams file:

openssl dhparam -out /etc/pki/tls/certs/dhparams.pem 2048

3. Also, stop all ADH ciphers in sendmail.mc:

LOCAL_CONFIG
O CipherList=HIGH:!ADH
O DHParameters=/etc/pki/tls/certs/dhparams.pem

4. Then, follow the next steps:

cd /etc/ssl
openssl req -new -nodes -out req.pem -keyout cert.key -sha256 -newkey rsa:2048
openssl req -new -x509 -days 3650 -key cert.key -out cert.crt -sha256

5. Now, edit the /etc/rc.conf file and add the following lines:

sendmail_cert_create="YES"
sendmail_cert_cn="localhost.mydomain.com"

6. Then, restart sendmail and apply the changes:

service sendmail restart
cd /etc/mail/certs
openssl dhparam -out dh.param 2048
cd /etc/mail && make restart

Switching to 2048 bits should work, as 4096 bits may take too much network capacity and impede connections. Even without rebooting after updating rc.conf, the issue was resolved. The commands listed above should resolve the issue.

[Searching solution for a different question? We’re happy to help.]

Conclusion

To sum up, our Tech team went over the details of fixing “reason=dh key too small” in Sendmail.

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

Never again lose customers to poor
server speed! Let us help you.

Privacy Preference Center

Necessary

Necessary cookies help make a website usable by enabling basic functions like page navigation and access to secure areas of the website. The website cannot function properly without these cookies.

PHPSESSID - Preserves user session state across page requests.

gdpr[consent_types] - Used to store user consents.

gdpr[allowed_cookies] - Used to store user allowed cookies.

PHPSESSID, gdpr[consent_types], gdpr[allowed_cookies]
PHPSESSID
WHMCSpKDlPzh2chML

Statistics

Statistic cookies help website owners to understand how visitors interact with websites by collecting and reporting information anonymously.

_ga - Preserves user session state across page requests.

_gat - Used by Google Analytics to throttle request rate

_gid - Registers a unique ID that is used to generate statistical data on how you use the website.

smartlookCookie - Used to collect user device and location information of the site visitors to improve the websites User Experience.

_ga, _gat, _gid
_ga, _gat, _gid
smartlookCookie
_clck, _clsk, CLID, ANONCHK, MR, MUID, SM

Marketing

Marketing cookies are used to track visitors across websites. The intention is to display ads that are relevant and engaging for the individual user and thereby more valuable for publishers and third party advertisers.

IDE - Used by Google DoubleClick to register and report the website user's actions after viewing or clicking one of the advertiser's ads with the purpose of measuring the efficacy of an ad and to present targeted ads to the user.

test_cookie - Used to check if the user's browser supports cookies.

1P_JAR - Google cookie. These cookies are used to collect website statistics and track conversion rates.

NID - Registers a unique ID that identifies a returning user's device. The ID is used for serving ads that are most relevant to the user.

DV - Google ad personalisation

_reb2bgeo - The visitor's geographical location

_reb2bloaded - Whether or not the script loaded for the visitor

_reb2bref - The referring URL for the visit

_reb2bsessionID - The visitor's RB2B session ID

_reb2buid - The visitor's RB2B user ID

IDE, test_cookie, 1P_JAR, NID, DV, NID
IDE, test_cookie
1P_JAR, NID, DV
NID
hblid
_reb2bgeo, _reb2bloaded, _reb2bref, _reb2bsessionID, _reb2buid

Security

These are essential site cookies, used by the google reCAPTCHA. These cookies use an unique identifier to verify if a visitor is human or a bot.

SID, APISID, HSID, NID, PREF
SID, APISID, HSID, NID, PREF