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

Filtering the webserver information in the nginx default error responses #2539

Merged
merged 1 commit into from
Jun 22, 2021

Conversation

jashaik
Copy link
Contributor

@jashaik jashaik commented Jun 16, 2021

Signed-off-by: jan shahid shaik jashaik@progress.com

Description

The internal server software used by the chef-server is revealed by the web server(nginx/openresty) in the default error reponses.

Issues Resolved

https://app.zenhub.com/workspaces/chef-infra-server-team-5fc64867d45ca500173dbbc7/issues/chef/customer-bugs/373

Solved -

  • openresty version/openresty server info in all the success/opscode-erchef generated responses - Solved by 'server_tokens off;' nginx tag
  • openresty verison info in all the default nginx error responses - Solved by 'server_tokens off;' nginx tag
  • openresty server name in the default nginx error reponses - solved by the 'body_filter_by_lua' directive(PR Filtering the webserver information in the nginx default error responses #2539 ).

Check List

@jashaik jashaik requested review from a team as code owners June 16, 2021 11:33
@netlify
Copy link

netlify bot commented Jun 16, 2021

👷 Deploy Preview for chef-server processing.

🔨 Explore the source changes: c9582a7

🔍 Inspect the deploy log: https://app.netlify.com/sites/chef-server/deploys/60d2355e7d891a0007965db0

@jashaik jashaik force-pushed the shahid/nginx-security-issue branch from e58984a to 074276a Compare June 16, 2021 11:44
@jashaik jashaik changed the title Filtering the webserver information in the nginx default error responses WIP - Filtering the webserver information in the nginx default error responses Jun 16, 2021
@jashaik jashaik force-pushed the shahid/nginx-security-issue branch 2 times, most recently from 729249d to 8f25de0 Compare June 17, 2021 06:46
@jashaik jashaik changed the title WIP - Filtering the webserver information in the nginx default error responses Filtering the webserver information in the nginx default error responses Jun 17, 2021
@PrajaktaPurohit
Copy link
Contributor

PrajaktaPurohit commented Jun 21, 2021

current output

root@api:~# curl -i -X TRACE -k https://api.chef-server.dev/_status
HTTP/1.1 301 Moved Permanently
Date: Mon, 21 Jun 2021 19:00:53 GMT
Content-Type: text/html
Transfer-Encoding: chunked
Connection: close
Location: https://api.chef-server.dev/_status

<html>
<head><title>301 Moved Permanently</title></head>
<body>
<center><h1>301 Moved Permanently</h1></center>
<hr><center>chef</center>
</body>
</html>

with empty replace string

root@api:~# curl -i -X TRACE -k http://api.chef-server.dev/_status
HTTP/1.1 301 Moved Permanently
Date: Mon, 21 Jun 2021 19:00:59 GMT
Content-Type: text/html
Transfer-Encoding: chunked
Connection: close
Location: https://api.chef-server.dev/_status

<html>
<head><title>301 Moved Permanently</title></head>
<body>
<center><h1>301 Moved Permanently</h1></center>
<hr><center></center>
</body>
</html>

Copy link
Contributor

@PrajaktaPurohit PrajaktaPurohit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nicely done! Left some suggestions. https://github.com/chef/chef-server/blob/master/oc-chef-pedant/spec/api/header_spec.rb might be a good place to add some tests for this.

@jashaik jashaik force-pushed the shahid/nginx-security-issue branch 6 times, most recently from a420357 to 64413e2 Compare June 22, 2021 17:18
@jashaik jashaik force-pushed the shahid/nginx-security-issue branch 2 times, most recently from b78333b to bfae3dc Compare June 22, 2021 18:04
Signed-off-by: jan shahid shaik <jashaik@progress.com>
@PrajaktaPurohit PrajaktaPurohit merged commit 4a8743d into master Jun 22, 2021
@PrajaktaPurohit PrajaktaPurohit deleted the shahid/nginx-security-issue branch June 22, 2021 19:11
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

Successfully merging this pull request may close these issues.

3 participants