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