-
Notifications
You must be signed in to change notification settings - Fork 29
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
Support either changing the Server header or removing it from responses #274
Comments
you mean |
Yep, I don't see that as I have server_tokens off; in my config! server_tokens off; server_tokens on; (default) But in this case the compiled nginx binary would be for example:
So the variable NGINX_VER would return "nginx-proxy-manager/1.23.4 (nginx-quic)" The static chars can be found in the source file for nginx: /src/nginx/src/http/ngx_http_header_filter_module.c |
So there is a few places it is referenced. This first one can probably be left alone #define NGINX_VERSION "1.25.0"
#define NGINX_VER "nginx/" NGINX_VERSION /src/http/ngx_http_header_filter_module.c static u_char ngx_http_server_string[] = "Server: nginx" CRLF;
static u_char ngx_http_server_full_string[] = "Server: " NGINX_VER CRLF;
static u_char ngx_http_server_build_string[] = "Server: " NGINX_VER_BUILD CRLF;` /src/http/v2/ngx_http_v2_filter_module.c if (r->headers_out.server == NULL) {
if (clcf->server_tokens == NGX_HTTP_SERVER_TOKENS_ON) {
len += 1 + nginx_ver_len;
} else if (clcf->server_tokens == NGX_HTTP_SERVER_TOKENS_BUILD) {
len += 1 + nginx_ver_build_len;
} else {
len += 1 + sizeof(nginx);
}
} /src/http/ngx_http_special_response.c: static u_char ngx_http_error_full_tail[] =
"<hr><center>" NGINX_VER "</center>" CRLF
"</body>" CRLF
"</html>" CRLF
;
static u_char ngx_http_error_build_tail[] =
"<hr><center>" NGINX_VER_BUILD "</center>" CRLF
"</body>" CRLF
"</html>" CRLF
;
static u_char ngx_http_error_tail[] =
"<hr><center>nginx</center>" CRLF
"</body>" CRLF
"</html>" CRLF
; |
currently, I change nginx to the nginx-proxy-manager: |
I think removing is not possible and the build would fail than? |
and the option of changing the header by the user is impossible, since the values are set while building... |
Not sure there would be enough demand for something like this from the general userbase to warrant two builds hmm, wondering if I should just use a modified Dockerfile, need to think about this one more, don't see an easy way to make it a simple enabled/disabled flag |
could you please try this: https://github.com/GetPageSpeed/ngx_security_headers#hide_server_tokens (this module is built in) |
for me it worked |
That definitely hides it from the headers so one step closer!! |
The thing is... Even if I remove the server name from the error pages, the design of them is still unique and they could be identified... |
But I can add |
or add an env option for this |
Yes I agree, the error page is unique enough to identify it as nginx at the very least. |
Could replace the error page with the Apache one to troll haha, watch attackers try Apache exploits on your server! Waste their time! |
This would reuqire to change https://hg.nginx.org/nginx/file/tip/src/http/ngx_http_special_response.c, even if it would be possible, it could to easily break |
done in latest comment, sorry, but I wont change the error pages |
will be pushed to latest, if modsec is finally done and I get darkmode fixed |
I was joking about the Apache one 😆 Thank you |
will keep this open until then |
I've pushed this now to latest. |
When connecting to any servers, in the HTTP response headers you will see this:
Server: nginx-proxy-manager
This gives potential attackers more information that they deserve!
When compiling nginx you can customise the server string in /src/nginx/src/http/ngx_http_header_filter_module.c
The text was updated successfully, but these errors were encountered: