LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   configuring sendmail with smart host (https://www.linuxquestions.org/questions/linux-software-2/configuring-sendmail-with-smart-host-131927/)

zapperabhi 01-05-2004 11:51 PM

configuring sendmail with smart host
 
i am configuring sendmail server in my fedora core 1
machine.

i have configured my mail server to send outgoing mail via a smtp relay agent(smart host and running on windows 2k) with public IP(203...) and possibly NATted and my mail server(which i call mail hub) that has private IP(192.168...) for security reasons.

among most of the documents i have read including the 'bat book' by b.c. & e.a. i have found that the configuration is explained for mail servers having public IP.

now what i would like to request you to inform me about is how to go about configuring my sendmail.
Moreover, the m4 configuration generated too many things i dont want to bother about, so i tried creating my own sendmail.cf

the system i want is
:- all outgoing mail should go via smart host.

:-all incoming mail to smart host ( which has public IP with valid MX record) should be forwarded to mail hub

:-all local mail should be delivered via smart host so that i can specify public POP server IP.

What i could succeed in doing was :
* to relay my mail TO say, yahoo.com via smtp relay agent.
* to relay my mail FROM yahoo.com to my smart host and to forward to mail hub(sendmail server)


But what i falied in doing was
* recieving mail from yahoo.com via smtp relay agent to my sendmail server.
(i think the sendmail forwards it again to smart host).

* sending/recieving mail locally.

i am using fluffy the SMTPGuardDog as my smtp relay agent for experimental purposes.

below is my configuration file sendmail.cf, i think you will have to help me with the M definition, for smtp & local.

please spare some time to view it and feel free to make changes.

V10/Berkeley

D{REMOTE}proxy # The name of the smart host
D{HUB}keckist.edu.np # Hub as known to the outside world
Cw localhost # My other names
Fw -o /etc/mail/local-host-names # A file of other names
Ct root daemon

# Options

O QueueDirectory=/var/spool/mqueue
O Timeout.queuewarn=4h
O Timeout.queuereturn=5d
O DeliveryMode=background
O TempFileMode=0600
O DefaultUser=1:1
O LogLevel=9
O OldStyleHeaders=True
O BlankSub=. # Replace unquoted spaces

# Headers
HFrom: <$g> # Added only if missing

HReceived: by $j; $b # Always added
H?x?Full-Name: $?x$x$. # Add full name if available
H?D?Date: $a # Add if F=D
H?M?Message-Id: <$t.$i@$j> # Add if F=M

# Precedence
Pspecial-delivery=100
Pfirst-class=0
Plist=-30
Pbulk=-60
Pjunk=-100


Msmtp, P=[IPC], S=Hubset/Hubset, R=2/2, F=0xmDFMuXa, T=DNS/RFC822/SMTP, A=TCP $h

Mlocal, P=/bin/mail, F=0lsDFMAw5:/|@rmn, S=Hubset/Hubset, R=2/2, A=mail -d $u

S0 # select delivery agent

R@$+ $#error $: Missing user name
R$+@$=w $#local $: $1
R$+@$=w.$m $#local $: $1
R$+@$=m $#local $: $1
#R$+@keckist.edu.np $#local $: $1

R$+ $#smtp $@${REMOTE} $:$1 # forward to smtp relay (proxy)


S2 #Rewrite reciever for hub
R$+@keckist.edu.np $1@moodle.inet.kec #moodle.inet.kec is my sendmail server in my private network


S3 # preprocessing for all rule sets
R$* <> $* $n # handle <> error address
R$* < $* <$*> $* > $* $2<$3>$4 # de-nest brackets
R$* < $* > $* $2 # basic RFC822 parsing



SHubset # Rewrite the sender for the hub
R$- $@ $1@${HUB} # user -> user@keckist.edu.np
R$- @ $=m $@ $1@${HUB} #user@domain -> user@keckist.edu.np
R$- @ $=w $@ $1@${HUB} # user@local -> user@keckist.edu.np
R$- @ $=w . $m $@ $1@${HUB} # user@local.domain -> user@keckist.edu.np

zapperabhi 01-07-2004 01:53 AM

nobody replied .... ok maybe i was too much a newbie ....
i have tweaked around the sendmail.cf file ..... but the problem persists.

1)changed deamon port options to listen on smtp port ....
2)defined DS(smart host) uselessly since my ruleset 0 points to my smart host.
3) other things ....

here's new one to look at :


V10/Berkeley
Cwlocalhost
Fw/etc/mail/local-host-names
CP.
DSproxy.inet.kec
CO @ % !
C..
C[[
Kresolve host -a<OKR> -T<TEMP>
C{ResOk}OKR
FR-o /etc/mail/relay-domains
Karith arith
Kdequote dequote
DnMAILER-DAEMON
CPREDIRECT
DZ8.12.10
D{REMOTE}proxy # The name of the smtp realy agent(smart host)
D{HUB}keckist.edu.np # Hub as known to the outside world
###############
# Options #
###############

O SevenBitInput=False
O AliasWait=10
#O AliasFile=/etc/aliases
O MinFreeBlocks=100
O BlankSub=.
O HoldExpensive=False
O DeliveryMode=background
O TempFileMode=0600
O HelpFile=/etc/mail/helpfile
O SendMimeErrors=True
O ForwardPath=$z/.forward.$w:$z/.forward
O ConnectionCacheSize=2
O ConnectionCacheTimeout=5m
O UseErrorsTo=False
O LogLevel=9
O CheckAliases=False
O OldStyleHeaders=True
#O DaemonPortOptions=Name=MTA
O DaemonPortOptions=Port=smtp,Addr=172.16.0.11,Name=MTA ## is this ok ?
O DaemonPortOptions=Port=smtp,Addr=127.0.0.1,Name=MLA ## is this ok ?
O DaemonPortOptions=Port=587, Name=MSA, M=E ## is this ok ?
O PrivacyOptions=authwarnings
O QueueDirectory=/var/spool/mqueue
O Timeout.queuereturn=5d
O Timeout.queuewarn=1h
O SuperSafe=True
O StatusFile=/etc/mail/statistics
O DefaultUser=8:12
O SmtpGreetingMessage=$j Sendmail $v/$Z; $b
O UnixFromLine=From $g $d
Pfirst-class=0
Pspecial-delivery=100
Plist=-30
Pbulk=-60
Pjunk=-100

#####################
# Trusted users #
#####################

Troot
Tdaemon
Tuucp

# Format of headers #
#########################

H?P?Return-Path: <$g>
HReceived: $?sfrom $s $.$?_($?s$|from $.$_)
$.$?{auth_type}(authenticated$?{auth_ssf} bits=${auth_s
$.by $j ($v/$Z)$?r with $r$. id $i$?{tls_version}
for $u; $|;
$.$b
H?D?Resent-Date: $a
H?D?Date: $a
H?F?Resent-From: $?x$x <$g>$|$g$.
H?F?From: $?x$x <$g>$|$g$.
H?x?Full-Name: $x
H?M?Resent-Message-Id: <$t.$i@$j>
H?M?Message-Id: <$t.$i@$j>

Msmtp, P=[IPC], F=mDFMuX, S=Hubset/Hubset, R=2/2, E=\r
T=DNS/RFC822/SMTP,
A=TCP $h 26
T=DNS/RFC822/X-Unix,
A=procmail -Y -a $h -d $u

# address rewrite rules
S0
R@$+ $#error $: Missing user name
R$+@$=w $#local $: $1
R$+@$=w.$m $#local $: $1
R$+@$=m $#local $: $1
R$+ $#smtp $@${REMOTE} $:$1 # forward to smtp relay (proxy)

S2
R$+@keckist.edu.np $1@moodle.inet.kec

S3
R$* <> $* $n # handle <> error address
R$* < $* <$*> $* > $* $2<$3>$4 # de-nest brackets
R$* < $* > $* $2 # basic RFC822 parsing

SHubset # Rewrite the sender for the hub
R$- $@ $1@${HUB} # user -> user@keckist.edu.np
R$- @ $=m $@ $1@${HUB} #user@domain -> user@keckist.edu.n
R$- @ $=w $@ $1@${HUB} # user@local -> user@keckist.edu
R$- @ $=w . $m $@ $1@${HUB} # user@local.domain -> user@keck

S4
R$+ :; <@> $@ $1 : handle <list:;>
R$* <@> $@ handle <> and list:;

zapperabhi 01-07-2004 03:24 AM

i finally got it !!
very useful configuration. 100% security. 2 levels of spam protection.
private mail server accessible publically.

thanx to all the folks who viewed my post.
thanx also to the folks who viewed, knew and didnt care to reply ...

:-)
-regards


All times are GMT -5. The time now is 03:15 PM.