Showing posts with label SendMail. Show all posts
Showing posts with label SendMail. Show all posts

Friday, February 17, 2012

Configuring sendmail


Files and Directories
Explanation
/ Usr / sbin / sendmail
Sendmail daemon
/ Usr / bin / makemap
Map generation files (access, virtususer registration)
/ Usr / bin / nealiases
alias file to create the DB
/ Usr / lib / sendmail
Sendmail daemon (/ usr / sbin / sendmail and link)
/ Var / spool / mqueue
Kyudirektori (mail temporary storage directory)
/ Var / spool / mail
-
/ Etc / mail / access
Relay restrictions and configuration files
/ Etc / mail / aliases
alias configuration file
/ Etc / mail / domaintable
Domain registration file table
/ Etc / mail / local-host-names
JS ChoiShinji configuration file
/ Etc / mail / sendmail.cf
-
/ Etc / mail / sendmail.cw
JS ChoiShinji configuration file (old version)
/ Etc / mail / virtusertable
Virtual-mail address, the register file
/ Etc / rc.d / init.d / sendmail
Sendmail startup and shutdown scripts (rpm installation)
/ Etc / sysconfig / sendmail
Sendmail configuration files at runtime execution options
/ Var / log / sendmail.st
Sendmail executable file, the situation



# Rpm installation è sendmail, sendmail-CF, m4 Verifying the Installation
# Chkconfig sendmail on
# Service sendmail restart
# Pgrep sendmail

# Vi post-edit-sendmail -> things need to change the configuration of sendmail script
#! / Bin / bash
cd / etc / mail
make
newaliases
/ Etc / init.d / sendmail restart è put up for practice. Sednmail.mc usually does not change the file does not need to be restarted.  service is not a good idea in your server
  Nowadays simple / etc / mail / directory, run "make" when you access and changes, including the virtusertable file allows all of the applicable. And if it does not generate sendmail.cf restart sendmail daemon does not need to.
# Chmod 700 post-edit-sendmail

# Vi / etc / resolv.conf
domain my-site.com -> Make sure that your mail server matches the domain of
nameserver 192.168.1.100 -> Mail Server acts as a DNS client, so make sure

# Vi / etc / hosts
Bigboy.my-site.com 127.0.0.1 localhost.localdomain localhost bigboy è / etc / hosts file, so make sure the DNS client settings in

# Vi / etc / mail / sendmail.mc
-          dnl DAEMON_OPTIONS ('Port = SMTP, Addr = 127.0.0.1, Name = MTA') è rokeolhoseuteuman rather than listen to listen on all interfaces are commented out.

-          FEATURE ('accept_unresolvable_domains') dnl è does not exist in order to block spam mail coming from the domain will be accepted (553 error) to handle the comment. If you do not uncomment the sender's domain without checking mail Relay permits.

    Note that with multiple NIC and accept a specific NIC, if ten thousand local interface settings as shown below, without commenting further stated the address of the NIC to accept a row is added.
DAEMON_OPTIONS ('Port = smtp, Addr = 127.0.0.1, Name = MTA')
DAEMON_OPTIONS ('Port = smtp, Addr = 192.168.1.100, Name = MTA')

-            dnl define ('SMART_HOST', 'mail.my-site.com') -> This is not necessary.

※ Anti-Spam SMTP authentication settings for
: Access the DRAC IP address based on the other hand, this configuration allowed RELAY ID / PASS to allow RELAY. Only use this configuration file, RELAY to allow access to the IP address is deleted.

# Vi / etc / mail / sendmail.mc
dnl TRUST_AUTH_MECH (`EXTERNAL DIGEST-MD5 CRAM-MD5 LOGIN PLAIN ') dnl
dnl define (`confAUTH_MECHANISMS ',` EXTERNAL GSSAPI DIGEST-MD5 CRAM-MD5 LOGIN PLAIN ') dnl
-> In the above "TRUST_AUTH_MECH" remove the comment lines that begin with the following makes.
TRUST_AUTH_MECH (`EXTERNAL DIGEST-MD5 CRAM-MD5 LOGIN PLAIN ') dnl
define (`confAUTH_MECHANISMS ',` EXTERNAL GSSAPI DIGEST-MD5 CRAM-MD5 LOGIN PLAIN ') dnl
# M4. / Sendmail.mc>. / Sendmail.cf
# / Etc / rc.d / init.d / sendmail restart

"Client Settings>
client1.JPG


# M4 / etc / mail / sendmail.mc> / etc / mail / sendmail.cf
# Service sendmail restart
    Check the sendmail.cf configuration file - after checking to change the settings that you change mc file instead of cf
# Vi / etc / mail / sendmail.cf
AliasFile = / etc / aliases è file path "/ etc / mail / aliases" If you modify a
MaxMessageSize = ten million è maximum mail size 10000000bytes (10MB) is limited to
Sendmail SmtpGreetingMessage = $ J $ v / $ Z; $ b è twenty-five welcome message when connecting to port. $ V / $ Z REQUIREMENTS


# Vi / etc / mail / Relay-Domains  ->This is not generated by default, must be created manually. This file specifies the domain to allow relay for spammers to fake the source domain, because the possibility. Than this, but usually / etc / mail / access is commonly used.

# Vi / etc / mail / access -> REJECT match, where things are not.
localhost.localdomain        RELAY
localhost                                RELAY
127.0.0.1                                RELAY
192.168.1.16                         RELAY
192.168.2                               RELAY
My-site.com                          RELAY
spam.com REJECT                         -> Incoming / outgoing rejected
spamuser@spam.com             DISCARD  ->Discarded after they received mail. Do not dispose of the sender notification

-> If the access file and smtp authentication when used as hosts access files in a separate setting in Outlook smtp authentication is not required. Host names are also used here in / etc / hosts that uses / etc / hosts will be set well in advance.

# Cd / etc / mail
# Make -> / Etc / mail / access.db apply

Or

# Makemap hash / etc / mail / access.db
# Strings / etc / mail / access.db -> Confirmation

Reference
Domain Check and check all the access is set to determine if the first domain and sends an error code 553 does not exist. Check the domain is not set or if the next access.db be either present a list of domains to check if it is set to be rejected on the list, or 550 (relaying denied), and sends an error.

# Vi / etc / maill / local-host-names -> Domain and receive mail settings (if your old / etc / sendmail.cw used)
my-site.com
another-site.com
-> Note that this file name in the sendmail.cf file "Fw / etc / mail / local-host-names" reference

※ The procedure for the mail server to handle mail
A. / Etc / mail / local-host-names to make sure, if in receipt of a domain
Two. suryeongdoen mail forwarding in virtusertable
Three. Get on top of the alias or aliases if you are explicitly handled in
Four. As a local account set up forwarding all mail processing presence in the local reporting process

# Vi / etc / mail / virtusertable è suryeongdoen specify what to do with mail
@ My-site webmater                             Paul
webmater@another-site.com            Peter -> webmaster-mail accounts are available in two domains
@ Another-site.com                              Marc
sales@my-site.com                             sales@another-site.com
paul@my-site.com                              Paul
finance@my-site.com                         Paul
@ My-site.com                                      Error: User Unknown nouser
-> E-mail address of the destination, the first column, the second a local user mailboxes, remote mail box, / etc / aliases file, mailing lists can be. In other words, when the second column and match the destination e-mail is forwarded to the address.

# Cd / etc / mail
# Make

# Vi / etc / aliases  ->The first, called a virtual meilbakseura mailing list, and the second, separated by commas, are members of the mailing list. (Comma separated space shall be free at)
Mailer-daemon:                    postmaster
postmaster:                           root
Directors:                               Peter, Paul, Mary è there should be no spaces
Admin-list:                             ": include :/ Home / Mailings / Admin-list" -> Can be explicitly specified as

# Vi / home / mailings / admin-list
user1@my-site.com
user2@my-site.com
    aliases are handled in the order
       Check here first that sendmail sendmail mail without thinking of the local user's address is stored in the local user's mailbox.
       Check the mail in the first column of the second column the second column aliases Meant to be the first column of the second column, so be sure to first column that you are.
       Sendmail duplicate (first column, second column) confirmed that there is nothing, the local user sends e-mail.
# Newaliases

# Tail-f / var / log / maillog -> View Log

# Vi / etc / mail / sendmail.mc -> Public use spam blacklists
FEATURE ('dnsbl', 'ipwhois.rfc-ignorant.org', '"550 Mail from" $ & {client_addr} "ref .....
FEATURE ('... see the site
-> See the list of spam by various agencies that match will reject mail.

# M4 / etc / mail / sendmail.mc> / etc / mail / sendmail.cf
# Service sendmail restart

# Telnet 10.123.38.200 25
MAIL From: test@test.comRCPT To: recp@test.com
DATA
Test email
.
QUIT


<-To-use Spam Assassin>
: Sendmail receives mail messages in the mailbox of the user account that is actually placing the message is processed eungyongin procmail. Control of two procmail spam filter temporarily to other applications, such as to enable filtering can neomgieo. Spam Assassin Spam not erasing the 'smap' put the phrase in the title. Then, the mail client to see this phrase to suit the user's intent is to be configured to handle.

# Rpm-Uvh samassassin-2.60-2.i386.rpm
# Chkconfig - level 345 spamassassin on
# Service spamassassin start

# Cp / etc / mail / SpamAssassin / SpamAssassin-spamc.rc / etc / procmailrc  ->/ Etc / procmailrc file procmail procmail helper programs used to say what is the file. By default, the file is not generated automatically.

# Vi / etc / mail / SpamAssassin / local.cf  ->Spam Assassin configuration file. Local.cf file from the website that you can create a menu format. Find related websites.

# Spamassassin-d - lint ->Check local.cf file. If there is no more than the output
# Service spamassassin restart

- dovecot IMAP / POP server
# Chkconfig dovecot on
# Service dovecot restart
# Pgrep dovecot
# Vi / etc / dovecot.conf è By default, IMAP, IMAPS, POP, POPS uses both. A good idea to limit the protocol to use.
# Protocols = POP3 IMAP IMAPS POP3S -> commented out
POP3 protocols = è only explicit use
# Netstat-a | egrep-i 'pop | imap'
-> If you use pop3s 995 times in Outlook using the settings in order to use the Encrypted POP should be separate. Do not forget the firewall must be set.

"Change-mail source>
DMkldp.org   ☞ test@test.com mail is sent from. 
Note that if you send mail, if it does not recognize your own domain
# Dj $ w.Foo.COM the "Djtest.com" less as its domain, then rerun the daemon

Wednesday, August 17, 2011

Sendmail Spamming Prevention

Sendmail is defame for security holes. But this is also a fact that sendmail is one of popular MTA. Its not possible to avoid spamming through sendmail completely but yes sendmail can be configured in better way to limit spamming though it.


I am here discussing some of the options which can be useful in this context. Although this is a subjective discussion that these options are how much useful in different scenario.

confMAX_DAEMON_CHILDREN is one of such option in sendmail.mc which specify number of Daemon's children. But these children process can handle incoming and outgoing traffic both.

confMAX_QUEUE_RUN option specify how many queued message to process every time queue is run.

confQUEUE_LA and confREFUSE_LA options are also very useful. confQUEUE_LA limit at what system load mail will queued for later processing and confREFUSE_LA specify at what load sendmail will reject will (Even will not queue for later processing).

Friday, July 8, 2011

How to Disable or Enable open relay in sendmail

Sendmail 8.9 and above will disallows relaying by default. By default this will allow relaying from localhost only.
You can edit the sendmail access database  ( /etc/mail/access) and enable or disable open relay.
Default Configuration: 

#vim /etc/mail/access
Connect:localhost.localdomain           RELAY
Connect:localhost                       RELAY
Connect:127.0.0.1                       RELAY



You can use host name or ip address in the access database
youordomain.com               RELAY 
spam@buyme.com             550 Spammers not allowed
virus@virusdomain.com    DISCARD

10.10.10                              REJECT

To Reject Mail Form Particular Hoste

rejectserver.com                REJECT
10.10.2.2                             REJECT


Open Relay:
  Open Relay servers will be configured to relay all ip range
By adding the *.* entry in /etc/mail/access you can enable relay for all 

*.*         RELAY
Also by adding your domain name in the /etc/mail/relay-domains you can enable relay form particular domain server.
Now a days most of the mail servers will not allow mails from open relay servers.


To Disable OPEN Relay:
 By allowing relay from only your local ip range and localhost, you can disable the open relay.
127.0.0.1               RELAY
192.168.1              RELAY
If your server is configured with smtp auth or POP-before-SMTP, then you can remove all the relay entries (Even local ip range) in the access database.
It is always better to configure your server with smtp auth or POP-before-SMTP . This will be useful for roaming users also.

Also check /etc/mail/relay-domains and remove all the relay domains


In some cases relaying is allowed even though it isn't intended. This is because of the use of FEATURE(relay_entire_domain) which allows relaying for every system in class m. If class m is wrong, then the system may open up relaying for other hosts in that domain. You have to verify this
echo '$=m' | sendmail -bt -d0.4
Sometimes class m is set wrong to be just a TLD (e.g., com). In this case, fix your hostname to be host.sld.tld instead of sld.tld or change $m, or remove FEATURE(relay_entire_domain) and use other means instead

Open Relay Testing Websites:

http://www.abuse.net/relay.html
http://www.mob.net/~ted/tools/relaytester.php3
http://www.checkor.com/

MX Tool
http://www.mxtoolbox.com/

smtp authentication vs. pop before smtp