Coder Social home page Coder Social logo

Renegotiate Issues about python-mbedtls HOT 4 CLOSED

synss avatar synss commented on June 11, 2024
Renegotiate Issues

from python-mbedtls.

Comments (4)

Jnetops avatar Jnetops commented on June 11, 2024

If this is a stupid bug report I apologize. If this functionality exists please, if you don't mind, advise me on how I would use it. Otherwise, if you need further information I can submit anything you need for a use case, including pcap of how a typical handshake with this particular server occurs vs how this library currently handles it etc.

from python-mbedtls.

Synss avatar Synss commented on June 11, 2024

Hi @Jnetops! No need to apologize. 😉 I will have a look at this in the next few days.

from python-mbedtls.

Jnetops avatar Jnetops commented on June 11, 2024

OK no problem. The error I get is a WantReadError() with the current state being HandshakeStep.SERVER_HELLO. This is totally understandable since once a CLIENT_HELLO is sent with cookie, the expectation is a SERVER_HELLO should follow. If there was a way to manually set state to HELLO_REQUEST so it attempts to read the right state, or ability to trigger renegotiation on HELLO_REQUEST etc etc that would be super.

from python-mbedtls.

Synss avatar Synss commented on June 11, 2024

It looks like mbedtls_ssl_conf_renegotiation() is indeed what you need but, according to upstream documentation, the option is dangerous and easily misused, as you might have seen already

If you don't need renegotiation, it's probably better to disable it, since
it has been associated with security issues in the past and is easy to
misuse/misunderstand.

https://github.com/ARMmbed/mbedtls/blob/master/include/mbedtls/mbedtls_config.h#L1428-L1432

It is recommended to always disable renegotation unless you
know you need it and you know what you're doing. In the
past, there have been several issues associated with
renegotiation or a poor understanding of its properties.

https://github.com/ARMmbed/mbedtls/blob/master/include/mbedtls/ssl.h#L3333-L3336

Actually, I realize https://github.com/Synss/python-mbedtls/blob/master/src/mbedtls/tls.pyx#L446 is useless in my code and I will remove the line. I think it is best if you patch the library yourself and make sure that

    # https://github.com/Synss/python-mbedtls/blob/master/src/mbedtls/tls.pxd#L305-L307
    void mbedtls_ssl_conf_renegotiation(
        mbedtls_ssl_config *conf,
        int renegotiation)

remains as-is and

           # https://github.com/Synss/python-mbedtls/blob/master/src/mbedtls/tls.pyx#L446
           _tls.mbedtls_ssl_conf_renegotiation(&self._ctx, 0)

is either set with a parameter or set to 1

           # or if you want to always enable renegotiation, which is not recommended
           _tls.mbedtls_ssl_conf_renegotiation(&self._ctx, 1)

from python-mbedtls.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.