Skip to content
This repository has been archived by the owner on Jan 15, 2024. It is now read-only.

Add SSL context configuration #309

Closed
wants to merge 2 commits into from
Closed

Add SSL context configuration #309

wants to merge 2 commits into from

Conversation

thijsc
Copy link
Contributor

@thijsc thijsc commented Aug 25, 2014

MongoDB offers a possibility to use SSL client certificates and to use the root CA to verify hosts. This change makes these settings accessible from the config by passing a Hash instead of a boolean to the SSL option.

This patch is heavily inspired by dc21475

MongoDB offers a possibility to use SSL client certificates and to use
the root CA to verify hosts. This change makes these settings accessible
from the config by passing a Hash instead of a boolean to the SSL
option.

This patch is heavily inspired by dc21475
@thijsc
Copy link
Contributor Author

thijsc commented Aug 25, 2014

I've been looking at how to add tests for the SSL socket. There's currently no test for the whole class. Happy to write one, but is this by design maybe?

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.68%) when pulling 9983f68 on appsignal:ssl_options into 2d92a6b on mongoid:master.

@thijsc
Copy link
Contributor Author

thijsc commented Nov 3, 2014

Any chance somebody from the core team could reply to my question or merge this?

@taemon1337
Copy link

I was trying to use this patch but was unable to get it working until I modded the Moped::Protcol::Commands::Authenticate class to set the Mongo authentication mechanism.

This patch was used in addition to the one this pull request suggests. You will also need to set the password field in the mongoid config to 'MONGODB-X509'.

module Moped
  module Protocol
    module Commands
      class Authenticate
        MECHANISM='MONGODB-X509'.freeze

        def initialize(database, username, password, nonce=nil)
          if password == MECHANISM
            super("$external", build_x509_command(username))
          else
            super(database, build_auth_command(username, password, nonce))
           end
        end
      end

      def build_x509_command(username)
        { authenticate: 1, user: username, mechanism: MECHANISM }
      end
    end
  end
end

@thijsc thijsc closed this Aug 23, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants