]> Cypherpunks.ru repositories - nncp.git/blob - doc/integration/postfix.texi
f02dca088354482a65582909d9a6aa549a30c4b5
[nncp.git] / doc / integration / postfix.texi
1 @node Postfix
2 @section Integration with Postfix
3
4 This section is taken from @url{http://www.postfix.org/UUCP_README.html,
5 Postfix and UUCP} manual and just replaces UUCP-related calls with NNCP
6 ones.
7
8 @strong{Setting up a Postfix Internet to NNCP gateway}
9
10 Here is how to set up a machine that sits on the Internet and that forwards
11 mail to a LAN that is connected via NNCP.
12
13 @itemize
14
15 @item You need an @ref{nncp-exec} program that extracts the sender
16 address from mail that arrives via NNCP, and that feeds the mail into
17 the Postfix @command{sendmail} command.
18
19 @item Define a @command{pipe(8)} based mail delivery transport for
20 delivery via NNCP:
21 @example
22 /usr/local/etc/postfix/master.cf:
23 nncp      unix  -       n       n       -       -       pipe
24   flags=Rqhu user=nncp argv=nncp-exec -quiet $nexthop sendmail $recipient
25 @end example
26
27 This runs the @command{nncp-exec} command to place outgoing mail into
28 the NNCP queue after replacing @var{$nexthop} by the receiving NNCP
29 node and after replacing @var{$recipient} by the recipients. The
30 @command{pipe(8)} delivery agent executes the @command{nncp-exec}
31 command without assistance from the shell, so there are no problems with
32 shell meta characters in command-line parameters.
33
34 Pay attention to @code{flags}, containing @code{R}, telling Postfix to
35 include @code{Return-Path:} header. Otherwise that envelope sender
36 information may be lost. Possibly you will also need somehow to
37 preserve that header on the receiving side, because @command{sendmail}
38 command will replace it. For example you can rename it before feeding to
39 @command{sendmail} with
40 @code{reformail -R Return-Path: X-Original-Return-Path: | sendmail}, or
41 extract with:
42
43 @verbatiminclude sendmail.sh
44
45 Also pay attention that @command{maildrop} does not like @code{From_}
46 mbox-style header, so you possibly want:
47
48 @example
49 mailbox_command = reformail -f0 | maildrop -d $@{USER@}
50 @end example
51
52 @item Specify that mail for @emph{example.com}, should be delivered via
53 NNCP, to a host named @emph{nncp-host}:
54
55 @example
56 /usr/local/etc/postfix/transport:
57     example.com     nncp:nncp-host
58     .example.com    nncp:nncp-host
59 @end example
60
61 See the @command{transport(5)} manual page for more details.
62
63 @item Execute the command @command{postmap /etc/postfix/transport}
64 whenever you change the @file{transport} file.
65
66 @item Enable @file{transport} table lookups:
67
68 @example
69 /usr/local/etc/postfix/main.cf:
70     transport_maps = hash:$config_directory/transport
71 @end example
72
73 @item Add @emph{example.com} to the list of domains that your site is
74 willing to relay mail for.
75
76 @example
77 /usr/local/etc/postfix/main.cf:
78     relay_domains = example.com @dots{}other relay domains@dots{}
79 @end example
80
81 See the @option{relay_domains} configuration parameter description for
82 details.
83
84 @item Execute the command @command{postfix reload} to make the changes
85 effective.
86
87 @end itemize
88
89 @strong{Setting up a Postfix LAN to NNCP gateway}
90
91 Here is how to relay mail from a LAN via NNCP to the Internet.
92
93 @itemize
94
95 @item You need an @ref{nncp-exec} program that extracts the sender
96 address from mail that arrives via NNCP, and that feeds the mail into
97 the Postfix @command{sendmail} command.
98
99 @item Specify that all remote mail must be sent via the @command{nncp}
100 mail transport to your NNCP gateway host, say, @emph{nncp-gateway}:
101
102 @example
103 /usr/local/etc/postfix/main.cf:
104     relayhost = nncp-gateway
105     default_transport = nncp
106 @end example
107
108 Postfix 2.0 and later also allows the following more succinct form:
109
110 @example
111 /usr/local/etc/postfix/main.cf:
112     default_transport = nncp:nncp-gateway
113 @end example
114
115 @item Define a @command{pipe(8)} based message delivery transport for
116 mail delivery via NNCP:
117
118 @example
119 /usr/local/etc/postfix/master.cf:
120 nncp      unix  -       n       n       -       -       pipe
121   flags=Fqhu user=nncp argv=nncp-exec -quiet $nexthop sendmail $recipient
122 @end example
123
124 This runs the @command{nncp-exec} command to place outgoing mail into
125 the NNCP queue. It substitutes the hostname (@emph{nncp-gateway}, or
126 whatever you specified) and the recipients before execution of the
127 command. The @command{nncp-exec} command is executed without assistance
128 from the shell, so there are no problems with shell meta characters.
129
130 @item Execute the command @command{postfix reload} to make the changes
131 effective.
132
133 @end itemize