限制对管理员用户的后队列访问

Tex*_*xec 4 security linux postfix gentoo

postfix在 Gentoo 上作为邮件程序守护进程运行。在调查一些队列堆积时,我发现/usr/sbin/postqueue系统上的所有用户都可以执行它,它很高兴地-q为所有用户输出当前的邮件队列(带有)。

看起来这或多或少是设计使然:postdrop并且postqueueset-gid带有 group 的二进制文件postdrop

-rwx--s--x  1 root postdrop  15K Apr 10 23:49 postdrop
-rwx--s--x  1 root postdrop  15K Apr 10 23:49 postqueue
Run Code Online (Sandbox Code Playgroud)

它们也可由 执行otherpostfix似乎需要(输出postfix check):

postfix/postfix-script: warning: not set-gid or not owner+group+world executable: /usr/sbin/postqueue
Run Code Online (Sandbox Code Playgroud)

我可能遗漏了一些内部工作,但据我所知,普通用户不应该访问队列,特别是因为在此配置中所有地址和域都设置为虚拟(通过数据库)。如果用户postqueue定期轮询,他可以组装一个<from>,<to>地址对列表(postcat受限制,用户无法访问邮件的内容)。

exim有一个名为 的配置选项queue_list_requires_admin,但我找不到这样的后缀。是否可以使用 postfix 限制队列访问?

tpm*_*ml7 6

Postfix 不使用 unix 权限功能来限制对postqueue. 相反,它使用像“authorized_mailq_users”这样的参数

authorized_mailq_users(静态:任何人)

有权查看队列的用户列表。

所以,如果你想限制特定用户,例如:root,你可以使用

authorized_mailq_users = static:root
Run Code Online (Sandbox Code Playgroud)

有关更多信息,请参阅 man 1 postqueue