Skip to content
This repository has been archived by the owner on Dec 7, 2018. It is now read-only.

Client SSL Certificates #113

Merged
merged 4 commits into from
Nov 12, 2013
Merged

Conversation

stouset
Copy link
Contributor

@stouset stouset commented Nov 8, 2013

Added support for verifying client SSL certs.

Added an explicit option for SSL's `verify_mode`. In the event that a CA file
or CA path are passed, default to expecting clients to have signed certs. If
nothing is provided, use the preexisting behavior of not verifying clients.
@stouset
Copy link
Contributor Author

stouset commented Nov 8, 2013

On second thought, I'm adding a test to verify that unsigned certificates fail, which is even more important than making sure signed certs succeed. Don't yet merge.

@digitalextremist
Copy link
Member

👍

@stouset
Copy link
Contributor Author

stouset commented Nov 8, 2013

Alright, good to go.


# if verify_mode isn't explicitly set, verify peers if we've
# been provided CA information that would enable us to do so
ssl_context.verify_mode = case
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

style points

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ditto on the style here. I'd probably go with an if elsif else and assign ssl_context.verify_mode in each e.g.:

if options.include?(:verify_mode)
  ssl_context.verify_mode = options[:verify_mode]
elsif options.include?(:ca_file) || options.include?(:ca_path)
  ...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I may have misunderstood @sconover, but I believe he was expressing appreciation for the style and not concern. :)

Personally, I feel like the tabular layout of case statements like this greatly increases readability and reduces noise. But if you prefer it with a series of elsifs, I'm happy to go with your preferred style.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think idiomatic Ruby style is to not indent whens after case statements, which is why I think this is kind of awkward. Although I may have misunderstood @sconover here ;)

@sconover
Copy link

sconover commented Nov 8, 2013

lgtm with suggestion

@tarcieri
Copy link
Member

Will merge this as-is. Seems fine ;)

tarcieri added a commit that referenced this pull request Nov 12, 2013
@tarcieri tarcieri merged commit 4e80ee2 into celluloid:master Nov 12, 2013
@stouset stouset deleted the client-ssl-certificates branch November 12, 2013 20:39
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

4 participants