-
Notifications
You must be signed in to change notification settings - Fork 413
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
SSL handshake fails because IP SANs are missing #221
Comments
@soupdiver Thanks for the heads-up. The readme needs an update, but what we really need is to add a flag to skip verification. We'll use this issue to push that through. |
👍 |
@soupdiver: Felix, pull branch ISSUE-221 and give it a whirl & ping me back on your end w/ ack|nack. It works for me. |
@alphazero-es ack |
@soupdiver great. |
(edited this comment to remove incorrect information) Basically, in order to use tls in Go, now you MUST specify a CN in the subject field. Wildcards are supported, but '*' does not match '.' If you're using self signed certs or have a closed ecosystem of SSL certs in your environment, it's possible that
I'm open to exposing a setting you can choose for the cert CN setting (what Go calls ServerName), if that would be useful. |
@jordansissel Have I've missed something? Could you give an example how could I create the certificate specifying the IP SAN ? @alphazero-es
yet ? ALL: Regards, |
@PavelPolyakov The consensus on our end is that it would violate expectation of security for users. @jordansissel has explored and found a viable and practical workaround. In the interim, if using |
@alphazero-es do you mean the workaround about creating the certificate using CN=* ?
The issue is, that even if I've created the certificate using the command provided, and updated it both on the receiver host and on the logstash-forwarder host - I still see that message. |
@PavelPolyakov Yes, it requires a minor change to the publisher code as well. If you can wait until Friday, hopefully we'll push it through then. In the interim, please use Go1.2, or the 221 branch (fully noting that it is NOT acceptable to us. |
@PavelPolyakov Using CN=* will only work if you connect via hostname. If you connect via IP then the CN is completely ignored and the certificate verification requires that an IP Subject Alternate Name is added to the certificate. If you connect via hostname the CN=* will work, or even CN=hostname.you.connect.with will work. I'm in process of writing a script to do all this in Log Courier. Currently I have a "make selfsigned" which works - but it needs manual editing of openssl.cnf to add IP SAN. I will be writing a script to do all this soon. It at least means people who just want quick security can get up and running fast. I'll post here when I'm done but @jordansissel or @alphazero-es are probably already doing something similar. |
@driskell where the blank space is my domain @alphazerp-es Tomorrow I would try to do that again :) Anyway, thanks for your help. |
@PavelPolyakov don't understand the 1.2.x issue. I can't at this moment switch focus to this -- I would have to reinstall 1.2 and all that -- so this will have to wait until Friday (or possibly @jordansissel can provide some insight). if this is absolutely a blocker for you, then I suggest you just build from the prior commit and all should be OK. Thank you for your patience. /R |
@PavelPolyakov this might be due to "*" matches "localhost" and "example" but not "example.com" according to my interpretation of it. Try using the same hostname in certificate as you do in the config to connect. "" is then not a solution as you'd need ".*" presumedly for "example.com" |
@driskell I think you'er right, I didn't test . (I tested * against 'localhost'). Testing now. |
What I can confirm:
IPs and Hostnames are configured differently, or appears to be so. To permit IPs as the server name, your ssl cert must include
Generating a cert with this allows lsf to connect to 127.0.0.1 (by 'name') and it's succesful:
In this respect, DNS seems much easier to work with, but I won't burden you with requiring dns vs ip server names. |
Also confirmed:
|
@PavelPolyakov Your SSL cert, if you are pointing atn an IP address for the server name, must include a subjectAlternativeName field that has |
ok guys, sorry, but I still don't have it working :(
The in config I had the next:
The output was the next:
So... looks like it still doesn't want to connect. The certificate looks the next way: Then I've tried your variant with IP.
Then I'm trying to generate the keys, and here is the output:
So I'm not able even to create the crt file (while .key is created). I've tried to launch everything with the binary compiled using the go-1.3 . However, currently I'm ok having the logstash-forwarder built using the go-1.2 . And I wait patiently for Friday, when the official solution would be exposed, hope it would work for me :) Much thanks for the help. Regards, |
Same issue. Followed this guide and it broke: https://www.digitalocean.com/community/tutorials/how-to-use-logstash-and-kibana-to-centralize-and-visualize-logs-on-ubuntu-14-04 |
Tried with my ip: sudo openssl req -subj '/CN=xx.xx.xx.xxx/' -x509 -batch -nodes -newkey rsa:2048 -keyout private/logstash-forwarder.key -out certs/logstash-forwarder.crt No luck. Same error. |
Added "ssl strict verify": false No IP SANs errors any more. No data either ಠ_ಠ |
@PavelPolyakov Your certificate error says @ponny Based on what I have tested, you cannot add IP addresses in the CN field, you MUST add a subjectAltName as described in this comment: #221 (comment) Allowing folks to disable ssl cert verification disables the very security that SSL provides. We CAN solve this in a way that doesn't continuously confuse users. However, for NOW you must use the instructions I gave in the comment here: #221 (comment) - generate a correct certificate and it works. |
Where will I find this ssl config on Ubuntu 14.04? Do I need to do this on the logstash server or the forwarder nodes? |
@ponny what ssl config? I'm confused now. You mean an ssl config file? You can copy whatever your distro ships with (probably in |
@jordansissel That did it. Thanks. |
The reason it wasn't sending data before was my clumsy fingers typed "falSE" which threw the config in to a spin. |
@driskell
Got any hint? |
@jimmod Make sure you include the IP address in the SANs when running lc-tlscert and not common name. Never put the IP in the common name - always make up a DNS if you don't have one. Then IP always should go in the SAN. I'll make an update soon to make this clear in the instructions lc-tlscert gives. |
@jimmod use DNS and add the records to /etc/hosts file of your local test machine, no special tool needed (the openssl command from README works just fine) |
@driskell ok it work now. |
Hi there!! I read this whole thread but it i still have the same Failed to tls handsake Error. openssl req -x509 -batch -nodes -newkey rsa:2048 -keyout lumberjack.key -out lumberjack.crt -subj /CN=logstash.example.com Just got a little Confusion about the CN, Should it be the Host Logstash Server or Client. |
Seems the main issue here is SSL does not work. And you can not disable it either. So no logstash-forwarder |
@RiaanPretorius It does work - it's just easy to setup wrong. In every case I've helped we've found the problem and fixed it. If you'd like to share your config and steps followed there'll be someone happy to help I'm sure. If you want without SSL there are alternatives available: beaver, nxlog, log-courier (which I maintain) I think all support plain tcp |
@driskell Ifollowed the guides i found on internet e.g. https://www.digitalocean.com/community/tutorials/how-to-install-elasticsearch-logstash-and-kibana-4-on-ubuntu-14-04 and https://github.com/elastic/logstash-forwarder#generating-an-ssl-certificate and a lot more. My biggest problem is multiple domains, sub domains. Plain TCP would be welcomed. I would gladly share my configs, but also keep in mind i followed the conversaion from start to end and nothing worked. I am going try log-courier it seems to best option. |
All of the alternatives to logstash-forwarder look good but it still appears to me that none come with as easy and simple integration with Logstash as the forwarder - No plugin or extra installations on Logstash server side, no other dependencies, and ease to use config file. Please correct me if wrong. Hence, I am very keen to make my forwarder work out but not able to due to the ssl handshake issue. Can any one suggest what are the possible reasons for my forwarder (on RHEL 6) not able to work with my Logstash server cert file and throwing the below error? 2015/06/07 15:47:23.964418 Setting trusted CA from file: /usr/bin/mw_lumberjack.crt Pasting the config and cert details below. Cert Issuer:- Forwarder Config File:-
I've already tried other options of mentioning the issuer's FQDN differently in the cert but NO luck. I also understand GO can be used to create new set of certs but my first concern is that the instructions provided in forwarder's documentation should work for me unless am making a mistake or there is a technical issue. |
I am still wondering why not giving the option to turn off SSL, all the solutions so far are not ok for your deployment, we are using Docker for our micro-services, and we would like each container (per service instance) will have a logstash-forwarder to forward the logs to a centralized logstash shipper (also in Docker container) in the same host, these Docker containers are using bridge mode (NAT), there is not easy way for us to generate SSL cert in my understanding, as the IP address is dynamic, Docker container itself is not in domain, hostname is dynamic as well (although we can fix it by specifying the hostname for the logstash-shipper container and linking it to the fowarder containers, but still is it a valid option here as we only have /etc/hosts covered but not under any domain?). I hate not having choices, it is like in China.... |
I was reading through the comments and what I see is that there is a need to update README file and manual on page in point that stands for genering certs - it is not mentioned there, that there is a need to set valid address in config file for ssl, where it should be mentioned and explained, what address (fqdn or num IP) should be used. So this is the first place, where the "bug" should get fixed. |
I've tried to resolve this issue by regenerating the cert and key every which way and I am still getting the handshake issue: Failed to tls handshake with x.x.x.x x509: cannot validate certificate for x.x.x.x because it doesn't contain any IP SANs I've tried the following open ssl commands: openssl req -config /etc/pki/tls/openssl.cnf -x509 -days 3650 -nodes -newkey rsa:2048 -keyout /etc/pki/tls/private/logstash-forwarder.key -out /etc/pki/tls/certs/logstash-forwarder.crt openssl req -x509 -nodes -newkey rsa:2048 -keyout logstash-forwarder.key -out logstash-forwarder.crt openssl req -subj '/CN=logstash.cloud.xxx.xxx.xxx/' -x509 -days 3650 -batch -nodes -newkey rsa:2048 -keyout private/logstash-forwarder.key -out certs/logstash-forwarder.crt openssl req -x509 -batch -nodes -newkey rsa:2048 -keyout /etc/pki/tls/logstash-forwarder.key -out /etc/pki/tls/logstash-forwarder.crt -subj /CN=logstash.cloud.xxx.xxx.xxx > /dev/null 2>&1; openssl x509 -text -in lumberjack.crt | grep CN When using the DNS CN option I have created an entry in /etc/hosts for the dns name pointing to the logstash server ip. I have also used the lc-tlscert utility for both DNS and IP with no success. Specify the Common Name for the certificate. The common name Common name: logstash.cloud.x.x.x.x The next step is to add any additional DNS names and IP DNS or IP address 1: x.x.x.x How long should the certificate be valid for? A year (365 Number of days: 365 The certificate can now be generated Successfully generated certificate Copy and paste the following into your Log Courier Copy and paste the following into your LogStash configuration, Any suggestions? |
@jdleehuit If you use the lc-tlscert method - can you verify the error message? It should be different - if lc-tlscert says it added IP SAN, then the error message shouldn't be because there is no IP SAN. Are you sure the message is not changing between your different tests? |
Also - when putting the hostname in /etc/hosts and connecting using the hostname it does not make sense that it would mention an IP address in the error message. Can you check again? |
@driskell Here's the error I get with the lc-tlscert method: 2015/07/08 17:13:58.821467 Connecting to [x.x.x.x]:5000 (logstash.cloud.x.x.x.x) |
@driskell It is working now! Silly error, restarted logstash server after recopying over key and crt and all is well. Thanks for your help! |
Creating SSL certificates is somewhat out of scope for this project. There are tools and documentation for doing this online in various places. My strongest recommendation is to avoid the difficulty of certificate Subject Alternatives (IP SAN, etc) and just use DNS so you can use a CN=hostname subject. The choice is up to you :) |
After hours i cant connect to my logstash server with logstash forwarding. I tried a lot of things. Now i have a certificate in server. Then i copy the certificate to the client side and i received error signed by unknown agent. ANY SOLUTION? The server is ubuntu 14.04 and the client is ubuntu 14.04 too. thanks |
I've been fighting with this ssl failed to handshake issue for a while now, but finally got it working. For me the key was what @jordansissel said earlier. Also, you only need the ssl_sa field pointing to the .crt in the logstash-forwarder config. Like so: logstash-forwarder.conf
logstash.conf
and this worked for generating the crt/key: openssl req -x509 -batch -nodes -newkey rsa:2048 -keyout lumberjack.key -out lumberjack.crt -subj /CN=dev.server.com |
If we set cluster as "servers": [ "server1:6782", "server2:6782" ], in logstash forwarder config file, how can I generate the certificate? Do I have to add domain name in the server hostname? |
lc-tlscert.go has worked perfectly for my Logstash deployment. However, it appears the certificates are created with SHA 1 hash instead of SHA 2. Is there any modification I can make to lc-tlscert so that the certificates I generate are SHA 2? Thanks! |
logstash and filebeat ssl configuration are a lot more strict than elasticsearch or kibana configuration. |
I saw the same error when using mysql client in golang:
and setting |
Helps self-signed certificate generation which since Go 1.3 is more complex elastic/logstash-forwarder#221
I've used the command from the README for generating a SSL certificate. I use the same cert on the server and on the forwarder. When starting the forwarder I get the following error:
So I see it is a problem with the cert and not the forwarder itself but maybe you can update the README.
The text was updated successfully, but these errors were encountered: