diff --git a/core/dovecot/conf/ham.script b/core/dovecot/conf/ham.script index aa25cefb..910df8e4 100755 --- a/core/dovecot/conf/ham.script +++ b/core/dovecot/conf/ham.script @@ -1,5 +1,12 @@ #!/bin/bash -tee >(rspamc -h {{ ANTISPAM_WEBUI_ADDRESS }} -P mailu learn_ham /dev/stdin) \ - >(rspamc -h {{ ANTISPAM_WEBUI_ADDRESS }} -P mailu -f 11 fuzzy_del /dev/stdin) \ - | rspamc -h {{ ANTISPAM_WEBUI_ADDRESS }} -P mailu -f 13 fuzzy_add /dev/stdin +RSPAMD_HOST="$(getent hosts {{ ANTISPAM_WEBUI_ADDRESS }}|cut -d\ -f1)" +if [[ $? -ne 0 ]] +then + echo "Failed to lookup {{ ANTISPAM_WEBUI_ADDRESS }}" >&2 + exit 1 +fi + +tee >(rspamc -h $RSPAMD_HOST -P mailu learn_ham /dev/stdin) \ + >(rspamc -h $RSPAMD_HOST -P mailu -f 11 fuzzy_del /dev/stdin) \ + | rspamc -h $RSPAMD_HOST -P mailu -f 13 fuzzy_add /dev/stdin diff --git a/core/dovecot/conf/spam.script b/core/dovecot/conf/spam.script index 05a3832d..e7d20427 100755 --- a/core/dovecot/conf/spam.script +++ b/core/dovecot/conf/spam.script @@ -1,5 +1,13 @@ #!/bin/bash -tee >(rspamc -h {{ ANTISPAM_WEBUI_ADDRESS }} -P mailu learn_spam /dev/stdin) \ - >(rspamc -h {{ ANTISPAM_WEBUI_ADDRESS }} -P mailu -f 13 fuzzy_del /dev/stdin) \ - | rspamc -h {{ ANTISPAM_WEBUI_ADDRESS }} -P mailu -f 11 fuzzy_add /dev/stdin +RSPAMD_HOST="$(getent hosts {{ ANTISPAM_WEBUI_ADDRESS }}|cut -d\ -f1)" +if [[ $? -ne 0 ]] +then + echo "Failed to lookup {{ ANTISPAM_WEBUI_ADDRESS }}" >&2 + exit 1 +fi + + +tee >(rspamc -h $RSPAMD_HOST -P mailu learn_spam /dev/stdin) \ + >(rspamc -h $RSPAMD_HOST -P mailu -f 13 fuzzy_del /dev/stdin) \ + | rspamc -h $RSPAMD_HOST -P mailu -f 11 fuzzy_add /dev/stdin