diff options
author | Nils Gillmann <ng0@n0.is> | 2018-06-11 06:34:14 +0000 |
---|---|---|
committer | Nils Gillmann <ng0@n0.is> | 2018-06-11 06:34:14 +0000 |
commit | 0183db872cb4df16971ea045ef204f190d901ed9 (patch) | |
tree | 969ae2cbd76ef60e85fa2cfcf56afca5e39dfaaa /doc/documentation/chapters/developer.texi | |
parent | 9c6274c6af9b86952de81029e4c36b724a356af5 (diff) | |
download | gnunet-0183db872cb4df16971ea045ef204f190d901ed9.tar.gz gnunet-0183db872cb4df16971ea045ef204f190d901ed9.zip |
documentation: user + developer changes
Signed-off-by: Nils Gillmann <ng0@n0.is>
Diffstat (limited to 'doc/documentation/chapters/developer.texi')
-rw-r--r-- | doc/documentation/chapters/developer.texi | 383 |
1 files changed, 382 insertions, 1 deletions
diff --git a/doc/documentation/chapters/developer.texi b/doc/documentation/chapters/developer.texi index 6a895ed11..16039c8d3 100644 --- a/doc/documentation/chapters/developer.texi +++ b/doc/documentation/chapters/developer.texi | |||
@@ -11,7 +11,7 @@ For developers, GNUnet is: | |||
11 | @itemize @bullet | 11 | @itemize @bullet |
12 | @item developed by a community that believes in the GNU philosophy | 12 | @item developed by a community that believes in the GNU philosophy |
13 | @item Free Software (Free as in Freedom), licensed under the | 13 | @item Free Software (Free as in Freedom), licensed under the |
14 | GNU General Public License@footnote{@uref{https://www.gnu.org/licenses/licenses.html#GPL, https://www.gnu.org/licenses/licenses.html#GPL}} | 14 | GNU Affero General Public License@footnote{@uref{https://www.gnu.org/licenses/licenses.html#AGPL, https://www.gnu.org/licenses/licenses.html#AGPL}} |
15 | @item A set of standards, including coding conventions and | 15 | @item A set of standards, including coding conventions and |
16 | architectural rules | 16 | architectural rules |
17 | @item A set of layered protocols, both specifying the communication | 17 | @item A set of layered protocols, both specifying the communication |
@@ -40,6 +40,7 @@ new chapters, sections or insightful comments. | |||
40 | 40 | ||
41 | @menu | 41 | @menu |
42 | * Developer Introduction:: | 42 | * Developer Introduction:: |
43 | * Internal Dependencies:: | ||
43 | * Code overview:: | 44 | * Code overview:: |
44 | * System Architecture:: | 45 | * System Architecture:: |
45 | * Subsystem stability:: | 46 | * Subsystem stability:: |
@@ -47,6 +48,7 @@ new chapters, sections or insightful comments. | |||
47 | * Build-system:: | 48 | * Build-system:: |
48 | * Developing extensions for GNUnet using the gnunet-ext template:: | 49 | * Developing extensions for GNUnet using the gnunet-ext template:: |
49 | * Writing testcases:: | 50 | * Writing testcases:: |
51 | * Building GNUnet and its dependencies:: | ||
50 | * TESTING library:: | 52 | * TESTING library:: |
51 | * Performance regression analysis with Gauger:: | 53 | * Performance regression analysis with Gauger:: |
52 | * TESTBED Subsystem:: | 54 | * TESTBED Subsystem:: |
@@ -251,6 +253,77 @@ those that have a public website) which build on top of the GNUnet | |||
251 | framework. | 253 | framework. |
252 | 254 | ||
253 | @c *********************************************************************** | 255 | @c *********************************************************************** |
256 | @node Internal dependencies | ||
257 | @section Internal dependencies | ||
258 | |||
259 | This section tries to give an overview of what processes a typical GNUnet | ||
260 | peer running a particular application would consist of. All of the | ||
261 | processes listed here should be automatically started by | ||
262 | @command{gnunet-arm -s}. | ||
263 | The list is given as a rough first guide to users for failure diagnostics. | ||
264 | Ideally, end-users should never have to worry about these internal | ||
265 | dependencies. | ||
266 | |||
267 | In terms of internal dependencies, a minimum file-sharing system consists | ||
268 | of the following GNUnet processes (in order of dependency): | ||
269 | |||
270 | @itemize @bullet | ||
271 | @item gnunet-service-arm | ||
272 | @item gnunet-service-resolver (required by all) | ||
273 | @item gnunet-service-statistics (required by all) | ||
274 | @item gnunet-service-peerinfo | ||
275 | @item gnunet-service-transport (requires peerinfo) | ||
276 | @item gnunet-service-core (requires transport) | ||
277 | @item gnunet-daemon-hostlist (requires core) | ||
278 | @item gnunet-daemon-topology (requires hostlist, peerinfo) | ||
279 | @item gnunet-service-datastore | ||
280 | @item gnunet-service-dht (requires core) | ||
281 | @item gnunet-service-identity | ||
282 | @item gnunet-service-fs (requires identity, mesh, dht, datastore, core) | ||
283 | @end itemize | ||
284 | |||
285 | @noindent | ||
286 | A minimum VPN system consists of the following GNUnet processes (in | ||
287 | order of dependency): | ||
288 | |||
289 | @itemize @bullet | ||
290 | @item gnunet-service-arm | ||
291 | @item gnunet-service-resolver (required by all) | ||
292 | @item gnunet-service-statistics (required by all) | ||
293 | @item gnunet-service-peerinfo | ||
294 | @item gnunet-service-transport (requires peerinfo) | ||
295 | @item gnunet-service-core (requires transport) | ||
296 | @item gnunet-daemon-hostlist (requires core) | ||
297 | @item gnunet-service-dht (requires core) | ||
298 | @item gnunet-service-mesh (requires dht, core) | ||
299 | @item gnunet-service-dns (requires dht) | ||
300 | @item gnunet-service-regex (requires dht) | ||
301 | @item gnunet-service-vpn (requires regex, dns, mesh, dht) | ||
302 | @end itemize | ||
303 | |||
304 | @noindent | ||
305 | A minimum GNS system consists of the following GNUnet processes (in | ||
306 | order of dependency): | ||
307 | |||
308 | @itemize @bullet | ||
309 | @item gnunet-service-arm | ||
310 | @item gnunet-service-resolver (required by all) | ||
311 | @item gnunet-service-statistics (required by all) | ||
312 | @item gnunet-service-peerinfo | ||
313 | @item gnunet-service-transport (requires peerinfo) | ||
314 | @item gnunet-service-core (requires transport) | ||
315 | @item gnunet-daemon-hostlist (requires core) | ||
316 | @item gnunet-service-dht (requires core) | ||
317 | @item gnunet-service-mesh (requires dht, core) | ||
318 | @item gnunet-service-dns (requires dht) | ||
319 | @item gnunet-service-regex (requires dht) | ||
320 | @item gnunet-service-vpn (requires regex, dns, mesh, dht) | ||
321 | @item gnunet-service-identity | ||
322 | @item gnunet-service-namestore (requires identity) | ||
323 | @item gnunet-service-gns (requires vpn, dns, dht, namestore, identity) | ||
324 | @end itemize | ||
325 | |||
326 | @c *********************************************************************** | ||
254 | @node Code overview | 327 | @node Code overview |
255 | @section Code overview | 328 | @section Code overview |
256 | 329 | ||
@@ -1089,6 +1162,314 @@ typically necessary to run @code{make install} before running any | |||
1089 | testcases. Thus the canonical command @code{make check install} has to be | 1162 | testcases. Thus the canonical command @code{make check install} has to be |
1090 | changed to @code{make install check} for GNUnet. | 1163 | changed to @code{make install check} for GNUnet. |
1091 | 1164 | ||
1165 | @c *********************************************************************** | ||
1166 | @cindex Building GNUnet | ||
1167 | @node Building GNUnet and its dependencies | ||
1168 | @section Building GNUnet and its dependencies | ||
1169 | |||
1170 | In the following section we will outline how to build GNUnet and | ||
1171 | some of its dependencies. We will assume a fair amount of knowledge | ||
1172 | for building applications under UNIX-like systems. Furthermore we | ||
1173 | assume that the build environment is sane and that you are aware of | ||
1174 | any implications actions in this process could have. | ||
1175 | Instructions here can be seen as notes for developers (an extension to | ||
1176 | the 'HACKING' section in README) as well as package mantainers. | ||
1177 | @b{Users should rely on the available binary packages.} | ||
1178 | We will use Debian as an example Operating System environment. Substitute | ||
1179 | accordingly with your own Ooperating System environment. | ||
1180 | |||
1181 | For the full list of depenendencies, consult the appropriate, up-to-date | ||
1182 | section in the @file{README} file. | ||
1183 | |||
1184 | First, we need to build or install (depending on your OS) the following | ||
1185 | packages. If you build them from source, build them in this exact order: | ||
1186 | |||
1187 | @exmaple | ||
1188 | libgpgerror, libgcrypt, libnettle, libunbound, GnuTLS (with libunbound | ||
1189 | support) | ||
1190 | @end example | ||
1191 | |||
1192 | After we have build and installed those packages, we continue with | ||
1193 | packages closer to GNUnet in this step: libgnurl (our libcurl fork), | ||
1194 | GNU libmicrohttpd, and GNU libextractor. Again, if your package manager | ||
1195 | provides one of these packages, use the packages provided from it | ||
1196 | unless you have good reasons (package version too old, conflicts, etc). | ||
1197 | We advise against compiling widely used packages such as GnuTLS | ||
1198 | yourself if your OS provides a variant already unless you take care | ||
1199 | of maintenance of the packages then. | ||
1200 | |||
1201 | In the optimistic case, this command will give you all the dependencies: | ||
1202 | |||
1203 | @example | ||
1204 | sudo apt-get install libgnurl libmicrohttpd libextractor | ||
1205 | @end example | ||
1206 | |||
1207 | From experience we know that at the very least libgnurl is not | ||
1208 | available in some environments. You could substitute libgnurl | ||
1209 | with libcurl, but we recommend to install libgnurl, as it gives | ||
1210 | you a predefined libcurl with the small set GNUnet requires. In | ||
1211 | the past namespaces of libcurl and libgnurl were shared, which | ||
1212 | caused problems when you wanted to integrate both of them in one | ||
1213 | Operating System. This has been resolved, and they can be installed | ||
1214 | side by side now. | ||
1215 | |||
1216 | @cindex libgnurl | ||
1217 | @cindex compiling libgnurl | ||
1218 | GNUnet and some of its function depend on a limited subset of cURL/libcurl. | ||
1219 | Rather than trying to enforce a certain configuration on the world, we | ||
1220 | opted to maintain a microfork of it that ensures we can link against the | ||
1221 | right set of features. We called this specialized set of libcurl | ||
1222 | ``libgnurl''. It is fully ABI compatible with libcurl and currently used | ||
1223 | by GNUnet and some of its dependencies. | ||
1224 | |||
1225 | We download libgnurl and its digital signature from the GNU fileserver, | ||
1226 | assuming @env{TMPDIR} exists@footnote{It might be @file{/tmp}, @env{TMPDIR}, @env{TMP} or any other location. For consistency we assume @env{TMPDIR} points to @file{/tmp} for the remainder of this section.} | ||
1227 | |||
1228 | @example | ||
1229 | cd \$TMPDIR | ||
1230 | wget https://ftp.gnu.org/gnu/gnunet/gnurl-7.60.0.tar.Z | ||
1231 | wget https://ftp.gnu.org/gnu/gnunet/gnurl-7.60.0.tar.Z.sig | ||
1232 | @end example | ||
1233 | |||
1234 | Next, verify the digital signature of the file: | ||
1235 | |||
1236 | @example | ||
1237 | gpg --verify gnurl-7.60.0.tar.Z.sig | ||
1238 | @end example | ||
1239 | |||
1240 | If gpg fails, you might try with @command{gpg2} on your OS. If the error | ||
1241 | states that ``the key can not be found'' or it is unknown, you have to | ||
1242 | retrieve the key (A88C8ADD129828D7EAC02E52E22F9BBFEE348588) from a | ||
1243 | keyserver first: | ||
1244 | |||
1245 | @example | ||
1246 | gpg --keyserver pgp.mit.edu --recv-keys A88C8ADD129828D7EAC02E52E22F9BBFEE348588 | ||
1247 | @end example | ||
1248 | |||
1249 | and rerun the verification command. | ||
1250 | |||
1251 | libgnurl will require the following packages to be present at runtime: | ||
1252 | gnutls (with DANE support / libunbound), libidn, zlib and at compile time: | ||
1253 | libtool, groff, perl, pkg-config, and python 2.7. | ||
1254 | |||
1255 | Once you have verified that all the required packages are present on your | ||
1256 | system, we can proceed to compile libgnurl: | ||
1257 | |||
1258 | @example | ||
1259 | tar -xvf gnurl-7.60.0.tar.Z | ||
1260 | cd gnurl-7.60.0 | ||
1261 | sh configure --disable-ntlm-wb | ||
1262 | make | ||
1263 | make -C tests test | ||
1264 | sudo make install | ||
1265 | @end example | ||
1266 | |||
1267 | After you've compiled and installed libgnurl, we can proceed to building | ||
1268 | GNUnet. | ||
1269 | |||
1270 | |||
1271 | |||
1272 | |||
1273 | First, in addition to the GNUnet sources you might require downloading the | ||
1274 | latest version of various dependencies, depending on how recent the | ||
1275 | software versions in your distribution of GNU/Linux are. | ||
1276 | Most distributions do not include sufficiently recent versions of these | ||
1277 | dependencies. | ||
1278 | Thus, a typically installation on a "modern" GNU/Linux distribution | ||
1279 | requires you to install the following dependencies (ideally in this | ||
1280 | order): | ||
1281 | |||
1282 | @itemize @bullet | ||
1283 | @item libgpgerror and libgcrypt | ||
1284 | @item libnettle and libunbound (possibly from distribution), GnuTLS | ||
1285 | @item libgnurl (read the README) | ||
1286 | @item GNU libmicrohttpd | ||
1287 | @item GNU libextractor | ||
1288 | @end itemize | ||
1289 | |||
1290 | Make sure to first install the various mandatory and optional | ||
1291 | dependencies including development headers from your distribution. | ||
1292 | |||
1293 | Other dependencies that you should strongly consider to install is a | ||
1294 | database (MySQL, sqlite or Postgres). | ||
1295 | The following instructions will assume that you installed at least sqlite. | ||
1296 | For most distributions you should be able to find pre-build packages for | ||
1297 | the database. Again, make sure to install the client libraries @b{and} the | ||
1298 | respective development headers (if they are packaged separately) as well. | ||
1299 | |||
1300 | You can find specific, detailed instructions for installing of the | ||
1301 | dependencies (and possibly the rest of the GNUnet installation) in the | ||
1302 | platform-specific descriptions, which can be found in the Index. | ||
1303 | Please consult them now. | ||
1304 | If your distribution is not listed, please study | ||
1305 | @ref{Build instructions for Debian 8}, the build instructions for | ||
1306 | Debian stable, carefully as you try to install the dependencies for your | ||
1307 | own distribution. | ||
1308 | Contributing additional instructions for further platforms is always | ||
1309 | appreciated. | ||
1310 | Please take in mind that operating system development tends to move at | ||
1311 | a rather fast speed. Due to this you should be aware that some of | ||
1312 | the instructions could be outdated by the time you are reading this. | ||
1313 | If you find a mistake, please tell us about it (or even better: send | ||
1314 | a patch to the documentation to fix it!). | ||
1315 | |||
1316 | Before proceeding further, please double-check the dependency list. | ||
1317 | Note that in addition to satisfying the dependencies, you might have to | ||
1318 | make sure that development headers for the various libraries are also | ||
1319 | installed. | ||
1320 | There maybe files for other distributions, or you might be able to find | ||
1321 | equivalent packages for your distribution. | ||
1322 | |||
1323 | While it is possible to build and install GNUnet without having root | ||
1324 | access, we will assume that you have full control over your system in | ||
1325 | these instructions. | ||
1326 | First, you should create a system user @emph{gnunet} and an additional | ||
1327 | group @emph{gnunetdns}. On the GNU/Linux distributions Debian and Ubuntu, | ||
1328 | type: | ||
1329 | |||
1330 | @example | ||
1331 | sudo adduser --system --home /var/lib/gnunet --group \ | ||
1332 | --disabled-password gnunet | ||
1333 | sudo addgroup --system gnunetdns | ||
1334 | @end example | ||
1335 | |||
1336 | @noindent | ||
1337 | On other Unixes and GNU systems, this should have the same effect: | ||
1338 | |||
1339 | @example | ||
1340 | sudo useradd --system --groups gnunet --home-dir /var/lib/gnunet | ||
1341 | sudo addgroup --system gnunetdns | ||
1342 | @end example | ||
1343 | |||
1344 | Now compile and install GNUnet using: | ||
1345 | |||
1346 | @example | ||
1347 | tar xvf gnunet-@value{VERSION}.tar.gz | ||
1348 | cd gnunet-@value{VERSION} | ||
1349 | ./configure --with-sudo=sudo --with-nssdir=/lib | ||
1350 | make | ||
1351 | sudo make install | ||
1352 | @end example | ||
1353 | |||
1354 | If you want to be able to enable DEBUG-level log messages, add | ||
1355 | @code{--enable-logging=verbose} to the end of the | ||
1356 | @command{./configure} command. | ||
1357 | @code{DEBUG}-level log messages are in English only and | ||
1358 | should only be useful for developers (or for filing | ||
1359 | really detailed bug reports). | ||
1360 | |||
1361 | @noindent | ||
1362 | Next, edit the file @file{/etc/gnunet.conf} to contain the following: | ||
1363 | |||
1364 | @example | ||
1365 | [arm] | ||
1366 | SYSTEM_ONLY = YES | ||
1367 | USER_ONLY = NO | ||
1368 | @end example | ||
1369 | |||
1370 | @noindent | ||
1371 | You may need to update your @code{ld.so} cache to include | ||
1372 | files installed in @file{/usr/local/lib}: | ||
1373 | |||
1374 | @example | ||
1375 | # ldconfig | ||
1376 | @end example | ||
1377 | |||
1378 | @noindent | ||
1379 | Then, switch from user @code{root} to user @code{gnunet} to start | ||
1380 | the peer: | ||
1381 | |||
1382 | @example | ||
1383 | # su -s /bin/sh - gnunet | ||
1384 | $ gnunet-arm -c /etc/gnunet.conf -s | ||
1385 | @end example | ||
1386 | |||
1387 | You may also want to add the last line in the gnunet user's @file{crontab} | ||
1388 | prefixed with @code{@@reboot} so that it is executed whenever the system | ||
1389 | is booted: | ||
1390 | |||
1391 | @example | ||
1392 | @@reboot /usr/local/bin/gnunet-arm -c /etc/gnunet.conf -s | ||
1393 | @end example | ||
1394 | |||
1395 | @noindent | ||
1396 | This will only start the system-wide GNUnet services. | ||
1397 | Type @command{exit} to get back your root shell. | ||
1398 | Now, you need to configure the per-user part. For each | ||
1399 | user that should get access to GNUnet on the system, run | ||
1400 | (replace alice with your username): | ||
1401 | |||
1402 | @example | ||
1403 | sudo adduser alice gnunet | ||
1404 | @end example | ||
1405 | |||
1406 | @noindent | ||
1407 | to allow them to access the system-wide GNUnet services. Then, each | ||
1408 | user should create a configuration file @file{~/.config/gnunet.conf} | ||
1409 | with the lines: | ||
1410 | |||
1411 | @example | ||
1412 | [arm] | ||
1413 | SYSTEM_ONLY = NO | ||
1414 | USER_ONLY = YES | ||
1415 | DEFAULTSERVICES = gns | ||
1416 | @end example | ||
1417 | |||
1418 | @noindent | ||
1419 | and start the per-user services using | ||
1420 | |||
1421 | @example | ||
1422 | $ gnunet-arm -c ~/.config/gnunet.conf -s | ||
1423 | @end example | ||
1424 | |||
1425 | @noindent | ||
1426 | Again, adding a @code{crontab} entry to autostart the peer is advised: | ||
1427 | |||
1428 | @example | ||
1429 | @@reboot /usr/local/bin/gnunet-arm -c $HOME/.config/gnunet.conf -s | ||
1430 | @end example | ||
1431 | |||
1432 | @noindent | ||
1433 | Note that some GNUnet services (such as SOCKS5 proxies) may need a | ||
1434 | system-wide TCP port for each user. | ||
1435 | For those services, systems with more than one user may require each user | ||
1436 | to specify a different port number in their personal configuration file. | ||
1437 | |||
1438 | Finally, the user should perform the basic initial setup for the GNU Name | ||
1439 | System (GNS) certificate authority. This is done by running: | ||
1440 | |||
1441 | @example | ||
1442 | $ gnunet-gns-proxy-setup-ca | ||
1443 | @end example | ||
1444 | |||
1445 | @noindent | ||
1446 | The first generates the default zones, wheras the second setups the GNS | ||
1447 | Certificate Authority with the user's browser. Now, to activate GNS in the | ||
1448 | normal DNS resolution process, you need to edit your | ||
1449 | @file{/etc/nsswitch.conf} where you should find a line like this: | ||
1450 | |||
1451 | @example | ||
1452 | hosts: files mdns4_minimal [NOTFOUND=return] dns mdns4 | ||
1453 | @end example | ||
1454 | |||
1455 | @noindent | ||
1456 | The exact details may differ a bit, which is fine. Add the text | ||
1457 | @emph{"gns [NOTFOUND=return]"} after @emph{"files"}. | ||
1458 | Keep in mind that we included a backslash ("\") here just for | ||
1459 | markup reasons. You should write the text below on @b{one line} | ||
1460 | and @b{without} the "\": | ||
1461 | |||
1462 | @example | ||
1463 | hosts: files gns [NOTFOUND=return] mdns4_minimal \ | ||
1464 | [NOTFOUND=return] dns mdns4 | ||
1465 | @end example | ||
1466 | |||
1467 | @c FIXME: Document new behavior. | ||
1468 | You might want to make sure that @file{/lib/libnss_gns.so.2} exists on | ||
1469 | your system, it should have been created during the installation. | ||
1470 | |||
1471 | |||
1472 | @c ********************************************************************** | ||
1092 | @cindex TESTING library | 1473 | @cindex TESTING library |
1093 | @node TESTING library | 1474 | @node TESTING library |
1094 | @section TESTING library | 1475 | @section TESTING library |