Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ssl: add SSLContext#min_version= and #max_version= #142

Merged
merged 5 commits into from
Sep 3, 2017

Commits on Sep 2, 2017

  1. ssl: ensure that SSL option flags are non-negative

    SSL_CTX_{get,set,clear}_options() are made separate functions and they
    now treat flags as unsigned long. Fix possible RangeError on platforms
    with sizeof(long)==4.
    rhenium committed Sep 2, 2017
    Configuration menu
    Copy the full SHA
    fb7fe81 View commit details
    Browse the repository at this point in the history
  2. ssl: update OpenSSL::SSL::OP_* flags

    Reorder, expand ossl_ssl_def_const() macro so RDoc can parse and render
    better, and add new flags that are in recent versions of OpenSSL.
    rhenium committed Sep 2, 2017
    Configuration menu
    Copy the full SHA
    b44ab7f View commit details
    Browse the repository at this point in the history
  3. ssl: prefer TLS_method() over SSLv23_method()

    OpenSSL 1.1.0 replaced SSLv23_method() with TLS_method(). SSLv23_method
    which still exists in 1.1.0, as a macro around TLS_method, will
    eventually be removed. Use the new name if possible.
    rhenium committed Sep 2, 2017
    Configuration menu
    Copy the full SHA
    5b753d4 View commit details
    Browse the repository at this point in the history

Commits on Sep 3, 2017

  1. ssl: add SSLContext#min_version= and #max_version=

    Add methods that set the minimum and maximum supported protocol versions
    for the SSL context. If the OpenSSL library supports, use
    SSL_CTX_set_{min,max}_proto_version() that do the exact thing.
    Otherwise, simulate by combining SSL_OP_NO_{SSL,TLS}v* flags.
    
    The new methods are meant to replace the deprecated #ssl_version= that
    cannot support multiple protocol versions.
    
    SSLContext::DEFAULT_PARAMS is also updated to use the new
    SSLContext#min_version=.
    rhenium committed Sep 3, 2017
    Configuration menu
    Copy the full SHA
    1860394 View commit details
    Browse the repository at this point in the history
  2. ssl: rework SSLContext#ssl_version=

    Reimplement SSLContext#ssl_version= as a wrapper around
    SSLContext#min_version= and #max_version=.
    
    SSLContext#ssl_version= used to call SSL_CTX_set_ssl_version() which
    replaces the SSL method used for the connections created from the SSL
    context. This is mainly used for forcing a specific SSL/TLS protocol
    version.
    
    As of OpenSSL 1.1.0, however, use of the version-specific SSL methods
    such as TLSv1_method() is deprecated. Follow the current recommendation
    -- to use the generic SSL method always and to control the supported
    version range by SSL_CTX_set_{min,max}_proto_version(). Actually, we
    have already started doing a similar thing when the extension is
    compiled with OpenSSL 1.1.0.
    
    OpenSSL::SSL::SSLContext::METHODS, which contained the possible names of
    SSL methods, is not useful anymore. It is now deprecate_constant-ed.
    rhenium committed Sep 3, 2017
    Configuration menu
    Copy the full SHA
    5653599 View commit details
    Browse the repository at this point in the history