AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / server / 问题 / 502910
Accepted
golemwashere
golemwashere
Asked: 2013-04-27 06:19:22 +0800 CST2013-04-27 06:19:22 +0800 CST 2013-04-27 06:19:22 +0800 CST

postfwd 不限制 sasl 用户的速率

  • 772

我想使用postfwd版本 2 来限制我的 sasl 身份验证用户每天发送的邮件数量。

我安装了最新的 tarball:postfwd-1.35,带有来自 Centos 6.4 的最新后缀

在我的我只有这条规则

id=RULEZEROSASL
  sasl_username=~/^(\S+)$/
  action=rcpt(sasl_username/500/86400/REJECT only 500 recipients per day for $$sasl_username) 

它应该只拒绝经过身份验证的用户的邮件(而不是来自受信任的邮件服务器的邮件)。

我的 postfwd2 在 tcp 10045 上监听,在我的 postfix main.cf 中我有

# Restriction Classes
smtpd_restriction_classes       = postfwdcheck
postfwdcheck                    = check_policy_service inet:127.0.0.1:10045
127.0.0.1:10045_time_limit      = 3600

...

smtpd_recipient_restrictions =
        permit_mynetworks
        permit_sasl_authenticated
        permit_tls_clientcerts
        reject_unauth_destination
        check_recipient_access  hash:/etc/postfix/access
        reject_invalid_helo_hostname
# postfwd con rate limiting
        check_policy_service inet:127.0.0.1:10045
        warn_if_reject reject_non_fqdn_helo_hostname
        warn_if_reject reject_unknown_helo_hostname
        warn_if_reject reject_unknown_client
        reject_non_fqdn_sender
        reject_non_fqdn_recipient
        reject_unknown_sender_domain
        reject_unknown_recipient_domain
        warn_if_reject reject_unverified_sender
        reject_unverified_recipient
        reject_rbl_client zen.spamhaus.org
        permit  

在 /etc/postfix/policy

.   postfwdcheck

我在日志和命令中看不到规则匹配项

postfwd2 -vv --dumpcache -f /etc/postfwd.cf

显示请求编号

[STATS] postfwd2::policy 1.35: **5** requests since 0 days, 01:05:31 hours

仅针对通过以下方式完成的手动测试增加:

 nc 127.0.0.1 10045 <request.sample

知道为什么 postfix 没有使用 postfwd 吗?

postfix
  • 2 2 个回答
  • 6506 Views

2 个回答

  • Voted
  1. Best Answer
    NickW
    2013-04-27T06:55:30+08:002013-04-27T06:55:30+08:00

    后缀限制类可以返回三个答案,OK、REJECT 或 DUNNO,通常它们有 (OK, DUNNO) 或 (REJECT, DUNNO),因为后缀的工作方式。DENY 和 OK 表示忽略其余检查,DUNNO 表示继续下一个检查。

    因此,在您的情况下,permit_mynetworksorpermit_sasl_authenticated正在返回 OK,因此它不会在 下进一步检查smtpd_recipient_restrictions,尽管您可以将它放在另一个限制类中,然后首先必须返回 OK,以便转发邮件。

    • 4
  2. Javi M.
    2013-10-29T07:44:42+08:002013-10-29T07:44:42+08:00

    您不应将“smtpd_recipient_restrictions”用于“action=rcpt(...)”,因为它需要知道 recipient_count 属性。从手册页:

     rcpt (<item>/<max>/<time>/<action>) 
       this command works similar to the rate() command with the difference,
       that the rate counter is increased by the request's recipient_count
       attribute. to do this reliably you should call postfwd from 
       smtpd_data_restrictions or smtpd_end_of_data_restrictions. if you want
       to be sure, you could check it within the ruleset:
          # recipient count limit 3 per hour per client
          id=RCPT01 ;  protocol_state==END-OF-MESSAGE ;  client_address!=10.1.1.1
             action=rcpt(client_address/3/3600/450 4.7.1 sorry, max 3 recipients per hour)
    

    因此,如果您在 smtpd_data_restrictions 中使用“check_policy_service inet:127.0.0.1:10045”,它将起作用。希望如此。

    • 1

相关问题

  • Postfix 在特定端口上接受邮件

  • 让 Postfix 以两种方式处理垃圾邮件

  • Postfix 或 exim:自动/程序化和转发电子邮件设置

  • 后缀电子邮件地址

  • 什么是最好的开源电子邮件解决方案包

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    新安装后 postgres 的默认超级用户用户名/密码是什么?

    • 5 个回答
  • Marko Smith

    SFTP 使用什么端口?

    • 6 个回答
  • Marko Smith

    命令行列出 Windows Active Directory 组中的用户?

    • 9 个回答
  • Marko Smith

    什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同?

    • 3 个回答
  • Marko Smith

    如何确定bash变量是否为空?

    • 15 个回答
  • Martin Hope
    Tom Feiner 如何按大小对 du -h 输出进行排序 2009-02-26 05:42:42 +0800 CST
  • Martin Hope
    Noah Goodrich 什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同? 2009-05-19 18:24:42 +0800 CST
  • Martin Hope
    Brent 如何确定bash变量是否为空? 2009-05-13 09:54:48 +0800 CST
  • Martin Hope
    cletus 您如何找到在 Windows 中打开文件的进程? 2009-05-01 16:47:16 +0800 CST

热门标签

linux nginx windows networking ubuntu domain-name-system amazon-web-services active-directory apache-2.4 ssh

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve