commit 3efb29842a4509cbeae6ee49d3404a3772666adb
parent 650bf0cd58c05853e0d39ca90db21ec15c31da65
Author: Petar Yotsev <petar@yotsev.xyz>
Date: Tue, 14 Dec 2021 12:35:06 +0000
Fix utils
Diffstat:
3 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/files/madduser b/files/madduser
@@ -30,6 +30,7 @@ echo -n "Password: "
stty -echo
read password
stty echo
+echo
record="$(smtpctl encrypt "$password")"
record="$user@$domain:$record:vmail:2000:2000:/var/vmail/$domain/$user::userdb_mail=maildir:/var/vmail/$domain/$user"
diff --git a/files/mdeluser b/files/mdeluser
@@ -16,12 +16,12 @@ if [ -z "$(grep "$domain" /etc/mail/domains 2> /dev/null)" ]; then
return 1
fi
-if [ -z "$(grep "^^$user@$domain" /etc/mail/credentials 2> /dev/null)" ]; then
+if [ -z "$(grep "^$user@$domain" /etc/mail/credentials 2> /dev/null)" ]; then
echo "Error: User doesn't exist in /etc/mail/credentials"
return 1
fi
-if [ -z "$(grep "$user@$domain" /etc/mail/virtuals 2> /dev/null)" ]; then
+if [ -z "$(grep "^$user@$domain" /etc/mail/virtuals 2> /dev/null)" ]; then
echo "Error: User doesn't exist in /etc/mail/virtuals"
return 1
fi
diff --git a/files/mpasswd b/files/mpasswd
@@ -30,9 +30,10 @@ echo -n "Password: "
stty -echo
read password
stty echo
+echo
record="$(smtpctl encrypt "$password")"
record="$user@$domain:$record:vmail:2000:2000:/var/vmail/$domain/$user::userdb_mail=maildir:/var/vmail/$domain/$user"
-sed "s#^$user@$domain.*#$record#g" > temp-cred-file
+sed "s#^$user@$domain.*#$record#g" /etc/mail/credentials > temp-cred-file
mv temp-cred-file /etc/mail/credentials