Ubuntu

Procmail:拒絕“/etc/procmailrcs/default.rc”的特殊權限

  • May 19, 2016

我正在嘗試設置 postfix、dovecot 和 procmail 以與虛擬使用者一起工作。最後,我希望擁有虛擬使用者以及添加規則以對傳入規則進行排序的可能性。最後,我需要 procmail(對嗎?)。

當我向我的伺服器發送電子郵件時,我沒有在我的 Maildir 中得到它,並在 mail.log 中看到它:

Jun 17 21:01:03 cs postfix/smtpd[24811]: connect from dub0-omc2-s13.dub0.hotmail.com[157.55.1.152]
Jun 17 21:01:03 cs postfix/smtpd[24811]: D8C9F44D88: client=dub0-omc2-s13.dub0.hotmail.com[157.55.1.152]
Jun 17 21:01:03 cs postfix/cleanup[24816]: D8C9F44D88: message-id=<DUB115-W85D8D79486AEC1D4346693C0830@phx.gbl>
Jun 17 21:01:04 cs postfix/qmgr[24806]: D8C9F44D88: from=<my-test-email>, size=1617, nrcpt=1 (queue active)
Jun 17 21:01:04 cs procmail[24818]: Denying special privileges for "/etc/procmailrcs/default.rc"
Jun 17 21:01:04 cs postfix/smtpd[24811]: disconnect from dub0-omc2-s13.dub0.hotmail.com[157.55.1.152]
Jun 17 21:01:04 cs postfix/pipe[24817]: D8C9F44D88: to=<my-virtual-email>, relay=virtualprocmail, delay=0.18, delays=0.15/0/0/0.02, dsn=2.0.0, status=sent (delivered via virtualprocmail service)
Jun 17 21:01:04 cs postfix/qmgr[24806]: D8C9F44D88: removed

如何修復“拒絕特權”procmail 吐出的行?

camilstaps@cs:/# ls -al /etc/procmailrcs
total 12
drwxr-xr-x  2 root  vmail   4096 Jun 17 19:48 .
drwxr-xr-x 97 root  root    4096 Jun 17 19:47 ..
-rw-------  1 vmail postfix   44 Jun 17 19:48 default.rc

這是我的/etc/postfix/master.cf

smtp      inet  n       -       -       -       -       smtpd
submission inet  n       -       n       -       -       smtpd
pickup    unix  n       -       -       60      1       pickup
cleanup   unix  n       -       -       -       0       cleanup
qmgr      unix  n       -       n       300     1       qmgr
tlsmgr    unix  -       -       -       1000?   1       tlsmgr
rewrite   unix  -       -       -       -       -       trivial-rewrite
bounce    unix  -       -       -       -       0       bounce
defer     unix  -       -       -       -       0       bounce
trace     unix  -       -       -       -       0       bounce
verify    unix  -       -       -       -       1       verify
flush     unix  n       -       -       1000?   0       flush
proxymap  unix  -       -       n       -       -       proxymap
proxywrite unix -       -       n       -       1       proxymap
smtp      unix  -       -       -       -       -       smtp
relay     unix  -       -       -       -       -       smtp
showq     unix  n       -       -       -       -       showq
error     unix  -       -       -       -       -       error
retry     unix  -       -       -       -       -       error
discard   unix  -       -       -       -       -       discard
local     unix  -       n       n       -       -       local
virtual   unix  -       n       n       -       -       virtual
lmtp      unix  -       -       -       -       -       lmtp
anvil     unix  -       -       -       -       1       anvil
scache    unix  -       -       -       -       1       scache
maildrop  unix  -       n       n       -       -       pipe
 flags=DRhu user=vmail argv=/usr/bin/maildrop -d ${recipient}
uucp      unix  -       n       n       -       -       pipe
 flags=Fqhu user=uucp argv=uux -r -n -z -a$sender - $nexthop!rmail ($recipient)
ifmail    unix  -       n       n       -       -       pipe
 flags=F user=ftn argv=/usr/lib/ifmail/ifmail -r $nexthop ($recipient)
bsmtp     unix  -       n       n       -       -       pipe
 flags=Fq. user=bsmtp argv=/usr/lib/bsmtp/bsmtp -t$nexthop -f$sender $recipient
scalemail-backend unix  -       n       n       -       2       pipe
 flags=R user=scalemail argv=/usr/lib/scalemail/bin/scalemail-store ${nexthop} ${user} ${extension}
virtualprocmail unix - n n - - pipe flags=DRXhuq user=vmail
 argv=/usr/bin/procmail -m E_SENDER=$sender E_RECIPIENT=$recipient ER_USER=$user ER_DOMAIN=$domain ER_DETAIL=$extension NEXTHOP=$nexthop /etc/procmailrcs/default.rc
mailman   unix  -       n       n       -       -       pipe
 flags=FR user=list argv=/usr/lib/mailman/bin/postfix-to-mailman.py
 ${nexthop} ${user}

我在 Ubuntu Server 13.04 上。

man procmail狀態:

Denying special privileges for "x"
 Procmail will not take on the identity that comes with the rcfile because 
 a security violation was found (e.g.  -p or variable assignments on the
 command line) or procmail had insufficient privileges to do so.

在提出的情況下,錯誤消息是由variable assignments on the command line例如引起的E_SENDER=$sender

可能的修復:

使用另一個“非特殊到 procmail”目錄來儲存腳本而不是 /etc/procmailrcs

(據我了解 /etc/procmailrcs 在這種情況下不需要魔法)

在命令行上傳遞使用位置參數並在 *.rc 中分配文件

procmail 腳本呼叫:

/usr/bin/procmail -m /etc/procmailrcs/default.rc $sender $recipient $user $domain $extension $nexthop 

procmail 腳本(初始部分):

# DROPRIVS - procmail magical variable, assigment causes side effects
DROPPRIVS=yes

E_SENDER=$1 
E_RECIPIENT=$2 
ER_USER=$3 
ER_DOMAIN=$4 
ER_DETAIL=$5 
NEXTHOP=$6

引用自:https://unix.stackexchange.com/questions/79741