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

Security: prevent malicious post indexing #10

Closed
AaronHolbrook opened this issue Jun 10, 2014 · 6 comments
Closed

Security: prevent malicious post indexing #10

AaronHolbrook opened this issue Jun 10, 2014 · 6 comments

Comments

@AaronHolbrook
Copy link
Contributor

Via server side - but still an important thing to figure out is how we're limiting and controlling access to the Elasticsearch server. Currently we are proxy pass limiting access to POST - this does not prevent users from maliciously indexing data

@tlovett1
Copy link
Member

This looks pretty interesting. We could add optional support for this plugin: https://github.com/sonian/elasticsearch-jetty

@AaronHolbrook
Copy link
Contributor Author

I believe this is more of an educational and documentational thing, as this will require stricter configuration of the nginx directives on the server.

Leaving open for now until I write the documentation surrounding this.

Open to thoughts or suggestions on how to better improve security surrounding this @tlovett1 @TheLastCicada @zamoose.

@AaronHolbrook
Copy link
Contributor Author

@AaronHolbrook AaronHolbrook modified the milestones: Someday, Version 1.0 Sep 24, 2014
@AaronHolbrook
Copy link
Contributor Author

Run through internal script in plugin before sending on to ES.

@AaronHolbrook
Copy link
Contributor Author

Good news on this front, after a fantastic post by the Elasticsearch team (post here) where they discuss good ways to incorporate NGINX usage into the HTTP stack with Elasticsearch, @TheLastCicada and I were able to come up with a directive that should help lock down any usage that is using a specific API endpoint (i.e. _suggest or _search).

# Elasticsearch endpoint
location /es-search {

  # only allow things to hit the _autosuggest API
  # change the `_endpoint` to be whatever you'd like to restrict usage to
  location ~* (.*)_suggest$ {

    # only allow POST requests
    limit_except POST {
      deny all;
    }

    # Perform our request
    rewrite ^/es-search(.*) $1 break;
    proxy_set_header Host $host;
    proxy_pass http://192.168.50.4:9200;
  }

  return 403;
}

@tlovett1
Copy link
Member

Awesome article. You could even use Basic HTTP Auth to lock down that endpoint even further.

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

No branches or pull requests

3 participants