Unix tutorial Contact as


Download Opera



Setting Up the Sendmail on FreeBsd or Linux

First of all you should download the source code of sendmail:

If you use the FreeBSD-STABLE and CVSup, very likely that you have the last version of sendmail and
you can omit the installation steps.

# mkdir /usr/local/src
# cd /usr/local/src
# ftp -i ftp.sendmail.org
Connected to ftp.sendmail.org.
220 pub1.pa.vix.com FTP server (Version wu-2.4(1) Fri Dec 29 06:15:49 GMT 1995) ready.
Name (ftp.sendmail.org:unknow): anonymous
331 Guest login ok, send your e-mail address as password.
Password: ozz@
230 Guest login ok, access restrictions apply.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp> cd /pub/sendmail
ftp> bin
200 Type set to I.
ftp> hash
Hash mark printing on (1024 bytes/hash mark).
ftp> lcd /usr/local/src
Local directory now /usr/local/src
ftp> get sendmail.8.9.3.tar.gz
.........................
ftp>

Unpack the sendmail:
# cd /usr/local/src
# tar xvfz sendmail.8.9.3.tar.gz
# cd /usr/local/src/sendmail-8.9.3

Make the sendmail-8.9.3:
# cd /usr/local/src/sendmail-8.9.3
# make

Install the sendmail-8.9.3:
# cd /usr/local/src/sendmail-8.9.3
# make install

Nw we will perform the configuration of the sendmail-8.9.3.
The directory /usr/local/src/sendmail-8.9.3/cf/cf contain the some basic sendmail configuration files.

Edit the configuration file:
divert(-1)
#
# Copyright (c) 1998 Sendmail, Inc. All rights reserved.
# Copyright (c) 1983 Eric P. Allman. All rights reserved.
# Copyright (c) 1988, 1993
# The Regents of the University of California. All rights reserved.

divert(0)dnl
VERSIONID(`@(#)domain_name.mc 1.0 (Berkeley) 5/30/98')
OSTYPE(bsd4.4)dnl
DOMAIN(generic)dnl
FEATURE(use_cw_file)dnl
FEATURE(access_db, hash -o /etc/mail/access)dnl
FEATURE(virtusertable, hash -o /etc/virtusertable)dnl
FEATURE(mailertable, hash -o /etc/mailertable)dnl
FEATURE(relay_entire_domain)dnl
FEATURE(stickyhost)dnl
FEATURE(nouucp)
FEATURE(relay_based_on_MX)dnl
MAILER(local)dnl
MAILER(smtp)dnl
define(`confMAX_MESSAGE_SIZE',`1500000')
define(`confDELIVERY_MODE',`queue')
define(`confMAX_HOP',`20')
define(`confPRIVACY_FLAGS',`authwarnings,needmailhelo,needexpnhelo,needvrfyhelo,noexpn,restrictmailq,restrictqrun')
define(`confQUEUE_LA',`64')
define(`confREFUSE_LA',`128')
define(`confMAX_DAEMON_CHILDREN',`25')
define(`confCONNECTION_RATE_THROTTLE',`5')
define(`confDEF_CHAR_SET',`koi8-r')
define(`confNO_RCPT_ACTION',`add-apparently-to')
define(`confMAX_RCPTS_PER_MESSAGE',`25')
define(`confDONT_BLAME_SENDMAIL',`forwardfileingroupwritabledirpath')
define(`confSMTP_MAILER',`esmtp')
define(`confSMTP_LOGIN_MSG',`$j Sendmail $v/$Z; $b\n"Use of this system for the delivery of UCE (a.k.a. SPAM), or any other"\n"message without the express permission of the system owner is prohibited."\n"Use of this system for third party relaying is prohibited." ')
define(`LUSER_RELAY',`local:postmaster')dnl
define(`VIRTUSER_CLASS', `T')
define(`VIRTUSER_ERR_NOUSER', 1)
LOCAL_RULESETS
# Kludgey Melissa virus checking routine.
# Just need enough of a pattern to match.
# Instructional note:
# The format for the rule is
# RExactly the thing you want to quote
# No quote marks, no tabs, absolutely nothing in
# parentheses (like this, they're considered comments
# and will be removed before they get to the rules).
# After the exact thing, then a tab, and the $#error.
# Note, the $* matches anything, so it's useful for
# wildcarding. This also scans all messages with
# Subject: headers and invokes a rule, so there is
# a performance hit.

HSubject: $>Check_Subject
D{MPat}Important Message From
D{MMsg}This message may contain the Melissa virus.

SCheck_Subject
R${MPat} $* $#error $: 553 ${MMsg}
RRe: ${MPat} $* $#error $: 553 ${MMsg}


Attention! To minimize the spam messages inside the your domain, you should remove the following line:


FEATURE(relay_entire_domain)dnl

and create the file /etc/mail/relay-domains. This file will contain the hosts for mail messages redirection. Save this file as config.mc.

Now we will create the sample script with name m4.run:

#!/bin/csh
setenv CFDIR /usr/src/contrib/sendmail/cf
m4 -D_CF_DIR=${CFDIR}/ ${CFDIR}/m4/cf.m4 config.mc > config.cf


As result we will have the basic configuration file named config.cf for sendmail-8.9.3. Now you should rename this file to sendmail.cf, copy to /etc directory and restart sendmail.

To protect your senmail server from spammers you can use the following steps:
Yuo can create the text files /etc/mail/access.db with following lines:

hawaiitropicalflowers.com REJECT
imarket2001.net REJECT
209.101.230 REJECT

Now you should perform the following commands:
# cd /etc/mail
# /usr/sbin/makemap hash access < /etc/mail/access

This commands will crate the file /etc/mail/access.db in sendmail format.



Comments/Feedback

If you have specific suggestions for changes, corrections, and additions to this article please use the comment form below.



Back to main page


Copyright © 2003-2016 The UnixCities.com
All rights reserved