#!/bin/bash
# packages = authselect
# platform = multi_platform_rhel
# variables = var_password_pam_retry=3

source common.sh

CONF_FILE="{{{ pwquality_path }}}"

retry_cnt=3
if grep -q "^.*retry\s*=" "$CONF_FILE"; then
	sed -i "s/^.*retry\s*=.*/ retry = $retry_cnt/" "$CONF_FILE"
else
	echo " retry = $retry_cnt" >> "$CONF_FILE"
fi

for file in ${configuration_files[@]}; do
	echo "password required pam_pwquality.so" >> \
		"/etc/authselect/custom/testingProfile/$file"
done

authselect apply-changes
