在Ubuntu 8.04上,SMTP邮件速率控制,最好是使用后缀

也许我正在追赶一个错误,但我正在尝试设置一个类似的smtp代理。 我有一个后缀服务器,接收所有的电子邮件收集的服务器/客户端。 他们使用智能主机(relayhost = …)将其邮件转发给我们的公司MTA。 我想限制单个服务器可以中继的消息数量,以防止淹没企业MTA。 Postfix有一个名为“铁砧”的程序,它能够跟踪邮件的统计信息,用于这些事情,但似乎没有被执行。 我运行“inotifywait -m / usr / lib / postfix / anvil”,而我开始postfix并从远程服务器通过它发送了一些消息。 inotifywait表示铁砧从未运行。 任何人得到后缀/铁砧率控制工作?

main.cf

smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu) biff = no append_dot_mydomain = no readme_directory = no myhostname = site-server-q9 alias_maps = hash:/etc/aliases alias_database = hash:/etc/aliases myorigin = /etc/mailname mydestination = localhost relayhost = Out outgoing mail relay mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128 10.0.0.0/8 mailbox_size_limit = 0 recipient_delimiter = + inet_interfaces = 10.XXX smtpd_client_message_rate_limit = 1 anvil_rate_time_unit = 1h 

master.cf提取

 anvil unix - - - - 1 anvil smtp inet n - - - - smtpd 

最后我用policyd来做这种事情。 我将其configuration为将单个IP地址限制为每小时不超过10000条消息和1 GB。 以下是我自己写的文档的副本,以防有人发现有帮助。


configurationpostfix和policyd

安装软件包后,对其configuration进行以下更改。 在/etc/postfix/main.cf中添加以下行

 smtpd_client_restrictions = check_policy_service inet:127.0.0.1:10031 

在/etc/postfix-policyd.conf中

  • WHITELISTING=1更改为WHITELISTING=0
  • GREYLISTING=1更改为GREYLISTING=0
  • SENDERTHROTTLE=0更改为SENDERTHROTTLE=1
  • QUOTA_EXCEEDED_TEMP_REJECT=1更改为QUOTA_EXCEEDED_TEMP_REJECT=0
  • 更改SENDER_QUOTA_REJECTION="Quota Exceeded." SENDER_QUOTA_REJECTION="Quota Exceeded, 10,000 messages/hour max!"
  • 更改SENDER_SIZE_REJECTION="Message size too big."SENDER_SIZE_REJECTION="Message size too big. 10Mb per message or 1 Gb/hour max!"
  • SENDERMSGLIMIT=512更改为SENDERMSGLIMIT=10000
  • SENDERRCPTLIMIT=3600更改为SENDERRCPTLIMIT=10000
  • SENDERQUOTALIMIT=250000000更改为SENDERQUOTALIMIT=1000000000
  • SENDERMSGSIZE=10240000更改为SENDERMSGSIZE=50000000
  • SENDER_INACTIVE_EXPIRE=31d更改为SENDER_INACTIVE_EXPIRE=1h

可能对您的实施有趣:

 default_destination_concurrency_limit (default: 20) The default maximal number of parallel deliveries to the same destination. This is the default limit for delivery via the lmtp(8), pipe(8), smtp(8) and virtual(8) delivery agents. With per-destination recipient limit > 1, a destination is a domain, otherwise it is a recipient. Use transport_destination_concurrency_limit to specify a transport-specific override, where transport is the master.cf name of the message delivery transport. 

铁砧是真的意味着限制传入的消息速率,不限制传出。 把它看作是一个粗略的DoSfilter。

您可能需要查看与postfix的qmgr部分有关的设置。 具体而言,您可能希望将并发限制设置为非常低,而您的等待时间非常长。 您需要将交货速率设置为具有较大(r)延迟的交货速度 ,并且还希望降低master.cf中交货过程的数量。

你有没有看过使用qshape来确定你的内部MTA可接受的速度?

铁砧logging后缀,我添加到main.cf下面,似乎为我工作

 #### Prevent server sending excess mail from clients add to /etc/postfix/main.cf #### anvil_rate_time_unit = 60s anvil_status_update_time = 120s smtpd_error_sleep_time = 2s smtpd_soft_error_limit = 10 smtpd_hard_error_limit = 20 smtpd_client_message_rate_limit = #### End Prevent server sending excess mail