Dovecot:操作不允许

Dovecot:操作不允许

我使用的是 centos6 和 centos web 面板、postfix。我可以发送消息并登录 roundcube。但我无法接收消息。Dovecot 日志:

9月09日 13:52:31 lda([电子邮件保护]):致命:setuid(101)因 euid=5000(vmail)而失败:操作不允许(此二进制文件可能应该使用设置为 101 而不是 5000(vmail)的进程用户来调用)请告诉我这些设置:

  • first_valid_uid
  • last_valid_uid
  • first_valid_gid
  • last_valid_gid

我应该拥有什么权限dovecot-lda

##
## Dovecot config file
##
listen = *
disable_plaintext_auth = no

protocols = imap pop3 lmtp sieve
auth_mechanisms = plain login

passdb {
    driver = sql
    args = /etc/dovecot/dovecot-mysql.conf
}

#userdb {
#driver = prefetch
#}

userdb {
    driver = sql
    args = /etc/dovecot/dovecot-mysql.conf
}

mail_location = maildir:/var/vmail/%d/%n
first_valid_uid = 101
#last_valid_uid = 5000
first_valid_gid = 0
#last_valid_gid = 12
mail_plugins = quota
mailbox_idle_check_interval = 30 secs
maildir_copy_with_hardlinks = yes

service imap-login {
    inet_listener imap {
        port = 143
    }
    inet_listener imaps {
        port = 993
        ssl = yes
    }
}

service pop3-login {
    inet_listener pop3 {
        port = 110
    }
    inet_listener pop3s {
        port = 995
        ssl = yes
    }
}

service lmtp {
    unix_listener lmtp {
        #mode = 0666
    }
}

service imap {
    vsz_limit = 256M
}

service pop3 {
}

service auth {
    unix_listener auth-userdb {
        mode = 0666
        user = vmail
        group = mail
    }

    # Postfix smtp-auth
    unix_listener /var/spool/postfix/private/auth {
        mode = 0666
        user = postfix
        group = postfix
    }
}
service auth-worker {
}
service dict {
    unix_listener dict {
        mode = 0666
        user = vmail
        group = mail
    }
}
service managesieve-login {
    inet_listener sieve {
        port = 4190
    }
    service_count = 1
    process_min_avail = 0
    vsz_limit = 64M
}

service managesieve {
}

ssl = yes
ssl_cert = </etc/pki/tls/certs/gog.uk.to.crt
ssl_key = </etc/pki/tls/private/gog.uk.to.key
ssl_verify_client_cert = no
ssl_ca =

lda_mailbox_autocreate = yes
lda_mailbox_autosubscribe = yes
protocol lda {
    #mail_plugins = sieve
    mail_plugins = quota sieve
    postmaster_address = [email protected]
}

protocol imap {
    mail_plugins = quota imap_quota trash
    #mail_plugins = trash
    imap_client_workarounds = delay-newmail
}

lmtp_save_to_detail_mailbox = yes

protocol lmtp {
    mail_plugins = quota sieve
    #mail_plugins = sieve
}

protocol pop3 {
    mail_plugins = quota
    #mail_plugins =
    pop3_client_workarounds = outlook-no-nuls oe-ns-eoh
}

protocol sieve {
    managesieve_max_line_length = 65536
    managesieve_implementation_string = Dovecot Pigeonhole
    managesieve_max_compile_errors = 5
}

dict {
    quotadict = mysql:/etc/dovecot/dovecot-dict-quota.conf
}

plugin {
    quota = dict:user::proxy::quotadict
    acl = vfile:/etc/dovecot/acls
    trash = /etc/dovecot/trash.conf
    sieve_global_path = /var/sieve/globalfilter.sieve
    sieve = ~/dovecot.sieve
    sieve_dir = ~/sieve
    sieve_global_dir = /var/sieve/
    #sieve_extensions = +notify +imapflags
    sieve_max_script_size = 1M
    #sieve_max_actions = 32
    #sieve_max_redirects = 4
}

log_path = /var/log/dovecot.log
info_log_path = /var/log/dovecot-info.log
debug_log_path = /var/log/dovecot-debug.log
mail_debug=no

答案1

我相信你也遇到了和我一样的问题:

多个 UID
如果您为用户使用多个 UID,则运行 dovecot-lda 会遇到问题,因为大多数 MTA 不允许您以 root 身份运行 dovecot-lda。最好的解决方案是改用 LMTP,但如果不能这样做,有两种方法可以解决这个问题:

  1. 使 dovecot-lda 成为 setuid-root。
  2. 使用 sudo 来包装 dovecot-lda 的调用。

来源:https://wiki2.dovecot.org/LDA#line-100

这是我每次更新 dovecot 包后所做的事情:

sudo chgrp dovenull /usr/lib/dovecot/deliver
sudo chmod 04750 /usr/lib/dovecot/dovecot-lda
# optional: run postqueue to deliver queued mails immediately
postqueue -f

不过我正在运行 Ubuntu,所以你很可能必须使用不同的组。我手边没有 CentOS 安装来查找。

答案2

为了完整性,类似的问题也适用于多个 GID(可能导致类似“致命:setresgid ...:操作不允许”的情况):

如果您需要多个 uid/gid,则需要设置 dovecot-lda setuid root 或通过 sudo 调用它。请参阅 LDA#multipleuids 了解如何安全地执行此操作。

来源:https://wiki2.dovecot.org/LDA/Postfix

或者像其他答案中提到的那样使用 LMTP。

相关内容