Browse Source

Global rate limit for tcp

Bob Mottram 8 years ago
parent
commit
f984d0297d
No account linked to committer's email
4 changed files with 394 additions and 367 deletions
  1. 11
    0
      src/freedombone-mesh-batman
  2. 15
    11
      src/freedombone-mesh-reset
  3. 13
    4
      src/freedombone-utils-firewall
  4. 355
    352
      src/freedombone-utils-setup

+ 11
- 0
src/freedombone-mesh-batman View File

@@ -89,6 +89,15 @@ if [ -e /etc/default/batctl ]; then
89 89
     . /etc/default/batctl
90 90
 fi
91 91
 
92
+function global_rate_limit {
93
+    if ! grep -q "tcp_challenge_ack_limit" /etc/sysctl.conf; then
94
+        echo 'net.ipv4.tcp_challenge_ack_limit = 999999999' >> /etc/sysctl.conf
95
+    else
96
+        sed -i 's|net.ipv4.tcp_challenge_ack_limit.*|net.ipv4.tcp_challenge_ack_limit = 999999999|g' /etc/sysctl.conf
97
+    fi
98
+    sysctl -p
99
+}
100
+
92 101
 function status {
93 102
     batctl o
94 103
 }
@@ -175,6 +184,8 @@ function start {
175 184
         sudo rm /etc/avahi/services/udisks.service
176 185
     fi
177 186
 
187
+    global_rate_limit
188
+
178 189
     # Might have to re-enable wifi
179 190
     rfkill unblock $(rfkill list|awk -F: "/phy/ {print $1}") || true
180 191
 

+ 15
- 11
src/freedombone-mesh-reset View File

@@ -32,19 +32,23 @@ export TEXTDOMAIN=${PROJECT_NAME}-mesh-reset
32 32
 export TEXTDOMAINDIR="/usr/share/locale"
33 33
 
34 34
 dialog --title $"New Identity" \
35
-	   --backtitle $"Freedombone Mesh" \
36
-	   --defaultno \
37
-	   --yesno $"\nDo you want to reset your identity? This will reset ALL data for this peer, and you will not be able to recover it." 8 60
35
+       --backtitle $"Freedombone Mesh" \
36
+       --defaultno \
37
+       --yesno $"\nDo you want to reset your identity? This will reset ALL data for this peer, and you will not be able to recover it." 8 60
38 38
 sel=$?
39 39
 case $sel in
40
-	0) sudo pkill qtox
41
-	   sudo pkill firefox
42
-	   sudo pkill iceweasel
43
-	   sudo ${PROJECT_NAME}-image-mesh $USER new
44
-	   sudo batman restart
45
-	   dialog --title $"New Identity" \
46
-			  --msgbox $"You now have a new identity" 6 40
47
-	   ;;
40
+    0) sudo pkill qtox
41
+       sudo pkill firefox
42
+       sudo pkill iceweasel
43
+       sudo ${PROJECT_NAME}-image-mesh $USER new
44
+       sudo batman restart
45
+       if [ -f $HOME/mesh-desktop.sh ]; then
46
+           $HOME/mesh-desktop.sh
47
+       else
48
+           dialog --title $"New Identity" \
49
+                  --msgbox $"You now have a new identity" 6 40
50
+       fi
51
+       ;;
48 52
 esac
49 53
 
50 54
 exit 0

+ 13
- 4
src/freedombone-utils-firewall View File

@@ -37,6 +37,15 @@ function save_firewall_settings {
37 37
     chmod +x /etc/network/if-up.d/iptables
38 38
 }
39 39
 
40
+function global_rate_limit {
41
+    if ! grep -q "tcp_challenge_ack_limit" /etc/sysctl.conf; then
42
+        echo 'net.ipv4.tcp_challenge_ack_limit = 999999999' >> /etc/sysctl.conf
43
+    else
44
+        sed -i 's|net.ipv4.tcp_challenge_ack_limit.*|net.ipv4.tcp_challenge_ack_limit = 999999999|g' /etc/sysctl.conf
45
+    fi
46
+    sysctl -p
47
+}
48
+
40 49
 function enable_ipv6 {
41 50
     # endure that ipv6 is enabled and can route
42 51
     sed -i 's/net.ipv6.conf.all.disable_ipv6.*/net.ipv6.conf.all.disable_ipv6 = 0/g' /etc/sysctl.conf
@@ -47,10 +56,10 @@ function enable_ipv6 {
47 56
 }
48 57
 
49 58
 function configure_firewall {
50
-	if [ $INSTALLING_MESH ]; then
51
-		mesh_firewall
52
-		return
53
-	fi
59
+    if [ $INSTALLING_MESH ]; then
60
+        mesh_firewall
61
+        return
62
+    fi
54 63
     if grep -q "RELATED" /etc/firewall.conf; then
55 64
         # recreate the firewall to remove RELATED
56 65
         sed -i "/firewall/d" $COMPLETION_FILE

+ 355
- 352
src/freedombone-utils-setup View File

@@ -87,474 +87,477 @@ CHECK_MESSAGE="Check your internet connection, /etc/network/interfaces and /etc/
87 87
 DH_KEYLENGTH=2048
88 88
 
89 89
 function initial_setup {
90
-	if grep -Fxq "initial_setup" $COMPLETION_FILE; then
91
-		return
92
-	fi
93
-
94
-	apt-get -y remove --purge apache*
95
-	apt-get -y dist-upgrade
96
-	apt-get -y install ca-certificates emacs24 cpulimit
97
-	apt-get -y install cryptsetup libgfshare-bin obnam sshpass wget
98
-	apt-get -y install avahi-daemon avahi-utils avahi-discover
99
-	apt-get -y install connect-proxy
100
-
101
-	if [ ! -d $INSTALL_DIR ]; then
102
-		mkdir -p $INSTALL_DIR
103
-	fi
104
-
105
-	echo 'initial_setup' >> $COMPLETION_FILE
90
+    if grep -Fxq "initial_setup" $COMPLETION_FILE; then
91
+        return
92
+    fi
93
+
94
+    apt-get -y remove --purge apache*
95
+    apt-get -y dist-upgrade
96
+    apt-get -y install ca-certificates emacs24 cpulimit
97
+    apt-get -y install cryptsetup libgfshare-bin obnam sshpass wget
98
+    apt-get -y install avahi-daemon avahi-utils avahi-discover
99
+    apt-get -y install connect-proxy
100
+
101
+    if [ ! -d $INSTALL_DIR ]; then
102
+        mkdir -p $INSTALL_DIR
103
+    fi
104
+
105
+    echo 'initial_setup' >> $COMPLETION_FILE
106 106
 }
107 107
 
108 108
 function search_for_attached_usb_drive {
109
-	# If a USB drive is attached then search for email,
110
-	# gpg, ssh keys and emacs configuration
111
-	if grep -Fxq "search_for_attached_usb_drive" $COMPLETION_FILE; then
112
-		return
113
-	fi
114
-	if [ -b $USB_DRIVE ]; then
115
-		if [ ! -d $USB_MOUNT ]; then
116
-			echo $'Mounting USB drive'
117
-			mkdir $USB_MOUNT
118
-			mount $USB_DRIVE $USB_MOUNT
119
-		fi
120
-		if ! [[ $SYSTEM_TYPE == "$VARIANT_WRITER" || $SYSTEM_TYPE == "$VARIANT_CLOUD" || $SYSTEM_TYPE == "$VARIANT_CHAT" || $SYSTEM_TYPE == "$VARIANT_SOCIAL" || $SYSTEM_TYPE == "$VARIANT_MEDIA" || $SYSTEM_TYPE == "$VARIANT_DEVELOPER" || $SYSTEM_TYPE == "$VARIANT_MESH" || $SYSTEM_TYPE == "$VARIANT_NONMAILBOX" ]]; then
121
-			if [ -d $USB_MOUNT/Maildir ]; then
122
-				echo $'Maildir found on USB drive'
123
-				IMPORT_MAILDIR=$USB_MOUNT/Maildir
124
-			fi
125
-			if [ -d $USB_MOUNT/.gnupg ]; then
126
-				echo $'Importing GPG keyring'
127
-				cp -r $USB_MOUNT/.gnupg /home/$MY_USERNAME
128
-				chown -R $MY_USERNAME:$MY_USERNAME /home/$MY_USERNAME/.gnupg
129
-				GPG_KEYS_IMPORTED="yes"
130
-				if [ ! -f /home/$MY_USERNAME/.gnupg/secring.gpg ]; then
131
-					echo $'GPG files did not copy'
132
-					exit 73529
133
-				fi
134
-			fi
135
-
136
-			if [ -f $USB_MOUNT/.procmailrc ]; then
137
-				echo $'Importing procmail settings'
138
-				cp $USB_MOUNT/.procmailrc /home/$MY_USERNAME
139
-				chown -R $MY_USERNAME:$MY_USERNAME /home/$MY_USERNAME/.procmailrc
140
-			fi
141
-
142
-			if [ -f $USB_MOUNT/private_key.gpg ]; then
143
-				echo $'GPG private key found on USB drive'
144
-				MY_GPG_PRIVATE_KEY=$USB_MOUNT/private_key.gpg
145
-			fi
146
-			if [ -f $USB_MOUNT/public_key.gpg ]; then
147
-				echo $'GPG public key found on USB drive'
148
-				MY_GPG_PUBLIC_KEY=$USB_MOUNT/public_key.gpg
149
-			fi
150
-		fi
151
-		if [ -d $USB_MOUNT/prosody ]; then
152
-			if [ ! -d $XMPP_DIRECTORY ]; then
153
-				mkdir $XMPP_DIRECTORY
154
-			fi
155
-			cp -r $USB_MOUNT/prosody/* $XMPP_DIRECTORY
156
-			chown -R prosody:prosody $XMPP_DIRECTORY
157
-		fi
158
-		if [ -d $USB_MOUNT/.ssh ]; then
159
-			echo $'Importing ssh keys'
160
-			cp -r $USB_MOUNT/.ssh /home/$MY_USERNAME
161
-			chown -R $MY_USERNAME:$MY_USERNAME /home/$MY_USERNAME/.ssh
162
-			# for security delete the ssh keys from the usb drive
163
-			if [ ! -f /home/$MY_USERNAME/.ssh/id_rsa ]; then
164
-				echo $'ssh files did not copy'
165
-				exit 8
166
-			fi
167
-		fi
168
-		if [ -f $USB_MOUNT/.emacs ]; then
169
-			echo $'Importing .emacs file'
170
-			cp -f $USB_MOUNT/.emacs /home/$MY_USERNAME/.emacs
171
-			chown $MY_USERNAME:$MY_USERNAME /home/$MY_USERNAME/.emacs
172
-		fi
173
-		if [ -d $USB_MOUNT/.emacs.d ]; then
174
-			echo $'Importing .emacs.d directory'
175
-			cp -r $USB_MOUNT/.emacs.d /home/$MY_USERNAME
176
-			chown -R $MY_USERNAME:$MY_USERNAME /home/$MY_USERNAME/.emacs.d
177
-		fi
178
-		if [ -d $USB_MOUNT/ssl ]; then
179
-			echo $'Importing SSL certificates'
180
-			cp -r $USB_MOUNT/ssl/* /etc/ssl
181
-			chmod 640 /etc/ssl/certs/*
182
-			chmod 400 /etc/ssl/private/*
183
-			# change ownership of some certificates
184
-			if [ -d /etc/prosody ]; then
185
-				chown prosody:prosody /etc/ssl/private/xmpp.*
186
-				chown prosody:prosody /etc/ssl/certs/xmpp.*
187
-			fi
188
-			if [ -d /etc/dovecot ]; then
189
-				chown root:dovecot /etc/ssl/certs/dovecot.*
190
-				chown root:dovecot /etc/ssl/private/dovecot.*
191
-			fi
192
-			if [ -f /etc/ssl/private/exim.key ]; then
193
-				cp /etc/ssl/private/exim.key /etc/exim4
194
-				cp /etc/ssl/certs/exim.crt /etc/exim4
195
-				cp /etc/ssl/certs/exim.dhparam /etc/exim4
196
-				chown root:Debian-exim /etc/exim4/exim.key /etc/exim4/exim.crt /etc/exim4/exim.dhparam
197
-				chmod 640 /etc/exim4/exim.key /etc/exim4/exim.crt /etc/exim4/exim.dhparam
198
-			fi
199
-		fi
200
-		if [ -d $USB_MOUNT/personal ]; then
201
-			echo $'Importing personal directory'
202
-			cp -r $USB_MOUNT/personal /home/$MY_USERNAME
203
-			chown -R $MY_USERNAME:$MY_USERNAME /home/$MY_USERNAME/personal
204
-		fi
205
-	else
206
-		if [ -d $USB_MOUNT ]; then
207
-			umount $USB_MOUNT
208
-			rm -rf $USB_MOUNT
209
-		fi
210
-		echo $'No USB drive attached'
211
-	fi
212
-	echo 'search_for_attached_usb_drive' >> $COMPLETION_FILE
109
+    # If a USB drive is attached then search for email,
110
+    # gpg, ssh keys and emacs configuration
111
+    if grep -Fxq "search_for_attached_usb_drive" $COMPLETION_FILE; then
112
+        return
113
+    fi
114
+    if [ -b $USB_DRIVE ]; then
115
+        if [ ! -d $USB_MOUNT ]; then
116
+            echo $'Mounting USB drive'
117
+            mkdir $USB_MOUNT
118
+            mount $USB_DRIVE $USB_MOUNT
119
+        fi
120
+        if ! [[ $SYSTEM_TYPE == "$VARIANT_WRITER" || $SYSTEM_TYPE == "$VARIANT_CLOUD" || $SYSTEM_TYPE == "$VARIANT_CHAT" || $SYSTEM_TYPE == "$VARIANT_SOCIAL" || $SYSTEM_TYPE == "$VARIANT_MEDIA" || $SYSTEM_TYPE == "$VARIANT_DEVELOPER" || $SYSTEM_TYPE == "$VARIANT_MESH" || $SYSTEM_TYPE == "$VARIANT_NONMAILBOX" ]]; then
121
+            if [ -d $USB_MOUNT/Maildir ]; then
122
+                echo $'Maildir found on USB drive'
123
+                IMPORT_MAILDIR=$USB_MOUNT/Maildir
124
+            fi
125
+            if [ -d $USB_MOUNT/.gnupg ]; then
126
+                echo $'Importing GPG keyring'
127
+                cp -r $USB_MOUNT/.gnupg /home/$MY_USERNAME
128
+                chown -R $MY_USERNAME:$MY_USERNAME /home/$MY_USERNAME/.gnupg
129
+                GPG_KEYS_IMPORTED="yes"
130
+                if [ ! -f /home/$MY_USERNAME/.gnupg/secring.gpg ]; then
131
+                    echo $'GPG files did not copy'
132
+                    exit 73529
133
+                fi
134
+            fi
135
+
136
+            if [ -f $USB_MOUNT/.procmailrc ]; then
137
+                echo $'Importing procmail settings'
138
+                cp $USB_MOUNT/.procmailrc /home/$MY_USERNAME
139
+                chown -R $MY_USERNAME:$MY_USERNAME /home/$MY_USERNAME/.procmailrc
140
+            fi
141
+
142
+            if [ -f $USB_MOUNT/private_key.gpg ]; then
143
+                echo $'GPG private key found on USB drive'
144
+                MY_GPG_PRIVATE_KEY=$USB_MOUNT/private_key.gpg
145
+            fi
146
+            if [ -f $USB_MOUNT/public_key.gpg ]; then
147
+                echo $'GPG public key found on USB drive'
148
+                MY_GPG_PUBLIC_KEY=$USB_MOUNT/public_key.gpg
149
+            fi
150
+        fi
151
+        if [ -d $USB_MOUNT/prosody ]; then
152
+            if [ ! -d $XMPP_DIRECTORY ]; then
153
+                mkdir $XMPP_DIRECTORY
154
+            fi
155
+            cp -r $USB_MOUNT/prosody/* $XMPP_DIRECTORY
156
+            chown -R prosody:prosody $XMPP_DIRECTORY
157
+        fi
158
+        if [ -d $USB_MOUNT/.ssh ]; then
159
+            echo $'Importing ssh keys'
160
+            cp -r $USB_MOUNT/.ssh /home/$MY_USERNAME
161
+            chown -R $MY_USERNAME:$MY_USERNAME /home/$MY_USERNAME/.ssh
162
+            # for security delete the ssh keys from the usb drive
163
+            if [ ! -f /home/$MY_USERNAME/.ssh/id_rsa ]; then
164
+                echo $'ssh files did not copy'
165
+                exit 8
166
+            fi
167
+        fi
168
+        if [ -f $USB_MOUNT/.emacs ]; then
169
+            echo $'Importing .emacs file'
170
+            cp -f $USB_MOUNT/.emacs /home/$MY_USERNAME/.emacs
171
+            chown $MY_USERNAME:$MY_USERNAME /home/$MY_USERNAME/.emacs
172
+        fi
173
+        if [ -d $USB_MOUNT/.emacs.d ]; then
174
+            echo $'Importing .emacs.d directory'
175
+            cp -r $USB_MOUNT/.emacs.d /home/$MY_USERNAME
176
+            chown -R $MY_USERNAME:$MY_USERNAME /home/$MY_USERNAME/.emacs.d
177
+        fi
178
+        if [ -d $USB_MOUNT/ssl ]; then
179
+            echo $'Importing SSL certificates'
180
+            cp -r $USB_MOUNT/ssl/* /etc/ssl
181
+            chmod 640 /etc/ssl/certs/*
182
+            chmod 400 /etc/ssl/private/*
183
+            # change ownership of some certificates
184
+            if [ -d /etc/prosody ]; then
185
+                chown prosody:prosody /etc/ssl/private/xmpp.*
186
+                chown prosody:prosody /etc/ssl/certs/xmpp.*
187
+            fi
188
+            if [ -d /etc/dovecot ]; then
189
+                chown root:dovecot /etc/ssl/certs/dovecot.*
190
+                chown root:dovecot /etc/ssl/private/dovecot.*
191
+            fi
192
+            if [ -f /etc/ssl/private/exim.key ]; then
193
+                cp /etc/ssl/private/exim.key /etc/exim4
194
+                cp /etc/ssl/certs/exim.crt /etc/exim4
195
+                cp /etc/ssl/certs/exim.dhparam /etc/exim4
196
+                chown root:Debian-exim /etc/exim4/exim.key /etc/exim4/exim.crt /etc/exim4/exim.dhparam
197
+                chmod 640 /etc/exim4/exim.key /etc/exim4/exim.crt /etc/exim4/exim.dhparam
198
+            fi
199
+        fi
200
+        if [ -d $USB_MOUNT/personal ]; then
201
+            echo $'Importing personal directory'
202
+            cp -r $USB_MOUNT/personal /home/$MY_USERNAME
203
+            chown -R $MY_USERNAME:$MY_USERNAME /home/$MY_USERNAME/personal
204
+        fi
205
+    else
206
+        if [ -d $USB_MOUNT ]; then
207
+            umount $USB_MOUNT
208
+            rm -rf $USB_MOUNT
209
+        fi
210
+        echo $'No USB drive attached'
211
+    fi
212
+    echo 'search_for_attached_usb_drive' >> $COMPLETION_FILE
213 213
 }
214 214
 
215 215
 function mark_admin_user_account {
216
-	if ! grep -q "Admin user:" $COMPLETION_FILE; then
217
-		echo "Admin user:$MY_USERNAME" >> $COMPLETION_FILE
218
-	fi
216
+    if ! grep -q "Admin user:" $COMPLETION_FILE; then
217
+        echo "Admin user:$MY_USERNAME" >> $COMPLETION_FILE
218
+    fi
219 219
 }
220 220
 
221 221
 function remove_instructions_from_motd {
222
-	sed -i '/## /d' /etc/motd
222
+    sed -i '/## /d' /etc/motd
223 223
 }
224 224
 
225 225
 function remove_default_user {
226
-	# make sure you don't use the default user account
227
-	if [[ $MY_USERNAME == "debian" ]]; then
228
-		echo 'Do not use the default debian user account. Create a different user with: adduser [username]'
229
-		exit 68
230
-	fi
231
-	# remove the default debian user to prevent it from becoming an attack vector
232
-	if [ -d /home/debian ]; then
233
-		userdel -r debian
234
-		echo 'Default debian user account removed'
235
-	fi
226
+    # make sure you don't use the default user account
227
+    if [[ $MY_USERNAME == "debian" ]]; then
228
+        echo 'Do not use the default debian user account. Create a different user with: adduser [username]'
229
+        exit 68
230
+    fi
231
+    # remove the default debian user to prevent it from becoming an attack vector
232
+    if [ -d /home/debian ]; then
233
+        userdel -r debian
234
+        echo 'Default debian user account removed'
235
+    fi
236 236
 }
237 237
 
238 238
 function create_completion_file {
239
-	if [ ! -f $COMPLETION_FILE ]; then
240
-		touch $COMPLETION_FILE
241
-	fi
239
+    if [ ! -f $COMPLETION_FILE ]; then
240
+        touch $COMPLETION_FILE
241
+    fi
242 242
 }
243 243
 
244 244
 function upgrade_installation {
245
-	# TODO
246
-	echo ''
245
+    # TODO
246
+    echo ''
247 247
 }
248 248
 
249 249
 function setup_firewall {
250
-	function_check create_completion_file
251
-	create_completion_file
250
+    function_check create_completion_file
251
+    create_completion_file
252 252
 
253
-	function_check configure_firewall
254
-	configure_firewall
253
+    function_check configure_firewall
254
+    configure_firewall
255 255
 
256
-	function_check configure_firewall_ping
257
-	configure_firewall_ping
256
+    function_check configure_firewall_ping
257
+    configure_firewall_ping
258 258
 
259
-	function_check configure_firewall_for_dns
260
-	configure_firewall_for_dns
259
+    function_check configure_firewall_for_dns
260
+    configure_firewall_for_dns
261 261
 
262
-	function_check configure_firewall_for_avahi
263
-	configure_firewall_for_avahi
262
+    function_check configure_firewall_for_avahi
263
+    configure_firewall_for_avahi
264
+
265
+    function_check global_rate_limit
266
+    global_rate_limit
264 267
 }
265 268
 
266 269
 function setup_utils {
267
-	function_check create_completion_file
268
-	create_completion_file
270
+    function_check create_completion_file
271
+    create_completion_file
269 272
 
270
-	function_check read_configuration
271
-	read_configuration
273
+    function_check read_configuration
274
+    read_configuration
272 275
 
273
-	function_check upgrade_installation
274
-	upgrade_installation
276
+    function_check upgrade_installation
277
+    upgrade_installation
275 278
 
276
-	function_check set_default_onion_domains
277
-	set_default_onion_domains
279
+    function_check set_default_onion_domains
280
+    set_default_onion_domains
278 281
 
279
-	function_check locale_setup
280
-	locale_setup
282
+    function_check locale_setup
283
+    locale_setup
281 284
 
282
-	function_check parse_args
283
-	parse_args
285
+    function_check parse_args
286
+    parse_args
284 287
 
285
-	function_check check_domains
286
-	check_domains
288
+    function_check check_domains
289
+    check_domains
287 290
 
288
-	function_check install_static_network
289
-	install_static_network
291
+    function_check install_static_network
292
+    install_static_network
290 293
 
291
-	function_check remove_default_user
292
-	remove_default_user
294
+    function_check remove_default_user
295
+    remove_default_user
293 296
 
294
-	function_check setup_firewall
295
-	setup_firewall
297
+    function_check setup_firewall
298
+    setup_firewall
296 299
 
297
-	function_check create_repo_sources
298
-	create_repo_sources
300
+    function_check create_repo_sources
301
+    create_repo_sources
299 302
 
300
-	function_check configure_dns
301
-	configure_dns
303
+    function_check configure_dns
304
+    configure_dns
302 305
 
303
-	function_check initial_setup
304
-	initial_setup
306
+    function_check initial_setup
307
+    initial_setup
305 308
 
306
-	function_check install_tor
307
-	install_tor
309
+    function_check install_tor
310
+    install_tor
308 311
 
309
-	#function_check resolve_dns_via_tor
310
-	#resolve_dns_via_tor
312
+    #function_check resolve_dns_via_tor
313
+    #resolve_dns_via_tor
311 314
 
312
-	function_check install_command_line_browser
313
-	install_command_line_browser
315
+    function_check install_command_line_browser
316
+    install_command_line_browser
314 317
 
315
-	function_check enable_ssh_via_onion
316
-	enable_ssh_via_onion
318
+    function_check enable_ssh_via_onion
319
+    enable_ssh_via_onion
317 320
 
318
-	function_check check_date
319
-	check_date
321
+    function_check check_date
322
+    check_date
320 323
 
321
-	function_check install_dynamicdns
322
-	install_dynamicdns
324
+    function_check install_dynamicdns
325
+    install_dynamicdns
323 326
 
324
-	function_check randomize_cron
325
-	randomize_cron
327
+    function_check randomize_cron
328
+    randomize_cron
326 329
 
327
-	function_check create_freedns_updater
328
-	create_freedns_updater
330
+    function_check create_freedns_updater
331
+    create_freedns_updater
329 332
 
330
-	function_check mark_admin_user_account
331
-	mark_admin_user_account
333
+    function_check mark_admin_user_account
334
+    mark_admin_user_account
332 335
 
333
-	function_check enforce_good_passwords
334
-	enforce_good_passwords
336
+    function_check enforce_good_passwords
337
+    enforce_good_passwords
335 338
 
336
-	function_check install_editor
337
-	install_editor
339
+    function_check install_editor
340
+    install_editor
338 341
 
339
-	function_check change_login_message
340
-	change_login_message
342
+    function_check change_login_message
343
+    change_login_message
341 344
 
342
-	function_check enable_zram
343
-	enable_zram
345
+    function_check enable_zram
346
+    enable_zram
344 347
 
345
-	function_check random_number_generator
346
-	random_number_generator
348
+    function_check random_number_generator
349
+    random_number_generator
347 350
 
348
-	function_check set_your_domain_name
349
-	set_your_domain_name
351
+    function_check set_your_domain_name
352
+    set_your_domain_name
350 353
 
351
-	function_check time_synchronisation_tlsdate
352
-	time_synchronisation_tlsdate
354
+    function_check time_synchronisation_tlsdate
355
+    time_synchronisation_tlsdate
353 356
 
354
-	function_check configure_internet_protocol
355
-	configure_internet_protocol
357
+    function_check configure_internet_protocol
358
+    configure_internet_protocol
356 359
 
357
-	function_check create_git_project
358
-	create_git_project
360
+    function_check create_git_project
361
+    create_git_project
359 362
 
360
-	function_check setup_wifi
361
-	setup_wifi
363
+    function_check setup_wifi
364
+    setup_wifi
362 365
 
363
-	function_check configure_ssh
364
-	configure_ssh
366
+    function_check configure_ssh
367
+    configure_ssh
365 368
 
366
-	function_check configure_ssh_onion
367
-	configure_ssh_onion
369
+    function_check configure_ssh_onion
370
+    configure_ssh_onion
368 371
 
369
-	function_check allow_ssh_to_onion_address
370
-	allow_ssh_to_onion_address
372
+    function_check allow_ssh_to_onion_address
373
+    allow_ssh_to_onion_address
371 374
 
372
-	function_check remove_instructions_from_motd
373
-	remove_instructions_from_motd
375
+    function_check remove_instructions_from_motd
376
+    remove_instructions_from_motd
374 377
 
375
-	function_check check_hwrng
376
-	check_hwrng
378
+    function_check check_hwrng
379
+    check_hwrng
377 380
 
378
-	function_check search_for_attached_usb_drive
379
-	search_for_attached_usb_drive
381
+    function_check search_for_attached_usb_drive
382
+    search_for_attached_usb_drive
380 383
 
381
-	function_check regenerate_ssh_keys
382
-	regenerate_ssh_keys
384
+    function_check regenerate_ssh_keys
385
+    regenerate_ssh_keys
383 386
 
384
-	function_check create_mirrors
385
-	create_mirrors
387
+    function_check create_mirrors
388
+    create_mirrors
386 389
 
387
-	function_check create_upgrade_script
388
-	create_upgrade_script
390
+    function_check create_upgrade_script
391
+    create_upgrade_script
389 392
 
390
-	function_check letsencrypt_renewals
391
-	letsencrypt_renewals
393
+    function_check letsencrypt_renewals
394
+    letsencrypt_renewals
392 395
 
393
-	function_check install_watchdog_script
394
-	install_watchdog_script
396
+    function_check install_watchdog_script
397
+    install_watchdog_script
395 398
 
396
-	function_check install_avahi
397
-	install_avahi
399
+    function_check install_avahi
400
+    install_avahi
398 401
 
399
-	function_check create_avahi_onion_domains
400
-	create_avahi_onion_domains
402
+    function_check create_avahi_onion_domains
403
+    create_avahi_onion_domains
401 404
 
402
-	#function_check install_atheros_wifi
403
-	#install_atheros_wifi
405
+    #function_check install_atheros_wifi
406
+    #install_atheros_wifi
404 407
 
405
-	function_check route_outgoing_traffic_through_tor
406
-	route_outgoing_traffic_through_tor
408
+    function_check route_outgoing_traffic_through_tor
409
+    route_outgoing_traffic_through_tor
407 410
 
408
-	function_check upgrade_golang
409
-	upgrade_golang
411
+    function_check upgrade_golang
412
+    upgrade_golang
410 413
 
411
-	function_check install_tomb
412
-	install_tomb
414
+    function_check install_tomb
415
+    install_tomb
413 416
 }
414 417
 
415 418
 function setup_email {
416
-	function_check create_completion_file
417
-	create_completion_file
419
+    function_check create_completion_file
420
+    create_completion_file
418 421
 
419
-	function_check install_email
420
-	install_email
422
+    function_check install_email
423
+    install_email
421 424
 
422
-	function_check create_procmail
423
-	create_procmail
425
+    function_check create_procmail
426
+    create_procmail
424 427
 
425
-	function_check handle_admin_emails
426
-	handle_admin_emails
428
+    function_check handle_admin_emails
429
+    handle_admin_emails
427 430
 
428
-	function_check spam_filtering
429
-	spam_filtering
431
+    function_check spam_filtering
432
+    spam_filtering
430 433
 
431
-	function_check configure_imap
432
-	configure_imap
434
+    function_check configure_imap
435
+    configure_imap
433 436
 
434
-	#function_check configure_imap_client_certs
435
-	#configure_imap_client_certs
437
+    #function_check configure_imap_client_certs
438
+    #configure_imap_client_certs
436 439
 
437
-	function_check configure_gpg
438
-	configure_gpg
440
+    function_check configure_gpg
441
+    configure_gpg
439 442
 
440
-	function_check refresh_gpg_keys
441
-	refresh_gpg_keys
443
+    function_check refresh_gpg_keys
444
+    refresh_gpg_keys
442 445
 
443
-	function_check configure_backup_key
444
-	configure_backup_key
446
+    function_check configure_backup_key
447
+    configure_backup_key
445 448
 
446
-	function_check install_monkeysphere
447
-	install_monkeysphere
449
+    function_check install_monkeysphere
450
+    install_monkeysphere
448 451
 
449
-	function_check encrypt_incoming_email
450
-	encrypt_incoming_email
452
+    function_check encrypt_incoming_email
453
+    encrypt_incoming_email
451 454
 
452
-	function_check encrypt_outgoing_email
453
-	encrypt_outgoing_email
455
+    function_check encrypt_outgoing_email
456
+    encrypt_outgoing_email
454 457
 
455
-	function_check email_client
456
-	email_client
458
+    function_check email_client
459
+    email_client
457 460
 
458
-	function_check email_archiving
459
-	email_archiving
461
+    function_check email_archiving
462
+    email_archiving
460 463
 
461
-	function_check email_from_address
462
-	email_from_address
464
+    function_check email_from_address
465
+    email_from_address
463 466
 
464
-	function_check create_public_mailing_list
465
-	create_public_mailing_list
467
+    function_check create_public_mailing_list
468
+    create_public_mailing_list
466 469
 
467
-	#function check create_private_mailing_list
468
-	#create_private_mailing_list
470
+    #function check create_private_mailing_list
471
+    #create_private_mailing_list
469 472
 
470
-	function_check encrypt_all_email
471
-	encrypt_all_email
473
+    function_check encrypt_all_email
474
+    encrypt_all_email
472 475
 
473
-	function_check import_email
474
-	import_email
476
+    function_check import_email
477
+    import_email
475 478
 }
476 479
 
477 480
 function setup_web {
478
-	function_check create_completion_file
479
-	create_completion_file
481
+    function_check create_completion_file
482
+    create_completion_file
480 483
 
481
-	function_check install_web_server
482
-	install_web_server
484
+    function_check install_web_server
485
+    install_web_server
483 486
 
484
-	function_check install_web_server_access_control
485
-	install_web_server_access_control
487
+    function_check install_web_server_access_control
488
+    install_web_server_access_control
486 489
 }
487 490
 
488 491
 function upgrade_apps {
489
-	function_check create_completion_file
490
-	create_completion_file
491
-
492
-	APPS_COMPLETED=()
493
-	FILES=/usr/share/${PROJECT_NAME}/apps/${PROJECT_NAME}-app-*
494
-
495
-	# for all the app scripts
496
-	for filename in $FILES
497
-	do
498
-		app_name=$(echo "${filename}" | awk -F '-app-' '{print $2}')
499
-		if [[ $(item_in_array ${app_name} ${APPS_COMPLETED[@]}) != 0 ]]; then
500
-			function_check app_is_installed
501
-			if [[ "$(app_is_installed $a)" == "1" ]]; then
502
-				APPS_COMPLETED+=("${app_name}")
503
-				function_check upgrade_${app_name}
504
-				upgrade_${app_name}
505
-			fi
506
-		fi
507
-	done
492
+    function_check create_completion_file
493
+    create_completion_file
494
+
495
+    APPS_COMPLETED=()
496
+    FILES=/usr/share/${PROJECT_NAME}/apps/${PROJECT_NAME}-app-*
497
+
498
+    # for all the app scripts
499
+    for filename in $FILES
500
+    do
501
+        app_name=$(echo "${filename}" | awk -F '-app-' '{print $2}')
502
+        if [[ $(item_in_array ${app_name} ${APPS_COMPLETED[@]}) != 0 ]]; then
503
+            function_check app_is_installed
504
+            if [[ "$(app_is_installed $a)" == "1" ]]; then
505
+                APPS_COMPLETED+=("${app_name}")
506
+                function_check upgrade_${app_name}
507
+                upgrade_${app_name}
508
+            fi
509
+        fi
510
+    done
508 511
 }
509 512
 
510 513
 function setup_apps {
511
-	function_check create_completion_file
512
-	create_completion_file
514
+    function_check create_completion_file
515
+    create_completion_file
513 516
 
514
-	function_check choose_apps_for_variant
515
-	choose_apps_for_variant "$SYSTEM_TYPE"
517
+    function_check choose_apps_for_variant
518
+    choose_apps_for_variant "$SYSTEM_TYPE"
516 519
 
517
-	echo $"System variant: $SYSTEM_TYPE"
518
-	echo $'The following apps have been selected'
519
-	echo ''
520
-	function_check list_chosen_apps
521
-	list_chosen_apps
522
-	echo ''
520
+    echo $"System variant: $SYSTEM_TYPE"
521
+    echo $'The following apps have been selected'
522
+    echo ''
523
+    function_check list_chosen_apps
524
+    list_chosen_apps
525
+    echo ''
523 526
 
524
-	function_check upgrade_apps
525
-	upgrade_apps
527
+    function_check upgrade_apps
528
+    upgrade_apps
526 529
 
527
-	function_check install_apps
528
-	install_apps
530
+    function_check install_apps
531
+    install_apps
529 532
 }
530 533
 
531 534
 function combine_all_scripts {
532
-	combined_filename=$1
533
-
534
-	# initial variables
535
-	cp $PROJECT_INSTALL_DIR/${PROJECT_NAME}-vars $combined_filename
536
-
537
-	# utilities
538
-	UTILS_FILES=/usr/share/${PROJECT_NAME}/utils/${PROJECT_NAME}-utils-*
539
-	for f in $UTILS_FILES
540
-	do
541
-		# this removes the first line, which is #!/bin/bash
542
-		tail -n +2 "$f" >> $combined_filename
543
-	done
544
-
545
-	# base system
546
-	BASE_SYSTEM_FILES=/usr/share/${PROJECT_NAME}/base/${PROJECT_NAME}-base-*
547
-	for f in $BASE_SYSTEM_FILES
548
-	do
549
-		tail -n +2 "$f" >> $combined_filename
550
-	done
551
-
552
-	# apps
553
-	APP_FILES=/usr/share/${PROJECT_NAME}/apps/${PROJECT_NAME}-app-*
554
-	for f in $APP_FILES
555
-	do
556
-		tail -n +2 "$f" >> $combined_filename
557
-	done
535
+    combined_filename=$1
536
+
537
+    # initial variables
538
+    cp $PROJECT_INSTALL_DIR/${PROJECT_NAME}-vars $combined_filename
539
+
540
+    # utilities
541
+    UTILS_FILES=/usr/share/${PROJECT_NAME}/utils/${PROJECT_NAME}-utils-*
542
+    for f in $UTILS_FILES
543
+    do
544
+        # this removes the first line, which is #!/bin/bash
545
+        tail -n +2 "$f" >> $combined_filename
546
+    done
547
+
548
+    # base system
549
+    BASE_SYSTEM_FILES=/usr/share/${PROJECT_NAME}/base/${PROJECT_NAME}-base-*
550
+    for f in $BASE_SYSTEM_FILES
551
+    do
552
+        tail -n +2 "$f" >> $combined_filename
553
+    done
554
+
555
+    # apps
556
+    APP_FILES=/usr/share/${PROJECT_NAME}/apps/${PROJECT_NAME}-app-*
557
+    for f in $APP_FILES
558
+    do
559
+        tail -n +2 "$f" >> $combined_filename
560
+    done
558 561
 }
559 562
 
560 563
 # NOTE: deliberately no exit 0