Created
July 16, 2012 16:07
-
-
Save kbaribeau/3123533 to your computer and use it in GitHub Desktop.
using custom ssl certs on osx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#see http://jjinux.blogspot.com/2012/02/ruby-working-around-ssl-errors-on-os-x.html | |
require 'open-uri' | |
require 'net/https' | |
module Net | |
class HTTP | |
alias_method :original_use_ssl=, :use_ssl= | |
def use_ssl=(flag) | |
# Ubuntu | |
if File.exists?('/etc/ssl/certs') | |
self.ca_path = '/etc/ssl/certs' | |
# MacPorts on OS X | |
# You'll need to run: sudo port install curl-ca-bundle | |
elsif File.exists?('/opt/local/share/curl/curl-ca-bundle.crt') | |
self.ca_file = '/opt/local/share/curl/curl-ca-bundle.crt' | |
end | |
self.verify_mode = OpenSSL::SSL::VERIFY_PEER | |
self.original_use_ssl = flag | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment