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