|
@@ -31,6 +31,9 @@ CURR_USER=$USER
|
31
|
31
|
# Version number of this script
|
32
|
32
|
VERSION="1.01"
|
33
|
33
|
|
|
34
|
+# mesh networking settings
|
|
35
|
+BATMAN_IPV6=
|
|
36
|
+
|
34
|
37
|
# ssh (from https://stribika.github.io/2015/01/04/secure-secure-shell.html)
|
35
|
38
|
SSH_CIPHERS="chacha20-poly1305@openssh.com,aes256-gcm@openssh.com,aes128-gcm@openssh.com,aes256-ctr,aes192-ctr,aes128-ctr"
|
36
|
39
|
SSH_MACS="hmac-sha2-512-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-ripemd160-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-512,hmac-sha2-256,hmac-ripemd160,umac-128@openssh.com"
|
|
@@ -79,6 +82,81 @@ function configure_ssh_client {
|
79
|
82
|
echo ''
|
80
|
83
|
}
|
81
|
84
|
|
|
85
|
+function mesh_batman {
|
|
86
|
+ if [ ! $BATMAN_IPV6 ]; then
|
|
87
|
+ return
|
|
88
|
+ fi
|
|
89
|
+ sudo apt-get -y install iproute bridge-utils libnetfilter-conntrack3 batctl
|
|
90
|
+ sudo apt-get -y install python-dev libevent-dev ebtables python-pip git
|
|
91
|
+
|
|
92
|
+ sudo modprobe batman-adv
|
|
93
|
+ [ $? -ne 0 ] && echo "B.A.T.M.A.N module not available" && exit 76482
|
|
94
|
+ if ! grep -q "batman_adv" /etc/modules; then
|
|
95
|
+ sudo echo 'batman_adv' >> /etc/modules
|
|
96
|
+ fi
|
|
97
|
+
|
|
98
|
+ echo '#!/bin/bash' > /tmp/freedombone_mesh
|
|
99
|
+ echo '' > /tmp/freedombone_mesh
|
|
100
|
+ echo '# stop network manager to make the mesh network work' >> /tmp/freedombone_mesh
|
|
101
|
+ echo 'service networking stop' >> /tmp/freedombone_mesh
|
|
102
|
+ echo '' >> /tmp/freedombone_mesh
|
|
103
|
+ echo -n '# configure the wlan interface to operate with ' >> /tmp/freedombone_mesh
|
|
104
|
+ echo 'mtus of 1532(batman requires it) and turn enc off ' >> /tmp/freedombone_mesh
|
|
105
|
+ echo 'to ensure it works' >> /tmp/freedombone_mesh
|
|
106
|
+ echo 'ifconfig wlan0 down' >> /tmp/freedombone_mesh
|
|
107
|
+ echo 'ifconfig wlan0 mtu 1532' >> /tmp/freedombone_mesh
|
|
108
|
+ echo 'iwconfig wlan0 enc off' >> /tmp/freedombone_mesh
|
|
109
|
+ echo '' >> /tmp/freedombone_mesh
|
|
110
|
+ echo '# add the interface to the ad-hoc network - or create it.' >> /tmp/freedombone_mesh
|
|
111
|
+ echo -n "iwconfig wlan0 mode ad-hoc essid mesh ap " >> /tmp/freedombone_mesh
|
|
112
|
+ echo "$BATMAN_IPV6 channel 2" >> /tmp/freedombone_mesh
|
|
113
|
+ echo '' >> /tmp/freedombone_mesh
|
|
114
|
+ echo -n '# add wlan0 to the batman-adv virtual interface(so it can ' >> /tmp/freedombone_mesh
|
|
115
|
+ echo 'communicate with other batman-adv nodes)' >> /tmp/freedombone_mesh
|
|
116
|
+ echo 'batctl if add wlan0' >> /tmp/freedombone_mesh
|
|
117
|
+ echo 'ifconfig wlan0 up' >> /tmp/freedombone_mesh
|
|
118
|
+ echo 'ifconfig bat0 up' >> /tmp/freedombone_mesh
|
|
119
|
+ echo '' >> /tmp/freedombone_mesh
|
|
120
|
+ echo '# get the ip address for the node from the bridge connected to the dhcp server' >> /tmp/freedombone_mesh
|
|
121
|
+ echo 'dhclient bat0' >> /tmp/freedombone_mesh
|
|
122
|
+ echo '' >> /tmp/freedombone_mesh
|
|
123
|
+ echo 'exit 0' >> /tmp/freedombone_mesh
|
|
124
|
+ chmod +x /tmp/freedombone_mesh
|
|
125
|
+ sudo mv /tmp/freedombone_mesh /usr/bin/mesh
|
|
126
|
+}
|
|
127
|
+
|
|
128
|
+function show_help {
|
|
129
|
+ echo ''
|
|
130
|
+ echo 'freedombone-client --mesh-ip [mesh bridge IPv6 address]'
|
|
131
|
+ echo ''
|
|
132
|
+ exit 0
|
|
133
|
+}
|
|
134
|
+
|
|
135
|
+while [[ $# > 1 ]]
|
|
136
|
+do
|
|
137
|
+key="$1"
|
|
138
|
+
|
|
139
|
+case $key in
|
|
140
|
+ -h|--help)
|
|
141
|
+ show_help
|
|
142
|
+ ;;
|
|
143
|
+ --mesh-ip)
|
|
144
|
+ shift
|
|
145
|
+ BATMAN_IPV6="$1"
|
|
146
|
+ ;;
|
|
147
|
+ *)
|
|
148
|
+ # unknown option
|
|
149
|
+ ;;
|
|
150
|
+esac
|
|
151
|
+shift
|
|
152
|
+done
|
|
153
|
+
|
82
|
154
|
echo 'Configuring client'
|
83
|
155
|
configure_ssh_client
|
|
156
|
+mesh_batman
|
84
|
157
|
echo 'Configuration complete'
|
|
158
|
+if [[ $BATMAN_IPV6 ]]; then
|
|
159
|
+ echo ''
|
|
160
|
+ echo 'Type "sudo mesh" to connect to the mesh network'
|
|
161
|
+fi
|
|
162
|
+exit 0
|