File tree Expand file tree Collapse file tree
roles/nginx/configure/tasks Expand file tree Collapse file tree Original file line number Diff line number Diff line change 66# vulnerabilities or exploits that are present in specific versions.
77# Disabling server_tokens can help to mitigate this risk by removing the NGINX
88# version number from the response headers.
9+ {% if not nginx_conf_has_server_tokens | default (false ) %}
910server_tokens off;
11+ {% endif %}
1012
1113# Configure the rate limiting module to prevent DDoS attacks.
1214limit_req_zone $binary_remote_addr zone=limited:10m rate=10r/s;
Original file line number Diff line number Diff line change 77 state : absent
88 path : /etc/nginx/sites-enabled/default
99
10+ - name : Check if server_tokens is already configured
11+ ansible.builtin.command : grep -E "^\s*server_tokens" /etc/nginx/nginx.conf
12+ register : nginx_server_tokens_directive
13+ failed_when : false
14+ changed_when : false
15+
16+ - name : Share server_tokens configuration state
17+ ansible.builtin.set_fact :
18+ nginx_conf_has_server_tokens : " {{ nginx_server_tokens_directive.rc == 0 }}"
19+
1020 - name : Setup NGINX conf
1121 ansible.builtin.template :
1222 src : " {{ ota_nginx_config_template }}"
You can’t perform that action at this time.
0 commit comments