From 75cd722cc406f44dcd32be0d539b1c3721174bb8 Mon Sep 17 00:00:00 2001 From: Andrey Date: Thu, 22 Jan 2026 22:38:01 +0300 Subject: [PATCH] fix: update htpasswd generation for monitoring and status page - Modified the htpasswd command to limit the password length to 72 characters for security compliance. - Added a new task to generate an htpasswd hash specifically for the status page. - Updated the task that creates the htpasswd file to use the output from the new hash generation. --- infra/ansible/playbook.yml | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/infra/ansible/playbook.yml b/infra/ansible/playbook.yml index cd847b3..e8e417f 100644 --- a/infra/ansible/playbook.yml +++ b/infra/ansible/playbook.yml @@ -869,7 +869,7 @@ ignore_errors: yes - name: "[8/10] Сгенерировать htpasswd хеш для мониторинга" - command: htpasswd -nb admin "{{ status_page_password }}" + command: htpasswd -nb admin "{{ status_page_password[:72] }}" register: htpasswd_output changed_when: false - name: "[8/10] Создать файл паролей для мониторинга" @@ -929,11 +929,15 @@ - "{{ project_root }}/infra/nginx/ssl/cert.pem" - "{{ project_root }}/infra/nginx/ssl/key.pem" + - name: "[8/10] Сгенерировать htpasswd хеш для status page" + command: htpasswd -nb admin "{{ status_page_password[:72] }}" + register: status_page_htpasswd_output + changed_when: false + - name: "[8/10] Создать htpasswd файл для status page" - htpasswd: - path: "{{ project_root }}/infra/nginx/.htpasswd" - name: "admin" - password: "{{ status_page_password }}" + copy: + content: "{{ status_page_htpasswd_output.stdout }}" + dest: "{{ project_root }}/infra/nginx/.htpasswd" owner: root group: root mode: '0644'