Skip to content

Debian Sid/Buster: Cannot enable TLS 1.0/1.1 with PROTOCOL_TLS #75634

Closed

Description

@AdrianVollmer
BPO 31453
Nosy @doko42, @tiran, @ned-deily, @njsmith, @AdrianVollmer, @miss-islington, @smartmadre
PRs
  • bpo-31453: [WIP] Allow to change TLS protocols on Debian #3662
  • bpo-31453: Add setter for min/max protocol version #5259
  • [3.7] bpo-31453: Add setter for min/max protocol version (GH-5259) #5926
  • Files
  • poc.py
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = <Date 2021-04-17.19:33:08.562>
    created_at = <Date 2017-09-13.15:48:25.120>
    labels = ['expert-SSL', 'type-bug']
    title = 'Debian Sid/Buster: Cannot enable TLS 1.0/1.1 with PROTOCOL_TLS'
    updated_at = <Date 2021-04-17.19:33:08.561>
    user = 'https://github.com/AdrianVollmer'

    bugs.python.org fields:

    activity = <Date 2021-04-17.19:33:08.561>
    actor = 'christian.heimes'
    assignee = 'none'
    closed = True
    closed_date = <Date 2021-04-17.19:33:08.562>
    closer = 'christian.heimes'
    components = ['SSL']
    creation = <Date 2017-09-13.15:48:25.120>
    creator = 'adrianv'
    dependencies = []
    files = ['47139']
    hgrepos = []
    issue_num = 31453
    keywords = ['patch']
    message_count = 30.0
    messages = ['302081', '302082', '302084', '302085', '302086', '302088', '302091', '302092', '302093', '302094', '302097', '302099', '302100', '302561', '307105', '310996', '311008', '312920', '312991', '312997', '312998', '314635', '316017', '317534', '317574', '317610', '317618', '317619', '329218', '391309']
    nosy_count = 9.0
    nosy_names = ['doko', 'christian.heimes', 'ned.deily', 'njs', 'kroeckx', 'Alex Gaynor', 'adrianv', 'miss-islington', 'mabrafoo']
    pr_nums = ['3662', '5259', '5926']
    priority = 'critical'
    resolution = 'out of date'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue31453'
    versions = ['Python 2.7', 'Python 3.6']

    Activity

    1. AdrianVollmer commented on Sep 13, 2017

      AdrianVollmermannequin
      MannequinAuthor

      According to the documentation (https://docs.python.org/2/library/ssl.html#ssl.PROTOCOL_TLS), using ssl_version = ssl.PROTOCOL_TLS in a server socket should offer all TLS/SSL versions. However, it only offers TLSv1_2.

      I attached a proof of concept.

      $ python3 poc.py
      3.5.4 (default, Aug 12 2017, 14:08:14)
      [GCC 7.1.0]
      OpenSSL 1.1.0f  25 May 2017
      [SSL: UNSUPPORTED_PROTOCOL] unsupported protocol (_ssl.c:719)
      [SSL: UNSUPPORTED_PROTOCOL] unsupported protocol (_ssl.c:719)
      b'test\n'
      
      $ python2 poc.py
      2.7.13 (default, Jan 19 2017, 14:48:08)
      [GCC 6.3.0 20170118]
      OpenSSL 1.1.0f  25 May 2017
      [SSL: UNSUPPORTED_PROTOCOL] unsupported protocol (_ssl.c:661)
      [SSL: UNSUPPORTED_PROTOCOL] unsupported protocol (_ssl.c:661)
      test

      To connect with s_client:

       $ for i in {tls1,tls1_1,tls1_2} ; do echo test | openssl s_client -connect localhost:3333 -CAfile server.pem -quiet -$i ; done
      140164347663616:error:1409442E:SSL routines:ssl3_read_bytes:tlsv1 alert protocol version:../ssl/record/rec_layer_s3.c:1399:SSL alert number 70
      139926441944320:error:1409442E:SSL routines:ssl3_read_bytes:tlsv1 alert protocol version:../ssl/record/rec_layer_s3.c:1399:SSL alert number 70
      depth=0 C = AU, ST = Some-State, O = Internet Widgits Pty Ltd
      verify return:1
      read:errno=0
    2. AlexGaynor commented on Sep 13, 2017

      AlexGaynormannequin
      Mannequin

      What operating system are you on?

    3. AdrianVollmer commented on Sep 13, 2017

      AdrianVollmermannequin
      MannequinAuthor

      Debian buster/sid

    4. tiran commented on Sep 13, 2017

      @tiran
      Member

      Debian Buster has patched OpenSSL to disable TLS 1.0 and 1.1 by default,
      https://lists.debian.org/debian-devel-announce/2017/08/msg00004.html

    5. AdrianVollmer commented on Sep 13, 2017

      AdrianVollmermannequin
      MannequinAuthor

      I read about that, but I don't understand. If I use openssl s_server -port 3333 , I can connect using either one of the three protocols.

      Even if that's the new default, is there no way now to get python on Buster/Sid to use OpenSSL in a non-default mode and have it offer all three versions?

    6. tiran commented on Sep 13, 2017

      @tiran
      Member

      You have to enable the protocols by applying a reverse bitmask to SSLContext.options:

      ctx = ssl.SSLContext(ssl.PROTOCOL_TLS)
      ctx.load_cert_chain('server.pem')
      ctx.options &= ~(ssl.OP_NO_TLSv1 | ssl.OP_NO_TLSv1_1)
      
      sslsock = ctx.wrap_socket(s, server_side=True)
    7. AdrianVollmer commented on Sep 13, 2017

      AdrianVollmermannequin
      MannequinAuthor

      Doesn't seem to do anything:

      >>> ctx.options
      2181170175L
      >>> ctx.options & ~(ssl.OP_NO_TLSv1 | ssl.OP_NO_TLSv1_1)
      2181170175L
    8. tiran commented on Sep 13, 2017

      @tiran
      Member

      Please report this issue to the Debian maintainers. I don't know how Debian has disabled TLS 1.0 and TLS 1.1 for the SSL_METHOD *TLS_method(void). It might not be possible to enable auto-negotiation for old protocols at all.

    9. AdrianVollmer commented on Sep 13, 2017

      AdrianVollmermannequin
      MannequinAuthor

      Okay, thanks for your time!

    10. tiran commented on Sep 13, 2017

      @tiran
      Member

      Ah, here we go: https://anonscm.debian.org/viewvc/pkg-openssl/openssl/branches/1.1.0/debian/patches/tls1_2_default.patch

      Debian patched the default for SSL_CTX_set_min_proto_version(). The SSL_CTX_set_min_proto_version() and SSL_CTX_set_max_proto_version() API calls are OpenSSL 1.1.0-only and not available from Python. It is not possible to override the minimum version from Python.

    11. changed the title [-]ssl.PROTOCOL_TLS only select TLSv1.2[/-] [+]Debian Sid/Buster: Cannot enable TLS 1.0/1.1 with PROTOCOL_TLS[/+] on Sep 13, 2017
    12. 15 remaining items

    13. tiran commented on Feb 27, 2018

      @tiran
      Member

      Ned,

      I have pushed the enhancement now. I feel a bit guilty about the last minute push, but I honestly believe it's in our best interesting.

      There is a high chance that the new APIs will be required for Debian and other distros in the near future. OpenSSL has deprecated the old API, too. It is likely that OpenSSL 1.2.0 will remove both the options (OP_NO_TLSv1, OP_NO_TLSv1_2, ...) options and version specific protocols (PROTOCOL_TLSv1, PROTOCOL_TLSv1_2, ...).

    14. ned-deily commented on Mar 29, 2018

      @ned-deily
      Member

      Christian, is there more needed for this issue or can it be closed?

    15. ned-deily commented on May 1, 2018

      @ned-deily
      Member

      Christian, ping. Can we close this?

    16. ned-deily commented on May 24, 2018

      @ned-deily
      Member

      Christian, ping again: can this be closed? In any case, it would not seem to be a "deferred blocker"; downgrading to "critical". Please close or update, thanks!

    17. tiran commented on May 24, 2018

      @tiran
      Member

      The problem no longer affects Python 3.7 and 3.8. It may affects Python 3.6 and 2.7 if Debian to decide to disable TLS 1.0 and 1.1 again. If Debian uses the new OpenSSL 1.1.0 API to disable the protocols, then I have to backport https://bugs.python.org/issue32609 to 2.7 and 3.6.

    18. kroeckx commented on May 24, 2018

      kroeckxmannequin
      Mannequin

      Note that the version in experimental only supports TLS 1.2 and 1.3 with the default config. It's moved from fixed in the code, to the default config file. I expect to upload that to unstable "soon", at which point people will be affected by this again.

    19. tiran commented on May 24, 2018

      @tiran
      Member

      Thanks Kurt,

      which API are you using to disable TLS 1.0 and 1.1? Is it the old SSL_CTX_set_options() or the new SSL_CTX_set_min/max_proto_version() API?

    20. kroeckx commented on May 24, 2018

      kroeckxmannequin
      Mannequin

      The effect is the same as calling SSL_CTX_set_min_proto_version().

    21. smartmadre commented on Nov 4, 2018

      smartmadremannequin
      Mannequin

      FYI, This is how I figured out and fixed the issue on my debian system.
      -Run nmap to figure out what ssl version is being used by the server
      nmap -p443 -sV --script ssl-enum-ciphers 10.10.10.7
      output says TLSv1.0

      test 10.10.10.7 using example in this comment (gets expected error)
      psf/requests#606 (comment)

      test with openssl binary (gets expected error)
      openssl s_client -connect 10.10.10.7:443

      fix by editing this value-->MinProtocol = TLSv1.0
      in this file--> /etc/ssl/openssl.cnf

      rerun tests without error.
      Note the outdated server I am connecting to is internal, non-production, not connected to the internet.

    22. tiran commented on Apr 17, 2021

      @tiran
      Member

      Python 2.7 is out of supports. 3.6 will reach end of security support soon. More recent Python versions have TLS 1.0 and 1.1 deprecated and contain workarounds for tests.

    23. transferred this issue fromon Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Metadata

    Metadata

    Assignees

    No one assigned

      Labels

      topic-SSLtype-bugAn unexpected behavior, bug, or error

      Projects

      No projects

        Milestone

        No milestone

        Relationships

        None yet

        Development

        No branches or pull requests

        Issue actions