After an update of OpenSSL from 3.0.10 to 3.0.11 my IMAP clients can no longer connect to mail-server Courier, because the server denies any authentication. The server's log contains suddenly such a line: Oct 22 16:22:31 server imapd-ssl: ip=[::ffff:192.168.223.227], couriertls: /usr/share/courier/imapd.pem: error:1E08010C:DECODER routines::unsupported This is the self-singed certificate that is automatically created when Courier starts and it is missing. The original certificate was still valid for some years. However, even after letting Courier generating new ones, the situation did not change. Every connection attempt created such server log entries: Oct 22 18:41:10 server imapd: LOGIN, user=me, ip=[::ffff:192.168.223.227], port=[41132], protocol=IMAP Oct 22 18:41:10 server imapd: ip=[::ffff:192.168.223.227], couriertls: read: error:0A000126:SSL routines::unexpected eof while reading Oct 22 18:41:10 server imapd: LOGOUT, user=me, ip=[::ffff:192.168.223.227], port=[41132], headers=0, body=0, rcvd=55, sent=424, time=0, starttls=1 After downgrading OpenSSL to 3.0.10 and restarting courier, the clients (KMail) were immediately able to connect again. Reproducible: Always Steps to Reproduce: 1. Install Courier-1.2.3-r1, activate IMAPS and run it 2. Install OpenSSL-3.0.11 3. Try to connect with an IMAP Client Actual Results: Connection is refused. Expected Results: Stable connection to the IMAP Server server /var/log # emerge --info Portage 3.0.51 (python 3.11.5-final-0, default/linux/amd64/17.1, gcc-13, glibc-2.37-r7, 6.1.53-gentoo-r1-x86_64 x86_64) ================================================================= System uname: Linux-6.1.53-gentoo-r1-x86_64-x86_64-AMD_Ryzen_5_3400G_with_Radeon_Vega_Graphics-with-glibc2.37 KiB Mem: 14236784 total, 7645324 free KiB Swap: 0 total, 0 free Timestamp of repository gentoo: Fri, 20 Oct 2023 20:46:56 +0000 Head commit of repository gentoo: e75d32547fc7166a5c826c66c041581fe72d291f Timestamp of repository dlang: Thu, 12 Oct 2023 20:31:53 +0000 Head commit of repository dlang: e380b6f8a5621ffa54619798d65dd14186d5b67f sh bash 5.1_p16-r6 ld GNU ld (Gentoo 2.40 p5) 2.40.0 app-misc/pax-utils: 1.3.5::gentoo app-shells/bash: 5.1_p16-r6::gentoo dev-java/java-config: 2.3.1-r1::gentoo dev-lang/perl: 5.38.0-r1::gentoo dev-lang/python: 3.11.5::gentoo dev-lang/rust: 1.71.1::gentoo dev-util/cmake: 3.26.5-r2::gentoo dev-util/meson: 1.2.1-r1::gentoo sys-apps/baselayout: 2.14::gentoo sys-apps/openrc: 0.48::gentoo sys-apps/sandbox: 2.38::gentoo sys-devel/autoconf: 2.71-r6::gentoo sys-devel/automake: 1.16.5-r1::gentoo sys-devel/binutils: 2.40-r5::gentoo sys-devel/binutils-config: 5.5::gentoo sys-devel/gcc: 12.3.1_p20230526::gentoo, 13.2.1_p20230826::gentoo sys-devel/gcc-config: 2.11::gentoo sys-devel/libtool: 2.4.7-r1::gentoo sys-devel/make: 4.4.1-r1::gentoo sys-kernel/linux-headers: 6.1::gentoo (virtual/os-headers) sys-libs/glibc: 2.37-r7::gentoo Repositories: gentoo location: /var/db/portage/tree/central sync-type: git sync-uri: https://github.com/gentoo-mirror/gentoo.git priority: -1000 volatile: True dlang location: /var/db/repos/dlang sync-type: git sync-uri: https://github.com/gentoo-mirror/dlang.git masters: gentoo volatile: False local location: /var/db/portage/tree/local masters: gentoo volatile: True ACCEPT_KEYWORDS="amd64" ACCEPT_LICENSE="@FREE" CBUILD="x86_64-pc-linux-gnu" CFLAGS="-march=native -Os -pipe" CHOST="x86_64-pc-linux-gnu" CONFIG_PROTECT="/etc /usr/share/gnupg/qualified.txt" CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/dconf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/php/apache2-php8.1/ext-active/ /etc/php/cgi-php8.1/ext-active/ /etc/php/cli-php8.1/ext-active/ /etc/php/fpm-php8.1/ext-active/ /etc/php/phpdbg-php8.1/ext-active/ /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo" CXXFLAGS="-march=native -Os -pipe" DISTDIR="/var/db/portage/distfiles/bobbel" EMERGE_DEFAULT_OPTS="--autounmask=n --with-bdeps=y" ENV_UNSET="CARGO_HOME DBUS_SESSION_BUS_ADDRESS DISPLAY GDK_PIXBUF_MODULE_FILE GOBIN GOPATH PERL5LIB PERL5OPT PERLPREFIX PERL_CORE PERL_MB_OPT PERL_MM_OPT XAUTHORITY XDG_CACHE_HOME XDG_CONFIG_HOME XDG_DATA_HOME XDG_RUNTIME_DIR XDG_STATE_HOME" FCFLAGS="-O2 -pipe" FEATURES="assume-digests binpkg-docompress binpkg-dostrip binpkg-logs buildpkg-live config-protect-if-modified distlocks ebuild-locks fixlafiles ipc-sandbox merge-sync multilib-strict network-sandbox news parallel-fetch pid-sandbox preserve-libs protect-owned qa-unresolved-soname-deps sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr" FFLAGS="-O2 -pipe" GENTOO_MIRRORS="http://sunsite.cnlab-switch.ch/mirror/gentoo/ http://linux.rz.ruhr-uni-bochum.de/download/gentoo-mirror/ http://ftp.heanet.ie/pub/gentoo/" LANG="en_US.UTF-8" LDFLAGS="-Wl,-O1 -Wl,--as-needed" LEX="flex" LINGUAS="en de" MAKEOPTS="-j7 -s" PKGDIR="/var/db/portage/packages/core2duo" PORTAGE_CONFIGROOT="/" PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --omit-dir-times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages --exclude=/.git" PORTAGE_TMPDIR="/var/tmp/portage" SHELL="/bin/bash" USE="acl alsa amd64 bzip2 caps cli crypt cups dbus dmd-2_096 dri fam fontconfig fortran gdbm gpm harfbuzz iconv icu idn ipv6 jpeg jpeg2k libtirpc logrotate multilib ncurses nptl pam pcre png readline seccomp split-usr ssl syslog test-rust tiff unicode usb vim-syntax xattr zlib zstd" ABI_X86="64" ADA_TARGET="gnat_2021" APACHE2_MODULES="authn_core authz_core socache_shmcb unixd actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="karbon sheets words" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CPU_FLAGS_X86="mmx mmxext sse sse2 aes avx avx2 f16c fma3 pclmul popcnt rdrand sha sse3 sse4_1 sse4_2 sse4a ssse3" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock greis isync itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf skytraq superstar2 timing tsip tripmate tnt ublox ubx" GRUB_PLATFORMS="efi-64" INPUT_DEVICES="libinput" KERNEL="linux" L10N="en" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" LUA_SINGLE_TARGET="lua5-1" LUA_TARGETS="lua5-1" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php8-1" POSTGRES_TARGETS="postgres15" PYTHON_SINGLE_TARGET="python3_11" PYTHON_TARGETS="python3_11" RUBY_TARGETS="ruby31" SANE_BACKENDS="net" VIDEO_CARDS="vesa" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq proto steal rawnat logmark ipmark dhcpmac delude chaos account" Unset: ADDR2LINE, AR, ARFLAGS, AS, ASFLAGS, CC, CCLD, CONFIG_SHELL, CPP, CPPFLAGS, CTARGET, CXX, CXXFILT, ELFEDIT, EXTRA_ECONF, F77FLAGS, FC, GCOV, GPROF, INSTALL_MASK, LC_ALL, LD, LFLAGS, LIBTOOL, MAKE, MAKEFLAGS, NM, OBJCOPY, OBJDUMP, PORTAGE_BINHOST, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, RANLIB, READELF, RUSTFLAGS, SIZE, STRINGS, STRIP, YACC, YFLAGS
Is .12 any better?
Can you paste all options starting with TLS from your imapd-ssl file? Something like "grep ^TLS_ /etc/courier/imapd-ssl". Any chance you could share that certificate in /usr/share/courier/imapd.pem?
Sorry, somehow I did not get informed by Bugzilla about your questions. Since 3.0.12 went stable now, I can confirm, that the problem persists. And it is also present with 3.1.4. Since this an internal server, that is not reachable from the outside, I can share the key and cert: =========== %< =============== cat /usr/share/courier/imapd.pem -----BEGIN PRIVATE KEY----- MIICeAIBADANBgkqhkiG9w0BAQEFAASCAmIwggJeAgEAAoGBANG7pMsGmnB9xPxC Yak/uof2swlkkR4K1ReyHPHtXqQM/8WZkVsRguptDL2MktAXuoUBj2weBdxHoVdF tjL3HvEz4mo5salU6UFYylGimjQ6CdTMea7a/Y0l60Ji4V0o/KwHZ2bWycVM5hn+ D98ERbA5TWFfo2tg3gj9IZzUCn6pAgMBAAECgYBnFefFspUuPWMY6je+TIiOU39k Wn3JWmGqp+z6LEWcNJdytCxxqoXCW58re3Cdv0v6G+42ofsXbk2q66TGIBigaauu lHFIlUrMWLsha2a+Y4oQOpLuGiKaWp1tRZRcKuRAg8GRLiz3hZrco/OqgisjRPPg yy99L2uz46Qq4kejQQJBAOfQv0qd6K3ZWJ/+fPa64Kfxq3Gaz/fYdd4pzIuPJAKn qyXZ8ItxAflmJus4tqLsM7qjeUESCN6ch5boLoOwYL0CQQDnnSA0OF2j0xU7EsSA kuwcHs6vwUT0Xn+qv+dOKzQqLNuv+fOsemH3c1fS2JGWrdgMKkInh7/qKxl0BT6U G2JdAkEAyO+ZkG0V7fOSrYRi/173Mrv5VszRbc0URhFHOsVFeoOph3LE3amEA5E3 NPcA4HILWMEwbmXaiFN3+CejggSVpQJBALv1Bu1Z0KPh6JjH4i91C6bGWXTHou2s wm4OzebhqLORM7bbYKPXrSjisaKpnXxqF6nHoWfzAgtGbqF4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mIwDQYJKoZIhvcNAQEFBQADgYEAfYXJ WNFapV9OMCspHSPX9nEtwTU9C85xCxw3XjxgtaxexBK1CwqUVCRpuHb7fZbnu2u0 cm+JcPrS7LAFIQvk3a6RXBy4vVVHoWg9lYmhefDMQ1LFzLUgTVv6Rk/1XcK0Py1+ ORhdH0tZ2rqWhAoFQdke2jL3kzrYxhdimZEKzEQ= -----END CERTIFICATE----- =========== %< =============== However, I can simply delete it and let Courier generate a new one at start - the situation does not change. The client detects the new cert and asks, if it is acceptable (permanently) and if I confirm, the cert is stored, but the connection is immediately dropped again and the server is claimed to be unavailable. Restoring 3.0.10 immediately solves the problem.
The missing config: # grep ^TLS /etc/courier/imapd-ssl TLS_STARTTLS_PROTOCOL="$TLS_PROTOCOL" TLS_CERTFILE=/usr/share/courier/imapd.pem TLS_TRUSTCERTS=/etc/ssl/certs/ca-certificates.crt TLS_VERIFYPEER=NONE TLS_CACHEFILE=/var/lib/courier/couriersslimapcache TLS_CACHESIZE=524288 TLS_ALPN=imap
Ok, I think now we're getting to the issue. You don't have the TLS_DHPARAMS option set, the default is: TLS_DHPARAMS=/usr/share/courier/dhparams.pem openssl 3.0.10 had some changes regarding checking DH parameters, so that might be the issue. Can you try adding that? Can you furthermore check that /usr/share/courier/dhparams.pem is there and that it has a reasonable size? (I believe in some very old courier versions there was a bug that it would create excessively small/insecure dhparams, it might be that newer openssl reject that.) You can check the parameter size with: openssl dhparam -in /usr/share/courier/dhparams.pem -text It should be 2048 bits or 4096 bits. If it's anything smaller, I recommend deleting the file and regenerating it with mkdhparams Also, your certificate is only 1024 bit in size. I don't know if openssl cares about that, but that's also too small for modern standards. You should regenerate that, too.
Hallo Hanno, sorry that it took so long again to come back to this, but I finally updated openssl again and did the correct configuration in Courier for the DH params, just as you suggested and you were right, my client can connect now. Thanks, Jörg