From 0aea79c6fb55a7ef1c1683daa22b9fe8c00defcb Mon Sep 17 00:00:00 2001 From: Christoph Date: Tue, 15 Feb 2022 16:47:10 +0100 Subject: [PATCH] update.. --- roles/common/tasks/nis-install-server.yml | 42 +++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/roles/common/tasks/nis-install-server.yml b/roles/common/tasks/nis-install-server.yml index b86cf2a..ecfca9b 100644 --- a/roles/common/tasks/nis-install-server.yml +++ b/roles/common/tasks/nis-install-server.yml @@ -37,6 +37,48 @@ - nis-install-client +# --- +# Since Debian 11 (bullseye) password hashing uses 'yescrypt' by default. +# +# Note: +# 'yescrypt' is not supported by Debian 10 (buster) nor by Ubuntu 18.04 and smaller +# +# --- + +- name: (nis-install-server.yml) Check if file '/etc/pam.d/common-password' exists + stat: + path: /etc/pam.d/common-password + register: file_etc_pam_d_common_password + tags: + - nis-install + - nis-install-server + when: + - ansible_facts['distribution'] == "Debian" + - ansible_facts['distribution_major_version']|int >= 11 + +- name: (nis-install-server.yml) Check if default hash for password is 'yescrypt' + shell: "grep -i -q -E '^password.+yescrypt' /etc/pam.d/common-password" + register: presence_of_passwprd_hashing_yescrypt + changed_when: + - presence_of_passwprd_hashing_yescrypt.rc < 1 + failed_when: + - presence_of_passwprd_hashing_yescrypt.rc >= 2 + when: + - ansible_facts['distribution'] == "Debian" + - ansible_distribution_major_version|int >= 11 + - ansible_distribution_major_version|int <= 12 + - file_etc_pam_d_common_password.stat.exists == True + +- name: (nis-install-server.yml) Change default password hash for local system accounts from SHA-512 to yescrypt + shell: perl -i -n -p -e "s/^(password.+)yescrypt/\1sha512/" /etc/pam.d/common-password + when: + - ansible_facts['distribution'] == "Debian" + - ansible_facts['distribution_major_version']|int >= 11 + - ansible_facts['distribution_major_version']|int <= 12 + - file_etc_pam_d_common_password.stat.exists == True + - presence_of_passwprd_hashing_yescrypt is changed + + # --- # /etc/default/nis # ---