Preventing SMTP Relaying
1.0 Introduction Note that by default
PMDF prevents most SMTP relaying activity. Why not all? For starters,
SMTP relaying is not necessarily a bad thing. However, some local
users using POP or IMAP may depend upon PMDF to act as an SMTP relay.
Blocking unauthorized relaying while allowing it for legitimate,
local users requires configuring PMDF to know how to distinguish
between the two classes of users. Configuring PMDF to make this
distinction is the topic of the next section. Note: This document assumes that you are
running PMDF V6.1 or later. Some of the functionality described
in this document is not available in earlier versions of PMDF. 1.1
Differentiation between internal & external mail The Note: Since the source IP address is used,
it is important that your network router connecting your local network
to the Internet be configured to prevent "IP spoofing".
Contact your router vendor for assistance if you are unsure of how
to configure your router. Let's now actually
change your PMDF configuration so that you can differentiate between
your internal and external message traffic. This is done by editing
your PMDF configuration file, <blank line> is
used to indicate a blank line in the configuration file.
· <blank line>
· defaults noswitchchannel
· <blank line>
So that the
configuration file appears something like ... last rewrite rule ... <first blank line> defaults noswitchchannel <blank line> l ... If you already
have a defaults channel at this point in your configuration file,
then simply add the
· <blank line>
· tcp_local smtp single_sys mx switchchannel remotehost
· TCP-DAEMON
· <blank line>
· tcp_internal smtp single_sys mx allowswitchchannel
· TCP-INTERNAL
· .domain.com $U%$H$D@TCP-INTERNAL · [a.b.] $U%[a.b.$L]@TCP-INTERNAL$E$R With
the above configuration changes, SMTP mail generated within your
domain will come in via the tcp_internal channel. All other SMTP
mail will come in via the tcp_local channel. You can therefore distinguish
between internal and external mail based upon which channel it comes
in on. How
does the above work? The key is the Note: Any mapping table or conversion file
entries which use the string "tcp_local" may need to be
changed to either "tcp_*" or "tcp_internal"
depending upon the usage. 1.2
Preventing mail relaying An ORIG_SEND_ACCESS
mapping table may be used to block traffic based upon the source
and destination channel. In this case, traffic from and back to
the tcp_local channel is to be blocked. This is realized with the
following ORIG_SEND_ACCESS mapping table: ORIG_SEND_ACCESS
tcp_local|*|*|*$%*.domain.com@* tcp_local|$0|$1|$2@$4$R tcp_local|*|*|*$%domain.com@* tcp_local|$0|$1|$2@$3$R tcp_local|*|*|*$%*.domain.com$%*@* tcp_local|$0|$1|$2@$5$R tcp_local|*|*|*$%domain.com$%*@* tcp_local|$0|$1|$2@$4$R tcp_local|*|*|*$%*.*@* $NRelaying$ not$ permitted tcp_local|*|*|*.*!*@* $NRelaying$ not$ permitted tcp_local|*|*|"*@*"@domain.com $NRelaying$ not$ permitted tcp_local|*|*|"*@*"@*.domain.com $NRelaying$ not$ permitted tcp_local|*|*|@*:"*@*"@domain.com $NRelaying$ not$ permitted tcp_local|*|*|@*:"*@*"@*.domain.com $NRelaying$ not$ permitted tcp_local|*|*|@*:*@*.domain.com $Y tcp_local|*|*|@*:*@domain.com $Y tcp_local|*|*|@*:*@* $NRelaying$ not$ permitted tcp_local|*|tcp_local|* $NRelaying$ not$ permitted In
the above, the first thirteen entries are already coded in PMDF
6.0 or higher; and does not need to be included in the ORIG_SEND_ACCESS
table. This means you would only need to add the last
entry. These entries are associated with blocking various forms
of source routed addresses which might otherwise be used to thread
a message through your channels. The fourteenth and final entry
is the expected entry: the entry which states that messages cannot
come in the tcp_local channel and go right back out it. That is,
the last entry disallows external mail from coming in your SMTP
server and being relayed right back out to the Internet. The updated
table only needs:
ORIG_SEND_ACCESS
tcp_local|*|tcp_local|* $NRelaying$ not$ permitted
The ORIG_SEND_ACCESS
mapping table shown above should be added to your file of mapping
tables. On UNIX systems that is the After setting up
the above ORIG_SEND_ACCESS mapping, you may find some desired forms
of message traffic prohibited. Specifically, forwarding to another
domain which is effected through a general database. Read on for
details on how to permit this form of activity. If you do not use
a general database, then you need not worry about this issue. If you use a general
database to redirect mail and some entries in that database forward
mail outside of your domain, then those forwarded addresses will
be affected by the above access controls. Specifically, a message
sent by someone from outside your domain to an address which is
immediately forwarded back out of your domain by the general database
will appear to the ORIG_SEND_ACCESS mapping table as a message coming
in the tcp_local channel and passing right back out the tcp_local
channel. Hence, it will be blocked as a relay attempt. To prevent
this difficulty, change the forwarding entry in the general database
to pass through the process channel. For example, if Jane.Doe@domain.com
used to forward out to jdoe@other.com, Jane.Doe jdoe%other.com
then
change the entry to be Jane.Doe jdoe%other.com@PROCESS-DAEMON
Add
to the end of your PMDF configuration file, the channel definition
<blank line> process PROCESS-DAEMON An even better approach is to switch to using a FORWARD mapping table which then probes the general database. However, the exact details of how to set this up will depend somewhat on your current use of the general database and hence no attempt is made here to explain how to do this. See the V6.1 or higher PMDF System Manager's Guide for details. You can also consider switching from using a general database to using a directory channel. |
Home > Support > Tech Tips > PMDF > Technical Notes
