misc: Ignore files generated by cscope/ctags
[netsniff-ng.git] / curvetun.8
blob9671afc6d36db77f8db03aebdbf5d82dd71b6bd4
1 .\" netsniff-ng - the packet sniffing beast
2 .\" Copyright 2013 Daniel Borkmann.
3 .\" Subject to the GPL, version 2.
4 .PP
5 .TH CURVETUN 8 "03 March 2013" "Linux" "netsniff-ng toolkit"
6 .SH NAME
7 curvetun \- a lightweight Curve25519 IP tunnel
8 .PP
9 .SH SYNOPSIS
10 .PP
11 \fB curvetun\fR [\fIoptions\fR]
12 .PP
13 .SH DESCRIPTION
14 curvetun is a lightweight, high-speed ECDH multiuser IP tunnel for Linux
15 that is based on epoll(2). curvetun uses the Linux TUN/TAP interface and
16 supports {IPv4, IPv6} over {IPv4, IPv6} with UDP or TCP as carrier protocols.
17 .PP
18 It has an integrated packet forwarding tree, thus multiple users with
19 different IPs can be handled via a single tunnel device on the server side
20 and flows are scheduled for processing in a CPU efficient way, at least in the
21 case of TCP as the carrier protocol.
22 .PP
23 For key management, public-key cryptography based on elliptic curves are being
24 used and packets are encrypted end-to-end by the symmetric stream cipher
25 Salsa20 and authenticated by the MAC Poly1305, where keys have previously
26 been computed with the ECDH key agreement protocol Curve25519.
27 .PP
28 Cryptography is based on Daniel J. Bernstein's networking and cryptography
29 library \[lq]NaCl\[rq]. By design, curvetun does not provide any particular pattern
30 or default port numbers that gives certainty that the connection from a
31 particular flow is actually running curvetun.
32 .PP
33 However, if you have a further need to bypass censorship, you can try using
34 curvetun in combination with Tor's obfsproxy or Telex. Furthermore, curvetun
35 also protects you against replay attacks and DH man-in-the-middle attacks.
36 Additionally, server-side syslog event logging can also be disabled to not
37 reveal any critical user connection data.
38 .PP
39 .IP " 1." 4
40 obfsproxy from the TOR project
41 .RS 4
42 \%https://www.torproject.org/projects/obfsproxy.html.en
43 .RE
44 .PP
45 .IP " 2." 4
46 Telex, anti-censorship in the network infrastructure
47 .RS 4
48 \%https://telex.cc/
49 .RE
50 .PP
51 .SH OPTIONS
52 .PP
53 todo FIXME
54 .PP
55 .SH CRYPTOGRAPHY
56 Encrypted IP tunnels are often used to create virtual private networks (VPN),
57 where parts of the network can only be reached via an insecure or untrusted medium
58 such as the Internet. Only a few software utilities exists to create such tunnels,
59 or, VPNs. Two popular representatives of such software are OpenVPN and VTUN.
60 .PP
61 The latter also introduced the TUN/TAP interfaces into the Linux kernel. VTUN
62 only has a rather basic encryption module, that does not fit todays
63 cryptographic needs. By default, MD5 is used to create 128-Bit wide keys for
64 the symmetric BlowFish cipher in ECB mode [1].
65 .PP
66 Although OpenSSL is used in both VTUN and OpenVPN, OpenVPN is much more
67 feature rich regarding ciphers and user authentication. Nevertheless, letting
68 people choose ciphers or authentication methods is not necessarily a
69 good thing: administrators could either prefer speed over security and
70 therefore choose weak ciphers, so that the communication system will be as
71 good as without any cipher; they could choose weak passwords for symmetric
72 encryption or they could misconfigure the communication system by having too
73 much choice of ciphers and too little experience for picking the right one.
74 .PP
75 Next to the administration issues, there are also software development issues.
76 Cryptographic libraries like OpenSSL are a huge mess and too low-level and
77 complex to properly fully understand or correctly apply, so that they form a
78 further ground for vulnerabilities of such software.
79 .PP
80 In 2010, the cryptographers Tanja Lange and Daniel J. Bernstein have therefore
81 created and published a cryptography library for networking, which is called
82 NaCl (pronounced ''salt''). NaCl addresses such problems as mentioned in
83 OpenSSL and, in contrast to the rather generic use of OpenSSL, was created
84 with a strong focus on public-key authenticated encryption based on elliptic
85 curve cryptography, which is used in curvetun. Partially quoting Daniel J.
86 Bernstein:
87 .PP
88 RSA is somewhat older than elliptic-curve cryptography: RSA was introduced
89 in 1977, while elliptic-curve cryptography was introduced in 1985. However,
90 RSA has shown many more weaknesses than elliptic-curve cryptography. RSA's
91 effective security level was dramatically reduced by the linear sieve in the
92 late 1970s, by the quadratic sieve and ECM in the 1980s, and by the
93 number-field sieve in the 1990s. For comparison, a few attacks have been
94 developed against some rare elliptic curves having special algebraic
95 structures, and the amount of computer power available to attackers has
96 predictably increased, but typical elliptic curves require just as much
97 computer power to break today as they required twenty years ago.
98 .PP
99 IEEE P1363 standardized elliptic-curve cryptography in the late 1990s,
100 including a stringent list of security criteria for elliptic curves. NIST
101 used the IEEE P1363 criteria to select fifteen specific elliptic curves at
102 five different security levels. In 2005, NSA issued a new ''Suite B''
103 standard, recommending the NIST elliptic curves (at two specific security
104 levels) for all public-key cryptography and withdrawing previous
105 recommendations of RSA.
107 curvetun uses a particular elliptic curve, Curve25519, introduced in the
108 following paper: Daniel J. Bernstein, ''Curve25519: new Diffie-Hellman speed
109 records,'' pages 207-228 in Proceedings of PKC 2006, edited by Moti Yung,
110 Yevgeniy Dodis, Aggelos Kiayias, and Tal Malkin, Lecture Notes in Computer
111 Science 3958, Springer, 2006, ISBN 3-540-33851-9.
113 This elliptic curve follows all of the standard IEEE P1363 security criteria.
114 It also follows new recommendations that achieve ''side-channel immunity''
115 and ''twist security'' while improving speed. What this means is that secure
116 implementations of Curve25519 are considerably simpler and faster than secure
117 implementations of, for example, NIST P-256; there are fewer opportunities for
118 implementors to make mistakes that compromise security, and mistakes are
119 more easily caught by reviewers.
121 An attacker who spends a billion dollars on special-purpose chips to attack
122 Curve25519, using the best attacks available today, has about 1 chance in
123 1000000000000000000000000000 of breaking Curve25519 after a year of computation.
124 One could achieve similar levels of security with 3000-bit RSA, but
125 encryption and authentication with 3000-bit RSA are not nearly fast enough
126 to handle tunnel traffic and would require much more space in network
127 packets.
129 .IP " 1." 4
130 Security analysis of VTun
131 .RS 4
132 \%http://www.off.net/~jme/vtun_secu.html
135 .IP " 2." 4
136 NaCl: Networking and Cryptography library
137 .RS 4
138 \%http://nacl.cr.yp.to/
141 .SH SETUP EXAMPLE
142 If you've never run curvetun before, you need to do an initial setup once.
144 First, make sure that the servers and clients clocks are periodically
145 synced, for example, by running an ntp daemon. This is necessary to protect
146 against replay attacks. Also, make sure you have read and write access to
147 /dev/net/tun. You should not run curvetun as root! Then, after you have assured
148 this, the first step is to generate keys and config files. On both the client
149 and server do:
151 .B curvetun -k
153 You are asked for a user name. You can use an email address or whatever suits
154 you. Here, we assume you have entered 'mysrv1' on the server and 'myclient1'
155 on the client side.
157 Now, all necessary files have been created under ~/.curvetun. Files include
158 \[lq]priv.key\[rq], \[lq]pub.key\[rq], \[lq]username\[rq], \[lq]clients\[rq] and \[lq]servers\[rq].
160 \[lq]clients\[rq] and \[lq]servers\[rq] are empty at the beginning and need to be filled.
161 The \[lq]clients\[rq] file is meant for the server, so that it knows what clients
162 are allowed to connect. The \[lq]servers\[rq] file is for the client, where it can
163 select curvetun servers to connect to. Both files are kept very simple, so that
164 a single configuration line per client or server is sufficient.
166 The client needs to export its public key data for the server:
168 .B curvetun -x
170 todo FIXME
172 .SH NOTE
173 This software is an experimental prototype intended for researchers. It will most
174 likely mature over time, but it is currently not advised to use this software
175 when life is put at risk.
177 .SH LEGAL
178 curvetun is licensed under the GNU GPL version 2.0.
180 .SH HISTORY
181 .B curvetun
182 was originally written for the netsniff-ng toolkit by Daniel Borkmann. It is
183 currently maintained by Tobias Klauser <tklauser@distanz.ch> and Daniel
184 Borkmann <dborkma@tik.ee.ethz.ch>.
186 .SH SEE ALSO
187 .BR netsniff-ng (8),
188 .BR trafgen (8),
189 .BR mausezahn (8),
190 .BR bpfc (8),
191 .BR ifpps (8),
192 .BR flowtop (8),
193 .BR astraceroute (8)
195 .SH AUTHOR
196 Manpage was written by Daniel Borkmann.