Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 1235056

Summary: recent openssl update breaks sendmail by increasing minimum DH parameter size
Product: Red Hat Enterprise Linux 6 Reporter: Tom Lane <tgl>
Component: sendmailAssignee: Jaroslav Škarvada <jskarvad>
Status: CLOSED WONTFIX QA Contact: qe-baseos-daemons
Severity: high Docs Contact:
Priority: high    
Version: 6.6CC: herrold, rzilka, sand.paul, thozza, tmraz
Target Milestone: rcKeywords: Documentation
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-09-06 09:30:45 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
Client hardening to use 1024 bits none

Description Tom Lane 2015-06-23 21:22:55 UTC
Description of problem:
As of openssl-1.0.1e-30.el6_6.11, the minimum allowed DH parameter size is something like 768 bits.  The problem with that is that in the default sendmail configuration, the server only offers a smaller DH parameter, therefore machines running the current openssl will fail to send mail to machines running the current sendmail.

Fixing this requires manual changes to the sendmail configuration.  I think that (1) Red Hat ought to ship a configuration that works out of the box, and (2) there needs to be some documentation issued to users explaining how to fix their existing configuration files.

Version-Release number of selected component (if applicable):
sendmail-8.14.4-8.el6.x86_64
openssl-1.0.1e-30.el6_6.11.x86_64

How reproducible:
100%

Steps to Reproduce:
1. Attempt to send mail to a RHEL6 machine configured to use TLS encryption, from a machine running RHEL6's current openssl.  (I'm unclear whether the recipient's openssl version matters.)

Actual results:
Sending machine logs a failure similar to this:
Jun 23 09:36:43 sss1 sendmail[831]: STARTTLS=client, error: connect failed=-1, SSL_error=1, errno=0, retry=-1
Jun 23 09:36:43 sss1 sendmail[831]: STARTTLS=client: 831:error:14082174:SSL routines:SSL3_CHECK_CERT_AND_ALGORITHM:dh key too small:s3_clnt.c:3331:
Jun 23 09:36:43 sss1 sendmail[831]: ruleset=tls_server, arg1=SOFTWARE, relay=mx-lb-03.srv.cs.cmu.edu, reject=403 4.7.0 TLS handshake failed.
Jun 23 09:36:43 sss1 sendmail[831]: t5MJdTE3009311: to=<suppressed>, ctladdr=<tgl.pa.us> (501/501), delay=17:57:14, xdelay=00:00:02, mailer=esmtp, pri=2011294, relay=mx-lb-03.srv.cs.cmu.edu. [128.2.217.14], dsn=4.0.0, stat=Deferred: 403 4.7.0 TLS handshake failed.

Expected results:
Should work.

Additional info:
I see that this behavior was previously reported as bug #1228892, which you closed WONTFIX on the grounds that it was the far end's problem.  What you failed to realize is that the far end is running a configuration exactly like what Red Hat tells people to use.  See also bug #1228755 which is the same thing for mysql.

Googling for the "dh key too small" issue reveals that the fix is to create a suitably large DH parameter file and add something like
define(`confDH_PARAMETERS', `/etc/mail/certs/dh.param')dnl
to sendmail.mc.  That's fine, but it needs to be documented properly; paying RHEL customers should not have to resort to Mr. Google to find this out.

Comment 2 Tomas Mraz 2015-06-24 07:17:42 UTC
This should be viewed as a security issue and fixed asynchronously as the default parameters should be at least 1024 bits otherwise they are insecure.

Comment 3 Paul Sand 2015-06-24 09:27:41 UTC
Thanks much for the alternate workaround. Mr. Google (heh) also says (e.g. https://www.freebsd.org/security/advisories/FreeBSD-EN-15:08.sendmail.asc) that

define(`confDH_PARAMETERS', `1')dnl

in sendmail.mc should work, bypassing the need to generate an extra file by hand yourself. (Any parameter beginning with 1 is interpreted as 1024.) I haven't tried that yet.

Comment 4 Paul Sand 2015-06-24 13:27:13 UTC
Well, now I've tried it, both

define(`confDH_PARAMETERS', `1024')dnl

and

define(`confDH_PARAMETERS', `/path/to/dh.param')dnl

With (either) alternate fix in place, I start seeing the dread "TLS handshake failed" in the mail logs again.

I may be doing something else incorrectly, but I've gone back to the original sendmail.mc workaround:

LOCAL_CONFIG
O CipherList=DEFAULT:!EDH:!DHE

Comment 5 Jaroslav Škarvada 2015-06-24 14:15:43 UTC
From the Sendmail Installation and Operational Guide for sendmail-8.14.4-9.el6 ('op.pdf'):

--
DHParameters:
Possible values are:
5 - use 512 bit prime
1 - use 1024 bit prime
none - do not use Diffie-Hellman
NAME - load prime from file

This is only required if a ciphersuite containing DSA/DH is used. If ‘‘5’’ is
selected, then precomputed, fixed primes are used. This is the default for the
client side. If ‘‘1’’ is selected, then prime values are computed during startup.
This is the default for the server side. Note: this operation can take a significant amount of time on a slow machine (several seconds), but it is only done once at startup.
--

I checked the code and it seems it really uses 1024 bits on server by default and we do not redefine the defaults.

Comment 6 Tom Lane 2015-06-24 14:18:16 UTC
Right, the point of the confDH_PARAMETERS change is to ensure that picky clients can connect to your server, ie that you can *receive* mail with TLS.  The business with CipherList is a workaround that can be applied on the *sending* side if the receiver has an insecurely small DH parameter --- but the proper long-term fix is really to fix the receiver's DH setting.

Comment 7 Jaroslav Škarvada 2015-06-24 14:24:56 UTC
(In reply to Paul Sand from comment #3)
> Thanks much for the alternate workaround. Mr. Google (heh) also says (e.g.
> https://www.freebsd.org/security/advisories/FreeBSD-EN-15:08.sendmail.asc)

This is workaround for "sendmail client rejected by server due to small DH", so at least comment 0 is incorrect, because default settings is OK on server.

Comment 8 Tom Lane 2015-06-24 14:28:58 UTC
(In reply to Jaroslav Škarvada from comment #5)
> This is only required if a ciphersuite containing DSA/DH is used. If ‘‘5’’ is
> selected, then precomputed, fixed primes are used. This is the default for
> the client side. If ‘‘1’’ is selected, then prime values are computed during
> startup. This is the default for the server side.

Hm.  That does not seem to square with my observational experience.  I noticed the reported problem when I tried to send mail to cs.cmu.edu on Monday, shortly after applying the recent openssl update.  After some googling, I generated a larger DH file and added the confDH_PARAMETERS setting with a file name to my own sendmail config, but that did not fix it.  I eventually contacted CMU by phone (how 20th century) and the upshot was that they'd also generated a larger DH parameter file, but had forgotten to add the actual confDH_PARAMETERS setting to their sendmail config.  After they did that, the mail went through.  So it seems clear that the default server-side DH setting is *NOT* large enough to satisfy the new openssl.

Is it possible that the text you're quoting here is the result of some Red Hat patching, and doesn't reflect the behavior of the average sendmail in the wild?
Or maybe it was changed in sendmail 8.14?  (From their Received: lines I gather
that CMU is running 8.13.6.)

Comment 9 Jaroslav Škarvada 2015-06-24 16:14:12 UTC
(In reply to Tom Lane from comment #8)
Sorry I am unable to reproduce, cleanly provisioned Red Hat Enterprise Linux Server release 6.6 (Santiago), sendmail-8.14.4-8.el6.x86_64, default configuration:

$ openssl s_client -starttls smtp -connect localhost:25
...
Server Temp Key: DH, 1024 bits
...

So it's 1024 bits exactly as stated in the operational guide.

Comment 10 Jaroslav Škarvada 2015-06-24 16:17:25 UTC
Created attachment 1042784 [details]
Client hardening to use 1024 bits

AFAIK this is not upstream. It will use 1024 bits also on client by default. But I think rather than diverging from upstream KB article about this problem would be probably enough.

Comment 12 Roman Žilka 2017-08-03 13:19:01 UTC
FYI: I've re-tried the experiment from the opening comment with current sendmail and openssl on RHEL-6.9, i.e.:
sendmail-8.14.4-9.el6_8.1.x86_64
openssl-1.0.1e-57.el6.x86_64

I have two RHEL-6.9 machines running sendmail to serve as the SMTP client and server. Both of them use the default config except for:
** Client:
define(`confLOG_LEVEL', `18')dnl
define(`SMART_HOST', `test-server')dnl
** Server:
define(`confLOG_LEVEL', `18')dnl
define(`confCACERT_PATH', `/etc/pki/tls/certs')dnl
define(`confCACERT', `/etc/pki/tls/certs/ca-bundle.crt')dnl
define(`confSERVER_CERT', `/etc/pki/tls/certs/sendmail.pem')dnl
define(`confSERVER_KEY', `/etc/pki/tls/certs/sendmail.pem')dnl
DAEMON_OPTIONS(`Port=smtp, Name=MTA')dnl

The server has a fairly generic self-signed TLS certificate generated using the instructions in sendmail.mc.

Upon sending out an e-mail at the client using mailx, a successful TLS session using DH takes place. Excerpt from client's maillog:

Aug  3 07:52:58 hostname sendmail[9158]: v73Bqw14009156: SMTP outgoing connect on test-client
Aug  3 07:52:58 hostname sendmail[9158]: STARTTLS: ClientCertFile missing
Aug  3 07:52:58 hostname sendmail[9158]: STARTTLS: ClientKeyFile missing
Aug  3 07:52:58 hostname sendmail[9158]: STARTTLS: CACertPath missing
Aug  3 07:52:58 hostname sendmail[9158]: STARTTLS: CACertFile missing
Aug  3 07:52:58 hostname sendmail[9158]: STARTTLS: CRLFile missing
Aug  3 07:52:58 hostname sendmail[9158]: STARTTLS=client, init=1
Aug  3 07:52:58 hostname sendmail[9158]: STARTTLS=client, start=ok
Aug  3 07:52:58 hostname sendmail[9158]: STARTTLS=client, info: fds=11/10, err=2
Aug  3 07:52:58 hostname sendmail[9158]: STARTTLS=client, info: fds=11/10, err=2
Aug  3 07:52:58 hostname sendmail[9158]: STARTTLS=client, info: fds=11/10, err=2
Aug  3 07:52:58 hostname sendmail[9158]: STARTTLS=client, info: fds=11/10, err=2
Aug  3 07:52:58 hostname sendmail[9158]: STARTTLS=client, get_verify: 18 get_peer: 0x7f138163da50
Aug  3 07:52:58 hostname sendmail[9158]: STARTTLS=client, relay=test-server, field=cn_subject, status=failed to extract CN
Aug  3 07:52:58 hostname sendmail[9158]: STARTTLS=client, relay=test-server, field=cn_issuer, status=failed to extract CN
Aug  3 07:52:58 hostname sendmail[9158]: STARTTLS=client, relay=test-server, version=TLSv1/SSLv3, verify=FAIL, cipher=DHE-RSA-AES256-GCM-SHA384, bits=256/256
Aug  3 07:52:58 hostname sendmail[9158]: STARTTLS=client, cert-subject=/C=XX/L=Default+20City/O=Default+20Company+20Ltd, cert-issuer=/C=XX/L=Default+20City/O=Default+20Company+20Ltd, verifymsg=self signed certificate

The server uses a 1024-bit DH parameter (not key(?), I believe, technically speaking) - topmost part of server's maillog follows. The "(1)" incicates the choice of 1024 bits as DH_PARAMETERS (as stated above, anything that starts with a '1' equals 1024).

Aug  3 07:52:51 hostname sendmail[3632]: starting daemon (8.14.4): SMTP+queueing@01:00:00
Aug  3 07:52:51 hostname sendmail[3632]: STARTTLS: CRLFile missing
Aug  3 07:52:51 hostname sm-msp-queue[3642]: starting daemon (8.14.4): queueing@01:00:00
Aug  3 07:52:51 hostname sendmail[3632]: STARTTLS=server, Diffie-Hellman init, key=1024 bit (1)
Aug  3 07:52:51 hostname sendmail[3632]: STARTTLS=server, init=1

The check from comment 9 passess too:
# openssl s_client -starttls smtp -connect test-server:25
   (...)
Server Temp Key: DH, 1024 bits
   (...)
    Protocol  : TLSv1.2
    Cipher    : DHE-RSA-AES256-GCM-SHA384
   (...)



As for the SMTP-client side of sendmail, I think it never generates any DH parameters in the first place. This needs careful verification (I'm not a developer), but it looks to me like the function inittls() in sendmail/tls.c is the only one which generates DH params. And this function never seems to be called by the client with any other "req" parameter but TLS_I_CLT. TLS_I_TRY_DH is required, however, for any DH parameter generation to take place. I haven't tested this rigorously, but I know from a recent experiment that the client side never generates the log message "(...) Diffie-Hellman init, key=%d bit (%c)". (It was a more recent version of sendmail, but the code looks basically the same.)

This means that it's not necessary to worry about the client side of sendmail at all WRT DH params (despite what the comments and the code in inittls() suggest). Furthermore, I think the patch from comment 10 would have no effect.

The fact that only the server generates DH params (and clients just adopt them) in OpenSSL (or TLS itself?) is also noted in a message linked at the top of this wiki page:
https://wiki.openssl.org/index.php/Diffie-Hellman_parameters

Comment 13 Tomáš Hozza 2017-09-06 09:30:45 UTC
Red Hat Enterprise Linux 6 transitioned to the Production 3 Phase on May 10, 2017.  During the Production 3 Phase, Critical impact Security Advisories (RHSAs) and selected Urgent Priority Bug Fix Advisories (RHBAs) may be released as they become available.

The official life cycle policy can be reviewed here:
http://redhat.com/rhel/lifecycle

This issue does not appear to meet the inclusion criteria for the Production Phase 3 and will be marked as CLOSED/WONTFIX. If this remains a critical requirement, please contact Red Hat Customer Support to request a re-evaluation of the issue, citing a clear business justification.  Red Hat Customer Support can be contacted via the Red Hat Customer Portal at the following URL:

https://access.redhat.com