/*****     SENDMAIL SMTP AUTH     *****/


# ftp://ftp.openssl.org/source/
# openssl-0.9.6d.tar.gz

$ gzip -dc openssl-0.9.6d.tar.gz | tar vxf -
$ cd openssl-0.9.6d
$ ./config
$ make
$ make test
$ make install


# ftp://ftp.pdc.kth.se/pub/krb/src/
# krb4-1.1.1.tar.gz

$ gzip -dc krb4-1.1.1.tar.gz | tar vxf -
$ cd krb4-1.1.1
$ ./configure
$ make
$ make install


# ftp://ftp.andrew.cmu.edu/pub/cyrus-mail/
# cyrus-sasl-2.1.2.tar.gz

$ gzip -dc cyrus-sasl-2.1.2.tar.gz | tar vxf -
$ cd cyrus-sasl-2.1.2
$ ./configure
$ make
$ make install


$ cd /usr/lib/sasl          
$ touch Sendmail.conf
$ vi Sendmail.conf

pwcheck_method: shadow


# ftp://ftp.sendmail.org/pub/sendmail/
# sendmail.8.12.3.tar.gz

$ gzip -dc sendmail.8.12.3.tar.gz | tar vxf -
$ cd sendmail.8.12.3/devtools/Site
$ vi site.config.m4

APPENDDEF(`confENVDEF', `-DSASL')
APPENDDEF(`conf_sendmail_LIBS', `-lsasl')
APPENDDEF(`confLIBDIRS', `-L/usr/lib')
APPENDDEF(`confINCDIRS', `-I/usr/include')


$ cd ../../
$ sh Build

$ cd cf/cf/
$ vi generic-linux.mc

divert(-1)
#
# Copyright (c) 1998, 1999 Sendmail, Inc. and its suppliers.
#       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.
#
# By using this file, you agree to the terms and conditions set
# forth in the LICENSE file which can be found at the top level of
# the sendmail distribution.
#
#

#
#  This is a generic configuration file for Linux.
#  It has support for local and SMTP mail only.  If you want to
#  customize it, copy it to a name appropriate for your environment
#  and do the modifications there.
#

divert(0)dnl
VERSIONID(`$Id: generic-linux.mc,v 8.1 1999/09/24 22:48:05 gshapiro Exp $')
OSTYPE(linux)dnl
DOMAIN(generic)dnl
FEATURE(access_db)dnl
FEATURE(`mailertable', `hash /etc/mail/mailertable')dnl
FEATURE(`virtusertable',`hash /etc/mail/virtusertable')dnl
MAILER(local)dnl
MAILER(smtp)dnl
TRUST_AUTH_MECH(`LOGIN PLAIN DIGEST-MD5 CRAM-MD5')dnl
define(`confAUTH_MECHANISMS', `LOGIN PLAIN DIGEST-MD5 CRAM-MD5')dnl


$ cp generic-linux.mc sendmail.mc
$ sh Build sendmail.cf
$ mkdir /etc/mail
$ sh Build install-cf

$ groupadd smmsp
$ useradd -g smmsp smmsp

$ cd ../../
$ mkdir -p /usr/man/man8/
$ mkdir -p /usr/man/man1/
$ sh Build install

$ mkdir /var/spool/mqueue
$ chown root / /etc /etc/mail /usr /var /var/spool /var/spool/mqueue
$ chmod go-w / /etc /etc/mail /usr /var /var/spool /var/spool/mqueue

$ vi /etc/mail/local-host-names
nnmm.com
okdk.com

$ vi /etc/mail/sendmail.cf

$ vi /etc/mail/relay-domains
127.0.0.1
216.236.151.
64.130.235.213

$ vi /etc/mail/aliases

# Following alias is required by the mail protocol, RFC 822
# Set it to the address of a HUMAN who deals with this system's mail problems.
Postmaster: i

# Alias for mailer daemon; returned messages from our MAILER-DAEMON
# should be routed to our local Postmaster.
MAILER-DAEMON: postmaster

# Aliases to handle mail to programs or files, eg news or vacation
# decode: "|/usr/bin/uudecode"
nobody: /dev/null

# Sample aliases:

# Alias for distribution list, members specified here:
#staff:wnj,mosher,sam,ecc,mckusick,sklower,olson,rwh@ernie

# Alias for distribution list, members specified elsewhere:
#keyboards: :include:/usr/jfarrell/keyboards.list

# Alias for a person, so they can receive mail by several names:
#epa:eric


$ newaliases

$ vi /etc/mail/access
localhost.localdomain           RELAY
localhost                       RELAY
okdk.com                        RELAY
haejuk.com                      REJECT
hacker@hacker.com               REJECT
cracker@hacker.com      550     I hate spammers like you!

$ touch /etc/mail/mailertable
$ vi /etc/mail/virtusertable

@nnmm.com   godspeed
ricky@nnmm.com   ricky
admin@okdk.com   dew@dr.com

$ makemap hash access.db < access
$ makemap hash virtusertable.db < virtusertable
$ makemap hash mailertable.db < mailertable

$ /usr/sbin/sendmail -bi
$ /usr/sbin/sendmail -bd -q15m

$ vi /etc/rc.d/init.d/sendmail

#!/bin/sh
#
# sendmail      This shell script takes care of starting and stopping
#               sendmail.
#
# chkconfig: 2345 80 30
# description: Sendmail is a Mail Transport Agent, which is the program \
#              that moves mail from one machine to another.
# processname: sendmail
# config: /etc/sendmail.cf
# pidfile: /var/run/sendmail.pid

# Source function library.
. /etc/rc.d/init.d/functions

# Source networking configuration.
. /etc/sysconfig/network

# Source sendmail configureation.
if [ -f /etc/sysconfig/sendmail ] ; then
        . /etc/sysconfig/sendmail
else
        DAEMON=yes
        QUEUE=1h
fi

# Check that networking is up.
[ ${NETWORKING} = "no" ] && exit 0

[ -f /usr/sbin/sendmail ] || exit 0

RETVAL=0

# See how we were called.
case "$1" in
  start)
        # Start daemons.

        echo -n "Starting sendmail: "
        /usr/bin/newaliases > /dev/null 2>&1
        for i in virtusertable access domaintable mailertable ; do
            if [ -f /etc/mail/$i ] ; then
                makemap hash /etc/mail/$i < /etc/mail/$i
            fi
        done
        daemon /usr/sbin/sendmail $([ "$DAEMON" = yes ] && echo -bd) \
                                  $([ -n "$QUEUE" ] && echo -q$QUEUE); \
               /usr/sbin/sendmail -L sm-msp-queue -Ac -q30m
        RETVAL=$?

        sleep 1
        echo
        if [ $RETVAL -eq 0 ] ; then
          touch /var/lock/subsys/sendmail
          cp -af /var/spool/clientmqueue/sm-client.pid /var/run/sm-client.pid
        fi
        ;;
  stop)
        # Stop daemons.
        echo -n "Shutting down sendmail: "
        killproc sendmail
        killproc sm-client
        RETVAL=$?
        echo
        if [ $RETVAL -eq 0 ] ; then
          rm -f /var/lock/subsys/sendmail
          rm -f /var/spool/clientmqueue/sm-client.pid
        fi
        ;;
  restart|reload)
        $0 stop
        $0 start
        RETVAL=$?
        ;;
  status)
        status sendmail
        RETVAL=$?
        ;;
  *)
        echo "Usage: sendmail {start|stop|restart|status}"
        exit 1
esac

exit $RETVAL


$ ntsysv


/*****     THE END     *****/

'전자/컴퓨터 > Unix/Linux' 카테고리의 다른 글

proftpd 설치 방법  (0) 2007.04.17
NetBSD3.0에 APM설치 방법  (0) 2007.04.17

+ Recent posts