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/user.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/user.texi')
-rw-r--r-- | doc/documentation/chapters/user.texi | 1926 |
1 files changed, 1926 insertions, 0 deletions
diff --git a/doc/documentation/chapters/user.texi b/doc/documentation/chapters/user.texi index e5ebf5371..48fcc04c3 100644 --- a/doc/documentation/chapters/user.texi +++ b/doc/documentation/chapters/user.texi | |||
@@ -27,6 +27,8 @@ Comments and extensions of this documentation are always welcome. | |||
27 | * File-sharing:: | 27 | * File-sharing:: |
28 | * The GNU Name System:: | 28 | * The GNU Name System:: |
29 | * Using the Virtual Public Network:: | 29 | * Using the Virtual Public Network:: |
30 | * The graphical configuration interface:: | ||
31 | * How to start and stop a GNUnet peer:: | ||
30 | @end menu | 32 | @end menu |
31 | 33 | ||
32 | @node Checking the Installation | 34 | @node Checking the Installation |
@@ -2006,3 +2008,1927 @@ service offered by that peer, you can create an IP tunnel to | |||
2006 | that peer by specifying the peer's identity, service name and | 2008 | that peer by specifying the peer's identity, service name and |
2007 | protocol (--tcp or --udp) and you will again receive an IP address | 2009 | protocol (--tcp or --udp) and you will again receive an IP address |
2008 | that will terminate at the respective peer's service. | 2010 | that will terminate at the respective peer's service. |
2011 | |||
2012 | |||
2013 | |||
2014 | @c NOTE: Inserted from Installation Handbook in original ``order'': | ||
2015 | @c FIXME: Move this to User Handbook. | ||
2016 | @node The graphical configuration interface | ||
2017 | @section The graphical configuration interface | ||
2018 | |||
2019 | If you also would like to use @command{gnunet-gtk} and | ||
2020 | @command{gnunet-setup} (highly recommended for beginners), do: | ||
2021 | |||
2022 | @menu | ||
2023 | * Configuring your peer:: | ||
2024 | * Configuring the Friend-to-Friend (F2F) mode:: | ||
2025 | * Configuring the hostlist to bootstrap:: | ||
2026 | * Configuration of the HOSTLIST proxy settings:: | ||
2027 | * Configuring your peer to provide a hostlist :: | ||
2028 | * Configuring the datastore:: | ||
2029 | * Configuring the MySQL database:: | ||
2030 | * Reasons for using MySQL:: | ||
2031 | * Reasons for not using MySQL:: | ||
2032 | * Setup Instructions:: | ||
2033 | * Testing:: | ||
2034 | * Performance Tuning:: | ||
2035 | * Setup for running Testcases:: | ||
2036 | * Configuring the Postgres database:: | ||
2037 | * Reasons to use Postgres:: | ||
2038 | * Reasons not to use Postgres:: | ||
2039 | * Manual setup instructions:: | ||
2040 | * Testing the setup manually:: | ||
2041 | * Configuring the datacache:: | ||
2042 | * Configuring the file-sharing service:: | ||
2043 | * Configuring logging:: | ||
2044 | * Configuring the transport service and plugins:: | ||
2045 | * Configuring the wlan transport plugin:: | ||
2046 | * Configuring HTTP(S) reverse proxy functionality using Apache or nginx:: | ||
2047 | * Blacklisting peers:: | ||
2048 | * Configuration of the HTTP and HTTPS transport plugins:: | ||
2049 | * Configuring the GNU Name System:: | ||
2050 | * Configuring the GNUnet VPN:: | ||
2051 | * Bandwidth Configuration:: | ||
2052 | * Configuring NAT:: | ||
2053 | * Peer configuration for distributions:: | ||
2054 | @end menu | ||
2055 | |||
2056 | @node Configuring your peer | ||
2057 | @subsection Configuring your peer | ||
2058 | |||
2059 | This chapter will describe the various configuration options in GNUnet. | ||
2060 | |||
2061 | The easiest way to configure your peer is to use the | ||
2062 | @command{gnunet-setup} tool. | ||
2063 | @command{gnunet-setup} is part of the @command{gnunet-gtk} | ||
2064 | application. You might have to install it separately. | ||
2065 | |||
2066 | Many of the specific sections from this chapter actually are linked from | ||
2067 | within @command{gnunet-setup} to help you while using the setup tool. | ||
2068 | |||
2069 | While you can also configure your peer by editing the configuration | ||
2070 | file by hand, this is not recommended for anyone except for developers | ||
2071 | as it requires a more in-depth understanding of the configuration files | ||
2072 | and internal dependencies of GNUnet. | ||
2073 | |||
2074 | @node Configuring the Friend-to-Friend (F2F) mode | ||
2075 | @subsection Configuring the Friend-to-Friend (F2F) mode | ||
2076 | |||
2077 | GNUnet knows three basic modes of operation: | ||
2078 | @itemize @bullet | ||
2079 | @item In standard "peer-to-peer" mode, | ||
2080 | your peer will connect to any peer. | ||
2081 | @item In the pure "friend-to-friend" | ||
2082 | mode, your peer will ONLY connect to peers from a list of friends | ||
2083 | specified in the configuration. | ||
2084 | @item Finally, in mixed mode, | ||
2085 | GNUnet will only connect to arbitrary peers if it | ||
2086 | has at least a specified number of connections to friends. | ||
2087 | @end itemize | ||
2088 | |||
2089 | When configuring any of the F2F ("friend-to-friend") modes, | ||
2090 | you first need to create a file with the peer identities | ||
2091 | of your friends. Ask your friends to run | ||
2092 | |||
2093 | @example | ||
2094 | $ gnunet-peerinfo -sq | ||
2095 | @end example | ||
2096 | |||
2097 | @noindent | ||
2098 | The resulting output of this command needs to be added to your | ||
2099 | @file{friends} file, which is simply a plain text file with one line | ||
2100 | per friend with the output from the above command. | ||
2101 | |||
2102 | You then specify the location of your @file{friends} file in the | ||
2103 | @code{FRIENDS} option of the "topology" section. | ||
2104 | |||
2105 | Once you have created the @file{friends} file, you can tell GNUnet to only | ||
2106 | connect to your friends by setting the @code{FRIENDS-ONLY} option | ||
2107 | (again in the "topology" section) to YES. | ||
2108 | |||
2109 | If you want to run in mixed-mode, set "FRIENDS-ONLY" to NO and configure a | ||
2110 | minimum number of friends to have (before connecting to arbitrary peers) | ||
2111 | under the "MINIMUM-FRIENDS" option. | ||
2112 | |||
2113 | If you want to operate in normal P2P-only mode, simply set | ||
2114 | @code{MINIMUM-FRIENDS} to zero and @code{FRIENDS_ONLY} to NO. | ||
2115 | This is the default. | ||
2116 | |||
2117 | @node Configuring the hostlist to bootstrap | ||
2118 | @subsection Configuring the hostlist to bootstrap | ||
2119 | |||
2120 | After installing the software you need to get connected to the GNUnet | ||
2121 | network. The configuration file included in your download is already | ||
2122 | configured to connect you to the GNUnet network. | ||
2123 | In this section the relevant configuration settings are explained. | ||
2124 | |||
2125 | To get an initial connection to the GNUnet network and to get to know | ||
2126 | peers already connected to the network you can use the so called | ||
2127 | "bootstrap servers". | ||
2128 | These servers can give you a list of peers connected to the network. | ||
2129 | To use these bootstrap servers you have to configure the hostlist daemon | ||
2130 | to activate bootstrapping. | ||
2131 | |||
2132 | To activate bootstrapping, edit the @code{[hostlist]}-section in your | ||
2133 | configuration file. You have to set the argument @command{-b} in the | ||
2134 | options line: | ||
2135 | |||
2136 | @example | ||
2137 | [hostlist] | ||
2138 | OPTIONS = -b | ||
2139 | @end example | ||
2140 | |||
2141 | Additionally you have to specify which server you want to use. | ||
2142 | The default bootstrapping server is | ||
2143 | "@uref{http://v10.gnunet.org/hostlist, http://v10.gnunet.org/hostlist}". | ||
2144 | [^] To set the server you have to edit the line "SERVERS" in the hostlist | ||
2145 | section. To use the default server you should set the lines to | ||
2146 | |||
2147 | @example | ||
2148 | SERVERS = http://v10.gnunet.org/hostlist [^] | ||
2149 | @end example | ||
2150 | |||
2151 | @noindent | ||
2152 | To use bootstrapping your configuration file should include these lines: | ||
2153 | |||
2154 | @example | ||
2155 | [hostlist] | ||
2156 | OPTIONS = -b | ||
2157 | SERVERS = http://v10.gnunet.org/hostlist [^] | ||
2158 | @end example | ||
2159 | |||
2160 | @noindent | ||
2161 | Besides using bootstrap servers you can configure your GNUnet peer to | ||
2162 | recieve hostlist advertisements. | ||
2163 | Peers offering hostlists to other peers can send advertisement messages | ||
2164 | to peers that connect to them. If you configure your peer to receive these | ||
2165 | messages, your peer can download these lists and connect to the peers | ||
2166 | included. These lists are persistent, which means that they are saved to | ||
2167 | your hard disk regularly and are loaded during startup. | ||
2168 | |||
2169 | To activate hostlist learning you have to add the @command{-e} | ||
2170 | switch to the @code{OPTIONS} line in the hostlist section: | ||
2171 | |||
2172 | @example | ||
2173 | [hostlist] | ||
2174 | OPTIONS = -b -e | ||
2175 | @end example | ||
2176 | |||
2177 | @noindent | ||
2178 | Furthermore you can specify in which file the lists are saved. | ||
2179 | To save the lists in the file @file{hostlists.file} just add the line: | ||
2180 | |||
2181 | @example | ||
2182 | HOSTLISTFILE = hostlists.file | ||
2183 | @end example | ||
2184 | |||
2185 | @noindent | ||
2186 | Best practice is to activate both bootstrapping and hostlist learning. | ||
2187 | So your configuration file should include these lines: | ||
2188 | |||
2189 | @example | ||
2190 | [hostlist] | ||
2191 | OPTIONS = -b -e | ||
2192 | HTTPPORT = 8080 | ||
2193 | SERVERS = http://v10.gnunet.org/hostlist [^] | ||
2194 | HOSTLISTFILE = $SERVICEHOME/hostlists.file | ||
2195 | @end example | ||
2196 | |||
2197 | @node Configuration of the HOSTLIST proxy settings | ||
2198 | @subsection Configuration of the HOSTLIST proxy settings | ||
2199 | |||
2200 | The hostlist client can be configured to use a proxy to connect to the | ||
2201 | hostlist server. | ||
2202 | This functionality can be configured in the configuration file directly | ||
2203 | or using the @command{gnunet-setup} tool. | ||
2204 | |||
2205 | The hostlist client supports the following proxy types at the moment: | ||
2206 | |||
2207 | @itemize @bullet | ||
2208 | @item HTTP and HTTP 1.0 only proxy | ||
2209 | @item SOCKS 4/4a/5/5 with hostname | ||
2210 | @end itemize | ||
2211 | |||
2212 | In addition authentication at the proxy with username and password can be | ||
2213 | configured. | ||
2214 | |||
2215 | To configure proxy support for the hostlist client in the | ||
2216 | @command{gnunet-setup} tool, select the "hostlist" tab and select | ||
2217 | the appropriate proxy type. | ||
2218 | The hostname or IP address (including port if required) has to be entered | ||
2219 | in the "Proxy hostname" textbox. If required, enter username and password | ||
2220 | in the "Proxy username" and "Proxy password" boxes. | ||
2221 | Be aware that this information will be stored in the configuration in | ||
2222 | plain text (TODO: Add explanation and generalize the part in Chapter 3.6 | ||
2223 | about the encrypted home). | ||
2224 | |||
2225 | To provide these options directly in the configuration, you can | ||
2226 | enter the following settings in the @code{[hostlist]} section of | ||
2227 | the configuration: | ||
2228 | |||
2229 | @example | ||
2230 | # Type of proxy server, | ||
2231 | # Valid values: HTTP, HTTP_1_0, SOCKS4, SOCKS5, SOCKS4A, SOCKS5_HOSTNAME | ||
2232 | # Default: HTTP | ||
2233 | # PROXY_TYPE = HTTP | ||
2234 | |||
2235 | # Hostname or IP of proxy server | ||
2236 | # PROXY = | ||
2237 | # User name for proxy server | ||
2238 | # PROXY_USERNAME = | ||
2239 | # User password for proxy server | ||
2240 | # PROXY_PASSWORD = | ||
2241 | @end example | ||
2242 | |||
2243 | @node Configuring your peer to provide a hostlist | ||
2244 | @subsection Configuring your peer to provide a hostlist | ||
2245 | |||
2246 | If you operate a peer permanently connected to GNUnet you can configure | ||
2247 | your peer to act as a hostlist server, providing other peers the list of | ||
2248 | peers known to him. | ||
2249 | |||
2250 | Your server can act as a bootstrap server and peers needing to obtain a | ||
2251 | list of peers can contact it to download this list. | ||
2252 | To download this hostlist the peer uses HTTP. | ||
2253 | For this reason you have to build your peer with libgnurl (or libcurl) | ||
2254 | and microhttpd support. | ||
2255 | How you build your peer with these options can be found here: | ||
2256 | @xref{Generic installation instructions}. | ||
2257 | |||
2258 | To configure your peer to act as a bootstrap server you have to add the | ||
2259 | @command{-p} option to @code{OPTIONS} in the @code{[hostlist]} section | ||
2260 | of your configuration file. | ||
2261 | Besides that you have to specify a port number for the http server. | ||
2262 | In conclusion you have to add the following lines: | ||
2263 | |||
2264 | @example | ||
2265 | [hostlist] | ||
2266 | HTTPPORT = 12980 | ||
2267 | OPTIONS = -p | ||
2268 | @end example | ||
2269 | |||
2270 | @noindent | ||
2271 | If your peer acts as a bootstrap server other peers should know about | ||
2272 | that. You can advertise the hostlist your are providing to other peers. | ||
2273 | Peers connecting to your peer will get a message containing an | ||
2274 | advertisement for your hostlist and the URL where it can be downloaded. | ||
2275 | If this peer is in learning mode, it will test the hostlist and, in the | ||
2276 | case it can obtain the list successfully, it will save it for | ||
2277 | bootstrapping. | ||
2278 | |||
2279 | To activate hostlist advertisement on your peer, you have to set the | ||
2280 | following lines in your configuration file: | ||
2281 | |||
2282 | @example | ||
2283 | [hostlist] | ||
2284 | EXTERNAL_DNS_NAME = example.org | ||
2285 | HTTPPORT = 12981 | ||
2286 | OPTIONS = -p -a | ||
2287 | @end example | ||
2288 | |||
2289 | @noindent | ||
2290 | With this configuration your peer will a act as a bootstrap server and | ||
2291 | advertise this hostlist to other peers connecting to it. | ||
2292 | The URL used to download the list will be | ||
2293 | @code{@uref{http://example.org:12981/, http://example.org:12981/}}. | ||
2294 | |||
2295 | Please notice: | ||
2296 | |||
2297 | @itemize @bullet | ||
2298 | @item The hostlist is @b{not} human readable, so you should not try to | ||
2299 | download it using your webbrowser. Just point your GNUnet peer to the | ||
2300 | address! | ||
2301 | @item Advertising without providing a hostlist does not make sense and | ||
2302 | will not work. | ||
2303 | @end itemize | ||
2304 | |||
2305 | @node Configuring the datastore | ||
2306 | @subsection Configuring the datastore | ||
2307 | |||
2308 | The datastore is what GNUnet uses for long-term storage of file-sharing | ||
2309 | data. Note that long-term does not mean 'forever' since content does have | ||
2310 | an expiration date, and of course storage space is finite (and hence | ||
2311 | sometimes content may have to be discarded). | ||
2312 | |||
2313 | Use the @code{QUOTA} option to specify how many bytes of storage space | ||
2314 | you are willing to dedicate to GNUnet. | ||
2315 | |||
2316 | In addition to specifying the maximum space GNUnet is allowed to use for | ||
2317 | the datastore, you need to specify which database GNUnet should use to do | ||
2318 | so. Currently, you have the choice between sqLite, MySQL and Postgres. | ||
2319 | |||
2320 | @node Configuring the MySQL database | ||
2321 | @subsection Configuring the MySQL database | ||
2322 | |||
2323 | This section describes how to setup the MySQL database for GNUnet. | ||
2324 | |||
2325 | Note that the mysql plugin does NOT work with mysql before 4.1 since we | ||
2326 | need prepared statements. | ||
2327 | We are generally testing the code against MySQL 5.1 at this point. | ||
2328 | |||
2329 | @node Reasons for using MySQL | ||
2330 | @subsection Reasons for using MySQL | ||
2331 | |||
2332 | @itemize @bullet | ||
2333 | |||
2334 | @item On up-to-date hardware wher | ||
2335 | mysql can be used comfortably, this module | ||
2336 | will have better performance than the other database choices (according | ||
2337 | to our tests). | ||
2338 | |||
2339 | @item Its often possible to recover the mysql database from internal | ||
2340 | inconsistencies. Some of the other databases do not support repair. | ||
2341 | @end itemize | ||
2342 | |||
2343 | @node Reasons for not using MySQL | ||
2344 | @subsection Reasons for not using MySQL | ||
2345 | |||
2346 | @itemize @bullet | ||
2347 | @item Memory usage (likely not an issue if you have more than 1 GB) | ||
2348 | @item Complex manual setup | ||
2349 | @end itemize | ||
2350 | |||
2351 | @node Setup Instructions | ||
2352 | @subsection Setup Instructions | ||
2353 | |||
2354 | @itemize @bullet | ||
2355 | |||
2356 | @item In @file{gnunet.conf} set in section @code{DATASTORE} the value for | ||
2357 | @code{DATABASE} to @code{mysql}. | ||
2358 | |||
2359 | @item Access mysql as root: | ||
2360 | |||
2361 | @example | ||
2362 | $ mysql -u root -p | ||
2363 | @end example | ||
2364 | |||
2365 | @noindent | ||
2366 | and issue the following commands, replacing $USER with the username | ||
2367 | that will be running @command{gnunet-arm} (so typically "gnunet"): | ||
2368 | |||
2369 | @example | ||
2370 | CREATE DATABASE gnunet; | ||
2371 | GRANT select,insert,update,delete,create,alter,drop,create \ | ||
2372 | temporary tables ON gnunet.* TO $USER@@localhost; | ||
2373 | SET PASSWORD FOR $USER@@localhost=PASSWORD('$the_password_you_like'); | ||
2374 | FLUSH PRIVILEGES; | ||
2375 | @end example | ||
2376 | |||
2377 | @item | ||
2378 | In the $HOME directory of $USER, create a @file{.my.cnf} file with the | ||
2379 | following lines | ||
2380 | |||
2381 | @example | ||
2382 | [client] | ||
2383 | user=$USER | ||
2384 | password=$the_password_you_like | ||
2385 | @end example | ||
2386 | |||
2387 | @end itemize | ||
2388 | |||
2389 | Thats it. Note that @file{.my.cnf} file is a slight security risk unless | ||
2390 | its on a safe partition. The @file{$HOME/.my.cnf} can of course be | ||
2391 | a symbolic link. | ||
2392 | Luckily $USER has only priviledges to mess up GNUnet's tables, | ||
2393 | which should be pretty harmless. | ||
2394 | |||
2395 | @node Testing | ||
2396 | @subsection Testing | ||
2397 | |||
2398 | You should briefly try if the database connection works. First, login | ||
2399 | as $USER. Then use: | ||
2400 | |||
2401 | @example | ||
2402 | $ mysql -u $USER | ||
2403 | mysql> use gnunet; | ||
2404 | @end example | ||
2405 | |||
2406 | @noindent | ||
2407 | If you get the message | ||
2408 | |||
2409 | @example | ||
2410 | Database changed | ||
2411 | @end example | ||
2412 | |||
2413 | @noindent | ||
2414 | it probably works. | ||
2415 | |||
2416 | If you get | ||
2417 | |||
2418 | @example | ||
2419 | ERROR 2002: Can't connect to local MySQL server | ||
2420 | through socket '/tmp/mysql.sock' (2) | ||
2421 | @end example | ||
2422 | |||
2423 | @noindent | ||
2424 | it may be resolvable by | ||
2425 | |||
2426 | @example | ||
2427 | ln -s /var/run/mysqld/mysqld.sock /tmp/mysql.sock | ||
2428 | @end example | ||
2429 | |||
2430 | @noindent | ||
2431 | so there may be some additional trouble depending on your mysql setup. | ||
2432 | |||
2433 | @node Performance Tuning | ||
2434 | @subsection Performance Tuning | ||
2435 | |||
2436 | For GNUnet, you probably want to set the option | ||
2437 | |||
2438 | @example | ||
2439 | innodb_flush_log_at_trx_commit = 0 | ||
2440 | @end example | ||
2441 | |||
2442 | @noindent | ||
2443 | for a rather dramatic boost in MySQL performance. However, this reduces | ||
2444 | the "safety" of your database as with this options you may loose | ||
2445 | transactions during a power outage. | ||
2446 | While this is totally harmless for GNUnet, the option applies to all | ||
2447 | applications using MySQL. So you should set it if (and only if) GNUnet is | ||
2448 | the only application on your system using MySQL. | ||
2449 | |||
2450 | @node Setup for running Testcases | ||
2451 | @subsection Setup for running Testcases | ||
2452 | |||
2453 | If you want to run the testcases, you must create a second database | ||
2454 | "gnunetcheck" with the same username and password. This database will | ||
2455 | then be used for testing (@command{make check}). | ||
2456 | |||
2457 | @node Configuring the Postgres database | ||
2458 | @subsection Configuring the Postgres database | ||
2459 | |||
2460 | This text describes how to setup the Postgres database for GNUnet. | ||
2461 | |||
2462 | This Postgres plugin was developed for Postgres 8.3 but might work for | ||
2463 | earlier versions as well. | ||
2464 | |||
2465 | @node Reasons to use Postgres | ||
2466 | @subsection Reasons to use Postgres | ||
2467 | |||
2468 | @itemize @bullet | ||
2469 | @item Easier to setup than MySQL | ||
2470 | @item Real database | ||
2471 | @end itemize | ||
2472 | |||
2473 | @node Reasons not to use Postgres | ||
2474 | @subsection Reasons not to use Postgres | ||
2475 | |||
2476 | @itemize @bullet | ||
2477 | @item Quite slow | ||
2478 | @item Still some manual setup required | ||
2479 | @end itemize | ||
2480 | |||
2481 | @node Manual setup instructions | ||
2482 | @subsection Manual setup instructions | ||
2483 | |||
2484 | @itemize @bullet | ||
2485 | @item In @file{gnunet.conf} set in section @code{DATASTORE} the value for | ||
2486 | @code{DATABASE} to @code{postgres}. | ||
2487 | @item Access Postgres to create a user: | ||
2488 | |||
2489 | @table @asis | ||
2490 | @item with Postgres 8.x, use: | ||
2491 | |||
2492 | @example | ||
2493 | # su - postgres | ||
2494 | $ createuser | ||
2495 | @end example | ||
2496 | |||
2497 | @noindent | ||
2498 | and enter the name of the user running GNUnet for the role interactively. | ||
2499 | Then, when prompted, do not set it to superuser, allow the creation of | ||
2500 | databases, and do not allow the creation of new roles. | ||
2501 | |||
2502 | @item with Postgres 9.x, use: | ||
2503 | |||
2504 | @example | ||
2505 | # su - postgres | ||
2506 | $ createuser -d $GNUNET_USER | ||
2507 | @end example | ||
2508 | |||
2509 | @noindent | ||
2510 | where $GNUNET_USER is the name of the user running GNUnet. | ||
2511 | |||
2512 | @end table | ||
2513 | |||
2514 | |||
2515 | @item | ||
2516 | As that user (so typically as user "gnunet"), create a database (or two): | ||
2517 | |||
2518 | @example | ||
2519 | $ createdb gnunet | ||
2520 | # this way you can run "make check" | ||
2521 | $ createdb gnunetcheck | ||
2522 | @end example | ||
2523 | |||
2524 | @end itemize | ||
2525 | |||
2526 | Now you should be able to start @code{gnunet-arm}. | ||
2527 | |||
2528 | @node Testing the setup manually | ||
2529 | @subsection Testing the setup manually | ||
2530 | |||
2531 | You may want to try if the database connection works. First, again login | ||
2532 | as the user who will run @command{gnunet-arm}. Then use: | ||
2533 | |||
2534 | @example | ||
2535 | $ psql gnunet # or gnunetcheck | ||
2536 | gnunet=> \dt | ||
2537 | @end example | ||
2538 | |||
2539 | @noindent | ||
2540 | If, after you have started @command{gnunet-arm} at least once, you get | ||
2541 | a @code{gn090} table here, it probably works. | ||
2542 | |||
2543 | @node Configuring the datacache | ||
2544 | @subsection Configuring the datacache | ||
2545 | @c %**end of header | ||
2546 | |||
2547 | The datacache is what GNUnet uses for storing temporary data. This data is | ||
2548 | expected to be wiped completely each time GNUnet is restarted (or the | ||
2549 | system is rebooted). | ||
2550 | |||
2551 | You need to specify how many bytes GNUnet is allowed to use for the | ||
2552 | datacache using the @code{QUOTA} option in the section @code{[dhtcache]}. | ||
2553 | Furthermore, you need to specify which database backend should be used to | ||
2554 | store the data. Currently, you have the choice between | ||
2555 | sqLite, MySQL and Postgres. | ||
2556 | |||
2557 | @node Configuring the file-sharing service | ||
2558 | @subsection Configuring the file-sharing service | ||
2559 | |||
2560 | In order to use GNUnet for file-sharing, you first need to make sure | ||
2561 | that the file-sharing service is loaded. | ||
2562 | This is done by setting the @code{AUTOSTART} option in | ||
2563 | section @code{[fs]} to "YES". Alternatively, you can run | ||
2564 | |||
2565 | @example | ||
2566 | $ gnunet-arm -i fs | ||
2567 | @end example | ||
2568 | |||
2569 | @noindent | ||
2570 | to start the file-sharing service by hand. | ||
2571 | |||
2572 | Except for configuring the database and the datacache the only important | ||
2573 | option for file-sharing is content migration. | ||
2574 | |||
2575 | Content migration allows your peer to cache content from other peers as | ||
2576 | well as send out content stored on your system without explicit requests. | ||
2577 | This content replication has positive and negative impacts on both system | ||
2578 | performance and privacy. | ||
2579 | |||
2580 | FIXME: discuss the trade-offs. Here is some older text about it... | ||
2581 | |||
2582 | Setting this option to YES allows gnunetd to migrate data to the local | ||
2583 | machine. Setting this option to YES is highly recommended for efficiency. | ||
2584 | Its also the default. If you set this value to YES, GNUnet will store | ||
2585 | content on your machine that you cannot decrypt. | ||
2586 | While this may protect you from liability if the judge is sane, it may | ||
2587 | not (IANAL). If you put illegal content on your machine yourself, setting | ||
2588 | this option to YES will probably increase your chances to get away with it | ||
2589 | since you can plausibly deny that you inserted the content. | ||
2590 | Note that in either case, your anonymity would have to be broken first | ||
2591 | (which may be possible depending on the size of the GNUnet network and the | ||
2592 | strength of the adversary). | ||
2593 | |||
2594 | @node Configuring logging | ||
2595 | @subsection Configuring logging | ||
2596 | |||
2597 | Logging in GNUnet 0.9.0 is controlled via the "-L" and "-l" options. | ||
2598 | Using @code{-L}, a log level can be specified. With log level | ||
2599 | @code{ERROR} only serious errors are logged. | ||
2600 | The default log level is @code{WARNING} which causes anything of | ||
2601 | concern to be logged. | ||
2602 | Log level @code{INFO} can be used to log anything that might be | ||
2603 | interesting information whereas | ||
2604 | @code{DEBUG} can be used by developers to log debugging messages | ||
2605 | (but you need to run @code{./configure} with | ||
2606 | @code{--enable-logging=verbose} to get them compiled). | ||
2607 | The @code{-l} option is used to specify the log file. | ||
2608 | |||
2609 | Since most GNUnet services are managed by @code{gnunet-arm}, using the | ||
2610 | @code{-l} or @code{-L} options directly is not possible. | ||
2611 | Instead, they can be specified using the @code{OPTIONS} configuration | ||
2612 | value in the respective section for the respective service. | ||
2613 | In order to enable logging globally without editing the @code{OPTIONS} | ||
2614 | values for each service, @command{gnunet-arm} supports a | ||
2615 | @code{GLOBAL_POSTFIX} option. | ||
2616 | The value specified here is given as an extra option to all services for | ||
2617 | which the configuration does contain a service-specific @code{OPTIONS} | ||
2618 | field. | ||
2619 | |||
2620 | @code{GLOBAL_POSTFIX} can contain the special sequence "@{@}" which | ||
2621 | is replaced by the name of the service that is being started. | ||
2622 | Furthermore, @code{GLOBAL_POSTFIX} is special in that sequences | ||
2623 | starting with "$" anywhere in the string are expanded (according | ||
2624 | to options in @code{PATHS}); this expansion otherwise is | ||
2625 | only happening for filenames and then the "$" must be the | ||
2626 | first character in the option. Both of these restrictions do | ||
2627 | not apply to @code{GLOBAL_POSTFIX}. | ||
2628 | Note that specifying @code{%} anywhere in the @code{GLOBAL_POSTFIX} | ||
2629 | disables both of these features. | ||
2630 | |||
2631 | In summary, in order to get all services to log at level | ||
2632 | @code{INFO} to log-files called @code{SERVICENAME-logs}, the | ||
2633 | following global prefix should be used: | ||
2634 | |||
2635 | @example | ||
2636 | GLOBAL_POSTFIX = -l $SERVICEHOME/@{@}-logs -L INFO | ||
2637 | @end example | ||
2638 | |||
2639 | @node Configuring the transport service and plugins | ||
2640 | @subsection Configuring the transport service and plugins | ||
2641 | |||
2642 | The transport service in GNUnet is responsible to maintain basic | ||
2643 | connectivity to other peers. | ||
2644 | Besides initiating and keeping connections alive it is also responsible | ||
2645 | for address validation. | ||
2646 | |||
2647 | The GNUnet transport supports more than one transport protocol. | ||
2648 | These protocols are configured together with the transport service. | ||
2649 | |||
2650 | The configuration section for the transport service itself is quite | ||
2651 | similar to all the other services | ||
2652 | |||
2653 | @example | ||
2654 | AUTOSTART = YES | ||
2655 | @@UNIXONLY@@ PORT = 2091 | ||
2656 | HOSTNAME = localhost | ||
2657 | HOME = $SERVICEHOME | ||
2658 | CONFIG = $DEFAULTCONFIG | ||
2659 | BINARY = gnunet-service-transport | ||
2660 | #PREFIX = valgrind | ||
2661 | NEIGHBOUR_LIMIT = 50 | ||
2662 | ACCEPT_FROM = 127.0.0.1; | ||
2663 | ACCEPT_FROM6 = ::1; | ||
2664 | PLUGINS = tcp udp | ||
2665 | UNIXPATH = /tmp/gnunet-service-transport.sock | ||
2666 | @end example | ||
2667 | |||
2668 | Different are the settings for the plugins to load @code{PLUGINS}. | ||
2669 | The first setting specifies which transport plugins to load. | ||
2670 | |||
2671 | @itemize @bullet | ||
2672 | @item transport-unix | ||
2673 | A plugin for local only communication with UNIX domain sockets. Used for | ||
2674 | testing and available on unix systems only. Just set the port | ||
2675 | |||
2676 | @example | ||
2677 | [transport-unix] | ||
2678 | PORT = 22086 | ||
2679 | TESTING_IGNORE_KEYS = ACCEPT_FROM; | ||
2680 | @end example | ||
2681 | |||
2682 | @item transport-tcp | ||
2683 | A plugin for communication with TCP. Set port to 0 for client mode with | ||
2684 | outbound only connections | ||
2685 | |||
2686 | @example | ||
2687 | [transport-tcp] | ||
2688 | # Use 0 to ONLY advertise as a peer behind NAT (no port binding) | ||
2689 | PORT = 2086 | ||
2690 | ADVERTISED_PORT = 2086 | ||
2691 | TESTING_IGNORE_KEYS = ACCEPT_FROM; | ||
2692 | # Maximum number of open TCP connections allowed | ||
2693 | MAX_CONNECTIONS = 128 | ||
2694 | @end example | ||
2695 | |||
2696 | @item transport-udp | ||
2697 | A plugin for communication with UDP. Supports peer discovery using | ||
2698 | broadcasts. | ||
2699 | |||
2700 | @example | ||
2701 | [transport-udp] | ||
2702 | PORT = 2086 | ||
2703 | BROADCAST = YES | ||
2704 | BROADCAST_INTERVAL = 30 s | ||
2705 | MAX_BPS = 1000000 | ||
2706 | TESTING_IGNORE_KEYS = ACCEPT_FROM; | ||
2707 | @end example | ||
2708 | |||
2709 | @item transport-http | ||
2710 | HTTP and HTTPS support is split in two part: a client plugin initiating | ||
2711 | outbound connections and a server part accepting connections from the | ||
2712 | client. The client plugin just takes the maximum number of connections as | ||
2713 | an argument. | ||
2714 | |||
2715 | @example | ||
2716 | [transport-http_client] | ||
2717 | MAX_CONNECTIONS = 128 | ||
2718 | TESTING_IGNORE_KEYS = ACCEPT_FROM; | ||
2719 | @end example | ||
2720 | |||
2721 | @example | ||
2722 | [transport-https_client] | ||
2723 | MAX_CONNECTIONS = 128 | ||
2724 | TESTING_IGNORE_KEYS = ACCEPT_FROM; | ||
2725 | @end example | ||
2726 | |||
2727 | @noindent | ||
2728 | The server has a port configured and the maximum nunber of connections. | ||
2729 | The HTTPS part has two files with the certificate key and the certificate | ||
2730 | file. | ||
2731 | |||
2732 | The server plugin supports reverse proxies, so a external hostname can be | ||
2733 | set using the @code{EXTERNAL_HOSTNAME} setting. | ||
2734 | The webserver under this address should forward the request to the peer | ||
2735 | and the configure port. | ||
2736 | |||
2737 | @example | ||
2738 | [transport-http_server] | ||
2739 | EXTERNAL_HOSTNAME = fulcrum.net.in.tum.de/gnunet | ||
2740 | PORT = 1080 | ||
2741 | MAX_CONNECTIONS = 128 | ||
2742 | TESTING_IGNORE_KEYS = ACCEPT_FROM; | ||
2743 | @end example | ||
2744 | |||
2745 | @example | ||
2746 | [transport-https_server] | ||
2747 | PORT = 4433 | ||
2748 | CRYPTO_INIT = NORMAL | ||
2749 | KEY_FILE = https.key | ||
2750 | CERT_FILE = https.cert | ||
2751 | MAX_CONNECTIONS = 128 | ||
2752 | TESTING_IGNORE_KEYS = ACCEPT_FROM; | ||
2753 | @end example | ||
2754 | |||
2755 | @item transport-wlan | ||
2756 | |||
2757 | The next section describes how to setup the WLAN plugin, | ||
2758 | so here only the settings. Just specify the interface to use: | ||
2759 | |||
2760 | @example | ||
2761 | [transport-wlan] | ||
2762 | # Name of the interface in monitor mode (typically monX) | ||
2763 | INTERFACE = mon0 | ||
2764 | # Real hardware, no testing | ||
2765 | TESTMODE = 0 | ||
2766 | TESTING_IGNORE_KEYS = ACCEPT_FROM; | ||
2767 | @end example | ||
2768 | @end itemize | ||
2769 | |||
2770 | @node Configuring the wlan transport plugin | ||
2771 | @subsection Configuring the wlan transport plugin | ||
2772 | |||
2773 | The wlan transport plugin enables GNUnet to send and to receive data on a | ||
2774 | wlan interface. | ||
2775 | It has not to be connected to a wlan network as long as sender and | ||
2776 | receiver are on the same channel. This enables you to get connection to | ||
2777 | GNUnet where no internet access is possible, for example during | ||
2778 | catastrophes or when censorship cuts you off from the internet. | ||
2779 | |||
2780 | |||
2781 | @menu | ||
2782 | * Requirements for the WLAN plugin:: | ||
2783 | * Configuration:: | ||
2784 | * Before starting GNUnet:: | ||
2785 | * Limitations and known bugs:: | ||
2786 | @end menu | ||
2787 | |||
2788 | |||
2789 | @node Requirements for the WLAN plugin | ||
2790 | @subsubsection Requirements for the WLAN plugin | ||
2791 | |||
2792 | @itemize @bullet | ||
2793 | |||
2794 | @item wlan network card with monitor support and packet injection | ||
2795 | (see @uref{http://www.aircrack-ng.org/, aircrack-ng.org}) | ||
2796 | |||
2797 | @item Linux kernel with mac80211 stack, introduced in 2.6.22, tested with | ||
2798 | 2.6.35 and 2.6.38 | ||
2799 | |||
2800 | @item Wlantools to create the a monitor interface, tested with airmon-ng | ||
2801 | of the aircrack-ng package | ||
2802 | @end itemize | ||
2803 | |||
2804 | @node Configuration | ||
2805 | @subsubsection Configuration | ||
2806 | |||
2807 | There are the following options for the wlan plugin (they should be like | ||
2808 | this in your default config file, you only need to adjust them if the | ||
2809 | values are incorrect for your system) | ||
2810 | |||
2811 | @example | ||
2812 | # section for the wlan transport plugin | ||
2813 | [transport-wlan] | ||
2814 | # interface to use, more information in the | ||
2815 | # "Before starting GNUnet" section of the handbook. | ||
2816 | INTERFACE = mon0 | ||
2817 | # testmode for developers: | ||
2818 | # 0 use wlan interface, | ||
2819 | #1 or 2 use loopback driver for tests 1 = server, 2 = client | ||
2820 | TESTMODE = 0 | ||
2821 | @end example | ||
2822 | |||
2823 | @node Before starting GNUnet | ||
2824 | @subsubsection Before starting GNUnet | ||
2825 | |||
2826 | Before starting GNUnet, you have to make sure that your wlan interface is | ||
2827 | in monitor mode. | ||
2828 | One way to put the wlan interface into monitor mode (if your interface | ||
2829 | name is wlan0) is by executing: | ||
2830 | |||
2831 | @example | ||
2832 | sudo airmon-ng start wlan0 | ||
2833 | @end example | ||
2834 | |||
2835 | @noindent | ||
2836 | Here is an example what the result should look like: | ||
2837 | |||
2838 | @example | ||
2839 | Interface Chipset Driver | ||
2840 | wlan0 Intel 4965 a/b/g/n iwl4965 - [phy0] | ||
2841 | (monitor mode enabled on mon0) | ||
2842 | @end example | ||
2843 | |||
2844 | @noindent | ||
2845 | The monitor interface is mon0 is the one that you have to put into the | ||
2846 | configuration file. | ||
2847 | |||
2848 | @node Limitations and known bugs | ||
2849 | @subsubsection Limitations and known bugs | ||
2850 | |||
2851 | Wlan speed is at the maximum of 1 Mbit/s because support for choosing the | ||
2852 | wlan speed with packet injection was removed in newer kernels. | ||
2853 | Please pester the kernel developers about fixing this. | ||
2854 | |||
2855 | The interface channel depends on the wlan network that the card is | ||
2856 | connected to. If no connection has been made since the start of the | ||
2857 | computer, it is usually the first channel of the card. | ||
2858 | Peers will only find each other and communicate if they are on the same | ||
2859 | channel. Channels must be set manually, i.e. using: | ||
2860 | |||
2861 | @example | ||
2862 | iwconfig wlan0 channel 1 | ||
2863 | @end example | ||
2864 | |||
2865 | @node Configuring HTTP(S) reverse proxy functionality using Apache or nginx | ||
2866 | @subsection Configuring HTTP(S) reverse proxy functionality using Apache or nginx | ||
2867 | |||
2868 | The HTTP plugin supports data transfer using reverse proxies. A reverse | ||
2869 | proxy forwards the HTTP request he receives with a certain URL to another | ||
2870 | webserver, here a GNUnet peer. | ||
2871 | |||
2872 | So if you have a running Apache or nginx webserver you can configure it to | ||
2873 | be a GNUnet reverse proxy. Especially if you have a well-known webiste | ||
2874 | this improves censorship resistance since it looks as normal surfing | ||
2875 | behaviour. | ||
2876 | |||
2877 | To do so, you have to do two things: | ||
2878 | |||
2879 | @itemize @bullet | ||
2880 | @item Configure your webserver to forward the GNUnet HTTP traffic | ||
2881 | @item Configure your GNUnet peer to announce the respective address | ||
2882 | @end itemize | ||
2883 | |||
2884 | As an example we want to use GNUnet peer running: | ||
2885 | |||
2886 | @itemize @bullet | ||
2887 | |||
2888 | @item HTTP server plugin on @code{gnunet.foo.org:1080} | ||
2889 | |||
2890 | @item HTTPS server plugin on @code{gnunet.foo.org:4433} | ||
2891 | |||
2892 | @item A apache or nginx webserver on | ||
2893 | @uref{http://www.foo.org/, http://www.foo.org:80/} | ||
2894 | |||
2895 | @item A apache or nginx webserver on https://www.foo.org:443/ | ||
2896 | @end itemize | ||
2897 | |||
2898 | And we want the webserver to accept GNUnet traffic under | ||
2899 | @code{http://www.foo.org/bar/}. The required steps are described here: | ||
2900 | |||
2901 | @menu | ||
2902 | * Reverse Proxy - Configure your Apache2 HTTP webserver:: | ||
2903 | * Reverse Proxy - Configure your Apache2 HTTPS webserver:: | ||
2904 | * Reverse Proxy - Configure your nginx HTTPS webserver:: | ||
2905 | * Reverse Proxy - Configure your nginx HTTP webserver:: | ||
2906 | * Reverse Proxy - Configure your GNUnet peer:: | ||
2907 | @end menu | ||
2908 | |||
2909 | @node Reverse Proxy - Configure your Apache2 HTTP webserver | ||
2910 | @subsubsection Reverse Proxy - Configure your Apache2 HTTP webserver | ||
2911 | |||
2912 | First of all you need mod_proxy installed. | ||
2913 | |||
2914 | Edit your webserver configuration. Edit | ||
2915 | @code{/etc/apache2/apache2.conf} or the site-specific configuration file. | ||
2916 | |||
2917 | In the respective @code{server config},@code{virtual host} or | ||
2918 | @code{directory} section add the following lines: | ||
2919 | |||
2920 | @example | ||
2921 | ProxyTimeout 300 | ||
2922 | ProxyRequests Off | ||
2923 | <Location /bar/ > | ||
2924 | ProxyPass http://gnunet.foo.org:1080/ | ||
2925 | ProxyPassReverse http://gnunet.foo.org:1080/ | ||
2926 | </Location> | ||
2927 | @end example | ||
2928 | |||
2929 | @node Reverse Proxy - Configure your Apache2 HTTPS webserver | ||
2930 | @subsubsection Reverse Proxy - Configure your Apache2 HTTPS webserver | ||
2931 | |||
2932 | We assume that you already have an HTTPS server running, if not please | ||
2933 | check how to configure a HTTPS host. An uncomplicated to use example | ||
2934 | is the example configuration file for Apache2/HTTPD provided in | ||
2935 | @file{apache2/sites-available/default-ssl}. | ||
2936 | |||
2937 | In the respective HTTPS @code{server config},@code{virtual host} or | ||
2938 | @code{directory} section add the following lines: | ||
2939 | |||
2940 | @example | ||
2941 | SSLProxyEngine On | ||
2942 | ProxyTimeout 300 | ||
2943 | ProxyRequests Off | ||
2944 | <Location /bar/ > | ||
2945 | ProxyPass https://gnunet.foo.org:4433/ | ||
2946 | ProxyPassReverse https://gnunet.foo.org:4433/ | ||
2947 | </Location> | ||
2948 | @end example | ||
2949 | |||
2950 | @noindent | ||
2951 | More information about the apache mod_proxy configuration can be found | ||
2952 | in the Apache documentation@footnote{@uref{http://httpd.apache.org/docs/2.2/mod/mod_proxy.html#proxypass, http://httpd.apache.org/docs/2.2/mod/mod_proxy.html#proxypass}} | ||
2953 | |||
2954 | @node Reverse Proxy - Configure your nginx HTTPS webserver | ||
2955 | @subsubsection Reverse Proxy - Configure your nginx HTTPS webserver | ||
2956 | |||
2957 | Since nginx does not support chunked encoding, you first of all have to | ||
2958 | install the @code{chunkin} module@footnote{@uref{http://wiki.nginx.org/HttpChunkinModule, http://wiki.nginx.org/HttpChunkinModule}} | ||
2959 | |||
2960 | To enable chunkin add: | ||
2961 | |||
2962 | @example | ||
2963 | chunkin on; | ||
2964 | error_page 411 = @@my_411_error; | ||
2965 | location @@my_411_error @{ | ||
2966 | chunkin_resume; | ||
2967 | @} | ||
2968 | @end example | ||
2969 | |||
2970 | @noindent | ||
2971 | Edit your webserver configuration. Edit @file{/etc/nginx/nginx.conf} or | ||
2972 | the site-specific configuration file. | ||
2973 | |||
2974 | In the @code{server} section add: | ||
2975 | |||
2976 | @example | ||
2977 | location /bar/ @{ | ||
2978 | proxy_pass http://gnunet.foo.org:1080/; | ||
2979 | proxy_buffering off; | ||
2980 | proxy_connect_timeout 5; # more than http_server | ||
2981 | proxy_read_timeout 350; # 60 default, 300s is GNUnet's idle timeout | ||
2982 | proxy_http_version 1.1; # 1.0 default | ||
2983 | proxy_next_upstream error timeout invalid_header http_500 http_503 http_502 http_504; | ||
2984 | @} | ||
2985 | @end example | ||
2986 | |||
2987 | @node Reverse Proxy - Configure your nginx HTTP webserver | ||
2988 | @subsubsection Reverse Proxy - Configure your nginx HTTP webserver | ||
2989 | |||
2990 | Edit your webserver configuration. Edit @file{/etc/nginx/nginx.conf} or | ||
2991 | the site-specific configuration file. | ||
2992 | |||
2993 | In the @code{server} section add: | ||
2994 | |||
2995 | @example | ||
2996 | ssl_session_timeout 6m; | ||
2997 | location /bar/ | ||
2998 | @{ | ||
2999 | proxy_pass https://gnunet.foo.org:4433/; | ||
3000 | proxy_buffering off; | ||
3001 | proxy_connect_timeout 5; # more than http_server | ||
3002 | proxy_read_timeout 350; # 60 default, 300s is GNUnet's idle timeout | ||
3003 | proxy_http_version 1.1; # 1.0 default | ||
3004 | proxy_next_upstream error timeout invalid_header http_500 http_503 http_502 http_504; | ||
3005 | @} | ||
3006 | @end example | ||
3007 | |||
3008 | @node Reverse Proxy - Configure your GNUnet peer | ||
3009 | @subsubsection Reverse Proxy - Configure your GNUnet peer | ||
3010 | |||
3011 | To have your GNUnet peer announce the address, you have to specify the | ||
3012 | @code{EXTERNAL_HOSTNAME} option in the @code{[transport-http_server]} | ||
3013 | section: | ||
3014 | |||
3015 | @example | ||
3016 | [transport-http_server] | ||
3017 | EXTERNAL_HOSTNAME = http://www.foo.org/bar/ | ||
3018 | @end example | ||
3019 | |||
3020 | @noindent | ||
3021 | and/or @code{[transport-https_server]} section: | ||
3022 | |||
3023 | @example | ||
3024 | [transport-https_server] | ||
3025 | EXTERNAL_HOSTNAME = https://www.foo.org/bar/ | ||
3026 | @end example | ||
3027 | |||
3028 | @noindent | ||
3029 | Now restart your webserver and your peer... | ||
3030 | |||
3031 | @node Blacklisting peers | ||
3032 | @subsection Blacklisting peers | ||
3033 | |||
3034 | Transport service supports to deny connecting to a specific peer of to a | ||
3035 | specific peer with a specific transport plugin using te blacklisting | ||
3036 | component of transport service. With@ blacklisting it is possible to deny | ||
3037 | connections to specific peers of@ to use a specific plugin to a specific | ||
3038 | peer. Peers can be blacklisted using@ the configuration or a blacklist | ||
3039 | client can be asked. | ||
3040 | |||
3041 | To blacklist peers using the configuration you have to add a section to | ||
3042 | your configuration containing the peer id of the peer to blacklist and | ||
3043 | the plugin@ if required. | ||
3044 | |||
3045 | Examples: | ||
3046 | |||
3047 | To blacklist connections to P565... on peer AG2P... using tcp add: | ||
3048 | |||
3049 | @c FIXME: This is too long and produces errors in the pdf. | ||
3050 | @example | ||
3051 | [transport-blacklist AG2PHES1BARB9IJCPAMJTFPVJ5V3A72S3F2A8SBUB8DAQ2V0O3V8G6G2JU56FHGFOHMQVKBSQFV98TCGTC3RJ1NINP82G0RC00N1520] | ||
3052 | P565723JO1C2HSN6J29TAQ22MN6CI8HTMUU55T0FUQG4CMDGGEQ8UCNBKUMB94GC8R9G4FB2SF9LDOBAJ6AMINBP4JHHDD6L7VD801G = tcp | ||
3053 | @end example | ||
3054 | |||
3055 | To blacklist connections to P565... on peer AG2P... using all plugins add: | ||
3056 | |||
3057 | @example | ||
3058 | [transport-blacklist-AG2PHES1BARB9IJCPAMJTFPVJ5V3A72S3F2A8SBUB8DAQ2V0O3V8G6G2JU56FHGFOHMQVKBSQFV98TCGTC3RJ1NINP82G0RC00N1520] | ||
3059 | P565723JO1C2HSN6J29TAQ22MN6CI8HTMUU55T0FUQG4CMDGGEQ8UCNBKUMB94GC8R9G4FB2SF9LDOBAJ6AMINBP4JHHDD6L7VD801G = | ||
3060 | @end example | ||
3061 | |||
3062 | You can also add a blacklist client usign the blacklist API. On a | ||
3063 | blacklist check, blacklisting first checks internally if the peer is | ||
3064 | blacklisted and if not, it asks the blacklisting clients. Clients are | ||
3065 | asked if it is OK to connect to a peer ID, the plugin is omitted. | ||
3066 | |||
3067 | On blacklist check for (peer, plugin) | ||
3068 | @itemize @bullet | ||
3069 | @item Do we have a local blacklist entry for this peer and this plugin?@ | ||
3070 | @item YES: disallow connection@ | ||
3071 | @item Do we have a local blacklist entry for this peer and all plugins?@ | ||
3072 | @item YES: disallow connection@ | ||
3073 | @item Does one of the clients disallow?@ | ||
3074 | @item YES: disallow connection | ||
3075 | @end itemize | ||
3076 | |||
3077 | @node Configuration of the HTTP and HTTPS transport plugins | ||
3078 | @subsection Configuration of the HTTP and HTTPS transport plugins | ||
3079 | |||
3080 | The client parts of the http and https transport plugins can be configured | ||
3081 | to use a proxy to connect to the hostlist server. This functionality can | ||
3082 | be configured in the configuration file directly or using the | ||
3083 | gnunet-setup tool. | ||
3084 | |||
3085 | Both the HTTP and HTTPS clients support the following proxy types at | ||
3086 | the moment: | ||
3087 | |||
3088 | @itemize @bullet | ||
3089 | @item HTTP 1.1 proxy | ||
3090 | @item SOCKS 4/4a/5/5 with hostname | ||
3091 | @end itemize | ||
3092 | |||
3093 | In addition authentication at the proxy with username and password can be | ||
3094 | configured. | ||
3095 | |||
3096 | To configure proxy support for the clients in the gnunet-setup tool, | ||
3097 | select the "transport" tab and activate the respective plugin. Now you | ||
3098 | can select the appropriate proxy type. The hostname or IP address | ||
3099 | (including port if required) has to be entered in the "Proxy hostname" | ||
3100 | textbox. If required, enter username and password in the "Proxy username" | ||
3101 | and "Proxy password" boxes. Be aware that these information will be stored | ||
3102 | in the configuration in plain text. | ||
3103 | |||
3104 | To configure these options directly in the configuration, you can | ||
3105 | configure the following settings in the @code{[transport-http_client]} | ||
3106 | and @code{[transport-https_client]} section of the configuration: | ||
3107 | |||
3108 | @example | ||
3109 | # Type of proxy server, | ||
3110 | # Valid values: HTTP, SOCKS4, SOCKS5, SOCKS4A, SOCKS5_HOSTNAME | ||
3111 | # Default: HTTP | ||
3112 | # PROXY_TYPE = HTTP | ||
3113 | |||
3114 | # Hostname or IP of proxy server | ||
3115 | # PROXY = | ||
3116 | # User name for proxy server | ||
3117 | # PROXY_USERNAME = | ||
3118 | # User password for proxy server | ||
3119 | # PROXY_PASSWORD = | ||
3120 | @end example | ||
3121 | |||
3122 | @node Configuring the GNU Name System | ||
3123 | @subsection Configuring the GNU Name System | ||
3124 | |||
3125 | @menu | ||
3126 | * Configuring system-wide DNS interception:: | ||
3127 | * Configuring the GNS nsswitch plugin:: | ||
3128 | * Configuring GNS on W32:: | ||
3129 | * GNS Proxy Setup:: | ||
3130 | * Setup of the GNS CA:: | ||
3131 | * Testing the GNS setup:: | ||
3132 | @end menu | ||
3133 | |||
3134 | |||
3135 | @node Configuring system-wide DNS interception | ||
3136 | @subsubsection Configuring system-wide DNS interception | ||
3137 | |||
3138 | Before you install GNUnet, make sure you have a user and group 'gnunet' | ||
3139 | as well as an empty group 'gnunetdns'. | ||
3140 | |||
3141 | When using GNUnet with system-wide DNS interception, it is absolutely | ||
3142 | necessary for all GNUnet service processes to be started by | ||
3143 | @code{gnunet-service-arm} as user and group 'gnunet'. You also need to be | ||
3144 | sure to run @code{make install} as root (or use the @code{sudo} option to | ||
3145 | configure) to grant GNUnet sufficient privileges. | ||
3146 | |||
3147 | With this setup, all that is required for enabling system-wide DNS | ||
3148 | interception is for some GNUnet component (VPN or GNS) to request it. | ||
3149 | The @code{gnunet-service-dns} will then start helper programs that will | ||
3150 | make the necessary changes to your firewall (@code{iptables}) rules. | ||
3151 | |||
3152 | Note that this will NOT work if your system sends out DNS traffic to a | ||
3153 | link-local IPv6 address, as in this case GNUnet can intercept the traffic, | ||
3154 | but not inject the responses from the link-local IPv6 address. Hence you | ||
3155 | cannot use system-wide DNS interception in conjunction with link-local | ||
3156 | IPv6-based DNS servers. If such a DNS server is used, it will bypass | ||
3157 | GNUnet's DNS traffic interception. | ||
3158 | |||
3159 | Using the GNU Name System (GNS) requires two different configuration | ||
3160 | steps. | ||
3161 | First of all, GNS needs to be integrated with the operating system. Most | ||
3162 | of this section is about the operating system level integration. | ||
3163 | |||
3164 | The remainder of this chapter will detail the various methods for | ||
3165 | configuring the use of GNS with your operating system. | ||
3166 | |||
3167 | At this point in time you have different options depending on your OS: | ||
3168 | |||
3169 | @table @asis | ||
3170 | |||
3171 | @item Use the gnunet-gns-proxy This approach works for all operating | ||
3172 | systems and is likely the easiest. However, it enables GNS only for | ||
3173 | browsers, not for other applications that might be using DNS, such as SSH. | ||
3174 | Still, using the proxy is required for using HTTP with GNS and is thus | ||
3175 | recommended for all users. To do this, you simply have to run the | ||
3176 | @code{gnunet-gns-proxy-setup-ca} script as the user who will run the | ||
3177 | browser (this will create a GNS certificate authority (CA) on your system | ||
3178 | and import its key into your browser), then start @code{gnunet-gns-proxy} | ||
3179 | and inform your browser to use the Socks5 proxy which | ||
3180 | @code{gnunet-gns-proxy} makes available by default on port 7777. | ||
3181 | @item Use a nsswitch plugin (recommended on GNU systems) | ||
3182 | This approach has the advantage of offering fully personalized resolution | ||
3183 | even on multi-user systems. A potential disadvantage is that some | ||
3184 | applications might be able to bypass GNS. | ||
3185 | @item Use a W32 resolver plugin (recommended on W32) | ||
3186 | This is currently the only option on W32 systems. | ||
3187 | @item Use system-wide DNS packet interception | ||
3188 | This approach is recommended for the GNUnet VPN. It can be used to handle | ||
3189 | GNS at the same time; however, if you only use this method, you will only | ||
3190 | get one root zone per machine (not so great for multi-user systems). | ||
3191 | @end table | ||
3192 | |||
3193 | You can combine system-wide DNS packet interception with the nsswitch | ||
3194 | plugin. | ||
3195 | The setup of the system-wide DNS interception is described here. All of | ||
3196 | the other GNS-specific configuration steps are described in the following | ||
3197 | sections. | ||
3198 | |||
3199 | @node Configuring the GNS nsswitch plugin | ||
3200 | @subsubsection Configuring the GNS nsswitch plugin | ||
3201 | |||
3202 | The Name Service Switch (NSS) is a facility in Unix-like operating systems | ||
3203 | @footnote{More accurate: NSS is a functionality of the GNU C Library} | ||
3204 | that provides a variety of sources for common configuration databases and | ||
3205 | name resolution mechanisms. | ||
3206 | A superuser (system administrator) usually configures the | ||
3207 | operating system's name services using the file | ||
3208 | @file{/etc/nsswitch.conf}. | ||
3209 | |||
3210 | GNS provides a NSS plugin to integrate GNS name resolution with the | ||
3211 | operating system's name resolution process. | ||
3212 | To use the GNS NSS plugin you have to either | ||
3213 | |||
3214 | @itemize @bullet | ||
3215 | @item install GNUnet as root or | ||
3216 | @item compile GNUnet with the @code{--with-sudo=yes} switch. | ||
3217 | @end itemize | ||
3218 | |||
3219 | Name resolution is controlled by the @emph{hosts} section in the NSS | ||
3220 | configuration. By default this section first performs a lookup in the | ||
3221 | @file{/etc/hosts} file and then in DNS. | ||
3222 | The nsswitch file should contain a line similar to: | ||
3223 | |||
3224 | @example | ||
3225 | hosts: files dns [NOTFOUND=return] mdns4_minimal mdns4 | ||
3226 | @end example | ||
3227 | |||
3228 | @noindent | ||
3229 | Here the GNS NSS plugin can be added to perform a GNS lookup before | ||
3230 | performing a DNS lookup. | ||
3231 | The GNS NSS plugin has to be added to the "hosts" section in | ||
3232 | @file{/etc/nsswitch.conf} file before DNS related plugins: | ||
3233 | |||
3234 | @example | ||
3235 | ... | ||
3236 | hosts: files gns [NOTFOUND=return] dns mdns4_minimal mdns4 | ||
3237 | ... | ||
3238 | @end example | ||
3239 | |||
3240 | @noindent | ||
3241 | The @code{NOTFOUND=return} will ensure that if a @code{.gnu} name is not | ||
3242 | found in GNS it will not be queried in DNS. | ||
3243 | |||
3244 | @node Configuring GNS on W32 | ||
3245 | @subsubsection Configuring GNS on W32 | ||
3246 | |||
3247 | This document is a guide to configuring GNU Name System on W32-compatible | ||
3248 | platforms. | ||
3249 | |||
3250 | After GNUnet is installed, run the w32nsp-install tool: | ||
3251 | |||
3252 | @example | ||
3253 | w32nsp-install.exe libw32nsp-0.dll | ||
3254 | @end example | ||
3255 | |||
3256 | @noindent | ||
3257 | ('0' is the library version of W32 NSP; it might increase in the future, | ||
3258 | change the invocation accordingly). | ||
3259 | |||
3260 | This will install GNS namespace provider into the system and allow other | ||
3261 | applications to resolve names that end in '@strong{gnu}' | ||
3262 | and '@strong{zkey}'. Note that namespace provider requires | ||
3263 | gnunet-gns-helper-service-w32 to be running, as well as gns service | ||
3264 | itself (and its usual dependencies). | ||
3265 | |||
3266 | Namespace provider is hardcoded to connect to @strong{127.0.0.1:5353}, | ||
3267 | and this is where gnunet-gns-helper-service-w32 should be listening to | ||
3268 | (and is configured to listen to by default). | ||
3269 | |||
3270 | To uninstall the provider, run: | ||
3271 | |||
3272 | @example | ||
3273 | w32nsp-uninstall.exe | ||
3274 | @end example | ||
3275 | |||
3276 | @noindent | ||
3277 | (uses provider GUID to uninstall it, does not need a dll name). | ||
3278 | |||
3279 | Note that while MSDN claims that other applications will only be able to | ||
3280 | use the new namespace provider after re-starting, in reality they might | ||
3281 | stat to use it without that. Conversely, they might stop using the | ||
3282 | provider after it's been uninstalled, even if they were not re-started. | ||
3283 | W32 will not permit namespace provider library to be deleted or | ||
3284 | overwritten while the provider is installed, and while there is at least | ||
3285 | one process still using it (even after it was uninstalled). | ||
3286 | |||
3287 | @node GNS Proxy Setup | ||
3288 | @subsubsection GNS Proxy Setup | ||
3289 | |||
3290 | When using the GNU Name System (GNS) to browse the WWW, there are several | ||
3291 | issues that can be solved by adding the GNS Proxy to your setup: | ||
3292 | |||
3293 | @itemize @bullet | ||
3294 | |||
3295 | @item If the target website does not support GNS, it might assume that it | ||
3296 | is operating under some name in the legacy DNS system (such as | ||
3297 | example.com). It may then attempt to set cookies for that domain, and the | ||
3298 | web server might expect a @code{Host: example.com} header in the request | ||
3299 | from your browser. | ||
3300 | However, your browser might be using @code{example.gnu} for the | ||
3301 | @code{Host} header and might only accept (and send) cookies for | ||
3302 | @code{example.gnu}. The GNS Proxy will perform the necessary translations | ||
3303 | of the hostnames for cookies and HTTP headers (using the LEHO record for | ||
3304 | the target domain as the desired substitute). | ||
3305 | |||
3306 | @item If using HTTPS, the target site might include an SSL certificate | ||
3307 | which is either only valid for the LEHO domain or might match a TLSA | ||
3308 | record in GNS. However, your browser would expect a valid certificate for | ||
3309 | @code{example.gnu}, not for some legacy domain name. The proxy will | ||
3310 | validate the certificate (either against LEHO or TLSA) and then | ||
3311 | on-the-fly produce a valid certificate for the exchange, signed by your | ||
3312 | own CA. Assuming you installed the CA of your proxy in your browser's | ||
3313 | certificate authority list, your browser will then trust the | ||
3314 | HTTPS/SSL/TLS connection, as the hostname mismatch is hidden by the proxy. | ||
3315 | |||
3316 | @item Finally, the proxy will in the future indicate to the server that it | ||
3317 | speaks GNS, which will enable server operators to deliver GNS-enabled web | ||
3318 | sites to your browser (and continue to deliver legacy links to legacy | ||
3319 | browsers) | ||
3320 | @end itemize | ||
3321 | |||
3322 | @node Setup of the GNS CA | ||
3323 | @subsubsection Setup of the GNS CA | ||
3324 | |||
3325 | First you need to create a CA certificate that the proxy can use. | ||
3326 | To do so use the provided script gnunet-gns-proxy-ca: | ||
3327 | |||
3328 | @example | ||
3329 | $ gnunet-gns-proxy-setup-ca | ||
3330 | @end example | ||
3331 | |||
3332 | @noindent | ||
3333 | This will create a personal certification authority for you and add this | ||
3334 | authority to the firefox and chrome database. The proxy will use the this | ||
3335 | CA certificate to generate @code{*.gnu} client certificates on the fly. | ||
3336 | |||
3337 | Note that the proxy uses libcurl. Make sure your version of libcurl uses | ||
3338 | GnuTLS and NOT OpenSSL. The proxy will @b{not} work with libcurl compiled | ||
3339 | against OpenSSL. | ||
3340 | |||
3341 | You can check the configuration your libcurl was build with by | ||
3342 | running: | ||
3343 | |||
3344 | @example | ||
3345 | curl --version | ||
3346 | @end example | ||
3347 | |||
3348 | the output will look like this (without the linebreaks): | ||
3349 | |||
3350 | @example | ||
3351 | gnurl --version | ||
3352 | curl 7.56.0 (x86_64-unknown-linux-gnu) libcurl/7.56.0 \ | ||
3353 | GnuTLS/3.5.13 zlib/1.2.11 libidn2/2.0.4 | ||
3354 | Release-Date: 2017-10-08 | ||
3355 | Protocols: http https | ||
3356 | Features: AsynchDNS IDN IPv6 Largefile NTLM SSL libz \ | ||
3357 | TLS-SRP UnixSockets HTTPS-proxy | ||
3358 | @end example | ||
3359 | |||
3360 | @node Testing the GNS setup | ||
3361 | @subsubsection Testing the GNS setup | ||
3362 | |||
3363 | Now for testing purposes we can create some records in our zone to test | ||
3364 | the SSL functionality of the proxy: | ||
3365 | |||
3366 | @example | ||
3367 | $ gnunet-identity -C test | ||
3368 | $ gnunet-namestore -a -e "1 d" -n "homepage" \ | ||
3369 | -t A -V 131.159.74.67 -z test | ||
3370 | $ gnunet-namestore -a -e "1 d" -n "homepage" \ | ||
3371 | -t LEHO -V "gnunet.org" -z test | ||
3372 | @end example | ||
3373 | |||
3374 | @noindent | ||
3375 | At this point we can start the proxy. Simply execute | ||
3376 | |||
3377 | @example | ||
3378 | $ gnunet-gns-proxy | ||
3379 | @end example | ||
3380 | |||
3381 | @noindent | ||
3382 | Configure your browser to use this SOCKSv5 proxy on port 7777 and visit | ||
3383 | this link. | ||
3384 | If you use @command{Firefox} (or one of its deriviates/forks such as | ||
3385 | Icecat) you also have to go to @code{about:config} and set the key | ||
3386 | @code{network.proxy.socks_remote_dns} to @code{true}. | ||
3387 | |||
3388 | When you visit @code{https://homepage.test/}, you should get to the | ||
3389 | @code{https://gnunet.org/} frontpage and the browser (with the correctly | ||
3390 | configured proxy) should give you a valid SSL certificate for | ||
3391 | @code{homepage.gnu} and no warnings. It should look like this: | ||
3392 | |||
3393 | @c FIXME: Image does not exist, create it or save it from Drupal? | ||
3394 | @c @image{images/gnunethpgns.png,5in,, picture of homepage.gnu in Webbrowser} | ||
3395 | |||
3396 | |||
3397 | @node Configuring the GNUnet VPN | ||
3398 | @subsection Configuring the GNUnet VPN | ||
3399 | |||
3400 | @menu | ||
3401 | * IPv4 address for interface:: | ||
3402 | * IPv6 address for interface:: | ||
3403 | * Configuring the GNUnet VPN DNS:: | ||
3404 | * Configuring the GNUnet VPN Exit Service:: | ||
3405 | * IP Address of external DNS resolver:: | ||
3406 | * IPv4 address for Exit interface:: | ||
3407 | * IPv6 address for Exit interface:: | ||
3408 | @end menu | ||
3409 | |||
3410 | Before configuring the GNUnet VPN, please make sure that system-wide DNS | ||
3411 | interception is configured properly as described in the section on the | ||
3412 | GNUnet DNS setup. @pxref{Configuring the GNU Name System}, | ||
3413 | if you haven't done so already. | ||
3414 | |||
3415 | The default options for the GNUnet VPN are usually sufficient to use | ||
3416 | GNUnet as a Layer 2 for your Internet connection. | ||
3417 | However, what you always have to specify is which IP protocol you want | ||
3418 | to tunnel: IPv4, IPv6 or both. | ||
3419 | Furthermore, if you tunnel both, you most likely should also tunnel | ||
3420 | all of your DNS requests. | ||
3421 | You theoretically can tunnel "only" your DNS traffic, but that usually | ||
3422 | makes little sense. | ||
3423 | |||
3424 | The other options as shown on the gnunet-setup tool are: | ||
3425 | |||
3426 | @node IPv4 address for interface | ||
3427 | @subsubsection IPv4 address for interface | ||
3428 | |||
3429 | This is the IPv4 address the VPN interface will get. You should pick an | ||
3430 | 'private' IPv4 network that is not yet in use for you system. For example, | ||
3431 | if you use @code{10.0.0.1/255.255.0.0} already, you might use | ||
3432 | @code{10.1.0.1/255.255.0.0}. | ||
3433 | If you use @code{10.0.0.1/255.0.0.0} already, then you might use | ||
3434 | @code{192.168.0.1/255.255.0.0}. | ||
3435 | If your system is not in a private IP-network, using any of the above will | ||
3436 | work fine. | ||
3437 | You should try to make the mask of the address big enough | ||
3438 | (@code{255.255.0.0} or, even better, @code{255.0.0.0}) to allow more | ||
3439 | mappings of remote IP Addresses into this range. | ||
3440 | However, even a @code{255.255.255.0} mask will suffice for most users. | ||
3441 | |||
3442 | @node IPv6 address for interface | ||
3443 | @subsubsection IPv6 address for interface | ||
3444 | |||
3445 | The IPv6 address the VPN interface will get. Here you can specify any | ||
3446 | non-link-local address (the address should not begin with @code{fe80:}). | ||
3447 | A subnet Unique Local Unicast (@code{fd00::/8} prefix) that you are | ||
3448 | currently not using would be a good choice. | ||
3449 | |||
3450 | @node Configuring the GNUnet VPN DNS | ||
3451 | @subsubsection Configuring the GNUnet VPN DNS | ||
3452 | |||
3453 | To resolve names for remote nodes, activate the DNS exit option. | ||
3454 | |||
3455 | @node Configuring the GNUnet VPN Exit Service | ||
3456 | @subsubsection Configuring the GNUnet VPN Exit Service | ||
3457 | |||
3458 | If you want to allow other users to share your Internet connection (yes, | ||
3459 | this may be dangerous, just as running a Tor exit node) or want to | ||
3460 | provide access to services on your host (this should be less dangerous, | ||
3461 | as long as those services are secure), you have to enable the GNUnet exit | ||
3462 | daemon. | ||
3463 | |||
3464 | You then get to specify which exit functions you want to provide. By | ||
3465 | enabling the exit daemon, you will always automatically provide exit | ||
3466 | functions for manually configured local services (this component of the | ||
3467 | system is under | ||
3468 | development and not documented further at this time). As for those | ||
3469 | services you explicitly specify the target IP address and port, there is | ||
3470 | no significant security risk in doing so. | ||
3471 | |||
3472 | Furthermore, you can serve as a DNS, IPv4 or IPv6 exit to the Internet. | ||
3473 | Being a DNS exit is usually pretty harmless. However, enabling IPv4 or | ||
3474 | IPv6-exit without further precautions may enable adversaries to access | ||
3475 | your local network, send spam, attack other systems from your Internet | ||
3476 | connection and to other mischief that will appear to come from your | ||
3477 | machine. This may or may not get you into legal trouble. | ||
3478 | If you want to allow IPv4 or IPv6-exit functionality, you should strongly | ||
3479 | consider adding additional firewall rules manually to protect your local | ||
3480 | network and to restrict outgoing TCP traffic (i.e. by not allowing access | ||
3481 | to port 25). While we plan to improve exit-filtering in the future, | ||
3482 | you're currently on your own here. | ||
3483 | Essentially, be prepared for any kind of IP-traffic to exit the respective | ||
3484 | TUN interface (and GNUnet will enable IP-forwarding and NAT for the | ||
3485 | interface automatically). | ||
3486 | |||
3487 | Additional configuration options of the exit as shown by the gnunet-setup | ||
3488 | tool are: | ||
3489 | |||
3490 | @node IP Address of external DNS resolver | ||
3491 | @subsubsection IP Address of external DNS resolver | ||
3492 | |||
3493 | If DNS traffic is to exit your machine, it will be send to this DNS | ||
3494 | resolver. You can specify an IPv4 or IPv6 address. | ||
3495 | |||
3496 | @node IPv4 address for Exit interface | ||
3497 | @subsubsection IPv4 address for Exit interface | ||
3498 | |||
3499 | This is the IPv4 address the Interface will get. Make the mask of the | ||
3500 | address big enough (255.255.0.0 or, even better, 255.0.0.0) to allow more | ||
3501 | mappings of IP addresses into this range. As for the VPN interface, any | ||
3502 | unused, private IPv4 address range will do. | ||
3503 | |||
3504 | @node IPv6 address for Exit interface | ||
3505 | @subsubsection IPv6 address for Exit interface | ||
3506 | |||
3507 | The public IPv6 address the interface will get. If your kernel is not a | ||
3508 | very recent kernel and you are willing to manually enable IPv6-NAT, the | ||
3509 | IPv6 address you specify here must be a globally routed IPv6 address of | ||
3510 | your host. | ||
3511 | |||
3512 | Suppose your host has the address @code{2001:4ca0::1234/64}, then | ||
3513 | using @code{2001:4ca0::1:0/112} would be fine (keep the first 64 bits, | ||
3514 | then change at least one bit in the range before the bitmask, in the | ||
3515 | example above we changed bit 111 from 0 to 1). | ||
3516 | |||
3517 | You may also have to configure your router to route traffic for the entire | ||
3518 | subnet (@code{2001:4ca0::1:0/112} for example) through your computer (this | ||
3519 | should be automatic with IPv6, but obviously anything can be | ||
3520 | disabled). | ||
3521 | |||
3522 | @node Bandwidth Configuration | ||
3523 | @subsection Bandwidth Configuration | ||
3524 | |||
3525 | You can specify how many bandwidth GNUnet is allowed to use to receive | ||
3526 | and send data. This is important for users with limited bandwidth or | ||
3527 | traffic volume. | ||
3528 | |||
3529 | @node Configuring NAT | ||
3530 | @subsection Configuring NAT | ||
3531 | |||
3532 | Most hosts today do not have a normal global IP address but instead are | ||
3533 | behind a router performing Network Address Translation (NAT) which assigns | ||
3534 | each host in the local network a private IP address. | ||
3535 | As a result, these machines cannot trivially receive inbound connections | ||
3536 | from the Internet. GNUnet supports NAT traversal to enable these machines | ||
3537 | to receive incoming connections from other peers despite their | ||
3538 | limitations. | ||
3539 | |||
3540 | In an ideal world, you can press the "Attempt automatic configuration" | ||
3541 | button in gnunet-setup to automatically configure your peer correctly. | ||
3542 | Alternatively, your distribution might have already triggered this | ||
3543 | automatic configuration during the installation process. | ||
3544 | However, automatic configuration can fail to determine the optimal | ||
3545 | settings, resulting in your peer either not receiving as many connections | ||
3546 | as possible, or in the worst case it not connecting to the network at all. | ||
3547 | |||
3548 | To manually configure the peer, you need to know a few things about your | ||
3549 | network setup. First, determine if you are behind a NAT in the first | ||
3550 | place. | ||
3551 | This is always the case if your IP address starts with "10.*" or | ||
3552 | "192.168.*". Next, if you have control over your NAT router, you may | ||
3553 | choose to manually configure it to allow GNUnet traffic to your host. | ||
3554 | If you have configured your NAT to forward traffic on ports 2086 (and | ||
3555 | possibly 1080) to your host, you can check the "NAT ports have been opened | ||
3556 | manually" option, which corresponds to the "PUNCHED_NAT" option in the | ||
3557 | configuration file. If you did not punch your NAT box, it may still be | ||
3558 | configured to support UPnP, which allows GNUnet to automatically | ||
3559 | configure it. In that case, you need to install the "upnpc" command, | ||
3560 | enable UPnP (or PMP) on your NAT box and set the "Enable NAT traversal | ||
3561 | via UPnP or PMP" option (corresponding to "ENABLE_UPNP" in the | ||
3562 | configuration file). | ||
3563 | |||
3564 | Some NAT boxes can be traversed using the autonomous NAT traversal method. | ||
3565 | This requires certain GNUnet components to be installed with "SUID" | ||
3566 | prividledges on your system (so if you're installing on a system you do | ||
3567 | not have administrative rights to, this will not work). | ||
3568 | If you installed as 'root', you can enable autonomous NAT traversal by | ||
3569 | checking the "Enable NAT traversal using ICMP method". | ||
3570 | The ICMP method requires a way to determine your NAT's external (global) | ||
3571 | IP address. This can be done using either UPnP, DynDNS, or by manual | ||
3572 | configuration. If you have a DynDNS name or know your external IP address, | ||
3573 | you should enter that name under "External (public) IPv4 address" (which | ||
3574 | corresponds to the "EXTERNAL_ADDRESS" option in the configuration file). | ||
3575 | If you leave the option empty, GNUnet will try to determine your external | ||
3576 | IP address automatically (which may fail, in which case autonomous | ||
3577 | NAT traversal will then not work). | ||
3578 | |||
3579 | Finally, if you yourself are not behind NAT but want to be able to | ||
3580 | connect to NATed peers using autonomous NAT traversal, you need to check | ||
3581 | the "Enable connecting to NATed peers using ICMP method" box. | ||
3582 | |||
3583 | |||
3584 | @node Peer configuration for distributions | ||
3585 | @subsection Peer configuration for distributions | ||
3586 | |||
3587 | The "GNUNET_DATA_HOME" in "[path]" in @file{/etc/gnunet.conf} should be | ||
3588 | manually set to "/var/lib/gnunet/data/" as the default | ||
3589 | "~/.local/share/gnunet/" is probably not that appropriate in this case. | ||
3590 | Similarly, distributions may consider pointing "GNUNET_RUNTIME_DIR" to | ||
3591 | "/var/run/gnunet/" and "GNUNET_HOME" to "/var/lib/gnunet/". Also, should a | ||
3592 | distribution decide to override system defaults, all of these changes | ||
3593 | should be done in a custom @file{/etc/gnunet.conf} and not in the files | ||
3594 | in the @file{config.d/} directory. | ||
3595 | |||
3596 | Given the proposed access permissions, the "gnunet-setup" tool must be | ||
3597 | run as use "gnunet" (and with option "-c /etc/gnunet.conf" so that it | ||
3598 | modifies the system configuration). As always, gnunet-setup should be run | ||
3599 | after the GNUnet peer was stopped using "gnunet-arm -e". Distributions | ||
3600 | might want to include a wrapper for gnunet-setup that allows the | ||
3601 | desktop-user to "sudo" (i.e. using gtksudo) to the "gnunet" user account | ||
3602 | and then runs "gnunet-arm -e", "gnunet-setup" and "gnunet-arm -s" in | ||
3603 | sequence. | ||
3604 | |||
3605 | @node How to start and stop a GNUnet peer | ||
3606 | @section How to start and stop a GNUnet peer | ||
3607 | |||
3608 | This section describes how to start a GNUnet peer. It assumes that you | ||
3609 | have already compiled and installed GNUnet and its' dependencies. | ||
3610 | Before you start a GNUnet peer, you may want to create a configuration | ||
3611 | file using gnunet-setup (but you do not have to). | ||
3612 | Sane defaults should exist in your | ||
3613 | @file{$GNUNET_PREFIX/share/gnunet/config.d/} directory, so in practice | ||
3614 | you could simply start without any configuration. If you want to | ||
3615 | configure your peer later, you need to stop it before invoking the | ||
3616 | @code{gnunet-setup} tool to customize further and to test your | ||
3617 | configuration (@code{gnunet-setup} has build-in test functions). | ||
3618 | |||
3619 | The most important option you might have to still set by hand is in | ||
3620 | [PATHS]. Here, you use the option "GNUNET_HOME" to specify the path where | ||
3621 | GNUnet should store its data. | ||
3622 | It defaults to @code{$HOME/}, which again should work for most users. | ||
3623 | Make sure that the directory specified as GNUNET_HOME is writable to | ||
3624 | the user that you will use to run GNUnet (note that you can run frontends | ||
3625 | using other users, GNUNET_HOME must only be accessible to the user used to | ||
3626 | run the background processes). | ||
3627 | |||
3628 | You will also need to make one central decision: should all of GNUnet be | ||
3629 | run under your normal UID, or do you want distinguish between system-wide | ||
3630 | (user-independent) GNUnet services and personal GNUnet services. The | ||
3631 | multi-user setup is slightly more complicated, but also more secure and | ||
3632 | generally recommended. | ||
3633 | |||
3634 | @menu | ||
3635 | * The Single-User Setup:: | ||
3636 | * The Multi-User Setup:: | ||
3637 | * Killing GNUnet services:: | ||
3638 | * Access Control for GNUnet:: | ||
3639 | @end menu | ||
3640 | |||
3641 | @node The Single-User Setup | ||
3642 | @subsection The Single-User Setup | ||
3643 | |||
3644 | For the single-user setup, you do not need to do anything special and can | ||
3645 | just start the GNUnet background processes using @code{gnunet-arm}. | ||
3646 | By default, GNUnet looks in @file{~/.config/gnunet.conf} for a | ||
3647 | configuration (or @code{$XDG_CONFIG_HOME/gnunet.conf} if@ | ||
3648 | @code{$XDG_CONFIG_HOME} is defined). If your configuration lives | ||
3649 | elsewhere, you need to pass the @code{-c FILENAME} option to all GNUnet | ||
3650 | commands. | ||
3651 | |||
3652 | Assuming the configuration file is called @file{~/.config/gnunet.conf}, | ||
3653 | you start your peer using the @code{gnunet-arm} command (say as user | ||
3654 | @code{gnunet}) using: | ||
3655 | |||
3656 | @example | ||
3657 | gnunet-arm -c ~/.config/gnunet.conf -s | ||
3658 | @end example | ||
3659 | |||
3660 | @noindent | ||
3661 | The "-s" option here is for "start". The command should return almost | ||
3662 | instantly. If you want to stop GNUnet, you can use: | ||
3663 | |||
3664 | @example | ||
3665 | gnunet-arm -c ~/.config/gnunet.conf -e | ||
3666 | @end example | ||
3667 | |||
3668 | @noindent | ||
3669 | The "-e" option here is for "end". | ||
3670 | |||
3671 | Note that this will only start the basic peer, no actual applications | ||
3672 | will be available. | ||
3673 | If you want to start the file-sharing service, use (after starting | ||
3674 | GNUnet): | ||
3675 | |||
3676 | @example | ||
3677 | gnunet-arm -c ~/.config/gnunet.conf -i fs | ||
3678 | @end example | ||
3679 | |||
3680 | @noindent | ||
3681 | The "-i fs" option here is for "initialize" the "fs" (file-sharing) | ||
3682 | application. You can also selectively kill only file-sharing support using | ||
3683 | |||
3684 | @example | ||
3685 | gnunet-arm -c ~/.config/gnunet.conf -k fs | ||
3686 | @end example | ||
3687 | |||
3688 | @noindent | ||
3689 | Assuming that you want certain services (like file-sharing) to be always | ||
3690 | automatically started whenever you start GNUnet, you can activate them by | ||
3691 | setting "FORCESTART=YES" in the respective section of the configuration | ||
3692 | file (for example, "[fs]"). Then GNUnet with file-sharing support would | ||
3693 | be started whenever you@ enter: | ||
3694 | |||
3695 | @example | ||
3696 | gnunet-arm -c ~/.config/gnunet.conf -s | ||
3697 | @end example | ||
3698 | |||
3699 | @noindent | ||
3700 | Alternatively, you can combine the two options: | ||
3701 | |||
3702 | @example | ||
3703 | gnunet-arm -c ~/.config/gnunet.conf -s -i fs | ||
3704 | @end example | ||
3705 | |||
3706 | @noindent | ||
3707 | Using @code{gnunet-arm} is also the preferred method for initializing | ||
3708 | GNUnet from @code{init}. | ||
3709 | |||
3710 | Finally, you should edit your @code{crontab} (using the @code{crontab} | ||
3711 | command) and insert a line@ | ||
3712 | |||
3713 | @example | ||
3714 | @@reboot gnunet-arm -c ~/.config/gnunet.conf -s | ||
3715 | @end example | ||
3716 | |||
3717 | to automatically start your peer whenever your system boots. | ||
3718 | |||
3719 | @node The Multi-User Setup | ||
3720 | @subsection The Multi-User Setup | ||
3721 | |||
3722 | This requires you to create a user @code{gnunet} and an additional group | ||
3723 | @code{gnunetdns}, prior to running @code{make install} during | ||
3724 | installation. | ||
3725 | Then, you create a configuration file @file{/etc/gnunet.conf} which should | ||
3726 | contain the lines:@ | ||
3727 | |||
3728 | @example | ||
3729 | [arm] | ||
3730 | SYSTEM_ONLY = YES | ||
3731 | USER_ONLY = NO | ||
3732 | @end example | ||
3733 | |||
3734 | @noindent | ||
3735 | Then, perform the same steps to run GNUnet as in the per-user | ||
3736 | configuration, except as user @code{gnunet} (including the | ||
3737 | @code{crontab} installation). | ||
3738 | You may also want to run @code{gnunet-setup} to configure your peer | ||
3739 | (databases, etc.). | ||
3740 | Make sure to pass @code{-c /etc/gnunet.conf} to all commands. If you | ||
3741 | run @code{gnunet-setup} as user @code{gnunet}, you might need to change | ||
3742 | permissions on @file{/etc/gnunet.conf} so that the @code{gnunet} user can | ||
3743 | write to the file (during setup). | ||
3744 | |||
3745 | Afterwards, you need to perform another setup step for each normal user | ||
3746 | account from which you want to access GNUnet. First, grant the normal user | ||
3747 | (@code{$USER}) permission to the group gnunet: | ||
3748 | |||
3749 | @example | ||
3750 | # adduser $USER gnunet | ||
3751 | @end example | ||
3752 | |||
3753 | @noindent | ||
3754 | Then, create a configuration file in @file{~/.config/gnunet.conf} for the | ||
3755 | $USER with the lines: | ||
3756 | |||
3757 | @example | ||
3758 | [arm] | ||
3759 | SYSTEM_ONLY = NO | ||
3760 | USER_ONLY = YES | ||
3761 | @end example | ||
3762 | |||
3763 | @noindent | ||
3764 | This will ensure that @code{gnunet-arm} when started by the normal user | ||
3765 | will only run services that are per-user, and otherwise rely on the | ||
3766 | system-wide services. | ||
3767 | Note that the normal user may run gnunet-setup, but the | ||
3768 | configuration would be ineffective as the system-wide services will use | ||
3769 | @file{/etc/gnunet.conf} and ignore options set by individual users. | ||
3770 | |||
3771 | Again, each user should then start the peer using | ||
3772 | @file{gnunet-arm -s} --- and strongly consider adding logic to start | ||
3773 | the peer automatically to their crontab. | ||
3774 | |||
3775 | Afterwards, you should see two (or more, if you have more than one USER) | ||
3776 | @code{gnunet-service-arm} processes running in your system. | ||
3777 | |||
3778 | @node Killing GNUnet services | ||
3779 | @subsection Killing GNUnet services | ||
3780 | |||
3781 | It is not necessary to stop GNUnet services explicitly when shutting | ||
3782 | down your computer. | ||
3783 | |||
3784 | It should be noted that manually killing "most" of the | ||
3785 | @code{gnunet-service} processes is generally not a successful method for | ||
3786 | stopping a peer (since @code{gnunet-service-arm} will instantly restart | ||
3787 | them). The best way to explicitly stop a peer is using | ||
3788 | @code{gnunet-arm -e}; note that the per-user services may need to be | ||
3789 | terminated before the system-wide services will terminate normally. | ||
3790 | |||
3791 | @node Access Control for GNUnet | ||
3792 | @subsection Access Control for GNUnet | ||
3793 | |||
3794 | This chapter documents how we plan to make access control work within the | ||
3795 | GNUnet system for a typical peer. It should be read as a best-practice | ||
3796 | installation guide for advanced users and builders of binary | ||
3797 | distributions. The recommendations in this guide apply to POSIX-systems | ||
3798 | with full support for UNIX domain sockets only. | ||
3799 | |||
3800 | Note that this is an advanced topic. The discussion presumes a very good | ||
3801 | understanding of users, groups and file permissions. Normal users on | ||
3802 | hosts with just a single user can just install GNUnet under their own | ||
3803 | account (and possibly allow the installer to use SUDO to grant additional | ||
3804 | permissions for special GNUnet tools that need additional rights). | ||
3805 | The discussion below largely applies to installations where multiple users | ||
3806 | share a system and to installations where the best possible security is | ||
3807 | paramount. | ||
3808 | |||
3809 | A typical GNUnet system consists of components that fall into four | ||
3810 | categories: | ||
3811 | |||
3812 | @table @asis | ||
3813 | |||
3814 | @item User interfaces | ||
3815 | User interfaces are not security sensitive and are supposed to be run and | ||
3816 | used by normal system users. | ||
3817 | The GTK GUIs and most command-line programs fall into this category. | ||
3818 | Some command-line tools (like gnunet-transport) should be excluded as they | ||
3819 | offer low-level access that normal users should not need. | ||
3820 | @item System services and support tools | ||
3821 | System services should always run and offer services that can then be | ||
3822 | accessed by the normal users. | ||
3823 | System services do not require special permissions, but as they are not | ||
3824 | specific to a particular user, they probably should not run as a | ||
3825 | particular user. Also, there should typically only be one GNUnet peer per | ||
3826 | host. System services include the gnunet-service and gnunet-daemon | ||
3827 | programs; support tools include command-line programs such as gnunet-arm. | ||
3828 | @item Priviledged helpers | ||
3829 | Some GNUnet components require root rights to open raw sockets or perform | ||
3830 | other special operations. These gnunet-helper binaries are typically | ||
3831 | installed SUID and run from services or daemons. | ||
3832 | @item Critical services | ||
3833 | Some GNUnet services (such as the DNS service) can manipulate the service | ||
3834 | in deep and possibly highly security sensitive ways. For example, the DNS | ||
3835 | service can be used to intercept and alter any DNS query originating from | ||
3836 | the local machine. Access to the APIs of these critical services and their | ||
3837 | priviledged helpers must be tightly controlled. | ||
3838 | @end table | ||
3839 | |||
3840 | @c FIXME: The titles of these chapters are too long in the index. | ||
3841 | |||
3842 | @menu | ||
3843 | * Recommendation - Disable access to services via TCP:: | ||
3844 | * Recommendation - Run most services as system user "gnunet":: | ||
3845 | * Recommendation - Control access to services using group "gnunet":: | ||
3846 | * Recommendation - Limit access to certain SUID binaries by group "gnunet":: | ||
3847 | * Recommendation - Limit access to critical gnunet-helper-dns to group "gnunetdns":: | ||
3848 | * Differences between "make install" and these recommendations:: | ||
3849 | @end menu | ||
3850 | |||
3851 | @node Recommendation - Disable access to services via TCP | ||
3852 | @subsubsection Recommendation - Disable access to services via TCP | ||
3853 | |||
3854 | GNUnet services allow two types of access: via TCP socket or via UNIX | ||
3855 | domain socket. | ||
3856 | If the service is available via TCP, access control can only be | ||
3857 | implemented by restricting connections to a particular range of IP | ||
3858 | addresses. | ||
3859 | This is acceptable for non-critical services that are supposed to be | ||
3860 | available to all users on the local system or local network. | ||
3861 | However, as TCP is generally less efficient and it is rarely the case | ||
3862 | that a single GNUnet peer is supposed to serve an entire local network, | ||
3863 | the default configuration should disable TCP access to all GNUnet | ||
3864 | services on systems with support for UNIX domain sockets. | ||
3865 | As of GNUnet 0.9.2, configuration files with TCP access disabled should be | ||
3866 | generated by default. Users can re-enable TCP access to particular | ||
3867 | services simply by specifying a non-zero port number in the section of | ||
3868 | the respective service. | ||
3869 | |||
3870 | |||
3871 | @node Recommendation - Run most services as system user "gnunet" | ||
3872 | @subsubsection Recommendation - Run most services as system user "gnunet" | ||
3873 | |||
3874 | GNUnet's main services should be run as a separate user "gnunet" in a | ||
3875 | special group "gnunet". | ||
3876 | The user "gnunet" should start the peer using "gnunet-arm -s" during | ||
3877 | system startup. The home directory for this user should be | ||
3878 | @file{/var/lib/gnunet} and the configuration file should be | ||
3879 | @file{/etc/gnunet.conf}. | ||
3880 | Only the @code{gnunet} user should have the right to access | ||
3881 | @file{/var/lib/gnunet} (@emph{mode: 700}). | ||
3882 | |||
3883 | @node Recommendation - Control access to services using group "gnunet" | ||
3884 | @subsubsection Recommendation - Control access to services using group "gnunet" | ||
3885 | |||
3886 | Users that should be allowed to use the GNUnet peer should be added to the | ||
3887 | group "gnunet". Using GNUnet's access control mechanism for UNIX domain | ||
3888 | sockets, those services that are considered useful to ordinary users | ||
3889 | should be made available by setting "UNIX_MATCH_GID=YES" for those | ||
3890 | services. | ||
3891 | Again, as shipped, GNUnet provides reasonable defaults. | ||
3892 | Permissions to access the transport and core subsystems might additionally | ||
3893 | be granted without necessarily causing security concerns. | ||
3894 | Some services, such as DNS, must NOT be made accessible to the "gnunet" | ||
3895 | group (and should thus only be accessible to the "gnunet" user and | ||
3896 | services running with this UID). | ||
3897 | |||
3898 | @node Recommendation - Limit access to certain SUID binaries by group "gnunet" | ||
3899 | @subsubsection Recommendation - Limit access to certain SUID binaries by group "gnunet" | ||
3900 | |||
3901 | Most of GNUnet's SUID binaries should be safe even if executed by normal | ||
3902 | users. However, it is possible to reduce the risk a little bit more by | ||
3903 | making these binaries owned by the group "gnunet" and restricting their | ||
3904 | execution to user of the group "gnunet" as well (4750). | ||
3905 | |||
3906 | @node Recommendation - Limit access to critical gnunet-helper-dns to group "gnunetdns" | ||
3907 | @subsubsection Recommendation - Limit access to critical gnunet-helper-dns to group "gnunetdns" | ||
3908 | |||
3909 | A special group "gnunetdns" should be created for controlling access to | ||
3910 | the "gnunet-helper-dns". | ||
3911 | The binary should then be owned by root and be in group "gnunetdns" and | ||
3912 | be installed SUID and only be group-executable (2750). | ||
3913 | @b{Note that the group "gnunetdns" should have no users in it at all, | ||
3914 | ever.} | ||
3915 | The "gnunet-service-dns" program should be executed by user "gnunet" (via | ||
3916 | gnunet-service-arm) with the binary owned by the user "root" and the group | ||
3917 | "gnunetdns" and be SGID (2700). This way, @strong{only} | ||
3918 | "gnunet-service-dns" can change its group to "gnunetdns" and execute the | ||
3919 | helper, and the helper can then run as root (as per SUID). | ||
3920 | Access to the API offered by "gnunet-service-dns" is in turn restricted | ||
3921 | to the user "gnunet" (not the group!), which means that only | ||
3922 | "benign" services can manipulate DNS queries using "gnunet-service-dns". | ||
3923 | |||
3924 | @node Differences between "make install" and these recommendations | ||
3925 | @subsubsection Differences between "make install" and these recommendations | ||
3926 | |||
3927 | The current build system does not set all permissions automatically based | ||
3928 | on the recommendations above. In particular, it does not use the group | ||
3929 | "gnunet" at all (so setting gnunet-helpers other than the | ||
3930 | gnunet-helper-dns to be owned by group "gnunet" must be done manually). | ||
3931 | Furthermore, 'make install' will silently fail to set the DNS binaries to | ||
3932 | be owned by group "gnunetdns" unless that group already exists (!). | ||
3933 | An alternative name for the "gnunetdns" group can be specified using the | ||
3934 | @code{--with-gnunetdns=GRPNAME} configure option. | ||