-
Notifications
You must be signed in to change notification settings - Fork 66
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
Access control for browsers stops working when basic auth is enabled #83
Comments
adding Rack::Cors middleware to the Rack::Builder.new seems to be on the right track although I don't have time to investigate more |
CORS should definitely be handled by this plugin properly because this results in two events |
Any update on this? Also experiencing this issue with logstash 6.2.4 |
@pkoretic @ryan-dyer-sp I'd also like to know what the status is here. At the moment, it means that the http input plugin is useless for consuming events from webapps. Cc'ing @yaauie @jsvd who were the most recent contributors to this plugin, maybe they can shed light on the subject? I don't know the codebase well enough to chip in usefully, but I do have a budget to fund professional services if anyone can fix the issue. |
As for the issue mentioned here you can just skip empty events with filter plugin or even better, just check if message field is valid in output - don't have exact line here anymore but something like https://discuss.elastic.co/t/conditional-for-empty-string-in-field/77182/5. However, we decided to develop our own HTTP/2 input directly for elasticsearch using vanilla Node.js that replaces HTTP+logstash which gave us all we wanted and 3x better throughout. No matter how we tried with this plugin it was too slow, used too much CPU and had issues like mentioned here. I think that writing a new logstash HTTP/2 input from scratch would be the best direction and I wish we could contribute that but that was outside of our possibilities. The elastic stack obviously supports custom development since Elasticsearch has REST api and both logstash and beats are using that so I think that is always a valid approach. |
@pkoretic Perhaps I've missed the point - if OPTIONS fails with 401, Angular doesn't go ahead with the next request. Not sure what that has to do with empty events - I'd like to get as far as an event! ;) |
@antgel ah, then you are here https://discuss.elastic.co/t/post-data-to-logstash-using-http-input/69166/7 :) well actually, I wrote instructions in this post, so yes, probably didn't work in the end, which was another reason we did our own input |
@pkoretic It's not the same issue, the issue I face is that the browser sends OPTIONS without an Authorization: header, as expected, and logstash doesn't cope with that when basic auth is configured. Have I missed something? |
That is the issue that is reported here. It's not angular related since that is just a html framework. You can easily see the logic for this here: https://github.com/logstash-plugins/logstash-input-http/blob/master/lib/logstash/inputs/http.rb You could also then implement some other auth logic like JWT or whichever you may already have for better security. |
Unfortunately I don't have time to fork or dive into the logstash code. I'm currently testing nginx as a proxy in front of logstash. It offers far greater control over the incoming HTTP connection, and then the connection between nginx and logstash can be internal and trusted. I'll know in the next few days if it works well or not. |
Yes, also valid approach, that will work for sure. |
For what it's worth, my workaround for this is passing an 'auth_token' field in the request header with the value set to a token. The request header is checked in a filter and compared against the expected value. If it doesn't match the log is dropped. |
This bug is still relevant.. |
Yes, this issue is still relevant. For preflight, browsers use the OPTIONS method without additional headers (like auth) or body. How about adding a preflight flag to skip basic auth for the OPTIONS method? After responding to the I am willing to help coding if the team agrees with the proposed solution. |
Logstash config file
This works as expected in non browser environment while in browser when POST request is made (
xhr.open("POST", "http://localhost:38080", true, "some", "one")
) this results in (Chrome 65.0.3325.181)Removing
user
/password
fields this works as expected. No difference with other options likeAccess-Control-Allow-Methods
. It just seems to me like this is handled by plugin internally because this is what I see in wireshark:This should return response_headers so that client can authenticate. I found same working example here, although this also uses ssl which I haven't tried yet (and only curl is used so I can't say if browsers are working):
https://discuss.elastic.co/t/http-input-with-ssl/115338
The text was updated successfully, but these errors were encountered: