]> Cypherpunks.ru repositories - nncp.git/blob - doc/usecases.texi
Documentation draft
[nncp.git] / doc / usecases.texi
1 @node Use cases
2 @unnumbered Use cases
3
4 @table @strong
5
6 @item Occasional connection to mail server
7
8 Assume that you have got your own @url{http://www.postfix.org/, Postfix}
9 SMTP server connected to the Internet. But you read and write emails on
10 your notebook, that is connected to it just from time to time. How can
11 you flush buffered mail queues when your notebook is connected?
12
13 One possibility is to log in and run something like @command{postqueue
14 -f}, but by default you have got only several days so and sender will
15 receive notification emails that his messages still are not delivered
16 yet. Also you must have secure link (SSH, VPN, etc).
17
18 Another possibility is to use POP3/IMAP4 servers, but this is too
19 overcomplicated and bloated for the simple task. Not an option.
20
21 Just tell both of your Postfixes (on the server and notebook) to drop
22 email as a mail via NNCP to specified node. Search for @code{uucp}
23 related strings in @code{master.cf} and replace command to NNCP ones:
24
25 @verbatim
26 nncp      unix  -       n       n       -       -       pipe
27   flags=Fqhu user=nncp argv=nncp-mail -quiet $nexthop $recipient
28 @end verbatim
29
30 Now, all mail will be stored in NNCP spool, that after exchanging and
31 tossing will call local @code{sendmail} command to deliver them just
32 that was happened on the same machine.
33
34 @item Unreliable/expensive communication link
35
36 Assume that you have got slow modem/radio/cellular link that frequently
37 disconnects and causes TCP timeouts. Not all HTTP servers support file
38 download continuation. SMTP does not support resuming at all and heavy
39 messages is a problem to retrieve. Moreover, each disconnect leads to
40 the same data retransmission again, that can be expensive to afford.
41
42 Just send your mail and files through NNCP. You can use either offline
43 delivery methods -- read about them below, or you can use included NNCP
44 TCP daemon.
45
46 The command below:
47
48 @verbatim
49 % nncp-file file_i_want_to_send bob:
50 % nncp-file another_file bob:movie.avi
51 @end verbatim
52
53 will queue two files for sending to @code{bob} node. Fire and forget!
54 Now this is daemon's job (or offline transfer) to send this file part by
55 part to remote system when it is available.
56
57 @item Slow/expensive link for high-volume data
58
59 Assume that you can give your relatively cheap 2 TiB removable hard
60 drive to someone each day at the morning (and take it back at the
61 evening). This equals to 185 Mbps good quality (without any speed
62 degradation) link in single direction. What about more and bigger hard
63 drives? This type of data transferring is called
64 @url{https://en.wikipedia.org/wiki/Sneakernet, sneakernet}/floppynet.
65
66 @item Extreme terrestrial environments, no link
67
68 This is some kind of too slow link. Offline delivery methods is the only
69 choice. Just send files as shown above, but use removable media for
70 transferring packets to other nodes.
71
72 Assume that you send two files to @code{bob} node. Insert USB storage
73 device, mount it and run:
74
75 @verbatim
76 % nncp-xfer -node bob /media/usbstick
77 @end verbatim
78
79 to copy all outbound packets related to @code{bob}'s node. Use
80 @code{-force} option to forcefully create related directory on USB
81 storage if they are missing (for example when running for the first
82 time).
83
84 If you use single storage device to transfer data both to @code{bob} and
85 @code{alice}, then just omit @code{-node} option to copy all existing
86 outgoing packets to that storage device.
87
88 @verbatim
89 % nncp-xfer /media/usbstick
90 @end verbatim
91
92 Unmount it and transfer somehow to Bob and Alice. When they will insert
93 it in their computers, they will use exactly the same command:
94
95 @verbatim
96 % nncp-xfer /media/usbstick
97 @end verbatim
98
99 to find all packets related to their node and copy them locally for
100 further processing. @code{nncp-xfer} is the only command used with
101 removable devices.
102
103 @item Private, isolated MitM-resistant networks
104
105 All Internet connections can be eavesdropped and forged. You
106 @strong{have to} to use encryption and authentication for securing them.
107 But it is very hard to secure metadata, that leaks during each online
108 session. When you start your shiny new software server be sure that
109 there could be huge quantity of bogus peers trying to perform
110 @url{https://en.wikipedia.org/wiki/Sybil_attack, Sybil attack}. Opennet
111 peer-to-peer networking is dangerous thing to do.
112
113 The most popular cryptographic protocol in Internet is
114 @url{https://en.wikipedia.org/wiki/Transport_Layer_Security, TLS} that
115 is very hard to implement right and hard to configure for mutual
116 participants authentication. Not all TLS configurations and related
117 protocols provide @url{https://en.wikipedia.org/wiki/Forward_secrecy,
118 forward secrecy} property -- all previously intercepted packets could be
119 read if private keys are compromised.
120
121 Friend-to-friend networks, darknets can mitigate risks related to fake
122 and forged nodes. However they are harder to support require more time
123 to be done right.
124
125 NNCP's TCP daemon uses @url{http://noiseprotocol.org/, Noise-IK}
126 protocol to mutually authenticate peers and provide effective (both
127 participants send payload in the very first packet) secure transport
128 with forward secrecy property.
129
130 @verbatim
131 % nncp-daemon -bind [::]:5400
132 @end verbatim
133 will start TCP daemon listening on all interfaces for incoming
134 connections.
135
136 @verbatim
137 % nncp-call bob
138 @end verbatim
139 will try to connect to @code{bob}'s node known TCP addresses (taken from
140 configuration file) and send all related outbound packets and retrieve
141 those the Bob has. All interrupted transfers will be automatically
142 resumed.
143
144 @item Highly secure isolated air-gap computers
145
146 If you worry much about security, then air-gapped computer could be the
147 only choice you can afford. Computer without any modems, wired and
148 wireless networks. Obviously the only possibility to exchange mail and
149 files is to use physically removable storage devices like CD-ROM, hard
150 drive, tape and USB flash drives (worst choice, due to those devices
151 complexity).
152
153 Presumably you have got another own hop before that computer: another
154 intermediate node which performs basic verification of retrieved storage
155 devices, possibly by rewriting the data from USB/hard drives to CD-RWs.
156
157 NNCP supports packets relying (transitioning) out-of-box.
158
159 @verbatim
160 neigh:
161   bob:
162     [...]
163     addrs:
164       lan: [fe80::5400%igb0]:5400
165   bob-airgap:
166     [...]
167     via: [bob]
168 @end verbatim
169
170 That configuration file tells that we have got two known neighbours
171 (nodes, peers): @code{bob} and @code{bob-airgap}. @code{bob} can be
172 reached via online connection using @code{lan} address.
173 @code{bob-airgap} can be reached by sending intermediate relay packet
174 through the @code{bob}.
175
176 Any command like @code{nncp-file myfile bob-airgap:} will automatically
177 create two packets: one for the destination endpoint, other for
178 intermediate relaying node.
179
180 Pay attention that relaying node knows nothing about the packet inside,
181 but just its size and priority. Transition packets are encrypted too.
182 @code{bob} can not read @code{bob-airgap}'s packets.
183
184 @item Reconnaissance, spying, intelligence, covert agents
185
186 Those guys know how Internet is a dangerous place incompatible with
187 privacy. They require quick, fast dropping and picking of data. No
188 possibility of many round-trips -- just drop the data, fire-and-forget.
189 It could be either removable media again, or
190 @url{https://en.wikipedia.org/wiki/USB_dead_drop, USB dead drops}, or
191 @url{https://en.wikipedia.org/wiki/PirateBox, PirateBox}es, or
192 @url{https://en.wikipedia.org/wiki/Short-range_agent_communications, SRAC}.
193 Short lived short range networks like Bluetooth and WiFi can also
194 be pretty fast, allowing to quickly fire chunks of queued packets.
195
196 Very important property is that compromising of those dead drops and
197 storages must not be fatal and even dangerous. Packets sent through the
198 network and exchanged via those devices are end-to-end encrypted (but
199 unfortunately without forward secrecy property). No filenames, mail
200 recipients are seen.
201
202 All communications are done with so-called spool area: directory
203 containing only those unprocessed encrypted packets. After packet
204 transfer you still can not read any mail of get files: you have to run
205 another stage: tossing. Only that stage involves your private
206 cryptographic keys. So even if your loose your computer, storage devices
207 and so on -- it is not so bad, because you are not carrying private keys
208 with it, you do not "toss" those packets immediately on the same device.
209
210 Tossing (reading those encrypted packets and extracting transferred
211 files and mail messages) could and should be done on a separate
212 computer.
213
214 @end table