{"id":458,"date":"2021-07-23T12:30:19","date_gmt":"2021-07-23T12:30:19","guid":{"rendered":"https:\/\/ssdsunucum.com\/blog\/how-to-prevent-email-abuse\/"},"modified":"2021-07-23T12:30:19","modified_gmt":"2021-07-23T12:30:19","slug":"how-to-prevent-email-abuse","status":"publish","type":"post","link":"https:\/\/ssdsunucum.com\/blog\/how-to-prevent-email-abuse\/","title":{"rendered":"How to Prevent Email Abuse"},"content":{"rendered":"<\/p>\n<div class=\"col-md-9\">\n<div class=\"flex-column flex-md-row article-header\"><\/div>\n<hr>\n<h2 id=\"overview\">Overview<\/h2>\n<p>This document outlines some of the best practices that you can follow to avoid email abuse on your cPanel &#038; WHM server.<\/p>\n<h2 id=\"password-strength-configuration\">Password Strength Configuration<\/h2>\n<p>If you increase the minimum password strength for your users\u2019 mail accounts, you can decrease the chance that a hacker will correctly guess their passwords.<\/p>\n<p>To define minimum password strength for all of your users\u2019 authenticated features, use WHM\u2019s <em>Password Strength Configuration<\/em> interface (<em>WHM<\/em> &gt;&gt; <em>Home<\/em> &gt;&gt; <em>Security Center<\/em> &gt;&gt; <em>Password Strength Configuration<\/em>).<\/p>\n<div class=\"callout callout-info\">\n<div class=\"callout-heading\">Note:<\/div>\n<div class=\"callout-content\">\n<p>We recommend that you set the default minimum password strength to at least <code>50<\/code>.<\/p>\n<\/p><\/div>\n<\/div>\n<h2 id=\"enable-cphulk\">Enable cPHulk<\/h2>\n<p>cPHulk provides protection for your server against brute force attacks (a hacking method that uses an automated system to guess passwords). If you enable cPHulk, you can decrease the chance that a hacker can use a brute force attack to gain access to your server\u2019s mail accounts.<\/p>\n<p>To enable this feature, navigate to WHM\u2019s <em>cPHulk Brute Force Protection<\/em> interface (<em>WHM<\/em> &gt;&gt; <em>Home<\/em> &gt;&gt; <em>Security Center<\/em> &gt;&gt; <em>cPHulk Brute Force Protection<\/em>) and click <em>Off<\/em> to toggle the feature\u2019s status.<\/p>\n<h2 id=\"enable-greylisting\">Enable Greylisting<\/h2>\n<p>Greylisting is a service that protects your server against unwanted email or spam. When enabled, the mail server will temporarily reject any email from a sender that the server does not recognize. If the email is legitimate, the originating server tries to send it again after a delay. After sufficient time passes, the server accepts the email.<\/p>\n<p>To enable this feature, navigate to WHM\u2019s <em>Greylisting<\/em> interface (<em>WHM &gt;&gt; Home &gt;&gt; Email &gt;&gt; Greylisting<\/em>) and click <em>Off<\/em> to toggle the feature\u2019s status.<\/p>\n<h2 id=\"smtp-restrictions\">SMTP restrictions<\/h2>\n<p>If you enable the <em>SMTP Restrictions<\/em> feature, spammers cannot directly interact with remote mail servers or work around mail security settings.<\/p>\n<ul>\n<li>\n<p>This feature restricts outgoing email connection attempts to the mail transfer agent (MTA), the <code>mailman<\/code> system user, and the <code>root<\/code> user.<\/p>\n<\/li>\n<li>\n<p>This feature forces both scripts and users to use Exim\u2019s <code>sendmail<\/code> binary, which helps to prevent direct access to the socket.<\/p>\n<\/li>\n<\/ul>\n<p>To enable this feature, navigate to WHM\u2019s <em>SMTP Restrictions<\/em> interface (<em>WHM<\/em> &gt;&gt; <em>Home<\/em> &gt;&gt; <em>Security Center<\/em> &gt;&gt; <em>SMTP Restrictions<\/em>) and click <em>Enable<\/em>.<\/p>\n<h2 id=\"exim-configuration-manager\">Exim Configuration Manager<\/h2>\n<p>WHM\u2019s <em>Exim Configuration Manager<\/em> interface (<em>WHM &gt;&gt; Home &gt;&gt; Service Configuration &gt;&gt; Exim Configuration Manager<\/em>) provides a large number of spam and abuse prevention options.<\/p>\n<p>We <strong>strongly<\/strong> recommend that you read the <em>Exim Configuration Manager<\/em> documentation for each option in that interface.<\/p>\n<h2 id=\"tweak-settings\">Tweak Settings<\/h2>\n<p>The following settings in the <em>Mail<\/em> section of WHM\u2019s <em>Tweak Settings<\/em> interface (<em>WHM<\/em> &gt;&gt; <em>Home<\/em> &gt;&gt; <em>Server Configuration<\/em> &gt;&gt; <em>Tweak Settings<\/em>) can help to prevent email abuse:<\/p>\n<div class=\"callout callout-info\">\n<div class=\"callout-heading\">Note:<\/div>\n<div class=\"callout-content\">\n<p>If you set the <em>Max hourly emails per domain<\/em> option to <code>500<\/code>, this allows each of the domains that you host to send 500 email messages per hour. For example, a domain uses a mailing list with 500 members. If this domain sends a message to the mailing list, then sends another email message in the same hour, the domain will exceed the <em>Max hourly emails per domain<\/em> limit.<\/p>\n<p>Use the <em>The percentage of email messages (above the account\u2019s hourly maximum) to queue and retry for delivery<\/em> setting to specify a \u201csoft limit.\u201d For example, if you set the <em>The percentage of email messages (above the account\u2019s hourly maximum) to queue and retry for delivery<\/em> value to <code>150<\/code>, the domain can queue up to 250 messages to send in the next hour. In this scenario, the domain can queue the additional 25 email messages in the next hour.<\/p>\n<\/p><\/div>\n<\/div>\n<h4 id=\"max-hourly-emails-per-domain\">Max hourly emails per domain<\/h4>\n<p>This setting specifies the maximum number of emails that each domain can send per hour.<\/p>\n<p>This setting defaults to <em>Unlimited<\/em>.<\/p>\n<div class=\"callout callout-info\">\n<div class=\"callout-heading\">Note:<\/div>\n<div class=\"callout-content\">\n<ul>\n<li>\n<p>The system <strong>only<\/strong> enforces email send limits on remote email deliveries.<\/p>\n<\/li>\n<li>\n<p>This setting does <strong>not<\/strong> appear if you disable the Exim Mail Server service in WHM\u2019s <em>Service Manager<\/em> interface (<em>WHM<\/em> &gt;&gt; <em>Home<\/em> &gt;&gt; <em>Service Configuration<\/em> &gt;&gt; <em>Service Manager<\/em>).<\/p>\n<\/li>\n<li>\n<p>This setting does <strong>not<\/strong> function if you disable the Eximstats driver in WHM\u2019s <em>Service Manager<\/em> (<em>WHM &gt;&gt; Home &gt;&gt; Service Configuration &gt;&gt; Service Manager<\/em>).<\/p>\n<\/li>\n<li>\n<p>This setting does <strong>not<\/strong> override the following settings:<\/p>\n<ul>\n<li><em>Maximum Hourly Email by Domain Relayed<\/em><\/li>\n<li><em>Maximum percentage of failed or deferred messages a domain may send per hour<\/em><\/li>\n<\/ul>\n<\/li>\n<\/ul><\/div>\n<\/div>\n<div class=\"callout callout-warning\">\n<div class=\"callout-heading\">Important:<\/div>\n<div class=\"callout-content\">\n<p>The system <strong>only<\/strong> enforces email send limits on remote email deliveries. To prevent email abuse, we recommend that you specify a value that is <strong>not<\/strong> <em>Unlimited<\/em>.<\/p>\n<\/p><\/div>\n<\/div>\n<h4 id=\"account-specific-max-hourly-emails-per-domain-settings\">Account specific Max hourly emails per domain settings<\/h4>\n<p>Use WHM\u2019s <em>Edit a Package<\/em> interface (<em>WHM<\/em> &gt;&gt; <em>Home<\/em> &gt;&gt; <em>Packages<\/em> &gt;&gt; <em>Edit a Package<\/em>) or WHM\u2019s <em>Modify an Account<\/em> interface (<em>WHM<\/em> &gt;&gt; <em>Home<\/em> &gt;&gt; <em>Account Functions<\/em> &gt;&gt; <em>Modify an Account<\/em>) to specify values for an individual package or an individual account.<\/p>\n<p>To enable this setting from the command line, you <strong>must<\/strong> perform the following steps to manually edit the <code>cpuser<\/code> file:<\/p>\n<ol>\n<li>\n<p>From the command line, open the <code>\/var\/cpanel\/users\/username<\/code> file, where <code>username<\/code> represents the desired account username.<\/p>\n<\/li>\n<li>\n<p>In this file, add the <code>MAX_EMAIL_PER_HOUR<\/code> key and specify the value for the selected username: <\/p>\n<div class=\"highlight\">\n<pre style=\"color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4\"><code class=\"language-BASH\" data-lang=\"BASH\">MAX_EMAIL_PER_HOUR<span style=\"color:#f92672\">=<\/span><span style=\"color:#ae81ff\">500<\/span><\/code><\/pre>\n<\/div>\n<\/li>\n<li>\n<p>Run the <code>\/usr\/local\/cpanel\/scripts\/updateuserdomains<\/code> script.<\/p>\n<\/li>\n<\/ol>\n<h4 id=\"prevent-nobody-from-sending-mail\">Prevent nobody from sending mail<\/h4>\n<p>This setting denies the <code>nobody<\/code> user the ability to send mail to a remote address.<\/p>\n<p>The setting defaults to <em>On<\/em>.<\/p>\n<div class=\"callout callout-info\">\n<div class=\"callout-heading\">Note:<\/div>\n<div class=\"callout-content\">\n<p>PHP and CGI scripts generally run as the <code>nobody<\/code> user. To use a PHP or CGI script to send mail, enable the <code>suEXEC<\/code> or <code>mod_php<\/code> modules in your Apache configuration.<\/p>\n<\/p><\/div>\n<\/div>\n<div class=\"callout callout-warning\">\n<div class=\"callout-heading\">Important:<\/div>\n<div class=\"callout-content\">\n<p>To prevent email abuse, we recommend that you select <em>On<\/em>.<\/p>\n<\/p><\/div>\n<\/div>\n<h4 id=\"the-percentage-of-email-messages-above-the-account-hourly-maximum-to-queue-and-retry-for-delivery\">The percentage of email messages above the account hourly maximum to queue and retry for delivery<\/h4>\n<p>This setting specifies whether to queue outgoing messages for later delivery after a domain reaches its limit for outgoing messages per hour.<\/p>\n<div class=\"callout callout-info\">\n<div class=\"callout-heading\">Note:<\/div>\n<div class=\"callout-content\">\n<p>The minimum value for this setting is <code>100<\/code>, with a maximum value of <code>10,000<\/code>.<\/p>\n<\/p><\/div>\n<\/div>\n<p>For example, with the default value of <code>125%<\/code>, after the domain reaches its hourly limit Exim queues any additional messages, up to 125% of the <em>Max hourly emails per domain<\/em> value. After the account reaches 125% of the <em>Max hourly emails per domain<\/em> value, any additional outgoing messages will fail.<\/p>\n<p>This setting defaults to <em>125%<\/em>.<\/p>\n<div class=\"callout callout-info\">\n<div class=\"callout-heading\">Note:<\/div>\n<div class=\"callout-content\">\n<ul>\n<li>\n<p>To force the failure of <strong>all<\/strong> outgoing messages after the domain reaches its limit, set this option to <code>100<\/code>.<\/p>\n<\/li>\n<li>\n<p>This setting does <strong>not<\/strong> appear if you disable the Exim Mail Server service in WHM\u2019s <em>Service Manager<\/em> interface (<em>WHM &gt;&gt; Home &gt;&gt; Service Configuration &gt;&gt; Service Manager<\/em>).<\/p>\n<\/li>\n<li>\n<p>This setting does <strong>not<\/strong> function if you disable the Eximstats driver in WHM\u2019s <em>Service Manager<\/em> (<em>WHM &gt;&gt; Home &gt;&gt; Service Configuration &gt;&gt; Service Manager<\/em>).<\/p>\n<\/li>\n<\/ul><\/div>\n<\/div>\n<h4 id=\"maximum-percentage-of-failed-or-deferred-messages-a-domain-may-send-per-hour\">Maximum percentage of failed or deferred messages a domain may send per hour<\/h4>\n<p>This setting allows you to specify a maximum percentage of failed or deferred messages that your domain may send per hour. Your server temporarily blocks outgoing mail from a domain if <strong>both<\/strong> of the following conditions are true:<\/p>\n<ul>\n<li>\n<p>The percentage of failed or deferred messages, out of the total number of sent messages, is <strong>equal to or greater than<\/strong> the specified percentage.<\/p>\n<\/li>\n<li>\n<p>The domain has sent <strong>at least<\/strong> the number of failed or deferred messages that the <em>Number of failed or deferred messages a domain may send before protections can be triggered<\/em> setting specifies.<\/p>\n<\/li>\n<\/ul>\n<p>The system examines all outgoing and local mail over the previous hour to determine whether these conditions are true. If <strong>only one<\/strong> of these conditions is true, the system does <strong>not<\/strong> block outgoing mail.<\/p>\n<p>For more information, read our Mail Limiting Features documentation.<\/p>\n<p>This setting defaults to <em>Unlimited<\/em>.<\/p>\n<div class=\"callout callout-info\">\n<div class=\"callout-heading\">Note:<\/div>\n<div class=\"callout-content\">\n<ul>\n<li>\n<p>This setting does <strong>not<\/strong> appear if you disable the Exim Mail Server service in WHM\u2019s <em>Service Manager<\/em> interface (<em>WHM &gt;&gt; Home &gt;&gt; Service Configuration &gt;&gt; Service Manager<\/em>).<\/p>\n<\/li>\n<li>\n<p>This setting does <strong>not<\/strong> function if you disable the Eximstats driver in WHM\u2019s <em>Service Manager<\/em> (<em>WHM &gt;&gt; Home &gt;&gt; Service Configuration &gt;&gt; Service Manager<\/em>).<\/p>\n<\/li>\n<li>\n<p>The system uses this setting in conjunction with the <em>Number of failed or deferred messages a domain may send before protections can be triggered<\/em> setting. Your server does <strong>not<\/strong> temporarily block outgoing mail from a domain until the domain meets <strong>both<\/strong> settings\u2019 requirements.<\/p>\n<\/li>\n<\/ul><\/div>\n<\/div>\n<h4 id=\"initial-default-catch-all-forwarder-destination\">Initial default\/catch-all forwarder destination<\/h4>\n<p>This setting specifies the initial forwarding destination for new accounts\u2019 default (catch-all) email addresses. The cPanel account default address handles email that nonexistent users on your server\u2019s domains receive.<\/p>\n<div class=\"callout callout-warning\">\n<div class=\"callout-heading\">Important:<\/div>\n<div class=\"callout-content\">\n<ul>\n<li>If you receive large amounts of spam, we recommend that you change this setting from <em>System account<\/em> (the default) to <em>Fail<\/em>.<\/li>\n<li>Check your domains\u2019 default addresses <strong>often<\/strong> for missing messages. The domain default address may receive messages for your existing email addresses if they contain typos or other issues. For example, if your email address is <code>corgis_sploot@example.com<\/code> but a sender uses <code>corgi_splot@example.com<\/code>, the default address will receive it.<\/li>\n<\/ul><\/div>\n<\/div>\n<p>This setting changes the default setting for newly-created accounts. To change this setting for an existing account, perform the following steps:<\/p>\n<ol>\n<li>\n<p>Log in to the desired cPanel account or use WHM\u2019s <em>List Accounts<\/em> interface (<em>WHM &gt;&gt; Home &gt;&gt; Account Information &gt;&gt; List Accounts<\/em>) to access it.<\/p>\n<\/li>\n<li>\n<p>Navigate to cPanel\u2019s <em>Default Address<\/em> interface (<em>cPanel &gt;&gt; Home &gt;&gt; Email &gt;&gt; Default Address<\/em>).<\/p>\n<\/li>\n<li>\n<p>From the <em>Send all unrouted email for the following domain<\/em> menu, select the domain for which you wish to set a default address.<\/p>\n<\/li>\n<li>\n<p>Select the <em>Discard the email while your server processes it by SMTP time with an error message<\/em> setting. This setting will send an error message to the sender.<\/p>\n<\/li>\n<li>\n<p>Enter an error message in the <em>Failure Message (seen by sender)<\/em> text box.<\/p>\n<\/li>\n<li>\n<p>Click <em>Change<\/em>.<\/p>\n<\/li>\n<\/ol>\n<h2 id=\"php-configuration\">PHP configuration<\/h2>\n<div class=\"callout callout-danger\">\n<div class=\"callout-heading\">Warning:<\/div>\n<div class=\"callout-content\">\n<p>Do <strong>not<\/strong> enable suEXEC with ModRuid2. suEXEC is <strong>not<\/strong> compatible with this module.<\/p>\n<\/p><\/div>\n<\/div>\n<p>If you configure PHP and suEXEC, ModRuid2, or suPHP, you can improve server security. This configuration allows you to know which users run which processes system-wide.<\/p>\n<ul>\n<li>\n<p>ModRuid2 and suPHP force CGI applications to run as the cPanel account user. In addition, ModRuid2 exploits some of the <code>POSIX.1e<\/code> capabilities in order to provide some performance enhancements over Apache\u2019s default suEXEC configuration.<\/p>\n<\/li>\n<li>\n<p>The suEXEC Apache module forces CGI and PHP applications to run as the cPanel account user.<\/p>\n<\/li>\n<\/ul>\n<h2 id=\"experimental-rewrite-from-header-to-match-actual-sender\">EXPERIMENTAL Rewrite From header to match actual sender<\/h2>\n<p>Any local cPanel user can use the <code>127.0.0.1<\/code> IP address to send mail without authentication. This can make it difficult for system administrators to determine which cPanel account sent the mail, especially when a malicious user spoofs an email address to disguise the origin of the email.<\/p>\n<p>To require cPanel &#038; WHM to put the actual sender in the header, enable the <em>Experimental: Rewrite From: header to match actual sender<\/em> option in WHM\u2019s <em>Exim Configuration Manager<\/em> interface (<em>WHM<\/em> &gt;&gt; <em>Home<\/em> &gt;&gt; <em>Service Configuration<\/em> &gt;&gt; <em>Exim Configuration Manager<\/em>).<\/p>\n<p>After you enable this feature, you will see output that is similar to the following in the <code>\/var\/log\/exim_mainlog<\/code> file:<\/p>\n<div class=\"highlight\">\n<pre style=\"color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4\"><code class=\"language-BASH\" data-lang=\"BASH\"><span style=\"color:#ae81ff\">2014<\/span>-04-23 <span style=\"color:#ae81ff\">08<\/span>:09:52 1Wcwvu-0000On-Sb From: header <span style=\"color:#f92672\">(<\/span>rewritten was: <span style=\"color:#f92672\">[<\/span>fakemail@example.com<span style=\"color:#f92672\">]<\/span>, actual sender is not the same system user<span style=\"color:#f92672\">)<\/span> original<span style=\"color:#f92672\">=[<\/span>fakemail@example.com<span style=\"color:#f92672\">]<\/span> actual_sender<span style=\"color:#f92672\">=[<\/span>spammer@spammer.com<span style=\"color:#f92672\">]<\/span><\/code><\/pre>\n<\/div>\n<p>The <code>actual_sender<\/code> portion of the log entry shows that <code>spammer<\/code> is the cPanel account that sent the email. This information allows the system administrator to take action against the account to prevent additional spam.<\/p>\n<\/p><\/div>\n","protected":false},"excerpt":{"rendered":"<p>Overview This document outlines some of the best practices that you can follow to avoid email abuse on your cPanel &#038; WHM server. Password Strength Configuration If you increase the minimum password strength for your users\u2019 mail accounts, you can decrease the chance that a hacker will correctly guess their passwords. To define minimum password &hellip;<\/p>\n","protected":false},"author":1,"featured_media":459,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[1],"tags":[],"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/ssdsunucum.com\/blog\/wp-json\/wp\/v2\/posts\/458"}],"collection":[{"href":"https:\/\/ssdsunucum.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ssdsunucum.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ssdsunucum.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ssdsunucum.com\/blog\/wp-json\/wp\/v2\/comments?post=458"}],"version-history":[{"count":0,"href":"https:\/\/ssdsunucum.com\/blog\/wp-json\/wp\/v2\/posts\/458\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/ssdsunucum.com\/blog\/wp-json\/wp\/v2\/media\/459"}],"wp:attachment":[{"href":"https:\/\/ssdsunucum.com\/blog\/wp-json\/wp\/v2\/media?parent=458"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ssdsunucum.com\/blog\/wp-json\/wp\/v2\/categories?post=458"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ssdsunucum.com\/blog\/wp-json\/wp\/v2\/tags?post=458"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}