Browse Source

Merge branch 'stretch' of https://github.com/bashrc/freedombone

Bob Mottram 7 years ago
parent
commit
84c96334bc

+ 1
- 1
doc/EN/app_vpn.org View File

50
 You will need to ensure that the /openvpn/ and /stunnel/ packages are installed. On an Arch based system:
50
 You will need to ensure that the /openvpn/ and /stunnel/ packages are installed. On an Arch based system:
51
 
51
 
52
 #+begin_src bash
52
 #+begin_src bash
53
-sudp pacman -S openvpn stunnel4
53
+sudo pacman -S openvpn stunnel4
54
 #+end_src
54
 #+end_src
55
 
55
 
56
 Or on a Debian based system:
56
 Or on a Debian based system:

+ 1
- 1
doc/EN/index.org View File

33
 
33
 
34
 If you have a single board ARM computer which isn't one of the officially supported ones, such as Raspberry Pi, then you may still be able to install [[./armbian.html][Freedombone with Armbian]].
34
 If you have a single board ARM computer which isn't one of the officially supported ones, such as Raspberry Pi, then you may still be able to install [[./armbian.html][Freedombone with Armbian]].
35
 
35
 
36
-Want to make a community mesh network which doesn't depend upon the internet? The [[./mesh.html][Freedombone Mesh]] is a wireless solution for autonomous communication that can be rapidly deployed in temporary, emergency or post-disaster situations where internet access is unavailable or compromised.
36
+Want to make a community mesh network which can either be fully autonomous or connected to the internet? The [[./mesh.html][Freedombone Mesh]] is a wireless solution for networked communication that can be rapidly deployed in temporary, emergency or post-disaster situations where internet access is unavailable or compromised, or used as an infrastructural community service similar to [[https://en.wikipedia.org/wiki/Freifunk][Freifunk]].
37
 
37
 
38
 After installation it's possible that you might want some advice on how to run your system and set up apps to work nicely with it.
38
 After installation it's possible that you might want some advice on how to run your system and set up apps to work nicely with it.
39
 
39
 

+ 55
- 5
doc/EN/mesh.org View File

26
  "/I see mesh networks naturally evolving to become the dominant form of network over the next few decades, because it’s the most practical solution to a number of problems that will have to be solved in order to build the VR web as well as to connect the entire world to the internet. Centralized networks are only possible in highly developed countries with existing infrastructures like power and telephone grids, as well as roads. You can’t build a tower where you don’t have either power or access. For vast areas of the world, mesh networks will be the only feasible solution./" -- Valkyrie Ice
26
  "/I see mesh networks naturally evolving to become the dominant form of network over the next few decades, because it’s the most practical solution to a number of problems that will have to be solved in order to build the VR web as well as to connect the entire world to the internet. Centralized networks are only possible in highly developed countries with existing infrastructures like power and telephone grids, as well as roads. You can’t build a tower where you don’t have either power or access. For vast areas of the world, mesh networks will be the only feasible solution./" -- Valkyrie Ice
27
 #+end_quote
27
 #+end_quote
28
 
28
 
29
-The Freedombone Mesh is a wireless solution for autonomous communication that can be rapidly deployed in temporary, emergency or post-disaster situations where internet access is unavailable or compromised.
29
+The Freedombone Mesh is a wireless solution for autonomous or internet connected communication that can be rapidly deployed in temporary, emergency or post-disaster situations where internet access is unavailable or compromised.
30
 
30
 
31
-Mesh networks are useful as a quick way to make a fully decentralised communications system which is not connected to or reliant upon the internet. Think festivals, hacker conferences, onboard ships at sea, disaster/war zones, small business internal office communications, protests, remote areas of the world, temporary "digital blackouts", scientific expeditions and off-world space colonies. The down side is that you can't access any internet content. The upside is that you can securely communicate with anyone on the local mesh. No ISPs. No payments or subscriptions beyond the cost of obtaining the hardware. Systems need to be within wifi range of each other for the mesh to be created. It can be an ultra-convenient way to do purely local communications.
31
+Mesh networks are useful as a quick way to make a fully decentralised communications system which is not connected to or reliant upon the internet. Think festivals, hacker conferences, onboard ships at sea, disaster/war zones, small businesses who don't want the overhead of server maintenance, protests, remote areas of the world, temporary "digital blackouts", scientific expeditions and off-world space colonies.
32
+
33
+If an internet connection is available then it can make use of that, but otherwise it can still work regardless of whether the internet exists. So it's not dependent upon ISPs and additional infrastructure other than USB drives isn't required.
34
+
35
+Systems only need to be within wifi range of each other for the mesh to be created, so it can be an very convenient way to create a local communications network.
32
 
36
 
33
 The Freedombone mesh roughly follows MondoNet's ten social specifications:
37
 The Freedombone mesh roughly follows MondoNet's ten social specifications:
34
 
38
 
47
 
51
 
48
  - Discovery of other users on the network
52
  - Discovery of other users on the network
49
  - Text based chat, one-to-one and in groups
53
  - Text based chat, one-to-one and in groups
50
- - Voice chat (VoIP)
54
+ - Voice chat (VoIP) and video calls
51
  - Private and public sharing of files
55
  - Private and public sharing of files
52
  - Blogging
56
  - Blogging
57
+ - Creating and broadcasting audio media/podcasts
53
  - Social network stream. Follow/unfollow other peers
58
  - Social network stream. Follow/unfollow other peers
54
  - No network administration required
59
  - No network administration required
55
- - No servers, internet connection or cabling is needed
60
+ - No servers
61
+ - Internet connection is optional
56
  - Works from bootable USB drives or microSD drives
62
  - Works from bootable USB drives or microSD drives
57
  - Data is mesh routed between systems
63
  - Data is mesh routed between systems
58
  - Private communications is end-to-end secured and forward secret
64
  - Private communications is end-to-end secured and forward secret
59
  - Publicly shared data is /content addressable/
65
  - Publicly shared data is /content addressable/
60
 
66
 
61
-This system should be quite scalable. Both qTox and IPFS are based upon distributed hash tables (DHT) so that each peer does not need to store the full index of data for the entire network. Caching or pinning of IPFS data and its content addressability means that if a file or blog becomes popular then performance should improve as the number of downloads increases, which is the opposite of the client/server paradigm.
67
+This system should be quite scalable. Both qTox and IPFS are based upon distributed hash tables (DHT) so that each peer does not need to store the full index of data for the entire network. Gossiping between SSB peers may be slower, but the [[https://en.wikipedia.org/wiki/Small-world_network][small world effect]] will presumably still make for quite efficient delivery in a large network. Caching or pinning of IPFS data and its content addressability means that if a file or blog becomes popular then performance should improve as the number of downloads increases, which is the opposite of the client/server paradigm.
62
 
68
 
63
 * Disk Images
69
 * Disk Images
64
 ** Writing many images quickly
70
 ** Writing many images quickly
222
 #+END_CENTER
228
 #+END_CENTER
223
 
229
 
224
 When you are finished close the window and then select the /Network Restart/ desktop icon, which will restart the B.A.T.M.A.N. network. You can also use the restart icon if you are within range of the mesh network but the /Chat/ and /Other Users/ icons do not automatically appear after a few minutes.
230
 When you are finished close the window and then select the /Network Restart/ desktop icon, which will restart the B.A.T.M.A.N. network. You can also use the restart icon if you are within range of the mesh network but the /Chat/ and /Other Users/ icons do not automatically appear after a few minutes.
231
+** Connecting to the internet
232
+If you need to be able to access the internet from the mesh then connect one of the peers to an internet router using an ethernet cable, then reboot it. Other peers in the mesh, including any attached mobile devices, will then be able to access the internet using the ethernet attached peer as a gateway. [[https://en.wikipedia.org/wiki/Freifunk][Freifunk]] works in a similar way.
233
+
234
+After connecting one peer to the internet you may need to reboot other peers in order to update their network configurations.
235
+
236
+If for legal reasons you need to connect to the internet via a VPN then openvpn is preinstalled and you can run the command:
237
+
238
+#+begin_src bash
239
+sudo openvpn myclient.ovpn
240
+#+end_src
241
+
242
+Where /myclient.ovpn/ comes from your VPN provider and with the password "/freedombone/".
243
+** Connecting two meshes over the internet via a VPN tunnel
244
+Maybe the internet exists, but you don't care about getting any content from it and just want to use it as a way to connect mesh networks from different geographical locations together. VPN configuration, pem and stunnel files exist within the home directory. Edit the configuration with:
245
+
246
+#+begin_src bash
247
+nano ~/client.ovpn
248
+#+end_src
249
+
250
+Edit the IP address or domain for the mesh that you wish to connect to within the /route/ command:
251
+
252
+#+begin_src bash
253
+route [mesh IP or domain] 255.255.255.255 net_gateway
254
+#+end_src
255
+
256
+Then you can connect to the other mesh with:
257
+
258
+#+begin_src bash
259
+cd /home/fbone
260
+sudo stunnel stunnel-client.conf
261
+sudo openvpn client.ovpn
262
+#+end_src
263
+
264
+Using the password "/freedombone/". From a deep packet inspection point of view the traffic going over the internet will just look like any other TLS connection to a server.
265
+
266
+** Mobile devices (phones, etc)
267
+To allow mobile devices to connect to the mesh you will need a second wifi adapter connected to your laptop/netbook/SBC. Plug in a second wifi adapter then reboot the system. The second adaptor will then create a wifi hotspot which mobile devices can connect to. The hotspot name also contains its local IP address (eg. "/mesh-192.168.1.83/").
268
+
269
+On a typical Android device go to *Settings* then *Security* and ensure that *Unknown sources* is enabled. Also within *Wifi* from the *Settings* screen select the mesh hotspot. The password is "/freedombone/". Open a non-Tor browser and navigate to the IP address showing in the hotspot name. You can then download and install mesh apps.
270
+
271
+#+BEGIN_CENTER
272
+[[file:images/mesh_mobileapps.jpg]]
273
+#+END_CENTER
225
 
274
 
275
+On some android devices you may need to move the downloaded APK file from the *Downloads* directory to your *home* directory before you can install it.
226
 ** Chat System
276
 ** Chat System
227
 
277
 
228
 Ensure that you're within wifi range of at least one other mesh peer (could be a router or client) and then you should see that the /Chat/ and /Other Users/ icons appear. Select the users icon and you should see a list of users on the mesh. Select the /Chat/ icon and once you are connected you should see the status light turn green. If after a few minutes you don't get the green status light then try closing and re-opening the Tox chat application. Select the plus button to add a friend and then copy and paste in a Tox ID from the users list.
278
 Ensure that you're within wifi range of at least one other mesh peer (could be a router or client) and then you should see that the /Chat/ and /Other Users/ icons appear. Select the users icon and you should see a list of users on the mesh. Select the /Chat/ icon and once you are connected you should see the status light turn green. If after a few minutes you don't get the green status light then try closing and re-opening the Tox chat application. Select the plus button to add a friend and then copy and paste in a Tox ID from the users list.

+ 30
- 0
doc/EN/meshindex.org View File

1
+#+TITLE:
2
+#+AUTHOR: Bob Mottram
3
+#+EMAIL: bob@freedombone.net
4
+#+KEYWORDS: mesh, freedombone, apps
5
+#+DESCRIPTION: Download apps for use on the mesh
6
+#+OPTIONS: ^:nil toc:nil
7
+#+HTML_HEAD: <link rel="stylesheet" type="text/css" href="freedombone.css" />
8
+
9
+#+BEGIN_CENTER
10
+[[file:images/logo.png]]
11
+#+END_CENTER
12
+
13
+#+BEGIN_EXPORT html
14
+<center>
15
+<h3>Welcome to the Freedombone Mesh</h3>
16
+</center>
17
+#+END_EXPORT
18
+
19
+The following apps are available:
20
+
21
+#+BEGIN_EXPORT html
22
+ <center>
23
+ <table style="width:80%; border:0">
24
+  <tr>
25
+    <td><center><b><a href="ssb.apk"><img src="images/ssb.png"/></a></b><br><a href="ssb.apk">Secure Scuttlebutt</a></center></td>
26
+    <td><center><b><h3></h3></b><br></center></td>
27
+  </tr>
28
+</table>
29
+</center>
30
+#+END_EXPORT

BIN
image_build/mesh_apps/ssb.apk View File


BIN
img/avatars/invite.png View File


BIN
img/icon_ferment.png View File


BIN
img/mesh_mobileapps.jpg View File


+ 44
- 5
src/freedombone-app-scuttlebot View File

8
 #
8
 #
9
 #                    Freedom in the Cloud
9
 #                    Freedom in the Cloud
10
 #
10
 #
11
-# scuttlebot pub application
11
+# scuttlebot pub application. Enables nat traversal for SSB.
12
 # https://scuttlebot.io
12
 # https://scuttlebot.io
13
-# Problem: on occasion uses 100% of the CPU, severely impacting other services
14
 #
13
 #
15
 # License
14
 # License
16
 # =======
15
 # =======
30
 # You should have received a copy of the GNU Affero General Public License
29
 # You should have received a copy of the GNU Affero General Public License
31
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
30
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
32
 
31
 
33
-VARIANTS=''
32
+VARIANTS='full full-vim social'
34
 
33
 
35
 IN_DEFAULT_INSTALL=0
34
 IN_DEFAULT_INSTALL=0
36
 SHOW_ON_ABOUT=0
35
 SHOW_ON_ABOUT=0
37
 SHOW_ICANN_ADDRESS_ON_ABOUT=0
36
 SHOW_ICANN_ADDRESS_ON_ABOUT=0
38
 
37
 
39
-SCUTTLEBOT_VERSION='9.8.0'
40
-SCUTTLEBOT_PORT=8008
38
+SCUTTLEBOT_VERSION='10.4.6'
39
+SCUTTLEBOT_PORT=8010
41
 
40
 
42
 scuttlebot_variables=(MY_USERNAME
41
 scuttlebot_variables=(MY_USERNAME
43
                       DEFAULT_DOMAIN_NAME
42
                       DEFAULT_DOMAIN_NAME
197
     sed -i '/scuttlebot /d' $COMPLETION_FILE
196
     sed -i '/scuttlebot /d' $COMPLETION_FILE
198
 }
197
 }
199
 
198
 
199
+function mesh_install_scuttlebot {
200
+    cat <<EOF > $rootdir/usr/bin/install_scuttlebot
201
+#!/bin/bash
202
+npm install -g scuttlebot@${SCUTTLEBOT_VERSION}
203
+EOF
204
+    chroot "$rootdir" /bin/chmod +x /usr/bin/install_scuttlebot
205
+    chroot "$rootdir" /usr/bin/install_scuttlebot
206
+    rm $rootdir/usr/bin/install_scuttlebot
207
+
208
+    if [ ! -f $rootdir/usr/local/bin/sbot ]; then
209
+        echo $'Scuttlebot was not installed'
210
+        exit 528253
211
+    fi
212
+
213
+    if [ ! -d $rootdir/etc/scuttlebot ]; then
214
+        mkdir -p $rootdir/etc/scuttlebot
215
+    fi
216
+
217
+    # an unprivileged user to run as
218
+    chroot "$rootdir" useradd -d /etc/scuttlebot/ scuttlebot
219
+
220
+    # daemon
221
+    echo '[Unit]' > $rootdir/etc/systemd/system/scuttlebot.service
222
+    echo 'Description=Scuttlebot (messaging system)' >> $rootdir/etc/systemd/system/scuttlebot.service
223
+    echo 'After=syslog.target' >> $rootdir/etc/systemd/system/scuttlebot.service
224
+    echo 'After=network.target' >> $rootdir/etc/systemd/system/scuttlebot.service
225
+    echo '' >> $rootdir/etc/systemd/system/scuttlebot.service
226
+    echo '[Service]' >> $rootdir/etc/systemd/system/scuttlebot.service
227
+    echo 'Type=simple' >> $rootdir/etc/systemd/system/scuttlebot.service
228
+    echo 'User=scuttlebot' >> $rootdir/etc/systemd/system/scuttlebot.service
229
+    echo 'Group=scuttlebot' >> $rootdir/etc/systemd/system/scuttlebot.service
230
+    echo "WorkingDirectory=/etc/scuttlebot" >> $rootdir/etc/systemd/system/scuttlebot.service
231
+    echo 'ExecStart=/usr/local/bin/sbot server' >> $rootdir/etc/systemd/system/scuttlebot.service
232
+    echo 'Restart=always' >> $rootdir/etc/systemd/system/scuttlebot.service
233
+    echo 'Environment="USER=scuttlebot"' >> $rootdir/etc/systemd/system/scuttlebot.service
234
+    echo '' >> $rootdir/etc/systemd/system/scuttlebot.service
235
+    echo '[Install]' >> $rootdir/etc/systemd/system/scuttlebot.service
236
+    echo 'WantedBy=multi-user.target' >> $rootdir/etc/systemd/system/scuttlebot.service
237
+}
238
+
200
 function install_scuttlebot {
239
 function install_scuttlebot {
201
     function_check install_nodejs
240
     function_check install_nodejs
202
     install_nodejs scuttlebot
241
     install_nodejs scuttlebot

+ 13
- 4
src/freedombone-app-tox View File

34
 SHOW_ON_ABOUT=1
34
 SHOW_ON_ABOUT=1
35
 
35
 
36
 TOX_PORT=33445
36
 TOX_PORT=33445
37
+
38
+# upstream is https://github.com/TokTok/c-toxcore
37
 TOXCORE_REPO="https://github.com/bashrc/toxcore"
39
 TOXCORE_REPO="https://github.com/bashrc/toxcore"
38
-TOXCORE_COMMIT='532629d486e3361c7d8d95b38293cc7d61dc4ee5'
40
+TOXCORE_COMMIT='987ad5eac173442d6ad2d5cd80c2da763a815a9a'
41
+
39
 TOXID_REPO="https://github.com/bashrc/toxid"
42
 TOXID_REPO="https://github.com/bashrc/toxid"
40
 TOX_BOOTSTRAP_ID_FILE=/var/lib/tox-bootstrapd/pubkey.txt
43
 TOX_BOOTSTRAP_ID_FILE=/var/lib/tox-bootstrapd/pubkey.txt
41
 # These are some default nodes, but you can replace them with trusted nodes
44
 # These are some default nodes, but you can replace them with trusted nodes
46
 #  '144.76.60.215,2a01:4f8:191:64d6::1,33445,04119E835DF3E78BACF0F84235B300546AF8B936F035185E2A8E9E0A67C8924F,sonOfRa,DE'
49
 #  '144.76.60.215,2a01:4f8:191:64d6::1,33445,04119E835DF3E78BACF0F84235B300546AF8B936F035185E2A8E9E0A67C8924F,sonOfRa,DE'
47
 #)
50
 #)
48
 TOXIC_REPO="https://github.com/Tox/toxic"
51
 TOXIC_REPO="https://github.com/Tox/toxic"
49
-TOXIC_COMMIT='cf16849b374e484a33a4dffa3dfb937b59d537f2'
52
+TOXIC_COMMIT='5cc83a7cb584886d90d7da15e8398215fed0d315'
50
 TOXIC_FILE=/usr/local/bin/toxic
53
 TOXIC_FILE=/usr/local/bin/toxic
51
 
54
 
52
 QTOX_REPO="https://github.com/bashrc/qTox"
55
 QTOX_REPO="https://github.com/bashrc/qTox"
139
     chroot "${rootdir}" apt-get -yq install libspeex-dev yasm pkg-config libopenjp2-7-dev
142
     chroot "${rootdir}" apt-get -yq install libspeex-dev yasm pkg-config libopenjp2-7-dev
140
     chroot "${rootdir}" apt-get -yq install libx264-dev mjpegtools libmjpegtools-dev libav-tools
143
     chroot "${rootdir}" apt-get -yq install libx264-dev mjpegtools libmjpegtools-dev libav-tools
141
 
144
 
145
+    chroot "${rootdir}" apt-get -yq install build-essential cmake ffmpeg libexif-dev libgdk-pixbuf2.0-dev libglib2.0-dev libgtk2.0-dev libopenal-dev libqrencode-dev libqt5opengl5-dev libqt5svg5-dev libsqlcipher-dev libxss-dev pkg-config qrencode qt5-default qt5-qmake qttools5-dev qttools5-dev-tools yasm
146
+
142
     if [ -d /repos/qtox ]; then
147
     if [ -d /repos/qtox ]; then
143
         mkdir ${rootdir}$INSTALL_DIR/qtox
148
         mkdir ${rootdir}$INSTALL_DIR/qtox
144
         cp -r -p /repos/qtox/. ${rootdir}$INSTALL_DIR/qtox
149
         cp -r -p /repos/qtox/. ${rootdir}$INSTALL_DIR/qtox
155
     git checkout $QTOX_COMMIT -b $QTOX_COMMIT
160
     git checkout $QTOX_COMMIT -b $QTOX_COMMIT
156
     chroot ${rootdir} /bin/bash -x <<EOF
161
     chroot ${rootdir} /bin/bash -x <<EOF
157
 cd ${INSTALL_DIR}/qtox
162
 cd ${INSTALL_DIR}/qtox
158
-qmake
163
+export PKG_CONFIG_PATH="$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig"
164
+cmake .
159
 make
165
 make
160
 make install
166
 make install
161
 EOF
167
 EOF
162
-    if [ ! -f ${rootdir}/usr/bin/qtox ]; then
168
+    if [ ! -f ${rootdir}/usr/local/bin/qtox ]; then
163
         exit 75784
169
         exit 75784
164
     fi
170
     fi
171
+    cp ${rootdir}/usr/local/bin/qtox ${rootdir}/usr/bin/qtox
165
 }
172
 }
166
 
173
 
167
 function reconfigure_tox {
174
 function reconfigure_tox {
684
     if [ ${rootdir} ]; then
691
     if [ ${rootdir} ]; then
685
         chroot ${rootdir} apt-get -yq install libncursesw5-dev libconfig-dev libqrencode-dev
692
         chroot ${rootdir} apt-get -yq install libncursesw5-dev libconfig-dev libqrencode-dev
686
         chroot ${rootdir} apt-get -yq install libcurl4-openssl-dev libvpx-dev libopenal-dev
693
         chroot ${rootdir} apt-get -yq install libcurl4-openssl-dev libvpx-dev libopenal-dev
694
+        chroot ${rootdir} apt-get -yq install libqrencode-dev
687
     else
695
     else
688
         apt-get -yq install libncursesw5-dev libconfig-dev libqrencode-dev
696
         apt-get -yq install libncursesw5-dev libconfig-dev libqrencode-dev
689
         apt-get -yq install libcurl4-openssl-dev libvpx-dev libopenal-dev
697
         apt-get -yq install libcurl4-openssl-dev libvpx-dev libopenal-dev
698
+        apt-get -yq install libqrencode-dev
690
     fi
699
     fi
691
 
700
 
692
     TEMP_SCRIPT_NAME=fbtmp728353.sh
701
     TEMP_SCRIPT_NAME=fbtmp728353.sh

+ 166
- 119
src/freedombone-app-vpn View File

46
 VPN_UNIT="Freedombone Unit"
46
 VPN_UNIT="Freedombone Unit"
47
 STUNNEL_PORT=3439
47
 STUNNEL_PORT=3439
48
 VPN_TLS_PORT=553
48
 VPN_TLS_PORT=553
49
+VPN_MESH_TLS_PORT=653
49
 
50
 
50
 vpn_variables=(MY_EMAIL_ADDRESS
51
 vpn_variables=(MY_EMAIL_ADDRESS
51
                DEFAULT_DOMAIN_NAME
52
                DEFAULT_DOMAIN_NAME
454
     new_username="$1"
455
     new_username="$1"
455
 }
456
 }
456
 
457
 
457
-function install_stunnel {
458
-    apt-get -yq install stunnel4
458
+function mesh_setup_vpn {
459
+    vpn_generate_keys
460
+
461
+    if [ -d /home/fbone ]; then
462
+        cp /etc/stunnel/stunnel-client.conf /home/fbone/stunnel-client.conf
463
+        chown fbone:fbone /home/fbone/stunnel*
464
+    fi
465
+
466
+    generate_stunnel_keys
459
 
467
 
460
-    cd /etc/stunnel
468
+    systemctl restart openvpn
469
+}
461
 
470
 
471
+function generate_stunnel_keys {
462
     openssl req -x509 -nodes -days 3650 -sha256 \
472
     openssl req -x509 -nodes -days 3650 -sha256 \
463
             -subj "/O=$VPN_ORGANISATION/OU=$VPN_UNIT/C=$VPN_COUNTRY_CODE/ST=$VPN_AREA/L=$VPN_LOCATION/CN=$HOSTNAME" \
473
             -subj "/O=$VPN_ORGANISATION/OU=$VPN_UNIT/C=$VPN_COUNTRY_CODE/ST=$VPN_AREA/L=$VPN_LOCATION/CN=$HOSTNAME" \
464
-            -newkey rsa:2048 -keyout key.pem \
465
-            -out cert.pem
466
-    if [ ! -f key.pem ]; then
474
+            -newkey rsa:2048 -keyout /etc/stunnel/key.pem \
475
+            -out /etc/stunnel/cert.pem
476
+    if [ ! -f /etc/stunnel/key.pem ]; then
467
         echo $'stunnel key not created'
477
         echo $'stunnel key not created'
468
         exit 793530
478
         exit 793530
469
     fi
479
     fi
470
-    if [ ! -f cert.pem ]; then
480
+    if [ ! -f /etc/stunnel/cert.pem ]; then
471
         echo $'stunnel cert not created'
481
         echo $'stunnel cert not created'
472
         exit 204587
482
         exit 204587
473
     fi
483
     fi
474
-    chmod 400 key.pem
475
-    chmod 640 cert.pem
484
+    chmod 400 /etc/stunnel/key.pem
485
+    chmod 640 /etc/stunnel/cert.pem
476
 
486
 
477
-    cat key.pem cert.pem >> stunnel.pem
478
-    chmod 640 stunnel.pem
487
+    cat /etc/stunnel/key.pem /etc/stunnel/cert.pem >> /etc/stunnel/stunnel.pem
488
+    chmod 640 /etc/stunnel/stunnel.pem
479
 
489
 
480
-    openssl pkcs12 -export -out stunnel.p12 -inkey key.pem -in cert.pem -passout pass:
481
-    if [ ! -f stunnel.p12 ]; then
490
+    openssl pkcs12 -export -out /etc/stunnel/stunnel.p12 -inkey /etc/stunnel/key.pem -in /etc/stunnel/cert.pem -passout pass:
491
+    if [ ! -f /etc/stunnel/stunnel.p12 ]; then
482
         echo $'stunnel pkcs12 not created'
492
         echo $'stunnel pkcs12 not created'
483
         exit 639353
493
         exit 639353
484
     fi
494
     fi
485
-    chmod 640 stunnel.p12
486
-
487
-    echo 'chroot = /var/lib/stunnel4' > stunnel.conf
488
-    echo 'pid = /stunnel4.pid' >> stunnel.conf
489
-    echo 'setuid = stunnel4' >> stunnel.conf
490
-    echo 'setgid = stunnel4' >> stunnel.conf
491
-    echo 'socket = l:TCP_NODELAY=1' >> stunnel.conf
492
-    echo 'socket = r:TCP_NODELAY=1' >> stunnel.conf
493
-    echo 'cert = /etc/stunnel/stunnel.pem' >> stunnel.conf
494
-    echo '[openvpn]' >> stunnel.conf
495
-    echo "accept = $VPN_TLS_PORT" >> stunnel.conf
496
-    echo 'connect = localhost:1194' >> stunnel.conf
497
-    echo 'cert = /etc/stunnel/stunnel.pem' >> stunnel.conf
498
-
499
-    sed -i 's|ENABLED=.*|ENABLED=1|g' /etc/default/stunnel4
500
-
501
-    echo '[openvpn]' > stunnel-client.conf
502
-    echo 'client = yes' >> stunnel-client.conf
503
-    echo "accept = $STUNNEL_PORT" >> stunnel-client.conf
504
-    echo "connect = $DEFAULT_DOMAIN_NAME:$VPN_TLS_PORT" >> stunnel-client.conf
505
-    echo 'cert = stunnel.pem' >> stunnel-client.conf
506
-
507
-    echo '[Unit]' > /etc/systemd/system/stunnel.service
508
-    echo 'Description=SSL tunnel for network daemons' >> /etc/systemd/system/stunnel.service
509
-    echo 'Documentation=man:stunnel https://www.stunnel.org/docs.html' >> /etc/systemd/system/stunnel.service
510
-    echo 'DefaultDependencies=no' >> /etc/systemd/system/stunnel.service
511
-    echo 'After=network.target' >> /etc/systemd/system/stunnel.service
512
-    echo 'After=syslog.target' >> /etc/systemd/system/stunnel.service
513
-    echo '' >> /etc/systemd/system/stunnel.service
514
-    echo '[Install]' >> /etc/systemd/system/stunnel.service
515
-    echo 'WantedBy=multi-user.target' >> /etc/systemd/system/stunnel.service
516
-    echo 'Alias=stunnel.target' >> /etc/systemd/system/stunnel.service
517
-    echo '' >> /etc/systemd/system/stunnel.service
518
-    echo '[Service]' >> /etc/systemd/system/stunnel.service
519
-    echo 'Type=forking' >> /etc/systemd/system/stunnel.service
520
-    echo 'RuntimeDirectory=stunnel' >> /etc/systemd/system/stunnel.service
521
-    echo 'EnvironmentFile=-/etc/stunnel/stunnel.conf' >> /etc/systemd/system/stunnel.service
522
-    echo 'ExecStart=/usr/bin/stunnel /etc/stunnel/stunnel.conf' >> /etc/systemd/system/stunnel.service
523
-    echo 'ExecStop=/usr/bin/killall -9 stunnel' >> /etc/systemd/system/stunnel.service
524
-    echo 'RemainAfterExit=yes' >> /etc/systemd/system/stunnel.service
525
-
526
-    if [ $VPN_TLS_PORT -eq 443 ]; then
527
-        systemctl stop nginx
528
-        systemctl disable nginx
529
-    else
530
-        systemctl enable nginx
531
-        systemctl restart nginx
532
-    fi
533
-
534
-    systemctl enable stunnel
535
-    systemctl daemon-reload
536
-    systemctl start stunnel
495
+    chmod 640 /etc/stunnel/stunnel.p12
537
 
496
 
538
     cp /etc/stunnel/stunnel.pem /home/$MY_USERNAME/stunnel.pem
497
     cp /etc/stunnel/stunnel.pem /home/$MY_USERNAME/stunnel.pem
539
     cp /etc/stunnel/stunnel.p12 /home/$MY_USERNAME/stunnel.p12
498
     cp /etc/stunnel/stunnel.p12 /home/$MY_USERNAME/stunnel.p12
540
-    cp /etc/stunnel/stunnel-client.conf /home/$MY_USERNAME/stunnel-client.conf
541
-    chown $MY_USERNAME:$MY_USERNAME /home/$MY_USERNAME/stunnel*
499
+    chown $MY_USERNAME:$MY_USERNAME $prefix$userhome/stunnel*
542
 }
500
 }
543
 
501
 
544
-function install_vpn {
545
-    apt-get -yq install fastd openvpn easy-rsa
502
+function install_stunnel {
503
+    prefix=
504
+    prefixchroot=
505
+    if [ $rootdir ]; then
506
+        prefix=$rootdir
507
+        prefixchroot="chroot $rootdir"
508
+        VPN_TLS_PORT=$VPN_MESH_TLS_PORT
509
+    fi
510
+
511
+    $prefixchroot apt-get -yq install stunnel4
512
+
513
+    if [ ! $prefix ]; then
514
+        cd /etc/stunnel
515
+        generate_stunnel_keys
516
+    fi
517
+
518
+    echo 'chroot = /var/lib/stunnel4' > $prefix/etc/stunnel/stunnel.conf
519
+    echo 'pid = /stunnel4.pid' >> $prefix/etc/stunnel/stunnel.conf
520
+    echo 'setuid = stunnel4' >> $prefix/etc/stunnel/stunnel.conf
521
+    echo 'setgid = stunnel4' >> $prefix/etc/stunnel/stunnel.conf
522
+    echo 'socket = l:TCP_NODELAY=1' >> $prefix/etc/stunnel/stunnel.conf
523
+    echo 'socket = r:TCP_NODELAY=1' >> $prefix/etc/stunnel/stunnel.conf
524
+    echo 'cert = /etc/stunnel/stunnel.pem' >> $prefix/etc/stunnel/stunnel.conf
525
+    echo '[openvpn]' >> $prefix/etc/stunnel/stunnel.conf
526
+    echo "accept = $VPN_TLS_PORT" >> $prefix/etc/stunnel/stunnel.conf
527
+    echo 'connect = localhost:1194' >> $prefix/etc/stunnel/stunnel.conf
528
+    echo 'cert = /etc/stunnel/stunnel.pem' >> $prefix/etc/stunnel/stunnel.conf
529
+
530
+    sed -i 's|ENABLED=.*|ENABLED=1|g' $prefix/etc/default/stunnel4
531
+
532
+    echo '[openvpn]' > $prefix/etc/stunnel/stunnel-client.conf
533
+    echo 'client = yes' >> $prefix/etc/stunnel/stunnel-client.conf
534
+    echo "accept = $STUNNEL_PORT" >> $prefix/etc/stunnel/stunnel-client.conf
535
+    echo "connect = $DEFAULT_DOMAIN_NAME:$VPN_TLS_PORT" >> $prefix/etc/stunnel/stunnel-client.conf
536
+    echo 'cert = stunnel.pem' >> $prefix/etc/stunnel/stunnel-client.conf
537
+
538
+    echo '[Unit]' > $prefix/etc/systemd/system/stunnel.service
539
+    echo 'Description=SSL tunnel for network daemons' >> $prefix/etc/systemd/system/stunnel.service
540
+    echo 'Documentation=man:stunnel https://www.stunnel.org/docs.html' >> $prefix/etc/systemd/system/stunnel.service
541
+    echo 'DefaultDependencies=no' >> $prefix/etc/systemd/system/stunnel.service
542
+    echo 'After=network.target' >> $prefix/etc/systemd/system/stunnel.service
543
+    echo 'After=syslog.target' >> $prefix/etc/systemd/system/stunnel.service
544
+    echo '' >> $prefix/etc/systemd/system/stunnel.service
545
+    echo '[Install]' >> $prefix/etc/systemd/system/stunnel.service
546
+    echo 'WantedBy=multi-user.target' >> $prefix/etc/systemd/system/stunnel.service
547
+    echo 'Alias=stunnel.target' >> $prefix/etc/systemd/system/stunnel.service
548
+    echo '' >> $prefix/etc/systemd/system/stunnel.service
549
+    echo '[Service]' >> $prefix/etc/systemd/system/stunnel.service
550
+    echo 'Type=forking' >> $prefix/etc/systemd/system/stunnel.service
551
+    echo 'RuntimeDirectory=stunnel' >> $prefix/etc/systemd/system/stunnel.service
552
+    echo 'EnvironmentFile=-/etc/stunnel/stunnel.conf' >> $prefix/etc/systemd/system/stunnel.service
553
+    echo 'ExecStart=/usr/bin/stunnel /etc/stunnel/stunnel.conf' >> $prefix/etc/systemd/system/stunnel.service
554
+    echo 'ExecStop=/usr/bin/killall -9 stunnel' >> $prefix/etc/systemd/system/stunnel.service
555
+    echo 'RemainAfterExit=yes' >> $prefix/etc/systemd/system/stunnel.service
556
+
557
+    if [ ! $prefix ]; then
558
+        if [ $VPN_TLS_PORT -eq 443 ]; then
559
+            systemctl stop nginx
560
+            systemctl disable nginx
561
+        else
562
+            systemctl enable nginx
563
+            systemctl restart nginx
564
+        fi
546
 
565
 
547
-    groupadd vpn
548
-    useradd -r -s /bin/false -g vpn vpn
566
+        systemctl enable stunnel
567
+        systemctl daemon-reload
568
+        systemctl start stunnel
549
 
569
 
550
-    # server configuration
551
-    echo 'port 1194' > /etc/openvpn/server.conf
552
-    echo 'proto tcp' >> /etc/openvpn/server.conf
553
-    echo 'dev tun' >> /etc/openvpn/server.conf
554
-    echo 'tun-mtu 1500' >> /etc/openvpn/server.conf
555
-    echo 'tun-mtu-extra 32' >> /etc/openvpn/server.conf
556
-    echo 'mssfix 1450' >> /etc/openvpn/server.conf
557
-    echo 'ca /etc/openvpn/ca.crt' >> /etc/openvpn/server.conf
558
-    echo 'cert /etc/openvpn/server.crt' >> /etc/openvpn/server.conf
559
-    echo 'key /etc/openvpn/server.key' >> /etc/openvpn/server.conf
560
-    echo 'dh /etc/openvpn/dh2048.pem' >> /etc/openvpn/server.conf
561
-    echo 'server 10.8.0.0 255.255.255.0' >> /etc/openvpn/server.conf
562
-    echo 'push "redirect-gateway def1 bypass-dhcp"' >> /etc/openvpn/server.conf
563
-    echo "push \"dhcp-option DNS 85.214.73.63\"" >> /etc/openvpn/server.conf
564
-    echo "push \"dhcp-option DNS 213.73.91.35\"" >> /etc/openvpn/server.conf
565
-    echo 'keepalive 5 30' >> /etc/openvpn/server.conf
566
-    echo 'comp-lzo' >> /etc/openvpn/server.conf
567
-    echo 'persist-key' >> /etc/openvpn/server.conf
568
-    echo 'persist-tun' >> /etc/openvpn/server.conf
569
-    echo 'status /dev/null' >> /etc/openvpn/server.conf
570
-    echo 'verb 3' >> /etc/openvpn/server.conf
571
-    echo '' >> /etc/openvpn/server.conf
572
-
573
-    echo 1 > /proc/sys/net/ipv4/ip_forward
574
-    sed -i 's|# net.ipv4.ip_forward|net.ipv4.ip_forward|g' /etc/sysctl.conf
575
-    sed -i 's|#net.ipv4.ip_forward|net.ipv4.ip_forward|g' /etc/sysctl.conf
576
-    sed -i 's|net.ipv4.ip_forward.*|net.ipv4.ip_forward=1|g' /etc/sysctl.conf
577
-
578
-    cp -r /usr/share/easy-rsa/ /etc/openvpn
579
-    if [ ! -d /etc/openvpn/easy-rsa/keys ]; then
580
-        mkdir /etc/openvpn/easy-rsa/keys
570
+        cp /etc/stunnel/stunnel-client.conf /home/$MY_USERNAME/stunnel-client.conf
571
+        chown $MY_USERNAME:$MY_USERNAME /home/$MY_USERNAME/stunnel*
581
     fi
572
     fi
573
+}
582
 
574
 
583
-    # keys configuration
584
-    sed -i "s|export KEY_COUNTRY.*|export KEY_COUNTRY=\"US\"|g" /etc/openvpn/easy-rsa/vars
585
-    sed -i "s|export KEY_PROVINCE.*|export KEY_PROVINCE=\"TX\"|g" /etc/openvpn/easy-rsa/vars
586
-    sed -i "s|export KEY_CITY.*|export KEY_CITY=\"Dallas\"|g" /etc/openvpn/easy-rsa/vars
587
-    sed -i "s|export KEY_ORG.*|export KEY_ORG=\"$PROJECT_NAME\"|g" /etc/openvpn/easy-rsa/vars
588
-    sed -i "s|export KEY_EMAIL.*|export KEY_EMAIL=\"$MY_EMAIL_ADDRESS\"|g" /etc/openvpn/easy-rsa/vars
589
-    sed -i "s|export KEY_OU=.*|export KEY_OU=\"MoonUnit\"|g" /etc/openvpn/easy-rsa/vars
590
-    sed -i "s|export KEY_NAME.*|export KEY_NAME=\"$OPENVPN_SERVER_NAME\"|g" /etc/openvpn/easy-rsa/vars
591
-
575
+function vpn_generate_keys {
592
     # generate host keys
576
     # generate host keys
593
     if [ ! -f /etc/openvpn/dh2048.pem ]; then
577
     if [ ! -f /etc/openvpn/dh2048.pem ]; then
594
-        openssl dhparam -out /etc/openvpn/dh2048.pem 2048
578
+        ${PROJECT_NAME}-dhparam -o /etc/openvpn/dh2048.pem
595
     fi
579
     fi
596
     if [ ! -f /etc/openvpn/dh2048.pem ]; then
580
     if [ ! -f /etc/openvpn/dh2048.pem ]; then
597
         echo $'vpn dhparams were not generated'
581
         echo $'vpn dhparams were not generated'
621
     sed -i 's| --interact||g' build-key-server
605
     sed -i 's| --interact||g' build-key-server
622
     sed -i 's| --interact||g' build-ca
606
     sed -i 's| --interact||g' build-ca
623
     ./build-ca
607
     ./build-ca
624
-    ./build-key-server $OPENVPN_SERVER_NAME
608
+    ./build-key-server ${OPENVPN_SERVER_NAME}
625
     if [ ! -f /etc/openvpn/easy-rsa/keys/${OPENVPN_SERVER_NAME}.crt ]; then
609
     if [ ! -f /etc/openvpn/easy-rsa/keys/${OPENVPN_SERVER_NAME}.crt ]; then
626
         echo $'OpenVPN crt not found'
610
         echo $'OpenVPN crt not found'
627
         exit 7823352
611
         exit 7823352
643
     fi
627
     fi
644
     cp /etc/openvpn/easy-rsa/keys/{$OPENVPN_SERVER_NAME.crt,$OPENVPN_SERVER_NAME.key,ca.crt} /etc/openvpn
628
     cp /etc/openvpn/easy-rsa/keys/{$OPENVPN_SERVER_NAME.crt,$OPENVPN_SERVER_NAME.key,ca.crt} /etc/openvpn
645
 
629
 
646
-    create_user_vpn_key $MY_USERNAME
630
+    create_user_vpn_key ${MY_USERNAME}
631
+}
632
+
633
+function install_vpn {
634
+    prefix=
635
+    prefixchroot=
636
+    if [ $rootdir ]; then
637
+        prefix=$rootdir
638
+        prefixchroot="chroot $rootdir"
639
+        VPN_TLS_PORT=$VPN_MESH_TLS_PORT
640
+    fi
641
+    $prefixchroot apt-get -yq install fastd openvpn easy-rsa
647
 
642
 
648
-    firewall_enable_vpn
643
+    $prefixchroot groupadd vpn
644
+    $prefixchroot useradd -r -s /bin/false -g vpn vpn
649
 
645
 
650
-    if [ $VPN_TLS_PORT -ne 443 ]; then
651
-        firewall_add VPN-TLS $VPN_TLS_PORT tcp
646
+    # server configuration
647
+    echo 'port 1194' > $prefix/etc/openvpn/server.conf
648
+    echo 'proto tcp' >> $prefix/etc/openvpn/server.conf
649
+    echo 'dev tun' >> $prefix/etc/openvpn/server.conf
650
+    echo 'tun-mtu 1500' >> $prefix/etc/openvpn/server.conf
651
+    echo 'tun-mtu-extra 32' >> $prefix/etc/openvpn/server.conf
652
+    echo 'mssfix 1450' >> $prefix/etc/openvpn/server.conf
653
+    echo 'ca /etc/openvpn/ca.crt' >> $prefix/etc/openvpn/server.conf
654
+    echo 'cert /etc/openvpn/server.crt' >> $prefix/etc/openvpn/server.conf
655
+    echo 'key /etc/openvpn/server.key' >> $prefix/etc/openvpn/server.conf
656
+    echo 'dh /etc/openvpn/dh2048.pem' >> $prefix/etc/openvpn/server.conf
657
+    echo 'server 10.8.0.0 255.255.255.0' >> $prefix/etc/openvpn/server.conf
658
+    echo 'push "redirect-gateway def1 bypass-dhcp"' >> $prefix/etc/openvpn/server.conf
659
+    echo "push \"dhcp-option DNS 85.214.73.63\"" >> $prefix/etc/openvpn/server.conf
660
+    echo "push \"dhcp-option DNS 213.73.91.35\"" >> $prefix/etc/openvpn/server.conf
661
+    echo 'keepalive 5 30' >> $prefix/etc/openvpn/server.conf
662
+    echo 'comp-lzo' >> $prefix/etc/openvpn/server.conf
663
+    echo 'persist-key' >> $prefix/etc/openvpn/server.conf
664
+    echo 'persist-tun' >> $prefix/etc/openvpn/server.conf
665
+    echo 'status /dev/null' >> $prefix/etc/openvpn/server.conf
666
+    echo 'verb 3' >> $prefix/etc/openvpn/server.conf
667
+    echo '' >> $prefix/etc/openvpn/server.conf
668
+
669
+    if [ ! $prefix ]; then
670
+        echo 1 > /proc/sys/net/ipv4/ip_forward
671
+    fi
672
+    sed -i 's|# net.ipv4.ip_forward|net.ipv4.ip_forward|g' $prefix/etc/sysctl.conf
673
+    sed -i 's|#net.ipv4.ip_forward|net.ipv4.ip_forward|g' $prefix/etc/sysctl.conf
674
+    sed -i 's|net.ipv4.ip_forward.*|net.ipv4.ip_forward=1|g' $prefix/etc/sysctl.conf
675
+
676
+    cp -r $prefix/usr/share/easy-rsa/ $prefix/etc/openvpn
677
+    if [ ! -d $prefix/etc/openvpn/easy-rsa/keys ]; then
678
+        mkdir $prefix/etc/openvpn/easy-rsa/keys
652
     fi
679
     fi
653
 
680
 
654
-    systemctl start openvpn
681
+    # keys configuration
682
+    sed -i "s|export KEY_COUNTRY.*|export KEY_COUNTRY=\"US\"|g" $prefix/etc/openvpn/easy-rsa/vars
683
+    sed -i "s|export KEY_PROVINCE.*|export KEY_PROVINCE=\"TX\"|g" $prefix/etc/openvpn/easy-rsa/vars
684
+    sed -i "s|export KEY_CITY.*|export KEY_CITY=\"Dallas\"|g" $prefix/etc/openvpn/easy-rsa/vars
685
+    sed -i "s|export KEY_ORG.*|export KEY_ORG=\"$PROJECT_NAME\"|g" $prefix/etc/openvpn/easy-rsa/vars
686
+    sed -i "s|export KEY_EMAIL.*|export KEY_EMAIL=\"$MY_EMAIL_ADDRESS\"|g" $prefix/etc/openvpn/easy-rsa/vars
687
+    sed -i "s|export KEY_OU=.*|export KEY_OU=\"MoonUnit\"|g" $prefix/etc/openvpn/easy-rsa/vars
688
+    sed -i "s|export KEY_NAME.*|export KEY_NAME=\"$OPENVPN_SERVER_NAME\"|g" $prefix/etc/openvpn/easy-rsa/vars
689
+
690
+    if [ ! $prefix ]; then
691
+        vpn_generate_keys
692
+        firewall_enable_vpn
693
+
694
+        if [ ${VPN_TLS_PORT} -ne 443 ]; then
695
+            firewall_add VPN-TLS ${VPN_TLS_PORT} tcp
696
+        fi
697
+
698
+        systemctl start openvpn
699
+    fi
655
 
700
 
656
     install_stunnel
701
     install_stunnel
657
 
702
 
658
-    systemctl restart openvpn
703
+    if [ ! $prefix ]; then
704
+        systemctl restart openvpn
705
+    fi
659
 
706
 
660
     APP_INSTALLED=1
707
     APP_INSTALLED=1
661
 }
708
 }

+ 6
- 0
src/freedombone-dhparam View File

199
             shift
199
             shift
200
             RECALCULATE=${1}
200
             RECALCULATE=${1}
201
             ;;
201
             ;;
202
+        -o|--output)
203
+            shift
204
+            FAST='yes'
205
+            calc_dh ${1}
206
+            exit 0
207
+            ;;
202
         --fast)
208
         --fast)
203
             shift
209
             shift
204
             if [[ ${1} == $"yes" || ${1} == $"y" ]]; then
210
             if [[ ${1} == $"yes" || ${1} == $"y" ]]; then

+ 115
- 1
src/freedombone-image-customise View File

564
 PATCHWORK_REPO="https://github.com/ssbc/patchwork"
564
 PATCHWORK_REPO="https://github.com/ssbc/patchwork"
565
 PATCHWORK_COMMIT='60111a9e3385d65be0d17aa0d15fd20e5fb311ce'
565
 PATCHWORK_COMMIT='60111a9e3385d65be0d17aa0d15fd20e5fb311ce'
566
 
566
 
567
+FERMENT_REPO="https://github.com/LolaShare/ferment"
568
+FERMENT_COMMIT='6e0e434114cd4cc652a03f6dcc6ddcec007b0058'
569
+
567
 install_patchwork() {
570
 install_patchwork() {
568
     if [[ $VARIANT != "meshclient" ]]; then
571
     if [[ $VARIANT != "meshclient" ]]; then
569
         return
572
         return
599
     cp $rootdir/root/$PROJECT_NAME/img/icon_patchwork.png $rootdir/etc/patchwork/icon_patchwork.png
602
     cp $rootdir/root/$PROJECT_NAME/img/icon_patchwork.png $rootdir/etc/patchwork/icon_patchwork.png
600
 }
603
 }
601
 
604
 
605
+install_ferment() {
606
+    if [[ $VARIANT != "meshclient" ]]; then
607
+        return
608
+    fi
609
+
610
+    get_npm_arch
611
+
612
+    git clone $FERMENT_REPO $rootdir/etc/ferment
613
+    if [ ! -d $rootdir/etc/ferment ]; then
614
+        exit 5239465
615
+    fi
616
+    cd $rootdir/etc/ferment
617
+    git checkout $FERMENT_COMMIT -b $FERMENT_COMMIT
618
+
619
+    cat <<EOF > $rootdir/usr/bin/install_ferment
620
+#!/bin/bash
621
+cd /etc/ferment
622
+npm install --arch=$NPM_ARCH --build-from-source
623
+npm install --arch=$NPM_ARCH --save-dev electron-rebuild
624
+./node_modules/.bin/electron-rebuild
625
+npm install --arch=$NPM_ARCH git-ssb
626
+EOF
627
+    chroot "$rootdir" /bin/chmod +x /usr/bin/install_ferment
628
+    chroot "$rootdir" /usr/bin/install_ferment
629
+    rm $rootdir/usr/bin/install_ferment
630
+
631
+    echo '#!/bin/bash' > $rootdir/usr/bin/start_ferment
632
+    echo 'cd /etc/ferment' >> $rootdir/usr/bin/start_ferment
633
+    echo 'npm start' >> $rootdir/usr/bin/start_ferment
634
+    chmod +x $rootdir/usr/bin/start_ferment
635
+
636
+    # Copy icon to an accesible location
637
+    cp $rootdir/root/$PROJECT_NAME/img/icon_ferment.png $rootdir/etc/patchwork/icon_ferment.png
638
+}
639
+
640
+mesh_shutdown_script() {
641
+    echo '[Unit]' > $rootdir/etc/systemd/system/meshshutdown.service
642
+    echo 'Description=Shuts down the mesh' >> $rootdir/etc/systemd/system/meshshutdown.service
643
+    echo 'Before=shutdown.target' >> $rootdir/etc/systemd/system/meshshutdown.service
644
+    echo '' >> $rootdir/etc/systemd/system/meshshutdown.service
645
+    echo '[Service]' >> $rootdir/etc/systemd/system/meshshutdown.service
646
+    echo 'ExecStart=/bin/true' >> $rootdir/etc/systemd/system/meshshutdown.service
647
+    echo 'ExecStop=/bin/bash /usr/local/bin/batman stop' >> $rootdir/etc/systemd/system/meshshutdown.service
648
+    echo 'RemainAfterExit=yes' >> $rootdir/etc/systemd/system/meshshutdown.service
649
+    echo '' >> $rootdir/etc/systemd/system/meshshutdown.service
650
+    echo '[Install]' >> $rootdir/etc/systemd/system/meshshutdown.service
651
+    echo 'WantedBy=multi-user.target' >> $rootdir/etc/systemd/system/meshshutdown.service
652
+    chroot "$rootdir" systemctl enable meshshutdown
653
+}
654
+
602
 initialise_mesh() {
655
 initialise_mesh() {
603
     if [[ $VARIANT != "mesh"* ]]; then
656
     if [[ $VARIANT != "mesh"* ]]; then
604
         return
657
         return
632
     configure_firewall
685
     configure_firewall
633
     install_avahi
686
     install_avahi
634
     install_batman
687
     install_batman
688
+    mesh_shutdown_script
689
+    install_vpn
635
     install_tomb
690
     install_tomb
636
     #install_tahoelafs
691
     #install_tahoelafs
637
     #install_librevault
692
     #install_librevault
638
     install_patchwork
693
     install_patchwork
694
+    mesh_install_scuttlebot
695
+    #install_ferment
639
     install_ipfs
696
     install_ipfs
640
     install_tox
697
     install_tox
641
     install_web_server
698
     install_web_server
828
     # USB cloning tool
885
     # USB cloning tool
829
     chroot "$rootdir" apt-get -yq install gnome-multi-writer
886
     chroot "$rootdir" apt-get -yq install gnome-multi-writer
830
 
887
 
888
+    # clipboard
889
+    chroot "$rootdir" apt-get -yq install xclip
890
+
891
+    # audio recording
892
+    chroot "$rootdir" apt-get -yq install audacity
893
+
831
     # Produce a text file on the desktop listing users on the mesh
894
     # Produce a text file on the desktop listing users on the mesh
832
     cat <<EOF > $rootdir/usr/bin/list-tox-users
895
     cat <<EOF > $rootdir/usr/bin/list-tox-users
833
 #!/bin/bash
896
 #!/bin/bash
897
+ethernet_connected=$(cat /sys/class/net/eth0/carrier)
834
 users_list=\$(lstox | awk -F ' ' '{\$1=""; print \$0}' | sed -e 's/^[[:space:]]*//' | sort -d | uniq)
898
 users_list=\$(lstox | awk -F ' ' '{\$1=""; print \$0}' | sed -e 's/^[[:space:]]*//' | sort -d | uniq)
835
 if [ ! \$users_list ]; then
899
 if [ ! \$users_list ]; then
836
     no_of_users=0
900
     no_of_users=0
870
         echo 'Comment=A decentralized messaging and sharing app built on top of Secure Scuttlebutt (SSB)' >> /home/$MY_USERNAME/Desktop/social.desktop
934
         echo 'Comment=A decentralized messaging and sharing app built on top of Secure Scuttlebutt (SSB)' >> /home/$MY_USERNAME/Desktop/social.desktop
871
         echo 'Exec=bash /usr/bin/start_patchwork' >> /home/$MY_USERNAME/Desktop/social.desktop
935
         echo 'Exec=bash /usr/bin/start_patchwork' >> /home/$MY_USERNAME/Desktop/social.desktop
872
         echo "Icon=/etc/patchwork/icon_patchwork.png" >> /home/$MY_USERNAME/Desktop/social.desktop
936
         echo "Icon=/etc/patchwork/icon_patchwork.png" >> /home/$MY_USERNAME/Desktop/social.desktop
873
-        echo 'StartupNotify=true' >> /home/$MY_USERNAME/Desktop/social.desktop
937
+        echo 'Terminal=false' >> /home/$MY_USERNAME/Desktop/social.desktop
938
+        echo 'Categories=Application;' >> /home/$MY_USERNAME/Desktop/social.desktop
874
         chmod +x /home/$MY_USERNAME/Desktop/social.desktop
939
         chmod +x /home/$MY_USERNAME/Desktop/social.desktop
875
         chown $MY_USERNAME:$MY_USERNAME /home/$MY_USERNAME/Desktop/social.desktop
940
         chown $MY_USERNAME:$MY_USERNAME /home/$MY_USERNAME/Desktop/social.desktop
876
     else
941
     else
879
         fi
944
         fi
880
     fi
945
     fi
881
 
946
 
947
+    #if [ ! -f /home/$MY_USERNAME/Desktop/audio.desktop ]; then
948
+    #    echo '[Desktop Entry]' > /home/$MY_USERNAME/Desktop/audio.desktop
949
+    #    echo 'Name=Audio/Music' >> /home/$MY_USERNAME/Desktop/audio.desktop
950
+    #    echo 'Type=Application' >> /home/$MY_USERNAME/Desktop/audio.desktop
951
+    #    echo 'Comment=Audio publishing and streaming' >> /home/$MY_USERNAME/Desktop/audio.desktop
952
+    #    echo 'Exec=bash /usr/bin/start_ferment' >> /home/$MY_USERNAME/Desktop/audio.desktop
953
+    #    echo "Icon=/etc/patchwork/icon_ferment.png" >> /home/$MY_USERNAME/Desktop/audio.desktop
954
+    #    echo 'Terminal=false' >> /home/$MY_USERNAME/Desktop/audio.desktop
955
+    #    echo 'Categories=Application;' >> /home/$MY_USERNAME/Desktop/audio.desktop
956
+    #    chmod +x /home/$MY_USERNAME/Desktop/audio.desktop
957
+    #    chown $MY_USERNAME:$MY_USERNAME /home/$MY_USERNAME/Desktop/audio.desktop
958
+    #else
959
+    #    if grep -q "Offline" /home/$MY_USERNAME/Desktop/audio.desktop; then
960
+    #        sed -i 's|Name=.*|Name=Audio/Music|g' /home/$MY_USERNAME/Desktop/audio.desktop
961
+    #    fi
962
+    #fi
963
+
882
     if [ -f /tmp/.ipfs-users ]; then
964
     if [ -f /tmp/.ipfs-users ]; then
883
         echo '[Desktop Entry]' > /home/$MY_USERNAME/Desktop/sites.desktop
965
         echo '[Desktop Entry]' > /home/$MY_USERNAME/Desktop/sites.desktop
884
         echo 'Type=Application' >> /home/$MY_USERNAME/Desktop/sites.desktop
966
         echo 'Type=Application' >> /home/$MY_USERNAME/Desktop/sites.desktop
922
         chmod +x /home/$MY_USERNAME/Desktop/tox.desktop
1004
         chmod +x /home/$MY_USERNAME/Desktop/tox.desktop
923
         chown $MY_USERNAME:$MY_USERNAME /home/$MY_USERNAME/Desktop/tox.desktop
1005
         chown $MY_USERNAME:$MY_USERNAME /home/$MY_USERNAME/Desktop/tox.desktop
924
     fi
1006
     fi
1007
+
1008
+    # If ethernet is connected then add the invite icon to help enable
1009
+    # SSB nat traversal
1010
+    if [[ "$ethernet_connected" != "0" ]]; then
1011
+        if [ ! -f /home/$MY_USERNAME/Desktop/invite.desktop ]; then
1012
+            echo '[Desktop Entry]' > /home/$MY_USERNAME/Desktop/invite.desktop
1013
+            echo 'Version=1.0' >> /home/$MY_USERNAME/Desktop/invite.desktop
1014
+            echo 'Name=Create Invite' >> /home/$MY_USERNAME/Desktop/invite.desktop
1015
+            echo 'Type=Application' >> /home/$MY_USERNAME/Desktop/invite.desktop
1016
+            echo 'Comment=Create an invite for Patchwork or Ferment' >> /home/$MY_USERNAME/Desktop/invite.desktop
1017
+            echo 'Exec=mate-terminal -e freedombone-mesh-invite' >> /home/$MY_USERNAME/Desktop/invite.desktop
1018
+            echo 'Icon=/usr/share/freedombone/avatars/invite.png' >> /home/$MY_USERNAME/Desktop/invite.desktop
1019
+            echo 'Terminal=false' >> /home/$MY_USERNAME/Desktop/invite.desktop
1020
+            echo 'Categories=Application;' >> /home/$MY_USERNAME/Desktop/invite.desktop
1021
+        fi
1022
+    else
1023
+        if [ -f /home/$MY_USERNAME/Desktop/invite.desktop ]; then
1024
+            rm /home/$MY_USERNAME/Desktop/invite.desktop
1025
+        fi
1026
+    fi
925
 else
1027
 else
926
     if [ -f /tmp/Users.txt ]; then
1028
     if [ -f /tmp/Users.txt ]; then
927
         rm /tmp/Users.txt
1029
         rm /tmp/Users.txt
943
                 sed -i 's|Name=.*|Name=Social (Offline)|g' /home/$MY_USERNAME/Desktop/social.desktop
1045
                 sed -i 's|Name=.*|Name=Social (Offline)|g' /home/$MY_USERNAME/Desktop/social.desktop
944
             fi
1046
             fi
945
         fi
1047
         fi
1048
+        #if [ -f /home/$MY_USERNAME/Desktop/audio.desktop ]; then
1049
+        #    if ! grep -q "Offline" /home/$MY_USERNAME/Desktop/audio.desktop; then
1050
+        #        sed -i 's|Name=.*|Name=Audio/Music (Offline)|g' /home/$MY_USERNAME/Desktop/audio.desktop
1051
+        #    fi
1052
+        #fi
946
         pkill qtox
1053
         pkill qtox
947
     fi
1054
     fi
1055
+
1056
+    # If there is no ethernet then remove the invite icon
1057
+    if [[ "$ethernet_connected" == "0" ]]; then
1058
+        if [ -f /home/$MY_USERNAME/Desktop/invite.desktop ]; then
1059
+            rm /home/$MY_USERNAME/Desktop/invite.desktop
1060
+        fi
1061
+    fi
948
 fi
1062
 fi
949
 EOF
1063
 EOF
950
     chroot "$rootdir" /bin/chown $MY_USERNAME:$MY_USERNAME /usr/bin/list-tox-users
1064
     chroot "$rootdir" /bin/chown $MY_USERNAME:$MY_USERNAME /usr/bin/list-tox-users

+ 1
- 6
src/freedombone-image-make View File

155
  --grub \
155
  --grub \
156
  --roottype btrfs \
156
  --roottype btrfs \
157
 "   ;;
157
 "   ;;
158
-    meshclient)
159
-        extra_opts="\
160
- --grub \
161
- --roottype btrfs \
162
-"   ;;
163
     all)
158
     all)
164
         extra_opts="\
159
         extra_opts="\
165
  --grub \
160
  --grub \
166
- --roottype btrfs \
161
+ --roottype ext4 \
167
 "   ;;
162
 "   ;;
168
 esac
163
 esac
169
 
164
 

+ 268
- 0
src/freedombone-image-mesh View File

72
 
72
 
73
 CURRENT_BLOG_INDEX=/home/$MY_USERNAME/.blog-index
73
 CURRENT_BLOG_INDEX=/home/$MY_USERNAME/.blog-index
74
 
74
 
75
+OPENVPN_SERVER_NAME="server"
76
+OPENVPN_KEY_FILENAME='client.ovpn'
77
+VPN_COUNTRY_CODE="US"
78
+VPN_AREA="Apparent Free Speech Zone"
79
+VPN_LOCATION="Freedomville"
80
+VPN_ORGANISATION="Freedombone"
81
+VPN_UNIT="Freedombone Unit"
82
+STUNNEL_PORT=3439
83
+VPN_TLS_PORT=553
84
+VPN_MESH_TLS_PORT=653
85
+
86
+SCUTTLEBOT_PORT=8010
87
+
75
 # Debian stretch has a problem where the formerly predictable wlan0 and eth0
88
 # Debian stretch has a problem where the formerly predictable wlan0 and eth0
76
 # device names get assigned random names. This is a hacky workaround.
89
 # device names get assigned random names. This is a hacky workaround.
77
 # Also adding net.ifnames=0 to kernel options on bootloader may work.
90
 # Also adding net.ifnames=0 to kernel options on bootloader may work.
280
     echo 'Terminal=false' >> /home/$MY_USERNAME/Desktop/new_identity.desktop
293
     echo 'Terminal=false' >> /home/$MY_USERNAME/Desktop/new_identity.desktop
281
     echo 'Categories=Application;' >> /home/$MY_USERNAME/Desktop/new_identity.desktop
294
     echo 'Categories=Application;' >> /home/$MY_USERNAME/Desktop/new_identity.desktop
282
 
295
 
296
+    echo '[Desktop Entry]' > /home/$MY_USERNAME/Desktop/social.desktop
297
+    echo 'Name=Social (Offline)' >> /home/$MY_USERNAME/Desktop/social.desktop
298
+    echo 'Type=Application' >> /home/$MY_USERNAME/Desktop/social.desktop
299
+    echo 'Comment=A decentralized messaging and sharing app built on top of Secure Scuttlebutt (SSB)' >> /home/$MY_USERNAME/Desktop/social.desktop
300
+    echo 'Exec=bash /usr/bin/start_patchwork' >> /home/$MY_USERNAME/Desktop/social.desktop
301
+    echo "Icon=/etc/patchwork/icon_patchwork.png" >> /home/$MY_USERNAME/Desktop/social.desktop
302
+    echo 'Terminal=false' >> /home/$MY_USERNAME/Desktop/social.desktop
303
+    echo 'Categories=Application;' >> /home/$MY_USERNAME/Desktop/social.desktop
304
+
305
+    #echo '[Desktop Entry]' > /home/$MY_USERNAME/Desktop/audio.desktop
306
+    #echo 'Name=Audio/Music (Offline)' >> /home/$MY_USERNAME/Desktop/audio.desktop
307
+    #echo 'Type=Application' >> /home/$MY_USERNAME/Desktop/audio.desktop
308
+    #echo 'Comment=Audio publishing and streaming' >> /home/$MY_USERNAME/Desktop/audio.desktop
309
+    #echo 'Exec=bash /usr/bin/start_ferment' >> /home/$MY_USERNAME/Desktop/audio.desktop
310
+    #echo "Icon=/etc/patchwork/icon_ferment.png" >> /home/$MY_USERNAME/Desktop/audio.desktop
311
+    #echo 'Terminal=false' >> /home/$MY_USERNAME/Desktop/audio.desktop
312
+    #echo 'Categories=Application;' >> /home/$MY_USERNAME/Desktop/audio.desktop
313
+
283
     # set permissions
314
     # set permissions
284
     chmod +x /home/$MY_USERNAME/Desktop/*.desktop
315
     chmod +x /home/$MY_USERNAME/Desktop/*.desktop
285
     chown ${MY_USERNAME}:${MY_USERNAME} /home/$MY_USERNAME/Desktop/*
316
     chown ${MY_USERNAME}:${MY_USERNAME} /home/$MY_USERNAME/Desktop/*
554
     echo $'Configured Tahoe-LAFS' >> $INSTALL_LOG
585
     echo $'Configured Tahoe-LAFS' >> $INSTALL_LOG
555
 }
586
 }
556
 
587
 
588
+function create_user_vpn_key {
589
+    username=$1
590
+
591
+    if [ ! -d /home/$username ]; then
592
+        return
593
+    fi
594
+
595
+    echo $"Creating VPN key for $username" >> /var/log/${PROJECT_NAME}.log
596
+
597
+    cd /etc/openvpn/easy-rsa
598
+
599
+    if [ -f /etc/openvpn/easy-rsa/keys/$username.crt ]; then
600
+        rm /etc/openvpn/easy-rsa/keys/$username.crt
601
+    fi
602
+    if [ -f /etc/openvpn/easy-rsa/keys/$username.key ]; then
603
+        rm /etc/openvpn/easy-rsa/keys/$username.key
604
+    fi
605
+    if [ -f /etc/openvpn/easy-rsa/keys/$username.csr ]; then
606
+        rm /etc/openvpn/easy-rsa/keys/$username.csr
607
+    fi
608
+
609
+    sed -i 's| --interact||g' build-key
610
+    ./build-key "$username"
611
+
612
+    if [ ! -f /etc/openvpn/easy-rsa/keys/$username.crt ]; then
613
+        echo $'VPN user cert not generated' >> /var/log/${PROJECT_NAME}.log
614
+        exit 783528
615
+    fi
616
+    user_cert=$(cat /etc/openvpn/easy-rsa/keys/$username.crt)
617
+    if [ ${#user_cert} -lt 10 ]; then
618
+        cat /etc/openvpn/easy-rsa/keys/$username.crt
619
+        echo $'User cert generation failed' >> /var/log/${PROJECT_NAME}.log
620
+        exit 634659
621
+    fi
622
+    if [ ! -f /etc/openvpn/easy-rsa/keys/$username.key ]; then
623
+        echo $'VPN user key not generated'
624
+        exit 682523
625
+    fi
626
+    user_key=$(cat /etc/openvpn/easy-rsa/keys/$username.key)
627
+    if [ ${#user_key} -lt 10 ]; then
628
+        cat /etc/openvpn/easy-rsa/keys/$username.key
629
+        echo $'User key generation failed'
630
+        exit 285838
631
+    fi
632
+
633
+    user_vpn_cert_file=/home/$username/$OPENVPN_KEY_FILENAME
634
+
635
+    echo 'client' > $user_vpn_cert_file
636
+    echo 'dev tun' >> $user_vpn_cert_file
637
+    echo 'proto tcp' >> $user_vpn_cert_file
638
+    echo "remote localhost $STUNNEL_PORT" >> $user_vpn_cert_file
639
+    echo "route $DEFAULT_DOMAIN_NAME 255.255.255.255 net_gateway" >> $user_vpn_cert_file
640
+    echo 'resolv-retry infinite' >> $user_vpn_cert_file
641
+    echo 'nobind' >> $user_vpn_cert_file
642
+    echo 'tun-mtu 1500' >> $user_vpn_cert_file
643
+    echo 'tun-mtu-extra 32' >> $user_vpn_cert_file
644
+    echo 'mssfix 1450' >> $user_vpn_cert_file
645
+    echo 'persist-key' >> $user_vpn_cert_file
646
+    echo 'persist-tun' >> $user_vpn_cert_file
647
+    echo 'auth-nocache' >> $user_vpn_cert_file
648
+    echo 'remote-cert-tls server' >> $user_vpn_cert_file
649
+    echo 'comp-lzo' >> $user_vpn_cert_file
650
+    echo 'verb 3' >> $user_vpn_cert_file
651
+    echo '' >> $user_vpn_cert_file
652
+
653
+    echo '<ca>' >> $user_vpn_cert_file
654
+    cat /etc/openvpn/ca.crt >> $user_vpn_cert_file
655
+    echo '</ca>' >> $user_vpn_cert_file
656
+
657
+    echo '<cert>' >> $user_vpn_cert_file
658
+    cat /etc/openvpn/easy-rsa/keys/$username.crt >> $user_vpn_cert_file
659
+    echo '</cert>' >> $user_vpn_cert_file
660
+
661
+    echo '<key>' >> $user_vpn_cert_file
662
+    cat /etc/openvpn/easy-rsa/keys/$username.key >> $user_vpn_cert_file
663
+    echo '</key>' >> $user_vpn_cert_file
664
+
665
+    chown $username:$username $user_vpn_cert_file
666
+
667
+    # keep a backup
668
+    cp $user_vpn_cert_file /etc/openvpn/easy-rsa/keys/$username.ovpn
669
+
670
+    #rm /etc/openvpn/easy-rsa/keys/$username.crt
671
+    #rm /etc/openvpn/easy-rsa/keys/$username.csr
672
+    shred -zu /etc/openvpn/easy-rsa/keys/$username.key
673
+
674
+    echo $"VPN key created at $user_vpn_cert_file" >> /var/log/${PROJECT_NAME}.log
675
+}
676
+
677
+function vpn_generate_keys {
678
+    # generate host keys
679
+    if [ ! -f /etc/openvpn/dh2048.pem ]; then
680
+        ${PROJECT_NAME}-dhparam -o /etc/openvpn/dh2048.pem
681
+    fi
682
+    if [ ! -f /etc/openvpn/dh2048.pem ]; then
683
+        echo $'vpn dhparams were not generated' >> /var/log/${PROJECT_NAME}.log
684
+        exit 73724523
685
+    fi
686
+    cp /etc/openvpn/dh2048.pem /etc/openvpn/easy-rsa/keys/dh2048.pem
687
+
688
+    cd /etc/openvpn/easy-rsa
689
+    . ./vars
690
+    ./clean-all
691
+    vpn_openssl_version='1.0.0'
692
+    if [ ! -f openssl-${vpn_openssl_version}.cnf ]; then
693
+        echo $"openssl-${vpn_openssl_version}.cnf was not found" >> /var/log/${PROJECT_NAME}.log
694
+        exit 7392353
695
+    fi
696
+    cp openssl-${vpn_openssl_version}.cnf openssl.cnf
697
+
698
+    if [ -f /etc/openvpn/easy-rsa/keys/${OPENVPN_SERVER_NAME}.crt ]; then
699
+        rm /etc/openvpn/easy-rsa/keys/${OPENVPN_SERVER_NAME}.crt
700
+    fi
701
+    if [ -f /etc/openvpn/easy-rsa/keys/${OPENVPN_SERVER_NAME}.key ]; then
702
+        rm /etc/openvpn/easy-rsa/keys/${OPENVPN_SERVER_NAME}.key
703
+    fi
704
+    if [ -f /etc/openvpn/easy-rsa/keys/${OPENVPN_SERVER_NAME}.csr ]; then
705
+        rm /etc/openvpn/easy-rsa/keys/${OPENVPN_SERVER_NAME}.csr
706
+    fi
707
+    sed -i 's| --interact||g' build-key-server
708
+    sed -i 's| --interact||g' build-ca
709
+    ./build-ca
710
+    ./build-key-server ${OPENVPN_SERVER_NAME}
711
+    if [ ! -f /etc/openvpn/easy-rsa/keys/${OPENVPN_SERVER_NAME}.crt ]; then
712
+        echo $'OpenVPN crt not found' >> /var/log/${PROJECT_NAME}.log
713
+        exit 7823352
714
+    fi
715
+    server_cert=$(cat /etc/openvpn/easy-rsa/keys/${OPENVPN_SERVER_NAME}.crt)
716
+    if [ ${#server_cert} -lt 10 ]; then
717
+        cat /etc/openvpn/easy-rsa/keys/${OPENVPN_SERVER_NAME}.crt
718
+        echo $'Server cert generation failed' >> /var/log/${PROJECT_NAME}.log
719
+        exit 3284682
720
+    fi
721
+
722
+    if [ ! -f /etc/openvpn/easy-rsa/keys/${OPENVPN_SERVER_NAME}.key ]; then
723
+        echo $'OpenVPN key not found' >> /var/log/${PROJECT_NAME}.log
724
+        exit 6839436
725
+    fi
726
+    if [ ! -f /etc/openvpn/easy-rsa/keys/ca.key ]; then
727
+        echo $'OpenVPN ca not found' >> /var/log/${PROJECT_NAME}.log
728
+        exit 7935203
729
+    fi
730
+    cp /etc/openvpn/easy-rsa/keys/{$OPENVPN_SERVER_NAME.crt,$OPENVPN_SERVER_NAME.key,ca.crt} /etc/openvpn
731
+
732
+    create_user_vpn_key ${MY_USERNAME}
733
+}
734
+
735
+function generate_stunnel_keys {
736
+    echo "Creating stunnel keys" >> /var/log/${PROJECT_NAME}.log
737
+    openssl req -x509 -nodes -days 3650 -sha256 \
738
+            -subj "/O=$VPN_ORGANISATION/OU=$VPN_UNIT/C=$VPN_COUNTRY_CODE/ST=$VPN_AREA/L=$VPN_LOCATION/CN=$HOSTNAME" \
739
+            -newkey rsa:2048 -keyout /etc/stunnel/key.pem \
740
+            -out /etc/stunnel/cert.pem
741
+    if [ ! -f /etc/stunnel/key.pem ]; then
742
+        echo $'stunnel key not created' >> /var/log/${PROJECT_NAME}.log
743
+        exit 793530
744
+    fi
745
+    if [ ! -f /etc/stunnel/cert.pem ]; then
746
+        echo $'stunnel cert not created' >> /var/log/${PROJECT_NAME}.log
747
+        exit 204587
748
+    fi
749
+    chmod 400 /etc/stunnel/key.pem
750
+    chmod 640 /etc/stunnel/cert.pem
751
+
752
+    cat /etc/stunnel/key.pem /etc/stunnel/cert.pem >> /etc/stunnel/stunnel.pem
753
+    chmod 640 /etc/stunnel/stunnel.pem
754
+
755
+    openssl pkcs12 -export -out /etc/stunnel/stunnel.p12 -inkey /etc/stunnel/key.pem -in /etc/stunnel/cert.pem -passout pass:
756
+    if [ ! -f /etc/stunnel/stunnel.p12 ]; then
757
+        echo $'stunnel pkcs12 not created' >> /var/log/${PROJECT_NAME}.log
758
+        exit 639353
759
+    fi
760
+    chmod 640 /etc/stunnel/stunnel.p12
761
+
762
+    cp /etc/stunnel/stunnel.pem /home/$MY_USERNAME/stunnel.pem
763
+    cp /etc/stunnel/stunnel.p12 /home/$MY_USERNAME/stunnel.p12
764
+    chown $MY_USERNAME:$MY_USERNAME $prefix$userhome/stunnel*
765
+    echo "stunnel keys created" >> /var/log/${PROJECT_NAME}.log
766
+}
767
+
768
+function mesh_setup_vpn {
769
+    vpn_generate_keys
770
+
771
+    cp /etc/stunnel/stunnel-client.conf /home/$MY_USERNAME/stunnel-client.conf
772
+    chown $MY_USERNAME:$MY_USERNAME /home/$MY_USERNAME/stunnel*
773
+
774
+    generate_stunnel_keys
775
+
776
+    sed -i 's|tun-mtu .*|tun-mtu 1532|g' /home/$MY_USERNAME/client.ovpn
777
+
778
+    systemctl restart openvpn
779
+}
780
+
781
+function initialise_scuttlebot_pub {
782
+    chown -R scuttlebot:scuttlebot /etc/scuttlebot
783
+
784
+    systemctl enable scuttlebot.service
785
+    systemctl daemon-reload
786
+    systemctl start scuttlebot.service
787
+
788
+    sleep 3
789
+
790
+    if [ ! -d /etc/scuttlebot/.ssb ]; then
791
+        echo $'Scuttlebot config not generated' >> /var/log/${PROJECT_NAME}.log
792
+        exit 73528
793
+    fi
794
+
795
+    echo '{' > /etc/scuttlebot/.ssb/config
796
+    echo "  \"host\": \"${HOSTNAME}\"," >> /etc/scuttlebot/.ssb/config
797
+    echo "  \"port\": ${SCUTTLEBOT_PORT}," >> /etc/scuttlebot/.ssb/config
798
+    echo '  "allowPrivate": true,' >> /etc/scuttlebot/.ssb/config
799
+    echo '  "timeout": 30000,' >> /etc/scuttlebot/.ssb/config
800
+    echo '  "pub": true,' >> /etc/scuttlebot/.ssb/config
801
+    echo '  "local": true,' >> /etc/scuttlebot/.ssb/config
802
+    echo '  "friends": {' >> /etc/scuttlebot/.ssb/config
803
+    echo '    "dunbar": 150,' >> /etc/scuttlebot/.ssb/config
804
+    echo '    "hops": 3' >> /etc/scuttlebot/.ssb/config
805
+    echo '  },' >> /etc/scuttlebot/.ssb/config
806
+    echo '  "gossip": {' >> /etc/scuttlebot/.ssb/config
807
+    echo '    "connections": 2' >> /etc/scuttlebot/.ssb/config
808
+    echo '  },' >> /etc/scuttlebot/.ssb/config
809
+    echo '  "master": [],' >> /etc/scuttlebot/.ssb/config
810
+    echo '  "logging": {' >> /etc/scuttlebot/.ssb/config
811
+    echo '    "level": "error"' >> /etc/scuttlebot/.ssb/config
812
+    echo '  }' >> /etc/scuttlebot/.ssb/config
813
+    echo '}' >> /etc/scuttlebot/.ssb/config
814
+    chown scuttlebot:scuttlebot /etc/scuttlebot/.ssb/config
815
+    systemctl restart scuttlebot.service
816
+}
817
+
557
 # whether to reset the identity
818
 # whether to reset the identity
558
 set_new_identity=
819
 set_new_identity=
559
 if [ $2 ]; then
820
 if [ $2 ]; then
594
         rm -rf /home/$MY_USERNAME/.ssb
855
         rm -rf /home/$MY_USERNAME/.ssb
595
     fi
856
     fi
596
 
857
 
858
+    # Remove vpn keys
859
+    if [ -d /etc/openvpn/easy-rsa/keys ]; then
860
+        rm -rf /etc/openvpn/easy-rsa/keys/*
861
+    fi
862
+
597
     echo $'Beginning mesh node setup' >> $INSTALL_LOG
863
     echo $'Beginning mesh node setup' >> $INSTALL_LOG
598
 
864
 
599
     if [ -d /home/$MY_USERNAME/.config ]; then
865
     if [ -d /home/$MY_USERNAME/.config ]; then
610
     configure_toxcore
876
     configure_toxcore
611
     create_tox_user
877
     create_tox_user
612
     #setup_tahoelafs
878
     #setup_tahoelafs
879
+    mesh_setup_vpn
880
+    initialise_scuttlebot_pub
613
     setup_ipfs
881
     setup_ipfs
614
     mesh_amnesic
882
     mesh_amnesic
615
     make_root_read_only
883
     make_root_read_only

+ 184
- 84
src/freedombone-mesh-batman View File

13
 # License
13
 # License
14
 # =======
14
 # =======
15
 #
15
 #
16
-# Copyright (C) 2015-2016 Bob Mottram <bob@freedombone.net>
16
+# Copyright (C) 2015-2017 Bob Mottram <bob@freedombone.net>
17
 #
17
 #
18
 # This program is free software: you can redistribute it and/or modify
18
 # This program is free software: you can redistribute it and/or modify
19
 # it under the terms of the GNU Affero General Public License as published by
19
 # it under the terms of the GNU Affero General Public License as published by
30
 
30
 
31
 PROJECT_NAME='freedombone'
31
 PROJECT_NAME='freedombone'
32
 COMPLETION_FILE=/root/${PROJECT_NAME}-completed.txt
32
 COMPLETION_FILE=/root/${PROJECT_NAME}-completed.txt
33
-HOTSPOT_PASSPHRASE='mesh'
33
+
34
+# hotspot passphrase must be 5 characters or longer
35
+HOTSPOT_PASSPHRASE="${PROJECT_NAME}"
34
 
36
 
35
 source /usr/share/${PROJECT_NAME}/utils/${PROJECT_NAME}-utils-wifi
37
 source /usr/share/${PROJECT_NAME}/utils/${PROJECT_NAME}-utils-wifi
36
 
38
 
94
     . /etc/default/batctl
96
     . /etc/default/batctl
95
 fi
97
 fi
96
 
98
 
99
+function get_ipv4_wlan {
100
+    echo $(ip -o -f inet addr show dev "$IFACE" | awk '{print $4}' | awk 'END {print}' | awk -F '/' '{print $1}')
101
+}
102
+
103
+function mesh_hotspot_ip_address {
104
+    echo $(ip -o -f inet addr show dev "$BRIDGE" | awk '{print $4}' | awk 'END {print}' | awk -F '/' '{print $1}')
105
+}
106
+
97
 function global_rate_limit {
107
 function global_rate_limit {
98
     if ! grep -q "tcp_challenge_ack_limit" /etc/sysctl.conf; then
108
     if ! grep -q "tcp_challenge_ack_limit" /etc/sysctl.conf; then
99
         echo 'net.ipv4.tcp_challenge_ack_limit = 999999999' >> /etc/sysctl.conf
109
         echo 'net.ipv4.tcp_challenge_ack_limit = 999999999' >> /etc/sysctl.conf
114
     fi
124
     fi
115
     if [ "$EIFACE" ]; then
125
     if [ "$EIFACE" ]; then
116
         brctl delif $BRIDGE bat0
126
         brctl delif $BRIDGE bat0
117
-        brctl delif $BRIDGE $EIFACE
118
         ifconfig $BRIDGE down || true
127
         ifconfig $BRIDGE down || true
128
+        ethernet_connected=$(cat /sys/class/net/$EIFACE/carrier)
129
+        if [[ "$ethernet_connected" != "0" ]]; then
130
+            systemctl stop hostapd
131
+            brctl delif $BRIDGE $EIFACE
132
+            ifconfig $EIFACE down -promisc
133
+        fi
119
         brctl delbr $BRIDGE
134
         brctl delbr $BRIDGE
120
-        ifconfig $EIFACE down -promisc
121
-    fi
122
-    if [ $IFACE_SECONDARY ]; then
123
-        systemctl stop hostapd
124
-        brctl delif $BRIDGE_HOTSPOT bat0
125
-        ifconfig $BRIDGE_HOTSPOT down || true
126
-        brctl delbr $BRIDGE_HOTSPOT
127
     fi
135
     fi
128
 
136
 
129
     avahi-autoipd -k $BRIDGE
137
     avahi-autoipd -k $BRIDGE
131
     ifconfig bat0 down -promisc
139
     ifconfig bat0 down -promisc
132
 
140
 
133
     batctl if del $IFACE
141
     batctl if del $IFACE
134
-    rmmod batman-adv
135
     ifconfig $IFACE mtu 1500
142
     ifconfig $IFACE mtu 1500
136
     ifconfig $IFACE down
143
     ifconfig $IFACE down
137
     iwconfig $IFACE mode managed
144
     iwconfig $IFACE mode managed
138
 
145
 
146
+    if [ $IFACE_SECONDARY ]; then
147
+        systemctl stop hostapd
148
+        systemctl disable hostapd
149
+        batctl if del $IFACE_SECONDARY
150
+        ifconfig $IFACE_SECONDARY mtu 1500
151
+        ifconfig $IFACE_SECONDARY down
152
+        iwconfig $IFACE_SECONDARY mode managed
153
+    fi
154
+
155
+    rmmod batman-adv
156
+
139
     iptables -D INPUT -p tcp --dport $TRACKER_PORT -j ACCEPT
157
     iptables -D INPUT -p tcp --dport $TRACKER_PORT -j ACCEPT
140
     iptables -D INPUT -p udp --dport $TRACKER_PORT -j ACCEPT
158
     iptables -D INPUT -p udp --dport $TRACKER_PORT -j ACCEPT
141
     iptables -D INPUT -p tcp --dport 80 -j ACCEPT
159
     iptables -D INPUT -p tcp --dport 80 -j ACCEPT
155
     iptables -D INPUT -p tcp --dport $LIBREVAULT_PORT -j ACCEPT
173
     iptables -D INPUT -p tcp --dport $LIBREVAULT_PORT -j ACCEPT
156
     iptables -D INPUT -p udp --dport $LIBREVAULT_PORT -j ACCEPT
174
     iptables -D INPUT -p udp --dport $LIBREVAULT_PORT -j ACCEPT
157
     iptables -D INPUT -p tcp --dport $TAHOELAFS_PORT -j ACCEPT
175
     iptables -D INPUT -p tcp --dport $TAHOELAFS_PORT -j ACCEPT
158
-    # SSB/Patchwork
176
+    # SSB/Scuttlebot/Patchwork
159
     iptables -D INPUT -p udp --dport 8008 -j ACCEPT
177
     iptables -D INPUT -p udp --dport 8008 -j ACCEPT
160
     iptables -D INPUT -p tcp --dport 8008 -j ACCEPT
178
     iptables -D INPUT -p tcp --dport 8008 -j ACCEPT
179
+    iptables -D INPUT -p udp --dport 8010 -j ACCEPT
180
+    iptables -D INPUT -p tcp --dport 8010 -j ACCEPT
181
+    # vpn over the internet
182
+    iptables -D INPUT -p tcp --dport 653 -j ACCEPT
183
+    iptables -D INPUT -p udp --dport 653 -j ACCEPT
184
+    iptables -D INPUT -i ${EIFACE} -m state --state NEW -p tcp --dport 1194 -j ACCEPT
185
+    iptables -D INPUT -i tun+ -j ACCEPT
186
+    iptables -D FORWARD -i tun+ -j ACCEPT
187
+    iptables -D FORWARD -i tun+ -o ${EIFACE} -m state --state RELATED,ESTABLISHED -j ACCEPT
188
+    iptables -D FORWARD -i ${EIFACE} -o tun+ -m state --state RELATED,ESTABLISHED -j ACCEPT
189
+    iptables -t nat -D POSTROUTING -s 10.8.0.0/24 -o ${EIFACE} -j MASQUERADE
190
+    iptables -D OUTPUT -o tun+ -j ACCEPT
191
+
192
+    echo 0 > /proc/sys/net/ipv4/ip_forward
193
+    sed -i 's|net.ipv4.ip_forward=.*|net.ipv4.ip_forward=0|g' /etc/sysctl.conf
161
 
194
 
162
     systemctl restart network-manager
195
     systemctl restart network-manager
163
 }
196
 }
188
         fi
221
         fi
189
         echo -n "${octet}"
222
         echo -n "${octet}"
190
     done
223
     done
191
-    echo ''
224
+}
225
+
226
+function add_wifi_interface {
227
+    ifname=$1
228
+    ifssid=$WIFI_SSID
229
+    if [ $2 ]; then
230
+        ifssid=$2
231
+    fi
232
+    ifmode=ad-hoc
233
+    if [ $3 ]; then
234
+        ifmode=$3
235
+    fi
236
+    ifchannel=$CHANNEL
237
+    if [ $4 ]; then
238
+        ifchannel=$4
239
+    fi
240
+
241
+    ifconfig $ifname down
242
+    ifconfig $ifname mtu 1532
243
+    peermac=$(assign_peer_address)
244
+    if [ ! $peermac ]; then
245
+        echo $"Unable to obtain MAC address for $peermac on $ifname"
246
+        return
247
+    fi
248
+    ifconfig $ifname hw ether $peermac
249
+    echo $"$ifname assigned MAC address $peermac"
250
+    iwconfig $ifname enc off
251
+    iwconfig $ifname mode $ifmode essid $ifssid channel $ifchannel
252
+
253
+    batctl if add $ifname
254
+    ifconfig $ifname up
255
+}
256
+
257
+function mesh_create_app_downloads_page {
258
+    if [ ! -d /root/$PROJECT_NAME/image_build/mesh_apps ]; then
259
+        return
260
+    fi
261
+    if [ ! -d /var/www/html ]; then
262
+        return
263
+    fi
264
+    cp /root/$PROJECT_NAME/website/EN/meshindex.html /var/www/html/index.html
265
+    if [ ! -f /var/www/html/ssb.apk ]; then
266
+        cp /root/$PROJECT_NAME/image_build/mesh_apps/ssb.apk /var/www/html/ssb.apk
267
+    fi
268
+    if [ ! -d /var/www/html/images ]; then
269
+        mkdir /var/www/html/images
270
+    fi
271
+    if [ ! -f /var/www/html/images/logo.png ]; then
272
+        cp /root/$PROJECT_NAME/img/logo.png /var/www/html/images/logo.png
273
+    fi
274
+    if [ ! -f /var/www/html/images/ssb.png ]; then
275
+        cp /root/$PROJECT_NAME/img/icon_patchwork.png /var/www/html/images/ssb.png
276
+    fi
277
+    if [ ! -f /var/www/html/freedombone.css ]; then
278
+        cp /root/$PROJECT_NAME/website/freedombone.css /var/www/html/freedombone.css
279
+    fi
280
+    chown -R www-data:www-data /var/www/html/*
192
 }
281
 }
193
 
282
 
194
 function start {
283
 function start {
211
     # Might have to re-enable wifi
300
     # Might have to re-enable wifi
212
     rfkill unblock $(rfkill list|awk -F: "/phy/ {print $1}") || true
301
     rfkill unblock $(rfkill list|awk -F: "/phy/ {print $1}") || true
213
 
302
 
214
-    ifconfig $IFACE down
215
-    ifconfig $IFACE mtu 1532
216
-    ifconfig $IFACE hw ether $(assign_peer_address)
217
-    iwconfig $IFACE enc off
218
-    iwconfig $IFACE mode ad-hoc essid $WIFI_SSID channel $CHANNEL
219
-    sleep 1
220
-    iwconfig $IFACE ap $CELLID
303
+    secondary_wifi_available=
304
+    if [ $IFACE_SECONDARY ]; then
305
+        if [[ $IFACE != $IFACE_SECONDARY ]]; then
306
+            if [ -d /etc/hostapd ]; then
307
+                if [ ${#HOTSPOT_PASSPHRASE} -gt 4 ]; then
308
+                    secondary_wifi_available=1
309
+                else
310
+                    echo $'Hotspot passphrase is too short'
311
+                fi
312
+            fi
313
+        fi
314
+    fi
221
 
315
 
222
     modprobe batman-adv
316
     modprobe batman-adv
223
-    batctl if add $IFACE
224
-    ifconfig $IFACE up
317
+
318
+    add_wifi_interface $IFACE $WIFI_SSID ad-hoc $CHANNEL
225
     avahi-autoipd --force-bind --daemonize --wait $IFACE
319
     avahi-autoipd --force-bind --daemonize --wait $IFACE
226
-    ifconfig bat0 up promisc
227
 
320
 
228
-    #Use persistent HWAddr
229
-    ether_new=$(ifconfig eth0 | grep HWaddr | sed -e "s/.*HWaddr //")
230
-    if [ ! -f /var/lib/mesh-node/bat0 ]; then
231
-        mkdir /var/lib/mesh-node
232
-        echo "${ether_new}" > /var/lib/mesh-node/bat0
233
-    else
234
-        ether=$(cat /var/lib/mesh-node/bat0)
235
-        ifconfig bat0 hw ether ${ether}
236
-    fi
321
+    # NOTE: Don't connect the secondary wifi device. hostapd will handle that by itself
237
 
322
 
238
-    if [ "$EIFACE" ] ; then
239
-        brctl addbr $BRIDGE
240
-        brctl addif $BRIDGE bat0
241
-        brctl addif $BRIDGE $EIFACE
242
-        ifconfig bat0 0.0.0.0
243
-        ifconfig $EIFACE 0.0.0.0
244
-        ifconfig $EIFACE up promisc
245
-        ifconfig $BRIDGE up
246
-        avahi-autoipd --force-bind --daemonize --wait $BRIDGE
247
-    fi
323
+    ifconfig bat0 up promisc
248
 
324
 
249
-    if [ $IFACE_SECONDARY ]; then
250
-        if [[ $IFACE != $IFACE_SECONDARY ]]; then
251
-            if [ -d /etc/hostapd ]; then
252
-                # bridge between mesh and wifi hotspot for mobile
253
-                HOTSPOT_NAME=$"${WIFI_SSID}-hotspot"
254
-                ifconfig $IFACE_SECONDARY down
255
-                ifconfig $IFACE_SECONDARY mtu 1500
256
-                ifconfig $IFACE_SECONDARY hw ether $(assign_peer_address)
257
-                iwconfig $IFACE_SECONDARY enc open
258
-                iwconfig $IFACE_SECONDARY mode managed essid $HOTSPOT_NAME channel ${HOTSPOT_CHANNEL}
259
-                iwconfig $IFACE_SECONDARY ap $CELLID
260
-
261
-                brctl addbr $BRIDGE_HOTSPOT
262
-                brctl addif $BRIDGE_HOTSPOT bat0
263
-                brctl addif $BRIDGE_HOTSPOT $IFACE_SECONDARY
264
-                ifconfig bat0 0.0.0.0
265
-                ifconfig $IFACE_SECONDARY 0.0.0.0
266
-
267
-                sed -i 's|#DAEMON_CONF=.*|DAEMON_CONF="/etc/hostapd/hostapd.conf"|g' /etc/default/hostapd
268
-
269
-                echo "interface=${IFACE_SECONDARY}" > /etc/hostapd/hostapd.conf
270
-                echo "bridge=${BRIDGE_HOTSPOT}" >> /etc/hostapd/hostapd.conf
271
-                echo 'driver=nl80211' >> /etc/hostapd/hostapd.conf
272
-                echo "country_code=UK" >> /etc/hostapd/hostapd.conf
273
-                echo "ssid=$HOTSPOT_NAME" >> /etc/hostapd/hostapd.conf
274
-                echo 'hw_mode=g' >> /etc/hostapd/hostapd.conf
275
-                echo "channel=${HOTSPOT_CHANNEL}" >> /etc/hostapd/hostapd.conf
276
-                echo 'wpa=2' >> /etc/hostapd/hostapd.conf
277
-                echo "wpa_passphrase=$HOTSPOT_PASSPHRASE" >> /etc/hostapd/hostapd.conf
278
-                echo 'wpa_key_mgmt=WPA-PSK' >> /etc/hostapd/hostapd.conf
279
-                echo 'wpa_pairwise=TKIP' >> /etc/hostapd/hostapd.conf
280
-                echo 'rsn_pairwise=CCMP' >> /etc/hostapd/hostapd.conf
281
-                echo 'auth_algs=1' >> /etc/hostapd/hostapd.conf
282
-                echo 'macaddr_acl=0' >> /etc/hostapd/hostapd.conf
283
-
284
-                ifconfig $BRIDGE_HOTSPOT up
285
-                avahi-autoipd --force-bind --daemonize --wait $BRIDGE_HOTSPOT
286
-                ifconfig $IFACE_SECONDARY up promisc
287
-                #ifconfig $IFACE_SECONDARY auto-dhcp start
288
-                systemctl start hostapd
289
-            fi
325
+    brctl addbr $BRIDGE
326
+    brctl addif $BRIDGE bat0
327
+    ifconfig bat0 0.0.0.0
328
+    if [ "$EIFACE" ] ; then
329
+        ethernet_connected=$(cat /sys/class/net/$EIFACE/carrier)
330
+        if [[ "$ethernet_connected" != "0" ]]; then
331
+            echo $'Trying ethernet bridge to the internet'
332
+            brctl addif $BRIDGE $EIFACE
333
+            ifconfig $EIFACE 0.0.0.0
334
+            ifconfig $EIFACE up promisc
335
+            echo $'End of ethernet bridge'
336
+        else
337
+            echo $"$EIFACE is not connected"
290
         fi
338
         fi
291
     fi
339
     fi
340
+    ifconfig $BRIDGE up
341
+    dhclient $BRIDGE
342
+
343
+    if [ $secondary_wifi_available ]; then
344
+        sed -i 's|#DAEMON_CONF=.*|DAEMON_CONF="/etc/hostapd/hostapd.conf"|g' /etc/default/hostapd
345
+
346
+        echo "interface=${IFACE_SECONDARY}" > /etc/hostapd/hostapd.conf
347
+        echo "bridge=${BRIDGE}" >> /etc/hostapd/hostapd.conf
348
+        echo 'driver=nl80211' >> /etc/hostapd/hostapd.conf
349
+        echo "country_code=UK" >> /etc/hostapd/hostapd.conf
350
+        echo "ssid=${WIFI_SSID}-$(mesh_hotspot_ip_address)" >> /etc/hostapd/hostapd.conf
351
+        echo 'hw_mode=g' >> /etc/hostapd/hostapd.conf
352
+        echo "channel=${HOTSPOT_CHANNEL}" >> /etc/hostapd/hostapd.conf
353
+        echo 'wpa=2' >> /etc/hostapd/hostapd.conf
354
+        echo "wpa_passphrase=$HOTSPOT_PASSPHRASE" >> /etc/hostapd/hostapd.conf
355
+        echo 'wpa_key_mgmt=WPA-PSK' >> /etc/hostapd/hostapd.conf
356
+        echo 'wpa_pairwise=TKIP' >> /etc/hostapd/hostapd.conf
357
+        echo 'rsn_pairwise=CCMP' >> /etc/hostapd/hostapd.conf
358
+        echo 'auth_algs=1' >> /etc/hostapd/hostapd.conf
359
+        echo 'macaddr_acl=0' >> /etc/hostapd/hostapd.conf
360
+
361
+        systemctl enable hostapd
362
+        systemctl restart hostapd
363
+        mesh_create_app_downloads_page
364
+    fi
292
 
365
 
293
     iptables -A INPUT -p icmp --icmp-type echo-request -j ACCEPT
366
     iptables -A INPUT -p icmp --icmp-type echo-request -j ACCEPT
294
     iptables -A OUTPUT -p icmp --icmp-type echo-reply -j ACCEPT
367
     iptables -A OUTPUT -p icmp --icmp-type echo-reply -j ACCEPT
310
     iptables -A INPUT -p tcp --dport $LIBREVAULT_PORT -j ACCEPT
383
     iptables -A INPUT -p tcp --dport $LIBREVAULT_PORT -j ACCEPT
311
     iptables -A INPUT -p udp --dport $LIBREVAULT_PORT -j ACCEPT
384
     iptables -A INPUT -p udp --dport $LIBREVAULT_PORT -j ACCEPT
312
     iptables -A INPUT -p tcp --dport $TAHOELAFS_PORT -j ACCEPT
385
     iptables -A INPUT -p tcp --dport $TAHOELAFS_PORT -j ACCEPT
313
-    # SSB/Patchwork
386
+    # SSB/Scuttlebot/Patchwork
314
     iptables -A INPUT -p udp --dport 8008 -j ACCEPT
387
     iptables -A INPUT -p udp --dport 8008 -j ACCEPT
315
     iptables -A INPUT -p tcp --dport 8008 -j ACCEPT
388
     iptables -A INPUT -p tcp --dport 8008 -j ACCEPT
389
+    iptables -A INPUT -p udp --dport 8010 -j ACCEPT
390
+    iptables -A INPUT -p tcp --dport 8010 -j ACCEPT
391
+    # vpn over the internet
392
+    iptables -A INPUT -p tcp --dport 653 -j ACCEPT
393
+    iptables -A INPUT -p udp --dport 653 -j ACCEPT
394
+    iptables -A INPUT -i ${EIFACE} -m state --state NEW -p tcp --dport 1194 -j ACCEPT
395
+    iptables -A INPUT -i tun+ -j ACCEPT
396
+    iptables -A FORWARD -i tun+ -j ACCEPT
397
+    iptables -A FORWARD -i tun+ -o ${EIFACE} -m state --state RELATED,ESTABLISHED -j ACCEPT
398
+    iptables -A FORWARD -i ${EIFACE} -o tun+ -m state --state RELATED,ESTABLISHED -j ACCEPT
399
+    iptables -t nat -A POSTROUTING -s 10.8.0.0/24 -o ${EIFACE} -j MASQUERADE
400
+    iptables -A OUTPUT -o tun+ -j ACCEPT
401
+
402
+    echo 1 > /proc/sys/net/ipv4/ip_forward
403
+    sed -i 's|# net.ipv4.ip_forward|net.ipv4.ip_forward|g' /etc/sysctl.conf
404
+    sed -i 's|#net.ipv4.ip_forward|net.ipv4.ip_forward|g' /etc/sysctl.conf
405
+    sed -i 's|net.ipv4.ip_forward.*|net.ipv4.ip_forward=1|g' /etc/sysctl.conf
316
 
406
 
317
     systemctl restart avahi-daemon
407
     systemctl restart avahi-daemon
318
 
408
 
409
+    if [ -f /etc/scuttlebot/.ssb/config ]; then
410
+        ethernet_connected=$(cat /sys/class/net/eth0/carrier)
411
+        if [[ "$ethernet_connected" != "0" ]]; then
412
+            sed -i "s|\"host\": .*|\"host\": \"$(get_ipv4_wlan)\",|g" /etc/scuttlebot/.ssb/config
413
+            systemctl restart scuttlebot
414
+        else
415
+            systemctl stop scuttlebot
416
+        fi
417
+    fi
418
+
319
     verify
419
     verify
320
 }
420
 }
321
 
421
 

+ 47
- 0
src/freedombone-mesh-invite View File

1
+#!/bin/bash
2
+#
3
+# .---.                  .              .
4
+# |                      |              |
5
+# |--- .--. .-.  .-.  .-.|  .-. .--.--. |.-.  .-. .--.  .-.
6
+# |    |   (.-' (.-' (   | (   )|  |  | |   )(   )|  | (.-'
7
+# '    '     --'  --'  -' -  -' '  '   -' -'   -' '   -  --'
8
+#
9
+#                    Freedom in the Cloud
10
+#
11
+# Creates a scuttlebot invite for use with Ferment or Patchwork
12
+#
13
+# License
14
+# =======
15
+#
16
+# This program is free software: you can redistribute it and/or modify
17
+# it under the terms of the GNU Affero General Public License as published by
18
+# the Free Software Foundation, either version 3 of the License, or
19
+# (at your option) any later version.
20
+#
21
+# This program is distributed in the hope that it will be useful,
22
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
23
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
24
+# GNU Affero General Public License for more details.
25
+#
26
+# You should have received a copy of the GNU Affero General Public License
27
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
28
+
29
+PROJECT_NAME='freedombone'
30
+
31
+export TEXTDOMAIN=${PROJECT_NAME}-mesh-invite
32
+export TEXTDOMAINDIR="/usr/share/locale"
33
+
34
+invite=$(sudo -- bash -c 'su -c "sbot invite.create 1" - scuttlebot' | awk -F '"' '{print $2}')
35
+
36
+if [ ${#invite} -lt 10 ]; then
37
+   dialog --title $"Create Invite" \
38
+          --msgbox $"\nThe invite could not be created" 7 70
39
+   exit 1
40
+fi
41
+
42
+echo "$invite" | xclip -selection c
43
+
44
+dialog --title $"Create Invite" \
45
+       --msgbox $"\nThe invite has been copied to the clipboard.\n\nYou can paste it with CTRL+v" 9 70
46
+
47
+exit 0

+ 1
- 0
src/freedombone-mesh-reset View File

44
        sudo pkill firefox
44
        sudo pkill firefox
45
        sudo pkill iceweasel
45
        sudo pkill iceweasel
46
        sudo pkill midori
46
        sudo pkill midori
47
+       sudo pkill patchwork
47
        sudo rm -f $MESH_INSTALL_COMPLETED
48
        sudo rm -f $MESH_INSTALL_COMPLETED
48
        sudo ${PROJECT_NAME}-image-mesh $USER new
49
        sudo ${PROJECT_NAME}-image-mesh $USER new
49
        sudo batman start
50
        sudo batman start

+ 4
- 0
src/freedombone-utils-wifi View File

216
     IFACE_SECONDARY=
216
     IFACE_SECONDARY=
217
 
217
 
218
     for i in $(seq 10 -1 0); do
218
     for i in $(seq 10 -1 0); do
219
+        ifdown --force wlan${i}
220
+    done
221
+
222
+    for i in $(seq 10 -1 0); do
219
         if grep -q "wlan${i}" /proc/net/dev; then
223
         if grep -q "wlan${i}" /proc/net/dev; then
220
             if [ ! $IFACE ]; then
224
             if [ ! $IFACE ]; then
221
                 IFACE="wlan${i}"
225
                 IFACE="wlan${i}"

+ 16
- 16
website/EN/app_vpn.html View File

3
 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
3
 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
4
 <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
4
 <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
5
 <head>
5
 <head>
6
-<!-- 2017-09-27 Wed 17:58 -->
6
+<!-- 2017-10-05 Thu 14:51 -->
7
 <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
7
 <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
8
 <meta name="viewport" content="width=device-width, initial-scale=1" />
8
 <meta name="viewport" content="width=device-width, initial-scale=1" />
9
 <title>&lrm;</title>
9
 <title>&lrm;</title>
266
 On Freedombone the VPN is wrapped within a TLS layer of encryption, making it difficult for any deep packet inspection systems to know whether you are using a VPN or not. Since there is lots of TLS traffic on the internet your connection looks like any other TLS connection to a server, and this may help to avoid being censored. It's probably not possible for your local ISP to block TLS traffic without immediately generating a lot of irate customers, and stopping any kind of commercial activity.
266
 On Freedombone the VPN is wrapped within a TLS layer of encryption, making it difficult for any deep packet inspection systems to know whether you are using a VPN or not. Since there is lots of TLS traffic on the internet your connection looks like any other TLS connection to a server, and this may help to avoid being censored. It's probably not possible for your local ISP to block TLS traffic without immediately generating a lot of irate customers, and stopping any kind of commercial activity.
267
 </p>
267
 </p>
268
 
268
 
269
-<div id="outline-container-org778c839" class="outline-2">
270
-<h2 id="org778c839">Installation</h2>
271
-<div class="outline-text-2" id="text-org778c839">
269
+<div id="outline-container-orgb96ecdd" class="outline-2">
270
+<h2 id="orgb96ecdd">Installation</h2>
271
+<div class="outline-text-2" id="text-orgb96ecdd">
272
 <p>
272
 <p>
273
 ssh into the system with:
273
 ssh into the system with:
274
 </p>
274
 </p>
288
 </div>
288
 </div>
289
 </div>
289
 </div>
290
 
290
 
291
-<div id="outline-container-org2cfcc49" class="outline-2">
292
-<h2 id="org2cfcc49">Usage</h2>
293
-<div class="outline-text-2" id="text-org2cfcc49">
291
+<div id="outline-container-orgc55576d" class="outline-2">
292
+<h2 id="orgc55576d">Usage</h2>
293
+<div class="outline-text-2" id="text-orgc55576d">
294
 <p>
294
 <p>
295
 When the installation is complete you can download your VPN keys and configuration files onto your local machine.
295
 When the installation is complete you can download your VPN keys and configuration files onto your local machine.
296
 </p>
296
 </p>
306
 </p>
306
 </p>
307
 
307
 
308
 <div class="org-src-container">
308
 <div class="org-src-container">
309
-<pre class="src src-bash">sudp pacman -S openvpn stunnel4
309
+<pre class="src src-bash">sudo pacman -S openvpn stunnel4
310
 </pre>
310
 </pre>
311
 </div>
311
 </div>
312
 
312
 
335
 </div>
335
 </div>
336
 </div>
336
 </div>
337
 
337
 
338
-<div id="outline-container-orgc7282cd" class="outline-2">
339
-<h2 id="orgc7282cd">Changing port number</h2>
340
-<div class="outline-text-2" id="text-orgc7282cd">
338
+<div id="outline-container-org8a983c5" class="outline-2">
339
+<h2 id="org8a983c5">Changing port number</h2>
340
+<div class="outline-text-2" id="text-org8a983c5">
341
 <p>
341
 <p>
342
 Avoiding censorship can be a cat and mouse game, and so if the port you're using for VPN gets blocked then you may want to change it.
342
 Avoiding censorship can be a cat and mouse game, and so if the port you're using for VPN gets blocked then you may want to change it.
343
 </p>
343
 </p>
348
 </div>
348
 </div>
349
 
349
 
350
 <p>
350
 <p>
351
-Select <b>Administrator controls</b> then <b>App Settings</b> then <b>vpn</b>. Choose <b>Change TLS port</b> and enter a new port value. You can then either manually change the port within your VPN configuration files, or download them again as described in the <a href="#org2cfcc49">Usage</a> section above.
351
+Select <b>Administrator controls</b> then <b>App Settings</b> then <b>vpn</b>. Choose <b>Change TLS port</b> and enter a new port value. You can then either manually change the port within your VPN configuration files, or download them again as described in the <a href="#orgc55576d">Usage</a> section above.
352
 </p>
352
 </p>
353
 </div>
353
 </div>
354
 </div>
354
 </div>
355
 
355
 
356
-<div id="outline-container-orgbe4ddea" class="outline-2">
357
-<h2 id="orgbe4ddea">Generating new keys</h2>
358
-<div class="outline-text-2" id="text-orgbe4ddea">
356
+<div id="outline-container-orgc802140" class="outline-2">
357
+<h2 id="orgc802140">Generating new keys</h2>
358
+<div class="outline-text-2" id="text-orgc802140">
359
 <p>
359
 <p>
360
-It's possible that your VPN keys might get lost or compromised on your local machine. If that happens you can generate new ones from the <b>Administrator controls</b> by going to <b>App Settings</b> then <b>vpn</b> then choosing <b>Regenerate keys for a user</b> and downloading the new keys as described in the <a href="#org2cfcc49">Usage</a> section above.
360
+It's possible that your VPN keys might get lost or compromised on your local machine. If that happens you can generate new ones from the <b>Administrator controls</b> by going to <b>App Settings</b> then <b>vpn</b> then choosing <b>Regenerate keys for a user</b> and downloading the new keys as described in the <a href="#orgc55576d">Usage</a> section above.
361
 </p>
361
 </p>
362
 </div>
362
 </div>
363
 </div>
363
 </div>

+ 2
- 2
website/EN/index.html View File

3
 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
3
 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
4
 <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
4
 <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
5
 <head>
5
 <head>
6
-<!-- 2017-09-28 Thu 10:42 -->
6
+<!-- 2017-10-05 Thu 13:21 -->
7
 <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
7
 <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
8
 <meta name="viewport" content="width=device-width, initial-scale=1" />
8
 <meta name="viewport" content="width=device-width, initial-scale=1" />
9
 <title>&lrm;</title>
9
 <title>&lrm;</title>
280
 </p>
280
 </p>
281
 
281
 
282
 <p>
282
 <p>
283
-Want to make a community mesh network which doesn't depend upon the internet? The <a href="./mesh.html">Freedombone Mesh</a> is a wireless solution for autonomous communication that can be rapidly deployed in temporary, emergency or post-disaster situations where internet access is unavailable or compromised.
283
+Want to make a community mesh network which can either be fully autonomous or connected to the internet? The <a href="./mesh.html">Freedombone Mesh</a> is a wireless solution for networked communication that can be rapidly deployed in temporary, emergency or post-disaster situations where internet access is unavailable or compromised, or used as an infrastructural community service similar to <a href="https://en.wikipedia.org/wiki/Freifunk">Freifunk</a>.
284
 </p>
284
 </p>
285
 
285
 
286
 <p>
286
 <p>

+ 154
- 58
website/EN/mesh.html View File

3
 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
3
 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
4
 <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
4
 <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
5
 <head>
5
 <head>
6
-<!-- 2017-09-23 Sat 21:46 -->
6
+<!-- 2017-10-05 Thu 15:10 -->
7
 <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
7
 <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
8
 <meta name="viewport" content="width=device-width, initial-scale=1" />
8
 <meta name="viewport" content="width=device-width, initial-scale=1" />
9
 <title>&lrm;</title>
9
 <title>&lrm;</title>
274
 </colgroup>
274
 </colgroup>
275
 <tbody>
275
 <tbody>
276
 <tr>
276
 <tr>
277
-<td class="org-left"><a href="#org802af98">What the system can do</a></td>
277
+<td class="org-left"><a href="#orgb0dd1ad">What the system can do</a></td>
278
 <td class="org-left">-</td>
278
 <td class="org-left">-</td>
279
-<td class="org-left"><a href="#org38eda48">Disk Images</a></td>
279
+<td class="org-left"><a href="#org2b727b3">Disk Images</a></td>
280
 <td class="org-left">-</td>
280
 <td class="org-left">-</td>
281
-<td class="org-left"><a href="#org0c3a295">Building Disk Images</a></td>
281
+<td class="org-left"><a href="#org520845e">Building Disk Images</a></td>
282
 <td class="org-left">-</td>
282
 <td class="org-left">-</td>
283
-<td class="org-left"><a href="#org5f6418e">How to use it</a></td>
283
+<td class="org-left"><a href="#org315aa35">How to use it</a></td>
284
 </tr>
284
 </tr>
285
 </tbody>
285
 </tbody>
286
 </table>
286
 </table>
292
 </blockquote>
292
 </blockquote>
293
 
293
 
294
 <p>
294
 <p>
295
-The Freedombone Mesh is a wireless solution for autonomous communication that can be rapidly deployed in temporary, emergency or post-disaster situations where internet access is unavailable or compromised.
295
+The Freedombone Mesh is a wireless solution for autonomous or internet connected communication that can be rapidly deployed in temporary, emergency or post-disaster situations where internet access is unavailable or compromised.
296
 </p>
296
 </p>
297
 
297
 
298
 <p>
298
 <p>
299
-Mesh networks are useful as a quick way to make a fully decentralised communications system which is not connected to or reliant upon the internet. Think festivals, hacker conferences, onboard ships at sea, disaster/war zones, small business internal office communications, protests, remote areas of the world, temporary "digital blackouts", scientific expeditions and off-world space colonies. The down side is that you can't access any internet content. The upside is that you can securely communicate with anyone on the local mesh. No ISPs. No payments or subscriptions beyond the cost of obtaining the hardware. Systems need to be within wifi range of each other for the mesh to be created. It can be an ultra-convenient way to do purely local communications.
299
+Mesh networks are useful as a quick way to make a fully decentralised communications system which is not connected to or reliant upon the internet. Think festivals, hacker conferences, onboard ships at sea, disaster/war zones, small businesses who don't want the overhead of server maintenance, protests, remote areas of the world, temporary "digital blackouts", scientific expeditions and off-world space colonies.
300
+</p>
301
+
302
+<p>
303
+If an internet connection is available then it can make use of that, but otherwise it can still work regardless of whether the internet exists. So it's not dependent upon ISPs and additional infrastructure other than USB drives isn't required.
304
+</p>
305
+
306
+<p>
307
+Systems only need to be within wifi range of each other for the mesh to be created, so it can be an very convenient way to create a local communications network.
300
 </p>
308
 </p>
301
 
309
 
302
 <p>
310
 <p>
316
 <li><b>Evolvable</b>: The network should be built with future development in mind. The platform should be flexible enough to support technologies, protocols and modes of usage that have not yet been developed.</li>
324
 <li><b>Evolvable</b>: The network should be built with future development in mind. The platform should be flexible enough to support technologies, protocols and modes of usage that have not yet been developed.</li>
317
 </ul>
325
 </ul>
318
 
326
 
319
-<div id="outline-container-org802af98" class="outline-2">
320
-<h2 id="org802af98">What the system can do</h2>
321
-<div class="outline-text-2" id="text-org802af98">
327
+<div id="outline-container-orgb0dd1ad" class="outline-2">
328
+<h2 id="orgb0dd1ad">What the system can do</h2>
329
+<div class="outline-text-2" id="text-orgb0dd1ad">
322
 <ul class="org-ul">
330
 <ul class="org-ul">
323
 <li>Discovery of other users on the network</li>
331
 <li>Discovery of other users on the network</li>
324
 <li>Text based chat, one-to-one and in groups</li>
332
 <li>Text based chat, one-to-one and in groups</li>
325
-<li>Voice chat (VoIP)</li>
333
+<li>Voice chat (VoIP) and video calls</li>
326
 <li>Private and public sharing of files</li>
334
 <li>Private and public sharing of files</li>
327
 <li>Blogging</li>
335
 <li>Blogging</li>
336
+<li>Creating and broadcasting audio media/podcasts</li>
328
 <li>Social network stream. Follow/unfollow other peers</li>
337
 <li>Social network stream. Follow/unfollow other peers</li>
329
 <li>No network administration required</li>
338
 <li>No network administration required</li>
330
-<li>No servers, internet connection or cabling is needed</li>
339
+<li>No servers</li>
340
+<li>Internet connection is optional</li>
331
 <li>Works from bootable USB drives or microSD drives</li>
341
 <li>Works from bootable USB drives or microSD drives</li>
332
 <li>Data is mesh routed between systems</li>
342
 <li>Data is mesh routed between systems</li>
333
 <li>Private communications is end-to-end secured and forward secret</li>
343
 <li>Private communications is end-to-end secured and forward secret</li>
335
 </ul>
345
 </ul>
336
 
346
 
337
 <p>
347
 <p>
338
-This system should be quite scalable. Both qTox and IPFS are based upon distributed hash tables (DHT) so that each peer does not need to store the full index of data for the entire network. Caching or pinning of IPFS data and its content addressability means that if a file or blog becomes popular then performance should improve as the number of downloads increases, which is the opposite of the client/server paradigm.
348
+This system should be quite scalable. Both qTox and IPFS are based upon distributed hash tables (DHT) so that each peer does not need to store the full index of data for the entire network. Gossiping between SSB peers may be slower, but the <a href="https://en.wikipedia.org/wiki/Small-world_network">small world effect</a> will presumably still make for quite efficient delivery in a large network. Caching or pinning of IPFS data and its content addressability means that if a file or blog becomes popular then performance should improve as the number of downloads increases, which is the opposite of the client/server paradigm.
339
 </p>
349
 </p>
340
 </div>
350
 </div>
341
 </div>
351
 </div>
342
 
352
 
343
-<div id="outline-container-org38eda48" class="outline-2">
344
-<h2 id="org38eda48">Disk Images</h2>
345
-<div class="outline-text-2" id="text-org38eda48">
353
+<div id="outline-container-org2b727b3" class="outline-2">
354
+<h2 id="org2b727b3">Disk Images</h2>
355
+<div class="outline-text-2" id="text-org2b727b3">
346
 </div>
356
 </div>
347
-<div id="outline-container-org2291a28" class="outline-3">
348
-<h3 id="org2291a28">Writing many images quickly</h3>
349
-<div class="outline-text-3" id="text-org2291a28">
357
+<div id="outline-container-org4dcc4ac" class="outline-3">
358
+<h3 id="org4dcc4ac">Writing many images quickly</h3>
359
+<div class="outline-text-3" id="text-org4dcc4ac">
350
 <p>
360
 <p>
351
 There may be situations where you need to write the same disk image to multiple drives at the same time in order to maximize rate of deployment. In the instructions given below the <b>dd</b> command is used for writing to the target drive, but to write to multiple drives you can use a tool such as <a href="https://wiki.gnome.org/Apps/MultiWriter">GNOME MultiWriter</a>.
361
 There may be situations where you need to write the same disk image to multiple drives at the same time in order to maximize rate of deployment. In the instructions given below the <b>dd</b> command is used for writing to the target drive, but to write to multiple drives you can use a tool such as <a href="https://wiki.gnome.org/Apps/MultiWriter">GNOME MultiWriter</a>.
352
 </p>
362
 </p>
374
 </p>
384
 </p>
375
 </div>
385
 </div>
376
 </div>
386
 </div>
377
-<div id="outline-container-orgd0546b8" class="outline-3">
378
-<h3 id="orgd0546b8">Client images</h3>
379
-<div class="outline-text-3" id="text-orgd0546b8">
387
+<div id="outline-container-orgd331956" class="outline-3">
388
+<h3 id="orgd331956">Client images</h3>
389
+<div class="outline-text-3" id="text-orgd331956">
380
 <div class="org-center">
390
 <div class="org-center">
381
 
391
 
382
 <div class="figure">
392
 <div class="figure">
425
 </div>
435
 </div>
426
 </div>
436
 </div>
427
 
437
 
428
-<div id="outline-container-orgefe9dc5" class="outline-3">
429
-<h3 id="orgefe9dc5">Router images</h3>
430
-<div class="outline-text-3" id="text-orgefe9dc5">
438
+<div id="outline-container-org513ddc4" class="outline-3">
439
+<h3 id="org513ddc4">Router images</h3>
440
+<div class="outline-text-3" id="text-org513ddc4">
431
 <p>
441
 <p>
432
 Routers are intended to build network coverage for an area using small and low cost hardware. You can bolt them to walls or leave them on window ledges. They don't have any user interface and their only job is to haul network traffic across the mesh and to enable peers to find each other via running bootstrap nodes for Tox and IPFS. Copy the image to a microSD card and insert it into the router, plug in an Atheros wifi dongle and power on. That should be all you need to do.
442
 Routers are intended to build network coverage for an area using small and low cost hardware. You can bolt them to walls or leave them on window ledges. They don't have any user interface and their only job is to haul network traffic across the mesh and to enable peers to find each other via running bootstrap nodes for Tox and IPFS. Copy the image to a microSD card and insert it into the router, plug in an Atheros wifi dongle and power on. That should be all you need to do.
433
 </p>
443
 </p>
434
 </div>
444
 </div>
435
-<div id="outline-container-org2f4e6c1" class="outline-4">
436
-<h4 id="org2f4e6c1">Beaglebone Black</h4>
437
-<div class="outline-text-4" id="text-org2f4e6c1">
445
+<div id="outline-container-orgfa33a6f" class="outline-4">
446
+<h4 id="orgfa33a6f">Beaglebone Black</h4>
447
+<div class="outline-text-4" id="text-orgfa33a6f">
438
 <div class="org-center">
448
 <div class="org-center">
439
 
449
 
440
 <div class="figure">
450
 <div class="figure">
471
 </div>
481
 </div>
472
 </div>
482
 </div>
473
 
483
 
474
-<div id="outline-container-org0c3a295" class="outline-2">
475
-<h2 id="org0c3a295">Building Disk Images</h2>
476
-<div class="outline-text-2" id="text-org0c3a295">
484
+<div id="outline-container-org520845e" class="outline-2">
485
+<h2 id="org520845e">Building Disk Images</h2>
486
+<div class="outline-text-2" id="text-org520845e">
477
 <p>
487
 <p>
478
 It's better not to trust images downloaded from random places on the interwebs. Chances are that unless you are in the web of trust of the above GPG signatures then they don't mean very much to you. If you actually want something trustworthy then build the images from scratch. It will take some time. Here's how to do it.
488
 It's better not to trust images downloaded from random places on the interwebs. Chances are that unless you are in the web of trust of the above GPG signatures then they don't mean very much to you. If you actually want something trustworthy then build the images from scratch. It will take some time. Here's how to do it.
479
 </p>
489
 </p>
561
 </div>
571
 </div>
562
 </div>
572
 </div>
563
 
573
 
564
-<div id="outline-container-orgdbfa9a8" class="outline-2">
565
-<h2 id="orgdbfa9a8">Customisation</h2>
566
-<div class="outline-text-2" id="text-orgdbfa9a8">
574
+<div id="outline-container-org138c835" class="outline-2">
575
+<h2 id="org138c835">Customisation</h2>
576
+<div class="outline-text-2" id="text-org138c835">
567
 <p>
577
 <p>
568
 If you want to make your own specially branded version, such as for a particular event, then to change the default desktop backgrounds edit the images within <b>img/backgrounds</b> and to change the available avatars and desktop icons edit the images within <b>img/avatars</b>. Re-create disk images using the instructions shown previously.
578
 If you want to make your own specially branded version, such as for a particular event, then to change the default desktop backgrounds edit the images within <b>img/backgrounds</b> and to change the available avatars and desktop icons edit the images within <b>img/avatars</b>. Re-create disk images using the instructions shown previously.
569
 </p>
579
 </p>
573
 </p>
583
 </p>
574
 </div>
584
 </div>
575
 </div>
585
 </div>
576
-<div id="outline-container-org5f6418e" class="outline-2">
577
-<h2 id="org5f6418e">How to use it</h2>
578
-<div class="outline-text-2" id="text-org5f6418e">
586
+<div id="outline-container-org315aa35" class="outline-2">
587
+<h2 id="org315aa35">How to use it</h2>
588
+<div class="outline-text-2" id="text-org315aa35">
579
 <p>
589
 <p>
580
 When you first boot from the USB drive the system will create some encryption keys, assign a unique network address to the system and then reboot itself. When that's done you should see a prompt asking for a username. This username just makes it easy for others to initially find you on the mesh and will appear in the list of users.
590
 When you first boot from the USB drive the system will create some encryption keys, assign a unique network address to the system and then reboot itself. When that's done you should see a prompt asking for a username. This username just makes it easy for others to initially find you on the mesh and will appear in the list of users.
581
 </p>
591
 </p>
585
 </p>
595
 </p>
586
 </div>
596
 </div>
587
 
597
 
588
-<div id="outline-container-org6f259f7" class="outline-3">
589
-<h3 id="org6f259f7">Boot trouble</h3>
590
-<div class="outline-text-3" id="text-org6f259f7">
598
+<div id="outline-container-org1b3364a" class="outline-3">
599
+<h3 id="org1b3364a">Boot trouble</h3>
600
+<div class="outline-text-3" id="text-org1b3364a">
591
 <p>
601
 <p>
592
 If the system doesn't boot and reports an error which includes <b>/dev/mapper/loop0p1</b> then reboot with <b>Ctrl-Alt-Del</b> and when you see the grub menu press <b>e</b> and manually change <b>/dev/mapper/loop0p1</b> to <b>/dev/sdb1</b>, then press <b>Ctrl-x</b>. If that doesn't work then reboot and try <b>/dev/sdc1</b> instead.
602
 If the system doesn't boot and reports an error which includes <b>/dev/mapper/loop0p1</b> then reboot with <b>Ctrl-Alt-Del</b> and when you see the grub menu press <b>e</b> and manually change <b>/dev/mapper/loop0p1</b> to <b>/dev/sdb1</b>, then press <b>Ctrl-x</b>. If that doesn't work then reboot and try <b>/dev/sdc1</b> instead.
593
 </p>
603
 </p>
597
 </p>
607
 </p>
598
 </div>
608
 </div>
599
 </div>
609
 </div>
600
-<div id="outline-container-org32ab229" class="outline-3">
601
-<h3 id="org32ab229">Set the Date</h3>
602
-<div class="outline-text-3" id="text-org32ab229">
610
+<div id="outline-container-orgde8506a" class="outline-3">
611
+<h3 id="orgde8506a">Set the Date</h3>
612
+<div class="outline-text-3" id="text-orgde8506a">
603
 <p>
613
 <p>
604
 On the ordinary internet the date and time of your system would be set automatically via NTP. But this is not the internet and so you will need to manually ensure that your date and time settings are correct. You might need to periodically do this if your clock drifts. It's not essential that the time on your system be highly accurate, but if it drifts too far or goes back to epoch then things could become a little confusing in regard to the order of blog posts.
614
 On the ordinary internet the date and time of your system would be set automatically via NTP. But this is not the internet and so you will need to manually ensure that your date and time settings are correct. You might need to periodically do this if your clock drifts. It's not essential that the time on your system be highly accurate, but if it drifts too far or goes back to epoch then things could become a little confusing in regard to the order of blog posts.
605
 </p>
615
 </p>
609
 </p>
619
 </p>
610
 </div>
620
 </div>
611
 </div>
621
 </div>
612
-<div id="outline-container-org0a0c31f" class="outline-3">
613
-<h3 id="org0a0c31f">Check network status</h3>
614
-<div class="outline-text-3" id="text-org0a0c31f">
622
+<div id="outline-container-orgc819dda" class="outline-3">
623
+<h3 id="orgc819dda">Check network status</h3>
624
+<div class="outline-text-3" id="text-orgc819dda">
615
 <p>
625
 <p>
616
 Unlike with ordinary wifi, on the mesh you don't get a signal strength icon and so it's not simple to see if you have a good connection.
626
 Unlike with ordinary wifi, on the mesh you don't get a signal strength icon and so it's not simple to see if you have a good connection.
617
 </p>
627
 </p>
634
 </p>
644
 </p>
635
 </div>
645
 </div>
636
 </div>
646
 </div>
647
+<div id="outline-container-org41bb113" class="outline-3">
648
+<h3 id="org41bb113">Connecting to the internet</h3>
649
+<div class="outline-text-3" id="text-org41bb113">
650
+<p>
651
+If you need to be able to access the internet from the mesh then connect one of the peers to an internet router using an ethernet cable, then reboot it. Other peers in the mesh, including any attached mobile devices, will then be able to access the internet using the ethernet attached peer as a gateway. <a href="https://en.wikipedia.org/wiki/Freifunk">Freifunk</a> works in a similar way.
652
+</p>
637
 
653
 
638
-<div id="outline-container-org334d737" class="outline-3">
639
-<h3 id="org334d737">Chat System</h3>
640
-<div class="outline-text-3" id="text-org334d737">
654
+<p>
655
+After connecting one peer to the internet you may need to reboot other peers in order to update their network configurations.
656
+</p>
657
+
658
+<p>
659
+If for legal reasons you need to connect to the internet via a VPN then openvpn is preinstalled and you can run the command:
660
+</p>
661
+
662
+<div class="org-src-container">
663
+<pre class="src src-bash">sudo openvpn myclient.ovpn
664
+</pre>
665
+</div>
666
+
667
+<p>
668
+Where <i>myclient.ovpn</i> comes from your VPN provider and with the password "<i>freedombone</i>".
669
+</p>
670
+</div>
671
+</div>
672
+<div id="outline-container-orgcffa0dd" class="outline-3">
673
+<h3 id="orgcffa0dd">Connecting two meshes over the internet via a VPN tunnel</h3>
674
+<div class="outline-text-3" id="text-orgcffa0dd">
675
+<p>
676
+Maybe the internet exists, but you don't care about getting any content from it and just want to use it as a way to connect mesh networks from different geographical locations together. VPN configuration, pem and stunnel files exist within the home directory. Edit the configuration with:
677
+</p>
678
+
679
+<div class="org-src-container">
680
+<pre class="src src-bash">nano ~/client.ovpn
681
+</pre>
682
+</div>
683
+
684
+<p>
685
+Edit the IP address or domain for the mesh that you wish to connect to within the <i>route</i> command:
686
+</p>
687
+
688
+<div class="org-src-container">
689
+<pre class="src src-bash">route [mesh IP or domain] 255.255.255.255 net_gateway
690
+</pre>
691
+</div>
692
+
693
+<p>
694
+Then you can connect to the other mesh with:
695
+</p>
696
+
697
+<div class="org-src-container">
698
+<pre class="src src-bash"><span class="org-builtin">cd</span> /home/fbone
699
+sudo stunnel stunnel-client.conf
700
+sudo openvpn client.ovpn
701
+</pre>
702
+</div>
703
+
704
+<p>
705
+Using the password "<i>freedombone</i>". From a deep packet inspection point of view the traffic going over the internet will just look like any other TLS connection to a server.
706
+</p>
707
+</div>
708
+</div>
709
+
710
+<div id="outline-container-org0071e68" class="outline-3">
711
+<h3 id="org0071e68">Mobile devices (phones, etc)</h3>
712
+<div class="outline-text-3" id="text-org0071e68">
713
+<p>
714
+To allow mobile devices to connect to the mesh you will need a second wifi adapter connected to your laptop/netbook/SBC. Plug in a second wifi adapter then reboot the system. The second adaptor will then create a wifi hotspot which mobile devices can connect to. The hotspot name also contains its local IP address (eg. "<i>mesh-192.168.1.83</i>").
715
+</p>
716
+
717
+<p>
718
+On a typical Android device go to <b>Settings</b> then <b>Security</b> and ensure that <b>Unknown sources</b> is enabled. Also within <b>Wifi</b> from the <b>Settings</b> screen select the mesh hotspot. The password is "<i>freedombone</i>". Open a non-Tor browser and navigate to the IP address showing in the hotspot name. You can then download and install mesh apps.
719
+</p>
720
+
721
+<div class="org-center">
722
+
723
+<div class="figure">
724
+<p><img src="images/mesh_mobileapps.jpg" alt="mesh_mobileapps.jpg" />
725
+</p>
726
+</div>
727
+</div>
728
+
729
+<p>
730
+On some android devices you may need to move the downloaded APK file from the <b>Downloads</b> directory to your <b>home</b> directory before you can install it.
731
+</p>
732
+</div>
733
+</div>
734
+<div id="outline-container-org15ce109" class="outline-3">
735
+<h3 id="org15ce109">Chat System</h3>
736
+<div class="outline-text-3" id="text-org15ce109">
641
 <p>
737
 <p>
642
 Ensure that you're within wifi range of at least one other mesh peer (could be a router or client) and then you should see that the <i>Chat</i> and <i>Other Users</i> icons appear. Select the users icon and you should see a list of users on the mesh. Select the <i>Chat</i> icon and once you are connected you should see the status light turn green. If after a few minutes you don't get the green status light then try closing and re-opening the Tox chat application. Select the plus button to add a friend and then copy and paste in a Tox ID from the users list.
738
 Ensure that you're within wifi range of at least one other mesh peer (could be a router or client) and then you should see that the <i>Chat</i> and <i>Other Users</i> icons appear. Select the users icon and you should see a list of users on the mesh. Select the <i>Chat</i> icon and once you are connected you should see the status light turn green. If after a few minutes you don't get the green status light then try closing and re-opening the Tox chat application. Select the plus button to add a friend and then copy and paste in a Tox ID from the users list.
643
 </p>
739
 </p>
696
 </div>
792
 </div>
697
 </div>
793
 </div>
698
 
794
 
699
-<div id="outline-container-org2195683" class="outline-3">
700
-<h3 id="org2195683">Social Network</h3>
701
-<div class="outline-text-3" id="text-org2195683">
795
+<div id="outline-container-org9f229f4" class="outline-3">
796
+<h3 id="org9f229f4">Social Network</h3>
797
+<div class="outline-text-3" id="text-org9f229f4">
702
 <p>
798
 <p>
703
 Patchwork is available as a social networking system for the mesh. Like all social network systems it has a stream of posts and you can follow or unfollow other users. You can also send private messages to other users with end-to-end encryption.
799
 Patchwork is available as a social networking system for the mesh. Like all social network systems it has a stream of posts and you can follow or unfollow other users. You can also send private messages to other users with end-to-end encryption.
704
 </p>
800
 </p>
733
 </div>
829
 </div>
734
 </div>
830
 </div>
735
 
831
 
736
-<div id="outline-container-org41de3cc" class="outline-3">
737
-<h3 id="org41de3cc">Sharing Files</h3>
738
-<div class="outline-text-3" id="text-org41de3cc">
832
+<div id="outline-container-org31fc0a9" class="outline-3">
833
+<h3 id="org31fc0a9">Sharing Files</h3>
834
+<div class="outline-text-3" id="text-org31fc0a9">
739
 <p>
835
 <p>
740
 You can make files publicly available on the network simply by dragging and dropping them into the <i>Public</i> folder on the desktop. To view the files belonging to another user select the desktop icon called <i>Visit a site</i> and enter the username or Tox ID of the other user.
836
 You can make files publicly available on the network simply by dragging and dropping them into the <i>Public</i> folder on the desktop. To view the files belonging to another user select the desktop icon called <i>Visit a site</i> and enter the username or Tox ID of the other user.
741
 </p>
837
 </p>
750
 </div>
846
 </div>
751
 </div>
847
 </div>
752
 
848
 
753
-<div id="outline-container-org534896d" class="outline-3">
754
-<h3 id="org534896d">Blogging</h3>
755
-<div class="outline-text-3" id="text-org534896d">
849
+<div id="outline-container-org5a54e47" class="outline-3">
850
+<h3 id="org5a54e47">Blogging</h3>
851
+<div class="outline-text-3" id="text-org5a54e47">
756
 <p>
852
 <p>
757
 To create a blog post select the <i>Blog</i> icon on the desktop and then use the up and down cursor keys, space bar and enter key to add a new entry. Edit the title of the entry and add your text. You can also include photos if you wish - just copy them to the <b>CreateBlog/content/images</b> directory and then link to them as shown.
853
 To create a blog post select the <i>Blog</i> icon on the desktop and then use the up and down cursor keys, space bar and enter key to add a new entry. Edit the title of the entry and add your text. You can also include photos if you wish - just copy them to the <b>CreateBlog/content/images</b> directory and then link to them as shown.
758
 </p>
854
 </p>

+ 289
- 0
website/EN/meshindex.html View File

1
+<?xml version="1.0" encoding="utf-8"?>
2
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
3
+"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
4
+<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
5
+<head>
6
+<!-- 2017-10-05 Thu 11:44 -->
7
+<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
8
+<meta name="viewport" content="width=device-width, initial-scale=1" />
9
+<title>&lrm;</title>
10
+<meta name="generator" content="Org mode" />
11
+<meta name="author" content="Bob Mottram" />
12
+<meta name="description" content="Download apps for use on the mesh"
13
+ />
14
+<meta name="keywords" content="mesh, freedombone, apps" />
15
+<style type="text/css">
16
+ <!--/*--><![CDATA[/*><!--*/
17
+  .title  { text-align: center;
18
+             margin-bottom: .2em; }
19
+  .subtitle { text-align: center;
20
+              font-size: medium;
21
+              font-weight: bold;
22
+              margin-top:0; }
23
+  .todo   { font-family: monospace; color: red; }
24
+  .done   { font-family: monospace; color: green; }
25
+  .priority { font-family: monospace; color: orange; }
26
+  .tag    { background-color: #eee; font-family: monospace;
27
+            padding: 2px; font-size: 80%; font-weight: normal; }
28
+  .timestamp { color: #bebebe; }
29
+  .timestamp-kwd { color: #5f9ea0; }
30
+  .org-right  { margin-left: auto; margin-right: 0px;  text-align: right; }
31
+  .org-left   { margin-left: 0px;  margin-right: auto; text-align: left; }
32
+  .org-center { margin-left: auto; margin-right: auto; text-align: center; }
33
+  .underline { text-decoration: underline; }
34
+  #postamble p, #preamble p { font-size: 90%; margin: .2em; }
35
+  p.verse { margin-left: 3%; }
36
+  pre {
37
+    border: 1px solid #ccc;
38
+    box-shadow: 3px 3px 3px #eee;
39
+    padding: 8pt;
40
+    font-family: monospace;
41
+    overflow: auto;
42
+    margin: 1.2em;
43
+  }
44
+  pre.src {
45
+    position: relative;
46
+    overflow: visible;
47
+    padding-top: 1.2em;
48
+  }
49
+  pre.src:before {
50
+    display: none;
51
+    position: absolute;
52
+    background-color: white;
53
+    top: -10px;
54
+    right: 10px;
55
+    padding: 3px;
56
+    border: 1px solid black;
57
+  }
58
+  pre.src:hover:before { display: inline;}
59
+  /* Languages per Org manual */
60
+  pre.src-asymptote:before { content: 'Asymptote'; }
61
+  pre.src-awk:before { content: 'Awk'; }
62
+  pre.src-C:before { content: 'C'; }
63
+  /* pre.src-C++ doesn't work in CSS */
64
+  pre.src-clojure:before { content: 'Clojure'; }
65
+  pre.src-css:before { content: 'CSS'; }
66
+  pre.src-D:before { content: 'D'; }
67
+  pre.src-ditaa:before { content: 'ditaa'; }
68
+  pre.src-dot:before { content: 'Graphviz'; }
69
+  pre.src-calc:before { content: 'Emacs Calc'; }
70
+  pre.src-emacs-lisp:before { content: 'Emacs Lisp'; }
71
+  pre.src-fortran:before { content: 'Fortran'; }
72
+  pre.src-gnuplot:before { content: 'gnuplot'; }
73
+  pre.src-haskell:before { content: 'Haskell'; }
74
+  pre.src-hledger:before { content: 'hledger'; }
75
+  pre.src-java:before { content: 'Java'; }
76
+  pre.src-js:before { content: 'Javascript'; }
77
+  pre.src-latex:before { content: 'LaTeX'; }
78
+  pre.src-ledger:before { content: 'Ledger'; }
79
+  pre.src-lisp:before { content: 'Lisp'; }
80
+  pre.src-lilypond:before { content: 'Lilypond'; }
81
+  pre.src-lua:before { content: 'Lua'; }
82
+  pre.src-matlab:before { content: 'MATLAB'; }
83
+  pre.src-mscgen:before { content: 'Mscgen'; }
84
+  pre.src-ocaml:before { content: 'Objective Caml'; }
85
+  pre.src-octave:before { content: 'Octave'; }
86
+  pre.src-org:before { content: 'Org mode'; }
87
+  pre.src-oz:before { content: 'OZ'; }
88
+  pre.src-plantuml:before { content: 'Plantuml'; }
89
+  pre.src-processing:before { content: 'Processing.js'; }
90
+  pre.src-python:before { content: 'Python'; }
91
+  pre.src-R:before { content: 'R'; }
92
+  pre.src-ruby:before { content: 'Ruby'; }
93
+  pre.src-sass:before { content: 'Sass'; }
94
+  pre.src-scheme:before { content: 'Scheme'; }
95
+  pre.src-screen:before { content: 'Gnu Screen'; }
96
+  pre.src-sed:before { content: 'Sed'; }
97
+  pre.src-sh:before { content: 'shell'; }
98
+  pre.src-sql:before { content: 'SQL'; }
99
+  pre.src-sqlite:before { content: 'SQLite'; }
100
+  /* additional languages in org.el's org-babel-load-languages alist */
101
+  pre.src-forth:before { content: 'Forth'; }
102
+  pre.src-io:before { content: 'IO'; }
103
+  pre.src-J:before { content: 'J'; }
104
+  pre.src-makefile:before { content: 'Makefile'; }
105
+  pre.src-maxima:before { content: 'Maxima'; }
106
+  pre.src-perl:before { content: 'Perl'; }
107
+  pre.src-picolisp:before { content: 'Pico Lisp'; }
108
+  pre.src-scala:before { content: 'Scala'; }
109
+  pre.src-shell:before { content: 'Shell Script'; }
110
+  pre.src-ebnf2ps:before { content: 'ebfn2ps'; }
111
+  /* additional language identifiers per "defun org-babel-execute"
112
+       in ob-*.el */
113
+  pre.src-cpp:before  { content: 'C++'; }
114
+  pre.src-abc:before  { content: 'ABC'; }
115
+  pre.src-coq:before  { content: 'Coq'; }
116
+  pre.src-groovy:before  { content: 'Groovy'; }
117
+  /* additional language identifiers from org-babel-shell-names in
118
+     ob-shell.el: ob-shell is the only babel language using a lambda to put
119
+     the execution function name together. */
120
+  pre.src-bash:before  { content: 'bash'; }
121
+  pre.src-csh:before  { content: 'csh'; }
122
+  pre.src-ash:before  { content: 'ash'; }
123
+  pre.src-dash:before  { content: 'dash'; }
124
+  pre.src-ksh:before  { content: 'ksh'; }
125
+  pre.src-mksh:before  { content: 'mksh'; }
126
+  pre.src-posh:before  { content: 'posh'; }
127
+  /* Additional Emacs modes also supported by the LaTeX listings package */
128
+  pre.src-ada:before { content: 'Ada'; }
129
+  pre.src-asm:before { content: 'Assembler'; }
130
+  pre.src-caml:before { content: 'Caml'; }
131
+  pre.src-delphi:before { content: 'Delphi'; }
132
+  pre.src-html:before { content: 'HTML'; }
133
+  pre.src-idl:before { content: 'IDL'; }
134
+  pre.src-mercury:before { content: 'Mercury'; }
135
+  pre.src-metapost:before { content: 'MetaPost'; }
136
+  pre.src-modula-2:before { content: 'Modula-2'; }
137
+  pre.src-pascal:before { content: 'Pascal'; }
138
+  pre.src-ps:before { content: 'PostScript'; }
139
+  pre.src-prolog:before { content: 'Prolog'; }
140
+  pre.src-simula:before { content: 'Simula'; }
141
+  pre.src-tcl:before { content: 'tcl'; }
142
+  pre.src-tex:before { content: 'TeX'; }
143
+  pre.src-plain-tex:before { content: 'Plain TeX'; }
144
+  pre.src-verilog:before { content: 'Verilog'; }
145
+  pre.src-vhdl:before { content: 'VHDL'; }
146
+  pre.src-xml:before { content: 'XML'; }
147
+  pre.src-nxml:before { content: 'XML'; }
148
+  /* add a generic configuration mode; LaTeX export needs an additional
149
+     (add-to-list 'org-latex-listings-langs '(conf " ")) in .emacs */
150
+  pre.src-conf:before { content: 'Configuration File'; }
151
+
152
+  table { border-collapse:collapse; }
153
+  caption.t-above { caption-side: top; }
154
+  caption.t-bottom { caption-side: bottom; }
155
+  td, th { vertical-align:top;  }
156
+  th.org-right  { text-align: center;  }
157
+  th.org-left   { text-align: center;   }
158
+  th.org-center { text-align: center; }
159
+  td.org-right  { text-align: right;  }
160
+  td.org-left   { text-align: left;   }
161
+  td.org-center { text-align: center; }
162
+  dt { font-weight: bold; }
163
+  .footpara { display: inline; }
164
+  .footdef  { margin-bottom: 1em; }
165
+  .figure { padding: 1em; }
166
+  .figure p { text-align: center; }
167
+  .inlinetask {
168
+    padding: 10px;
169
+    border: 2px solid gray;
170
+    margin: 10px;
171
+    background: #ffffcc;
172
+  }
173
+  #org-div-home-and-up
174
+   { text-align: right; font-size: 70%; white-space: nowrap; }
175
+  textarea { overflow-x: auto; }
176
+  .linenr { font-size: smaller }
177
+  .code-highlighted { background-color: #ffff00; }
178
+  .org-info-js_info-navigation { border-style: none; }
179
+  #org-info-js_console-label
180
+    { font-size: 10px; font-weight: bold; white-space: nowrap; }
181
+  .org-info-js_search-highlight
182
+    { background-color: #ffff00; color: #000000; font-weight: bold; }
183
+  .org-svg { width: 90%; }
184
+  /*]]>*/-->
185
+</style>
186
+<link rel="stylesheet" type="text/css" href="freedombone.css" />
187
+<script type="text/javascript">
188
+/*
189
+@licstart  The following is the entire license notice for the
190
+JavaScript code in this tag.
191
+
192
+Copyright (C) 2012-2017 Free Software Foundation, Inc.
193
+
194
+The JavaScript code in this tag is free software: you can
195
+redistribute it and/or modify it under the terms of the GNU
196
+General Public License (GNU GPL) as published by the Free Software
197
+Foundation, either version 3 of the License, or (at your option)
198
+any later version.  The code is distributed WITHOUT ANY WARRANTY;
199
+without even the implied warranty of MERCHANTABILITY or FITNESS
200
+FOR A PARTICULAR PURPOSE.  See the GNU GPL for more details.
201
+
202
+As additional permission under GNU GPL version 3 section 7, you
203
+may distribute non-source (e.g., minimized or compacted) forms of
204
+that code without the copy of the GNU GPL normally required by
205
+section 4, provided you include this license notice and a URL
206
+through which recipients can access the Corresponding Source.
207
+
208
+
209
+@licend  The above is the entire license notice
210
+for the JavaScript code in this tag.
211
+*/
212
+<!--/*--><![CDATA[/*><!--*/
213
+ function CodeHighlightOn(elem, id)
214
+ {
215
+   var target = document.getElementById(id);
216
+   if(null != target) {
217
+     elem.cacheClassElem = elem.className;
218
+     elem.cacheClassTarget = target.className;
219
+     target.className = "code-highlighted";
220
+     elem.className   = "code-highlighted";
221
+   }
222
+ }
223
+ function CodeHighlightOff(elem, id)
224
+ {
225
+   var target = document.getElementById(id);
226
+   if(elem.cacheClassElem)
227
+     elem.className = elem.cacheClassElem;
228
+   if(elem.cacheClassTarget)
229
+     target.className = elem.cacheClassTarget;
230
+ }
231
+/*]]>*///-->
232
+</script>
233
+</head>
234
+<body>
235
+<div id="preamble" class="status">
236
+<a name="top" id="top"></a>
237
+</div>
238
+<div id="content">
239
+<div class="org-center">
240
+
241
+<div class="figure">
242
+<p><img src="images/logo.png" alt="logo.png" />
243
+</p>
244
+</div>
245
+</div>
246
+
247
+<center>
248
+<h3>Welcome to the Freedombone Mesh</h3>
249
+</center>
250
+
251
+<p>
252
+The following apps are available:
253
+</p>
254
+
255
+ <center>
256
+ <table style="width:80%; border:0">
257
+  <tr>
258
+    <td><center><b><a href="ssb.apk"><img src="images/ssb.png"/></a></b><br><a href="ssb.apk">Secure Scuttlebutt</a></center></td>
259
+    <td><center><b><h3></h3></b><br></center></td>
260
+  </tr>
261
+</table>
262
+</center>
263
+</div>
264
+<div id="postamble" class="status">
265
+
266
+<style type="text/css">
267
+.back-to-top {
268
+    position: fixed;
269
+    bottom: 2em;
270
+    right: 0px;
271
+    text-decoration: none;
272
+    color: #000000;
273
+    background-color: rgba(235, 235, 235, 0.80);
274
+    font-size: 12px;
275
+    padding: 1em;
276
+    display: none;
277
+}
278
+
279
+.back-to-top:hover {
280
+    background-color: rgba(135, 135, 135, 0.50);
281
+}
282
+</style>
283
+
284
+<div class="back-to-top">
285
+<a href="#top">Back to top</a> | <a href="mailto:bob@freedombone.net">E-mail me</a>
286
+</div>
287
+</div>
288
+</body>
289
+</html>