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

Issues with SSL certificate validation in logstash output http plugin #21

Closed
suraj-kamath opened this issue Sep 28, 2015 · 65 comments · Fixed by #126
Closed

Issues with SSL certificate validation in logstash output http plugin #21

suraj-kamath opened this issue Sep 28, 2015 · 65 comments · Fixed by #126

Comments

@suraj-kamath
Copy link

There are two issues:

  1. ssl_certificate_validation option is not taking effect. Irrespective of whether we give the value as true or false, it is always taken as true.
  2. During SSL certification validation, logstash is doing a strict host name check. As part of this, it is not supporting wildcard certificates where CN is like *.subdomain.domain.com. Either this needs to be fixed or it would be ideal to have another option to the http plugin like, for example, "strict_host name_check" which can be set to true or false.

Logstash version :1.5.4
Http plugin version :1.1.0
java : 1.8.0_51.

@ayashjorden
Copy link

👍
Also experienced this behaviour.
@suraj-kamath nice description of the problem :)

@suraj-kamath
Copy link
Author

@logstash-dev's can we have an update here ?

@ayashjorden
Copy link

@suraj-kamath I've found that 'ssl_certificate_validation' is used here.

Does it help?

@deeptjos
Copy link

Still awaiting response on this from "logstash-dev"
Please provide an update on this issue, Is there any plan of adding the changes in latest release ?

@suyograo
Copy link
Contributor

ssl_certificate_validation option is not taking effect. Irrespective of whether we give the value as true or false, it is always taken as true.

@suraj-kamath is this plugin still trying to do cert validation when ssl_certificate_validation is false?

@clausy
Copy link

clausy commented Nov 6, 2015

I'm getting the same error when using
ssl_certificate_validation => false
I get
"error" => "PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target"

I just downloaded logstash 2.0 and installed the http_poller plugin

@deeptjos
Copy link

@logstash-dev's Any update on this ?
Also looks like Logstash does not support SNI, Please confirm.

@type0lang
Copy link

+1

@sameerpanicker
Copy link

I am also getting the same error.

"error" => "PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target"

@NikolaeVarius
Copy link

+1 Getting same issue as above

@rlwmmw
Copy link

rlwmmw commented Apr 14, 2016

+1 Need a workaround!

@lifeofguenter
Copy link

+1

@sameerpanicker
Copy link

I was able to fix this problem. Check whether your application is using JDK or JRE. Based on that try installing the certificate in the keystore.
Let me know if you have any queries.

@dandrestor
Copy link

Same problem here.

@claudekenni
Copy link

same problem here:

"PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target"

@RohanKumbhar1
Copy link

@sameerpanicker : great !! could you please help us here to fix this issue? may be list of steps to fix this would be great.

@sameerpanicker
Copy link

Go to Environment Variables and check if you are using JRE or JDK path as a JAVA_HOME value.
i.e. C:\Program Files\java\jdk1.8.0_74 or C:\Program Files\java\jre1.8.0_74

Based on that change JRE/JDK and execute this command using CMD

C:\Program Files\Java\jre1.8.0_74\bin
keytool -import -noprompt -trustcacerts -alias "CERT-NAME" -file "C:\Users\MYWORK\Desktop\QA.cer" -keystore "C:\Program Files\Java\jdk1.8.0_74\jre\lib\security\cacerts" -storepass changeit

Let me know if this works.

@dandrestor
Copy link

dandrestor commented Jun 7, 2016

I managed to find the problem in my case, although I don't know if this would apply to everybody here.
See logstash-plugins/logstash-output-elasticsearch#433

@suraj-kamath can you check if this is a duplicate?

@amulyas
Copy link

amulyas commented Oct 12, 2016

+1 same issue any workaround here?

@breml
Copy link

breml commented Jan 18, 2017

Creating my own truststore with the keytool and using the configuration options keystore and keystore_password did not work for me. Adding the same certificate the same way to the $JAVA_HOME/jre/lib/security/cacerts truststore solved the problem for me.

Using logstash version 2.4.1.

@slalomnut
Copy link

breml's work around did the trick for me.

@blacklobo
Copy link

@dandrestor output HTTP does not have an valid setting of "ssl". So that solution will not work.

This problem is still present in Logstash version 5.3.1

@yaoyaminaco0571
Copy link

yaoyaminaco0571 commented Jul 12, 2017

@bernielomax as the error output mentioned "logstash unable to find valid certification path to requested target", you should add a fake path to it since the code needs.

The configuration is worked fine for me:

    ssl => true
    ssl_certificate_verification => false
    truststore => "/home/admin/server/elasticsearch-current/config/truststore.jks"
    truststore_password => changeit
    user => logstash
    password => logstash

If OK pls feedback. I guess it will work around the problem met in http output. @blacklobo

Caution: the jks file should be exists and readable for logstash.

@Petrox
Copy link

Petrox commented Aug 16, 2017

This issue is open since 2015.

@AverageS
Copy link

AverageS commented Aug 24, 2017

@Petrox +1
Issue is opened since 2015 and still option ssl_certificate_verification => false doesnt do anything.

@logstash-plugins logstash-plugins deleted a comment from bernielomax Aug 24, 2017
@logstash-plugins logstash-plugins deleted a comment from andremilk Aug 24, 2017
@ashmilhussain
Copy link

+1 same issue as everyone else.

@NihilBabu
Copy link

same issue need help urgently

@agberoz
Copy link

agberoz commented Oct 27, 2020

+1 same issue here

@samrui
Copy link

samrui commented Feb 2, 2021

+1 same issure

@taajuni2
Copy link

taajuni2 commented Feb 4, 2021

+1 same issue here

@pedrolauro
Copy link

+1 Same issue here...

@fkellner
Copy link

+1 same issue with a wildcard certificate not being recognized here.

@jwhiteman36
Copy link

+1 same issue.

@Beeez
Copy link

Beeez commented Feb 26, 2021

+1 Having the same problem

@GreggBzz
Copy link

+1, same issue using wildcards and/or ignoring certification verification.

@qwerty1q2w
Copy link

+1

5 similar comments
@mazurdv
Copy link

mazurdv commented May 3, 2021

+1

@mldaali
Copy link

mldaali commented Jun 26, 2021

+1

@dchsueh
Copy link

dchsueh commented Jun 30, 2021

+1

@denisvll
Copy link

denisvll commented Aug 3, 2021

+1

@sennl
Copy link

sennl commented Aug 12, 2021

+1

@thunderwood19
Copy link

Since 2015...

@zgfh
Copy link

zgfh commented Aug 18, 2021

+1

@hamparid
Copy link

hamparid commented Oct 21, 2021

+1 (We have wildcard Certs AND SSL settings to turn off verification in LS don't work)

@M9k
Copy link

M9k commented Nov 4, 2021

+1

1 similar comment
@smnschndr
Copy link

+1

@jeffwong-mocs
Copy link

@yaoyaminaco0571 's suggestion to add truststore path worked for me in v7.16.1

@bernielomax as the error output mentioned "logstash unable to find valid certification path to requested target", you should add a fake path to it since the code needs.

The configuration is worked fine for me:

    ssl => true
    ssl_certificate_verification => false
    truststore => "/home/admin/server/elasticsearch-current/config/truststore.jks"
    truststore_password => changeit
    user => logstash
    password => logstash

If OK pls feedback. I guess it will work around the problem met in http output. @blacklobo

Caution: the jks file should be exists and readable for logstash.

@yaoyaminaco0571
Copy link

yaoyaminaco0571 commented Dec 13, 2021 via email

@bastianhjaeger
Copy link

Facing the same issue (out of a sudden) with no cert used at all .

This is my output section:

  elasticsearch {
    hosts => "https://elastic.xxx.de:9200"
    ssl => true
    ssl_certificate_verification => false
    document_id => "someid"
    user => "user"
    password => "password"
    doc_as_upsert => true
    action => "update"
  }

And I have no truststore to set ot a cacert.

@kares kares linked a pull request Feb 3, 2022 that will close this issue
@kares
Copy link
Contributor

kares commented Feb 3, 2022

A lot has been going on here over the years, but let me tackle this down:

  • the http_client mixin and thus output-http plugin at some point had the ssl_certificate_validation option
  • the ssl_certificate_validation => false had no effect and was later removed to confuse users
  • Feat: support ssl_verification_mode => 'full' / 'none' #126 added a new option ssl_verification_mode

The updated http output which can be used to disable verification (using ssl_verification_mode => none) will be part of Logstash 8.1, in the mean time try bin/logstash-plugin update logstash-output-http (which should update the plugin to >= 5.3.0)

The issue also mentions ES output with the ssl_certificate_verification => false option, the issue while similar do not have the same cause - for ES output disabling verification had some effect (allowing self-signed certificates) but did not disable verification completely. This issue has also been resolved and should be available since Logstash 7.17.0.

@kares kares closed this as completed Feb 3, 2022
@yaoyaminaco0571
Copy link

yaoyaminaco0571 commented Feb 3, 2022 via email

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

Successfully merging a pull request may close this issue.