Просмотр исходного кода

Merge pull request #360 from thePurpyel/fix/adddomain.sh

Fix bash-only syntax and fix missing login_maps.pcre entry in adddomain.sh
master
Luke Smith 5 дней назад
committed by GitHub
Родитель
Сommit
aefc7a88f9
Не найден GPG ключ соответствующий данной подписи Идентификатор GPG ключа: B5690EEEBB952194
1 измененных файлов: 7 добавлений и 4 удалений
  1. +7
    -4
      adddomain.sh

+ 7
- 4
adddomain.sh Просмотреть файл

@@ -3,10 +3,12 @@
domain="$1"

# Input validation to allow only valid domain characters
if ! [[ "$domain" =~ ^[a-zA-Z0-9.-]+$ ]]; then
echo "Give a valid domain as an argument to add mail server for it. Only alphanumeric characters, dashes, and dots are allowed."
exit 1
fi
case "$domain" in
""|*[!a-zA-Z0-9.-]*)
echo "Give a valid domain as an argument to add mail server for it. Only alphanumeric characters, dashes, and dots are allowed."
exit 1
;;
esac

subdom="mail"
maildomain="mail.$(cat /etc/mailname)"
@@ -24,6 +26,7 @@ chmod -R g+r /etc/postfix/dkim/*
# Add entries to keytable and signing table
echo "$subdom._domainkey.$domain $domain:$subdom:/etc/postfix/dkim/$domain/$subdom.private" >> /etc/postfix/dkim/keytable
echo "*@$domain $subdom._domainkey.$domain" >> /etc/postfix/dkim/signingtable
echo "/^(.*)@$(echo "$domain" | sed 's/\./\\./')\$/ \${1}" >> /etc/postfix/login_maps.pcre

systemctl reload opendkim postfix



Загрузка…
Отмена
Сохранить