fetcher icon indicating copy to clipboard operation
fetcher copied to clipboard

Fetcher should accept a parameter to ignore bad SSL certificates

Open ryanmcgrath opened this issue 15 years ago • 0 comments

I know, I know, it kinda defeats the point of SSL entirely, but there's legitimate cases where this is useful (e.g, Gmail having SSL issues randomly, all you care about is the emails, SSL isn't truly a problem in this case and you don't really care about security).

I implemented a patch for this - the following option would have to be specified in the config parameters:

ssl_verification: false

Then the core file (fetcher/lib/fetcher/imap.rb, around line 40) would be this:

def initialize(options={})
  @authentication = options.delete(:authentication) || 'PLAIN'
  @port = options.delete(:port) || PORT
  @ssl = options.delete(:ssl)
  @ssl_verification = options.delete(:ssl_verification)
  @use_login = options.delete(:use_login)
  @in_folder = options.delete(:in_folder) || 'INBOX'
  @processed_folder = options.delete(:processed_folder)
  @error_folder = options.delete(:error_folder) || 'bogus'
  super(options)
end

# Open connection and login to server
def establish_connection
  timeout_call = (RUBY_VERSION < '1.9.0') ? "SystemTimer.timeout_after(15.seconds) do" : "Timeout::timeout(15) do"

  eval("#{timeout_call}
            @connection = Net::IMAP.new(@server, @port, @ssl, nil, @ssl_verification)
            if @use_login
                @connection.login(@username, @password)
            else
                @connection.authenticate(@authentication, @username, @password)
            end
        end")
end

If I have time I'll fork and make a real patch, but I find myself incredibly busy these days. Figured it's worth noting here for anyone else who runs into this issue, if nothing else.

Google Buzzwords: Ruby, Gmail, IMAP, SSL, Certificates, Verify

ryanmcgrath avatar Sep 09 '10 21:09 ryanmcgrath