From dd758254b3c3bf6c58e4a7eddd5d5d524de7fece Mon Sep 17 00:00:00 2001 From: Christoph Date: Tue, 28 Feb 2017 15:14:40 +0100 Subject: [PATCH] Avoid sign '$' in genereted passwords --- postfix_add_mailboxes.sh | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/postfix_add_mailboxes.sh b/postfix_add_mailboxes.sh index 1c50e71..d8fcbab 100755 --- a/postfix_add_mailboxes.sh +++ b/postfix_add_mailboxes.sh @@ -181,13 +181,12 @@ while read email passwd ; do ## - if [[ -z "$passwd" ]]; then if [[ -z "$_passwd" ]]; then - passwd=`tr -cd '[:alnum:]\!@#$%' < /dev/urandom | fold -w10 | head -n1` password_accepted=false while ! $password_accepted ; do - passwd=`tr -cd '[:alnum:]\!@#$%' < /dev/urandom | fold -w10 | head -n1` - regex="[\!@#$%_]" + passwd=`tr -cd '[:alnum:]#_\!\%/=@-' < /dev/urandom | tr '0' 'O' | fold -w10 | head -n1` + regex="[#_\!\%/=@-]" [[ $passwd =~ $regex ]] || continue - regex="[0123456789].*[0123456789]" + regex="[123456789].*[123456789]" [[ $passwd =~ $regex ]] || continue password_accepted=true done