How to prevent spamming in Cpanel / Linux server ?
A few things may help
Disable all network interfaces. It'll ensure that no spam enters or leaves your server, and ensures perfect security, as well.
cPanel is a piece of hosting automation software (http://cpanel.net/), it provides a web interface to control many open source services (such as Apache, Exim and Pure-FTPD).
I believe the question concerns outbound mail (i.e. hosting accounts being used to send spam), but I'll briefly outline the inbound mail as well.
Outbound mail: There are a couple of possible routes outbound mail may take:
I am not aware of cPanel providing an easy method to scan outbound mail for spam. However, there are several cPanel options to help mitigate the above scenarios:
With the above setup, all mail is now funnelled through the MTA under the correct user, allowing per domain (and other per user) restrictions to be applied. cPanel provides a rate limiting point and click option:
If you're interested in the domain rate limiting implementation, look at /etc/exim.pl and if it exists, /etc/exim.pl.local. A chunk of useful cPanel functionality is exposed in these, which may allow you to roll your own custom Perl based solution.
Ofcourse, the above solutions all catch the outbound spam after it's already started flowing. It would be preferable to catch root causes of the problem as well: Rogue users from being given accounts, users installing old vulnerable software, users having simple passwords and so on.
This is a list of things that you can do entirely within WHM.
Main >> Server Configuration >> Tweak Settings >> Mail:
Main >> Service Configuration >> Exim Configuration Editor: