Wednesday, March 24, 2010

RBL Configuration with Exim

Configure RBL with Exim
Firt create 3 files
rblblacklist
It is a manual blacklist, it rejects specific spammer hosts BEFORE they can send more email to your server.

rblbypass
It will email testing for specific destination (local) domains that don't want RBL filtering or prefer SpamAssassin tagging.

rblwhitelist
It will email testing for listed incoming hosts, (wildcards allowed), in case an important client's mailserver is listed on an RBL you use, also automatically excludes relayhosts.

touch /etc/rblblacklist rblbypass rblwhitelist

-------------------------------
EXIM CONFIGURATION EDITOR
-------------------------------
Now edif exim.conf file any your any favorite text editor like vi/nano/pico

# pico /etc/exim.conf

######################################################################

# MAIN CONFIGURATION SETTINGS #

######################################################################

# Specify your host's canonical name here. This should normally be the fully

# qualified "official" name of your host. If this option is not set, the

# uname() function is called to obtain the name. In many cases this does

# the right thing and you need not set anything explicitly.

# primary_hostname =

Add these Linux Here

domainlist rbl_blacklist = lsearch;/etc/exim/rblblacklist

domainlist rbl_bypass = lsearch;/etc/exim/rblbypass

hostlist rbl_whitelist = lsearch;/etc/exim/relayhosts : partial-lsearch;/etc/exim/rblwhitelist

######################################################################

# ACL CONFIGURATION #

# Specifies access control lists for incoming SMTP mail #

######################################################################

begin acl

# This access control list is used for every RCPT command in an incoming

# SMTP message. The tests are run in order until the address is either

# accepted or denied.

acl_check_rcpt:

# Accept if the source is local SMTP (i.e. not over TCP/IP). We do this by

# testing for an empty sending host field.

accept hosts = :

Add these Lines Here

#**#

#**# RBL List Begin

#**#

#

# Always accept mail to postmaster & abuse for any local domain

#

accept domains = +local_domains

local_parts = postmaster:abuse

#

# Check sending hosts against DNS black lists.

# Accept all locally generated messages

# Reject message if address listed in blacklist.

deny message = Message rejected because $sender_fullhost is blacklisted at $dnslist_domain see $dnslist_text :

!hosts = +relay_from_hosts

!authenticated = *

dnslists = dnsbl.njabl.org : bl.spamcop.net : sbl.spamhaus.org : list.dsbl.org : cbl.abuseat.org :

# RBL Bypass Local Domain List

!domains = +rbl_bypass

# RBL Whitelist incoming hosts

!hosts = +rbl_whitelist

#**#

#**# RBL List End

#**#

######################################################################

# ROUTERS CONFIGURATION #

# Specifies how addresses are handled #

######################################################################

# THE ORDER IN WHICH THE ROUTERS ARE DEFINED IS IMPORTANT! #

# An address is passed to each router in turn until it is accepted. #

######################################################################

begin routers

# This router routes to remote hosts over SMTP by explicit IP address,

# when an email address is given in "domain literal" form, for example,

# . The RFCs require this facility. However, it is

# little-known these days, and has been exploited by evil people seeking

# to abuse SMTP relays. Consequently it is commented out in the default

# configuration. If you uncomment this router, you also need to uncomment

# allow_domain_literals above, so that Exim can recognize the syntax of

# domain literal addresses.

# domain_literal:

# driver = ipliteral

# domains = ! +local_domains

# transport = remote_smtp


Add These Lines Here

# Deny and send notice to list of rejected domains.

reject_domains:

driver = redirect

# RBL Blacklist incoming hosts

domains = +rbl_blacklist

allow_fail

data = :fail: Connection rejected: SPAM source $domain is manually blacklisted


Install RoundCube Webmail on Linux

Download location:

http://roundcube.net/download


Introduction

RoundCube is an excellent open source AJAX webmail client that makes older PHP webmail clients seem obsolete. It's easy to set up provided you already have a working LAMP server (Linux, Apache, MySQL, and PHP). RoundCube does also work with PostgreSQL or SQLite, but that is not covered by this HowTo. For PostgreSQL or SQLite, refer to the README and INSTALL contained in the RoundCube tarball (sorry).

The aim of this HowTo is to make installing and configuring RoundCube a trivial 5 minute process.


Preparation

Your Linux computer must be configured as a LAMP server first. To check if your box is ready, you can create a phpinfo file and place it in your Apache document root, and then open it with a browser. This is how:

cd /var/www/htdocs (or /var/www/html or wherever your document root is)
vi phpinfo.php

Paste this code, ensuring there are no additional spaces or carriage returns. Change the comma to a semi-colon and save and close.

Next navigate to http://localhost/phpinfo.php. If you can see a nicely formatted page (like this one), then you already have Apache configured with PHP! Scroll down the list and if you have a MySQL section, congratulations, your server is LAMP enabled and you ready to go! If you do not have a MySQL section, it means that your PHP was not compiled with the --with-mysql=/DIR switch. It's possible to install PHP with MySQL using packages (depending on your distro), or you might find it easier to remove Apache and PHP and follow a LAMP HowTo, like this one.

Once you have a working LAMP server, I would really recommend the use ofPHPMyAdmin or Webmin as a nice interface to MySQL, but that is not required for this tutorial.

Installing RoundCube
Check the
downloads page for the latest copy, and then download it to your box.

cd /var/www/htdocs
wget http://kent.dl.sourceforge.net/sourceforge/roundcubemail/roundcubemail-0.1beta2.tar.gz
tar zxfv roundcubemail-0.1beta2.tar.gz

Next we'll rename the folder to webmail and make some small changes to the permissions and the config files required for RoundCube to work.

Note: after completing extract change mode of given bellow files

mv roundcubemail-0.1beta2 webmail
chmod 777 webmail/logs
chmod 777 webmail/temp
mv webmail/config/db.inc.php.dist webmail/config/db.inc.php
mv webmail/config/main.inc.php.dist webmail/config/main.inc.php

Now to configure MySQL. Substitute password with a real password:

Note: Create Database from mysql

$rcmail_config['db_dsnw'] = 'mysql://DB_User:DB_Pass@localhost/DB_Name';

mysql
create database roundcubemail;
GRANT ALL PRIVILEGES ON roundcubemail.* TO roundcube@localhostIDENTIFIED BY 'password';
quit
mysql roundcubemail <>

The final step is to edit the config files to suit your environment.

vi webmail/config/db.inc.php

On the line starting $rcmail_config, change pass to the password you specified earlier.

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

Nothing else needs to be changed in this file for RoundCube to work.

vi webmail/config/main.inc.php

The commented lines explain what you need to change, but you only really need to edit a few of the lines to get RoundCube working. Namely, your IMAP server, this can be your ISP or webhost, or localhost:

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

Your domain name:

$rcmail_config['mail_domain'] = 'yourdomain.com';

Your SMTP Server, and the username and password for this server. If you're using "localhost", then a username and password is not normally required. However, if you relay mail through your ISP, you will need to specify a username and password here.

$rcmail_config['smtp_server'] = 'mail.yourisp.com';
$rcmail_config['smtp_user'] = 'your_username';
$rcmail_config['smtp_pass'] = 'your_password';

If your IMAP server is on the same box as your RoundCube installation, it's a good idea to set caching to FALSE. If this is left to TRUE it can cause a known issue with the inbox not displaying the right number of messages.

$rcmail_config['enable_caching'] = FALSE;

You can save and close at this point, but before you do, have a look through the rest of the config file just to familiarise yourself with the workings of these files.

That's it - RoundCube is ready. Point your browser to http://localhost/webmailand you can now log in with your IMAP username and password.

Note: After complete installation please move installer folder to back of public_html or create new fodder and move in it