Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

es7 + https + ca_file #13

Open
DavidGoodwin opened this issue May 26, 2022 · 0 comments
Open

es7 + https + ca_file #13

DavidGoodwin opened this issue May 26, 2022 · 0 comments

Comments

@DavidGoodwin
Copy link

DavidGoodwin commented May 26, 2022

Hi,
We have an Es7 cluster, and I had to make a few changes to this plugin for it to talk to it. Mostly around the fact we need to use https when talking to ES, and have a custom ca_file to use with openssl etc.

so, I did :

1 . Specified the 'host' env var as https://whatever-server
2. Changed the 'fetch(resource)' function to be :

def fetch(resource)
    uri = URI("" + @host + ":" + @port.to_s + resource)
    http = Net::HTTP.new(uri.host, uri.port)
    http.use_ssl = (uri.scheme == 'https')
    if(http.use_ssl?) 
      http.ca_file = "/etc/whatever/es7.crt"
      http.use_ssl = true
      http.verify_mode = OpenSSL::SSL::VERIFY_NONE
    end

    req = Net::HTTP::Get.new(uri)
    unless @user.empty?
      req.basic_auth @user, @pass
    end

    response = http.request(req)
    return JSON.parse(response.body)
end

after that, it seems to work.

Apologies for what's probably not very good ruby. I suspect the 'ca_file' should really be handled through another ENV thing really.

Thanks for this plugin though ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant