Anvil will help us to prevent the system from overloading
Note: This features are available in Postfix 2.2 and later.
Open postfix config file in your favourite text editor
#vim /etc/postfix/main.cf
And add next rows
smtpd_client_event_limit_exceptions = #Clients that are excluded from connection count (default: $mynetworks)
anvil_rate_time_unit = 60s #The time unit over which client connection rates and other rates are calculated. (default: 60s)
anvil_status_update_time = 120s #How frequently the server logs peak usage information. (default: 600s)
smtpd_client_message_rate_limit=500 #The
maximal number of message delivery requests that any client is allowed
to make to this service per time unit. (default: 0) To disable this
feature, specify a limit of 0.
This configuration means that client may send 500 messages per minute, message 501 will be rejected.
Make this changing on your testing environment and check it with next script
#vim bomber.sh
and Insert
#!/bin/bash
i=0
while [ $i != 2500 ]; do
echo test | /bin/mail -s "test message$i" "user@test.com"
i=$(( $i + 1 ))
done;
2500 under while - means that script will try to send 2500 messages.
Replace "user@test.com" with real mailbox
Now make the script executable
#chmod 700 bomber.sh
#./bomber.sh
#tailf /var/log/maillog
And we are ready.
No comments:
Post a Comment