Next: Integration with Exim, Previous: Index files for freqing, Up: Integration with existing software [Index]
This section is taken from Postfix and UUCP manual and just replaces UUCP-related calls with NNCP ones.
Setting up a Postfix Internet to NNCP gateway
Here is how to set up a machine that sits on the Internet and that forwards mail to a LAN that is connected via NNCP.
nncp-exec
program that extracts the
sender address from mail that arrives via NNCP, and that feeds the mail
into the Postfix sendmail
command.
pipe(8)
based mail delivery transport for
delivery via NNCP:
/usr/local/etc/postfix/master.cf: nncp unix - n n - - pipe flags=Rqhu user=nncp argv=nncp-exec -quiet $nexthop sendmail $recipient
This runs the nncp-exec
command to place outgoing mail into
the NNCP queue after replacing $nexthop by the receiving NNCP
node and after replacing $recipient by the recipients. The
pipe(8)
delivery agent executes the nncp-exec
command without assistance from the shell, so there are no problems with
shell meta characters in command-line parameters.
Pay attention to flags
, containing R
, telling Postfix to
include Return-Path:
header. Otherwise that envelope sender
information may be lost. Possibly you will also need somehow to
preserve that header on the receiving side, because sendmail
command will replace it. For example you can rename it before feeding to
sendmail
with
reformail -R Return-Path: X-Original-Return-Path: | sendmail
, or
extract with:
#!/bin/sh -e tmp=`mktemp` trap "rm -f $tmp" HUP PIPE INT QUIT TERM EXIT cat >$tmp sendmail -f "`reformail -x Return-Path: <$tmp`" $@ <$tmp
Also pay attention that maildrop
does not like From_
mbox-style header, so you possibly want:
mailbox_command = reformail -f0 | maildrop -d ${USER}
/usr/local/etc/postfix/transport: example.com nncp:nncp-host .example.com nncp:nncp-host
See the transport(5)
manual page for more details.
postmap /etc/postfix/transport
whenever you change the transport file.
/usr/local/etc/postfix/main.cf: transport_maps = hash:$config_directory/transport
/usr/local/etc/postfix/main.cf: relay_domains = example.com ...other relay domains...
See the relay_domains configuration parameter description for details.
postfix reload
to make the changes
effective.
Setting up a Postfix LAN to NNCP gateway
Here is how to relay mail from a LAN via NNCP to the Internet.
nncp-exec
program that extracts the
sender address from mail that arrives via NNCP, and that feeds the mail
into the Postfix sendmail
command.
nncp
mail transport to your NNCP gateway host, say, nncp-gateway:
/usr/local/etc/postfix/main.cf: relayhost = nncp-gateway default_transport = nncp
Postfix 2.0 and later also allows the following more succinct form:
/usr/local/etc/postfix/main.cf: default_transport = nncp:nncp-gateway
pipe(8)
based message delivery transport for
mail delivery via NNCP:
/usr/local/etc/postfix/master.cf: nncp unix - n n - - pipe flags=Fqhu user=nncp argv=nncp-exec -quiet $nexthop sendmail $recipient
This runs the nncp-exec
command to place outgoing mail into
the NNCP queue. It substitutes the hostname (nncp-gateway, or
whatever you specified) and the recipients before execution of the
command. The nncp-exec
command is executed without assistance
from the shell, so there are no problems with shell meta characters.
postfix reload
to make the changes
effective.
Next: Integration with Exim, Previous: Index files for freqing, Up: Integration with existing software [Index]