How to disable mail send function for certain directadmin users?

ozgurerdogan

Verified User
Joined
Apr 20, 2008
Messages
352
Often wordpress or joomla sites those use nulled plugins causes to send lots of spam mails. I am limiting directadmin users to send x mails for a day. But I also want to know if it is possible to completely disable mail send function for these sites.

Two things I want to learn:
1. Is it possible to disable mail sending from any php codes? (with mail send() function or even smtp authantication - go to 2nd here)
2. Is it also possible to disable smtp service for these domains? And how please?

Thanks
 
1a) It depends on which php type you're using.
For CLI (mod_php) based php installs, it uses a global php.ini, so the disable_functions applies to all domains.
I believe all other php type (suPhp, php-fpm, fastcgi) will allow a per-User php.ini file, so you can add mail to the disable_functions list.
Let us know which php type you have and we can narrow that down for you.

1b) Another trick would be to add per-Email limits, if you've got exim.pl 16:
http://help.directadmin.com/item.php?id=514


2a) To disable smtp, you'd set a limit of 1 for the DA User, eg:
Code:
echo 1 > /etc/virtual/limit_[B]username[/B]
where it's max of 1 emails per day. Setting it to 0 means unlimited. This is the same setting as in DA, per User.

2b) If you truely wanted 0, the /etc/exim.pl can be modified to suit your needs.. but you may want to chattr +i /etc/exim.pl if you do make any changes, to ensure your changes stick.

John
 
If I set limit to 1, and user tries to send lets say 100 mails, will 99 mails stuck in mail queue? If yes, I would have to completely disable mail send function.
 
Depends on how they're sent.

If they're sent via smtp, the 2nd email will throw a wrong password error (assuming exim.pl version 15+, 16 is current)

For command-line sends, the default would have them pile up in the queue, but they won't leave the box.
The solution for that, assuming you're running a user-privilege php type (suphp, mod_php+mod_ruid2, php-fpm, fastcgi), would be to setup a noexim group on /usr/sbin/exim, and chmod the binary to 4705, rather than 4755.
Info on that here (but for perl, so swap it around for exim): http://help.directadmin.com/item.php?id=490

John
 
Back
Top