Error Generating Dh Server Key Exchange
- Error Generating Dh Server Key Exchange Handshake Message
- Error Generating Dh Server Key Exchange Program
- Error Generating Dh Server Key Exchange System
- Error Generating Dh Server Key Exchange 2017
- How-to create Diffie-Hellman (DH) 2048 bit keys for nginx and nginxapache. Diffie-Hellman key exchange is a popular cryptographic algorithm that allows Internet protocols to agree on a shared key and negotiate a secure connection. It is fundamental.
- Add DH parameter limits to the target server's certificate. First, generate custom DH parameters by using openssl dhparam command and apply it with the SSLCertificateFile directive. The custom DH parameters with a 1024-bit prime will always have precedence over any of the built-in DH parameters. This has been described here.
- Then, supposing the server supports an alternative algorithm, it will be selecting during normal negotiation. Obviously the downside of this is that if somebody somehow manages to find a server that only supports Diffie-Hellman at 1024 bits or less then this.
May 30, 2017 I am implementing an SSL layer on a client-server network protocol. I use SSLEngine for wrapping and unwrapping the application buffers on the server. And the clients connect to the Secure server using javax.net.ssl.SSLSocket. I see the following exception on SSLHandshake, can anyone tell me what could be wrong? And how we can avoid this?
In some cases, such as when SSL certificate not correctly installed on the server, following warning message will appear in the browser: an error has occurred while connecting to www.site.com. SSL received a weak ephemeral key Diffie-Hellman in the handshake message 'Exchange keys server.' (Error code: ssl_error_weak_server_ephemeral_dh_key).
- The page you are trying to open cannot be shown because the authenticity of the received data could not be verified.
- Please contact website owners to advise them of this issue.
The reason behind this problem is that the server tries to establish a secure connection using a weak encryption key (less than 1024 bits). The recommended size of the encryption key is 2048 bits. /key-generator-for-machine-id.html. The easiest way to generate this kind of improved encryption key is to use OpenSSL:
Openssl dhparam -out dhparams.pem 2048
To solve issue with different servers, you need to follow below steps:
- Specify secure cipher sets
- Define the appropriate parameters for the Diffie-Hellman algorithm
Solution for Apache:
SSL parameters can be globally defined in the httpd.conf file or in specific virtual hosts.
Cipher sets
Disable SSLv2 and SSLv3 support and enable TLS support by explicitly allowing / disabling certain ciphers in the specified order:
SSLProtocol all -SSLv2 -SSLv3
SSLCipherSuite ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-DSS-AES128-GCM-SHA256:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-DSS-AES128-SHA256:DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA:DHE-RSA-AES256-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:AES:CAMELLIA:DES-CBC3-SHA:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!MD5:!PSK:!aECDH:!EDH-DSS-DES-CBC3-SHA:!EDH-RSA-DES-CBC3-SHA:!KRB5-DES-CBC3-SHA
SSLHonorCipherOrder on
Diffie-Hellman parameters:
In recent versions of Apache (2.4.8 and higher), as well as OpenSSL 1.0.2 and later, you can directly specify a file with Diffie-Hellman parameters:
SSLOpenSSLConfCmd DHParameters '{path to dhparams.pem}'
If you use Apache with LibreSSL or work with versions of Apache 2.4.7 or OpenSSL 0.9.8a or later, you can add the Diffie-Hellman parameters generated earlier to the end of your certificate file.
Perform the config reset:
Sudo service apache2 reload
The solution for Nginx
In the server block in the site config (/etc/nginx/sites-enabled/default) add the following:
Cipher sets:
ssl_ciphers 'ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-DSS-AES128-GCM-SHA256:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-DSS-AES128-SHA256:DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA:DHE-RSA-AES256-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:AES:CAMELLIA:DES-CBC3-SHA:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!MD5:!PSK:!aECDH:!EDH-DSS-DES-CBC3-SHA:!EDH-RSA-DES-CBC3-SHA:!KRB5-DES-CBC3-SHA';
ssl_prefer_server_ciphers on;
Diffie-Hellman parameters
Ssl_dhparam {path to dhparams.pem}
Reload config:
Sudo nginx -s reload
Microsoft IIS
1. Open Group Policy Object Editor (run gpedit.msc in the command line).
2. Go to Computer Configuration, Administrative Templates, Network, and then click on SSL Configuration Settings.
3. In the SSL Configuration Settings section, open the SSL Cipher Suite Order parameter
4. Set stable ciphers. The list of ciphers can be reviewed on the Microsoft website or on the Mozilla page.
Lighttpd
Changes are made to /etc/lighttpd/lighttpd.conf.
Cipher sets:
ssl.cipher-list = 'ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-DSS-AES128-GCM-SHA256:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-DSS-AES128-SHA256:DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA:DHE-RSA-AES256-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:AES:CAMELLIA:DES-CBC3-SHA:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!MD5:!PSK:!aECDH:!EDH-DSS-DES-CBC3-SHA:!EDH-RSA-DES-CBC3-SHA:!KRB5-DES-CBC3-SHA '
Diffie-Hellman parameters
Ssl.dh-file = '{path to dhparams.pem}'
Reset config:
Sudo service lighttpd restart
Apache Tomcat
In the server.xml file (for JSSE)
Cipher sets:
<Connector
ciphers='TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,TLS_DHE_RSA_WITH_AES_128_GCM_SHA256,TLS_DHE_DSS_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_128_SHA256,TLS_ECDHE_ECDSA_WITH_AES_128_SHA256,TLS_ECDHE_RSA_WITH_AES_128_SHA,TLS_ECDHE_ECDSA_WITH_AES_128_SHA,TLS_ECDHE_RSA_WITH_AES_256_SHA384,TLS_ECDHE_ECDSA_WITH_AES_256_SHA384,TLS_ECDHE_RSA_WITH_AES_256_SHA,TLS_ECDHE_ECDSA_WITH_AES_256_SHA,TLS_DHE_RSA_WITH_AES_128_SHA256,TLS_DHE_RSA_WITH_AES_128_SHA,TLS_DHE_DSS_WITH_AES_128_SHA256,TLS_DHE_RSA_WITH_AES_256_SHA256,TLS_DHE_DSS_WITH_AES_256_SHA,TLS_DHE_RSA_WITH_AES_256_SHA'
/>
Note: To use AES 256-bit ciphers, you must install JCE Unlimited Strength Jurisdiction Policy Files. You may find it at the following link.
Postfix SMTP
Both parameters must be specified in /etc/postfix/main.cf.
Cipher sets:
smtpd_tls_exclude_ciphers = aNULL, eNULL, EXPORT, DES, RC4, MD5, PSK, aECDH, EDH-DSS-DES-CBC3-SHA, EDH-RSA-DES-CBC3-SHA, KRB5-DES, CBC3-SHA
Diffie-Hellman parameters
smtpd_tls_dh1024_param_file = ${config_directory}/dhparams.pem
Reset config:
sudo postfix reload
Sendmail
Changes can be made in the LOCAL_CONFIG section of the file /etc/mail/sendmail.mc
Cipher sets:
O CipherList=ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-DSS-AES128-GCM-SHA256:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-DSS-AES128-SHA256:DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA:DHE-RSA-AES256-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:AES:CAMELLIA:DES-CBC3-SHA:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!MD5:!PSK:!aECDH:!EDH-DSS-DES-CBC3-SHA:!EDH-RSA-DES-CBC3-SHA:!KRB5-DES-CBC3-SHA
Diffie-Hellman parameters
O DHParameters={path to dhparams.pem}
Reset config:
sudo service sendmail restart
Dovecot
Changes can be made to /etc/dovecot.conf
Cipher sets:
ssl_cipher_list=ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-DSS-AES128-GCM-SHA256:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-DSS-AES128-SHA256:DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA:DHE-RSA-AES256-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:AES:CAMELLIA:DES-CBC3-SHA:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!MD5:!PSK:!aECDH:!EDH-DSS-DES-CBC3-SHA:!EDH-RSA-DES-CBC3-SHA:!KRB5-DES-CBC3-SHA
ssl_prefer_server_ciphers = yes (Dovecot 2.2.6 or greater)
Diffie-Hellman parameters:
#regenerates every week
ssl_dh_parameters_length = 2048
Reset config:
sudo doveadm reload
HAProxy
Changes are made to the global section of the config.
Cipher sets:
ssl-default-bind-ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-DSS-AES128-GCM-SHA256:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-DSS-AES128-SHA256:DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA:DHE-RSA-AES256-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:AES:CAMELLIA:DES-CBC3-SHA:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!MD5:!PSK:!aECDH:!EDH-DSS-DES-CBC3-SHA:!EDH-RSA-DES-CBC3-SHA:!KRB5-DES-CBC3-SHA
Diffie-Hellman parameters:
Add to the bottom of .crt file with the Diffie-Hellman parameter generated with OpenSSL.
Note: despite the tune.ssl.default-dh-param option, which allows you to specify the maximum size of prime numbers used for DHE, placing arbitrary parameters in your certificate file will overwrite these values.
Reset config:
sudo haproxy -f haproxy.cfg -p $(</var/run/haproxy-private.pid) -st $(</var/run/haproxy-private.pid)
Amazon Elastic Load Balancing
The last set of predefined SSL parameters (2015-05) uses ECDHE ciphers, not DHE, which are resistant to LogJam attack. Details can be found in the documentation.
OpenSSH
The SSH protocol is protected from LogJam attacks, when an attacker can switch a connection to a weaker cryptography. However, many SSH implementations, including OpenSSH, use prime numbers, for instance 1024-bit Oakley Group 2. However, there are several ways to resolve this issue. The first and simplest method is to get customers to use the Diffie-Hellman algorithm on elliptical curves. In particular, Curve 25519. You can do this by setting Key Exchange algorithms:
KexAlgorithms curve25519-sha256@libssh.org
If you want to continue supporting the non-Elliptic Diffie-Hellman algorithm, you must disable Group 1 support by removing diffie-hellman-group1-sha1. You can leave diffie-hellman-group14-sha1, which uses 2038-bit prime numbers.
Error Generating Dh Server Key Exchange Handshake Message
You can also generate new Diffie-Hellman groups:
ssh-keygen -G moduli-2048.candidates -b 2048
Error Generating Dh Server Key Exchange Program
ssh-keygen -T moduli-2048 -f moduli-2048.candidates
Error Generating Dh Server Key Exchange System
You will then need to install the moduli-2048 in your system moduli file. In Debian / Ubuntu, it is located in /etc/ssh/moduli. SSH selects (in a random way) the groups from this file, so you must add new generated groups to the moduli file with removing the old ones.
Error Generating Dh Server Key Exchange 2017
Should you have any follow up questions or concerns, please feel free to contact LeaderTelecom support team using contact information provided on the website.