Wednesday, November 22, 2006
4:27 AM

Setting up your own SMTP and POP3 Mail Server

I used SendMail for SMTP and Qpopper for POP3.

Download and install the sendmail package if you don't have it

rpm -qa | grep -i sendmail

Start it and check if its running

/etc/init.d/sendmail start
ps aux | grep -i sendmail

change into the mail config directory and edit the settings
cd /etc/mail

add the following to sendmail.mc
TRUST_AUTH_MECH('LOGIN PLAIN')dnl
define('confAUTH_MECHANISMS', 'LOGIN PLAIN')dnl
define('confSMTP_LOGIN_MSG', '$j')dnl

Comment this line out so Sendmail will listen for remote connections.
DAEMON_OPTIONS('Port=smtp,Addr=127.0.0.1, Name=MTA')dnl.

Make the config
make -C /etc/mail

Check firewall settings to allow access to port 25. Also allow access to other systems on domain by adding relays to the following file

/etc/mail/access
jf.intel.com RELAY

Compile it
makemap hash /etc/mail/access < /etc/mail/access

Check that there is a service listning on 25 by doing a port scan and try to telnet to it remotely
nmap localhost
telnet tsrd-rhel4-1 25
quit

Add you domain to
cd /etc/mail
vi local-host-names
intel.com

Create accounts
useradd webmaster
passwd webmaster
[enter password]
[confirm password]

Associate users to their email addresses

vi virtusertable
webmaster@intel.com webmaster

Compile
makemap -v hash ./virtusertable.db < ./virtusertable

Restart service
/etc/init.d/sendmail restart

Setting up POP3
Download QPopper and compile it
./configure --prefix=/usr --mandir=/usr/share/man
make all
make install

Use xinitd to manage it
cd /etc/xinetd.d
vi qpopper
# qpopper POP3 server
service pop3
{
disable = no
flags = REUSE
socket_type = stream
wait = no
user = root
server = /usr/sbin/popper
instances = 50
per_source = 10
log_on_failure += USERID
}

restart init.d
/etc/init.d/xinetd restart

check if the service is running on 110
nmap localhost

Check your mail
telnet localhost 110
user [account name]
pass [account password]

0 comments:

Post a Comment