티스토리 뷰

CONFIGURING MAIL SERVER . SENDMAIL

 

 

Basically, the following main components are forming mail server.

MUA (MAIL USER AGENT ) : The email application that a user sends/receives

MTA (MAIL TRANSFER AGENT) : The server agent that responds to send request from user

MDA (MAIL DELIVERY AGENT) : The server agent also that receives email from MTA and deliver to users mail box MRA (MAIIL RETRIEVAL AGENT) : The server agent that send to user2 from mail box

SMTP (SIMPLE MAIL TRANSPORT PROTOCOL) : Protocal sends when client request and also receives between mail server

POP3 (POST OFFICE PROTOCOL) : Protocol that sends to client from mailbox

IMAP (INTERNET MAIL ACCESS PROTOCOL) : Same as POP3

 

Goal : Configure Mail server and send mail to seungjun88@gmail.com (sent to Jay Lee)

which is my email.

 

Before we start, let's grab some overall ideas.

 

1. Source

Get source of sendmail.8.14.4 in tar.gz format. Place it in /usr/local/src directory.

Also, make sure remove pre-installed sendmail package by check those with 'rpm -qa | grep sendmail' .

 

2.  There will be no configuration, but only make and make install.

We got to do some works before run make and make install. If you just start make install, it will gives you error, saying

"install: cannot create regular file '/usr/man/man8/smrsh.8':

'install: cannot create regular file '/usr/man/man1/vacation.1":

'install: cannot create reuglar file '/usr/man/man1/aliases.5':

Thus... react to this..

such errors can be fixed by simply making a directories, which are man8,man1 and man5 in /usr/man directory.

then now try again with make and make intall. it will work properly this time.

 

3. /usr/local/src/sendmail-8.14.4/cf/cf

new directories have been created after make install. 'cf/cf' what are those for?

cf/cf directory is not an absolute path, it can be loacated vary from system to system..

Inside of 'cf/cf' directory, you will see generic-linux.mc file which is linux version, and also other source file in 'mc' extensions with different operating system. Files ending .mc, stands for `M4 configuration' are the input descriptions and the corresponding .cf file is the output descriptions. Meaning that we need .mc configuration file

to generate the .cf file. Assume that we are using linux system, generic-lunux.mc file is approprioate to us. Name it as 'sendmail.mc' file for use later on. If you have chance to see contents of generic-linux.mc file, keep an eye on DOMAIN ( generic ) dnl. The reason why we copy generic-linux.mc file is to create custom configurations which is  modified as sendmail.mc. Since we want to customize configuration, we need to add more contents on sendmail.mc file using FEATURE()dnl to make database files, redirection and to define alloawable users.

 

4. Generate sendmail.cf file

There are two ways to generate sendmail.cf; using 'Build' or using 'M4'. It's the matter of personal preference, so use whichever way you want. However, the latter method offers advantages when building a files. Such as when you tries to rebuild sendmail.cf file using 'Build" script, then it will gives error becuase Build does not reference changes in the domain file. To fix this problem, simply use M4 script or create a new .mc file and removes old .cf file. But like I said on previous, whichever you like to use is up to you.

Then how to generate sendmail.cf file. Compliling a 'Build sendmail.cf' means that the input file of sendmail.mc is used to create output file of sendmail.cf or use 'm4 (files) sendmail.mc > sendmail.cf' to create sendmail.cf.

Once you are done creating a new sendmail.cf, it has to be placed on proper location to be used by sendmail, where is /etc/mail directory. But.. instead of copying it to the location, you also need to ensure that 'submit.cf' file is installed. It is important configuration file as well as sendmail.cf for the purpose of submit a mail. So to work on both things at once, use 'Build install-cf', then it will set the location and also install.  

 

5. Managing Access and Aliases

Managing the access databse allows selected users to accept mail and relay mail for. Also it makes a blaklist for spammers by denying them. Access must be generated as database, so it is recognizable by sendmail. In order to do that, we already features access database which has declraed in sendmail.mc configuration file, also need to generated using 'makemap' becuase access database is a map. There are some options in 'makemap', but adequate option for us is 'hash' depends on the type of database. So it will be 'makemap hash'  and you need to generate this everytime when access file is updated.

Any modification of aliases file also will not informs changes to sendamil because the server agent that responds to tranfer of mail, called MTA does not refer to aliases file directly, but instead aliases.db. Thus 'newaliases' command should be executed after any modification in alises file.

 

6. Run Sendmail

 

 

 

 

 

#Since we have handled detailed precedure above, I won't comment additional explanation here.

 

Procedure

1. Download source and compile it.

usr/local/src]#wget ftp://ftp.sendmail.org/pub/sendmail/sendmail.8.14.4.tar.gz

usr/local/src]#tar zxf sendmail.8.14.4.tar.gz

 

 

2. Get prepared to execute make; make install

]#mkdir /usr/man; mkdir /usr/man/man1; mkdir /usr/man/man5; mkdir /usr/man/man8

 

 

]# make; make install  

 

 

 

3. Modify the configuration file; sendmail.mc

]# cd /usr/local/src/sendmail-8.14.4/cf/cf

 

 

]# mv generic-linux.mc sendmail.mc

 

 

 

]#vi sendmail.mc

FEATURE(access_db)dnl

FEATURE(virtusertable, btree /etc/mail/domainaliases.db)dnl

FEATURE(genericstable, btree /etc/mail/useraliases.db)dnl

FEATURE(accept_unqualified_senders)dnl

 

 

 

 

 

 

CAREFUL!!! FEATURE SHOULD BEFORE MAILER

 

 

 

4. Building sendmail.cf from sendmail.mc

/cf/cf]# m4 ../m4/cf.m4 sendmail.mc > sendmail.cf

        ]# sh Build install-cf

 

 

 

 

5. Modifing access

 

 

]#vi access

172.16.7.216   RELAY

 

 

 ]#makemap hash access < access

 

 

6. Modifying aliases

]#whereis aliases

]#cp /etc/aliases /etc/mail/aliases; cp /etc/aliases.db /etc/mail/aliases

 

 

]#newaliases

 

 

 7. Run Sendmail

]#/usr/sbin/sendmail -Ac -q3h

]#/usr/sbin/sendmail -bd -q3h

]#ps -ef | grep sendmail

 

 

 

 

8. Let's play with sendmail server

]#telnet localhost25

mail from : testsendmail@hahahoho.com

 

rcpt to : sengjun88@gmail.com

 

subject : wassup dog

 

data

how are you doing

bye

.

 

 

 

9. Let's check out on my gmail.com

 

 

 

 

Fun? Easy? Keep it up!!

 

 

 

 

 

공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
TAG
more
«   2024/12   »
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30 31
글 보관함