Skip to content
This repository was archived by the owner on Dec 2, 2017. It is now read-only.
This repository was archived by the owner on Dec 2, 2017. It is now read-only.

Fetcher should accept a parameter to ignore bad SSL certificates #8

Description

@ryanmcgrath

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions