Vesta Control Panel - Forum

Community Forum

Skip to content

Advanced search
  • Quick links
    • Main site
    • Github repo
    • Google Search
  • FAQ
  • Login
  • Register
  • Board index Main Section General Discussion Debian/Ubuntu
  • Search

Limit emails per hour per domain

Debian/Ubuntu related topics
Post Reply
  • Print view
Advanced search
41 posts
  • Previous
  • 1
  • 2
  • 3
  • 4
  • 5
  • Next
mike08
Posts: 160
Joined: Sat Jun 20, 2015 7:12 am

Os: Debian 6x
Web: apache + nginx
Re: Limit emails per hour per domain
  • Quote

Post by mike08 » Sun Sep 11, 2016 5:16 am

You are a crack, it indeed work, it wasn't working for me the php scripts earlier as I was testing it with roundcube using the ww-data user, however it indeed blocks or limits connections for the entire account, useful when users are using old wordpress instances, outdated plugins or nulled content.

Good job.
Top

dpeca
VestaCP Team
Posts: 473
Joined: Wed Nov 25, 2015 7:30 pm

Re: Limit emails per hour per domain
  • Quote

Post by dpeca » Sun Sep 11, 2016 11:25 am

One is glad to be of service ;)
This will also helps me, because I have a lot of servers :)
Top

mehargags
Support team
Posts: 1096
Joined: Sat Sep 06, 2014 9:58 pm
Contact:
Contact mehargags
Website Skype

Os: Debian 8x
Web: apache + nginx
Re: Limit emails per hour per domain
  • Quote

Post by mehargags » Mon Dec 12, 2016 11:32 am

dpeca,
Can you please check if I got it correctly ?

What is this line ?? where to put it ?

Code: Select all

acl_not_smtp = acl_not_smtp
nano /etc/exim4/exim4.conf.template
# inside the section that says

Code: Select all

begin acl
# Towards the end of the section add the following text

Code: Select all

# for PHP scripts, limit per Vesta user
acl_not_smtp:
deny message = Web site of $authenticated_id user is sending too much emails - rate overlimit = $sender_rate / $sender_rate_period
ratelimit = 20 / 1h / $authenticated_id
accept
Did I get it all correct ?
Top

dpeca
VestaCP Team
Posts: 473
Joined: Wed Nov 25, 2015 7:30 pm

Re: Limit emails per hour per domain
  • Quote

Post by dpeca » Thu Dec 15, 2016 10:40 am

mehargags wrote:dpeca,
Can you please check if I got it correctly ?

What is this line ?? where to put it ?
Image
Top

mehargags
Support team
Posts: 1096
Joined: Sat Sep 06, 2014 9:58 pm
Contact:
Contact mehargags
Website Skype

Os: Debian 8x
Web: apache + nginx
Re: Limit emails per hour per domain
  • Quote

Post by mehargags » Thu Dec 15, 2016 2:57 pm

thx dpeca
Yes I got it later...!! thanks
Top

kronz
Posts: 12
Joined: Mon May 23, 2016 1:52 am

Re: Limit emails per hour per domain
  • Quote

Post by kronz » Sun Jan 22, 2017 9:22 pm

To Summarize it all, here is what you have to do to get it all working. I had to read both threads until I get it right.

File to edit: /etc/exim4/exim4.conf.template
Find:

Code: Select all

begin acl
Before, add:

Code: Select all

acl_not_smtp = acl_not_smtp
Find:

Code: Select all

begin acl
After, add:

Code: Select all

# for PHP scripts, limit per vesta user
acl_not_smtp:
deny message = Web site of $authenticated_id user is sending too much emails - rate overlimit = $sender_rate / $sender_rate_period
ratelimit = 20 / 1h / $authenticated_id
accept
Find:

Code: Select all

acl_check_rcpt:
accept hosts = :
After, add:

Code: Select all

# for SMTP authenticated users, limit per email account
deny message = Email account $authenticated_id is sending too much emails - rate overlimit = $sender_rate / $sender_rate_period
ratelimit = 20 / 1h / $authenticated_id

File to edit: /etc/roundcube/defaults.inc.php
Change the settings in red to match those posted here.
$config['smtp_server'] = 'localhost';

// SMTP port (default is 25; use 587 for STARTTLS or 465 for the
// deprecated SSL over SMTP (aka SMTPS))
$config['smtp_port'] = 25;

// SMTP username (if required) if you use %u as the username Roundcube
// will use the current username for login
$config['smtp_user'] = '%u';

// SMTP password (if required) if you use %p as the password Roundcube
// will use the current user's password for login
$config['smtp_pass'] = '%p';
Top

dpeca
VestaCP Team
Posts: 473
Joined: Wed Nov 25, 2015 7:30 pm

Re: Limit emails per hour per domain
  • Quote

Post by dpeca » Thu Jan 26, 2017 3:23 pm

Excelent kronz, thank you for summarizing :)
Top

mehargags
Support team
Posts: 1096
Joined: Sat Sep 06, 2014 9:58 pm
Contact:
Contact mehargags
Website Skype

Os: Debian 8x
Web: apache + nginx
Re: Limit emails per hour per domain
  • Quote

Post by mehargags » Tue Feb 14, 2017 6:20 pm

A small clarification I need... Say I want to create MULTIPLE ACLs for acl_not_smtp:


I would only once define:

Code: Select all

acl_not_smtp = acl_not_smtp 
correct ??

Then
how do I define Multiple Acls per hour, per minute, per second like this ??

Code: Select all

acl_not_smtp_s:
  deny message = Web site of $authenticated_id user is sending too much emails - rate overlimit = $sender_rate / $sender_rate_period
  ratelimit = 20 / 1s / $authenticated_id
  accept

Code: Select all

acl_not_smtp:
  deny message = Web site of $authenticated_id user is sending too much emails - rate overlimit = $sender_rate / $sender_rate_period
  ratelimit = 200 / 1h / $authenticated_id
  accept
Am I doing it correctly ??
Sorry the Exim documentation is too damn reference only, no real examples to show real syntax. Please help me for this.
Top

dpeca
VestaCP Team
Posts: 473
Joined: Wed Nov 25, 2015 7:30 pm

Re: Limit emails per hour per domain
  • Quote

Post by dpeca » Fri Feb 17, 2017 10:41 am

Only one

Code: Select all

acl_not_smtp = acl_not_smtp
and then:

Code: Select all

acl_not_smtp:
  deny message = Web site of $authenticated_id user is sending too much emails - rate overlimit = $sender_rate / $sender_rate_period
  ratelimit = 20 / 1s / $authenticated_id

  deny message = Web site of $authenticated_id user is sending too much emails - rate overlimit = $sender_rate / $sender_rate_period
  ratelimit = 200 / 1h / $authenticated_id

  accept
Top

mehargags
Support team
Posts: 1096
Joined: Sat Sep 06, 2014 9:58 pm
Contact:
Contact mehargags
Website Skype

Os: Debian 8x
Web: apache + nginx
Re: Limit emails per hour per domain
  • Quote

Post by mehargags » Sun Feb 19, 2017 7:14 pm

Hey Dpecca,
Thanks a ton ... got the same reference from a friend... Will test it out soon and post results
Top


Post Reply
  • Print view

41 posts
  • Previous
  • 1
  • 2
  • 3
  • 4
  • 5
  • Next

Return to “Debian/Ubuntu”



  • Board index
  • All times are UTC
  • Delete all board cookies
  • The team
Powered by phpBB® Forum Software © phpBB Limited
*Original Author: Brad Veryard
*Updated to 3.2 by MannixMD
 

 

cron

Login  •  Register

I forgot my password