微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

ubuntu-14.04 – opendkim配置未正确加载

当从Ubuntu 12.04移动到14.04时,opendkim不再以我之前使用的相同配置启动.我在/ etc / default / opendkim中的任何项目在启动时都显示为“未找到”.
/etc/init.d/opendkim: 6: /etc/default/opendkim: Syslog: not found
/etc/init.d/opendkim: 9: /etc/default/opendkim: UMask: not found
/etc/init.d/opendkim: 13: /etc/default/opendkim: Domain: not found
/etc/init.d/opendkim: 14: /etc/default/opendkim: KeyFile: not found
/etc/init.d/opendkim: 15: /etc/default/opendkim: Selector: not found
/etc/init.d/opendkim: 28: /etc/default/opendkim: OversignHeaders: not found

我无法在互联网中的任何地方找到这个问题,它确实没有多大意义.为什么“Syslog yes”会抛出错误?那是非常标准的东西.

对于masegaloeh,opendkim:OpenDKIM Filter v2.9.1

等/认/ opendkim:

Syslog                  yes
UMask                   002
Domain                  mydomain.com
KeyFile                 /etc/mail/dkim.key
Selector                postfix
OversignHeaders         From

/etc/init.d/opendkim:

PATH=/sbin:/bin:/usr/sbin:/usr/bin
DAEMON=/usr/sbin/opendkim
NAME=opendkim
DESC="OpenDKIM"
RUNDIR=/var/run/$NAME
USER=opendkim
GROUP=opendkim
SOCKET=local:$RUNDIR/$NAME.sock
PIDFILE=$RUNDIR/$NAME.pid

# How long to wait for the process to die on stop/restart
stoptimeout=5

test -x $DAEMON || exit 0

# Include LSB provided init functions
. /lib/lsb/init-functions

# Include opendkim defaults if available
if [ -f /etc/default/opendkim ] ; then
        . /etc/default/opendkim
fi

if [ -f /etc/opendkim.conf ]; then
        CONfig_SOCKET=`awk '$1 == "Socket" { print $2 }' /etc/opendkim.conf`
fi

# This can be set via Socket option in config file,so it's not required
if [ -n "$SOCKET" -a -z "$CONfig_SOCKET" ]; then
        DAEMON_OPTS="-p $SOCKET $DAEMON_OPTS"
fi

DAEMON_OPTS="-x /etc/opendkim.conf -u $USER -P $PIDFILE $DAEMON_OPTS"

start() {
        # Create the run directory if it doesn't exist
        if [ ! -d "$RUNDIR" ]; then
                install -o "$USER" -g "$GROUP" -m 755 -d "$RUNDIR" || return 2
                [ -x /sbin/restorecon ] && /sbin/restorecon "$RUNDIR"
        fi
        # Clean up stale sockets
        if [ -f "$PIDFILE" ]; then
                pid=`cat $PIDFILE`
                if ! ps -C "$DAEMON" -s "$pid" >/dev/null; then
                        rm "$PIDFILE"
                        TMPSOCKET=""
                        if [ -n "$SOCKET" ]; then
                                TMPSOCKET="$SOCKET"
                        elif [ -n "$CONfig_SOCKET" ]; then
                                TMPSOCKET="$CONfig_SOCKET"
                        fi
                        if [ -n "$TMPSOCKET" ]; then
                                # UNIX sockets may be specified with or without the
                                # local: prefix; handle both
                                t=`echo $SOCKET | cut -d: -f1`
                                s=`echo $SOCKET | cut -d: -f2`
                                if [ -e "$s" -a -S "$s" ]; then
                                        if [ "$t" = "$s" -o "$t" = "local" ]; then
                                                rm "$s"
                                        fi
                                fi
                        fi
                fi
        fi
        start-stop-daemon --start --quiet --pidfile "$PIDFILE" --exec "$DAEMON" --test -- $DAEMON_OPTS || return 1
        start-stop-daemon --start --quiet --pidfile "$PIDFILE" --exec "$DAEMON" -- $DAEMON_OPTS || return 2
        # Detect exit status 78 (configuration error)
        ret=$?
        if [ $ret -eq 78 ]; then
                echo "See /usr/share/doc/opendkim/README.Debian for help"
                echo "Starting for DKIM verification only"
                DAEMON_OPTS="-b v $DAEMON_OPTS"
                start-stop-daemon --start --quiet --pidfile "$PIDFILE" --exec "$DAEMON" -- $DAEMON_OPTS
                exit 0
        elif [ $ret -ne 0 ]; then
                exit $ret
        fi
}

stop() {
        start-stop-daemon --stop --retry "$stoptimeout" --exec "$DAEMON"
}

reload() {
        start-stop-daemon --stop --signal USR1 --exec "$DAEMON"
}

status() {
    local pidfile daemon name status

    pidfile=
    OPTIND=1
    while getopts p: opt ; do
        case "$opt" in
            p)  pidfile="$OPTARG";;
        esac
    done
    shift $(($OPTIND - 1))

    if [ -n "$pidfile" ]; then
        pidfile="-p $pidfile"
    fi
    daemon="$1"
    name="$2"

    status="0"
    pidofproc $pidfile $daemon >/dev/null || status="$?"
    if [ "$status" = 0 ]; then
        log_success_msg "$name is running"
        return 0
    else
        log_failure_msg "$name is not running"
        return $status
    fi
}

case "$1" in
  start)
        echo -n "Starting $DESC: "
        start
        echo "$NAME."
        ;;
  stop)
        echo -n "Stopping $DESC: "
        stop
        echo "$NAME."
        ;;
  restart)
        echo -n "Restarting $DESC: "
        stop
        start
        echo "$NAME."
        ;;
  reload|force-reload)
        echo -n "Restarting $DESC: "
        reload
        echo "$NAME."
        ;;
  status)
        status $DAEMON $NAME
        ;;
  *)
        N=/etc/init.d/$NAME
        echo "Usage: $N {start|stop|restart|reload|force-reload|status}" >&2
        exit 1
        ;;
esac

exit 0
Ubuntu Community Wiki开始,OpenDKIM使用两个文件进行配置:

> / etc / default / opendkim:它控制opendkim二进制参数如何.请参见此处的手册页.这个文件DAEMON_OPTS和SOCKET的两个重要参数.见man 8 opendkim
> /etc/opendkim.conf:运行时由opendkim二进制文件读取的主配置文件.见man 5 opendkim.conf

/ etc / default / opendkim文件内容应该放在/etc/opendkim.conf中.您应该只在/ etc / default / opendkim中配置套接字和其他二进制参数.

仅供参考,未找到Line-X上方的错误消息由/etc/init.d/opendkim投掷,尤其是此行

. /etc/default/opendkim

Space-after-dot syntax was shortcut for source in shell. / etc / default / opendkim不是用于分配变量的有效shell脚本.因此,init脚本尝试执行但它失败,因为它无法找到二进制文件.

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐