Browse Source

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

Bob Mottram 8 years ago
parent
commit
1547479013
100 changed files with 3668 additions and 2219 deletions
  1. 5
    1
      Makefile
  2. 0
    41
      doc/EN/app_radicale.org
  3. 0
    34
      doc/EN/app_scuttlebot.org
  4. 0
    9
      doc/EN/apps.org
  5. 2
    0
      doc/EN/beaglebone.org
  6. 2
    1
      doc/EN/debianinstall.org
  7. 10
    0
      doc/EN/devguide.org
  8. 6
    0
      doc/EN/faq.org
  9. 1
    1
      doc/EN/fediverse.org
  10. 3
    1
      doc/EN/homeserver.org
  11. 8
    7
      doc/EN/index.org
  12. 5
    2
      doc/EN/installation.org
  13. 52
    34
      doc/EN/mesh.org
  14. 73
    0
      doc/EN/release3.org
  15. 1
    1
      doc/EN/support.org
  16. BIN
      image_build/bbb-4.9.0.tar.gz
  17. 153
    153
      image_build/debootstrap/scripts/stretch
  18. BIN
      img/gnusocial_sprite.png
  19. BIN
      img/postactiv_sprite.png
  20. BIN
      img/release3.jpg
  21. BIN
      man/freedombone-image.1.gz
  22. BIN
      man/freedombone.1.gz
  23. 13
    1
      src/freedombone
  24. 3
    7
      src/freedombone-addcert
  25. 6
    2
      src/freedombone-addremove
  26. 22
    20
      src/freedombone-adduser
  27. 8
    0
      src/freedombone-app-batman
  28. 24
    2
      src/freedombone-app-cryptpad
  29. 8
    0
      src/freedombone-app-dlna
  30. 205
    132
      src/freedombone-app-dokuwiki
  31. 11
    3
      src/freedombone-app-emacs
  32. 43
    5
      src/freedombone-app-etherpad
  33. 47
    12
      src/freedombone-app-friendica
  34. 125
    6
      src/freedombone-app-ghost
  35. 159
    232
      src/freedombone-app-gnusocial
  36. 39
    2
      src/freedombone-app-gogs
  37. 33
    9
      src/freedombone-app-htmly
  38. 61
    17
      src/freedombone-app-hubzilla
  39. 23
    3
      src/freedombone-app-ipfs
  40. 14
    2
      src/freedombone-app-irc
  41. 13
    5
      src/freedombone-app-jitsi
  42. 61
    17
      src/freedombone-app-koel
  43. 26
    14
      src/freedombone-app-librevault
  44. 34
    10
      src/freedombone-app-lychee
  45. 30
    10
      src/freedombone-app-mailpile
  46. 61
    8
      src/freedombone-app-matrix
  47. 29
    7
      src/freedombone-app-mediagoblin
  48. 44
    7
      src/freedombone-app-movim
  49. 16
    0
      src/freedombone-app-mumble
  50. 65
    18
      src/freedombone-app-nextcloud
  51. 8
    1
      src/freedombone-app-pelican
  52. 28
    1
      src/freedombone-app-pihole
  53. 157
    65
      src/freedombone-app-postactiv
  54. 36
    3
      src/freedombone-app-profanity
  55. 14
    2
      src/freedombone-app-radicale
  56. 31
    6
      src/freedombone-app-riot
  57. 78
    15
      src/freedombone-app-rss
  58. 11
    1
      src/freedombone-app-scuttlebot
  59. 50
    7
      src/freedombone-app-searx
  60. 10
    2
      src/freedombone-app-sip
  61. 20
    4
      src/freedombone-app-syncthing
  62. 84
    88
      src/freedombone-app-tahoelafs
  63. 68
    16
      src/freedombone-app-tox
  64. 45
    5
      src/freedombone-app-turtl
  65. 8
    0
      src/freedombone-app-vim
  66. 8
    0
      src/freedombone-app-vpn
  67. 29
    13
      src/freedombone-app-xmpp
  68. 18
    1
      src/freedombone-app-zeronet
  69. 37
    0
      src/freedombone-backup-local
  70. 20
    2
      src/freedombone-backup-remote
  71. 69
    106
      src/freedombone-base-email
  72. 1
    1
      src/freedombone-client
  73. 126
    62
      src/freedombone-config
  74. 161
    157
      src/freedombone-controlpanel
  75. 10
    6
      src/freedombone-controlpanel-user
  76. 23
    7
      src/freedombone-freedns
  77. 19
    2
      src/freedombone-image
  78. 234
    127
      src/freedombone-image-customise
  79. 32
    35
      src/freedombone-image-hardware-setup
  80. 5
    1
      src/freedombone-image-make
  81. 1
    1
      src/freedombone-image-makefile
  82. 14
    4
      src/freedombone-image-mesh
  83. 126
    72
      src/freedombone-keydrive
  84. 98
    82
      src/freedombone-logging
  85. 15
    22
      src/freedombone-mesh
  86. 3
    2
      src/freedombone-mesh-batman
  87. 2
    7
      src/freedombone-mesh-install
  88. 0
    288
      src/freedombone-mirrors
  89. 10
    6
      src/freedombone-pass
  90. 49
    0
      src/freedombone-prepare-scripts
  91. 3
    14
      src/freedombone-recoverkey
  92. 1
    1
      src/freedombone-renew-cert
  93. 100
    45
      src/freedombone-restore-local
  94. 73
    39
      src/freedombone-restore-remote
  95. 1
    1
      src/freedombone-rmuser
  96. 4
    4
      src/freedombone-sec
  97. 40
    11
      src/freedombone-splitkey
  98. 23
    0
      src/freedombone-syncthing
  99. 121
    48
      src/freedombone-tests
  100. 0
    0
      src/freedombone-upgrade

+ 5
- 1
Makefile View File

27
 	cp img/backgrounds/${APP}_*.png ${DESTDIR}${PREFIX}/share
27
 	cp img/backgrounds/${APP}_*.png ${DESTDIR}${PREFIX}/share
28
 	cp img/avatars/* ${DESTDIR}/usr/share/${APP}/avatars
28
 	cp img/avatars/* ${DESTDIR}/usr/share/${APP}/avatars
29
 	cp src/* ${DESTDIR}${PREFIX}/bin
29
 	cp src/* ${DESTDIR}${PREFIX}/bin
30
-	cp src/${APP}-controlpanel ${DESTDIR}${PREFIX}/bin/control
30
+#	cp src/${APP}-controlpanel ${DESTDIR}${PREFIX}/bin/control
31
 	cp src/${APP}-mesh-batman ${DESTDIR}${PREFIX}/bin/batman
31
 	cp src/${APP}-mesh-batman ${DESTDIR}${PREFIX}/bin/batman
32
 	cp src/${APP}-backup-local ${DESTDIR}${PREFIX}/bin/backup
32
 	cp src/${APP}-backup-local ${DESTDIR}${PREFIX}/bin/backup
33
 	cp src/${APP}-backup-local ${DESTDIR}${PREFIX}/bin/backup2friends
33
 	cp src/${APP}-backup-local ${DESTDIR}${PREFIX}/bin/backup2friends
46
 	chown -R root: /usr/share/${APP}
46
 	chown -R root: /usr/share/${APP}
47
 	chmod -R +r /usr/share/${APP}
47
 	chmod -R +r /usr/share/${APP}
48
 #	bash -c "./translate install"
48
 #	bash -c "./translate install"
49
+	/usr/local/bin/${APP}-prepare-scripts
49
 uninstall:
50
 uninstall:
50
 	rm -f ${PREFIX}/share/${APP}_*.png
51
 	rm -f ${PREFIX}/share/${APP}_*.png
51
 	rm -f ${PREFIX}/share/man/man1/backup.1.gz
52
 	rm -f ${PREFIX}/share/man/man1/backup.1.gz
61
 	rm -f ${PREFIX}/bin/restorefromfriend
62
 	rm -f ${PREFIX}/bin/restorefromfriend
62
 	rm -f ${PREFIX}/bin/batman
63
 	rm -f ${PREFIX}/bin/batman
63
 	rm -rf /etc/${APP}
64
 	rm -rf /etc/${APP}
65
+	rm -f ${PREFIX}/bin/control
66
+	rm -f ${PREFIX}/bin/controluser
67
+	rm -f ${PREFIX}/bin/addremove
64
 	bash -c "./translate uninstall"
68
 	bash -c "./translate uninstall"
65
 clean:
69
 clean:
66
 	rm -f \#* \.#* debian/*.substvars debian/*.log src/*~
70
 	rm -f \#* \.#* debian/*.substvars debian/*.log src/*~

+ 0
- 41
doc/EN/app_radicale.org View File

1
-#+TITLE:
2
-#+AUTHOR: Bob Mottram
3
-#+EMAIL: bob@freedombone.net
4
-#+KEYWORDS: freedombone, radicale
5
-#+DESCRIPTION: How to use Radicale
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
-<h1>Radicale</h1>
16
-</center>
17
-#+END_EXPORT
18
-
19
-Radicale is a calendar server which allows your to synchronise your calendar across all your devices. Support for CalDAV within various client systems can be quite patchy/flaky though, so use it with caution.
20
-
21
-* Installation
22
-Log into your system with:
23
-
24
-#+begin_src bash
25
-ssh myusername@mydomain -p 2222
26
-#+end_src
27
-
28
-Using cursor keys, space bar and Enter key select *Administrator controls* and type in your password.
29
-
30
-Select *Add/Remove Apps* then *radicale*. If you don't already have an SSL/TLS certificate for your main domain then go to the security settings and create a new Let's Encrypt cert for it. That will ensure that your calendar events have some minimal level of protection from passive surveillance.
31
-
32
-* Setting up on Android
33
-Via F-droid install *DAVdroid*.
34
-
35
-There seems to be a problem with Let's Encrypt certificates with this app, but it's possible to get around it. Open DAVdroid and select the side *menu* followed by *Settings*. Enable *Distrust system certificates* and press *Reset untrusted certificates*.
36
-
37
-Exit from settings and press the *plus button* to add an account. Select *Login with URL and user name*. The URL should be https://yourmaindomainname/radicale/. Remember to include the trailing slash on the URL. If you installed Freedombone from a disk image then enter your username and the password which was shown at the start of installation. If not then the password for Radicale will be within *Passwords* section of the *Administrator control panel*.
38
-
39
-You will be prompted to approve the Let's Encrypt cerificate for your domain name, and once that's done then you should see your account as a large yellow box. Press on that and ensure that *Addresses* and *calendar* are selected.
40
-
41
-Now go to your calendar app and press the plus icon to add an event. You should notice that the calendar account selected is your username on the Freedombone system.

+ 0
- 34
doc/EN/app_scuttlebot.org View File

1
-#+TITLE:
2
-#+AUTHOR: Bob Mottram
3
-#+EMAIL: bob@freedombone.net
4
-#+KEYWORDS: freedombone, scuttlebot
5
-#+DESCRIPTION: How to use Scuttlebot
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
-<h1>Scuttlebot</h1>
16
-</center>
17
-#+END_EXPORT
18
-
19
-This is a type of /followbot/ for the [[https://www.scuttlebutt.nz][Secure Scuttlebutt]] peer-to-peer messaging system. It's purpose is to follow your friends and keep a log of their messages so that if you are offline for a while when you return you can sync with this system to get all of the missed messages. This avoid the problem common in messaging systems of /everyone needing to be online all of the time/.
20
-
21
-The Secure Scuttlebutt system has message encryption, but no protection of the metadata. It lives only on the clearnet. So this system is more about ensuring that messages get correctly delivered and appear in the right chronological order in unreliable situations where network availability may be intermittent, rather than defending against surveillance adversaries.
22
-
23
-* Installation
24
-Log into your system with:
25
-
26
-#+begin_src bash
27
-ssh myusername@mydomain -p 2222
28
-#+end_src
29
-
30
-Using cursor keys, space bar and Enter key select *Administrator controls* and type in your password.
31
-
32
-Select *Add/Remove Apps*. If Vim is selected then you might want to unselect and uninstall it first, then select *scuttlebot*.
33
-
34
-Install your favourite Scuttlebutt client onto your laptop, then select *Join Pub*. ssh into your Freedombone system and go to the *Administrator control panel* then select *App settings* followed by *scuttlebot*. You can then create an invite and paste it into your client.

+ 0
- 9
doc/EN/apps.org View File

115
 A shell based XMPP client which you can run on the Freedombone server via ssh.
115
 A shell based XMPP client which you can run on the Freedombone server via ssh.
116
 
116
 
117
 [[./app_profanity.html][How to use it]]
117
 [[./app_profanity.html][How to use it]]
118
-* Radicale
119
-Calendar system compatible with CalDAV and CardDAV. Synch your calendar events easily and securely across all your devices.
120
-
121
-[[./app_radicale.html][How to use it]]
122
 * Riot Web
118
 * Riot Web
123
 A browser based user interface for the Matrix federated communications system, including WebRTC audio and video chat.
119
 A browser based user interface for the Matrix federated communications system, including WebRTC audio and video chat.
124
 
120
 
125
 [[./app_riot.html][How to use it]]
121
 [[./app_riot.html][How to use it]]
126
-* Scuttlebot
127
-A pub service to help synchronize your messages.
128
-
129
-
130
-[[./app_scuttlebot.html][How to use it]]
131
 * SearX
122
 * SearX
132
 A metasearch engine for customised and private web searches.
123
 A metasearch engine for customised and private web searches.
133
 
124
 

+ 2
- 0
doc/EN/beaglebone.org View File

41
 sudo apt-get install git
41
 sudo apt-get install git
42
 git clone https://github.com/bashrc/freedombone
42
 git clone https://github.com/bashrc/freedombone
43
 cd freedombone
43
 cd freedombone
44
+git checkout stretch
44
 sudo make install
45
 sudo make install
45
 freedombone-image --setup debian
46
 freedombone-image --setup debian
46
 #+end_src
47
 #+end_src
51
 sudo pacman -S git
52
 sudo pacman -S git
52
 git clone https://github.com/bashrc/freedombone
53
 git clone https://github.com/bashrc/freedombone
53
 cd freedombone
54
 cd freedombone
55
+git checkout stretch
54
 sudo make install
56
 sudo make install
55
 freedombone-image --setup parabola
57
 freedombone-image --setup parabola
56
 #+end_src
58
 #+end_src

+ 2
- 1
doc/EN/debianinstall.org View File

18
 
18
 
19
 Although the image builder supports a variety of architectures there may still be some which aren't supported. These especially include systems which have a proprietary boot blob, such as the Raspberry Pi boards.
19
 Although the image builder supports a variety of architectures there may still be some which aren't supported. These especially include systems which have a proprietary boot blob, such as the Raspberry Pi boards.
20
 
20
 
21
-It's still possible to install the system onto these unsupported devices if you need to. First you'll need to ensure that you have *Debian Jessie* installed and can get ssh access to the system. Then either via ssh, or directly on the target device in the case of an old laptop or netbook:
21
+It's still possible to install the system onto these unsupported devices if you need to. First you'll need to ensure that you have *Debian Stretch* installed and can get ssh access to the system. Then either via ssh, or directly on the target device in the case of an old laptop or netbook:
22
 
22
 
23
 #+BEGIN_SRC bash
23
 #+BEGIN_SRC bash
24
 su
24
 su
26
 apt-get -qy install build-essential git dialog
26
 apt-get -qy install build-essential git dialog
27
 git clone https://github.com/bashrc/freedombone
27
 git clone https://github.com/bashrc/freedombone
28
 cd freedombone
28
 cd freedombone
29
+git checkout stretch
29
 make install
30
 make install
30
 freedombone makeconfig
31
 freedombone makeconfig
31
 #+END_SRC
32
 #+END_SRC

+ 10
- 0
doc/EN/devguide.org View File

89
                      MYAPPNAME_ONION_PORT
89
                      MYAPPNAME_ONION_PORT
90
                      MYAPPNAME_DB_PASSWORD)
90
                      MYAPPNAME_DB_PASSWORD)
91
 
91
 
92
+function logging_on_myappname {
93
+    echo -n ''
94
+    # Commands to turn on logging go here
95
+}
96
+
97
+function logging_off_myappname {
98
+    echo -n ''
99
+    # Commands to turn off logging go here
100
+}
101
+
92
 function change_password_myappname {
102
 function change_password_myappname {
93
     PASSWORD_USERNAME="$1"
103
     PASSWORD_USERNAME="$1"
94
     PASSWORD_NEW="$2"
104
     PASSWORD_NEW="$2"

+ 6
- 0
doc/EN/faq.org View File

46
 | [[Why does my email keep getting rejected as spam by Gmail/etc?]]                             |
46
 | [[Why does my email keep getting rejected as spam by Gmail/etc?]]                             |
47
 | [[Tor is censored/blocked in my area. What can I do?]]                                        |
47
 | [[Tor is censored/blocked in my area. What can I do?]]                                        |
48
 | [[I want to block a particular domain from getting its content into my social network sites]] |
48
 | [[I want to block a particular domain from getting its content into my social network sites]] |
49
+| [[The mesh system doesn't boot from USB drive]]                                               |
49
 
50
 
50
 #+END_CENTER
51
 #+END_CENTER
51
 
52
 
332
 #+end_src
333
 #+end_src
333
 
334
 
334
 Select /Administrator controls/ then /Domain blocking/.
335
 Select /Administrator controls/ then /Domain blocking/.
336
+
337
+* The mesh system doesn't boot from USB drive
338
+If the system doesn't boot and reports an error which includes */dev/mapper/loop0p1* then reboot with *Ctrl-Alt-Del* and when you see the grub menu press *e* and manually change */dev/mapper/loop0p1* to */dev/sdb1*, then press *Ctrl-x*. If that doesn't work then reboot and try */dev/sdc1* instead.
339
+
340
+After the system has booted successfully the problem should resolve itself on subsequent reboots.

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

39
 
39
 
40
 
40
 
41
 #+BEGIN_CENTER
41
 #+BEGIN_CENTER
42
-This site can also be accessed via a Tor browser at http://2tp3f6vtvhkqpuc6.onion. This documentation is under the [[https://www.gnu.org/licenses/fdl-1.3.txt][GNU Free Documentation License version 1.3]]
42
+This site can also be accessed via a Tor browser at http://pazyv7nkllp76hqr.onion. This documentation is under the [[https://www.gnu.org/licenses/fdl-1.3.txt][GNU Free Documentation License version 1.3]]
43
 #+END_CENTER
43
 #+END_CENTER

+ 3
- 1
doc/EN/homeserver.org View File

23
 sudo apt-get install git
23
 sudo apt-get install git
24
 git clone https://github.com/bashrc/freedombone
24
 git clone https://github.com/bashrc/freedombone
25
 cd freedombone
25
 cd freedombone
26
+git checkout stretch
26
 sudo make install
27
 sudo make install
27
 freedombone-image --setup debian
28
 freedombone-image --setup debian
28
 freedombone-image -t i386 --onion yes
29
 freedombone-image -t i386 --onion yes
34
 sudo pacman -S git
35
 sudo pacman -S git
35
 git clone https://github.com/bashrc/freedombone
36
 git clone https://github.com/bashrc/freedombone
36
 cd freedombone
37
 cd freedombone
38
+git checkout stretch
37
 sudo make install
39
 sudo make install
38
 freedombone-image --setup parabola
40
 freedombone-image --setup parabola
39
 freedombone-image -t i386 --onion yes
41
 freedombone-image -t i386 --onion yes
148
 #+end_src
150
 #+end_src
149
 
151
 
150
 #+BEGIN_CENTER
152
 #+BEGIN_CENTER
151
-This site can also be accessed via a Tor browser at http://2tp3f6vtvhkqpuc6.onion
153
+This site can also be accessed via a Tor browser at http://pazyv7nkllp76hqr.onion
152
 #+END_CENTER
154
 #+END_CENTER

+ 8
- 7
doc/EN/index.org View File

16
 -- Lucas Nussbaum
16
 -- Lucas Nussbaum
17
 #+end_quote
17
 #+end_quote
18
 
18
 
19
-#+BEGIN_CENTER
20
-[[file:images/beaglebone_logo.jpg]]
21
-#+END_CENTER
19
+
20
+#+BEGIN_EXPORT html
21
+<center>
22
+<h1><a href="./release3.html">New version 3 (Stretch)</a></h1>
23
+</center>
24
+#+END_EXPORT
22
 
25
 
23
 So you want to run your own internet services? Email, chat, VoIP, web sites, file synchronisation, wikis, blogs, social networks, media hosting, backups. Freedombone enables you to do all of that in a self-hosted way, where you keep control of your data and it resides in your own home.
26
 So you want to run your own internet services? Email, chat, VoIP, web sites, file synchronisation, wikis, blogs, social networks, media hosting, backups. Freedombone enables you to do all of that in a self-hosted way, where you keep control of your data and it resides in your own home.
24
 
27
 
28
 
31
 
29
 Or you can install [[./debianinstall.html][onto an existing Debian system]].
32
 Or you can install [[./debianinstall.html][onto an existing Debian system]].
30
 
33
 
31
-Want to make a community mesh network which doesn't depend upon the internet?
32
-
33
-[[./mesh.html][You can do that too]].
34
+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.
34
 
35
 
35
 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.
36
 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.
36
 
37
 
45
 Ready made disk images which can be copied onto USB or microSD drives are [[./downloads][available here]] and also [[http://www.postactiv.com/freedombone/2.00/index.html][mirrored here]].
46
 Ready made disk images which can be copied onto USB or microSD drives are [[./downloads][available here]] and also [[http://www.postactiv.com/freedombone/2.00/index.html][mirrored here]].
46
 
47
 
47
 #+BEGIN_CENTER
48
 #+BEGIN_CENTER
48
-This site can also be accessed via a Tor browser at http://2tp3f6vtvhkqpuc6.onion. This documentation is under the [[https://www.gnu.org/licenses/fdl-1.3.txt][GNU Free Documentation License version 1.3]]
49
+This site can also be accessed via a Tor browser at http://pazyv7nkllp76hqr.onion. This documentation is under the [[https://www.gnu.org/licenses/fdl-1.3.txt][GNU Free Documentation License version 1.3]]
49
 #+END_CENTER
50
 #+END_CENTER

+ 5
- 2
doc/EN/installation.org View File

35
 sudo apt-get install git build-essential dialog
35
 sudo apt-get install git build-essential dialog
36
 git clone https://github.com/bashrc/freedombone
36
 git clone https://github.com/bashrc/freedombone
37
 cd freedombone
37
 cd freedombone
38
+git checkout stretch
38
 sudo make install
39
 sudo make install
39
 #+END_SRC
40
 #+END_SRC
40
 
41
 
80
 Before installing Freedombone you will need a few things.
81
 Before installing Freedombone you will need a few things.
81
 
82
 
82
   * Have some domains, or subdomains, registered with a dynamic DNS service. For the full install you may need two "official" purchased domains or be using a subdomain provider which is supported by Let's Encrypt.
83
   * Have some domains, or subdomains, registered with a dynamic DNS service. For the full install you may need two "official" purchased domains or be using a subdomain provider which is supported by Let's Encrypt.
83
-  * System with a new installation of Debian Jessie or a downloaded/prepared disk image
84
+  * System with a new installation of Debian Stretch or a downloaded/prepared disk image
84
   * Ethernet connection between the system and your internet router
85
   * Ethernet connection between the system and your internet router
85
   * That it is possible to forward ports from the internet router to the system, typically via firewall settings
86
   * That it is possible to forward ports from the internet router to the system, typically via firewall settings
86
   * Have ssh access to the system, typically via fbone@freedombone.local on port 2222
87
   * Have ssh access to the system, typically via fbone@freedombone.local on port 2222
88
 There are three install options: Laptop/Desktop/Netbook, SBC and Virtual Machine.
89
 There are three install options: Laptop/Desktop/Netbook, SBC and Virtual Machine.
89
 
90
 
90
 ** On a Laptop, Netbook or Desktop machine
91
 ** On a Laptop, Netbook or Desktop machine
91
-If you have an existing system, such as an old laptop or netbook which you can leave running as a server, then install a new version of Debian Jessie onto it. During the Debian install you won't need the print server or the desktop environment, and unchecking those will reduce the attack surface. Once Debian enter the following commands:
92
+If you have an existing system, such as an old laptop or netbook which you can leave running as a server, then install a new version of Debian Stretch onto it. During the Debian install you won't need the print server or the desktop environment, and unchecking those will reduce the attack surface. Once Debian enter the following commands:
92
 
93
 
93
 #+BEGIN_SRC bash
94
 #+BEGIN_SRC bash
94
 su
95
 su
96
 apt-get -y install git dialog build-essential
97
 apt-get -y install git dialog build-essential
97
 git clone https://github.com/bashrc/freedombone
98
 git clone https://github.com/bashrc/freedombone
98
 cd freedombone
99
 cd freedombone
100
+git checkout stretch
99
 make install
101
 make install
100
 freedombone menuconfig
102
 freedombone menuconfig
101
 #+END_SRC
103
 #+END_SRC
223
 sudo apt-get install git dialog haveged build-essential
225
 sudo apt-get install git dialog haveged build-essential
224
 git clone https://github.com/bashrc/freedombone
226
 git clone https://github.com/bashrc/freedombone
225
 cd freedombone
227
 cd freedombone
228
+git checkout stretch
226
 sudo make install
229
 sudo make install
227
 freedombone-client
230
 freedombone-client
228
 #+END_SRC
231
 #+END_SRC

+ 52
- 34
doc/EN/mesh.org View File

22
 | [[What the system can do]] | - | [[Disk Images]] | - | [[Building Disk Images]] | - | [[How to use it]] |
22
 | [[What the system can do]] | - | [[Disk Images]] | - | [[Building Disk Images]] | - | [[How to use it]] |
23
 |------------------------+---+-------------+---+----------------------+---+---------------|
23
 |------------------------+---+-------------+---+----------------------+---+---------------|
24
 
24
 
25
+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.
26
+
25
 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.
27
 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.
26
 
28
 
27
 * What the system can do
29
 * What the system can do
41
 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.
43
 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.
42
 
44
 
43
 * Disk Images
45
 * Disk Images
46
+** Writing many images quickly
47
+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 *dd* command is used for writing to the target drive, but to write to multiple drives you can use a tool such as [[https://wiki.gnome.org/Apps/MultiWriter][GNOME MultiWriter]].
48
+
49
+For example on Arch/Parabola:
50
+
51
+#+begin_src bash
52
+sudo pacman -S gnome-multi-writer
53
+#+end_src
54
+
55
+Or on Debian based systems:
56
+
57
+#+begin_src bash
58
+sudo apt-get install gnome-multi-writer
59
+#+end_src
44
 ** Client images
60
 ** Client images
45
 
61
 
46
 #+BEGIN_CENTER
62
 #+BEGIN_CENTER
51
 
67
 
52
 #+begin_src bash
68
 #+begin_src bash
53
 sudo apt-get install xz-utils wget
69
 sudo apt-get install xz-utils wget
54
-wget https://freedombone.net/downloads/v2.00/freedombone-meshclient-2.00_all-i386.img.xz
55
-wget https://freedombone.net/downloads/v2.00/freedombone-meshclient-2.00_all-i386.img.xz.sig
56
-gpg --verify freedombone-meshclient-2.00_all-i386.img.xz.sig
57
-sha256sum freedombone-meshclient-2.00_all-i386.img.xz
58
-403cf1cc2bc5272e5921d3ebefc351540928141bc65641b6d16f2262a933cb4e
59
-unxz freedombone-meshclient-2.00_all-i386.img.xz
60
-sudo dd bs=1M if=freedombone-meshclient-2.00_all-i386.img of=/dev/sdX conv=fdatasync
70
+wget https://freedombone.net/downloads/v3/freedombone-meshclient-3_all-i386.img.xz
71
+wget https://freedombone.net/downloads/v3/freedombone-meshclient-3_all-i386.img.xz.sig
72
+gpg --verify freedombone-meshclient-3_all-i386.img.xz.sig
73
+sha256sum freedombone-meshclient-3_all-i386.img.xz
74
+74f9eaad479f84d3bf9cb002067074d35a97028145e781c5746c74577f777ee5
75
+unxz freedombone-meshclient-3_all-i386.img.xz
76
+sudo dd bs=1M if=freedombone-meshclient-3_all-i386.img of=/dev/sdX conv=fdatasync
61
 #+end_src
77
 #+end_src
62
 
78
 
63
 To get a number of systems onto the mesh repeat the /dd/ command to create however many bootable USB drives you need.
79
 To get a number of systems onto the mesh repeat the /dd/ command to create however many bootable USB drives you need.
66
 
82
 
67
 #+begin_src bash
83
 #+begin_src bash
68
 sudo apt-get install xz-utils wget
84
 sudo apt-get install xz-utils wget
69
-wget https://freedombone.net/downloads/v2.00/freedombone-meshclient-insecure-2.00_all-i386.img.xz
70
-wget https://freedombone.net/downloads/v2.00/freedombone-meshclient-insecure-2.00_all-i386.img.xz.sig
71
-gpg --verify freedombone-meshclient-insecure-2.00_all-i386.img.xz.sig
72
-sha256sum freedombone-meshclient-insecure-2.00_all-i386.img.xz
73
-7cda1a52acad7d18156ea238d7eb550479a5f882ac45c8cf9b9e56077fb26be9
74
-unxz freedombone-meshclient-insecure-2.00_all-i386.img.xz
75
-sudo dd bs=1M if=freedombone-meshclient-insecure-2.00_all-i386.img of=/dev/sdX conv=fdatasync
85
+wget https://freedombone.net/downloads/v3/freedombone-meshclient-insecure-3_all-i386.img.xz
86
+wget https://freedombone.net/downloads/v3/freedombone-meshclient-insecure-3_all-i386.img.xz.sig
87
+gpg --verify freedombone-meshclient-insecure-3_all-i386.img.xz.sig
88
+sha256sum freedombone-meshclient-insecure-3_all-i386.img.xz
89
+f1c5df24a4bfca47bd5c41dfd2568925e63a1abf83aecf0250480b4b8edc071d
90
+unxz freedombone-meshclient-insecure-3_all-i386.img.xz
91
+sudo dd bs=1M if=freedombone-meshclient-insecure-3_all-i386.img of=/dev/sdX conv=fdatasync
76
 #+end_src
92
 #+end_src
77
 
93
 
78
 ** Router images
94
 ** Router images
86
 
102
 
87
 #+begin_src bash
103
 #+begin_src bash
88
 sudo apt-get install xz-utils wget
104
 sudo apt-get install xz-utils wget
89
-wget https://freedombone.net/downloads/v2.00/freedombone-mesh-2.00_beaglebone-armhf.img.xz
90
-wget https://freedombone.net/downloads/v2.00/freedombone-mesh-2.00_beaglebone-armhf.img.xz.sig
91
-gpg --verify freedombone-mesh-2.00_beaglebone-armhf.img.xz.sig
92
-sha256sum freedombone-mesh-2.00_beaglebone-armhf.img.xz
93
-daf8c82f111ae8714cffc52633156554c23d5feafabbe85cb15925e0373a3ff4
94
-unxz freedombone-mesh-2.00_beaglebone-armhf.img.xz
95
-sudo dd bs=1M if=freedombone-mesh-2.00_beaglebone-armhf.img of=/dev/sdX conv=fdatasync
105
+wget https://freedombone.net/downloads/v3/freedombone-mesh-3_beaglebone-armhf.img.xz
106
+wget https://freedombone.net/downloads/v3/freedombone-mesh-3_beaglebone-armhf.img.xz.sig
107
+gpg --verify freedombone-mesh-3_beaglebone-armhf.img.xz.sig
108
+sha256sum freedombone-mesh-3_beaglebone-armhf.img.xz
109
+ab783ea807da1144bd076f7b43e54b5f4376ecf1ea1f86f56ac76c3469325802
110
+unxz freedombone-mesh-3_beaglebone-armhf.img.xz
111
+sudo dd bs=1M if=freedombone-mesh-3_beaglebone-armhf.img of=/dev/sdX conv=fdatasync
96
 #+end_src
112
 #+end_src
97
 
113
 
98
 If you have a few Beaglebone Blacks to use as routers then repeat the /dd/ command to create however many microSD cards you need.
114
 If you have a few Beaglebone Blacks to use as routers then repeat the /dd/ command to create however many microSD cards you need.
102
 * Building Disk Images
118
 * Building Disk Images
103
 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.
119
 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.
104
 
120
 
105
-First you will need to create an image. On a Debian based system (tested on Debian Jessie and Trisquel 7):
121
+First you will need to create an image. On a Debian based system (tested on Debian Stretch):
106
 
122
 
107
 #+begin_src bash
123
 #+begin_src bash
108
-sudo apt-get -y install build-essential libc6-dev-i386 wget \
109
-    gcc-multilib g++-multilib git python-docutils mktorrent \
110
-    vmdebootstrap xz-utils dosfstools btrfs-tools extlinux \
111
-    python-distro-info mbr qemu-user-static binfmt-support \
112
-    u-boot-tools qemu
113
-wget https://freedombone.net/downloads/freedombone-mesh-13-09-2016.tar.gz
114
-wget https://freedombone.net/downloads/freedombone-mesh-13-09-2016.tar.gz.sig
115
-gpg --verify freedombone-mesh-13-09-2016.tar.gz.sig
116
-sha256sum freedombone-mesh-13-09-2016.tar.gz
117
-3e279f8ed762afb682bec6bd463830087354dd2f24020f3b0de51143585ab0ed
118
-tar -xzvf freedombone-mesh-13-09-2016.tar.gz
124
+sudo apt-get -y install git wget build-essential
125
+wget https://freedombone.net/downloads/v3/freedombone-3.tar.gz
126
+wget https://freedombone.net/downloads/freedombone-3.tar.gz.sig
127
+gpg --verify freedombone-3.tar.gz.sig
128
+sha256sum freedombone-3.tar.gz
129
+b99853322871efd298a9efd78d22323e0e7424a5cdb5097b4cc55ef45a220ebb
130
+tar -xzvf freedombone-3.tar.gz
119
 cd freedombone
131
 cd freedombone
132
+git checkout stretch
120
 sudo make install
133
 sudo make install
134
+freedombone-image --setup debian
121
 freedombone-image -t i386 -v meshclient
135
 freedombone-image -t i386 -v meshclient
122
 #+end_src
136
 #+end_src
123
 
137
 
166
 
180
 
167
 After a minute or two if you are within wifi range and there is at least one other user on the network then you should see additional icons appear on the desktop, such as /Other Users/ and /Chat/.
181
 After a minute or two if you are within wifi range and there is at least one other user on the network then you should see additional icons appear on the desktop, such as /Other Users/ and /Chat/.
168
 
182
 
183
+** Boot trouble
184
+If the system doesn't boot and reports an error which includes */dev/mapper/loop0p1* then reboot with *Ctrl-Alt-Del* and when you see the grub menu press *e* and manually change */dev/mapper/loop0p1* to */dev/sdb1*, then press *Ctrl-x*. If that doesn't work then reboot and try */dev/sdc1* instead.
185
+
186
+After the system has booted successfully the problem should resolve itself on subsequent reboots.
169
 ** Set the Date
187
 ** Set the Date
170
 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.
188
 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.
171
 
189
 
240
 
258
 
241
 
259
 
242
 #+BEGIN_CENTER
260
 #+BEGIN_CENTER
243
-This site can also be accessed via a Tor browser at http://2tp3f6vtvhkqpuc6.onion
261
+This site can also be accessed via a Tor browser at http://pazyv7nkllp76hqr.onion
244
 #+END_CENTER
262
 #+END_CENTER

+ 73
- 0
doc/EN/release3.org View File

1
+#+TITLE:
2
+#+AUTHOR: Bob Mottram
3
+#+EMAIL: bob@freedombone.net
4
+#+KEYWORDS: freedombone
5
+#+DESCRIPTION: Version 3
6
+#+OPTIONS: ^:nil toc:nil
7
+#+HTML_HEAD: <link rel="stylesheet" type="text/css" href="freedombone.css" />
8
+
9
+#+BEGIN_CENTER
10
+[[file:images/release3.jpg]]
11
+#+END_CENTER
12
+
13
+#+BEGIN_EXPORT html
14
+<center>
15
+<h2>Building an internet run by the users, for the users</h2>
16
+</center>
17
+#+END_EXPORT
18
+
19
+The internet may still be mostly in the clutches of a few giant megacorporations and dubious governments with sketchy agendas, but it doesn't have to remain that way. With the third version of the Freedombone system there is now more scope than before to take back your privacy, have ownership of personal data and run your own online communities without undesirable intermediaries.
20
+
21
+Freedombone version 3 is based on Debian 9 (Stretch). It was released in July 2017 and includes:
22
+
23
+ * Faster initial setup
24
+ * More [[./apps.html][installable apps]], including CryptPad, Koel, NextCloud, PostActiv, Friendica and Matrix/RiotWeb
25
+ * Automated [[https://github.com/hardenedlinux/STIG-4-Debian][security tests]]
26
+ * Improved XMPP configuration for support of the [[https://conversations.im][Conversations]] app features
27
+ * Improved blocking controls for a better federated network experience
28
+ * Uses [[https://en.wikipedia.org/wiki/EdDSA][elliptic curve]] based GPG keys for better performance on low power single board computers
29
+ * Pre-downloaded repos distributed within images for faster and more autonomous app installs
30
+
31
+* Installation
32
+
33
+The simplest way to install is from a pre-made disk image. Images can be [[https://freedombone.net/downloads/v3][downloaded here]]. You will need to have previously obtained a domain name and have a dynamic DNS account somewhere.
34
+
35
+Copy the image to a microSD card or USB thumb drive, replacing sdX with the identifier of the USB thumb drive. Don't include any numbers (so for example use sdc instead of sdc1).
36
+
37
+#+BEGIN_SRC bash
38
+unxz downloadedimagefile.img.xz
39
+dd bs=1M if=downloadedimagefile.img of=/dev/sdX conv=fdatasync
40
+#+END_SRC
41
+
42
+And wait. It will take a while to copy over. When that's done you might want to increase the partition size on the drive, using a tool such as [[http://gparted.org][Gparted]]. Whether you need to do that will depend upon how many apps you intend to install and how much data they will store.
43
+
44
+Plug the microSD or USB drive into the target hardware which you want to use as a server and power on. If you're using an old laptop or netbook as the server then you will need to set the BIOS to boot from USB.
45
+
46
+As the system boots for the first time the login is:
47
+
48
+#+BEGIN_SRC bash
49
+username: fbone
50
+password: freedombone
51
+#+END_SRC
52
+
53
+If you're installing from a microSD card on a single board computer without a screen and keyboard attached then you can ssh into it with:
54
+
55
+#+BEGIN_SRC bash
56
+ssh fbone@freedombone.local -p 2222
57
+#+END_SRC
58
+
59
+Using the initial password "freedombone". If you have trouble accessing the server then make sure you have Avahi installed and [[https://en.wikipedia.org/wiki/Multicast_DNS][mDNS]] enabled.
60
+
61
+You will then be shown a new randomly generated password. It's very important that you write this down somewhere or transfer it to a password manager before going further, because you'll need this to log in later.
62
+
63
+More detailed installation instructions are linked from [[./index.html][the main site]].
64
+
65
+* Upgrading from a previous install
66
+
67
+To upgrade from the Debian Jessie version first create a master keydrive. Go to the *Administrator control panel* and select *Backup and restore* then *Backup GPG key to USB (master keydrive)*. Insert a LUKS encrypted USB drive. When that is done Create a full backup by selecting *Backup data to USB drive* and using another LUKS encrypted USB drive.
68
+
69
+Follow the installation infstructions for the new Freedombone version, as described in the previous section. When the new system starts installing it will ask if you want to restore your GPG keys. Select *yes* and plug in your master keydrive.
70
+
71
+When the initial setup is complete go to the *Administrator control panel* and select *Backup and restore* then *Restore data from USB drive* followed by *all*. Insert the backup USB drive which you made previously. This will restore the base system, including any emails.
72
+
73
+You can now go to *Add/Remove apps* on the *Administrator control panel* and add the apps you want. Once they're installed you can recover their content and settings from *Backup and Restore*.

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

18
 
18
 
19
 * Contact details
19
 * Contact details
20
 
20
 
21
-This site can also be accessed via a Tor browser at *http://2tp3f6vtvhkqpuc6.onion*
21
+This site can also be accessed via a Tor browser at *http://pazyv7nkllp76hqr.onion*
22
 
22
 
23
 *Email:* bob@freedombone.net
23
 *Email:* bob@freedombone.net
24
 
24
 

BIN
image_build/bbb-4.9.0.tar.gz View File


+ 153
- 153
image_build/debootstrap/scripts/stretch View File

5
 keyring /usr/share/keyrings/debian-archive-keyring.gpg
5
 keyring /usr/share/keyrings/debian-archive-keyring.gpg
6
 
6
 
7
 if doing_variant fakechroot; then
7
 if doing_variant fakechroot; then
8
-	test "$FAKECHROOT" = "true" || error 1 FAKECHROOTREQ "This variant requires fakechroot environment to be started"
8
+    test "$FAKECHROOT" = "true" || error 1 FAKECHROOTREQ "This variant requires fakechroot environment to be started"
9
 fi
9
 fi
10
 
10
 
11
 case $ARCH in
11
 case $ARCH in
12
-	alpha|ia64) LIBC="libc6.1" ;;
13
-	kfreebsd-*) LIBC="libc0.1" ;;
14
-	hurd-*)     LIBC="libc0.3" ;;
15
-	*)          LIBC="libc6" ;;
12
+    alpha|ia64) LIBC="libc6.1" ;;
13
+    kfreebsd-*) LIBC="libc0.1" ;;
14
+    hurd-*)     LIBC="libc0.3" ;;
15
+    *)          LIBC="libc6" ;;
16
 esac
16
 esac
17
 
17
 
18
 work_out_debs () {
18
 work_out_debs () {
19
-	required="$(get_debs Priority: required)"
20
-
21
-	if doing_variant - || doing_variant fakechroot; then
22
-		#required="$required $(get_debs Priority: important)"
23
-		#  ^^ should be getting debconf here somehow maybe
24
-		base="$(get_debs Priority: important)"
25
-	elif doing_variant buildd || doing_variant scratchbox; then
26
-		base="apt build-essential"
27
-	elif doing_variant minbase; then
28
-		base="apt"
29
-	fi
30
-
31
-	if doing_variant fakechroot; then
32
-		# ldd.fake needs binutils
33
-		required="$required binutils"
34
-	fi
35
-
36
-	case $MIRRORS in
37
-	    https://*)
38
-		base="$base apt-transport-https ca-certificates"
39
-		;;
40
-	esac
19
+    required="$(get_debs Priority: required)"
20
+
21
+    if doing_variant - || doing_variant fakechroot; then
22
+        #required="$required $(get_debs Priority: important)"
23
+        #  ^^ should be getting debconf here somehow maybe
24
+        base="$(get_debs Priority: important)"
25
+    elif doing_variant buildd || doing_variant scratchbox; then
26
+        base="apt build-essential"
27
+    elif doing_variant minbase; then
28
+        base="apt"
29
+    fi
30
+
31
+    if doing_variant fakechroot; then
32
+        # ldd.fake needs binutils
33
+        required="$required binutils"
34
+    fi
35
+
36
+    case $MIRRORS in
37
+        https://*)
38
+        base="$base apt-transport-https ca-certificates"
39
+        ;;
40
+    esac
41
 }
41
 }
42
 
42
 
43
 first_stage_install () {
43
 first_stage_install () {
44
-	case "$CODENAME" in
45
-		etch|etch-m68k|jessie|lenny|squeeze|wheezy) ;;
46
-		*) setup_merged_usr ;;
47
-	esac
44
+    case "$CODENAME" in
45
+        etch|etch-m68k|stretch|jessie|lenny|squeeze|wheezy) ;;
46
+        *) setup_merged_usr ;;
47
+    esac
48
 
48
 
49
-	extract $required
49
+    extract $required
50
 
50
 
51
-	mkdir -p "$TARGET/var/lib/dpkg"
52
-	: >"$TARGET/var/lib/dpkg/status"
53
-	: >"$TARGET/var/lib/dpkg/available"
51
+    mkdir -p "$TARGET/var/lib/dpkg"
52
+    : >"$TARGET/var/lib/dpkg/status"
53
+    : >"$TARGET/var/lib/dpkg/available"
54
 
54
 
55
-	setup_etc
56
-	if [ ! -e "$TARGET/etc/fstab" ]; then
57
-		echo '# UNCONFIGURED FSTAB FOR BASE SYSTEM' > "$TARGET/etc/fstab"
58
-		chown 0:0 "$TARGET/etc/fstab"; chmod 644 "$TARGET/etc/fstab"
59
-	fi
55
+    setup_etc
56
+    if [ ! -e "$TARGET/etc/fstab" ]; then
57
+        echo '# UNCONFIGURED FSTAB FOR BASE SYSTEM' > "$TARGET/etc/fstab"
58
+        chown 0:0 "$TARGET/etc/fstab"; chmod 644 "$TARGET/etc/fstab"
59
+    fi
60
 
60
 
61
-	setup_devices
61
+    setup_devices
62
 }
62
 }
63
 
63
 
64
 second_stage_install () {
64
 second_stage_install () {
65
-	setup_dynamic_devices
65
+    setup_dynamic_devices
66
 
66
 
67
-	x_feign_install () {
68
-		local pkg="$1"
69
-		local deb="$(debfor $pkg)"
70
-		local ver="$(in_target dpkg-deb -f "$deb" Version)"
67
+    x_feign_install () {
68
+        local pkg="$1"
69
+        local deb="$(debfor $pkg)"
70
+        local ver="$(in_target dpkg-deb -f "$deb" Version)"
71
 
71
 
72
-		mkdir -p "$TARGET/var/lib/dpkg/info"
72
+        mkdir -p "$TARGET/var/lib/dpkg/info"
73
 
73
 
74
-		echo \
74
+        echo \
75
 "Package: $pkg
75
 "Package: $pkg
76
 Version: $ver
76
 Version: $ver
77
 Maintainer: unknown
77
 Maintainer: unknown
78
 Status: install ok installed" >> "$TARGET/var/lib/dpkg/status"
78
 Status: install ok installed" >> "$TARGET/var/lib/dpkg/status"
79
 
79
 
80
-		touch "$TARGET/var/lib/dpkg/info/${pkg}.list"
81
-	}
80
+        touch "$TARGET/var/lib/dpkg/info/${pkg}.list"
81
+    }
82
 
82
 
83
-	x_feign_install dpkg
83
+    x_feign_install dpkg
84
 
84
 
85
-	x_core_install () {
86
-		smallyes '' | in_target dpkg --force-depends --install $(debfor "$@")
87
-	}
85
+    x_core_install () {
86
+        smallyes '' | in_target dpkg --force-depends --install $(debfor "$@")
87
+    }
88
 
88
 
89
-	p () {
90
-		baseprog="$(($baseprog + ${1:-1}))"
91
-	}
89
+    p () {
90
+        baseprog="$(($baseprog + ${1:-1}))"
91
+    }
92
 
92
 
93
-	if doing_variant fakechroot; then
94
-		setup_proc_fakechroot
95
-	elif doing_variant scratchbox; then
96
-		true
97
-	else
98
-		setup_proc
99
-		in_target /sbin/ldconfig
100
-	fi
93
+    if doing_variant fakechroot; then
94
+        setup_proc_fakechroot
95
+    elif doing_variant scratchbox; then
96
+        true
97
+    else
98
+        setup_proc
99
+        in_target /sbin/ldconfig
100
+    fi
101
 
101
 
102
-	DEBIAN_FRONTEND=noninteractive
103
-	DEBCONF_NONINTERACTIVE_SEEN=true
104
-	export DEBIAN_FRONTEND DEBCONF_NONINTERACTIVE_SEEN
102
+    DEBIAN_FRONTEND=noninteractive
103
+    DEBCONF_NONINTERACTIVE_SEEN=true
104
+    export DEBIAN_FRONTEND DEBCONF_NONINTERACTIVE_SEEN
105
 
105
 
106
-	baseprog=0
107
-	bases=7
106
+    baseprog=0
107
+    bases=7
108
 
108
 
109
-	p; progress $baseprog $bases INSTCORE "Installing core packages" #1
110
-	info INSTCORE "Installing core packages..."
109
+    p; progress $baseprog $bases INSTCORE "Installing core packages" #1
110
+    info INSTCORE "Installing core packages..."
111
 
111
 
112
-	p; progress $baseprog $bases INSTCORE "Installing core packages" #2
113
-	ln -sf mawk "$TARGET/usr/bin/awk"
114
-	x_core_install base-passwd
115
-	x_core_install base-files
116
-	p; progress $baseprog $bases INSTCORE "Installing core packages" #3
117
-	x_core_install dpkg
112
+    p; progress $baseprog $bases INSTCORE "Installing core packages" #2
113
+    ln -sf mawk "$TARGET/usr/bin/awk"
114
+    x_core_install base-passwd
115
+    x_core_install base-files
116
+    p; progress $baseprog $bases INSTCORE "Installing core packages" #3
117
+    x_core_install dpkg
118
 
118
 
119
-	if [ ! -e "$TARGET/etc/localtime" ]; then
120
-		ln -sf /usr/share/zoneinfo/UTC "$TARGET/etc/localtime"
121
-	fi
119
+    if [ ! -e "$TARGET/etc/localtime" ]; then
120
+        ln -sf /usr/share/zoneinfo/UTC "$TARGET/etc/localtime"
121
+    fi
122
 
122
 
123
-	if doing_variant fakechroot; then
124
-		install_fakechroot_tools
125
-	fi
123
+    if doing_variant fakechroot; then
124
+        install_fakechroot_tools
125
+    fi
126
 
126
 
127
-	p; progress $baseprog $bases INSTCORE "Installing core packages" #4
128
-	x_core_install $LIBC
127
+    p; progress $baseprog $bases INSTCORE "Installing core packages" #4
128
+    x_core_install $LIBC
129
 
129
 
130
-	p; progress $baseprog $bases INSTCORE "Installing core packages" #5
131
-	x_core_install perl-base
130
+    p; progress $baseprog $bases INSTCORE "Installing core packages" #5
131
+    x_core_install perl-base
132
 
132
 
133
-	p; progress $baseprog $bases INSTCORE "Installing core packages" #6
134
-	rm "$TARGET/usr/bin/awk"
135
-	x_core_install mawk
133
+    p; progress $baseprog $bases INSTCORE "Installing core packages" #6
134
+    rm "$TARGET/usr/bin/awk"
135
+    x_core_install mawk
136
 
136
 
137
-	p; progress $baseprog $bases INSTCORE "Installing core packages" #7
138
-	if doing_variant -; then
139
-		x_core_install debconf
140
-	fi
137
+    p; progress $baseprog $bases INSTCORE "Installing core packages" #7
138
+    if doing_variant -; then
139
+        x_core_install debconf
140
+    fi
141
 
141
 
142
-	baseprog=0
143
-	bases=$(set -- $required; echo $#)
142
+    baseprog=0
143
+    bases=$(set -- $required; echo $#)
144
 
144
 
145
-	info UNPACKREQ "Unpacking required packages..."
145
+    info UNPACKREQ "Unpacking required packages..."
146
 
146
 
147
-	exec 7>&1
147
+    exec 7>&1
148
 
148
 
149
-	smallyes '' |
150
-		(repeatn 5 in_target_failmsg UNPACK_REQ_FAIL_FIVE "Failure while unpacking required packages.  This will be attempted up to five times." "" \
151
-		dpkg --status-fd 8 --force-depends --unpack $(debfor $required) 8>&1 1>&7 || echo EXITCODE $?) |
152
-		dpkg_progress $baseprog $bases UNPACKREQ "Unpacking required packages" UNPACKING
149
+    smallyes '' |
150
+        (repeatn 5 in_target_failmsg UNPACK_REQ_FAIL_FIVE "Failure while unpacking required packages.  This will be attempted up to five times." "" \
151
+        dpkg --status-fd 8 --force-depends --unpack $(debfor $required) 8>&1 1>&7 || echo EXITCODE $?) |
152
+        dpkg_progress $baseprog $bases UNPACKREQ "Unpacking required packages" UNPACKING
153
 
153
 
154
-	info CONFREQ "Configuring required packages..."
154
+    info CONFREQ "Configuring required packages..."
155
 
155
 
156
-	echo \
156
+    echo \
157
 "#!/bin/sh
157
 "#!/bin/sh
158
 exit 101" > "$TARGET/usr/sbin/policy-rc.d"
158
 exit 101" > "$TARGET/usr/sbin/policy-rc.d"
159
-	chmod 755 "$TARGET/usr/sbin/policy-rc.d"
159
+    chmod 755 "$TARGET/usr/sbin/policy-rc.d"
160
 
160
 
161
-	mv "$TARGET/sbin/start-stop-daemon" "$TARGET/sbin/start-stop-daemon.REAL"
162
-	echo \
161
+    mv "$TARGET/sbin/start-stop-daemon" "$TARGET/sbin/start-stop-daemon.REAL"
162
+    echo \
163
 "#!/bin/sh
163
 "#!/bin/sh
164
 echo
164
 echo
165
 echo \"Warning: Fake start-stop-daemon called, doing nothing\"" > "$TARGET/sbin/start-stop-daemon"
165
 echo \"Warning: Fake start-stop-daemon called, doing nothing\"" > "$TARGET/sbin/start-stop-daemon"
166
-	chmod 755 "$TARGET/sbin/start-stop-daemon"
167
-
168
-	setup_dselect_method apt
169
-
170
-	smallyes '' |
171
-		(in_target_failmsg CONF_REQ_FAIL "Failure while configuring required packages." "" \
172
-		dpkg --status-fd 8 --configure --pending --force-configure-any --force-depends 8>&1 1>&7 || echo EXITCODE $?) |
173
-		dpkg_progress $baseprog $bases CONFREQ "Configuring required packages" CONFIGURING
174
-
175
-	baseprog=0
176
-	bases="$(set -- $base; echo $#)"
177
-
178
-	info UNPACKBASE "Unpacking the base system..."
179
-
180
-	setup_available $required $base
181
-	done_predeps=
182
-	while predep=$(get_next_predep); do
183
-		# We have to resolve dependencies of pre-dependencies manually because
184
-		# dpkg --predep-package doesn't handle this.
185
-		predep=$(without "$(without "$(resolve_deps $predep)" "$required")" "$done_predeps")
186
-		# XXX: progress is tricky due to how dpkg_progress works
187
-		# -- cjwatson 2009-07-29
188
-		p; smallyes '' |
189
-		in_target dpkg --force-overwrite --force-confold --skip-same-version --install $(debfor $predep)
190
-		base=$(without "$base" "$predep")
191
-		done_predeps="$done_predeps $predep"
192
-	done
193
-
194
-	smallyes '' |
195
-		(repeatn 5 in_target_failmsg INST_BASE_FAIL_FIVE "Failure while installing base packages.  This will be re-attempted up to five times." "" \
196
-		dpkg --status-fd 8 --force-overwrite --force-confold --skip-same-version --unpack $(debfor $base) 8>&1 1>&7 || echo EXITCODE $?) |
197
-		dpkg_progress $baseprog $bases UNPACKBASE "Unpacking base system" UNPACKING
198
-
199
-	info CONFBASE "Configuring the base system..."
200
-
201
-	smallyes '' |
202
-		(repeatn 5 in_target_failmsg CONF_BASE_FAIL_FIVE "Failure while configuring base packages.  This will be re-attempted up to five times." "" \
203
-		dpkg --status-fd 8 --force-confold --skip-same-version --configure -a 8>&1 1>&7 || echo EXITCODE $?) |
204
-		dpkg_progress $baseprog $bases CONFBASE "Configuring base system" CONFIGURING
205
-
206
-	mv "$TARGET/sbin/start-stop-daemon.REAL" "$TARGET/sbin/start-stop-daemon"
207
-	rm -f "$TARGET/usr/sbin/policy-rc.d"
208
-
209
-	progress $bases $bases CONFBASE "Configuring base system"
210
-	info BASESUCCESS "Base system installed successfully."
166
+    chmod 755 "$TARGET/sbin/start-stop-daemon"
167
+
168
+    setup_dselect_method apt
169
+
170
+    smallyes '' |
171
+        (in_target_failmsg CONF_REQ_FAIL "Failure while configuring required packages." "" \
172
+        dpkg --status-fd 8 --configure --pending --force-configure-any --force-depends 8>&1 1>&7 || echo EXITCODE $?) |
173
+        dpkg_progress $baseprog $bases CONFREQ "Configuring required packages" CONFIGURING
174
+
175
+    baseprog=0
176
+    bases="$(set -- $base; echo $#)"
177
+
178
+    info UNPACKBASE "Unpacking the base system..."
179
+
180
+    setup_available $required $base
181
+    done_predeps=
182
+    while predep=$(get_next_predep); do
183
+        # We have to resolve dependencies of pre-dependencies manually because
184
+        # dpkg --predep-package doesn't handle this.
185
+        predep=$(without "$(without "$(resolve_deps $predep)" "$required")" "$done_predeps")
186
+        # XXX: progress is tricky due to how dpkg_progress works
187
+        # -- cjwatson 2009-07-29
188
+        p; smallyes '' |
189
+        in_target dpkg --force-overwrite --force-confold --skip-same-version --install $(debfor $predep)
190
+        base=$(without "$base" "$predep")
191
+        done_predeps="$done_predeps $predep"
192
+    done
193
+
194
+    smallyes '' |
195
+        (repeatn 5 in_target_failmsg INST_BASE_FAIL_FIVE "Failure while installing base packages.  This will be re-attempted up to five times." "" \
196
+        dpkg --status-fd 8 --force-overwrite --force-confold --skip-same-version --unpack $(debfor $base) 8>&1 1>&7 || echo EXITCODE $?) |
197
+        dpkg_progress $baseprog $bases UNPACKBASE "Unpacking base system" UNPACKING
198
+
199
+    info CONFBASE "Configuring the base system..."
200
+
201
+    smallyes '' |
202
+        (repeatn 5 in_target_failmsg CONF_BASE_FAIL_FIVE "Failure while configuring base packages.  This will be re-attempted up to five times." "" \
203
+        dpkg --status-fd 8 --force-confold --skip-same-version --configure -a 8>&1 1>&7 || echo EXITCODE $?) |
204
+        dpkg_progress $baseprog $bases CONFBASE "Configuring base system" CONFIGURING
205
+
206
+    mv "$TARGET/sbin/start-stop-daemon.REAL" "$TARGET/sbin/start-stop-daemon"
207
+    rm -f "$TARGET/usr/sbin/policy-rc.d"
208
+
209
+    progress $bases $bases CONFBASE "Configuring base system"
210
+    info BASESUCCESS "Base system installed successfully."
211
 }
211
 }

BIN
img/gnusocial_sprite.png View File


BIN
img/postactiv_sprite.png View File


BIN
img/release3.jpg View File


BIN
man/freedombone-image.1.gz View File


BIN
man/freedombone.1.gz View File


+ 13
- 1
src/freedombone View File

13
 # License
13
 # License
14
 # =======
14
 # =======
15
 #
15
 #
16
-# Copyright (C) 2014-2016 Bob Mottram <bob@freedombone.net>
16
+# Copyright (C) 2014-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
65
     ONION_ONLY="yes"
65
     ONION_ONLY="yes"
66
 fi
66
 fi
67
 
67
 
68
+if [[ $command_options == "menuconfig-gnusocial" ]]; then
69
+    MINIMAL_INSTALL="yes"
70
+    ONION_ONLY="no"
71
+    SOCIALINSTANCE='gnusocial'
72
+fi
73
+
74
+if [[ $command_options == "menuconfig-postactiv" ]]; then
75
+    MINIMAL_INSTALL="yes"
76
+    ONION_ONLY="no"
77
+    SOCIALINSTANCE='postactiv'
78
+fi
79
+
68
 if [ ! $CONFIGURATION_FILE ]; then
80
 if [ ! $CONFIGURATION_FILE ]; then
69
     CONFIGURATION_FILE=$HOME/${PROJECT_NAME}.cfg
81
     CONFIGURATION_FILE=$HOME/${PROJECT_NAME}.cfg
70
 fi
82
 fi

+ 3
- 7
src/freedombone-addcert View File

59
 INSTALL_DIR=/root/build
59
 INSTALL_DIR=/root/build
60
 LETSENCRYPT_SERVER='https://acme-v01.api.letsencrypt.org/directory'
60
 LETSENCRYPT_SERVER='https://acme-v01.api.letsencrypt.org/directory'
61
 MY_EMAIL_ADDRESS=
61
 MY_EMAIL_ADDRESS=
62
-FRIENDS_MIRRORS_SERVER=
63
-FRIENDS_MIRRORS_PASSWORD=
64
-FRIENDS_MIRRORS_SSH_PORT=
65
-MY_MIRRORS_PASSWORD=
66
 
62
 
67
 function show_help {
63
 function show_help {
68
     echo ''
64
     echo ''
222
     fi
218
     fi
223
 
219
 
224
     if [ ! -f /usr/bin/certbot ]; then
220
     if [ ! -f /usr/bin/certbot ]; then
225
-        apt-get -yq install certbot -t jessie-backports
221
+        apt-get -yq install certbot
222
+        groupadd ssl-cert
226
         if [ ! -f /usr/bin/certbot ]; then
223
         if [ ! -f /usr/bin/certbot ]; then
227
             echo $'LetsEncrypt certbot failed to install'
224
             echo $'LetsEncrypt certbot failed to install'
228
             exit 762830
225
             exit 762830
311
 
308
 
312
     openssl req -x509 ${EXTENSIONS} -nodes -days 3650 -sha256 \
309
     openssl req -x509 ${EXTENSIONS} -nodes -days 3650 -sha256 \
313
             -subj "/O=$ORGANISATION/OU=$UNIT/C=$COUNTRY_CODE/ST=$AREA/L=$LOCATION/CN=$HOSTNAME" \
310
             -subj "/O=$ORGANISATION/OU=$UNIT/C=$COUNTRY_CODE/ST=$AREA/L=$LOCATION/CN=$HOSTNAME" \
314
-            -newkey rsa:4096 -keyout /etc/ssl/private/${CERTFILE}.key \
311
+            -newkey rsa:2048 -keyout /etc/ssl/private/${CERTFILE}.key \
315
             -out /etc/ssl/certs/${CERTFILE}.crt
312
             -out /etc/ssl/certs/${CERTFILE}.crt
316
     chmod 400 /etc/ssl/private/${CERTFILE}.key
313
     chmod 400 /etc/ssl/private/${CERTFILE}.key
317
     chmod 640 /etc/ssl/certs/${CERTFILE}.crt
314
     chmod 640 /etc/ssl/certs/${CERTFILE}.crt
359
     fi
356
     fi
360
 }
357
 }
361
 
358
 
362
-read_repo_servers
363
 create_cert
359
 create_cert
364
 generate_dh_params
360
 generate_dh_params
365
 restart_web_server
361
 restart_web_server

+ 6
- 2
src/freedombone-addremove View File

38
     PROJECT_INSTALL_DIR=/usr/bin
38
     PROJECT_INSTALL_DIR=/usr/bin
39
 fi
39
 fi
40
 
40
 
41
-source $PROJECT_INSTALL_DIR/${PROJECT_NAME}-vars
42
-
43
 COMPLETION_FILE=$HOME/${PROJECT_NAME}-completed.txt
41
 COMPLETION_FILE=$HOME/${PROJECT_NAME}-completed.txt
44
 CONFIGURATION_FILE=$HOME/${PROJECT_NAME}.cfg
42
 CONFIGURATION_FILE=$HOME/${PROJECT_NAME}.cfg
45
 
43
 
44
+# Start including files
45
+
46
+source $PROJECT_INSTALL_DIR/${PROJECT_NAME}-vars
47
+
46
 UTILS_FILES=/usr/share/${PROJECT_NAME}/utils/${PROJECT_NAME}-utils-*
48
 UTILS_FILES=/usr/share/${PROJECT_NAME}/utils/${PROJECT_NAME}-utils-*
47
 for f in $UTILS_FILES
49
 for f in $UTILS_FILES
48
 do
50
 do
55
   source $f
57
   source $f
56
 done
58
 done
57
 
59
 
60
+# End including files
61
+
58
 function mark_unselected_apps_as_removed {
62
 function mark_unselected_apps_as_removed {
59
     # Initially mark the apps not chosen on first install as being removed
63
     # Initially mark the apps not chosen on first install as being removed
60
     # otherwise they may be automatically installed on the next update
64
     # otherwise they may be automatically installed on the next update

+ 22
- 20
src/freedombone-adduser View File

136
 chmod 600 /home/$ADD_USERNAME/.gnupg/*
136
 chmod 600 /home/$ADD_USERNAME/.gnupg/*
137
 
137
 
138
 # Generate a GPG key
138
 # Generate a GPG key
139
-echo 'Key-Type: 1' > /home/$ADD_USERNAME/gpg-genkey.conf
140
-echo 'Key-Length: 4096' >> /home/$ADD_USERNAME/gpg-genkey.conf
141
-echo 'Subkey-Type: 1' >> /home/$ADD_USERNAME/gpg-genkey.conf
142
-echo 'Subkey-Length: 4096' >> /home/$ADD_USERNAME/gpg-genkey.conf
139
+echo 'Key-Type: eddsa' > /home/$ADD_USERNAME/gpg-genkey.conf
140
+echo 'Key-Curve: Ed25519' >> /home/$ADD_USERNAME/gpg-genkey.conf
141
+echo 'Subkey-Type: eddsa' >> /home/$ADD_USERNAME/gpg-genkey.conf
143
 echo "Name-Real:  $ADD_USERNAME" >> /home/$ADD_USERNAME/gpg-genkey.conf
142
 echo "Name-Real:  $ADD_USERNAME" >> /home/$ADD_USERNAME/gpg-genkey.conf
144
 echo "Name-Email: $ADD_USERNAME@$HOSTNAME" >> /home/$ADD_USERNAME/gpg-genkey.conf
143
 echo "Name-Email: $ADD_USERNAME@$HOSTNAME" >> /home/$ADD_USERNAME/gpg-genkey.conf
145
 echo 'Expire-Date: 0' >> /home/$ADD_USERNAME/gpg-genkey.conf
144
 echo 'Expire-Date: 0' >> /home/$ADD_USERNAME/gpg-genkey.conf
145
+echo "Passphrase: $NEW_USER_PASSWORD" >> /home/$ADD_USERNAME/gpg-genkey.conf
146
 chown $ADD_USERNAME:$ADD_USERNAME /home/$ADD_USERNAME/gpg-genkey.conf
146
 chown $ADD_USERNAME:$ADD_USERNAME /home/$ADD_USERNAME/gpg-genkey.conf
147
-su -c "gpg --batch --gen-key /home/$ADD_USERNAME/gpg-genkey.conf" - $ADD_USERNAME
147
+su -m root -c "gpg --homedir /home/$ADD_USERNAME/.gnupg --batch --full-gen-key /home/$ADD_USERNAME/gpg-genkey.conf" - $ADD_USERNAME
148
+chown -R $ADD_USERNAME:$ADD_USERNAME /home/$ADD_USERNAME/.gnupg
148
 shred -zu /home/$ADD_USERNAME/gpg-genkey.conf
149
 shred -zu /home/$ADD_USERNAME/gpg-genkey.conf
149
 MY_GPG_PUBLIC_KEY_ID=$(gpg_pubkey_from_email "$ADD_USERNAME" "$ADD_USERNAME@$HOSTNAME")
150
 MY_GPG_PUBLIC_KEY_ID=$(gpg_pubkey_from_email "$ADD_USERNAME" "$ADD_USERNAME@$HOSTNAME")
150
 MY_GPG_PUBLIC_KEY=/home/$ADD_USERNAME/public_key.gpg
151
 MY_GPG_PUBLIC_KEY=/home/$ADD_USERNAME/public_key.gpg
151
-su -c "gpg --output $MY_GPG_PUBLIC_KEY --armor --export $MY_GPG_PUBLIC_KEY_ID" - $ADD_USERNAME
152
+su -m root -c "gpg --output $MY_GPG_PUBLIC_KEY --armor --export $MY_GPG_PUBLIC_KEY_ID" - $ADD_USERNAME
152
 
153
 
153
 if [ ! -f $MY_GPG_PUBLIC_KEY ]; then
154
 if [ ! -f $MY_GPG_PUBLIC_KEY ]; then
154
     echo "GPG public key was not generated for $ADD_USERNAME@$HOSTNAME $MY_GPG_PUBLIC_KEY_ID"
155
     echo "GPG public key was not generated for $ADD_USERNAME@$HOSTNAME $MY_GPG_PUBLIC_KEY_ID"
155
     userdel -r $ADD_USERNAME
156
     userdel -r $ADD_USERNAME
156
     exit 7
157
     exit 7
157
 fi
158
 fi
159
+gpg_agent_setup $ADD_USERNAME
158
 
160
 
159
 # add a monkeysphere subkey
161
 # add a monkeysphere subkey
160
 #echo $'Adding monkeysphere subkey'
162
 #echo $'Adding monkeysphere subkey'
162
 #echo $'Adding monkeysphere subkey to ssh-agent'
164
 #echo $'Adding monkeysphere subkey to ssh-agent'
163
 #su -c "monkeysphere s" - $ADD_USERNAME
165
 #su -c "monkeysphere s" - $ADD_USERNAME
164
 # add authorized GPG email address
166
 # add authorized GPG email address
165
-mkdir /home/$ADD_USERNAME/.monkeysphere
166
-chmod 755 /home/$ADD_USERNAME/.monkeysphere
167
-echo "$ADD_USERNAME <$ADD_USERNAME@$HOSTNAME>" > /home/$ADD_USERNAME/.monkeysphere/authorized_user_ids
168
-chmod 644 /home/$ADD_USERNAME/.monkeysphere/authorized_user_ids
169
-chown -R $ADD_USERNAME:$ADD_USERNAME /home/$ADD_USERNAME/.monkeysphere
170
-echo $'Updating monkeysphere users'
171
-monkeysphere-authentication update-users
167
+#mkdir /home/$ADD_USERNAME/.monkeysphere
168
+#chmod 755 /home/$ADD_USERNAME/.monkeysphere
169
+#echo "$ADD_USERNAME <$ADD_USERNAME@$HOSTNAME>" > /home/$ADD_USERNAME/.monkeysphere/authorized_user_ids
170
+#chmod 644 /home/$ADD_USERNAME/.monkeysphere/authorized_user_ids
171
+#chown -R $ADD_USERNAME:$ADD_USERNAME /home/$ADD_USERNAME/.monkeysphere
172
+#echo $'Updating monkeysphere users'
173
+#monkeysphere-authentication update-users
172
 
174
 
173
 if [ -f /home/$ADD_USERNAME/.muttrc ]; then
175
 if [ -f /home/$ADD_USERNAME/.muttrc ]; then
174
     # encrypt outgoing mail to the "sent" folder
176
     # encrypt outgoing mail to the "sent" folder
175
     if ! grep -q "pgp_encrypt_only_command" /home/$ADD_USERNAME/.muttrc; then
177
     if ! grep -q "pgp_encrypt_only_command" /home/$ADD_USERNAME/.muttrc; then
176
         echo '' >> /home/$ADD_USERNAME/.muttrc
178
         echo '' >> /home/$ADD_USERNAME/.muttrc
177
         echo $'# Encrypt items in the Sent folder' >> /home/$ADD_USERNAME/.muttrc
179
         echo $'# Encrypt items in the Sent folder' >> /home/$ADD_USERNAME/.muttrc
178
-        echo "set pgp_encrypt_only_command=\"/usr/lib/mutt/pgpewrap gpg --batch --quiet --no-verbose --output - --encrypt --textmode --armor --always-trust --encrypt-to 0x$MY_GPG_PUBLIC_KEY_ID -- -r %r -- %f\"" >> /home/$ADD_USERNAME/.muttrc
180
+        echo "set pgp_encrypt_only_command=\"/usr/lib/mutt/pgpewrap gpg --batch --quiet --no-verbose --output - --encrypt --textmode --armor --always-trust --encrypt-to $MY_GPG_PUBLIC_KEY_ID -- -r %r -- %f\"" >> /home/$ADD_USERNAME/.muttrc
179
     else
181
     else
180
-        sed -i "s|set pgp_encrypt_only_command.*|set pgp_encrypt_only_command=\"/usr/lib/mutt/pgpewrap gpg --batch --quiet --no-verbose --output - --encrypt --textmode --armor --always-trust --encrypt-to 0x$MY_GPG_PUBLIC_KEY_ID -- -r %r -- %f\"|g" /home/$ADD_USERNAME/.muttrc
182
+        sed -i "s|set pgp_encrypt_only_command.*|set pgp_encrypt_only_command=\"/usr/lib/mutt/pgpewrap gpg --batch --quiet --no-verbose --output - --encrypt --textmode --armor --always-trust --encrypt-to $MY_GPG_PUBLIC_KEY_ID -- -r %r -- %f\"|g" /home/$ADD_USERNAME/.muttrc
181
     fi
183
     fi
182
 
184
 
183
     if ! grep -q "pgp_encrypt_sign_command" /home/$ADD_USERNAME/.muttrc; then
185
     if ! grep -q "pgp_encrypt_sign_command" /home/$ADD_USERNAME/.muttrc; then
184
-        echo "set pgp_encrypt_sign_command=\"/usr/lib/mutt/pgpewrap gpg %?p?--passphrase-fd 0? --batch --quiet --no-verbose --textmode --output - --encrypt --sign %?a?-u %a? --armor --always-trust --encrypt-to 0x$MY_GPG_PUBLIC_KEY_ID -- -r %r -- %f\"" >> /home/$ADD_USERNAME/.muttrc
186
+        echo "set pgp_encrypt_sign_command=\"/usr/lib/mutt/pgpewrap gpg %?p?--passphrase-fd 0? --batch --quiet --no-verbose --textmode --output - --encrypt --sign %?a?-u %a? --armor --always-trust --encrypt-to $MY_GPG_PUBLIC_KEY_ID -- -r %r -- %f\"" >> /home/$ADD_USERNAME/.muttrc
185
     else
187
     else
186
-        sed -i "s|set pgp_encrypt_sign_command.*|set pgp_encrypt_sign_command=\"/usr/lib/mutt/pgpewrap gpg %?p?--passphrase-fd 0? --batch --quiet --no-verbose --textmode --output - --encrypt --sign %?a?-u %a? --armor --always-trust --encrypt-to 0x$MY_GPG_PUBLIC_KEY_ID -- -r %r -- %f\"|g" /home/$ADD_USERNAME/.muttrc
188
+        sed -i "s|set pgp_encrypt_sign_command.*|set pgp_encrypt_sign_command=\"/usr/lib/mutt/pgpewrap gpg %?p?--passphrase-fd 0? --batch --quiet --no-verbose --textmode --output - --encrypt --sign %?a?-u %a? --armor --always-trust --encrypt-to $MY_GPG_PUBLIC_KEY_ID -- -r %r -- %f\"|g" /home/$ADD_USERNAME/.muttrc
187
     fi
189
     fi
188
 fi
190
 fi
189
 
191
 
227
 done
229
 done
228
 
230
 
229
 if [ -f /etc/nginx/.htpasswd ]; then
231
 if [ -f /etc/nginx/.htpasswd ]; then
230
-    if ! grep "${ADD_USERNAME}:" /etc/nginx/.htpasswd; then
232
+    if ! grep -q "${ADD_USERNAME}:" /etc/nginx/.htpasswd; then
231
         echo "$NEW_USER_PASSWORD" | htpasswd -i -s /etc/nginx/.htpasswd $ADD_USERNAME
233
         echo "$NEW_USER_PASSWORD" | htpasswd -i -s /etc/nginx/.htpasswd $ADD_USERNAME
232
     fi
234
     fi
233
 fi
235
 fi
234
 
236
 
235
 # add user menu on ssh login
237
 # add user menu on ssh login
236
-if ! grep -q 'control' /home/$ADD_USERNAME/.bashrc; then
237
-    echo 'control' >> /home/$ADD_USERNAME/.bashrc
238
+if ! grep -q 'controluser' /home/$ADD_USERNAME/.bashrc; then
239
+    echo 'controluser' >> /home/$ADD_USERNAME/.bashrc
238
 fi
240
 fi
239
 
241
 
240
 ${PROJECT_NAME}-pass -u $ADD_USERNAME -a login -p "$NEW_USER_PASSWORD"
242
 ${PROJECT_NAME}-pass -u $ADD_USERNAME -a login -p "$NEW_USER_PASSWORD"

+ 8
- 0
src/freedombone-app-batman View File

39
 batman_variables=(MY_USERNAME
39
 batman_variables=(MY_USERNAME
40
                   BATMAN_CELLID)
40
                   BATMAN_CELLID)
41
 
41
 
42
+function logging_on_batman {
43
+    echo -n ''
44
+}
45
+
46
+function logging_off_batman {
47
+    echo -n ''
48
+}
49
+
42
 function install_interactive_batman {
50
 function install_interactive_batman {
43
     echo -n ''
51
     echo -n ''
44
     APP_INSTALLED=1
52
     APP_INSTALLED=1

+ 24
- 2
src/freedombone-app-cryptpad View File

42
 
42
 
43
 cryptpad_variables=(ONION_ONLY)
43
 cryptpad_variables=(ONION_ONLY)
44
 
44
 
45
+function logging_on_cryptpad {
46
+    echo -n ''
47
+}
48
+
49
+function logging_off_cryptpad {
50
+    echo -n ''
51
+}
52
+
45
 function remove_user_cryptpad {
53
 function remove_user_cryptpad {
46
     remove_username="$1"
54
     remove_username="$1"
47
 }
55
 }
157
     if [ -f /etc/systemd/system/cryptpad.service ]; then
165
     if [ -f /etc/systemd/system/cryptpad.service ]; then
158
         rm /etc/systemd/system/cryptpad.service
166
         rm /etc/systemd/system/cryptpad.service
159
     fi
167
     fi
168
+    systemctl daemon-reload
160
 
169
 
161
     function_check remove_nodejs
170
     function_check remove_nodejs
162
     remove_nodejs cryptpad
171
     remove_nodejs cryptpad
190
         rm -rf $CRYPTPAD_DIR
199
         rm -rf $CRYPTPAD_DIR
191
     fi
200
     fi
192
 
201
 
193
-    function_check git_clone
194
-    git_clone $CRYPTPAD_REPO $CRYPTPAD_DIR
202
+    if [ -d /repos/cryptpad ]; then
203
+        mkdir $CRYPTPAD_DIR
204
+        cp -r -p /repos/cryptpad/. $CRYPTPAD_DIR
205
+        cd $CRYPTPAD_DIR
206
+        git pull
207
+    else
208
+        function_check git_clone
209
+        git_clone $CRYPTPAD_REPO $CRYPTPAD_DIR
210
+    fi
211
+
195
     if [ ! -d $CRYPTPAD_DIR ]; then
212
     if [ ! -d $CRYPTPAD_DIR ]; then
196
         echo $'Unable to clone cryptpad repo'
213
         echo $'Unable to clone cryptpad repo'
197
         exit 783251
214
         exit 783251
286
 
303
 
287
     npm install
304
     npm install
288
     npm install -g bower@1.8.0
305
     npm install -g bower@1.8.0
306
+    chown -R cryptpad:cryptpad $CRYPTPAD_DIR
289
     su -c 'bower install' - cryptpad
307
     su -c 'bower install' - cryptpad
290
     cp config.example.js config.js
308
     cp config.example.js config.js
291
     if [ ! -f config.js ]; then
309
     if [ ! -f config.js ]; then
333
     fi
351
     fi
334
     chown -R cryptpad:cryptpad $CRYPTPAD_DIR
352
     chown -R cryptpad:cryptpad $CRYPTPAD_DIR
335
 
353
 
354
+    # install again
355
+    cd $CRYPTPAD_DIR
356
+    su -c 'bower install' - cryptpad
357
+
336
     systemctl restart nginx
358
     systemctl restart nginx
337
 
359
 
338
     APP_INSTALLED=1
360
     APP_INSTALLED=1

+ 8
- 0
src/freedombone-app-dlna View File

38
                 INSTALLED_WITHIN_DOCKER
38
                 INSTALLED_WITHIN_DOCKER
39
                 MY_USERNAME)
39
                 MY_USERNAME)
40
 
40
 
41
+function logging_on_dlna {
42
+    echo -n ''
43
+}
44
+
45
+function logging_off_dlna {
46
+    echo -n ''
47
+}
48
+
41
 function configure_interactive_dlna {
49
 function configure_interactive_dlna {
42
     while true
50
     while true
43
     do
51
     do

+ 205
- 132
src/freedombone-app-dokuwiki View File

34
 SHOW_ON_ABOUT=1
34
 SHOW_ON_ABOUT=1
35
 
35
 
36
 DOKUWIKI_DOMAIN_NAME=
36
 DOKUWIKI_DOMAIN_NAME=
37
-DOKUWIKI_ADMIN_PASSWORD=
38
-DOKUWIKI_TITLE="${PROJECT_NAME} Dokuwiki"
39
 DOKUWIKI_CODE=
37
 DOKUWIKI_CODE=
40
 DOKUWIKI_ONION_PORT=8089
38
 DOKUWIKI_ONION_PORT=8089
39
+DOKUWIKI_ADMIN_PASSWORD=
40
+DOKUWIKI_TITLE="${PROJECT_NAME} Dokuwiki"
41
+
42
+DOKUWIKI_REPO="https://github.com/splitbrain/dokuwiki"
43
+DOKUWIKI_COMMIT='be15c01c0b982cf1a75b5af031bf077143c63f39'
41
 
44
 
42
 dokuwiki_variables=(ONION_ONLY
45
 dokuwiki_variables=(ONION_ONLY
43
                     MY_USERNAME
46
                     MY_USERNAME
46
                     DOKUWIKI_CODE
49
                     DOKUWIKI_CODE
47
                     DDNS_PROVIDER)
50
                     DDNS_PROVIDER)
48
 
51
 
52
+function logging_on_dokuwiki {
53
+    echo -n ''
54
+}
55
+
56
+function logging_off_dokuwiki {
57
+    echo -n ''
58
+}
59
+
49
 function install_interactive_dokuwiki {
60
 function install_interactive_dokuwiki {
50
     if [[ $ONION_ONLY != "no" ]]; then
61
     if [[ $ONION_ONLY != "no" ]]; then
51
         DOKUWIKI_TITLE=$'My Dokuwiki'
62
         DOKUWIKI_TITLE=$'My Dokuwiki'
63
     curr_username="$1"
74
     curr_username="$1"
64
     new_user_password="$2"
75
     new_user_password="$2"
65
 
76
 
66
-    if grep "$curr_username:" /var/lib/dokuwiki/acl/users.auth.php; then
77
+    DOKUWIKI_DOMAIN_NAME=$(get_completion_param "dokuwiki domain")
78
+    if grep -q "$curr_username:" /var/www/$DOKUWIKI_DOMAIN_NAME/htdocs/lib/plugins/acl/users.auth.php; then
67
         HASHED_DOKUWIKI_PASSWORD=$(echo -n "$new_user_password" | md5sum | awk -F ' ' '{print $1}')
79
         HASHED_DOKUWIKI_PASSWORD=$(echo -n "$new_user_password" | md5sum | awk -F ' ' '{print $1}')
68
-        existing_user=$(cat /var/lib/dokuwiki/acl/users.auth.php | grep "$curr_username:" | hean -n 1)
80
+        existing_user=$(cat /var/www/$DOKUWIKI_DOMAIN_NAME/htdocs/lib/plugins/acl/users.auth.php | grep "$curr_username:" | hean -n 1)
69
         if [[ "$existing_user" == *":admin,"* ]]; then
81
         if [[ "$existing_user" == *":admin,"* ]]; then
70
-            sed -i "s|$curr_username:.*|$curr_username:$HASHED_DOKUWIKI_PASSWORD:$curr_username:$curr_username@$HOSTNAME:admin,user,upload|g" /var/lib/dokuwiki/acl/users.auth.php
82
+            sed -i "s|$curr_username:.*|$curr_username:$HASHED_DOKUWIKI_PASSWORD:$curr_username:$curr_username@$HOSTNAME:admin,user,upload|g" /var/www/$DOKUWIKI_DOMAIN_NAME/htdocs/lib/plugins/acl/users.auth.php
71
         else
83
         else
72
-            sed -i "s|$curr_username:.*|$curr_username:$HASHED_DOKUWIKI_PASSWORD:$curr_username:$curr_username@$HOSTNAME:user,upload|g" /var/lib/dokuwiki/acl/users.auth.php
84
+            sed -i "s|$curr_username:.*|$curr_username:$HASHED_DOKUWIKI_PASSWORD:$curr_username:$curr_username@$HOSTNAME:user,upload|g" /var/www/$DOKUWIKI_DOMAIN_NAME/htdocs/lib/plugins/acl/users.auth.php
73
         fi
85
         fi
74
-        chmod 640 /var/lib/dokuwiki/acl/users.auth.php
86
+        cp /var/www/$DOKUWIKI_DOMAIN_NAME/htdocs/lib/plugins/acl/users.auth.php /var/www/$DOKUWIKI_DOMAIN_NAME/htdocs/conf/users.auth.php
87
+        chmod 640 /var/www/$DOKUWIKI_DOMAIN_NAME/htdocs/conf/users.auth.php
88
+        chmod 640 /var/www/$DOKUWIKI_DOMAIN_NAME/htdocs/lib/plugins/acl/users.auth.php
75
         ${PROJECT_NAME}-pass -u $curr_username -a dokuwiki -p "$new_user_password"
89
         ${PROJECT_NAME}-pass -u $curr_username -a dokuwiki -p "$new_user_password"
76
     fi
90
     fi
77
 }
91
 }
80
     new_username="$1"
94
     new_username="$1"
81
     new_user_password="$2"
95
     new_user_password="$2"
82
 
96
 
97
+    DOKUWIKI_DOMAIN_NAME=$(get_completion_param "dokuwiki domain")
83
     HASHED_DOKUWIKI_PASSWORD=$(echo -n "$new_user_password" | md5sum | awk -F ' ' '{print $1}')
98
     HASHED_DOKUWIKI_PASSWORD=$(echo -n "$new_user_password" | md5sum | awk -F ' ' '{print $1}')
84
-    echo "$new_username:$HASHED_DOKUWIKI_PASSWORD:$new_username:$new_username@$HOSTNAME:user,upload" >> /var/lib/dokuwiki/acl/users.auth.php
85
-    chmod 640 /var/lib/dokuwiki/acl/users.auth.php
99
+    echo "$new_username:$HASHED_DOKUWIKI_PASSWORD:$new_username:$new_username@$HOSTNAME:user,upload" >> /var/www/$DOKUWIKI_DOMAIN_NAME/htdocs/lib/plugins/acl/users.auth.php
100
+    cp /var/www/$DOKUWIKI_DOMAIN_NAME/htdocs/lib/plugins/acl/users.auth.php /var/www/$DOKUWIKI_DOMAIN_NAME/htdocs/conf/users.auth.php
101
+    chmod 640 /var/www/$DOKUWIKI_DOMAIN_NAME/htdocs/lib/plugins/acl/users.auth.php
102
+    chmod 640 /var/www/$DOKUWIKI_DOMAIN_NAME/htdocs/conf/users.auth.php
86
     ${PROJECT_NAME}-pass -u "$new_username" -a dokuwiki -p "$new_user_password"
103
     ${PROJECT_NAME}-pass -u "$new_username" -a dokuwiki -p "$new_user_password"
87
 }
104
 }
88
 
105
 
89
 function remove_user_dokuwiki {
106
 function remove_user_dokuwiki {
90
     remove_username="$1"
107
     remove_username="$1"
91
 
108
 
92
-    if grep "$remove_username:" /var/lib/dokuwiki/acl/users.auth.php; then
93
-        sed -i "/$remove_username:/d" /var/lib/dokuwiki/acl/users.auth.php
109
+    read_config_param "DOKUWIKI_DOMAIN_NAME"
110
+    if grep -q "$remove_username:" /var/www/$DOKUWIKI_DOMAIN_NAME/htdocs/lib/plugins/acl/users.auth.php; then
111
+        sed -i "/$remove_username:/d" /var/www/$DOKUWIKI_DOMAIN_NAME/htdocs/lib/plugins/acl/users.auth.php
112
+        sed -i "/$remove_username:/d" /var/www/$DOKUWIKI_DOMAIN_NAME/htdocs/conf/users.auth.php
94
         ${PROJECT_NAME}-pass -u "$remove_username" --rmapp dokuwiki
113
         ${PROJECT_NAME}-pass -u "$remove_username" --rmapp dokuwiki
95
     fi
114
     fi
96
 }
115
 }
100
 }
119
 }
101
 
120
 
102
 function upgrade_dokuwiki {
121
 function upgrade_dokuwiki {
103
-    echo -n ''
122
+    function_check set_repo_commit
123
+    set_repo_commit /var/www/$DOKUWIKI_DOMAIN_NAME/htdocs "dokuwiki commit" "$DOKUWIKI_COMMIT" $DOKUWIKI_REPO
104
 }
124
 }
105
 
125
 
106
 function backup_local_dokuwiki {
126
 function backup_local_dokuwiki {
107
-    source_directory=/var/lib/dokuwiki
127
+    DOKUWIKI_DOMAIN_NAME=$(get_completion_param "dokuwiki domain")
128
+
129
+    function_check backup_directory_to_usb
130
+
131
+    # backup the data
132
+    source_directory=/var/www/$DOKUWIKI_DOMAIN_NAME/htdocs/data
108
     if [ -d $source_directory ]; then
133
     if [ -d $source_directory ]; then
109
-        dest_directory=dokuwiki
110
-        function_check backup_directory_to_usb
134
+        dest_directory=dokuwikidat
135
+        backup_directory_to_usb $source_directory $dest_directory
136
+    fi
137
+
138
+    # backup the users
139
+    source_directory=/var/www/$DOKUWIKI_DOMAIN_NAME/htdocs/lib/plugins/acl
140
+    if [ -d $source_directory ]; then
141
+        dest_directory=dokuwikiacl
142
+        cp /var/www/$DOKUWIKI_DOMAIN_NAME/htdocs/conf/users*.php /var/www/$DOKUWIKI_DOMAIN_NAME/htdocs/lib/plugins/acl/
111
         backup_directory_to_usb $source_directory $dest_directory
143
         backup_directory_to_usb $source_directory $dest_directory
112
-        backup_directory_to_usb /etc/dokuwiki dokuwiki2
113
     fi
144
     fi
114
 }
145
 }
115
 
146
 
116
-function restore_local_dokuwiki {
147
+function restore_local_dokuwiki_legacy {
117
     if [ -d /var/lib/dokuwiki ]; then
148
     if [ -d /var/lib/dokuwiki ]; then
118
-        echo $"Restoring Dokuwiki installation"
149
+        echo $"Restoring Legacy Dokuwiki installation"
119
         function_check get_completion_param
150
         function_check get_completion_param
120
         DOKUWIKI_DOMAIN_NAME=$(get_completion_param "dokuwiki domain")
151
         DOKUWIKI_DOMAIN_NAME=$(get_completion_param "dokuwiki domain")
152
+
121
         temp_restore_dir=/root/tempdokuwiki
153
         temp_restore_dir=/root/tempdokuwiki
122
         function_check restore_directory_from_usb
154
         function_check restore_directory_from_usb
123
         if [ -d ${USB_MOUNT}/backup/dokuwiki ]; then
155
         if [ -d ${USB_MOUNT}/backup/dokuwiki ]; then
125
         else
157
         else
126
             restore_directory_from_usb ${temp_restore_dir} wiki
158
             restore_directory_from_usb ${temp_restore_dir} wiki
127
         fi
159
         fi
128
-        cp -r ${temp_restore_dir}/var/lib/dokuwiki/* /var/lib/dokuwiki/
160
+
161
+        # restore the data
162
+        cp -r ${temp_restore_dir}/var/lib/dokuwiki/data/* /var/www/$DOKUWIKI_DOMAIN_NAME/htdocs/data
129
         if [ ! "$?" = "0" ]; then
163
         if [ ! "$?" = "0" ]; then
130
             function_check restore_directory_from_usb
164
             function_check restore_directory_from_usb
131
             set_user_permissions
165
             set_user_permissions
132
             function_check backup_unmount_drive
166
             function_check backup_unmount_drive
133
             backup_unmount_drive
167
             backup_unmount_drive
134
-            exit 868
168
+            rm -rf ${temp_restore_dir}
169
+            exit 73562
135
         fi
170
         fi
136
-        if [ -d ${USB_MOUNT}/backup/wiki2 ]; then
137
-            restore_directory_from_usb ${temp_restore_dir}2 wiki2
138
-        else
139
-            restore_directory_from_usb ${temp_restore_dir}2 dokuwiki2
140
-        fi
141
-        cp -r ${temp_restore_dir}2/etc/dokuwiki/* /etc/dokuwiki/
171
+
172
+        # restore the users
173
+        cp -r ${temp_restore_dir}/var/lib/dokuwiki/acl/users.auth.php /var/www/$DOKUWIKI_DOMAIN_NAME/htdocs/lib/plugins/acl
174
+        cp -r ${temp_restore_dir}/var/lib/dokuwiki/acl/users.auth.php /var/www/$DOKUWIKI_DOMAIN_NAME/htdocs/conf
142
         if [ ! "$?" = "0" ]; then
175
         if [ ! "$?" = "0" ]; then
143
-            function_check set_user_permissions
176
+            function_check restore_directory_from_usb
144
             set_user_permissions
177
             set_user_permissions
145
             function_check backup_unmount_drive
178
             function_check backup_unmount_drive
146
             backup_unmount_drive
179
             backup_unmount_drive
147
-            exit 869
180
+            rm -rf ${temp_restore_dir}
181
+            exit 23985
148
         fi
182
         fi
149
         rm -rf ${temp_restore_dir}
183
         rm -rf ${temp_restore_dir}
150
-        rm -rf ${temp_restore_dir}2
151
-        #rm -rf /var/lib/dokuwiki/data/cache/*
152
-        #rm -rf /var/lib/dokuwiki/data/meta/*
153
-        chmod -R 755 /var/lib/dokuwiki/data
154
-        chown -R www-data:www-data /var/lib/dokuwiki/data
155
-        chown -R www-data:www-data /var/lib/dokuwiki/*
156
-        # Ensure that the bundled SSL cert is being used
157
-        if [ -f /etc/ssl/certs/${DOKUWIKI_DOMAIN_NAME}.bundle.crt ]; then
158
-            sed -i "s|${DOKUWIKI_DOMAIN_NAME}.crt|${DOKUWIKI_DOMAIN_NAME}.bundle.crt|g" /etc/nginx/sites-available/${DOKUWIKI_DOMAIN_NAME}
159
-        fi
160
-        if [ -d /etc/letsencrypt/live/${DOKUWIKI_DOMAIN_NAME} ]; then
161
-            ln -s /etc/letsencrypt/live/${DOKUWIKI_DOMAIN_NAME}/privkey.pem /etc/ssl/private/${DOKUWIKI_DOMAIN_NAME}.key
162
-            ln -s /etc/letsencrypt/live/${DOKUWIKI_DOMAIN_NAME}/fullchain.pem /etc/ssl/certs/${DOKUWIKI_DOMAIN_NAME}.pem
163
-        fi
164
-        echo $"Restore of Dokuwiki complete"
184
+
185
+        chmod -R 755 /var/www/$DOKUWIKI_DOMAIN_NAME/htdocs/data
186
+        chmod -R 755 /var/www/$DOKUWIKI_DOMAIN_NAME/htdocs/lib
187
+        chmod 640 /var/www/$DOKUWIKI_DOMAIN_NAME/htdocs/lib/plugins/acl/users.auth.php
188
+        chmod 640 /var/www/$DOKUWIKI_DOMAIN_NAME/htdocs/conf/users.auth.php
189
+        chown -R www-data:www-data /var/www/$DOKUWIKI_DOMAIN_NAME/htdocs
190
+        echo $"Restore of Legacy Dokuwiki complete"
165
     fi
191
     fi
166
 }
192
 }
167
 
193
 
194
+function restore_local_dokuwiki {
195
+    if [ -d ${USB_MOUNT}/backup/dokuwiki ]; then
196
+        restore_local_dokuwiki_legacy
197
+        return
198
+    fi
199
+
200
+    echo $"Restoring Dokuwiki installation"
201
+    function_check get_completion_param
202
+    DOKUWIKI_DOMAIN_NAME=$(get_completion_param "dokuwiki domain")
203
+
204
+    # restore the data
205
+    temp_restore_dir=/root/tempdokuwikidat
206
+    function_check restore_directory_from_usb
207
+    restore_directory_from_usb ${temp_restore_dir} dokuwikidat
208
+    cp -r ${temp_restore_dir}/var/www/${DOKUWIKI_DOMAIN_NAME}/htdocs/data/* /var/www/$DOKUWIKI_DOMAIN_NAME/htdocs/data
209
+    if [ ! "$?" = "0" ]; then
210
+        function_check restore_directory_from_usb
211
+        set_user_permissions
212
+        function_check backup_unmount_drive
213
+        backup_unmount_drive
214
+        rm -rf ${temp_restore_dir}
215
+        exit 683352
216
+    fi
217
+    rm -rf ${temp_restore_dir}
218
+
219
+    # restore the users
220
+    temp_restore_dir=/root/tempdokuwikiacl
221
+    function_check restore_directory_from_usb
222
+    restore_directory_from_usb ${temp_restore_dir} dokuwikiacl
223
+    cp ${temp_restore_dir}/var/www/${DOKUWIKI_DOMAIN_NAME}/htdocs/lib/plugins/acl/users.auth.php /var/www/$DOKUWIKI_DOMAIN_NAME/htdocs/lib/plugins/acl/
224
+    cp ${temp_restore_dir}/var/www/${DOKUWIKI_DOMAIN_NAME}/htdocs/lib/plugins/acl/users.auth.php /var/www/$DOKUWIKI_DOMAIN_NAME/htdocs/conf/
225
+    if [ ! "$?" = "0" ]; then
226
+        function_check restore_directory_from_usb
227
+        set_user_permissions
228
+        function_check backup_unmount_drive
229
+        backup_unmount_drive
230
+        rm -rf ${temp_restore_dir}
231
+        exit 456495
232
+    fi
233
+    rm -rf ${temp_restore_dir}
234
+
235
+    chmod 640 /var/www/$DOKUWIKI_DOMAIN_NAME/htdocs/lib/plugins/acl/users.auth.php
236
+    chmod 640 /var/www/$DOKUWIKI_DOMAIN_NAME/htdocs/conf/users.auth.php
237
+    chmod -R 755 /var/www/$DOKUWIKI_DOMAIN_NAME/htdocs/data
238
+    chmod -R 755 /var/www/$DOKUWIKI_DOMAIN_NAME/htdocs/lib
239
+    chown -R www-data:www-data /var/www/$DOKUWIKI_DOMAIN_NAME/htdocs
240
+    echo $"Restore of Dokuwiki complete"
241
+}
242
+
168
 function backup_remote_dokuwiki {
243
 function backup_remote_dokuwiki {
169
-    if [ -d /etc/dokuwiki ]; then
244
+    DOKUWIKI_DOMAIN_NAME=$(get_completion_param "dokuwiki domain")
245
+    if [ -d /var/www/$DOKUWIKI_DOMAIN_NAME/htdocs ]; then
170
         echo $"Backing up dokuwiki"
246
         echo $"Backing up dokuwiki"
171
-        backup_directory_to_friend /var/lib/dokuwiki dokuwiki
172
-        backup_directory_to_friend /etc/dokuwiki dokuwiki2
247
+        backup_directory_to_friend /var/www/$DOKUWIKI_DOMAIN_NAME/htdocs/data dokuwikidat
248
+        cp /var/www/$DOKUWIKI_DOMAIN_NAME/htdocs/conf/users*.php /var/www/$DOKUWIKI_DOMAIN_NAME/htdocs/lib/plugins/acl/
249
+        backup_directory_to_friend /var/www/$DOKUWIKI_DOMAIN_NAME/htdocs/lib/plugins/acl dokuwikiacl
173
     fi
250
     fi
174
 }
251
 }
175
 
252
 
176
 function restore_remote_dokuwiki {
253
 function restore_remote_dokuwiki {
177
-    if [ -d $SERVER_DIRECTORY/backup/dokuwiki ]; then
178
-        function_check get_completion_param
179
-        DOKUWIKI_DOMAIN_NAME=$(get_completion_param "dokuwiki domain")
180
-        echo $"Restoring Dokuwiki installation $DOKUWIKI_DOMAIN_NAME"
181
-        function_check restore_directory_from_friend
182
-        restore_directory_from_friend /root/tempdokuwiki dokuwiki
183
-        cp -r /root/tempdokuwiki/var/lib/dokuwiki/* /var/lib/dokuwiki/
254
+    DOKUWIKI_DOMAIN_NAME=$(get_completion_param "dokuwiki domain")
255
+    function_check get_completion_param
256
+    function_check restore_directory_from_friend
257
+
258
+    if [ -d $SERVER_DIRECTORY/backup/dokuwikidat ]; then
259
+        echo $"Restoring Dokuwiki data for $DOKUWIKI_DOMAIN_NAME"
260
+        restore_directory_from_friend /root/tempdokuwikidat dokuwikidat
261
+        cp -r /root/tempdokuwikidat/var/www/$DOKUWIKI_DOMAIN_NAME/htdocs/data/* /var/www/$DOKUWIKI_DOMAIN_NAME/htdocs/data/
184
         if [ ! "$?" = "0" ]; then
262
         if [ ! "$?" = "0" ]; then
185
-            exit 868
263
+            exit 92634
186
         fi
264
         fi
187
-        restore_directory_from_friend /root/tempdokuwiki2 dokuwiki2
188
-        cp -r /root/tempdokuwiki2/etc/dokuwiki/* /etc/dokuwiki/
265
+        rm -rf /root/tempdokuwikidat
266
+
267
+        echo $"Restore of Dokuwiki data complete"
268
+    fi
269
+
270
+    if [ -d $SERVER_DIRECTORY/backup/dokuwikiacl ]; then
271
+        echo $"Restoring Dokuwiki users for $DOKUWIKI_DOMAIN_NAME"
272
+        restore_directory_from_friend /root/tempdokuwikiacl dokuwikiacl
273
+        cp -r /root/tempdokuwikidat/var/www/$DOKUWIKI_DOMAIN_NAME/htdocs/lib/plugins/acl/* /var/www/$DOKUWIKI_DOMAIN_NAME/htdocs/lib/plugins/acl/
189
         if [ ! "$?" = "0" ]; then
274
         if [ ! "$?" = "0" ]; then
190
-            exit 869
191
-        fi
192
-        rm -rf /root/tempdokuwiki
193
-        rm -rf /root/tempdokuwiki2
194
-        #rm -rf /var/lib/dokuwiki/data/cache/*
195
-        #rm -rf /var/lib/dokuwiki/data/meta/*
196
-        chmod -R 755 /var/lib/dokuwiki/data
197
-        chown -R www-data:www-data /var/lib/dokuwiki/data
198
-        chown -R www-data:www-data /var/lib/dokuwiki/*
199
-        # Ensure that the bundled SSL cert is being used
200
-        if [ -f /etc/ssl/certs/${DOKUWIKI_DOMAIN_NAME}.bundle.crt ]; then
201
-            sed -i "s|${DOKUWIKI_DOMAIN_NAME}.crt|${DOKUWIKI_DOMAIN_NAME}.bundle.crt|g" /etc/nginx/sites-available/${DOKUWIKI_DOMAIN_NAME}
275
+            exit 735287
202
         fi
276
         fi
203
-        if [ -d /etc/letsencrypt/live/${DOKUWIKI_DOMAIN_NAME} ]; then
204
-            ln -s /etc/letsencrypt/live/${DOKUWIKI_DOMAIN_NAME}/privkey.pem /etc/ssl/private/${DOKUWIKI_DOMAIN_NAME}.key
205
-            ln -s /etc/letsencrypt/live/${DOKUWIKI_DOMAIN_NAME}/fullchain.pem /etc/ssl/certs/${DOKUWIKI_DOMAIN_NAME}.pem
206
-        fi
207
-        echo $"Restore of Dokuwiki complete"
277
+        rm -rf /root/tempdokuwikiacl
278
+
279
+        echo $"Restore of Dokuwiki users complete"
208
     fi
280
     fi
281
+
282
+    chmod 640 /var/www/$DOKUWIKI_DOMAIN_NAME/htdocs/lib/plugins/acl/users.auth.php
283
+    chmod 640 /var/www/$DOKUWIKI_DOMAIN_NAME/htdocs/conf/users.auth.php
284
+    chmod -R 755 /var/www/$DOKUWIKI_DOMAIN_NAME/htdocs/data/data
285
+    chmod -R 755 /var/www/$DOKUWIKI_DOMAIN_NAME/htdocs/data/lib
286
+    chown -R www-data:www-data /var/www/$DOKUWIKI_DOMAIN_NAME/htdocs
209
 }
287
 }
210
 
288
 
211
 function remove_dokuwiki {
289
 function remove_dokuwiki {
219
     if [ -f /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME ]; then
297
     if [ -f /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME ]; then
220
         rm /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
298
         rm /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
221
     fi
299
     fi
222
-    apt-get -yq remove --purge dokuwiki
223
     if [ ! -d /var/www/$DOKUWIKI_DOMAIN_NAME ]; then
300
     if [ ! -d /var/www/$DOKUWIKI_DOMAIN_NAME ]; then
224
         rm -rf /var/www/$DOKUWIKI_DOMAIN_NAME
301
         rm -rf /var/www/$DOKUWIKI_DOMAIN_NAME
225
     fi
302
     fi
244
     if [ ! $DOKUWIKI_DOMAIN_NAME ]; then
321
     if [ ! $DOKUWIKI_DOMAIN_NAME ]; then
245
         return
322
         return
246
     fi
323
     fi
247
-    apt-get -yq install dokuwiki
248
-    apt-get -yq remove --purge apache*
249
-    if [ -d /etc/apache2 ]; then
250
-        rm -rf /etc/apache2
251
-        echo $'Removed Apache installation after Dokuwiki install'
252
-    fi
324
+
325
+    apt-get -yq install php-common php-cli php-curl php-gd php-mcrypt git
326
+    apt-get -yq install php-dev imagemagick php-imagick libfcgi0ldbl
327
+    apt-get -yq install php-memcached memcached
253
 
328
 
254
     if [ ! -d /var/www/$DOKUWIKI_DOMAIN_NAME ]; then
329
     if [ ! -d /var/www/$DOKUWIKI_DOMAIN_NAME ]; then
255
         mkdir /var/www/$DOKUWIKI_DOMAIN_NAME
330
         mkdir /var/www/$DOKUWIKI_DOMAIN_NAME
256
     fi
331
     fi
257
-    if [ -d /var/www/$DOKUWIKI_DOMAIN_NAME/htdocs ]; then
258
-        rm -rf /var/www/$DOKUWIKI_DOMAIN_NAME/htdocs
259
-    fi
260
-
261
-    ln -s /usr/share/dokuwiki /var/www/$DOKUWIKI_DOMAIN_NAME/htdocs
262
-
263
-    if [ ! -d /var/lib/dokuwiki/custom ]; then
264
-        mkdir /var/lib/dokuwiki/custom
265
-    fi
266
-    cp /etc/dokuwiki/local.php.dist /var/lib/dokuwiki/custom/local.php
267
-    if [ ! -f /etc/dokuwiki/local.php ]; then
268
-        ln -s /var/lib/dokuwiki/custom/local.php /etc/dokuwiki/local.php
269
-    fi
270
-
271
-    chown www-data /var/lib/dokuwiki/custom
272
-    chown www-data /var/lib/dokuwiki/custom/local.php
273
-    chown -R www-data /etc/dokuwiki
274
-    chown -R www-data /usr/share/dokuwiki/lib/
275
-    chmod 600 /var/lib/dokuwiki/custom/local.php
276
-    chmod -R 755 /usr/share/dokuwiki/lib
277
 
332
 
278
-    sed -i 's|//$conf|$conf|g' /var/lib/dokuwiki/custom/local.php
279
-    sed -i "s|joe|$MY_USERNAME|g" /var/lib/dokuwiki/custom/local.php
333
+    if [ ! -f /var/www/$DOKUWIKI_DOMAIN_NAME/htdocs/install.php ]; then
334
+        cd /var/www/$DOKUWIKI_DOMAIN_NAME
280
 
335
 
281
-    sed -i "s|Debian Dokuwiki|$DOKUWIKI_TITLE|g" /etc/dokuwiki/local.php
282
-    sed -i "s|Debian DokuWiki|$DOKUWIKI_TITLE|g" /etc/dokuwiki/local.php
336
+        if [ -d /repos/dokuwiki ]; then
337
+            mkdir /var/www/$DOKUWIKI_DOMAIN_NAME/htdocs
338
+            cp -r -p /repos/dokuwiki/. /var/www/$DOKUWIKI_DOMAIN_NAME/htdocs
339
+            cd /var/www/$DOKUWIKI_DOMAIN_NAME/htdocs
340
+            git pull
341
+        else
342
+            function_check git_clone
343
+            git_clone $DOKUWIKI_REPO /var/www/$DOKUWIKI_DOMAIN_NAME/htdocs
344
+        fi
283
 
345
 
284
-    # set the admin user
285
-    sed -i "s/@admin/$MY_USERNAME/g" /etc/dokuwiki/local.php
346
+        cd /var/www/$DOKUWIKI_DOMAIN_NAME/htdocs
347
+        git checkout $DOKUWIKI_COMMIT -b $DOKUWIKI_COMMIT
348
+        set_completion_param "dokuwiki commit" "$DOKUWIKI_COMMIT"
286
 
349
 
287
-    # disallow registration of new users
288
-    if ! grep -q "disableactions" /etc/dokuwiki/local.php; then
289
-        echo "\$conf['disableactions'] = 'register';" >> /etc/dokuwiki/local.php
290
-    fi
291
-    if ! grep -q "disableactions" /var/lib/dokuwiki/custom/local.php; then
292
-        echo "\$conf['disableactions'] = 'register';" >> /var/lib/dokuwiki/custom/local.php
293
     fi
350
     fi
294
 
351
 
295
-    if ! grep -q "authtype" /var/lib/dokuwiki/custom/local.php; then
296
-        echo "\$conf['authtype'] = 'authplain';" >> /var/lib/dokuwiki/custom/local.php
297
-    fi
298
-    if ! grep -q "authtype" /etc/dokuwiki/local.php; then
299
-        echo "\$conf['authtype'] = 'authplain';" >> /etc/dokuwiki/local.php
352
+    apt-get -yq remove --purge apache2-bin*
353
+    if [ -d /etc/apache2 ]; then
354
+        rm -rf /etc/apache2
355
+        echo $'Removed Apache installation after Dokuwiki install'
300
     fi
356
     fi
301
 
357
 
358
+    echo '<?php' > /var/www/$DOKUWIKI_DOMAIN_NAME/htdocs/conf/local.php
359
+    echo "\$conf['title'] = '${DOKUWIKI_TITLE}';" >> /var/www/$DOKUWIKI_DOMAIN_NAME/htdocs/conf/local.php
360
+    echo "\$conf['lang'] = 'en';" >> /var/www/$DOKUWIKI_DOMAIN_NAME/htdocs/conf/local.php
361
+    echo "\$conf['license'] = 'cc-by-sa';" >> /var/www/$DOKUWIKI_DOMAIN_NAME/htdocs/conf/local.php
362
+    echo "\$conf['useacl'] = 1;" >> /var/www/$DOKUWIKI_DOMAIN_NAME/htdocs/conf/local.php
363
+    echo "\$conf['superuser'] = '@admin';" >> /var/www/$DOKUWIKI_DOMAIN_NAME/htdocs/conf/local.php
364
+    echo "\$conf['disableactions'] = 'register';" >> /var/www/$DOKUWIKI_DOMAIN_NAME/htdocs/conf/local.php
365
+    ln -s /var/www/$DOKUWIKI_DOMAIN_NAME/htdocs/conf/local.php /var/www/$DOKUWIKI_DOMAIN_NAME/htdocs/local.php
366
+
367
+    chmod 600 /var/www/$DOKUWIKI_DOMAIN_NAME/htdocs/conf/local.php
368
+    chown -R www-data:www-data /var/www/$DOKUWIKI_DOMAIN_NAME/htdocs
369
+    chmod -R 755 /var/www/$DOKUWIKI_DOMAIN_NAME/htdocs/lib
370
+    chmod -R 755 /var/www/$DOKUWIKI_DOMAIN_NAME/htdocs/data
371
+
302
     if [ -f $IMAGE_PASSWORD_FILE ]; then
372
     if [ -f $IMAGE_PASSWORD_FILE ]; then
303
         DOKUWIKI_ADMIN_PASSWORD="$(printf `cat $IMAGE_PASSWORD_FILE`)"
373
         DOKUWIKI_ADMIN_PASSWORD="$(printf `cat $IMAGE_PASSWORD_FILE`)"
304
     else
374
     else
307
         fi
377
         fi
308
     fi
378
     fi
309
     HASHED_DOKUWIKI_PASSWORD=$(echo -n "$DOKUWIKI_ADMIN_PASSWORD" | md5sum | awk -F ' ' '{print $1}')
379
     HASHED_DOKUWIKI_PASSWORD=$(echo -n "$DOKUWIKI_ADMIN_PASSWORD" | md5sum | awk -F ' ' '{print $1}')
310
-    echo -n "$MY_USERNAME:$HASHED_DOKUWIKI_PASSWORD:$MY_NAME:$MY_EMAIL:admin,user,upload" > /var/lib/dokuwiki/acl/users.auth.php
311
-    chmod 640 /var/lib/dokuwiki/acl/users.auth.php
380
+    echo -n "$MY_USERNAME:$HASHED_DOKUWIKI_PASSWORD:$MY_NAME:$MY_EMAIL:admin,user,upload" > /var/www/$DOKUWIKI_DOMAIN_NAME/htdocs/lib/plugins/acl/users.auth.php
381
+    cp /var/www/$DOKUWIKI_DOMAIN_NAME/htdocs/lib/plugins/acl/users.auth.php /var/www/$DOKUWIKI_DOMAIN_NAME/htdocs/conf/users.auth.php
382
+    chmod 640 /var/www/$DOKUWIKI_DOMAIN_NAME/htdocs/lib/plugins/acl/users.auth.php
312
 
383
 
313
-    if ! grep -q "video/ogg" /etc/dokuwiki/mime.conf; then
314
-        echo 'ogv     video/ogg' >> /etc/dokuwiki/mime.conf
384
+    if ! grep -q "video/ogg" /var/www/$DOKUWIKI_DOMAIN_NAME/htdocs/conf/mime.conf; then
385
+        echo 'ogv     video/ogg' >> /var/www/$DOKUWIKI_DOMAIN_NAME/htdocs/conf/mime.conf
315
     fi
386
     fi
316
-    if ! grep -q "video/mp4" /etc/dokuwiki/mime.conf; then
317
-        echo 'mp4     video/mp4' >> /etc/dokuwiki/mime.conf
387
+    if ! grep -q "video/mp4" /var/www/$DOKUWIKI_DOMAIN_NAME/htdocs/conf/mime.conf; then
388
+        echo 'mp4     video/mp4' >> /var/www/$DOKUWIKI_DOMAIN_NAME/htdocs/conf/mime.conf
318
     fi
389
     fi
319
-    if ! grep -q "video/webm" /etc/dokuwiki/mime.conf; then
320
-        echo 'webm    video/webm' >> /etc/dokuwiki/mime.conf
390
+    if ! grep -q "video/webm" /var/www/$DOKUWIKI_DOMAIN_NAME/htdocs/conf/mime.conf; then
391
+        echo 'webm    video/webm' >> /var/www/$DOKUWIKI_DOMAIN_NAME/htdocs/conf/mime.conf
321
     fi
392
     fi
322
 
393
 
323
     DOKUWIKI_ONION_HOSTNAME=$(add_onion_service dokuwiki 80 ${DOKUWIKI_ONION_PORT})
394
     DOKUWIKI_ONION_HOSTNAME=$(add_onion_service dokuwiki 80 ${DOKUWIKI_ONION_PORT})
379
         echo '        try_files $uri $uri/ /index.php;' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
450
         echo '        try_files $uri $uri/ /index.php;' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
380
         echo '        # NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
451
         echo '        # NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
381
         echo '        fastcgi_split_path_info ^(.+\.php)(/.+)$;' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
452
         echo '        fastcgi_split_path_info ^(.+\.php)(/.+)$;' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
382
-        echo '        # With php5-cgi alone:' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
453
+        echo '        # With php-cgi alone:' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
383
         echo '        # fastcgi_pass 127.0.0.1:9000;' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
454
         echo '        # fastcgi_pass 127.0.0.1:9000;' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
384
-        echo '        # With php5-fpm:' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
385
-        echo '        fastcgi_pass unix:/var/run/php5-fpm.sock;' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
455
+        echo '        # With php-fpm:' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
456
+        echo '        fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
457
+        echo '        fastcgi_read_timeout 30;' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
386
         echo '        include fastcgi_params;' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
458
         echo '        include fastcgi_params;' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
387
         echo '        fastcgi_index index.php;' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
459
         echo '        fastcgi_index index.php;' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
388
         echo '        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
460
         echo '        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
457
     echo '        try_files $uri $uri/ /index.php;' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
529
     echo '        try_files $uri $uri/ /index.php;' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
458
     echo '        # NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
530
     echo '        # NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
459
     echo '        fastcgi_split_path_info ^(.+\.php)(/.+)$;' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
531
     echo '        fastcgi_split_path_info ^(.+\.php)(/.+)$;' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
460
-    echo '        # With php5-cgi alone:' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
532
+    echo '        # With php-cgi alone:' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
461
     echo '        # fastcgi_pass 127.0.0.1:9000;' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
533
     echo '        # fastcgi_pass 127.0.0.1:9000;' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
462
-    echo '        # With php5-fpm:' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
463
-    echo '        fastcgi_pass unix:/var/run/php5-fpm.sock;' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
534
+    echo '        # With php-fpm:' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
535
+    echo '        fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
536
+    echo '        fastcgi_read_timeout 30;' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
464
     echo '        include fastcgi_params;' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
537
     echo '        include fastcgi_params;' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
465
     echo '        fastcgi_index index.php;' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
538
     echo '        fastcgi_index index.php;' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
466
     echo '        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
539
     echo '        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
491
 
564
 
492
     nginx_ensite $DOKUWIKI_DOMAIN_NAME
565
     nginx_ensite $DOKUWIKI_DOMAIN_NAME
493
 
566
 
494
-    systemctl restart php5-fpm
567
+    systemctl restart php7.0-fpm
495
     systemctl restart nginx
568
     systemctl restart nginx
496
 
569
 
497
     function_check add_ddns_domain
570
     function_check add_ddns_domain

+ 11
- 3
src/freedombone-app-emacs View File

36
 emacs_variables=(USB_MOUNT
36
 emacs_variables=(USB_MOUNT
37
                  MY_USERNAME)
37
                  MY_USERNAME)
38
 
38
 
39
+function logging_on_emacs {
40
+    echo -n ''
41
+}
42
+
43
+function logging_off_emacs {
44
+    echo -n ''
45
+}
46
+
39
 function reconfigure_emacs {
47
 function reconfigure_emacs {
40
     echo -n ''
48
     echo -n ''
41
 }
49
 }
133
 }
141
 }
134
 
142
 
135
 function remove_emacs {
143
 function remove_emacs {
136
-    apt-get -yq remove --purge emacs24
144
+    apt-get -yq remove --purge emacs
137
     update-alternatives --set editor /usr/bin/nano
145
     update-alternatives --set editor /usr/bin/nano
138
     sed -i '/install_emacs/d' $COMPLETION_FILE
146
     sed -i '/install_emacs/d' $COMPLETION_FILE
139
 
147
 
156
 }
164
 }
157
 
165
 
158
 function install_emacs {
166
 function install_emacs {
159
-    apt-get -yq install emacs24
160
-    update-alternatives --set editor /usr/bin/emacs24
167
+    apt-get -yq install emacs
168
+    update-alternatives --set editor /usr/bin/emacs
161
 
169
 
162
     # A minimal emacs configuration
170
     # A minimal emacs configuration
163
     #echo -n "(add-to-list 'load-path " > /home/$MY_USERNAME/.emacs
171
     #echo -n "(add-to-list 'load-path " > /home/$MY_USERNAME/.emacs

+ 43
- 5
src/freedombone-app-etherpad View File

13
 # License
13
 # License
14
 # =======
14
 # =======
15
 #
15
 #
16
-# Copyright (C) 2016 Bob Mottram <bob@freedombone.net>
16
+# Copyright (C) 2016-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
52
                     DDNS_PROVIDER
52
                     DDNS_PROVIDER
53
                     MY_USERNAME)
53
                     MY_USERNAME)
54
 
54
 
55
+function logging_on_etherpad {
56
+    echo -n ''
57
+}
58
+
59
+function logging_off_etherpad {
60
+    echo -n ''
61
+}
62
+
55
 function etherpad_password_hash {
63
 function etherpad_password_hash {
56
     echo $(python -c "from passlib.hash import bcrypt;print(bcrypt.encrypt(\"$1\", rounds=10))")
64
     echo $(python -c "from passlib.hash import bcrypt;print(bcrypt.encrypt(\"$1\", rounds=10))")
57
 }
65
 }
62
 
70
 
63
     read_config_param ETHERPAD_DOMAIN_NAME
71
     read_config_param ETHERPAD_DOMAIN_NAME
64
 
72
 
65
-    if grep "\"$change_username\": {" /var/www/${ETHERPAD_DOMAIN_NAME}/htdocs/settings.json; then
73
+    if grep -q "\"$change_username\": {" /var/www/${ETHERPAD_DOMAIN_NAME}/htdocs/settings.json; then
66
         user_line=$(cat /var/www/${ETHERPAD_DOMAIN_NAME}/htdocs/settings.json | grep "\"$change_username\": {")
74
         user_line=$(cat /var/www/${ETHERPAD_DOMAIN_NAME}/htdocs/settings.json | grep "\"$change_username\": {")
67
         if [[ "$user_line" == *"\"is_admin\": true"* ]]; then
75
         if [[ "$user_line" == *"\"is_admin\": true"* ]]; then
68
             sed -i "s|\"$change_username\": {.*|\"$change_username\": { \"hash\": \"$new_user_password\", \"is_admin\": true }|g" /var/www/${ETHERPAD_DOMAIN_NAME}/htdocs/settings.json
76
             sed -i "s|\"$change_username\": {.*|\"$change_username\": { \"hash\": \"$new_user_password\", \"is_admin\": true }|g" /var/www/${ETHERPAD_DOMAIN_NAME}/htdocs/settings.json
302
 }
310
 }
303
 
311
 
304
 function upgrade_etherpad {
312
 function upgrade_etherpad {
313
+    CURR_ETHERPAD_COMMIT=$(get_completion_param "etherpad commit")
314
+    if [[ "$CURR_ETHERPAD_COMMIT" == "$ETHERPAD_COMMIT" ]]; then
315
+        return
316
+    fi
317
+
305
     read_config_param "ETHERPAD_DOMAIN_NAME"
318
     read_config_param "ETHERPAD_DOMAIN_NAME"
306
 
319
 
307
     function_check set_repo_commit
320
     function_check set_repo_commit
355
         if [ -f /etc/ssl/private/${ETHERPAD_DOMAIN_NAME}.key ]; then
368
         if [ -f /etc/ssl/private/${ETHERPAD_DOMAIN_NAME}.key ]; then
356
             chown etherpad: /etc/ssl/private/${ETHERPAD_DOMAIN_NAME}.key
369
             chown etherpad: /etc/ssl/private/${ETHERPAD_DOMAIN_NAME}.key
357
         fi
370
         fi
371
+
372
+        MARIADB_PASSWORD=$(${PROJECT_NAME}-pass -u root -a mariadb)
373
+        settings_file=/var/www/${ETHERPAD_DOMAIN_NAME}/htdocs/settings.json
374
+        sed -i "s|\"password\":.*|\"password\": \"${MARIADB_PASSWORD}\",|g" $settings_file
375
+        MARIADB_PASSWORD=
358
     fi
376
     fi
359
 }
377
 }
360
 
378
 
400
         if [ -f /etc/ssl/private/${ETHERPAD_DOMAIN_NAME}.key ]; then
418
         if [ -f /etc/ssl/private/${ETHERPAD_DOMAIN_NAME}.key ]; then
401
             chown etherpad: /etc/ssl/private/${ETHERPAD_DOMAIN_NAME}.key
419
             chown etherpad: /etc/ssl/private/${ETHERPAD_DOMAIN_NAME}.key
402
         fi
420
         fi
421
+
422
+        MARIADB_PASSWORD=$(${PROJECT_NAME}-pass -u root -a mariadb)
423
+        settings_file=/var/www/${ETHERPAD_DOMAIN_NAME}/htdocs/settings.json
424
+        sed -i "s|\"password\":.*|\"password\": \"${MARIADB_PASSWORD}\",|g" $settings_file
425
+        MARIADB_PASSWORD=
403
     fi
426
     fi
404
 }
427
 }
405
 
428
 
415
         systemctl disable etherpad
438
         systemctl disable etherpad
416
         rm /etc/systemd/system/etherpad.service
439
         rm /etc/systemd/system/etherpad.service
417
     fi
440
     fi
441
+    systemctl daemon-reload
418
     nginx_dissite $ETHERPAD_DOMAIN_NAME
442
     nginx_dissite $ETHERPAD_DOMAIN_NAME
419
     remove_certs $ETHERPAD_DOMAIN_NAME
443
     remove_certs $ETHERPAD_DOMAIN_NAME
420
     if [ -d /var/www/$ETHERPAD_DOMAIN_NAME ]; then
444
     if [ -d /var/www/$ETHERPAD_DOMAIN_NAME ]; then
431
     remove_completion_param install_etherpad
455
     remove_completion_param install_etherpad
432
     sed -i '/etherpad/d' $COMPLETION_FILE
456
     sed -i '/etherpad/d' $COMPLETION_FILE
433
     remove_backup_database_local etherpad
457
     remove_backup_database_local etherpad
434
-    deluser --remove-all-files etherpad
435
     remove_nodejs etherpad
458
     remove_nodejs etherpad
436
 
459
 
460
+    groupdel -f etherpad
461
+    userdel -r etherpad
462
+
437
     function_check remove_ddns_domain
463
     function_check remove_ddns_domain
438
     remove_ddns_domain $ETHERPAD_DOMAIN_NAME
464
     remove_ddns_domain $ETHERPAD_DOMAIN_NAME
439
 }
465
 }
444
         exit 7359
470
         exit 7359
445
     fi
471
     fi
446
 
472
 
473
+    check_ram_availability 2000
474
+
447
     if [ -f $IMAGE_PASSWORD_FILE ]; then
475
     if [ -f $IMAGE_PASSWORD_FILE ]; then
448
         ETHERPAD_ADMIN_PASSWORD="$(printf `cat $IMAGE_PASSWORD_FILE`)"
476
         ETHERPAD_ADMIN_PASSWORD="$(printf `cat $IMAGE_PASSWORD_FILE`)"
449
     else
477
     else
472
         mkdir /var/www/$ETHERPAD_DOMAIN_NAME
500
         mkdir /var/www/$ETHERPAD_DOMAIN_NAME
473
     fi
501
     fi
474
     if [ ! -d /var/www/$ETHERPAD_DOMAIN_NAME/htdocs ]; then
502
     if [ ! -d /var/www/$ETHERPAD_DOMAIN_NAME/htdocs ]; then
475
-        function_check git_clone
476
-        git_clone $ETHERPAD_REPO /var/www/$ETHERPAD_DOMAIN_NAME/htdocs
503
+
504
+        if [ -d /repos/etherpad ]; then
505
+            mkdir /var/www/$ETHERPAD_DOMAIN_NAME/htdocs
506
+            cp -r -p /repos/etherpad/. /var/www/$ETHERPAD_DOMAIN_NAME/htdocs
507
+            cd /var/www/$ETHERPAD_DOMAIN_NAME/htdocs
508
+            git pull
509
+        else
510
+            function_check git_clone
511
+            git_clone $ETHERPAD_REPO /var/www/$ETHERPAD_DOMAIN_NAME/htdocs
512
+        fi
513
+
477
         if [ ! -d /var/www/$ETHERPAD_DOMAIN_NAME/htdocs ]; then
514
         if [ ! -d /var/www/$ETHERPAD_DOMAIN_NAME/htdocs ]; then
478
             echo $'Unable to clone etherpad repo'
515
             echo $'Unable to clone etherpad repo'
479
             exit 56382
516
             exit 56382
612
 
649
 
613
     set_completion_param "etherpad domain" "$ETHERPAD_DOMAIN_NAME"
650
     set_completion_param "etherpad domain" "$ETHERPAD_DOMAIN_NAME"
614
 
651
 
652
+    systemctl restart mariadb
615
     systemctl enable etherpad
653
     systemctl enable etherpad
616
     systemctl daemon-reload
654
     systemctl daemon-reload
617
     systemctl start etherpad
655
     systemctl start etherpad

+ 47
- 12
src/freedombone-app-friendica View File

50
                      FRIENDICA_REPO
50
                      FRIENDICA_REPO
51
                      FRIENDICA_ADDONS_REPO)
51
                      FRIENDICA_ADDONS_REPO)
52
 
52
 
53
+function logging_on_friendica {
54
+    echo -n ''
55
+}
56
+
57
+function logging_off_friendica {
58
+    echo -n ''
59
+}
60
+
53
 function remove_user_friendica {
61
 function remove_user_friendica {
54
     remove_username="$1"
62
     remove_username="$1"
55
     ${PROJECT_NAME}-pass -u $remove_username --rmapp friendica
63
     ${PROJECT_NAME}-pass -u $remove_username --rmapp friendica
213
 }
221
 }
214
 
222
 
215
 function upgrade_friendica {
223
 function upgrade_friendica {
224
+    CURR_FRIENDICA_COMMIT=$(get_completion_param "friendica commit")
225
+    if [[ "$CURR_FRIENDICA_COMMIT" == "$FRIENDICA_COMMIT" ]]; then
226
+        return
227
+    fi
228
+
216
     FRIENDICA_PATH=/var/www/$FRIENDICA_DOMAIN_NAME/htdocs
229
     FRIENDICA_PATH=/var/www/$FRIENDICA_DOMAIN_NAME/htdocs
217
 
230
 
218
     function_check set_repo_commit
231
     function_check set_repo_commit
247
         if [ -d $temp_restore_dir ]; then
260
         if [ -d $temp_restore_dir ]; then
248
             rm -rf $temp_restore_dir
261
             rm -rf $temp_restore_dir
249
         fi
262
         fi
263
+
264
+        MARIADB_PASSWORD=$(${PROJECT_NAME}-pass -u root -a mariadb)
265
+        FRIENDICA_PATH=/var/www/$FRIENDICA_DOMAIN_NAME/htdocs
266
+        sed -i "s|\$db_pass =.*|\$db_pass = '${MARIADB_PASSWORD}';|g" $FRIENDICA_PATH/.htconfig.php
267
+        MARIADB_PASSWORD=
250
     fi
268
     fi
251
 }
269
 }
252
 
270
 
282
     if [ -d /root/tempfriendica ]; then
300
     if [ -d /root/tempfriendica ]; then
283
         rm -rf /root/tempfriendica
301
         rm -rf /root/tempfriendica
284
     fi
302
     fi
303
+
304
+    MARIADB_PASSWORD=$(${PROJECT_NAME}-pass -u root -a mariadb)
305
+    FRIENDICA_PATH=/var/www/$FRIENDICA_DOMAIN_NAME/htdocs
306
+    sed -i "s|\$db_pass =.*|\$db_pass = '${MARIADB_PASSWORD}';|g" $FRIENDICA_PATH/.htconfig.php
307
+    MARIADB_PASSWORD=
285
 }
308
 }
286
 
309
 
287
 function remove_friendica {
310
 function remove_friendica {
327
     function_check repair_databases_script
350
     function_check repair_databases_script
328
     repair_databases_script
351
     repair_databases_script
329
 
352
 
330
-    apt-get -yq install php5-common php5-cli php5-curl php5-gd php5-mysql php5-mcrypt git
331
-    apt-get -yq install php5-dev imagemagick php5-imagick
332
-    apt-get -yq install php5-memcached
353
+    apt-get -yq install php-common php-cli php-curl php-gd php-mysql php-mcrypt git
354
+    apt-get -yq install php-dev imagemagick php-imagick libfcgi0ldbl
355
+    apt-get -yq install php-memcached
333
 
356
 
334
     if [ ! -d /var/www/$FRIENDICA_DOMAIN_NAME ]; then
357
     if [ ! -d /var/www/$FRIENDICA_DOMAIN_NAME ]; then
335
         mkdir /var/www/$FRIENDICA_DOMAIN_NAME
358
         mkdir /var/www/$FRIENDICA_DOMAIN_NAME
340
 
363
 
341
     if [ ! -f $FRIENDICA_PATH/index.php ]; then
364
     if [ ! -f $FRIENDICA_PATH/index.php ]; then
342
         cd $INSTALL_DIR
365
         cd $INSTALL_DIR
343
-        function_check git_clone
344
-        git_clone $FRIENDICA_REPO friendica
366
+
367
+        if [ -d /repos/friendica ]; then
368
+            mkdir friendica
369
+            cp -r -p /repos/friendica/. friendica
370
+            cd friendica
371
+            git pull
372
+        else
373
+            function_check git_clone
374
+            git_clone $FRIENDICA_REPO friendica
375
+        fi
376
+
345
         git checkout $FRIENDICA_COMMIT -b $FRIENDICA_COMMIT
377
         git checkout $FRIENDICA_COMMIT -b $FRIENDICA_COMMIT
346
         set_completion_param "friendica commit" "$FRIENDICA_COMMIT"
378
         set_completion_param "friendica commit" "$FRIENDICA_COMMIT"
347
 
379
 
425
         echo '        try_files $uri $uri/ /index.php;' >> /etc/nginx/sites-available/$FRIENDICA_DOMAIN_NAME
457
         echo '        try_files $uri $uri/ /index.php;' >> /etc/nginx/sites-available/$FRIENDICA_DOMAIN_NAME
426
         echo '        # NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini' >> /etc/nginx/sites-available/$FRIENDICA_DOMAIN_NAME
458
         echo '        # NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini' >> /etc/nginx/sites-available/$FRIENDICA_DOMAIN_NAME
427
         echo '        fastcgi_split_path_info ^(.+\.php)(/.+)$;' >> /etc/nginx/sites-available/$FRIENDICA_DOMAIN_NAME
459
         echo '        fastcgi_split_path_info ^(.+\.php)(/.+)$;' >> /etc/nginx/sites-available/$FRIENDICA_DOMAIN_NAME
428
-        echo '        # With php5-cgi alone:' >> /etc/nginx/sites-available/$FRIENDICA_DOMAIN_NAME
460
+        echo '        # With php-cgi alone:' >> /etc/nginx/sites-available/$FRIENDICA_DOMAIN_NAME
429
         echo '        # fastcgi_pass 127.0.0.1:9000;' >> /etc/nginx/sites-available/$FRIENDICA_DOMAIN_NAME
461
         echo '        # fastcgi_pass 127.0.0.1:9000;' >> /etc/nginx/sites-available/$FRIENDICA_DOMAIN_NAME
430
-        echo '        # With php5-fpm:' >> /etc/nginx/sites-available/$FRIENDICA_DOMAIN_NAME
431
-        echo '        fastcgi_pass unix:/var/run/php5-fpm.sock;' >> /etc/nginx/sites-available/$FRIENDICA_DOMAIN_NAME
462
+        echo '        # With php-fpm:' >> /etc/nginx/sites-available/$FRIENDICA_DOMAIN_NAME
463
+        echo '        fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;' >> /etc/nginx/sites-available/$FRIENDICA_DOMAIN_NAME
432
         echo '        include fastcgi_params;' >> /etc/nginx/sites-available/$FRIENDICA_DOMAIN_NAME
464
         echo '        include fastcgi_params;' >> /etc/nginx/sites-available/$FRIENDICA_DOMAIN_NAME
465
+        echo '        fastcgi_read_timeout 30;' >> /etc/nginx/sites-available/$FRIENDICA_DOMAIN_NAME
433
         echo '        fastcgi_index index.php;' >> /etc/nginx/sites-available/$FRIENDICA_DOMAIN_NAME
466
         echo '        fastcgi_index index.php;' >> /etc/nginx/sites-available/$FRIENDICA_DOMAIN_NAME
434
         echo '        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;' >> /etc/nginx/sites-available/$FRIENDICA_DOMAIN_NAME
467
         echo '        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;' >> /etc/nginx/sites-available/$FRIENDICA_DOMAIN_NAME
435
         echo '        fastcgi_read_timeout 300;' >> /etc/nginx/sites-available/$FRIENDICA_DOMAIN_NAME
468
         echo '        fastcgi_read_timeout 300;' >> /etc/nginx/sites-available/$FRIENDICA_DOMAIN_NAME
493
         echo '        try_files $uri $uri/ /index.php;' >> /etc/nginx/sites-available/$FRIENDICA_DOMAIN_NAME
526
         echo '        try_files $uri $uri/ /index.php;' >> /etc/nginx/sites-available/$FRIENDICA_DOMAIN_NAME
494
         echo '        # NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini' >> /etc/nginx/sites-available/$FRIENDICA_DOMAIN_NAME
527
         echo '        # NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini' >> /etc/nginx/sites-available/$FRIENDICA_DOMAIN_NAME
495
         echo '        fastcgi_split_path_info ^(.+\.php)(/.+)$;' >> /etc/nginx/sites-available/$FRIENDICA_DOMAIN_NAME
528
         echo '        fastcgi_split_path_info ^(.+\.php)(/.+)$;' >> /etc/nginx/sites-available/$FRIENDICA_DOMAIN_NAME
496
-        echo '        # With php5-cgi alone:' >> /etc/nginx/sites-available/$FRIENDICA_DOMAIN_NAME
529
+        echo '        # With php-cgi alone:' >> /etc/nginx/sites-available/$FRIENDICA_DOMAIN_NAME
497
         echo '        # fastcgi_pass 127.0.0.1:9000;' >> /etc/nginx/sites-available/$FRIENDICA_DOMAIN_NAME
530
         echo '        # fastcgi_pass 127.0.0.1:9000;' >> /etc/nginx/sites-available/$FRIENDICA_DOMAIN_NAME
498
-        echo '        # With php5-fpm:' >> /etc/nginx/sites-available/$FRIENDICA_DOMAIN_NAME
499
-        echo '        fastcgi_pass unix:/var/run/php5-fpm.sock;' >> /etc/nginx/sites-available/$FRIENDICA_DOMAIN_NAME
531
+        echo '        # With php-fpm:' >> /etc/nginx/sites-available/$FRIENDICA_DOMAIN_NAME
532
+        echo '        fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;' >> /etc/nginx/sites-available/$FRIENDICA_DOMAIN_NAME
500
         echo '        include fastcgi_params;' >> /etc/nginx/sites-available/$FRIENDICA_DOMAIN_NAME
533
         echo '        include fastcgi_params;' >> /etc/nginx/sites-available/$FRIENDICA_DOMAIN_NAME
534
+        echo '        fastcgi_read_timeout 30;' >> /etc/nginx/sites-available/$FRIENDICA_DOMAIN_NAME
501
         echo '        fastcgi_index index.php;' >> /etc/nginx/sites-available/$FRIENDICA_DOMAIN_NAME
535
         echo '        fastcgi_index index.php;' >> /etc/nginx/sites-available/$FRIENDICA_DOMAIN_NAME
502
         echo '        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;' >> /etc/nginx/sites-available/$FRIENDICA_DOMAIN_NAME
536
         echo '        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;' >> /etc/nginx/sites-available/$FRIENDICA_DOMAIN_NAME
503
         echo '        fastcgi_read_timeout 300;' >> /etc/nginx/sites-available/$FRIENDICA_DOMAIN_NAME
537
         echo '        fastcgi_read_timeout 300;' >> /etc/nginx/sites-available/$FRIENDICA_DOMAIN_NAME
588
     chown www-data:www-data $FRIENDICA_PATH/.htconfig.php
622
     chown www-data:www-data $FRIENDICA_PATH/.htconfig.php
589
     chmod 755 $FRIENDICA_PATH/.htconfig.php
623
     chmod 755 $FRIENDICA_PATH/.htconfig.php
590
 
624
 
591
-    systemctl restart php5-fpm
625
+    systemctl restart mariadb
626
+    systemctl restart php7.0-fpm
592
     systemctl restart nginx
627
     systemctl restart nginx
593
     systemctl restart cron
628
     systemctl restart cron
594
 
629
 

+ 125
- 6
src/freedombone-app-ghost View File

9
 #                    Freedom in the Cloud
9
 #                    Freedom in the Cloud
10
 #
10
 #
11
 # Ghost blog
11
 # Ghost blog
12
+# Only works with nodejs version ^6.9.0
12
 #
13
 #
13
 # License
14
 # License
14
 # =======
15
 # =======
37
 GHOST_CODE=
38
 GHOST_CODE=
38
 GHOST_ONION_PORT=8104
39
 GHOST_ONION_PORT=8104
39
 GHOST_PORT=2368
40
 GHOST_PORT=2368
40
-GHOST_VERSION='0.11.8'
41
-GHOST_HASH='244faad0b16eb1b90c8095f1e536db65299a3a2d85a20af76342be3707522b38'
41
+GHOST_VERSION='0.11.10'
42
+GHOST_HASH='cccdf02d46112f1671739696f2b1888a90a5c3bdf2fae45e8e81d538a8e0f487'
42
 GHOST_DOWNLOAD_URL="https://github.com/TryGhost/Ghost/releases/download/${GHOST_VERSION}/Ghost-${GHOST_VERSION}.zip"
43
 GHOST_DOWNLOAD_URL="https://github.com/TryGhost/Ghost/releases/download/${GHOST_VERSION}/Ghost-${GHOST_VERSION}.zip"
43
 
44
 
44
 ghost_variables=(GHOST_DOMAIN_NAME
45
 ghost_variables=(GHOST_DOMAIN_NAME
48
                  DDNS_PROVIDER
49
                  DDNS_PROVIDER
49
                  MY_USERNAME)
50
                  MY_USERNAME)
50
 
51
 
52
+function logging_on_ghost {
53
+    echo -n ''
54
+}
55
+
56
+function logging_off_ghost {
57
+    echo -n ''
58
+}
59
+
51
 function ghost_replace_jquery {
60
 function ghost_replace_jquery {
52
     sed -i "s|code.jquery.com/jquery-${previous_jquery_version}.min.js|$GHOST_DOMAIN_NAME/jquery-${jquery_version}.js|g" content/themes/casper/default.hbs
61
     sed -i "s|code.jquery.com/jquery-${previous_jquery_version}.min.js|$GHOST_DOMAIN_NAME/jquery-${jquery_version}.js|g" content/themes/casper/default.hbs
53
     sed -i "s|code.jquery.com/jquery-${previous_jquery_version}.min.js|$GHOST_DOMAIN_NAME/jquery-${jquery_version}.js|g" core/server/data/migration/fixtures/004/01-move-jquery-with-alert.js
62
     sed -i "s|code.jquery.com/jquery-${previous_jquery_version}.min.js|$GHOST_DOMAIN_NAME/jquery-${jquery_version}.js|g" core/server/data/migration/fixtures/004/01-move-jquery-with-alert.js
170
     GHOST_PATH=/var/www/$GHOST_DOMAIN_NAME/htdocs
179
     GHOST_PATH=/var/www/$GHOST_DOMAIN_NAME/htdocs
171
 
180
 
172
     cd $GHOST_PATH
181
     cd $GHOST_PATH
173
-    if [ ! -f ghost-${GHOST_VERSION}.zip ]; then
182
+    if [ ! -f Ghost-${GHOST_VERSION}.zip ]; then
174
         wget ${GHOST_DOWNLOAD_URL}
183
         wget ${GHOST_DOWNLOAD_URL}
175
     fi
184
     fi
176
     if [ ! -f Ghost-${GHOST_VERSION}.zip ]; then
185
     if [ ! -f Ghost-${GHOST_VERSION}.zip ]; then
233
         function_check restore_database
242
         function_check restore_database
234
         restore_database ghost ${GHOST_DOMAIN_NAME}
243
         restore_database ghost ${GHOST_DOMAIN_NAME}
235
 
244
 
245
+        MARIADB_PASSWORD=$(${PROJECT_NAME}-pass -u root -a mariadb)
246
+        ghost_config=/var/www/${GHOST_DOMAIN_NAME}/htdocs/config.js
247
+        sed -i "s|password :.*|password : '${MARIADB_PASSWORD}',|g" $ghost_config
248
+        MARIADB_PASSWORD=
249
+
250
+        # install any missing packages
251
+        if [ ! -d /var/www/${GHOST_DOMAIN_NAME}/htdocs/node_modules/intl ]; then
252
+            cd /var/www/${GHOST_DOMAIN_NAME}/htdocs
253
+            npm install passport-http-bearer@1.0.1
254
+            npm install amperize@0.3.4
255
+            npm install bcryptjs@2.4.3
256
+            npm install knex@0.12.9
257
+            npm install bookshelf@0.10.2
258
+            npm install cookie-session@1.2.0
259
+            npm install ghost-gql@0.0.6
260
+            npm install intl@1.2.5
261
+            npm install sanitize-html@1.14.1
262
+            npm install showdown-ghost@0.3.6
263
+            npm install superagent@3.5.2
264
+            npm install mysql@2.1.1
265
+        fi
266
+
236
         systemctl start ghost
267
         systemctl start ghost
237
         restart_site
268
         restart_site
238
     fi
269
     fi
273
     ghost_create_database
304
     ghost_create_database
274
 
305
 
275
     restore_database_from_friend ghost ${GHOST_DOMAIN_NAME}
306
     restore_database_from_friend ghost ${GHOST_DOMAIN_NAME}
307
+
308
+    MARIADB_PASSWORD=$(${PROJECT_NAME}-pass -u root -a mariadb)
309
+    ghost_config=/var/www/${GHOST_DOMAIN_NAME}/htdocs/config.js
310
+    sed -i "s|password :.*|password : '${MARIADB_PASSWORD}',|g" $ghost_config
311
+    MARIADB_PASSWORD=
312
+
313
+    # install any missing packages
314
+    if [ ! -d /var/www/${GHOST_DOMAIN_NAME}/htdocs/node_modules/intl ]; then
315
+        cd /var/www/${GHOST_DOMAIN_NAME}/htdocs
316
+        npm install passport-http-bearer@1.0.1
317
+        npm install amperize@0.3.4
318
+        npm install bcryptjs@2.4.3
319
+        npm install knex@0.12.9
320
+        npm install bookshelf@0.10.2
321
+        npm install cookie-session@1.2.0
322
+        npm install ghost-gql@0.0.6
323
+        npm install intl@1.2.5
324
+        npm install sanitize-html@1.14.1
325
+        npm install showdown-ghost@0.3.6
326
+        npm install superagent@3.5.2
327
+        npm install mysql@2.1.1
328
+    fi
329
+
276
     systemctl start ghost
330
     systemctl start ghost
277
     restart_site
331
     restart_site
278
     chown -R ghost: /var/www/$GHOST_DOMAIN_NAME/htdocs/
332
     chown -R ghost: /var/www/$GHOST_DOMAIN_NAME/htdocs/
286
     systemctl stop ghost
340
     systemctl stop ghost
287
     systemctl disable ghost
341
     systemctl disable ghost
288
     rm /etc/systemd/system/ghost.service
342
     rm /etc/systemd/system/ghost.service
343
+    systemctl daemon-reload
289
 
344
 
290
     function_check remove_nodejs
345
     function_check remove_nodejs
291
     remove_nodejs ghost
346
     remove_nodejs ghost
296
     read_config_param "GHOST_DOMAIN_NAME"
351
     read_config_param "GHOST_DOMAIN_NAME"
297
     nginx_dissite $GHOST_DOMAIN_NAME
352
     nginx_dissite $GHOST_DOMAIN_NAME
298
     remove_certs ${GHOST_DOMAIN_NAME}
353
     remove_certs ${GHOST_DOMAIN_NAME}
299
-    deluser --remove-all-files ghost
300
     if [ -f /etc/nginx/sites-available/$GHOST_DOMAIN_NAME ]; then
354
     if [ -f /etc/nginx/sites-available/$GHOST_DOMAIN_NAME ]; then
301
         rm -f /etc/nginx/sites-available/$GHOST_DOMAIN_NAME
355
         rm -f /etc/nginx/sites-available/$GHOST_DOMAIN_NAME
302
     fi
356
     fi
311
     sed -i '/Ghost/d' $COMPLETION_FILE
365
     sed -i '/Ghost/d' $COMPLETION_FILE
312
     sed -i '/ghost/d' $COMPLETION_FILE
366
     sed -i '/ghost/d' $COMPLETION_FILE
313
 
367
 
368
+    groupdel -f ghost
369
+    userdel -r ghost
370
+
314
     function_check remove_ddns_domain
371
     function_check remove_ddns_domain
315
     remove_ddns_domain $GHOST_DOMAIN_NAME
372
     remove_ddns_domain $GHOST_DOMAIN_NAME
316
 }
373
 }
318
 function ghost_create_config {
375
 function ghost_create_config {
319
     ghost_config=/var/www/${GHOST_DOMAIN_NAME}/htdocs/config.js
376
     ghost_config=/var/www/${GHOST_DOMAIN_NAME}/htdocs/config.js
320
 
377
 
378
+    function_check get_mariadb_password
379
+    get_mariadb_password
380
+
321
     echo "var path = require('path')," > $ghost_config
381
     echo "var path = require('path')," > $ghost_config
322
     echo '    config;' >> $ghost_config
382
     echo '    config;' >> $ghost_config
323
     echo '' >> $ghost_config
383
     echo '' >> $ghost_config
393
         mkdir -p /var/www/$GHOST_DOMAIN_NAME/htdocs
453
         mkdir -p /var/www/$GHOST_DOMAIN_NAME/htdocs
394
     fi
454
     fi
395
     cd /var/www/$GHOST_DOMAIN_NAME/htdocs
455
     cd /var/www/$GHOST_DOMAIN_NAME/htdocs
396
-    wget ${GHOST_DOWNLOAD_URL}
456
+    if [ ! -f Ghost-${GHOST_VERSION}.zip ]; then
457
+        wget ${GHOST_DOWNLOAD_URL}
458
+    fi
397
     if [ ! -f Ghost-${GHOST_VERSION}.zip ]; then
459
     if [ ! -f Ghost-${GHOST_VERSION}.zip ]; then
398
         echo $'Unable to download ghost'
460
         echo $'Unable to download ghost'
399
         rm -rf /var/www/$GHOST_DOMAIN_NAME
461
         rm -rf /var/www/$GHOST_DOMAIN_NAME
418
     install_nodejs ghost
480
     install_nodejs ghost
419
 
481
 
420
     sed -i "/sqlite/d" /var/www/${GHOST_DOMAIN_NAME}/htdocs/package.json
482
     sed -i "/sqlite/d" /var/www/${GHOST_DOMAIN_NAME}/htdocs/package.json
483
+
484
+    cd /var/www/$GHOST_DOMAIN_NAME/htdocs
485
+    npm install -g jison@0.4.13 --save
486
+    npm install moment-timezone@0.5.13
487
+    npm install express@4.15.3
488
+    npm install lodash@4.17.4
489
+    npm install uuid@3.0.1
490
+    npm install bluebird@3.5.0
491
+    npm install chalk@1.1.3
492
+    npm install intl-messageformat@1.3.0
493
+    npm install validator@7.0.0
494
+    npm install express-hbs@1.0.4
495
+    npm install glob@7.1.2
496
+    npm install unidecode@0.1.8
497
+    npm install csv-parser@1.11.0
498
+    npm install archiver@1.3.0
499
+    npm install fs-extra@3.0.1
500
+    npm install extract-zip-fork@1.5.1
501
+    npm install moment@2.18.1
502
+    npm install nodemailer@4.0.1
503
+    npm install html-to-text@3.3.0
504
+    npm install gscan@1.1.0
505
+    npm install body-parser@1.17.2
506
+    npm install compression@1.6.2
507
+    npm install morgan@1.8.2
508
+    npm install semver@5.3.0
509
+    npm install path-match@1.2.4
510
+    npm install downsize@0.0.8
511
+    npm install rss@1.2.2
512
+    npm install cheerio@1.0.0-rc.1
513
+    npm install passport@0.3.2
514
+    npm install xml@1.0.1
515
+    npm install multer@1.3.0
516
+    npm install oauth2orize@1.8.0
517
+    npm install connect-slashes@1.3.1
518
+    npm install cors@2.8.3
519
+    npm install netjet@1.1.3
520
+    npm install jsonpath@0.2.11
521
+    npm install image-size@0.5.4
522
+    npm install passport-oauth2-client-password@0.1.2
523
+    npm install passport-http-bearer@1.0.1
524
+    npm install amperize@0.3.4
525
+    npm install bcryptjs@2.4.3
526
+    npm install knex@0.12.9
527
+    npm install bookshelf@0.10.2
528
+    npm install cookie-session@1.2.0
529
+    npm install ghost-gql@0.0.6
530
+    npm install intl@1.2.5
531
+    npm install sanitize-html@1.14.1
532
+    npm install showdown-ghost@0.3.6
533
+    npm install superagent@3.5.2
534
+    npm install mysql@2.1.1
535
+    npm install mariasql@0.2.6
536
+
421
     npm install --production
537
     npm install --production
422
 
538
 
423
     function_check install_mariadb
539
     function_check install_mariadb
432
     ghost_create_config
548
     ghost_create_config
433
 
549
 
434
     adduser --system --home=/var/www/${GHOST_DOMAIN_NAME}/htdocs/ --group ghost
550
     adduser --system --home=/var/www/${GHOST_DOMAIN_NAME}/htdocs/ --group ghost
435
-    chown -R ghost: /var/www/${GHOST_DOMAIN_NAME}/htdocs/
551
+    chown -R ghost: /var/www/${GHOST_DOMAIN_NAME}/htdocs
436
 
552
 
437
     echo '[Unit]' > /etc/systemd/system/ghost.service
553
     echo '[Unit]' > /etc/systemd/system/ghost.service
438
     echo 'Description=Ghost Blog' >> /etc/systemd/system/ghost.service
554
     echo 'Description=Ghost Blog' >> /etc/systemd/system/ghost.service
540
 
656
 
541
     if [[ $ONION_ONLY != 'no' ]]; then
657
     if [[ $ONION_ONLY != 'no' ]]; then
542
         sed -i "s|url: .*|url: 'http://${GHOST_ONION_HOSTNAME}',|g" /var/www/${GHOST_DOMAIN_NAME}/htdocs/config.js
658
         sed -i "s|url: .*|url: 'http://${GHOST_ONION_HOSTNAME}',|g" /var/www/${GHOST_DOMAIN_NAME}/htdocs/config.js
659
+        systemctl restart mariadb
543
         systemctl restart ghost
660
         systemctl restart ghost
544
     fi
661
     fi
545
 
662
 
549
     nginx_ensite $GHOST_DOMAIN_NAME
666
     nginx_ensite $GHOST_DOMAIN_NAME
550
 
667
 
551
     systemctl restart nginx
668
     systemctl restart nginx
669
+    systemctl restart mariadb
552
 
670
 
553
     ${PROJECT_NAME}-pass -u $MY_USERNAME -a ghost -p "$GHOST_ADMIN_PASSWORD"
671
     ${PROJECT_NAME}-pass -u $MY_USERNAME -a ghost -p "$GHOST_ADMIN_PASSWORD"
554
 
672
 
555
     function_check add_ddns_domain
673
     function_check add_ddns_domain
556
     add_ddns_domain $GHOST_DOMAIN_NAME
674
     add_ddns_domain $GHOST_DOMAIN_NAME
557
 
675
 
676
+    chown -R ghost: /var/www/${GHOST_DOMAIN_NAME}/htdocs
558
     set_completion_param "ghost domain" "$GHOST_DOMAIN_NAME"
677
     set_completion_param "ghost domain" "$GHOST_DOMAIN_NAME"
559
     if ! grep -q "ghost version:" ${COMPLETION_FILE}; then
678
     if ! grep -q "ghost version:" ${COMPLETION_FILE}; then
560
         echo "ghost version:${GHOST_VERSION}" >> ${COMPLETION_FILE}
679
         echo "ghost version:${GHOST_VERSION}" >> ${COMPLETION_FILE}

+ 159
- 232
src/freedombone-app-gnusocial View File

37
 GNUSOCIAL_CODE=
37
 GNUSOCIAL_CODE=
38
 GNUSOCIAL_ONION_PORT=8087
38
 GNUSOCIAL_ONION_PORT=8087
39
 GNUSOCIAL_REPO="https://git.gnu.io/gnu/gnu-social.git"
39
 GNUSOCIAL_REPO="https://git.gnu.io/gnu/gnu-social.git"
40
-GNUSOCIAL_COMMIT='1517deeeb621a0256106d0108855e8827713e2cc'
40
+GNUSOCIAL_COMMIT='05a9c11c476b384e5ef3f3cc83b66406fcf7a378'
41
 GNUSOCIAL_ADMIN_PASSWORD=
41
 GNUSOCIAL_ADMIN_PASSWORD=
42
 
42
 
43
 GNUSOCIAL_BACKGROUND_IMAGE_URL=
43
 GNUSOCIAL_BACKGROUND_IMAGE_URL=
44
-GNUSOCIAL_MARKDOWN_REPO="https://git.gnu.io/chimo/markdown.git"
45
-GNUSOCIAL_MARKDOWN_COMMIT='03c53942f94b3376f0946e6e1fe566cc21ccf232'
46
-
47
-# Sharings plugin for gnusocial
48
-SHARINGS_REPO="http://git.lasindias.club/bashrc/Sharings"
49
-SHARINGS_COMMIT='d5c6c7f855d9afff9086c09ea706f38c859bc0d4'
50
-SHARINGS_THEME_REPO="http://git.lasindias.club/manuel/SharingsTheme"
51
-SHARINGS_THEME_COMMIT='7106c7ef03'
52
 
44
 
53
 GNUSOCIAL_TITLE='Pleroma FE'
45
 GNUSOCIAL_TITLE='Pleroma FE'
54
 
46
 
61
                      GNUSOCIAL_WELCOME_MESSAGE
53
                      GNUSOCIAL_WELCOME_MESSAGE
62
                      GNUSOCIAL_BACKGROUND_IMAGE_URL
54
                      GNUSOCIAL_BACKGROUND_IMAGE_URL
63
                      DDNS_PROVIDER
55
                      DDNS_PROVIDER
64
-                     GNUSOCIAL_MARKDOWN_REPO
65
-                     GNUSOCIAL_MARKDOWN_COMMIT
66
-                     SHARINGS_REPO
67
-                     SHARINGS_COMMIT
68
-                     SHARINGS_THEME_REPO
69
-                     SHARINGS_THEME_COMMIT
70
                      GNUSOCIAL_TITLE
56
                      GNUSOCIAL_TITLE
71
                      GNUSOCIAL_EXPIRE_MONTHS
57
                      GNUSOCIAL_EXPIRE_MONTHS
72
                      MY_USERNAME)
58
                      MY_USERNAME)
73
 
59
 
60
+function logging_on_gnusocial {
61
+    echo -n ''
62
+}
63
+
64
+function logging_off_gnusocial {
65
+    echo -n ''
66
+}
67
+
74
 function gnusocial_fix_endless_reloads {
68
 function gnusocial_fix_endless_reloads {
75
     # This fixes a bug introduced with commit 5f7032dfee1fd202c14e76a9f8b37af35d584901
69
     # This fixes a bug introduced with commit 5f7032dfee1fd202c14e76a9f8b37af35d584901
76
     # and which causes OrFox to endlessly reload the page
70
     # and which causes OrFox to endlessly reload the page
311
         trap "rm -f $data" 0 1 2 5 15
305
         trap "rm -f $data" 0 1 2 5 15
312
         dialog --backtitle $"Freedombone Control Panel" \
306
         dialog --backtitle $"Freedombone Control Panel" \
313
                --title $"GNU Social" \
307
                --title $"GNU Social" \
314
-               --radiolist $"Choose an operation:" 17 70 8 \
308
+               --radiolist $"Choose an operation:" 16 70 7 \
315
                1 $"Set a background image" off \
309
                1 $"Set a background image" off \
316
                2 $"Set the title" off \
310
                2 $"Set the title" off \
317
                3 $"Set post expiry period (currently $GNUSOCIAL_EXPIRE_MONTHS months)" off \
311
                3 $"Set post expiry period (currently $GNUSOCIAL_EXPIRE_MONTHS months)" off \
318
                4 $"Select Qvitter user interface" off \
312
                4 $"Select Qvitter user interface" off \
319
                5 $"Select Pleroma user interface" off \
313
                5 $"Select Pleroma user interface" off \
320
                6 $"Select Classic user interface" off \
314
                6 $"Select Classic user interface" off \
321
-               7 $"Select Armadillo user interface" off \
322
-               8 $"Exit" on 2> $data
315
+               7 $"Exit" on 2> $data
323
         sel=$?
316
         sel=$?
324
         case $sel in
317
         case $sel in
325
             1) return;;
318
             1) return;;
332
             4) gnusocial_use_qvitter gnusocial;;
325
             4) gnusocial_use_qvitter gnusocial;;
333
             5) gnusocial_use_pleroma gnusocial;;
326
             5) gnusocial_use_pleroma gnusocial;;
334
             6) gnusocial_use_classic gnusocial;;
327
             6) gnusocial_use_classic gnusocial;;
335
-            7) gnusocial_use_armadillo gnusocial;;
336
-            8) break;;
328
+            7) break;;
337
         esac
329
         esac
338
     done
330
     done
339
 }
331
 }
340
 
332
 
341
 function upgrade_gnusocial {
333
 function upgrade_gnusocial {
334
+    CURR_GNUSOCIAL_COMMIT=$(get_completion_param "gnusocial commit")
335
+    if [[ "$CURR_GNUSOCIAL_COMMIT" == "$GNUSOCIAL_COMMIT" ]]; then
336
+        return
337
+    fi
338
+
342
     if grep -q "gnusocial domain" $COMPLETION_FILE; then
339
     if grep -q "gnusocial domain" $COMPLETION_FILE; then
343
         GNUSOCIAL_DOMAIN_NAME=$(get_completion_param "gnusocial domain")
340
         GNUSOCIAL_DOMAIN_NAME=$(get_completion_param "gnusocial domain")
344
     fi
341
     fi
364
     gnusocial_block_domain_script gnusocial $GNUSOCIAL_DOMAIN_NAME
361
     gnusocial_block_domain_script gnusocial $GNUSOCIAL_DOMAIN_NAME
365
 
362
 
366
     gnusocial_hourly_script gnusocial $GNUSOCIAL_DOMAIN_NAME
363
     gnusocial_hourly_script gnusocial $GNUSOCIAL_DOMAIN_NAME
367
-    upgrade_pleroma "$GNUSOCIAL_DOMAIN_NAME" "gnusocial" "$GNUSOCIAL_BACKGROUND_IMAGE_URL" "$GNUSOCIAL_TITLE"
364
+    if [ -d $INSTALL_DIR/pleroma ]; then
365
+        upgrade_pleroma "$GNUSOCIAL_DOMAIN_NAME" "gnusocial" "$GNUSOCIAL_BACKGROUND_IMAGE_URL" "$GNUSOCIAL_TITLE"
366
+    fi
368
     install_gnusocial_default_background "gnusocial" "$GNUSOCIAL_DOMAIN_NAME"
367
     install_gnusocial_default_background "gnusocial" "$GNUSOCIAL_DOMAIN_NAME"
369
     chown -R www-data:www-data /var/www/${GNUSOCIAL_DOMAIN_NAME}/htdocs
368
     chown -R www-data:www-data /var/www/${GNUSOCIAL_DOMAIN_NAME}/htdocs
370
 }
369
 }
376
         GNUSOCIAL_DOMAIN_NAME=$(get_completion_param "gnusocial domain")
375
         GNUSOCIAL_DOMAIN_NAME=$(get_completion_param "gnusocial domain")
377
     fi
376
     fi
378
 
377
 
379
-    source_directory=/var/www/${GNUSOCIAL_DOMAIN_NAME}/htdocs
380
-    if [ -d $source_directory ]; then
381
-        dest_directory=gnusocial
382
-        function_check suspend_site
383
-        suspend_site ${GNUSOCIAL_DOMAIN_NAME}
378
+    # don't backup more data than we need to
379
+    gnusocial-expire
380
+
381
+    source_directory=/var/www/${GNUSOCIAL_DOMAIN_NAME}/htdocs/backup
382
+    if [ ! -d $source_directory ]; then
383
+        mkdir $source_directory
384
+    fi
385
+    cp -p /var/www/${GNUSOCIAL_DOMAIN_NAME}/htdocs/config.php $source_directory
386
+    if [ -d /var/www/${GNUSOCIAL_DOMAIN_NAME}/htdocs/static ]; then
387
+        cp -rp /var/www/${GNUSOCIAL_DOMAIN_NAME}/htdocs/static $source_directory
388
+    fi
389
+
390
+    function_check suspend_site
391
+    suspend_site ${GNUSOCIAL_DOMAIN_NAME}
384
 
392
 
385
-        function_check backup_directory_to_usb
386
-        backup_directory_to_usb $source_directory $dest_directory
393
+    function_check backup_directory_to_usb
394
+    dest_directory=gnusocialconfig
395
+    backup_directory_to_usb $source_directory $dest_directory
387
 
396
 
388
-        function_check backup_database_to_usb
389
-        backup_database_to_usb gnusocial
397
+    source_directory=/var/www/${GNUSOCIAL_DOMAIN_NAME}/htdocs/file
398
+    dest_directory=gnusocialfile
399
+    backup_directory_to_usb $source_directory $dest_directory
390
 
400
 
391
-        function_check restart_site
392
-        restart_site
393
-    fi
401
+    function_check backup_database_to_usb
402
+    backup_database_to_usb gnusocial
403
+
404
+    function_check restart_site
405
+    restart_site
394
 }
406
 }
395
 
407
 
396
 function restore_local_gnusocial {
408
 function restore_local_gnusocial {
404
         gnusocial_dir=/var/www/${GNUSOCIAL_DOMAIN_NAME}/htdocs
416
         gnusocial_dir=/var/www/${GNUSOCIAL_DOMAIN_NAME}/htdocs
405
         # stop the daemons
417
         # stop the daemons
406
         cd $gnusocial_dir
418
         cd $gnusocial_dir
407
-        su -c "sh scripts/stopdaemons.sh" -s /bin/sh www-data
419
+        scripts/stopdaemons.sh
408
 
420
 
409
         function_check gnusocial_create_database
421
         function_check gnusocial_create_database
410
         gnusocial_create_database
422
         gnusocial_create_database
411
 
423
 
412
-        restore_database gnusocial ${GNUSOCIAL_DOMAIN_NAME}
424
+        restore_database gnusocial
413
         if [ -d $temp_restore_dir ]; then
425
         if [ -d $temp_restore_dir ]; then
414
             rm -rf $temp_restore_dir
426
             rm -rf $temp_restore_dir
415
         fi
427
         fi
416
 
428
 
417
-        # start the daemons
418
-        cd $gnusocial_dir
419
-        su -c "sh scripts/startdaemons.sh" -s /bin/sh www-data
429
+        function_check restore_directory_from_usb
430
+        restore_directory_from_usb $temp_restore_dir gnusocialconfig
431
+        if [ -d $temp_restore_dir ]; then
432
+            cp $temp_restore_dir$gnusocial_dir/backup/config.php $gnusocial_dir/
433
+            chown www-data:www-data $gnusocial_dir/config.php
434
+            cp -rp $temp_restore_dir$gnusocial_dir/static $gnusocial_dir/
435
+            chown -R www-data:www-data $gnusocial_dir/static
436
+            rm -rf $temp_restore_dir
437
+        fi
438
+
439
+        restore_directory_from_usb $temp_restore_dir gnusocialfile
440
+        if [ -d $temp_restore_dir ]; then
441
+            cp -rp $temp_restore_dir$gnusocial_dir/file $gnusocial_dir/
442
+            chown -R www-data:www-data $gnusocial_dir/file
443
+            rm -rf $temp_restore_dir
444
+        fi
445
+
446
+        gnusocial_update_after_restore gnusocial ${GNUSOCIAL_DOMAIN_NAME}
447
+
420
         echo $"Restore of gnusocial complete"
448
         echo $"Restore of gnusocial complete"
421
     fi
449
     fi
422
 }
450
 }
423
 
451
 
424
 function backup_remote_gnusocial {
452
 function backup_remote_gnusocial {
453
+    GNUSOCIAL_DOMAIN_NAME='gnusocial'
425
     if grep -q "gnusocial domain" $COMPLETION_FILE; then
454
     if grep -q "gnusocial domain" $COMPLETION_FILE; then
426
         GNUSOCIAL_DOMAIN_NAME=$(get_completion_param "gnusocial domain")
455
         GNUSOCIAL_DOMAIN_NAME=$(get_completion_param "gnusocial domain")
427
-        temp_backup_dir=/var/www/${GNUSOCIAL_DOMAIN_NAME}/htdocs
428
-        if [ -d $temp_backup_dir ]; then
429
-            function_check suspend_site
430
-            suspend_site ${GNUSOCIAL_DOMAIN_NAME}
456
+    fi
431
 
457
 
432
-            function_check backup_database_to_friend
433
-            backup_database_to_friend gnusocial
458
+    # don't backup more data than we need to
459
+    gnusocial-expire
434
 
460
 
435
-            echo $"Backing up GNU social installation"
461
+    source_directory=/var/www/${GNUSOCIAL_DOMAIN_NAME}/htdocs/backup
462
+    if [ ! -d $source_directory ]; then
463
+        mkdir $source_directory
464
+    fi
465
+    cp -p /var/www/${GNUSOCIAL_DOMAIN_NAME}/htdocs/config.php $source_directory
466
+    if [ -d /var/www/${GNUSOCIAL_DOMAIN_NAME}/htdocs/static ]; then
467
+        cp -rp /var/www/${GNUSOCIAL_DOMAIN_NAME}/htdocs/static $source_directory
468
+    fi
436
 
469
 
437
-            function_check backup_directory_to_friend
438
-            backup_directory_to_friend $temp_backup_dir gnusocial
470
+    function_check suspend_site
471
+    suspend_site ${GNUSOCIAL_DOMAIN_NAME}
439
 
472
 
440
-            function_check restart_site
441
-            restart_site
442
-        else
443
-            echo $"gnusocial domain specified but not found in ${temp_backup_dir}"
444
-        fi
445
-    fi
473
+    function_check backup_directory_to_friend
474
+    dest_directory=gnusocialconfig
475
+    backup_directory_to_friend $source_directory $dest_directory
476
+
477
+    source_directory=/var/www/${GNUSOCIAL_DOMAIN_NAME}/htdocs/file
478
+    dest_directory=gnusocialfile
479
+    backup_directory_to_friend $source_directory $dest_directory
480
+
481
+    function_check backup_database_to_friend
482
+    backup_database_to_friend gnusocial
483
+
484
+    function_check restart_site
485
+    restart_site
446
 }
486
 }
447
 
487
 
448
 function restore_remote_gnusocial {
488
 function restore_remote_gnusocial {
449
-    if grep -q "gnusocial domain" $COMPLETION_FILE; then
489
+    if ! grep -q "gnusocial domain" $COMPLETION_FILE; then
490
+        return
491
+    fi
492
+    GNUSOCIAL_DOMAIN_NAME=$(get_completion_param "gnusocial domain")
493
+    if [ $GNUSOCIAL_DOMAIN_NAME ]; then
450
         echo $"Restoring gnusocial"
494
         echo $"Restoring gnusocial"
451
-        GNUSOCIAL_DOMAIN_NAME=$(get_completion_param "gnusocial domain")
452
-
495
+        temp_restore_dir=/root/tempgnusocial
496
+        gnusocial_dir=/var/www/${GNUSOCIAL_DOMAIN_NAME}/htdocs
453
         # stop the daemons
497
         # stop the daemons
454
-        cd /var/www/${GNUSOCIAL_DOMAIN_NAME}/htdocs
455
-        su -c "sh scripts/stopdaemons.sh" -s /bin/sh www-data
498
+        cd $gnusocial_dir
499
+        scripts/stopdaemons.sh
456
 
500
 
457
         function_check gnusocial_create_database
501
         function_check gnusocial_create_database
458
         gnusocial_create_database
502
         gnusocial_create_database
459
 
503
 
460
         function_check restore_database_from_friend
504
         function_check restore_database_from_friend
461
-        restore_database_from_friend gnusocial ${GNUSOCIAL_DOMAIN_NAME}
462
-        if [ -d /root/tempgnusocial ]; then
463
-            rm -rf /root/tempgnusocial
505
+        restore_database_from_friend gnusocial
506
+        if [ -d $temp_restore_dir ]; then
507
+            rm -rf $temp_restore_dir
464
         fi
508
         fi
465
 
509
 
466
-        # start the daemons
467
-        cd /var/www/${GNUSOCIAL_DOMAIN_NAME}/htdocs
468
-        su -c "sh scripts/startdaemons.sh" -s /bin/sh www-data
510
+        function_check restore_directory_from_friend
511
+        restore_directory_from_friend $temp_restore_dir gnusocialconfig
512
+        if [ -d $temp_restore_dir ]; then
513
+            cp $temp_restore_dir$gnusocial_dir/backup/config.php $gnusocial_dir/
514
+            chown www-data:www-data $gnusocial_dir/config.php
515
+            cp -rp $temp_restore_dir$gnusocial_dir/static $gnusocial_dir/
516
+            chown -R www-data:www-data $gnusocial_dir/static
517
+            rm -rf $temp_restore_dir
518
+        fi
519
+
520
+        restore_directory_from_friend $temp_restore_dir gnusocialfile
521
+        if [ -d $temp_restore_dir ]; then
522
+            cp -rp $temp_restore_dir$gnusocial_dir/file $gnusocial_dir/
523
+            chown -R www-data:www-data $gnusocial_dir/file
524
+            rm -rf $temp_restore_dir
525
+        fi
526
+
527
+        gnusocial_update_after_restore gnusocial ${GNUSOCIAL_DOMAIN_NAME}
528
+
469
         echo $"Restore of gnusocial complete"
529
         echo $"Restore of gnusocial complete"
470
     fi
530
     fi
471
 }
531
 }
486
         rm /etc/cron.hourly/gnusocial-daemons
546
         rm /etc/cron.hourly/gnusocial-daemons
487
     fi
547
     fi
488
     if [ -f /var/www/$GNUSOCIAL_DOMAIN_NAME/htdocs/scripts/stopdaemons.sh ]; then
548
     if [ -f /var/www/$GNUSOCIAL_DOMAIN_NAME/htdocs/scripts/stopdaemons.sh ]; then
489
-        cd /var/www/$GNUSOCIAL_DOMAIN_NAME/htdocs/scripts
490
-        su -c "sh scripts/stopdaemons.sh" -s /bin/sh www-data
549
+        cd /var/www/$GNUSOCIAL_DOMAIN_NAME/htdocs
550
+        scripts/stopdaemons.sh
491
     fi
551
     fi
492
     kill_pid=$(ps aux | grep /var/www/$GNUSOCIAL_DOMAIN_NAME/htdocs/scripts/queuedaemon.php | awk -F ' ' '{print $2}' | head -n 1)
552
     kill_pid=$(ps aux | grep /var/www/$GNUSOCIAL_DOMAIN_NAME/htdocs/scripts/queuedaemon.php | awk -F ' ' '{print $2}' | head -n 1)
493
     kill -9 $kill_pid
553
     kill -9 $kill_pid
537
     function_check repair_databases_script
597
     function_check repair_databases_script
538
     repair_databases_script
598
     repair_databases_script
539
 
599
 
540
-    apt-get -yq install php-gettext php5-curl php5-gd php5-mysql git curl php-xml-parser
541
-    apt-get -yq install php5-memcached php5-intl exiftool
600
+    apt-get -yq install php-gettext php-curl php-gd php-mysql git curl
601
+    apt-get -yq install memcached php-memcached php-intl exiftool libfcgi0ldbl
542
 
602
 
543
     if [ ! -d /var/www/$GNUSOCIAL_DOMAIN_NAME ]; then
603
     if [ ! -d /var/www/$GNUSOCIAL_DOMAIN_NAME ]; then
544
         mkdir /var/www/$GNUSOCIAL_DOMAIN_NAME
604
         mkdir /var/www/$GNUSOCIAL_DOMAIN_NAME
545
     fi
605
     fi
546
     if [ ! -d /var/www/$GNUSOCIAL_DOMAIN_NAME/htdocs ]; then
606
     if [ ! -d /var/www/$GNUSOCIAL_DOMAIN_NAME/htdocs ]; then
547
-        function_check git_clone
548
-        git_clone $GNUSOCIAL_REPO /var/www/$GNUSOCIAL_DOMAIN_NAME/htdocs
607
+
608
+        if [ -d /repos/gnusocial ]; then
609
+            mkdir /var/www/$GNUSOCIAL_DOMAIN_NAME/htdocs
610
+            cp -r -p /repos/gnusocial/. /var/www/$GNUSOCIAL_DOMAIN_NAME/htdocs
611
+            cd /var/www/$GNUSOCIAL_DOMAIN_NAME/htdocs
612
+            git pull
613
+        else
614
+            function_check git_clone
615
+            git_clone $GNUSOCIAL_REPO /var/www/$GNUSOCIAL_DOMAIN_NAME/htdocs
616
+        fi
617
+
549
         if [ ! -d /var/www/$GNUSOCIAL_DOMAIN_NAME/htdocs ]; then
618
         if [ ! -d /var/www/$GNUSOCIAL_DOMAIN_NAME/htdocs ]; then
550
             echo $'Unable to clone gnusocial repo'
619
             echo $'Unable to clone gnusocial repo'
551
             exit 87525
620
             exit 87525
580
     function_check add_ddns_domain
649
     function_check add_ddns_domain
581
     add_ddns_domain $GNUSOCIAL_DOMAIN_NAME
650
     add_ddns_domain $GNUSOCIAL_DOMAIN_NAME
582
 
651
 
652
+    GNUSOCIAL_ONION_HOSTNAME=$(add_onion_service gnusocial 80 ${GNUSOCIAL_ONION_PORT})
653
+
583
     gnusocial_nginx_site=/etc/nginx/sites-available/$GNUSOCIAL_DOMAIN_NAME
654
     gnusocial_nginx_site=/etc/nginx/sites-available/$GNUSOCIAL_DOMAIN_NAME
584
     if [[ $ONION_ONLY == "no" ]]; then
655
     if [[ $ONION_ONLY == "no" ]]; then
585
         function_check nginx_http_redirect
656
         function_check nginx_http_redirect
614
         echo '  # PHP' >> $gnusocial_nginx_site
685
         echo '  # PHP' >> $gnusocial_nginx_site
615
         echo '  location ~ \.php {' >> $gnusocial_nginx_site
686
         echo '  location ~ \.php {' >> $gnusocial_nginx_site
616
         echo '    include snippets/fastcgi-php.conf;' >> $gnusocial_nginx_site
687
         echo '    include snippets/fastcgi-php.conf;' >> $gnusocial_nginx_site
617
-        echo '    fastcgi_pass unix:/var/run/php5-fpm.sock;' >> $gnusocial_nginx_site
688
+        echo '    fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;' >> $gnusocial_nginx_site
689
+        echo '    fastcgi_read_timeout 30;' >> $gnusocial_nginx_site
618
         echo '  }' >> $gnusocial_nginx_site
690
         echo '  }' >> $gnusocial_nginx_site
619
         echo '' >> $gnusocial_nginx_site
691
         echo '' >> $gnusocial_nginx_site
620
         echo '  # Location' >> $gnusocial_nginx_site
692
         echo '  # Location' >> $gnusocial_nginx_site
641
     fi
713
     fi
642
     echo 'server {' >> $gnusocial_nginx_site
714
     echo 'server {' >> $gnusocial_nginx_site
643
     echo "    listen 127.0.0.1:$GNUSOCIAL_ONION_PORT default_server;" >> $gnusocial_nginx_site
715
     echo "    listen 127.0.0.1:$GNUSOCIAL_ONION_PORT default_server;" >> $gnusocial_nginx_site
644
-    echo "    server_name $GNUSOCIAL_DOMAIN_NAME;" >> $gnusocial_nginx_site
716
+    echo "    server_name $GNUSOCIAL_ONION_HOSTNAME;" >> $gnusocial_nginx_site
645
     echo '' >> $gnusocial_nginx_site
717
     echo '' >> $gnusocial_nginx_site
646
     function_check nginx_compress
718
     function_check nginx_compress
647
     nginx_compress $GNUSOCIAL_DOMAIN_NAME
719
     nginx_compress $GNUSOCIAL_DOMAIN_NAME
662
     echo '  # PHP' >> $gnusocial_nginx_site
734
     echo '  # PHP' >> $gnusocial_nginx_site
663
     echo '  location ~ \.php {' >> $gnusocial_nginx_site
735
     echo '  location ~ \.php {' >> $gnusocial_nginx_site
664
     echo '    include snippets/fastcgi-php.conf;' >> $gnusocial_nginx_site
736
     echo '    include snippets/fastcgi-php.conf;' >> $gnusocial_nginx_site
665
-    echo '    fastcgi_pass unix:/var/run/php5-fpm.sock;' >> $gnusocial_nginx_site
737
+    echo '    fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;' >> $gnusocial_nginx_site
738
+    echo '    fastcgi_read_timeout 30;' >> $gnusocial_nginx_site
666
     echo '  }' >> $gnusocial_nginx_site
739
     echo '  }' >> $gnusocial_nginx_site
667
     echo '' >> $gnusocial_nginx_site
740
     echo '' >> $gnusocial_nginx_site
668
     echo '  # Location' >> $gnusocial_nginx_site
741
     echo '  # Location' >> $gnusocial_nginx_site
710
         gnusocial_ssl='never'
783
         gnusocial_ssl='never'
711
     fi
784
     fi
712
 
785
 
713
-    GNUSOCIAL_ONION_HOSTNAME=$(add_onion_service gnusocial 80 ${GNUSOCIAL_ONION_PORT})
714
-
715
     GNUSOCIAL_SERVER=${GNUSOCIAL_DOMAIN_NAME}
786
     GNUSOCIAL_SERVER=${GNUSOCIAL_DOMAIN_NAME}
716
     if [[ $ONION_ONLY != 'no' ]]; then
787
     if [[ $ONION_ONLY != 'no' ]]; then
717
         GNUSOCIAL_SERVER=${GNUSOCIAL_ONION_HOSTNAME}
788
         GNUSOCIAL_SERVER=${GNUSOCIAL_ONION_HOSTNAME}
770
     # This improves performance
841
     # This improves performance
771
     sed -i "s|//\$config\['db'\]\['schemacheck'\].*|\$config\['db'\]\['schemacheck'\] = 'script';|g" $gnusocial_config_file
842
     sed -i "s|//\$config\['db'\]\['schemacheck'\].*|\$config\['db'\]\['schemacheck'\] = 'script';|g" $gnusocial_config_file
772
 
843
 
773
-    systemctl restart php5-fpm
844
+    systemctl restart mariadb
845
+    systemctl restart php7.0-fpm
774
     systemctl restart nginx
846
     systemctl restart nginx
775
 
847
 
776
     ${PROJECT_NAME}-addemail -u $MY_USERNAME -e "noreply@$GNUSOCIAL_DOMAIN_NAME" -g gnusocial --public no
848
     ${PROJECT_NAME}-addemail -u $MY_USERNAME -e "noreply@$GNUSOCIAL_DOMAIN_NAME" -g gnusocial --public no
784
     install_completed gnusocial_main
856
     install_completed gnusocial_main
785
 }
857
 }
786
 
858
 
787
-function install_gnusocial_plugin_sharings {
788
-    if [ ! -d /var/www/$GNUSOCIAL_DOMAIN_NAME/htdocs/local/plugins ]; then
789
-        echo $'No local/plugins directory found for the gnusocial'
790
-        exit 72945
791
-    fi
792
-
793
-    apt-get -yq install liblocale-msgfmt-perl gettext
794
-
795
-    # update to the next commit
796
-    function_check set_repo_commit
797
-    set_repo_commit /var/www/$GNUSOCIAL_DOMAIN_NAME/htdocs/local/plugins "gnusocial sharings plugin commit" "$SHARINGS_COMMIT" $SHARINGS_REPO
798
-
799
-    if [[ $(app_is_installed gnusocial_plugin_sharings) == "1" ]]; then
800
-        return
801
-    fi
802
-
803
-    cd /var/www/$GNUSOCIAL_DOMAIN_NAME/htdocs/local/plugins
804
-    function_check git_clone
805
-    git_clone $SHARINGS_REPO Sharings
806
-    if [ ! -d /var/www/$GNUSOCIAL_DOMAIN_NAME/htdocs/local/plugins/Sharings ]; then
807
-        echo $'Unable to clone gnusocial sharings plugin'
808
-        exit 36738
809
-    fi
810
-
811
-    cd /var/www/$GNUSOCIAL_DOMAIN_NAME/htdocs/local/plugins/Sharings
812
-    git stash
813
-    git checkout master
814
-    git branch -D $SHARINGS_COMMIT
815
-    git checkout $SHARINGS_COMMIT -b $SHARINGS_COMMIT
816
-
817
-    # enable the plugin
818
-    if ! grep -q "addPlugin('Sharings');" /var/www/$GNUSOCIAL_DOMAIN_NAME/htdocs/config.php; then
819
-        echo "addPlugin('Sharings');" >> /var/www/$GNUSOCIAL_DOMAIN_NAME/htdocs/config.php
820
-    fi
821
-
822
-    cd /var/www/$GNUSOCIAL_DOMAIN_NAME/htdocs
823
-    php scripts/checkschema.php
824
-    cd /var/www/$GNUSOCIAL_DOMAIN_NAME/htdocs/local/plugins/Sharings
825
-    php scripts/seedsharings.php
826
-    cd /var/www/$GNUSOCIAL_DOMAIN_NAME/htdocs
827
-    php scripts/upgrade.php
828
-    php scripts/checkschema.php
829
-
830
-    # Languages
831
-    cd /var/www/$GNUSOCIAL_DOMAIN_NAME/htdocs/local/plugins/Sharings/locale/en/LC_MESSAGES
832
-    msgfmt -o Sharings.mo Sharings.po
833
-    if [ ! -f Sharings.po ]; then
834
-        echo $'English translations for gnusocial sharings plugin were not created'
835
-        exit 84352
836
-    fi
837
-    cd /var/www/$GNUSOCIAL_DOMAIN_NAME/htdocs/local/plugins/Sharings/locale/en_GB/LC_MESSAGES
838
-    msgfmt -o Sharings.mo Sharings.po
839
-    if [ ! -f Sharings.po ]; then
840
-        echo $'English (GB) translations for gnusocial sharings plugin were not created'
841
-        exit 84352
842
-    fi
843
-    cd /var/www/$GNUSOCIAL_DOMAIN_NAME/htdocs/local/plugins/Sharings/locale/en_US/LC_MESSAGES
844
-    msgfmt -o Sharings.mo Sharings.po
845
-    if [ ! -f Sharings.po ]; then
846
-        echo $'English (US) translations for gnusocial sharings plugin were not created'
847
-        exit 84352
848
-    fi
849
-
850
-    # Looks like this update function isn't supported by the current php version
851
-    sed -i 's|ActivityVerb::UPDATE, ||g' /var/www/$GNUSOCIAL_DOMAIN_NAME/htdocs/local/plugins/Sharings/SharingsPlugin.php
852
-
853
-    chown -R www-data:www-data /var/www/$GNUSOCIAL_DOMAIN_NAME/htdocs
854
-
855
-    set_completion_param gnusocial "sharings plugin commit" "$SHARINGS_COMMIT"
856
-    install_completed gnusocial_plugin_sharings
857
-}
858
-
859
-function install_gnusocial_plugin_sharings_theme {
860
-    if [ ! -d /var/www/$GNUSOCIAL_DOMAIN_NAME/htdocs/local/plugins ]; then
861
-        echo $'No local/plugins directory found for the gnusocial'
862
-        exit 74458
863
-    fi
864
-
865
-    # update to the next commit
866
-    function_check set_repo_commit
867
-    set_repo_commit /var/www/$GNUSOCIAL_DOMAIN_NAME/htdocs/local/plugins "gnusocial sharings theme plugin commit" "$SHARINGS_THEME_COMMIT" $SHARINGS_THEME_REPO
868
-
869
-    if [[ $(app_is_installed gnusocial_plugin_sharings_theme) == "1" ]]; then
870
-        return
871
-    fi
872
-
873
-    cd /var/www/$GNUSOCIAL_DOMAIN_NAME/htdocs/local/plugins
874
-    function_check git_clone
875
-    git_clone $SHARINGS_THEME_REPO SharingsTheme
876
-    if [ ! -d /var/www/$GNUSOCIAL_DOMAIN_NAME/htdocs/local/plugins/SharingsTheme ]; then
877
-        echo $'Unable to clone gnusocial sharings plugin theme'
878
-        exit 639253
879
-    fi
880
-
881
-    cd /var/www/$GNUSOCIAL_DOMAIN_NAME/htdocs/local/plugins/SharingsTheme
882
-    git stash
883
-    git checkout master
884
-    git branch -D $SHARINGS_THEME_COMMIT
885
-    git checkout $SHARINGS_THEME_COMMIT -b $SHARINGS_THEME_COMMIT
886
-
887
-    # enable the plugin
888
-    if ! grep -q "addPlugin('SharingsTheme');" /var/www/$GNUSOCIAL_DOMAIN_NAME/htdocs/config.php; then
889
-        echo "addPlugin('SharingsTheme');" >> /var/www/$GNUSOCIAL_DOMAIN_NAME/htdocs/config.php
890
-    fi
891
-
892
-    cd /var/www/$GNUSOCIAL_DOMAIN_NAME/htdocs
893
-    php scripts/checkschema.php
894
-
895
-    chown -R www-data:www-data /var/www/$GNUSOCIAL_DOMAIN_NAME/htdocs
896
-
897
-    set_completion_param "gnusocial sharings plugin theme commit" "$SHARINGS_THEME_COMMIT"
898
-    install_completed gnusocial_plugin_sharings_theme
899
-}
900
-
901
-function install_gnusocial_markdown {
902
-    GNUSOCIAL_PATH=/var/www/$GNUSOCIAL_DOMAIN_NAME/htdocs
903
-
904
-    # update to the next commit
905
-    function_check set_repo_commit
906
-    set_repo_commit $GNUSOCIAL_PATH/local/plugins/Markdown "gnusocial Markdown commit" "$GNUSOCIAL_MARKDOWN_COMMIT" $GNUSOCIAL_MARKDOWN_REPO
907
-
908
-    if [[ $(app_is_installed gnusocial_markdown) == "1" ]]; then
909
-        return
910
-    fi
911
-
912
-    if [ -d $GNUSOCIAL_PATH/local/plugins/Markdown ]; then
913
-        rm -rf $GNUSOCIAL_PATH/local/plugins/Markdown
914
-    fi
915
-
916
-    if [ ! -d $GNUSOCIAL_PATH/local/plugins ]; then
917
-        mkdir -p $GNUSOCIAL_PATH/local/plugins
918
-    fi
919
-
920
-    cd $GNUSOCIAL_PATH/local/plugins
921
-    function_check git_clone
922
-    git_clone $GNUSOCIAL_MARKDOWN_REPO Markdown
923
-    cd $GNUSOCIAL_PATH/local/plugins/Markdown
924
-    git checkout $GNUSOCIAL_MARKDOWN_COMMIT -b $GNUSOCIAL_MARKDOWN_COMMIT
925
-
926
-    gnusocial_config_file=$GNUSOCIAL_PATH/config.php
927
-    if ! grep -q "addPlugin('Markdown'" $gnusocial_config_file; then
928
-        echo "" >> $gnusocial_config_file
929
-        echo "// Markdown settings" >> $gnusocial_config_file
930
-        echo "addPlugin('Markdown');" >> $gnusocial_config_file
931
-    fi
932
-
933
-    set_completion_param "gnusocial markdown commit" "$GNUSOCIAL_MARKDOWN_COMMIT"
934
-
935
-    chown -R www-data:www-data $GNUSOCIAL_PATH
936
-
937
-    install_completed gnusocial_markdown
938
-}
939
-
940
 function install_gnusocial {
859
 function install_gnusocial {
941
     if [ ! $ONION_ONLY ]; then
860
     if [ ! $ONION_ONLY ]; then
942
         ONION_ONLY='no'
861
         ONION_ONLY='no'
945
     install_gnusocial_main
864
     install_gnusocial_main
946
     expire_gnusocial_posts "$GNUSOCIAL_DOMAIN_NAME" "gnusocial" "$GNUSOCIAL_EXPIRE_MONTHS"
865
     expire_gnusocial_posts "$GNUSOCIAL_DOMAIN_NAME" "gnusocial" "$GNUSOCIAL_EXPIRE_MONTHS"
947
     install_qvitter "$GNUSOCIAL_DOMAIN_NAME" "gnusocial"
866
     install_qvitter "$GNUSOCIAL_DOMAIN_NAME" "gnusocial"
948
-    install_gnusocial_markdown
949
-    #install_gnusocial_plugin_sharings
950
-    #install_gnusocial_plugin_sharings_theme
867
+    install_gnusocial_markdown "$GNUSOCIAL_DOMAIN_NAME" "gnusocial"
868
+    install_gnusocial_plugin_sharings "$GNUSOCIAL_DOMAIN_NAME" "gnusocial"
869
+    install_gnusocial_plugin_sharings_theme "$GNUSOCIAL_DOMAIN_NAME" "gnusocial"
951
 
870
 
952
     # Currently Pleroma won't install on ARM systems
871
     # Currently Pleroma won't install on ARM systems
953
     # because it uses node-sass which doesn't support ARM
872
     # because it uses node-sass which doesn't support ARM
967
 
886
 
968
     systemctl restart nginx
887
     systemctl restart nginx
969
 
888
 
889
+    # Set qvitter to be the default UI. It's probably the most stable.
890
+    # And doesn't forget logins
891
+    gnusocial_use_qvitter gnusocial
892
+
893
+    if [ $GNUSOCIAL_BACKGROUND_IMAGE_URL ]; then
894
+        pleroma_set_background_image_from_url "$GNUSOCIAL_DOMAIN_NAME" "$GNUSOCIAL_BACKGROUND_IMAGE_URL" "$GNUSOCIAL_TITLE"
895
+    fi
896
+
970
     APP_INSTALLED=1
897
     APP_INSTALLED=1
971
 }
898
 }
972
 
899
 

+ 39
- 2
src/freedombone-app-gogs View File

13
 # License
13
 # License
14
 # =======
14
 # =======
15
 #
15
 #
16
-# Copyright (C) 2014-2016 Bob Mottram <bob@freedombone.net>
16
+# Copyright (C) 2014-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
51
                 DDNS_PROVIDER
51
                 DDNS_PROVIDER
52
                 ARCHITECTURE)
52
                 ARCHITECTURE)
53
 
53
 
54
+function logging_on_gogs {
55
+    echo -n ''
56
+}
57
+
58
+function logging_off_gogs {
59
+    echo -n ''
60
+}
61
+
54
 function change_password_gogs {
62
 function change_password_gogs {
55
     curr_username="$1"
63
     curr_username="$1"
56
     new_user_password="$2"
64
     new_user_password="$2"
102
         ARCHITECTURE=$(uname -m)
110
         ARCHITECTURE=$(uname -m)
103
         if [[ ${ARCHITECTURE} == "arm"* ]]; then
111
         if [[ ${ARCHITECTURE} == "arm"* ]]; then
104
             CURR_ARCH=armv5
112
             CURR_ARCH=armv5
113
+            echo $"Using $CURR_ARCH"
105
         fi
114
         fi
106
         if [[ ${ARCHITECTURE} == "amd"* || ${ARCHITECTURE} == "x86_64" ]]; then
115
         if [[ ${ARCHITECTURE} == "amd"* || ${ARCHITECTURE} == "x86_64" ]]; then
107
             CURR_ARCH=amd64
116
             CURR_ARCH=amd64
117
+            echo $"Using $CURR_ARCH"
108
         fi
118
         fi
109
         if [[ ${ARCHITECTURE} == *"386" || ${ARCHITECTURE} == *"686" ]]; then
119
         if [[ ${ARCHITECTURE} == *"386" || ${ARCHITECTURE} == *"686" ]]; then
110
             CURR_ARCH=386
120
             CURR_ARCH=386
121
+            echo $"Using $CURR_ARCH"
111
         fi
122
         fi
112
     fi
123
     fi
113
 
124
 
192
     rm $INSTALL_DIR/gogs_config.ini
203
     rm $INSTALL_DIR/gogs_config.ini
193
 
204
 
194
     sed -i "s|gogs version.*|gogs version:$GOGS_VERSION|g" ${COMPLETION_FILE}
205
     sed -i "s|gogs version.*|gogs version:$GOGS_VERSION|g" ${COMPLETION_FILE}
206
+    systemctl restart mariadb
195
     systemctl restart gogs
207
     systemctl restart gogs
196
 }
208
 }
197
 
209
 
275
             rm -rf ${temp_restore_dir}ssh
287
             rm -rf ${temp_restore_dir}ssh
276
             chown -R ${GOGS_USERNAME}:${GOGS_USERNAME} /home/${GOGS_USERNAME}
288
             chown -R ${GOGS_USERNAME}:${GOGS_USERNAME} /home/${GOGS_USERNAME}
277
         fi
289
         fi
290
+
291
+        GOGS_CONFIG_PATH=/home/${GOGS_USERNAME}/custom/conf
292
+        GOGS_CONFIG_FILE=${GOGS_CONFIG_PATH}/app.ini
293
+        MARIADB_PASSWORD=$(${PROJECT_NAME}-pass -u root -a mariadb)
294
+        sed -i "s|PASSWD =.*|PASSWD = $MARIADB_PASSWORD|g" ${GOGS_CONFIG_FILE}
295
+        MARIADB_PASSWORD=
278
     fi
296
     fi
279
 }
297
 }
280
 
298
 
345
             chown -R ${GOGS_USERNAME}:${GOGS_USERNAME} /home/${GOGS_USERNAME}
363
             chown -R ${GOGS_USERNAME}:${GOGS_USERNAME} /home/${GOGS_USERNAME}
346
             echo $"Restore of Gogs complete"
364
             echo $"Restore of Gogs complete"
347
         fi
365
         fi
366
+
367
+        GOGS_CONFIG_PATH=/home/${GOGS_USERNAME}/custom/conf
368
+        GOGS_CONFIG_FILE=${GOGS_CONFIG_PATH}/app.ini
369
+        MARIADB_PASSWORD=$(${PROJECT_NAME}-pass -u root -a mariadb)
370
+        sed -i "s|PASSWD =.*|PASSWD = $MARIADB_PASSWORD|g" ${GOGS_CONFIG_FILE}
371
+        MARIADB_PASSWORD=
348
     fi
372
     fi
349
 }
373
 }
350
 
374
 
354
     fi
378
     fi
355
     systemctl stop gogs
379
     systemctl stop gogs
356
     systemctl disable gogs
380
     systemctl disable gogs
381
+
357
     nginx_dissite ${GIT_DOMAIN_NAME}
382
     nginx_dissite ${GIT_DOMAIN_NAME}
358
     remove_certs ${GIT_DOMAIN_NAME}
383
     remove_certs ${GIT_DOMAIN_NAME}
359
     if [ -d /var/www/${GIT_DOMAIN_NAME} ]; then
384
     if [ -d /var/www/${GIT_DOMAIN_NAME} ]; then
365
     function_check drop_database
390
     function_check drop_database
366
     drop_database gogs
391
     drop_database gogs
367
     rm /etc/systemd/system/gogs.service
392
     rm /etc/systemd/system/gogs.service
393
+    systemctl daemon-reload
368
     rm -rf /home/${GOGS_USERNAME}/*
394
     rm -rf /home/${GOGS_USERNAME}/*
369
     remove_onion_service gogs ${GIT_ONION_PORT} 9418
395
     remove_onion_service gogs ${GIT_ONION_PORT} 9418
370
     remove_completion_param "install_gogs"
396
     remove_completion_param "install_gogs"
371
     sed -i '/gogs /d' $COMPLETION_FILE
397
     sed -i '/gogs /d' $COMPLETION_FILE
372
     remove_backup_database_local gogs
398
     remove_backup_database_local gogs
373
 
399
 
400
+    groupdel -f gogs
401
+    userdel -r gogs
402
+
374
     function_check remove_ddns_domain
403
     function_check remove_ddns_domain
375
     remove_ddns_domain $GIT_DOMAIN_NAME
404
     remove_ddns_domain $GIT_DOMAIN_NAME
376
 }
405
 }
382
 
411
 
383
     adduser --disabled-login --gecos 'Gogs' $GOGS_USERNAME
412
     adduser --disabled-login --gecos 'Gogs' $GOGS_USERNAME
384
 
413
 
414
+    if [ ! -d /home/$GOGS_USERNAME ]; then
415
+        echo $"/home/$GOGS_USERNAME directory not created"
416
+        exit 783528
417
+    fi
418
+
419
+    groupadd gogs
420
+
385
     gogs_parameters
421
     gogs_parameters
386
 
422
 
387
     if [ ! -d ${INSTALL_DIR} ]; then
423
     if [ ! -d ${INSTALL_DIR} ]; then
575
 
611
 
576
     GIT_ONION_HOSTNAME=$(cat /var/lib/tor/hidden_service_gogs/hostname)
612
     GIT_ONION_HOSTNAME=$(cat /var/lib/tor/hidden_service_gogs/hostname)
577
 
613
 
578
-    systemctl restart php5-fpm
614
+    systemctl restart mariadb
615
+    systemctl restart php7.0-fpm
579
     systemctl restart nginx
616
     systemctl restart nginx
580
 
617
 
581
     set_completion_param "gogs domain" "$GIT_DOMAIN_NAME"
618
     set_completion_param "gogs domain" "$GIT_DOMAIN_NAME"

+ 33
- 9
src/freedombone-app-htmly View File

50
                  DDNS_PROVIDER
50
                  DDNS_PROVIDER
51
                  MY_USERNAME)
51
                  MY_USERNAME)
52
 
52
 
53
+function logging_on_htmly {
54
+    echo -n ''
55
+}
56
+
57
+function logging_off_htmly {
58
+    echo -n ''
59
+}
60
+
53
 function set_avatar_from_url {
61
 function set_avatar_from_url {
54
     AVATAR="$1"
62
     AVATAR="$1"
55
 
63
 
192
 }
200
 }
193
 
201
 
194
 function upgrade_htmly {
202
 function upgrade_htmly {
203
+    CURR_HTMLY_COMMIT=$(get_completion_param "htmly commit")
204
+    if [[ "$CURR_HTMLY_COMMIT" == "$HTMLY_COMMIT" ]]; then
205
+        return
206
+    fi
207
+
195
     read_config_param "HTMLY_DOMAIN_NAME"
208
     read_config_param "HTMLY_DOMAIN_NAME"
196
 
209
 
197
     function_check set_repo_commit
210
     function_check set_repo_commit
462
     echo '        try_files $uri $uri/ /index.php;' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
475
     echo '        try_files $uri $uri/ /index.php;' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
463
     echo '        # NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
476
     echo '        # NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
464
     echo '        fastcgi_split_path_info ^(.+\.php)(/.+)$;' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
477
     echo '        fastcgi_split_path_info ^(.+\.php)(/.+)$;' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
465
-    echo '        # With php5-cgi alone:' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
478
+    echo '        # With php-cgi alone:' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
466
     echo '        # fastcgi_pass 127.0.0.1:9000;' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
479
     echo '        # fastcgi_pass 127.0.0.1:9000;' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
467
-    echo '        # With php5-fpm:' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
468
-    echo '        fastcgi_pass unix:/var/run/php5-fpm.sock;' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
480
+    echo '        # With php-fpm:' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
481
+    echo '        fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
469
     echo '        include fastcgi_params;' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
482
     echo '        include fastcgi_params;' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
483
+    echo '        fastcgi_read_timeout 30;' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
470
     echo '        fastcgi_index index.php;' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
484
     echo '        fastcgi_index index.php;' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
471
     echo '        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
485
     echo '        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
472
     echo '    }' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
486
     echo '    }' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
541
     echo '        try_files $uri $uri/ /index.php;' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
555
     echo '        try_files $uri $uri/ /index.php;' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
542
     echo '        # NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
556
     echo '        # NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
543
     echo '        fastcgi_split_path_info ^(.+\.php)(/.+)$;' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
557
     echo '        fastcgi_split_path_info ^(.+\.php)(/.+)$;' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
544
-    echo '        # With php5-cgi alone:' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
558
+    echo '        # With php-cgi alone:' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
545
     echo '        # fastcgi_pass 127.0.0.1:9000;' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
559
     echo '        # fastcgi_pass 127.0.0.1:9000;' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
546
-    echo '        # With php5-fpm:' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
547
-    echo '        fastcgi_pass unix:/var/run/php5-fpm.sock;' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
560
+    echo '        # With php-fpm:' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
561
+    echo '        fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
548
     echo '        include fastcgi_params;' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
562
     echo '        include fastcgi_params;' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
563
+    echo '        fastcgi_read_timeout 30;' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
549
     echo '        fastcgi_index index.php;' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
564
     echo '        fastcgi_index index.php;' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
550
     echo '        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
565
     echo '        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
551
     echo '    }' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
566
     echo '    }' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
574
     fi
589
     fi
575
 
590
 
576
     cd /var/www/$HTMLY_DOMAIN_NAME
591
     cd /var/www/$HTMLY_DOMAIN_NAME
577
-    git_clone $HTMLY_REPO htdocs
592
+
593
+    if [ -d /repos/htmly ]; then
594
+        mkdir htdocs
595
+        cp -r -p /repos/htmly/. htdocs
596
+        cd htdocs
597
+        git pull
598
+    else
599
+        git_clone $HTMLY_REPO htdocs
600
+    fi
601
+
578
     cd htdocs
602
     cd htdocs
579
     git checkout $HTMLY_COMMIT -b $HTMLY_COMMIT
603
     git checkout $HTMLY_COMMIT -b $HTMLY_COMMIT
580
     set_completion_param "htmly commit" "$HTMLY_COMMIT"
604
     set_completion_param "htmly commit" "$HTMLY_COMMIT"
591
     fi
615
     fi
592
 
616
 
593
     # for the avatar changing command
617
     # for the avatar changing command
594
-    apt-get -yq install imagemagick
618
+    apt-get -yq install imagemagick libfcgi0ldbl
595
 
619
 
596
     function_check install_htmly_from_repo
620
     function_check install_htmly_from_repo
597
     install_htmly_from_repo
621
     install_htmly_from_repo
627
     function_check nginx_ensite
651
     function_check nginx_ensite
628
     nginx_ensite $HTMLY_DOMAIN_NAME
652
     nginx_ensite $HTMLY_DOMAIN_NAME
629
 
653
 
630
-    systemctl restart php5-fpm
654
+    systemctl restart php7.0-fpm
631
     systemctl restart nginx
655
     systemctl restart nginx
632
 
656
 
633
     ${PROJECT_NAME}-pass -u $MY_USERNAME -a htmly -p "$HTMLY_ADMIN_PASSWORD"
657
     ${PROJECT_NAME}-pass -u $MY_USERNAME -a htmly -p "$HTMLY_ADMIN_PASSWORD"

+ 61
- 17
src/freedombone-app-hubzilla View File

13
 # License
13
 # License
14
 # =======
14
 # =======
15
 #
15
 #
16
-# Copyright (C) 2014-2016 Bob Mottram <bob@freedombone.net>
16
+# Copyright (C) 2014-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
51
                     HUBZILLA_REPO
51
                     HUBZILLA_REPO
52
                     HUBZILLA_ADDONS_REPO)
52
                     HUBZILLA_ADDONS_REPO)
53
 
53
 
54
+function logging_on_hubzilla {
55
+    echo -n ''
56
+}
57
+
58
+function logging_off_hubzilla {
59
+    echo -n ''
60
+}
61
+
54
 function remove_user_hubzilla {
62
 function remove_user_hubzilla {
55
     remove_username="$1"
63
     remove_username="$1"
56
     ${PROJECT_NAME}-pass -u $remove_username --rmapp hubzilla
64
     ${PROJECT_NAME}-pass -u $remove_username --rmapp hubzilla
196
 }
204
 }
197
 
205
 
198
 function upgrade_hubzilla {
206
 function upgrade_hubzilla {
207
+    CURR_HUBZILLA_COMMIT=$(get_completion_param "hubzilla commit")
208
+    if [[ "$CURR_HUBZILLA_COMMIT" == "$HUBZILLA_COMMIT" ]]; then
209
+        return
210
+    fi
211
+
199
     HUBZILLA_PATH=/var/www/$HUBZILLA_DOMAIN_NAME/htdocs
212
     HUBZILLA_PATH=/var/www/$HUBZILLA_DOMAIN_NAME/htdocs
200
 
213
 
201
     function_check set_repo_commit
214
     function_check set_repo_commit
238
         if [ -d $temp_restore_dir ]; then
251
         if [ -d $temp_restore_dir ]; then
239
             rm -rf $temp_restore_dir
252
             rm -rf $temp_restore_dir
240
         fi
253
         fi
254
+
255
+        MARIADB_PASSWORD=$(${PROJECT_NAME}-pass -u root -a mariadb)
256
+        HUBZILLA_PATH=/var/www/$HUBZILLA_DOMAIN_NAME/htdocs
257
+        sed -i "s|\$db_pass =.*|\$db_pass = '${MARIADB_PASSWORD}';|g" $HUBZILLA_PATH/.htconfig.php
258
+        MARIADB_PASSWORD=
241
     fi
259
     fi
242
 }
260
 }
243
 
261
 
273
     if [ -d /root/temphubzilla ]; then
291
     if [ -d /root/temphubzilla ]; then
274
         rm -rf /root/temphubzilla
292
         rm -rf /root/temphubzilla
275
     fi
293
     fi
294
+
295
+    MARIADB_PASSWORD=$(${PROJECT_NAME}-pass -u root -a mariadb)
296
+    HUBZILLA_PATH=/var/www/$HUBZILLA_DOMAIN_NAME/htdocs
297
+    sed -i "s|\$db_pass =.*|\$db_pass = '${MARIADB_PASSWORD}';|g" $HUBZILLA_PATH/.htconfig.php
298
+    MARIADB_PASSWORD=
276
 }
299
 }
277
 
300
 
278
 function remove_hubzilla {
301
 function remove_hubzilla {
304
     fi
327
     fi
305
 
328
 
306
     if [[ $ONION_ONLY != "no" ]]; then
329
     if [[ $ONION_ONLY != "no" ]]; then
307
-        return
330
+        echo $"Hubzilla won't work on an onion address"
331
+        exit 529925
308
     fi
332
     fi
309
 
333
 
310
     HUBZILLA_PATH=/var/www/$HUBZILLA_DOMAIN_NAME/htdocs
334
     HUBZILLA_PATH=/var/www/$HUBZILLA_DOMAIN_NAME/htdocs
318
     function_check repair_databases_script
342
     function_check repair_databases_script
319
     repair_databases_script
343
     repair_databases_script
320
 
344
 
321
-    apt-get -yq install php5-common php5-cli php5-curl php5-gd php5-mysql php5-mcrypt git
322
-    apt-get -yq install php5-dev imagemagick php5-imagick
323
-    apt-get -yq install php5-memcached
345
+    apt-get -yq install php-common php-cli php-curl php-gd php-mysql php-mcrypt git
346
+    apt-get -yq install php-dev imagemagick php-imagick libfcgi0ldbl
347
+    apt-get -yq install php-memcached memcached
324
 
348
 
325
     if [ ! -d /var/www/$HUBZILLA_DOMAIN_NAME ]; then
349
     if [ ! -d /var/www/$HUBZILLA_DOMAIN_NAME ]; then
326
         mkdir /var/www/$HUBZILLA_DOMAIN_NAME
350
         mkdir /var/www/$HUBZILLA_DOMAIN_NAME
331
 
355
 
332
     if [ ! -f $HUBZILLA_PATH/index.php ]; then
356
     if [ ! -f $HUBZILLA_PATH/index.php ]; then
333
         cd $INSTALL_DIR
357
         cd $INSTALL_DIR
334
-        function_check git_clone
335
-        git_clone $HUBZILLA_REPO hubzilla
358
+
359
+        if [ -d /repos/hubzilla ]; then
360
+            mkdir hubzilla
361
+            cp -r -p /repos/hubzilla/. hubzilla
362
+            cd hubzilla
363
+            git pull
364
+        else
365
+            function_check git_clone
366
+            git_clone $HUBZILLA_REPO hubzilla
367
+        fi
368
+
336
         git checkout $HUBZILLA_COMMIT -b $HUBZILLA_COMMIT
369
         git checkout $HUBZILLA_COMMIT -b $HUBZILLA_COMMIT
337
         set_completion_param "hubzilla commit" "$HUBZILLA_COMMIT"
370
         set_completion_param "hubzilla commit" "$HUBZILLA_COMMIT"
338
 
371
 
339
         rm -rf $HUBZILLA_PATH
372
         rm -rf $HUBZILLA_PATH
340
         mv hubzilla $HUBZILLA_PATH
373
         mv hubzilla $HUBZILLA_PATH
341
 
374
 
342
-        git_clone $HUBZILLA_ADDONS_REPO $HUBZILLA_PATH/addon
375
+        if [ -d /repos/hubzilla-addons ]; then
376
+            mkdir $HUBZILLA_PATH/addon
377
+            cp -r -p /repos/hubzilla-addons/. $HUBZILLA_PATH/addon
378
+            cd $HUBZILLA_PATH/addon
379
+            git pull
380
+        else
381
+            git_clone $HUBZILLA_ADDONS_REPO $HUBZILLA_PATH/addon
382
+        fi
383
+
343
         cd $HUBZILLA_PATH/addon
384
         cd $HUBZILLA_PATH/addon
344
         git checkout $HUBZILLA_ADDONS_COMMIT -b $HUBZILLA_ADDONS_COMMIT
385
         git checkout $HUBZILLA_ADDONS_COMMIT -b $HUBZILLA_ADDONS_COMMIT
345
         set_completion_param "hubzilla addons commit" "$HUBZILLA_ADDONS_COMMIT"
386
         set_completion_param "hubzilla addons commit" "$HUBZILLA_ADDONS_COMMIT"
346
 
387
 
347
         # some extra themes
388
         # some extra themes
348
-        git_clone $HUBZILLA_THEMES_REPO $HUBZILLA_PATH/redmatrix-themes1
349
-        cp -r $HUBZILLA_PATH/redmatrix-themes1/* $HUBZILLA_PATH/view/theme/
389
+        #git_clone $HUBZILLA_THEMES_REPO $HUBZILLA_PATH/redmatrix-themes1
390
+        #cp -r $HUBZILLA_PATH/redmatrix-themes1/* $HUBZILLA_PATH/view/theme/
350
 
391
 
351
         chown -R www-data:www-data $HUBZILLA_PATH
392
         chown -R www-data:www-data $HUBZILLA_PATH
352
     fi
393
     fi
420
         echo '        try_files $uri $uri/ /index.php;' >> /etc/nginx/sites-available/$HUBZILLA_DOMAIN_NAME
461
         echo '        try_files $uri $uri/ /index.php;' >> /etc/nginx/sites-available/$HUBZILLA_DOMAIN_NAME
421
         echo '        # NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini' >> /etc/nginx/sites-available/$HUBZILLA_DOMAIN_NAME
462
         echo '        # NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini' >> /etc/nginx/sites-available/$HUBZILLA_DOMAIN_NAME
422
         echo '        fastcgi_split_path_info ^(.+\.php)(/.+)$;' >> /etc/nginx/sites-available/$HUBZILLA_DOMAIN_NAME
463
         echo '        fastcgi_split_path_info ^(.+\.php)(/.+)$;' >> /etc/nginx/sites-available/$HUBZILLA_DOMAIN_NAME
423
-        echo '        # With php5-cgi alone:' >> /etc/nginx/sites-available/$HUBZILLA_DOMAIN_NAME
464
+        echo '        # With php-cgi alone:' >> /etc/nginx/sites-available/$HUBZILLA_DOMAIN_NAME
424
         echo '        # fastcgi_pass 127.0.0.1:9000;' >> /etc/nginx/sites-available/$HUBZILLA_DOMAIN_NAME
465
         echo '        # fastcgi_pass 127.0.0.1:9000;' >> /etc/nginx/sites-available/$HUBZILLA_DOMAIN_NAME
425
-        echo '        # With php5-fpm:' >> /etc/nginx/sites-available/$HUBZILLA_DOMAIN_NAME
426
-        echo '        fastcgi_pass unix:/var/run/php5-fpm.sock;' >> /etc/nginx/sites-available/$HUBZILLA_DOMAIN_NAME
466
+        echo '        # With php-fpm:' >> /etc/nginx/sites-available/$HUBZILLA_DOMAIN_NAME
467
+        echo '        fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;' >> /etc/nginx/sites-available/$HUBZILLA_DOMAIN_NAME
427
         echo '        include fastcgi_params;' >> /etc/nginx/sites-available/$HUBZILLA_DOMAIN_NAME
468
         echo '        include fastcgi_params;' >> /etc/nginx/sites-available/$HUBZILLA_DOMAIN_NAME
469
+        echo '        fastcgi_read_timeout 30;' >> /etc/nginx/sites-available/$HUBZILLA_DOMAIN_NAME
428
         echo '        fastcgi_index index.php;' >> /etc/nginx/sites-available/$HUBZILLA_DOMAIN_NAME
470
         echo '        fastcgi_index index.php;' >> /etc/nginx/sites-available/$HUBZILLA_DOMAIN_NAME
429
         echo '        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;' >> /etc/nginx/sites-available/$HUBZILLA_DOMAIN_NAME
471
         echo '        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;' >> /etc/nginx/sites-available/$HUBZILLA_DOMAIN_NAME
430
         echo '        fastcgi_read_timeout 300;' >> /etc/nginx/sites-available/$HUBZILLA_DOMAIN_NAME
472
         echo '        fastcgi_read_timeout 300;' >> /etc/nginx/sites-available/$HUBZILLA_DOMAIN_NAME
488
         echo '        try_files $uri $uri/ /index.php;' >> /etc/nginx/sites-available/$HUBZILLA_DOMAIN_NAME
530
         echo '        try_files $uri $uri/ /index.php;' >> /etc/nginx/sites-available/$HUBZILLA_DOMAIN_NAME
489
         echo '        # NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini' >> /etc/nginx/sites-available/$HUBZILLA_DOMAIN_NAME
531
         echo '        # NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini' >> /etc/nginx/sites-available/$HUBZILLA_DOMAIN_NAME
490
         echo '        fastcgi_split_path_info ^(.+\.php)(/.+)$;' >> /etc/nginx/sites-available/$HUBZILLA_DOMAIN_NAME
532
         echo '        fastcgi_split_path_info ^(.+\.php)(/.+)$;' >> /etc/nginx/sites-available/$HUBZILLA_DOMAIN_NAME
491
-        echo '        # With php5-cgi alone:' >> /etc/nginx/sites-available/$HUBZILLA_DOMAIN_NAME
533
+        echo '        # With php-cgi alone:' >> /etc/nginx/sites-available/$HUBZILLA_DOMAIN_NAME
492
         echo '        # fastcgi_pass 127.0.0.1:9000;' >> /etc/nginx/sites-available/$HUBZILLA_DOMAIN_NAME
534
         echo '        # fastcgi_pass 127.0.0.1:9000;' >> /etc/nginx/sites-available/$HUBZILLA_DOMAIN_NAME
493
-        echo '        # With php5-fpm:' >> /etc/nginx/sites-available/$HUBZILLA_DOMAIN_NAME
494
-        echo '        fastcgi_pass unix:/var/run/php5-fpm.sock;' >> /etc/nginx/sites-available/$HUBZILLA_DOMAIN_NAME
535
+        echo '        # With php-fpm:' >> /etc/nginx/sites-available/$HUBZILLA_DOMAIN_NAME
536
+        echo '        fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;' >> /etc/nginx/sites-available/$HUBZILLA_DOMAIN_NAME
495
         echo '        include fastcgi_params;' >> /etc/nginx/sites-available/$HUBZILLA_DOMAIN_NAME
537
         echo '        include fastcgi_params;' >> /etc/nginx/sites-available/$HUBZILLA_DOMAIN_NAME
538
+        echo '        fastcgi_read_timeout 30;' >> /etc/nginx/sites-available/$HUBZILLA_DOMAIN_NAME
496
         echo '        fastcgi_index index.php;' >> /etc/nginx/sites-available/$HUBZILLA_DOMAIN_NAME
539
         echo '        fastcgi_index index.php;' >> /etc/nginx/sites-available/$HUBZILLA_DOMAIN_NAME
497
         echo '        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;' >> /etc/nginx/sites-available/$HUBZILLA_DOMAIN_NAME
540
         echo '        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;' >> /etc/nginx/sites-available/$HUBZILLA_DOMAIN_NAME
498
         echo '        fastcgi_read_timeout 300;' >> /etc/nginx/sites-available/$HUBZILLA_DOMAIN_NAME
541
         echo '        fastcgi_read_timeout 300;' >> /etc/nginx/sites-available/$HUBZILLA_DOMAIN_NAME
583
     chown www-data:www-data $HUBZILLA_PATH/.htconfig.php
626
     chown www-data:www-data $HUBZILLA_PATH/.htconfig.php
584
     chmod 755 $HUBZILLA_PATH/.htconfig.php
627
     chmod 755 $HUBZILLA_PATH/.htconfig.php
585
 
628
 
586
-    systemctl restart php5-fpm
629
+    systemctl restart mariadb
630
+    systemctl restart php7.0-fpm
587
     systemctl restart nginx
631
     systemctl restart nginx
588
     systemctl restart cron
632
     systemctl restart cron
589
 
633
 

+ 23
- 3
src/freedombone-app-ipfs View File

48
                 IPFS_KEY_LENGTH
48
                 IPFS_KEY_LENGTH
49
                 IPFS_PORT)
49
                 IPFS_PORT)
50
 
50
 
51
+function logging_on_ipfs {
52
+    echo -n ''
53
+}
54
+
55
+function logging_off_ipfs {
56
+    echo -n ''
57
+}
58
+
51
 function install_interactive_ipfs {
59
 function install_interactive_ipfs {
52
     echo -n ''
60
     echo -n ''
53
     APP_INSTALLED=1
61
     APP_INSTALLED=1
58
 }
66
 }
59
 
67
 
60
 function upgrade_ipfs_go {
68
 function upgrade_ipfs_go {
69
+    CURR_IPFS_COMMIT=$(get_completion_param "ipfs commit")
70
+    if [[ "$CURR_IPFS_COMMIT" == "$IPFS_COMMIT" ]]; then
71
+        return
72
+    fi
73
+
61
     if [[ $(app_is_installed ipfs_go) == "0" ]]; then
74
     if [[ $(app_is_installed ipfs_go) == "0" ]]; then
62
         return
75
         return
63
     fi
76
     fi
155
     systemctl disable ipfs
168
     systemctl disable ipfs
156
     systemctl daemon-reload
169
     systemctl daemon-reload
157
     rm /etc/systemd/system/ipfs.service
170
     rm /etc/systemd/system/ipfs.service
171
+    systemctl daemon-reload
158
     rm -rf $GOPATH/src/github.com/ipfs
172
     rm -rf $GOPATH/src/github.com/ipfs
159
     firewall_remove $IPFS_PORT tcp
173
     firewall_remove $IPFS_PORT tcp
160
     remove_completion_param install_ipfs
174
     remove_completion_param install_ipfs
199
         return
213
         return
200
     fi
214
     fi
201
 
215
 
202
-    chroot ${rootdir} apt-get -yq install nodejs
203
-    chroot ${rootdir} apt-get -yq install npm curl
216
+    chroot ${rootdir} apt-get -yq install nodejs curl
204
     chroot ${rootdir} apt-get -yq install libpam0g-dev fuse
217
     chroot ${rootdir} apt-get -yq install libpam0g-dev fuse
205
 
218
 
206
     if [ ! -f ${rootdir}/usr/bin/nodejs ]; then
219
     if [ ! -f ${rootdir}/usr/bin/nodejs ]; then
395
         ARCHITECTURE=$(uname -m)
408
         ARCHITECTURE=$(uname -m)
396
         if [[ $ARCHITECTURE == "arm"* ]]; then
409
         if [[ $ARCHITECTURE == "arm"* ]]; then
397
             IPFS_ARCH=arm
410
             IPFS_ARCH=arm
411
+            echo $"Using $IPFS_ARCH"
398
         fi
412
         fi
399
         if [[ $ARCHITECTURE == "amd"* || $ARCHITECTURE == "x86_64" ]]; then
413
         if [[ $ARCHITECTURE == "amd"* || $ARCHITECTURE == "x86_64" ]]; then
400
             IPFS_ARCH=amd64
414
             IPFS_ARCH=amd64
415
+            echo $"Using $IPFS_ARCH"
401
         fi
416
         fi
402
         if [[ $ARCHITECTURE == *"386" || $ARCHITECTURE == *"686" ]]; then
417
         if [[ $ARCHITECTURE == *"386" || $ARCHITECTURE == *"686" ]]; then
403
             IPFS_ARCH=386
418
             IPFS_ARCH=386
419
+            echo $"Using $IPFS_ARCH"
404
         fi
420
         fi
405
     fi
421
     fi
406
 
422
 
451
     if [ ! -d /home/git ]; then
467
     if [ ! -d /home/git ]; then
452
         # add a gogs user account
468
         # add a gogs user account
453
         adduser --disabled-login --gecos 'Gogs' git
469
         adduser --disabled-login --gecos 'Gogs' git
470
+        if [ ! -d /home/git ]; then
471
+            echo $"/home/git directory not created"
472
+            exit 735272
473
+        fi
454
 
474
 
455
         # install Go
475
         # install Go
456
         if ! grep -q "export GOPATH=" ~/.bashrc; then
476
         if ! grep -q "export GOPATH=" ~/.bashrc; then
510
     fi
530
     fi
511
 
531
 
512
     # initialise
532
     # initialise
513
-    su -c "$IPFS_PATH/ipfs init -b 4096" - $MY_USERNAME
533
+    su -c "$IPFS_PATH/ipfs init -b 2048" - $MY_USERNAME
514
     if [ ! -d /home/$MY_USERNAME/.ipfs ]; then
534
     if [ ! -d /home/$MY_USERNAME/.ipfs ]; then
515
         echo "IPFS could not be initialised for user $MY_USERNAME"
535
         echo "IPFS could not be initialised for user $MY_USERNAME"
516
         exit 7358
536
         exit 7358

+ 14
- 2
src/freedombone-app-irc View File

54
                IRC_BUFFER_LENGTH
54
                IRC_BUFFER_LENGTH
55
                ONION_ONLY)
55
                ONION_ONLY)
56
 
56
 
57
+function logging_on_irc {
58
+    echo -n ''
59
+}
60
+
61
+function logging_off_irc {
62
+    echo -n ''
63
+}
64
+
57
 function irc_get_global_password {
65
 function irc_get_global_password {
58
     echo $(cat /etc/ngircd/ngircd.conf | grep "Password =" | head -n 1 | awk -F '=' '{print $2}')
66
     echo $(cat /etc/ngircd/ngircd.conf | grep "Password =" | head -n 1 | awk -F '=' '{print $2}')
59
 }
67
 }
544
     else
552
     else
545
         sed -i 's|;SSLConnect.*|SSLConnect = no|g'
553
         sed -i 's|;SSLConnect.*|SSLConnect = no|g'
546
         # comment out the second Ports entry
554
         # comment out the second Ports entry
547
-        if ! grep ";Ports =" /etc/ngircd/ngircd.conf; then
555
+        if ! grep -q ";Ports =" /etc/ngircd/ngircd.conf; then
548
             sed -i '0,/Ports =/! s/Ports =/;Ports =/' /etc/ngircd/ngircd.conf
556
             sed -i '0,/Ports =/! s/Ports =/;Ports =/' /etc/ngircd/ngircd.conf
549
         fi
557
         fi
550
     fi
558
     fi
613
         return
621
         return
614
     fi
622
     fi
615
 
623
 
616
-    apt-get -yq -t jessie-backports install znc
624
+    apt-get -yq install znc
617
 
625
 
618
     adduser --disabled-login --gecos 'znc' znc
626
     adduser --disabled-login --gecos 'znc' znc
627
+    if [ ! -d /home/znc ]; then
628
+        echo $"/home/znc directory not created"
629
+        exit 7354262
630
+    fi
619
 
631
 
620
     mkdir -p /home/znc/.znc/configs
632
     mkdir -p /home/znc/.znc/configs
621
     mkdir -p /home/znc/.znc/users
633
     mkdir -p /home/znc/.znc/users

+ 13
- 5
src/freedombone-app-jitsi View File

51
                  DEFAULT_DOMAIN_NAME
51
                  DEFAULT_DOMAIN_NAME
52
                  MY_USERNAME)
52
                  MY_USERNAME)
53
 
53
 
54
+function logging_on_jitsi {
55
+    echo -n ''
56
+}
57
+
58
+function logging_off_jitsi {
59
+    echo -n ''
60
+}
61
+
54
 function jitsi_disable_google_spyware {
62
 function jitsi_disable_google_spyware {
55
     # Presumably they included Google Analytics for benign reasons, but it's
63
     # Presumably they included Google Analytics for benign reasons, but it's
56
     # an obvious security problem. This should disable it.
64
     # an obvious security problem. This should disable it.
57
     sed -i "s|Google Analytics|Google Spyware deactivated|g" /usr/share/jitsi-meet/analytics.js
65
     sed -i "s|Google Analytics|Google Spyware deactivated|g" /usr/share/jitsi-meet/analytics.js
58
     sed -i "s|www.google-analytics.com|${JITSI_DOMAIN_NAME}|g" /usr/share/jitsi-meet/analytics.js
66
     sed -i "s|www.google-analytics.com|${JITSI_DOMAIN_NAME}|g" /usr/share/jitsi-meet/analytics.js
59
-    if ! grep '//ga(' /usr/share/jitsi-meet/analytics.js; then
67
+    if ! grep -q '//ga(' /usr/share/jitsi-meet/analytics.js; then
60
         sed -i 's|ga(|//ga(|g' /usr/share/jitsi-meet/analytics.js
68
         sed -i 's|ga(|//ga(|g' /usr/share/jitsi-meet/analytics.js
61
     fi
69
     fi
62
-    if ! grep '//action +' /usr/share/jitsi-meet/analytics.js; then
70
+    if ! grep -q '//action +' /usr/share/jitsi-meet/analytics.js; then
63
         sed -i 's|action +|//action +|g' /usr/share/jitsi-meet/analytics.js
71
         sed -i 's|action +|//action +|g' /usr/share/jitsi-meet/analytics.js
64
     fi
72
     fi
65
 
73
 
66
     sed -i "s|Google Analytics|Google Spyware deactivated|g" /usr/share/jitsi-meet/libs/analytics.js
74
     sed -i "s|Google Analytics|Google Spyware deactivated|g" /usr/share/jitsi-meet/libs/analytics.js
67
     sed -i "s|www.google-analytics.com|${JITSI_DOMAIN_NAME}|g" /usr/share/jitsi-meet/libs/analytics.js
75
     sed -i "s|www.google-analytics.com|${JITSI_DOMAIN_NAME}|g" /usr/share/jitsi-meet/libs/analytics.js
68
-    if ! grep '//ga(' /usr/share/jitsi-meet/libs/analytics.js; then
76
+    if ! grep -q '//ga(' /usr/share/jitsi-meet/libs/analytics.js; then
69
         sed -i 's|ga(|//ga(|g' /usr/share/jitsi-meet/libs/analytics.js
77
         sed -i 's|ga(|//ga(|g' /usr/share/jitsi-meet/libs/analytics.js
70
     fi
78
     fi
71
-    if ! grep '//action +' /usr/share/jitsi-meet/libs/analytics.js; then
79
+    if ! grep -q '//action +' /usr/share/jitsi-meet/libs/analytics.js; then
72
         sed -i 's|action +|//action +|g' /usr/share/jitsi-meet/libs/analytics.js
80
         sed -i 's|action +|//action +|g' /usr/share/jitsi-meet/libs/analytics.js
73
     fi
81
     fi
74
 }
82
 }
230
         remove_nodejs jitsi
238
         remove_nodejs jitsi
231
         exit 638352
239
         exit 638352
232
     fi
240
     fi
233
-    if ! grep "jitsi" /etc/apt/sources.list; then
241
+    if ! grep -q "jitsi" /etc/apt/sources.list; then
234
         echo "deb http://download.jitsi.org/nightly/deb ${jitsi_deb_repo}/" >> /etc/apt/sources.list
242
         echo "deb http://download.jitsi.org/nightly/deb ${jitsi_deb_repo}/" >> /etc/apt/sources.list
235
     fi
243
     fi
236
     wget -qO - https://download.jitsi.org/nightly/deb/${jitsi_deb_repo}/archive.key | apt-key add -
244
     wget -qO - https://download.jitsi.org/nightly/deb/${jitsi_deb_repo}/archive.key | apt-key add -

+ 61
- 17
src/freedombone-app-koel View File

39
 KOEL_ONION_PORT=8118
39
 KOEL_ONION_PORT=8118
40
 KOEL_PORT=9002
40
 KOEL_PORT=9002
41
 KOEL_REPO="https://github.com/phanan/koel"
41
 KOEL_REPO="https://github.com/phanan/koel"
42
-KOEL_COMMIT='70464a8977b1058f3bd0a4ec77877fe7894d8d84'
42
+KOEL_COMMIT='70464a'
43
 KOEL_ADMIN_PASSWORD=
43
 KOEL_ADMIN_PASSWORD=
44
 
44
 
45
 koel_variables=(ONION_ONLY
45
 koel_variables=(ONION_ONLY
49
                 MY_EMAIL_ADDRESS
49
                 MY_EMAIL_ADDRESS
50
                 MY_USERNAME)
50
                 MY_USERNAME)
51
 
51
 
52
+function logging_on_koel {
53
+    echo -n ''
54
+}
55
+
56
+function logging_off_koel {
57
+    echo -n ''
58
+}
59
+
52
 function koel_remove_gravatar {
60
 function koel_remove_gravatar {
53
     cd /var/www/${KOEL_DOMAIN_NAME}/htdocs
61
     cd /var/www/${KOEL_DOMAIN_NAME}/htdocs
54
     sed -i "s|www.gravatar.com|${KOEL_DOMAIN_NAME}|g" node_modules/browser-sync-ui/public/js/app.js.map
62
     sed -i "s|www.gravatar.com|${KOEL_DOMAIN_NAME}|g" node_modules/browser-sync-ui/public/js/app.js.map
323
 
331
 
324
     source_directory=/var/www/${KOEL_DOMAIN_NAME}/htdocs
332
     source_directory=/var/www/${KOEL_DOMAIN_NAME}/htdocs
325
     if [ -d $source_directory ]; then
333
     if [ -d $source_directory ]; then
326
-        systemctl stop koal
334
+        systemctl stop koel
327
 
335
 
328
         dest_directory=koel
336
         dest_directory=koel
329
         function_check suspend_site
337
         function_check suspend_site
338
         function_check restart_site
346
         function_check restart_site
339
         restart_site
347
         restart_site
340
 
348
 
341
-        systemctl start koal
349
+        systemctl start koel
342
     fi
350
     fi
343
 }
351
 }
344
 
352
 
349
     KOEL_DOMAIN_NAME=$(get_completion_param "koel domain")
357
     KOEL_DOMAIN_NAME=$(get_completion_param "koel domain")
350
     if [ $KOEL_DOMAIN_NAME ]; then
358
     if [ $KOEL_DOMAIN_NAME ]; then
351
         echo $"Restoring koel"
359
         echo $"Restoring koel"
352
-        systemctl stop koal
360
+        systemctl stop koel
353
 
361
 
354
         temp_restore_dir=/root/tempkoel
362
         temp_restore_dir=/root/tempkoel
355
         koel_dir=/var/www/${KOEL_DOMAIN_NAME}/htdocs
363
         koel_dir=/var/www/${KOEL_DOMAIN_NAME}/htdocs
361
         if [ -d $temp_restore_dir ]; then
369
         if [ -d $temp_restore_dir ]; then
362
             rm -rf $temp_restore_dir
370
             rm -rf $temp_restore_dir
363
         fi
371
         fi
364
-        systemctl start koal
372
+
373
+        MARIADB_PASSWORD=$(${PROJECT_NAME}-pass -u root -a mariadb)
374
+        cd /var/www/$KOEL_DOMAIN_NAME/htdocs
375
+        sed -i "s|DB_PASSWORD=.*|DB_PASSWORD=$MARIADB_PASSWORD|g" .env
376
+        MARIADB_PASSWORD=
377
+
378
+        systemctl start koel
365
     fi
379
     fi
366
 }
380
 }
367
 
381
 
370
         KOEL_DOMAIN_NAME=$(get_completion_param "koel domain")
384
         KOEL_DOMAIN_NAME=$(get_completion_param "koel domain")
371
         temp_backup_dir=/var/www/${KOEL_DOMAIN_NAME}/htdocs
385
         temp_backup_dir=/var/www/${KOEL_DOMAIN_NAME}/htdocs
372
         if [ -d $temp_backup_dir ]; then
386
         if [ -d $temp_backup_dir ]; then
373
-            systemctl stop koal
387
+            systemctl stop koel
374
 
388
 
375
             function_check suspend_site
389
             function_check suspend_site
376
             suspend_site ${KOEL_DOMAIN_NAME}
390
             suspend_site ${KOEL_DOMAIN_NAME}
386
             function_check restart_site
400
             function_check restart_site
387
             restart_site
401
             restart_site
388
 
402
 
389
-            systemctl start koal
403
+            systemctl start koel
390
         else
404
         else
391
             echo $"koel domain specified but not found in ${temp_backup_dir}"
405
             echo $"koel domain specified but not found in ${temp_backup_dir}"
392
         fi
406
         fi
397
     if grep -q "koel domain" $COMPLETION_FILE; then
411
     if grep -q "koel domain" $COMPLETION_FILE; then
398
         echo $"Restoring koel"
412
         echo $"Restoring koel"
399
 
413
 
400
-        systemctl stop koal
414
+        systemctl stop koel
401
 
415
 
402
         KOEL_DOMAIN_NAME=$(get_completion_param "koel domain")
416
         KOEL_DOMAIN_NAME=$(get_completion_param "koel domain")
403
 
417
 
410
             rm -rf /root/tempkoel
424
             rm -rf /root/tempkoel
411
         fi
425
         fi
412
 
426
 
413
-        systemctl start koal
427
+        MARIADB_PASSWORD=$(${PROJECT_NAME}-pass -u root -a mariadb)
428
+        cd /var/www/$KOEL_DOMAIN_NAME/htdocs
429
+        sed -i "s|DB_PASSWORD=.*|DB_PASSWORD=$MARIADB_PASSWORD|g" .env
430
+        MARIADB_PASSWORD=
431
+
432
+        systemctl start koel
414
 
433
 
415
         echo $"Restore of koel complete"
434
         echo $"Restore of koel complete"
416
     fi
435
     fi
426
     if [ -f /etc/systemd/system/koel.service ]; then
445
     if [ -f /etc/systemd/system/koel.service ]; then
427
         rm /etc/systemd/system/koel.service
446
         rm /etc/systemd/system/koel.service
428
     fi
447
     fi
448
+    systemctl daemon-reload
429
 
449
 
430
     function_check remove_nodejs
450
     function_check remove_nodejs
431
     remove_nodejs koel
451
     remove_nodejs koel
479
     function_check repair_databases_script
499
     function_check repair_databases_script
480
     repair_databases_script
500
     repair_databases_script
481
 
501
 
482
-    apt-get -yq install php-gettext php5-curl php5-gd php5-mysql git curl php-xml-parser
483
-    apt-get -yq install php5-memcached php5-intl exiftool
502
+    apt-get -yq install php-gettext php-curl php-gd php-mysql git curl php-zip
503
+    apt-get -yq install php-memcached php-intl exiftool libfcgi0ldbl
504
+    apt-get -yq install ffmpeg
484
 
505
 
485
     if [ ! -d /var/www/$KOEL_DOMAIN_NAME ]; then
506
     if [ ! -d /var/www/$KOEL_DOMAIN_NAME ]; then
486
         mkdir /var/www/$KOEL_DOMAIN_NAME
507
         mkdir /var/www/$KOEL_DOMAIN_NAME
487
     fi
508
     fi
488
     if [ ! -d /var/www/$KOEL_DOMAIN_NAME/htdocs ]; then
509
     if [ ! -d /var/www/$KOEL_DOMAIN_NAME/htdocs ]; then
489
-        function_check git_clone
490
-        git_clone $KOEL_REPO /var/www/$KOEL_DOMAIN_NAME/htdocs
510
+
511
+        if [ -d /repos/koel ]; then
512
+            mkdir /var/www/$KOEL_DOMAIN_NAME/htdocs
513
+            cp -r -p /repos/koel/. /var/www/$KOEL_DOMAIN_NAME/htdocs
514
+            cd /var/www/$KOEL_DOMAIN_NAME/htdocs
515
+            git pull
516
+        else
517
+            function_check git_clone
518
+            git_clone $KOEL_REPO /var/www/$KOEL_DOMAIN_NAME/htdocs
519
+        fi
520
+
491
         if [ ! -d /var/www/$KOEL_DOMAIN_NAME/htdocs ]; then
521
         if [ ! -d /var/www/$KOEL_DOMAIN_NAME/htdocs ]; then
492
             echo $'Unable to clone koel repo'
522
             echo $'Unable to clone koel repo'
493
             exit 365735
523
             exit 365735
554
         echo '  # PHP' >> $koel_nginx_site
584
         echo '  # PHP' >> $koel_nginx_site
555
         echo '  location ~ \.php {' >> $koel_nginx_site
585
         echo '  location ~ \.php {' >> $koel_nginx_site
556
         echo '    include snippets/fastcgi-php.conf;' >> $koel_nginx_site
586
         echo '    include snippets/fastcgi-php.conf;' >> $koel_nginx_site
557
-        echo '    fastcgi_pass unix:/var/run/php5-fpm.sock;' >> $koel_nginx_site
587
+        echo '    fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;' >> $koel_nginx_site
588
+        echo '    fastcgi_read_timeout 30;' >> $koel_nginx_site
558
         echo '  }' >> $koel_nginx_site
589
         echo '  }' >> $koel_nginx_site
559
         echo '' >> $koel_nginx_site
590
         echo '' >> $koel_nginx_site
560
         echo '  # Location' >> $koel_nginx_site
591
         echo '  # Location' >> $koel_nginx_site
612
     echo '  # PHP' >> $koel_nginx_site
643
     echo '  # PHP' >> $koel_nginx_site
613
     echo '  location ~ \.php {' >> $koel_nginx_site
644
     echo '  location ~ \.php {' >> $koel_nginx_site
614
     echo '    include snippets/fastcgi-php.conf;' >> $koel_nginx_site
645
     echo '    include snippets/fastcgi-php.conf;' >> $koel_nginx_site
615
-    echo '    fastcgi_pass unix:/var/run/php5-fpm.sock;' >> $koel_nginx_site
646
+    echo '    fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;' >> $koel_nginx_site
647
+    echo '    fastcgi_read_timeout 30;' >> $koel_nginx_site
616
     echo '  }' >> $koel_nginx_site
648
     echo '  }' >> $koel_nginx_site
617
     echo '' >> $koel_nginx_site
649
     echo '' >> $koel_nginx_site
618
     echo '  # Location' >> $koel_nginx_site
650
     echo '  # Location' >> $koel_nginx_site
661
         KOEL_SERVER=${KOEL_ONION_HOSTNAME}
693
         KOEL_SERVER=${KOEL_ONION_HOSTNAME}
662
     fi
694
     fi
663
 
695
 
664
-    systemctl restart php5-fpm
696
+    systemctl restart mariadb
697
+    systemctl restart php7.0-fpm
665
     systemctl restart nginx
698
     systemctl restart nginx
666
 
699
 
667
     ${PROJECT_NAME}-pass -u $MY_USERNAME -a koel -p "$KOEL_ADMIN_PASSWORD"
700
     ${PROJECT_NAME}-pass -u $MY_USERNAME -a koel -p "$KOEL_ADMIN_PASSWORD"
691
             cat /home/$MY_USERNAME/freedombone/image_build/composer_install | php
724
             cat /home/$MY_USERNAME/freedombone/image_build/composer_install | php
692
         fi
725
         fi
693
     fi
726
     fi
694
-    npm install
727
+    npm install -g yarn
695
     php composer.phar install
728
     php composer.phar install
729
+    if [ ! "$?" = "0" ]; then
730
+        echo $'Unable to run composer install'
731
+        exit 7252198
732
+    fi
733
+    npm install
696
 
734
 
697
     function_check get_mariadb_password
735
     function_check get_mariadb_password
698
     get_mariadb_password
736
     get_mariadb_password
708
     sed -i "s|DB_PASSWORD=.*|DB_PASSWORD=$MARIADB_PASSWORD|g" .env
746
     sed -i "s|DB_PASSWORD=.*|DB_PASSWORD=$MARIADB_PASSWORD|g" .env
709
     sed -i 's/MAIL_HOST=.*/MAIL_HOST=localhost/g' .env
747
     sed -i 's/MAIL_HOST=.*/MAIL_HOST=localhost/g' .env
710
     sed -i 's/MAIL_PORT=.*/MAIL_PORT=25/g' .env
748
     sed -i 's/MAIL_PORT=.*/MAIL_PORT=25/g' .env
749
+    sed -i 's|FFMPEG_PATH=.*|FFMPEG_PATH=/usr/bin/ffmpeg|g' .env
711
 
750
 
712
     php artisan koel:init
751
     php artisan koel:init
752
+    if [ ! "$?" = "0" ]; then
753
+        echo $"Can't install koel:init"
754
+        exit 78362
755
+    fi
713
     koel_remove_gravatar
756
     koel_remove_gravatar
714
     chown -R www-data:www-data /var/www/$KOEL_DOMAIN_NAME/htdocs
757
     chown -R www-data:www-data /var/www/$KOEL_DOMAIN_NAME/htdocs
715
 
758
 
738
     fi
781
     fi
739
     chown -R www-data:www-data /music
782
     chown -R www-data:www-data /music
740
 
783
 
784
+    systemctl restart mariadb
741
     systemctl restart nginx
785
     systemctl restart nginx
742
 
786
 
743
     APP_INSTALLED=1
787
     APP_INSTALLED=1

+ 26
- 14
src/freedombone-app-librevault View File

44
                       LIBREVAULT_REPO
44
                       LIBREVAULT_REPO
45
                       LIBREVAULT_PORT)
45
                       LIBREVAULT_PORT)
46
 
46
 
47
+function logging_on_librevault {
48
+    echo -n ''
49
+}
50
+
51
+function logging_off_librevault {
52
+    echo -n ''
53
+}
54
+
47
 function install_interactive_librevault {
55
 function install_interactive_librevault {
48
     echo -n ''
56
     echo -n ''
49
     APP_INSTALLED=1
57
     APP_INSTALLED=1
55
 }
63
 }
56
 
64
 
57
 function upgrade_librevault {
65
 function upgrade_librevault {
66
+    CURR_LIBREVAULT_COMMIT=$(get_completion_param "librevault commit")
67
+    if [[ "$CURR_LIBREVAULT_COMMIT" == "$LIBREVAULT_COMMIT" ]]; then
68
+        return
69
+    fi
70
+
58
     function_check set_repo_commit
71
     function_check set_repo_commit
59
 
72
 
60
     if [ -d $INSTALL_DIR/protobuf ]; then
73
     if [ -d $INSTALL_DIR/protobuf ]; then
71
     fi
84
     fi
72
 
85
 
73
     if [ -d $INSTALL_DIR/librevault/build ]; then
86
     if [ -d $INSTALL_DIR/librevault/build ]; then
74
-        if ! grep -q "Librevault commit:$LIBREVAULT_COMMIT" $COMPLETION_FILE; then
75
-            set_repo_commit $INSTALL_DIR/librevault "Librevault commit" "$LIBREVAULT_COMMIT" $LIBREVAULT_REPO
87
+        if ! grep -q "librevault commit:$LIBREVAULT_COMMIT" $COMPLETION_FILE; then
88
+            set_repo_commit $INSTALL_DIR/librevault "librevault commit" "$LIBREVAULT_COMMIT" $LIBREVAULT_REPO
76
             cd $INSTALL_DIR/librevault
89
             cd $INSTALL_DIR/librevault
77
             git submodule update --init --recursive
90
             git submodule update --init --recursive
78
             cd $INSTALL_DIR/librevault/build
91
             cd $INSTALL_DIR/librevault/build
108
     systemctl stop librevault
121
     systemctl stop librevault
109
     systemctl disable librevault
122
     systemctl disable librevault
110
     rm /etc/systemd/system/librevault.service
123
     rm /etc/systemd/system/librevault.service
124
+    systemctl daemon-reload
111
     remove_completion_param install_librevault
125
     remove_completion_param install_librevault
112
     remove_completion_param configure_firewall_for_librevault
126
     remove_completion_param configure_firewall_for_librevault
113
 }
127
 }
130
     chroot "$rootdir" apt-get -yq install autoconf automake libtool curl make unzip
144
     chroot "$rootdir" apt-get -yq install autoconf automake libtool curl make unzip
131
 
145
 
132
     # A workaround which allows c++14 to be installed
146
     # A workaround which allows c++14 to be installed
133
-    sed -i 's|jessie|stretch|g' $rootdir/etc/apt/sources.list
134
-    sed -i 's|stretch-backports|jessie-backports|g' $rootdir/etc/apt/sources.list
135
-    chroot "$rootdir" apt-get update
136
     chroot "$rootdir" apt-get -yq install g++ gcc-6 g++-6 libboost-all-dev libssl-dev
147
     chroot "$rootdir" apt-get -yq install g++ gcc-6 g++-6 libboost-all-dev libssl-dev
137
     chroot "$rootdir" apt-get -yq install protobuf-compiler libprotobuf-dev
148
     chroot "$rootdir" apt-get -yq install protobuf-compiler libprotobuf-dev
138
     chroot "$rootdir" apt-get -yq install qtbase5-dev libqt5svg5-dev libqt5websockets5-dev
149
     chroot "$rootdir" apt-get -yq install qtbase5-dev libqt5svg5-dev libqt5websockets5-dev
139
     chroot "$rootdir" apt-get -yq install libsqlite3-dev qttools5-dev qttools5-dev-tools libnatpmp-dev
150
     chroot "$rootdir" apt-get -yq install libsqlite3-dev qttools5-dev qttools5-dev-tools libnatpmp-dev
140
-    sed -i 's|stretch|jessie|g' $rootdir/etc/apt/sources.list
141
-    chroot "$rootdir" apt-get update
142
 
151
 
143
     if [ ! -d $rootdir$INSTALL_DIR ]; then
152
     if [ ! -d $rootdir$INSTALL_DIR ]; then
144
         mkdir -p $rootdir$INSTALL_DIR
153
         mkdir -p $rootdir$INSTALL_DIR
228
     apt-get -yq install autoconf automake libtool curl make unzip
237
     apt-get -yq install autoconf automake libtool curl make unzip
229
 
238
 
230
     # A workaround which allows c++14 to be installed
239
     # A workaround which allows c++14 to be installed
231
-    sed -i 's|jessie|stretch|g' /etc/apt/sources.list
232
-    sed -i 's|stretch-backports|jessie-backports|g' /etc/apt/sources.list
233
-    apt-get update
234
     apt-get -yq install protobuf-compiler libprotobuf-dev
240
     apt-get -yq install protobuf-compiler libprotobuf-dev
235
     apt-get -yq install g++ gcc-6 g++-6 libboost-all-dev libssl-dev
241
     apt-get -yq install g++ gcc-6 g++-6 libboost-all-dev libssl-dev
236
     apt-get -yq install qtbase5-dev libqt5svg5-dev libqt5websockets5-dev
242
     apt-get -yq install qtbase5-dev libqt5svg5-dev libqt5websockets5-dev
237
     apt-get -yq install libsqlite3-dev qttools5-dev qttools5-dev-tools libnatpmp-dev
243
     apt-get -yq install libsqlite3-dev qttools5-dev qttools5-dev-tools libnatpmp-dev
238
     apt-get -yq install gcc-6 g++-6 libboost-all-dev
244
     apt-get -yq install gcc-6 g++-6 libboost-all-dev
239
-    sed -i 's|stretch|jessie|g' /etc/apt/sources.list
240
-    apt-get update
241
 
245
 
242
     if [ ! -d $INSTALL_DIR ]; then
246
     if [ ! -d $INSTALL_DIR ]; then
243
         mkdir -p $INSTALL_DIR
247
         mkdir -p $INSTALL_DIR
254
 
258
 
255
     set_completion_param "Protobuf commit" "$PROTOBUF_COMMIT"
259
     set_completion_param "Protobuf commit" "$PROTOBUF_COMMIT"
256
 
260
 
257
-    git_clone $LIBREVAULT_REPO $INSTALL_DIR/librevault
261
+    if [ -d /repos/librevault ]; then
262
+        mkdir $INSTALL_DIR/librevault
263
+        cp -r -p /repos/librevault/. $INSTALL_DIR/librevault
264
+        cd $INSTALL_DIR/librevault
265
+        git pull
266
+    else
267
+        git_clone $LIBREVAULT_REPO $INSTALL_DIR/librevault
268
+    fi
269
+
258
     cd $INSTALL_DIR/librevault
270
     cd $INSTALL_DIR/librevault
259
     git checkout $LIBREVAULT_COMMIT -b $LIBREVAULT_COMMIT
271
     git checkout $LIBREVAULT_COMMIT -b $LIBREVAULT_COMMIT
260
     git submodule update --init --recursive
272
     git submodule update --init --recursive
271
     cmake --build .
283
     cmake --build .
272
     make install
284
     make install
273
 
285
 
274
-    set_completion_param "Librevault commit" "$LIBREVAULT_COMMIT"
286
+    set_completion_param "librevault commit" "$LIBREVAULT_COMMIT"
275
 
287
 
276
     LIBREVAULT_DAEMON=/etc/systemd/system/librevault-daemon.service
288
     LIBREVAULT_DAEMON=/etc/systemd/system/librevault-daemon.service
277
     echo '[Unit]' > $LIBREVAULT_DAEMON
289
     echo '[Unit]' > $LIBREVAULT_DAEMON

+ 34
- 10
src/freedombone-app-lychee View File

13
 # License
13
 # License
14
 # =======
14
 # =======
15
 #
15
 #
16
-# Copyright (C) 2014-2016 Bob Mottram <bob@freedombone.net>
16
+# Copyright (C) 2014-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
46
                   DDNS_PROVIDER
46
                   DDNS_PROVIDER
47
                   MY_USERNAME)
47
                   MY_USERNAME)
48
 
48
 
49
+function logging_on_lychee {
50
+    echo -n ''
51
+}
52
+
53
+function logging_off_lychee {
54
+    echo -n ''
55
+}
49
 
56
 
50
 function lychee_create_database {
57
 function lychee_create_database {
51
     if [ -f ${IMAGE_PASSWORD_FILE} ]; then
58
     if [ -f ${IMAGE_PASSWORD_FILE} ]; then
123
 }
130
 }
124
 
131
 
125
 function upgrade_lychee {
132
 function upgrade_lychee {
133
+    CURR_LYCHEE_COMMIT=$(get_completion_param "lychee commit")
134
+    if [[ "$CURR_LYCHEE_COMMIT" == "$LYCHEE_COMMIT" ]]; then
135
+        return
136
+    fi
137
+
126
     read_config_param "LYCHEE_DOMAIN_NAME"
138
     read_config_param "LYCHEE_DOMAIN_NAME"
127
 
139
 
128
     function_check set_repo_commit
140
     function_check set_repo_commit
262
     echo '        try_files $uri $uri/ /index.html;' >> /etc/nginx/sites-available/$LYCHEE_DOMAIN_NAME
274
     echo '        try_files $uri $uri/ /index.html;' >> /etc/nginx/sites-available/$LYCHEE_DOMAIN_NAME
263
     echo '        # NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini' >> /etc/nginx/sites-available/$LYCHEE_DOMAIN_NAME
275
     echo '        # NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini' >> /etc/nginx/sites-available/$LYCHEE_DOMAIN_NAME
264
     echo '        fastcgi_split_path_info ^(.+\.php)(/.+)$;' >> /etc/nginx/sites-available/$LYCHEE_DOMAIN_NAME
276
     echo '        fastcgi_split_path_info ^(.+\.php)(/.+)$;' >> /etc/nginx/sites-available/$LYCHEE_DOMAIN_NAME
265
-    echo '        # With php5-cgi alone:' >> /etc/nginx/sites-available/$LYCHEE_DOMAIN_NAME
277
+    echo '        # With php-cgi alone:' >> /etc/nginx/sites-available/$LYCHEE_DOMAIN_NAME
266
     echo '        # fastcgi_pass 127.0.0.1:9000;' >> /etc/nginx/sites-available/$LYCHEE_DOMAIN_NAME
278
     echo '        # fastcgi_pass 127.0.0.1:9000;' >> /etc/nginx/sites-available/$LYCHEE_DOMAIN_NAME
267
-    echo '        # With php5-fpm:' >> /etc/nginx/sites-available/$LYCHEE_DOMAIN_NAME
268
-    echo '        fastcgi_pass unix:/var/run/php5-fpm.sock;' >> /etc/nginx/sites-available/$LYCHEE_DOMAIN_NAME
279
+    echo '        # With php-fpm:' >> /etc/nginx/sites-available/$LYCHEE_DOMAIN_NAME
280
+    echo '        fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;' >> /etc/nginx/sites-available/$LYCHEE_DOMAIN_NAME
269
     echo '        include fastcgi_params;' >> /etc/nginx/sites-available/$LYCHEE_DOMAIN_NAME
281
     echo '        include fastcgi_params;' >> /etc/nginx/sites-available/$LYCHEE_DOMAIN_NAME
282
+    echo '        fastcgi_read_timeout 30;' >> /etc/nginx/sites-available/$LYCHEE_DOMAIN_NAME
270
     echo '        fastcgi_index index.html;' >> /etc/nginx/sites-available/$LYCHEE_DOMAIN_NAME
283
     echo '        fastcgi_index index.html;' >> /etc/nginx/sites-available/$LYCHEE_DOMAIN_NAME
271
     echo '        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;' >> /etc/nginx/sites-available/$LYCHEE_DOMAIN_NAME
284
     echo '        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;' >> /etc/nginx/sites-available/$LYCHEE_DOMAIN_NAME
272
     echo '    }' >> /etc/nginx/sites-available/$LYCHEE_DOMAIN_NAME
285
     echo '    }' >> /etc/nginx/sites-available/$LYCHEE_DOMAIN_NAME
331
     echo '        try_files $uri $uri/ /index.html;' >> /etc/nginx/sites-available/$LYCHEE_DOMAIN_NAME
344
     echo '        try_files $uri $uri/ /index.html;' >> /etc/nginx/sites-available/$LYCHEE_DOMAIN_NAME
332
     echo '        # NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini' >> /etc/nginx/sites-available/$LYCHEE_DOMAIN_NAME
345
     echo '        # NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini' >> /etc/nginx/sites-available/$LYCHEE_DOMAIN_NAME
333
     echo '        fastcgi_split_path_info ^(.+\.php)(/.+)$;' >> /etc/nginx/sites-available/$LYCHEE_DOMAIN_NAME
346
     echo '        fastcgi_split_path_info ^(.+\.php)(/.+)$;' >> /etc/nginx/sites-available/$LYCHEE_DOMAIN_NAME
334
-    echo '        # With php5-cgi alone:' >> /etc/nginx/sites-available/$LYCHEE_DOMAIN_NAME
347
+    echo '        # With php-cgi alone:' >> /etc/nginx/sites-available/$LYCHEE_DOMAIN_NAME
335
     echo '        # fastcgi_pass 127.0.0.1:9000;' >> /etc/nginx/sites-available/$LYCHEE_DOMAIN_NAME
348
     echo '        # fastcgi_pass 127.0.0.1:9000;' >> /etc/nginx/sites-available/$LYCHEE_DOMAIN_NAME
336
-    echo '        # With php5-fpm:' >> /etc/nginx/sites-available/$LYCHEE_DOMAIN_NAME
337
-    echo '        fastcgi_pass unix:/var/run/php5-fpm.sock;' >> /etc/nginx/sites-available/$LYCHEE_DOMAIN_NAME
349
+    echo '        # With php-fpm:' >> /etc/nginx/sites-available/$LYCHEE_DOMAIN_NAME
350
+    echo '        fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;' >> /etc/nginx/sites-available/$LYCHEE_DOMAIN_NAME
338
     echo '        include fastcgi_params;' >> /etc/nginx/sites-available/$LYCHEE_DOMAIN_NAME
351
     echo '        include fastcgi_params;' >> /etc/nginx/sites-available/$LYCHEE_DOMAIN_NAME
352
+    echo '        fastcgi_read_timeout 30;' >> /etc/nginx/sites-available/$LYCHEE_DOMAIN_NAME
339
     echo '        fastcgi_index index.html;' >> /etc/nginx/sites-available/$LYCHEE_DOMAIN_NAME
353
     echo '        fastcgi_index index.html;' >> /etc/nginx/sites-available/$LYCHEE_DOMAIN_NAME
340
     echo '        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;' >> /etc/nginx/sites-available/$LYCHEE_DOMAIN_NAME
354
     echo '        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;' >> /etc/nginx/sites-available/$LYCHEE_DOMAIN_NAME
341
     echo '    }' >> /etc/nginx/sites-available/$LYCHEE_DOMAIN_NAME
355
     echo '    }' >> /etc/nginx/sites-available/$LYCHEE_DOMAIN_NAME
364
     fi
378
     fi
365
 
379
 
366
     cd /var/www/$LYCHEE_DOMAIN_NAME
380
     cd /var/www/$LYCHEE_DOMAIN_NAME
367
-    git_clone $LYCHEE_REPO htdocs
381
+
382
+    if [ -d /repos/lychee ]; then
383
+        mkdir htdocs
384
+        cp -r -p /repos/lychee/. htdocs
385
+        cd htdocs
386
+        git pull
387
+    else
388
+        git_clone $LYCHEE_REPO htdocs
389
+    fi
390
+
368
     cd htdocs
391
     cd htdocs
369
     git checkout $LYCHEE_COMMIT -b $LYCHEE_COMMIT
392
     git checkout $LYCHEE_COMMIT -b $LYCHEE_COMMIT
370
     set_completion_param "lychee commit" "$LYCHEE_COMMIT"
393
     set_completion_param "lychee commit" "$LYCHEE_COMMIT"
381
     fi
404
     fi
382
 
405
 
383
     # for the avatar changing command
406
     # for the avatar changing command
384
-    apt-get -yq install imagemagick exif zip php5-mcrypt mcrypt
407
+    apt-get -yq install imagemagick exif zip php-mcrypt mcrypt libfcgi0ldbl
385
 
408
 
386
     function_check install_lychee_from_repo
409
     function_check install_lychee_from_repo
387
     install_lychee_from_repo
410
     install_lychee_from_repo
426
     function_check lychee_create_database
449
     function_check lychee_create_database
427
     lychee_create_database
450
     lychee_create_database
428
 
451
 
429
-    systemctl restart php5-fpm
452
+    systemctl restart mariadb
453
+    systemctl restart php7.0-fpm
430
     systemctl restart nginx
454
     systemctl restart nginx
431
 
455
 
432
     ${PROJECT_NAME}-pass -u $MY_USERNAME -a lychee -p "$LYCHEE_ADMIN_PASSWORD"
456
     ${PROJECT_NAME}-pass -u $MY_USERNAME -a lychee -p "$LYCHEE_ADMIN_PASSWORD"

+ 30
- 10
src/freedombone-app-mailpile View File

47
                     DDNS_PROVIDER
47
                     DDNS_PROVIDER
48
                     MY_USERNAME)
48
                     MY_USERNAME)
49
 
49
 
50
+function logging_on_mailpile {
51
+    echo -n ''
52
+}
53
+
54
+function logging_off_mailpile {
55
+    echo -n ''
56
+}
57
+
50
 function remove_user_mailpile {
58
 function remove_user_mailpile {
51
     remove_username="$1"
59
     remove_username="$1"
52
     ${PROJECT_NAME}-pass -u $remove_username --rmapp mailpile
60
     ${PROJECT_NAME}-pass -u $remove_username --rmapp mailpile
83
 function upgrade_mailpile {
91
 function upgrade_mailpile {
84
     read_config_param "MAILPILE_DOMAIN_NAME"
92
     read_config_param "MAILPILE_DOMAIN_NAME"
85
 
93
 
86
-    upgrade_mp=
87
     CURR_COMMIT=$MAILPILE_COMMIT
94
     CURR_COMMIT=$MAILPILE_COMMIT
88
     if grep -q "mailpile commit" $COMPLETION_FILE; then
95
     if grep -q "mailpile commit" $COMPLETION_FILE; then
89
         CURR_COMMIT=$(get_completion_param "mailpile commit")
96
         CURR_COMMIT=$(get_completion_param "mailpile commit")
90
     fi
97
     fi
91
-    if [[ "$CURR_COMMIT" != "$MAILPILE_COMMIT" ]]; then
92
-        upgrade_mp=1
98
+    if [[ "$CURR_COMMIT" == "$MAILPILE_COMMIT" ]]; then
99
+        return
93
     fi
100
     fi
94
 
101
 
95
     function_check set_repo_commit
102
     function_check set_repo_commit
96
     set_repo_commit /var/www/$MAILPILE_DOMAIN_NAME/mail "mailpile commit" "$MAILPILE_COMMIT" $MAILPILE_REPO
103
     set_repo_commit /var/www/$MAILPILE_DOMAIN_NAME/mail "mailpile commit" "$MAILPILE_COMMIT" $MAILPILE_REPO
97
 
104
 
98
-    if [ $upgrade_mp ]; then
99
-        cd /var/www/$MAILPILE_DOMAIN_NAME/mail
100
-        pip install -r requirements.txt
105
+    cd /var/www/$MAILPILE_DOMAIN_NAME/mail
106
+    pip install -r requirements.txt
101
 
107
 
102
-        chown -R mailpile:mailpile /var/www/$MAILPILE_DOMAIN_NAME/mail
103
-    fi
108
+    chown -R mailpile:mailpile /var/www/$MAILPILE_DOMAIN_NAME/mail
104
 }
109
 }
105
 
110
 
106
 function backup_local_mailpile {
111
 function backup_local_mailpile {
226
     systemctl stop mailpile
231
     systemctl stop mailpile
227
     systemctl disable mailpile
232
     systemctl disable mailpile
228
     rm /etc/systemd/system/mailpile.service
233
     rm /etc/systemd/system/mailpile.service
234
+    systemctl daemon-reload
229
 
235
 
230
     read_config_param "MAILPILE_DOMAIN_NAME"
236
     read_config_param "MAILPILE_DOMAIN_NAME"
231
     nginx_dissite $MAILPILE_DOMAIN_NAME
237
     nginx_dissite $MAILPILE_DOMAIN_NAME
238
     fi
244
     fi
239
     function_check remove_ddns_domain
245
     function_check remove_ddns_domain
240
     remove_ddns_domain $MAILPILE_DOMAIN_NAME
246
     remove_ddns_domain $MAILPILE_DOMAIN_NAME
241
-    deluser --remove-all-files mailpile
247
+
248
+    groupdel -f mailpile
249
+    userdel -r mailpile
242
 
250
 
243
     remove_config_param MAILPILE_DOMAIN_NAME
251
     remove_config_param MAILPILE_DOMAIN_NAME
244
     remove_config_param MAILPILE_CODE
252
     remove_config_param MAILPILE_CODE
272
     if [ -d /var/www/$MAILPILE_DOMAIN_NAME/mail ]; then
280
     if [ -d /var/www/$MAILPILE_DOMAIN_NAME/mail ]; then
273
         rm -rf /var/www/$MAILPILE_DOMAIN_NAME/mail
281
         rm -rf /var/www/$MAILPILE_DOMAIN_NAME/mail
274
     fi
282
     fi
275
-    git_clone $MAILPILE_REPO mail
283
+
284
+    if [ -d /repos/mailpile ]; then
285
+        mkdir mail
286
+        cp -r -p /repos/mailpile/. mail
287
+        cd mail
288
+        git pull
289
+    else
290
+        git_clone $MAILPILE_REPO mail
291
+    fi
292
+
276
     cd mail
293
     cd mail
277
     git checkout $MAILPILE_COMMIT -b $MAILPILE_COMMIT
294
     git checkout $MAILPILE_COMMIT -b $MAILPILE_COMMIT
278
     set_completion_param "mailpile commit" "$MAILPILE_COMMIT"
295
     set_completion_param "mailpile commit" "$MAILPILE_COMMIT"
420
     chown -R mailpile:mailpile /var/www/$MAILPILE_DOMAIN_NAME/mail/.gnupg
437
     chown -R mailpile:mailpile /var/www/$MAILPILE_DOMAIN_NAME/mail/.gnupg
421
     chmod +x /var/www/$MAILPILE_DOMAIN_NAME/mail/.gnupg
438
     chmod +x /var/www/$MAILPILE_DOMAIN_NAME/mail/.gnupg
422
 
439
 
440
+    pip install jinja2==2.9.6
441
+    pip install pgpdump==1.5
442
+
423
     systemctl enable mailpile
443
     systemctl enable mailpile
424
     systemctl daemon-reload
444
     systemctl daemon-reload
425
     systemctl start mailpile
445
     systemctl start mailpile

+ 61
- 8
src/freedombone-app-matrix View File

62
                   MATRIX_DOMAIN_NAME
62
                   MATRIX_DOMAIN_NAME
63
                   MATRIX_CODE)
63
                   MATRIX_CODE)
64
 
64
 
65
+function logging_on_matrix {
66
+    if [ -f /var/lib/matrix/homeserver.yaml ]; then
67
+        sed -i 's|log_file:.*|log_file: /etc/matrix/homeserver.log|g' /var/lib/matrix/homeserver.yaml
68
+        if ! grep -q "#log_config:" /var/lib/matrix/homeserver.yaml; then
69
+            sed -i 's|log_config:|#log_config:|g' /var/lib/matrix/homeserver.yaml
70
+        fi
71
+    fi
72
+}
73
+
74
+function logging_off_matrix {
75
+    if [ -f /var/lib/matrix/homeserver.yaml ]; then
76
+        sed -i 's|log_file:.*|log_file: /dev/null|g' /var/lib/matrix/homeserver.yaml
77
+        if ! grep -q "#log_config:" /var/lib/matrix/homeserver.yaml; then
78
+            sed -i 's|log_config:|#log_config:|g' /var/lib/matrix/homeserver.yaml
79
+        fi
80
+        if [ -f /etc/matrix/homeserver.log ]; then
81
+            $REMOVE_FILES_COMMAND /etc/matrix/homeserver.log
82
+        fi
83
+        if [ -f /etc/matrix/homeserver.log.1 ]; then
84
+            $REMOVE_FILES_COMMAND /etc/matrix/homeserver.log.1
85
+        fi
86
+    fi
87
+}
88
+
65
 function matrix_nginx {
89
 function matrix_nginx {
66
     matrix_nginx_site=/etc/nginx/sites-available/$MATRIX_DOMAIN_NAME
90
     matrix_nginx_site=/etc/nginx/sites-available/$MATRIX_DOMAIN_NAME
67
     if [[ $ONION_ONLY == "no" ]]; then
91
     if [[ $ONION_ONLY == "no" ]]; then
329
     if [ ! -d /etc/matrix ]; then
353
     if [ ! -d /etc/matrix ]; then
330
        return
354
        return
331
     fi
355
     fi
356
+
357
+    CURR_MATRIX_COMMIT=$(get_completion_param "matrix commit")
358
+    if [[ "$CURR_MATRIX_COMMIT" == "$MATRIX_COMMIT" ]]; then
359
+        return
360
+    fi
361
+
332
     systemctl stop turn
362
     systemctl stop turn
333
     systemctl stop matrix
363
     systemctl stop matrix
334
 
364
 
478
     if [ -f /etc/systemd/system/matrix.service ]; then
508
     if [ -f /etc/systemd/system/matrix.service ]; then
479
         rm /etc/systemd/system/matrix.service
509
         rm /etc/systemd/system/matrix.service
480
     fi
510
     fi
511
+    systemctl daemon-reload
481
     apt-get -y remove --purge coturn
512
     apt-get -y remove --purge coturn
482
     cd /etc/matrix
513
     cd /etc/matrix
483
     pip uninstall .
514
     pip uninstall .
484
     rm -rf $MATRIX_DATA_DIR
515
     rm -rf $MATRIX_DATA_DIR
485
     rm -rf /etc/matrix
516
     rm -rf /etc/matrix
486
-    deluser matrix
487
-    delgroup matrix
517
+
518
+    groupdel -f matrix
519
+    userdel -r matrix
520
+
488
     remove_onion_service matrix ${MATRIX_ONION_PORT}
521
     remove_onion_service matrix ${MATRIX_ONION_PORT}
489
     remove_onion_service matrix ${MATRIX_FEDERATION_ONION_PORT}
522
     remove_onion_service matrix ${MATRIX_FEDERATION_ONION_PORT}
490
 
523
 
497
 
530
 
498
 function install_home_server {
531
 function install_home_server {
499
     if [ ! -d /etc/matrix ]; then
532
     if [ ! -d /etc/matrix ]; then
500
-        function_check git_clone
501
-        git_clone $MATRIX_REPO /etc/matrix
533
+
534
+        if [ -d /repos/matrix ]; then
535
+            mkdir /etc/matrix
536
+            cp -r -p /repos/matrix/. /etc/matrix
537
+            cd /etc/matrix
538
+            git pull
539
+        else
540
+            function_check git_clone
541
+            git_clone $MATRIX_REPO /etc/matrix
542
+        fi
543
+
502
         if [ ! -d /etc/matrix ]; then
544
         if [ ! -d /etc/matrix ]; then
503
             echo $'Unable to clone matrix repo'
545
             echo $'Unable to clone matrix repo'
504
             exit 6724683
546
             exit 6724683
575
     sleep 5
617
     sleep 5
576
 
618
 
577
     if [ ! -f $MATRIX_DATA_DIR/homeserver.db ]; then
619
     if [ ! -f $MATRIX_DATA_DIR/homeserver.db ]; then
578
-        echo $'No matrix home server database was created'
579
-        exit 23782
620
+        # On low power systems more sleeping may be needed
621
+        sleep 10
622
+
623
+        if [ ! -f $MATRIX_DATA_DIR/homeserver.db ]; then
624
+            echo $'No matrix home server database was created'
625
+            exit 23782
626
+        fi
580
     fi
627
     fi
581
     chmod -R 700 $MATRIX_DATA_DIR/homeserver.db
628
     chmod -R 700 $MATRIX_DATA_DIR/homeserver.db
582
 
629
 
583
     MATRIX_ONION_HOSTNAME=$(add_onion_service matrix ${MATRIX_PORT} ${MATRIX_ONION_PORT})
630
     MATRIX_ONION_HOSTNAME=$(add_onion_service matrix ${MATRIX_PORT} ${MATRIX_ONION_PORT})
584
     echo "HiddenServicePort ${MATRIX_HTTP_PORT} 127.0.0.1:${MATRIX_FEDERATION_ONION_PORT}" >> /etc/tor/torrc
631
     echo "HiddenServicePort ${MATRIX_HTTP_PORT} 127.0.0.1:${MATRIX_FEDERATION_ONION_PORT}" >> /etc/tor/torrc
585
-    systemctl reload tor
632
+    systemctl restart tor
586
 
633
 
587
     if [ ! ${MATRIX_PASSWORD} ]; then
634
     if [ ! ${MATRIX_PASSWORD} ]; then
588
         if [ -f ${IMAGE_PASSWORD_FILE} ]; then
635
         if [ -f ${IMAGE_PASSWORD_FILE} ]; then
603
 }
650
 }
604
 
651
 
605
 function install_matrix {
652
 function install_matrix {
653
+    if [[ $ONION_ONLY != 'no' ]]; then
654
+        return
655
+    fi
656
+
657
+    check_ram_availability 1500
658
+
606
     if [ ! -d $INSTALL_DIR ]; then
659
     if [ ! -d $INSTALL_DIR ]; then
607
         mkdir -p $INSTALL_DIR
660
         mkdir -p $INSTALL_DIR
608
     fi
661
     fi
637
             libjpeg62-turbo-dev libldap-2.4-2 \
690
             libjpeg62-turbo-dev libldap-2.4-2 \
638
             libldap2-dev libsasl2-dev \
691
             libldap2-dev libsasl2-dev \
639
             libsqlite3-dev libssl-dev \
692
             libsqlite3-dev libssl-dev \
640
-            libssl1.0.0 libtool libxml2 \
693
+            libssl1.1 libtool libxml2 \
641
             libxml2-dev libxslt1-dev libxslt1.1 \
694
             libxml2-dev libxslt1-dev libxslt1.1 \
642
             make python python-dev \
695
             make python python-dev \
643
             python-pip python-psycopg2 \
696
             python-pip python-psycopg2 \

+ 29
- 7
src/freedombone-app-mediagoblin View File

13
 # License
13
 # License
14
 # =======
14
 # =======
15
 #
15
 #
16
-# Copyright (C) 2016 Bob Mottram <bob@freedombone.net>
16
+# Copyright (C) 2016-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
49
                        DEFAULT_DOMAIN_NAME
49
                        DEFAULT_DOMAIN_NAME
50
                        DDNS_PROVIDER)
50
                        DDNS_PROVIDER)
51
 
51
 
52
+function logging_on_mediagoblin {
53
+    echo -n ''
54
+}
55
+
56
+function logging_off_mediagoblin {
57
+    echo -n ''
58
+}
59
+
52
 function mediagoblin_fix_email {
60
 function mediagoblin_fix_email {
53
     # This is a crude hack and there may be a better solution
61
     # This is a crude hack and there may be a better solution
54
     # The cause of verification problems might be that the mediagoblin user
62
     # The cause of verification problems might be that the mediagoblin user
60
         echo $'Unable to fix email sending'
68
         echo $'Unable to fix email sending'
61
         exit 792532
69
         exit 792532
62
     fi
70
     fi
63
-    if ! grep 'import os' $mgfile; then
71
+    if ! grep -q 'import os' $mgfile; then
64
         sed -i '/import sys/a import os' $mgfile
72
         sed -i '/import sys/a import os' $mgfile
65
     fi
73
     fi
66
     sed -i "s|return mhost.sendmail(from_addr, to_addrs, message.as_string())|return os.system(\"echo '\" + message_body + \"' \| mail -s '\" + message['Subject'] + \"' \" + message['To'])|g" $mgfile
74
     sed -i "s|return mhost.sendmail(from_addr, to_addrs, message.as_string())|return os.system(\"echo '\" + message_body + \"' \| mail -s '\" + message['Subject'] + \"' \" + message['To'])|g" $mgfile
235
     systemctl stop mediagoblin
243
     systemctl stop mediagoblin
236
     systemctl disable mediagoblin
244
     systemctl disable mediagoblin
237
     rm /etc/systemd/system/mediagoblin.service
245
     rm /etc/systemd/system/mediagoblin.service
246
+    systemctl daemon-reload
238
 
247
 
239
     function_check remove_onion_service
248
     function_check remove_onion_service
240
     remove_onion_service mediagoblin ${MEDIAGOBLIN_ONION_PORT}
249
     remove_onion_service mediagoblin ${MEDIAGOBLIN_ONION_PORT}
251
     sed -i '/mediagoblin/d' $COMPLETION_FILE
260
     sed -i '/mediagoblin/d' $COMPLETION_FILE
252
 
261
 
253
     remove_nodejs mediagoblin
262
     remove_nodejs mediagoblin
254
-    deluser mediagoblin
255
-    delgroup mediagoblin
263
+
264
+    groupdel -f mediagoblin
265
+    userdel -r mediagoblin
256
 
266
 
257
     function_check remove_ddns_domain
267
     function_check remove_ddns_domain
258
     remove_ddns_domain $MEDIAGOBLIN_DOMAIN_NAME
268
     remove_ddns_domain $MEDIAGOBLIN_DOMAIN_NAME
279
     chown -hR mediagoblin:www-data $MEDIAGOBLIN_BASE_DIR
289
     chown -hR mediagoblin:www-data $MEDIAGOBLIN_BASE_DIR
280
     chown -hR mediagoblin:www-data /var/lib/mediagoblin
290
     chown -hR mediagoblin:www-data /var/lib/mediagoblin
281
     chmod -R g+wx /var/lib/mediagoblin
291
     chmod -R g+wx /var/lib/mediagoblin
282
-    su -c "cd $MEDIAGOBLIN_BASE_DIR && git clone $MEDIAGOBLIN_REPO $MEDIAGOBLIN_BASE_DIR/mediagoblin" - mediagoblin
292
+
293
+    if [ -d /repos/mediagoblin ]; then
294
+        mkdir -p $MEDIAGOBLIN_BASE_DIR/mediagoblin
295
+        cp -r -p /repos/mediagoblin/. $MEDIAGOBLIN_BASE_DIR/mediagoblin
296
+        cd $MEDIAGOBLIN_BASE_DIR/mediagoblin
297
+        git pull
298
+        chown -R mediagoblin:mediagoblin $MEDIAGOBLIN_BASE_DIR/mediagoblin
299
+    else
300
+        su -c "cd $MEDIAGOBLIN_BASE_DIR && git clone $MEDIAGOBLIN_REPO $MEDIAGOBLIN_BASE_DIR/mediagoblin" - mediagoblin
301
+    fi
302
+
283
     su -c "cd $MEDIAGOBLIN_BASE_DIR/mediagoblin && git checkout $MEDIAGOBLIN_COMMIT -b $MEDIAGOBLIN_COMMIT" - mediagoblin
303
     su -c "cd $MEDIAGOBLIN_BASE_DIR/mediagoblin && git checkout $MEDIAGOBLIN_COMMIT -b $MEDIAGOBLIN_COMMIT" - mediagoblin
284
     su -c "cd $MEDIAGOBLIN_BASE_DIR/mediagoblin && git submodule sync" - mediagoblin
304
     su -c "cd $MEDIAGOBLIN_BASE_DIR/mediagoblin && git submodule sync" - mediagoblin
285
     su -c "cd $MEDIAGOBLIN_BASE_DIR/mediagoblin && git submodule update --force --init --recursive" - mediagoblin
305
     su -c "cd $MEDIAGOBLIN_BASE_DIR/mediagoblin && git submodule update --force --init --recursive" - mediagoblin
382
         echo '        include /etc/nginx/fastcgi_params;' >> /etc/nginx/sites-available/$MEDIAGOBLIN_DOMAIN_NAME
402
         echo '        include /etc/nginx/fastcgi_params;' >> /etc/nginx/sites-available/$MEDIAGOBLIN_DOMAIN_NAME
383
         echo '        fastcgi_param PATH_INFO $fastcgi_script_name;' >> /etc/nginx/sites-available/$MEDIAGOBLIN_DOMAIN_NAME
403
         echo '        fastcgi_param PATH_INFO $fastcgi_script_name;' >> /etc/nginx/sites-available/$MEDIAGOBLIN_DOMAIN_NAME
384
         echo '        fastcgi_param SCRIPT_NAME "";' >> /etc/nginx/sites-available/$MEDIAGOBLIN_DOMAIN_NAME
404
         echo '        fastcgi_param SCRIPT_NAME "";' >> /etc/nginx/sites-available/$MEDIAGOBLIN_DOMAIN_NAME
405
+        echo '        fastcgi_read_timeout 30;' >> /etc/nginx/sites-available/$MEDIAGOBLIN_DOMAIN_NAME
385
         echo '    }' >> /etc/nginx/sites-available/$MEDIAGOBLIN_DOMAIN_NAME
406
         echo '    }' >> /etc/nginx/sites-available/$MEDIAGOBLIN_DOMAIN_NAME
386
         echo '}' >> /etc/nginx/sites-available/$MEDIAGOBLIN_DOMAIN_NAME
407
         echo '}' >> /etc/nginx/sites-available/$MEDIAGOBLIN_DOMAIN_NAME
387
     else
408
     else
438
     echo '        include /etc/nginx/fastcgi_params;' >> /etc/nginx/sites-available/$MEDIAGOBLIN_DOMAIN_NAME
459
     echo '        include /etc/nginx/fastcgi_params;' >> /etc/nginx/sites-available/$MEDIAGOBLIN_DOMAIN_NAME
439
     echo '        fastcgi_param PATH_INFO $fastcgi_script_name;' >> /etc/nginx/sites-available/$MEDIAGOBLIN_DOMAIN_NAME
460
     echo '        fastcgi_param PATH_INFO $fastcgi_script_name;' >> /etc/nginx/sites-available/$MEDIAGOBLIN_DOMAIN_NAME
440
     echo '        fastcgi_param SCRIPT_NAME "";' >> /etc/nginx/sites-available/$MEDIAGOBLIN_DOMAIN_NAME
461
     echo '        fastcgi_param SCRIPT_NAME "";' >> /etc/nginx/sites-available/$MEDIAGOBLIN_DOMAIN_NAME
462
+    echo '        fastcgi_read_timeout 30;' >> /etc/nginx/sites-available/$MEDIAGOBLIN_DOMAIN_NAME
441
     echo '    }' >> /etc/nginx/sites-available/$MEDIAGOBLIN_DOMAIN_NAME
463
     echo '    }' >> /etc/nginx/sites-available/$MEDIAGOBLIN_DOMAIN_NAME
442
     echo '}' >> /etc/nginx/sites-available/$MEDIAGOBLIN_DOMAIN_NAME
464
     echo '}' >> /etc/nginx/sites-available/$MEDIAGOBLIN_DOMAIN_NAME
443
 
465
 
469
 
491
 
470
     sed -i 's|allow_reporting.*|allow_reporting = false|g' $MEDIAGOBLIN_BASE_DIR/mediagoblin/mediagoblin_local.ini
492
     sed -i 's|allow_reporting.*|allow_reporting = false|g' $MEDIAGOBLIN_BASE_DIR/mediagoblin/mediagoblin_local.ini
471
 
493
 
472
-    if ! grep '[[[skip_transcode]]]' $MEDIAGOBLIN_BASE_DIR/mediagoblin/mediagoblin_local.ini; then
494
+    if ! grep -q '[[[skip_transcode]]]' $MEDIAGOBLIN_BASE_DIR/mediagoblin/mediagoblin_local.ini; then
473
         echo '[[[skip_transcode]]]' >> $MEDIAGOBLIN_BASE_DIR/mediagoblin/mediagoblin_local.ini
495
         echo '[[[skip_transcode]]]' >> $MEDIAGOBLIN_BASE_DIR/mediagoblin/mediagoblin_local.ini
474
         echo 'mime_types = video/webm, video/ogg, video/mp4, audio/ogg, application/ogg, application/x-annodex' >> $MEDIAGOBLIN_BASE_DIR/mediagoblin/mediagoblin_local.ini
496
         echo 'mime_types = video/webm, video/ogg, video/mp4, audio/ogg, application/ogg, application/x-annodex' >> $MEDIAGOBLIN_BASE_DIR/mediagoblin/mediagoblin_local.ini
475
         echo 'container_formats = Matroska, Ogg, ISO MP4/M4A' >> $MEDIAGOBLIN_BASE_DIR/mediagoblin/mediagoblin_local.ini
497
         echo 'container_formats = Matroska, Ogg, ISO MP4/M4A' >> $MEDIAGOBLIN_BASE_DIR/mediagoblin/mediagoblin_local.ini
496
 
518
 
497
     nginx_ensite $MEDIAGOBLIN_DOMAIN_NAME
519
     nginx_ensite $MEDIAGOBLIN_DOMAIN_NAME
498
 
520
 
499
-    systemctl restart php5-fpm
521
+    systemctl restart php7.0-fpm
500
     systemctl restart nginx
522
     systemctl restart nginx
501
 
523
 
502
     function_check add_ddns_domain
524
     function_check add_ddns_domain

+ 44
- 7
src/freedombone-app-movim View File

47
                  DDNS_PROVIDER
47
                  DDNS_PROVIDER
48
                  MY_USERNAME)
48
                  MY_USERNAME)
49
 
49
 
50
+function logging_on_movim {
51
+    echo -n ''
52
+}
53
+
54
+function logging_off_movim {
55
+    echo -n ''
56
+}
57
+
50
 function remove_user_movim {
58
 function remove_user_movim {
51
     remove_username="$1"
59
     remove_username="$1"
52
 
60
 
152
 }
160
 }
153
 
161
 
154
 function upgrade_movim {
162
 function upgrade_movim {
163
+    CURR_MOVIM_COMMIT=$(get_completion_param "movim commit")
164
+    if [[ "$CURR_MOVIM_COMMIT" == "$MOVIM_COMMIT" ]]; then
165
+        return
166
+    fi
167
+
155
     if grep -q "movim domain" $COMPLETION_FILE; then
168
     if grep -q "movim domain" $COMPLETION_FILE; then
156
         MOVIM_DOMAIN_NAME=$(get_completion_param "movim domain")
169
         MOVIM_DOMAIN_NAME=$(get_completion_param "movim domain")
157
     fi
170
     fi
211
             rm -rf $temp_restore_dir
224
             rm -rf $temp_restore_dir
212
         fi
225
         fi
213
 
226
 
227
+        MARIADB_PASSWORD=$(${PROJECT_NAME}-pass -u root -a mariadb)
228
+        cd /var/www/$MOVIM_DOMAIN_NAME/htdocs/config
229
+        sed -i "s|'password'.*|'password'    => '$MARIADB_PASSWORD',|g" db.inc.php
230
+        MARIADB_PASSWORD=
231
+
214
         echo $"Restore of movim complete"
232
         echo $"Restore of movim complete"
215
     fi
233
     fi
216
 }
234
 }
254
         if [ -d /root/tempmovim ]; then
272
         if [ -d /root/tempmovim ]; then
255
             rm -rf /root/tempmovim
273
             rm -rf /root/tempmovim
256
         fi
274
         fi
275
+
276
+        MARIADB_PASSWORD=$(${PROJECT_NAME}-pass -u root -a mariadb)
277
+        cd /var/www/$MOVIM_DOMAIN_NAME/htdocs/config
278
+        sed -i "s|'password'.*|'password'    => '$MARIADB_PASSWORD',|g" db.inc.php
279
+        MARIADB_PASSWORD=
280
+
257
         echo $"Restore of movim complete"
281
         echo $"Restore of movim complete"
258
     fi
282
     fi
259
 }
283
 }
270
     systemctl stop movim
294
     systemctl stop movim
271
     systemctl disable movim
295
     systemctl disable movim
272
     rm /etc/systemd/system/movim.service
296
     rm /etc/systemd/system/movim.service
297
+    systemctl daemon-reload
273
 
298
 
274
     read_config_param "MY_USERNAME"
299
     read_config_param "MY_USERNAME"
275
     echo "Removing $MOVIM_DOMAIN_NAME"
300
     echo "Removing $MOVIM_DOMAIN_NAME"
319
     function_check repair_databases_script
344
     function_check repair_databases_script
320
     repair_databases_script
345
     repair_databases_script
321
 
346
 
322
-    apt-get -yq install php-gettext php5-curl php5-gd php5-mysql git curl php-xml-parser
323
-    apt-get -yq install php5-memcached php5-intl exiftool php5-imagick
347
+    apt-get -yq install php-gettext php-curl php-gd php-mysql git curl
348
+    apt-get -yq install php-memcached php-intl exiftool php-imagick libfcgi0ldbl
324
 
349
 
325
     if [ ! -d /var/www/$MOVIM_DOMAIN_NAME ]; then
350
     if [ ! -d /var/www/$MOVIM_DOMAIN_NAME ]; then
326
         mkdir /var/www/$MOVIM_DOMAIN_NAME
351
         mkdir /var/www/$MOVIM_DOMAIN_NAME
327
     fi
352
     fi
328
     if [ ! -d /var/www/$MOVIM_DOMAIN_NAME/htdocs ]; then
353
     if [ ! -d /var/www/$MOVIM_DOMAIN_NAME/htdocs ]; then
329
-        function_check git_clone
330
-        git_clone $MOVIM_REPO /var/www/$MOVIM_DOMAIN_NAME/htdocs
354
+
355
+        if [ -d /repos/movim ]; then
356
+            mkdir /var/www/$MOVIM_DOMAIN_NAME/htdocs
357
+            cp -r -p /repos/movim/. /var/www/$MOVIM_DOMAIN_NAME/htdocs
358
+            cd /var/www/$MOVIM_DOMAIN_NAME/htdocs
359
+            git pull
360
+        else
361
+            function_check git_clone
362
+            git_clone $MOVIM_REPO /var/www/$MOVIM_DOMAIN_NAME/htdocs
363
+        fi
364
+
331
         if [ ! -d /var/www/$MOVIM_DOMAIN_NAME/htdocs ]; then
365
         if [ ! -d /var/www/$MOVIM_DOMAIN_NAME/htdocs ]; then
332
             echo $'Unable to clone movim repo'
366
             echo $'Unable to clone movim repo'
333
             exit 76285
367
             exit 76285
435
         echo '  # PHP' >> $movim_nginx_site
469
         echo '  # PHP' >> $movim_nginx_site
436
         echo '  location ~ \.php {' >> $movim_nginx_site
470
         echo '  location ~ \.php {' >> $movim_nginx_site
437
         echo '    include snippets/fastcgi-php.conf;' >> $movim_nginx_site
471
         echo '    include snippets/fastcgi-php.conf;' >> $movim_nginx_site
438
-        echo '    fastcgi_pass unix:/var/run/php5-fpm.sock;' >> $movim_nginx_site
472
+        echo '    fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;' >> $movim_nginx_site
473
+        echo '    fastcgi_read_timeout 30;' >> $movim_nginx_site
439
         echo '  }' >> $movim_nginx_site
474
         echo '  }' >> $movim_nginx_site
440
         echo '' >> $movim_nginx_site
475
         echo '' >> $movim_nginx_site
441
         echo '  # Location' >> $movim_nginx_site
476
         echo '  # Location' >> $movim_nginx_site
494
     echo '  # PHP' >> $movim_nginx_site
529
     echo '  # PHP' >> $movim_nginx_site
495
     echo '  location ~ \.php {' >> $movim_nginx_site
530
     echo '  location ~ \.php {' >> $movim_nginx_site
496
     echo '    include snippets/fastcgi-php.conf;' >> $movim_nginx_site
531
     echo '    include snippets/fastcgi-php.conf;' >> $movim_nginx_site
497
-    echo '    fastcgi_pass unix:/var/run/php5-fpm.sock;' >> $movim_nginx_site
532
+    echo '    fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;' >> $movim_nginx_site
533
+    echo '    fastcgi_read_timeout 30;' >> $movim_nginx_site
498
     echo '  }' >> $movim_nginx_site
534
     echo '  }' >> $movim_nginx_site
499
     echo '' >> $movim_nginx_site
535
     echo '' >> $movim_nginx_site
500
     echo '  # Location' >> $movim_nginx_site
536
     echo '  # Location' >> $movim_nginx_site
549
 
585
 
550
     set_completion_param "movim domain" "$MOVIM_DOMAIN_NAME"
586
     set_completion_param "movim domain" "$MOVIM_DOMAIN_NAME"
551
 
587
 
588
+    systemctl restart mariadb
552
     systemctl start movim
589
     systemctl start movim
553
-    systemctl restart php5-fpm
590
+    systemctl restart php7.0-fpm
554
     systemctl restart nginx
591
     systemctl restart nginx
555
     APP_INSTALLED=1
592
     APP_INSTALLED=1
556
 }
593
 }

+ 16
- 0
src/freedombone-app-mumble View File

47
                   ONION_ONLY
47
                   ONION_ONLY
48
                   ADMIN_USERNAME)
48
                   ADMIN_USERNAME)
49
 
49
 
50
+function logging_on_mumble {
51
+    if [ -f /etc/mumble-server.ini ]; then
52
+        sed -i 's|logfile=.*|logfile=/var/log/mumble-server.log|g' /etc/mumble-server.ini
53
+    fi
54
+}
55
+
56
+function logging_off_mumble {
57
+    if [ -f /etc/mumble-server.ini ]; then
58
+        sed -i 's|logfile=.*|logfile=/dev/null|g' /etc/mumble-server.ini
59
+        if [ -d /var/log/mumble-server ]; then
60
+            $REMOVE_FILES_COMMAND /var/log/mumble-server/*
61
+            rm -rf /var/log/mumble-server
62
+        fi
63
+    fi
64
+}
65
+
50
 function install_interactive_mumble {
66
 function install_interactive_mumble {
51
     echo -n ''
67
     echo -n ''
52
     APP_INSTALLED=1
68
     APP_INSTALLED=1

+ 65
- 18
src/freedombone-app-nextcloud View File

38
 NEXTCLOUD_DOMAIN_NAME=
38
 NEXTCLOUD_DOMAIN_NAME=
39
 NEXTCLOUD_CODE=
39
 NEXTCLOUD_CODE=
40
 NEXTCLOUD_ONION_PORT=8112
40
 NEXTCLOUD_ONION_PORT=8112
41
-NEXTCLOUD_DOWNLOAD_URL='https://download.nextcloud.com/server/releases/nextcloud-'
42
-NEXTCLOUD_VERSION='11.0.3'
43
 NEXTCLOUD_REPO="https://github.com/nextcloud/server"
41
 NEXTCLOUD_REPO="https://github.com/nextcloud/server"
44
-# Stable 11 branch
45
-NEXTCLOUD_COMMIT='4fe02f6e3a812551661a3a7a7ceb4e1f3791cbd3'
42
+# Stable 12 branch
43
+NEXTCLOUD_COMMIT='5e22b330963d01feb636b24e7b1027b50b46e3c2'
46
 NEXTCLOUD_ADMIN_PASSWORD=
44
 NEXTCLOUD_ADMIN_PASSWORD=
47
 
45
 
48
 nextcloud_variables=(ONION_ONLY
46
 nextcloud_variables=(ONION_ONLY
51
                      DDNS_PROVIDER
49
                      DDNS_PROVIDER
52
                      MY_USERNAME)
50
                      MY_USERNAME)
53
 
51
 
52
+function logging_on_nextcloud {
53
+    echo -n ''
54
+}
55
+
56
+function logging_off_nextcloud {
57
+    echo -n ''
58
+}
59
+
54
 function remove_user_nextcloud {
60
 function remove_user_nextcloud {
55
     remove_username="$1"
61
     remove_username="$1"
56
 
62
 
178
 }
184
 }
179
 
185
 
180
 function upgrade_nextcloud {
186
 function upgrade_nextcloud {
187
+    CURR_NEXTCLOUD_COMMIT=$(get_completion_param "nextcloud commit")
188
+    if [[ "$CURR_NEXTCLOUD_COMMIT" == "$NEXTCLOUD_COMMIT" ]]; then
189
+        chown -R www-data:www-data /var/www/$NEXTCLOUD_DOMAIN_NAME/htdocs
190
+        chown -R www-data:www-data /var/www/$NEXTCLOUD_DOMAIN_NAME/data
191
+        cd /var/www/$NEXTCLOUD_DOMAIN_NAME/htdocs
192
+        sudo -u www-data ./occ maintenance:repair
193
+        sudo -u www-data ./occ files:cleanup
194
+        sudo -u www-data ./occ files:scan --all
195
+        sudo -u www-data ./occ maintenance:mode --off
196
+        return
197
+    fi
198
+
181
     if grep -q "nextcloud domain" $COMPLETION_FILE; then
199
     if grep -q "nextcloud domain" $COMPLETION_FILE; then
182
         NEXTCLOUD_DOMAIN_NAME=$(get_completion_param "nextcloud domain")
200
         NEXTCLOUD_DOMAIN_NAME=$(get_completion_param "nextcloud domain")
183
     fi
201
     fi
339
     function_check remove_nodejs
357
     function_check remove_nodejs
340
     remove_nodejs pleroma-nextcloud
358
     remove_nodejs pleroma-nextcloud
341
 
359
 
342
-    sed -i 's|env[PATH]|;env[PATH]|g' /etc/php5/fpm/pool.d/www.conf
360
+    sed -i 's|env[PATH]|;env[PATH]|g' /etc/php/7.0/fpm/pool.d/www.conf
343
 
361
 
344
     read_config_param "NEXTCLOUD_DOMAIN_NAME"
362
     read_config_param "NEXTCLOUD_DOMAIN_NAME"
345
     read_config_param "MY_USERNAME"
363
     read_config_param "MY_USERNAME"
367
     function_check remove_ddns_domain
385
     function_check remove_ddns_domain
368
     remove_ddns_domain $NEXTCLOUD_DOMAIN_NAME
386
     remove_ddns_domain $NEXTCLOUD_DOMAIN_NAME
369
     systemctl restart nginx
387
     systemctl restart nginx
370
-    systemctl restart php5-fpm
388
+    systemctl restart php7.0-fpm
371
 }
389
 }
372
 
390
 
373
 function install_nextcloud_main {
391
 function install_nextcloud_main {
389
     function_check repair_databases_script
407
     function_check repair_databases_script
390
     repair_databases_script
408
     repair_databases_script
391
 
409
 
392
-    apt-get -yq install php-gettext php5-curl php5-gd php5-mysql git curl php-xml-parser
393
-    apt-get -yq install php5-memcached php5-intl memcached php5-memcached
410
+    apt-get -yq install php-gettext php-curl php-gd php-mysql git curl
411
+    apt-get -yq install php-intl memcached php-memcached libfcgi0ldbl
412
+    apt-get -yq install php-zip
394
 
413
 
395
     # Ensure PATH is available to php
414
     # Ensure PATH is available to php
396
-    if [ ! -f /etc/php5/fpm/pool.d/www.conf ]; then
415
+    if [ ! -f /etc/php/7.0/fpm/pool.d/www.conf ]; then
397
        echo $'No php www configuration file found'
416
        echo $'No php www configuration file found'
398
        exit 628757
417
        exit 628757
399
     fi
418
     fi
400
-    sed -i 's|;env[PATH]|env[PATH]|g' /etc/php5/fpm/pool.d/www.conf
419
+    sed -i 's|;env[PATH]|env[PATH]|g' /etc/php/7.0/fpm/pool.d/www.conf
401
 
420
 
402
     if [ ! -d /var/www/$NEXTCLOUD_DOMAIN_NAME ]; then
421
     if [ ! -d /var/www/$NEXTCLOUD_DOMAIN_NAME ]; then
403
         mkdir /var/www/$NEXTCLOUD_DOMAIN_NAME
422
         mkdir /var/www/$NEXTCLOUD_DOMAIN_NAME
404
     fi
423
     fi
405
     if [ ! -d /var/www/$NEXTCLOUD_DOMAIN_NAME/htdocs ]; then
424
     if [ ! -d /var/www/$NEXTCLOUD_DOMAIN_NAME/htdocs ]; then
406
-        function_check git_clone
407
-        git_clone $NEXTCLOUD_REPO /var/www/$NEXTCLOUD_DOMAIN_NAME/htdocs
425
+
426
+        if [ -d /repos/nextcloud ]; then
427
+            mkdir /var/www/$NEXTCLOUD_DOMAIN_NAME/htdocs
428
+            cp -r -p /repos/nextcloud/. /var/www/$NEXTCLOUD_DOMAIN_NAME/htdocs
429
+            cd /var/www/$NEXTCLOUD_DOMAIN_NAME/htdocs
430
+            git pull
431
+        else
432
+            function_check git_clone
433
+            git_clone $NEXTCLOUD_REPO /var/www/$NEXTCLOUD_DOMAIN_NAME/htdocs
434
+        fi
435
+
408
         if [ ! -d /var/www/$NEXTCLOUD_DOMAIN_NAME/htdocs ]; then
436
         if [ ! -d /var/www/$NEXTCLOUD_DOMAIN_NAME/htdocs ]; then
409
             echo $'Unable to clone nextcloud repo'
437
             echo $'Unable to clone nextcloud repo'
410
             exit 87525
438
             exit 87525
463
         echo '  # PHP' >> $nextcloud_nginx_site
491
         echo '  # PHP' >> $nextcloud_nginx_site
464
         echo '  location ~ \.php {' >> $nextcloud_nginx_site
492
         echo '  location ~ \.php {' >> $nextcloud_nginx_site
465
         echo '    include snippets/fastcgi-php.conf;' >> $nextcloud_nginx_site
493
         echo '    include snippets/fastcgi-php.conf;' >> $nextcloud_nginx_site
466
-        echo '    fastcgi_pass unix:/var/run/php5-fpm.sock;' >> $nextcloud_nginx_site
494
+        echo '    fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;' >> $nextcloud_nginx_site
495
+        echo '    fastcgi_read_timeout 30;' >> $nextcloud_nginx_site
467
         echo '  }' >> $nextcloud_nginx_site
496
         echo '  }' >> $nextcloud_nginx_site
468
         echo '' >> $nextcloud_nginx_site
497
         echo '' >> $nextcloud_nginx_site
469
         echo '  # Location' >> $nextcloud_nginx_site
498
         echo '  # Location' >> $nextcloud_nginx_site
518
     echo '  # PHP' >> $nextcloud_nginx_site
547
     echo '  # PHP' >> $nextcloud_nginx_site
519
     echo '  location ~ \.php {' >> $nextcloud_nginx_site
548
     echo '  location ~ \.php {' >> $nextcloud_nginx_site
520
     echo '    include snippets/fastcgi-php.conf;' >> $nextcloud_nginx_site
549
     echo '    include snippets/fastcgi-php.conf;' >> $nextcloud_nginx_site
521
-    echo '    fastcgi_pass unix:/var/run/php5-fpm.sock;' >> $nextcloud_nginx_site
550
+    echo '    fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;' >> $nextcloud_nginx_site
551
+    echo '    fastcgi_read_timeout 30;' >> $nextcloud_nginx_site
522
     echo '  }' >> $nextcloud_nginx_site
552
     echo '  }' >> $nextcloud_nginx_site
523
     echo '' >> $nextcloud_nginx_site
553
     echo '' >> $nextcloud_nginx_site
524
     echo '  # Location' >> $nextcloud_nginx_site
554
     echo '  # Location' >> $nextcloud_nginx_site
592
         NEXTCLOUD_SERVER=${NEXTCLOUD_ONION_HOSTNAME}
622
         NEXTCLOUD_SERVER=${NEXTCLOUD_ONION_HOSTNAME}
593
     fi
623
     fi
594
 
624
 
595
-    systemctl restart php5-fpm
625
+    systemctl restart php7.0-fpm
596
     systemctl restart nginx
626
     systemctl restart nginx
597
 
627
 
598
     ${PROJECT_NAME}-addemail -u $MY_USERNAME -e "noreply@$NEXTCLOUD_DOMAIN_NAME" -g nextcloud --public no
628
     ${PROJECT_NAME}-addemail -u $MY_USERNAME -e "noreply@$NEXTCLOUD_DOMAIN_NAME" -g nextcloud --public no
600
     ${PROJECT_NAME}-pass -u $MY_USERNAME -a nextcloud -p "$NEXTCLOUD_ADMIN_PASSWORD"
630
     ${PROJECT_NAME}-pass -u $MY_USERNAME -a nextcloud -p "$NEXTCLOUD_ADMIN_PASSWORD"
601
 
631
 
602
     cd /var/www/${NEXTCLOUD_DOMAIN_NAME}/htdocs
632
     cd /var/www/${NEXTCLOUD_DOMAIN_NAME}/htdocs
603
-    chown -R www-data:www-data config
604
-    chown -R www-data:www-data data
633
+    if [ -d config ]; then
634
+        chown -R www-data:www-data config
635
+    fi
636
+    if [ -d data ]; then
637
+        chown -R www-data:www-data data
638
+    fi
639
+
605
     chmod +x occ
640
     chmod +x occ
606
     ./occ maintenance:install --database-name nextcloud --admin-user ${MY_USERNAME} --admin-pass "${NEXTCLOUD_ADMIN_PASSWORD}" --database mysql --database-user root --database-pass "${MARIADB_PASSWORD}"
641
     ./occ maintenance:install --database-name nextcloud --admin-user ${MY_USERNAME} --admin-pass "${NEXTCLOUD_ADMIN_PASSWORD}" --database mysql --database-user root --database-pass "${MARIADB_PASSWORD}"
642
+    if [ ! -d data ]; then
643
+        echo $'Nextcloud data directory was not found. This probably means that the installation failed.'
644
+        echo ''
645
+        echo $'Install command was:'
646
+        echo "./occ maintenance:install --database-name nextcloud --admin-user ${MY_USERNAME} --admin-pass \"${NEXTCLOUD_ADMIN_PASSWORD}\" --database mysql --database-user root --database-pass \"${MARIADB_PASSWORD}\""
647
+        exit 83522
648
+    fi
649
+    chown -R www-data:www-data config
650
+    chown -R www-data:www-data data
607
     ./occ check
651
     ./occ check
608
     ./occ status
652
     ./occ status
609
     ./occ app:list
653
     ./occ app:list
610
     ./occ app:enable encryption
654
     ./occ app:enable encryption
611
     ./occ config:system:set appstoreenabled --value=false
655
     ./occ config:system:set appstoreenabled --value=false
612
-    ./occ config:system:set trusted_domains 1 --value=$NEXTCLOUD_DOMAIN_NAME
613
     chmod g+w /var/www/${NEXTCLOUD_DOMAIN_NAME}/htdocs/config/config.php
656
     chmod g+w /var/www/${NEXTCLOUD_DOMAIN_NAME}/htdocs/config/config.php
614
     chown -R www-data:www-data /var/www/${NEXTCLOUD_DOMAIN_NAME}/htdocs
657
     chown -R www-data:www-data /var/www/${NEXTCLOUD_DOMAIN_NAME}/htdocs
615
     chmod 0644 .htaccess
658
     chmod 0644 .htaccess
616
     chmod 0750 data
659
     chmod 0750 data
617
     chown -R www-data:www-data /var/www/${NEXTCLOUD_DOMAIN_NAME}/data
660
     chown -R www-data:www-data /var/www/${NEXTCLOUD_DOMAIN_NAME}/data
661
+    sudo -u www-data ./occ config:system:set trusted_domains 1 --value=$NEXTCLOUD_DOMAIN_NAME
662
+    sudo -u www-data ./occ config:system:set trusted_domains 2 --value=$NEXTCLOUD_ONION_HOSTNAME
618
     sudo -u www-data ./occ files:cleanup
663
     sudo -u www-data ./occ files:cleanup
619
     sudo -u www-data ./occ files:scan --all
664
     sudo -u www-data ./occ files:scan --all
620
     sudo -u www-data ./occ maintenance:repair
665
     sudo -u www-data ./occ maintenance:repair
621
     sudo -u www-data ./occ maintenance:mode --off
666
     sudo -u www-data ./occ maintenance:mode --off
622
 
667
 
668
+    systemctl restart mariadb
669
+
623
     # move the data directory
670
     # move the data directory
624
     mv /var/www/${NEXTCLOUD_DOMAIN_NAME}/htdocs/data /var/www/${NEXTCLOUD_DOMAIN_NAME}/
671
     mv /var/www/${NEXTCLOUD_DOMAIN_NAME}/htdocs/data /var/www/${NEXTCLOUD_DOMAIN_NAME}/
625
     sed -i "s|'datadirectory'.*|'datadirectory' => '/var/www/$NEXTCLOUD_DOMAIN_NAME/data',|g" /var/www/${NEXTCLOUD_DOMAIN_NAME}/htdocs/config/config.php
672
     sed -i "s|'datadirectory'.*|'datadirectory' => '/var/www/$NEXTCLOUD_DOMAIN_NAME/data',|g" /var/www/${NEXTCLOUD_DOMAIN_NAME}/htdocs/config/config.php

+ 8
- 1
src/freedombone-app-pelican View File

49
                    PELICAN_DOMAIN_NAME
49
                    PELICAN_DOMAIN_NAME
50
                    PELICAN_BLOG_CODE)
50
                    PELICAN_BLOG_CODE)
51
 
51
 
52
+function logging_on_pelican {
53
+    echo -n ''
54
+}
55
+
56
+function logging_off_pelican {
57
+    echo -n ''
58
+}
52
 
59
 
53
 function install_pelican_website {
60
 function install_pelican_website {
54
     if [[ $ONION_ONLY != 'no' ]]; then
61
     if [[ $ONION_ONLY != 'no' ]]; then
525
     function_check remove_onion_service
532
     function_check remove_onion_service
526
     remove_onion_service pelican ${PELICAN_ONION_PORT}
533
     remove_onion_service pelican ${PELICAN_ONION_PORT}
527
     remove_app pelican
534
     remove_app pelican
528
-    systemctl reload tor
535
+    systemctl restart tor
529
 }
536
 }
530
 
537
 
531
 function create_pelican_conf {
538
 function create_pelican_conf {

+ 28
- 1
src/freedombone-app-pihole View File

54
                   PIHOLE_DNS1
54
                   PIHOLE_DNS1
55
                   PIHOLE_DNS2)
55
                   PIHOLE_DNS2)
56
 
56
 
57
+function logging_on_pihole {
58
+    echo -n ''
59
+}
60
+
61
+function logging_off_pihole {
62
+    echo -n ''
63
+}
64
+
57
 function pihole_copy_files {
65
 function pihole_copy_files {
58
     if [ ! -d /etc/.pihole ]; then
66
     if [ ! -d /etc/.pihole ]; then
59
         mkdir /etc/.pihole
67
         mkdir /etc/.pihole
278
 }
286
 }
279
 
287
 
280
 function upgrade_pihole {
288
 function upgrade_pihole {
289
+    CURR_PIHOLE_COMMIT=$(get_completion_param "pihole commit")
290
+    if [[ "$CURR_PIHOLE_COMMIT" == "$PIHOLE_COMMIT" ]]; then
291
+        return
292
+    fi
293
+
281
     function_check set_repo_commit
294
     function_check set_repo_commit
282
     set_repo_commit $INSTALL_DIR/pihole "pihole commit" "$PIHOLE_COMMIT" $PIHOLE_REPO
295
     set_repo_commit $INSTALL_DIR/pihole "pihole commit" "$PIHOLE_COMMIT" $PIHOLE_REPO
283
 
296
 
351
 function install_pihole {
364
 function install_pihole {
352
     apt-get -yq install dnsmasq curl
365
     apt-get -yq install dnsmasq curl
353
     adduser --disabled-login --gecos 'pi-hole' pihole
366
     adduser --disabled-login --gecos 'pi-hole' pihole
367
+    if [ ! -d /home/pihole ]; then
368
+        echo $"/home/pihole directory not created"
369
+        exit 538929
370
+    fi
371
+
354
     chmod 600 /etc/shadow
372
     chmod 600 /etc/shadow
355
     chmod 600 /etc/gshadow
373
     chmod 600 /etc/gshadow
356
     usermod -a -G www-data pihole
374
     usermod -a -G www-data pihole
365
 
383
 
366
     if [ ! -d $INSTALL_DIR/pihole ]; then
384
     if [ ! -d $INSTALL_DIR/pihole ]; then
367
         cd $INSTALL_DIR
385
         cd $INSTALL_DIR
368
-        git_clone $PIHOLE_REPO pihole
386
+
387
+        if [ -d /repos/pihole ]; then
388
+            mkdir pihole
389
+            cp -r -p /repos/pihole/. pihole
390
+            cd pihole
391
+            git pull
392
+        else
393
+            git_clone $PIHOLE_REPO pihole
394
+        fi
395
+
369
         if [ ! -d $INSTALL_DIR/pihole ]; then
396
         if [ ! -d $INSTALL_DIR/pihole ]; then
370
             exit 523925
397
             exit 523925
371
         fi
398
         fi

+ 157
- 65
src/freedombone-app-postactiv View File

37
 POSTACTIV_CODE=
37
 POSTACTIV_CODE=
38
 POSTACTIV_ONION_PORT=8100
38
 POSTACTIV_ONION_PORT=8100
39
 POSTACTIV_REPO="https://git.postactiv.com/postActiv/postActiv.git"
39
 POSTACTIV_REPO="https://git.postactiv.com/postActiv/postActiv.git"
40
-POSTACTIV_COMMIT='65fcc4eb440380f2373d428e8dde23fcc73c9f08'
40
+POSTACTIV_COMMIT='0531c469b44aab6a71230778ab4492eca889bb2c'
41
 POSTACTIV_ADMIN_PASSWORD=
41
 POSTACTIV_ADMIN_PASSWORD=
42
 
42
 
43
 POSTACTIV_BACKGROUND_IMAGE_URL=
43
 POSTACTIV_BACKGROUND_IMAGE_URL=
55
                      POSTACTIV_EXPIRE_MONTHS
55
                      POSTACTIV_EXPIRE_MONTHS
56
                      POSTACTIV_TITLE)
56
                      POSTACTIV_TITLE)
57
 
57
 
58
+function logging_on_postactiv {
59
+    echo -n ''
60
+}
61
+
62
+function logging_off_postactiv {
63
+    echo -n ''
64
+}
65
+
58
 function postactiv_customise_logo {
66
 function postactiv_customise_logo {
59
     domain_name=$1
67
     domain_name=$1
60
 
68
 
313
         trap "rm -f $data" 0 1 2 5 15
321
         trap "rm -f $data" 0 1 2 5 15
314
         dialog --backtitle $"Freedombone Control Panel" \
322
         dialog --backtitle $"Freedombone Control Panel" \
315
                --title $"PostActiv" \
323
                --title $"PostActiv" \
316
-               --radiolist $"Choose an operation:" 17 70 8 \
324
+               --radiolist $"Choose an operation:" 16 70 7 \
317
                1 $"Set a background image" off \
325
                1 $"Set a background image" off \
318
                2 $"Set the title" off \
326
                2 $"Set the title" off \
319
                3 $"Set post expiry period (currently $POSTACTIV_EXPIRE_MONTHS months)" off \
327
                3 $"Set post expiry period (currently $POSTACTIV_EXPIRE_MONTHS months)" off \
320
                4 $"Select Qvitter user interface" off \
328
                4 $"Select Qvitter user interface" off \
321
                5 $"Select Pleroma user interface" off \
329
                5 $"Select Pleroma user interface" off \
322
                6 $"Select Classic user interface" off \
330
                6 $"Select Classic user interface" off \
323
-               7 $"Select Armadillo user interface" off \
324
-               8 $"Exit" on 2> $data
331
+               7 $"Exit" on 2> $data
325
         sel=$?
332
         sel=$?
326
         case $sel in
333
         case $sel in
327
             1) return;;
334
             1) return;;
334
             4) gnusocial_use_qvitter postactiv;;
341
             4) gnusocial_use_qvitter postactiv;;
335
             5) gnusocial_use_pleroma postactiv;;
342
             5) gnusocial_use_pleroma postactiv;;
336
             6) gnusocial_use_classic postactiv;;
343
             6) gnusocial_use_classic postactiv;;
337
-            7) gnusocial_use_armadillo postactiv;;
338
-            8) break;;
344
+            7) break;;
339
         esac
345
         esac
340
     done
346
     done
341
 }
347
 }
375
     postactiv_customise_logo
381
     postactiv_customise_logo
376
     install_gnusocial_default_background "postactiv" "$POSTACTIV_DOMAIN_NAME"
382
     install_gnusocial_default_background "postactiv" "$POSTACTIV_DOMAIN_NAME"
377
     chown -R www-data:www-data /var/www/${POSTACTIV_DOMAIN_NAME}/htdocs
383
     chown -R www-data:www-data /var/www/${POSTACTIV_DOMAIN_NAME}/htdocs
384
+    systemctl restart mariadb
378
 }
385
 }
379
 
386
 
380
 
387
 
384
         POSTACTIV_DOMAIN_NAME=$(get_completion_param "postactiv domain")
391
         POSTACTIV_DOMAIN_NAME=$(get_completion_param "postactiv domain")
385
     fi
392
     fi
386
 
393
 
387
-    source_directory=/var/www/${POSTACTIV_DOMAIN_NAME}/htdocs
388
-    if [ -d $source_directory ]; then
389
-        dest_directory=postactiv
390
-        function_check suspend_site
391
-        suspend_site ${POSTACTIV_DOMAIN_NAME}
394
+    # don't backup more data than we need to
395
+    postactiv-expire
392
 
396
 
393
-        function_check backup_directory_to_usb
394
-        backup_directory_to_usb $source_directory $dest_directory
397
+    source_directory=/var/www/${POSTACTIV_DOMAIN_NAME}/htdocs/backup
398
+    if [ ! -d $source_directory ]; then
399
+        mkdir $source_directory
400
+    fi
401
+    cp -p /var/www/${POSTACTIV_DOMAIN_NAME}/htdocs/config.php $source_directory
402
+    if [ -d /var/www/${POSTACTIV_DOMAIN_NAME}/htdocs/static ]; then
403
+        cp -rp /var/www/${POSTACTIV_DOMAIN_NAME}/htdocs/static $source_directory
404
+    fi
395
 
405
 
396
-        function_check backup_database_to_usb
397
-        backup_database_to_usb postactiv
406
+    function_check suspend_site
407
+    suspend_site ${POSTACTIV_DOMAIN_NAME}
398
 
408
 
399
-        function_check restart_site
400
-        restart_site
401
-    fi
409
+    function_check backup_directory_to_usb
410
+    dest_directory=postactivconfig
411
+    backup_directory_to_usb $source_directory $dest_directory
412
+
413
+    source_directory=/var/www/${POSTACTIV_DOMAIN_NAME}/htdocs/file
414
+    dest_directory=postactivfile
415
+    backup_directory_to_usb $source_directory $dest_directory
416
+
417
+    function_check backup_database_to_usb
418
+    backup_database_to_usb postactiv
419
+
420
+    function_check restart_site
421
+    restart_site
402
 }
422
 }
403
 
423
 
404
 function restore_local_postactiv {
424
 function restore_local_postactiv {
407
     fi
427
     fi
408
     POSTACTIV_DOMAIN_NAME=$(get_completion_param "postactiv domain")
428
     POSTACTIV_DOMAIN_NAME=$(get_completion_param "postactiv domain")
409
     if [ $POSTACTIV_DOMAIN_NAME ]; then
429
     if [ $POSTACTIV_DOMAIN_NAME ]; then
430
+        echo $"Restoring postactiv"
410
         temp_restore_dir=/root/temppostactiv
431
         temp_restore_dir=/root/temppostactiv
411
         postactiv_dir=/var/www/${POSTACTIV_DOMAIN_NAME}/htdocs
432
         postactiv_dir=/var/www/${POSTACTIV_DOMAIN_NAME}/htdocs
412
         # stop the daemons
433
         # stop the daemons
413
         cd $postactiv_dir
434
         cd $postactiv_dir
414
-        su -c "sh scripts/stopdaemons.sh" -s /bin/sh www-data
435
+        scripts/stopdaemons.sh
415
 
436
 
416
         function_check postactiv_create_database
437
         function_check postactiv_create_database
417
         postactiv_create_database
438
         postactiv_create_database
418
 
439
 
419
-        restore_database postactiv ${POSTACTIV_DOMAIN_NAME}
440
+        restore_database postactiv
420
         if [ -d $temp_restore_dir ]; then
441
         if [ -d $temp_restore_dir ]; then
421
             rm -rf $temp_restore_dir
442
             rm -rf $temp_restore_dir
422
         fi
443
         fi
423
 
444
 
424
-        # start the daemons
425
-        cd $postactiv_dir
426
-        su -c "sh scripts/startdaemons.sh" -s /bin/sh www-data
445
+        function_check restore_directory_from_usb
446
+        restore_directory_from_usb $temp_restore_dir postactivconfig
447
+        if [ -d $temp_restore_dir ]; then
448
+            cp $temp_restore_dir$postactiv_dir/backup/config.php $postactiv_dir/
449
+            chown www-data:www-data $postactiv_dir/config.php
450
+            cp -rp $temp_restore_dir$postactiv_dir/static $postactiv_dir/
451
+            chown -R www-data:www-data $postactiv_dir/static
452
+            rm -rf $temp_restore_dir
453
+        fi
454
+
455
+        restore_directory_from_usb $temp_restore_dir postactivfile
456
+        if [ -d $temp_restore_dir ]; then
457
+            cp -rp $temp_restore_dir$postactiv_dir/file $postactiv_dir/
458
+            chown -R www-data:www-data $postactiv_dir/file
459
+            rm -rf $temp_restore_dir
460
+        fi
461
+
462
+        gnusocial_update_after_restore postactiv ${POSTACTIV_DOMAIN_NAME}
463
+
464
+        echo $"Restore of postactiv complete"
427
     fi
465
     fi
428
 }
466
 }
429
 
467
 
430
 function backup_remote_postactiv {
468
 function backup_remote_postactiv {
469
+    POSTACTIV_DOMAIN_NAME='postactiv'
431
     if grep -q "postactiv domain" $COMPLETION_FILE; then
470
     if grep -q "postactiv domain" $COMPLETION_FILE; then
432
         POSTACTIV_DOMAIN_NAME=$(get_completion_param "postactiv domain")
471
         POSTACTIV_DOMAIN_NAME=$(get_completion_param "postactiv domain")
433
-        temp_backup_dir=/var/www/${POSTACTIV_DOMAIN_NAME}/htdocs
434
-        if [ -d $temp_backup_dir ]; then
435
-            function_check suspend_site
436
-            suspend_site ${POSTACTIV_DOMAIN_NAME}
437
-
438
-            function_check backup_database_to_friend
439
-            backup_database_to_friend postactiv
472
+    fi
440
 
473
 
441
-            function_check backup_directory_to_friend
442
-            backup_directory_to_friend $temp_backup_dir postactiv
474
+    # don't backup more data than we need to
475
+    postactiv-expire
443
 
476
 
444
-            function_check restart_site
445
-            restart_site
446
-        else
447
-            echo $"postactiv domain specified but not found in ${temp_backup_dir}"
448
-        fi
477
+    source_directory=/var/www/${POSTACTIV_DOMAIN_NAME}/htdocs/backup
478
+    if [ ! -d $source_directory ]; then
479
+        mkdir $source_directory
449
     fi
480
     fi
481
+    cp -p /var/www/${POSTACTIV_DOMAIN_NAME}/htdocs/config.php $source_directory
482
+    if [ -d /var/www/${POSTACTIV_DOMAIN_NAME}/htdocs/static ]; then
483
+        cp -rp /var/www/${POSTACTIV_DOMAIN_NAME}/htdocs/static $source_directory
484
+    fi
485
+
486
+    function_check suspend_site
487
+    suspend_site ${POSTACTIV_DOMAIN_NAME}
488
+
489
+    function_check backup_directory_to_friend
490
+    dest_directory=postactivconfig
491
+    backup_directory_to_friend $source_directory $dest_directory
492
+
493
+    source_directory=/var/www/${POSTACTIV_DOMAIN_NAME}/htdocs/file
494
+    dest_directory=postactivfile
495
+    backup_directory_to_friend $source_directory $dest_directory
496
+
497
+    function_check backup_database_to_friend
498
+    backup_database_to_friend postactiv
499
+
500
+    function_check restart_site
501
+    restart_site
450
 }
502
 }
451
 
503
 
452
 function restore_remote_postactiv {
504
 function restore_remote_postactiv {
453
-    if grep -q "postactiv domain" $COMPLETION_FILE; then
454
-        POSTACTIV_DOMAIN_NAME=$(get_completion_param "postactiv domain")
455
-
505
+    if ! grep -q "postactiv domain" $COMPLETION_FILE; then
506
+        return
507
+    fi
508
+    POSTACTIV_DOMAIN_NAME=$(get_completion_param "postactiv domain")
509
+    if [ $POSTACTIV_DOMAIN_NAME ]; then
510
+        echo $"Restoring postactiv"
511
+        temp_restore_dir=/root/temppostactiv
512
+        postactiv_dir=/var/www/${POSTACTIV_DOMAIN_NAME}/htdocs
456
         # stop the daemons
513
         # stop the daemons
457
-        cd /var/www/${POSTACTIV_DOMAIN_NAME}/htdocs
458
-        su -c "sh scripts/stopdaemons.sh" -s /bin/sh www-data
514
+        cd $postactiv_dir
515
+        scripts/stopdaemons.sh
459
 
516
 
460
         function_check postactiv_create_database
517
         function_check postactiv_create_database
461
         postactiv_create_database
518
         postactiv_create_database
462
 
519
 
463
         function_check restore_database_from_friend
520
         function_check restore_database_from_friend
464
-        restore_database_from_friend postactiv ${POSTACTIV_DOMAIN_NAME}
465
-        if [ -d /root/temppostactiv ]; then
466
-            rm -rf /root/temppostactiv
521
+        restore_database_from_friend postactiv
522
+        if [ -d $temp_restore_dir ]; then
523
+            rm -rf $temp_restore_dir
524
+        fi
525
+
526
+        function_check restore_directory_from_friend
527
+        restore_directory_from_friend $temp_restore_dir postactivconfig
528
+        if [ -d $temp_restore_dir ]; then
529
+            cp $temp_restore_dir$postactiv_dir/backup/config.php $postactiv_dir/
530
+            chown www-data:www-data $postactiv_dir/config.php
531
+            cp -rp $temp_restore_dir$postactiv_dir/static $postactiv_dir/
532
+            chown -R www-data:www-data $postactiv_dir/static
533
+            rm -rf $temp_restore_dir
534
+        fi
535
+
536
+        restore_directory_from_friend $temp_restore_dir postactivfile
537
+        if [ -d $temp_restore_dir ]; then
538
+            cp -rp $temp_restore_dir$postactiv_dir/file $postactiv_dir/
539
+            chown -R www-data:www-data $postactiv_dir/file
540
+            rm -rf $temp_restore_dir
467
         fi
541
         fi
468
 
542
 
469
-        # start the daemons
470
-        cd /var/www/${POSTACTIV_DOMAIN_NAME}/htdocs
471
-        su -c "sh scripts/startdaemons.sh" -s /bin/sh www-data
543
+        gnusocial_update_after_restore postactiv ${POSTACTIV_DOMAIN_NAME}
544
+
545
+        echo $"Restore of postactiv complete"
472
     fi
546
     fi
473
 }
547
 }
474
 
548
 
488
         rm /etc/cron.hourly/postactiv-daemons
562
         rm /etc/cron.hourly/postactiv-daemons
489
     fi
563
     fi
490
     if [ -f /var/www/$POSTACTIV_DOMAIN_NAME/htdocs/scripts/stopdaemons.sh ]; then
564
     if [ -f /var/www/$POSTACTIV_DOMAIN_NAME/htdocs/scripts/stopdaemons.sh ]; then
491
-        cd /var/www/$POSTACTIV_DOMAIN_NAME/htdocs/scripts
492
-        su -c "sh scripts/stopdaemons.sh" -s /bin/sh www-data
565
+        cd /var/www/$POSTACTIV_DOMAIN_NAME/htdocs
566
+        scripts/stopdaemons.sh
493
     fi
567
     fi
494
     kill_pid=$(ps aux | grep /var/www/$POSTACTIV_DOMAIN_NAME/htdocs/scripts/queuedaemon.php | awk -F ' ' '{print $2}' | head -n 1)
568
     kill_pid=$(ps aux | grep /var/www/$POSTACTIV_DOMAIN_NAME/htdocs/scripts/queuedaemon.php | awk -F ' ' '{print $2}' | head -n 1)
495
     kill -9 $kill_pid
569
     kill -9 $kill_pid
540
     function_check repair_databases_script
614
     function_check repair_databases_script
541
     repair_databases_script
615
     repair_databases_script
542
 
616
 
543
-    apt-get -yq install php-gettext php5-curl php5-gd php5-mysql git curl php-xml-parser
544
-    apt-get -yq install php5-memcached php5-intl exiftool
617
+    apt-get -yq install php-gettext php-curl php-gd php-mysql git curl
618
+    apt-get -yq install memcached php-memcached php-intl exiftool libfcgi0ldbl
545
 
619
 
546
     if [ ! -d /var/www/$POSTACTIV_DOMAIN_NAME ]; then
620
     if [ ! -d /var/www/$POSTACTIV_DOMAIN_NAME ]; then
547
         mkdir /var/www/$POSTACTIV_DOMAIN_NAME
621
         mkdir /var/www/$POSTACTIV_DOMAIN_NAME
548
     fi
622
     fi
549
     if [ ! -d /var/www/$POSTACTIV_DOMAIN_NAME/htdocs ]; then
623
     if [ ! -d /var/www/$POSTACTIV_DOMAIN_NAME/htdocs ]; then
550
-        function_check git_clone
551
-        git_clone $POSTACTIV_REPO /var/www/$POSTACTIV_DOMAIN_NAME/htdocs
624
+
625
+        if [ -d /repos/postactiv ]; then
626
+            mkdir /var/www/$POSTACTIV_DOMAIN_NAME/htdocs
627
+            cp -r -p /repos/postactiv/. /var/www/$POSTACTIV_DOMAIN_NAME/htdocs
628
+            cd /var/www/$POSTACTIV_DOMAIN_NAME/htdocs
629
+            git pull
630
+        else
631
+            function_check git_clone
632
+            git_clone $POSTACTIV_REPO /var/www/$POSTACTIV_DOMAIN_NAME/htdocs
633
+        fi
634
+
552
         if [ ! -d /var/www/$POSTACTIV_DOMAIN_NAME/htdocs ]; then
635
         if [ ! -d /var/www/$POSTACTIV_DOMAIN_NAME/htdocs ]; then
553
             echo $'Unable to clone postactiv repo'
636
             echo $'Unable to clone postactiv repo'
554
             exit 87525
637
             exit 87525
583
     function_check add_ddns_domain
666
     function_check add_ddns_domain
584
     add_ddns_domain $POSTACTIV_DOMAIN_NAME
667
     add_ddns_domain $POSTACTIV_DOMAIN_NAME
585
 
668
 
669
+    POSTACTIV_ONION_HOSTNAME=$(add_onion_service postactiv 80 ${POSTACTIV_ONION_PORT})
670
+
586
     postactiv_nginx_site=/etc/nginx/sites-available/$POSTACTIV_DOMAIN_NAME
671
     postactiv_nginx_site=/etc/nginx/sites-available/$POSTACTIV_DOMAIN_NAME
587
     if [[ $ONION_ONLY == "no" ]]; then
672
     if [[ $ONION_ONLY == "no" ]]; then
588
         function_check nginx_http_redirect
673
         function_check nginx_http_redirect
617
         echo '  # PHP' >> $postactiv_nginx_site
702
         echo '  # PHP' >> $postactiv_nginx_site
618
         echo '  location ~ \.php {' >> $postactiv_nginx_site
703
         echo '  location ~ \.php {' >> $postactiv_nginx_site
619
         echo '    include snippets/fastcgi-php.conf;' >> $postactiv_nginx_site
704
         echo '    include snippets/fastcgi-php.conf;' >> $postactiv_nginx_site
620
-        echo '    fastcgi_pass unix:/var/run/php5-fpm.sock;' >> $postactiv_nginx_site
705
+        echo '    fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;' >> $postactiv_nginx_site
706
+        echo '    fastcgi_read_timeout 30;' >> $postactiv_nginx_site
621
         echo '  }' >> $postactiv_nginx_site
707
         echo '  }' >> $postactiv_nginx_site
622
         echo '' >> $postactiv_nginx_site
708
         echo '' >> $postactiv_nginx_site
623
         echo '  # Location' >> $postactiv_nginx_site
709
         echo '  # Location' >> $postactiv_nginx_site
644
     fi
730
     fi
645
     echo 'server {' >> $postactiv_nginx_site
731
     echo 'server {' >> $postactiv_nginx_site
646
     echo "    listen 127.0.0.1:$POSTACTIV_ONION_PORT default_server;" >> $postactiv_nginx_site
732
     echo "    listen 127.0.0.1:$POSTACTIV_ONION_PORT default_server;" >> $postactiv_nginx_site
647
-    echo "    server_name $POSTACTIV_DOMAIN_NAME;" >> $postactiv_nginx_site
733
+    echo "    server_name $POSTACTIV_ONION_HOSTNAME;" >> $postactiv_nginx_site
648
     echo '' >> $postactiv_nginx_site
734
     echo '' >> $postactiv_nginx_site
649
     function_check nginx_disable_sniffing
735
     function_check nginx_disable_sniffing
650
     nginx_disable_sniffing $POSTACTIV_DOMAIN_NAME
736
     nginx_disable_sniffing $POSTACTIV_DOMAIN_NAME
665
     echo '  # PHP' >> $postactiv_nginx_site
751
     echo '  # PHP' >> $postactiv_nginx_site
666
     echo '  location ~ \.php {' >> $postactiv_nginx_site
752
     echo '  location ~ \.php {' >> $postactiv_nginx_site
667
     echo '    include snippets/fastcgi-php.conf;' >> $postactiv_nginx_site
753
     echo '    include snippets/fastcgi-php.conf;' >> $postactiv_nginx_site
668
-    echo '    fastcgi_pass unix:/var/run/php5-fpm.sock;' >> $postactiv_nginx_site
754
+    echo '    fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;' >> $postactiv_nginx_site
755
+    echo '    fastcgi_read_timeout 30;' >> $postactiv_nginx_site
669
     echo '  }' >> $postactiv_nginx_site
756
     echo '  }' >> $postactiv_nginx_site
670
     echo '' >> $postactiv_nginx_site
757
     echo '' >> $postactiv_nginx_site
671
     echo '  # Location' >> $postactiv_nginx_site
758
     echo '  # Location' >> $postactiv_nginx_site
713
         postactiv_ssl='never'
800
         postactiv_ssl='never'
714
     fi
801
     fi
715
 
802
 
716
-    POSTACTIV_ONION_HOSTNAME=$(add_onion_service postactiv 80 ${POSTACTIV_ONION_PORT})
717
-
718
     POSTACTIV_SERVER=${POSTACTIV_DOMAIN_NAME}
803
     POSTACTIV_SERVER=${POSTACTIV_DOMAIN_NAME}
719
     if [[ $ONION_ONLY != 'no' ]]; then
804
     if [[ $ONION_ONLY != 'no' ]]; then
720
         POSTACTIV_SERVER=${POSTACTIV_ONION_HOSTNAME}
805
         POSTACTIV_SERVER=${POSTACTIV_ONION_HOSTNAME}
776
         rm /var/www/$POSTACTIV_DOMAIN_NAME/htdocs/install.php
861
         rm /var/www/$POSTACTIV_DOMAIN_NAME/htdocs/install.php
777
     fi
862
     fi
778
 
863
 
779
-    systemctl restart php5-fpm
864
+    systemctl restart mariadb
865
+    systemctl restart php7.0-fpm
780
     systemctl restart nginx
866
     systemctl restart nginx
781
 
867
 
782
     ${PROJECT_NAME}-addemail -u $MY_USERNAME -e "noreply@$POSTACTIV_DOMAIN_NAME" -g postactiv --public no
868
     ${PROJECT_NAME}-addemail -u $MY_USERNAME -e "noreply@$POSTACTIV_DOMAIN_NAME" -g postactiv --public no
798
 
884
 
799
     install_postactiv_main
885
     install_postactiv_main
800
     install_qvitter "$POSTACTIV_DOMAIN_NAME" "postactiv"
886
     install_qvitter "$POSTACTIV_DOMAIN_NAME" "postactiv"
801
-
802
-    #function_check install_nodejs
803
-    #install_nodejs pleroma-postactiv
804
-
805
-    install_armadillo_front_end "postactiv" "$POSTACTIV_DOMAIN_NAME" "$POSTACTIV_BACKGROUND_IMAGE_URL"
887
+    install_gnusocial_markdown "$POSTACTIV_DOMAIN_NAME" "postactiv"
888
+    install_gnusocial_plugin_sharings "$POSTACTIV_DOMAIN_NAME" "postactiv"
889
+    install_gnusocial_plugin_sharings_theme "$POSTACTIV_DOMAIN_NAME" "postactiv"
806
 
890
 
807
     # Currently Pleroma won't install on ARM systems
891
     # Currently Pleroma won't install on ARM systems
808
     # because it uses node-sass which doesn't support ARM
892
     # because it uses node-sass which doesn't support ARM
825
 
909
 
826
     systemctl restart nginx
910
     systemctl restart nginx
827
 
911
 
912
+    # Set qvitter to be the default UI. It's probably the most stable.
913
+    # And doesn't forget logins
914
+    gnusocial_use_qvitter postactiv
915
+
916
+    if [ $POSTACTIV_BACKGROUND_IMAGE_URL ]; then
917
+        pleroma_set_background_image_from_url "$POSTACTIV_DOMAIN_NAME" "$POSTACTIV_BACKGROUND_IMAGE_URL" "$POSTACTIV_TITLE"
918
+    fi
919
+
828
     APP_INSTALLED=1
920
     APP_INSTALLED=1
829
 }
921
 }
830
 
922
 

+ 36
- 3
src/freedombone-app-profanity View File

48
                 DEFAULT_DOMAIN_NAME
48
                 DEFAULT_DOMAIN_NAME
49
                 XMPP_DOMAIN_CODE)
49
                 XMPP_DOMAIN_CODE)
50
 
50
 
51
+function logging_on_profanity {
52
+    echo -n ''
53
+}
54
+
55
+function logging_off_profanity {
56
+    echo -n ''
57
+}
58
+
51
 function remove_user_profanity {
59
 function remove_user_profanity {
52
     remove_username="$1"
60
     remove_username="$1"
53
 }
61
 }
198
     apt-get -yq install libotr5-dev libgpgme11-dev python-dev libreadline-dev
206
     apt-get -yq install libotr5-dev libgpgme11-dev python-dev libreadline-dev
199
 
207
 
200
     # dependency for profanity not available in debian
208
     # dependency for profanity not available in debian
201
-    git_clone $LIBMESODE_REPO $INSTALL_DIR/libmesode
209
+    if [ -d /repos/libmesode ]; then
210
+        mkdir $INSTALL_DIR/libmesode
211
+        cp -r -p /repos/libmesode/. $INSTALL_DIR/libmesode
212
+        cd $INSTALL_DIR/libmesode
213
+        git pull
214
+    else
215
+        git_clone $LIBMESODE_REPO $INSTALL_DIR/libmesode
216
+    fi
217
+
202
     cd $INSTALL_DIR/libmesode
218
     cd $INSTALL_DIR/libmesode
203
     git checkout $LIBMESODE_COMMIT -b $LIBMESODE_COMMIT
219
     git checkout $LIBMESODE_COMMIT -b $LIBMESODE_COMMIT
204
     ./bootstrap.sh
220
     ./bootstrap.sh
208
     cp /usr/local/lib/libmesode* /usr/lib
224
     cp /usr/local/lib/libmesode* /usr/lib
209
 
225
 
210
     # build profanity
226
     # build profanity
211
-    git_clone $PROFANITY_REPO $INSTALL_DIR/profanity
227
+    if [ -d /repos/profanity ]; then
228
+        mkdir $INSTALL_DIR/profanity
229
+        cp -r -p /repos/profanity/. $INSTALL_DIR/profanity
230
+        cd $INSTALL_DIR/profanity
231
+        git pull
232
+    else
233
+        git_clone $PROFANITY_REPO $INSTALL_DIR/profanity
234
+    fi
235
+
212
     cd $INSTALL_DIR/profanity
236
     cd $INSTALL_DIR/profanity
213
     git checkout $PROFANITY_COMMIT -b $PROFANITY_COMMIT
237
     git checkout $PROFANITY_COMMIT -b $PROFANITY_COMMIT
214
     ./bootstrap.sh
238
     ./bootstrap.sh
223
 
247
 
224
     # install the omemo plugin
248
     # install the omemo plugin
225
     apt-get -yq install python-pip python-setuptools clang libffi-dev libssl-dev python-dev
249
     apt-get -yq install python-pip python-setuptools clang libffi-dev libssl-dev python-dev
226
-    git_clone $PROFANITY_OMEMO_PLUGIN_REPO $INSTALL_DIR/profanity-omemo-plugin
250
+
251
+    if [ -d /repos/profanity-omemo ]; then
252
+        mkdir $INSTALL_DIR/profanity-omemo-plugin
253
+        cp -r -p /repos/profanity-omemo/. $INSTALL_DIR/profanity-omemo-plugin
254
+        cd $INSTALL_DIR/profanity-omemo-plugin
255
+        git pull
256
+    else
257
+        git_clone $PROFANITY_OMEMO_PLUGIN_REPO $INSTALL_DIR/profanity-omemo-plugin
258
+    fi
259
+
227
     cd $INSTALL_DIR/profanity-omemo-plugin
260
     cd $INSTALL_DIR/profanity-omemo-plugin
228
     git checkout $PROFANITY_OMEMO_PLUGIN_COMMIT -b $PROFANITY_OMEMO_PLUGIN_COMMIT
261
     git checkout $PROFANITY_OMEMO_PLUGIN_COMMIT -b $PROFANITY_OMEMO_PLUGIN_COMMIT
229
     if [ ! -f $INSTALL_DIR/profanity-omemo-plugin/deploy/prof_omemo_plugin.py ]; then
262
     if [ ! -f $INSTALL_DIR/profanity-omemo-plugin/deploy/prof_omemo_plugin.py ]; then

+ 14
- 2
src/freedombone-app-radicale View File

31
 # You should have received a copy of the GNU Affero General Public License
31
 # You should have received a copy of the GNU Affero General Public License
32
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
32
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
33
 
33
 
34
-VARIANTS='full full-vim'
34
+VARIANTS=''
35
 
35
 
36
 IN_DEFAULT_INSTALL=0
36
 IN_DEFAULT_INSTALL=0
37
 SHOW_ON_ABOUT=1
37
 SHOW_ON_ABOUT=1
50
                     RADICALE_PASSWORD
50
                     RADICALE_PASSWORD
51
                     DEFAULT_DOMAIN_NAME)
51
                     DEFAULT_DOMAIN_NAME)
52
 
52
 
53
+function logging_on_radicale {
54
+    echo -n ''
55
+}
56
+
57
+function logging_off_radicale {
58
+    echo -n ''
59
+}
60
+
53
 function remove_user_radicale {
61
 function remove_user_radicale {
54
     remove_username="$1"
62
     remove_username="$1"
55
 
63
 
274
     if [ -f /etc/systemd/system/radicale.service ]; then
282
     if [ -f /etc/systemd/system/radicale.service ]; then
275
         rm /etc/systemd/system/radicale.service
283
         rm /etc/systemd/system/radicale.service
276
     fi
284
     fi
285
+    systemctl daemon-reload
277
     if [ -f /etc/nginx/sites-available/radicale ]; then
286
     if [ -f /etc/nginx/sites-available/radicale ]; then
278
         rm /etc/nginx/sites-available/radicale
287
         rm /etc/nginx/sites-available/radicale
279
     fi
288
     fi
282
     fi
291
     fi
283
 
292
 
284
     firewall_remove ${RADICALE_PORT} tcp
293
     firewall_remove ${RADICALE_PORT} tcp
285
-    deluser radicale
294
+
295
+    groupdel -f radicale
296
+    userdel -r radicale
286
 
297
 
287
     function_check remove_onion_service
298
     function_check remove_onion_service
288
     remove_onion_service radicale ${RADICALE_ONION_PORT}
299
     remove_onion_service radicale ${RADICALE_ONION_PORT}
323
 
334
 
324
     useradd -c "Radicale system account" -d /var/www/radicale -m -r -g radicale radicale
335
     useradd -c "Radicale system account" -d /var/www/radicale -m -r -g radicale radicale
325
     usermod -a -G www-data radicale
336
     usermod -a -G www-data radicale
337
+    groupadd radicale
326
 
338
 
327
     # create directories
339
     # create directories
328
     if [ ! -d /var/log/radicale ]; then
340
     if [ ! -d /var/log/radicale ]; then

+ 31
- 6
src/freedombone-app-riot View File

46
                 RIOT_DOMAIN_NAME
46
                 RIOT_DOMAIN_NAME
47
                 MATRIX_DOMAIN_NAME
47
                 MATRIX_DOMAIN_NAME
48
                 SYSTEM_TYPE
48
                 SYSTEM_TYPE
49
+                ONION_ONLY
49
                 DDNS_PROVIDER)
50
                 DDNS_PROVIDER)
50
 
51
 
52
+function logging_on_riot {
53
+    echo -n ''
54
+}
55
+
56
+function logging_off_riot {
57
+    echo -n ''
58
+}
59
+
51
 function remove_user_riot {
60
 function remove_user_riot {
52
     echo -n ''
61
     echo -n ''
53
 }
62
 }
206
 }
215
 }
207
 
216
 
208
 function install_riot {
217
 function install_riot {
218
+    if [[ $ONION_ONLY != 'no' ]]; then
219
+        return
220
+    fi
221
+
209
     # check that matrix has been installed
222
     # check that matrix has been installed
210
     if [ ! $MATRIX_DOMAIN_NAME ]; then
223
     if [ ! $MATRIX_DOMAIN_NAME ]; then
211
         exit 687292
224
         exit 687292
217
         exit 827334
230
         exit 827334
218
     fi
231
     fi
219
 
232
 
233
+    function_check get_completion_param
234
+    MATRIX_ONION_DOMAIN_NAME=$(get_completion_param "matrix onion domain")
235
+
220
     apt-get -yq install wget
236
     apt-get -yq install wget
221
 
237
 
222
     if [ ! -d /var/www/$RIOT_DOMAIN_NAME/htdocs ]; then
238
     if [ ! -d /var/www/$RIOT_DOMAIN_NAME/htdocs ]; then
232
     cd /var/www/$RIOT_DOMAIN_NAME/htdocs
248
     cd /var/www/$RIOT_DOMAIN_NAME/htdocs
233
     cp config.sample.json config.json
249
     cp config.sample.json config.json
234
 
250
 
235
-    sed -i "s|\"default_hs_url\":.*|\"default_hs_url\": \"https://${MATRIX_DOMAIN_NAME}\",|g" config.json
236
-    sed -i "s|\"default_is_url\":.*|\"default_is_url\": \"https://${MATRIX_DOMAIN_NAME}\",|g" config.json
237
-    sed -i "s|\"integrations_ui_url\":.*|\"integrations_ui_url\": \"https://${MATRIX_DOMAIN_NAME}/\",|g" config.json
238
-    sed -i "s|\"integrations_rest_url\":.*|\"integrations_rest_url\": \"https://${MATRIX_DOMAIN_NAME}/api\",|g" config.json
239
-    sed -i "s|\"bug_report_endpoint_url\":.*|\"bug_report_endpoint_url\": \"https://${MATRIX_DOMAIN_NAME}/bugs\",|g" config.json
240
-    sed -i "/\"servers\":/a \"matrix.freedombone.net\"," config.json
251
+    if [[ $ONION_ONLY == 'no' ]]; then
252
+        sed -i "s|\"default_hs_url\":.*|\"default_hs_url\": \"https://${MATRIX_DOMAIN_NAME}\",|g" config.json
253
+        sed -i "s|\"default_is_url\":.*|\"default_is_url\": \"https://${MATRIX_DOMAIN_NAME}\",|g" config.json
254
+        sed -i "s|\"integrations_ui_url\":.*|\"integrations_ui_url\": \"https://${MATRIX_DOMAIN_NAME}/\",|g" config.json
255
+        sed -i "s|\"integrations_rest_url\":.*|\"integrations_rest_url\": \"https://${MATRIX_DOMAIN_NAME}/api\",|g" config.json
256
+        sed -i "s|\"bug_report_endpoint_url\":.*|\"bug_report_endpoint_url\": \"https://${MATRIX_DOMAIN_NAME}/bugs\",|g" config.json
257
+        sed -i "/\"servers\":/a \"${MATRIX_DOMAIN_NAME}\"," config.json
258
+    else
259
+        sed -i "s|\"default_hs_url\":.*|\"default_hs_url\": \"http://${MATRIX_ONION_DOMAIN_NAME}\",|g" config.json
260
+        sed -i "s|\"default_is_url\":.*|\"default_is_url\": \"http://${MATRIX_ONION_DOMAIN_NAME}\",|g" config.json
261
+        sed -i "s|\"integrations_ui_url\":.*|\"integrations_ui_url\": \"http://${MATRIX_ONION_DOMAIN_NAME}/\",|g" config.json
262
+        sed -i "s|\"integrations_rest_url\":.*|\"integrations_rest_url\": \"http://${MATRIX_ONION_DOMAIN_NAME}/api\",|g" config.json
263
+        sed -i "s|\"bug_report_endpoint_url\":.*|\"bug_report_endpoint_url\": \"http://${MATRIX_ONION_DOMAIN_NAME}/bugs\",|g" config.json
264
+        sed -i "/\"servers\":/a \"${MATRIX_ONION_DOMAIN_NAME}\"," config.json
265
+    fi
241
 
266
 
242
     RIOT_ONION_HOSTNAME=$(add_onion_service riot 80 ${RIOT_ONION_PORT})
267
     RIOT_ONION_HOSTNAME=$(add_onion_service riot 80 ${RIOT_ONION_PORT})
243
 
268
 

+ 78
- 15
src/freedombone-app-rss View File

13
 # License
13
 # License
14
 # =======
14
 # =======
15
 #
15
 #
16
-# Copyright (C) 2014-2016 Bob Mottram <bob@freedombone.net>
16
+# Copyright (C) 2014-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
53
                USB_MOUNT
53
                USB_MOUNT
54
                MY_USERNAME)
54
                MY_USERNAME)
55
 
55
 
56
+function logging_on_rss {
57
+    echo -n ''
58
+}
59
+
60
+function logging_off_rss {
61
+    echo -n ''
62
+}
63
+
64
+function remove_user_rss {
65
+    remove_username="$1"
66
+}
67
+
68
+function add_user_rss {
69
+    new_username="$1"
70
+    new_user_password="$2"
71
+    echo '0'
72
+}
73
+
56
 function install_interactive_rss {
74
 function install_interactive_rss {
57
     echo -n ''
75
     echo -n ''
58
     APP_INSTALLED=1
76
     APP_INSTALLED=1
86
 }
104
 }
87
 
105
 
88
 function upgrade_rss {
106
 function upgrade_rss {
107
+    CURR_RSS_READER_COMMIT=$(get_completion_param "rss reader commit")
108
+    if [[ "$CURR_RSS_READER_COMMIT" == "$RSS_READER_COMMIT" ]]; then
109
+        return
110
+    fi
111
+
89
     RSS_MOBILE_READER_PATH=/etc/share/ttrss-mobile
112
     RSS_MOBILE_READER_PATH=/etc/share/ttrss-mobile
90
 
113
 
91
     if [[ $(app_is_installed rss) == "1" ]]; then
114
     if [[ $(app_is_installed rss) == "1" ]]; then
180
             rm -rf $temp_restore_dir
203
             rm -rf $temp_restore_dir
181
         fi
204
         fi
182
     fi
205
     fi
206
+
207
+    MARIADB_PASSWORD=$(${PROJECT_NAME}-pass -u root -a mariadb)
208
+    sed -i "s|define('DB_PASS'.*|define('DB_PASS', '${MARIADB_PASSWORD}');|g" $RSS_READER_PATH/config.php
209
+    MARIADB_PASSWORD=
183
 }
210
 }
184
 
211
 
185
 function backup_remote_rss {
212
 function backup_remote_rss {
238
         if [ -d /root/tempttrss ]; then
265
         if [ -d /root/tempttrss ]; then
239
             rm -rf /root/tempttrss
266
             rm -rf /root/tempttrss
240
         fi
267
         fi
268
+
269
+        MARIADB_PASSWORD=$(${PROJECT_NAME}-pass -u root -a mariadb)
270
+        sed -i "s|define('DB_PASS'.*|define('DB_PASS', '${MARIADB_PASSWORD}');|g" $RSS_READER_PATH/config.php
271
+        MARIADB_PASSWORD=
272
+
241
         echo $"Restore of ttrss complete"
273
         echo $"Restore of ttrss complete"
242
     fi
274
     fi
243
 }
275
 }
249
 
281
 
250
     nginx_dissite $RSS_READER_DOMAIN_NAME
282
     nginx_dissite $RSS_READER_DOMAIN_NAME
251
     function_check remove_onion_service
283
     function_check remove_onion_service
252
-    remove_onion_service rss ${RSS_READER_ONION_PORT} ${RSS_MOBILE_READER_ONION_PORT}
284
+    remove_onion_service mobilerss ${RSS_MOBILE_READER_ONION_PORT}
285
+    remove_onion_service rss ${RSS_READER_ONION_PORT}
253
     if [ -f /etc/nginx/sites-available/$RSS_READER_DOMAIN_NAME ]; then
286
     if [ -f /etc/nginx/sites-available/$RSS_READER_DOMAIN_NAME ]; then
254
         rm /etc/nginx/sites-available/$RSS_READER_DOMAIN_NAME
287
         rm /etc/nginx/sites-available/$RSS_READER_DOMAIN_NAME
255
     fi
288
     fi
261
     remove_completion_param install_rss
294
     remove_completion_param install_rss
262
     sed -i '/RSS /d' $COMPLETION_FILE
295
     sed -i '/RSS /d' $COMPLETION_FILE
263
     sed -i '/rss /d' $COMPLETION_FILE
296
     sed -i '/rss /d' $COMPLETION_FILE
297
+    sed -i '/rss_/d' $COMPLETION_FILE
264
     remove_backup_database_local ttrss
298
     remove_backup_database_local ttrss
265
 }
299
 }
266
 
300
 
294
     function_check remove_onion_service
328
     function_check remove_onion_service
295
     remove_onion_service rss ${RSS_READER_ONION_PORT} ${RSS_MOBILE_READER_ONION_PORT}
329
     remove_onion_service rss ${RSS_READER_ONION_PORT} ${RSS_MOBILE_READER_ONION_PORT}
296
 
330
 
297
-    apt-get -yq install php-gettext php5-curl php5-gd php5-mysql git
298
-    apt-get -yq install curl php-xml-parser php5-mcrypt
331
+    apt-get -yq install php-gettext php-curl php-gd php-mysql git
332
+    apt-get -yq install curl php-mcrypt libfcgi0ldbl
333
+
334
+    remove_onion_service mobilerss ${RSS_MOBILE_READER_ONION_PORT}
335
+    remove_onion_service rss ${RSS_READER_ONION_PORT}
299
 
336
 
300
     if [ ! -d /etc/share ]; then
337
     if [ ! -d /etc/share ]; then
301
         mkdir /etc/share
338
         mkdir /etc/share
302
     fi
339
     fi
303
     cd /etc/share
340
     cd /etc/share
304
-    function_check git_clone
305
-    git_clone $RSS_READER_REPO tt-rss
341
+
342
+    if [ -d /repos/rss ]; then
343
+        mkdir tt-rss
344
+        cp -r -p /repos/rss/. tt-rss
345
+        cd tt-rss
346
+        git pull
347
+    else
348
+        function_check git_clone
349
+        git_clone $RSS_READER_REPO tt-rss
350
+    fi
351
+
306
     if [ ! -d $RSS_READER_PATH ]; then
352
     if [ ! -d $RSS_READER_PATH ]; then
307
         echo $'Could not clone RSS reader repo'
353
         echo $'Could not clone RSS reader repo'
308
         exit 52925
354
         exit 52925
323
     rss_create_database
369
     rss_create_database
324
 
370
 
325
     RSS_READER_ONION_HOSTNAME=$(add_onion_service rss 80 ${RSS_READER_ONION_PORT})
371
     RSS_READER_ONION_HOSTNAME=$(add_onion_service rss 80 ${RSS_READER_ONION_PORT})
326
-    RSS_MOBILE_READER_ONION_HOSTNAME=$(add_onion_service rss_mobile 80 ${RSS_MOBILE_READER_ONION_PORT})
372
+
373
+    sleep 2
374
+
375
+    RSS_MOBILE_READER_ONION_HOSTNAME=$(add_onion_service mobilerss 80 ${RSS_MOBILE_READER_ONION_PORT})
376
+
377
+    set_completion_param "rss_mobile onion domain" "$RSS_MOBILE_READER_ONION_HOSTNAME"
327
 
378
 
328
     echo 'server {' > /etc/nginx/sites-available/$RSS_READER_DOMAIN_NAME
379
     echo 'server {' > /etc/nginx/sites-available/$RSS_READER_DOMAIN_NAME
329
     echo "  listen 127.0.0.1:$RSS_MOBILE_READER_ONION_PORT;" >> /etc/nginx/sites-available/$RSS_READER_DOMAIN_NAME
380
     echo "  listen 127.0.0.1:$RSS_MOBILE_READER_ONION_PORT;" >> /etc/nginx/sites-available/$RSS_READER_DOMAIN_NAME
337
     echo '' >> /etc/nginx/sites-available/$RSS_READER_DOMAIN_NAME
388
     echo '' >> /etc/nginx/sites-available/$RSS_READER_DOMAIN_NAME
338
     echo '  location ~ \.php {' >> /etc/nginx/sites-available/$RSS_READER_DOMAIN_NAME
389
     echo '  location ~ \.php {' >> /etc/nginx/sites-available/$RSS_READER_DOMAIN_NAME
339
     echo '    include snippets/fastcgi-php.conf;' >> /etc/nginx/sites-available/$RSS_READER_DOMAIN_NAME
390
     echo '    include snippets/fastcgi-php.conf;' >> /etc/nginx/sites-available/$RSS_READER_DOMAIN_NAME
340
-    echo '    fastcgi_pass unix:/var/run/php5-fpm.sock;' >> /etc/nginx/sites-available/$RSS_READER_DOMAIN_NAME
391
+    echo '    fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;' >> /etc/nginx/sites-available/$RSS_READER_DOMAIN_NAME
392
+    echo '    fastcgi_read_timeout 30;' >> /etc/nginx/sites-available/$RSS_READER_DOMAIN_NAME
341
     echo '  }' >> /etc/nginx/sites-available/$RSS_READER_DOMAIN_NAME
393
     echo '  }' >> /etc/nginx/sites-available/$RSS_READER_DOMAIN_NAME
342
     echo '' >> /etc/nginx/sites-available/$RSS_READER_DOMAIN_NAME
394
     echo '' >> /etc/nginx/sites-available/$RSS_READER_DOMAIN_NAME
343
     echo '  location / {' >> /etc/nginx/sites-available/$RSS_READER_DOMAIN_NAME
395
     echo '  location / {' >> /etc/nginx/sites-available/$RSS_READER_DOMAIN_NAME
375
     echo '' >> /etc/nginx/sites-available/$RSS_READER_DOMAIN_NAME
427
     echo '' >> /etc/nginx/sites-available/$RSS_READER_DOMAIN_NAME
376
     echo '  location ~ \.php {' >> /etc/nginx/sites-available/$RSS_READER_DOMAIN_NAME
428
     echo '  location ~ \.php {' >> /etc/nginx/sites-available/$RSS_READER_DOMAIN_NAME
377
     echo '    include snippets/fastcgi-php.conf;' >> /etc/nginx/sites-available/$RSS_READER_DOMAIN_NAME
429
     echo '    include snippets/fastcgi-php.conf;' >> /etc/nginx/sites-available/$RSS_READER_DOMAIN_NAME
378
-    echo '    fastcgi_pass unix:/var/run/php5-fpm.sock;' >> /etc/nginx/sites-available/$RSS_READER_DOMAIN_NAME
430
+    echo '    fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;' >> /etc/nginx/sites-available/$RSS_READER_DOMAIN_NAME
431
+    echo '    fastcgi_read_timeout 30;' >> /etc/nginx/sites-available/$RSS_READER_DOMAIN_NAME
379
     echo '  }' >> /etc/nginx/sites-available/$RSS_READER_DOMAIN_NAME
432
     echo '  }' >> /etc/nginx/sites-available/$RSS_READER_DOMAIN_NAME
380
     echo '' >> /etc/nginx/sites-available/$RSS_READER_DOMAIN_NAME
433
     echo '' >> /etc/nginx/sites-available/$RSS_READER_DOMAIN_NAME
381
     echo '  set $mobile_rewrite do_not_perform;' >> /etc/nginx/sites-available/$RSS_READER_DOMAIN_NAME
434
     echo '  set $mobile_rewrite do_not_perform;' >> /etc/nginx/sites-available/$RSS_READER_DOMAIN_NAME
396
     echo '' >> /etc/nginx/sites-available/$RSS_READER_DOMAIN_NAME
449
     echo '' >> /etc/nginx/sites-available/$RSS_READER_DOMAIN_NAME
397
     echo '  location ~ \.php {' >> /etc/nginx/sites-available/$RSS_READER_DOMAIN_NAME
450
     echo '  location ~ \.php {' >> /etc/nginx/sites-available/$RSS_READER_DOMAIN_NAME
398
     echo '    include snippets/fastcgi-php.conf;' >> /etc/nginx/sites-available/$RSS_READER_DOMAIN_NAME
451
     echo '    include snippets/fastcgi-php.conf;' >> /etc/nginx/sites-available/$RSS_READER_DOMAIN_NAME
399
-    echo '    fastcgi_pass unix:/var/run/php5-fpm.sock;' >> /etc/nginx/sites-available/$RSS_READER_DOMAIN_NAME
452
+    echo '    fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;' >> /etc/nginx/sites-available/$RSS_READER_DOMAIN_NAME
400
     echo '  }' >> /etc/nginx/sites-available/$RSS_READER_DOMAIN_NAME
453
     echo '  }' >> /etc/nginx/sites-available/$RSS_READER_DOMAIN_NAME
401
     echo '' >> /etc/nginx/sites-available/$RSS_READER_DOMAIN_NAME
454
     echo '' >> /etc/nginx/sites-available/$RSS_READER_DOMAIN_NAME
402
     echo '  location / {' >> /etc/nginx/sites-available/$RSS_READER_DOMAIN_NAME
455
     echo '  location / {' >> /etc/nginx/sites-available/$RSS_READER_DOMAIN_NAME
420
         # generate a config file
473
         # generate a config file
421
         RSS_FEED_CRYPT_KEY="$(create_password 24)"
474
         RSS_FEED_CRYPT_KEY="$(create_password 24)"
422
         echo '<?php' > $RSS_READER_PATH/config.php
475
         echo '<?php' > $RSS_READER_PATH/config.php
423
-        echo "  define ('_CURL_HTTP_PROXY', '127.0.0.1:9050');" >> $RSS_READER_PATH/config.php
476
+        echo "  define('_CURL_HTTP_PROXY', '127.0.0.1:9050');" >> $RSS_READER_PATH/config.php
424
         echo "  define('DB_TYPE', 'mysql');" >> $RSS_READER_PATH/config.php
477
         echo "  define('DB_TYPE', 'mysql');" >> $RSS_READER_PATH/config.php
425
         echo "  define('DB_HOST', 'localhost');" >> $RSS_READER_PATH/config.php
478
         echo "  define('DB_HOST', 'localhost');" >> $RSS_READER_PATH/config.php
426
         echo "  define('DB_USER', 'root');" >> $RSS_READER_PATH/config.php
479
         echo "  define('DB_USER', 'root');" >> $RSS_READER_PATH/config.php
482
     configure_php
535
     configure_php
483
 
536
 
484
     nginx_ensite $RSS_READER_DOMAIN_NAME
537
     nginx_ensite $RSS_READER_DOMAIN_NAME
485
-    systemctl restart php5-fpm
538
+    systemctl restart mariadb
539
+    systemctl restart php7.0-fpm
486
     systemctl restart nginx
540
     systemctl restart nginx
487
 
541
 
488
     # daemon to update feeds
542
     # daemon to update feeds
489
     echo '[Unit]' > /etc/systemd/system/ttrss.service
543
     echo '[Unit]' > /etc/systemd/system/ttrss.service
490
     echo 'Description=ttrss_backend' >> /etc/systemd/system/ttrss.service
544
     echo 'Description=ttrss_backend' >> /etc/systemd/system/ttrss.service
491
-    echo 'After=network.target mysql.service' >> /etc/systemd/system/ttrss.service
545
+    echo 'After=network.target mariadb.service' >> /etc/systemd/system/ttrss.service
492
     echo 'After=tor.service' >> /etc/systemd/system/ttrss.service
546
     echo 'After=tor.service' >> /etc/systemd/system/ttrss.service
493
     echo '' >> /etc/systemd/system/ttrss.service
547
     echo '' >> /etc/systemd/system/ttrss.service
494
     echo '[Service]' >> /etc/systemd/system/ttrss.service
548
     echo '[Service]' >> /etc/systemd/system/ttrss.service
570
     fi
624
     fi
571
 
625
 
572
     cd /etc/share
626
     cd /etc/share
573
-    function_check git_clone
574
-    git_clone $RSS_MOBILE_READER_REPO ttrss-mobile
627
+
628
+    if [ -d /repos/rss-mobile ]; then
629
+        mkdir ttrss-mobile
630
+        cp -r -p /repos/rss-mobile/. ttrss-mobile
631
+        cd ttrss-mobile
632
+        git pull
633
+    else
634
+        function_check git_clone
635
+        git_clone $RSS_MOBILE_READER_REPO ttrss-mobile
636
+    fi
637
+
575
     if [ ! -d $RSS_MOBILE_READER_PATH ]; then
638
     if [ ! -d $RSS_MOBILE_READER_PATH ]; then
576
         echo $'Could not clone RSS mobile reader repo'
639
         echo $'Could not clone RSS mobile reader repo'
577
         exit 24816
640
         exit 24816

+ 11
- 1
src/freedombone-app-scuttlebot View File

10
 #
10
 #
11
 # scuttlebot pub application
11
 # scuttlebot pub application
12
 # https://scuttlebot.io
12
 # https://scuttlebot.io
13
+# Problem: on occasion uses 100% of the CPU, severely impacting other services
13
 #
14
 #
14
 # License
15
 # License
15
 # =======
16
 # =======
29
 # You should have received a copy of the GNU Affero General Public License
30
 # You should have received a copy of the GNU Affero General Public License
30
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
31
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
31
 
32
 
32
-VARIANTS='full full-vim chat'
33
+VARIANTS=''
33
 
34
 
34
 IN_DEFAULT_INSTALL=0
35
 IN_DEFAULT_INSTALL=0
35
 SHOW_ON_ABOUT=0
36
 SHOW_ON_ABOUT=0
42
                       DEFAULT_DOMAIN_NAME
43
                       DEFAULT_DOMAIN_NAME
43
                       SYSTEM_TYPE)
44
                       SYSTEM_TYPE)
44
 
45
 
46
+function logging_on_scuttlebot {
47
+    echo -n ''
48
+}
49
+
50
+function logging_off_scuttlebot {
51
+    echo -n ''
52
+}
53
+
45
 function scuttlebot_create_invite {
54
 function scuttlebot_create_invite {
46
     invite_string=$(su -c "sbot invite.create 1" - scuttlebot | sed 's/"//g')
55
     invite_string=$(su -c "sbot invite.create 1" - scuttlebot | sed 's/"//g')
47
 
56
 
166
     systemctl stop scuttlebot
175
     systemctl stop scuttlebot
167
     systemctl disable scuttlebot
176
     systemctl disable scuttlebot
168
     rm /etc/systemd/system/scuttlebot.service
177
     rm /etc/systemd/system/scuttlebot.service
178
+    systemctl daemon-reload
169
 
179
 
170
     userdel -r scuttlebot
180
     userdel -r scuttlebot
171
 
181
 

+ 50
- 7
src/freedombone-app-searx View File

35
 SHOW_ICANN_ADDRESS_ON_ABOUT=0
35
 SHOW_ICANN_ADDRESS_ON_ABOUT=0
36
 
36
 
37
 SEARX_REPO="https://github.com/asciimoo/searx"
37
 SEARX_REPO="https://github.com/asciimoo/searx"
38
-SEARX_COMMIT='259735f30901ae884f8234f1f138c28a9e59713a'
38
+SEARX_COMMIT='80460be8f69cea5f15c9d5ddbb63e4e48fde2dd0'
39
 SEARX_PATH=/etc
39
 SEARX_PATH=/etc
40
 SEARX_ONION_PORT=8094
40
 SEARX_ONION_PORT=8094
41
 SEARX_ONION_HOSTNAME=
41
 SEARX_ONION_HOSTNAME=
48
                  SEARX_BACKGROUND_IMAGE_URL
48
                  SEARX_BACKGROUND_IMAGE_URL
49
                  SYSTEM_TYPE)
49
                  SYSTEM_TYPE)
50
 
50
 
51
+function logging_on_searx {
52
+    echo -n ''
53
+}
54
+
55
+function logging_off_searx {
56
+    echo -n ''
57
+}
58
+
51
 function searx_set_default_background {
59
 function searx_set_default_background {
52
     if [ -f ~/freedombone/img/backgrounds/searx.jpg ]; then
60
     if [ -f ~/freedombone/img/backgrounds/searx.jpg ]; then
53
         cp ~/freedombone/img/backgrounds/searx.jpg /etc/searx/searx/static/themes/courgette/img/bg-body-index.jpg
61
         cp ~/freedombone/img/backgrounds/searx.jpg /etc/searx/searx/static/themes/courgette/img/bg-body-index.jpg
737
 }
745
 }
738
 
746
 
739
 function upgrade_searx {
747
 function upgrade_searx {
748
+    CURR_SEARX_COMMIT=$(get_completion_param "searx commit")
749
+    if [[ "$CURR_SEARX_COMMIT" == "$SEARX_COMMIT" ]]; then
750
+        return
751
+    fi
752
+
740
     settings_file=${SEARX_PATH}/searx/searx/settings.yml
753
     settings_file=${SEARX_PATH}/searx/searx/settings.yml
741
     background_image=/etc/searx/searx/static/themes/courgette/img/bg-body-index.jpg
754
     background_image=/etc/searx/searx/static/themes/courgette/img/bg-body-index.jpg
742
 
755
 
789
     systemctl stop searx
802
     systemctl stop searx
790
     systemctl disable searx
803
     systemctl disable searx
791
     rm /etc/systemd/system/searx.service
804
     rm /etc/systemd/system/searx.service
805
+    systemctl daemon-reload
806
+
792
     function_check remove_onion_service
807
     function_check remove_onion_service
793
     remove_onion_service searx ${SEARX_ONION_PORT}
808
     remove_onion_service searx ${SEARX_ONION_PORT}
794
     userdel -r searx
809
     userdel -r searx
811
         exit 62429
826
         exit 62429
812
     fi
827
     fi
813
 
828
 
814
-    apt-get -yq install python-pip libyaml-dev python-werkzeug python-babel python-lxml apache2-utils
815
-    apt-get -yq install git build-essential libxslt-dev python-dev python-virtualenv python-pybabel zlib1g-dev uwsgi uwsgi-plugin-python libapache2-mod-uwsgi imagemagick
829
+    apt-get -yq install python-pip libyaml-dev python-werkzeug python-babel python-lxml
830
+    apt-get -yq install git build-essential libxslt-dev python-dev python-virtualenv zlib1g-dev uwsgi uwsgi-plugin-python imagemagick
831
+    apt-get -yq install apache2-utils
832
+
833
+    apt-get -yq remove --purge apache2-bin*
834
+    if [ -d /etc/apache2 ]; then
835
+        rm -rf /etc/apache2
836
+        echo $'Removed Apache installation'
837
+    fi
816
 
838
 
817
     pip install --upgrade pip
839
     pip install --upgrade pip
818
 
840
 
846
         exit 63738
868
         exit 63738
847
     fi
869
     fi
848
 
870
 
871
+    pip install requests --upgrade
872
+    if [ ! "$?" = "0" ]; then
873
+        echo $'Failed to install requests'
874
+        exit 357282
875
+    fi
876
+
877
+    pip install pygments --upgrade
878
+    if [ ! "$?" = "0" ]; then
879
+        echo $'Failed to install pygments'
880
+        exit 357282
881
+    fi
882
+
849
     if [ ! -d $SEARX_PATH ]; then
883
     if [ ! -d $SEARX_PATH ]; then
850
         mkdir -p $SEARX_PATH
884
         mkdir -p $SEARX_PATH
851
     fi
885
     fi
852
 
886
 
853
     # clone the repo
887
     # clone the repo
854
     cd $SEARX_PATH
888
     cd $SEARX_PATH
855
-    function_check git_clone
856
-    git_clone $SEARX_REPO searx
889
+
890
+    if [ -d /repos/searx ]; then
891
+        mkdir searx
892
+        cp -r -p /repos/searx/. searx
893
+        cd searx
894
+        git pull
895
+    else
896
+        function_check git_clone
897
+        git_clone $SEARX_REPO searx
898
+    fi
899
+
857
     git checkout $SEARX_COMMIT -b $SEARX_COMMIT
900
     git checkout $SEARX_COMMIT -b $SEARX_COMMIT
858
     set_completion_param "searx commit" "$SEARX_COMMIT"
901
     set_completion_param "searx commit" "$SEARX_COMMIT"
859
 
902
 
915
     echo '}' >> /etc/nginx/sites-available/searx
958
     echo '}' >> /etc/nginx/sites-available/searx
916
 
959
 
917
     # replace the secret key
960
     # replace the secret key
918
-    if ! grep "searx key" $COMPLETION_FILE; then
961
+    if ! grep -q "searx key" $COMPLETION_FILE; then
919
         SEARX_SECRET_KEY="$(create_password 30)"
962
         SEARX_SECRET_KEY="$(create_password 30)"
920
         set_completion_param "searx key" "${SEARX_SECRET_KEY}"
963
         set_completion_param "searx key" "${SEARX_SECRET_KEY}"
921
     fi
964
     fi
930
     nginx_ensite searx
973
     nginx_ensite searx
931
 
974
 
932
     # restart the web server
975
     # restart the web server
933
-    systemctl restart php5-fpm
976
+    systemctl restart php7.0-fpm
934
     systemctl restart nginx
977
     systemctl restart nginx
935
 
978
 
936
     # start the daemon
979
     # start the daemon

+ 10
- 2
src/freedombone-app-sip View File

50
                TURN_TLS_PORT
50
                TURN_TLS_PORT
51
                TURN_NONCE)
51
                TURN_NONCE)
52
 
52
 
53
+function logging_on_sip {
54
+    echo -n ''
55
+}
56
+
57
+function logging_off_sip {
58
+    echo -n ''
59
+}
60
+
53
 function remove_user_sip {
61
 function remove_user_sip {
54
     remove_username="$1"
62
     remove_username="$1"
55
     ${PROJECT_NAME}-rmsipuser ${remove_username}
63
     ${PROJECT_NAME}-rmsipuser ${remove_username}
146
             exit 3679
154
             exit 3679
147
         fi
155
         fi
148
         rm -rf $temp_restore_dir
156
         rm -rf $temp_restore_dir
149
-        service sipwitch restart
157
+        systemctl restart sipwitch
150
         echo $"Restore of SIP settings complete"
158
         echo $"Restore of SIP settings complete"
151
     fi
159
     fi
152
 }
160
 }
212
         return
220
         return
213
     fi
221
     fi
214
 
222
 
215
-    service sipwitch stop
223
+    systemctl stop sipwitch
216
 
224
 
217
     # remove the original sipwitch daemon if it exists
225
     # remove the original sipwitch daemon if it exists
218
     if [ -f /etc/init.d/sipwitch ]; then
226
     if [ -f /etc/init.d/sipwitch ]; then

+ 20
- 4
src/freedombone-app-syncthing View File

13
 # License
13
 # License
14
 # =======
14
 # =======
15
 #
15
 #
16
-# Copyright (C) 2014-2016 Bob Mottram <bob@freedombone.net>
16
+# Copyright (C) 2014-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
51
                      SYNCTHING_SHARED_DATA
51
                      SYNCTHING_SHARED_DATA
52
                      USB_MOUNT)
52
                      USB_MOUNT)
53
 
53
 
54
+function logging_on_syncthing {
55
+    echo -n ''
56
+}
57
+
58
+function logging_off_syncthing {
59
+    echo -n ''
60
+}
61
+
54
 function syncthing_create_ids_file {
62
 function syncthing_create_ids_file {
55
     if [ ! -f ~/.syncthing-server-id ]; then
63
     if [ ! -f ~/.syncthing-server-id ]; then
56
         return
64
         return
458
     firewall_remove ${SYNCTHING_PORT}
466
     firewall_remove ${SYNCTHING_PORT}
459
     systemctl stop syncthing
467
     systemctl stop syncthing
460
     systemctl disable syncthing
468
     systemctl disable syncthing
461
-    apt-get -yq remove --purge syncthing
462
     rm /etc/systemd/system/syncthing.service
469
     rm /etc/systemd/system/syncthing.service
470
+    systemctl daemon-reload
471
+    apt-get -yq remove --purge syncthing
463
     sed -i "/${PROJECT_NAME}-syncthing/d" /etc/crontab
472
     sed -i "/${PROJECT_NAME}-syncthing/d" /etc/crontab
464
     remove_completion_param install_syncthing
473
     remove_completion_param install_syncthing
465
     remove_completion_param configure_firewall_for_syncthing
474
     remove_completion_param configure_firewall_for_syncthing
475
     mark_completed $FUNCNAME
484
     mark_completed $FUNCNAME
476
 }
485
 }
477
 
486
 
478
-function install_syncthing {
479
-    apt-get -yq install curl
487
+function install_syncthing_repo {
488
+    if [ -f /etc/apt/sources.list.d/syncthing.list ]; then
489
+        return
490
+    fi
480
 
491
 
492
+    apt-get -yq install curl
481
     curl -s https://syncthing.net/release-key.txt | apt-key add -
493
     curl -s https://syncthing.net/release-key.txt | apt-key add -
482
     echo "deb http://apt.syncthing.net/ syncthing release" | tee /etc/apt/sources.list.d/syncthing.list
494
     echo "deb http://apt.syncthing.net/ syncthing release" | tee /etc/apt/sources.list.d/syncthing.list
483
     apt-get update
495
     apt-get update
496
+}
497
+
498
+function install_syncthing {
499
+    install_syncthing_repo
484
     apt-get -yq install syncthing
500
     apt-get -yq install syncthing
485
 
501
 
486
     # This probably does need to run as root so that it can access the Sync directories
502
     # This probably does need to run as root so that it can access the Sync directories

+ 84
- 88
src/freedombone-app-tahoelafs View File

36
 SHOW_ON_ABOUT=1
36
 SHOW_ON_ABOUT=1
37
 SHOW_ICANN_ADDRESS_ON_ABOUT=0
37
 SHOW_ICANN_ADDRESS_ON_ABOUT=0
38
 
38
 
39
-TAHOELAFS_REPO="https://github.com/tahoe-lafs/tahoe-lafs"
40
-TAHOELAFS_COMMIT='bb782b0331a60de438136a593bba18338d8d866b'
41
-
42
 TAHOELAFS_PORT=50213
39
 TAHOELAFS_PORT=50213
43
 TAHOELAFS_STORAGE_PORT=50214
40
 TAHOELAFS_STORAGE_PORT=50214
44
 TAHOELAFS_ONION_PORT=8096
41
 TAHOELAFS_ONION_PORT=8096
45
 TAHOELAFS_STORAGE_ONION_PORT=8097
42
 TAHOELAFS_STORAGE_ONION_PORT=8097
46
 
43
 
47
-TAHOE_COMMAND="cd /home/tahoelafs/tahoelafs && venv/bin/tahoe"
48
-tahoelafs_storage_file=/home/tahoelafs/client/private/servers.yaml
44
+TAHOE_DIR=/home/tahoelafs
45
+TAHOE_COMMAND='/usr/bin/tahoe'
46
+tahoelafs_storage_file=$TAHOE_DIR/client/private/servers.yaml
49
 
47
 
50
 TAHOELAFS_SHARES_NEEDED=3
48
 TAHOELAFS_SHARES_NEEDED=3
51
 TAHOELAFS_SHARES_HAPPY=7
49
 TAHOELAFS_SHARES_HAPPY=7
53
 
51
 
54
 tahoelafs_variables=(ONION_ONLY
52
 tahoelafs_variables=(ONION_ONLY
55
                      MY_USERNAME
53
                      MY_USERNAME
56
-                     TAHOELAFS_REPO
57
                      TAHOELAFS_PORT
54
                      TAHOELAFS_PORT
58
                      TAHOELAFS_SHARES_NEEDED
55
                      TAHOELAFS_SHARES_NEEDED
59
                      TAHOELAFS_SHARES_HAPPY
56
                      TAHOELAFS_SHARES_HAPPY
60
                      TAHOELAFS_SHARES_TOTAL)
57
                      TAHOELAFS_SHARES_TOTAL)
61
 
58
 
59
+function logging_on_tahoelafs {
60
+    echo -n ''
61
+}
62
+
63
+function logging_off_tahoelafs {
64
+    echo -n ''
65
+}
66
+
62
 function add_user_tahoelafs {
67
 function add_user_tahoelafs {
63
     if [[ $(app_is_installed tahoelafs) == "0" ]]; then
68
     if [[ $(app_is_installed tahoelafs) == "0" ]]; then
64
         echo '0'
69
         echo '0'
68
     new_username="$1"
73
     new_username="$1"
69
     new_user_password="$2"
74
     new_user_password="$2"
70
     ${PROJECT_NAME}-pass -u $new_username -a tahoelafs -p "$new_user_password"
75
     ${PROJECT_NAME}-pass -u $new_username -a tahoelafs -p "$new_user_password"
71
-    if grep "${new_username}:" /etc/nginx/.htpasswd-tahoelafs; then
76
+    if grep -q "${new_username}:" /etc/nginx/.htpasswd-tahoelafs; then
72
         sed -i '/${new_username}:/d' /etc/nginx/.htpasswd-tahoelafs
77
         sed -i '/${new_username}:/d' /etc/nginx/.htpasswd-tahoelafs
73
     fi
78
     fi
74
     echo "${new_user_password}" | htpasswd -i -s /etc/nginx/.htpasswd-tahoelafs ${new_username}
79
     echo "${new_user_password}" | htpasswd -i -s /etc/nginx/.htpasswd-tahoelafs ${new_username}
78
 function remove_user_tahoelafs {
83
 function remove_user_tahoelafs {
79
     remove_username="$1"
84
     remove_username="$1"
80
     ${PROJECT_NAME}-pass -u $remove_username --rmapp tahoelafs
85
     ${PROJECT_NAME}-pass -u $remove_username --rmapp tahoelafs
81
-    if grep "${remove_username}:" /etc/nginx/.htpasswd-tahoelafs; then
86
+    if grep -q "${remove_username}:" /etc/nginx/.htpasswd-tahoelafs; then
82
         sed -i '/${remove_username}:/d' /etc/nginx/.htpasswd-tahoelafs
87
         sed -i '/${remove_username}:/d' /etc/nginx/.htpasswd-tahoelafs
83
     fi
88
     fi
84
 }
89
 }
87
     change_username="$1"
92
     change_username="$1"
88
     change_password="$2"
93
     change_password="$2"
89
     ${PROJECT_NAME}-pass -u $change_username -a tahoelafs -p "$change_password"
94
     ${PROJECT_NAME}-pass -u $change_username -a tahoelafs -p "$change_password"
90
-    if grep "${change_username}:" /etc/nginx/.htpasswd-tahoelafs; then
95
+    if grep -q "${change_username}:" /etc/nginx/.htpasswd-tahoelafs; then
91
         sed -i '/tahoe-${change_username}:/d' /etc/nginx/.htpasswd-tahoelafs
96
         sed -i '/tahoe-${change_username}:/d' /etc/nginx/.htpasswd-tahoelafs
92
     fi
97
     fi
93
     echo "${change_password}" | htpasswd -i -s /etc/nginx/.htpasswd-tahoelafs ${change_username}
98
     echo "${change_password}" | htpasswd -i -s /etc/nginx/.htpasswd-tahoelafs ${change_username}
164
         TAHOELAFS_SHARES_TOTAL=${tl_total}
169
         TAHOELAFS_SHARES_TOTAL=${tl_total}
165
     fi
170
     fi
166
 
171
 
167
-    sed -i "s|shares.needed.*|shares.needed = ${TAHOELAFS_SHARES_NEEDED}|g" /home/tahoelafs/tahoelafs/client/tahoe.cfg
168
-    sed -i "s|shares.happy.*|shares.happy = ${TAHOELAFS_SHARES_HAPPY}|g" /home/tahoelafs/tahoelafs/client/tahoe.cfg
169
-    sed -i "s|shares.total.*|shares.total = ${TAHOELAFS_SHARES_TOTAL}|g" /home/tahoelafs/tahoelafs/client/tahoe.cfg
172
+    sed -i "s|shares.needed.*|shares.needed = ${TAHOELAFS_SHARES_NEEDED}|g" $TAHOE_DIR/tahoelafs/client/tahoe.cfg
173
+    sed -i "s|shares.happy.*|shares.happy = ${TAHOELAFS_SHARES_HAPPY}|g" $TAHOE_DIR/tahoelafs/client/tahoe.cfg
174
+    sed -i "s|shares.total.*|shares.total = ${TAHOELAFS_SHARES_TOTAL}|g" $TAHOE_DIR/tahoelafs/client/tahoe.cfg
170
 
175
 
171
-    sed -i "s|shares.needed.*|shares.needed = ${TAHOELAFS_SHARES_NEEDED}|g" /home/tahoelafs/tahoelafs/storage/tahoe.cfg
172
-    sed -i "s|shares.happy.*|shares.happy = ${TAHOELAFS_SHARES_HAPPY}|g" /home/tahoelafs/tahoelafs/storage/tahoe.cfg
173
-    sed -i "s|shares.total.*|shares.total = ${TAHOELAFS_SHARES_TOTAL}|g" /home/tahoelafs/tahoelafs/storage/tahoe.cfg
176
+    sed -i "s|shares.needed.*|shares.needed = ${TAHOELAFS_SHARES_NEEDED}|g" $TAHOE_DIR/tahoelafs/storage/tahoe.cfg
177
+    sed -i "s|shares.happy.*|shares.happy = ${TAHOELAFS_SHARES_HAPPY}|g" $TAHOE_DIR/tahoelafs/storage/tahoe.cfg
178
+    sed -i "s|shares.total.*|shares.total = ${TAHOELAFS_SHARES_TOTAL}|g" $TAHOE_DIR/tahoelafs/storage/tahoe.cfg
174
 
179
 
175
     systemctl restart tahoelafs-storage
180
     systemctl restart tahoelafs-storage
176
     systemctl restart tahoelafs-client
181
     systemctl restart tahoelafs-client
263
     echo '[connections]' >> $config_file
268
     echo '[connections]' >> $config_file
264
     echo 'tcp = tor' >> $config_file
269
     echo 'tcp = tor' >> $config_file
265
 
270
 
266
-    chown -R tahoelafs:debian-tor /home/tahoelafs
271
+    chown -R tahoelafs:debian-tor $TAHOE_DIR
267
 }
272
 }
268
 
273
 
269
 function install_interactive_tahoelafs {
274
 function install_interactive_tahoelafs {
272
 }
277
 }
273
 
278
 
274
 function upgrade_tahoelafs {
279
 function upgrade_tahoelafs {
275
-    if [ ! -d /home/tahoelafs/tahoelafs ]; then
276
-        return
277
-    fi
278
-    systemctl stop tahoelafs
279
-    function_check set_repo_commit
280
-    set_repo_commit /home/tahoelafs/tahoelafs "tahoelafs commit" "$TAHOELAFS_COMMIT" $TAHOELAFS_REPO
281
-    cd /home/tahoelafs/tahoelafs
282
-    git submodule update --init --recursive
283
-    virtualenv venv
284
-    venv/bin/pip install --editable .
285
-    chown -R tahoelafs:debian-tor /home/tahoelafs
286
-    systemctl start tahoelafs
280
+    echo -n ''
287
 }
281
 }
288
 
282
 
289
 function backup_local_tahoelafs {
283
 function backup_local_tahoelafs {
290
-    source_directory=/home/tahoelafs
284
+    source_directory=$TAHOE_DIR
291
     if [ ! -d $source_directory ]; then
285
     if [ ! -d $source_directory ]; then
292
         return
286
         return
293
     fi
287
     fi
304
     systemctl stop tahoelafs-client
298
     systemctl stop tahoelafs-client
305
     temp_restore_dir=/root/temptahoelafs
299
     temp_restore_dir=/root/temptahoelafs
306
     restore_directory_from_usb $temp_restore_dir tahoelafs
300
     restore_directory_from_usb $temp_restore_dir tahoelafs
307
-    mv /home/tahoelafs /home/tahoelafs-old
308
-    cp -r $temp_restore_dir/home/tahoelafs /home/tahoelafs
301
+    mv $TAHOE_DIR ${TAHOE_DIR}-old
302
+    cp -r $temp_restore_dir$TAHOE_DIR $TAHOE_DIR
309
     if [ ! "$?" = "0" ]; then
303
     if [ ! "$?" = "0" ]; then
310
-        mv /home/tahoelafs-old /home/tahoelafs
304
+        mv ${TAHOE_DIR}-old $TAHOE_DIR
311
         exit 246833
305
         exit 246833
312
     fi
306
     fi
313
-    rm -rf /home/tahoelafs-old
314
-    chown -R tahoelafs:debian-tor /home/tahoelafs
307
+    rm -rf ${TAHOE_DIR}-old
308
+    chown -R tahoelafs:debian-tor $TAHOE_DIR
315
     systemctl start tahoelafs-client
309
     systemctl start tahoelafs-client
316
     systemctl start tahoelafs-storage
310
     systemctl start tahoelafs-storage
317
     echo $"Restore complete"
311
     echo $"Restore complete"
318
 }
312
 }
319
 
313
 
320
 function backup_remote_tahoelafs {
314
 function backup_remote_tahoelafs {
321
-    source_directory=/home/tahoelafs
315
+    source_directory=$TAHOE_DIR
322
     if [ ! -d $source_directory ]; then
316
     if [ ! -d $source_directory ]; then
323
         return
317
         return
324
     fi
318
     fi
337
     systemctl stop tahoelafs-client
331
     systemctl stop tahoelafs-client
338
     temp_restore_dir=/root/temptahoelafs
332
     temp_restore_dir=/root/temptahoelafs
339
     restore_directory_from_friend $temp_restore_dir tahoelafs
333
     restore_directory_from_friend $temp_restore_dir tahoelafs
340
-    mv /home/tahoelafs /home/tahoelafs-old
341
-    cp -r $temp_restore_dir/home/tahoelafs /home/tahoelafs
334
+    mv $TAHOE_DIR ${TAHOE_DIR}-old
335
+    cp -r $temp_restore_dir$TAHOE_DIR $TAHOE_DIR
342
     if [ ! "$?" = "0" ]; then
336
     if [ ! "$?" = "0" ]; then
343
-        mv /home/tahoelafs-old /home/tahoelafs
337
+        mv ${TAHOE_DIR}old $TAHOE_DIR
344
         exit 623925
338
         exit 623925
345
     fi
339
     fi
346
-    rm -rf /home/tahoelafs-old
347
-    chown -R tahoelafs:debian-tor /home/tahoelafs
340
+    rm -rf ${$TAHOE_DIR}-old
341
+    chown -R tahoelafs:debian-tor $TAHOE_DIR
348
     systemctl start tahoelafs-client
342
     systemctl start tahoelafs-client
349
     systemctl start tahoelafs-storage
343
     systemctl start tahoelafs-storage
350
     echo $"Restore complete"
344
     echo $"Restore complete"
370
     systemctl stop tahoelafs-storage
364
     systemctl stop tahoelafs-storage
371
     systemctl disable tahoelafs-storage
365
     systemctl disable tahoelafs-storage
372
     rm /etc/systemd/system/tahoelafs-storage.service
366
     rm /etc/systemd/system/tahoelafs-storage.service
367
+    systemctl daemon-reload
373
 
368
 
374
     systemctl stop tahoelafs-client
369
     systemctl stop tahoelafs-client
375
     systemctl disable tahoelafs-client
370
     systemctl disable tahoelafs-client
376
     rm /etc/systemd/system/tahoelafs-client.service
371
     rm /etc/systemd/system/tahoelafs-client.service
372
+    systemctl daemon-reload
373
+
374
+    pip uninstall tahoe-lafs[tor]
375
+    apt-get -yq remove tahoe-lafs
377
 
376
 
378
     if [ -d /var/lib/tahoelafs ]; then
377
     if [ -d /var/lib/tahoelafs ]; then
379
         rm -rf /var/lib/tahoelafs
378
         rm -rf /var/lib/tahoelafs
383
     remove_onion_service tahoelafs ${TAHOELAFS_ONION_PORT}
382
     remove_onion_service tahoelafs ${TAHOELAFS_ONION_PORT}
384
     remove_onion_service storage-tahoelafs ${TAHOELAFS_STORAGE_ONION_PORT} $(get_tahoelafs_nick)
383
     remove_onion_service storage-tahoelafs ${TAHOELAFS_STORAGE_ONION_PORT} $(get_tahoelafs_nick)
385
     sed -i '/HidServAuth /d' /etc/tor/torrc
384
     sed -i '/HidServAuth /d' /etc/tor/torrc
386
-    deluser tahoelafs
387
-    if [ -d /home/tahoelafs ]; then
388
-        rm -rf /home/tahoelafs
385
+
386
+    groupdel -f tahoelafs
387
+    userdel -r tahoelafs
388
+
389
+    if [ -d $TAHOE_DIR ]; then
390
+        rm -rf $TAHOE_DIR
389
     fi
391
     fi
390
     remove_app tahoelafs
392
     remove_app tahoelafs
391
     if [ -f /etc/nginx/.htpasswd-tahoelafs ]; then
393
     if [ -f /etc/nginx/.htpasswd-tahoelafs ]; then
392
         shred -zu /etc/nginx/.htpasswd-tahoelafs
394
         shred -zu /etc/nginx/.htpasswd-tahoelafs
393
     fi
395
     fi
394
-    remove_completion_param "tahoelafs commit"
395
-    systemctl reload tor
396
-}
397
-
398
-function install_tahoelafs_to_directory {
399
-    tahoe_dir=$1
400
-
401
-    git_clone $TAHOELAFS_REPO $tahoe_dir
402
-    cd $tahoe_dir
403
-    git checkout $TAHOELAFS_COMMIT -b $TAHOELAFS_COMMIT
404
-    git submodule update --init --recursive
405
-    virtualenv venv --distribute
406
-    venv/bin/pip uninstall --yes setuptools
407
-    venv/bin/pip install setuptools==11.3
408
-    venv/bin/pip install six==1.10.0 packaging==16.8 attrs==16.3.0 appdirs==1.4.2 pycrypto==2.1.0 cffi==1.9.1
409
-    venv/bin/pip install cryptography==1.7.2 markerlib==0.6.0 distribute==0.7.3
410
-    venv/bin/pip install txtorcon==0.18.0
411
-    venv/bin/pip install --editable .
396
+    onion_update
412
 }
397
 }
413
 
398
 
414
 function create_tahoelafs_stealth_node {
399
 function create_tahoelafs_stealth_node {
496
 }
481
 }
497
 
482
 
498
 function get_tahoelafs_furl {
483
 function get_tahoelafs_furl {
499
-    furl=$(cat /home/tahoelafs/storage/private/storage.furl)
484
+    furl=$(cat $TAHOE_DIR/storage/private/storage.furl)
500
     furl_1=$(echo "${furl}" | awk -F ' ' '{print $1}')
485
     furl_1=$(echo "${furl}" | awk -F ' ' '{print $1}')
501
     furl_2=$(echo "${furl}" | awk -F ':' '{print $5}')
486
     furl_2=$(echo "${furl}" | awk -F ':' '{print $5}')
502
     echo "${furl_1}:${furl_2}"
487
     echo "${furl_1}:${furl_2}"
511
 }
496
 }
512
 
497
 
513
 function get_tahoelafs_public_key {
498
 function get_tahoelafs_public_key {
514
-    echo "$(cat /home/tahoelafs/storage/node.pubkey | grep 'v0-' | sed 's|pub-||g')"
499
+    echo "$(cat $TAHOE_DIR/storage/node.pubkey | grep 'v0-' | sed 's|pub-||g')"
515
 }
500
 }
516
 
501
 
517
 function add_tahoelafs_server {
502
 function add_tahoelafs_server {
572
     echo 'Type=simple' >> $TAHOELAFS_DAEMON_FILE
557
     echo 'Type=simple' >> $TAHOELAFS_DAEMON_FILE
573
     echo "User=tahoelafs" >> $TAHOELAFS_DAEMON_FILE
558
     echo "User=tahoelafs" >> $TAHOELAFS_DAEMON_FILE
574
     echo "Group=debian-tor" >> $TAHOELAFS_DAEMON_FILE
559
     echo "Group=debian-tor" >> $TAHOELAFS_DAEMON_FILE
575
-    echo "WorkingDirectory=/home/tahoelafs/tahoelafs" >> $TAHOELAFS_DAEMON_FILE
576
-    echo "ExecStart=/home/tahoelafs/tahoelafs/venv/bin/tahoe run /home/tahoelafs/${daemon_name}" >> $TAHOELAFS_DAEMON_FILE
577
-    echo "ExecStop=/home/tahoelafs/tahoelafs/venv/bin/tahoe stop /home/tahoelafs/${daemon_name}" >> $TAHOELAFS_DAEMON_FILE
560
+    echo "WorkingDirectory=${TAHOE_DIR}" >> $TAHOELAFS_DAEMON_FILE
561
+    echo "ExecStart=/usr/bin/tahoe run ${TAHOE_DIR}/${daemon_name}" >> $TAHOELAFS_DAEMON_FILE
562
+    echo "ExecStop=/usr/bin/tahoe stop ${TAHOE_DIR}/${daemon_name}" >> $TAHOELAFS_DAEMON_FILE
578
     echo 'Restart=on-failure' >> $TAHOELAFS_DAEMON_FILE
563
     echo 'Restart=on-failure' >> $TAHOELAFS_DAEMON_FILE
579
     echo 'RestartSec=10' >> $TAHOELAFS_DAEMON_FILE
564
     echo 'RestartSec=10' >> $TAHOELAFS_DAEMON_FILE
580
-    echo "Environment=\"USER=tahoelafs\" \"HOME=/home/tahoelafs\"" >> $TAHOELAFS_DAEMON_FILE
565
+    echo "Environment=\"USER=tahoelafs\" \"HOME=${TAHOE_DIR}\"" >> $TAHOELAFS_DAEMON_FILE
581
     echo '' >> $TAHOELAFS_DAEMON_FILE
566
     echo '' >> $TAHOELAFS_DAEMON_FILE
582
     echo '[Install]' >> $TAHOELAFS_DAEMON_FILE
567
     echo '[Install]' >> $TAHOELAFS_DAEMON_FILE
583
     echo 'WantedBy=multi-user.target' >> $TAHOELAFS_DAEMON_FILE
568
     echo 'WantedBy=multi-user.target' >> $TAHOELAFS_DAEMON_FILE
627
     if [ ! -f /etc/nginx/.htpasswd-tahoelafs ]; then
612
     if [ ! -f /etc/nginx/.htpasswd-tahoelafs ]; then
628
         touch /etc/nginx/.htpasswd-tahoelafs
613
         touch /etc/nginx/.htpasswd-tahoelafs
629
     fi
614
     fi
630
-    if grep "${MY_USERNAME}:" /etc/nginx/.htpasswd-tahoelafs; then
615
+    if grep -q "${MY_USERNAME}:" /etc/nginx/.htpasswd-tahoelafs; then
631
         sed -i '/${MY_USERNAME}:/d' /etc/nginx/.htpasswd-tahoelafs
616
         sed -i '/${MY_USERNAME}:/d' /etc/nginx/.htpasswd-tahoelafs
632
     fi
617
     fi
633
     echo "${TAHOELAFS_ADMIN_PASSWORD}" | htpasswd -i -s /etc/nginx/.htpasswd-tahoelafs ${MY_USERNAME}
618
     echo "${TAHOELAFS_ADMIN_PASSWORD}" | htpasswd -i -s /etc/nginx/.htpasswd-tahoelafs ${MY_USERNAME}
643
     fi
628
     fi
644
 
629
 
645
     apt-get -yq install build-essential python-pip python-dev libffi-dev libssl-dev
630
     apt-get -yq install build-essential python-pip python-dev libffi-dev libssl-dev
646
-    apt-get -yq install libcrypto++-dev python-pycryptopp python-cffi python-virtualenv
631
+    apt-get -yq install libcrypto++-dev python-pycryptopp python-cffi
632
+    apt-get -yq install python-virtualenv apache2-utils
647
 
633
 
648
-    # create a user
649
-    if [ ! -d /home/tahoelafs ]; then
650
-        # add a gogs user account
651
-        adduser --disabled-login --gecos 'tahoe-lafs' tahoelafs
652
-        adduser tahoelafs debian-tor
634
+    if [ -d $TAHOE_DIR ]; then
635
+        groupdel -f tahoelafs
636
+        userdel -r tahoelafs
637
+        rm -rf $TAHOE_DIR
653
     fi
638
     fi
654
 
639
 
655
-    if [ -d /home/tahoelafs/Maildir ]; then
656
-        rm -rf /home/tahoelafs/Maildir
640
+    # create a user
641
+    adduser --disabled-login --gecos 'tahoe-lafs' tahoelafs
642
+
643
+    if [ ! -d $TAHOE_DIR ]; then
644
+        echo $"$TAHOE_DIR directory was not created"
645
+        exit 879335
657
     fi
646
     fi
658
 
647
 
659
-    install_tahoelafs_to_directory /home/tahoelafs/tahoelafs
648
+    adduser tahoelafs debian-tor
649
+    groupadd tahoelafs
650
+
651
+    apt-get -yq install tahoe-lafs
652
+    pip install tahoe-lafs[tor]
653
+
654
+    if [ -d $TAHOE_DIR/Maildir ]; then
655
+        rm -rf $TAHOE_DIR/Maildir
656
+    fi
660
 
657
 
661
     # remove files we don't need
658
     # remove files we don't need
662
-    rm -rf /home/tahoelafs/.mutt
663
-    rm /home/tahoelafs/.emacs-mutt
664
-    rm /home/tahoelafs/.muttrc
665
-    rm /home/tahoelafs/.mutt-alias
666
-    rm /home/tahoelafs/.procmailrc
659
+    rm -rf $TAHOE_DIR/.mutt
660
+    rm $TAHOE_DIR/.emacs-mutt
661
+    rm $TAHOE_DIR/.muttrc
662
+    rm $TAHOE_DIR/.mutt-alias
663
+    rm $TAHOE_DIR/.procmailrc
667
 
664
 
668
     # set permissions
665
     # set permissions
669
-    chown -R tahoelafs:debian-tor /home/tahoelafs
666
+    chown -R tahoelafs:debian-tor $TAHOE_DIR
670
 
667
 
671
     node_nick=$(get_tahoelafs_nick)
668
     node_nick=$(get_tahoelafs_nick)
672
     client_nick=${MY_USERNAME}-client
669
     client_nick=${MY_USERNAME}-client
677
     # create an onion address for client node
674
     # create an onion address for client node
678
     TAHOELAFS_ONION_HOSTNAME=$(add_onion_service tahoelafs 80 ${TAHOELAFS_ONION_PORT})
675
     TAHOELAFS_ONION_HOSTNAME=$(add_onion_service tahoelafs 80 ${TAHOELAFS_ONION_PORT})
679
 
676
 
680
-    create_tahoelafs_stealth_node /home/tahoelafs/storage /home/tahoelafs/client ${node_nick} ${client_nick}
677
+    create_tahoelafs_stealth_node $TAHOE_DIR/storage $TAHOE_DIR/client ${node_nick} ${client_nick}
681
 
678
 
682
     # start the storage node
679
     # start the storage node
683
-    su -c '/home/tahoelafs/tahoelafs/venv/bin/python2 /home/tahoelafs/tahoelafs/venv/bin/tahoe start /home/tahoelafs/storage' - tahoelafs
680
+    su -c "/usr/bin/python2 /usr/bin/tahoe start $TAHOE_DIR/storage" - tahoelafs
684
     create_tahoelafs_daemon "storage"
681
     create_tahoelafs_daemon "storage"
685
 
682
 
686
     # start the client
683
     # start the client
687
-    su -c '/home/tahoelafs/tahoelafs/venv/bin/python2 /home/tahoelafs/tahoelafs/venv/bin/tahoe start /home/tahoelafs/client' - tahoelafs
684
+    su -c "/usr/bin/python2 /usr/bin/tahoe start $TAHOE_DIR/client" - tahoelafs
688
     add_tahoelafs_server "$(get_tahoelafs_storage_hostname)" "$(get_tahoelafs_public_key)" "${node_nick}" "$(get_tahoelafs_furl)"
685
     add_tahoelafs_server "$(get_tahoelafs_storage_hostname)" "$(get_tahoelafs_public_key)" "${node_nick}" "$(get_tahoelafs_furl)"
689
     if ! grep -q "HidServAuth $(get_tahoelafs_storage_hostname)" /etc/tor/torrc; then
686
     if ! grep -q "HidServAuth $(get_tahoelafs_storage_hostname)" /etc/tor/torrc; then
690
         echo $'Unable to create tahoelafs server'
687
         echo $'Unable to create tahoelafs server'
696
     fi
693
     fi
697
     create_tahoelafs_daemon "client"
694
     create_tahoelafs_daemon "client"
698
 
695
 
699
-    set_completion_param "tahoelafs commit" "$TAHOELAFS_COMMIT"
700
     set_completion_param "tahoelafs onion domain" "$TAHOELAFS_ONION_HOSTNAME"
696
     set_completion_param "tahoelafs onion domain" "$TAHOELAFS_ONION_HOSTNAME"
701
 
697
 
702
     create_tahoelafs_web
698
     create_tahoelafs_web
703
-    systemctl restart tor
699
+    onion_update
704
     APP_INSTALLED=1
700
     APP_INSTALLED=1
705
 }
701
 }
706
 
702
 

+ 68
- 16
src/freedombone-app-tox View File

35
 
35
 
36
 TOX_PORT=33445
36
 TOX_PORT=33445
37
 TOXCORE_REPO="https://github.com/bashrc/toxcore"
37
 TOXCORE_REPO="https://github.com/bashrc/toxcore"
38
-TOXCORE_COMMIT='d3fa9f82bda3a8746917502c525237427ba17d45'
38
+TOXCORE_COMMIT='532629d486e3361c7d8d95b38293cc7d61dc4ee5'
39
 TOXID_REPO="https://github.com/bashrc/toxid"
39
 TOXID_REPO="https://github.com/bashrc/toxid"
40
 TOX_BOOTSTRAP_ID_FILE=/var/lib/tox-bootstrapd/pubkey.txt
40
 TOX_BOOTSTRAP_ID_FILE=/var/lib/tox-bootstrapd/pubkey.txt
41
 # These are some default nodes, but you can replace them with trusted nodes
41
 # These are some default nodes, but you can replace them with trusted nodes
60
                TOX_PORT
60
                TOX_PORT
61
                TOX_NODES)
61
                TOX_NODES)
62
 
62
 
63
+function logging_on_tox {
64
+    echo -n ''
65
+}
66
+
67
+function logging_off_tox {
68
+    echo -n ''
69
+}
70
+
63
 function remove_user_tox {
71
 function remove_user_tox {
64
     remove_username="$1"
72
     remove_username="$1"
65
 
73
 
122
         mkdir -p ${rootdir}$INSTALL_DIR
130
         mkdir -p ${rootdir}$INSTALL_DIR
123
     fi
131
     fi
124
 
132
 
125
-    chroot "${rootdir}" apt-get -yq install build-essential libatk1.0-0 libbz2-1.0 libc6 libcairo2 libdbus-1-3 libegl1-mesa libfontconfig1 libfreetype6 libgcc1 libgdk-pixbuf2.0-0 libgl1-mesa-glx libglib2.0-0 libgtk2.0-0 libice6 libicu52 libjpeg62-turbo libmng1 libmtdev1 libopenal1 libopus0 libpango-1.0-0 libpangocairo-1.0-0 libpangoft2-1.0-0 libpng12-0 libqrencode3 libsm6 libsodium13 libsqlite3-0 libssl1.0.0 libstdc++6 libtiff5 libudev1 libvpx1 libwayland-client0 libwayland-cursor0 libwayland-egl1-mesa libwebp5 libx11-6 libx11-xcb1 libxcb-glx0 libxcb-icccm4 libxcb-image0 libxcb-keysyms1 libxcb-randr0 libxcb-render-util0 libxcb-render0 libxcb-shape0 libxcb-shm0 libxcb-sync1 libxcb-xfixes0 libxcb-xinerama0 libxcb1 libxext6 libxfixes3 libxi6 libxrender1 libxss1 zlib1g libopus-dev libvpx-dev
126
-    chroot "${rootdir}" apt-get -yq install build-essential qt5-qmake qt5-default qttools5-dev-tools libqt5opengl5-dev libqt5svg5-dev libopenal-dev libxss-dev qrencode libqrencode-dev libglib2.0-dev libgdk-pixbuf2.0-dev libgtk2.0-dev libsqlcipher-dev libopus-dev libvpx-dev libavformat-dev libavdevice-dev libswscale-dev libavutil-dev libavcodec-dev libavcodec56 libavcodec57 libavfilter-dev libavfilter6
133
+    chroot "${rootdir}" apt-get -yq install build-essential libatk1.0-0 libbz2-1.0 libc6 libcairo2 libdbus-1-3 libegl1-mesa libfontconfig1 libfreetype6 libgcc1 libgdk-pixbuf2.0-0 libgl1-mesa-glx libglib2.0-0 libgtk2.0-0 libice6 libicu57 libjpeg62-turbo libmng1 libmtdev1 libopenal1 libopus0 libpango-1.0-0 libpangocairo-1.0-0 libpangoft2-1.0-0 libpng16-16 libqrencode3 libsm6 libsodium18 libsqlite3-0 libssl1.1 libstdc++6 libtiff5 libudev1 libvpx4 libwayland-client0 libwayland-cursor0 libwayland-egl1-mesa libwebp6 libx11-6 libx11-xcb1 libxcb-glx0 libxcb-icccm4 libxcb-image0 libxcb-keysyms1 libxcb-randr0 libxcb-render-util0 libxcb-render0 libxcb-shape0 libxcb-shm0 libxcb-sync1 libxcb-xfixes0 libxcb-xinerama0 libxcb1 libxext6 libxfixes3 libxi6 libxrender1 libxss1 zlib1g libopus-dev libvpx-dev
134
+    chroot "${rootdir}" apt-get -yq install build-essential qt5-qmake qt5-default qttools5-dev-tools libqt5opengl5-dev libqt5svg5-dev libopenal-dev libxss-dev qrencode libqrencode-dev libglib2.0-dev libgdk-pixbuf2.0-dev libgtk2.0-dev libsqlcipher-dev libopus-dev libvpx-dev libavformat-dev libavdevice-dev libswscale-dev libavutil-dev libavcodec-dev libavcodec57 libavfilter-dev libavfilter6
127
 
135
 
128
-    mesh_install_ffmpeg
136
+    # ffmpeg
137
+    chroot "${rootdir}" apt-get -yq install build-essential
138
+    chroot "${rootdir}" apt-get -yq install ffmpeg libmp3lame-dev libvorbis-dev libtheora-dev
139
+    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
141
+
142
+    if [ -d /repos/qtox ]; then
143
+        mkdir ${rootdir}$INSTALL_DIR/qtox
144
+        cp -r -p /repos/qtox/. ${rootdir}$INSTALL_DIR/qtox
145
+        cd ${rootdir}$INSTALL_DIR/qtox
146
+        git pull
147
+    else
148
+        git clone $QTOX_REPO ${rootdir}$INSTALL_DIR/qtox
149
+    fi
129
 
150
 
130
-    git clone $QTOX_REPO ${rootdir}$INSTALL_DIR/qtox
131
     if [ ! -d ${rootdir}$INSTALL_DIR/qtox ]; then
151
     if [ ! -d ${rootdir}$INSTALL_DIR/qtox ]; then
132
         exit 72428
152
         exit 72428
133
     fi
153
     fi
323
 
343
 
324
     # install a command to obtain the Tox ID
344
     # install a command to obtain the Tox ID
325
     cd $INSTALL_DIR
345
     cd $INSTALL_DIR
326
-    function_check git_clone
327
-    git_clone $TOXID_REPO $INSTALL_DIR/toxid
346
+
347
+    if [ -d /repos/toxid ]; then
348
+        mkdir $INSTALL_DIR/toxid
349
+        cp -r -p /repos/toxid/. $INSTALL_DIR/toxid
350
+        cd $INSTALL_DIR/toxid
351
+        git pull
352
+    else
353
+        function_check git_clone
354
+        git_clone $TOXID_REPO $INSTALL_DIR/toxid
355
+    fi
356
+
328
     if [ ! -d $INSTALL_DIR/toxid ]; then
357
     if [ ! -d $INSTALL_DIR/toxid ]; then
329
         exit 63921
358
         exit 63921
330
     fi
359
     fi
442
     if [ $rootdir ]; then
471
     if [ $rootdir ]; then
443
         chroot ${rootdir} apt-get -yq install build-essential libtool autotools-dev
472
         chroot ${rootdir} apt-get -yq install build-essential libtool autotools-dev
444
         chroot ${rootdir} apt-get -yq install automake checkinstall check git yasm
473
         chroot ${rootdir} apt-get -yq install automake checkinstall check git yasm
445
-        chroot ${rootdir} apt-get -yq install libsodium13 libsodium-dev libcap2-bin
474
+        chroot ${rootdir} apt-get -yq install libsodium18 libsodium-dev libcap2-bin
446
         chroot ${rootdir} apt-get -yq install libconfig9 libconfig-dev autoconf
475
         chroot ${rootdir} apt-get -yq install libconfig9 libconfig-dev autoconf
447
         chroot ${rootdir} apt-get -yq install libopus-dev libvpx-dev
476
         chroot ${rootdir} apt-get -yq install libopus-dev libvpx-dev
448
     else
477
     else
449
         apt-get -yq install build-essential libtool autotools-dev
478
         apt-get -yq install build-essential libtool autotools-dev
450
         apt-get -yq install automake checkinstall check git yasm
479
         apt-get -yq install automake checkinstall check git yasm
451
-        apt-get -yq install libsodium13 libsodium-dev libcap2-bin
480
+        apt-get -yq install libsodium18 libsodium-dev libcap2-bin
452
         apt-get -yq install libconfig9 libconfig-dev autoconf
481
         apt-get -yq install libconfig9 libconfig-dev autoconf
453
         apt-get -yq install libopus-dev libvpx-dev
482
         apt-get -yq install libopus-dev libvpx-dev
454
     fi
483
     fi
457
         mkdir -p ${rootdir}${INSTALL_DIR}
486
         mkdir -p ${rootdir}${INSTALL_DIR}
458
     fi
487
     fi
459
     if [ ! -d ${rootdir}${INSTALL_DIR}/toxcore ]; then
488
     if [ ! -d ${rootdir}${INSTALL_DIR}/toxcore ]; then
460
-        git clone ${TOXCORE_REPO} ${rootdir}${INSTALL_DIR}/toxcore
461
-        if [ ! "$?" = "0" ]; then
462
-            exit 429252
489
+        if [ -d /repos/toxcore ]; then
490
+            mkdir ${rootdir}${INSTALL_DIR}/toxcore
491
+            cp -r -p /repos/toxcore/. ${rootdir}${INSTALL_DIR}/toxcore
492
+            cd ${rootdir}${INSTALL_DIR}/toxcore
493
+            git pull
494
+        else
495
+            git clone ${TOXCORE_REPO} ${rootdir}${INSTALL_DIR}/toxcore
496
+            if [ ! "$?" = "0" ]; then
497
+                exit 429252
498
+            fi
463
         fi
499
         fi
464
     fi
500
     fi
465
     cd ${rootdir}$INSTALL_DIR/toxcore
501
     cd ${rootdir}$INSTALL_DIR/toxcore
580
         mkdir -p ${rootdir}${INSTALL_DIR}
616
         mkdir -p ${rootdir}${INSTALL_DIR}
581
     fi
617
     fi
582
 
618
 
583
-    git clone ${TOXID_REPO} ${rootdir}${INSTALL_DIR}/toxid
619
+    if [ -d /repos/toxid ]; then
620
+        mkdir ${rootdir}${INSTALL_DIR}/toxid
621
+        cp -r -p /repos/toxid/. ${rootdir}${INSTALL_DIR}/toxid
622
+        cd ${rootdir}${INSTALL_DIR}/toxid
623
+        git pull
624
+    else
625
+        git clone ${TOXID_REPO} ${rootdir}${INSTALL_DIR}/toxid
626
+    fi
627
+
584
     if [ ! -d ${rootdir}${INSTALL_DIR}/toxid ]; then
628
     if [ ! -d ${rootdir}${INSTALL_DIR}/toxid ]; then
585
         echo $'Unable to clone toxid repo'
629
         echo $'Unable to clone toxid repo'
586
         exit 768352
630
         exit 768352
647
     TEMP_SCRIPT=/tmp/$TEMP_SCRIPT_NAME
691
     TEMP_SCRIPT=/tmp/$TEMP_SCRIPT_NAME
648
     echo '#!/bin/bash' > $TEMP_SCRIPT
692
     echo '#!/bin/bash' > $TEMP_SCRIPT
649
     echo "mkdir -p $INSTALL_DIR" >> $TEMP_SCRIPT
693
     echo "mkdir -p $INSTALL_DIR" >> $TEMP_SCRIPT
650
-    echo "git clone $TOXIC_REPO $INSTALL_DIR/toxic" >> $TEMP_SCRIPT
694
+    echo 'if [ -d /repos/toxic ]; then' >> $TEMP_SCRIPT
695
+    echo "    mkdir $INSTALL_DIR/toxic" >> $TEMP_SCRIPT
696
+    echo "    cp -r -p /repos/toxic/. $INSTALL_DIR/toxic" >> $TEMP_SCRIPT
697
+    echo "    cd $INSTALL_DIR/toxic" >> $TEMP_SCRIPT
698
+    echo '    git pull' >> $TEMP_SCRIPT
699
+    echo 'else' >> $TEMP_SCRIPT
700
+    echo "    git clone $TOXIC_REPO $INSTALL_DIR/toxic" >> $TEMP_SCRIPT
701
+    echo 'fi' >> $TEMP_SCRIPT
651
     echo "cd $INSTALL_DIR/toxic" >> $TEMP_SCRIPT
702
     echo "cd $INSTALL_DIR/toxic" >> $TEMP_SCRIPT
652
     echo "git checkout $TOXIC_COMMIT -b $TOXIC_COMMIT" >> $TEMP_SCRIPT
703
     echo "git checkout $TOXIC_COMMIT -b $TOXIC_COMMIT" >> $TEMP_SCRIPT
653
     echo 'make' >> $TEMP_SCRIPT
704
     echo 'make' >> $TEMP_SCRIPT
668
         /root/$TEMP_SCRIPT_NAME
719
         /root/$TEMP_SCRIPT_NAME
669
     fi
720
     fi
670
     if [ ! "$?" = "0" ]; then
721
     if [ ! "$?" = "0" ]; then
722
+        cat -n /root/fbtmp728353.sh
671
         duration=$SECONDS
723
         duration=$SECONDS
672
         echo $"Toxic client compile failed at $(($duration / 60)) minutes and $(($duration % 60)) seconds elapsed."
724
         echo $"Toxic client compile failed at $(($duration / 60)) minutes and $(($duration % 60)) seconds elapsed."
673
         echo $'Unable to make tox client'
725
         echo $'Unable to make tox client'
684
 }
736
 }
685
 
737
 
686
 function enable_tox_repo {
738
 function enable_tox_repo {
687
-    echo 'deb http://download.opensuse.org/repositories/home:/antonbatenev:/tox/Debian_8.0/ /' > $rootdir/etc/apt/sources.list.d/tox.list
739
+    echo 'deb http://download.opensuse.org/repositories/home:/antonbatenev:/tox/Debian_9.0/ /' > $rootdir/etc/apt/sources.list.d/tox.list
688
 
740
 
689
 
741
 
690
     cat >> $rootdir/root/gettoxkey.sh <<EOF
742
     cat >> $rootdir/root/gettoxkey.sh <<EOF
691
 #!/bin/bash
743
 #!/bin/bash
692
-wget -q http://download.opensuse.org/repositories/home:antonbatenev:tox/Debian_8.0/Release.key -O- > /root/tox.key
744
+wget -q http://download.opensuse.org/repositories/home:antonbatenev:tox/Debian_9.0/Release.key -O- > /root/tox.key
693
 apt-key add /root/tox.key
745
 apt-key add /root/tox.key
694
 rm /root/tox.key
746
 rm /root/tox.key
695
 EOF
747
 EOF

+ 45
- 5
src/freedombone-app-turtl View File

59
                  MY_EMAIL_ADDRESS
59
                  MY_EMAIL_ADDRESS
60
                  MY_USERNAME)
60
                  MY_USERNAME)
61
 
61
 
62
+function logging_on_turtl {
63
+    echo -n ''
64
+}
65
+
66
+function logging_off_turtl {
67
+    echo -n ''
68
+}
69
+
62
 function change_password_turtl {
70
 function change_password_turtl {
63
     change_username="$1"
71
     change_username="$1"
64
     new_user_password="$2"
72
     new_user_password="$2"
90
 }
98
 }
91
 
99
 
92
 function turtl_disable_registrations {
100
 function turtl_disable_registrations {
93
-    if grep "$TURTL_SIGNUP_STRING" $turtl_users_file; then
101
+    if grep -q "$TURTL_SIGNUP_STRING" $turtl_users_file; then
94
         if [ -f $turtl_users_file ]; then
102
         if [ -f $turtl_users_file ]; then
95
             cp $turtl_users_file $TURTL_BASE_DIR/.users.lisp
103
             cp $turtl_users_file $TURTL_BASE_DIR/.users.lisp
96
             sed -i '/(route (:post "\/users") (req res)/,/(send-json res user))))/{//!d}' $turtl_users_file
104
             sed -i '/(route (:post "\/users") (req res)/,/(send-json res user))))/{//!d}' $turtl_users_file
102
 }
110
 }
103
 
111
 
104
 function turtl_enable_registrations {
112
 function turtl_enable_registrations {
105
-    if ! grep "$TURTL_SIGNUP_STRING" $turtl_users_file; then
113
+    if ! grep -q "$TURTL_SIGNUP_STRING" $turtl_users_file; then
106
         if [ -f $TURTL_BASE_DIR/.users.lisp ]; then
114
         if [ -f $TURTL_BASE_DIR/.users.lisp ]; then
107
             cp $TURTL_BASE_DIR/.users.lisp $turtl_users_file
115
             cp $TURTL_BASE_DIR/.users.lisp $turtl_users_file
108
             rm $TURTL_BASE_DIR/.users.lisp
116
             rm $TURTL_BASE_DIR/.users.lisp
186
 }
194
 }
187
 
195
 
188
 function upgrade_turtl {
196
 function upgrade_turtl {
197
+    CURR_TURTL_COMMIT=$(get_completion_param "turtl commit")
198
+    if [[ "$CURR_TURTL_COMMIT" == "$TURTL_COMMIT" ]]; then
199
+        return
200
+    fi
201
+
189
     read_config_param "TURTL_DOMAIN_NAME"
202
     read_config_param "TURTL_DOMAIN_NAME"
190
 
203
 
191
     function_check set_repo_commit
204
     function_check set_repo_commit
351
     systemctl stop turtl
364
     systemctl stop turtl
352
     systemctl disable turtl
365
     systemctl disable turtl
353
     rm /etc/systemd/system/turtl.service
366
     rm /etc/systemd/system/turtl.service
367
+    systemctl daemon-reload
368
+
354
     remove_rethinkdb
369
     remove_rethinkdb
355
     remove_app turtl
370
     remove_app turtl
356
     remove_completion_param install_turtl
371
     remove_completion_param install_turtl
357
     sed -i '/turtl/d' $COMPLETION_FILE
372
     sed -i '/turtl/d' $COMPLETION_FILE
358
-    deluser turtl
359
     nginx_dissite $TURTL_DOMAIN_NAME
373
     nginx_dissite $TURTL_DOMAIN_NAME
360
     if [ -f /etc/nginx/sites-available/$TURTL_DOMAIN_NAME ]; then
374
     if [ -f /etc/nginx/sites-available/$TURTL_DOMAIN_NAME ]; then
361
         rm /etc/nginx/sites-available/$TURTL_DOMAIN_NAME
375
         rm /etc/nginx/sites-available/$TURTL_DOMAIN_NAME
368
     rm -rf /etc/rethinkdb
382
     rm -rf /etc/rethinkdb
369
     rm -rf /var/lib/rethinkdb
383
     rm -rf /var/lib/rethinkdb
370
     rm -rf $TURTL_BASE_DIR
384
     rm -rf $TURTL_BASE_DIR
385
+
386
+    groupdel -f turtl
387
+    userdel -r turtl
371
 }
388
 }
372
 
389
 
373
 
390
 
433
     # start the turtl server
450
     # start the turtl server
434
     systemctl restart rethinkdb
451
     systemctl restart rethinkdb
435
 
452
 
453
+    if [ ! -f $TURTL_BASE_DIR/quicklisp/setup.lisp ]; then
454
+        echo $"$TURTL_BASE_DIR/quicklisp/setup.lisp was not found"
455
+        exit 6238234
456
+    fi
457
+
436
     echo '[Unit]' > /etc/systemd/system/turtl.service
458
     echo '[Unit]' > /etc/systemd/system/turtl.service
437
     echo 'Description=Note taking service' >> /etc/systemd/system/turtl.service
459
     echo 'Description=Note taking service' >> /etc/systemd/system/turtl.service
438
     echo 'Documentation=http://turtl.it' >> /etc/systemd/system/turtl.service
460
     echo 'Documentation=http://turtl.it' >> /etc/systemd/system/turtl.service
452
         if [[ "$check_architecture" != *"arm"* ]]; then
474
         if [[ "$check_architecture" != *"arm"* ]]; then
453
             echo "ExecStart=$TURTL_BASE_DIR/ccl/lx86cl -l $TURTL_BASE_DIR/quicklisp/setup.lisp -l launch.lisp" >> /etc/systemd/system/turtl.service
475
             echo "ExecStart=$TURTL_BASE_DIR/ccl/lx86cl -l $TURTL_BASE_DIR/quicklisp/setup.lisp -l launch.lisp" >> /etc/systemd/system/turtl.service
454
         else
476
         else
455
-            echo "ExecStart=$TURTL_BASE_DIR/ccl/larmcl -l $TURTL_BASE_DIR/quicklisp/setup.lisp -l launch.lisp" >> /etc/systemd/system/turtl.service
477
+            echo "ExecStart=$TURTL_BASE_DIR/ccl/armcl -l $TURTL_BASE_DIR/quicklisp/setup.lisp -l launch.lisp" >> /etc/systemd/system/turtl.service
456
         fi
478
         fi
457
     fi
479
     fi
458
     echo '' >> /etc/systemd/system/turtl.service
480
     echo '' >> /etc/systemd/system/turtl.service
561
         wget https://beta.quicklisp.org/quicklisp.lisp
583
         wget https://beta.quicklisp.org/quicklisp.lisp
562
     fi
584
     fi
563
 
585
 
586
+    if [ -d $TURTL_BASE_DIR ]; then
587
+        chown -R turtl:turtl $TURTL_BASE_DIR
588
+    fi
564
     adduser --disabled-login --home=$TURTL_BASE_DIR --gecos 'turtl' turtl
589
     adduser --disabled-login --home=$TURTL_BASE_DIR --gecos 'turtl' turtl
590
+    if [ ! -d $TURTL_BASE_DIR ]; then
591
+        echo $"$TURTL_BASE_DIR directory not created"
592
+        exit 263493
593
+    fi
594
+
595
+    groupadd turtl
565
     chown -R turtl:turtl $TURTL_BASE_DIR
596
     chown -R turtl:turtl $TURTL_BASE_DIR
566
 
597
 
567
     if [[ "$check_architecture" != *"arm"* ]]; then
598
     if [[ "$check_architecture" != *"arm"* ]]; then
581
 
612
 
582
     # install turtl API
613
     # install turtl API
583
     cd $TURTL_BASE_DIR/
614
     cd $TURTL_BASE_DIR/
584
-    git clone $TURTL_REPO $TURTL_BASE_DIR/api
615
+
616
+    if [ -d /repos/turtl ]; then
617
+        mkdir $TURTL_BASE_DIR/api
618
+        cp -r -p /repos/turtl/. $TURTL_BASE_DIR/api
619
+        cd $TURTL_BASE_DIR/api
620
+        git pull
621
+    else
622
+        git clone $TURTL_REPO $TURTL_BASE_DIR/api
623
+    fi
624
+
585
     cd $TURTL_BASE_DIR/api
625
     cd $TURTL_BASE_DIR/api
586
     git checkout $TURTL_COMMIT -b $TURTL_COMMIT
626
     git checkout $TURTL_COMMIT -b $TURTL_COMMIT
587
     set_completion_param "turtl commit" "$TURTL_COMMIT"
627
     set_completion_param "turtl commit" "$TURTL_COMMIT"

+ 8
- 0
src/freedombone-app-vim View File

39
 vim_variables=(MY_USERNAME
39
 vim_variables=(MY_USERNAME
40
                VIM_MUTT_EDITOR)
40
                VIM_MUTT_EDITOR)
41
 
41
 
42
+function logging_on_vim {
43
+    echo -n ''
44
+}
45
+
46
+function logging_off_vim {
47
+    echo -n ''
48
+}
49
+
42
 function reconfigure_vim {
50
 function reconfigure_vim {
43
     echo -n ''
51
     echo -n ''
44
 }
52
 }

+ 8
- 0
src/freedombone-app-vpn View File

35
 
35
 
36
 vpn_variables=()
36
 vpn_variables=()
37
 
37
 
38
+function logging_on_vpn {
39
+    echo -n ''
40
+}
41
+
42
+function logging_off_vpn {
43
+    echo -n ''
44
+}
45
+
38
 function install_interactive_vpn {
46
 function install_interactive_vpn {
39
     echo -n ''
47
     echo -n ''
40
     APP_INSTALLED=1
48
     APP_INSTALLED=1

+ 29
- 13
src/freedombone-app-xmpp View File

50
 prosody_modules_filename='prosody-modules-20170514.tar.gz'
50
 prosody_modules_filename='prosody-modules-20170514.tar.gz'
51
 prosody_modules_hash='ef404c203317cc0de6da7aaec4f21765a57f630adfbf082cf2dd92b881c15f86'
51
 prosody_modules_hash='ef404c203317cc0de6da7aaec4f21765a57f630adfbf082cf2dd92b881c15f86'
52
 
52
 
53
-LIBMESODE_REPO="https://github.com/boothj5/libmesode"
54
-LIBMESODE_COMMIT='e3db0e9bfba61b2d82193874343a94a88f910800'
55
-
56
-PROFANITY_REPO="https://github.com/boothj5/profanity"
57
-PROFANITY_COMMIT='2fafaec8a7dc9bc01ee894d83214590598b32914'
58
-
59
-PROFANITY_OMEMO_PLUGIN_REPO="https://github.com/ReneVolution/profanity-omemo-plugin"
60
-PROFANITY_OMEMO_PLUGIN_COMMIT='3ec8ec173656bed9761b740b086123e07c749548'
61
-
62
 xmpp_variables=(ONION_ONLY
53
 xmpp_variables=(ONION_ONLY
63
                 INSTALLED_WITHIN_DOCKER
54
                 INSTALLED_WITHIN_DOCKER
64
                 XMPP_CIPHERS
55
                 XMPP_CIPHERS
68
                 DEFAULT_DOMAIN_NAME
59
                 DEFAULT_DOMAIN_NAME
69
                 XMPP_DOMAIN_CODE)
60
                 XMPP_DOMAIN_CODE)
70
 
61
 
62
+function logging_on_xmpp {
63
+    if [ -d /etc/prosody ]; then
64
+        if [ ! -d /var/log/prosody ]; then
65
+            mkdir /var/log/prosody
66
+            chown root:adm /var/log/prosody
67
+        fi
68
+        sed -i 's|info = "/dev/null";|info = "/var/log/prosody/prosody.log";|g' /etc/prosody/prosody.cfg.lua
69
+        sed -i 's|error = "/dev/null";|error = "/var/log/prosody/prosody.err";|g' /etc/prosody/prosody.cfg.lua
70
+        sed -i 's|levels = { "error" }; to = "/dev/null";|levels = { "error" }; to = "syslog";|g' /etc/prosody/prosody.cfg.lua
71
+    fi
72
+}
73
+
74
+function logging_off_xmpp {
75
+    if [ -d /etc/prosody ]; then
76
+        sed -i 's|info = "/var/log/prosody/prosody.log";|info = "/dev/null";|g' /etc/prosody/prosody.cfg.lua
77
+        sed -i 's|error = "/var/log/prosody/prosody.err";|error = "/dev/null";|g' /etc/prosody/prosody.cfg.lua
78
+        sed -i 's|levels = { "error" }; to = "syslog";|levels = { "error" }; to = "/dev/null";|g' /etc/prosody/prosody.cfg.lua
79
+        $REMOVE_FILES_COMMAND /var/log/prosody/*
80
+        rm -rf /var/log/prosody
81
+    fi
82
+}
83
+
71
 function xmpp_add_onion_address {
84
 function xmpp_add_onion_address {
72
     domain_name="$1"
85
     domain_name="$1"
73
     onion_address="$2"
86
     onion_address="$2"
343
     fi
356
     fi
344
 
357
 
345
     # change to using pep rather than profile modules
358
     # change to using pep rather than profile modules
346
-    if grep '"pep"' /etc/prosody/prosody.cfg.lua; then
359
+    if grep -q '"pep"' /etc/prosody/prosody.cfg.lua; then
347
         # This strange dance seems to fix occasional breakage of PEP
360
         # This strange dance seems to fix occasional breakage of PEP
348
         # Is there a better solution?
361
         # Is there a better solution?
349
         sed -i 's|"pep"|"profile"|g' /etc/prosody/prosody.cfg.lua
362
         sed -i 's|"pep"|"profile"|g' /etc/prosody/prosody.cfg.lua
352
         sed -i 's|"profile"|"pep"|g' /etc/prosody/prosody.cfg.lua
365
         sed -i 's|"profile"|"pep"|g' /etc/prosody/prosody.cfg.lua
353
         systemctl restart prosody
366
         systemctl restart prosody
354
     fi
367
     fi
355
-    if ! grep '"vcard"' /etc/prosody/prosody.cfg.lua; then
368
+    if ! grep -q '"vcard"' /etc/prosody/prosody.cfg.lua; then
356
         systemctl stop prosody
369
         systemctl stop prosody
357
         sed -i '/"pep"/a "vcard";' /etc/prosody/prosody.cfg.lua
370
         sed -i '/"pep"/a "vcard";' /etc/prosody/prosody.cfg.lua
358
         systemctl start prosody
371
         systemctl start prosody
420
         set_completion_param "prosody_filename" "${prosody_filename}"
433
         set_completion_param "prosody_filename" "${prosody_filename}"
421
     fi
434
     fi
422
 
435
 
436
+    cp -r $INSTALL_DIR/prosody-modules/* /var/lib/prosody/prosody-modules/
437
+    chown -R prosody:prosody /var/lib/prosody/prosody-modules
438
+
423
     systemctl restart prosody
439
     systemctl restart prosody
424
 }
440
 }
425
 
441
 
447
             exit 725
463
             exit 725
448
         fi
464
         fi
449
         rm -rf $temp_restore_dir
465
         rm -rf $temp_restore_dir
450
-        service prosody restart
466
+        systemctl restart prosody
451
         chown -R prosody:prosody /var/lib/prosody/*
467
         chown -R prosody:prosody /var/lib/prosody/*
452
         echo $"Restore of xmpp settings complete"
468
         echo $"Restore of xmpp settings complete"
453
     fi
469
     fi
472
             exit 725
488
             exit 725
473
         fi
489
         fi
474
         rm -rf $temp_restore_dir
490
         rm -rf $temp_restore_dir
475
-        service prosody restart
491
+        systemctl restart prosody
476
         chown -R prosody:prosody /var/lib/prosody/*
492
         chown -R prosody:prosody /var/lib/prosody/*
477
         echo $"Restore of xmpp settings complete"
493
         echo $"Restore of xmpp settings complete"
478
     fi
494
     fi

+ 18
- 1
src/freedombone-app-zeronet View File

59
                    ZERONET_DEFAULT_FORUM_TAGLINE
59
                    ZERONET_DEFAULT_FORUM_TAGLINE
60
                    ZERONET_DEFAULT_MAIL_TAGLINE)
60
                    ZERONET_DEFAULT_MAIL_TAGLINE)
61
 
61
 
62
+function logging_on_zeronet {
63
+    echo -n ''
64
+}
65
+
66
+function logging_off_zeronet {
67
+    echo -n ''
68
+}
69
+
62
 function install_interactive_zeronet {
70
 function install_interactive_zeronet {
63
     echo -n ''
71
     echo -n ''
64
     APP_INSTALLED=1
72
     APP_INSTALLED=1
432
     chroot "$rootdir" pip install msgpack-python --upgrade
440
     chroot "$rootdir" pip install msgpack-python --upgrade
433
 
441
 
434
     chroot "$rootdir" useradd -d $MESH_INSTALL_DIR/zeronet/ -s /bin/false zeronet
442
     chroot "$rootdir" useradd -d $MESH_INSTALL_DIR/zeronet/ -s /bin/false zeronet
435
-    git clone $ZERONET_REPO $rootdir$MESH_INSTALL_DIR/zeronet
443
+
444
+    if [ -d /repos/zeronet ]; then
445
+        mkdir $rootdir$MESH_INSTALL_DIR/zeronet
446
+        cp -r -p /repos/zeronet/. $rootdir$MESH_INSTALL_DIR/zeronet
447
+        cd $rootdir$MESH_INSTALL_DIR/zeronet
448
+        git pull
449
+    else
450
+        git clone $ZERONET_REPO $rootdir$MESH_INSTALL_DIR/zeronet
451
+    fi
452
+
436
     if [ ! -d $rootdir$MESH_INSTALL_DIR/zeronet ]; then
453
     if [ ! -d $rootdir$MESH_INSTALL_DIR/zeronet ]; then
437
         echo 'WARNING: Unable to clone zeronet'
454
         echo 'WARNING: Unable to clone zeronet'
438
         return
455
         return

+ 37
- 0
src/freedombone-backup-local View File

42
     PROJECT_INSTALL_DIR=/usr/bin
42
     PROJECT_INSTALL_DIR=/usr/bin
43
 fi
43
 fi
44
 
44
 
45
+function please_wait {
46
+        local str width height length
47
+
48
+        width=$(tput cols)
49
+        height=$(tput lines)
50
+        str="Standby to backup to USB"
51
+        length=${#str}
52
+        clear
53
+        tput cup $((height / 2)) $(((width / 2) - (length / 2)))
54
+        echo "$str"
55
+        tput cup $((height * 3 / 5)) $(((width / 2)))
56
+        echo -n ''
57
+}
58
+
59
+please_wait
60
+
45
 source $PROJECT_INSTALL_DIR/${PROJECT_NAME}-vars
61
 source $PROJECT_INSTALL_DIR/${PROJECT_NAME}-vars
46
 
62
 
47
 # include utils which allow function_check and drive mount
63
 # include utils which allow function_check and drive mount
51
   source $f
67
   source $f
52
 done
68
 done
53
 
69
 
70
+clear
71
+
54
 USB_DRIVE=/dev/sdb1
72
 USB_DRIVE=/dev/sdb1
55
 USB_MOUNT=/mnt/usb
73
 USB_MOUNT=/mnt/usb
56
 
74
 
241
     fi
259
     fi
242
 }
260
 }
243
 
261
 
262
+function backup_blocklist {
263
+    if [ ! -f /root/${PROJECT_NAME}-firewall-domains.cfg ]; then
264
+        return
265
+    fi
266
+    echo $"Backing up ${PROJECT_NAME} blocklist"
267
+    temp_backup_dir=/root/tempbackupblocklist
268
+    if [ ! -d $temp_backup_dir ]; then
269
+        mkdir -p $temp_backup_dir
270
+    fi
271
+    if [ -f $NODEJS_INSTALLED_APPS_FILE ]; then
272
+        cp -f /root/${PROJECT_NAME}-firewall-domains.cfg $temp_backup_dir
273
+    fi
274
+    backup_directory_to_usb $temp_backup_dir blocklist
275
+    rm -rf $temp_backup_dir
276
+}
277
+
244
 function backup_configfiles {
278
 function backup_configfiles {
245
     echo $"Backing up ${PROJECT_NAME} configuration files"
279
     echo $"Backing up ${PROJECT_NAME} configuration files"
246
     temp_backup_dir=/root/tempbackupconfig
280
     temp_backup_dir=/root/tempbackupconfig
267
         cp -f /etc/nginx/.htpasswd $temp_backup_dir/htpasswd
301
         cp -f /etc/nginx/.htpasswd $temp_backup_dir/htpasswd
268
     fi
302
     fi
269
     backup_directory_to_usb $temp_backup_dir configfiles
303
     backup_directory_to_usb $temp_backup_dir configfiles
304
+    rm -rf $temp_backup_dir
270
 }
305
 }
271
 
306
 
272
 function backup_admin_readme {
307
 function backup_admin_readme {
287
         if [ ! -d $temp_backup_dir ]; then
322
         if [ ! -d $temp_backup_dir ]; then
288
             mkdir $temp_backup_dir
323
             mkdir $temp_backup_dir
289
         fi
324
         fi
325
+        keep_database_running
290
         mysqldump --lock-tables --password="$DATABASE_PASSWORD" mysql user > $temp_backup_dir/mysql.sql
326
         mysqldump --lock-tables --password="$DATABASE_PASSWORD" mysql user > $temp_backup_dir/mysql.sql
291
         if [ ! -s $temp_backup_dir/mysql.sql ]; then
327
         if [ ! -s $temp_backup_dir/mysql.sql ]; then
292
             echo $"Unable to backup mysql settings"
328
             echo $"Unable to backup mysql settings"
316
 backup_directories
352
 backup_directories
317
 backup_apps local
353
 backup_apps local
318
 backup_configfiles
354
 backup_configfiles
355
+backup_blocklist
319
 backup_admin_readme
356
 backup_admin_readme
320
 backup_mariadb
357
 backup_mariadb
321
 backup_extra_directories local
358
 backup_extra_directories local

+ 20
- 2
src/freedombone-backup-remote View File

92
     fi
92
     fi
93
     SUSPENDED_SITE="$1"
93
     SUSPENDED_SITE="$1"
94
     nginx_dissite $SUSPENDED_SITE
94
     nginx_dissite $SUSPENDED_SITE
95
-    service nginx reload
95
+    systemctl reload nginx
96
 }
96
 }
97
 
97
 
98
 function restart_site {
98
 function restart_site {
101
         return
101
         return
102
     fi
102
     fi
103
     nginx_ensite $SUSPENDED_SITE
103
     nginx_ensite $SUSPENDED_SITE
104
-    service nginx reload
104
+    systemctl reload nginx
105
     SUSPENDED_SITE=
105
     SUSPENDED_SITE=
106
 }
106
 }
107
 
107
 
108
+function backup_blocklist {
109
+    if [ ! -f /root/${PROJECT_NAME}-firewall-domains.cfg ]; then
110
+        return
111
+    fi
112
+    echo $"Backing up ${PROJECT_NAME} blocklist"
113
+    temp_backup_dir=/root/tempbackupblocklist
114
+    if [ ! -d $temp_backup_dir ]; then
115
+        mkdir -p $temp_backup_dir
116
+    fi
117
+    if [ -f $NODEJS_INSTALLED_APPS_FILE ]; then
118
+        cp -f /root/${PROJECT_NAME}-firewall-domains.cfg $temp_backup_dir
119
+    fi
120
+    backup_directory_to_friend $temp_backup_dir blocklist
121
+    rm -rf $temp_backup_dir
122
+}
123
+
108
 function backup_configfiles {
124
 function backup_configfiles {
109
     echo $"Backing up ${PROJECT_NAME} configuration files"
125
     echo $"Backing up ${PROJECT_NAME} configuration files"
110
     temp_backup_dir=/root/tempbackupconfig
126
     temp_backup_dir=/root/tempbackupconfig
305
         if [ ! -d $temp_backup_dir ]; then
321
         if [ ! -d $temp_backup_dir ]; then
306
             mkdir $temp_backup_dir
322
             mkdir $temp_backup_dir
307
         fi
323
         fi
324
+        keep_database_running
308
         mysqldump --password=$DATABASE_PASSWORD mysql user > $temp_backup_dir/mysql.sql
325
         mysqldump --password=$DATABASE_PASSWORD mysql user > $temp_backup_dir/mysql.sql
309
         if [ ! -s $temp_backup_dir/mysql.sql ]; then
326
         if [ ! -s $temp_backup_dir/mysql.sql ]; then
310
             echo $"Unable to backup MariaDB settings"
327
             echo $"Unable to backup MariaDB settings"
385
 
402
 
386
 backup_configfiles
403
 backup_configfiles
387
 if [[ $TEST_MODE == "no" ]]; then
404
 if [[ $TEST_MODE == "no" ]]; then
405
+    backup_blocklist
388
     backup_users
406
     backup_users
389
     backup_letsencrypt
407
     backup_letsencrypt
390
     backup_passwordstore
408
     backup_passwordstore

+ 69
- 106
src/freedombone-base-email View File

13
 # License
13
 # License
14
 # =======
14
 # =======
15
 #
15
 #
16
-# Copyright (C) 2014-2016 Bob Mottram <bob@freedombone.net>
16
+# Copyright (C) 2014-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
48
 # whether to encrypt all incoming email with your public key
48
 # whether to encrypt all incoming email with your public key
49
 GPG_ENCRYPT_STORED_EMAIL="yes"
49
 GPG_ENCRYPT_STORED_EMAIL="yes"
50
 
50
 
51
-# gets set to yes if gpg keys are imported from usb
52
-GPG_KEYS_IMPORTED="no"
53
-
54
 # optionally you can provide your exported GPG key pair here
51
 # optionally you can provide your exported GPG key pair here
55
 # Note that the private key file will be deleted after use
52
 # Note that the private key file will be deleted after use
56
 # If these are unspecified then a new GPG key will be created
53
 # If these are unspecified then a new GPG key will be created
157
         return
154
         return
158
     fi
155
     fi
159
 
156
 
160
-    echo 'HiddenServiceDir /var/lib/tor/hidden_service_email/' >> /etc/tor/torrc
161
-    echo 'HiddenServicePort 25 127.0.0.1:25' >> /etc/tor/torrc
162
-    echo 'HiddenServicePort 587 127.0.0.1:587' >> /etc/tor/torrc
163
-    echo 'HiddenServicePort 465 127.0.0.1:465' >> /etc/tor/torrc
157
+    if ! grep -q "hidden_service_email" /etc/tor/torrc; then
158
+        echo 'HiddenServiceDir /var/lib/tor/hidden_service_email/' >> /etc/tor/torrc
159
+        echo 'HiddenServicePort 25 127.0.0.1:25' >> /etc/tor/torrc
160
+        echo 'HiddenServicePort 587 127.0.0.1:587' >> /etc/tor/torrc
161
+        echo 'HiddenServicePort 465 127.0.0.1:465' >> /etc/tor/torrc
162
+    fi
164
 
163
 
165
     function_check onion_update
164
     function_check onion_update
166
     onion_update
165
     onion_update
168
     function_check wait_for_onion_service
167
     function_check wait_for_onion_service
169
     wait_for_onion_service email
168
     wait_for_onion_service email
170
 
169
 
171
-    if [[ $(onion_service_exists email) == "0" ]]; then
170
+    if [ ! -f /var/lib/tor/hidden_service_email/hostname ]; then
172
         echo $"email onion site hostname not found"
171
         echo $"email onion site hostname not found"
172
+        systemctl restart tor
173
         exit 782352
173
         exit 782352
174
     fi
174
     fi
175
 
175
 
303
     if ! grep -q "pgp_encrypt_only_command" /home/$MY_USERNAME/.muttrc; then
303
     if ! grep -q "pgp_encrypt_only_command" /home/$MY_USERNAME/.muttrc; then
304
         echo '' >> /home/$MY_USERNAME/.muttrc
304
         echo '' >> /home/$MY_USERNAME/.muttrc
305
         echo $'# Encrypt items in the Sent folder' >> /home/$MY_USERNAME/.muttrc
305
         echo $'# Encrypt items in the Sent folder' >> /home/$MY_USERNAME/.muttrc
306
-        echo "set pgp_encrypt_only_command=\"/usr/lib/mutt/pgpewrap gpg --batch --quiet --no-verbose --output - --encrypt --textmode --armor --trust-model always --encrypt-to 0x$MY_GPG_PUBLIC_KEY_ID -- -r %r -- %f\"" >> /home/$MY_USERNAME/.muttrc
306
+        echo "set pgp_encrypt_only_command=\"/usr/lib/mutt/pgpewrap gpg --batch --quiet --no-verbose --output - --encrypt --textmode --armor --trust-model always --encrypt-to $MY_GPG_PUBLIC_KEY_ID -- -r %r -- %f\"" >> /home/$MY_USERNAME/.muttrc
307
     else
307
     else
308
-        sed -i "s|set pgp_encrypt_only_command.*|set pgp_encrypt_only_command=\"/usr/lib/mutt/pgpewrap gpg --batch --quiet --no-verbose --output - --encrypt --textmode --armor --trust-model always --encrypt-to 0x$MY_GPG_PUBLIC_KEY_ID -- -r %r -- %f\"|g" /home/$MY_USERNAME/.muttrc
308
+        sed -i "s|set pgp_encrypt_only_command.*|set pgp_encrypt_only_command=\"/usr/lib/mutt/pgpewrap gpg --batch --quiet --no-verbose --output - --encrypt --textmode --armor --trust-model always --encrypt-to $MY_GPG_PUBLIC_KEY_ID -- -r %r -- %f\"|g" /home/$MY_USERNAME/.muttrc
309
     fi
309
     fi
310
 
310
 
311
     if ! grep -q "pgp_encrypt_sign_command" /home/$MY_USERNAME/.muttrc; then
311
     if ! grep -q "pgp_encrypt_sign_command" /home/$MY_USERNAME/.muttrc; then
312
-        echo "set pgp_encrypt_sign_command=\"/usr/lib/mutt/pgpewrap gpg %?p?--passphrase-fd 0? --batch --quiet --no-verbose --textmode --output - --encrypt --sign %?a?-u %a? --armor --trust-model always --encrypt-to 0x$MY_GPG_PUBLIC_KEY_ID -- -r %r -- %f\"" >> /home/$MY_USERNAME/.muttrc
312
+        echo "set pgp_encrypt_sign_command=\"/usr/lib/mutt/pgpewrap gpg %?p?--passphrase-fd 0? --batch --quiet --no-verbose --textmode --output - --encrypt --sign %?a?-u %a? --armor --trust-model always --encrypt-to $MY_GPG_PUBLIC_KEY_ID -- -r %r -- %f\"" >> /home/$MY_USERNAME/.muttrc
313
     else
313
     else
314
-        sed -i "s|set pgp_encrypt_sign_command.*|set pgp_encrypt_sign_command=\"/usr/lib/mutt/pgpewrap gpg %?p?--passphrase-fd 0? --batch --quiet --no-verbose --textmode --output - --encrypt --sign %?a?-u %a? --armor --trust-model always --encrypt-to 0x$MY_GPG_PUBLIC_KEY_ID -- -r %r -- %f\"|g" /home/$MY_USERNAME/.muttrc
314
+        sed -i "s|set pgp_encrypt_sign_command.*|set pgp_encrypt_sign_command=\"/usr/lib/mutt/pgpewrap gpg %?p?--passphrase-fd 0? --batch --quiet --no-verbose --textmode --output - --encrypt --sign %?a?-u %a? --armor --trust-model always --encrypt-to $MY_GPG_PUBLIC_KEY_ID -- -r %r -- %f\"|g" /home/$MY_USERNAME/.muttrc
315
     fi
315
     fi
316
 
316
 
317
     mark_completed $FUNCNAME
317
     mark_completed $FUNCNAME
365
     if [[ $(is_completed $FUNCNAME) == "1" ]]; then
365
     if [[ $(is_completed $FUNCNAME) == "1" ]]; then
366
         return
366
         return
367
     fi
367
     fi
368
-    apt-get -yq install mutt-patched lynx abook urlview
368
+    apt-get -yq install lynx abook urlview mutt
369
 
369
 
370
     if [ ! -f /etc/Muttrc ]; then
370
     if [ ! -f /etc/Muttrc ]; then
371
         echo $"ERROR: Mutt does not appear to have installed. $CHECK_MESSAGE"
371
         echo $"ERROR: Mutt does not appear to have installed. $CHECK_MESSAGE"
403
     echo '# set up the sidebar' >> /etc/Muttrc
403
     echo '# set up the sidebar' >> /etc/Muttrc
404
     echo 'set sidebar_width=22' >> /etc/Muttrc
404
     echo 'set sidebar_width=22' >> /etc/Muttrc
405
     echo 'set sidebar_visible=yes' >> /etc/Muttrc
405
     echo 'set sidebar_visible=yes' >> /etc/Muttrc
406
-    echo "set sidebar_delim='|'" >> /etc/Muttrc
407
-    echo 'set sidebar_sort=yes' >> /etc/Muttrc
408
     echo '' >> /etc/Muttrc
406
     echo '' >> /etc/Muttrc
409
     echo 'set rfc2047_parameters' >> /etc/Muttrc
407
     echo 'set rfc2047_parameters' >> /etc/Muttrc
410
     echo '' >> /etc/Muttrc
408
     echo '' >> /etc/Muttrc
652
     if [ ! -d /etc/exim4 ]; then
650
     if [ ! -d /etc/exim4 ]; then
653
         return
651
         return
654
     fi
652
     fi
655
-    # This installation doesn't work, results in ruby errors
656
-    # There is currently no schleuder package for Debian jessie
657
     if [[ $(is_completed $FUNCNAME) == "1" ]]; then
653
     if [[ $(is_completed $FUNCNAME) == "1" ]]; then
658
         return
654
         return
659
     fi
655
     fi
715
 function split_gpg_key_into_fragments {
711
 function split_gpg_key_into_fragments {
716
     # split the gpg key into fragments if social key management is enabled
712
     # split the gpg key into fragments if social key management is enabled
717
     if [[ $ENABLE_SOCIAL_KEY_MANAGEMENT == "yes" ]]; then
713
     if [[ $ENABLE_SOCIAL_KEY_MANAGEMENT == "yes" ]]; then
714
+
715
+        if [ $IMAGE_PASSWORD_FILE ]; then
716
+            if [ -f $IMAGE_PASSWORD_FILE ]; then
717
+                ${PROJECT_NAME}-splitkey -u $MY_USERNAME -e $MY_EMAIL_ADDRESS --fullname "$MY_NAME" --passwordfile $IMAGE_PASSWORD_FILE
718
+                return
719
+            fi
720
+        fi
721
+
718
         echo 'Splitting GPG key. You may need to enter your passphrase.'
722
         echo 'Splitting GPG key. You may need to enter your passphrase.'
719
         ${PROJECT_NAME}-splitkey -u $MY_USERNAME -e $MY_EMAIL_ADDRESS --fullname "$MY_NAME"
723
         ${PROJECT_NAME}-splitkey -u $MY_USERNAME -e $MY_EMAIL_ADDRESS --fullname "$MY_NAME"
720
         if [ ! -d /home/$MY_USERNAME/.gnupg_fragments ]; then
724
         if [ ! -d /home/$MY_USERNAME/.gnupg_fragments ]; then
1155
     echo '#!/bin/bash' > /usr/bin/filterspam
1159
     echo '#!/bin/bash' > /usr/bin/filterspam
1156
     echo 'for d in /home/*/ ; do' >> /usr/bin/filterspam
1160
     echo 'for d in /home/*/ ; do' >> /usr/bin/filterspam
1157
     echo '    USERNAME=$(echo "$d" | awk -F '"'"'/'"'"' '"'"'{print $3}'"'"')' >> /usr/bin/filterspam
1161
     echo '    USERNAME=$(echo "$d" | awk -F '"'"'/'"'"' '"'"'{print $3}'"'"')' >> /usr/bin/filterspam
1158
-    echo '    if [[ $USERNAME != "git" && $USERNAME != "go" && $USERNAME != "gogs" && $USERNAME != "mirrors" && $USERNAME != "sync" && $USERNAME != "tahoelafs" ]]; then' >> /usr/bin/filterspam
1162
+    echo '    if [[ $USERNAME != "git" && $USERNAME != "go" && $USERNAME != "gogs" && $USERNAME != "sync" && $USERNAME != "tahoelafs" ]]; then' >> /usr/bin/filterspam
1159
     echo '        MAILDIR=/home/$USERNAME/Maildir/.learn-spam' >> /usr/bin/filterspam
1163
     echo '        MAILDIR=/home/$USERNAME/Maildir/.learn-spam' >> /usr/bin/filterspam
1160
     echo '        if [ ! -d "$MAILDIR" ]; then' >> /usr/bin/filterspam
1164
     echo '        if [ ! -d "$MAILDIR" ]; then' >> /usr/bin/filterspam
1161
     echo '           exit' >> /usr/bin/filterspam
1165
     echo '           exit' >> /usr/bin/filterspam
1177
     echo '#!/bin/bash' > /usr/bin/filterham
1181
     echo '#!/bin/bash' > /usr/bin/filterham
1178
     echo 'for d in /home/*/ ; do' >> /usr/bin/filterham
1182
     echo 'for d in /home/*/ ; do' >> /usr/bin/filterham
1179
     echo '    USERNAME=$(echo "$d" | awk -F '"'"'/'"'"' '"'"'{print $3}'"'"')' >> /usr/bin/filterham
1183
     echo '    USERNAME=$(echo "$d" | awk -F '"'"'/'"'"' '"'"'{print $3}'"'"')' >> /usr/bin/filterham
1180
-    echo '    if [[ $USERNAME != "git" && $USERNAME != "go" && $USERNAME != "gogs" && $USERNAME != "mirrors" && $USERNAME != "sync" && $USERNAME != "tahoelafs" ]]; then' >> /usr/bin/filterham
1184
+    echo '    if [[ $USERNAME != "git" && $USERNAME != "go" && $USERNAME != "gogs" && $USERNAME != "sync" && $USERNAME != "tahoelafs" ]]; then' >> /usr/bin/filterham
1181
     echo '        MAILDIR=/home/$USERNAME/Maildir/.learn-ham' >> /usr/bin/filterham
1185
     echo '        MAILDIR=/home/$USERNAME/Maildir/.learn-ham' >> /usr/bin/filterham
1182
     echo '        if [ ! -d "$MAILDIR" ]; then' >> /usr/bin/filterham
1186
     echo '        if [ ! -d "$MAILDIR" ]; then' >> /usr/bin/filterham
1183
     echo '            exit' >> /usr/bin/filterham
1187
     echo '            exit' >> /usr/bin/filterham
1271
         return
1275
         return
1272
     fi
1276
     fi
1273
 
1277
 
1274
-    dpkg -P dovecot-imapd
1275
-    dpkg -P dovecot-core
1276
     apt-get -yq install dovecot-imapd
1278
     apt-get -yq install dovecot-imapd
1277
 
1279
 
1278
     if [ ! -d /etc/dovecot ]; then
1280
     if [ ! -d /etc/dovecot ]; then
1280
         exit 48
1282
         exit 48
1281
     fi
1283
     fi
1282
 
1284
 
1283
-    if [[ $ONION_ONLY == 'no' ]]; then
1284
-        # obtain a cert for the default domain
1285
-        if [[ "$(cert_exists ${DEFAULT_DOMAIN_NAME} pem)" == "0" ]]; then
1286
-            echo $'Obtaining certificate for the main domain'
1287
-            create_site_certificate ${DEFAULT_DOMAIN_NAME} 'yes'
1288
-        fi
1289
-    fi
1290
-
1291
-    if [[ "$(cert_exists ${DEFAULT_DOMAIN_NAME} pem)" == "0" ]]; then
1292
-        if [[ "$(cert_exists dovecot)" == "0" ]]; then
1293
-            ${PROJECT_NAME}-addcert -h dovecot --dhkey $DH_KEYLENGTH
1294
-            check_certificates dovecot
1295
-        fi
1285
+    if [[ "$(cert_exists dovecot)" == "0" ]]; then
1286
+        ${PROJECT_NAME}-addcert -h dovecot --dhkey $DH_KEYLENGTH
1287
+        check_certificates dovecot
1296
     fi
1288
     fi
1297
 
1289
 
1298
     chmod 600 /etc/shadow
1290
     chmod 600 /etc/shadow
1313
     fi
1305
     fi
1314
     sed -i 's|#ssl =.*|ssl = required|g' /etc/dovecot/conf.d/10-ssl.conf
1306
     sed -i 's|#ssl =.*|ssl = required|g' /etc/dovecot/conf.d/10-ssl.conf
1315
     sed -i 's|ssl =.*|ssl = required|g' /etc/dovecot/conf.d/10-ssl.conf
1307
     sed -i 's|ssl =.*|ssl = required|g' /etc/dovecot/conf.d/10-ssl.conf
1316
-    if [[ "$(cert_exists ${DEFAULT_DOMAIN_NAME} pem)" == "1" ]]; then
1317
-        sed -i "s|#ssl_cert =.*|ssl_cert = </etc/ssl/certs/${DEFAULT_DOMAIN_NAME}.pem|g" /etc/dovecot/conf.d/10-ssl.conf
1318
-        sed -i "s|ssl_cert =.*|ssl_cert = </etc/ssl/certs/${DEFAULT_DOMAIN_NAME}.pem|g" /etc/dovecot/conf.d/10-ssl.conf
1319
-    else
1320
-        sed -i "s|#ssl_cert =.*|ssl_cert = </etc/ssl/certs/${DEFAULT_DOMAIN_NAME}.crt|g" /etc/dovecot/conf.d/10-ssl.conf
1321
-        sed -i "s|ssl_cert =.*|ssl_cert = </etc/ssl/certs/${DEFAULT_DOMAIN_NAME}.crt|g" /etc/dovecot/conf.d/10-ssl.conf
1322
-    fi
1323
-    sed -i "s|#ssl_key =.*|ssl_key = </etc/ssl/private/${DEFAULT_DOMAIN_NAME}.key|g" /etc/dovecot/conf.d/10-ssl.conf
1324
-    sed -i "s|ssl_key =.*|ssl_key = </etc/ssl/private/${DEFAULT_DOMAIN_NAME}.key|g" /etc/dovecot/conf.d/10-ssl.conf
1325
-    if [[ "$(cert_exists ${DEFAULT_DOMAIN_NAME})" == "1" ]]; then
1326
-        sed -i "s|#ssl_dh_parameters_length.*|ssl_dh_parameters_length = ${DH_KEYLENGTH}|g" /etc/dovecot/conf.d/10-ssl.conf
1327
-    fi
1308
+    sed -i "s|#ssl_cert =.*|ssl_cert = </etc/ssl/certs/dovecot.crt|g" /etc/dovecot/conf.d/10-ssl.conf
1309
+    sed -i "s|ssl_cert =.*|ssl_cert = </etc/ssl/certs/dovecot.crt|g" /etc/dovecot/conf.d/10-ssl.conf
1310
+    sed -i "s|#ssl_key =.*|ssl_key = </etc/ssl/private/dovecot.key|g" /etc/dovecot/conf.d/10-ssl.conf
1311
+    sed -i "s|ssl_key =.*|ssl_key = </etc/ssl/private/dovecot.key|g" /etc/dovecot/conf.d/10-ssl.conf
1312
+    sed -i "s|#ssl_dh_parameters_length.*|ssl_dh_parameters_length = ${DH_KEYLENGTH}|g" /etc/dovecot/conf.d/10-ssl.conf
1328
     sed -i 's/#ssl_prefer_server_ciphers.*/ssl_prefer_server_ciphers = yes/g' /etc/dovecot/conf.d/10-ssl.conf
1313
     sed -i 's/#ssl_prefer_server_ciphers.*/ssl_prefer_server_ciphers = yes/g' /etc/dovecot/conf.d/10-ssl.conf
1329
     sed -i "s|#ssl_protocols =.*|ssl_protocols = '$SSL_PROTOCOLS'|g" /etc/dovecot/conf.d/10-ssl.conf
1314
     sed -i "s|#ssl_protocols =.*|ssl_protocols = '$SSL_PROTOCOLS'|g" /etc/dovecot/conf.d/10-ssl.conf
1330
     sed -i "s|ssl_protocols =.*|ssl_protocols = '$SSL_PROTOCOLS'|g" /etc/dovecot/conf.d/10-ssl.conf
1315
     sed -i "s|ssl_protocols =.*|ssl_protocols = '$SSL_PROTOCOLS'|g" /etc/dovecot/conf.d/10-ssl.conf
1374
     fi
1359
     fi
1375
 
1360
 
1376
     # Separate logging, otherwise syslog is used
1361
     # Separate logging, otherwise syslog is used
1377
-    if ! grep "# logging" /etc/dovecot/dovecot.conf; then
1362
+    if ! grep -q "# logging" /etc/dovecot/dovecot.conf; then
1378
         echo '' >> /etc/dovecot/dovecot.conf
1363
         echo '' >> /etc/dovecot/dovecot.conf
1379
         echo '# logging' >> /etc/dovecot/dovecot.conf
1364
         echo '# logging' >> /etc/dovecot/dovecot.conf
1380
         echo 'log_path = /var/log/dovecot.log' >> /etc/dovecot/dovecot.conf
1365
         echo 'log_path = /var/log/dovecot.log' >> /etc/dovecot/dovecot.conf
1437
     echo 'serial = sslserial' >> /etc/ssl/dovecot-ca.cnf
1422
     echo 'serial = sslserial' >> /etc/ssl/dovecot-ca.cnf
1438
     echo 'default_days = 3650' >> /etc/ssl/dovecot-ca.cnf
1423
     echo 'default_days = 3650' >> /etc/ssl/dovecot-ca.cnf
1439
     echo 'default_md = sha256' >> /etc/ssl/dovecot-ca.cnf
1424
     echo 'default_md = sha256' >> /etc/ssl/dovecot-ca.cnf
1440
-    echo 'default_bits = 4096' >> /etc/ssl/dovecot-ca.cnf
1425
+    echo 'default_bits = 2048' >> /etc/ssl/dovecot-ca.cnf
1441
     echo 'policy = dovecot-ca_policy' >> /etc/ssl/dovecot-ca.cnf
1426
     echo 'policy = dovecot-ca_policy' >> /etc/ssl/dovecot-ca.cnf
1442
     echo 'x509_extensions = dovecot-ca_extensions' >> /etc/ssl/dovecot-ca.cnf
1427
     echo 'x509_extensions = dovecot-ca_extensions' >> /etc/ssl/dovecot-ca.cnf
1443
     echo '' >> /etc/ssl/dovecot-ca.cnf
1428
     echo '' >> /etc/ssl/dovecot-ca.cnf
1469
 }
1454
 }
1470
 
1455
 
1471
 function create_gpg_subkey {
1456
 function create_gpg_subkey {
1457
+    # Note: currently not used
1472
     if [ ! -d /etc/exim4 ]; then
1458
     if [ ! -d /etc/exim4 ]; then
1473
         return
1459
         return
1474
     fi
1460
     fi
1487
     KEYGRIP=$(gpg --fingerprint --fingerprint $MY_EMAIL_ADDRESS | grep fingerprint | tail -1 | cut -d= -f2 | sed -e 's/ //g')
1473
     KEYGRIP=$(gpg --fingerprint --fingerprint $MY_EMAIL_ADDRESS | grep fingerprint | tail -1 | cut -d= -f2 | sed -e 's/ //g')
1488
 
1474
 
1489
     # Generate a GPG subkey
1475
     # Generate a GPG subkey
1490
-    # Here a 2048bit length is used to be compatible with yubikey
1491
-    echo 'Key-Type: 1' > /home/$MY_USERNAME/gpg-genkey.conf
1492
-    echo "Key-Grip: $KEYGRIP" > /home/$MY_USERNAME/gpg-genkey.conf
1493
-    echo 'Subkey-Type: 1' >> /home/$MY_USERNAME/gpg-genkey.conf
1494
-    echo 'Subkey-Length: 2048' >> /home/$MY_USERNAME/gpg-genkey.conf
1476
+    echo 'Key-Type: eddsa' > /home/$MY_USERNAME/gpg-genkey.conf
1477
+    echo 'Key-Curve: Ed25519' >> /home/$MY_USERNAME/gpg-genkey.conf
1478
+    echo "Key-Grip: $KEYGRIP" >> /home/$MY_USERNAME/gpg-genkey.conf
1479
+    echo 'Subkey-Type: eddsa' >> /home/$MY_USERNAME/gpg-genkey.conf
1495
     echo "subkey-Usage: $GPG_KEY_USAGE" > /home/$MY_USERNAME/gpg-genkey.conf
1480
     echo "subkey-Usage: $GPG_KEY_USAGE" > /home/$MY_USERNAME/gpg-genkey.conf
1496
     echo "Name-Real:  $MY_NAME" >> /home/$MY_USERNAME/gpg-genkey.conf
1481
     echo "Name-Real:  $MY_NAME" >> /home/$MY_USERNAME/gpg-genkey.conf
1497
     echo "Name-Email: $MY_EMAIL_ADDRESS" >> /home/$MY_USERNAME/gpg-genkey.conf
1482
     echo "Name-Email: $MY_EMAIL_ADDRESS" >> /home/$MY_USERNAME/gpg-genkey.conf
1498
     echo "Name-Comment: $GPG_KEY_USAGE" >> /home/$MY_USERNAME/gpg-genkey.conf
1483
     echo "Name-Comment: $GPG_KEY_USAGE" >> /home/$MY_USERNAME/gpg-genkey.conf
1499
     echo 'Expire-Date: 0' >> /home/$MY_USERNAME/gpg-genkey.conf
1484
     echo 'Expire-Date: 0' >> /home/$MY_USERNAME/gpg-genkey.conf
1485
+    echo "Passphrase: $PROJECT_NAME" >> /home/$MY_USERNAME/gpg-genkey.conf
1500
     chown $MY_USERNAME:$MY_USERNAME /home/$MY_USERNAME/gpg-genkey.conf
1486
     chown $MY_USERNAME:$MY_USERNAME /home/$MY_USERNAME/gpg-genkey.conf
1501
-    su -c "gpg --batch --gen-key /home/$MY_USERNAME/gpg-genkey.conf" - $MY_USERNAME
1487
+    su -m root -c "gpg --homedir /home/$MY_USERNAME/.gnupg --batch --full-gen-key /home/$MY_USERNAME/gpg-genkey.conf" - $MY_USERNAME
1488
+    chown -R $MY_USERNAME:$MY_USERNAME /home/$MY_USERNAME/.gnupg
1489
+
1502
     shred -zu /home/$MY_USERNAME/gpg-genkey.conf
1490
     shred -zu /home/$MY_USERNAME/gpg-genkey.conf
1503
-    MY_GPG_SUBKEY_ID=$(su -c "gpg --list-keys $MY_EMAIL_ADDRESS | grep 'pub '" - $MY_USERNAME | awk -F ' ' '{print $2}' | awk -F '/' '{print $2}')
1491
+
1492
+    MY_GPG_SUBKEY_ID=$(gpg_pubkey_from_email "$MY_USERNAME" "$MY_EMAIL_ADDRESS")
1504
 
1493
 
1505
     mark_completed $FUNCNAME
1494
     mark_completed $FUNCNAME
1506
 }
1495
 }
1538
     gpg_dir=/home/$MY_USERNAME/.gnupg
1527
     gpg_dir=/home/$MY_USERNAME/.gnupg
1539
 
1528
 
1540
     # if gpg keys directory was previously imported from usb
1529
     # if gpg keys directory was previously imported from usb
1541
-    if [[ $GPG_KEYS_IMPORTED == "yes" && -d $gpg_dir ]]; then
1530
+    if [ -d $gpg_dir ]; then
1531
+        echo $'GPG directory exists'
1532
+    else
1533
+        echo $"GPG directory $gpg_dir was not found"
1534
+    fi
1535
+    if [ -d $gpg_dir ]; then
1542
         echo $'GPG keys were imported'
1536
         echo $'GPG keys were imported'
1543
         sed -i "s|keyserver hkp://keys.gnupg.net|keyserver $GPG_KEYSERVER|g" $gpg_dir/gpg.conf
1537
         sed -i "s|keyserver hkp://keys.gnupg.net|keyserver $GPG_KEYSERVER|g" $gpg_dir/gpg.conf
1544
         MY_GPG_PUBLIC_KEY_ID=$(gpg_pubkey_from_email "$MY_USERNAME" "$MY_EMAIL_ADDRESS")
1538
         MY_GPG_PUBLIC_KEY_ID=$(gpg_pubkey_from_email "$MY_USERNAME" "$MY_EMAIL_ADDRESS")
1582
             echo $"GPG public key file $MY_GPG_PUBLIC_KEY was not found"
1576
             echo $"GPG public key file $MY_GPG_PUBLIC_KEY was not found"
1583
             exit 2483
1577
             exit 2483
1584
         fi
1578
         fi
1579
+
1585
         if [ ! -f $MY_GPG_PRIVATE_KEY ]; then
1580
         if [ ! -f $MY_GPG_PRIVATE_KEY ]; then
1586
             echo $"GPG private key file $MY_GPG_PRIVATE_KEY was not found"
1581
             echo $"GPG private key file $MY_GPG_PRIVATE_KEY was not found"
1587
             exit 5383
1582
             exit 5383
1588
         fi
1583
         fi
1589
-        su -c "gpg --import $MY_GPG_PUBLIC_KEY" - $MY_USERNAME
1590
-        su -c "gpg --allow-secret-key-import --import $MY_GPG_PRIVATE_KEY" - $MY_USERNAME
1584
+
1585
+        gpg_import_public_key $MY_USERNAME $MY_GPG_PUBLIC_KEY
1586
+        gpg_import_private_key $MY_USERNAME $MY_GPG_PRIVATE_KEY
1587
+
1591
         KEY_EXISTS=$(gpg_key_exists "$MY_USERNAME" "$MY_EMAIL_ADDRESS")
1588
         KEY_EXISTS=$(gpg_key_exists "$MY_USERNAME" "$MY_EMAIL_ADDRESS")
1592
         if [[ $KEY_EXISTS == "no" ]]; then
1589
         if [[ $KEY_EXISTS == "no" ]]; then
1593
             echo $"The GPG key for $MY_EMAIL_ADDRESS could not be imported"
1590
             echo $"The GPG key for $MY_EMAIL_ADDRESS could not be imported"
1602
         fi
1599
         fi
1603
     else
1600
     else
1604
         # Generate a GPG key
1601
         # Generate a GPG key
1605
-        echo 'Key-Type: 1' > /home/$MY_USERNAME/gpg-genkey.conf
1606
-        echo 'Key-Length: 4096' >> /home/$MY_USERNAME/gpg-genkey.conf
1607
-        echo 'Subkey-Type: 1' >> /home/$MY_USERNAME/gpg-genkey.conf
1608
-        echo 'Subkey-Length: 4096' >> /home/$MY_USERNAME/gpg-genkey.conf
1609
-        echo "Name-Real:  $MY_NAME" >> /home/$MY_USERNAME/gpg-genkey.conf
1610
-        echo "Name-Email: $MY_EMAIL_ADDRESS" >> /home/$MY_USERNAME/gpg-genkey.conf
1611
-        echo 'Expire-Date: 0' >> /home/$MY_USERNAME/gpg-genkey.conf
1612
-        chown $MY_USERNAME:$MY_USERNAME /home/$MY_USERNAME/gpg-genkey.conf
1613
-        echo $'Generating a new GPG key'
1614
-        su -c "gpg --batch --gen-key /home/$MY_USERNAME/gpg-genkey.conf" - $MY_USERNAME
1615
-        KEY_EXISTS=$(gpg_key_exists "$MY_USERNAME" "$MY_EMAIL_ADDRESS")
1616
-        if [[ $KEY_EXISTS == "no" ]]; then
1617
-            echo $"A GPG key for $MY_EMAIL_ADDRESS could not be created"
1618
-            exit 6362
1602
+        if [ -f $IMAGE_PASSWORD_FILE ]; then
1603
+            gpg_create_key $MY_USERNAME $(printf `cat $IMAGE_PASSWORD_FILE`)
1604
+        else
1605
+            gpg_create_key $MY_USERNAME $PROJECT_NAME
1619
         fi
1606
         fi
1620
-        shred -zu /home/$MY_USERNAME/gpg-genkey.conf
1621
         MY_GPG_PUBLIC_KEY_ID=$(gpg_pubkey_from_email "$MY_USERNAME" "$MY_EMAIL_ADDRESS")
1607
         MY_GPG_PUBLIC_KEY_ID=$(gpg_pubkey_from_email "$MY_USERNAME" "$MY_EMAIL_ADDRESS")
1622
-        if [ ${#MY_GPG_PUBLIC_KEY_ID} -lt 4 ]; then
1623
-            echo $'GPG public key ID could not be obtained'
1624
-        fi
1625
         MY_GPG_PUBLIC_KEY=/tmp/public_key.gpg
1608
         MY_GPG_PUBLIC_KEY=/tmp/public_key.gpg
1626
-        su -c "gpg --output $MY_GPG_PUBLIC_KEY --armor --export $MY_GPG_PUBLIC_KEY_ID" - $MY_USERNAME
1627
-
1628
-        if grep -q "install_email" $COMPLETION_FILE; then
1629
-            if ! grep -q $"Change your GPG password" /home/$MY_USERNAME/README; then
1630
-                echo '' >> /home/$MY_USERNAME/README
1631
-                echo '' >> /home/$MY_USERNAME/README
1632
-                echo $'# Change your GPG password' >> /home/$MY_USERNAME/README
1633
-                echo $"It's very important to add a password to your GPG key so that" >> /home/$MY_USERNAME/README
1634
-                echo $"if anyone does get access to your email they still won't be able" >> /home/$MY_USERNAME/README
1635
-                echo $'to read them without knowning the GPG password.' >> /home/$MY_USERNAME/README
1636
-                echo $'You can change the it with:' >> /home/$MY_USERNAME/README
1637
-                echo '' >> /home/$MY_USERNAME/README
1638
-                echo "  gpg --edit-key $MY_GPG_PUBLIC_KEY_ID" >> /home/$MY_USERNAME/README
1639
-                echo '  passwd' >> /home/$MY_USERNAME/README
1640
-                echo '  save' >> /home/$MY_USERNAME/README
1641
-                echo '  quit' >> /home/$MY_USERNAME/README
1642
-            fi
1643
-            if ! grep -q $"Publish your GPG public key" /home/$MY_USERNAME/README; then
1644
-                echo '' >> /home/$MY_USERNAME/README
1645
-                echo '' >> /home/$MY_USERNAME/README
1646
-                echo $'# Publish your GPG public key' >> /home/$MY_USERNAME/README
1647
-                echo $'So that others can send emails to you securely you should' >> /home/$MY_USERNAME/README
1648
-                echo $'publish your GPG public key with the command:' >> /home/$MY_USERNAME/README
1649
-                echo '' >> /home/$MY_USERNAME/README
1650
-                echo "  gpg --send-keys $MY_GPG_PUBLIC_KEY_ID" >> /home/$MY_USERNAME/README
1651
-            fi
1652
-            chown $MY_USERNAME:$MY_USERNAME /home/$MY_USERNAME/README
1653
-            chmod 600 /home/$MY_USERNAME/README
1654
-        fi
1609
+        gpg_export_public_key $MY_USERNAME $MY_GPG_PUBLIC_KEY_ID $MY_GPG_PUBLIC_KEY
1610
+    fi
1611
+
1612
+    if [ ! -d /root/.gnupg ]; then
1613
+        cp -r /home/$MY_USERNAME/.gnupg /root/
1614
+        chmod 700 /root/.gnupg
1615
+        chmod 600 /root/.gnupg/*
1655
     fi
1616
     fi
1617
+    gpg_agent_setup root
1618
+    gpg_agent_setup $MY_USERNAME
1656
 
1619
 
1657
     mark_completed $FUNCNAME
1620
     mark_completed $FUNCNAME
1658
 }
1621
 }

+ 1
- 1
src/freedombone-client View File

154
         ssh-keygen -t ed25519 -o -a 100
154
         ssh-keygen -t ed25519 -o -a 100
155
     fi
155
     fi
156
     if [ ! -f /home/$CURR_USER/.ssh/id_rsa ]; then
156
     if [ ! -f /home/$CURR_USER/.ssh/id_rsa ]; then
157
-        ssh-keygen -t rsa -b 4096 -o -a 100
157
+        ssh-keygen -t rsa -b 2048 -o -a 100
158
     fi
158
     fi
159
 
159
 
160
     ssh_remove_small_moduli
160
     ssh_remove_small_moduli

+ 126
- 62
src/freedombone-config View File

14
 # License
14
 # License
15
 # =======
15
 # =======
16
 #
16
 #
17
-# Copyright (C) 2015-2016 Bob Mottram <bob@freedombone.net>
17
+# Copyright (C) 2015-2017 Bob Mottram <bob@freedombone.net>
18
 #
18
 #
19
 # This program is free software: you can redistribute it and/or modify
19
 # This program is free software: you can redistribute it and/or modify
20
 # it under the terms of the GNU Affero General Public License as published by
20
 # it under the terms of the GNU Affero General Public License as published by
95
 DEFAULT_LANGUAGE='en_GB.UTF-8'
95
 DEFAULT_LANGUAGE='en_GB.UTF-8'
96
 ONION_ONLY="no"
96
 ONION_ONLY="no"
97
 SELECTED_USERNAME=
97
 SELECTED_USERNAME=
98
-
99
-# Mirrors settings
100
-FRIENDS_MIRRORS_SERVER=
101
-FRIENDS_MIRRORS_SSH_PORT=2222
102
-FRIENDS_MIRRORS_PASSWORD=
103
-MY_MIRRORS_PASSWORD=
98
+SOCIALINSTANCE=
104
 
99
 
105
 VALID_CODE=
100
 VALID_CODE=
106
 
101
 
109
     PROJECT_INSTALL_DIR=/usr/bin
104
     PROJECT_INSTALL_DIR=/usr/bin
110
 fi
105
 fi
111
 
106
 
107
+function please_wait {
108
+        local str width height length
109
+
110
+        width=$(tput cols)
111
+        height=$(tput lines)
112
+        str=$"Please wait"
113
+        length=${#str}
114
+        clear
115
+        tput cup $((height / 2)) $(((width / 2) - (length / 2)))
116
+        echo "$str"
117
+        tput cup $((height * 3 / 5)) $(((width / 2)))
118
+        echo -n ''
119
+}
120
+
112
 source $PROJECT_INSTALL_DIR/${PROJECT_NAME}-vars
121
 source $PROJECT_INSTALL_DIR/${PROJECT_NAME}-vars
113
 
122
 
114
 UTILS_FILES=/usr/share/${PROJECT_NAME}/utils/${PROJECT_NAME}-utils-*
123
 UTILS_FILES=/usr/share/${PROJECT_NAME}/utils/${PROJECT_NAME}-utils-*
130
     echo $'Creates an inventory of remote backup locations'
139
     echo $'Creates an inventory of remote backup locations'
131
     echo ''
140
     echo ''
132
     echo ''
141
     echo ''
133
-    echo $'  -h --help             Show help'
134
-    echo $'  -f --filename         Configuration file (usually freedombone.cfg)'
135
-    echo $'  -m --min              Minimum password length (characters)'
136
-    echo $'  -w --www              Freedombone web site'
137
-    echo $'  -b --bm               Freedombone support Bitmessage address'
138
-    echo $'  -o --onion [yes|no]   Whether to only create .onion sites'
139
-    echo $'     --minimal [yes|no] For minimalistic "consumer grade" installs'
142
+    echo $'  -h --help                         Show help'
143
+    echo $'  -f --filename                     Configuration file (usually freedombone.cfg)'
144
+    echo $'  -m --min                          Minimum password length (characters)'
145
+    echo $'  -w --www                          Freedombone web site'
146
+    echo $'  -b --bm                           Freedombone support Bitmessage address'
147
+    echo $'  -o --onion [yes|no]               Whether to only create .onion sites'
148
+    echo $'     --minimal [yes|no]             For minimalistic "consumer grade" installs'
149
+    echo $'     --social [gnusocial|postactiv] Create gnusocial/postactiv instance'
140
     echo ''
150
     echo ''
141
     exit 0
151
     exit 0
142
 }
152
 }
170
     save_configuration_values
180
     save_configuration_values
171
 }
181
 }
172
 
182
 
183
+function choose_social_instance_domain_name {
184
+    DEFAULT_DOMAIN_DETAILS_COMPLETE=
185
+    while [ ! $DEFAULT_DOMAIN_DETAILS_COMPLETE ]
186
+    do
187
+        data=$(tempfile 2>/dev/null)
188
+        trap "rm -f $data" 0 1 2 5 15
189
+        if [[ $DDNS_PROVIDER == "default@freedns.afraid.org" ]]; then
190
+            dialog --backtitle $"Freedombone Configuration" \
191
+                   --title $"Instance domain" \
192
+                   --form $"\nEnter your instance domain name and its FreeDNS code:" 11 55 3 \
193
+                   $"Domain:" 1 1 "$(grep 'DEFAULT_DOMAIN_NAME' temp.cfg | awk -F '=' '{print $2}')" 1 24 33 40 \
194
+                   $"Code:" 2 1 "$(grep 'DEFAULT_DOMAIN_CODE' temp.cfg | awk -F '=' '{print $2}')" 2 24 33 255 \
195
+                   2> $data
196
+            sel=$?
197
+            case $sel in
198
+                1) exit 1;;
199
+                255) exit 1;;
200
+            esac
201
+            DEFAULT_DOMAIN_NAME=$(cat $data | sed -n 1p)
202
+            DEFAULT_DOMAIN_CODE=$(cat $data | sed -n 2p)
203
+            if [ $DEFAULT_DOMAIN_NAME ]; then
204
+                validate_freedns_code "$DEFAULT_DOMAIN_CODE"
205
+                if [ ! $VALID_CODE ]; then
206
+                    DEFAULT_DOMAIN_NAME=
207
+                fi
208
+            fi
209
+        else
210
+            dialog --backtitle $"Freedombone Configuration" \
211
+                   --inputbox $"Enter your instance domain name:" 10 45 \
212
+                   "$(grep 'DEFAULT_DOMAIN_NAME' temp.cfg | awk -F '=' '{print $2}')" 2> $data
213
+            sel=$?
214
+            case $sel in
215
+                0) DEFAULT_DOMAIN_NAME=$(cat $data);;
216
+                1) exit 1;;
217
+                255) exit 1;;
218
+            esac
219
+        fi
220
+        if [ $DEFAULT_DOMAIN_NAME ]; then
221
+            TEST_DOMAIN_NAME=$DEFAULT_DOMAIN_NAME
222
+            validate_domain_name
223
+            if [[ $TEST_DOMAIN_NAME != $DEFAULT_DOMAIN_NAME ]]; then
224
+                DEFAULT_DOMAIN_NAME=
225
+                dialog --title $"Domain name validation" --msgbox "$TEST_DOMAIN_NAME" 15 50
226
+            else
227
+                DEFAULT_DOMAIN_DETAILS_COMPLETE="yes"
228
+            fi
229
+        fi
230
+    done
231
+    save_configuration_values
232
+}
233
+
173
 function choose_default_domain_name {
234
 function choose_default_domain_name {
235
+    if [ $SOCIALINSTANCE ]; then
236
+        choose_social_instance_domain_name
237
+        return
238
+    fi
239
+
174
     if [[ $ONION_ONLY != "no" ]]; then
240
     if [[ $ONION_ONLY != "no" ]]; then
175
-        DEFAULT_DOMAIN_NAME="${PROJECT_NAME}.local"
241
+        DEFAULT_DOMAIN_NAME="${LOCAL_NAME}.local"
176
     else
242
     else
177
         DEFAULT_DOMAIN_DETAILS_COMPLETE=
243
         DEFAULT_DOMAIN_DETAILS_COMPLETE=
178
         while [ ! $DEFAULT_DOMAIN_DETAILS_COMPLETE ]
244
         while [ ! $DEFAULT_DOMAIN_DETAILS_COMPLETE ]
608
                            if [ ${#possible_username} -gt 1 ]; then
674
                            if [ ${#possible_username} -gt 1 ]; then
609
                                if [[ $possible_username != $GENERIC_IMAGE_USERNAME ]]; then
675
                                if [[ $possible_username != $GENERIC_IMAGE_USERNAME ]]; then
610
                                    MY_USERNAME=$(cat $data)
676
                                    MY_USERNAME=$(cat $data)
677
+                                   please_wait
678
+                                   echo ''
679
+                                   echo $'Creating user account'
611
                                    chmod 600 /etc/shadow
680
                                    chmod 600 /etc/shadow
612
                                    chmod 600 /etc/gshadow
681
                                    chmod 600 /etc/gshadow
613
                                    useradd -m -s /bin/bash $MY_USERNAME
682
                                    useradd -m -s /bin/bash $MY_USERNAME
665
         exit 6437
734
         exit 6437
666
     fi
735
     fi
667
     save_configuration_values
736
     save_configuration_values
737
+    please_wait
738
+    echo ''
668
 }
739
 }
669
 
740
 
670
 function choose_full_name {
741
 function choose_full_name {
691
         esac
762
         esac
692
     done
763
     done
693
     save_configuration_values
764
     save_configuration_values
765
+    please_wait
766
+    echo ''
694
 }
767
 }
695
 
768
 
696
 function choose_system_variant {
769
 function choose_system_variant {
761
             shift
834
             shift
762
             FREEDOMBONE_WEBSITE="$1"
835
             FREEDOMBONE_WEBSITE="$1"
763
             ;;
836
             ;;
837
+        --social)
838
+            shift
839
+            if [[ "$1" == 'gnusocial' || "$1" == 'postactiv' ]]; then
840
+                SOCIALINSTANCE="$1"
841
+            fi
842
+            ;;
764
         --minimal)
843
         --minimal)
765
             shift
844
             shift
766
             MINIMAL_INSTALL="$1"
845
             MINIMAL_INSTALL="$1"
776
     shift
855
     shift
777
 done
856
 done
778
 
857
 
779
-function set_main_repo {
780
-    data=$(tempfile 2>/dev/null)
781
-    trap "rm -f $data" 0 1 2 5 15
782
-    dialog --backtitle $"Freedombone Control Panel" \
783
-           --title $"Main Repository (Mirrors)" \
784
-           --form $"If you don't know what this means then just select Ok.\n\nIf you don't wish to use the default repositories they can be obtained from mirrored repos on another ${PROJECT_NAME} system.\n\nThe repositories are for applications which are not yet packaged for Debian." 18 65 4 \
785
-           $"URL:" 1 1 "$FRIENDS_MIRRORS_SERVER" 1 18 40 18 \
786
-           $"SSH Port:" 2 1 "$FRIENDS_MIRRORS_SSH_PORT" 2 18 10 10000 \
787
-           $"Password:" 3 1 "$FRIENDS_MIRRORS_PASSWORD" 3 18 40 10000 \
788
-           2> $data
789
-    sel=$?
790
-    case $sel in
791
-        1) return;;
792
-        255) return;;
793
-    esac
794
-    new_mirrors_url=$(cat $data | sed -n 1p)
795
-    new_mirrors_ssh_port=$(cat $data | sed -n 2p)
796
-    new_mirrors_password=$(cat $data | sed -n 3p)
797
-
798
-    if [ ${#new_mirrors_url} -lt 2 ]; then
799
-        return
800
-    fi
801
-    if [ ${#new_mirrors_ssh_port} -lt 1 ]; then
802
-        return
803
-    fi
804
-    if [ ${#new_mirrors_password} -lt 10 ]; then
805
-        dialog --title $"Main Repository" \
806
-               --msgbox $'Mirrors password was too short. Should be at least 10 characters.' 6 40
807
-        return
808
-    fi
809
-
810
-    if [[ $new_mirrors_url == *"."* ]]; then
811
-        FRIENDS_MIRRORS_SERVER=$new_mirrors_url
812
-        FRIENDS_MIRRORS_SSH_PORT=$new_mirrors_ssh_port
813
-        FRIENDS_MIRRORS_PASSWORD=$new_mirrors_password
814
-
815
-        dialog --title $"Main Repository" \
816
-               --msgbox $"Main repository set to $FRIENDS_MIRRORS_SERVER" 6 60
817
-    fi
818
-    save_configuration_values
819
-}
820
-
821
 function interactive_select_language {
858
 function interactive_select_language {
822
     data=$(tempfile 2>/dev/null)
859
     data=$(tempfile 2>/dev/null)
823
     trap "rm -f $data" 0 1 2 5 15
860
     trap "rm -f $data" 0 1 2 5 15
968
     esac
1005
     esac
969
     save_configuration_values
1006
     save_configuration_values
970
 
1007
 
1008
+    please_wait
1009
+    echo ''
1010
+    echo 'Setting locale'
1011
+
971
     locale-gen "${DEFAULT_LANGUAGE}"
1012
     locale-gen "${DEFAULT_LANGUAGE}"
972
     update-locale LANG=${DEFAULT_LANGUAGE}
1013
     update-locale LANG=${DEFAULT_LANGUAGE}
973
     update-locale LANGUAGE=${DEFAULT_LANGUAGE}
1014
     update-locale LANGUAGE=${DEFAULT_LANGUAGE}
974
     update-locale LC_MESSAGES=${DEFAULT_LANGUAGE}
1015
     update-locale LC_MESSAGES=${DEFAULT_LANGUAGE}
975
     update-locale LC_ALL=${DEFAULT_LANGUAGE}
1016
     update-locale LC_ALL=${DEFAULT_LANGUAGE}
976
     update-locale LC_CTYPE=${DEFAULT_LANGUAGE}
1017
     update-locale LC_CTYPE=${DEFAULT_LANGUAGE}
1018
+    please_wait
1019
+    echo ''
977
 }
1020
 }
978
 
1021
 
979
 function select_user {
1022
 function select_user {
981
 
1024
 
982
     users_array=($(ls /home))
1025
     users_array=($(ls /home))
983
 
1026
 
984
-    delete=(mirrors git)
1027
+    delete=(git)
985
     for del in ${delete[@]}
1028
     for del in ${delete[@]}
986
     do
1029
     do
987
         users_array=(${users_array[@]/$del})
1030
         users_array=(${users_array[@]/$del})
1019
 
1062
 
1020
     interactive_select_language
1063
     interactive_select_language
1021
 
1064
 
1022
-    if [[ $ONION_ONLY == "no" ]]; then
1023
-        INITIAL_MESSAGE=$"Welcome to the Freedombone interactive installer. Communications freedom is only a short time away.\n\nEnsure that you have your domain and dynamic DNS settings ready.\n\nFor more information please visit $FREEDOMBONE_WEBSITE."
1065
+    if [ $SOCIALINSTANCE ]; then
1066
+        INITIAL_MESSAGE=$"Welcome to your Freedombone $SOCIALINSTANCE instance.\n\nEnsure that you have your domain and dynamic DNS settings ready.\n\nFor more information please visit ${FREEDOMBONE_WEBSITE}/socialinstance.html."
1024
     else
1067
     else
1025
-        INITIAL_MESSAGE=$"Welcome to the Freedombone interactive installer. Communications freedom is only a short time away.\n\nWeb sites created will only be viewable within a Tor browser.\n\nFor more information please visit $FREEDOMBONE_WEBSITE."
1068
+        if [[ $ONION_ONLY == "no" ]]; then
1069
+            INITIAL_MESSAGE=$"Welcome to the Freedombone interactive installer. Communications freedom is only a short time away.\n\nEnsure that you have your domain and dynamic DNS settings ready.\n\nFor more information please visit $FREEDOMBONE_WEBSITE."
1070
+        else
1071
+            INITIAL_MESSAGE=$"Welcome to the Freedombone interactive installer. Communications freedom is only a short time away.\n\nWeb sites created will only be viewable within a Tor browser.\n\nFor more information please visit $FREEDOMBONE_WEBSITE."
1072
+        fi
1026
     fi
1073
     fi
1027
 
1074
 
1028
     dialog --title $"Freedombone" --msgbox "$INITIAL_MESSAGE" 15 50
1075
     dialog --title $"Freedombone" --msgbox "$INITIAL_MESSAGE" 15 50
1029
 
1076
 
1030
     #choose_system_variant
1077
     #choose_system_variant
1031
-    set_main_repo
1032
     choose_username
1078
     choose_username
1033
     choose_full_name
1079
     choose_full_name
1034
     choose_social_key_management
1080
     choose_social_key_management
1040
     choose_email_address
1086
     choose_email_address
1041
     interactive_key_recovery
1087
     interactive_key_recovery
1042
 
1088
 
1089
+    if [[ "$SOCIALINSTANCE" == 'gnusocial' ]]; then
1090
+        GNUSOCIAL_DOMAIN_NAME=$DEFAULT_DOMAIN_NAME
1091
+        GNUSOCIAL_CODE=$DEFAULT_DOMAIN_CODE
1092
+        write_config_param "GNUSOCIAL_DOMAIN_NAME" "$GNUSOCIAL_DOMAIN_NAME"
1093
+        write_config_param "GNUSOCIAL_CODE" "$GNUSOCIAL_CODE"
1094
+        write_config_param "SOCIALINSTANCE" "$SOCIALINSTANCE"
1095
+        install_gnusocial
1096
+    fi
1097
+
1098
+    if [[ "$SOCIALINSTANCE" == 'postactiv' ]]; then
1099
+        POSTACTIV_DOMAIN_NAME=$DEFAULT_DOMAIN_NAME
1100
+        POSTACTIV_CODE=$DEFAULT_DOMAIN_CODE
1101
+        write_config_param "POSTACTIV_DOMAIN_NAME" "$POSTACTIV_DOMAIN_NAME"
1102
+        write_config_param "POSTACTIV_CODE" "$POSTACTIV_CODE"
1103
+        write_config_param "SOCIALINSTANCE" "$SOCIALINSTANCE"
1104
+        install_postactiv
1105
+    fi
1106
+
1043
     # delete the temporary configuration file
1107
     # delete the temporary configuration file
1044
     if [ -f temp.cfg ]; then
1108
     if [ -f temp.cfg ]; then
1045
         shred -zu temp.cfg
1109
         shred -zu temp.cfg

+ 161
- 157
src/freedombone-controlpanel View File

33
 export TEXTDOMAIN=${PROJECT_NAME}-controlpanel
33
 export TEXTDOMAIN=${PROJECT_NAME}-controlpanel
34
 export TEXTDOMAINDIR="/usr/share/locale"
34
 export TEXTDOMAINDIR="/usr/share/locale"
35
 
35
 
36
+if [[ $USER != 'root' ]]; then
37
+    # show the user version of the control panel
38
+    #${PROJECT_NAME}-controlpanel-user
39
+    controluser
40
+    exit 0
41
+fi
42
+
43
+function please_wait {
44
+        local str width height length
45
+
46
+        width=$(tput cols)
47
+        height=$(tput lines)
48
+        str=$"Please wait"
49
+        length=${#str}
50
+        clear
51
+        tput cup $((height / 2)) $(((width / 2) - (length / 2)))
52
+        echo "$str"
53
+        tput cup $((height * 3 / 5)) $(((width / 2)))
54
+        echo -n ''
55
+}
56
+
57
+please_wait
58
+
59
+# Start including files
60
+
61
+source /usr/local/bin/${PROJECT_NAME}-vars
62
+
36
 UTILS_FILES=/usr/share/${PROJECT_NAME}/utils/${PROJECT_NAME}-utils-*
63
 UTILS_FILES=/usr/share/${PROJECT_NAME}/utils/${PROJECT_NAME}-utils-*
37
 for f in $UTILS_FILES
64
 for f in $UTILS_FILES
38
 do
65
 do
45
     source $f
72
     source $f
46
 done
73
 done
47
 
74
 
75
+# End including files
76
+
48
 COMPLETION_FILE=$HOME/${PROJECT_NAME}-completed.txt
77
 COMPLETION_FILE=$HOME/${PROJECT_NAME}-completed.txt
49
 SELECTED_USERNAME=
78
 SELECTED_USERNAME=
50
 SIP_CONFIGURATION_FILE=/etc/sipwitch.conf
79
 SIP_CONFIGURATION_FILE=/etc/sipwitch.conf
94
 read_config_param SMTP_PROXY_PASSWORD
123
 read_config_param SMTP_PROXY_PASSWORD
95
 read_config_param USB_DRIVE
124
 read_config_param USB_DRIVE
96
 read_config_param MY_USERNAME
125
 read_config_param MY_USERNAME
126
+read_config_param ONION_ONLY
97
 if [[ $USB_DRIVE == *"dev"* ]]; then
127
 if [[ $USB_DRIVE == *"dev"* ]]; then
98
     USB_DRIVE=$(echo ${USB_DRIVE} | awk -F '/' '{print $3}' | sed 's|1||g' | sed 's|2||g')
128
     USB_DRIVE=$(echo ${USB_DRIVE} | awk -F '/' '{print $3}' | sed 's|1||g' | sed 's|2||g')
99
 fi
129
 fi
100
 
130
 
101
-# Mirrors settings
102
-FRIENDS_MIRRORS_SERVER=
103
-FRIENDS_MIRRORS_SSH_PORT=2222
104
-FRIENDS_MIRRORS_PASSWORD=
105
-MY_MIRRORS_PASSWORD=
106
-
107
 function any_key {
131
 function any_key {
108
     echo ' '
132
     echo ' '
109
     read -n1 -r -p $"Press any key to continue..." key
133
     read -n1 -r -p $"Press any key to continue..." key
123
 
147
 
124
     users_array=($(ls /home))
148
     users_array=($(ls /home))
125
 
149
 
126
-    delete=(mirrors git)
150
+    delete=(git)
127
     for del in ${delete[@]}
151
     for del in ${delete[@]}
128
     do
152
     do
129
         users_array=(${users_array[@]/$del})
153
         users_array=(${users_array[@]/$del})
165
             name+=("$a")
189
             name+=("$a")
166
         fi
190
         fi
167
     done
191
     done
192
+    i=$((i+1))
193
+    W+=($i "mariadb")
194
+    name+=("mariadb")
168
 
195
 
169
     selected_app_index=$(dialog --backtitle $"Freedombone Control Panel" --title $"Select App" --menu $"Select one of the following:" 24 40 17 "${W[@]}" 3>&2 2>&1 1>&3)
196
     selected_app_index=$(dialog --backtitle $"Freedombone Control Panel" --title $"Select App" --menu $"Select one of the following:" 24 40 17 "${W[@]}" 3>&2 2>&1 1>&3)
170
 
197
 
215
         fi
242
         fi
216
     fi
243
     fi
217
 
244
 
245
+    if [[ "${SELECTED_APP}" == 'mariadb' ]]; then
246
+        CURR_PASSWORD=$(${PROJECT_NAME}-pass -u root -a mariadb)
247
+        dialog --title $"MariaDB database password" \
248
+               --msgbox "\n            ${CURR_PASSWORD}" 7 40
249
+        return
250
+    fi
251
+
218
     data=$(tempfile 2>/dev/null)
252
     data=$(tempfile 2>/dev/null)
219
     trap "rm -f $data" 0 1 2 5 15
253
     trap "rm -f $data" 0 1 2 5 15
220
     dialog --title "$titlestr" \
254
     dialog --title "$titlestr" \
250
     any_key
284
     any_key
251
 }
285
 }
252
 
286
 
253
-function set_main_repo {
254
-    data=$(tempfile 2>/dev/null)
255
-    trap "rm -f $data" 0 1 2 5 15
256
-    dialog --backtitle $"Freedombone Control Panel" \
257
-           --title $"Main Repository (Mirrors)" \
258
-           --form $"If you do not wish to use the default repositories they can be obtained from mirrors on another ${PROJECT_NAME} server." 14 60 3 \
259
-           $"URL:" 1 1 "$FRIENDS_MIRRORS_SERVER" 1 14 40 15 \
260
-           $"SSH Port:" 2 1 "$FRIENDS_MIRRORS_SSH_PORT" 2 14 40 10000 \
261
-           $"Password:" 3 1 "$FRIENDS_MIRRORS_PASSWORD" 3 14 40 10000 \
262
-           2> $data
263
-    sel=$?
264
-    case $sel in
265
-        1) return;;
266
-        255) return;;
267
-    esac
268
-    new_mirrors_url=$(cat $data | sed -n 1p)
269
-    new_mirrors_ssh_port=$(cat $data | sed -n 2p)
270
-    new_mirrors_password=$(cat $data | sed -n 3p)
271
-
272
-    if [ ${#new_mirrors_url} -lt 2 ]; then
273
-        return
274
-    fi
275
-    if [ ${#new_mirrors_ssh_port} -lt 1 ]; then
276
-        return
277
-    fi
278
-    if [ ${#new_mirrors_password} -lt 10 ]; then
279
-        dialog --title $"Main Repository" \
280
-               --msgbox $'Mirrors password was too short. Should be at least 10 characters.' 6 40
281
-        return
282
-    fi
283
-
284
-    if [[ $new_mirrors_url == *"."* ]]; then
285
-        FRIENDS_MIRRORS_SERVER=$new_mirrors_url
286
-        FRIENDS_MIRRORS_SSH_PORT=$new_mirrors_ssh_port
287
-        FRIENDS_MIRRORS_PASSWORD=$new_mirrors_password
288
-
289
-        write_config_param "FRIENDS_MIRRORS_SERVER" "$FRIENDS_MIRRORS_SERVER"
290
-        write_config_param "FRIENDS_MIRRORS_SSH_PORT" "$FRIENDS_MIRRORS_SSH_PORT"
291
-        write_config_param "FRIENDS_MIRRORS_PASSWORD" "$FRIENDS_MIRRORS_PASSWORD"
292
-
293
-        # re-read the repos
294
-        read_repo_servers
295
-
296
-        dialog --title $"Main Repository" \
297
-               --msgbox $"Main repository set to $FRIENDS_MIRRORS_SERVER" 6 60
298
-    fi
299
-}
300
-
301
 function add_user {
287
 function add_user {
302
     data=$(tempfile 2>/dev/null)
288
     data=$(tempfile 2>/dev/null)
303
     trap "rm -f $data" 0 1 2 5 15
289
     trap "rm -f $data" 0 1 2 5 15
390
             if grep -q "SHOW_ICANN_ADDRESS_ON_ABOUT=0" /usr/share/${PROJECT_NAME}/apps/${PROJECT_NAME}-app-${app_name}; then
376
             if grep -q "SHOW_ICANN_ADDRESS_ON_ABOUT=0" /usr/share/${PROJECT_NAME}/apps/${PROJECT_NAME}-app-${app_name}; then
391
                 icann_address='-'
377
                 icann_address='-'
392
             fi
378
             fi
379
+            if [[ $ONION_ONLY != 'no' ]]; then
380
+                if [[ ${icann_address} != ${LOCAL_NAME}.local ]]; then
381
+                    icann_address='-'
382
+                fi
383
+            fi
393
             onion_address=$(get_app_onion_address "$app_name")
384
             onion_address=$(get_app_onion_address "$app_name")
394
             if [ ${#onion_address} -eq 0 ]; then
385
             if [ ${#onion_address} -eq 0 ]; then
395
                 onion_address="-"
386
                 onion_address="-"
469
     echo ''
460
     echo ''
470
 }
461
 }
471
 
462
 
472
-function show_mirrors_password {
473
-    if [ ! /home/mirrors ]; then
474
-        return
475
-    fi
476
-    read_config_param "MY_MIRRORS_PASSWORD"
477
-    echo 'Local Mirrors'
478
-    echo '============='
479
-    echo ''
480
-    echo -n "URL:      "
481
-    echo "$(cat ${COMPLETION_FILE} | grep 'ssh onion domain' | awk -F ':' '{print $2}')    SSH Port: $SSH_PORT"
482
-    echo "Password: $MY_MIRRORS_PASSWORD"
483
-    echo ''
484
-}
485
-
486
 function show_tahoelafs {
463
 function show_tahoelafs {
487
     if [ ! -f /home/tahoelafs/storage/private/storage.furl ]; then
464
     if [ ! -f /home/tahoelafs/storage/private/storage.furl ]; then
488
         return
465
         return
561
 }
538
 }
562
 
539
 
563
 function show_about {
540
 function show_about {
564
-    clear
565
-    echo ''
566
-    echo $'  Detecting installed apps...'
567
     detect_apps
541
     detect_apps
568
     get_apps_installed_names
542
     get_apps_installed_names
569
 
543
 
570
     clear
544
     clear
545
+    echo "==== ${PROJECT_NAME} version ${VERSION} ($DEBIAN_VERSION) ===="
546
+    echo ''
571
     show_ip_addresses
547
     show_ip_addresses
572
     show_tor_bridges
548
     show_tor_bridges
573
     show_ssh_public_key
549
     show_ssh_public_key
574
     show_domains
550
     show_domains
575
     show_tahoelafs
551
     show_tahoelafs
576
-    show_mirrors_password
577
     show_users
552
     show_users
578
     any_key
553
     any_key
579
 }
554
 }
583
 
558
 
584
     users_array=($(ls /home))
559
     users_array=($(ls /home))
585
 
560
 
586
-    delete=(mirrors git)
561
+    delete=(git)
587
     for del in ${delete[@]}
562
     for del in ${delete[@]}
588
     do
563
     do
589
         users_array=(${users_array[@]/$del})
564
         users_array=(${users_array[@]/$del})
1018
     dialog --title $"USB Master Keydrive" \
993
     dialog --title $"USB Master Keydrive" \
1019
            --msgbox $"Plug in a LUKS encrypted USB drive" 6 40
994
            --msgbox $"Plug in a LUKS encrypted USB drive" 6 40
1020
     clear
995
     clear
1021
-    ${PROJECT_NAME}-keydrive -u $SELECTED_USERNAME --master 'yes'
996
+    detect_usb_drive
997
+    ${PROJECT_NAME}-keydrive -u $SELECTED_USERNAME --master 'yes' -d $USB_DRIVE
1022
     any_key
998
     any_key
1023
 }
999
 }
1024
 
1000
 
1030
     dialog --title $"USB Fragment Keydrive" \
1006
     dialog --title $"USB Fragment Keydrive" \
1031
            --msgbox $"Plug in a LUKS encrypted USB drive" 6 40
1007
            --msgbox $"Plug in a LUKS encrypted USB drive" 6 40
1032
     clear
1008
     clear
1033
-    ${PROJECT_NAME}-keydrive -u $SELECTED_USERNAME
1009
+    detect_usb_drive
1010
+    ${PROJECT_NAME}-keydrive -u $SELECTED_USERNAME -d $USB_DRIVE
1034
     any_key
1011
     any_key
1035
 }
1012
 }
1036
 
1013
 
1064
     fi
1041
     fi
1065
 
1042
 
1066
     utils_installed=(configfiles
1043
     utils_installed=(configfiles
1044
+                     blocklist
1067
                      mariadb
1045
                      mariadb
1068
                      letsencrypt
1046
                      letsencrypt
1069
                      passwords
1047
                      passwords
1137
             $restore_command
1115
             $restore_command
1138
             retcode="$?"
1116
             retcode="$?"
1139
             if [[ "$retcode" != "0" ]]; then
1117
             if [[ "$retcode" != "0" ]]; then
1118
+                any_key
1140
                 if [[ "$1" == "local" ]]; then
1119
                 if [[ "$1" == "local" ]]; then
1141
                     dialog --title $"Restore all apps from USB" \
1120
                     dialog --title $"Restore all apps from USB" \
1142
                            --msgbox $"Restore failed with code $retcode" 6 60
1121
                            --msgbox $"Restore failed with code $retcode" 6 60
1161
         $restore_command "${app_name}"
1140
         $restore_command "${app_name}"
1162
         retcode="$?"
1141
         retcode="$?"
1163
         if [[ "$retcode" != "0" ]]; then
1142
         if [[ "$retcode" != "0" ]]; then
1143
+            any_key
1164
             dialog --title $"Restore apps from USB" \
1144
             dialog --title $"Restore apps from USB" \
1165
                    --msgbox $"Restore of ${app_name} failed with code $retcode" 6 60
1145
                    --msgbox $"Restore of ${app_name} failed with code $retcode" 6 60
1166
             return
1146
             return
1346
         1) return;;
1326
         1) return;;
1347
         255) return;;
1327
         255) return;;
1348
     esac
1328
     esac
1349
-    shutdown now
1329
+    systemctl poweroff
1350
 }
1330
 }
1351
 
1331
 
1352
 function restart_system {
1332
 function restart_system {
1359
         1) return;;
1339
         1) return;;
1360
         255) return;;
1340
         255) return;;
1361
     esac
1341
     esac
1362
-    reboot
1342
+    systemctl reboot -i
1363
 }
1343
 }
1364
 
1344
 
1365
 function change_system_name {
1345
 function change_system_name {
1404
         echo $'Changing to a dynamic IP address.'
1384
         echo $'Changing to a dynamic IP address.'
1405
         echo ''
1385
         echo ''
1406
         echo $"System is rebooting. You may need to close this terminal and log in from a new one."
1386
         echo $"System is rebooting. You may need to close this terminal and log in from a new one."
1407
-        reboot
1387
+        systemctl reboot -i
1408
     fi
1388
     fi
1409
 }
1389
 }
1410
 
1390
 
1416
 
1396
 
1417
     NEW_STATIC_IP=
1397
     NEW_STATIC_IP=
1418
     NEW_STATIC_GATEWAY=
1398
     NEW_STATIC_GATEWAY=
1419
-    if grep -q 'iface eth0 inet static' /etc/network/interfaces; then
1420
-        STATIC_IP=$(cat /etc/network/interfaces | grep "address " | head -n 1 | awk -F ' ' '{print $2}')
1421
-        STATIC_GATEWAY=$(cat /etc/network/interfaces | grep "gateway " | head -n 1 | awk -F ' ' '{print $2}')
1399
+    if [ -f /etc/network/interfaces.d/static ]; then
1400
+        STATIC_IP=$(cat /etc/network/interfaces.d/static | grep "address " | head -n 1 | awk -F ' ' '{print $2}')
1401
+        STATIC_GATEWAY=$(cat /etc/network/interfaces.d/static | grep "gateway " | head -n 1 | awk -F ' ' '{print $2}')
1422
     fi
1402
     fi
1423
 
1403
 
1424
     # get the IP for the box
1404
     # get the IP for the box
1456
     esac
1436
     esac
1457
 
1437
 
1458
     if [[ "$NEW_STATIC_GATEWAY" == *"."* && "$NEW_STATIC_IP" == *"."* ]]; then
1438
     if [[ "$NEW_STATIC_GATEWAY" == *"."* && "$NEW_STATIC_IP" == *"."* ]]; then
1459
-        ip_addresses_have_changed=
1460
-        if ! grep -q "address ${NEW_STATIC_IP}" /etc/network/interfaces; then
1461
-            ip_addresses_have_changed=1
1462
-        fi
1463
-        if ! grep -q "gateway ${NEW_STATIC_GATEWAY}" /etc/network/interfaces; then
1464
-            ip_addresses_have_changed=1
1439
+        ip_addresses_have_changed=1
1440
+        if [ -f /etc/network/interfaces.d/static ]; then
1441
+            ip_addresses_have_changed=
1442
+            if ! grep -q "address ${NEW_STATIC_IP}" /etc/network/interfaces.d/static; then
1443
+                ip_addresses_have_changed=1
1444
+            fi
1445
+            if ! grep -q "gateway ${NEW_STATIC_GATEWAY}" /etc/network/interfaces.d/static; then
1446
+                ip_addresses_have_changed=1
1447
+            fi
1465
         fi
1448
         fi
1466
         if [ $ip_addresses_have_changed ]; then
1449
         if [ $ip_addresses_have_changed ]; then
1467
             write_config_param "NETWORK_IS_STATIC" "1"
1450
             write_config_param "NETWORK_IS_STATIC" "1"
1483
                 esac
1466
                 esac
1484
             fi
1467
             fi
1485
 
1468
 
1469
+            echo '# This file describes the network interfaces available on your system' > /etc/network/interfaces
1470
+            echo '# and how to activate them. For more information, see interfaces(5).' >> /etc/network/interfaces
1471
+            echo 'source /etc/network/interfaces.d/*' >> /etc/network/interfaces
1472
+
1486
             if [ ! $static_wifi_address ]; then
1473
             if [ ! $static_wifi_address ]; then
1487
                 # wired network
1474
                 # wired network
1488
                 remove_wifi_startup_script
1475
                 remove_wifi_startup_script
1489
-                echo '# This file describes the network interfaces available on your system' > /etc/network/interfaces
1490
-                echo '# and how to activate them. For more information, see interfaces(5).' >> /etc/network/interfaces
1491
-                echo '' >> /etc/network/interfaces
1492
-                echo '# The loopback network interface' >> /etc/network/interfaces
1493
-                echo 'auto lo' >> /etc/network/interfaces
1494
-                echo 'iface lo inet loopback' >> /etc/network/interfaces
1495
-                echo '' >> /etc/network/interfaces
1496
-                echo '# The primary network interface' >> /etc/network/interfaces
1497
-                echo 'auto eth0' >> /etc/network/interfaces
1498
-                echo 'iface eth0 inet static' >> /etc/network/interfaces
1499
-                echo "    address ${NEW_STATIC_IP}" >> /etc/network/interfaces
1500
-                echo '    netmask 255.255.255.0' >> /etc/network/interfaces
1501
-                echo "    gateway ${NEW_STATIC_GATEWAY}" >> /etc/network/interfaces
1502
-                echo "    dns-nameservers 213.73.91.35 85.214.20.141" >> /etc/network/interfaces
1503
-                echo '# Example to keep MAC address between reboots' >> /etc/network/interfaces
1504
-                echo '#hwaddress ether DE:AD:BE:EF:CA:FE' >> /etc/network/interfaces
1505
-                echo '' >> /etc/network/interfaces
1506
-                echo '# The secondary network interface' >> /etc/network/interfaces
1507
-                echo '#auto eth1' >> /etc/network/interfaces
1508
-                echo '#iface eth1 inet dhcp' >> /etc/network/interfaces
1509
-                echo '' >> /etc/network/interfaces
1510
-                echo '# WiFi Example' >> /etc/network/interfaces
1511
-                echo "#auto $WIFI_INTERFACE" >> /etc/network/interfaces
1512
-                echo "#iface $WIFI_INTERFACE inet dhcp" >> /etc/network/interfaces
1513
-                echo '#    wpa-ssid "essid"' >> /etc/network/interfaces
1514
-                echo '#    wpa-psk  "password"' >> /etc/network/interfaces
1515
-                echo '' >> /etc/network/interfaces
1516
-                echo '# Ethernet/RNDIS gadget (g_ether)' >> /etc/network/interfaces
1517
-                echo '# ... or on host side, usbnet and random hwaddr' >> /etc/network/interfaces
1518
-                echo '# Note on some boards, usb0 is automaticly setup with an init script' >> /etc/network/interfaces
1519
-                echo '#iface usb0 inet static' >> /etc/network/interfaces
1520
-                echo '#    address 192.168.7.2' >> /etc/network/interfaces
1521
-                echo '#    netmask 255.255.255.0' >> /etc/network/interfaces
1522
-                echo '#    network 192.168.7.0' >> /etc/network/interfaces
1523
-                echo '#    gateway 192.168.7.1' >> /etc/network/interfaces
1476
+
1477
+                echo 'auto eth0' > /etc/network/interfaces.d/static
1478
+                echo 'iface eth0 inet static' >> /etc/network/interfaces.d/static
1479
+                echo "    address ${NEW_STATIC_IP}" >> /etc/network/interfaces.d/static
1480
+                echo '    netmask 255.255.255.0' >> /etc/network/interfaces.d/static
1481
+                echo "    gateway ${NEW_STATIC_GATEWAY}" >> /etc/network/interfaces.d/static
1524
             else
1482
             else
1525
                 # wifi network
1483
                 # wifi network
1526
                 wifi_settings
1484
                 wifi_settings
1540
                    --yesno $"\nFor the change to take effect your system will now need to reboot. Do this now?" 8 60
1498
                    --yesno $"\nFor the change to take effect your system will now need to reboot. Do this now?" 8 60
1541
             sel=$?
1499
             sel=$?
1542
             case $sel in
1500
             case $sel in
1543
-                0) reboot;;
1501
+                0) systemctl reboot -i;;
1544
             esac
1502
             esac
1545
         fi
1503
         fi
1546
     fi
1504
     fi
1645
         WIFI_PASSPHRASE=$TEMP_WIFI_PASSPHRASE
1603
         WIFI_PASSPHRASE=$TEMP_WIFI_PASSPHRASE
1646
 
1604
 
1647
         ${PROJECT_NAME}-wifi -i $WIFI_INTERFACE -s $WIFI_SSID -t $WIFI_TYPE -p $WIFI_PASSPHRASE --hotspot $WIFI_HOTSPOT $WIFI_EXTRA
1605
         ${PROJECT_NAME}-wifi -i $WIFI_INTERFACE -s $WIFI_SSID -t $WIFI_TYPE -p $WIFI_PASSPHRASE --hotspot $WIFI_HOTSPOT $WIFI_EXTRA
1606
+        if [ ! "$?" = "0" ]; then
1607
+            echo $"Can't enable wifi hotspot"
1608
+            any_key
1609
+        fi
1648
     else
1610
     else
1649
         WIFI_HOTSPOT=$TEMP_WIFI_HOTSPOT
1611
         WIFI_HOTSPOT=$TEMP_WIFI_HOTSPOT
1650
         WIFI_SSID=$TEMP_WIFI_SSID
1612
         WIFI_SSID=$TEMP_WIFI_SSID
1762
 
1724
 
1763
     # change muttrc
1725
     # change muttrc
1764
     if [ $SMTP_PROXY_ENABLE != $'no' ]; then
1726
     if [ $SMTP_PROXY_ENABLE != $'no' ]; then
1765
-        if ! grep "set smtp_url" $MUTTRC_FILE; then
1727
+        if ! grep -q "set smtp_url" $MUTTRC_FILE; then
1766
             echo "set smtp_url=\"${SMTP_PROXY_PROTOCOL}://${SMTP_PROXY_USERNAME}:${SMTP_PROXY_PASSWORD}@${SMTP_PROXY_SERVER}:${SMTP_PROXY_PORT}/\"" >> $MUTTRC_FILE
1728
             echo "set smtp_url=\"${SMTP_PROXY_PROTOCOL}://${SMTP_PROXY_USERNAME}:${SMTP_PROXY_PASSWORD}@${SMTP_PROXY_SERVER}:${SMTP_PROXY_PORT}/\"" >> $MUTTRC_FILE
1767
         else
1729
         else
1768
             sed -i "s|set smtp_url=.*|set smtp_url=\"${SMTP_PROXY_PROTOCOL}://${SMTP_PROXY_USERNAME}:${SMTP_PROXY_PASSWORD}@${SMTP_PROXY_SERVER}:${SMTP_PROXY_PORT}/\"|g" $MUTTRC_FILE
1730
             sed -i "s|set smtp_url=.*|set smtp_url=\"${SMTP_PROXY_PROTOCOL}://${SMTP_PROXY_USERNAME}:${SMTP_PROXY_PASSWORD}@${SMTP_PROXY_SERVER}:${SMTP_PROXY_PORT}/\"|g" $MUTTRC_FILE
1769
         fi
1731
         fi
1770
         sed -i 's|#set smtp_url|set smtp_url|g' $MUTTRC_FILE
1732
         sed -i 's|#set smtp_url|set smtp_url|g' $MUTTRC_FILE
1771
     else
1733
     else
1772
-        if grep "set smtp_url" $MUTTRC_FILE; then
1734
+        if grep -q "set smtp_url" $MUTTRC_FILE; then
1773
             sed -i 's|set smtp_url|#set smtp_url|g' $MUTTRC_FILE
1735
             sed -i 's|set smtp_url|#set smtp_url|g' $MUTTRC_FILE
1774
         fi
1736
         fi
1775
     fi
1737
     fi
1883
     esac
1845
     esac
1884
 }
1846
 }
1885
 
1847
 
1848
+function ip_blocking_add {
1849
+    data=$(tempfile 2>/dev/null)
1850
+    trap "rm -f $data" 0 1 2 5 15
1851
+    dialog --title $"Block an IP address" \
1852
+           --backtitle $"Freedombone Control Panel" \
1853
+           --inputbox $"Enter the IP address that you wish to block" 8 60 "" 2>$data
1854
+    sel=$?
1855
+    case $sel in
1856
+        0)
1857
+            blocked_ip=$(<$data)
1858
+            if [ ${#blocked_ip} -gt 2 ]; then
1859
+                if [[ "${blocked_ip}" == *'.'* ]]; then
1860
+                    firewall_block_ip $blocked_ip
1861
+                    if [[ "${blocked_ip}" != *'@'* ]]; then
1862
+                        dialog --title $"Block an IP address" \
1863
+                               --msgbox $"The IP address $blocked_ip has been blocked" 6 40
1864
+                    fi
1865
+                fi
1866
+            fi
1867
+            ;;
1868
+    esac
1869
+}
1870
+
1886
 function domain_blocking_remove {
1871
 function domain_blocking_remove {
1887
     data=$(tempfile 2>/dev/null)
1872
     data=$(tempfile 2>/dev/null)
1888
     trap "rm -f $data" 0 1 2 5 15
1873
     trap "rm -f $data" 0 1 2 5 15
1909
     esac
1894
     esac
1910
 }
1895
 }
1911
 
1896
 
1897
+function ip_blocking_remove {
1898
+    data=$(tempfile 2>/dev/null)
1899
+    trap "rm -f $data" 0 1 2 5 15
1900
+    dialog --title $"Unblock an IP address" \
1901
+           --backtitle $"Freedombone Control Panel" \
1902
+           --inputbox $"Enter the IP address that you wish to unblock" 8 60 "" 2>$data
1903
+    sel=$?
1904
+    case $sel in
1905
+        0)
1906
+            unblocked_ip=$(<$data)
1907
+            if [ ${#unblocked_ip} -gt 2 ]; then
1908
+                if [[ "${unblocked_ip}" == *'.'* ]]; then
1909
+                    firewall_unblock_ip $unblocked_ip
1910
+                    if [[ "${unblocked_ip}" != *'@'* ]]; then
1911
+                        dialog --title $"Unblock an IP address" \
1912
+                               --msgbox $"The IP address $unblocked_ip has been unblocked" 6 40
1913
+                    fi
1914
+                fi
1915
+            fi
1916
+            ;;
1917
+    esac
1918
+}
1919
+
1912
 function domain_blocking_show {
1920
 function domain_blocking_show {
1913
     if [ -f $FIREWALL_DOMAINS ]; then
1921
     if [ -f $FIREWALL_DOMAINS ]; then
1914
         clear
1922
         clear
1930
         trap "rm -f $data" 0 1 2 5 15
1938
         trap "rm -f $data" 0 1 2 5 15
1931
         dialog --backtitle $"Freedombone Control Panel" \
1939
         dialog --backtitle $"Freedombone Control Panel" \
1932
                --title $"Domain or User Blocking" \
1940
                --title $"Domain or User Blocking" \
1933
-               --radiolist $"Choose an operation:" 12 60 4 \
1941
+               --radiolist $"Choose an operation:" 14 60 6 \
1934
                1 $"Block a domain or user" off \
1942
                1 $"Block a domain or user" off \
1935
                2 $"Unblock a domain or user" off \
1943
                2 $"Unblock a domain or user" off \
1936
-               3 $"Show blocked domains and users" off \
1937
-               4 $"Back to main menu" on 2> $data
1944
+               3 $"Block an IP address" off \
1945
+               4 $"Unblock an IP address" off \
1946
+               5 $"Show blocked domains and users" off \
1947
+               6 $"Back to main menu" on 2> $data
1938
         sel=$?
1948
         sel=$?
1939
         case $sel in
1949
         case $sel in
1940
             1) break;;
1950
             1) break;;
1943
         case $(cat $data) in
1953
         case $(cat $data) in
1944
             1) domain_blocking_add;;
1954
             1) domain_blocking_add;;
1945
             2) domain_blocking_remove;;
1955
             2) domain_blocking_remove;;
1946
-            3) domain_blocking_show;;
1947
-            4) break;;
1956
+            3) ip_blocking_add;;
1957
+            4) ip_blocking_remove;;
1958
+            5) domain_blocking_show;;
1959
+            6) break;;
1948
         esac
1960
         esac
1949
     done
1961
     done
1950
 }
1962
 }
2007
         if [ -f /etc/hostapd/hostapd.conf ]; then
2019
         if [ -f /etc/hostapd/hostapd.conf ]; then
2008
             status_str=$'Hotspot ON'
2020
             status_str=$'Hotspot ON'
2009
         else
2021
         else
2010
-            if grep -q "# wifi enabled" /etc/network/interfaces; then
2022
+            if [ -f /etc/network/interfaces.d/wifi ]; then
2011
                 status_str=$'Wifi ON'
2023
                 status_str=$'Wifi ON'
2012
             fi
2024
             fi
2013
         fi
2025
         fi
2083
         trap "rm -f $data" 0 1 2 5 15
2095
         trap "rm -f $data" 0 1 2 5 15
2084
         dialog --backtitle $"Freedombone Control Panel" \
2096
         dialog --backtitle $"Freedombone Control Panel" \
2085
                --title $"Control Panel" \
2097
                --title $"Control Panel" \
2086
-               --radiolist $"Choose an operation:" 29 70 21 \
2098
+               --radiolist $"Choose an operation:" 28 70 20 \
2087
                1 $"About this system" off \
2099
                1 $"About this system" off \
2088
                2 $"Passwords" off \
2100
                2 $"Passwords" off \
2089
                3 $"Backup and Restore" off \
2101
                3 $"Backup and Restore" off \
2097
                11 $"Email Menu" off \
2109
                11 $"Email Menu" off \
2098
                12 $"Domain or User Blocking" off \
2110
                12 $"Domain or User Blocking" off \
2099
                13 $"Security Settings" off \
2111
                13 $"Security Settings" off \
2100
-               14 $"Set the main repository (repo mirrors)" off \
2101
-               15 $"Change the name of this system" off \
2102
-               16 $"Set a static local IP address" off \
2103
-               17 $"Wifi menu" off \
2104
-               18 $"Check for updates" off \
2105
-               19 $"Power off the system" off \
2106
-               20 $"Restart the system" off \
2107
-               21 $"Exit" on 2> $data
2112
+               14 $"Change the name of this system" off \
2113
+               15 $"Set a static local IP address" off \
2114
+               16 $"Wifi menu" off \
2115
+               17 $"Check for updates" off \
2116
+               18 $"Power off the system" off \
2117
+               19 $"Restart the system" off \
2118
+               20 $"Exit" on 2> $data
2108
         sel=$?
2119
         sel=$?
2109
         case $sel in
2120
         case $sel in
2110
             1) exit 1;;
2121
             1) exit 1;;
2111
             255) exit 1;;
2122
             255) exit 1;;
2112
         esac
2123
         esac
2124
+        please_wait
2113
         case $(cat $data) in
2125
         case $(cat $data) in
2114
             1) show_about;;
2126
             1) show_about;;
2115
             2) view_or_change_passwords;;
2127
             2) view_or_change_passwords;;
2117
             4) show_firewall;;
2129
             4) show_firewall;;
2118
             5) reset_tripwire;;
2130
             5) reset_tripwire;;
2119
             6) menu_app_settings;;
2131
             6) menu_app_settings;;
2120
-            7) ${PROJECT_NAME}-addremove
2132
+            7) /usr/local/bin/addremove
2121
                if [ ! "$?" = "0" ]; then
2133
                if [ ! "$?" = "0" ]; then
2122
                    any_key
2134
                    any_key
2123
                fi
2135
                fi
2128
             11) menu_email;;
2140
             11) menu_email;;
2129
             12) domain_blocking;;
2141
             12) domain_blocking;;
2130
             13) security_settings;;
2142
             13) security_settings;;
2131
-            14) set_main_repo;;
2132
-            15) change_system_name;;
2133
-            16) set_static_IP;;
2134
-            17) menu_wifi;;
2135
-            18) check_for_updates;;
2136
-            19) shut_down_system;;
2137
-            20) restart_system;;
2138
-            21) break;;
2143
+            14) change_system_name;;
2144
+            15) set_static_IP;;
2145
+            16) menu_wifi;;
2146
+            17) check_for_updates;;
2147
+            18) shut_down_system;;
2148
+            19) restart_system;;
2149
+            20) break;;
2139
         esac
2150
         esac
2140
     done
2151
     done
2141
 }
2152
 }
2142
 
2153
 
2143
-if [[ $USER != 'root' ]]; then
2144
-    # show the user version of the control panel
2145
-    ${PROJECT_NAME}-controlpanel-user
2146
-    exit 0
2147
-fi
2148
-
2149
 if [ ! -f $COMPLETION_FILE ]; then
2154
 if [ ! -f $COMPLETION_FILE ]; then
2150
     echo $'This command should only be run on an installed Freedombone system'
2155
     echo $'This command should only be run on an installed Freedombone system'
2151
     exit 1
2156
     exit 1
2152
 fi
2157
 fi
2153
 
2158
 
2154
 ADMIN_USER=$(get_completion_param "Admin user")
2159
 ADMIN_USER=$(get_completion_param "Admin user")
2155
-read_repo_servers
2156
 menu_top_level
2160
 menu_top_level
2157
 clear
2161
 clear
2158
 cat /etc/motd
2162
 cat /etc/motd

+ 10
- 6
src/freedombone-controlpanel-user View File

34
 export TEXTDOMAINDIR="/usr/share/locale"
34
 export TEXTDOMAINDIR="/usr/share/locale"
35
 
35
 
36
 MY_EMAIL_ADDRESS=$USER@$HOSTNAME
36
 MY_EMAIL_ADDRESS=$USER@$HOSTNAME
37
-GPG_ID=$(gpg --fingerprint $MY_EMAIL_ADDRESS | grep -i "pub" | head -n 1 | awk -F '/' '{print $2}' | awk -F ' ' '{print $1}')
38
-GPG_BACKUP_ID=$(gpg --fingerprint "(backup key)" | grep -i "pub" | head -n 1 | awk -F '/' '{print $2}' | awk -F ' ' '{print $1}')
37
+GPG_ID=$(gpg --list-keys $MY_EMAIL_ADDRESS | sed -n '2p' | sed 's/^[ \t]*//')
38
+GPG_BACKUP_ID=$(gpg --list-keys "(backup key)" | sed -n '2p' | sed 's/^[ \t]*//')
39
+
40
+# Start including files
39
 
41
 
40
 UTILS_FILES=/usr/share/${PROJECT_NAME}/utils/${PROJECT_NAME}-utils-*
42
 UTILS_FILES=/usr/share/${PROJECT_NAME}/utils/${PROJECT_NAME}-utils-*
41
 for f in $UTILS_FILES
43
 for f in $UTILS_FILES
49
   source $f
51
   source $f
50
 done
52
 done
51
 
53
 
54
+# End including files
55
+
52
 function any_key {
56
 function any_key {
53
     echo ' '
57
     echo ' '
54
     read -n1 -r -p $"Press any key to continue..." key
58
     read -n1 -r -p $"Press any key to continue..." key
398
 }
402
 }
399
 
403
 
400
 function show_gpg_key {
404
 function show_gpg_key {
401
-    GPG_FINGERPRINT=$(gpg --fingerprint $MY_EMAIL_ADDRESS | grep -i "key fingerprint" | head -n 1 | awk -F '= ' '{print $2}')
402
-    GPG_DATE=$(gpg --fingerprint $MY_EMAIL_ADDRESS | grep -i "pub" | head -n 1 | awk -F '/' '{print $2}' | awk -F ' ' '{print $2}')
405
+    GPG_FINGERPRINT=$(gpg --fingerprint $MY_EMAIL_ADDRESS | sed -n '2p' | sed 's/^[ \t]*//')
406
+    GPG_DATE=$(gpg --fingerprint $MY_EMAIL_ADDRESS | grep -i "pub" | head -n 1 | awk -F ' ' '{print $3}')
403
     dialog --title $"My PGP/GPG Key" \
407
     dialog --title $"My PGP/GPG Key" \
404
            --backtitle $"Freedombone User Control Panel" \
408
            --backtitle $"Freedombone User Control Panel" \
405
            --msgbox $"Email Address: $MY_EMAIL_ADDRESS\n\nKey ID: $GPG_ID\n\nFingerprint: $GPG_FINGERPRINT\n\nCreated: $GPG_DATE" 12 70
409
            --msgbox $"Email Address: $MY_EMAIL_ADDRESS\n\nKey ID: $GPG_ID\n\nFingerprint: $GPG_FINGERPRINT\n\nCreated: $GPG_DATE" 12 70
619
         fi
623
         fi
620
         sed -i 's|#set smtp_url|set smtp_url|g' $MUTTRC_FILE
624
         sed -i 's|#set smtp_url|set smtp_url|g' $MUTTRC_FILE
621
     else
625
     else
622
-        if grep "set smtp_url" $MUTTRC_FILE; then
626
+        if grep -q "set smtp_url" $MUTTRC_FILE; then
623
             sed -i 's|set smtp_url|#set smtp_url|g' $MUTTRC_FILE
627
             sed -i 's|set smtp_url|#set smtp_url|g' $MUTTRC_FILE
624
         fi
628
         fi
625
     fi
629
     fi
750
         clear
754
         clear
751
         exit 0
755
         exit 0
752
     fi
756
     fi
753
-    sudo ${PROJECT_NAME}-controlpanel
757
+    sudo /usr/local/bin/control
754
 }
758
 }
755
 
759
 
756
 function sign_keys {
760
 function sign_keys {

+ 23
- 7
src/freedombone-freedns View File

13
 # License
13
 # License
14
 # =======
14
 # =======
15
 #
15
 #
16
-# Copyright (C) 2016 Bob Mottram <bob@freedombone.net>
16
+# Copyright (C) 2016-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
33
 export TEXTDOMAIN=${PROJECT_NAME}-freedns
33
 export TEXTDOMAIN=${PROJECT_NAME}-freedns
34
 export TEXTDOMAINDIR="/usr/share/locale"
34
 export TEXTDOMAINDIR="/usr/share/locale"
35
 
35
 
36
+VERBOSE=
36
 CONFIGURATION_FILE=$HOME/${PROJECT_NAME}.cfg
37
 CONFIGURATION_FILE=$HOME/${PROJECT_NAME}.cfg
37
-FREEDNS_WGET='wget -q --read-timeout=0.0 --waitretry=5 --tries=4 https://freedns.afraid.org/dynamic/update.php?'
38
+FREEDNS_WGET='wget --read-timeout=0.0 --waitretry=5 --tries=4 https://freedns.afraid.org/dynamic/update.php?'
39
+
40
+if [[ "$1" == "--verbose" || "$1" == "-v" ]]; then
41
+    VERBOSE=1
42
+fi
38
 
43
 
39
 if [ ! -f $CONFIGURATION_FILE ]; then
44
 if [ ! -f $CONFIGURATION_FILE ]; then
40
     exit 0
45
     exit 0
47
 }
52
 }
48
 
53
 
49
 detected_codes=()
54
 detected_codes=()
50
-codelines=($(grep "_CODE=" $CONFIGURATION_FILE | uniq))
51
-for line in "${codelines[@]}"
52
-do
55
+codelines=$(grep "_CODE=" $CONFIGURATION_FILE | uniq)
56
+while read -r line; do
53
     code=$(echo "$line" | awk -F '=' '{print $2}')
57
     code=$(echo "$line" | awk -F '=' '{print $2}')
54
     item_in_array "$code" "${detected_codes[@]}"
58
     item_in_array "$code" "${detected_codes[@]}"
55
     if [[ $? != 0 ]]; then
59
     if [[ $? != 0 ]]; then
56
         detected_codes+=("$code")
60
         detected_codes+=("$code")
57
     fi
61
     fi
58
-done
62
+done <<< "$codelines"
59
 
63
 
60
 if [ ! -d $HOME/.freedns-update ]; then
64
 if [ ! -d $HOME/.freedns-update ]; then
61
     mkdir $HOME/.freedns-update
65
     mkdir $HOME/.freedns-update
63
 cd $HOME/.freedns-update
67
 cd $HOME/.freedns-update
64
 for code in "${detected_codes[@]}"
68
 for code in "${detected_codes[@]}"
65
 do
69
 do
66
-    $FREEDNS_WGET${code}
70
+    if [ $VERBOSE ]; then
71
+        echo $"command: $FREEDNS_WGET${code}="
72
+        $FREEDNS_WGET${code}=
73
+    else
74
+        if [ -f /tmp/freedns ]; then
75
+            rm /tmp/freedns
76
+        fi
77
+        $FREEDNS_WGET${code}= >> /tmp/freedns 2>&1
78
+    fi
67
 done
79
 done
68
 
80
 
81
+if [ -f /tmp/freedns ]; then
82
+    rm /tmp/freedns
83
+fi
84
+
69
 exit 0
85
 exit 0

+ 19
- 2
src/freedombone-image View File

93
 # An optional freedombone configuration file
93
 # An optional freedombone configuration file
94
 CONFIG_FILENAME=
94
 CONFIG_FILENAME=
95
 
95
 
96
-DEFAULT_DOMAIN_NAME="${PROJECT_NAME}.local"
96
+DEFAULT_DOMAIN_NAME="${LOCAL_NAME}.local"
97
 
97
 
98
 # Minimum number of characters in a password
98
 # Minimum number of characters in a password
99
 MINIMUM_PASSWORD_LENGTH=$(cat /usr/share/${PROJECT_NAME}/utils/${PROJECT_NAME}-utils-passwords | grep 'MINIMUM_PASSWORD_LENGTH=' | head -n 1 | awk -F '=' '{print $2}')
99
 MINIMUM_PASSWORD_LENGTH=$(cat /usr/share/${PROJECT_NAME}/utils/${PROJECT_NAME}-utils-passwords | grep 'MINIMUM_PASSWORD_LENGTH=' | head -n 1 | awk -F '=' '{print $2}')
138
 # a new identity at every shutdown/boot
138
 # a new identity at every shutdown/boot
139
 AMNESIC='no'
139
 AMNESIC='no'
140
 
140
 
141
+# Is this a dedicated gnusocial or postactiv instance?
142
+SOCIALINSTANCE=
143
+
141
 # Versions used for Arch/Parabola setup
144
 # Versions used for Arch/Parabola setup
142
 MBR_VERSION='1.1.11'
145
 MBR_VERSION='1.1.11'
143
 
146
 
400
             shift
403
             shift
401
             PROJECT_REPO="$1"
404
             PROJECT_REPO="$1"
402
             ;;
405
             ;;
406
+        --social|--instance)
407
+            shift
408
+            SOCIALINSTANCE="$1"
409
+            ;;
403
         -m|--mirror)
410
         -m|--mirror)
404
             shift
411
             shift
405
             MIRROR="$1"
412
             MIRROR="$1"
443
             image_setup "$1"
450
             image_setup "$1"
444
             exit 0
451
             exit 0
445
             ;;
452
             ;;
453
+        --local|--localname)
454
+            shift
455
+            LOCAL_NAME="$1"
456
+            ;;
446
         *)
457
         *)
447
             # unknown option
458
             # unknown option
448
             ;;
459
             ;;
546
     IMAGE_NAME="${IMAGE_NAME}-amnesic"
557
     IMAGE_NAME="${IMAGE_NAME}-amnesic"
547
 fi
558
 fi
548
 
559
 
560
+if [[ "$SOCIALINSTANCE" == "gnusocial" || "$SOCIALINSTANCE" == "postactiv" ]]; then
561
+    IMAGE_NAME="${IMAGE_NAME}-${SOCIALINSTANCE}"
562
+fi
563
+
549
 cd $TEMPBUILD_DIR
564
 cd $TEMPBUILD_DIR
550
 make $IMAGE_TYPE \
565
 make $IMAGE_TYPE \
551
      MYUSERNAME="$USERNAME" \
566
      MYUSERNAME="$USERNAME" \
580
      VARIANT="$VARIANT" \
595
      VARIANT="$VARIANT" \
581
      MINIMUM_PASSWORD_LENGTH="$MINIMUM_PASSWORD_LENGTH" \
596
      MINIMUM_PASSWORD_LENGTH="$MINIMUM_PASSWORD_LENGTH" \
582
      INSECURE="$INSECURE" \
597
      INSECURE="$INSECURE" \
583
-     AMNESIC="$AMNESIC"
598
+     AMNESIC="$AMNESIC" \
599
+     SOCIALINSTANCE="$SOCIALINSTANCE" \
600
+     LOCAL_NAME="$LOCAL_NAME"
584
 
601
 
585
 if [ ! "$?" = "0" ]; then
602
 if [ ! "$?" = "0" ]; then
586
     echo $'Build failed'
603
     echo $'Build failed'

+ 234
- 127
src/freedombone-image-customise View File

30
 set -x
30
 set -x
31
 
31
 
32
 PROJECT_NAME='freedombone'
32
 PROJECT_NAME='freedombone'
33
+LOCAL_NAME=${PROJECT_NAME}
33
 INSTALL_DIR=/root/build
34
 INSTALL_DIR=/root/build
34
 COMPLETION_FILE=$HOME/${PROJECT_NAME}-completed.txt
35
 COMPLETION_FILE=$HOME/${PROJECT_NAME}-completed.txt
35
 
36
 
106
 # a new identity at every shutdown/boot
107
 # a new identity at every shutdown/boot
107
 AMNESIC='no'
108
 AMNESIC='no'
108
 
109
 
110
+# Whether this is a dedicated gnusocial or postactiv instance
111
+SOCIALINSTANCE=
112
+
109
 # defines the initial keyboard layout
113
 # defines the initial keyboard layout
110
 KEYBOARD_MAP='gb'
114
 KEYBOARD_MAP='gb'
111
 
115
 
174
 }
178
 }
175
 
179
 
176
 configure_networking() {
180
 configure_networking() {
181
+    chroot "$rootdir" apt-get -yq install resolvconf
182
+
177
     if [[ "$MACHINE" == "beaglebonewifi" ]]; then
183
     if [[ "$MACHINE" == "beaglebonewifi" ]]; then
178
         # Allow networking over USB in order to configure the
184
         # Allow networking over USB in order to configure the
179
         # wifi login settings
185
         # wifi login settings
180
-        echo 'auto lo' > $rootdir/etc/network/interfaces
181
-        echo 'iface lo inet loopback' >> $rootdir/etc/network/interfaces
182
-        echo '' >> $rootdir/etc/network/interfaces
183
-        echo 'iface usb0 inet static' >> $rootdir/etc/network/interfaces
184
-        echo '    address 192.168.7.2' >> $rootdir/etc/network/interfaces
185
-        echo '    netmask 255.255.255.252' >> $rootdir/etc/network/interfaces
186
-        echo '    network 192.168.7.0' >> $rootdir/etc/network/interfaces
187
-        echo '    gateway 192.168.7.1' >> $rootdir/etc/network/interfaces
186
+
187
+        echo '# This file describes the network interfaces available on your system' > $rootdir/etc/network/interfaces
188
+        echo '# and how to activate them. For more information, see interfaces(5).' >> $rootdir/etc/network/interfaces
189
+        echo 'source /etc/network/interfaces.d/*' >> $rootdir/etc/network/interfaces
190
+
191
+        echo 'iface usb0 inet static' >> $rootdir/etc/network/interfaces.d/usb
192
+        echo '    address 192.168.7.2' >> $rootdir/etc/network/interfaces.d/usb
193
+        echo '    netmask 255.255.255.252' >> $rootdir/etc/network/interfaces.d/usb
194
+        echo '    network 192.168.7.0' >> $rootdir/etc/network/interfaces.d/usb
195
+        echo '    gateway 192.168.7.1' >> $rootdir/etc/network/interfaces.d/usb
188
         return
196
         return
189
     fi
197
     fi
190
 
198
 
193
     fi
201
     fi
194
 
202
 
195
     if [[ $GENERIC_IMAGE == "no" ]]; then
203
     if [[ $GENERIC_IMAGE == "no" ]]; then
196
-        echo "# This file describes the network interfaces available on your system
197
-# and how to activate them. For more information, see interfaces(5).
198
-
199
-# The loopback network interface
200
-auto lo
201
-iface lo inet loopback
204
+        echo '# This file describes the network interfaces available on your system' > $rootdir/etc/network/interfaces
205
+        echo '# and how to activate them. For more information, see interfaces(5).' >> $rootdir/etc/network/interfaces
206
+        echo 'source /etc/network/interfaces.d/*' >> $rootdir/etc/network/interfaces
202
 
207
 
203
-# The primary network interface
204
-auto eth0
208
+        echo "auto eth0
205
 iface eth0 inet static
209
 iface eth0 inet static
206
     address $BOX_IP_ADDRESS
210
     address $BOX_IP_ADDRESS
207
     netmask 255.255.255.0
211
     netmask 255.255.255.0
208
-    gateway $ROUTER_IP_ADDRESS
209
-    dns-nameservers $NAMESERVER1 $NAMESERVER2
210
-        # Example to keep MAC address between reboots
211
-        #hwaddress ether B5:A2:BE:3F:1A:FE
212
-
213
-        # The secondary network interface
214
-        #auto eth1
215
-        #iface eth1 inet dhcp
216
-
217
-        # WiFi Example
218
-        #auto wlan0
219
-        #iface wlan0 inet dhcp
220
-        #    wpa-ssid \"essid\"
221
-        #    wpa-psk  \"password\"
222
-
223
-        # Ethernet/RNDIS gadget (g_ether)
224
-        # ... or on host side, usbnet and random hwaddr
225
-        # Note on some boards, usb0 is automaticly setup with an init script
226
-        #iface usb0 inet static
227
-        #    address 192.168.7.2
228
-        #    netmask 255.255.255.0
229
-        #    network 192.168.7.0
230
-        #    gateway 192.168.7.1" > $rootdir/etc/network/interfaces
212
+    gateway $ROUTER_IP_ADDRESS" > $rootdir/etc/network/interfaces.d/static
231
 
213
 
232
         hexarray=( 1 2 3 4 5 6 7 8 9 0 a b c d e f )
214
         hexarray=( 1 2 3 4 5 6 7 8 9 0 a b c d e f )
233
         a=${hexarray[$RANDOM%16]}${hexarray[$RANDOM%16]}
215
         a=${hexarray[$RANDOM%16]}${hexarray[$RANDOM%16]}
235
         c=${hexarray[$RANDOM%16]}${hexarray[$RANDOM%16]}
217
         c=${hexarray[$RANDOM%16]}${hexarray[$RANDOM%16]}
236
         d=${hexarray[$RANDOM%16]}${hexarray[$RANDOM%16]}
218
         d=${hexarray[$RANDOM%16]}${hexarray[$RANDOM%16]}
237
         e=${hexarray[$RANDOM%16]}${hexarray[$RANDOM%16]}
219
         e=${hexarray[$RANDOM%16]}${hexarray[$RANDOM%16]}
238
-        sed -i "s|#hwaddress ether.*|hwaddress ether de:$a:$b:$c:$d:$e|g" \
239
-            $rootdir/etc/network/interfaces
220
+        echo "hwaddress ether de:$a:$b:$c:$d:$e" > $rootdir/etc/network/interfaces.d/macaddress
240
     fi
221
     fi
241
 
222
 
242
-    sed -i "s/nameserver.*/nameserver $NAMESERVER1/g" $rootdir/etc/resolv.conf
243
-    sed -i "/nameserver $NAMESERVER1/a\nameserver $NAMESERVER2" $rootdir/etc/resolv.conf
223
+    # configure DNS
224
+    resolvconf=$rootdir/etc/resolvconf/resolv.conf.d/head
225
+    echo 'domain localdomain' > $resolvconf
226
+    echo 'search localdomain' >> $resolvconf
227
+    echo "nameserver $NAMESERVER1" >> $resolvconf
228
+    echo "nameserver $NAMESERVER2" >> $resolvconf
229
+    echo "nameserver $NAMESERVER3" >> $resolvconf
230
+    echo "nameserver $NAMESERVER4" >> $resolvconf
231
+    echo "nameserver $NAMESERVER5" >> $resolvconf
232
+    echo "nameserver $NAMESERVER6" >> $resolvconf
233
+    chroot "$rootdir" resolvconf -u
244
 
234
 
245
     if [[ $VARIANT != "meshclient" && $VARIANT != "meshusb" ]]; then
235
     if [[ $VARIANT != "meshclient" && $VARIANT != "meshusb" ]]; then
246
         # change the motd to show further install instructions
236
         # change the motd to show further install instructions
274
 }
264
 }
275
 
265
 
276
 configure_ssh() {
266
 configure_ssh() {
277
-    if [[ $VARIANT == "mesh" || $VARIANT == "meshclient" || $VARIANT == "meshusb" ]]; then
267
+    if [[ $VARIANT == "mesh"* ]]; then
278
         return
268
         return
279
     fi
269
     fi
280
 
270
 
281
     sed -i "s/Port .*/Port ${SSH_PORT}/g" $rootdir/etc/ssh/sshd_config
271
     sed -i "s/Port .*/Port ${SSH_PORT}/g" $rootdir/etc/ssh/sshd_config
272
+    sed -i "s/#Port ${SSH_PORT}/Port ${SSH_PORT}/g" $rootdir/etc/ssh/sshd_config
282
 
273
 
283
     if [[ "$SSH_PUBKEY" != "no" ]]; then
274
     if [[ "$SSH_PUBKEY" != "no" ]]; then
284
         if [ ! -d $rootdir/home/$MY_USERNAME/.ssh ]; then
275
         if [ ! -d $rootdir/home/$MY_USERNAME/.ssh ]; then
287
         echo "$SSH_PUBKEY" > $rootdir/home/$MY_USERNAME/.ssh/authorized_keys
278
         echo "$SSH_PUBKEY" > $rootdir/home/$MY_USERNAME/.ssh/authorized_keys
288
         chroot $rootdir /bin/chown -R $MY_USERNAME:$MY_USERNAME /home/$MY_USERNAME/.ssh
279
         chroot $rootdir /bin/chown -R $MY_USERNAME:$MY_USERNAME /home/$MY_USERNAME/.ssh
289
         sed -i 's|PasswordAuthentication.*|PasswordAuthentication no|g' $rootdir/etc/ssh/sshd_config
280
         sed -i 's|PasswordAuthentication.*|PasswordAuthentication no|g' $rootdir/etc/ssh/sshd_config
281
+        sed -i 's|#PasswordAuthentication no|PasswordAuthentication no|g' $rootdir/etc/ssh/sshd_config
290
         echo $"Using ssh public key:"
282
         echo $"Using ssh public key:"
291
         echo $SSH_PUBKEY
283
         echo $SSH_PUBKEY
292
         echo $'Password ssh authentication turned off'
284
         echo $'Password ssh authentication turned off'
307
     fi
299
     fi
308
 
300
 
309
     # Don't install any configuration. This will be a base system
301
     # Don't install any configuration. This will be a base system
310
-    if [[ $VARIANT != "mesh" && $VARIANT != "meshclient" && $VARIANT != "meshusb" ]]; then
302
+    if [[ $VARIANT != "mesh"* ]]; then
311
         CONFIG_FILENAME=
303
         CONFIG_FILENAME=
312
     else
304
     else
313
         touch $rootdir/root/.initial_mesh_setup
305
         touch $rootdir/root/.initial_mesh_setup
387
     echo "    cd /root/${PROJECT_NAME}" >> $rootdir/root/.bashrc
379
     echo "    cd /root/${PROJECT_NAME}" >> $rootdir/root/.bashrc
388
     echo "    git stash" >> $rootdir/root/.bashrc
380
     echo "    git stash" >> $rootdir/root/.bashrc
389
     echo "    git pull" >> $rootdir/root/.bashrc
381
     echo "    git pull" >> $rootdir/root/.bashrc
390
-    echo "    git checkout jessie" >> $rootdir/root/.bashrc
382
+    echo "    git checkout stretch" >> $rootdir/root/.bashrc
391
     echo "    make install" >> $rootdir/root/.bashrc
383
     echo "    make install" >> $rootdir/root/.bashrc
392
 
384
 
393
-    if [[ $VARIANT != "mesh" && $VARIANT != "meshclient" && $VARIANT != "meshusb" && $VARIANT != "usb" ]]; then
394
-        if [[ $ONION_ONLY == "no" ]]; then
395
-            if [[ $MINIMAL_INSTALL == "no" ]]; then
396
-                echo "    ${PROJECT_NAME} menuconfig-full" >> $rootdir/root/.bashrc
385
+    if [[ $VARIANT != "mesh"* && $VARIANT != "usb" ]]; then
386
+        if [[ "$SOCIALINSTANCE" == "gnusocial" ]]; then
387
+            echo "    ${PROJECT_NAME} menuconfig-gnusocial" >> $rootdir/root/.bashrc
388
+        else
389
+            if [[ "$SOCIALINSTANCE" == "postactiv" ]]; then
390
+                echo "    ${PROJECT_NAME} menuconfig-postactiv" >> $rootdir/root/.bashrc
397
             else
391
             else
398
-                echo "    ${PROJECT_NAME} menuconfig" >> $rootdir/root/.bashrc
392
+                if [[ $ONION_ONLY == "no" ]]; then
393
+                    if [[ $MINIMAL_INSTALL == "no" ]]; then
394
+                        echo "    ${PROJECT_NAME} menuconfig-full" >> $rootdir/root/.bashrc
395
+                    else
396
+                        echo "    ${PROJECT_NAME} menuconfig" >> $rootdir/root/.bashrc
397
+                    fi
398
+                else
399
+                    echo "    ${PROJECT_NAME} menuconfig-onion" >> $rootdir/root/.bashrc
400
+                fi
399
             fi
401
             fi
400
-        else
401
-            echo "    ${PROJECT_NAME} menuconfig-onion" >> $rootdir/root/.bashrc
402
         fi
402
         fi
403
     else
403
     else
404
         echo "    echo ''" >> $rootdir/root/.bashrc
404
         echo "    echo ''" >> $rootdir/root/.bashrc
405
     fi
405
     fi
406
     echo '    if [ "$?" = "0" ]; then' >> $rootdir/root/.bashrc
406
     echo '    if [ "$?" = "0" ]; then' >> $rootdir/root/.bashrc
407
     echo "        if [ -f ~/${PROJECT_NAME}-completed.txt ]; then" >> $rootdir/root/.bashrc
407
     echo "        if [ -f ~/${PROJECT_NAME}-completed.txt ]; then" >> $rootdir/root/.bashrc
408
+    echo "            # Check that the initial setup really did complete" >> $rootdir/root/.bashrc
409
+    echo "            if grep -q 'tripwire' ~/${PROJECT_NAME}-completed.txt; then" >> $rootdir/root/.bashrc
408
     # Remove the initial setup files
410
     # Remove the initial setup files
409
-    echo '            rm /root/.initial_setup' >> $rootdir/root/.bashrc
410
-    echo '            rm /home/fbone/.initial_setup' >> $rootdir/root/.bashrc
411
-    echo "            touch /root/.remove_${GENERIC_IMAGE_USERNAME}" >> $rootdir/root/.bashrc
412
-    echo '            shred -zu ~/login.txt' >> $rootdir/root/.bashrc
413
-    if [[ $VARIANT != "mesh" && $VARIANT != "meshclient" && $VARIANT != "meshusb" && $VARIANT != "usb" ]]; then
414
-        echo '            SSH_ONION_HOSTNAME=$(cat /var/lib/tor/hidden_service_ssh/hostname)' >> $rootdir/root/.bashrc
415
-
416
-        echo '            if [ ${#SSH_ONION_HOSTNAME} -lt 2 ]; then' >> $rootdir/root/.bashrc
417
-        echo '                exit 62392' >> $rootdir/root/.bashrc
418
-        echo '            fi' >> $rootdir/root/.bashrc
419
-    fi
420
-    echo "            if [ -f /root/${PROJECT_NAME}-wifi.cfg ]; then" >> $rootdir/root/.bashrc
421
-    echo "                echo '[Unit]' > /etc/systemd/system/wifistart.service" >> $rootdir/root/.bashrc
422
-    echo "                echo 'Description=WifiStartup (Start wifi networking)' >> /etc/systemd/system/wifistart.service" >> $rootdir/root/.bashrc
423
-    echo "                echo 'After=syslog.target' >> /etc/systemd/system/wifistart.service" >> $rootdir/root/.bashrc
424
-    echo "                echo 'After=network.target' >> /etc/systemd/system/wifistart.service" >> $rootdir/root/.bashrc
425
-    echo "                echo 'After=remote-fs.target' >> /etc/systemd/system/wifistart.service" >> $rootdir/root/.bashrc
426
-    echo "                echo '' >> /etc/systemd/system/wifistart.service" >> $rootdir/root/.bashrc
427
-    echo "                echo '[Service]' >> /etc/systemd/system/wifistart.service" >> $rootdir/root/.bashrc
428
-    echo "                echo 'Type=simple' >> /etc/systemd/system/wifistart.service" >> $rootdir/root/.bashrc
429
-    echo "                echo 'User=root' >> /etc/systemd/system/wifistart.service" >> $rootdir/root/.bashrc
430
-    echo "                echo 'Group=root' >> /etc/systemd/system/wifistart.service" >> $rootdir/root/.bashrc
431
-    echo "                echo 'WorkingDirectory=/root' >> /etc/systemd/system/wifistart.service" >> $rootdir/root/.bashrc
432
-    echo "                echo 'ExecStart=/usr/local/bin/freedombone-wifi --wait 5 2> /dev/null' >> /etc/systemd/system/wifistart.service" >> $rootdir/root/.bashrc
433
-    echo "                echo '' >> /etc/systemd/system/wifistart.service" >> $rootdir/root/.bashrc
434
-    echo "                echo '[Install]' >> /etc/systemd/system/wifistart.service" >> $rootdir/root/.bashrc
435
-    echo "                echo 'WantedBy=multi-user.target' >> /etc/systemd/system/wifistart.service" >> $rootdir/root/.bashrc
436
-    echo "                systemctl enable wifistart" >> $rootdir/root/.bashrc
437
-    echo "                systemctl daemon-reload" >> $rootdir/root/.bashrc
411
+    echo '                rm /root/.initial_setup' >> $rootdir/root/.bashrc
412
+    echo '                rm /home/fbone/.initial_setup' >> $rootdir/root/.bashrc
413
+    echo "                touch /root/.remove_${GENERIC_IMAGE_USERNAME}" >> $rootdir/root/.bashrc
414
+    echo '                shred -zu ~/login.txt' >> $rootdir/root/.bashrc
415
+    if [[ $VARIANT != "mesh"* && $VARIANT != "usb" ]]; then
416
+        echo '                SSH_ONION_HOSTNAME=$(cat /var/lib/tor/hidden_service_ssh/hostname)' >> $rootdir/root/.bashrc
417
+
418
+        echo '                if [ ${#SSH_ONION_HOSTNAME} -lt 2 ]; then' >> $rootdir/root/.bashrc
419
+        echo '                    exit 62392' >> $rootdir/root/.bashrc
420
+        echo '                fi' >> $rootdir/root/.bashrc
421
+    fi
422
+    echo "                if [ -f /root/${PROJECT_NAME}-wifi.cfg ]; then" >> $rootdir/root/.bashrc
423
+    echo "                    echo '[Unit]' > /etc/systemd/system/wifistart.service" >> $rootdir/root/.bashrc
424
+    echo "                    echo 'Description=WifiStartup (Start wifi networking)' >> /etc/systemd/system/wifistart.service" >> $rootdir/root/.bashrc
425
+    echo "                    echo 'After=syslog.target' >> /etc/systemd/system/wifistart.service" >> $rootdir/root/.bashrc
426
+    echo "                    echo 'After=network.target' >> /etc/systemd/system/wifistart.service" >> $rootdir/root/.bashrc
427
+    echo "                    echo 'After=remote-fs.target' >> /etc/systemd/system/wifistart.service" >> $rootdir/root/.bashrc
428
+    echo "                    echo '' >> /etc/systemd/system/wifistart.service" >> $rootdir/root/.bashrc
429
+    echo "                    echo '[Service]' >> /etc/systemd/system/wifistart.service" >> $rootdir/root/.bashrc
430
+    echo "                    echo 'Type=simple' >> /etc/systemd/system/wifistart.service" >> $rootdir/root/.bashrc
431
+    echo "                    echo 'User=root' >> /etc/systemd/system/wifistart.service" >> $rootdir/root/.bashrc
432
+    echo "                    echo 'Group=root' >> /etc/systemd/system/wifistart.service" >> $rootdir/root/.bashrc
433
+    echo "                    echo 'WorkingDirectory=/root' >> /etc/systemd/system/wifistart.service" >> $rootdir/root/.bashrc
434
+    echo "                    echo 'ExecStart=/usr/local/bin/freedombone-wifi --wait 5 2> /dev/null' >> /etc/systemd/system/wifistart.service" >> $rootdir/root/.bashrc
435
+    echo "                    echo '' >> /etc/systemd/system/wifistart.service" >> $rootdir/root/.bashrc
436
+    echo "                    echo '[Install]' >> /etc/systemd/system/wifistart.service" >> $rootdir/root/.bashrc
437
+    echo "                    echo 'WantedBy=multi-user.target' >> /etc/systemd/system/wifistart.service" >> $rootdir/root/.bashrc
438
+    echo "                    systemctl enable wifistart" >> $rootdir/root/.bashrc
439
+    echo "                    systemctl daemon-reload" >> $rootdir/root/.bashrc
440
+    echo '                fi' >> $rootdir/root/.bashrc
441
+    echo '                systemctl reboot -i' >> $rootdir/root/.bashrc
438
     echo '            fi' >> $rootdir/root/.bashrc
442
     echo '            fi' >> $rootdir/root/.bashrc
439
-    echo '            reboot' >> $rootdir/root/.bashrc
440
     echo '        fi' >> $rootdir/root/.bashrc
443
     echo '        fi' >> $rootdir/root/.bashrc
441
     echo '    else' >> $rootdir/root/.bashrc
444
     echo '    else' >> $rootdir/root/.bashrc
442
     echo '        key=' >> $rootdir/root/.bashrc
445
     echo '        key=' >> $rootdir/root/.bashrc
526
 WIFI_SSID='mesh'
529
 WIFI_SSID='mesh'
527
 
530
 
528
 # To avoid confusions these are obtained from the main project file
531
 # To avoid confusions these are obtained from the main project file
529
-TOXID_REPO=
530
-TOX_PORT=
531
-TOXCORE_REPO=
532
-TOXIC_REPO=
533
-TOXCORE_COMMIT=
534
-TOXIC_COMMIT=
532
+#TOXID_REPO=
533
+#TOX_PORT=
534
+#TOXCORE_REPO=
535
+#TOXIC_REPO=
536
+#TOXCORE_COMMIT=
537
+#TOXIC_COMMIT=
535
 # These are some default nodes, but you can replace them with trusted nodes
538
 # These are some default nodes, but you can replace them with trusted nodes
536
 # as you prefer. See https://wiki.tox.im/Nodes
539
 # as you prefer. See https://wiki.tox.im/Nodes
537
-TOX_NODES=
540
+#TOX_NODES=
538
 #TOX_NODES=(
541
 #TOX_NODES=(
539
 #  '192.254.75.102,2607:5600:284::2,33445,951C88B7E75C867418ACDB5D273821372BB5BD652740BCDF623A4FA293E75D2F,Tox RELENG,US'
542
 #  '192.254.75.102,2607:5600:284::2,33445,951C88B7E75C867418ACDB5D273821372BB5BD652740BCDF623A4FA293E75D2F,Tox RELENG,US'
540
 #  '144.76.60.215,2a01:4f8:191:64d6::1,33445,04119E835DF3E78BACF0F84235B300546AF8B936F035185E2A8E9E0A67C8924F,sonOfRa,DE'
543
 #  '144.76.60.215,2a01:4f8:191:64d6::1,33445,04119E835DF3E78BACF0F84235B300546AF8B936F035185E2A8E9E0A67C8924F,sonOfRa,DE'
559
 INSTALLING_MESH=
562
 INSTALLING_MESH=
560
 
563
 
561
 initialise_mesh() {
564
 initialise_mesh() {
562
-    if [[ $VARIANT != "mesh" && $VARIANT != "meshclient" && $VARIANT != "meshusb" ]]; then
565
+    if [[ $VARIANT != "mesh"* ]]; then
563
         return
566
         return
564
     fi
567
     fi
565
     if [[ $DEBIAN_INSTALL_ONLY != "no" ]]; then
568
     if [[ $DEBIAN_INSTALL_ONLY != "no" ]]; then
581
 
584
 
582
         # install proprietary wifi drivers
585
         # install proprietary wifi drivers
583
         # see https://wiki.debian.org/iwlwifi
586
         # see https://wiki.debian.org/iwlwifi
584
-        chroot "$rootdir" apt-get -yq install firmware-iwlwifi firmware-b43-installer firmware-brcm80211
587
+        chroot "$rootdir" apt-get -yq install firmware-iwlwifi firmware-b43-installer firmware-brcm80211 firmware-realtek
585
     fi
588
     fi
586
 
589
 
587
     INSTALLING_MESH=1
590
     INSTALLING_MESH=1
588
 
591
 
592
+    chroot "$rootdir" apt-get -yq install apt-transport-https
593
+
589
     configure_firewall
594
     configure_firewall
590
     install_avahi
595
     install_avahi
591
     install_batman
596
     install_batman
767
     chroot "$rootdir" apt-get -yq install libtheora-bin libvorbis-dev v4l-utils
772
     chroot "$rootdir" apt-get -yq install libtheora-bin libvorbis-dev v4l-utils
768
 
773
 
769
     # a sane editor
774
     # a sane editor
770
-    chroot "$rootdir" apt-get -yq install emacs24
775
+    chroot "$rootdir" apt-get -yq install emacs
771
 
776
 
772
     # for wifi monitoring
777
     # for wifi monitoring
773
     chroot "$rootdir" apt-get -yq install horst
778
     chroot "$rootdir" apt-get -yq install horst
774
 
779
 
775
     # for sound level control
780
     # for sound level control
776
-    chroot "$rootdir" apt-get -yq install alsa-utils
781
+    chroot "$rootdir" apt-get -yq install alsa-utils pavucontrol
777
 
782
 
778
     # to play various media types
783
     # to play various media types
779
     chroot "$rootdir" apt-get -yq install vlc
784
     chroot "$rootdir" apt-get -yq install vlc
941
 
946
 
942
     if [[ $VARIANT == "usb" ]]; then
947
     if [[ $VARIANT == "usb" ]]; then
943
         # tor
948
         # tor
944
-        chroot "$rootdir" apt-get -y install tor
949
+        chroot "$rootdir" apt-get -yq install tor
945
 
950
 
946
         # xmpp client
951
         # xmpp client
947
         chroot "$rootdir" echo "deb ftp://ftp.gajim.org/debian unstable main" > /etc/apt/sources.list.d/gajim.list
952
         chroot "$rootdir" echo "deb ftp://ftp.gajim.org/debian unstable main" > /etc/apt/sources.list.d/gajim.list
970
         mkdir -p $rootdir/root/build
975
         mkdir -p $rootdir/root/build
971
     fi
976
     fi
972
     chroot "$rootdir" apt-get -yq install build-essential curl libgnutls28-dev automake1.11 libconfuse-dev
977
     chroot "$rootdir" apt-get -yq install build-essential curl libgnutls28-dev automake1.11 libconfuse-dev
973
-    git clone $INADYN_REPO $rootdir/root/build/inadyn
978
+
979
+    if [ -d /repos/inadyn ]; then
980
+        mkdir $rootdir/root/build/inadyn
981
+        cp -r -p /repos/inadyn/. $rootdir/root/build/inadyn
982
+        cd $rootdir/root/build/inadyn
983
+        git pull
984
+    else
985
+        git clone $INADYN_REPO $rootdir/root/build/inadyn
986
+    fi
987
+
974
     if [ ! -d $rootdir/root/build/inadyn ]; then
988
     if [ ! -d $rootdir/root/build/inadyn ]; then
975
         echo 'Failed to clone inadyn'
989
         echo 'Failed to clone inadyn'
976
         exit 728252
990
         exit 728252
1020
     if [ $INSTALLING_MESH ]; then
1034
     if [ $INSTALLING_MESH ]; then
1021
         return
1035
         return
1022
     fi
1036
     fi
1023
-    chroot "$rootdir" apt-get -yq install nfs-kernel-server
1037
+    chroot "$rootdir" apt-get -yq install apt-transport-https
1038
+    chroot "$rootdir" apt-get -yq remove --purge apache2-bin*
1039
+    chroot "$rootdir" apt-get -yq dist-upgrade
1040
+    chroot "$rootdir" apt-get -yq install ca-certificates
1041
+    chroot "$rootdir" apt-get -yq install apt-utils
1024
 
1042
 
1025
     if [[ $ARCHITECTURE == 'amd64' ]]; then
1043
     if [[ $ARCHITECTURE == 'amd64' ]]; then
1026
-        chroot "$rootdir" apt-get -yq install linux-image-amd64 -t jessie-backports
1044
+        chroot "$rootdir" apt-get -yq install linux-image-amd64
1027
     fi
1045
     fi
1028
 
1046
 
1029
     if [[ $ARCHITECTURE == 'qemu'* || $ARCHITECTURE == 'amd64' || $ARCHITECTURE == 'x86_64' || $ARCHITECTURE == 'i686' || $ARCHITECTURE == 'i386' ]]; then
1047
     if [[ $ARCHITECTURE == 'qemu'* || $ARCHITECTURE == 'amd64' || $ARCHITECTURE == 'x86_64' || $ARCHITECTURE == 'i686' || $ARCHITECTURE == 'i386' ]]; then
1030
-        chroot "$rootdir" apt-get -yq install grub2
1048
+        chroot "$rootdir" apt-get -yq install grub2 lvm2 initramfs-tools
1031
     fi
1049
     fi
1032
 
1050
 
1033
     chroot "$rootdir" apt-get -yq install locales locales-all debconf
1051
     chroot "$rootdir" apt-get -yq install locales locales-all debconf
1047
     rm $rootdir/root/sysctl.conf
1065
     rm $rootdir/root/sysctl.conf
1048
 
1066
 
1049
     # all the packages
1067
     # all the packages
1050
-    chroot "$rootdir" apt-get -yq install apt-transport-https
1051
-    chroot "$rootdir" apt-get -yq remove --purge apache*
1052
-    chroot "$rootdir" apt-get -yq dist-upgrade
1053
-    chroot "$rootdir" apt-get -yq install ca-certificates
1054
-    chroot "$rootdir" apt-get -yq install apt-utils
1055
     chroot "$rootdir" apt-get -yq install cryptsetup libgfshare-bin obnam sshpass wget avahi-daemon
1068
     chroot "$rootdir" apt-get -yq install cryptsetup libgfshare-bin obnam sshpass wget avahi-daemon
1056
     chroot "$rootdir" apt-get -yq install avahi-utils avahi-discover connect-proxy openssh-server
1069
     chroot "$rootdir" apt-get -yq install avahi-utils avahi-discover connect-proxy openssh-server
1057
     chroot "$rootdir" apt-get -yq install sudo git dialog build-essential avahi-daemon avahi-utils
1070
     chroot "$rootdir" apt-get -yq install sudo git dialog build-essential avahi-daemon avahi-utils
1065
 
1078
 
1066
     # Tor and ssh over tor
1079
     # Tor and ssh over tor
1067
     chroot "$rootdir" apt-get -yq install tor connect-proxy
1080
     chroot "$rootdir" apt-get -yq install tor connect-proxy
1081
+    chroot "$rootdir" connect-proxy
1068
     sed -i 's|#Log notice file.*|Log notice file /dev/null|g' $rootdir/etc/tor/torrc
1082
     sed -i 's|#Log notice file.*|Log notice file /dev/null|g' $rootdir/etc/tor/torrc
1069
     sed -i 's|Log notice file.*|Log notice file /dev/null|g' $rootdir/etc/tor/torrc
1083
     sed -i 's|Log notice file.*|Log notice file /dev/null|g' $rootdir/etc/tor/torrc
1084
+    sed -i "s|#AccountingMax.*|AccountingMax $TOR_MAX_TRAFFIC_PER_DAY_GB GBytes|g" $rootdir/etc/tor/torrc
1085
+    sed -i "s|AccountingMax.*|AccountingMax $TOR_MAX_TRAFFIC_PER_DAY_GB GBytes|g" $rootdir/etc/tor/torrc
1070
     if ! grep -q 'Host *.onion' $rootdir/root/.ssh/config; then
1086
     if ! grep -q 'Host *.onion' $rootdir/root/.ssh/config; then
1071
         if [ ! -d $rootdir/root/.ssh ]; then
1087
         if [ ! -d $rootdir/root/.ssh ]; then
1072
             mkdir $rootdir/root/.ssh
1088
             mkdir $rootdir/root/.ssh
1130
     chroot "$rootdir" cd /root/build/tomb && make install
1146
     chroot "$rootdir" cd /root/build/tomb && make install
1131
     echo "tomb commit:$TOMB_COMMIT" >> $rootdir/root/freedombone-completed.txt
1147
     echo "tomb commit:$TOMB_COMMIT" >> $rootdir/root/freedombone-completed.txt
1132
 
1148
 
1133
-    if ! grep '* hard maxsyslogins' $rootdir/etc/security/limits.conf; then
1149
+    if ! grep -q '* hard maxsyslogins' $rootdir/etc/security/limits.conf; then
1134
         echo '* hard maxsyslogins 10' >> $rootdir/etc/security/limits.conf
1150
         echo '* hard maxsyslogins 10' >> $rootdir/etc/security/limits.conf
1135
     else
1151
     else
1136
         sed -i 's|hard maxsyslogins.*|hard maxsyslogins 10|g' $rootdir/etc/security/limits.conf
1152
         sed -i 's|hard maxsyslogins.*|hard maxsyslogins 10|g' $rootdir/etc/security/limits.conf
1137
     fi
1153
     fi
1138
 
1154
 
1139
     # Max logins for each user
1155
     # Max logins for each user
1140
-    if ! grep '* hard maxlogins' $rootdir/etc/security/limits.conf; then
1156
+    if ! grep -q '* hard maxlogins' $rootdir/etc/security/limits.conf; then
1141
         echo '* hard maxlogins 2' >> $rootdir/etc/security/limits.conf
1157
         echo '* hard maxlogins 2' >> $rootdir/etc/security/limits.conf
1142
     else
1158
     else
1143
         sed -i 's|hard maxlogins.*|hard maxlogins 2|g' $rootdir/etc/security/limits.conf
1159
         sed -i 's|hard maxlogins.*|hard maxlogins 2|g' $rootdir/etc/security/limits.conf
1147
     chroot "$rootdir" apt-get -yq remove postfix
1163
     chroot "$rootdir" apt-get -yq remove postfix
1148
     chroot "$rootdir" apt-get -yq install exim4 exim4-daemon-heavy sasl2-bin swaks libnet-ssleay-perl procmail
1164
     chroot "$rootdir" apt-get -yq install exim4 exim4-daemon-heavy sasl2-bin swaks libnet-ssleay-perl procmail
1149
     chroot "$rootdir" apt-get -yq install spamassassin
1165
     chroot "$rootdir" apt-get -yq install spamassassin
1150
-    #chroot "$rootdir" apt-get -yq install dovecot-core dovecot-imapd
1151
-
1152
-    # TODO generate certs for exim and dovecot if needed on first boot
1166
+    chroot "$rootdir" apt-get -yq install dovecot-imapd
1153
 
1167
 
1154
     #backup
1168
     #backup
1155
     chroot "$rootdir" apt-get -yq install obnam gnupg
1169
     chroot "$rootdir" apt-get -yq install obnam gnupg
1166
     echo "gpgit commit:$GPGIT_COMMIT" >> $rootdir/root/freedombone-completed.txt
1180
     echo "gpgit commit:$GPGIT_COMMIT" >> $rootdir/root/freedombone-completed.txt
1167
 
1181
 
1168
     # email client
1182
     # email client
1169
-    chroot "$rootdir" apt-get -yq install mutt-patched lynx abook urlview
1183
+    chroot "$rootdir" apt-get -yq install lynx abook urlview mutt
1170
 
1184
 
1171
     git clone $CLEANUP_MAILDIR_REPO $rootdir/root/build/cleanup-maildir
1185
     git clone $CLEANUP_MAILDIR_REPO $rootdir/root/build/cleanup-maildir
1172
     cd $rootdir/root/build/cleanup-maildir
1186
     cd $rootdir/root/build/cleanup-maildir
1176
 
1190
 
1177
     # web server
1191
     # web server
1178
     chroot "$rootdir" apt-get -yq remove --purge apache2
1192
     chroot "$rootdir" apt-get -yq remove --purge apache2
1179
-    chroot "$rootdir" apt-get -yq install nginx php5-fpm
1193
+    chroot "$rootdir" apt-get -yq install nginx php-fpm
1180
     git clone $NGINX_ENSITE_REPO $rootdir/root/build/nginx_ensite
1194
     git clone $NGINX_ENSITE_REPO $rootdir/root/build/nginx_ensite
1181
     cd $rootdir/root/build/nginx_ensite
1195
     cd $rootdir/root/build/nginx_ensite
1182
     git checkout $NGINX_ENSITE_COMMIT -b $NGINX_ENSITE_COMMIT
1196
     git checkout $NGINX_ENSITE_COMMIT -b $NGINX_ENSITE_COMMIT
1190
     fi
1204
     fi
1191
     chroot "$rootdir" apt-get -yq install tripwire
1205
     chroot "$rootdir" apt-get -yq install tripwire
1192
 
1206
 
1193
-    # mirroring
1194
-    # cmake
1207
+    # filesystem optimisations
1208
+    #sed -i 's|btrfs subvol=@|btrfs defaults,subvol=@,compress=lzo,ssd|g' $rootdir/etc/fstab
1195
 }
1209
 }
1196
 
1210
 
1197
 function image_install_nodejs {
1211
 function image_install_nodejs {
1198
-    if [ $INSTALLING_MESH ]; then
1212
+    mesh_install_nodejs
1213
+    #echo 'install_nodejs' >> ${rootdir}/root/${PROJECT_NAME}-completed.txt
1214
+}
1215
+
1216
+function image_preinstall_repos {
1217
+    if [[ $VARIANT == "mesh"* ]]; then
1199
         return
1218
         return
1200
     fi
1219
     fi
1201
 
1220
 
1202
-    chroot "$rootdir" apt-get -yq install nodejs
1203
-    chroot "$rootdir" apt-get -yq install npm curl
1221
+    if [ ! -d $rootdir/repos ]; then
1222
+        mkdir $rootdir/repos
1223
+    fi
1224
+
1225
+    git clone $CMAKE_REPO $rootdir/repos/cmake
1226
+    git clone $INADYN_REPO $rootdir/repos/inadyn
1227
+    git clone $TOMB_REPO $rootdir/repos/tomb
1204
 
1228
 
1205
-    if [ ! -f $rootdir/usr/bin/nodejs ]; then
1206
-        echo $'nodejs was not installed'
1207
-        exit 63962
1229
+    if [[ $SOCIALINSTANCE == "gnusocial" ]]; then
1230
+        git clone $GNUSOCIAL_REPO $rootdir/repos/gnusocial
1231
+        git clone $GNUSOCIAL_MARKDOWN_REPO $rootdir/repos/gnusocial-markdown
1232
+        git clone $QVITTER_THEME_REPO $rootdir/repos/qvitter
1233
+        git clone $PLEROMA_REPO $rootdir/repos/pleroma
1234
+        return
1208
     fi
1235
     fi
1209
-}
1210
 
1236
 
1237
+    if [[ $SOCIALINSTANCE == "postactiv" ]]; then
1238
+        git clone $GNUSOCIAL_MARKDOWN_REPO $rootdir/repos/gnusocial-markdown
1239
+        git clone $QVITTER_THEME_REPO $rootdir/repos/qvitter
1240
+        git clone $PLEROMA_REPO $rootdir/repos/pleroma
1241
+        git clone $POSTACTIV_REPO $rootdir/repos/postactiv
1242
+        return
1243
+    fi
1244
+
1245
+    git clone $CRYPTPAD_REPO $rootdir/repos/cryptpad
1246
+    git clone $DOKUWIKI_REPO $rootdir/repos/dokuwiki
1247
+    git clone $ETHERPAD_REPO $rootdir/repos/etherpad
1248
+    git clone $FRIENDICA_REPO $rootdir/repos/friendica
1249
+    git clone $GNUSOCIAL_REPO $rootdir/repos/gnusocial
1250
+    git clone $GNUSOCIAL_MARKDOWN_REPO $rootdir/repos/gnusocial-markdown
1251
+    git clone $QVITTER_THEME_REPO $rootdir/repos/qvitter
1252
+    git clone $PLEROMA_REPO $rootdir/repos/pleroma
1253
+    git clone $POSTACTIV_REPO $rootdir/repos/postactiv
1254
+    git clone $SHARINGS_REPO $rootdir/repos/sharings
1255
+    git clone $HTMLY_REPO $rootdir/repos/htmly
1256
+    git clone $HUBZILLA_REPO $rootdir/repos/hubzilla
1257
+    git clone $HUBZILLA_ADDONS_REPO $rootdir/repos/hubzilla-addons
1258
+    git clone $KOEL_REPO $rootdir/repos/koel
1259
+    #git clone $LIBREVAULT_REPO $rootdir/repos/librevault
1260
+    git clone $LYCHEE_REPO $rootdir/repos/lychee
1261
+    git clone $MAILPILE_REPO $rootdir/repos/mailpile
1262
+    git clone $MATRIX_REPO $rootdir/repos/matrix
1263
+    git clone $MEDIAGOBLIN_REPO $rootdir/repos/mediagoblin
1264
+    #git clone $MOVIM_REPO $rootdir/repos/movim
1265
+    git clone $NEXTCLOUD_REPO $rootdir/repos/nextcloud
1266
+    git clone $PIHOLE_REPO $rootdir/repos/pihole
1267
+    git clone $PROFANITY_REPO $rootdir/repos/profanity
1268
+    git clone $LIBMESODE_REPO $rootdir/repos/libmesode
1269
+    git clone $PROFANITY_OMEMO_PLUGIN_REPO $rootdir/repos/profanity-omemo
1270
+    git clone $RSS_READER_REPO $rootdir/repos/rss
1271
+    git clone $RSS_MOBILE_READER_REPO $rootdir/repos/rss-mobile
1272
+    git clone $SEARX_REPO $rootdir/repos/searx
1273
+    git clone $TOXCORE_REPO $rootdir/repos/toxcore
1274
+    git clone $TOXID_REPO $rootdir/repos/toxid
1275
+    git clone $TOXIC_REPO $rootdir/repos/toxic
1276
+    git clone $TURTL_REPO $rootdir/repos/turtl
1277
+    #git clone $ZERONET_REPO $rootdir/repos/zeronet
1278
+    #git clone $QTOX_REPO $rootdir/repos/qtox
1279
+}
1211
 
1280
 
1212
 ##############################################################################
1281
 ##############################################################################
1213
 
1282
 
1248
     DEBIAN_REPO='ftp.de.debian.org'
1317
     DEBIAN_REPO='ftp.de.debian.org'
1249
 fi
1318
 fi
1250
 if [ ! $DEBIAN_VERSION ]; then
1319
 if [ ! $DEBIAN_VERSION ]; then
1251
-    DEBIAN_VERSION='jessie'
1320
+    DEBIAN_VERSION='stretch'
1252
 fi
1321
 fi
1253
 
1322
 
1254
 set_apt_sources $BUILD_MIRROR
1323
 set_apt_sources $BUILD_MIRROR
1277
     chroot "$rootdir" gdebi -n /tmp/"$(basename $CUSTOM_SETUP)"
1346
     chroot "$rootdir" gdebi -n /tmp/"$(basename $CUSTOM_SETUP)"
1278
 fi
1347
 fi
1279
 
1348
 
1280
-if [[ $VARIANT != "meshclient" && $VARIANT != "meshusb" && $VARIANT != "mesh" ]]; then
1349
+if [[ $VARIANT != "mesh"* ]]; then
1281
     chroot "$rootdir" apt-get install -y openssh-server
1350
     chroot "$rootdir" apt-get install -y openssh-server
1282
 fi
1351
 fi
1283
 chroot "$rootdir" apt-get install -y sudo git dialog build-essential
1352
 chroot "$rootdir" apt-get install -y sudo git dialog build-essential
1287
 chroot "$rootdir" apt-get install -y locales locales-all debconf wireless-tools wpasupplicant usbutils
1356
 chroot "$rootdir" apt-get install -y locales locales-all debconf wireless-tools wpasupplicant usbutils
1288
 if [[ $ARCHITECTURE == 'qemu'* || $ARCHITECTURE == 'i386' || $ARCHITECTURE == 'i686' || $ARCHITECTURE == 'amd64' || $ARCHITECTURE == 'x86_64' ]]; then
1357
 if [[ $ARCHITECTURE == 'qemu'* || $ARCHITECTURE == 'i386' || $ARCHITECTURE == 'i686' || $ARCHITECTURE == 'amd64' || $ARCHITECTURE == 'x86_64' ]]; then
1289
     chroot "$rootdir" apt-get install -y cryptsetup zsh pinentry-curses iotop bc
1358
     chroot "$rootdir" apt-get install -y cryptsetup zsh pinentry-curses iotop bc
1290
-    chroot "$rootdir" apt-get install -y grub2 hostapd
1359
+    chroot "$rootdir" apt-get install -y grub2 hostapd lvm2 initramfs-tools
1291
 fi
1360
 fi
1292
 
1361
 
1293
-sed -i "s|#host-name=.*|host-name=${PROJECT_NAME}|g" $rootdir/etc/avahi/avahi-daemon.conf
1294
-sed -i "s|host-name=.*|host-name=${PROJECT_NAME}|g" $rootdir/etc/avahi/avahi-daemon.conf
1362
+sed -i "s|#host-name=.*|host-name=${LOCAL_NAME}|g" $rootdir/etc/avahi/avahi-daemon.conf
1363
+sed -i "s|host-name=.*|host-name=${LOCAL_NAME}|g" $rootdir/etc/avahi/avahi-daemon.conf
1364
+sed -i "s|use-ipv4=.*|use-ipv4=yes|g" $rootdir/etc/avahi/avahi-daemon.conf
1365
+sed -i "s|use-ipv6=.*|use-ipv6=no|g" $rootdir/etc/avahi/avahi-daemon.conf
1366
+sed -i "s|#disallow-other-stacks=.*|disallow-other-stacks=yes|g" $rootdir/etc/avahi/avahi-daemon.conf
1367
+sed -i "s|hosts:.*|hosts:          files mdns4_minimal dns mdns4 mdns|g" $rootdir/etc/nsswitch.conf
1368
+
1369
+# Add an ssh avahi service
1370
+echo '<?xml version="1.0" standalone="no"?><!--*-nxml-*-->' > $rootdir/etc/avahi/services/ssh.service
1371
+echo '<!DOCTYPE service-group SYSTEM "avahi-service.dtd">' >> $rootdir/etc/avahi/services/ssh.service
1372
+echo '<service-group>' >> $rootdir/etc/avahi/services/ssh.service
1373
+echo '  <name replace-wildcards="yes">%h SSH</name>' >> $rootdir/etc/avahi/services/ssh.service
1374
+echo '  <service>' >> $rootdir/etc/avahi/services/ssh.service
1375
+echo '    <type>_ssh._tcp</type>' >> $rootdir/etc/avahi/services/ssh.service
1376
+echo "    <port>$SSH_PORT</port>" >> $rootdir/etc/avahi/services/ssh.service
1377
+echo '  </service>' >> $rootdir/etc/avahi/services/ssh.service
1378
+echo '</service-group>' >> $rootdir/etc/avahi/services/ssh.service
1379
+
1380
+# Ensure that the avahi daemon keeps running
1381
+WATCHDOG_SCRIPT_NAME="keepon"
1382
+echo '#!/bin/bash' > $rootdir/usr/bin/$WATCHDOG_SCRIPT_NAME
1383
+echo 'LOGFILE=/var/log/keepon.log' >> $rootdir/usr/bin/$WATCHDOG_SCRIPT_NAME
1384
+echo 'CURRENT_DATE=$(date)' >> $rootdir/usr/bin/$WATCHDOG_SCRIPT_NAME
1385
+echo '' >> $rootdir/usr/bin/$WATCHDOG_SCRIPT_NAME
1386
+echo "# keep avahi-daemon daemon running" >> $rootdir/usr/bin/$WATCHDOG_SCRIPT_NAME
1387
+echo "RUNNING=$(pgrep avahi-daemon > /dev/null && echo Running)" >> $rootdir/usr/bin/$WATCHDOG_SCRIPT_NAME
1388
+echo 'if [ ! $RUNNING ]; then' >> $rootdir/usr/bin/$WATCHDOG_SCRIPT_NAME
1389
+echo "  systemctl start avahi-daemon" >> $rootdir/usr/bin/$WATCHDOG_SCRIPT_NAME
1390
+echo '  echo -n $CURRENT_DATE >> $LOGFILE' >> $rootdir/usr/bin/$WATCHDOG_SCRIPT_NAME
1391
+echo "  echo \"avahi-daemon daemon restarted\" >> \$LOGFILE" >> $rootdir/usr/bin/$WATCHDOG_SCRIPT_NAME
1392
+echo 'fi' >> $rootdir/usr/bin/$WATCHDOG_SCRIPT_NAME
1393
+echo "# End of avahi-daemon" >> $rootdir/usr/bin/$WATCHDOG_SCRIPT_NAME
1394
+chmod +x $rootdir/usr/bin/$WATCHDOG_SCRIPT_NAME
1395
+echo "*/1            * *   *   *   root /usr/bin/$WATCHDOG_SCRIPT_NAME" >> $rootdir/etc/crontab
1295
 
1396
 
1296
 chroot "$rootdir" /bin/bash -x <<EOF
1397
 chroot "$rootdir" /bin/bash -x <<EOF
1297
 git clone $PROJECT_REPO /root/$PROJECT_NAME
1398
 git clone $PROJECT_REPO /root/$PROJECT_NAME
1298
 cd /root/$PROJECT_NAME
1399
 cd /root/$PROJECT_NAME
1299
-git checkout jessie
1400
+git checkout stretch
1300
 make install
1401
 make install
1402
+cp image_build/bbb-4.9.0.tar.gz /boot/bbb.tar.gz
1301
 EOF
1403
 EOF
1302
 
1404
 
1303
 chroot "$rootdir" ${PROJECT_NAME}-image-hardware-setup 2>&1 | \
1405
 chroot "$rootdir" ${PROJECT_NAME}-image-hardware-setup 2>&1 | \
1308
 # Set up HRNG for systems known to have one
1410
 # Set up HRNG for systems known to have one
1309
 # Otherwise install haveged
1411
 # Otherwise install haveged
1310
 if [[ "$MACHINE" != "beaglebone"* ]]; then
1412
 if [[ "$MACHINE" != "beaglebone"* ]]; then
1311
-    chroot $rootdir apt-get -yq install haveged
1413
+    # With some VMs, the hardware cycles counter is emulated and deterministic,
1414
+    # and thus predictible, so havege should not be used
1415
+    if [[ "$MACHINE" != "qemu"* ]]; then
1416
+        chroot $rootdir apt-get -yq install haveged
1417
+    fi
1312
 else
1418
 else
1313
     chroot $rootdir apt-get -yq install rng-tools
1419
     chroot $rootdir apt-get -yq install rng-tools
1314
     sed -i 's|#HRNGDEVICE=/dev/hwrng|HRNGDEVICE=/dev/hwrng|g' $rootdir/etc/default/rng-tools
1420
     sed -i 's|#HRNGDEVICE=/dev/hwrng|HRNGDEVICE=/dev/hwrng|g' $rootdir/etc/default/rng-tools
1356
 image_setup_utils
1462
 image_setup_utils
1357
 image_install_inadyn
1463
 image_install_inadyn
1358
 image_install_nodejs
1464
 image_install_nodejs
1465
+image_preinstall_repos
1359
 
1466
 
1360
 # remove downloaded packages
1467
 # remove downloaded packages
1361
 chroot $rootdir apt-get -y autoremove
1468
 chroot $rootdir apt-get -y autoremove

+ 32
- 35
src/freedombone-image-hardware-setup View File

56
     initRd=initrd.img-$version
56
     initRd=initrd.img-$version
57
     vmlinuz=vmlinuz-$version
57
     vmlinuz=vmlinuz-$version
58
 
58
 
59
-    bbb_loadaddr='0x80200000'
60
-    bbb_initrd_addr='0x81000000'
61
-    bbb_fdtaddr='0x80F80000'
62
-    if [[ "$bbb_version" == "wireless" ]]; then
63
-        bbb_loadaddr='0x82000000'
64
-        bbb_initrd_addr='0x88080000'
65
-        bbb_fdtaddr='0x88000000'
66
-    fi
59
+    bbb_loadaddr='0x82000000'
60
+    bbb_initrd_addr='0x88080000'
61
+    bbb_fdtaddr='0x88000000'
67
 
62
 
68
     # uEnv.txt for Beaglebone
63
     # uEnv.txt for Beaglebone
69
     # based on https://github.com/beagleboard/image-builder/blob/master/target/boot/beagleboard.org.txt
64
     # based on https://github.com/beagleboard/image-builder/blob/master/target/boot/beagleboard.org.txt
89
 loadfdt=load mmc \${mmcdev}:\${mmcpart} \${fdtaddr} /dtbs/\${fdtfile}
84
 loadfdt=load mmc \${mmcdev}:\${mmcpart} \${fdtaddr} /dtbs/\${fdtfile}
90
 
85
 
91
 loadfiles=run loadkernel; run loadinitrd; run loadfdt
86
 loadfiles=run loadkernel; run loadinitrd; run loadfdt
92
-mmcargs=setenv bootargs console=tty0 console=\${console} root=\${mmcroot} rootfstype=\${mmcrootfstype} rootflags=\${mmcrootflags}
87
+mmcargs=setenv bootargs init=/lib/systemd/systemd console=tty0 console=\${console} root=\${mmcroot} rootfstype=\${mmcrootfstype} rootflags=\${mmcrootflags} ifnames=0 slub_debug=FZP slab_nomerge page_poison=1
93
 
88
 
94
 uenvcmd=run loadfiles; run mmcargs; bootz \${loadaddr} \${initrd_addr}:\${initrd_size} \${fdtaddr}
89
 uenvcmd=run loadfiles; run mmcargs; bootz \${loadaddr} \${initrd_addr}:\${initrd_size} \${fdtaddr}
95
 EOF
90
 EOF
123
 
118
 
124
     echo "info: repacking beaglebone kernel and initrd"
119
     echo "info: repacking beaglebone kernel and initrd"
125
 
120
 
126
-    if [ ! $bbb_version ]; then
127
-        kernelVersion=$(ls /usr/lib/*/am335x-boneblack.dtb | head -1 | cut -d/ -f4)
128
-    else
129
-        kernelVersion=$(ls /usr/lib/*/am335x-boneblack-${1}.dtb | head -1 | cut -d/ -f4)
121
+    bbb_dtb='am335x-boneblack'
122
+    if [ $bbb_version ]; then
123
+        bbb_dtb="am335x-boneblack-${bbb_version}"
130
     fi
124
     fi
125
+
126
+    kernelVersion=$(ls /usr/lib/*/${bbb_dtb}.dtb | head -1 | cut -d/ -f4)
131
     version=$(echo $kernelVersion | sed 's/linux-image-\(.*\)/\1/')
127
     version=$(echo $kernelVersion | sed 's/linux-image-\(.*\)/\1/')
132
     initRd=initrd.img-$version
128
     initRd=initrd.img-$version
133
     vmlinuz=vmlinuz-$version
129
     vmlinuz=vmlinuz-$version
134
 
130
 
131
+    # optionally use a separately compiled kernel
132
+    bbb_dtb_file=/usr/lib/$kernelVersion/${bbb_dtb}.dtb
133
+    #if [ -f /boot/bbb.tar.gz ]; then
134
+    #    cd /boot
135
+    #    tar -xzvf /boot/bbb.tar.gz
136
+    #    if [ -f /boot/bbb/dtbs/${bbb_dtb}.dtb ]; then
137
+    #        if [ -f /boot/bbb/zImage ]; then
138
+    #            bbb_dtb_file=/boot/bbb/dtbs/${bbb_dtb}.dtb
139
+    #            vmlinuz=/boot/bbb/zImage
140
+    #        fi
141
+    #    fi
142
+    #fi
143
+
135
     mkdir /tmp/initrd-repack
144
     mkdir /tmp/initrd-repack
136
 
145
 
137
     (cd /tmp/initrd-repack ; \
146
     (cd /tmp/initrd-repack ; \
142
 
151
 
143
     rm -rf /tmp/initrd-repack
152
     rm -rf /tmp/initrd-repack
144
 
153
 
145
-    if [ ! $bbb_version ]; then
146
-        (cd /boot ; \
147
-         cp /usr/lib/$kernelVersion/am335x-boneblack.dtb dtb ; \
148
-         cat $vmlinuz dtb >> temp-kernel ; \
149
-         mkimage -A arm -O linux -T kernel -n "Debian kernel ${version}" \
150
-                 -C none -a 0x80200000 -e 0x80200000 -d temp-kernel uImage ; \
151
-         rm -f temp-kernel ; \
152
-         mkimage -A arm -O linux -T ramdisk -C gzip -a 0x81000000 -e 0x81000000 \
153
-                 -n "Debian ramdisk ${version}" \
154
-                 -d $initRd uInitrd )
155
-    else
156
-        (cd /boot ; \
157
-         cp /usr/lib/$kernelVersion/am335x-boneblack-${bbb_version}.dtb dtb ; \
158
-         cat $vmlinuz dtb >> temp-kernel ; \
159
-         mkimage -A arm -O linux -T kernel -n "Debian kernel ${version}" \
160
-                 -C none -a 0x82000000 -e 0x82000000 -d temp-kernel uImage ; \
161
-         rm -f temp-kernel ; \
162
-         mkimage -A arm -O linux -T ramdisk -C gzip -a 0x88080000 -e 0x88080000 \
163
-                 -n "Debian ramdisk ${version}" \
164
-                 -d $initRd uInitrd )
165
-    fi
154
+    (cd /boot ; \
155
+     cp ${bbb_dtb_file} dtb ; \
156
+     cat $vmlinuz dtb >> temp-kernel ; \
157
+     mkimage -A arm -O linux -T kernel -n "Debian kernel ${version}" \
158
+             -C none -a 0x82000000 -e 0x82000000 -d temp-kernel uImage ; \
159
+     rm -f temp-kernel ; \
160
+     mkimage -A arm -O linux -T ramdisk -C gzip -a 0x88080000 -e 0x88080000 \
161
+             -n "Debian ramdisk ${version}" \
162
+             -d $initRd uInitrd )
166
 }
163
 }
167
 
164
 
168
 a20_setup_boot() {
165
 a20_setup_boot() {
206
 setenv loadfdt load mmc \${mmcdev}:\${mmcpart} \${fdtaddr} /dtbs/\${fdtfile}
203
 setenv loadfdt load mmc \${mmcdev}:\${mmcpart} \${fdtaddr} /dtbs/\${fdtfile}
207
 
204
 
208
 setenv loadfiles run loadkernel\\; run loadinitrd\\; run loadfdt
205
 setenv loadfiles run loadkernel\\; run loadinitrd\\; run loadfdt
209
-setenv mmcargs setenv bootargs console=\${console} root=\${mmcroot} rootfstype=\${mmcrootfstype} rootflags=\${mmcrootflags}
206
+setenv mmcargs setenv bootargs init=/lib/systemd/systemd console=\${console} root=\${mmcroot} rootfstype=\${mmcrootfstype} rootflags=\${mmcrootflags} ifnames=0 slub_debug=FZP slab_nomerge page_poison=1
210
 
207
 
211
 run loadfiles; run mmcargs; bootz \${loadaddr} \${initrd_addr}:\${initrd_size} \${fdtaddr}
208
 run loadfiles; run mmcargs; bootz \${loadaddr} \${initrd_addr}:\${initrd_size} \${fdtaddr}
212
 EOF
209
 EOF

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

77
 export MINIMUM_PASSWORD_LENGTH
77
 export MINIMUM_PASSWORD_LENGTH
78
 export INSECURE
78
 export INSECURE
79
 export AMNESIC
79
 export AMNESIC
80
+export SOCIALINSTANCE
81
+export LOCAL_NAME
80
 
82
 
81
 # Locate vmdebootstrap program fetched in Makefile
83
 # Locate vmdebootstrap program fetched in Makefile
82
 basedir=`pwd`
84
 basedir=`pwd`
90
 
92
 
91
 # Packages to install in all Freedombone environments
93
 # Packages to install in all Freedombone environments
92
 base_pkgs="apt base-files ifupdown initramfs-tools \
94
 base_pkgs="apt base-files ifupdown initramfs-tools \
93
-logrotate module-init-tools netbase rsyslog udev debian-archive-keyring"
95
+logrotate kmod netbase rsyslog udev debian-archive-keyring"
94
 
96
 
95
 # Packages needed on the beaglebone
97
 # Packages needed on the beaglebone
96
 beaglebone_pkgs="linux-image-armmp u-boot-tools u-boot"
98
 beaglebone_pkgs="linux-image-armmp u-boot-tools u-boot"
241
 sed -i "s|MINIMUM_PASSWORD_LENGTH=.*|MINIMUM_PASSWORD_LENGTH=\"${MINIMUM_PASSWORD_LENGTH}\"|g" $TEMP_CUSTOMISE3
243
 sed -i "s|MINIMUM_PASSWORD_LENGTH=.*|MINIMUM_PASSWORD_LENGTH=\"${MINIMUM_PASSWORD_LENGTH}\"|g" $TEMP_CUSTOMISE3
242
 sed -i "s|INSECURE=.*|INSECURE=\"${INSECURE}\"|g" $TEMP_CUSTOMISE3
244
 sed -i "s|INSECURE=.*|INSECURE=\"${INSECURE}\"|g" $TEMP_CUSTOMISE3
243
 sed -i "s|AMNESIC=.*|AMNESIC=\"${AMNESIC}\"|g" $TEMP_CUSTOMISE3
245
 sed -i "s|AMNESIC=.*|AMNESIC=\"${AMNESIC}\"|g" $TEMP_CUSTOMISE3
246
+sed -i "s|SOCIALINSTANCE=.*|SOCIALINSTANCE=\"${SOCIALINSTANCE}\"|g" $TEMP_CUSTOMISE3
247
+sed -i "s|LOCAL_NAME=.*|LOCAL_NAME=\"${LOCAL_NAME}\"|g" $TEMP_CUSTOMISE3
244
 sed -i 's|#!/bin/bash||g' $TEMP_CUSTOMISE3
248
 sed -i 's|#!/bin/bash||g' $TEMP_CUSTOMISE3
245
 
249
 
246
 cat $TEMP_CUSTOMISE2 $TEMP_CUSTOMISE3 > $TEMP_CUSTOMISE4
250
 cat $TEMP_CUSTOMISE2 $TEMP_CUSTOMISE3 > $TEMP_CUSTOMISE4

+ 1
- 1
src/freedombone-image-makefile View File

31
 BUILD_MIRROR ?= http://httpredir.debian.org/debian
31
 BUILD_MIRROR ?= http://httpredir.debian.org/debian
32
 IMAGE_SIZE ?= 8G
32
 IMAGE_SIZE ?= 8G
33
 IMAGE_NAME ?= 'full'
33
 IMAGE_NAME ?= 'full'
34
-SUITE ?= jessie
34
+SUITE ?= stretch
35
 # include source packages in image?
35
 # include source packages in image?
36
 SOURCE ?= false
36
 SOURCE ?= false
37
 
37
 

+ 14
- 4
src/freedombone-image-mesh View File

42
 
42
 
43
 DEFAULT_USERNAME=fbone
43
 DEFAULT_USERNAME=fbone
44
 
44
 
45
-GO_VERSION=1.7
46
-
47
 TOX_NODES=
45
 TOX_NODES=
48
 #TOX_NODES=(
46
 #TOX_NODES=(
49
 #  '192.254.75.102,2607:5600:284::2,33445,951C88B7E75C867418ACDB5D273821372BB5BD652740BCDF623A4FA293E75D2F,Tox RELENG,US'
47
 #  '192.254.75.102,2607:5600:284::2,33445,951C88B7E75C867418ACDB5D273821372BB5BD652740BCDF623A4FA293E75D2F,Tox RELENG,US'
74
 
72
 
75
 CURRENT_BLOG_INDEX=/home/$MY_USERNAME/.blog-index
73
 CURRENT_BLOG_INDEX=/home/$MY_USERNAME/.blog-index
76
 
74
 
75
+# Debian stretch has a problem where the formerly predictable wlan0 and eth0
76
+# device names get assigned random names. This is a hacky workaround.
77
+# Also adding net.ifnames=0 to kernel options on bootloader may work.
78
+function enable_predictable_device_names {
79
+    ln -s /dev/null /etc/udev/rules.d/80-net-setup-link.rules
80
+    update-initramfs -u
81
+}
82
+
77
 function create_avahi_mesh_service {
83
 function create_avahi_mesh_service {
78
     service_name=$1
84
     service_name=$1
79
     service_type=$2
85
     service_type=$2
112
 
118
 
113
 function make_root_read_only {
119
 function make_root_read_only {
114
     if [ ! -d /home/$MY_USERNAME/Desktop ]; then
120
     if [ ! -d /home/$MY_USERNAME/Desktop ]; then
115
-        if ! grep 'ro,subvol=@' /etc/fstab; then
121
+        if ! grep -q 'ro,subvol=@' /etc/fstab; then
116
             sed -i 's|subvol=@|ro,subvol=@|g' /etc/fstab
122
             sed -i 's|subvol=@|ro,subvol=@|g' /etc/fstab
117
             echo $'Root filesystem set to read only' >> $INSTALL_LOG
123
             echo $'Root filesystem set to read only' >> $INSTALL_LOG
118
         fi
124
         fi
591
 
597
 
592
     #tomb slam all
598
     #tomb slam all
593
     tmp_ram_disk 100
599
     tmp_ram_disk 100
600
+    enable_predictable_device_names
594
     enable_batman_daemon
601
     enable_batman_daemon
595
     #create_ram_disk 1
602
     #create_ram_disk 1
596
     #setup_amnesic_data
603
     #setup_amnesic_data
625
             rm /usr/share/images/desktop-base/desktop-background
632
             rm /usr/share/images/desktop-base/desktop-background
626
             ln -s /usr/share/images/desktop-base/${PROJECT_NAME}_mesh_background.png /usr/share/images/desktop-base/desktop-background
633
             ln -s /usr/share/images/desktop-base/${PROJECT_NAME}_mesh_background.png /usr/share/images/desktop-base/desktop-background
627
         fi
634
         fi
628
-        reboot
635
+        if [ -f /etc/default/grub ]; then
636
+            update-grub
637
+        fi
638
+        systemctl reboot -i
629
     fi
639
     fi
630
 fi
640
 fi
631
 
641
 

+ 126
- 72
src/freedombone-keydrive 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
50
 
50
 
51
 while [[ $# > 1 ]]
51
 while [[ $# > 1 ]]
52
 do
52
 do
53
-key="$1"
53
+    key="$1"
54
 
54
 
55
-case $key in
56
-    -h|--help)
57
-    show_help
58
-    ;;
59
-    -u|--user)
55
+    case $key in
56
+        -h|--help)
57
+            show_help
58
+            ;;
59
+        -u|--user)
60
+            shift
61
+            MY_USERNAME="$1"
62
+            ;;
63
+        -d|--dev)
64
+            shift
65
+            if [[ "${1}" != '/dev/'* ]]; then
66
+                USB_DRIVE=/dev/${1}1
67
+            else
68
+                USB_DRIVE=${1}
69
+            fi
70
+            ;;
71
+        -m|--master)
72
+            shift
73
+            MASTER_DRIVE="$1"
74
+            ;;
75
+        -n|--fragments)
76
+            shift
77
+            KEY_FRAGMENTS=$1
78
+            ;;
79
+        -f|--format)
80
+            shift
81
+            FORMAT="yes"
82
+            ;;
83
+        *)
84
+            # unknown option
85
+            ;;
86
+    esac
60
     shift
87
     shift
61
-    MY_USERNAME="$1"
62
-    ;;
63
-    -d|--dev)
64
-    shift
65
-    USB_DRIVE=/dev/${1}1
66
-    ;;
67
-    -m|--master)
68
-    shift
69
-    MASTER_DRIVE="$1"
70
-    ;;
71
-    -n|--fragments)
72
-    shift
73
-    KEY_FRAGMENTS=$1
74
-    ;;
75
-    -f|--format)
76
-    shift
77
-    FORMAT="yes"
78
-    ;;
79
-    *)
80
-    # unknown option
81
-    ;;
82
-esac
83
-shift
84
 done
88
 done
85
 
89
 
86
 if [ ! $MY_USERNAME ]; then
90
 if [ ! $MY_USERNAME ]; then
94
 fi
98
 fi
95
 
99
 
96
 if [ ! -b $USB_DRIVE ]; then
100
 if [ ! -b $USB_DRIVE ]; then
97
-  echo $'Please attach a USB drive'
98
-  exit 65743
101
+    echo $'Please attach a USB drive'
102
+    exit 65743
99
 fi
103
 fi
100
 
104
 
101
 umount -f $USB_MOUNT
105
 umount -f $USB_MOUNT
102
 if [ ! -d $USB_MOUNT ]; then
106
 if [ ! -d $USB_MOUNT ]; then
103
-  mkdir $USB_MOUNT
107
+    mkdir $USB_MOUNT
104
 fi
108
 fi
105
 if [ -f /dev/mapper/encrypted_usb ]; then
109
 if [ -f /dev/mapper/encrypted_usb ]; then
106
-  rm -rf /dev/mapper/encrypted_usb
110
+    rm -rf /dev/mapper/encrypted_usb
107
 fi
111
 fi
108
 cryptsetup luksClose encrypted_usb
112
 cryptsetup luksClose encrypted_usb
109
 
113
 
110
 # optionally format the drive
114
 # optionally format the drive
111
 if [[ $FORMAT == "yes" ]]; then
115
 if [[ $FORMAT == "yes" ]]; then
112
-  ${PROJECT_NAME}-format ${USB_DRIVE::-1}
113
-  if [ ! "$?" = "0" ]; then
114
-      exit 36823
115
-  fi
116
+    ${PROJECT_NAME}-format ${USB_DRIVE::-1}
117
+    if [ ! "$?" = "0" ]; then
118
+        exit 36823
119
+    fi
116
 fi
120
 fi
117
 
121
 
118
 cryptsetup luksOpen $USB_DRIVE encrypted_usb
122
 cryptsetup luksOpen $USB_DRIVE encrypted_usb
119
 if [ "$?" = "0" ]; then
123
 if [ "$?" = "0" ]; then
120
-  USB_DRIVE=/dev/mapper/encrypted_usb
124
+    USB_DRIVE=/dev/mapper/encrypted_usb
121
 fi
125
 fi
122
 mount $USB_DRIVE $USB_MOUNT
126
 mount $USB_DRIVE $USB_MOUNT
123
 if [ ! "$?" = "0" ]; then
127
 if [ ! "$?" = "0" ]; then
124
-  echo $"There was a problem mounting the USB drive to $USB_MOUNT"
125
-  rm -rf $USB_MOUNT
126
-  exit 78543
128
+    echo $"There was a problem mounting the USB drive to $USB_MOUNT"
129
+    rm -rf $USB_MOUNT
130
+    exit 78543
127
 fi
131
 fi
128
 
132
 
129
 # optionally create a master drive which contains the full GPG keyring
133
 # optionally create a master drive which contains the full GPG keyring
130
 if [[ $MASTER_DRIVE == "yes" || $MASTER_DRIVE == "y" || $MASTER_DRIVE == "1" ]]; then
134
 if [[ $MASTER_DRIVE == "yes" || $MASTER_DRIVE == "y" || $MASTER_DRIVE == "1" ]]; then
131
-  if [ ! -d /home/$MY_USERNAME/.gnupg ]; then
132
-      echo $"No .gnupg directory was found for $MY_USERNAME"
133
-      umount -f $USB_MOUNT
134
-      rm -rf $USB_MOUNT
135
-      exit 73025
136
-  fi
137
-  cp -rf /home/$MY_USERNAME/.gnupg $USB_MOUNT
138
-  if [ -d /etc/letsencrypt ]; then
139
-      cp -rf /etc/letsencrypt $USB_MOUNT
140
-      echo $"LetsEncrypt keys copied to $USB_DRIVE"
141
-  fi
142
-  if [ -d $USB_MOUNT/.gnupg ]; then
143
-      echo $"GPG Keyring copied to $USB_DRIVE. You may now remove the drive."
144
-  else
145
-      echo $"Unable to copy gpg keyring to $USB_DRIVE"
146
-  fi
147
-  umount -f $USB_MOUNT
148
-  rm -rf $USB_MOUNT
149
-  exit 0
135
+    if [ ! -d /home/$MY_USERNAME/.gnupg ]; then
136
+        echo $"No .gnupg directory was found for $MY_USERNAME"
137
+        umount -f $USB_MOUNT
138
+        rm -rf $USB_MOUNT
139
+        exit 73025
140
+    fi
141
+
142
+    # export the gpg key and backup key as text
143
+    # so that it may be imported at the beginning of new installs
144
+    GPG_TTY=$(tty)
145
+    export GPG_TTY
146
+
147
+    USER_EMAIL_ADDRESS=$MY_USERNAME@$HOSTNAME
148
+    GPG_ID=$(su -m root -c "gpg --list-keys $USER_EMAIL_ADDRESS | sed -n '2p' | sed 's/^[ \t]*//'" - $MY_USERNAME)
149
+    GPG_BACKUP_ID=$(su -m root -c "gpg --list-keys \"(backup key)\" | sed -n '2p' | sed 's/^[ \t]*//'" - $MY_USERNAME)
150
+
151
+    gpgerrstr=$'error'
152
+    gpgkey=$(gpg --homedir=/home/$MY_USERNAME/.gnupg --armor --export $GPG_ID)
153
+    if [[ "$gpgkey" == *"$gpgerrstr"* ]]; then
154
+        echo $'Problem exporting public gpg key'
155
+        echo "$gpgkey"
156
+        exit 735282
157
+    fi
158
+    echo ''
159
+    echo $'Enter your gpg private key passphrase:'
160
+    gpgprivkey=$(gpg --homedir=/home/$MY_USERNAME/.gnupg --armor --export-secret-key $GPG_ID)
161
+    if [[ "$gpgprivkey" == *"$gpgerrstr"* ]]; then
162
+        echo $'Problem exporting private gpg key'
163
+        echo "$gpgprivkey"
164
+        gpgprivkey=
165
+        exit 629362
166
+    fi
167
+
168
+    # Dummy password to get around not being able to create a key without passphrase
169
+    BACKUP_DUMMY_PASSWORD='backup'
170
+
171
+    backupgpgkey=$(gpg --homedir=/home/$MY_USERNAME/.gnupg --armor --export $GPG_BACKUP_ID)
172
+    if [[ "$backupgpgkey" == *"$gpgerrstr"* ]]; then
173
+        echo $'Problem exporting public gpg backup key'
174
+        echo "$backupgpgkey"
175
+        exit 735282
176
+    fi
177
+    backupgpgprivkey=$(echo "$BACKUP_DUMMY_PASSWORD" | gpg --batch --passphrase-fd 0 --homedir=/home/$MY_USERNAME/.gnupg --armor --export-secret-key $GPG_BACKUP_ID)
178
+    if [[ "$backupgpgprivkey" == *"$gpgerrstr"* ]]; then
179
+        echo $'Problem exporting private gpg backup key'
180
+        echo "$backupgpgprivkey"
181
+        backupgpgprivkey=
182
+        exit 629362
183
+    fi
184
+
185
+    echo "$gpgkey" > $USB_MOUNT/.mastergpgkey
186
+    echo "$gpgprivkey" >> $USB_MOUNT/.mastergpgkey
187
+    echo "$backupgpgkey" > $USB_MOUNT/.backupgpgkey
188
+    echo "$backupgpgprivkey" >> $USB_MOUNT/.backupgpgkey
189
+
190
+    cp -rf /home/$MY_USERNAME/.gnupg $USB_MOUNT
191
+
192
+    if [ -d /etc/letsencrypt ]; then
193
+        cp -rf /etc/letsencrypt $USB_MOUNT
194
+        echo $"LetsEncrypt keys copied to $USB_DRIVE"
195
+    fi
196
+    if [ -d $USB_MOUNT/.gnupg ]; then
197
+        echo $"GPG Keyring copied to $USB_DRIVE. You may now remove the drive."
198
+    else
199
+        echo $"Unable to copy gpg keyring to $USB_DRIVE"
200
+    fi
201
+    umount -f $USB_MOUNT
202
+    rm -rf $USB_MOUNT
203
+    exit 0
150
 fi
204
 fi
151
 
205
 
152
 # Don't use the USB drive if it already contains a full keyring
206
 # Don't use the USB drive if it already contains a full keyring
153
 if [ -d $USB_MOUNT/.gnupg ]; then
207
 if [ -d $USB_MOUNT/.gnupg ]; then
154
-  echo $'A full GPG keyring already exists on the USB drive.'
155
-  echo $'Either reformat the USB drive or use a different drive.'
156
-  umount -f $USB_MOUNT
157
-  rm -rf $USB_MOUNT
158
-  exit 3392
208
+    echo $'A full GPG keyring already exists on the USB drive.'
209
+    echo $'Either reformat the USB drive or use a different drive.'
210
+    umount -f $USB_MOUNT
211
+    rm -rf $USB_MOUNT
212
+    exit 3392
159
 fi
213
 fi
160
 
214
 
161
 # Append the username as a subdirectory.
215
 # Append the username as a subdirectory.
167
 
221
 
168
 # make a directory to contain the fragments
222
 # make a directory to contain the fragments
169
 if [ ! -d $FRAGMENTS_DIR ]; then
223
 if [ ! -d $FRAGMENTS_DIR ]; then
170
-  mkdir -p $FRAGMENTS_DIR
171
-  echo $"Made directory $FRAGMENTS_DIR"
224
+    mkdir -p $FRAGMENTS_DIR
225
+    echo $"Made directory $FRAGMENTS_DIR"
172
 fi
226
 fi
173
 if [ ! -d $FRAGMENTS_DIR ]; then
227
 if [ ! -d $FRAGMENTS_DIR ]; then
174
-  echo $"There was a problem making the directory $FRAGMENTS_DIR"
175
-  umount -f $USB_MOUNT
176
-  rm -rf $USB_MOUNT
177
-  exit 6843
228
+    echo $"There was a problem making the directory $FRAGMENTS_DIR"
229
+    umount -f $USB_MOUNT
230
+    rm -rf $USB_MOUNT
231
+    exit 6843
178
 fi
232
 fi
179
 
233
 
180
 cd $FRAGMENTS_DIR
234
 cd $FRAGMENTS_DIR

+ 98
- 82
src/freedombone-logging View File

35
 
35
 
36
 WEBSERVER_LOG_LEVEL='warn'
36
 WEBSERVER_LOG_LEVEL='warn'
37
 
37
 
38
+# Shredding could be used here, but especially on microSD
39
+# or SSD it's debatable how useful shredding really is.
40
+# Also the shred command can be very slow on Beaglebone Black
41
+REMOVE_FILES_COMMAND='rm -rf'
42
+
43
+APP_FILES=/usr/share/${PROJECT_NAME}/apps/${PROJECT_NAME}-app-*
44
+for f in $APP_FILES
45
+do
46
+    source $f
47
+done
48
+
49
+APPS_AVAILABLE=()
50
+
51
+function logging_get_app_names {
52
+    FILES=/usr/share/${PROJECT_NAME}/apps/${PROJECT_NAME}-app-*
53
+
54
+    for filename in $FILES
55
+    do
56
+        app_name=$(echo "${filename}" | awk -F '-app-' '{print $2}')
57
+        if grep -q "logging_on_" ${filename}; then
58
+            if grep -q "logging_off_" ${filename}; then
59
+                APPS_AVAILABLE+=("${app_name}")
60
+            fi
61
+        fi
62
+    done
63
+}
64
+
65
+function turn_logging_on {
66
+    logging_get_app_names
67
+
68
+    for a in "${APPS_AVAILABLE[@]}"
69
+    do
70
+        echo $"Turning on logging for ${a}"
71
+        logging_on_${a}
72
+    done
73
+}
74
+
75
+function turn_logging_off {
76
+    logging_get_app_names
77
+
78
+    for a in "${APPS_AVAILABLE[@]}"
79
+    do
80
+        echo $"Turning off logging for ${a}"
81
+        logging_off_${a}
82
+    done
83
+}
84
+
38
 function turn_off_rsys_logging {
85
 function turn_off_rsys_logging {
39
     sed -i 's|mail,news.none.*|mail,news.none      /dev/null|g' /etc/rsyslog.conf
86
     sed -i 's|mail,news.none.*|mail,news.none      /dev/null|g' /etc/rsyslog.conf
40
     sed -i 's|auth,authpriv.\*.*|auth,authpriv.\*         /dev/null|g' /etc/rsyslog.conf
87
     sed -i 's|auth,authpriv.\*.*|auth,authpriv.\*         /dev/null|g' /etc/rsyslog.conf
48
     sed -i 's|\*.\*;auth,authpriv.none.*|\*.\*;auth,authpriv.none      /dev/null|g' /etc/rsyslog.conf
95
     sed -i 's|\*.\*;auth,authpriv.none.*|\*.\*;auth,authpriv.none      /dev/null|g' /etc/rsyslog.conf
49
     sed -i 's|#cron.\*|cron.\*|g' /etc/rsyslog.conf
96
     sed -i 's|#cron.\*|cron.\*|g' /etc/rsyslog.conf
50
     sed -i 's|cron.\*.*|cron.\*             /dev/null|g' /etc/rsyslog.conf
97
     sed -i 's|cron.\*.*|cron.\*             /dev/null|g' /etc/rsyslog.conf
51
-    shred -zu /var/log/wtmp*
52
-    shred -zu /var/log/debug*
53
-    shred -zu /var/log/cron.*
54
-    shred -zu /var/log/auth.*
55
-    shred -zu /var/log/mail.*
56
-    shred -zu /var/log/daemon.*
57
-    shred -zu /var/log/user.*
58
-    shred -zu /var/log/messages*
98
+    $REMOVE_FILES_COMMAND /var/log/wtmp*
99
+    $REMOVE_FILES_COMMAND /var/log/debug*
100
+    $REMOVE_FILES_COMMAND /var/log/cron.*
101
+    $REMOVE_FILES_COMMAND /var/log/auth.*
102
+    $REMOVE_FILES_COMMAND /var/log/mail.*
103
+    $REMOVE_FILES_COMMAND /var/log/daemon.*
104
+    $REMOVE_FILES_COMMAND /var/log/user.*
105
+    $REMOVE_FILES_COMMAND /var/log/messages*
59
 }
106
 }
60
 
107
 
61
 function turn_on_rsys_logging {
108
 function turn_on_rsys_logging {
78
 fi
125
 fi
79
 
126
 
80
 if [[ "$1" == "on" || "$1" == "On" || "$1" == "ON" ]]; then
127
 if [[ "$1" == "on" || "$1" == "On" || "$1" == "ON" ]]; then
81
-    if [ -f /var/lib/matrix/homeserver.yaml ]; then
82
-        sed -i 's|log_file:.*|log_file: /etc/matrix/homeserver.log|g' /var/lib/matrix/homeserver.yaml
83
-        if ! grep -q "#log_config:" /var/lib/matrix/homeserver.yaml; then
84
-            sed -i 's|log_config:|#log_config:|g' /var/lib/matrix/homeserver.yaml
85
-        fi
86
-    fi
128
+    turn_logging_on
129
+
87
     if [ -f /etc/fail2ban/fail2ban.conf ]; then
130
     if [ -f /etc/fail2ban/fail2ban.conf ]; then
88
         sed -i 's|loglevel.*|loglevel = 3|g' /etc/fail2ban/fail2ban.conf
131
         sed -i 's|loglevel.*|loglevel = 3|g' /etc/fail2ban/fail2ban.conf
89
         sed -i 's|logtarget.*|logtarget = /var/log/fail2ban.log|g' /etc/fail2ban/fail2ban.conf
132
         sed -i 's|logtarget.*|logtarget = /var/log/fail2ban.log|g' /etc/fail2ban/fail2ban.conf
90
     fi
133
     fi
91
     if [ -d /etc/tor ]; then
134
     if [ -d /etc/tor ]; then
92
-        if [ ! -f /var/log/tor.log ]; then
93
-            touch /var/log/tor.log
94
-            chown debian-tor:debian-tor /var/log/tor.log
135
+        if [ ! -d /var/log/tor ]; then
136
+            mkdir /var/log/tor
137
+            chown -R debian-tor:adm /var/log/tor
95
         fi
138
         fi
96
-        sed -i 's|#Log notice file.*|Log notice file /var/log/tor.log|g' /etc/tor/torrc
97
-        sed -i 's|Log notice file.*|Log notice file /var/log/tor.log|g' /etc/tor/torrc
98
-    fi
99
-    if [ -f /etc/mumble-server.ini ]; then
100
-        sed -i 's|logfile=.*|logfile=/var/log/mumble-server.log|g' /etc/mumble-server.ini
139
+        if [ ! -f /var/log/tor/notices.log ]; then
140
+            touch /var/log/tor/notices.log
141
+            chown debian-tor:adm /var/log/tor/notices.log
142
+        fi
143
+        sed -i 's|#Log notice file.*|Log notice file /var/log/tor/notices.log|g' /etc/tor/torrc
144
+        sed -i 's|Log notice file.*|Log notice file /var/log/tor/notices.log|g' /etc/tor/torrc
101
     fi
145
     fi
102
-    if [ -f /etc/php5/fpm/php-fpm.conf ]; then
103
-        sed -i 's|error_log =.*|error_log = /var/log/php5-fpm.log|g' /etc/php5/fpm/php-fpm.conf
146
+    if [ -f /etc/php/7.0/fpm/php-fpm.conf ]; then
147
+        sed -i 's|error_log =.*|error_log = /var/log/php-fpm.log|g' /etc/php/7.0/fpm/php-fpm.conf
104
     fi
148
     fi
105
     if [ -d /etc/nginx ]; then
149
     if [ -d /etc/nginx ]; then
106
         if [ ! -d /var/log/nginx ]; then
150
         if [ ! -d /var/log/nginx ]; then
117
     if [ -f /etc/init.d/spamassassin ]; then
161
     if [ -f /etc/init.d/spamassassin ]; then
118
         sed -i 's|DOPTIONS="-s null -d --pidfile=$PIDFILE"|DOPTIONS="-d --pidfile=$PIDFILE"|g' /etc/init.d/spamassassin
162
         sed -i 's|DOPTIONS="-s null -d --pidfile=$PIDFILE"|DOPTIONS="-d --pidfile=$PIDFILE"|g' /etc/init.d/spamassassin
119
     fi
163
     fi
120
-    if [ -d /etc/prosody ]; then
121
-        if [ ! -d /var/log/prosody ]; then
122
-            mkdir /var/log/prosody
123
-            chown root:adm /var/log/prosody
124
-        fi
125
-        sed -i 's|info = "/dev/null";|info = "/var/log/prosody/prosody.log";|g' /etc/prosody/prosody.cfg.lua
126
-        sed -i 's|error = "/dev/null";|error = "/var/log/prosody/prosody.err";|g' /etc/prosody/prosody.cfg.lua
127
-        sed -i 's|levels = { "error" }; to = "/dev/null";|levels = { "error" }; to = "syslog";|g' /etc/prosody/prosody.cfg.lua
128
-    fi
129
     if [ -d /etc/exim4 ]; then
164
     if [ -d /etc/exim4 ]; then
130
         if [ ! -d /var/log/exim4 ]; then
165
         if [ ! -d /var/log/exim4 ]; then
131
             mkdir /var/log/exim4
166
             mkdir /var/log/exim4
149
     fi
184
     fi
150
     turn_on_rsys_logging
185
     turn_on_rsys_logging
151
 else
186
 else
152
-    if [ -f /var/lib/matrix/homeserver.yaml ]; then
153
-        sed -i 's|log_file:.*|log_file: /dev/null|g' /var/lib/matrix/homeserver.yaml
154
-        if ! grep -q "#log_config:" /var/lib/matrix/homeserver.yaml; then
155
-            sed -i 's|log_config:|#log_config:|g' /var/lib/matrix/homeserver.yaml
156
-        fi
157
-        if [ -f /etc/matrix/homeserver.log ]; then
158
-            shred -zu /etc/matrix/homeserver.log
159
-        fi
160
-        if [ -f /etc/matrix/homeserver.log.1 ]; then
161
-            shred -zu /etc/matrix/homeserver.log.1
162
-        fi
163
-    fi
187
+    turn_logging_off
188
+
164
     if [ -d /etc/tor ]; then
189
     if [ -d /etc/tor ]; then
165
         sed -i 's|#Log notice file.*|Log notice file /dev/null|g' /etc/tor/torrc
190
         sed -i 's|#Log notice file.*|Log notice file /dev/null|g' /etc/tor/torrc
166
         sed -i 's|Log notice file.*|Log notice file /dev/null|g' /etc/tor/torrc
191
         sed -i 's|Log notice file.*|Log notice file /dev/null|g' /etc/tor/torrc
167
-        if [ -d /var/log/tor ]; then
168
-            shred -zu /var/log/tor/*
169
-            rm -rf /var/log/tor
170
-        fi
171
-    fi
172
-    if [ -f /etc/mumble-server.ini ]; then
173
-        sed -i 's|logfile=.*|logfile=/dev/null|g' /etc/mumble-server.ini
174
-        if [ -d /var/log/mumble-server ]; then
175
-            shred -zu /var/log/mumble-server/*
176
-            rm -rf /var/log/mumble-server
177
-        fi
178
     fi
192
     fi
179
     if [ -d /var/log/radicale ]; then
193
     if [ -d /var/log/radicale ]; then
180
-        shred -zu /var/log/radicale/*
194
+        $REMOVE_FILES_COMMAND /var/log/radicale/*
181
         rm -rf /var/log/radicale
195
         rm -rf /var/log/radicale
182
     fi
196
     fi
183
-    if [ -f /etc/php5/fpm/php-fpm.conf ]; then
184
-        sed -i 's|error_log =.*|error_log = /dev/null|g' /etc/php5/fpm/php-fpm.conf
185
-        shred -zu /var/log/php5-fpm.*
197
+    if [ -f /etc/php/7.0/fpm/php-fpm.conf ]; then
198
+        sed -i 's|error_log =.*|error_log = /dev/null|g' /etc/php/7.0/fpm/php-fpm.conf
199
+        $REMOVE_FILES_COMMAND /var/log/php-fpm.*
186
     fi
200
     fi
187
     if [ -d /etc/nginx ]; then
201
     if [ -d /etc/nginx ]; then
188
         for filename in /etc/nginx/sites-available/* ; do
202
         for filename in /etc/nginx/sites-available/* ; do
192
         done
206
         done
193
         sed -i 's|access_log.*|access_log /dev/null;|g' /etc/nginx/nginx.conf
207
         sed -i 's|access_log.*|access_log /dev/null;|g' /etc/nginx/nginx.conf
194
         sed -i 's|error_log.*|error_log /dev/null;|g' /etc/nginx/nginx.conf
208
         sed -i 's|error_log.*|error_log /dev/null;|g' /etc/nginx/nginx.conf
195
-        shred -zu /var/log/nginx/*
209
+        $REMOVE_FILES_COMMAND /var/log/nginx/*
196
     fi
210
     fi
197
     if [ -f /etc/init.d/spamassassin ]; then
211
     if [ -f /etc/init.d/spamassassin ]; then
198
         sed -i 's|DOPTIONS="-d --pidfile=$PIDFILE"|DOPTIONS="-s null -d --pidfile=$PIDFILE"|g' /etc/init.d/spamassassin
212
         sed -i 's|DOPTIONS="-d --pidfile=$PIDFILE"|DOPTIONS="-s null -d --pidfile=$PIDFILE"|g' /etc/init.d/spamassassin
199
     fi
213
     fi
200
-    if [ -d /etc/prosody ]; then
201
-        sed -i 's|info = "/var/log/prosody/prosody.log";|info = "/dev/null";|g' /etc/prosody/prosody.cfg.lua
202
-        sed -i 's|error = "/var/log/prosody/prosody.err";|error = "/dev/null";|g' /etc/prosody/prosody.cfg.lua
203
-        sed -i 's|levels = { "error" }; to = "syslog";|levels = { "error" }; to = "/dev/null";|g' /etc/prosody/prosody.cfg.lua
204
-        shred -zu /var/log/prosody/*
205
-        rm -rf /var/log/prosody
206
-    fi
207
     if [ -d /etc/exim4 ]; then
214
     if [ -d /etc/exim4 ]; then
208
         sed -i 's|MAIN_LOG_SELECTOR = .*|MAIN_LOG_SELECTOR = -all|g' /etc/exim4/conf.d/main/01_exim4-config_listmacrosdefs
215
         sed -i 's|MAIN_LOG_SELECTOR = .*|MAIN_LOG_SELECTOR = -all|g' /etc/exim4/conf.d/main/01_exim4-config_listmacrosdefs
209
         sed -i 's|MAIN_LOG_SELECTOR = .*|MAIN_LOG_SELECTOR = -all|g' /etc/exim4/exim4.conf.template
216
         sed -i 's|MAIN_LOG_SELECTOR = .*|MAIN_LOG_SELECTOR = -all|g' /etc/exim4/exim4.conf.template
210
         sed -i 's|log_selector =.*|log_selector = -all|g' /etc/exim4/conf.d/main/90_exim4-config_log_selector
217
         sed -i 's|log_selector =.*|log_selector = -all|g' /etc/exim4/conf.d/main/90_exim4-config_log_selector
211
-        shred -zu /var/log/exim4/*
218
+        $REMOVE_FILES_COMMAND /var/log/exim4/*
212
     fi
219
     fi
213
     if [ -f /etc/dovecot/dovecot.conf ]; then
220
     if [ -f /etc/dovecot/dovecot.conf ]; then
214
         sed -i 's|log_path =.*|log_path = /dev/null|g' /etc/dovecot/dovecot.conf
221
         sed -i 's|log_path =.*|log_path = /dev/null|g' /etc/dovecot/dovecot.conf
215
         sed -i 's|info_log_path =.*|info_log_path = /dev/null|g' /etc/dovecot/dovecot.conf
222
         sed -i 's|info_log_path =.*|info_log_path = /dev/null|g' /etc/dovecot/dovecot.conf
216
         sed -i 's|debug_log_path =.*|debug_log_path = /dev/null|g' /etc/dovecot/dovecot.conf
223
         sed -i 's|debug_log_path =.*|debug_log_path = /dev/null|g' /etc/dovecot/dovecot.conf
217
-        shred -zu /var/log/mail.*
218
-        shred -zu /var/log/dovecot*
224
+        $REMOVE_FILES_COMMAND /var/log/mail.*
225
+        $REMOVE_FILES_COMMAND /var/log/dovecot*
219
     fi
226
     fi
220
     if [ -d /etc/mysql ]; then
227
     if [ -d /etc/mysql ]; then
221
         if [ -d /var/log/mysql ]; then
228
         if [ -d /var/log/mysql ]; then
222
-            shred -zu /var/log/mysql/*
229
+            $REMOVE_FILES_COMMAND /var/log/mysql/*
223
         fi
230
         fi
224
         if [ -f /var/log/mysql.err ]; then
231
         if [ -f /var/log/mysql.err ]; then
225
-            shred -zu /var/log/mysql.err
232
+            $REMOVE_FILES_COMMAND /var/log/mysql.err
226
         fi
233
         fi
227
         if [ -f /var/log/mysql.log ]; then
234
         if [ -f /var/log/mysql.log ]; then
228
-            shred -zu /var/log/mysql.log
235
+            $REMOVE_FILES_COMMAND /var/log/mysql.log
229
         fi
236
         fi
230
         if [ -f /etc/mysql/my.cnf ]; then
237
         if [ -f /etc/mysql/my.cnf ]; then
231
             sed -i 's|log_error =.*|log_error = /dev/null|g' /etc/mysql/my.cnf
238
             sed -i 's|log_error =.*|log_error = /dev/null|g' /etc/mysql/my.cnf
234
     if [ -f /etc/fail2ban/fail2ban.conf ]; then
241
     if [ -f /etc/fail2ban/fail2ban.conf ]; then
235
         sed -i 's|loglevel.*|loglevel = 1|g' /etc/fail2ban/fail2ban.conf
242
         sed -i 's|loglevel.*|loglevel = 1|g' /etc/fail2ban/fail2ban.conf
236
         sed -i 's|logtarget.*|logtarget = /dev/null|g' /etc/fail2ban/fail2ban.conf
243
         sed -i 's|logtarget.*|logtarget = /dev/null|g' /etc/fail2ban/fail2ban.conf
237
-        shred -zu /var/log/fail2ban.*
244
+        $REMOVE_FILES_COMMAND /var/log/fail2ban.*
238
     fi
245
     fi
239
     turn_off_rsys_logging
246
     turn_off_rsys_logging
240
 fi
247
 fi
241
 
248
 
249
+if [ -d /etc/exim4 ]; then
250
+    update-exim4.conf.template -r
251
+    update-exim4.conf
252
+    dpkg-reconfigure --frontend noninteractive exim4-config
253
+fi
254
+
255
+if [[ "$2" == "--reboot"* || "$2" == "--restart"* ]]; then
256
+    # if we are rebooting anyway then there is no need to
257
+    # restart the daemons
258
+    exit 0
259
+fi
260
+
261
+if [ -d /etc/exim4 ]; then
262
+    systemctl restart exim4
263
+fi
242
 systemctl restart syslog
264
 systemctl restart syslog
243
 if [ -d /etc/tor ]; then
265
 if [ -d /etc/tor ]; then
244
     if [[ "$2" != "--onion" ]]; then
266
     if [[ "$2" != "--onion" ]]; then
246
     fi
268
     fi
247
 fi
269
 fi
248
 if [ -d /etc/nginx ]; then
270
 if [ -d /etc/nginx ]; then
249
-    systemctl restart php5-fpm
271
+    systemctl restart php7.0-fpm
250
     systemctl restart nginx
272
     systemctl restart nginx
251
 fi
273
 fi
252
 if [ -f /etc/init.d/spamassassin ]; then
274
 if [ -f /etc/init.d/spamassassin ]; then
255
 if [ -d /etc/prosody ]; then
277
 if [ -d /etc/prosody ]; then
256
     systemctl restart prosody
278
     systemctl restart prosody
257
 fi
279
 fi
258
-if [ -d /etc/exim4 ]; then
259
-    update-exim4.conf.template -r
260
-    update-exim4.conf
261
-    dpkg-reconfigure --frontend noninteractive exim4-config
262
-    systemctl restart exim4
263
-fi
264
 if [ -d /etc/dovecot ]; then
280
 if [ -d /etc/dovecot ]; then
265
     systemctl restart dovecot
281
     systemctl restart dovecot
266
 fi
282
 fi

+ 15
- 22
src/freedombone-mesh View File

42
 PEERS_FILE=/tmp/meshpeers.txt
42
 PEERS_FILE=/tmp/meshpeers.txt
43
 
43
 
44
 TOX_PORT=33445
44
 TOX_PORT=33445
45
-TOXCORE_REPO='git://github.com/irungentoo/toxcore.git'
45
+TOXCORE_REPO='https://github.com/irungentoo/toxcore'
46
 TOXCORE_COMMIT=
46
 TOXCORE_COMMIT=
47
 # obtain tox values from main install
47
 # obtain tox values from main install
48
 if grep -q "TOX_PORT=" $CONFIG_FILE; then
48
 if grep -q "TOX_PORT=" $CONFIG_FILE; then
71
 
71
 
72
     sudo apt-get -yq install build-essential libtool autotools-dev
72
     sudo apt-get -yq install build-essential libtool autotools-dev
73
     sudo apt-get -yq install automake checkinstall check git yasm
73
     sudo apt-get -yq install automake checkinstall check git yasm
74
-    sudo apt-get -yq install libsodium13 libsodium-dev libcap2-bin
74
+    sudo apt-get -yq install libsodium18 libsodium-dev libcap2-bin
75
     sudo apt-get -yq install libconfig9 libconfig-dev
75
     sudo apt-get -yq install libconfig9 libconfig-dev
76
 
76
 
77
     if [ ! -d ~/develop ]; then
77
     if [ ! -d ~/develop ]; then
121
     sudo cp /tmp/tox-bootstrapd.conf /etc/tox-bootstrapd.conf
121
     sudo cp /tmp/tox-bootstrapd.conf /etc/tox-bootstrapd.conf
122
     rm /tmp/tox-bootstrapd.conf
122
     rm /tmp/tox-bootstrapd.conf
123
 
123
 
124
-    if [ -f /bin/systemctl ]; then
125
-        if [ ! -f ~/develop/toxcore/other/bootstrap_daemon/tox-bootstrapd.service ]; then
126
-            echo $"File not found ~/develop/toxcore/other/bootstrap_daemon/tox-bootstrapd.service"
127
-            exit 7359
128
-        fi
129
-        sudo cp ~/develop/toxcore/other/bootstrap_daemon/tox-bootstrapd.service /etc/systemd/system/
130
-
131
-        sudo systemctl daemon-reload
132
-        sudo systemctl enable tox-bootstrapd.service
133
-        sudo systemctl start tox-bootstrapd.service
134
-        if [ ! "$?" = "0" ]; then
135
-            sudo systemctl status tox-bootstrapd.service
136
-            exit 5846
137
-        fi
124
+    if [ ! -f ~/develop/toxcore/other/bootstrap_daemon/tox-bootstrapd.service ]; then
125
+        echo $"File not found ~/develop/toxcore/other/bootstrap_daemon/tox-bootstrapd.service"
126
+        exit 7359
127
+    fi
128
+    sudo cp ~/develop/toxcore/other/bootstrap_daemon/tox-bootstrapd.service /etc/systemd/system/
138
 
129
 
139
-        sudo systemctl restart tox-bootstrapd.service
140
-    else
141
-        sudo cp ~/develop/toxcore/other/bootstrap_daemon/tox-bootstrapd.sh /etc/init.d/tox-bootstrapd
142
-        sudo chmod 755 /etc/init.d/tox-bootstrapd
143
-        sudo update-rc.d tox-bootstrapd defaults
144
-        sudo service tox-bootstrapd start
130
+    sudo systemctl daemon-reload
131
+    sudo systemctl enable tox-bootstrapd.service
132
+    sudo systemctl start tox-bootstrapd.service
133
+    if [ ! "$?" = "0" ]; then
134
+        sudo systemctl status tox-bootstrapd.service
135
+        exit 5846
145
     fi
136
     fi
146
 
137
 
138
+    sudo systemctl restart tox-bootstrapd.service
139
+
147
     TOX_PUBLIC_KEY=$(cat /var/log/syslog | grep tox | grep "Public Key" | awk -F ' ' '{print $8}' | tail -1)
140
     TOX_PUBLIC_KEY=$(cat /var/log/syslog | grep tox | grep "Public Key" | awk -F ' ' '{print $8}' | tail -1)
148
     if [ ${#TOX_PUBLIC_KEY} -lt 30 ]; then
141
     if [ ${#TOX_PUBLIC_KEY} -lt 30 ]; then
149
         echo $'Could not obtain the tox node public key'
142
         echo $'Could not obtain the tox node public key'

+ 3
- 2
src/freedombone-mesh-batman View File

55
 CELLID='any'
55
 CELLID='any'
56
 
56
 
57
 CHANNEL=2
57
 CHANNEL=2
58
+HOTSPOT_CHANNEL=6
58
 if [ -f $COMPLETION_FILE ]; then
59
 if [ -f $COMPLETION_FILE ]; then
59
     if grep -q "Wifi channel:" $COMPLETION_FILE; then
60
     if grep -q "Wifi channel:" $COMPLETION_FILE; then
60
         CHANNEL=$(cat $COMPLETION_FILE | grep "Wifi channel:" | awk -F ':' '{print $2}')
61
         CHANNEL=$(cat $COMPLETION_FILE | grep "Wifi channel:" | awk -F ':' '{print $2}')
251
                 ifconfig $IFACE_SECONDARY mtu 1500
252
                 ifconfig $IFACE_SECONDARY mtu 1500
252
                 ifconfig $IFACE_SECONDARY hw ether $(assign_peer_address)
253
                 ifconfig $IFACE_SECONDARY hw ether $(assign_peer_address)
253
                 iwconfig $IFACE_SECONDARY enc open
254
                 iwconfig $IFACE_SECONDARY enc open
254
-                iwconfig $IFACE_SECONDARY mode managed essid $HOTSPOT_NAME channel ${CHANNEL}
255
+                iwconfig $IFACE_SECONDARY mode managed essid $HOTSPOT_NAME channel ${HOTSPOT_CHANNEL}
255
                 iwconfig $IFACE_SECONDARY ap $CELLID
256
                 iwconfig $IFACE_SECONDARY ap $CELLID
256
 
257
 
257
                 brctl addbr $BRIDGE_HOTSPOT
258
                 brctl addbr $BRIDGE_HOTSPOT
268
                 echo "country_code=UK" >> /etc/hostapd/hostapd.conf
269
                 echo "country_code=UK" >> /etc/hostapd/hostapd.conf
269
                 echo "ssid=$HOTSPOT_NAME" >> /etc/hostapd/hostapd.conf
270
                 echo "ssid=$HOTSPOT_NAME" >> /etc/hostapd/hostapd.conf
270
                 echo 'hw_mode=g' >> /etc/hostapd/hostapd.conf
271
                 echo 'hw_mode=g' >> /etc/hostapd/hostapd.conf
271
-                echo "channel=${CHANNEL}" >> /etc/hostapd/hostapd.conf
272
+                echo "channel=${HOTSPOT_CHANNEL}" >> /etc/hostapd/hostapd.conf
272
                 echo 'wpa=2' >> /etc/hostapd/hostapd.conf
273
                 echo 'wpa=2' >> /etc/hostapd/hostapd.conf
273
                 echo "wpa_passphrase=$HOTSPOT_PASSPHRASE" >> /etc/hostapd/hostapd.conf
274
                 echo "wpa_passphrase=$HOTSPOT_PASSPHRASE" >> /etc/hostapd/hostapd.conf
274
                 echo 'wpa_key_mgmt=WPA-PSK' >> /etc/hostapd/hostapd.conf
275
                 echo 'wpa_key_mgmt=WPA-PSK' >> /etc/hostapd/hostapd.conf

+ 2
- 7
src/freedombone-mesh-install View File

47
 rootdir=''
47
 rootdir=''
48
 FN=
48
 FN=
49
 CHROOT_PREFIX=''
49
 CHROOT_PREFIX=''
50
-FRIENDS_MIRRORS_SERVER=
51
 
50
 
52
 # To avoid confusions these are obtained from the main project file
51
 # To avoid confusions these are obtained from the main project file
53
 TOXID_REPO=
52
 TOXID_REPO=
233
 }
232
 }
234
 
233
 
235
 function enable_tox_repo {
234
 function enable_tox_repo {
236
-    sudo sh -c "echo 'deb http://download.opensuse.org/repositories/home:/antonbatenev:/tox/Debian_8.0/ /' > /etc/apt/sources.list.d/tox.list"
237
-    wget http://download.opensuse.org/repositories/home:antonbatenev:tox/Debian_8.0/Release.key
235
+    sudo sh -c "echo 'deb http://download.opensuse.org/repositories/home:/antonbatenev:/tox/Debian_9.0/ /' > /etc/apt/sources.list.d/tox.list"
236
+    wget http://download.opensuse.org/repositories/home:antonbatenev:tox/Debian_9.0/Release.key
238
     sudo sh -c "apt-key add - < Release.key"
237
     sudo sh -c "apt-key add - < Release.key"
239
     sudo apt-get update
238
     sudo apt-get update
240
     echo "Tox Repository Installed."
239
     echo "Tox Repository Installed."
273
         shift
272
         shift
274
         WIFI_INTERFACE="$1"
273
         WIFI_INTERFACE="$1"
275
         ;;
274
         ;;
276
-    -m|--mirror)
277
-        shift
278
-        FRIENDS_MIRRORS_SERVER="$1"
279
-        ;;
280
     --remove)
275
     --remove)
281
         shift
276
         shift
282
         REMOVE="$1"
277
         REMOVE="$1"

+ 0
- 288
src/freedombone-mirrors View File

1
-#!/bin/bash
2
-#
3
-# .---.                  .              .
4
-# |                      |              |
5
-# |--- .--. .-.  .-.  .-.|  .-. .--.--. |.-.  .-. .--.  .-.
6
-# |    |   (.-' (.-' (   | (   )|  |  | |   )(   )|  | (.-'
7
-# '    '     --'  --'  -' -  -' '  '   -' -'   -' '   -  --'
8
-#
9
-#                    Freedom in the Cloud
10
-#
11
-# Mirror git repos which the project depends on
12
-#
13
-# License
14
-# =======
15
-#
16
-# Copyright (C) 2015-2016 Bob Mottram <bob@freedombone.net>
17
-#
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
20
-# the Free Software Foundation, either version 3 of the License, or
21
-# (at your option) any later version.
22
-#
23
-# This program is distributed in the hope that it will be useful,
24
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
25
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
26
-# GNU Affero General Public License for more details.
27
-#
28
-# You should have received a copy of the GNU Affero General Public License
29
-# along with this program.  If not, see <http://www.gnu.org/licenses/>.
30
-
31
-PROJECT_NAME='freedombone'
32
-
33
-export TEXTDOMAIN=${PROJECT_NAME}-mirrors
34
-export TEXTDOMAINDIR="/usr/share/locale"
35
-
36
-# Minimum number of characters in a password
37
-MINIMUM_PASSWORD_LENGTH=$(cat /usr/share/${PROJECT_NAME}/utils/${PROJECT_NAME}-utils-passwords | grep 'MINIMUM_PASSWORD_LENGTH=' | head -n 1 | awk -F '=' '{print $2}')
38
-
39
-CONFIGURATION_FILE="$HOME/${PROJECT_NAME}.cfg"
40
-
41
-# used to mirror a single application
42
-SYNC_SINGLE_APP=
43
-
44
-# if this is blank then just use the default repos
45
-FRIENDS_MIRRORS_SERVER=
46
-UTILS_REPOS=
47
-INSTALLED_APPS_REPOS=
48
-MY_MIRRORS_PASSWORD=
49
-FRIENDS_MIRRORS_PASSWORD=
50
-NEW_MIRRORS='no'
51
-FRIENDS_MIRRORS_SSH_PORT=2222
52
-
53
-MAIN_COMMAND=/usr/local/bin/${PROJECT_NAME}
54
-if [ ! -f $MAIN_COMMAND ]; then
55
-    MAIN_COMMAND=/usr/bin/${PROJECT_NAME}
56
-fi
57
-
58
-# local repos for utils
59
-UTILS_REPOS=($(cat ${MAIN_COMMAND} /usr/share/${PROJECT_NAME}/utils/${PROJECT_NAME}-utils-* /usr/share/${PROJECT_NAME}/apps/${PROJECT_NAME}-app-* | grep "_REPO=\"" | grep -v "(cat " | uniq -u | sed 's|${PROJECT_NAME}|'"${PROJECT_NAME}"'|g'))
60
-
61
-UTILS_FILES=/usr/share/${PROJECT_NAME}/utils/${PROJECT_NAME}-utils-*
62
-for f in $UTILS_FILES
63
-do
64
-    source $f
65
-done
66
-
67
-# obtain the mirrors password if it exists
68
-read_config_param MY_MIRRORS_PASSWORD
69
-read_config_param FRIENDS_MIRRORS_SERVER
70
-read_config_param FRIENDS_MIRRORS_PASSWORD
71
-read_config_param FRIENDS_MIRRORS_SSH_PORT
72
-
73
-function show_help {
74
-    echo ''
75
-    echo $"${PROJECT_NAME}-mirrors --sync [domain/url] -p [password]"
76
-    echo ''
77
-    echo $'Creates or syncs with a set of git repositories'
78
-    echo ''
79
-    echo $'     --help                   Show help'
80
-    echo $'  -n|--new [yes|no]           Start a new mirrors'
81
-    echo $"  -p|--password [password]    Friend's mirrors user password"
82
-    echo $"  -m|--mypassword [password]  Local mirrors user password"
83
-    echo $"     --port [number]          Friend's server ssh port number"
84
-    echo $"  -s|--sync [domain]          Friend's server domain to sync with"
85
-    echo ''
86
-    exit 0
87
-}
88
-
89
-function create_mirrors_user {
90
-    if [ -d /home/mirrors ]; then
91
-        return
92
-    fi
93
-
94
-    create_password=1
95
-    if [ ${#MY_MIRRORS_PASSWORD} -ge ${MINIMUM_PASSWORD_LENGTH} ]; then
96
-        create_password=
97
-    fi
98
-
99
-    if [ $create_password ]; then
100
-        MY_MIRRORS_PASSWORD=$(openssl rand -base64 64 | tr -dc A-Za-z0-9 | head -c 18)
101
-    fi
102
-
103
-    chmod 600 /etc/shadow
104
-    chmod 600 /etc/gshadow
105
-    useradd -m -p "$MY_MIRRORS_PASSWORD" -s /bin/bash mirrors
106
-    chmod 0000 /etc/shadow
107
-    chmod 0000 /etc/gshadow
108
-
109
-    # remove any existing user files
110
-    rm -rf /home/mirrors/*
111
-
112
-    # store the mirrors password
113
-    write_config_param "MY_MIRRORS_PASSWORD" "${MY_MIRRORS_PASSWORD}"
114
-}
115
-
116
-function enable_mirrors_via_onion {
117
-    if ! grep -q 'Host *.onion' /home/mirrors/.ssh/config; then
118
-        if [ ! -d /home/mirrors/.ssh ]; then
119
-            mkdir /home/mirrors/.ssh
120
-        fi
121
-        echo 'Host *.onion' >> /home/mirrors/.ssh/config
122
-        echo 'ProxyCommand connect -R remote -5 -S 127.0.0.1:9050 %h %p' >> /home/mirrors/.ssh/config
123
-        chown mirrors:mirrors /home/mirrors/.ssh
124
-        chown mirrors:mirrors /home/mirrors/.ssh/config
125
-    fi
126
-}
127
-
128
-function update_installed_single_repo {
129
-    # only deal with a single app
130
-    filename=/usr/share/${PROJECT_NAME}/apps/${PROJECT_NAME}-app-${SYNC_SINGLE_APP}
131
-    if [ ! -f $filename ]; then
132
-        echo $"The app $SYNC_SINGLE_APP was not found"
133
-        exit 36822
134
-    fi
135
-    APP_REPOS=($(cat ${MAIN_COMMAND} $filename | grep "_REPO=\"" | grep -v "(cat " | uniq -u | sed 's|${PROJECT_NAME}|'"${PROJECT_NAME}"'|g'))
136
-    for line in "${APP_REPOS[@]}"
137
-    do
138
-        INSTALLED_APPS_REPOS+=("${line}")
139
-    done
140
-}
141
-
142
-function update_installed_apps_repos {
143
-    INSTALLED_APPS_REPOS=()
144
-
145
-    function_check app_is_installed
146
-
147
-    if [ $SYNC_SINGLE_APP ]; then
148
-        update_installed_single_repo
149
-        return
150
-    fi
151
-
152
-    # all apps currently installed
153
-    FILES=/usr/share/${PROJECT_NAME}/apps/${PROJECT_NAME}-app-*
154
-
155
-    # for all the app scripts
156
-    for filename in $FILES
157
-    do
158
-        app_name=$(echo "${filename}" | awk -F '-app-' '{print $2}')
159
-        if [[ "$(app_is_installed ${app_name})" == "1" ]]; then
160
-            APP_REPOS=($(cat ${MAIN_COMMAND} $filename | grep "_REPO=\"" | grep -v "(cat " | uniq -u | sed 's|${PROJECT_NAME}|'"${PROJECT_NAME}"'|g'))
161
-            for line in "${APP_REPOS[@]}"
162
-            do
163
-                INSTALLED_APPS_REPOS+=("${line}")
164
-            done
165
-        fi
166
-    done
167
-}
168
-
169
-function update_repos_from_friend_base {
170
-    syncrepos=${1}
171
-    new_repos=()
172
-    for line in $syncrepos
173
-    do
174
-        repo_name=$(echo "$line" | awk -F '=' '{print $1}')
175
-        mirrors_name=$(echo "$repo_name" | sed "s|_REPO||g" | awk '{print tolower($0)}')
176
-        friends_repo_url="ssh://mirrors@${FRIENDS_MIRRORS_SERVER}:${FRIENDS_MIRRORS_SSH_PORT}/home/mirrors/${mirrors_name}"
177
-        new_line="${repo_name}=\"${friends_repo_url}\""
178
-        new_repos+=($new_line)
179
-    done
180
-}
181
-
182
-function update_repos_from_friend {
183
-    if [ ! $FRIENDS_MIRRORS_SERVER ]; then
184
-       return
185
-    fi
186
-    if [ ${#FRIENDS_MIRRORS_SERVER} -lt 2 ]; then
187
-        return
188
-    fi
189
-
190
-    update_repos_from_friend_base "${UTILS_REPOS[@]}"
191
-    UTILS_REPOS=("${new_repos[@]}")
192
-
193
-    update_repos_from_friend_base "${INSTALLED_APPS_REPOS[@]}"
194
-    INSTALLED_APPS_REPOS=("${new_repos[@]}")
195
-}
196
-
197
-function sync_mirrors_base {
198
-    syncrepos=${1}
199
-    for line in $syncrepos
200
-    do
201
-        repo_name=$(echo "$line" | awk -F '=' '{print $1}')
202
-        repo_url=$(echo "$line" | awk -F '=' '{print $2}'  | awk -F '"' '{print $2}')
203
-        mirrors_name=$(echo "$repo_name" | sed "s|_REPO||g" | awk '{print tolower($0)}')
204
-        if [[ ${mirrors_name} != 'debian' ]]; then
205
-            if [[ $NEW_MIRRORS == 'yes' ]]; then
206
-                if [ -d /home/mirrors/${mirrors_name} ]; then
207
-                    rm -rf /home/mirrors/${mirrors_name}
208
-                fi
209
-            fi
210
-            if [ ! -d /home/mirrors/${mirrors_name} ]; then
211
-                if [[ ${repo_url} != 'ssh:'* ]]; then
212
-                    git clone --mirror ${repo_url} /home/mirrors/${mirrors_name}
213
-                else
214
-                    sshpass -p "$FRIENDS_MIRRORS_PASSWORD" git clone --mirror ${repo_url} /home/mirrors/${mirrors_name}
215
-                fi
216
-                if [ ! -d /home/mirrors/${mirrors_name} ]; then
217
-                    echo $"WARNING: failed to mirror repo ${repo_url}"
218
-                fi
219
-            else
220
-                cd /home/mirrors/${mirrors_name}
221
-                git remote set-url origin ${repo_url}
222
-                if [[ ${repo_url} != 'ssh:'* ]]; then
223
-                    git fetch -p origin
224
-                else
225
-                    sshpass -p "$FRIENDS_MIRRORS_PASSWORD" git fetch -p origin
226
-                fi
227
-            fi
228
-        fi
229
-    done
230
-    chown -R mirrors:mirrors /home/mirrors
231
-}
232
-
233
-function sync_mirrors_repos {
234
-    if [ ! $SYNC_SINGLE_APP ]; then
235
-        sync_mirrors_base "${UTILS_REPOS[@]}"
236
-    fi
237
-    sync_mirrors_base "${INSTALLED_APPS_REPOS[@]}"
238
-}
239
-
240
-while [[ $# > 1 ]]
241
-do
242
-key="$1"
243
-
244
-case $key in
245
-    --help)
246
-    show_help
247
-    ;;
248
-    -s|--sync)
249
-    shift
250
-    # use repos on another server
251
-    FRIENDS_MIRRORS_SERVER="$1"
252
-    ;;
253
-    -m|--mypass|--mypassword)
254
-    shift
255
-    MY_MIRRORS_PASSWORD="$1"
256
-    write_config_param "MY_MIRRORS_PASSWORD" "${MY_MIRRORS_PASSWORD}"
257
-    ;;
258
-    -p|--pass|--password)
259
-    shift
260
-    FRIENDS_MIRRORS_PASSWORD="$1"
261
-    write_config_param "FRIENDS_MIRRORS_PASSWORD" "${FRIENDS_MIRRORS_PASSWORD}"
262
-    ;;
263
-    -n|--new)
264
-    shift
265
-    NEW_MIRRORS="$1"
266
-    ;;
267
-    --port)
268
-    shift
269
-    FRIENDS_MIRRORS_SSH_PORT=${1}
270
-    ;;
271
-    -a|--app)
272
-    shift
273
-    SYNC_SINGLE_APP="${1}"
274
-    ;;
275
-    *)
276
-    # unknown option
277
-    ;;
278
-esac
279
-shift
280
-done
281
-
282
-create_mirrors_user
283
-enable_mirrors_via_onion
284
-update_installed_apps_repos
285
-update_repos_from_friend
286
-sync_mirrors_repos
287
-
288
-exit 0

+ 10
- 6
src/freedombone-pass View File

22
 # License
22
 # License
23
 # =======
23
 # =======
24
 #
24
 #
25
-# Copyright (C) 2016 Bob Mottram <bob@freedombone.net>
25
+# Copyright (C) 2016-2017 Bob Mottram <bob@freedombone.net>
26
 #
26
 #
27
 # This program is free software: you can redistribute it and/or modify
27
 # This program is free software: you can redistribute it and/or modify
28
 # it under the terms of the GNU Affero General Public License as published by
28
 # it under the terms of the GNU Affero General Public License as published by
57
 NO_PASSWORD_STORE_FILE=~/.nostore
57
 NO_PASSWORD_STORE_FILE=~/.nostore
58
 
58
 
59
 function get_backup_key_id {
59
 function get_backup_key_id {
60
-    MY_BACKUP_KEY_ID=$(gpg --list-keys "(backup key)" | \
61
-                           grep 'pub ' | awk -F ' ' '{print $2}' | \
62
-                           awk -F '/' '{print $2}')
60
+    MY_BACKUP_KEY_ID=$(gpg --list-keys "(backup key)" | sed -n '2p' | sed 's/^[ \t]*//')
63
     if [ ${#MY_BACKUP_KEY_ID} -lt 4 ]; then
61
     if [ ${#MY_BACKUP_KEY_ID} -lt 4 ]; then
64
         echo $"Error: gpg backup key was not found"
62
         echo $"Error: gpg backup key was not found"
65
         return 58213
63
         return 58213
121
         exit 78352
119
         exit 78352
122
     fi
120
     fi
123
     ${PROJECT_NAME}-pass -u root -a tests -p "$pass"
121
     ${PROJECT_NAME}-pass -u root -a tests -p "$pass"
122
+    if [ ! "$?" = "0" ]; then
123
+        echo $'Unable to encrypt password'
124
+        exit 72725
125
+    fi
126
+    echo $'Password encrypted'
124
     returned_pass=$(${PROJECT_NAME}-pass -u root -a tests)
127
     returned_pass=$(${PROJECT_NAME}-pass -u root -a tests)
125
     if [[ "$pass" != "$returned_pass" ]]; then
128
     if [[ "$pass" != "$returned_pass" ]]; then
126
         echo "pass     :${pass}:"
129
         echo "pass     :${pass}:"
128
         echo "returned :${returned_pass}:"
131
         echo "returned :${returned_pass}:"
129
         exit 73825
132
         exit 73825
130
     fi
133
     fi
134
+    echo $'Password decrypted'
131
     ${PROJECT_NAME}-pass -u root --rmapp tests
135
     ${PROJECT_NAME}-pass -u root --rmapp tests
132
     echo "Tests passed"
136
     echo "Tests passed"
133
 }
137
 }
303
         echo ""
307
         echo ""
304
         exit 4
308
         exit 4
305
     else
309
     else
306
-        pass=$(gpg -dq --passphrase "$MASTER_PASSWORD" ~/.passwords/$CURR_USERNAME/$CURR_APP)
310
+        pass=$(gpg --batch -dq --passphrase "$MASTER_PASSWORD" ~/.passwords/$CURR_USERNAME/$CURR_APP)
307
         remove_padding "${pass}"
311
         remove_padding "${pass}"
308
     fi
312
     fi
309
 else
313
 else
318
         mkdir -p ~/.passwords/$CURR_USERNAME
322
         mkdir -p ~/.passwords/$CURR_USERNAME
319
     fi
323
     fi
320
     # padding helps to ensure than nothing can be learned from the length of the cyphertext
324
     # padding helps to ensure than nothing can be learned from the length of the cyphertext
321
-    pad_string "${CURR_PASSWORD}" | gpg -ca --cipher-algo AES256 --passphrase "$MASTER_PASSWORD" > ~/.passwords/$CURR_USERNAME/$CURR_APP
325
+    pad_string "${CURR_PASSWORD}" | gpg --batch -ca --cipher-algo AES256 --passphrase "$MASTER_PASSWORD" > ~/.passwords/$CURR_USERNAME/$CURR_APP
322
     if [ ! -f ~/.passwords/$CURR_USERNAME/$CURR_APP ]; then
326
     if [ ! -f ~/.passwords/$CURR_USERNAME/$CURR_APP ]; then
323
         MASTER_PASSWORD=
327
         MASTER_PASSWORD=
324
         exit 5
328
         exit 5

+ 49
- 0
src/freedombone-prepare-scripts View File

1
+#!/bin/bash
2
+#
3
+# .---.                  .              .
4
+# |                      |              |
5
+# |--- .--. .-.  .-.  .-.|  .-. .--.--. |.-.  .-. .--.  .-.
6
+# |    |   (.-' (.-' (   | (   )|  |  | |   )(   )|  | (.-'
7
+# '    '     --'  --'  -' -  -' '  '   -' -'   -' '   -  --'
8
+#
9
+#                    Freedom in the Cloud
10
+#
11
+# Prepares control scripts
12
+#
13
+# License
14
+# =======
15
+#
16
+# Copyright (C) 2017 Bob Mottram <bob@freedombone.net>
17
+#
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
20
+# the Free Software Foundation, either version 3 of the License, or
21
+# (at your option) any later version.
22
+#
23
+# This program is distributed in the hope that it will be useful,
24
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
25
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
26
+# GNU Affero General Public License for more details.
27
+#
28
+# You should have received a copy of the GNU Affero General Public License
29
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
30
+
31
+PROJECT_NAME='freedombone'
32
+
33
+cat /usr/local/bin/${PROJECT_NAME}-vars /usr/share/${PROJECT_NAME}/utils/${PROJECT_NAME}-utils-* /usr/share/${PROJECT_NAME}/apps/${PROJECT_NAME}-app-* > /tmp/includescripts
34
+
35
+cat /tmp/includescripts /usr/local/bin/freedombone-controlpanel > /usr/local/bin/control
36
+cat /tmp/includescripts /usr/local/bin/freedombone-controlpanel-user > /usr/local/bin/controluser
37
+cat /tmp/includescripts /usr/local/bin/freedombone-addremove > /usr/local/bin/addremove
38
+
39
+sed -i '/# Start including files/,/# End including files/d' /usr/local/bin/control
40
+sed -i '/# Start including files/,/# End including files/d' /usr/local/bin/controluser
41
+sed -i '/# Start including files/,/# End including files/d' /usr/local/bin/addremove
42
+
43
+chmod +x /usr/local/bin/control
44
+chmod +x /usr/local/bin/controluser
45
+chmod +x /usr/local/bin/addremove
46
+
47
+rm /tmp/includescripts
48
+
49
+exit 0

+ 3
- 14
src/freedombone-recoverkey View File

42
     source $f
42
     source $f
43
 done
43
 done
44
 
44
 
45
-read_config_param USB_DRIVE
46
-
47
 FRIENDS_SERVERS_LIST=
45
 FRIENDS_SERVERS_LIST=
48
 MY_USERNAME=
46
 MY_USERNAME=
49
-if [ $USB_DRIVE ]; then
50
-    GPG_USB_DRIVE=$USB_DRIVE
51
-else
52
-    GPG_USB_DRIVE='/dev/sdb1'
53
-fi
54
 
47
 
55
 function show_help {
48
 function show_help {
56
     echo ''
49
     echo ''
57
-    echo $"${PROJECT_NAME}-recoverkey -u [username] -d [drive]"
58
-    echo $'                       -l [friends servers list filename]'
50
+    echo $"${PROJECT_NAME}-recoverkey -u [username]"
51
+    echo $'                           -l [friends servers list filename]'
59
     echo ''
52
     echo ''
60
     exit 0
53
     exit 0
61
 }
54
 }
78
             shift
71
             shift
79
             FRIENDS_SERVERS_LIST="$1"
72
             FRIENDS_SERVERS_LIST="$1"
80
             ;;
73
             ;;
81
-        -d|--drive)
82
-            shift
83
-            GPG_USB_DRIVE=/dev/${1}1
84
-            ;;
85
         *)
74
         *)
86
             # unknown option
75
             # unknown option
87
             ;;
76
             ;;
174
 echo $'Key fragments recombined'
163
 echo $'Key fragments recombined'
175
 
164
 
176
 # import the gpg key
165
 # import the gpg key
177
-su -c "gpg --allow-secret-key-import --import $KEYS_FILE" - $MY_USERNAME
166
+gpg --homedir=/home/$MY_USERNAME/.gnupg --allow-secret-key-import --import $KEYS_FILE
178
 if [ ! "$?" = "0" ]; then
167
 if [ ! "$?" = "0" ]; then
179
     echo $'Unable to import gpg key'
168
     echo $'Unable to import gpg key'
180
     shred -zu $KEYS_FILE
169
     shred -zu $KEYS_FILE

+ 1
- 1
src/freedombone-renew-cert View File

135
         sed -i "s|$HOSTNAME.crt|$HOSTNAME.bundle.crt|g" /etc/nginx/sites-available/$HOSTNAME
135
         sed -i "s|$HOSTNAME.crt|$HOSTNAME.bundle.crt|g" /etc/nginx/sites-available/$HOSTNAME
136
 
136
 
137
         echo $'Certificate installed'
137
         echo $'Certificate installed'
138
-        service nginx restart
138
+        systemctl restart nginx
139
         return
139
         return
140
     fi
140
     fi
141
 
141
 

+ 100
- 45
src/freedombone-restore-local 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
44
     PROJECT_INSTALL_DIR=/usr/bin
44
     PROJECT_INSTALL_DIR=/usr/bin
45
 fi
45
 fi
46
 
46
 
47
+# MariaDB password
48
+DATABASE_PASSWORD=$(${PROJECT_NAME}-pass -u root -a mariadb)
49
+
50
+function please_wait {
51
+        local str width height length
52
+
53
+        width=$(tput cols)
54
+        height=$(tput lines)
55
+        str="Standby to restore from USB"
56
+        length=${#str}
57
+        clear
58
+        tput cup $((height / 2)) $(((width / 2) - (length / 2)))
59
+        echo "$str"
60
+        tput cup $((height * 3 / 5)) $(((width / 2)))
61
+        echo -n ''
62
+}
63
+
64
+please_wait
65
+
47
 source $PROJECT_INSTALL_DIR/${PROJECT_NAME}-vars
66
 source $PROJECT_INSTALL_DIR/${PROJECT_NAME}-vars
48
 
67
 
49
 # include utils which allow function_check, go and drive mount
68
 # include utils which allow function_check, go and drive mount
53
     source $f
72
     source $f
54
 done
73
 done
55
 
74
 
75
+clear
76
+
56
 USB_DRIVE=/dev/sdb1
77
 USB_DRIVE=/dev/sdb1
57
 USB_MOUNT=/mnt/usb
78
 USB_MOUNT=/mnt/usb
58
 
79
 
65
     ADMIN_USERNAME=$(get_completion_param "Admin user")
86
     ADMIN_USERNAME=$(get_completion_param "Admin user")
66
 fi
87
 fi
67
 
88
 
68
-# MariaDB password
69
-DATABASE_PASSWORD=$(${PROJECT_NAME}-pass -u root -a mariadb)
70
-
71
 function check_backup_exists {
89
 function check_backup_exists {
72
     if [ ! -d $USB_MOUNT/backup ]; then
90
     if [ ! -d $USB_MOUNT/backup ]; then
73
         echo $"No backup directory found on the USB drive."
91
         echo $"No backup directory found on the USB drive."
90
 function copy_gpg_keys {
108
 function copy_gpg_keys {
91
     echo $"Copying GPG keys from admin user to root"
109
     echo $"Copying GPG keys from admin user to root"
92
     cp -r /home/$ADMIN_USERNAME/.gnupg /root
110
     cp -r /home/$ADMIN_USERNAME/.gnupg /root
111
+    gpg_set_permissions root
112
+}
113
+
114
+function restore_blocklist {
115
+    if [[ $RESTORE_APP != 'all' ]]; then
116
+        if [[ $RESTORE_APP != 'blocklist' ]]; then
117
+            return
118
+        fi
119
+    fi
120
+
121
+    if [ -d $USB_MOUNT/backup/blocklist ]; then
122
+        echo $"Restoring blocklist"
123
+        temp_restore_dir=/root/tempblocklist
124
+        restore_directory_from_usb $temp_restore_dir blocklist
125
+
126
+        if [ -f $temp_restore_dir/root/tempbackupblocklist/${PROJECT_NAME}-firewall-domains.cfg ]; then
127
+            cp -f $temp_restore_dir/root/tempbackupblocklist/${PROJECT_NAME}-firewall-domains.cfg /root/${PROJECT_NAME}-firewall-domains.cfg
128
+        fi
129
+
130
+        rm -rf $temp_restore_dir
131
+
132
+        firewall_refresh_blocklist
133
+    fi
93
 }
134
 }
94
 
135
 
95
 function restore_configfiles {
136
 function restore_configfiles {
100
     fi
141
     fi
101
 
142
 
102
     # this restores *.cfg and COMPLETION_FILE
143
     # this restores *.cfg and COMPLETION_FILE
103
-    if [ -d $USB_MOUNT/backup/config ]; then
144
+    if [ -d $USB_MOUNT/backup/configfiles ]; then
104
         echo $"Restoring configuration files"
145
         echo $"Restoring configuration files"
105
-        temp_restore_dir=/root/tempconfig
146
+        temp_restore_dir=/root/tempconfigfiles
106
         restore_directory_from_usb $temp_restore_dir configfiles
147
         restore_directory_from_usb $temp_restore_dir configfiles
107
 
148
 
108
         if [ -f $temp_restore_dir/root/.nostore ]; then
149
         if [ -f $temp_restore_dir/root/.nostore ]; then
115
             fi
156
             fi
116
         fi
157
         fi
117
 
158
 
118
-        if [ -f $temp_restore_dir$NODEJS_INSTALLED_APPS_FILE ]; then
119
-            cp -f $temp_restore_dir$NODEJS_INSTALLED_APPS_FILE $NODEJS_INSTALLED_APPS_FILE
120
-        fi
121
-
122
-        if [ -f $temp_restore_dir/root/${PROJECT_NAME}.cfg ]; then
123
-            cp -f $temp_restore_dir/root/${PROJECT_NAME}.cfg $CONFIGURATION_FILE
124
-            if [ ! "$?" = "0" ]; then
125
-                set_user_permissions
126
-                backup_unmount_drive
127
-                rm -rf $temp_restore_dir
128
-                exit 5294
129
-            fi
130
-        fi
131
-
132
-        if [ -f $CONFIGURATION_FILE ]; then
133
-            # install according to the config file
134
-            freedombone -c $CONFIGURATION_FILE
135
-        fi
136
-
137
-        if [ -f $temp_restore_dir/root/${PROJECT_NAME}-completed.txt ]; then
138
-            cp -f $temp_restore_dir/root/${PROJECT_NAME}-completed.txt $COMPLETION_FILE
139
-            if [ ! "$?" = "0" ]; then
140
-                set_user_permissions
141
-                backup_unmount_drive
142
-                rm -rf $temp_restore_dir
143
-                exit 6382
144
-            fi
145
-        fi
159
+        #if [ -f $temp_restore_dir$NODEJS_INSTALLED_APPS_FILE ]; then
160
+        #    cp -f $temp_restore_dir$NODEJS_INSTALLED_APPS_FILE $NODEJS_INSTALLED_APPS_FILE
161
+        #fi
162
+
163
+        #if [ -f $temp_restore_dir/root/${PROJECT_NAME}.cfg ]; then
164
+        #    cp -f $temp_restore_dir/root/${PROJECT_NAME}.cfg $CONFIGURATION_FILE
165
+        #    if [ ! "$?" = "0" ]; then
166
+        #        set_user_permissions
167
+        #        backup_unmount_drive
168
+        #        rm -rf $temp_restore_dir
169
+        #        exit 5294
170
+        #    fi
171
+        #fi
172
+
173
+        #if [ -f $CONFIGURATION_FILE ]; then
174
+        #    # install according to the config file
175
+        #    freedombone -c $CONFIGURATION_FILE
176
+        #fi
177
+
178
+        #if [ -f $temp_restore_dir/root/${PROJECT_NAME}-completed.txt ]; then
179
+        #    cp -f $temp_restore_dir/root/${PROJECT_NAME}-completed.txt $COMPLETION_FILE
180
+        #    if [ ! "$?" = "0" ]; then
181
+        #        set_user_permissions
182
+        #        backup_unmount_drive
183
+        #        rm -rf $temp_restore_dir
184
+        #        exit 6382
185
+        #    fi
186
+        #fi
146
 
187
 
147
         if [ -f ${temp_restore_dir}${BACKUP_EXTRA_DIRECTORIES} ]; then
188
         if [ -f ${temp_restore_dir}${BACKUP_EXTRA_DIRECTORIES} ]; then
148
             cp -f ${temp_restore_dir}${BACKUP_EXTRA_DIRECTORIES} ${BACKUP_EXTRA_DIRECTORIES}
189
             cp -f ${temp_restore_dir}${BACKUP_EXTRA_DIRECTORIES} ${BACKUP_EXTRA_DIRECTORIES}
187
 
228
 
188
     if [ -d $USB_MOUNT/backup/mariadb ]; then
229
     if [ -d $USB_MOUNT/backup/mariadb ]; then
189
         echo $"Restoring mysql settings"
230
         echo $"Restoring mysql settings"
231
+        keep_database_running
190
         temp_restore_dir=/root/tempmariadb
232
         temp_restore_dir=/root/tempmariadb
191
         restore_directory_from_usb $temp_restore_dir mariadb
233
         restore_directory_from_usb $temp_restore_dir mariadb
192
-        echo $'Obtaining MariaDB password'
193
-        db_pass=$(${PROJECT_NAME}-pass -u root -a mariadb)
234
+
235
+        store_original_mariadb_password
236
+
237
+        echo $'Obtaining original MariaDB password'
238
+        db_pass=$(cat /root/.mariadboriginal)
194
         if [ ${#db_pass} -gt 0 ]; then
239
         if [ ${#db_pass} -gt 0 ]; then
195
             echo $"Restore the MariaDB user table"
240
             echo $"Restore the MariaDB user table"
196
-            mysqlsuccess=$(mysql -u root --password="$DATABASE_PASSWORD" mysql -o < ${temp_restore_dir}${temp_restore_dir}/mysql.sql)
241
+            mysqlsuccess=$(mysql -u root --password="$db_pass" mysql -o < ${temp_restore_dir}${temp_restore_dir}/mysql.sql)
197
             if [ ! "$?" = "0" ]; then
242
             if [ ! "$?" = "0" ]; then
198
                 echo $"Try again using the password obtained from backup"
243
                 echo $"Try again using the password obtained from backup"
244
+                db_pass=$(${PROJECT_NAME}-pass -u root -a mariadb)
199
                 mysqlsuccess=$(mysql -u root --password="$db_pass" mysql -o < ${temp_restore_dir}${temp_restore_dir}/mysql.sql)
245
                 mysqlsuccess=$(mysql -u root --password="$db_pass" mysql -o < ${temp_restore_dir}${temp_restore_dir}/mysql.sql)
200
             fi
246
             fi
201
             if [ ! "$?" = "0" ]; then
247
             if [ ! "$?" = "0" ]; then
205
                 exit 962
251
                 exit 962
206
             fi
252
             fi
207
             echo $"Restarting database"
253
             echo $"Restarting database"
208
-            service mysql restart
209
-            echo $"Change the MariaDB password to the backup version"
210
-            DATABASE_PASSWORD="$db_pass"
211
-            ${PROJECT_NAME}-pass -u root -a mariadb -p "$DATABASE_PASSWORD"
254
+            systemctl restart mariadb
255
+            echo $"Ensure MariaDB handles authentication"
256
+            MARIADB_PASSWORD=$(${PROJECT_NAME}-pass -u root -a mariadb)
257
+            mariadb_fix_authentication
258
+            DATABASE_PASSWORD=$(${PROJECT_NAME}-pass -u root -a mariadb)
212
         fi
259
         fi
213
         rm -rf $temp_restore_dir
260
         rm -rf $temp_restore_dir
214
     fi
261
     fi
235
         fi
282
         fi
236
     fi
283
     fi
237
     if [ -d $USB_MOUNT/backup/passwordstore ]; then
284
     if [ -d $USB_MOUNT/backup/passwordstore ]; then
285
+        store_original_mariadb_password
238
         echo $"Restoring password store"
286
         echo $"Restoring password store"
239
         restore_directory_from_usb / passwordstore
287
         restore_directory_from_usb / passwordstore
240
     fi
288
     fi
270
                 restore_directory_from_usb $temp_restore_dir mutt/$USERNAME
318
                 restore_directory_from_usb $temp_restore_dir mutt/$USERNAME
271
                 if [ -f $temp_restore_dir/home/$USERNAME/tempbackup/.muttrc ]; then
319
                 if [ -f $temp_restore_dir/home/$USERNAME/tempbackup/.muttrc ]; then
272
                     cp -f $temp_restore_dir/home/$USERNAME/tempbackup/.muttrc /home/$USERNAME/.muttrc
320
                     cp -f $temp_restore_dir/home/$USERNAME/tempbackup/.muttrc /home/$USERNAME/.muttrc
321
+                    sed -i '/set sidebar_delim/d' /home/$USERNAME/.muttrc
322
+                    sed -i '/set sidebar_sort/d' /home/$USERNAME/.muttrc
273
                 fi
323
                 fi
274
                 if [ -f $temp_restore_dir/home/$USERNAME/tempbackup/Muttrc ]; then
324
                 if [ -f $temp_restore_dir/home/$USERNAME/tempbackup/Muttrc ]; then
275
                     cp -f $temp_restore_dir/home/$USERNAME/tempbackup/Muttrc /etc/Muttrc
325
                     cp -f $temp_restore_dir/home/$USERNAME/tempbackup/Muttrc /etc/Muttrc
326
+                    sed -i '/set sidebar_delim/d' /etc/Muttrc
327
+                    sed -i '/set sidebar_sort/d' /etc/Muttrc
276
                 fi
328
                 fi
277
                 if [ ! "$?" = "0" ]; then
329
                 if [ ! "$?" = "0" ]; then
278
                     rm -rf $temp_restore_dir
330
                     rm -rf $temp_restore_dir
287
 }
339
 }
288
 
340
 
289
 function restore_gpg {
341
 function restore_gpg {
290
-    if [[ $RESTORE_APP != 'all' ]]; then
291
-        if [[ $RESTORE_APP != 'gpg' ]]; then
292
-            return
293
-        fi
342
+    if [[ $RESTORE_APP != 'gpg' ]]; then
343
+        return
294
     fi
344
     fi
345
+
295
     if [ -d $USB_MOUNT/backup/gnupg ]; then
346
     if [ -d $USB_MOUNT/backup/gnupg ]; then
296
         for d in $USB_MOUNT/backup/gnupg/*/ ; do
347
         for d in $USB_MOUNT/backup/gnupg/*/ ; do
297
             USERNAME=$(echo "$d" | awk -F '/' '{print $6}')
348
             USERNAME=$(echo "$d" | awk -F '/' '{print $6}')
310
                     exit 276
361
                     exit 276
311
                 fi
362
                 fi
312
                 rm -rf $temp_restore_dir
363
                 rm -rf $temp_restore_dir
364
+                gpg_set_permissions $USERNAME
313
                 if [[ "$USERNAME" == "$ADMIN_USERNAME" ]]; then
365
                 if [[ "$USERNAME" == "$ADMIN_USERNAME" ]]; then
314
                     cp -r /home/$USERNAME/.gnupg /root
366
                     cp -r /home/$USERNAME/.gnupg /root
315
                     if [ ! "$?" = "0" ]; then
367
                     if [ ! "$?" = "0" ]; then
317
                         backup_unmount_drive
369
                         backup_unmount_drive
318
                         exit 283
370
                         exit 283
319
                     fi
371
                     fi
372
+                    gpg_set_permissions root
320
                 fi
373
                 fi
321
             fi
374
             fi
322
         done
375
         done
585
             exit 276
638
             exit 276
586
         fi
639
         fi
587
         rm -rf /root/tempssl
640
         rm -rf /root/tempssl
641
+        update-ca-certificates
588
 
642
 
589
         # restore ownership
643
         # restore ownership
590
         if [ -f /etc/ssl/private/xmpp.key ]; then
644
         if [ -f /etc/ssl/private/xmpp.key ]; then
710
 check_backup_exists
764
 check_backup_exists
711
 check_admin_user
765
 check_admin_user
712
 copy_gpg_keys
766
 copy_gpg_keys
767
+restore_blocklist
713
 restore_configfiles
768
 restore_configfiles
714
 same_admin_user
769
 same_admin_user
715
 restore_passwordstore
770
 restore_passwordstore

+ 73
- 39
src/freedombone-restore-remote 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
99
 function copy_gpg_keys {
99
 function copy_gpg_keys {
100
     echo $"Copying GPG keys from admin user to root"
100
     echo $"Copying GPG keys from admin user to root"
101
     cp -r /home/$ADMIN_USERNAME/.gnupg /root
101
     cp -r /home/$ADMIN_USERNAME/.gnupg /root
102
+    gpg_set_permissions root
103
+}
104
+
105
+function restore_blocklist {
106
+    if [[ $RESTORE_APP != 'all' ]]; then
107
+        if [[ $RESTORE_APP != 'blocklist' ]]; then
108
+            return
109
+        fi
110
+    fi
111
+
112
+    if [ -d $USB_MOUNT/backup/blocklist ]; then
113
+        echo $"Restoring blocklist"
114
+        temp_restore_dir=/root/tempblocklist
115
+        restore_directory_from_friend $temp_restore_dir blocklist
116
+        restore_directory_from_usb $temp_restore_dir blocklist
117
+
118
+        if [ -f $temp_restore_dir/root/tempbackupblocklist/${PROJECT_NAME}-firewall-domains.cfg ]; then
119
+            cp -f $temp_restore_dir/root/tempbackupblocklist/${PROJECT_NAME}-firewall-domains.cfg /root/${PROJECT_NAME}-firewall-domains.cfg
120
+        fi
121
+
122
+        rm -rf $temp_restore_dir
123
+
124
+        firewall_refresh_blocklist
125
+    fi
102
 }
126
 }
103
 
127
 
104
 function restore_configfiles {
128
 function restore_configfiles {
107
             return
131
             return
108
         fi
132
         fi
109
     fi
133
     fi
110
-    if [ -d $SERVER_DIRECTORY/backup/config ]; then
134
+    if [ -d $SERVER_DIRECTORY/backup/configfiles ]; then
111
         echo $"Restoring configuration files"
135
         echo $"Restoring configuration files"
112
-        temp_restore_dir=/root/tempconfig
136
+        temp_restore_dir=/root/tempconfigfiles
113
         restore_directory_from_friend $temp_restore_dir configfiles
137
         restore_directory_from_friend $temp_restore_dir configfiles
114
 
138
 
115
         if [ -f $temp_restore_dir/root/.nostore ]; then
139
         if [ -f $temp_restore_dir/root/.nostore ]; then
122
             fi
146
             fi
123
         fi
147
         fi
124
 
148
 
125
-        if [ -f $temp_restore_dir$NODEJS_INSTALLED_APPS_FILE ]; then
126
-            cp -f $temp_restore_dir$NODEJS_INSTALLED_APPS_FILE $NODEJS_INSTALLED_APPS_FILE
127
-        fi
128
-
129
-        if [ -f $temp_restore_dir/root/${PROJECT_NAME}.cfg ]; then
130
-            cp -f $temp_restore_dir/root/${PROJECT_NAME}.cfg $CONFIGURATION_FILE
131
-            if [ ! "$?" = "0" ]; then
132
-                unmount_drive
133
-                rm -rf $temp_restore_dir
134
-                exit 5372
135
-            fi
136
-        fi
137
-
138
-        if [ -f $CONFIGURATION_FILE ]; then
139
-            # install according to the config file
140
-            freedombone -c $CONFIGURATION_FILE
141
-        fi
142
-
143
-        if [ -f $temp_restore_dir/root/${PROJECT_NAME}-completed.txt ]; then
144
-            cp -f $temp_restore_dir/root/${PROJECT_NAME}-completed.txt $COMPLETION_FILE
145
-            if [ ! "$?" = "0" ]; then
146
-                unmount_drive
147
-                rm -rf $temp_restore_dir
148
-                exit 7252
149
-            fi
150
-        fi
149
+        #if [ -f $temp_restore_dir$NODEJS_INSTALLED_APPS_FILE ]; then
150
+        #    cp -f $temp_restore_dir$NODEJS_INSTALLED_APPS_FILE $NODEJS_INSTALLED_APPS_FILE
151
+        #fi
152
+
153
+        #if [ -f $temp_restore_dir/root/${PROJECT_NAME}.cfg ]; then
154
+        #    cp -f $temp_restore_dir/root/${PROJECT_NAME}.cfg $CONFIGURATION_FILE
155
+        #    if [ ! "$?" = "0" ]; then
156
+        #        unmount_drive
157
+        #        rm -rf $temp_restore_dir
158
+        #        exit 5372
159
+        #    fi
160
+        #fi
161
+
162
+        #if [ -f $CONFIGURATION_FILE ]; then
163
+        #    # install according to the config file
164
+        #    freedombone -c $CONFIGURATION_FILE
165
+        #fi
166
+
167
+        #if [ -f $temp_restore_dir/root/${PROJECT_NAME}-completed.txt ]; then
168
+        #    cp -f $temp_restore_dir/root/${PROJECT_NAME}-completed.txt $COMPLETION_FILE
169
+        #    if [ ! "$?" = "0" ]; then
170
+        #        unmount_drive
171
+        #        rm -rf $temp_restore_dir
172
+        #        exit 7252
173
+        #    fi
174
+        #fi
151
 
175
 
152
         if [ -f ${temp_restore_dir}${BACKUP_EXTRA_DIRECTORIES} ]; then
176
         if [ -f ${temp_restore_dir}${BACKUP_EXTRA_DIRECTORIES} ]; then
153
             cp -f ${temp_restore_dir}${BACKUP_EXTRA_DIRECTORIES} ${BACKUP_EXTRA_DIRECTORIES}
177
             cp -f ${temp_restore_dir}${BACKUP_EXTRA_DIRECTORIES} ${BACKUP_EXTRA_DIRECTORIES}
184
         temp_restore_dir=/root/tempmariadb
208
         temp_restore_dir=/root/tempmariadb
185
         restore_directory_from_friend $temp_restore_dir mariadb
209
         restore_directory_from_friend $temp_restore_dir mariadb
186
 
210
 
211
+        store_original_mariadb_password
212
+
187
         echo $'Obtaining MariaDB password'
213
         echo $'Obtaining MariaDB password'
188
-        db_pass=$(${PROJECT_NAME}-pass -u root -a mariadb)
214
+        db_pass=$(cat /root/.mariadboriginal)
189
         if [ ${#db_pass} -gt 0 ]; then
215
         if [ ${#db_pass} -gt 0 ]; then
190
             echo $"Restore the MariaDB user table"
216
             echo $"Restore the MariaDB user table"
191
-            mysqlsuccess=$(mysql -u root --password="$DATABASE_PASSWORD" mysql -o < ${temp_restore_dir}${temp_restore_dir}/mysql.sql)
217
+            mysqlsuccess=$(mysql -u root --password="$db_pass" mysql -o < ${temp_restore_dir}${temp_restore_dir}/mysql.sql)
192
             if [ ! "$?" = "0" ]; then
218
             if [ ! "$?" = "0" ]; then
193
                 echo $"Try again using the password obtained from backup"
219
                 echo $"Try again using the password obtained from backup"
220
+                db_pass=$(${PROJECT_NAME}-pass -u root -a mariadb)
194
                 mysqlsuccess=$(mysql -u root --password="$db_pass" mysql -o < ${temp_restore_dir}${temp_restore_dir}/mysql.sql)
221
                 mysqlsuccess=$(mysql -u root --password="$db_pass" mysql -o < ${temp_restore_dir}${temp_restore_dir}/mysql.sql)
195
             fi
222
             fi
196
             if [ ! "$?" = "0" ]; then
223
             if [ ! "$?" = "0" ]; then
198
                 exit 962
225
                 exit 962
199
             fi
226
             fi
200
             echo $"Restarting database"
227
             echo $"Restarting database"
201
-            service mysql restart
202
-            echo $"Change the MariaDB password to the backup version"
203
-            DATABASE_PASSWORD="$db_pass"
204
-            ${PROJECT_NAME}-pass -u root -a mariadb -p "$DATABASE_PASSWORD"
228
+            systemctl restart mariadb
229
+            echo $"Ensure MariaDB handles authentication"
230
+            MARIADB_PASSWORD=$(${PROJECT_NAME}-pass -u root -a mariadb)
231
+            mariadb_fix_authentication
205
         fi
232
         fi
206
         rm -rf ${temp_restore_dir}
233
         rm -rf ${temp_restore_dir}
207
     fi
234
     fi
226
         fi
253
         fi
227
     fi
254
     fi
228
     if [ -d $SERVER_DIRECTORY/backup/passwordstore ]; then
255
     if [ -d $SERVER_DIRECTORY/backup/passwordstore ]; then
256
+        store_original_mariadb_password
229
         echo $"Restoring password store"
257
         echo $"Restoring password store"
230
         restore_directory_from_friend / passwordstore
258
         restore_directory_from_friend / passwordstore
231
     fi
259
     fi
261
                 restore_directory_from_friend ${temp_restore_dir} mutt/$USERNAME
289
                 restore_directory_from_friend ${temp_restore_dir} mutt/$USERNAME
262
                 if [ -f ${temp_restore_dir}/home/$USERNAME/tempbackup/.muttrc ]; then
290
                 if [ -f ${temp_restore_dir}/home/$USERNAME/tempbackup/.muttrc ]; then
263
                     cp -f ${temp_restore_dir}/home/$USERNAME/tempbackup/.muttrc /home/$USERNAME/.muttrc
291
                     cp -f ${temp_restore_dir}/home/$USERNAME/tempbackup/.muttrc /home/$USERNAME/.muttrc
292
+                    sed -i '/set sidebar_delim/d' /home/$USERNAME/.muttrc
293
+                    sed -i '/set sidebar_sort/d' /home/$USERNAME/.muttrc
264
                 fi
294
                 fi
265
                 if [ -f ${temp_restore_dir}/home/$USERNAME/tempbackup/Muttrc ]; then
295
                 if [ -f ${temp_restore_dir}/home/$USERNAME/tempbackup/Muttrc ]; then
266
                     cp -f ${temp_restore_dir}/home/$USERNAME/tempbackup/Muttrc /etc/Muttrc
296
                     cp -f ${temp_restore_dir}/home/$USERNAME/tempbackup/Muttrc /etc/Muttrc
297
+                    sed -i '/set sidebar_delim/d' /etc/Muttrc
298
+                    sed -i '/set sidebar_sort/d' /etc/Muttrc
267
                 fi
299
                 fi
268
                 if [ ! "$?" = "0" ]; then
300
                 if [ ! "$?" = "0" ]; then
269
                     rm -rf ${temp_restore_dir}
301
                     rm -rf ${temp_restore_dir}
276
 }
308
 }
277
 
309
 
278
 function restore_gpg {
310
 function restore_gpg {
279
-    if [[ $RESTORE_APP != 'all' ]]; then
280
-        if [[ $RESTORE_APP != 'gpg' ]]; then
281
-            return
282
-        fi
311
+    if [[ $RESTORE_APP != 'gpg' ]]; then
312
+        return
283
     fi
313
     fi
314
+
284
     for d in $SERVER_DIRECTORY/backup/gnupg/*/ ; do
315
     for d in $SERVER_DIRECTORY/backup/gnupg/*/ ; do
285
         USERNAME=$(echo "$d" | awk -F '/' '{print $6}')
316
         USERNAME=$(echo "$d" | awk -F '/' '{print $6}')
286
         if [[ $(is_valid_user "$USERNAME") == "1" ]]; then
317
         if [[ $(is_valid_user "$USERNAME") == "1" ]]; then
302
                     if [ ! "$?" = "0" ]; then
333
                     if [ ! "$?" = "0" ]; then
303
                         exit 283
334
                         exit 283
304
                     fi
335
                     fi
336
+                    gpg_set_permissions root
305
                 fi
337
                 fi
306
             fi
338
             fi
307
         fi
339
         fi
538
             exit 276
570
             exit 276
539
         fi
571
         fi
540
         rm -rf /root/tempssl
572
         rm -rf /root/tempssl
573
+        update-ca-certificates
541
 
574
 
542
         # restore ownership
575
         # restore ownership
543
         if [ -f /etc/ssl/private/xmpp.key ]; then
576
         if [ -f /etc/ssl/private/xmpp.key ]; then
646
 ${PROJECT_NAME}-recoverkey -u ${ADMIN_USERNAME} -l $BACKUP_LIST
679
 ${PROJECT_NAME}-recoverkey -u ${ADMIN_USERNAME} -l $BACKUP_LIST
647
 
680
 
648
 copy_gpg_keys
681
 copy_gpg_keys
682
+restore_blocklist
649
 restore_configfiles
683
 restore_configfiles
650
 restore_passwordstore
684
 restore_passwordstore
651
 restore_mariadb
685
 restore_mariadb

+ 1
- 1
src/freedombone-rmuser View File

106
 fi
106
 fi
107
 
107
 
108
 if [ -f /etc/nginx/.htpasswd ]; then
108
 if [ -f /etc/nginx/.htpasswd ]; then
109
-    if grep "${REMOVE_USERNAME}:" /etc/nginx/.htpasswd; then
109
+    if grep -q "${REMOVE_USERNAME}:" /etc/nginx/.htpasswd; then
110
         htpasswd -D /etc/nginx/.htpasswd $REMOVE_USERNAME
110
         htpasswd -D /etc/nginx/.htpasswd $REMOVE_USERNAME
111
     fi
111
     fi
112
 fi
112
 fi

+ 4
- 4
src/freedombone-sec View File

566
     if [ ! -d /var/www/${new_domain} ]; then
566
     if [ ! -d /var/www/${new_domain} ]; then
567
         domain_found=
567
         domain_found=
568
         if [ -f /etc/nginx/sites-available/radicale ]; then
568
         if [ -f /etc/nginx/sites-available/radicale ]; then
569
-            if grep "${new_domain}" /etc/nginx/sites-available/radicale; then
569
+            if grep -q "${new_domain}" /etc/nginx/sites-available/radicale; then
570
                 domain_found=1
570
                 domain_found=1
571
             fi
571
             fi
572
         fi
572
         fi
664
 
664
 
665
         MY_GPG_PUBLIC_KEY_ID=$(gpg_pubkey_from_email "$MY_USERNAME" "$MY_USERNAME@$HOSTNAME")
665
         MY_GPG_PUBLIC_KEY_ID=$(gpg_pubkey_from_email "$MY_USERNAME" "$MY_USERNAME@$HOSTNAME")
666
         if [ ${#MY_GPG_PUBLIC_KEY_ID} -lt 4 ]; then
666
         if [ ${#MY_GPG_PUBLIC_KEY_ID} -lt 4 ]; then
667
-            echo $'monkeysphere unable to get GPG key ID for user $MY_USERNAME'
667
+            echo $"monkeysphere unable to get GPG key ID for user $MY_USERNAME@$HOSTNAME"
668
             exit 52825
668
             exit 52825
669
         fi
669
         fi
670
 
670
 
856
             if [ ${#response} -gt 2 ]; then
856
             if [ ${#response} -gt 2 ]; then
857
                 if [[ "${response}" != *" "* ]]; then
857
                 if [[ "${response}" != *" "* ]]; then
858
                     if [[ "${response}" == *"."* ]]; then
858
                     if [[ "${response}" == *"."* ]]; then
859
-                        if grep "Bridge ${response}" /etc/tor/torrc; then
859
+                        if grep -q "Bridge ${response}" /etc/tor/torrc; then
860
                             tor_remove_bridge "${response}"
860
                             tor_remove_bridge "${response}"
861
                             bridge_removed=1
861
                             bridge_removed=1
862
                         fi
862
                         fi
863
                     else
863
                     else
864
-                        if grep " $response" /etc/tor/torrc; then
864
+                        if grep -q " $response" /etc/tor/torrc; then
865
                             tor_remove_bridge "${response}"
865
                             tor_remove_bridge "${response}"
866
                             bridge_removed=1
866
                             bridge_removed=1
867
                         fi
867
                         fi

+ 40
- 11
src/freedombone-splitkey View File

39
 export TEXTDOMAIN=${PROJECT_NAME}-splitkey
39
 export TEXTDOMAIN=${PROJECT_NAME}-splitkey
40
 export TEXTDOMAINDIR="/usr/share/locale"
40
 export TEXTDOMAINDIR="/usr/share/locale"
41
 
41
 
42
+# Dummy password to get around not being able to create a key without passphrase
43
+BACKUP_DUMMY_PASSWORD='backup'
44
+
42
 KEY_FRAGMENTS=3
45
 KEY_FRAGMENTS=3
43
 MY_USERNAME=
46
 MY_USERNAME=
44
 MY_EMAIL_ADDRESS=
47
 MY_EMAIL_ADDRESS=
45
 MY_NAME=
48
 MY_NAME=
49
+PASSWORD_FILE=
46
 
50
 
47
 function show_help {
51
 function show_help {
48
     echo ''
52
     echo ''
75
     shift
79
     shift
76
     MY_NAME=$1
80
     MY_NAME=$1
77
     ;;
81
     ;;
82
+    --passwordfile)
83
+    shift
84
+    PASSWORD_FILE=$1
85
+    ;;
78
     *)
86
     *)
79
     # unknown option
87
     # unknown option
80
     ;;
88
     ;;
95
     exit 5393
103
     exit 5393
96
 fi
104
 fi
97
 
105
 
106
+if [ $PASSWORD_FILE ]; then
107
+    if [ ! -f $PASSWORD_FILE ]; then
108
+        echo $'Password file not found'
109
+        exit 62952
110
+    fi
111
+fi
112
+
98
 FRAGMENTS_DIR=/home/$MY_USERNAME/.gnupg_fragments
113
 FRAGMENTS_DIR=/home/$MY_USERNAME/.gnupg_fragments
99
 if [ -d $FRAGMENTS_DIR ]; then
114
 if [ -d $FRAGMENTS_DIR ]; then
100
     exit 0
115
     exit 0
104
 if [ ! $MY_EMAIL_ADDRESS ]; then
119
 if [ ! $MY_EMAIL_ADDRESS ]; then
105
     MY_EMAIL_ADDRESS=$MY_USERNAME@$HOSTNAME
120
     MY_EMAIL_ADDRESS=$MY_USERNAME@$HOSTNAME
106
 fi
121
 fi
107
-KEYID=$(su -c "gpg --list-keys $MY_EMAIL_ADDRESS | grep 'pub '" - \
108
-           $MY_USERNAME | awk -F ' ' '{print $2}' | awk -F '/' '{print $2}')
122
+
123
+KEYID=$(su -c "gpg --list-keys $MY_EMAIL_ADDRESS" - $MY_USERNAME | sed -n '2p' | sed 's/^[ \t]*//')
109
 if [ ${#KEYID} -lt 4 ]; then
124
 if [ ${#KEYID} -lt 4 ]; then
110
     echo $"gpg key for $MY_EMAIL_ADDRESS was not found"
125
     echo $"gpg key for $MY_EMAIL_ADDRESS was not found"
111
-    return 3682
126
+    exit 3682
112
 fi
127
 fi
113
 
128
 
114
-MY_BACKUP_KEY_ID=$(gpg --list-keys "$MY_NAME (backup key)" | \
115
-                          grep 'pub ' | awk -F ' ' '{print $2}' | \
116
-                          awk -F '/' '{print $2}')
129
+MY_BACKUP_KEY_ID=$(gpg --list-keys "$MY_NAME (backup key)" | sed -n '2p' | sed 's/^[ \t]*//')
117
 if [ ${#MY_BACKUP_KEY_ID} -lt 4 ]; then
130
 if [ ${#MY_BACKUP_KEY_ID} -lt 4 ]; then
118
     echo $"gpg backup key for '$MY_NAME' was not found"
131
     echo $"gpg backup key for '$MY_NAME' was not found"
119
-    return 58213
132
+    exit 58213
120
 fi
133
 fi
121
 
134
 
122
 # create the key file
135
 # create the key file
123
 mkdir -p $FRAGMENTS_DIR
136
 mkdir -p $FRAGMENTS_DIR
137
+chown $MY_USERNAME:$MY_USERNAME $FRAGMENTS_DIR
124
 KEYS_FILE=$FRAGMENTS_DIR/keyshare.asc
138
 KEYS_FILE=$FRAGMENTS_DIR/keyshare.asc
125
 gpg --output $FRAGMENTS_DIR/pubkey.txt --armor --export $KEYID
139
 gpg --output $FRAGMENTS_DIR/pubkey.txt --armor --export $KEYID
126
 if [ ! "$?" = "0" ]; then
140
 if [ ! "$?" = "0" ]; then
127
     echo $"Unable to extract public key for $KEYID"
141
     echo $"Unable to extract public key for $KEYID"
128
     exit 7835
142
     exit 7835
129
 fi
143
 fi
130
-gpg --output $FRAGMENTS_DIR/privkey.txt \
131
-    --armor --export-secret-key $KEYID
144
+if [ ! $PASSWORD_FILE ]; then
145
+    gpg --output $FRAGMENTS_DIR/privkey.txt \
146
+        --armor --export-secret-key $KEYID
147
+else
148
+    echo "$(printf `cat $PASSWORD_FILE`)" | \
149
+        gpg --batch --passphrase-fd 0 \
150
+        --output $FRAGMENTS_DIR/privkey.txt \
151
+        --armor --export-secret-key $KEYID
152
+fi
132
 if [ ! "$?" = "0" ]; then
153
 if [ ! "$?" = "0" ]; then
133
     echo $"Unable to extract private key for $KEYID"
154
     echo $"Unable to extract private key for $KEYID"
134
     exit 7823
155
     exit 7823
136
 gpg --output $FRAGMENTS_DIR/backup_pubkey.txt \
157
 gpg --output $FRAGMENTS_DIR/backup_pubkey.txt \
137
     --armor --export $MY_BACKUP_KEY_ID
158
     --armor --export $MY_BACKUP_KEY_ID
138
 if [ ! "$?" = "0" ]; then
159
 if [ ! "$?" = "0" ]; then
160
+    shred -zu $FRAGMENTS_DIR/privkey.txt
139
     echo $"Unable to extract backup public key for $MY_BACKUP_KEY_ID"
161
     echo $"Unable to extract backup public key for $MY_BACKUP_KEY_ID"
140
     exit 62928
162
     exit 62928
141
 fi
163
 fi
142
-gpg --output $FRAGMENTS_DIR/backup_privkey.txt \
143
-    --armor --export-secret-key $MY_BACKUP_KEY_ID
164
+echo "$BACKUP_DUMMY_PASSWORD" | \
165
+    gpg --output $FRAGMENTS_DIR/backup_privkey.txt \
166
+        --batch --passphrase-fd 0 \
167
+        --armor --export-secret-key $MY_BACKUP_KEY_ID
144
 if [ ! "$?" = "0" ]; then
168
 if [ ! "$?" = "0" ]; then
169
+    shred -zu $FRAGMENTS_DIR/privkey.txt
145
     echo $"Unable to extract backup private key for $MY_BACKUP_KEY_ID"
170
     echo $"Unable to extract backup private key for $MY_BACKUP_KEY_ID"
146
     exit 13783
171
     exit 13783
147
 fi
172
 fi
148
 
173
 
174
+# Ensure there aren't any permissions problems when running cat
175
+chmod +r $FRAGMENTS_DIR/privkey.txt
176
+chmod +r $FRAGMENTS_DIR/backup_privkey.txt
177
+
149
 cat $FRAGMENTS_DIR/pubkey.txt \
178
 cat $FRAGMENTS_DIR/pubkey.txt \
150
     $FRAGMENTS_DIR/privkey.txt \
179
     $FRAGMENTS_DIR/privkey.txt \
151
     $FRAGMENTS_DIR/backup_pubkey.txt \
180
     $FRAGMENTS_DIR/backup_pubkey.txt \

+ 23
- 0
src/freedombone-syncthing View File

266
 
266
 
267
     for d in /home/*/ ; do
267
     for d in /home/*/ ; do
268
         USERNAME=$(echo "$d" | awk -F '/' '{print $3}')
268
         USERNAME=$(echo "$d" | awk -F '/' '{print $3}')
269
+        if [ ! -f /home/$USERNAME/.syncthing-server-id ]; then
270
+            CHANGED=1
271
+            return
272
+        fi
273
+    done
274
+
275
+    for d in /home/*/ ; do
276
+        USERNAME=$(echo "$d" | awk -F '/' '{print $3}')
269
         if [[ $(is_valid_user "$USERNAME") == "1" ]]; then
277
         if [[ $(is_valid_user "$USERNAME") == "1" ]]; then
270
             if [ -f /home/$USERNAME/$SYNCTHING_UPDATE_FILE ]; then
278
             if [ -f /home/$USERNAME/$SYNCTHING_UPDATE_FILE ]; then
271
                 CHANGED=1
279
                 CHANGED=1
294
     done
302
     done
295
 }
303
 }
296
 
304
 
305
+function syncthing_set_permissions {
306
+    for d in /home/*/ ; do
307
+        USERNAME=$(echo "$d" | awk -F '/' '{print $3}')
308
+        if [ -d /home/$USERNAME/Sync ]; then
309
+            chown $USERNAME:$USERNAME /home/$USERNAME /home/$USERNAME/Sync
310
+        fi
311
+        if [ -d /home/$USERNAME/SyncShared ]; then
312
+            chown $USERNAME:$USERNAME /home/$USERNAME /home/$USERNAME/SyncShared
313
+        fi
314
+    done
315
+}
316
+
297
 user_devices_changed
317
 user_devices_changed
298
 if [ $CHANGED ]; then
318
 if [ $CHANGED ]; then
299
     create_syncthing_config
319
     create_syncthing_config
320
+    syncthing_set_permissions
300
     systemctl restart syncthing
321
     systemctl restart syncthing
322
+else
323
+    syncthing_set_permissions
301
 fi
324
 fi
302
 
325
 
303
 exit 0
326
 exit 0

+ 121
- 48
src/freedombone-tests View File

762
     output "V-38616" $? ${SETLANG}
762
     output "V-38616" $? ${SETLANG}
763
     ################
763
     ################
764
 
764
 
765
+    ##A FIPS 140-2 approved cryptographic algorithm must be used for SSH communications.
766
+    bash $STIG_TESTS_DIR/check-ssh.sh ciphers >/dev/null 2>&1 &
767
+    stig_spinner $!
768
+    output "SV-86845r2_rule" $? ${SETLANG}
769
+    ################
770
+
771
+    ##The Standard Notice must be displayed immediately prior to, or as part of, remote access logon prompts.
772
+    bash $STIG_TESTS_DIR/check-ssh.sh banner >/dev/null 2>&1 &
773
+    stig_spinner $!
774
+    output "SV-86849r2_rule" $? ${SETLANG}
775
+    ################
776
+
777
+    ##All networked systems must use SSH for confidentiality and integrity of transmitted and received information as well as information during preparation for transmission.
778
+    bash $STIG_TESTS_DIR/check-ssh.sh sshd_status >/dev/null 2>&1 &
779
+    stig_spinner $!
780
+    output "SV-86859r2_rule" $? ${SETLANG}
781
+    ################
782
+
783
+    ##All network connections associated with SSH traffic must terminate at the end of the session or after 10 minutes of inactivity, except to fulfill documented and validated mission requirements.
784
+    bash $STIG_TESTS_DIR/check-ssh.sh ClientAliveInterval >/dev/null 2>&1 &
785
+    stig_spinner $!
786
+    output "SV-86861r2_rule" $? ${SETLANG}
787
+    ################
788
+
789
+    ##The SSH daemon must not allow authentication using RSA rhosts authentication.
790
+    bash $STIG_TESTS_DIR/check-ssh.sh RhostsRSAAuthentication >/dev/null 2>&1 &
791
+    stig_spinner $!
792
+    output "SV-86863r2_rule" $? ${SETLANG}
793
+    ################
794
+
795
+    ##All network connections associated with SSH traffic must terminate after a period of inactivity.
796
+    bash $STIG_TESTS_DIR/check-ssh.sh ClientAliveCountMax >/dev/null 2>&1 &
797
+    stig_spinner $!
798
+    output "SV-86865r2_rule" $? ${SETLANG}
799
+    ################
800
+
801
+    ##The SSH daemon must not allow authentication using rhosts authentication.
802
+    bash $STIG_TESTS_DIR/check-ssh.sh IgnoreRhosts >/dev/null 2>&1 &
803
+    stig_spinner $!
804
+    output "SV-86867r2_rule" $? ${SETLANG}
805
+    ################
806
+
807
+    ##The system must display the date and time of the last successful account logon upon an SSH logon.
808
+    bash $STIG_TESTS_DIR/check-ssh.sh PrintLastLog >/dev/null 2>&1 &
809
+    stig_spinner $!
810
+    output "SV-86869r2_rule" $? ${SETLANG}
811
+    ################
812
+
813
+    ##The system must not permit direct logons to the root account using remote access via SSH.
814
+    bash $STIG_TESTS_DIR/check-ssh.sh permitroot >/dev/null 2>&1 &
815
+    stig_spinner $!
816
+    output "SV-86871r2_rule" $? ${SETLANG}
817
+    ################
818
+
819
+    ##The SSH daemon must not allow authentication using known hosts authentication.
820
+    bash $STIG_TESTS_DIR/check-ssh.sh IgnoreUserKnownHosts >/dev/null 2>&1 &
821
+    stig_spinner $!
822
+    output "SV-86873r2_rule" $? ${SETLANG}
823
+    ################
824
+
825
+    ##The SSH daemon must be configured to only use the SSHv2 protocol.
826
+    bash $STIG_TESTS_DIR/check-ssh.sh Protocol >/dev/null 2>&1 &
827
+    stig_spinner $!
828
+    output "SV-86875r2_rule" $? ${SETLANG}
829
+    ################
830
+
831
+    ##The SSH daemon must be configured to only use Message Authentication Codes (MACs) employing FIPS 140-2 approved cryptographic hash algorithms.
832
+    bash $STIG_TESTS_DIR/check-ssh.sh macs >/dev/null 2>&1 &
833
+    stig_spinner $!
834
+    output "SV-86877r2_rule" $? ${SETLANG}
835
+    ################
836
+
837
+    ##The SSH public host key files must have mode 0644 or less permissive.
838
+    bash $STIG_TESTS_DIR/check-ssh.sh pubkeypermissive >/dev/null 2>&1 &
839
+    stig_spinner $!
840
+    output "SV-86879r1_rule" $? ${SETLANG}
841
+    ################
842
+
843
+    ##The SSH private host key files must have mode 0600 or less permissive.
844
+    bash $STIG_TESTS_DIR/check-ssh.sh hostkeypermissive >/dev/null 2>&1 &
845
+    stig_spinner $!
846
+    output "SV-86881r1_rule" $? ${SETLANG}
847
+    ################
848
+
849
+    ##The SSH daemon must not permit Generic Security Service Application Program Interface (GSSAPI) authentication unless needed.
850
+    bash $STIG_TESTS_DIR/check-ssh.sh GSSAPIAuthentication >/dev/null 2>&1 &
851
+    stig_spinner $!
852
+    output "SV-86883r2_rule" $? ${SETLANG}
853
+    ################
854
+
855
+    ##The SSH daemon must not permit Kerberos authentication unless needed.
856
+    bash $STIG_TESTS_DIR/check-ssh.sh KerberosAuthentication >/dev/null 2>&1 &
857
+    stig_spinner $!
858
+    output "SV-86885r2_rule" $? ${SETLANG}
859
+    ################
860
+
861
+    ##The SSH daemon must perform strict mode checking of home directory configuration files.
862
+    bash $STIG_TESTS_DIR/check-ssh.sh StrictModes >/dev/null 2>&1 &
863
+    stig_spinner $!
864
+    output "SV-86887r2_rule" $? ${SETLANG}
865
+    ################
866
+
867
+    ##The SSH daemon must use privilege separation.
868
+    bash $STIG_TESTS_DIR/check-ssh.sh UsePrivilegeSeparation >/dev/null 2>&1 &
869
+    stig_spinner $!
870
+    output "SV-86889r2_rule" $? ${SETLANG}
871
+    ################
872
+
873
+    ##The SSH daemon must not allow compression or must only allow compression after successful authentication.
874
+    bash $STIG_TESTS_DIR/check-ssh.sh Compression >/dev/null 2>&1 &
875
+    stig_spinner $!
876
+    output "SV-86891r2_rule" $? ${SETLANG}
877
+    ################
878
+
879
+    ##Dont allow remote X connections.
880
+    bash $STIG_TESTS_DIR/check-ssh.sh X11Forwarding >/dev/null 2>&1 &
881
+    stig_spinner $!
882
+    output "SV-86927r2_rule" $? ${SETLANG}
883
+    ################
884
+
765
     ##RHEL-06-000247
885
     ##RHEL-06-000247
766
     ##The system clock must be synchronized continuously, or at least daily.
886
     ##The system clock must be synchronized continuously, or at least daily.
767
 
887
 
844
     output "V-38641" $? ${SETLANG}
964
     output "V-38641" $? ${SETLANG}
845
     ################
965
     ################
846
 
966
 
847
-    ##RHEL-06-000269
848
-    ##Remote file systems must be mounted with the nodev option.
849
-    if [ "$(mount | grep nfs | wc -l)" -gt 0 ];then
850
-        bash $STIG_TESTS_DIR/check-nfs.sh nodev >/dev/null 2>&1 &
851
-
852
-        stig_spinner $!
853
-        output "V-38652" $? ${SETLANG}
854
-    fi
855
-    ################
856
-
857
-    ##RHEL-06-000270
858
-    ##Remote file systems must be mounted with the nosuid option.
859
-    if [ "$(mount | grep nfs | wc -l)" -gt 0 ];then
860
-        bash $STIG_TESTS_DIR/check-nfs.sh nosuid >/dev/null 2>&1 &
861
-
862
-        stig_spinner $!
863
-        output "V-38654" $? ${SETLANG}
864
-    fi
865
-    ################
866
-
867
     ##RHEL-06-000271
967
     ##RHEL-06-000271
868
     ##The noexec option must be added to removable media partitions.
968
     ##The noexec option must be added to removable media partitions.
869
     if [ "$(grep -Hv ^0$ /sys/block/*/removable | sed s/removable:.*$/device\\/uevent/ | xargs grep -H ^DRIVER=sd | sed s/device.uevent.*$/size/ | xargs grep -Hv ^0$ | cut -d / -f 4 | wc -l)" -gt 0 ];then
969
     if [ "$(grep -Hv ^0$ /sys/block/*/removable | sed s/removable:.*$/device\\/uevent/ | xargs grep -H ^DRIVER=sd | sed s/device.uevent.*$/size/ | xargs grep -Hv ^0$ | cut -d / -f 4 | wc -l)" -gt 0 ];then
946
     output "V-38675" $? ${SETLANG}
1046
     output "V-38675" $? ${SETLANG}
947
     ################
1047
     ################
948
 
1048
 
949
-    ##RHEL-06-000309
950
-    ##The NFS server must not have the insecure file locking option enabled.
951
-
952
-    bash $STIG_TESTS_DIR/check-nfs-insecure.sh > /dev/null 2>&1 &
953
-
954
-    stig_spinner $!
955
-    output "V-38677" $? ${SETLANG}
956
-    ################
957
-
958
     ##RHEL-06-000319
1049
     ##RHEL-06-000319
959
     ##The system must limit users to 10 simultaneous system logins, or a site-defined number, in accordance with operational requirements.
1050
     ##The system must limit users to 10 simultaneous system logins, or a site-defined number, in accordance with operational requirements.
960
 
1051
 
1010
     output "V-38645" $? ${SETLANG}
1101
     output "V-38645" $? ${SETLANG}
1011
     ################
1102
     ################
1012
 
1103
 
1013
-    ##RHEL-06-000346
1014
-    ##The system default umask for daemons must be 027 or 022.
1015
-    ##For more detial :http://unix.stackexchange.com/questions/36220/how-to-set-umask-for-a-system-user
1016
-
1017
-    sed -e '/^#/d' -e '/^[ \t][ \t]*#/d' -e 's/#.*$//' -e '/^$/d' /etc/init.d/rc | grep -i "umask.*027\|umask.*022" >/dev/null 2>&1 &
1018
-
1019
-    stig_spinner $!
1020
-    output "V-38646" $? ${SETLANG}
1021
-    ################
1022
-
1023
     ##RHEL-06-000347
1104
     ##RHEL-06-000347
1024
     ##There must be no .netrc files on the system.
1105
     ##There must be no .netrc files on the system.
1025
 
1106
 
1056
     output "V-38462" $? ${SETLANG}
1137
     output "V-38462" $? ${SETLANG}
1057
     ################
1138
     ################
1058
 
1139
 
1059
-    ##RHEL-06-000515
1060
-    ##The NFS server must not have the all_squash option enabled.
1061
-
1062
-    bash $STIG_TESTS_DIR/check-nfs-all-squash.sh > /dev/null 2>&1 &
1063
-
1064
-    stig_spinner $!
1065
-    output "V-38460" $? ${SETLANG}
1066
-    ################
1067
-
1068
     ##RHEL-06-000523
1140
     ##RHEL-06-000523
1069
     ##The systems local IPv6 firewall must implement a deny-all, allow-by-exception policy for inbound packets.
1141
     ##The systems local IPv6 firewall must implement a deny-all, allow-by-exception policy for inbound packets.
1070
 
1142
 
1149
 test_app_functions
1221
 test_app_functions
1150
 test_unique_onion_ports
1222
 test_unique_onion_ports
1151
 remove_management_engine_interface
1223
 remove_management_engine_interface
1224
+freedombone-pass --test yes
1152
 fix_stig
1225
 fix_stig
1153
 test_stig
1226
 test_stig
1154
 
1227
 

+ 0
- 0
src/freedombone-upgrade View File


Some files were not shown because too many files changed in this diff