I'd like to ask if there's a way to lower SSL security level to 1 on Ubuntu 20.04, since I'm receiving:
141A318A:SSL routines:tls_process_ske_dhe:dh key too small
when trying to curl the website.
Curl works if I add --ciphers 'DEFAULT:!DH'
parameter, however, I am not able to fetch a website via my client app written in C#. The website also works when opened via browser.
According to bugs.launchpad.net the Ubuntu team set higher SSL security level on purpose.
In several places I came across an information that changing CipherString = DEFAULT@SECLEVEL=2
to 1
in openssl.cnf
helps, but my config file did not have such a line at all and adding it had no effect.
I do not control the website server, so I am not able to change its security configuration.
Any ideas? Would installing some older openSSL package help?
Thanks in advance
EDIT: As for changes to my config file, I've added the following at the end:
system_default = system_default_sect
[system_default_sect]
MinProtocol = TLSv1.2
CipherString = DEFAULT@SECLEVEL=1
Output from openssl version -a
:
OpenSSL 1.1.1f 31 Mar 2020 built on: Mon Apr 20 11:53:50 2020 UTC
platform: debian-amd64
options: bn(64,64) rc4(16x,int) des(int) blowfish(ptr)
compiler: gcc -fPIC -pthread -m64 -Wa,--noexecstack -Wall -Wa,
--noexecstack -g -O2 -fdebug-prefix-map=/build/openssl-P_ODHM/openssl-1.1.1f=.
-fstack-protector-strong -Wformat -Werror=format-security
-DOPENSSL_TLS_SECURITY_LEVEL=2 -DOPENSSL_USE_NODELETE
-DL_ENDIAN -DOPENSSL_PIC -DOPENSSL_CPUID_OBJ
-DOPENSSL_IA32_SSE2 -DOPENSSL_BN_ASM_MONT
-DOPENSSL_BN_ASM_MONT5 -DOPENSSL_BN_ASM_GF2m
-DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DKECCAK1600_ASM
-DRC4_ASM -DMD5_ASM -DAESNI_ASM -DVPAES_ASM -DGHASH_ASM
-DECP_NISTZ256_ASM -DX25519_ASM -DPOLY1305_ASM -DNDEBUG
-Wdate-time -D_FORTIFY_SOURCE=2
OPENSSLDIR: "/usr/lib/ssl" ENGINESDIR:
"/usr/lib/x86_64-linux-gnu/engines-1.1" Seeding source: os-specific
You don't have your config changes quite right. You need to add this to the beginning of your config file:
And then this to the end:
Note that if you prefer you can make changes to a local copy of the config file, and then ensure your process is started with the environment variable
OPENSSL_CONF
defined to point at the location of your config file:This way you can make changes without having to impact your entire system.
Note: To find the system's openssl.cnf file, run the following:
the run
ls -l
on the directory outputted to see where theopenssl.cnf
file is via its symlink in that directory as needed.Edit
openssl.conf
file:Add this line at the top:
And add these lines at the end:
It works for me. :)
Ref: When I try to CURL a website I get SSL error
For the Laravel, also run
The two solutions above were confusing for me.
You just need two blocks of modifications in /usr/lib/ssl/openssl.cnf as documented with this diff:
For cut&paste:
Update: the previous answer seems to work if you extract the default configuration from the deb file by downloading it on https://packages.ubuntu.com/search?keywords=openssl&searchon=names.
Update 2: in fact the previous answer did not work for me because I had a wrong config file using
[system_default_sect]
instead of[ssl_default_sect]
. It seems to be an error that I copy-pasted from https://wiki.debian.org/ContinuousIntegration/TriagingTips/openssl-1.1.1. It is possible to use the name system_default_sect to be consistent with Debian, you just need to use it everywhere instead of ssl_default_sect.Original answer:
The previous answer was not working for me on Ubuntu 20.04 so I used the config file from my Debian LXC container on Ubuntu and changed
SECLEVEL=2
toSECLEVEL=1
.I saved the file as
/etc/ssl/openssl_custom.cnf
and then used the command shared in the previous answer to load another config file when you need to:export OPENSSL_CONF=/etc/ssl/openssl_custom.cnf
Here is the full config file that worked for me (you can also extract the default configuration from the deb file by downloading it on https://packages.debian.org/stable/openssl):
For any system add at the top of
openssl.cnf
:and at end of
openssl.cnf
:For Debian add:
For Ubuntu 20.04 add: