]> Cypherpunks.ru repositories - nncp.git/blob - doc/usecases.texi
65d1c60d2b32cf43d532273383e31c83dfa03c26
[nncp.git] / doc / usecases.texi
1 @node Use cases
2 @unnumbered Use cases
3
4 @menu
5 * Occasional connection to mail server: UsecaseMail.
6 * Lightweight fast POP3/IMAP4 replacement: UsecasePOP.
7 * Unreliable/expensive communication link: UsecaseUnreliable.
8 * Slow/expensive link for high-volume data, bad QoS: UsecaseQoS.
9 * Extreme terrestrial environments, no link: UsecaseNoLink.
10 * Private, isolated MitM/Sybil-resistant networks: UsecaseF2F.
11 * Highly secure isolated air-gap computers: UsecaseAirgap.
12 * Network censorship bypassing, health: UsecaseCensor.
13 * Reconnaissance, spying, intelligence, covert agents: UsecaseSpy.
14 @end menu
15
16 @node UsecaseMail
17 @section Occasional connection to mail server
18
19 Assume that you have got your own @url{http://www.postfix.org/, Postfix}
20 SMTP server connected to the Internet. But you read and write emails on
21 your notebook, that is connected to it just from time to time. How can
22 you flush buffered mail queues when your notebook is connected?
23
24 One possibility is to log in and run something like @command{postqueue
25 -f}, but by default you have got only several days so and sender will
26 receive notification emails that his messages still are not delivered
27 yet. Also you must have secure link (SSH, VPN, etc).
28
29 Another possibility is to use POP3/IMAP4 servers, but this is too
30 overcomplicated and bloated for the simple task. Not an option.
31 @url{https://en.wikipedia.org/wiki/KISS_principle, KISS}!
32
33 Just tell both of your Postfixes (on the server and notebook) to drop
34 email as a mail via NNCP (@ref{nncp-mail}) to specified node. This is
35 done similarly as with UUCP and as written in
36 @url{http://www.postfix.org/UUCP_README.html, Postfix documentation}.
37
38 Look @ref{Postfix, here} for further information. All mail will be
39 stored in NNCP @ref{Spool, spool}, that after exchanging and tossing
40 will call local @command{sendmail} command to deliver them just like
41 that happened on the same machine.
42
43 @node UsecasePOP
44 @section Lightweight fast POP3/IMAP4 replacement
45
46 @ref{nncp-daemon} can be connected with @ref{nncp-caller} for a long
47 time -- it can create TCP connection that lasts for many hours. When
48 SMTP server receives mail, it will call @ref{nncp-mail} creating an
49 outbound encrypted packet. Daemon checks outbound directory each second
50 and immediately sends notification about undelivered packets to remote
51 side, that also downloads it at once.
52
53 There are only dozens of bytes notifying about incoming packets, dozens
54 of bytes telling to download those packets. Mail packets are compressed
55 (POP3 and IMAP4 as a rule do not). You have lightweight, compressed,
56 low-delay, reliable link for the mail with strong encryption and mutual
57 sides authentication!
58
59 @node UsecaseUnreliable
60 @section Unreliable/expensive communication link
61
62 Assume that you have got slow modem/radio/cellular link that frequently
63 disconnects and causes TCP timeouts. Not all HTTP servers support file
64 download continuation. SMTP does not support resuming at all and heavy
65 messages is problematic to retrieve. Moreover, each disconnect leads to
66 the same data retransmission again, that can not be afforded sometimes.
67
68 Just send your @ref{nncp-mail, mail} and @ref{nncp-file, files} through
69 NNCP. You can use either offline delivery methods -- read about them in
70 the next section, or you can use included NNCP @ref{nncp-daemon, TCP
71 daemon}.
72
73 The command:
74
75 @verbatim
76 % nncp-file file_i_want_to_send bob:
77 % nncp-file another_file bob:movie.avi
78 @end verbatim
79
80 will queue two files for sending to @emph{bob} node. Fire and forget!
81 Now this is daemon's job (or offline transfer) to send this files part
82 by part to remote system when it is available.
83
84 @node UsecaseQoS
85 @section Slow/expensive link for high-volume data, bad QoS
86
87 Assume that you can give your relatively cheap 2 TiB removable hard
88 drive to someone each day at the morning (and take it back at the
89 evening). This equals to 185 Mbps good quality (without any speed
90 degradation) link in single direction. What about more and bigger hard
91 drives? This type of data exchange is called
92 @url{https://en.wikipedia.org/wiki/Sneakernet, sneakernet}/floppynet.
93
94 NNCP allows traffic @ref{Niceness, prioritizing}: each packet has
95 niceness level, that will guarantee that it will be processed earlier or
96 later than the other ones. Nearly all commands has corresponding option:
97
98 @verbatim
99 % nncp-file -nice 32 myfile node:dst
100 % nncp-xfer -nice 192 /mnt/shared
101 % nncp-call -nice 224 bob
102 [...]
103 @end verbatim
104
105 Huge files could be split on smaller @ref{Chunked, chunks}, giving
106 possibility to transfer virtually any volumes using small capacity
107 storages.
108
109 @node UsecaseNoLink
110 @section Extreme terrestrial environments, no link
111
112 This is some kind of too slow link. Offline delivery methods is the only
113 choice. Just send files as shown in previous section, but use removable
114 media for transferring packets to other nodes.
115
116 Assume that you send two files to @emph{bob} node. Insert USB storage
117 device, mount it and run @ref{nncp-xfer}:
118
119 @verbatim
120 % nncp-xfer -node bob /media/usbstick
121 @end verbatim
122
123 to copy all outbound packets related to @emph{bob}. Use @option{-mkdir}
124 option to create related directory on USB storage if they are missing
125 (for example when running for the first time).
126
127 If you use single storage device to transfer data both to @emph{bob} and
128 @emph{alice}, then just omit @option{-node} option to copy all available
129 outgoing packets.
130
131 @verbatim
132 % nncp-xfer /media/usbstick
133 @end verbatim
134
135 Unmount it and transfer storage to Bob and Alice. When they will insert
136 it in their computers, they will use exactly the same command:
137
138 @verbatim
139 % nncp-xfer /media/usbstick
140 @end verbatim
141
142 to find all packets related to their node and copy them locally for
143 further processing. @command{nncp-xfer} is the only command used with
144 removable devices.
145
146 @node UsecaseF2F
147 @section Private, isolated MitM/Sybil-resistant networks
148
149 All Internet connections can be eavesdropped and forged. You
150 @strong{have to} to use encryption and authentication for securing them.
151 But it is very hard to secure metadata, that leaks during each online
152 session. When you start your shiny new software server be sure that
153 there could be huge quantity of bogus peers trying to perform
154 @url{https://en.wikipedia.org/wiki/Sybil_attack, Sybil attack}. Opennet
155 peer-to-peer networking is dangerous thing to do.
156
157 The most popular cryptographic protocol in Internet is
158 @url{https://en.wikipedia.org/wiki/Transport_Layer_Security, TLS} that
159 is very hard to implement correctly and hard to configure for mutual
160 participants authentication. Not all TLS configurations and related
161 protocols provide @url{https://en.wikipedia.org/wiki/Forward_secrecy,
162 forward secrecy} property -- all previously intercepted packets could be
163 read if private keys are compromised.
164
165 Friend-to-friend networks, darknets can mitigate risks related to fake
166 and forged nodes. However they are harder to support and require more
167 time to be done right.
168
169 NNCP's @ref{nncp-daemon, TCP daemon} uses
170 @url{http://noiseprotocol.org/, Noise-IK} protocol to mutually
171 authenticate peers and provide effective (both participants send payload
172 in the very first packet) secure transport with forward secrecy
173 property.
174
175 @verbatim
176 % nncp-daemon -bind [::]:5400
177 @end verbatim
178 will start TCP daemon listening on all interfaces for incoming
179 connections.
180
181 @verbatim
182 % nncp-call bob
183 @end verbatim
184 will try to connect to @emph{bob}'s node known TCP addresses (taken from
185 configuration file) and send all related outbound packets and retrieve
186 those the Bob has. All interrupted transfers will be automatically
187 resumed.
188
189 @node UsecaseAirgap
190 @section Highly secure isolated air-gap computers
191
192 If you worry much about security, then air-gapped computer could be the
193 only choice you can afford. Computer without any modems, wired and
194 wireless networks. Obviously the only possibility to exchange mail and
195 files is to use physically removable storage devices like CD-ROM, hard
196 drive, tape and USB flash drives (worst choice, due to those devices
197 complexity).
198
199 Presumably you have got another own hop before that computer: another
200 intermediate node which performs basic verification of retrieved storage
201 devices, possibly by rewriting the data from USB/hard drives to CD-RWs.
202
203 NNCP supports packets relying (transitioning) out-of-box.
204
205 @verbatim
206 neigh:
207   bob:
208     [...]
209     addrs:
210       lan: [fe80::5400%igb0]:5400
211   bob-airgap:
212     [...]
213     via: [bob]
214 @end verbatim
215
216 That @ref{Configuration, configuration file} tells that we have got two
217 known neighbours: @emph{bob} and @emph{bob-airgap}. @emph{bob} can be
218 reached via online connection using @emph{lan} address.
219 @emph{bob-airgap} can be reached by sending intermediate relay packet
220 through the @emph{bob}.
221
222 Any command like @command{nncp-file myfile bob-airgap:} will
223 automatically create an encapsulated packet: one for the destination
224 endpoint, and other carrying it for intermediate relaying node.
225
226 Pay attention that relaying node knows nothing about the packet inside,
227 but just its size and priority. Transition packets are encrypted too:
228 using well-known @url{https://en.wikipedia.org/wiki/Onion_routing, onion
229 routing} technology. @emph{bob} can not read @emph{bob-airgap}'s packets.
230
231 @node UsecaseCensor
232 @section Network censorship bypassing, health
233
234 This is some kind of bad link too. Some governments tend to forbid
235 @strong{any} kind of private communication between people, allowing only
236 entertainment content delivering and popular social networks access
237 (that are already bloated with advertisements, locally executed
238 @url{https://www.gnu.org/philosophy/free-sw.html, proprietary}
239 JavaScript code (for spying on user activities, collect data on them),
240 shamelessly exploiting the very basic human need of communication).
241
242 This is their natural wish. But nobody forces you to obey huge
243 corporations like Apple, Google or Microsoft. It is your choice to
244 create an isolated friend-to-friend network with piles of harmless
245 content and private messaging. Only predators silently watch for their
246 victims in mammals world -- it harms your health being watched and
247 feeling that you are the victim that has already done something wrong.
248
249 @node UsecaseSpy
250 @section Reconnaissance, spying, intelligence, covert agents
251
252 Those guys know how Internet is a dangerous place incompatible with
253 privacy. They require quick, fast dropping and picking of data. No
254 possibility of many round-trips -- just drop the data, fire-and-forget.
255 It could be either removable media again and/or
256 @url{https://en.wikipedia.org/wiki/USB_dead_drop, USB dead drops},
257 @url{https://en.wikipedia.org/wiki/PirateBox, PirateBox}es,
258 @url{https://en.wikipedia.org/wiki/Short-range_agent_communications, SRAC}.
259 Short lived short range networks like Bluetooth and WiFi can also
260 be pretty fast, allowing to quickly fire chunks of queued packets.
261
262 Very important property is that compromising of those dead drops and
263 storages must be neither fatal nor even dangerous. Packets sent through
264 the network and exchanged via those devices are end-to-end
265 @ref{Encrypted, encrypted} (but unfortunately lacking forward secrecy).
266 No filenames, mail recipients are seen.
267
268 All node communications are done with so-called @ref{Spool, spool} area:
269 directory containing only those unprocessed encrypted packets. After
270 packet transfer you still can not read any of them: you have to run
271 another stage: @ref{nncp-toss, tossing}, that involves your private
272 cryptographic keys. So even if your loose your computer, storage devices
273 and so on -- it is not so bad, because you are not carrying private keys
274 with it (don't you?), you do not "toss" those packets immediately on the
275 same device. Tossing (reading those encrypted packets and extracting
276 transferred files and mail messages) could and should be done on a
277 separate computer (@ref{nncp-mincfg} command could help creating
278 configuration file without private keys for that purpose).