]> Cypherpunks.ru repositories - nncp.git/blob - doc/integration/exim.texi
Unify @ref and @command usage
[nncp.git] / doc / integration / exim.texi
1 @node Exim
2 @cindex Exim integration
3 @section Integration with Exim
4
5 This section is unaltered copy-paste of
6 @url{https://changelog.complete.org/archives/10165-asynchronous-email-exim-over-nncp-or-uucp, Asynchronous Email: Exim over NNCP (or UUCP)}
7 article by John Goerzen, with his permission.
8
9 @strong{Sending from Exim to a smarthost}
10
11 One common use for async email is from a satellite system: one that
12 doesn't receive mail, or have local mailboxes, but just needs to get
13 email out to the Internet. This is a common situation even for
14 conventionally-connected systems; in Exim speak, this is a "satellite
15 system that routes mail via a smarthost". That is, every outbound
16 message goes to a specific target, which then is responsible for
17 eventual delivery (over the Internet, LAN, whatever).
18
19 This is fairly simple in Exim.
20
21 @pindex bsmtp
22 @pindex rmail
23 We actually have two choices for how to do this: @command{bsmtp} or
24 @command{rmail} mode. bsmtp (batch SMTP) is the more modern way, and is
25 essentially a derivative of SMTP that explicitly can be queued
26 asynchronously. Basically it's a set of SMTP commands that can be saved
27 in a file. The alternative is @command{rmail} (which is just an alias
28 for sendmail these days), where the data is piped to
29 @command{rmail}/@command{sendmail} with the recipients given on the
30 command line. Both can work with Exim and NNCP, but because we're doing
31 shiny new things, we'll use @command{bsmtp}.
32
33 These instructions are loosely based on the
34 @url{https://people.debian.org/~jdg/bsmtp.html, Using outgoing BSMTP with Exim HOWTO}.
35 Some of these may assume Debianness in the configuration, but should be
36 easily enough extrapolated to other configs as well.
37
38 First, configure Exim to use satellite mode with minimal DNS lookups
39 (assuming that you may not have working DNS anyhow).
40
41 Then, in the Exim primary router section for smarthost
42 (@file{router/200_exim4-config_primary} in Debian split configurations),
43 just change @code{transport = remote_smtp_smarthost to transport = nncp}.
44
45 Now, define the NNCP transport. If you are on Debian, you might name this
46 @file{transports/40_exim4-config_local_nncp}:
47
48 @example
49 nncp:
50   debug_print = "T: nncp transport for $local_part@@$domain"
51   driver = pipe
52   user = nncp
53   batch_max = 100
54   use_bsmtp
55   command = /usr/local/nncp/bin/nncp-exec -noprogress -quiet hostname_goes_here rsmtp
56 .ifdef REMOTE_SMTP_HEADERS_REWRITE
57   headers_rewrite = REMOTE_SMTP_HEADERS_REWRITE
58 .endif
59 .ifdef REMOTE_SMTP_RETURN_PATH
60   return_path = REMOTE_SMTP_RETURN_PATH
61 .endif
62 @end example
63
64 This is pretty straightforward. We pipe to @command{@ref{nncp-exec}}, run it
65 as the nncp user. @command{@ref{nncp-exec}} sends it to a target node and runs
66 whatever that node has called @command{rsmtp} (the command to receive
67 bsmtp data). When the target node processes the request, it will run the
68 configured command and pipe the data in to it.
69
70 @strong{More complicated: Routing to various NNCP nodes}
71
72 Perhaps you would like to be able to send mail directly to various NNCP
73 nodes. There are a lot of ways to do that.
74
75 Fundamentally, you will need a setup similar to the UUCP example in
76 @url{https://www.exim.org/exim-html-current/doc/html/spec_html/ch-the_manualroute_router.html,
77 Exim's manualroute manual}, which lets you define how to reach various
78 hosts via UUCP/NNCP. Perhaps you have a star topology (every NNCP node
79 exchanges email with a central hub). In the NNCP world, you have two
80 choices of how you do this. You could, at the Exim level, make the
81 central hub the smarthost for all the side nodes, and let it
82 redistribute mail. That would work, but requires decrypting messages at
83 the hub to let Exim process. The other alternative is to configure NNCP
84 to just send to the destinations via the central hub; that takes
85 advantage of onion routing and doesn't require any Exim processing at
86 the central hub at all.
87
88 @strong{Receiving mail from NNCP}
89
90 On the receiving side, first you need to configure NNCP to authorize the
91 execution of a mail program. In the section of your receiving host where
92 you set the permissions for the client, include something like this:
93
94 @example
95 exec: @{
96     rsmtp: ["/usr/sbin/sendmail", "-bS"]
97 @}
98 @end example
99
100 The @option{-bS} option is what tells Exim to receive BSMTP on @code{stdin}.
101
102 @vindex MAIN_TRUSTED_USERS
103 Now, you need to tell Exim that nncp is a trusted user (able to set From
104 headers arbitrarily). Assuming you are running NNCP as the @code{nncp} user,
105 then add @code{MAIN_TRUSTED_USERS = nncp} to a file such as
106 @file{/etc/exim4/conf.d/main/01_exim4-config_local-nncp}. That's it!
107
108 Some hosts, of course, both send and receive mail via NNCP and will need
109 configurations for both.