-
Notifications
You must be signed in to change notification settings - Fork 113
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
Hiding nginx from the response header #4397
Conversation
Signed-off-by: Lance Finfrock <lfinfrock@chef.io>
Deploy preview for chef-automate processing. Building with commit fd7536d https://app.netlify.com/sites/chef-automate/deploys/5f862e5e4577b80007c6ff66 |
Signed-off-by: Lance Finfrock <lfinfrock@chef.io>
Added the headers-more-nginx-module to the nginx build. Also add the line 'more_set_headers 'server: ' that removes the server nginx field from the response. Signed-off-by: Lance Finfrock <lfinfrock@chef.io>
5985966
to
fd7536d
Compare
@@ -0,0 +1,89 @@ | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This file is needed in the nginx.conf file
@@ -106,6 +106,8 @@ http { | |||
|
|||
{{#each cfg.frontend_tls as |tls| ~}} | |||
server { | |||
more_set_headers 'server: '; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This removes the server line from the response.
@@ -5,4 +5,4 @@ exec 2>&1 | |||
|
|||
source {{pkg.svc_config_path}}/render-certs.sh | |||
|
|||
exec {{pkgPathFor "core/nginx"}}/bin/nginx -c {{pkg.svc_config_path}}/nginx.conf | |||
exec nginx -c {{pkg.svc_config_path}}/nginx.conf |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nginx is in the path now.
--with-http_slice_module \ | ||
--with-cc-opt="${CFLAGS}" \ | ||
--with-ld-opt="${LDFLAGS}" \ | ||
--add-module=${HAB_CACHE_SRC_PATH}/headers-more-nginx-module-${headers_more_version} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding the headers-more module
pkg_origin=chef | ||
pkg_version="0.1.0" | ||
pkg_description="internal and external load balancer and reverse proxy for Automate 2.0" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Most of the changes here were copied from here https://github.com/chef-base-plans/nginx/blob/master/plan.sh
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! I think it would be worth adding the more headers module upstream in core plans and then using that package like we did before but let’s go with this for now.
🔩 Description: What code changed, and why?
Nginx should not be exposed in the response header for automate-ui requests.
This change is building Nginx with the headers-more module. This module allows removing the server field from the response.
⛓️ Related Resources
#4403
👟 How to Build and Test the Change
start_all_services
rebuild components/automate-load-balancer/
✅ Checklist
📷 Screenshots, if applicable