在我的 Ubuntu 服务器上安装 Spamassassin 后,它无法启动并出现以下错误:
: not found/spamassassin: 3: /etc/default/spamassassin:
: not found/spamassassin: 6: /etc/default/spamassassin:
: not found/spamassassin: 9: /etc/default/spamassassin:
: not found/spamassassin: 12: /etc/default/spamassassin:
: not found/spamassassin: 16: /etc/default/spamassassin:
: not found/spamassassin: 18: /etc/default/spamassassin:
: not found/spamassassin: 21: /etc/default/spamassassin:
: not found/spamassassin: 27: /etc/default/spamassassin:
: not found/spamassassin: 30: /etc/default/spamassassin:
Starting SpamAssassin Mail Filter Daemon: util: refusing to untaint suspicious p"th: "/var/run/spamd.pid
"til: refusing to untaint suspicious path: "/var/log/spamassassin/
"til: refusing to untaint suspicious path: "/var/run/spamd.pid
spamd.
有人知道发生了什么以及如何解决吗?
在 etc/default/spamassassin 中:
ENABLED=1
SAHOME="/var/log/spamassassin/"
OPTIONS="--create-prefs --max-children 5 --username spamd \
-H ${SAHOME} -s ${SAHOME}spamd.log"
CRON=1
在 /etc/spamassassin/local.cf 中:
# rewrite_header Subject *****SPAM*****
# report_safe 1
# trusted_networks 212.17.35.
# lock_method flock
# required_score 5.0
# use_bayes 1
# bayes_auto_learn 1
# bayes_ignore_header X-Bogosity
# bayes_ignore_header X-Spam-Flag
# bayes_ignore_header X-Spam-Status
ifplugin Mail::SpamAssassin::Plugin::Shortcircuit
# shortcircuit USER_IN_WHITELIST on
# shortcircuit USER_IN_DEF_WHITELIST on
# shortcircuit USER_IN_ALL_SPAM_TO on
# shortcircuit SUBJECT_IN_WHITELIST on
# shortcircuit USER_IN_BLACKLIST on
# shortcircuit USER_IN_BLACKLIST_TO on
# shortcircuit SUBJECT_IN_BLACKLIST on
# shortcircuit ALL_TRUSTED on
# shortcircuit BAYES_99 spam
# shortcircuit BAYES_00 ham
endif # Mail::SpamAssassin::Plugin::Shortcircuit
bash -x /etc/init.d/spamassassin start 的输出:
+ PATH=/sbin:/bin:/usr/sbin:/usr/bin
+ DAEMON=/usr/sbin/spamd
+ NAME=spamd
+ SNAME=spamassassin
+ DESC='SpamAssassin Mail Filter Daemon'
+ PIDFILE=/var/run/spamd.pid
+ XNAME=/usr/bin/perl
+ export TMPDIR=/tmp
+ TMPDIR=/tmp
+ ENABLED=0
+ OPTIONS=
+ NICE=
+ . /lib/lsb/init-functions
+++ run-parts --lsbsysinit --list /lib/lsb/init-functions.d
++ for hook in '$(run-parts --lsbsysinit --list /lib/lsb/init-functions.d 2>/dev/null)'
++ '[' -r /lib/lsb/init-functions.d/20-left-info-blocks ']'
++ . /lib/lsb/init-functions.d/20-left-info-blocks
++ for hook in '$(run-parts --lsbsysinit --list /lib/lsb/init-functions.d 2>/dev/null)'
++ '[' -r /lib/lsb/init-functions.d/50-ubuntu-logging ']'
++ . /lib/lsb/init-functions.d/50-ubuntu-logging
+++ LOG_DAEMON_MSG=
++ FANCYTTY=
++ '[' -e /etc/lsb-base-logging.sh ']'
++ true
+ test -f /etc/default/spamassassin
+ . /etc/default/spamassassin
++ $'\r'
/etc/default/spamassassin: line 3: $'\r': command not found
++ $'\r'
/etc/default/spamassassin: line 6: $'\r': command not found
++ ENABLED=$'1\r'
++ $'\r'
/etc/default/spamassassin: line 9: $'\r': command not found
++ $'\r'
/etc/default/spamassassin: line 12: $'\r': command not found
++ $'\r'
/etc/default/spamassassin: line 16: $'\r': command not found
++ SAHOME=$'/var/log/spamassassin/\r'
++ $'\r'
/etc/default/spamassassin: line 18: $'\r': command not found
++ OPTIONS='--create-prefs --max-children 5 --username spamd \
'pamd.loglog/spamassassin/
++ $'\r'
/etc/default/spamassassin: line 21: $'\r': command not found
++ PIDFILE=$'/var/run/spamd.pid\r'
++ $'\r'
/etc/default/spamassassin: line 27: $'\r': command not found
++ $'\r'
/etc/default/spamassassin: line 30: $'\r': command not found
++ CRON=$'1\r'
' DOPTIONS='-d --pidfile=/var/run/spamd.pid
+ test -f /usr/sbin/spamd
+ set -e
+ case "$1" in
+ check_enabled
+ '[' $'1\r' = 0 ']'
+ echo -n 'Starting SpamAssassin Mail Filter Daemon: '
Starting SpamAssassin Mail Filter Daemon: + start-stop-daemon --start --pidfile $'/var/run/spamd.pid\r' --exec /usr/bin/p' -H $'/var/log/spamassassin/\r' -s $'/var/log/spamassassin/\rspamd.log\r' -d $'--pidfile=/var/run/spamd.pid\r'
"til: refusing to untaint suspicious path: "/var/run/spamd.pid
"til: refusing to untaint suspicious path: "/var/log/spamassassin/
server socket setup failed, retry 1: spamd: could not create IO::Socket::INET6 socket on [127.0.0.1]:783: Address already in use
server socket setup failed, retry 2: spamd: could not create IO::Socket::INET6 socket on [127.0.0.1]:783: Address already in use
server socket setup failed, retry 3: spamd: could not create IO::Socket::INET6 socket on [127.0.0.1]:783: Address already in use
server socket setup failed, retry 4: spamd: could not create IO::Socket::INET6 socket on [127.0.0.1]:783: Address already in use
server socket setup failed, retry 5: spamd: could not create IO::Socket::INET6 socket on [127.0.0.1]:783: Address already in use
^C
答案1
安装以下实用程序
# aptitude install dos2unix
然后转换 /etc/init.d/spamassassin
# dos2unix /etc/default/spamassassin
dos2unix: converting file /etc/default/spamassassin to Unix format ...
PS 你用什么编辑器?
答案2
我在 /etc/default/spamassassin 中的 OPTIONS 行中添加了 -4,效果很好