Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 804894 - dev-lang/python: do not override dev-libs/openssl defaults
Summary: dev-lang/python: do not override dev-libs/openssl defaults
Status: UNCONFIRMED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal enhancement (vote)
Assignee: Python Gentoo Team
URL:
Whiteboard:
Keywords:
Depends on: 812794
Blocks:
  Show dependency tree
 
Reported: 2021-07-28 14:48 UTC by Joakim Tjernlund
Modified: 2022-05-06 10:58 UTC (History)
7 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Joakim Tjernlund 2021-07-28 14:48:56 UTC
I got bitten by python SSL defaults are different than openssl:
/* Python custom selection of sensible cipher suites
 * @SECLEVEL=2: security level 2 with 112 bits minimum security (e.g. 2048 bits RSA key)
 * ECDH+*: enable ephemeral elliptic curve Diffie-Hellman
 * DHE+*: fallback to ephemeral finite field Diffie-Hellman
 * encryption order: AES AEAD (GCM), ChaCha AEAD, AES CBC
 * !aNULL:!eNULL: really no NULL ciphers
 * !aDSS: no authentication with discrete logarithm DSA algorithm
 * !SHA1: no weak SHA1 MAC
 * !AESCCM: no CCM mode, it's uncommon and slow
 *
 * Based on Hynek's excellent blog post (update 2021-02-11)
 * https://hynek.me/articles/hardening-your-web-servers-ssl-ciphers/
 */

There is a configure option --with-ssl-default-suites=python|openssl which can
change these defaults.

I wonder if it would make sense to either expose this config option with a USE
flag or just enforce openssl defaults ?
Comment 1 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2021-07-31 06:01:27 UTC
Oh nice.  I generally like the idea of following OpenSSL, and it would follow suit with e.g. how we disable custom certificate stores.

Could you make a quick comparison against the current OpenSSL defaults though?  (presuming their notes might not be up-to-date)

Also, does that imply disabling things like ECDH?  Wouldn't that risk breaking something?
Comment 2 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2021-07-31 06:07:51 UTC
I see that Fedora is using OpenSSL defaults [1].  Debian doesn't seem to use the flag but with their humongous patch set they might be actually doing something like that anyway [2].  Arch uses Python defaults [3].

[1] https://src.fedoraproject.org/rpms/python3.9/blob/rawhide/f/python3.9.spec#_864
[2] https://packages.debian.org/bullseye/python3.9
[3] https://github.com/archlinux/svntogit-packages/blob/packages/python/trunk/PKGBUILD#L59
Comment 3 Joakim Tjernlund 2021-07-31 10:52:52 UTC
(In reply to Michał Górny from comment #1)
> Oh nice.  I generally like the idea of following OpenSSL, and it would
> follow suit with e.g. how we disable custom certificate stores.
> 
> Could you make a quick comparison against the current OpenSSL defaults
> though?  (presuming their notes might not be up-to-date)
> 
> Also, does that imply disabling things like ECDH?  Wouldn't that risk
> breaking something?

I don't know how to do that, not that into SSL.
What tripped me was the change of SECLEVEL, from 1 to 2 in python
SECLEVEL=2 requires a key size >= 2048 and we had an old cert which had key size = 1024.
This cert has been fixed now though.
Comment 4 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2021-07-31 11:41:08 UTC
Security, could you advise us here?
Comment 5 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2021-08-07 14:05:52 UTC
After some discussion, I think the best solution here would be to:

1. Stop overriding SSL defaults in CPython.

2. Enforce stronger SSL defaults in OpenSSL itself, possibly under USE=hardened or alike.


Long story short, I don't like CPython overriding the defaults indeed but I also don't like the idea of going with weaker settings than CPython does by default.  After all, since upstream is already 'hardening' SSL settings here, weakening them on Gentoo would mean that people developing on Gentoo could create packages that fail on other distros.

I think the best compromise here is to have strong settings available in OpenSSL itself, and possibly use OpenSSL as a single 'switching point' for these settings rather than having individual packages override them.

CC-ing base-system@ as OpenSSL maintainers.
Comment 6 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2021-09-05 06:12:38 UTC
@base-system, ping.
Comment 7 Mike Gilbert gentoo-dev 2021-09-05 14:45:42 UTC
I think it makes sense to use the OpenSSL default settings for Python.

Could you file a separate bug with your proposed changes for the OpenSSL defaults?