Thursday, 7 July 2011

SquirrelMail Webmail Setup Howto for RHEL/CentOS 6

SquirrelMail is an open source standards-based webmail package written in PHP. When installed, SquirrelMail is ready out of the box. All it needs is an installed web server like Apache, SMTP server like Postfix, and IMAP server like Dovecot.

Installing SquirrelMail

yum install squirrelmail2. Install squirrelmail using the command below.
yum install squirrelmail
Service Configuration3. Start the httpd service. Learn how to start and stop services here.

Configuring SquirrelMail

SquirrelMail Configuration1. Launch the SquirrelMail Configuration utility using the command below.
/usr/share/squirrelmail/config/conf.pl
NoteIf your Terminal window has a white background, make sure that the colors are off by looking for the command Turn color on. If the command is Turn color off, type in C and press Enter to turn the colors off. This will ensure that you will be able to read all of the text.
SquirrelMail Configuration2. Type in D and press Enter to select the Set pre-defined settings for specific IMAP servers menu. Type in dovecot and press Enter.
SquirrelMail Configuration3. Type in 2 and press Enter to select the Server Settings menu.
SquirrelMail Configuration4. Type in 1 and press Enter to select the Domain menu. Type in your domain name and press Enter. Save your changes and quit when you are done.
setsebool httpd5. Type the commands below to enable SquirrelMail to function properly under SELinux.
setsebool httpd_can_network_connect on
setsebool httpd_can_sendmail on
NoteI recommend installing the Retrieve User Data plugin so the user’s name will appear whenever he or she sends an email in SquirrelMail.

Testing SquirrelMail

Firefox1. Click the browser icon at the top near the System menu to launch the Firefox web browser.
SquirrelMail configtest2. In the address box, type in http://localhost/webmail/src/configtest.php and press Enter. Check for any errors.
SquirrelMail3. In the address box, type in http://localhost/webmail and press Enter. Type in a valid username and password and click Login.
SquirrelMail3. That’s it, it’s working.
NoteIf you encounter any problems, check the log file at /var/log/maillog.
 

Relocating SquirrelMail into the domain root

By default, SquirrelMail is located in the /webmail of your domain. If you prefer to access SquirrelMail from the root of your domain, follow the steps below.
Edit SQRoot.conf
1. Create the file /etc/httpd/conf.d/sqroot.conf containing the lines below.
<VirtualHost *:80>
DocumentRoot /usr/share/squirrelmail
</VirtualHost>
NoteIf you are using SSL and you want to force users to use SSL, add the Redirect directive inside the VirtualHost section to redirect browsers to the secured version. See the example below.
redirect permanent / https://mail.acme.local
Service Configuration2. Restart the httpd service. Learn how to restart services here.
SquirrelMail3. Now try browsing http://localhost

Wednesday, 6 July 2011

Postfix SMTP Authentication and Dovecot SASL for RHEL/CentOS 6

SMTP Authentication (SMTP Auth) provides an access control mechanism that can be used to allow legitimate users to relay mail while denying relay service to unauthorized users, such as spammers.

Configure Postfix and Dovecot

Edit dovecot 10-master.conf
1. Edit the file /etc/dovecot/conf.d/10-master.conf and make sure your service auth section has the lines below.
service auth { 
  unix_listener /var/spool/postfix/private/auth {
 mode = 0666
 user = postfix
 group = postfix
  } 
}
Edit dovecot 10-auth.conf
2. Edit the file /etc/dovecot/conf.d/10-auth.conf and update the line below.
auth_mechanisms = plain login
Edit main.cf3. Edit /etc/postfix/main.cf, find the keys below and change its values as follows or add it at the bottom of the file if the key (the word before the = sign) cannot be found.
mynetworks = 127.0.0.0/8
smtpd_sasl_type = dovecot
smtpd_sasl_path = private/auth
smtpd_sasl_auth_enable = yes
smtpd_recipient_restrictions =  permit_mynetworks, 
    permit_sasl_authenticated, 
    reject_unauth_destination
broken_sasl_auth_clients = yes
The first line says trust only localhost, meaning only localhost can send email outside the network (relay). The last line is there to support old clients like Microsoft Outlook Express 4.0 and Microsoft Exchange 5.0 just in case someone is still using it.
 
Lines starting with # are comments. Save the file after completing your changes.
 
Install postfixdovecotsasl.te4. Configure SELinux using the commands below. Here’s the content of postfixdovecotsasl.te
wget linuxmail.info/files/rhel6/postfixdovecotsasl.te
checkmodule -M -m -o postfixdovecotsasl.mod postfixdovecotsasl.te
semodule_package -o postfixdovecotsasl.pp -m postfixdovecotsasl.mod
semodule -i postfixdovecotsasl.pp
Service Configuration5. Restart the Dovecot and Postfix service. But if you installed MailScanner, restart MailScanner instead of Postfix. Learn how to restart services here.

Test Postfix

TerminalIn a Terminal window, type in the highlighted commands below.
Sample postfix session
[root@mail ~]# telnet mail smtp
ImportantReplace mail with the name of your server. We should not use localhost since localhost is a trusted client ip address. And make sure the domain name you specified does not resolve to 127.0.0.1 which is the IP address of localhost.
Trying 192.168.0.1...
Connected to mail.acme.local (192.168.0.1).
Escape character is '^]'.
220 mail.acme.local ESMTP Postfix
ehlo localhost
250-mail.acme.local
250-PIPELINING
250-SIZE 10240000
250-VRFY
250-ETRN
250-AUTH LOGIN PLAIN
250-AUTH=LOGIN PLAIN
250-ENHANCEDSTATUSCODES
250-8BITMIME
250 DSN
Note the new 250-AUTH lines. See the old SMTP Telnet Test.
mail from:<johndoe>
250 2.1.0 Ok
rcpt to:<test@example.com>
554 5.7.1 <test@example.com>: Relay access denied
It works, now to check if we can send it after authenticating.
auth plain AGpvaG5kb2UAcGFzc3dvcmQ=
235 2.0.0 Authentication successful
rcpt to:<test@example.com>
250 2.1.5 Ok
quit
221 2.0.0 Bye
Connection closed by foreign host.
[root@mail ~]#
NoteYou can send to email addresses belonging to your domain without authentication. This is normal as it enables you to receive mail from the outside.
The gibberish text after AUTH PLAIN is the base64 encoded value of the user name johndoe and password password. You can generate your own base64 text using the form
click here:

If you encounter any problems, check the log file at /var/log/maillog.

**********Thanks regards cnuvasan*****************

Tuesday, 5 July 2011

Dovecot POP3/IMAP Server Setup Howto for RHEL/CentOS 6

Installing and setting up Dovecot in Red Hat Enterprise Linux 6 or CentOS 6 is easy. All we have to do is to enable the services we would like to provide and we are good to go.

Monday, 4 July 2011

Postfix SMTP Server Setup Howto for RHEL/CentOS 6

Installing and setting up Postfix SMTP Server in Red Hat Enterprise Linux 6 or CentOS 6 is easy. Postfix has secure default settings so we just need to open it up a bit.

Configure Postfix:

1. Edit the file /etc/postfix/main.cf and update the lines below.

inet_interfaces = all
mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain
home_mailbox = Maildir/ 
 
In main.cf, lines starting with # are comments. Save the file after completing your changes.
NoteMake sure that all mail_spool_directory lines are commented out. Otherwise, it will override the setting in the home_mailbox line above.
Service Configuration2. Restart the postfix service. Learn how to restart services here.

Test Postfix

Terminal1. Click Applications, select System Tools, and click Terminal. This will launch the Terminal window.
Terminal2. In the Terminal window, type in the highlighted commands below.
Sample postfix session. Replace johndoe with any valid user account. The dot after the line test is a command that should be typed in.
NoteIf you need to add new user accounts, learn how to add or remove user accounts here.
[root@mail ~]# telnet localhost smtp
Trying 127.0.0.1...
Connected to localhost.localdomain (127.0.0.1).
Escape character is '^]'.
220 mail.acme.local ESMTP Postfix
ehlo localhost
250-mail.acme.local
250-PIPELINING
250-SIZE 10240000
250-VRFY
250-ETRN
250-ENHANCEDSTATUSCODES
250-8BITMIME
250 DSN
mail from:<johndoe>
250 2.1.0 Ok
rcpt to:<johndoe>
250 2.1.5 Ok
data
354 End data with <CR><LF>.<CR><LF>
test
.
250 2.0.0 Ok: queued as 9729067C17
quit
221 2.0.0 Bye
Connection closed by foreign host.
[root@mail ~]#

To check if the mail indeed exists
[root@mail ~]# cd /home/johndoe/Maildir/new
[root@mail new]# ls
1185669817.Vfd00I18012M795756.mail.acme.local
[root@mail new]# cat 1185669817.Vfd00I18012M795756.mail.acme.local
Don’t worry, you don’t have to type in the whole filename above. Just type in the first few characters say 118 then press Tab to activate automatic completion.
From johndoe@mail.acme.local  Thu Feb 22 21:48:28 2007
Return-Path: <johndoe@mail.acme.local>
X-Original-To: johndoe
Delivered-To: johndoe@mail.acme.local
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
        by mail.acme.local (Postfix) with SMTP id 9729067C17
        for <johndoe>; Thu, 22 Feb 2007 21:48:26 -0500 (EST)
Message-Id: <20070222134827.9729067C17@mail.acme.local>
Date: Thu, 22 Feb 2007 21:48:26 -0500 (EST)
From: johndoe@mail.acme.local
To: undisclosed-recipients:;

test

[root@mail mail]#
NoteIf you encounter any problems, check the log file at /var/log/maillog.
NoteReview your Postfix aliases configuration file. There are some predefined email aliases that might conflict with your existing mail accounts like sales, marketing, info, etc.

 ******************ALL THE BEST  *******cnu

Sunday, 3 July 2011

RHEL6 openldap server configuration step by step

Step 1: first we need to install the required packages:

#yum install openldap-servers migrationtools

Step2: As the configuration for LDAP is stored inside the LDAP server itself the configuration has to be done by editing LDIF files under the /etc/openldap/slapd.d/ directory.

Now create the ldap password:

#slappasswd

you’ll get something like this ”{SSHA}r2or9f2vYlvieCu0LP6wTnSdYfrddsuV” as a result. This is the string we will have to add to the bdb.ldif config file.

# vim /etc/openldap/slapd.d/cn\=config/olcDatabase\=\{1\}bdb.ldif

substitute my-domain.com with yourdomain.com

:%s/dc=my-domain,dc=com/dc=yourdmain,dc=com/g


Step 3: We now  set the admin password and specify the location of our encryption certificate and key.

add these 3 lines at the end of the file bdb.ldif file:

olcRootPW: {SSHA}r2or9f2vYlvieCu0LP6wTnSdYfrddsuV
olcTLSCertificateFile: /etc/pki/tls/certs/slapdcert.pem
olcTLSCertificateKeyFile: /etc/pki/tls/certs/slapdkey.pem

Step 4: Now we have to specify the monitoring privileges

#vim /etc/openldap/slapd.d/cn\=config/olcDatabase\=\{2\}monitor.ldif

again, we have to replace the default domain name with our domain name

:%s/cn=manager,dc=my-domain,dc=com/cn=Manager,dc=yourdomain,dc=com/g

Step 5: Now its time for the Database Cache

#updatedb
#cp /usr/share/doc/openldap-servers-2.4.19/ DB_CONFIG.example /var/lib/ldap/DB_CONFIG
#chown -Rf ldap:ldap /var/lib/ldap/

Step 6: Now we will need to set up a certificate for TLS. First we need to edit /etc/sysconfig/ldap and change SLAPD_LDAPS from no to yes.

#vi /etc/sysconfig/ldap
SLAPD_LDAPS=yes

Now we can create the certificate

#openssl req -new -x509 -nodes -out /etc/pki/tls/certs/slapdcert.pem -keyout /etc/pki/tls/certs/slapdkey.pem -days 365

This will create the two required keys in the /etc/pki/tls/certs/ directory. We need to make them readable for the ldap user.

# chown -Rf root:ldap /etc/pki/tls/certs/$cert.pem
# chmod -Rf 750 /etc/pki/tls/certs/$key.pem

Step 7: Time to test our configuration

# slaptest -u

config file testing succeeded

Step 8:  Start the ldap server

#service sladp start

lets check if our ldap server really works:

#ldapsearch -x  -b ”dc=yourdomain,dc=com”

if you get a search: 2 then your on track!

Step 9: Configure the base domain

#vi base.ldif
dn: dc=yourdomain,dc=net
dc: yourdomain
objectClass: top
objectClass: domain
dn: ou=People,dc=yourdomain,dc=net
ou: People
objectClass: top
objectClass: organizationalUnit
dn: ou=Group,dc=yourdomain,dc=net
ou: Group
objectClass: top
objectClass: organizationalUnit

now we import our base information to the ldap directory:

#ldapadd -x -W -D ”cn=Manager,dc=yourdomain,dc=com” -f base.ldif

Step 10: lets migrate the users

Go to the directory /usr/share/migrationtools. Edit the file
# vim /usr/share/migrationtools/migrate_common.ph
Set:

# Default DNS domain
$DEFAULT_MAIL_DOMAIN = ”yourdomain.com”;
# Default base
$DEFAULT_BASE = ”dc=yourdomain,dc=com”;
#grep ”:5[0-9][0-9]” /etc/passwd > passwd
#grep ”:5[0-9][0-9]” /etc/group > group
#./migrate_passwd.pl passwd > users.ldif
#./migrate_group.pl group > group.ldif
#sed -e ”s/ou=Group/ou=Groups/g” group.ldif > groups.ldif
ldapadd -x -W -D ”cn=Manager,dc=yourdomain,dc=com” -f users.ldif
ldapadd -x -W -D ”cn=Manager,dc=yourdomain,dc=com” -f groups.ldif

Step 11: Testing the ldap server. We check if user mani exists
#ldapsearch -x ”cn=mani”  -b ”dc=mycompany,dc=com”


If the test is successful your done :)

************************All The Best*******************regards cnuvasan

Wednesday, 8 June 2011

Static ip block list checking link and importent:

When you  bay new static ip from any ip providers,

first you check ip Block list"

if you plan to configure DNS & mail Server means we must check that static ip block list

here i give some usefull link for ip block list check

http://whatismyipaddress.com/blacklist-check

you must remove from this block listed other wise your mail server didt work correct manner...

 note: removal option will get from click on the red color listed domains

*********************ALL The BEST************************* 

Wednesday, 25 May 2011

Examples to Backup Linux Using dd Command (Including Disk to Disk)

Data loss will be costly. At the very least, critical data loss will have a financial impact on companies of all sizes. In some cases, it can cost your job. I’ve seen cases where sysadmins learned this in the hard way.

There are several ways to backup a Linux system, including rsync and rsnapshot that we discussed a while back.

This article provides 6 practical examples on using dd command to backup the Linux system. dd is a powerful UNIX utility, which is used by the Linux kernel makefiles to make boot images. It can also be used to copy data. Only superuser can execute dd command.

Warning: While using dd command, if you are not careful, and if you don’t know what you are doing, you will lose your data!

Example 1. Backup Entire Harddisk 

To backup an entire copy of a hard disk to another hard disk connected to the same system, execute the dd command as shown below. In this dd command example, the UNIX device name of the source hard disk is /dev/hda, and device name of the target hard disk is /dev/hdb.

# dd if=/dev/sda of=/dev/sdb

“if” represents inputfile, and “of” represents output file. So the exact copy of /dev/sda will be available in /dev/sdb.
If there are any errors, the above command will fail. If you give the parameter “conv=noerror” then it will continue to copy if there are read errors.
Input file and output file should be mentioned very carefully, if you mention source device in the target and vice versa, you might loss all your data.

In the copy of hard drive to hard drive using dd command given below, sync option allows you to copy everything using synchronized I/O.

# dd if=/dev/sda of=/dev/sdb conv=noerror,sync 

Example 2. Create an Image of a Hard Disk

Instead of taking a backup of the hard disk, you can create an image file of the hard disk and save it in other storage devices.There are many advantages to backing up your data to a disk image, one being the ease of use. This method is typically faster than other types of backups, enabling you to quickly restore data following an unexpected catastrophe.

# dd if=/dev/hda of=~/hdadisk.img

The above creates the image of a harddisk /dev/hda. Refer our earlier article How to view initrd.image for more details.

Example 3. Restore using Hard Disk Image

To restore a hard disk with the image file of an another hard disk, use the following dd command example.

# dd if=hdadisk.img of=/dev/hdb

The image file hdadisk.img file, is the image of a /dev/hda, so the above command will restore the image of /dev/hda to /dev/hdb. 

Example 4. Creating a Floppy Image 

Using dd command, you can create a copy of the floppy image very quickly. In input file, give the floppy device location, and in the output file, give the name of your floppy image file as shown below.

# dd if=/dev/fd0 of=myfloppy.img 

Example 5. Backup a Partition

You can use the device name of a partition in the input file, and in the output either you can specify your target path or image file as shown in the dd command example below.

# dd if=/dev/hda1 of=~/partition1.img 

Example 6. CDROM Backup

dd command allows you to create an iso file from a source file. So we can insert the CD and enter dd command to create an iso file of a CD content.

# dd if=/dev/cdrom of=tgsservice.iso bs=2048

dd command reads one block of input and process it and writes it into an output file. You can specify the block size for input and output file. In the above dd command example, the parameter “bs” specifies the block size for the both the input and output file. So dd uses 2048bytes as a block size in the above command.

Note: If CD is auto mounted, before creating an iso image using dd command, its always good if you unmount the CD device to avoid any unnecessary access to the CD ROM. 

Friday, 6 May 2011

how many domains available under server or any webhost company clients:

This will help full for find our server clients


ex:

http://www.sitedossier.com/ip/1.2.3.4/


just chage that ip:1.2.3.4