Skip to content

Commit 5dfa64e

Browse files
committed
Ensure compatibility with Debian 13
1 parent 293a916 commit 5dfa64e

2 files changed

Lines changed: 12 additions & 0 deletions

File tree

playbooks/templates/nginx.conf.j2

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@
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) %}
910
server_tokens off;
11+
{% endif %}
1012

1113
# Configure the rate limiting module to prevent DDoS attacks.
1214
limit_req_zone $binary_remote_addr zone=limited:10m rate=10r/s;

roles/nginx/configure/tasks/main.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,16 @@
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 }}"

0 commit comments

Comments
 (0)