浏览代码

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

Bob Mottram 8 年前
父节点
当前提交
1547479013
共有 100 个文件被更改,包括 3668 次插入2219 次删除
  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. 二进制
      image_build/bbb-4.9.0.tar.gz
  17. 153
    153
      image_build/debootstrap/scripts/stretch
  18. 二进制
      img/gnusocial_sprite.png
  19. 二进制
      img/postactiv_sprite.png
  20. 二进制
      img/release3.jpg
  21. 二进制
      man/freedombone-image.1.gz
  22. 二进制
      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 查看文件

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

+ 0
- 41
doc/EN/app_radicale.org 查看文件

@@ -1,41 +0,0 @@
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 查看文件

@@ -1,34 +0,0 @@
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 查看文件

@@ -115,19 +115,10 @@ An alternative federated social networking system compatible with GNU Social. It
115 115
 A shell based XMPP client which you can run on the Freedombone server via ssh.
116 116
 
117 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 118
 * Riot Web
123 119
 A browser based user interface for the Matrix federated communications system, including WebRTC audio and video chat.
124 120
 
125 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 122
 * SearX
132 123
 A metasearch engine for customised and private web searches.
133 124
 

+ 2
- 0
doc/EN/beaglebone.org 查看文件

@@ -41,6 +41,7 @@ On your laptop or desktop prepare a microSD card image as follows. To create an
41 41
 sudo apt-get install git
42 42
 git clone https://github.com/bashrc/freedombone
43 43
 cd freedombone
44
+git checkout stretch
44 45
 sudo make install
45 46
 freedombone-image --setup debian
46 47
 #+end_src
@@ -51,6 +52,7 @@ Or on Arch/Parabola:
51 52
 sudo pacman -S git
52 53
 git clone https://github.com/bashrc/freedombone
53 54
 cd freedombone
55
+git checkout stretch
54 56
 sudo make install
55 57
 freedombone-image --setup parabola
56 58
 #+end_src

+ 2
- 1
doc/EN/debianinstall.org 查看文件

@@ -18,7 +18,7 @@
18 18
 
19 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 23
 #+BEGIN_SRC bash
24 24
 su
@@ -26,6 +26,7 @@ apt-get update
26 26
 apt-get -qy install build-essential git dialog
27 27
 git clone https://github.com/bashrc/freedombone
28 28
 cd freedombone
29
+git checkout stretch
29 30
 make install
30 31
 freedombone makeconfig
31 32
 #+END_SRC

+ 10
- 0
doc/EN/devguide.org 查看文件

@@ -89,6 +89,16 @@ myappname_variables=(ONION_ONLY
89 89
                      MYAPPNAME_ONION_PORT
90 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 102
 function change_password_myappname {
93 103
     PASSWORD_USERNAME="$1"
94 104
     PASSWORD_NEW="$2"

+ 6
- 0
doc/EN/faq.org 查看文件

@@ -46,6 +46,7 @@
46 46
 | [[Why does my email keep getting rejected as spam by Gmail/etc?]]                             |
47 47
 | [[Tor is censored/blocked in my area. What can I do?]]                                        |
48 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 51
 #+END_CENTER
51 52
 
@@ -332,3 +333,8 @@ ssh username@domainname -p 2222
332 333
 #+end_src
333 334
 
334 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 查看文件

@@ -39,5 +39,5 @@ It may seem like a good idea and it may seem like you're doing a service to the
39 39
 
40 40
 
41 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 43
 #+END_CENTER

+ 3
- 1
doc/EN/homeserver.org 查看文件

@@ -23,6 +23,7 @@ First install freedombone onto your local system (not the target hardware that y
23 23
 sudo apt-get install git
24 24
 git clone https://github.com/bashrc/freedombone
25 25
 cd freedombone
26
+git checkout stretch
26 27
 sudo make install
27 28
 freedombone-image --setup debian
28 29
 freedombone-image -t i386 --onion yes
@@ -34,6 +35,7 @@ Or on Arch/Parabola:
34 35
 sudo pacman -S git
35 36
 git clone https://github.com/bashrc/freedombone
36 37
 cd freedombone
38
+git checkout stretch
37 39
 sudo make install
38 40
 freedombone-image --setup parabola
39 41
 freedombone-image -t i386 --onion yes
@@ -148,5 +150,5 @@ man freedombone-image
148 150
 #+end_src
149 151
 
150 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 154
 #+END_CENTER

+ 8
- 7
doc/EN/index.org 查看文件

@@ -16,9 +16,12 @@
16 16
 -- Lucas Nussbaum
17 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 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,9 +31,7 @@ And here's how [[./beaglebone.html][on a Beaglebone Black]].
28 31
 
29 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 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,5 +46,5 @@ If you find bugs, or want to add a new app to this system see the [[./devguide.h
45 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 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 50
 #+END_CENTER

+ 5
- 2
doc/EN/installation.org 查看文件

@@ -35,6 +35,7 @@ Install the freedombone commands onto your laptop/desktop:
35 35
 sudo apt-get install git build-essential dialog
36 36
 git clone https://github.com/bashrc/freedombone
37 37
 cd freedombone
38
+git checkout stretch
38 39
 sudo make install
39 40
 #+END_SRC
40 41
 
@@ -80,7 +81,7 @@ freedombone-image -t beaglebone -s 8G -m http://ftp.de.debian.org/debian
80 81
 Before installing Freedombone you will need a few things.
81 82
 
82 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 85
   * Ethernet connection between the system and your internet router
85 86
   * That it is possible to forward ports from the internet router to the system, typically via firewall settings
86 87
   * Have ssh access to the system, typically via fbone@freedombone.local on port 2222
@@ -88,7 +89,7 @@ Before installing Freedombone you will need a few things.
88 89
 There are three install options: Laptop/Desktop/Netbook, SBC and Virtual Machine.
89 90
 
90 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 94
 #+BEGIN_SRC bash
94 95
 su
@@ -96,6 +97,7 @@ apt-get update
96 97
 apt-get -y install git dialog build-essential
97 98
 git clone https://github.com/bashrc/freedombone
98 99
 cd freedombone
100
+git checkout stretch
99 101
 make install
100 102
 freedombone menuconfig
101 103
 #+END_SRC
@@ -223,6 +225,7 @@ sudo apt-get update
223 225
 sudo apt-get install git dialog haveged build-essential
224 226
 git clone https://github.com/bashrc/freedombone
225 227
 cd freedombone
228
+git checkout stretch
226 229
 sudo make install
227 230
 freedombone-client
228 231
 #+END_SRC

+ 52
- 34
doc/EN/mesh.org 查看文件

@@ -22,6 +22,8 @@
22 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 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 29
 * What the system can do
@@ -41,6 +43,20 @@ Mesh networks are useful as a quick way to make a fully decentralised communicat
41 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 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 60
 ** Client images
45 61
 
46 62
 #+BEGIN_CENTER
@@ -51,13 +67,13 @@ This system should be quite scalable. Both qTox and IPFS are based upon distribu
51 67
 
52 68
 #+begin_src bash
53 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 77
 #+end_src
62 78
 
63 79
 To get a number of systems onto the mesh repeat the /dd/ command to create however many bootable USB drives you need.
@@ -66,13 +82,13 @@ If you're in an emergency and don't have Atheros wifi dongles then there is also
66 82
 
67 83
 #+begin_src bash
68 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 92
 #+end_src
77 93
 
78 94
 ** Router images
@@ -86,13 +102,13 @@ The above picture shows a Beaglebone Black with the image copied onto a microSD
86 102
 
87 103
 #+begin_src bash
88 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 112
 #+end_src
97 113
 
98 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,22 +118,20 @@ There is still a software freedom issue with the Beaglebone Black, but it doesn'
102 118
 * Building Disk Images
103 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 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 131
 cd freedombone
132
+git checkout stretch
120 133
 sudo make install
134
+freedombone-image --setup debian
121 135
 freedombone-image -t i386 -v meshclient
122 136
 #+end_src
123 137
 
@@ -166,6 +180,10 @@ When you first boot from the USB drive the system will create some encryption ke
166 180
 
167 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 187
 ** Set the Date
170 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,5 +258,5 @@ You can also visit other blogs, edit or delete your previous entry and also chan
240 258
 
241 259
 
242 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 262
 #+END_CENTER

+ 73
- 0
doc/EN/release3.org 查看文件

@@ -0,0 +1,73 @@
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 查看文件

@@ -18,7 +18,7 @@
18 18
 
19 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 23
 *Email:* bob@freedombone.net
24 24
 

二进制
image_build/bbb-4.9.0.tar.gz 查看文件


+ 153
- 153
image_build/debootstrap/scripts/stretch 查看文件

@@ -5,207 +5,207 @@ variants - buildd fakechroot minbase scratchbox
5 5
 keyring /usr/share/keyrings/debian-archive-keyring.gpg
6 6
 
7 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 9
 fi
10 10
 
11 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 16
 esac
17 17
 
18 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 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 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 75
 "Package: $pkg
76 76
 Version: $ver
77 77
 Maintainer: unknown
78 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 157
 "#!/bin/sh
158 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 163
 "#!/bin/sh
164 164
 echo
165 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
 }

二进制
img/gnusocial_sprite.png 查看文件


二进制
img/postactiv_sprite.png 查看文件


二进制
img/release3.jpg 查看文件


二进制
man/freedombone-image.1.gz 查看文件


二进制
man/freedombone.1.gz 查看文件


+ 13
- 1
src/freedombone 查看文件

@@ -13,7 +13,7 @@
13 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 18
 # This program is free software: you can redistribute it and/or modify
19 19
 # it under the terms of the GNU Affero General Public License as published by
@@ -65,6 +65,18 @@ if [[ $command_options == "menuconfig-onion" ]]; then
65 65
     ONION_ONLY="yes"
66 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 80
 if [ ! $CONFIGURATION_FILE ]; then
69 81
     CONFIGURATION_FILE=$HOME/${PROJECT_NAME}.cfg
70 82
 fi

+ 3
- 7
src/freedombone-addcert 查看文件

@@ -59,10 +59,6 @@ DH_KEYLENGTH=2048
59 59
 INSTALL_DIR=/root/build
60 60
 LETSENCRYPT_SERVER='https://acme-v01.api.letsencrypt.org/directory'
61 61
 MY_EMAIL_ADDRESS=
62
-FRIENDS_MIRRORS_SERVER=
63
-FRIENDS_MIRRORS_PASSWORD=
64
-FRIENDS_MIRRORS_SSH_PORT=
65
-MY_MIRRORS_PASSWORD=
66 62
 
67 63
 function show_help {
68 64
     echo ''
@@ -222,7 +218,8 @@ function add_cert_letsencrypt {
222 218
     fi
223 219
 
224 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 223
         if [ ! -f /usr/bin/certbot ]; then
227 224
             echo $'LetsEncrypt certbot failed to install'
228 225
             exit 762830
@@ -311,7 +308,7 @@ function add_cert_selfsigned {
311 308
 
312 309
     openssl req -x509 ${EXTENSIONS} -nodes -days 3650 -sha256 \
313 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 312
             -out /etc/ssl/certs/${CERTFILE}.crt
316 313
     chmod 400 /etc/ssl/private/${CERTFILE}.key
317 314
     chmod 640 /etc/ssl/certs/${CERTFILE}.crt
@@ -359,7 +356,6 @@ function create_cert {
359 356
     fi
360 357
 }
361 358
 
362
-read_repo_servers
363 359
 create_cert
364 360
 generate_dh_params
365 361
 restart_web_server

+ 6
- 2
src/freedombone-addremove 查看文件

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

+ 22
- 20
src/freedombone-adduser 查看文件

@@ -136,25 +136,27 @@ chmod 700 /home/$ADD_USERNAME/.gnupg
136 136
 chmod 600 /home/$ADD_USERNAME/.gnupg/*
137 137
 
138 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 142
 echo "Name-Real:  $ADD_USERNAME" >> /home/$ADD_USERNAME/gpg-genkey.conf
144 143
 echo "Name-Email: $ADD_USERNAME@$HOSTNAME" >> /home/$ADD_USERNAME/gpg-genkey.conf
145 144
 echo 'Expire-Date: 0' >> /home/$ADD_USERNAME/gpg-genkey.conf
145
+echo "Passphrase: $NEW_USER_PASSWORD" >> /home/$ADD_USERNAME/gpg-genkey.conf
146 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 149
 shred -zu /home/$ADD_USERNAME/gpg-genkey.conf
149 150
 MY_GPG_PUBLIC_KEY_ID=$(gpg_pubkey_from_email "$ADD_USERNAME" "$ADD_USERNAME@$HOSTNAME")
150 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 154
 if [ ! -f $MY_GPG_PUBLIC_KEY ]; then
154 155
     echo "GPG public key was not generated for $ADD_USERNAME@$HOSTNAME $MY_GPG_PUBLIC_KEY_ID"
155 156
     userdel -r $ADD_USERNAME
156 157
     exit 7
157 158
 fi
159
+gpg_agent_setup $ADD_USERNAME
158 160
 
159 161
 # add a monkeysphere subkey
160 162
 #echo $'Adding monkeysphere subkey'
@@ -162,28 +164,28 @@ fi
162 164
 #echo $'Adding monkeysphere subkey to ssh-agent'
163 165
 #su -c "monkeysphere s" - $ADD_USERNAME
164 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 175
 if [ -f /home/$ADD_USERNAME/.muttrc ]; then
174 176
     # encrypt outgoing mail to the "sent" folder
175 177
     if ! grep -q "pgp_encrypt_only_command" /home/$ADD_USERNAME/.muttrc; then
176 178
         echo '' >> /home/$ADD_USERNAME/.muttrc
177 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 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 183
     fi
182 184
 
183 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 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 189
     fi
188 190
 fi
189 191
 
@@ -227,14 +229,14 @@ do
227 229
 done
228 230
 
229 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 233
         echo "$NEW_USER_PASSWORD" | htpasswd -i -s /etc/nginx/.htpasswd $ADD_USERNAME
232 234
     fi
233 235
 fi
234 236
 
235 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 240
 fi
239 241
 
240 242
 ${PROJECT_NAME}-pass -u $ADD_USERNAME -a login -p "$NEW_USER_PASSWORD"

+ 8
- 0
src/freedombone-app-batman 查看文件

@@ -39,6 +39,14 @@ BATMAN_CELLID='any'
39 39
 batman_variables=(MY_USERNAME
40 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 50
 function install_interactive_batman {
43 51
     echo -n ''
44 52
     APP_INSTALLED=1

+ 24
- 2
src/freedombone-app-cryptpad 查看文件

@@ -42,6 +42,14 @@ CRYPTPAD_DIR=/etc/cryptpad
42 42
 
43 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 53
 function remove_user_cryptpad {
46 54
     remove_username="$1"
47 55
 }
@@ -157,6 +165,7 @@ function remove_cryptpad {
157 165
     if [ -f /etc/systemd/system/cryptpad.service ]; then
158 166
         rm /etc/systemd/system/cryptpad.service
159 167
     fi
168
+    systemctl daemon-reload
160 169
 
161 170
     function_check remove_nodejs
162 171
     remove_nodejs cryptpad
@@ -190,8 +199,16 @@ function install_cryptpad_main {
190 199
         rm -rf $CRYPTPAD_DIR
191 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 212
     if [ ! -d $CRYPTPAD_DIR ]; then
196 213
         echo $'Unable to clone cryptpad repo'
197 214
         exit 783251
@@ -286,6 +303,7 @@ function install_cryptpad {
286 303
 
287 304
     npm install
288 305
     npm install -g bower@1.8.0
306
+    chown -R cryptpad:cryptpad $CRYPTPAD_DIR
289 307
     su -c 'bower install' - cryptpad
290 308
     cp config.example.js config.js
291 309
     if [ ! -f config.js ]; then
@@ -333,6 +351,10 @@ function install_cryptpad {
333 351
     fi
334 352
     chown -R cryptpad:cryptpad $CRYPTPAD_DIR
335 353
 
354
+    # install again
355
+    cd $CRYPTPAD_DIR
356
+    su -c 'bower install' - cryptpad
357
+
336 358
     systemctl restart nginx
337 359
 
338 360
     APP_INSTALLED=1

+ 8
- 0
src/freedombone-app-dlna 查看文件

@@ -38,6 +38,14 @@ dlna_variables=(SYSTEM_TYPE
38 38
                 INSTALLED_WITHIN_DOCKER
39 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 49
 function configure_interactive_dlna {
42 50
     while true
43 51
     do

+ 205
- 132
src/freedombone-app-dokuwiki 查看文件

@@ -34,10 +34,13 @@ IN_DEFAULT_INSTALL=0
34 34
 SHOW_ON_ABOUT=1
35 35
 
36 36
 DOKUWIKI_DOMAIN_NAME=
37
-DOKUWIKI_ADMIN_PASSWORD=
38
-DOKUWIKI_TITLE="${PROJECT_NAME} Dokuwiki"
39 37
 DOKUWIKI_CODE=
40 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 45
 dokuwiki_variables=(ONION_ONLY
43 46
                     MY_USERNAME
@@ -46,6 +49,14 @@ dokuwiki_variables=(ONION_ONLY
46 49
                     DOKUWIKI_CODE
47 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 60
 function install_interactive_dokuwiki {
50 61
     if [[ $ONION_ONLY != "no" ]]; then
51 62
         DOKUWIKI_TITLE=$'My Dokuwiki'
@@ -63,15 +74,18 @@ function change_password_dokuwiki {
63 74
     curr_username="$1"
64 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 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 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 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 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 89
         ${PROJECT_NAME}-pass -u $curr_username -a dokuwiki -p "$new_user_password"
76 90
     fi
77 91
 }
@@ -80,17 +94,22 @@ function add_user_dokuwiki {
80 94
     new_username="$1"
81 95
     new_user_password="$2"
82 96
 
97
+    DOKUWIKI_DOMAIN_NAME=$(get_completion_param "dokuwiki domain")
83 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 103
     ${PROJECT_NAME}-pass -u "$new_username" -a dokuwiki -p "$new_user_password"
87 104
 }
88 105
 
89 106
 function remove_user_dokuwiki {
90 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 113
         ${PROJECT_NAME}-pass -u "$remove_username" --rmapp dokuwiki
95 114
     fi
96 115
 }
@@ -100,24 +119,37 @@ function reconfigure_dokuwiki {
100 119
 }
101 120
 
102 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 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 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 143
         backup_directory_to_usb $source_directory $dest_directory
112
-        backup_directory_to_usb /etc/dokuwiki dokuwiki2
113 144
     fi
114 145
 }
115 146
 
116
-function restore_local_dokuwiki {
147
+function restore_local_dokuwiki_legacy {
117 148
     if [ -d /var/lib/dokuwiki ]; then
118
-        echo $"Restoring Dokuwiki installation"
149
+        echo $"Restoring Legacy Dokuwiki installation"
119 150
         function_check get_completion_param
120 151
         DOKUWIKI_DOMAIN_NAME=$(get_completion_param "dokuwiki domain")
152
+
121 153
         temp_restore_dir=/root/tempdokuwiki
122 154
         function_check restore_directory_from_usb
123 155
         if [ -d ${USB_MOUNT}/backup/dokuwiki ]; then
@@ -125,87 +157,133 @@ function restore_local_dokuwiki {
125 157
         else
126 158
             restore_directory_from_usb ${temp_restore_dir} wiki
127 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 163
         if [ ! "$?" = "0" ]; then
130 164
             function_check restore_directory_from_usb
131 165
             set_user_permissions
132 166
             function_check backup_unmount_drive
133 167
             backup_unmount_drive
134
-            exit 868
168
+            rm -rf ${temp_restore_dir}
169
+            exit 73562
135 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 175
         if [ ! "$?" = "0" ]; then
143
-            function_check set_user_permissions
176
+            function_check restore_directory_from_usb
144 177
             set_user_permissions
145 178
             function_check backup_unmount_drive
146 179
             backup_unmount_drive
147
-            exit 869
180
+            rm -rf ${temp_restore_dir}
181
+            exit 23985
148 182
         fi
149 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 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 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 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 250
     fi
174 251
 }
175 252
 
176 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 262
         if [ ! "$?" = "0" ]; then
185
-            exit 868
263
+            exit 92634
186 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 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 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 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 289
 function remove_dokuwiki {
@@ -219,7 +297,6 @@ function remove_dokuwiki {
219 297
     if [ -f /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME ]; then
220 298
         rm /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
221 299
     fi
222
-    apt-get -yq remove --purge dokuwiki
223 300
     if [ ! -d /var/www/$DOKUWIKI_DOMAIN_NAME ]; then
224 301
         rm -rf /var/www/$DOKUWIKI_DOMAIN_NAME
225 302
     fi
@@ -244,61 +321,54 @@ function install_dokuwiki {
244 321
     if [ ! $DOKUWIKI_DOMAIN_NAME ]; then
245 322
         return
246 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 329
     if [ ! -d /var/www/$DOKUWIKI_DOMAIN_NAME ]; then
255 330
         mkdir /var/www/$DOKUWIKI_DOMAIN_NAME
256 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 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 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 372
     if [ -f $IMAGE_PASSWORD_FILE ]; then
303 373
         DOKUWIKI_ADMIN_PASSWORD="$(printf `cat $IMAGE_PASSWORD_FILE`)"
304 374
     else
@@ -307,17 +377,18 @@ function install_dokuwiki {
307 377
         fi
308 378
     fi
309 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 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 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 392
     fi
322 393
 
323 394
     DOKUWIKI_ONION_HOSTNAME=$(add_onion_service dokuwiki 80 ${DOKUWIKI_ONION_PORT})
@@ -379,10 +450,11 @@ function install_dokuwiki {
379 450
         echo '        try_files $uri $uri/ /index.php;' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
380 451
         echo '        # NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
381 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 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 458
         echo '        include fastcgi_params;' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
387 459
         echo '        fastcgi_index index.php;' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
388 460
         echo '        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
@@ -457,10 +529,11 @@ function install_dokuwiki {
457 529
     echo '        try_files $uri $uri/ /index.php;' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
458 530
     echo '        # NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
459 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 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 537
     echo '        include fastcgi_params;' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
465 538
     echo '        fastcgi_index index.php;' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
466 539
     echo '        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
@@ -491,7 +564,7 @@ function install_dokuwiki {
491 564
 
492 565
     nginx_ensite $DOKUWIKI_DOMAIN_NAME
493 566
 
494
-    systemctl restart php5-fpm
567
+    systemctl restart php7.0-fpm
495 568
     systemctl restart nginx
496 569
 
497 570
     function_check add_ddns_domain

+ 11
- 3
src/freedombone-app-emacs 查看文件

@@ -36,6 +36,14 @@ SHOW_ON_ABOUT=0
36 36
 emacs_variables=(USB_MOUNT
37 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 47
 function reconfigure_emacs {
40 48
     echo -n ''
41 49
 }
@@ -133,7 +141,7 @@ function restore_remote_emacs {
133 141
 }
134 142
 
135 143
 function remove_emacs {
136
-    apt-get -yq remove --purge emacs24
144
+    apt-get -yq remove --purge emacs
137 145
     update-alternatives --set editor /usr/bin/nano
138 146
     sed -i '/install_emacs/d' $COMPLETION_FILE
139 147
 
@@ -156,8 +164,8 @@ function remove_emacs {
156 164
 }
157 165
 
158 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 170
     # A minimal emacs configuration
163 171
     #echo -n "(add-to-list 'load-path " > /home/$MY_USERNAME/.emacs

+ 43
- 5
src/freedombone-app-etherpad 查看文件

@@ -13,7 +13,7 @@
13 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 18
 # This program is free software: you can redistribute it and/or modify
19 19
 # it under the terms of the GNU Affero General Public License as published by
@@ -52,6 +52,14 @@ etherpad_variables=(ONION_ONLY
52 52
                     DDNS_PROVIDER
53 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 63
 function etherpad_password_hash {
56 64
     echo $(python -c "from passlib.hash import bcrypt;print(bcrypt.encrypt(\"$1\", rounds=10))")
57 65
 }
@@ -62,7 +70,7 @@ function change_password_etherpad {
62 70
 
63 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 74
         user_line=$(cat /var/www/${ETHERPAD_DOMAIN_NAME}/htdocs/settings.json | grep "\"$change_username\": {")
67 75
         if [[ "$user_line" == *"\"is_admin\": true"* ]]; then
68 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,6 +310,11 @@ function reconfigure_etherpad {
302 310
 }
303 311
 
304 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 318
     read_config_param "ETHERPAD_DOMAIN_NAME"
306 319
 
307 320
     function_check set_repo_commit
@@ -355,6 +368,11 @@ function restore_local_etherpad {
355 368
         if [ -f /etc/ssl/private/${ETHERPAD_DOMAIN_NAME}.key ]; then
356 369
             chown etherpad: /etc/ssl/private/${ETHERPAD_DOMAIN_NAME}.key
357 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 376
     fi
359 377
 }
360 378
 
@@ -400,6 +418,11 @@ function restore_remote_etherpad {
400 418
         if [ -f /etc/ssl/private/${ETHERPAD_DOMAIN_NAME}.key ]; then
401 419
             chown etherpad: /etc/ssl/private/${ETHERPAD_DOMAIN_NAME}.key
402 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 426
     fi
404 427
 }
405 428
 
@@ -415,6 +438,7 @@ function remove_etherpad {
415 438
         systemctl disable etherpad
416 439
         rm /etc/systemd/system/etherpad.service
417 440
     fi
441
+    systemctl daemon-reload
418 442
     nginx_dissite $ETHERPAD_DOMAIN_NAME
419 443
     remove_certs $ETHERPAD_DOMAIN_NAME
420 444
     if [ -d /var/www/$ETHERPAD_DOMAIN_NAME ]; then
@@ -431,9 +455,11 @@ function remove_etherpad {
431 455
     remove_completion_param install_etherpad
432 456
     sed -i '/etherpad/d' $COMPLETION_FILE
433 457
     remove_backup_database_local etherpad
434
-    deluser --remove-all-files etherpad
435 458
     remove_nodejs etherpad
436 459
 
460
+    groupdel -f etherpad
461
+    userdel -r etherpad
462
+
437 463
     function_check remove_ddns_domain
438 464
     remove_ddns_domain $ETHERPAD_DOMAIN_NAME
439 465
 }
@@ -444,6 +470,8 @@ function install_etherpad {
444 470
         exit 7359
445 471
     fi
446 472
 
473
+    check_ram_availability 2000
474
+
447 475
     if [ -f $IMAGE_PASSWORD_FILE ]; then
448 476
         ETHERPAD_ADMIN_PASSWORD="$(printf `cat $IMAGE_PASSWORD_FILE`)"
449 477
     else
@@ -472,8 +500,17 @@ function install_etherpad {
472 500
         mkdir /var/www/$ETHERPAD_DOMAIN_NAME
473 501
     fi
474 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 514
         if [ ! -d /var/www/$ETHERPAD_DOMAIN_NAME/htdocs ]; then
478 515
             echo $'Unable to clone etherpad repo'
479 516
             exit 56382
@@ -612,6 +649,7 @@ function install_etherpad {
612 649
 
613 650
     set_completion_param "etherpad domain" "$ETHERPAD_DOMAIN_NAME"
614 651
 
652
+    systemctl restart mariadb
615 653
     systemctl enable etherpad
616 654
     systemctl daemon-reload
617 655
     systemctl start etherpad

+ 47
- 12
src/freedombone-app-friendica 查看文件

@@ -50,6 +50,14 @@ friendica_variables=(ONION_ONLY
50 50
                      FRIENDICA_REPO
51 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 61
 function remove_user_friendica {
54 62
     remove_username="$1"
55 63
     ${PROJECT_NAME}-pass -u $remove_username --rmapp friendica
@@ -213,6 +221,11 @@ function reconfigure_friendica {
213 221
 }
214 222
 
215 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 229
     FRIENDICA_PATH=/var/www/$FRIENDICA_DOMAIN_NAME/htdocs
217 230
 
218 231
     function_check set_repo_commit
@@ -247,6 +260,11 @@ function restore_local_friendica {
247 260
         if [ -d $temp_restore_dir ]; then
248 261
             rm -rf $temp_restore_dir
249 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 268
     fi
251 269
 }
252 270
 
@@ -282,6 +300,11 @@ function restore_remote_friendica {
282 300
     if [ -d /root/tempfriendica ]; then
283 301
         rm -rf /root/tempfriendica
284 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 310
 function remove_friendica {
@@ -327,9 +350,9 @@ function install_friendica {
327 350
     function_check repair_databases_script
328 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 357
     if [ ! -d /var/www/$FRIENDICA_DOMAIN_NAME ]; then
335 358
         mkdir /var/www/$FRIENDICA_DOMAIN_NAME
@@ -340,8 +363,17 @@ function install_friendica {
340 363
 
341 364
     if [ ! -f $FRIENDICA_PATH/index.php ]; then
342 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 377
         git checkout $FRIENDICA_COMMIT -b $FRIENDICA_COMMIT
346 378
         set_completion_param "friendica commit" "$FRIENDICA_COMMIT"
347 379
 
@@ -425,11 +457,12 @@ function install_friendica {
425 457
         echo '        try_files $uri $uri/ /index.php;' >> /etc/nginx/sites-available/$FRIENDICA_DOMAIN_NAME
426 458
         echo '        # NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini' >> /etc/nginx/sites-available/$FRIENDICA_DOMAIN_NAME
427 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 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 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 466
         echo '        fastcgi_index index.php;' >> /etc/nginx/sites-available/$FRIENDICA_DOMAIN_NAME
434 467
         echo '        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;' >> /etc/nginx/sites-available/$FRIENDICA_DOMAIN_NAME
435 468
         echo '        fastcgi_read_timeout 300;' >> /etc/nginx/sites-available/$FRIENDICA_DOMAIN_NAME
@@ -493,11 +526,12 @@ function install_friendica {
493 526
         echo '        try_files $uri $uri/ /index.php;' >> /etc/nginx/sites-available/$FRIENDICA_DOMAIN_NAME
494 527
         echo '        # NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini' >> /etc/nginx/sites-available/$FRIENDICA_DOMAIN_NAME
495 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 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 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 535
         echo '        fastcgi_index index.php;' >> /etc/nginx/sites-available/$FRIENDICA_DOMAIN_NAME
502 536
         echo '        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;' >> /etc/nginx/sites-available/$FRIENDICA_DOMAIN_NAME
503 537
         echo '        fastcgi_read_timeout 300;' >> /etc/nginx/sites-available/$FRIENDICA_DOMAIN_NAME
@@ -588,7 +622,8 @@ function install_friendica {
588 622
     chown www-data:www-data $FRIENDICA_PATH/.htconfig.php
589 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 627
     systemctl restart nginx
593 628
     systemctl restart cron
594 629
 

+ 125
- 6
src/freedombone-app-ghost 查看文件

@@ -9,6 +9,7 @@
9 9
 #                    Freedom in the Cloud
10 10
 #
11 11
 # Ghost blog
12
+# Only works with nodejs version ^6.9.0
12 13
 #
13 14
 # License
14 15
 # =======
@@ -37,8 +38,8 @@ GHOST_DOMAIN_NAME=
37 38
 GHOST_CODE=
38 39
 GHOST_ONION_PORT=8104
39 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 43
 GHOST_DOWNLOAD_URL="https://github.com/TryGhost/Ghost/releases/download/${GHOST_VERSION}/Ghost-${GHOST_VERSION}.zip"
43 44
 
44 45
 ghost_variables=(GHOST_DOMAIN_NAME
@@ -48,6 +49,14 @@ ghost_variables=(GHOST_DOMAIN_NAME
48 49
                  DDNS_PROVIDER
49 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 60
 function ghost_replace_jquery {
52 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 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,7 +179,7 @@ function upgrade_ghost {
170 179
     GHOST_PATH=/var/www/$GHOST_DOMAIN_NAME/htdocs
171 180
 
172 181
     cd $GHOST_PATH
173
-    if [ ! -f ghost-${GHOST_VERSION}.zip ]; then
182
+    if [ ! -f Ghost-${GHOST_VERSION}.zip ]; then
174 183
         wget ${GHOST_DOWNLOAD_URL}
175 184
     fi
176 185
     if [ ! -f Ghost-${GHOST_VERSION}.zip ]; then
@@ -233,6 +242,28 @@ function restore_local_ghost {
233 242
         function_check restore_database
234 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 267
         systemctl start ghost
237 268
         restart_site
238 269
     fi
@@ -273,6 +304,29 @@ function restore_remote_ghost {
273 304
     ghost_create_database
274 305
 
275 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 330
     systemctl start ghost
277 331
     restart_site
278 332
     chown -R ghost: /var/www/$GHOST_DOMAIN_NAME/htdocs/
@@ -286,6 +340,7 @@ function remove_ghost {
286 340
     systemctl stop ghost
287 341
     systemctl disable ghost
288 342
     rm /etc/systemd/system/ghost.service
343
+    systemctl daemon-reload
289 344
 
290 345
     function_check remove_nodejs
291 346
     remove_nodejs ghost
@@ -296,7 +351,6 @@ function remove_ghost {
296 351
     read_config_param "GHOST_DOMAIN_NAME"
297 352
     nginx_dissite $GHOST_DOMAIN_NAME
298 353
     remove_certs ${GHOST_DOMAIN_NAME}
299
-    deluser --remove-all-files ghost
300 354
     if [ -f /etc/nginx/sites-available/$GHOST_DOMAIN_NAME ]; then
301 355
         rm -f /etc/nginx/sites-available/$GHOST_DOMAIN_NAME
302 356
     fi
@@ -311,6 +365,9 @@ function remove_ghost {
311 365
     sed -i '/Ghost/d' $COMPLETION_FILE
312 366
     sed -i '/ghost/d' $COMPLETION_FILE
313 367
 
368
+    groupdel -f ghost
369
+    userdel -r ghost
370
+
314 371
     function_check remove_ddns_domain
315 372
     remove_ddns_domain $GHOST_DOMAIN_NAME
316 373
 }
@@ -318,6 +375,9 @@ function remove_ghost {
318 375
 function ghost_create_config {
319 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 381
     echo "var path = require('path')," > $ghost_config
322 382
     echo '    config;' >> $ghost_config
323 383
     echo '' >> $ghost_config
@@ -393,7 +453,9 @@ function install_ghost {
393 453
         mkdir -p /var/www/$GHOST_DOMAIN_NAME/htdocs
394 454
     fi
395 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 459
     if [ ! -f Ghost-${GHOST_VERSION}.zip ]; then
398 460
         echo $'Unable to download ghost'
399 461
         rm -rf /var/www/$GHOST_DOMAIN_NAME
@@ -418,6 +480,60 @@ function install_ghost {
418 480
     install_nodejs ghost
419 481
 
420 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 537
     npm install --production
422 538
 
423 539
     function_check install_mariadb
@@ -432,7 +548,7 @@ function install_ghost {
432 548
     ghost_create_config
433 549
 
434 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 553
     echo '[Unit]' > /etc/systemd/system/ghost.service
438 554
     echo 'Description=Ghost Blog' >> /etc/systemd/system/ghost.service
@@ -540,6 +656,7 @@ function install_ghost {
540 656
 
541 657
     if [[ $ONION_ONLY != 'no' ]]; then
542 658
         sed -i "s|url: .*|url: 'http://${GHOST_ONION_HOSTNAME}',|g" /var/www/${GHOST_DOMAIN_NAME}/htdocs/config.js
659
+        systemctl restart mariadb
543 660
         systemctl restart ghost
544 661
     fi
545 662
 
@@ -549,12 +666,14 @@ function install_ghost {
549 666
     nginx_ensite $GHOST_DOMAIN_NAME
550 667
 
551 668
     systemctl restart nginx
669
+    systemctl restart mariadb
552 670
 
553 671
     ${PROJECT_NAME}-pass -u $MY_USERNAME -a ghost -p "$GHOST_ADMIN_PASSWORD"
554 672
 
555 673
     function_check add_ddns_domain
556 674
     add_ddns_domain $GHOST_DOMAIN_NAME
557 675
 
676
+    chown -R ghost: /var/www/${GHOST_DOMAIN_NAME}/htdocs
558 677
     set_completion_param "ghost domain" "$GHOST_DOMAIN_NAME"
559 678
     if ! grep -q "ghost version:" ${COMPLETION_FILE}; then
560 679
         echo "ghost version:${GHOST_VERSION}" >> ${COMPLETION_FILE}

+ 159
- 232
src/freedombone-app-gnusocial 查看文件

@@ -37,18 +37,10 @@ GNUSOCIAL_DOMAIN_NAME=
37 37
 GNUSOCIAL_CODE=
38 38
 GNUSOCIAL_ONION_PORT=8087
39 39
 GNUSOCIAL_REPO="https://git.gnu.io/gnu/gnu-social.git"
40
-GNUSOCIAL_COMMIT='1517deeeb621a0256106d0108855e8827713e2cc'
40
+GNUSOCIAL_COMMIT='05a9c11c476b384e5ef3f3cc83b66406fcf7a378'
41 41
 GNUSOCIAL_ADMIN_PASSWORD=
42 42
 
43 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 45
 GNUSOCIAL_TITLE='Pleroma FE'
54 46
 
@@ -61,16 +53,18 @@ gnusocial_variables=(ONION_ONLY
61 53
                      GNUSOCIAL_WELCOME_MESSAGE
62 54
                      GNUSOCIAL_BACKGROUND_IMAGE_URL
63 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 56
                      GNUSOCIAL_TITLE
71 57
                      GNUSOCIAL_EXPIRE_MONTHS
72 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 68
 function gnusocial_fix_endless_reloads {
75 69
     # This fixes a bug introduced with commit 5f7032dfee1fd202c14e76a9f8b37af35d584901
76 70
     # and which causes OrFox to endlessly reload the page
@@ -311,15 +305,14 @@ function configure_interactive_gnusocial {
311 305
         trap "rm -f $data" 0 1 2 5 15
312 306
         dialog --backtitle $"Freedombone Control Panel" \
313 307
                --title $"GNU Social" \
314
-               --radiolist $"Choose an operation:" 17 70 8 \
308
+               --radiolist $"Choose an operation:" 16 70 7 \
315 309
                1 $"Set a background image" off \
316 310
                2 $"Set the title" off \
317 311
                3 $"Set post expiry period (currently $GNUSOCIAL_EXPIRE_MONTHS months)" off \
318 312
                4 $"Select Qvitter user interface" off \
319 313
                5 $"Select Pleroma user interface" off \
320 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 316
         sel=$?
324 317
         case $sel in
325 318
             1) return;;
@@ -332,13 +325,17 @@ function configure_interactive_gnusocial {
332 325
             4) gnusocial_use_qvitter gnusocial;;
333 326
             5) gnusocial_use_pleroma gnusocial;;
334 327
             6) gnusocial_use_classic gnusocial;;
335
-            7) gnusocial_use_armadillo gnusocial;;
336
-            8) break;;
328
+            7) break;;
337 329
         esac
338 330
     done
339 331
 }
340 332
 
341 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 339
     if grep -q "gnusocial domain" $COMPLETION_FILE; then
343 340
         GNUSOCIAL_DOMAIN_NAME=$(get_completion_param "gnusocial domain")
344 341
     fi
@@ -364,7 +361,9 @@ function upgrade_gnusocial {
364 361
     gnusocial_block_domain_script gnusocial $GNUSOCIAL_DOMAIN_NAME
365 362
 
366 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 367
     install_gnusocial_default_background "gnusocial" "$GNUSOCIAL_DOMAIN_NAME"
369 368
     chown -R www-data:www-data /var/www/${GNUSOCIAL_DOMAIN_NAME}/htdocs
370 369
 }
@@ -376,21 +375,34 @@ function backup_local_gnusocial {
376 375
         GNUSOCIAL_DOMAIN_NAME=$(get_completion_param "gnusocial domain")
377 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 408
 function restore_local_gnusocial {
@@ -404,68 +416,116 @@ function restore_local_gnusocial {
404 416
         gnusocial_dir=/var/www/${GNUSOCIAL_DOMAIN_NAME}/htdocs
405 417
         # stop the daemons
406 418
         cd $gnusocial_dir
407
-        su -c "sh scripts/stopdaemons.sh" -s /bin/sh www-data
419
+        scripts/stopdaemons.sh
408 420
 
409 421
         function_check gnusocial_create_database
410 422
         gnusocial_create_database
411 423
 
412
-        restore_database gnusocial ${GNUSOCIAL_DOMAIN_NAME}
424
+        restore_database gnusocial
413 425
         if [ -d $temp_restore_dir ]; then
414 426
             rm -rf $temp_restore_dir
415 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 448
         echo $"Restore of gnusocial complete"
421 449
     fi
422 450
 }
423 451
 
424 452
 function backup_remote_gnusocial {
453
+    GNUSOCIAL_DOMAIN_NAME='gnusocial'
425 454
     if grep -q "gnusocial domain" $COMPLETION_FILE; then
426 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 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 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 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 501
         function_check gnusocial_create_database
458 502
         gnusocial_create_database
459 503
 
460 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 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 529
         echo $"Restore of gnusocial complete"
470 530
     fi
471 531
 }
@@ -486,8 +546,8 @@ function remove_gnusocial {
486 546
         rm /etc/cron.hourly/gnusocial-daemons
487 547
     fi
488 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 551
     fi
492 552
     kill_pid=$(ps aux | grep /var/www/$GNUSOCIAL_DOMAIN_NAME/htdocs/scripts/queuedaemon.php | awk -F ' ' '{print $2}' | head -n 1)
493 553
     kill -9 $kill_pid
@@ -537,15 +597,24 @@ function install_gnusocial_main {
537 597
     function_check repair_databases_script
538 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 603
     if [ ! -d /var/www/$GNUSOCIAL_DOMAIN_NAME ]; then
544 604
         mkdir /var/www/$GNUSOCIAL_DOMAIN_NAME
545 605
     fi
546 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 618
         if [ ! -d /var/www/$GNUSOCIAL_DOMAIN_NAME/htdocs ]; then
550 619
             echo $'Unable to clone gnusocial repo'
551 620
             exit 87525
@@ -580,6 +649,8 @@ function install_gnusocial_main {
580 649
     function_check add_ddns_domain
581 650
     add_ddns_domain $GNUSOCIAL_DOMAIN_NAME
582 651
 
652
+    GNUSOCIAL_ONION_HOSTNAME=$(add_onion_service gnusocial 80 ${GNUSOCIAL_ONION_PORT})
653
+
583 654
     gnusocial_nginx_site=/etc/nginx/sites-available/$GNUSOCIAL_DOMAIN_NAME
584 655
     if [[ $ONION_ONLY == "no" ]]; then
585 656
         function_check nginx_http_redirect
@@ -614,7 +685,8 @@ function install_gnusocial_main {
614 685
         echo '  # PHP' >> $gnusocial_nginx_site
615 686
         echo '  location ~ \.php {' >> $gnusocial_nginx_site
616 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 690
         echo '  }' >> $gnusocial_nginx_site
619 691
         echo '' >> $gnusocial_nginx_site
620 692
         echo '  # Location' >> $gnusocial_nginx_site
@@ -641,7 +713,7 @@ function install_gnusocial_main {
641 713
     fi
642 714
     echo 'server {' >> $gnusocial_nginx_site
643 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 717
     echo '' >> $gnusocial_nginx_site
646 718
     function_check nginx_compress
647 719
     nginx_compress $GNUSOCIAL_DOMAIN_NAME
@@ -662,7 +734,8 @@ function install_gnusocial_main {
662 734
     echo '  # PHP' >> $gnusocial_nginx_site
663 735
     echo '  location ~ \.php {' >> $gnusocial_nginx_site
664 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 739
     echo '  }' >> $gnusocial_nginx_site
667 740
     echo '' >> $gnusocial_nginx_site
668 741
     echo '  # Location' >> $gnusocial_nginx_site
@@ -710,8 +783,6 @@ function install_gnusocial_main {
710 783
         gnusocial_ssl='never'
711 784
     fi
712 785
 
713
-    GNUSOCIAL_ONION_HOSTNAME=$(add_onion_service gnusocial 80 ${GNUSOCIAL_ONION_PORT})
714
-
715 786
     GNUSOCIAL_SERVER=${GNUSOCIAL_DOMAIN_NAME}
716 787
     if [[ $ONION_ONLY != 'no' ]]; then
717 788
         GNUSOCIAL_SERVER=${GNUSOCIAL_ONION_HOSTNAME}
@@ -770,7 +841,8 @@ function install_gnusocial_main {
770 841
     # This improves performance
771 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 846
     systemctl restart nginx
775 847
 
776 848
     ${PROJECT_NAME}-addemail -u $MY_USERNAME -e "noreply@$GNUSOCIAL_DOMAIN_NAME" -g gnusocial --public no
@@ -784,159 +856,6 @@ function install_gnusocial_main {
784 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 859
 function install_gnusocial {
941 860
     if [ ! $ONION_ONLY ]; then
942 861
         ONION_ONLY='no'
@@ -945,9 +864,9 @@ function install_gnusocial {
945 864
     install_gnusocial_main
946 865
     expire_gnusocial_posts "$GNUSOCIAL_DOMAIN_NAME" "gnusocial" "$GNUSOCIAL_EXPIRE_MONTHS"
947 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 871
     # Currently Pleroma won't install on ARM systems
953 872
     # because it uses node-sass which doesn't support ARM
@@ -967,6 +886,14 @@ function install_gnusocial {
967 886
 
968 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 897
     APP_INSTALLED=1
971 898
 }
972 899
 

+ 39
- 2
src/freedombone-app-gogs 查看文件

@@ -13,7 +13,7 @@
13 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 18
 # This program is free software: you can redistribute it and/or modify
19 19
 # it under the terms of the GNU Affero General Public License as published by
@@ -51,6 +51,14 @@ gogs_variables=(ONION_ONLY
51 51
                 DDNS_PROVIDER
52 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 62
 function change_password_gogs {
55 63
     curr_username="$1"
56 64
     new_user_password="$2"
@@ -102,12 +110,15 @@ function gogs_parameters {
102 110
         ARCHITECTURE=$(uname -m)
103 111
         if [[ ${ARCHITECTURE} == "arm"* ]]; then
104 112
             CURR_ARCH=armv5
113
+            echo $"Using $CURR_ARCH"
105 114
         fi
106 115
         if [[ ${ARCHITECTURE} == "amd"* || ${ARCHITECTURE} == "x86_64" ]]; then
107 116
             CURR_ARCH=amd64
117
+            echo $"Using $CURR_ARCH"
108 118
         fi
109 119
         if [[ ${ARCHITECTURE} == *"386" || ${ARCHITECTURE} == *"686" ]]; then
110 120
             CURR_ARCH=386
121
+            echo $"Using $CURR_ARCH"
111 122
         fi
112 123
     fi
113 124
 
@@ -192,6 +203,7 @@ function upgrade_gogs {
192 203
     rm $INSTALL_DIR/gogs_config.ini
193 204
 
194 205
     sed -i "s|gogs version.*|gogs version:$GOGS_VERSION|g" ${COMPLETION_FILE}
206
+    systemctl restart mariadb
195 207
     systemctl restart gogs
196 208
 }
197 209
 
@@ -275,6 +287,12 @@ function restore_local_gogs {
275 287
             rm -rf ${temp_restore_dir}ssh
276 288
             chown -R ${GOGS_USERNAME}:${GOGS_USERNAME} /home/${GOGS_USERNAME}
277 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 296
     fi
279 297
 }
280 298
 
@@ -345,6 +363,12 @@ function restore_remote_gogs {
345 363
             chown -R ${GOGS_USERNAME}:${GOGS_USERNAME} /home/${GOGS_USERNAME}
346 364
             echo $"Restore of Gogs complete"
347 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 372
     fi
349 373
 }
350 374
 
@@ -354,6 +378,7 @@ function remove_gogs {
354 378
     fi
355 379
     systemctl stop gogs
356 380
     systemctl disable gogs
381
+
357 382
     nginx_dissite ${GIT_DOMAIN_NAME}
358 383
     remove_certs ${GIT_DOMAIN_NAME}
359 384
     if [ -d /var/www/${GIT_DOMAIN_NAME} ]; then
@@ -365,12 +390,16 @@ function remove_gogs {
365 390
     function_check drop_database
366 391
     drop_database gogs
367 392
     rm /etc/systemd/system/gogs.service
393
+    systemctl daemon-reload
368 394
     rm -rf /home/${GOGS_USERNAME}/*
369 395
     remove_onion_service gogs ${GIT_ONION_PORT} 9418
370 396
     remove_completion_param "install_gogs"
371 397
     sed -i '/gogs /d' $COMPLETION_FILE
372 398
     remove_backup_database_local gogs
373 399
 
400
+    groupdel -f gogs
401
+    userdel -r gogs
402
+
374 403
     function_check remove_ddns_domain
375 404
     remove_ddns_domain $GIT_DOMAIN_NAME
376 405
 }
@@ -382,6 +411,13 @@ function install_gogs {
382 411
 
383 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 421
     gogs_parameters
386 422
 
387 423
     if [ ! -d ${INSTALL_DIR} ]; then
@@ -575,7 +611,8 @@ function install_gogs {
575 611
 
576 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 616
     systemctl restart nginx
580 617
 
581 618
     set_completion_param "gogs domain" "$GIT_DOMAIN_NAME"

+ 33
- 9
src/freedombone-app-htmly 查看文件

@@ -50,6 +50,14 @@ htmly_variables=(HTMLY_REPO
50 50
                  DDNS_PROVIDER
51 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 61
 function set_avatar_from_url {
54 62
     AVATAR="$1"
55 63
 
@@ -192,6 +200,11 @@ function reconfigure_htmly {
192 200
 }
193 201
 
194 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 208
     read_config_param "HTMLY_DOMAIN_NAME"
196 209
 
197 210
     function_check set_repo_commit
@@ -462,11 +475,12 @@ function install_htmly_website {
462 475
     echo '        try_files $uri $uri/ /index.php;' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
463 476
     echo '        # NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
464 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 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 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 484
     echo '        fastcgi_index index.php;' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
471 485
     echo '        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
472 486
     echo '    }' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
@@ -541,11 +555,12 @@ function install_htmly_website_onion {
541 555
     echo '        try_files $uri $uri/ /index.php;' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
542 556
     echo '        # NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
543 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 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 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 564
     echo '        fastcgi_index index.php;' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
550 565
     echo '        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
551 566
     echo '    }' >> /etc/nginx/sites-available/$HTMLY_DOMAIN_NAME
@@ -574,7 +589,16 @@ function install_htmly_from_repo {
574 589
     fi
575 590
 
576 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 602
     cd htdocs
579 603
     git checkout $HTMLY_COMMIT -b $HTMLY_COMMIT
580 604
     set_completion_param "htmly commit" "$HTMLY_COMMIT"
@@ -591,7 +615,7 @@ function install_htmly {
591 615
     fi
592 616
 
593 617
     # for the avatar changing command
594
-    apt-get -yq install imagemagick
618
+    apt-get -yq install imagemagick libfcgi0ldbl
595 619
 
596 620
     function_check install_htmly_from_repo
597 621
     install_htmly_from_repo
@@ -627,7 +651,7 @@ function install_htmly {
627 651
     function_check nginx_ensite
628 652
     nginx_ensite $HTMLY_DOMAIN_NAME
629 653
 
630
-    systemctl restart php5-fpm
654
+    systemctl restart php7.0-fpm
631 655
     systemctl restart nginx
632 656
 
633 657
     ${PROJECT_NAME}-pass -u $MY_USERNAME -a htmly -p "$HTMLY_ADMIN_PASSWORD"

+ 61
- 17
src/freedombone-app-hubzilla 查看文件

@@ -13,7 +13,7 @@
13 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 18
 # This program is free software: you can redistribute it and/or modify
19 19
 # it under the terms of the GNU Affero General Public License as published by
@@ -51,6 +51,14 @@ hubzilla_variables=(ONION_ONLY
51 51
                     HUBZILLA_REPO
52 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 62
 function remove_user_hubzilla {
55 63
     remove_username="$1"
56 64
     ${PROJECT_NAME}-pass -u $remove_username --rmapp hubzilla
@@ -196,6 +204,11 @@ function reconfigure_hubzilla {
196 204
 }
197 205
 
198 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 212
     HUBZILLA_PATH=/var/www/$HUBZILLA_DOMAIN_NAME/htdocs
200 213
 
201 214
     function_check set_repo_commit
@@ -238,6 +251,11 @@ function restore_local_hubzilla {
238 251
         if [ -d $temp_restore_dir ]; then
239 252
             rm -rf $temp_restore_dir
240 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 259
     fi
242 260
 }
243 261
 
@@ -273,6 +291,11 @@ function restore_remote_hubzilla {
273 291
     if [ -d /root/temphubzilla ]; then
274 292
         rm -rf /root/temphubzilla
275 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 301
 function remove_hubzilla {
@@ -304,7 +327,8 @@ function install_hubzilla {
304 327
     fi
305 328
 
306 329
     if [[ $ONION_ONLY != "no" ]]; then
307
-        return
330
+        echo $"Hubzilla won't work on an onion address"
331
+        exit 529925
308 332
     fi
309 333
 
310 334
     HUBZILLA_PATH=/var/www/$HUBZILLA_DOMAIN_NAME/htdocs
@@ -318,9 +342,9 @@ function install_hubzilla {
318 342
     function_check repair_databases_script
319 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 349
     if [ ! -d /var/www/$HUBZILLA_DOMAIN_NAME ]; then
326 350
         mkdir /var/www/$HUBZILLA_DOMAIN_NAME
@@ -331,22 +355,39 @@ function install_hubzilla {
331 355
 
332 356
     if [ ! -f $HUBZILLA_PATH/index.php ]; then
333 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 369
         git checkout $HUBZILLA_COMMIT -b $HUBZILLA_COMMIT
337 370
         set_completion_param "hubzilla commit" "$HUBZILLA_COMMIT"
338 371
 
339 372
         rm -rf $HUBZILLA_PATH
340 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 384
         cd $HUBZILLA_PATH/addon
344 385
         git checkout $HUBZILLA_ADDONS_COMMIT -b $HUBZILLA_ADDONS_COMMIT
345 386
         set_completion_param "hubzilla addons commit" "$HUBZILLA_ADDONS_COMMIT"
346 387
 
347 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 392
         chown -R www-data:www-data $HUBZILLA_PATH
352 393
     fi
@@ -420,11 +461,12 @@ function install_hubzilla {
420 461
         echo '        try_files $uri $uri/ /index.php;' >> /etc/nginx/sites-available/$HUBZILLA_DOMAIN_NAME
421 462
         echo '        # NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini' >> /etc/nginx/sites-available/$HUBZILLA_DOMAIN_NAME
422 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 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 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 470
         echo '        fastcgi_index index.php;' >> /etc/nginx/sites-available/$HUBZILLA_DOMAIN_NAME
429 471
         echo '        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;' >> /etc/nginx/sites-available/$HUBZILLA_DOMAIN_NAME
430 472
         echo '        fastcgi_read_timeout 300;' >> /etc/nginx/sites-available/$HUBZILLA_DOMAIN_NAME
@@ -488,11 +530,12 @@ function install_hubzilla {
488 530
         echo '        try_files $uri $uri/ /index.php;' >> /etc/nginx/sites-available/$HUBZILLA_DOMAIN_NAME
489 531
         echo '        # NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini' >> /etc/nginx/sites-available/$HUBZILLA_DOMAIN_NAME
490 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 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 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 539
         echo '        fastcgi_index index.php;' >> /etc/nginx/sites-available/$HUBZILLA_DOMAIN_NAME
497 540
         echo '        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;' >> /etc/nginx/sites-available/$HUBZILLA_DOMAIN_NAME
498 541
         echo '        fastcgi_read_timeout 300;' >> /etc/nginx/sites-available/$HUBZILLA_DOMAIN_NAME
@@ -583,7 +626,8 @@ function install_hubzilla {
583 626
     chown www-data:www-data $HUBZILLA_PATH/.htconfig.php
584 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 631
     systemctl restart nginx
588 632
     systemctl restart cron
589 633
 

+ 23
- 3
src/freedombone-app-ipfs 查看文件

@@ -48,6 +48,14 @@ ipfs_variables=(IPFS_GO_VERSION
48 48
                 IPFS_KEY_LENGTH
49 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 59
 function install_interactive_ipfs {
52 60
     echo -n ''
53 61
     APP_INSTALLED=1
@@ -58,6 +66,11 @@ function reconfigure_ipfs {
58 66
 }
59 67
 
60 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 74
     if [[ $(app_is_installed ipfs_go) == "0" ]]; then
62 75
         return
63 76
     fi
@@ -155,6 +168,7 @@ function remove_ipfs_go {
155 168
     systemctl disable ipfs
156 169
     systemctl daemon-reload
157 170
     rm /etc/systemd/system/ipfs.service
171
+    systemctl daemon-reload
158 172
     rm -rf $GOPATH/src/github.com/ipfs
159 173
     firewall_remove $IPFS_PORT tcp
160 174
     remove_completion_param install_ipfs
@@ -199,8 +213,7 @@ function mesh_install_ipfs_js {
199 213
         return
200 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 217
     chroot ${rootdir} apt-get -yq install libpam0g-dev fuse
205 218
 
206 219
     if [ ! -f ${rootdir}/usr/bin/nodejs ]; then
@@ -395,12 +408,15 @@ function mesh_install_ipfs_go {
395 408
         ARCHITECTURE=$(uname -m)
396 409
         if [[ $ARCHITECTURE == "arm"* ]]; then
397 410
             IPFS_ARCH=arm
411
+            echo $"Using $IPFS_ARCH"
398 412
         fi
399 413
         if [[ $ARCHITECTURE == "amd"* || $ARCHITECTURE == "x86_64" ]]; then
400 414
             IPFS_ARCH=amd64
415
+            echo $"Using $IPFS_ARCH"
401 416
         fi
402 417
         if [[ $ARCHITECTURE == *"386" || $ARCHITECTURE == *"686" ]]; then
403 418
             IPFS_ARCH=386
419
+            echo $"Using $IPFS_ARCH"
404 420
         fi
405 421
     fi
406 422
 
@@ -451,6 +467,10 @@ function install_ipfs_go {
451 467
     if [ ! -d /home/git ]; then
452 468
         # add a gogs user account
453 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 475
         # install Go
456 476
         if ! grep -q "export GOPATH=" ~/.bashrc; then
@@ -510,7 +530,7 @@ function install_ipfs_go {
510 530
     fi
511 531
 
512 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 534
     if [ ! -d /home/$MY_USERNAME/.ipfs ]; then
515 535
         echo "IPFS could not be initialised for user $MY_USERNAME"
516 536
         exit 7358

+ 14
- 2
src/freedombone-app-irc 查看文件

@@ -54,6 +54,14 @@ irc_variables=(MY_USERNAME
54 54
                IRC_BUFFER_LENGTH
55 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 65
 function irc_get_global_password {
58 66
     echo $(cat /etc/ngircd/ngircd.conf | grep "Password =" | head -n 1 | awk -F '=' '{print $2}')
59 67
 }
@@ -544,7 +552,7 @@ function install_irc_server {
544 552
     else
545 553
         sed -i 's|;SSLConnect.*|SSLConnect = no|g'
546 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 556
             sed -i '0,/Ports =/! s/Ports =/;Ports =/' /etc/ngircd/ngircd.conf
549 557
         fi
550 558
     fi
@@ -613,9 +621,13 @@ function install_irc_bouncer {
613 621
         return
614 622
     fi
615 623
 
616
-    apt-get -yq -t jessie-backports install znc
624
+    apt-get -yq install znc
617 625
 
618 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 632
     mkdir -p /home/znc/.znc/configs
621 633
     mkdir -p /home/znc/.znc/users

+ 13
- 5
src/freedombone-app-jitsi 查看文件

@@ -51,24 +51,32 @@ jitsi_variables=(ONION_ONLY
51 51
                  DEFAULT_DOMAIN_NAME
52 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 62
 function jitsi_disable_google_spyware {
55 63
     # Presumably they included Google Analytics for benign reasons, but it's
56 64
     # an obvious security problem. This should disable it.
57 65
     sed -i "s|Google Analytics|Google Spyware deactivated|g" /usr/share/jitsi-meet/analytics.js
58 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 68
         sed -i 's|ga(|//ga(|g' /usr/share/jitsi-meet/analytics.js
61 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 71
         sed -i 's|action +|//action +|g' /usr/share/jitsi-meet/analytics.js
64 72
     fi
65 73
 
66 74
     sed -i "s|Google Analytics|Google Spyware deactivated|g" /usr/share/jitsi-meet/libs/analytics.js
67 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 77
         sed -i 's|ga(|//ga(|g' /usr/share/jitsi-meet/libs/analytics.js
70 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 80
         sed -i 's|action +|//action +|g' /usr/share/jitsi-meet/libs/analytics.js
73 81
     fi
74 82
 }
@@ -230,7 +238,7 @@ function install_jitsi {
230 238
         remove_nodejs jitsi
231 239
         exit 638352
232 240
     fi
233
-    if ! grep "jitsi" /etc/apt/sources.list; then
241
+    if ! grep -q "jitsi" /etc/apt/sources.list; then
234 242
         echo "deb http://download.jitsi.org/nightly/deb ${jitsi_deb_repo}/" >> /etc/apt/sources.list
235 243
     fi
236 244
     wget -qO - https://download.jitsi.org/nightly/deb/${jitsi_deb_repo}/archive.key | apt-key add -

+ 61
- 17
src/freedombone-app-koel 查看文件

@@ -39,7 +39,7 @@ KOEL_CODE=
39 39
 KOEL_ONION_PORT=8118
40 40
 KOEL_PORT=9002
41 41
 KOEL_REPO="https://github.com/phanan/koel"
42
-KOEL_COMMIT='70464a8977b1058f3bd0a4ec77877fe7894d8d84'
42
+KOEL_COMMIT='70464a'
43 43
 KOEL_ADMIN_PASSWORD=
44 44
 
45 45
 koel_variables=(ONION_ONLY
@@ -49,6 +49,14 @@ koel_variables=(ONION_ONLY
49 49
                 MY_EMAIL_ADDRESS
50 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 60
 function koel_remove_gravatar {
53 61
     cd /var/www/${KOEL_DOMAIN_NAME}/htdocs
54 62
     sed -i "s|www.gravatar.com|${KOEL_DOMAIN_NAME}|g" node_modules/browser-sync-ui/public/js/app.js.map
@@ -323,7 +331,7 @@ function backup_local_koel {
323 331
 
324 332
     source_directory=/var/www/${KOEL_DOMAIN_NAME}/htdocs
325 333
     if [ -d $source_directory ]; then
326
-        systemctl stop koal
334
+        systemctl stop koel
327 335
 
328 336
         dest_directory=koel
329 337
         function_check suspend_site
@@ -338,7 +346,7 @@ function backup_local_koel {
338 346
         function_check restart_site
339 347
         restart_site
340 348
 
341
-        systemctl start koal
349
+        systemctl start koel
342 350
     fi
343 351
 }
344 352
 
@@ -349,7 +357,7 @@ function restore_local_koel {
349 357
     KOEL_DOMAIN_NAME=$(get_completion_param "koel domain")
350 358
     if [ $KOEL_DOMAIN_NAME ]; then
351 359
         echo $"Restoring koel"
352
-        systemctl stop koal
360
+        systemctl stop koel
353 361
 
354 362
         temp_restore_dir=/root/tempkoel
355 363
         koel_dir=/var/www/${KOEL_DOMAIN_NAME}/htdocs
@@ -361,7 +369,13 @@ function restore_local_koel {
361 369
         if [ -d $temp_restore_dir ]; then
362 370
             rm -rf $temp_restore_dir
363 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 379
     fi
366 380
 }
367 381
 
@@ -370,7 +384,7 @@ function backup_remote_koel {
370 384
         KOEL_DOMAIN_NAME=$(get_completion_param "koel domain")
371 385
         temp_backup_dir=/var/www/${KOEL_DOMAIN_NAME}/htdocs
372 386
         if [ -d $temp_backup_dir ]; then
373
-            systemctl stop koal
387
+            systemctl stop koel
374 388
 
375 389
             function_check suspend_site
376 390
             suspend_site ${KOEL_DOMAIN_NAME}
@@ -386,7 +400,7 @@ function backup_remote_koel {
386 400
             function_check restart_site
387 401
             restart_site
388 402
 
389
-            systemctl start koal
403
+            systemctl start koel
390 404
         else
391 405
             echo $"koel domain specified but not found in ${temp_backup_dir}"
392 406
         fi
@@ -397,7 +411,7 @@ function restore_remote_koel {
397 411
     if grep -q "koel domain" $COMPLETION_FILE; then
398 412
         echo $"Restoring koel"
399 413
 
400
-        systemctl stop koal
414
+        systemctl stop koel
401 415
 
402 416
         KOEL_DOMAIN_NAME=$(get_completion_param "koel domain")
403 417
 
@@ -410,7 +424,12 @@ function restore_remote_koel {
410 424
             rm -rf /root/tempkoel
411 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 434
         echo $"Restore of koel complete"
416 435
     fi
@@ -426,6 +445,7 @@ function remove_koel {
426 445
     if [ -f /etc/systemd/system/koel.service ]; then
427 446
         rm /etc/systemd/system/koel.service
428 447
     fi
448
+    systemctl daemon-reload
429 449
 
430 450
     function_check remove_nodejs
431 451
     remove_nodejs koel
@@ -479,15 +499,25 @@ function install_koel_main {
479 499
     function_check repair_databases_script
480 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 506
     if [ ! -d /var/www/$KOEL_DOMAIN_NAME ]; then
486 507
         mkdir /var/www/$KOEL_DOMAIN_NAME
487 508
     fi
488 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 521
         if [ ! -d /var/www/$KOEL_DOMAIN_NAME/htdocs ]; then
492 522
             echo $'Unable to clone koel repo'
493 523
             exit 365735
@@ -554,7 +584,8 @@ function install_koel_main {
554 584
         echo '  # PHP' >> $koel_nginx_site
555 585
         echo '  location ~ \.php {' >> $koel_nginx_site
556 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 589
         echo '  }' >> $koel_nginx_site
559 590
         echo '' >> $koel_nginx_site
560 591
         echo '  # Location' >> $koel_nginx_site
@@ -612,7 +643,8 @@ function install_koel_main {
612 643
     echo '  # PHP' >> $koel_nginx_site
613 644
     echo '  location ~ \.php {' >> $koel_nginx_site
614 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 648
     echo '  }' >> $koel_nginx_site
617 649
     echo '' >> $koel_nginx_site
618 650
     echo '  # Location' >> $koel_nginx_site
@@ -661,7 +693,8 @@ function install_koel_main {
661 693
         KOEL_SERVER=${KOEL_ONION_HOSTNAME}
662 694
     fi
663 695
 
664
-    systemctl restart php5-fpm
696
+    systemctl restart mariadb
697
+    systemctl restart php7.0-fpm
665 698
     systemctl restart nginx
666 699
 
667 700
     ${PROJECT_NAME}-pass -u $MY_USERNAME -a koel -p "$KOEL_ADMIN_PASSWORD"
@@ -691,8 +724,13 @@ function install_koel {
691 724
             cat /home/$MY_USERNAME/freedombone/image_build/composer_install | php
692 725
         fi
693 726
     fi
694
-    npm install
727
+    npm install -g yarn
695 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 735
     function_check get_mariadb_password
698 736
     get_mariadb_password
@@ -708,8 +746,13 @@ function install_koel {
708 746
     sed -i "s|DB_PASSWORD=.*|DB_PASSWORD=$MARIADB_PASSWORD|g" .env
709 747
     sed -i 's/MAIL_HOST=.*/MAIL_HOST=localhost/g' .env
710 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 751
     php artisan koel:init
752
+    if [ ! "$?" = "0" ]; then
753
+        echo $"Can't install koel:init"
754
+        exit 78362
755
+    fi
713 756
     koel_remove_gravatar
714 757
     chown -R www-data:www-data /var/www/$KOEL_DOMAIN_NAME/htdocs
715 758
 
@@ -738,6 +781,7 @@ function install_koel {
738 781
     fi
739 782
     chown -R www-data:www-data /music
740 783
 
784
+    systemctl restart mariadb
741 785
     systemctl restart nginx
742 786
 
743 787
     APP_INSTALLED=1

+ 26
- 14
src/freedombone-app-librevault 查看文件

@@ -44,6 +44,14 @@ librevault_variables=(PROTOBUF_REPO
44 44
                       LIBREVAULT_REPO
45 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 55
 function install_interactive_librevault {
48 56
     echo -n ''
49 57
     APP_INSTALLED=1
@@ -55,6 +63,11 @@ function reconfigure_librevault {
55 63
 }
56 64
 
57 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 71
     function_check set_repo_commit
59 72
 
60 73
     if [ -d $INSTALL_DIR/protobuf ]; then
@@ -71,8 +84,8 @@ function upgrade_librevault {
71 84
     fi
72 85
 
73 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 89
             cd $INSTALL_DIR/librevault
77 90
             git submodule update --init --recursive
78 91
             cd $INSTALL_DIR/librevault/build
@@ -108,6 +121,7 @@ function remove_librevault {
108 121
     systemctl stop librevault
109 122
     systemctl disable librevault
110 123
     rm /etc/systemd/system/librevault.service
124
+    systemctl daemon-reload
111 125
     remove_completion_param install_librevault
112 126
     remove_completion_param configure_firewall_for_librevault
113 127
 }
@@ -130,15 +144,10 @@ function mesh_install_librevault {
130 144
     chroot "$rootdir" apt-get -yq install autoconf automake libtool curl make unzip
131 145
 
132 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 147
     chroot "$rootdir" apt-get -yq install g++ gcc-6 g++-6 libboost-all-dev libssl-dev
137 148
     chroot "$rootdir" apt-get -yq install protobuf-compiler libprotobuf-dev
138 149
     chroot "$rootdir" apt-get -yq install qtbase5-dev libqt5svg5-dev libqt5websockets5-dev
139 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 152
     if [ ! -d $rootdir$INSTALL_DIR ]; then
144 153
         mkdir -p $rootdir$INSTALL_DIR
@@ -228,16 +237,11 @@ function install_librevault {
228 237
     apt-get -yq install autoconf automake libtool curl make unzip
229 238
 
230 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 240
     apt-get -yq install protobuf-compiler libprotobuf-dev
235 241
     apt-get -yq install g++ gcc-6 g++-6 libboost-all-dev libssl-dev
236 242
     apt-get -yq install qtbase5-dev libqt5svg5-dev libqt5websockets5-dev
237 243
     apt-get -yq install libsqlite3-dev qttools5-dev qttools5-dev-tools libnatpmp-dev
238 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 246
     if [ ! -d $INSTALL_DIR ]; then
243 247
         mkdir -p $INSTALL_DIR
@@ -254,7 +258,15 @@ function install_librevault {
254 258
 
255 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 270
     cd $INSTALL_DIR/librevault
259 271
     git checkout $LIBREVAULT_COMMIT -b $LIBREVAULT_COMMIT
260 272
     git submodule update --init --recursive
@@ -271,7 +283,7 @@ function install_librevault {
271 283
     cmake --build .
272 284
     make install
273 285
 
274
-    set_completion_param "Librevault commit" "$LIBREVAULT_COMMIT"
286
+    set_completion_param "librevault commit" "$LIBREVAULT_COMMIT"
275 287
 
276 288
     LIBREVAULT_DAEMON=/etc/systemd/system/librevault-daemon.service
277 289
     echo '[Unit]' > $LIBREVAULT_DAEMON

+ 34
- 10
src/freedombone-app-lychee 查看文件

@@ -13,7 +13,7 @@
13 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 18
 # This program is free software: you can redistribute it and/or modify
19 19
 # it under the terms of the GNU Affero General Public License as published by
@@ -46,6 +46,13 @@ lychee_variables=(LYCHEE_REPO
46 46
                   DDNS_PROVIDER
47 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 57
 function lychee_create_database {
51 58
     if [ -f ${IMAGE_PASSWORD_FILE} ]; then
@@ -123,6 +130,11 @@ function reconfigure_lychee {
123 130
 }
124 131
 
125 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 138
     read_config_param "LYCHEE_DOMAIN_NAME"
127 139
 
128 140
     function_check set_repo_commit
@@ -262,11 +274,12 @@ function install_lychee_website {
262 274
     echo '        try_files $uri $uri/ /index.html;' >> /etc/nginx/sites-available/$LYCHEE_DOMAIN_NAME
263 275
     echo '        # NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini' >> /etc/nginx/sites-available/$LYCHEE_DOMAIN_NAME
264 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 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 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 283
     echo '        fastcgi_index index.html;' >> /etc/nginx/sites-available/$LYCHEE_DOMAIN_NAME
271 284
     echo '        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;' >> /etc/nginx/sites-available/$LYCHEE_DOMAIN_NAME
272 285
     echo '    }' >> /etc/nginx/sites-available/$LYCHEE_DOMAIN_NAME
@@ -331,11 +344,12 @@ function install_lychee_website_onion {
331 344
     echo '        try_files $uri $uri/ /index.html;' >> /etc/nginx/sites-available/$LYCHEE_DOMAIN_NAME
332 345
     echo '        # NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini' >> /etc/nginx/sites-available/$LYCHEE_DOMAIN_NAME
333 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 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 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 353
     echo '        fastcgi_index index.html;' >> /etc/nginx/sites-available/$LYCHEE_DOMAIN_NAME
340 354
     echo '        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;' >> /etc/nginx/sites-available/$LYCHEE_DOMAIN_NAME
341 355
     echo '    }' >> /etc/nginx/sites-available/$LYCHEE_DOMAIN_NAME
@@ -364,7 +378,16 @@ function install_lychee_from_repo {
364 378
     fi
365 379
 
366 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 391
     cd htdocs
369 392
     git checkout $LYCHEE_COMMIT -b $LYCHEE_COMMIT
370 393
     set_completion_param "lychee commit" "$LYCHEE_COMMIT"
@@ -381,7 +404,7 @@ function install_lychee {
381 404
     fi
382 405
 
383 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 409
     function_check install_lychee_from_repo
387 410
     install_lychee_from_repo
@@ -426,7 +449,8 @@ function install_lychee {
426 449
     function_check lychee_create_database
427 450
     lychee_create_database
428 451
 
429
-    systemctl restart php5-fpm
452
+    systemctl restart mariadb
453
+    systemctl restart php7.0-fpm
430 454
     systemctl restart nginx
431 455
 
432 456
     ${PROJECT_NAME}-pass -u $MY_USERNAME -a lychee -p "$LYCHEE_ADMIN_PASSWORD"

+ 30
- 10
src/freedombone-app-mailpile 查看文件

@@ -47,6 +47,14 @@ mailpile_variables=(MAILPILE_REPO
47 47
                     DDNS_PROVIDER
48 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 58
 function remove_user_mailpile {
51 59
     remove_username="$1"
52 60
     ${PROJECT_NAME}-pass -u $remove_username --rmapp mailpile
@@ -83,24 +91,21 @@ function reconfigure_mailpile {
83 91
 function upgrade_mailpile {
84 92
     read_config_param "MAILPILE_DOMAIN_NAME"
85 93
 
86
-    upgrade_mp=
87 94
     CURR_COMMIT=$MAILPILE_COMMIT
88 95
     if grep -q "mailpile commit" $COMPLETION_FILE; then
89 96
         CURR_COMMIT=$(get_completion_param "mailpile commit")
90 97
     fi
91
-    if [[ "$CURR_COMMIT" != "$MAILPILE_COMMIT" ]]; then
92
-        upgrade_mp=1
98
+    if [[ "$CURR_COMMIT" == "$MAILPILE_COMMIT" ]]; then
99
+        return
93 100
     fi
94 101
 
95 102
     function_check set_repo_commit
96 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 111
 function backup_local_mailpile {
@@ -226,6 +231,7 @@ function remove_mailpile {
226 231
     systemctl stop mailpile
227 232
     systemctl disable mailpile
228 233
     rm /etc/systemd/system/mailpile.service
234
+    systemctl daemon-reload
229 235
 
230 236
     read_config_param "MAILPILE_DOMAIN_NAME"
231 237
     nginx_dissite $MAILPILE_DOMAIN_NAME
@@ -238,7 +244,9 @@ function remove_mailpile {
238 244
     fi
239 245
     function_check remove_ddns_domain
240 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 251
     remove_config_param MAILPILE_DOMAIN_NAME
244 252
     remove_config_param MAILPILE_CODE
@@ -272,7 +280,16 @@ function install_mailpile {
272 280
     if [ -d /var/www/$MAILPILE_DOMAIN_NAME/mail ]; then
273 281
         rm -rf /var/www/$MAILPILE_DOMAIN_NAME/mail
274 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 293
     cd mail
277 294
     git checkout $MAILPILE_COMMIT -b $MAILPILE_COMMIT
278 295
     set_completion_param "mailpile commit" "$MAILPILE_COMMIT"
@@ -420,6 +437,9 @@ function install_mailpile {
420 437
     chown -R mailpile:mailpile /var/www/$MAILPILE_DOMAIN_NAME/mail/.gnupg
421 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 443
     systemctl enable mailpile
424 444
     systemctl daemon-reload
425 445
     systemctl start mailpile

+ 61
- 8
src/freedombone-app-matrix 查看文件

@@ -62,6 +62,30 @@ matrix_variables=(ONION_ONLY
62 62
                   MATRIX_DOMAIN_NAME
63 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 89
 function matrix_nginx {
66 90
     matrix_nginx_site=/etc/nginx/sites-available/$MATRIX_DOMAIN_NAME
67 91
     if [[ $ONION_ONLY == "no" ]]; then
@@ -329,6 +353,12 @@ function upgrade_matrix {
329 353
     if [ ! -d /etc/matrix ]; then
330 354
        return
331 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 362
     systemctl stop turn
333 363
     systemctl stop matrix
334 364
 
@@ -478,13 +508,16 @@ function remove_matrix {
478 508
     if [ -f /etc/systemd/system/matrix.service ]; then
479 509
         rm /etc/systemd/system/matrix.service
480 510
     fi
511
+    systemctl daemon-reload
481 512
     apt-get -y remove --purge coturn
482 513
     cd /etc/matrix
483 514
     pip uninstall .
484 515
     rm -rf $MATRIX_DATA_DIR
485 516
     rm -rf /etc/matrix
486
-    deluser matrix
487
-    delgroup matrix
517
+
518
+    groupdel -f matrix
519
+    userdel -r matrix
520
+
488 521
     remove_onion_service matrix ${MATRIX_ONION_PORT}
489 522
     remove_onion_service matrix ${MATRIX_FEDERATION_ONION_PORT}
490 523
 
@@ -497,8 +530,17 @@ function remove_matrix {
497 530
 
498 531
 function install_home_server {
499 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 544
         if [ ! -d /etc/matrix ]; then
503 545
             echo $'Unable to clone matrix repo'
504 546
             exit 6724683
@@ -575,14 +617,19 @@ function install_home_server {
575 617
     sleep 5
576 618
 
577 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 627
     fi
581 628
     chmod -R 700 $MATRIX_DATA_DIR/homeserver.db
582 629
 
583 630
     MATRIX_ONION_HOSTNAME=$(add_onion_service matrix ${MATRIX_PORT} ${MATRIX_ONION_PORT})
584 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 634
     if [ ! ${MATRIX_PASSWORD} ]; then
588 635
         if [ -f ${IMAGE_PASSWORD_FILE} ]; then
@@ -603,6 +650,12 @@ function install_home_server {
603 650
 }
604 651
 
605 652
 function install_matrix {
653
+    if [[ $ONION_ONLY != 'no' ]]; then
654
+        return
655
+    fi
656
+
657
+    check_ram_availability 1500
658
+
606 659
     if [ ! -d $INSTALL_DIR ]; then
607 660
         mkdir -p $INSTALL_DIR
608 661
     fi
@@ -637,7 +690,7 @@ function install_matrix {
637 690
             libjpeg62-turbo-dev libldap-2.4-2 \
638 691
             libldap2-dev libsasl2-dev \
639 692
             libsqlite3-dev libssl-dev \
640
-            libssl1.0.0 libtool libxml2 \
693
+            libssl1.1 libtool libxml2 \
641 694
             libxml2-dev libxslt1-dev libxslt1.1 \
642 695
             make python python-dev \
643 696
             python-pip python-psycopg2 \

+ 29
- 7
src/freedombone-app-mediagoblin 查看文件

@@ -13,7 +13,7 @@
13 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 18
 # This program is free software: you can redistribute it and/or modify
19 19
 # it under the terms of the GNU Affero General Public License as published by
@@ -49,6 +49,14 @@ mediagoblin_variables=(ONION_ONLY
49 49
                        DEFAULT_DOMAIN_NAME
50 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 60
 function mediagoblin_fix_email {
53 61
     # This is a crude hack and there may be a better solution
54 62
     # The cause of verification problems might be that the mediagoblin user
@@ -60,7 +68,7 @@ function mediagoblin_fix_email {
60 68
         echo $'Unable to fix email sending'
61 69
         exit 792532
62 70
     fi
63
-    if ! grep 'import os' $mgfile; then
71
+    if ! grep -q 'import os' $mgfile; then
64 72
         sed -i '/import sys/a import os' $mgfile
65 73
     fi
66 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,6 +243,7 @@ function remove_mediagoblin {
235 243
     systemctl stop mediagoblin
236 244
     systemctl disable mediagoblin
237 245
     rm /etc/systemd/system/mediagoblin.service
246
+    systemctl daemon-reload
238 247
 
239 248
     function_check remove_onion_service
240 249
     remove_onion_service mediagoblin ${MEDIAGOBLIN_ONION_PORT}
@@ -251,8 +260,9 @@ function remove_mediagoblin {
251 260
     sed -i '/mediagoblin/d' $COMPLETION_FILE
252 261
 
253 262
     remove_nodejs mediagoblin
254
-    deluser mediagoblin
255
-    delgroup mediagoblin
263
+
264
+    groupdel -f mediagoblin
265
+    userdel -r mediagoblin
256 266
 
257 267
     function_check remove_ddns_domain
258 268
     remove_ddns_domain $MEDIAGOBLIN_DOMAIN_NAME
@@ -279,7 +289,17 @@ function install_mediagoblin {
279 289
     chown -hR mediagoblin:www-data $MEDIAGOBLIN_BASE_DIR
280 290
     chown -hR mediagoblin:www-data /var/lib/mediagoblin
281 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 303
     su -c "cd $MEDIAGOBLIN_BASE_DIR/mediagoblin && git checkout $MEDIAGOBLIN_COMMIT -b $MEDIAGOBLIN_COMMIT" - mediagoblin
284 304
     su -c "cd $MEDIAGOBLIN_BASE_DIR/mediagoblin && git submodule sync" - mediagoblin
285 305
     su -c "cd $MEDIAGOBLIN_BASE_DIR/mediagoblin && git submodule update --force --init --recursive" - mediagoblin
@@ -382,6 +402,7 @@ function install_mediagoblin {
382 402
         echo '        include /etc/nginx/fastcgi_params;' >> /etc/nginx/sites-available/$MEDIAGOBLIN_DOMAIN_NAME
383 403
         echo '        fastcgi_param PATH_INFO $fastcgi_script_name;' >> /etc/nginx/sites-available/$MEDIAGOBLIN_DOMAIN_NAME
384 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 406
         echo '    }' >> /etc/nginx/sites-available/$MEDIAGOBLIN_DOMAIN_NAME
386 407
         echo '}' >> /etc/nginx/sites-available/$MEDIAGOBLIN_DOMAIN_NAME
387 408
     else
@@ -438,6 +459,7 @@ function install_mediagoblin {
438 459
     echo '        include /etc/nginx/fastcgi_params;' >> /etc/nginx/sites-available/$MEDIAGOBLIN_DOMAIN_NAME
439 460
     echo '        fastcgi_param PATH_INFO $fastcgi_script_name;' >> /etc/nginx/sites-available/$MEDIAGOBLIN_DOMAIN_NAME
440 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 463
     echo '    }' >> /etc/nginx/sites-available/$MEDIAGOBLIN_DOMAIN_NAME
442 464
     echo '}' >> /etc/nginx/sites-available/$MEDIAGOBLIN_DOMAIN_NAME
443 465
 
@@ -469,7 +491,7 @@ function install_mediagoblin {
469 491
 
470 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 495
         echo '[[[skip_transcode]]]' >> $MEDIAGOBLIN_BASE_DIR/mediagoblin/mediagoblin_local.ini
474 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 497
         echo 'container_formats = Matroska, Ogg, ISO MP4/M4A' >> $MEDIAGOBLIN_BASE_DIR/mediagoblin/mediagoblin_local.ini
@@ -496,7 +518,7 @@ function install_mediagoblin {
496 518
 
497 519
     nginx_ensite $MEDIAGOBLIN_DOMAIN_NAME
498 520
 
499
-    systemctl restart php5-fpm
521
+    systemctl restart php7.0-fpm
500 522
     systemctl restart nginx
501 523
 
502 524
     function_check add_ddns_domain

+ 44
- 7
src/freedombone-app-movim 查看文件

@@ -47,6 +47,14 @@ movim_variables=(ONION_ONLY
47 47
                  DDNS_PROVIDER
48 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 58
 function remove_user_movim {
51 59
     remove_username="$1"
52 60
 
@@ -152,6 +160,11 @@ function reconfigure_movim {
152 160
 }
153 161
 
154 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 168
     if grep -q "movim domain" $COMPLETION_FILE; then
156 169
         MOVIM_DOMAIN_NAME=$(get_completion_param "movim domain")
157 170
     fi
@@ -211,6 +224,11 @@ function restore_local_movim {
211 224
             rm -rf $temp_restore_dir
212 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 232
         echo $"Restore of movim complete"
215 233
     fi
216 234
 }
@@ -254,6 +272,12 @@ function restore_remote_movim {
254 272
         if [ -d /root/tempmovim ]; then
255 273
             rm -rf /root/tempmovim
256 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 281
         echo $"Restore of movim complete"
258 282
     fi
259 283
 }
@@ -270,6 +294,7 @@ function remove_movim {
270 294
     systemctl stop movim
271 295
     systemctl disable movim
272 296
     rm /etc/systemd/system/movim.service
297
+    systemctl daemon-reload
273 298
 
274 299
     read_config_param "MY_USERNAME"
275 300
     echo "Removing $MOVIM_DOMAIN_NAME"
@@ -319,15 +344,24 @@ function install_movim {
319 344
     function_check repair_databases_script
320 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 350
     if [ ! -d /var/www/$MOVIM_DOMAIN_NAME ]; then
326 351
         mkdir /var/www/$MOVIM_DOMAIN_NAME
327 352
     fi
328 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 365
         if [ ! -d /var/www/$MOVIM_DOMAIN_NAME/htdocs ]; then
332 366
             echo $'Unable to clone movim repo'
333 367
             exit 76285
@@ -435,7 +469,8 @@ function install_movim {
435 469
         echo '  # PHP' >> $movim_nginx_site
436 470
         echo '  location ~ \.php {' >> $movim_nginx_site
437 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 474
         echo '  }' >> $movim_nginx_site
440 475
         echo '' >> $movim_nginx_site
441 476
         echo '  # Location' >> $movim_nginx_site
@@ -494,7 +529,8 @@ function install_movim {
494 529
     echo '  # PHP' >> $movim_nginx_site
495 530
     echo '  location ~ \.php {' >> $movim_nginx_site
496 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 534
     echo '  }' >> $movim_nginx_site
499 535
     echo '' >> $movim_nginx_site
500 536
     echo '  # Location' >> $movim_nginx_site
@@ -549,8 +585,9 @@ function install_movim {
549 585
 
550 586
     set_completion_param "movim domain" "$MOVIM_DOMAIN_NAME"
551 587
 
588
+    systemctl restart mariadb
552 589
     systemctl start movim
553
-    systemctl restart php5-fpm
590
+    systemctl restart php7.0-fpm
554 591
     systemctl restart nginx
555 592
     APP_INSTALLED=1
556 593
 }

+ 16
- 0
src/freedombone-app-mumble 查看文件

@@ -47,6 +47,22 @@ mumble_variables=(MY_USERNAME
47 47
                   ONION_ONLY
48 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 66
 function install_interactive_mumble {
51 67
     echo -n ''
52 68
     APP_INSTALLED=1

+ 65
- 18
src/freedombone-app-nextcloud 查看文件

@@ -38,11 +38,9 @@ SHOW_ON_ABOUT=1
38 38
 NEXTCLOUD_DOMAIN_NAME=
39 39
 NEXTCLOUD_CODE=
40 40
 NEXTCLOUD_ONION_PORT=8112
41
-NEXTCLOUD_DOWNLOAD_URL='https://download.nextcloud.com/server/releases/nextcloud-'
42
-NEXTCLOUD_VERSION='11.0.3'
43 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 44
 NEXTCLOUD_ADMIN_PASSWORD=
47 45
 
48 46
 nextcloud_variables=(ONION_ONLY
@@ -51,6 +49,14 @@ nextcloud_variables=(ONION_ONLY
51 49
                      DDNS_PROVIDER
52 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 60
 function remove_user_nextcloud {
55 61
     remove_username="$1"
56 62
 
@@ -178,6 +184,18 @@ function configure_interactive_nextcloud {
178 184
 }
179 185
 
180 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 199
     if grep -q "nextcloud domain" $COMPLETION_FILE; then
182 200
         NEXTCLOUD_DOMAIN_NAME=$(get_completion_param "nextcloud domain")
183 201
     fi
@@ -339,7 +357,7 @@ function remove_nextcloud {
339 357
     function_check remove_nodejs
340 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 362
     read_config_param "NEXTCLOUD_DOMAIN_NAME"
345 363
     read_config_param "MY_USERNAME"
@@ -367,7 +385,7 @@ function remove_nextcloud {
367 385
     function_check remove_ddns_domain
368 386
     remove_ddns_domain $NEXTCLOUD_DOMAIN_NAME
369 387
     systemctl restart nginx
370
-    systemctl restart php5-fpm
388
+    systemctl restart php7.0-fpm
371 389
 }
372 390
 
373 391
 function install_nextcloud_main {
@@ -389,22 +407,32 @@ function install_nextcloud_main {
389 407
     function_check repair_databases_script
390 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 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 416
        echo $'No php www configuration file found'
398 417
        exit 628757
399 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 421
     if [ ! -d /var/www/$NEXTCLOUD_DOMAIN_NAME ]; then
403 422
         mkdir /var/www/$NEXTCLOUD_DOMAIN_NAME
404 423
     fi
405 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 436
         if [ ! -d /var/www/$NEXTCLOUD_DOMAIN_NAME/htdocs ]; then
409 437
             echo $'Unable to clone nextcloud repo'
410 438
             exit 87525
@@ -463,7 +491,8 @@ function install_nextcloud_main {
463 491
         echo '  # PHP' >> $nextcloud_nginx_site
464 492
         echo '  location ~ \.php {' >> $nextcloud_nginx_site
465 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 496
         echo '  }' >> $nextcloud_nginx_site
468 497
         echo '' >> $nextcloud_nginx_site
469 498
         echo '  # Location' >> $nextcloud_nginx_site
@@ -518,7 +547,8 @@ function install_nextcloud_main {
518 547
     echo '  # PHP' >> $nextcloud_nginx_site
519 548
     echo '  location ~ \.php {' >> $nextcloud_nginx_site
520 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 552
     echo '  }' >> $nextcloud_nginx_site
523 553
     echo '' >> $nextcloud_nginx_site
524 554
     echo '  # Location' >> $nextcloud_nginx_site
@@ -592,7 +622,7 @@ function install_nextcloud_main {
592 622
         NEXTCLOUD_SERVER=${NEXTCLOUD_ONION_HOSTNAME}
593 623
     fi
594 624
 
595
-    systemctl restart php5-fpm
625
+    systemctl restart php7.0-fpm
596 626
     systemctl restart nginx
597 627
 
598 628
     ${PROJECT_NAME}-addemail -u $MY_USERNAME -e "noreply@$NEXTCLOUD_DOMAIN_NAME" -g nextcloud --public no
@@ -600,26 +630,43 @@ function install_nextcloud_main {
600 630
     ${PROJECT_NAME}-pass -u $MY_USERNAME -a nextcloud -p "$NEXTCLOUD_ADMIN_PASSWORD"
601 631
 
602 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 640
     chmod +x occ
606 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 651
     ./occ check
608 652
     ./occ status
609 653
     ./occ app:list
610 654
     ./occ app:enable encryption
611 655
     ./occ config:system:set appstoreenabled --value=false
612
-    ./occ config:system:set trusted_domains 1 --value=$NEXTCLOUD_DOMAIN_NAME
613 656
     chmod g+w /var/www/${NEXTCLOUD_DOMAIN_NAME}/htdocs/config/config.php
614 657
     chown -R www-data:www-data /var/www/${NEXTCLOUD_DOMAIN_NAME}/htdocs
615 658
     chmod 0644 .htaccess
616 659
     chmod 0750 data
617 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 663
     sudo -u www-data ./occ files:cleanup
619 664
     sudo -u www-data ./occ files:scan --all
620 665
     sudo -u www-data ./occ maintenance:repair
621 666
     sudo -u www-data ./occ maintenance:mode --off
622 667
 
668
+    systemctl restart mariadb
669
+
623 670
     # move the data directory
624 671
     mv /var/www/${NEXTCLOUD_DOMAIN_NAME}/htdocs/data /var/www/${NEXTCLOUD_DOMAIN_NAME}/
625 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 查看文件

@@ -49,6 +49,13 @@ pelican_variables=(MY_USERNAME
49 49
                    PELICAN_DOMAIN_NAME
50 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 60
 function install_pelican_website {
54 61
     if [[ $ONION_ONLY != 'no' ]]; then
@@ -525,7 +532,7 @@ function remove_pelican {
525 532
     function_check remove_onion_service
526 533
     remove_onion_service pelican ${PELICAN_ONION_PORT}
527 534
     remove_app pelican
528
-    systemctl reload tor
535
+    systemctl restart tor
529 536
 }
530 537
 
531 538
 function create_pelican_conf {

+ 28
- 1
src/freedombone-app-pihole 查看文件

@@ -54,6 +54,14 @@ pihole_variables=(ONION_ONLY
54 54
                   PIHOLE_DNS1
55 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 65
 function pihole_copy_files {
58 66
     if [ ! -d /etc/.pihole ]; then
59 67
         mkdir /etc/.pihole
@@ -278,6 +286,11 @@ function reconfigure_pihole {
278 286
 }
279 287
 
280 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 294
     function_check set_repo_commit
282 295
     set_repo_commit $INSTALL_DIR/pihole "pihole commit" "$PIHOLE_COMMIT" $PIHOLE_REPO
283 296
 
@@ -351,6 +364,11 @@ function remove_pihole {
351 364
 function install_pihole {
352 365
     apt-get -yq install dnsmasq curl
353 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 372
     chmod 600 /etc/shadow
355 373
     chmod 600 /etc/gshadow
356 374
     usermod -a -G www-data pihole
@@ -365,7 +383,16 @@ function install_pihole {
365 383
 
366 384
     if [ ! -d $INSTALL_DIR/pihole ]; then
367 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 396
         if [ ! -d $INSTALL_DIR/pihole ]; then
370 397
             exit 523925
371 398
         fi

+ 157
- 65
src/freedombone-app-postactiv 查看文件

@@ -37,7 +37,7 @@ POSTACTIV_DOMAIN_NAME=
37 37
 POSTACTIV_CODE=
38 38
 POSTACTIV_ONION_PORT=8100
39 39
 POSTACTIV_REPO="https://git.postactiv.com/postActiv/postActiv.git"
40
-POSTACTIV_COMMIT='65fcc4eb440380f2373d428e8dde23fcc73c9f08'
40
+POSTACTIV_COMMIT='0531c469b44aab6a71230778ab4492eca889bb2c'
41 41
 POSTACTIV_ADMIN_PASSWORD=
42 42
 
43 43
 POSTACTIV_BACKGROUND_IMAGE_URL=
@@ -55,6 +55,14 @@ postactiv_variables=(ONION_ONLY
55 55
                      POSTACTIV_EXPIRE_MONTHS
56 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 66
 function postactiv_customise_logo {
59 67
     domain_name=$1
60 68
 
@@ -313,15 +321,14 @@ function configure_interactive_postactiv {
313 321
         trap "rm -f $data" 0 1 2 5 15
314 322
         dialog --backtitle $"Freedombone Control Panel" \
315 323
                --title $"PostActiv" \
316
-               --radiolist $"Choose an operation:" 17 70 8 \
324
+               --radiolist $"Choose an operation:" 16 70 7 \
317 325
                1 $"Set a background image" off \
318 326
                2 $"Set the title" off \
319 327
                3 $"Set post expiry period (currently $POSTACTIV_EXPIRE_MONTHS months)" off \
320 328
                4 $"Select Qvitter user interface" off \
321 329
                5 $"Select Pleroma user interface" off \
322 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 332
         sel=$?
326 333
         case $sel in
327 334
             1) return;;
@@ -334,8 +341,7 @@ function configure_interactive_postactiv {
334 341
             4) gnusocial_use_qvitter postactiv;;
335 342
             5) gnusocial_use_pleroma postactiv;;
336 343
             6) gnusocial_use_classic postactiv;;
337
-            7) gnusocial_use_armadillo postactiv;;
338
-            8) break;;
344
+            7) break;;
339 345
         esac
340 346
     done
341 347
 }
@@ -375,6 +381,7 @@ function upgrade_postactiv {
375 381
     postactiv_customise_logo
376 382
     install_gnusocial_default_background "postactiv" "$POSTACTIV_DOMAIN_NAME"
377 383
     chown -R www-data:www-data /var/www/${POSTACTIV_DOMAIN_NAME}/htdocs
384
+    systemctl restart mariadb
378 385
 }
379 386
 
380 387
 
@@ -384,21 +391,34 @@ function backup_local_postactiv {
384 391
         POSTACTIV_DOMAIN_NAME=$(get_completion_param "postactiv domain")
385 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 424
 function restore_local_postactiv {
@@ -407,68 +427,122 @@ function restore_local_postactiv {
407 427
     fi
408 428
     POSTACTIV_DOMAIN_NAME=$(get_completion_param "postactiv domain")
409 429
     if [ $POSTACTIV_DOMAIN_NAME ]; then
430
+        echo $"Restoring postactiv"
410 431
         temp_restore_dir=/root/temppostactiv
411 432
         postactiv_dir=/var/www/${POSTACTIV_DOMAIN_NAME}/htdocs
412 433
         # stop the daemons
413 434
         cd $postactiv_dir
414
-        su -c "sh scripts/stopdaemons.sh" -s /bin/sh www-data
435
+        scripts/stopdaemons.sh
415 436
 
416 437
         function_check postactiv_create_database
417 438
         postactiv_create_database
418 439
 
419
-        restore_database postactiv ${POSTACTIV_DOMAIN_NAME}
440
+        restore_database postactiv
420 441
         if [ -d $temp_restore_dir ]; then
421 442
             rm -rf $temp_restore_dir
422 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 465
     fi
428 466
 }
429 467
 
430 468
 function backup_remote_postactiv {
469
+    POSTACTIV_DOMAIN_NAME='postactiv'
431 470
     if grep -q "postactiv domain" $COMPLETION_FILE; then
432 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 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 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 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 517
         function_check postactiv_create_database
461 518
         postactiv_create_database
462 519
 
463 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 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 546
     fi
473 547
 }
474 548
 
@@ -488,8 +562,8 @@ function remove_postactiv {
488 562
         rm /etc/cron.hourly/postactiv-daemons
489 563
     fi
490 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 567
     fi
494 568
     kill_pid=$(ps aux | grep /var/www/$POSTACTIV_DOMAIN_NAME/htdocs/scripts/queuedaemon.php | awk -F ' ' '{print $2}' | head -n 1)
495 569
     kill -9 $kill_pid
@@ -540,15 +614,24 @@ function install_postactiv_main {
540 614
     function_check repair_databases_script
541 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 620
     if [ ! -d /var/www/$POSTACTIV_DOMAIN_NAME ]; then
547 621
         mkdir /var/www/$POSTACTIV_DOMAIN_NAME
548 622
     fi
549 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 635
         if [ ! -d /var/www/$POSTACTIV_DOMAIN_NAME/htdocs ]; then
553 636
             echo $'Unable to clone postactiv repo'
554 637
             exit 87525
@@ -583,6 +666,8 @@ function install_postactiv_main {
583 666
     function_check add_ddns_domain
584 667
     add_ddns_domain $POSTACTIV_DOMAIN_NAME
585 668
 
669
+    POSTACTIV_ONION_HOSTNAME=$(add_onion_service postactiv 80 ${POSTACTIV_ONION_PORT})
670
+
586 671
     postactiv_nginx_site=/etc/nginx/sites-available/$POSTACTIV_DOMAIN_NAME
587 672
     if [[ $ONION_ONLY == "no" ]]; then
588 673
         function_check nginx_http_redirect
@@ -617,7 +702,8 @@ function install_postactiv_main {
617 702
         echo '  # PHP' >> $postactiv_nginx_site
618 703
         echo '  location ~ \.php {' >> $postactiv_nginx_site
619 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 707
         echo '  }' >> $postactiv_nginx_site
622 708
         echo '' >> $postactiv_nginx_site
623 709
         echo '  # Location' >> $postactiv_nginx_site
@@ -644,7 +730,7 @@ function install_postactiv_main {
644 730
     fi
645 731
     echo 'server {' >> $postactiv_nginx_site
646 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 734
     echo '' >> $postactiv_nginx_site
649 735
     function_check nginx_disable_sniffing
650 736
     nginx_disable_sniffing $POSTACTIV_DOMAIN_NAME
@@ -665,7 +751,8 @@ function install_postactiv_main {
665 751
     echo '  # PHP' >> $postactiv_nginx_site
666 752
     echo '  location ~ \.php {' >> $postactiv_nginx_site
667 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 756
     echo '  }' >> $postactiv_nginx_site
670 757
     echo '' >> $postactiv_nginx_site
671 758
     echo '  # Location' >> $postactiv_nginx_site
@@ -713,8 +800,6 @@ function install_postactiv_main {
713 800
         postactiv_ssl='never'
714 801
     fi
715 802
 
716
-    POSTACTIV_ONION_HOSTNAME=$(add_onion_service postactiv 80 ${POSTACTIV_ONION_PORT})
717
-
718 803
     POSTACTIV_SERVER=${POSTACTIV_DOMAIN_NAME}
719 804
     if [[ $ONION_ONLY != 'no' ]]; then
720 805
         POSTACTIV_SERVER=${POSTACTIV_ONION_HOSTNAME}
@@ -776,7 +861,8 @@ function install_postactiv_main {
776 861
         rm /var/www/$POSTACTIV_DOMAIN_NAME/htdocs/install.php
777 862
     fi
778 863
 
779
-    systemctl restart php5-fpm
864
+    systemctl restart mariadb
865
+    systemctl restart php7.0-fpm
780 866
     systemctl restart nginx
781 867
 
782 868
     ${PROJECT_NAME}-addemail -u $MY_USERNAME -e "noreply@$POSTACTIV_DOMAIN_NAME" -g postactiv --public no
@@ -798,11 +884,9 @@ function install_postactiv {
798 884
 
799 885
     install_postactiv_main
800 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 891
     # Currently Pleroma won't install on ARM systems
808 892
     # because it uses node-sass which doesn't support ARM
@@ -825,6 +909,14 @@ function install_postactiv {
825 909
 
826 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 920
     APP_INSTALLED=1
829 921
 }
830 922
 

+ 36
- 3
src/freedombone-app-profanity 查看文件

@@ -48,6 +48,14 @@ xmpp_variables=(ONION_ONLY
48 48
                 DEFAULT_DOMAIN_NAME
49 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 59
 function remove_user_profanity {
52 60
     remove_username="$1"
53 61
 }
@@ -198,7 +206,15 @@ function install_profanity {
198 206
     apt-get -yq install libotr5-dev libgpgme11-dev python-dev libreadline-dev
199 207
 
200 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 218
     cd $INSTALL_DIR/libmesode
203 219
     git checkout $LIBMESODE_COMMIT -b $LIBMESODE_COMMIT
204 220
     ./bootstrap.sh
@@ -208,7 +224,15 @@ function install_profanity {
208 224
     cp /usr/local/lib/libmesode* /usr/lib
209 225
 
210 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 236
     cd $INSTALL_DIR/profanity
213 237
     git checkout $PROFANITY_COMMIT -b $PROFANITY_COMMIT
214 238
     ./bootstrap.sh
@@ -223,7 +247,16 @@ function install_profanity {
223 247
 
224 248
     # install the omemo plugin
225 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 260
     cd $INSTALL_DIR/profanity-omemo-plugin
228 261
     git checkout $PROFANITY_OMEMO_PLUGIN_COMMIT -b $PROFANITY_OMEMO_PLUGIN_COMMIT
229 262
     if [ ! -f $INSTALL_DIR/profanity-omemo-plugin/deploy/prof_omemo_plugin.py ]; then

+ 14
- 2
src/freedombone-app-radicale 查看文件

@@ -31,7 +31,7 @@
31 31
 # You should have received a copy of the GNU Affero General Public License
32 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 36
 IN_DEFAULT_INSTALL=0
37 37
 SHOW_ON_ABOUT=1
@@ -50,6 +50,14 @@ radicale_variables=(ONION_ONLY
50 50
                     RADICALE_PASSWORD
51 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 61
 function remove_user_radicale {
54 62
     remove_username="$1"
55 63
 
@@ -274,6 +282,7 @@ function remove_radicale {
274 282
     if [ -f /etc/systemd/system/radicale.service ]; then
275 283
         rm /etc/systemd/system/radicale.service
276 284
     fi
285
+    systemctl daemon-reload
277 286
     if [ -f /etc/nginx/sites-available/radicale ]; then
278 287
         rm /etc/nginx/sites-available/radicale
279 288
     fi
@@ -282,7 +291,9 @@ function remove_radicale {
282 291
     fi
283 292
 
284 293
     firewall_remove ${RADICALE_PORT} tcp
285
-    deluser radicale
294
+
295
+    groupdel -f radicale
296
+    userdel -r radicale
286 297
 
287 298
     function_check remove_onion_service
288 299
     remove_onion_service radicale ${RADICALE_ONION_PORT}
@@ -323,6 +334,7 @@ function install_radicale {
323 334
 
324 335
     useradd -c "Radicale system account" -d /var/www/radicale -m -r -g radicale radicale
325 336
     usermod -a -G www-data radicale
337
+    groupadd radicale
326 338
 
327 339
     # create directories
328 340
     if [ ! -d /var/log/radicale ]; then

+ 31
- 6
src/freedombone-app-riot 查看文件

@@ -46,8 +46,17 @@ riot_variables=(MY_USERNAME
46 46
                 RIOT_DOMAIN_NAME
47 47
                 MATRIX_DOMAIN_NAME
48 48
                 SYSTEM_TYPE
49
+                ONION_ONLY
49 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 60
 function remove_user_riot {
52 61
     echo -n ''
53 62
 }
@@ -206,6 +215,10 @@ function remove_riot {
206 215
 }
207 216
 
208 217
 function install_riot {
218
+    if [[ $ONION_ONLY != 'no' ]]; then
219
+        return
220
+    fi
221
+
209 222
     # check that matrix has been installed
210 223
     if [ ! $MATRIX_DOMAIN_NAME ]; then
211 224
         exit 687292
@@ -217,6 +230,9 @@ function install_riot {
217 230
         exit 827334
218 231
     fi
219 232
 
233
+    function_check get_completion_param
234
+    MATRIX_ONION_DOMAIN_NAME=$(get_completion_param "matrix onion domain")
235
+
220 236
     apt-get -yq install wget
221 237
 
222 238
     if [ ! -d /var/www/$RIOT_DOMAIN_NAME/htdocs ]; then
@@ -232,12 +248,21 @@ function install_riot {
232 248
     cd /var/www/$RIOT_DOMAIN_NAME/htdocs
233 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 267
     RIOT_ONION_HOSTNAME=$(add_onion_service riot 80 ${RIOT_ONION_PORT})
243 268
 

+ 78
- 15
src/freedombone-app-rss 查看文件

@@ -13,7 +13,7 @@
13 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 18
 # This program is free software: you can redistribute it and/or modify
19 19
 # it under the terms of the GNU Affero General Public License as published by
@@ -53,6 +53,24 @@ rss_variables=(RSS_READER_REPO
53 53
                USB_MOUNT
54 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 74
 function install_interactive_rss {
57 75
     echo -n ''
58 76
     APP_INSTALLED=1
@@ -86,6 +104,11 @@ function reconfigure_rss {
86 104
 }
87 105
 
88 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 112
     RSS_MOBILE_READER_PATH=/etc/share/ttrss-mobile
90 113
 
91 114
     if [[ $(app_is_installed rss) == "1" ]]; then
@@ -180,6 +203,10 @@ function restore_local_rss {
180 203
             rm -rf $temp_restore_dir
181 204
         fi
182 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 212
 function backup_remote_rss {
@@ -238,6 +265,11 @@ function restore_remote_rss {
238 265
         if [ -d /root/tempttrss ]; then
239 266
             rm -rf /root/tempttrss
240 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 273
         echo $"Restore of ttrss complete"
242 274
     fi
243 275
 }
@@ -249,7 +281,8 @@ function remove_rss {
249 281
 
250 282
     nginx_dissite $RSS_READER_DOMAIN_NAME
251 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 286
     if [ -f /etc/nginx/sites-available/$RSS_READER_DOMAIN_NAME ]; then
254 287
         rm /etc/nginx/sites-available/$RSS_READER_DOMAIN_NAME
255 288
     fi
@@ -261,6 +294,7 @@ function remove_rss {
261 294
     remove_completion_param install_rss
262 295
     sed -i '/RSS /d' $COMPLETION_FILE
263 296
     sed -i '/rss /d' $COMPLETION_FILE
297
+    sed -i '/rss_/d' $COMPLETION_FILE
264 298
     remove_backup_database_local ttrss
265 299
 }
266 300
 
@@ -294,15 +328,27 @@ function install_rss_main {
294 328
     function_check remove_onion_service
295 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 337
     if [ ! -d /etc/share ]; then
301 338
         mkdir /etc/share
302 339
     fi
303 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 352
     if [ ! -d $RSS_READER_PATH ]; then
307 353
         echo $'Could not clone RSS reader repo'
308 354
         exit 52925
@@ -323,7 +369,12 @@ function install_rss_main {
323 369
     rss_create_database
324 370
 
325 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 379
     echo 'server {' > /etc/nginx/sites-available/$RSS_READER_DOMAIN_NAME
329 380
     echo "  listen 127.0.0.1:$RSS_MOBILE_READER_ONION_PORT;" >> /etc/nginx/sites-available/$RSS_READER_DOMAIN_NAME
@@ -337,7 +388,8 @@ function install_rss_main {
337 388
     echo '' >> /etc/nginx/sites-available/$RSS_READER_DOMAIN_NAME
338 389
     echo '  location ~ \.php {' >> /etc/nginx/sites-available/$RSS_READER_DOMAIN_NAME
339 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 393
     echo '  }' >> /etc/nginx/sites-available/$RSS_READER_DOMAIN_NAME
342 394
     echo '' >> /etc/nginx/sites-available/$RSS_READER_DOMAIN_NAME
343 395
     echo '  location / {' >> /etc/nginx/sites-available/$RSS_READER_DOMAIN_NAME
@@ -375,7 +427,8 @@ function install_rss_main {
375 427
     echo '' >> /etc/nginx/sites-available/$RSS_READER_DOMAIN_NAME
376 428
     echo '  location ~ \.php {' >> /etc/nginx/sites-available/$RSS_READER_DOMAIN_NAME
377 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 432
     echo '  }' >> /etc/nginx/sites-available/$RSS_READER_DOMAIN_NAME
380 433
     echo '' >> /etc/nginx/sites-available/$RSS_READER_DOMAIN_NAME
381 434
     echo '  set $mobile_rewrite do_not_perform;' >> /etc/nginx/sites-available/$RSS_READER_DOMAIN_NAME
@@ -396,7 +449,7 @@ function install_rss_main {
396 449
     echo '' >> /etc/nginx/sites-available/$RSS_READER_DOMAIN_NAME
397 450
     echo '  location ~ \.php {' >> /etc/nginx/sites-available/$RSS_READER_DOMAIN_NAME
398 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 453
     echo '  }' >> /etc/nginx/sites-available/$RSS_READER_DOMAIN_NAME
401 454
     echo '' >> /etc/nginx/sites-available/$RSS_READER_DOMAIN_NAME
402 455
     echo '  location / {' >> /etc/nginx/sites-available/$RSS_READER_DOMAIN_NAME
@@ -420,7 +473,7 @@ function install_rss_main {
420 473
         # generate a config file
421 474
         RSS_FEED_CRYPT_KEY="$(create_password 24)"
422 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 477
         echo "  define('DB_TYPE', 'mysql');" >> $RSS_READER_PATH/config.php
425 478
         echo "  define('DB_HOST', 'localhost');" >> $RSS_READER_PATH/config.php
426 479
         echo "  define('DB_USER', 'root');" >> $RSS_READER_PATH/config.php
@@ -482,13 +535,14 @@ function install_rss_main {
482 535
     configure_php
483 536
 
484 537
     nginx_ensite $RSS_READER_DOMAIN_NAME
485
-    systemctl restart php5-fpm
538
+    systemctl restart mariadb
539
+    systemctl restart php7.0-fpm
486 540
     systemctl restart nginx
487 541
 
488 542
     # daemon to update feeds
489 543
     echo '[Unit]' > /etc/systemd/system/ttrss.service
490 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 546
     echo 'After=tor.service' >> /etc/systemd/system/ttrss.service
493 547
     echo '' >> /etc/systemd/system/ttrss.service
494 548
     echo '[Service]' >> /etc/systemd/system/ttrss.service
@@ -570,8 +624,17 @@ function install_rss_mobile_reader {
570 624
     fi
571 625
 
572 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 638
     if [ ! -d $RSS_MOBILE_READER_PATH ]; then
576 639
         echo $'Could not clone RSS mobile reader repo'
577 640
         exit 24816

+ 11
- 1
src/freedombone-app-scuttlebot 查看文件

@@ -10,6 +10,7 @@
10 10
 #
11 11
 # scuttlebot pub application
12 12
 # https://scuttlebot.io
13
+# Problem: on occasion uses 100% of the CPU, severely impacting other services
13 14
 #
14 15
 # License
15 16
 # =======
@@ -29,7 +30,7 @@
29 30
 # You should have received a copy of the GNU Affero General Public License
30 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 35
 IN_DEFAULT_INSTALL=0
35 36
 SHOW_ON_ABOUT=0
@@ -42,6 +43,14 @@ scuttlebot_variables=(MY_USERNAME
42 43
                       DEFAULT_DOMAIN_NAME
43 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 54
 function scuttlebot_create_invite {
46 55
     invite_string=$(su -c "sbot invite.create 1" - scuttlebot | sed 's/"//g')
47 56
 
@@ -166,6 +175,7 @@ function remove_scuttlebot {
166 175
     systemctl stop scuttlebot
167 176
     systemctl disable scuttlebot
168 177
     rm /etc/systemd/system/scuttlebot.service
178
+    systemctl daemon-reload
169 179
 
170 180
     userdel -r scuttlebot
171 181
 

+ 50
- 7
src/freedombone-app-searx 查看文件

@@ -35,7 +35,7 @@ SHOW_ON_ABOUT=1
35 35
 SHOW_ICANN_ADDRESS_ON_ABOUT=0
36 36
 
37 37
 SEARX_REPO="https://github.com/asciimoo/searx"
38
-SEARX_COMMIT='259735f30901ae884f8234f1f138c28a9e59713a'
38
+SEARX_COMMIT='80460be8f69cea5f15c9d5ddbb63e4e48fde2dd0'
39 39
 SEARX_PATH=/etc
40 40
 SEARX_ONION_PORT=8094
41 41
 SEARX_ONION_HOSTNAME=
@@ -48,6 +48,14 @@ searx_variables=(SEARX_LOGIN_TEXT
48 48
                  SEARX_BACKGROUND_IMAGE_URL
49 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 59
 function searx_set_default_background {
52 60
     if [ -f ~/freedombone/img/backgrounds/searx.jpg ]; then
53 61
         cp ~/freedombone/img/backgrounds/searx.jpg /etc/searx/searx/static/themes/courgette/img/bg-body-index.jpg
@@ -737,6 +745,11 @@ function create_searx_config {
737 745
 }
738 746
 
739 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 753
     settings_file=${SEARX_PATH}/searx/searx/settings.yml
741 754
     background_image=/etc/searx/searx/static/themes/courgette/img/bg-body-index.jpg
742 755
 
@@ -789,6 +802,8 @@ function remove_searx {
789 802
     systemctl stop searx
790 803
     systemctl disable searx
791 804
     rm /etc/systemd/system/searx.service
805
+    systemctl daemon-reload
806
+
792 807
     function_check remove_onion_service
793 808
     remove_onion_service searx ${SEARX_ONION_PORT}
794 809
     userdel -r searx
@@ -811,8 +826,15 @@ function install_searx {
811 826
         exit 62429
812 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 839
     pip install --upgrade pip
818 840
 
@@ -846,14 +868,35 @@ function install_searx {
846 868
         exit 63738
847 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 883
     if [ ! -d $SEARX_PATH ]; then
850 884
         mkdir -p $SEARX_PATH
851 885
     fi
852 886
 
853 887
     # clone the repo
854 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 900
     git checkout $SEARX_COMMIT -b $SEARX_COMMIT
858 901
     set_completion_param "searx commit" "$SEARX_COMMIT"
859 902
 
@@ -915,7 +958,7 @@ function install_searx {
915 958
     echo '}' >> /etc/nginx/sites-available/searx
916 959
 
917 960
     # replace the secret key
918
-    if ! grep "searx key" $COMPLETION_FILE; then
961
+    if ! grep -q "searx key" $COMPLETION_FILE; then
919 962
         SEARX_SECRET_KEY="$(create_password 30)"
920 963
         set_completion_param "searx key" "${SEARX_SECRET_KEY}"
921 964
     fi
@@ -930,7 +973,7 @@ function install_searx {
930 973
     nginx_ensite searx
931 974
 
932 975
     # restart the web server
933
-    systemctl restart php5-fpm
976
+    systemctl restart php7.0-fpm
934 977
     systemctl restart nginx
935 978
 
936 979
     # start the daemon

+ 10
- 2
src/freedombone-app-sip 查看文件

@@ -50,6 +50,14 @@ sip_variables=(ONION_ONLY
50 50
                TURN_TLS_PORT
51 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 61
 function remove_user_sip {
54 62
     remove_username="$1"
55 63
     ${PROJECT_NAME}-rmsipuser ${remove_username}
@@ -146,7 +154,7 @@ function restore_local_sip {
146 154
             exit 3679
147 155
         fi
148 156
         rm -rf $temp_restore_dir
149
-        service sipwitch restart
157
+        systemctl restart sipwitch
150 158
         echo $"Restore of SIP settings complete"
151 159
     fi
152 160
 }
@@ -212,7 +220,7 @@ function update_sipwitch_daemon {
212 220
         return
213 221
     fi
214 222
 
215
-    service sipwitch stop
223
+    systemctl stop sipwitch
216 224
 
217 225
     # remove the original sipwitch daemon if it exists
218 226
     if [ -f /etc/init.d/sipwitch ]; then

+ 20
- 4
src/freedombone-app-syncthing 查看文件

@@ -13,7 +13,7 @@
13 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 18
 # This program is free software: you can redistribute it and/or modify
19 19
 # it under the terms of the GNU Affero General Public License as published by
@@ -51,6 +51,14 @@ syncthing_variables=(SYNCTHING_ID
51 51
                      SYNCTHING_SHARED_DATA
52 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 62
 function syncthing_create_ids_file {
55 63
     if [ ! -f ~/.syncthing-server-id ]; then
56 64
         return
@@ -458,8 +466,9 @@ function remove_syncthing {
458 466
     firewall_remove ${SYNCTHING_PORT}
459 467
     systemctl stop syncthing
460 468
     systemctl disable syncthing
461
-    apt-get -yq remove --purge syncthing
462 469
     rm /etc/systemd/system/syncthing.service
470
+    systemctl daemon-reload
471
+    apt-get -yq remove --purge syncthing
463 472
     sed -i "/${PROJECT_NAME}-syncthing/d" /etc/crontab
464 473
     remove_completion_param install_syncthing
465 474
     remove_completion_param configure_firewall_for_syncthing
@@ -475,12 +484,19 @@ function configure_firewall_for_syncthing {
475 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 493
     curl -s https://syncthing.net/release-key.txt | apt-key add -
482 494
     echo "deb http://apt.syncthing.net/ syncthing release" | tee /etc/apt/sources.list.d/syncthing.list
483 495
     apt-get update
496
+}
497
+
498
+function install_syncthing {
499
+    install_syncthing_repo
484 500
     apt-get -yq install syncthing
485 501
 
486 502
     # This probably does need to run as root so that it can access the Sync directories

+ 84
- 88
src/freedombone-app-tahoelafs 查看文件

@@ -36,16 +36,14 @@ IN_DEFAULT_INSTALL=0
36 36
 SHOW_ON_ABOUT=1
37 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 39
 TAHOELAFS_PORT=50213
43 40
 TAHOELAFS_STORAGE_PORT=50214
44 41
 TAHOELAFS_ONION_PORT=8096
45 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 48
 TAHOELAFS_SHARES_NEEDED=3
51 49
 TAHOELAFS_SHARES_HAPPY=7
@@ -53,12 +51,19 @@ TAHOELAFS_SHARES_TOTAL=10
53 51
 
54 52
 tahoelafs_variables=(ONION_ONLY
55 53
                      MY_USERNAME
56
-                     TAHOELAFS_REPO
57 54
                      TAHOELAFS_PORT
58 55
                      TAHOELAFS_SHARES_NEEDED
59 56
                      TAHOELAFS_SHARES_HAPPY
60 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 67
 function add_user_tahoelafs {
63 68
     if [[ $(app_is_installed tahoelafs) == "0" ]]; then
64 69
         echo '0'
@@ -68,7 +73,7 @@ function add_user_tahoelafs {
68 73
     new_username="$1"
69 74
     new_user_password="$2"
70 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 77
         sed -i '/${new_username}:/d' /etc/nginx/.htpasswd-tahoelafs
73 78
     fi
74 79
     echo "${new_user_password}" | htpasswd -i -s /etc/nginx/.htpasswd-tahoelafs ${new_username}
@@ -78,7 +83,7 @@ function add_user_tahoelafs {
78 83
 function remove_user_tahoelafs {
79 84
     remove_username="$1"
80 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 87
         sed -i '/${remove_username}:/d' /etc/nginx/.htpasswd-tahoelafs
83 88
     fi
84 89
 }
@@ -87,7 +92,7 @@ function change_password_tahoelafs {
87 92
     change_username="$1"
88 93
     change_password="$2"
89 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 96
         sed -i '/tahoe-${change_username}:/d' /etc/nginx/.htpasswd-tahoelafs
92 97
     fi
93 98
     echo "${change_password}" | htpasswd -i -s /etc/nginx/.htpasswd-tahoelafs ${change_username}
@@ -164,13 +169,13 @@ function edit_tahoelafs_shares {
164 169
         TAHOELAFS_SHARES_TOTAL=${tl_total}
165 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 180
     systemctl restart tahoelafs-storage
176 181
     systemctl restart tahoelafs-client
@@ -263,7 +268,7 @@ function tahoelafs_setup_storage_config {
263 268
     echo '[connections]' >> $config_file
264 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 274
 function install_interactive_tahoelafs {
@@ -272,22 +277,11 @@ function install_interactive_tahoelafs {
272 277
 }
273 278
 
274 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 283
 function backup_local_tahoelafs {
290
-    source_directory=/home/tahoelafs
284
+    source_directory=$TAHOE_DIR
291 285
     if [ ! -d $source_directory ]; then
292 286
         return
293 287
     fi
@@ -304,21 +298,21 @@ function restore_local_tahoelafs {
304 298
     systemctl stop tahoelafs-client
305 299
     temp_restore_dir=/root/temptahoelafs
306 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 303
     if [ ! "$?" = "0" ]; then
310
-        mv /home/tahoelafs-old /home/tahoelafs
304
+        mv ${TAHOE_DIR}-old $TAHOE_DIR
311 305
         exit 246833
312 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 309
     systemctl start tahoelafs-client
316 310
     systemctl start tahoelafs-storage
317 311
     echo $"Restore complete"
318 312
 }
319 313
 
320 314
 function backup_remote_tahoelafs {
321
-    source_directory=/home/tahoelafs
315
+    source_directory=$TAHOE_DIR
322 316
     if [ ! -d $source_directory ]; then
323 317
         return
324 318
     fi
@@ -337,14 +331,14 @@ function restore_remote_tahoelafs {
337 331
     systemctl stop tahoelafs-client
338 332
     temp_restore_dir=/root/temptahoelafs
339 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 336
     if [ ! "$?" = "0" ]; then
343
-        mv /home/tahoelafs-old /home/tahoelafs
337
+        mv ${TAHOE_DIR}old $TAHOE_DIR
344 338
         exit 623925
345 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 342
     systemctl start tahoelafs-client
349 343
     systemctl start tahoelafs-storage
350 344
     echo $"Restore complete"
@@ -370,10 +364,15 @@ function remove_tahoelafs {
370 364
     systemctl stop tahoelafs-storage
371 365
     systemctl disable tahoelafs-storage
372 366
     rm /etc/systemd/system/tahoelafs-storage.service
367
+    systemctl daemon-reload
373 368
 
374 369
     systemctl stop tahoelafs-client
375 370
     systemctl disable tahoelafs-client
376 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 377
     if [ -d /var/lib/tahoelafs ]; then
379 378
         rm -rf /var/lib/tahoelafs
@@ -383,32 +382,18 @@ function remove_tahoelafs {
383 382
     remove_onion_service tahoelafs ${TAHOELAFS_ONION_PORT}
384 383
     remove_onion_service storage-tahoelafs ${TAHOELAFS_STORAGE_ONION_PORT} $(get_tahoelafs_nick)
385 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 391
     fi
390 392
     remove_app tahoelafs
391 393
     if [ -f /etc/nginx/.htpasswd-tahoelafs ]; then
392 394
         shred -zu /etc/nginx/.htpasswd-tahoelafs
393 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 399
 function create_tahoelafs_stealth_node {
@@ -496,7 +481,7 @@ function create_tahoelafs_client {
496 481
 }
497 482
 
498 483
 function get_tahoelafs_furl {
499
-    furl=$(cat /home/tahoelafs/storage/private/storage.furl)
484
+    furl=$(cat $TAHOE_DIR/storage/private/storage.furl)
500 485
     furl_1=$(echo "${furl}" | awk -F ' ' '{print $1}')
501 486
     furl_2=$(echo "${furl}" | awk -F ':' '{print $5}')
502 487
     echo "${furl_1}:${furl_2}"
@@ -511,7 +496,7 @@ function get_tahoelafs_storage_hostname {
511 496
 }
512 497
 
513 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 502
 function add_tahoelafs_server {
@@ -572,12 +557,12 @@ function create_tahoelafs_daemon {
572 557
     echo 'Type=simple' >> $TAHOELAFS_DAEMON_FILE
573 558
     echo "User=tahoelafs" >> $TAHOELAFS_DAEMON_FILE
574 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 563
     echo 'Restart=on-failure' >> $TAHOELAFS_DAEMON_FILE
579 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 566
     echo '' >> $TAHOELAFS_DAEMON_FILE
582 567
     echo '[Install]' >> $TAHOELAFS_DAEMON_FILE
583 568
     echo 'WantedBy=multi-user.target' >> $TAHOELAFS_DAEMON_FILE
@@ -627,7 +612,7 @@ function create_tahoelafs_web {
627 612
     if [ ! -f /etc/nginx/.htpasswd-tahoelafs ]; then
628 613
         touch /etc/nginx/.htpasswd-tahoelafs
629 614
     fi
630
-    if grep "${MY_USERNAME}:" /etc/nginx/.htpasswd-tahoelafs; then
615
+    if grep -q "${MY_USERNAME}:" /etc/nginx/.htpasswd-tahoelafs; then
631 616
         sed -i '/${MY_USERNAME}:/d' /etc/nginx/.htpasswd-tahoelafs
632 617
     fi
633 618
     echo "${TAHOELAFS_ADMIN_PASSWORD}" | htpasswd -i -s /etc/nginx/.htpasswd-tahoelafs ${MY_USERNAME}
@@ -643,30 +628,42 @@ function install_tahoelafs {
643 628
     fi
644 629
 
645 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 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 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 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 665
     # set permissions
669
-    chown -R tahoelafs:debian-tor /home/tahoelafs
666
+    chown -R tahoelafs:debian-tor $TAHOE_DIR
670 667
 
671 668
     node_nick=$(get_tahoelafs_nick)
672 669
     client_nick=${MY_USERNAME}-client
@@ -677,14 +674,14 @@ function install_tahoelafs {
677 674
     # create an onion address for client node
678 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 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 681
     create_tahoelafs_daemon "storage"
685 682
 
686 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 685
     add_tahoelafs_server "$(get_tahoelafs_storage_hostname)" "$(get_tahoelafs_public_key)" "${node_nick}" "$(get_tahoelafs_furl)"
689 686
     if ! grep -q "HidServAuth $(get_tahoelafs_storage_hostname)" /etc/tor/torrc; then
690 687
         echo $'Unable to create tahoelafs server'
@@ -696,11 +693,10 @@ function install_tahoelafs {
696 693
     fi
697 694
     create_tahoelafs_daemon "client"
698 695
 
699
-    set_completion_param "tahoelafs commit" "$TAHOELAFS_COMMIT"
700 696
     set_completion_param "tahoelafs onion domain" "$TAHOELAFS_ONION_HOSTNAME"
701 697
 
702 698
     create_tahoelafs_web
703
-    systemctl restart tor
699
+    onion_update
704 700
     APP_INSTALLED=1
705 701
 }
706 702
 

+ 68
- 16
src/freedombone-app-tox 查看文件

@@ -35,7 +35,7 @@ SHOW_ON_ABOUT=1
35 35
 
36 36
 TOX_PORT=33445
37 37
 TOXCORE_REPO="https://github.com/bashrc/toxcore"
38
-TOXCORE_COMMIT='d3fa9f82bda3a8746917502c525237427ba17d45'
38
+TOXCORE_COMMIT='532629d486e3361c7d8d95b38293cc7d61dc4ee5'
39 39
 TOXID_REPO="https://github.com/bashrc/toxid"
40 40
 TOX_BOOTSTRAP_ID_FILE=/var/lib/tox-bootstrapd/pubkey.txt
41 41
 # These are some default nodes, but you can replace them with trusted nodes
@@ -60,6 +60,14 @@ tox_variables=(SYSTEM_TYPE
60 60
                TOX_PORT
61 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 71
 function remove_user_tox {
64 72
     remove_username="$1"
65 73
 
@@ -122,12 +130,24 @@ function mesh_tox_qtox {
122 130
         mkdir -p ${rootdir}$INSTALL_DIR
123 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 151
     if [ ! -d ${rootdir}$INSTALL_DIR/qtox ]; then
132 152
         exit 72428
133 153
     fi
@@ -323,8 +343,17 @@ function tox_avahi {
323 343
 
324 344
     # install a command to obtain the Tox ID
325 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 357
     if [ ! -d $INSTALL_DIR/toxid ]; then
329 358
         exit 63921
330 359
     fi
@@ -442,13 +471,13 @@ function mesh_tox_node {
442 471
     if [ $rootdir ]; then
443 472
         chroot ${rootdir} apt-get -yq install build-essential libtool autotools-dev
444 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 475
         chroot ${rootdir} apt-get -yq install libconfig9 libconfig-dev autoconf
447 476
         chroot ${rootdir} apt-get -yq install libopus-dev libvpx-dev
448 477
     else
449 478
         apt-get -yq install build-essential libtool autotools-dev
450 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 481
         apt-get -yq install libconfig9 libconfig-dev autoconf
453 482
         apt-get -yq install libopus-dev libvpx-dev
454 483
     fi
@@ -457,9 +486,16 @@ function mesh_tox_node {
457 486
         mkdir -p ${rootdir}${INSTALL_DIR}
458 487
     fi
459 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 499
         fi
464 500
     fi
465 501
     cd ${rootdir}$INSTALL_DIR/toxcore
@@ -580,7 +616,15 @@ function mesh_tox_avahi {
580 616
         mkdir -p ${rootdir}${INSTALL_DIR}
581 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 628
     if [ ! -d ${rootdir}${INSTALL_DIR}/toxid ]; then
585 629
         echo $'Unable to clone toxid repo'
586 630
         exit 768352
@@ -647,7 +691,14 @@ function mesh_tox_client {
647 691
     TEMP_SCRIPT=/tmp/$TEMP_SCRIPT_NAME
648 692
     echo '#!/bin/bash' > $TEMP_SCRIPT
649 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 702
     echo "cd $INSTALL_DIR/toxic" >> $TEMP_SCRIPT
652 703
     echo "git checkout $TOXIC_COMMIT -b $TOXIC_COMMIT" >> $TEMP_SCRIPT
653 704
     echo 'make' >> $TEMP_SCRIPT
@@ -668,6 +719,7 @@ function mesh_tox_client {
668 719
         /root/$TEMP_SCRIPT_NAME
669 720
     fi
670 721
     if [ ! "$?" = "0" ]; then
722
+        cat -n /root/fbtmp728353.sh
671 723
         duration=$SECONDS
672 724
         echo $"Toxic client compile failed at $(($duration / 60)) minutes and $(($duration % 60)) seconds elapsed."
673 725
         echo $'Unable to make tox client'
@@ -684,12 +736,12 @@ function mesh_tox_client {
684 736
 }
685 737
 
686 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 742
     cat >> $rootdir/root/gettoxkey.sh <<EOF
691 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 745
 apt-key add /root/tox.key
694 746
 rm /root/tox.key
695 747
 EOF

+ 45
- 5
src/freedombone-app-turtl 查看文件

@@ -59,6 +59,14 @@ turtl_variables=(ONION_ONLY
59 59
                  MY_EMAIL_ADDRESS
60 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 70
 function change_password_turtl {
63 71
     change_username="$1"
64 72
     new_user_password="$2"
@@ -90,7 +98,7 @@ function install_interactive_turtl {
90 98
 }
91 99
 
92 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 102
         if [ -f $turtl_users_file ]; then
95 103
             cp $turtl_users_file $TURTL_BASE_DIR/.users.lisp
96 104
             sed -i '/(route (:post "\/users") (req res)/,/(send-json res user))))/{//!d}' $turtl_users_file
@@ -102,7 +110,7 @@ function turtl_disable_registrations {
102 110
 }
103 111
 
104 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 114
         if [ -f $TURTL_BASE_DIR/.users.lisp ]; then
107 115
             cp $TURTL_BASE_DIR/.users.lisp $turtl_users_file
108 116
             rm $TURTL_BASE_DIR/.users.lisp
@@ -186,6 +194,11 @@ function reconfigure_turtl {
186 194
 }
187 195
 
188 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 202
     read_config_param "TURTL_DOMAIN_NAME"
190 203
 
191 204
     function_check set_repo_commit
@@ -351,11 +364,12 @@ function remove_turtl {
351 364
     systemctl stop turtl
352 365
     systemctl disable turtl
353 366
     rm /etc/systemd/system/turtl.service
367
+    systemctl daemon-reload
368
+
354 369
     remove_rethinkdb
355 370
     remove_app turtl
356 371
     remove_completion_param install_turtl
357 372
     sed -i '/turtl/d' $COMPLETION_FILE
358
-    deluser turtl
359 373
     nginx_dissite $TURTL_DOMAIN_NAME
360 374
     if [ -f /etc/nginx/sites-available/$TURTL_DOMAIN_NAME ]; then
361 375
         rm /etc/nginx/sites-available/$TURTL_DOMAIN_NAME
@@ -368,6 +382,9 @@ function remove_turtl {
368 382
     rm -rf /etc/rethinkdb
369 383
     rm -rf /var/lib/rethinkdb
370 384
     rm -rf $TURTL_BASE_DIR
385
+
386
+    groupdel -f turtl
387
+    userdel -r turtl
371 388
 }
372 389
 
373 390
 
@@ -433,6 +450,11 @@ __ENDCONFIG__
433 450
     # start the turtl server
434 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 458
     echo '[Unit]' > /etc/systemd/system/turtl.service
437 459
     echo 'Description=Note taking service' >> /etc/systemd/system/turtl.service
438 460
     echo 'Documentation=http://turtl.it' >> /etc/systemd/system/turtl.service
@@ -452,7 +474,7 @@ __ENDCONFIG__
452 474
         if [[ "$check_architecture" != *"arm"* ]]; then
453 475
             echo "ExecStart=$TURTL_BASE_DIR/ccl/lx86cl -l $TURTL_BASE_DIR/quicklisp/setup.lisp -l launch.lisp" >> /etc/systemd/system/turtl.service
454 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 478
         fi
457 479
     fi
458 480
     echo '' >> /etc/systemd/system/turtl.service
@@ -561,7 +583,16 @@ __ENDCONFIG__
561 583
         wget https://beta.quicklisp.org/quicklisp.lisp
562 584
     fi
563 585
 
586
+    if [ -d $TURTL_BASE_DIR ]; then
587
+        chown -R turtl:turtl $TURTL_BASE_DIR
588
+    fi
564 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 596
     chown -R turtl:turtl $TURTL_BASE_DIR
566 597
 
567 598
     if [[ "$check_architecture" != *"arm"* ]]; then
@@ -581,7 +612,16 @@ __ENDCONFIG__
581 612
 
582 613
     # install turtl API
583 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 625
     cd $TURTL_BASE_DIR/api
586 626
     git checkout $TURTL_COMMIT -b $TURTL_COMMIT
587 627
     set_completion_param "turtl commit" "$TURTL_COMMIT"

+ 8
- 0
src/freedombone-app-vim 查看文件

@@ -39,6 +39,14 @@ VIM_MUTT_EDITOR='vim \"+set nonumber\" \"+set insertmode\" \"+set spell\" +/^$/
39 39
 vim_variables=(MY_USERNAME
40 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 50
 function reconfigure_vim {
43 51
     echo -n ''
44 52
 }

+ 8
- 0
src/freedombone-app-vpn 查看文件

@@ -35,6 +35,14 @@ SHOW_ON_ABOUT=0
35 35
 
36 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 46
 function install_interactive_vpn {
39 47
     echo -n ''
40 48
     APP_INSTALLED=1

+ 29
- 13
src/freedombone-app-xmpp 查看文件

@@ -50,15 +50,6 @@ prosody_nightly_url="https://prosody.im/nightly/${prosody_latest_version}/latest
50 50
 prosody_modules_filename='prosody-modules-20170514.tar.gz'
51 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 53
 xmpp_variables=(ONION_ONLY
63 54
                 INSTALLED_WITHIN_DOCKER
64 55
                 XMPP_CIPHERS
@@ -68,6 +59,28 @@ xmpp_variables=(ONION_ONLY
68 59
                 DEFAULT_DOMAIN_NAME
69 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 84
 function xmpp_add_onion_address {
72 85
     domain_name="$1"
73 86
     onion_address="$2"
@@ -343,7 +356,7 @@ function update_prosody_modules {
343 356
     fi
344 357
 
345 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 360
         # This strange dance seems to fix occasional breakage of PEP
348 361
         # Is there a better solution?
349 362
         sed -i 's|"pep"|"profile"|g' /etc/prosody/prosody.cfg.lua
@@ -352,7 +365,7 @@ function update_prosody_modules {
352 365
         sed -i 's|"profile"|"pep"|g' /etc/prosody/prosody.cfg.lua
353 366
         systemctl restart prosody
354 367
     fi
355
-    if ! grep '"vcard"' /etc/prosody/prosody.cfg.lua; then
368
+    if ! grep -q '"vcard"' /etc/prosody/prosody.cfg.lua; then
356 369
         systemctl stop prosody
357 370
         sed -i '/"pep"/a "vcard";' /etc/prosody/prosody.cfg.lua
358 371
         systemctl start prosody
@@ -420,6 +433,9 @@ function upgrade_xmpp {
420 433
         set_completion_param "prosody_filename" "${prosody_filename}"
421 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 439
     systemctl restart prosody
424 440
 }
425 441
 
@@ -447,7 +463,7 @@ function restore_local_xmpp {
447 463
             exit 725
448 464
         fi
449 465
         rm -rf $temp_restore_dir
450
-        service prosody restart
466
+        systemctl restart prosody
451 467
         chown -R prosody:prosody /var/lib/prosody/*
452 468
         echo $"Restore of xmpp settings complete"
453 469
     fi
@@ -472,7 +488,7 @@ function restore_remote_xmpp {
472 488
             exit 725
473 489
         fi
474 490
         rm -rf $temp_restore_dir
475
-        service prosody restart
491
+        systemctl restart prosody
476 492
         chown -R prosody:prosody /var/lib/prosody/*
477 493
         echo $"Restore of xmpp settings complete"
478 494
     fi

+ 18
- 1
src/freedombone-app-zeronet 查看文件

@@ -59,6 +59,14 @@ zeronet_variables=(TRACKER_PORT
59 59
                    ZERONET_DEFAULT_FORUM_TAGLINE
60 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 70
 function install_interactive_zeronet {
63 71
     echo -n ''
64 72
     APP_INSTALLED=1
@@ -432,7 +440,16 @@ function mesh_zeronet {
432 440
     chroot "$rootdir" pip install msgpack-python --upgrade
433 441
 
434 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 453
     if [ ! -d $rootdir$MESH_INSTALL_DIR/zeronet ]; then
437 454
         echo 'WARNING: Unable to clone zeronet'
438 455
         return

+ 37
- 0
src/freedombone-backup-local 查看文件

@@ -42,6 +42,22 @@ if [ -f /usr/bin/${PROJECT_NAME} ]; then
42 42
     PROJECT_INSTALL_DIR=/usr/bin
43 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 61
 source $PROJECT_INSTALL_DIR/${PROJECT_NAME}-vars
46 62
 
47 63
 # include utils which allow function_check and drive mount
@@ -51,6 +67,8 @@ do
51 67
   source $f
52 68
 done
53 69
 
70
+clear
71
+
54 72
 USB_DRIVE=/dev/sdb1
55 73
 USB_MOUNT=/mnt/usb
56 74
 
@@ -241,6 +259,22 @@ function prepare_directories {
241 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 278
 function backup_configfiles {
245 279
     echo $"Backing up ${PROJECT_NAME} configuration files"
246 280
     temp_backup_dir=/root/tempbackupconfig
@@ -267,6 +301,7 @@ function backup_configfiles {
267 301
         cp -f /etc/nginx/.htpasswd $temp_backup_dir/htpasswd
268 302
     fi
269 303
     backup_directory_to_usb $temp_backup_dir configfiles
304
+    rm -rf $temp_backup_dir
270 305
 }
271 306
 
272 307
 function backup_admin_readme {
@@ -287,6 +322,7 @@ function backup_mariadb {
287 322
         if [ ! -d $temp_backup_dir ]; then
288 323
             mkdir $temp_backup_dir
289 324
         fi
325
+        keep_database_running
290 326
         mysqldump --lock-tables --password="$DATABASE_PASSWORD" mysql user > $temp_backup_dir/mysql.sql
291 327
         if [ ! -s $temp_backup_dir/mysql.sql ]; then
292 328
             echo $"Unable to backup mysql settings"
@@ -316,6 +352,7 @@ prepare_directories
316 352
 backup_directories
317 353
 backup_apps local
318 354
 backup_configfiles
355
+backup_blocklist
319 356
 backup_admin_readme
320 357
 backup_mariadb
321 358
 backup_extra_directories local

+ 20
- 2
src/freedombone-backup-remote 查看文件

@@ -92,7 +92,7 @@ function suspend_site {
92 92
     fi
93 93
     SUSPENDED_SITE="$1"
94 94
     nginx_dissite $SUSPENDED_SITE
95
-    service nginx reload
95
+    systemctl reload nginx
96 96
 }
97 97
 
98 98
 function restart_site {
@@ -101,10 +101,26 @@ function restart_site {
101 101
         return
102 102
     fi
103 103
     nginx_ensite $SUSPENDED_SITE
104
-    service nginx reload
104
+    systemctl reload nginx
105 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 124
 function backup_configfiles {
109 125
     echo $"Backing up ${PROJECT_NAME} configuration files"
110 126
     temp_backup_dir=/root/tempbackupconfig
@@ -305,6 +321,7 @@ function backup_mariadb {
305 321
         if [ ! -d $temp_backup_dir ]; then
306 322
             mkdir $temp_backup_dir
307 323
         fi
324
+        keep_database_running
308 325
         mysqldump --password=$DATABASE_PASSWORD mysql user > $temp_backup_dir/mysql.sql
309 326
         if [ ! -s $temp_backup_dir/mysql.sql ]; then
310 327
             echo $"Unable to backup MariaDB settings"
@@ -385,6 +402,7 @@ fi
385 402
 
386 403
 backup_configfiles
387 404
 if [[ $TEST_MODE == "no" ]]; then
405
+    backup_blocklist
388 406
     backup_users
389 407
     backup_letsencrypt
390 408
     backup_passwordstore

+ 69
- 106
src/freedombone-base-email 查看文件

@@ -13,7 +13,7 @@
13 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 18
 # This program is free software: you can redistribute it and/or modify
19 19
 # it under the terms of the GNU Affero General Public License as published by
@@ -48,9 +48,6 @@ GPG_KEYSERVER="hkp://keys.gnupg.net"
48 48
 # whether to encrypt all incoming email with your public key
49 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 51
 # optionally you can provide your exported GPG key pair here
55 52
 # Note that the private key file will be deleted after use
56 53
 # If these are unspecified then a new GPG key will be created
@@ -157,10 +154,12 @@ function configure_email_onion {
157 154
         return
158 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 164
     function_check onion_update
166 165
     onion_update
@@ -168,8 +167,9 @@ function configure_email_onion {
168 167
     function_check wait_for_onion_service
169 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 171
         echo $"email onion site hostname not found"
172
+        systemctl restart tor
173 173
         exit 782352
174 174
     fi
175 175
 
@@ -303,15 +303,15 @@ function encrypt_outgoing_email {
303 303
     if ! grep -q "pgp_encrypt_only_command" /home/$MY_USERNAME/.muttrc; then
304 304
         echo '' >> /home/$MY_USERNAME/.muttrc
305 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 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 309
     fi
310 310
 
311 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 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 315
     fi
316 316
 
317 317
     mark_completed $FUNCNAME
@@ -365,7 +365,7 @@ function email_client {
365 365
     if [[ $(is_completed $FUNCNAME) == "1" ]]; then
366 366
         return
367 367
     fi
368
-    apt-get -yq install mutt-patched lynx abook urlview
368
+    apt-get -yq install lynx abook urlview mutt
369 369
 
370 370
     if [ ! -f /etc/Muttrc ]; then
371 371
         echo $"ERROR: Mutt does not appear to have installed. $CHECK_MESSAGE"
@@ -403,8 +403,6 @@ function email_client {
403 403
     echo '# set up the sidebar' >> /etc/Muttrc
404 404
     echo 'set sidebar_width=22' >> /etc/Muttrc
405 405
     echo 'set sidebar_visible=yes' >> /etc/Muttrc
406
-    echo "set sidebar_delim='|'" >> /etc/Muttrc
407
-    echo 'set sidebar_sort=yes' >> /etc/Muttrc
408 406
     echo '' >> /etc/Muttrc
409 407
     echo 'set rfc2047_parameters' >> /etc/Muttrc
410 408
     echo '' >> /etc/Muttrc
@@ -652,8 +650,6 @@ function create_private_mailing_list {
652 650
     if [ ! -d /etc/exim4 ]; then
653 651
         return
654 652
     fi
655
-    # This installation doesn't work, results in ruby errors
656
-    # There is currently no schleuder package for Debian jessie
657 653
     if [[ $(is_completed $FUNCNAME) == "1" ]]; then
658 654
         return
659 655
     fi
@@ -715,6 +711,14 @@ function create_private_mailing_list {
715 711
 function split_gpg_key_into_fragments {
716 712
     # split the gpg key into fragments if social key management is enabled
717 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 722
         echo 'Splitting GPG key. You may need to enter your passphrase.'
719 723
         ${PROJECT_NAME}-splitkey -u $MY_USERNAME -e $MY_EMAIL_ADDRESS --fullname "$MY_NAME"
720 724
         if [ ! -d /home/$MY_USERNAME/.gnupg_fragments ]; then
@@ -1155,7 +1159,7 @@ function spam_filtering {
1155 1159
     echo '#!/bin/bash' > /usr/bin/filterspam
1156 1160
     echo 'for d in /home/*/ ; do' >> /usr/bin/filterspam
1157 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 1163
     echo '        MAILDIR=/home/$USERNAME/Maildir/.learn-spam' >> /usr/bin/filterspam
1160 1164
     echo '        if [ ! -d "$MAILDIR" ]; then' >> /usr/bin/filterspam
1161 1165
     echo '           exit' >> /usr/bin/filterspam
@@ -1177,7 +1181,7 @@ function spam_filtering {
1177 1181
     echo '#!/bin/bash' > /usr/bin/filterham
1178 1182
     echo 'for d in /home/*/ ; do' >> /usr/bin/filterham
1179 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 1185
     echo '        MAILDIR=/home/$USERNAME/Maildir/.learn-ham' >> /usr/bin/filterham
1182 1186
     echo '        if [ ! -d "$MAILDIR" ]; then' >> /usr/bin/filterham
1183 1187
     echo '            exit' >> /usr/bin/filterham
@@ -1271,8 +1275,6 @@ function configure_imap {
1271 1275
         return
1272 1276
     fi
1273 1277
 
1274
-    dpkg -P dovecot-imapd
1275
-    dpkg -P dovecot-core
1276 1278
     apt-get -yq install dovecot-imapd
1277 1279
 
1278 1280
     if [ ! -d /etc/dovecot ]; then
@@ -1280,19 +1282,9 @@ function configure_imap {
1280 1282
         exit 48
1281 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 1288
     fi
1297 1289
 
1298 1290
     chmod 600 /etc/shadow
@@ -1313,18 +1305,11 @@ function configure_imap {
1313 1305
     fi
1314 1306
     sed -i 's|#ssl =.*|ssl = required|g' /etc/dovecot/conf.d/10-ssl.conf
1315 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 1313
     sed -i 's/#ssl_prefer_server_ciphers.*/ssl_prefer_server_ciphers = yes/g' /etc/dovecot/conf.d/10-ssl.conf
1329 1314
     sed -i "s|#ssl_protocols =.*|ssl_protocols = '$SSL_PROTOCOLS'|g" /etc/dovecot/conf.d/10-ssl.conf
1330 1315
     sed -i "s|ssl_protocols =.*|ssl_protocols = '$SSL_PROTOCOLS'|g" /etc/dovecot/conf.d/10-ssl.conf
@@ -1374,7 +1359,7 @@ function configure_imap {
1374 1359
     fi
1375 1360
 
1376 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 1363
         echo '' >> /etc/dovecot/dovecot.conf
1379 1364
         echo '# logging' >> /etc/dovecot/dovecot.conf
1380 1365
         echo 'log_path = /var/log/dovecot.log' >> /etc/dovecot/dovecot.conf
@@ -1437,7 +1422,7 @@ function configure_imap_client_certs {
1437 1422
     echo 'serial = sslserial' >> /etc/ssl/dovecot-ca.cnf
1438 1423
     echo 'default_days = 3650' >> /etc/ssl/dovecot-ca.cnf
1439 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 1426
     echo 'policy = dovecot-ca_policy' >> /etc/ssl/dovecot-ca.cnf
1442 1427
     echo 'x509_extensions = dovecot-ca_extensions' >> /etc/ssl/dovecot-ca.cnf
1443 1428
     echo '' >> /etc/ssl/dovecot-ca.cnf
@@ -1469,6 +1454,7 @@ function configure_imap_client_certs {
1469 1454
 }
1470 1455
 
1471 1456
 function create_gpg_subkey {
1457
+    # Note: currently not used
1472 1458
     if [ ! -d /etc/exim4 ]; then
1473 1459
         return
1474 1460
     fi
@@ -1487,20 +1473,23 @@ function create_gpg_subkey {
1487 1473
     KEYGRIP=$(gpg --fingerprint --fingerprint $MY_EMAIL_ADDRESS | grep fingerprint | tail -1 | cut -d= -f2 | sed -e 's/ //g')
1488 1474
 
1489 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 1480
     echo "subkey-Usage: $GPG_KEY_USAGE" > /home/$MY_USERNAME/gpg-genkey.conf
1496 1481
     echo "Name-Real:  $MY_NAME" >> /home/$MY_USERNAME/gpg-genkey.conf
1497 1482
     echo "Name-Email: $MY_EMAIL_ADDRESS" >> /home/$MY_USERNAME/gpg-genkey.conf
1498 1483
     echo "Name-Comment: $GPG_KEY_USAGE" >> /home/$MY_USERNAME/gpg-genkey.conf
1499 1484
     echo 'Expire-Date: 0' >> /home/$MY_USERNAME/gpg-genkey.conf
1485
+    echo "Passphrase: $PROJECT_NAME" >> /home/$MY_USERNAME/gpg-genkey.conf
1500 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 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 1494
     mark_completed $FUNCNAME
1506 1495
 }
@@ -1538,7 +1527,12 @@ function configure_gpg {
1538 1527
     gpg_dir=/home/$MY_USERNAME/.gnupg
1539 1528
 
1540 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 1536
         echo $'GPG keys were imported'
1543 1537
         sed -i "s|keyserver hkp://keys.gnupg.net|keyserver $GPG_KEYSERVER|g" $gpg_dir/gpg.conf
1544 1538
         MY_GPG_PUBLIC_KEY_ID=$(gpg_pubkey_from_email "$MY_USERNAME" "$MY_EMAIL_ADDRESS")
@@ -1582,12 +1576,15 @@ function configure_gpg {
1582 1576
             echo $"GPG public key file $MY_GPG_PUBLIC_KEY was not found"
1583 1577
             exit 2483
1584 1578
         fi
1579
+
1585 1580
         if [ ! -f $MY_GPG_PRIVATE_KEY ]; then
1586 1581
             echo $"GPG private key file $MY_GPG_PRIVATE_KEY was not found"
1587 1582
             exit 5383
1588 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 1588
         KEY_EXISTS=$(gpg_key_exists "$MY_USERNAME" "$MY_EMAIL_ADDRESS")
1592 1589
         if [[ $KEY_EXISTS == "no" ]]; then
1593 1590
             echo $"The GPG key for $MY_EMAIL_ADDRESS could not be imported"
@@ -1602,57 +1599,23 @@ function configure_gpg {
1602 1599
         fi
1603 1600
     else
1604 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 1606
         fi
1620
-        shred -zu /home/$MY_USERNAME/gpg-genkey.conf
1621 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 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 1616
     fi
1617
+    gpg_agent_setup root
1618
+    gpg_agent_setup $MY_USERNAME
1656 1619
 
1657 1620
     mark_completed $FUNCNAME
1658 1621
 }

+ 1
- 1
src/freedombone-client 查看文件

@@ -154,7 +154,7 @@ function configure_ssh_client {
154 154
         ssh-keygen -t ed25519 -o -a 100
155 155
     fi
156 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 158
     fi
159 159
 
160 160
     ssh_remove_small_moduli

+ 126
- 62
src/freedombone-config 查看文件

@@ -14,7 +14,7 @@
14 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 19
 # This program is free software: you can redistribute it and/or modify
20 20
 # it under the terms of the GNU Affero General Public License as published by
@@ -95,12 +95,7 @@ MINIMAL_INSTALL="yes"
95 95
 DEFAULT_LANGUAGE='en_GB.UTF-8'
96 96
 ONION_ONLY="no"
97 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 100
 VALID_CODE=
106 101
 
@@ -109,6 +104,20 @@ if [ -f /usr/bin/${PROJECT_NAME} ]; then
109 104
     PROJECT_INSTALL_DIR=/usr/bin
110 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 121
 source $PROJECT_INSTALL_DIR/${PROJECT_NAME}-vars
113 122
 
114 123
 UTILS_FILES=/usr/share/${PROJECT_NAME}/utils/${PROJECT_NAME}-utils-*
@@ -130,13 +139,14 @@ function show_help {
130 139
     echo $'Creates an inventory of remote backup locations'
131 140
     echo ''
132 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 150
     echo ''
141 151
     exit 0
142 152
 }
@@ -170,9 +180,65 @@ function choose_email_address {
170 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 234
 function choose_default_domain_name {
235
+    if [ $SOCIALINSTANCE ]; then
236
+        choose_social_instance_domain_name
237
+        return
238
+    fi
239
+
174 240
     if [[ $ONION_ONLY != "no" ]]; then
175
-        DEFAULT_DOMAIN_NAME="${PROJECT_NAME}.local"
241
+        DEFAULT_DOMAIN_NAME="${LOCAL_NAME}.local"
176 242
     else
177 243
         DEFAULT_DOMAIN_DETAILS_COMPLETE=
178 244
         while [ ! $DEFAULT_DOMAIN_DETAILS_COMPLETE ]
@@ -608,6 +674,9 @@ function choose_username {
608 674
                            if [ ${#possible_username} -gt 1 ]; then
609 675
                                if [[ $possible_username != $GENERIC_IMAGE_USERNAME ]]; then
610 676
                                    MY_USERNAME=$(cat $data)
677
+                                   please_wait
678
+                                   echo ''
679
+                                   echo $'Creating user account'
611 680
                                    chmod 600 /etc/shadow
612 681
                                    chmod 600 /etc/gshadow
613 682
                                    useradd -m -s /bin/bash $MY_USERNAME
@@ -665,6 +734,8 @@ function choose_username {
665 734
         exit 6437
666 735
     fi
667 736
     save_configuration_values
737
+    please_wait
738
+    echo ''
668 739
 }
669 740
 
670 741
 function choose_full_name {
@@ -691,6 +762,8 @@ function choose_full_name {
691 762
         esac
692 763
     done
693 764
     save_configuration_values
765
+    please_wait
766
+    echo ''
694 767
 }
695 768
 
696 769
 function choose_system_variant {
@@ -761,6 +834,12 @@ do
761 834
             shift
762 835
             FREEDOMBONE_WEBSITE="$1"
763 836
             ;;
837
+        --social)
838
+            shift
839
+            if [[ "$1" == 'gnusocial' || "$1" == 'postactiv' ]]; then
840
+                SOCIALINSTANCE="$1"
841
+            fi
842
+            ;;
764 843
         --minimal)
765 844
             shift
766 845
             MINIMAL_INSTALL="$1"
@@ -776,48 +855,6 @@ do
776 855
     shift
777 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 858
 function interactive_select_language {
822 859
     data=$(tempfile 2>/dev/null)
823 860
     trap "rm -f $data" 0 1 2 5 15
@@ -968,12 +1005,18 @@ function interactive_select_language {
968 1005
     esac
969 1006
     save_configuration_values
970 1007
 
1008
+    please_wait
1009
+    echo ''
1010
+    echo 'Setting locale'
1011
+
971 1012
     locale-gen "${DEFAULT_LANGUAGE}"
972 1013
     update-locale LANG=${DEFAULT_LANGUAGE}
973 1014
     update-locale LANGUAGE=${DEFAULT_LANGUAGE}
974 1015
     update-locale LC_MESSAGES=${DEFAULT_LANGUAGE}
975 1016
     update-locale LC_ALL=${DEFAULT_LANGUAGE}
976 1017
     update-locale LC_CTYPE=${DEFAULT_LANGUAGE}
1018
+    please_wait
1019
+    echo ''
977 1020
 }
978 1021
 
979 1022
 function select_user {
@@ -981,7 +1024,7 @@ function select_user {
981 1024
 
982 1025
     users_array=($(ls /home))
983 1026
 
984
-    delete=(mirrors git)
1027
+    delete=(git)
985 1028
     for del in ${delete[@]}
986 1029
     do
987 1030
         users_array=(${users_array[@]/$del})
@@ -1019,16 +1062,19 @@ function interactive_config {
1019 1062
 
1020 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 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 1073
     fi
1027 1074
 
1028 1075
     dialog --title $"Freedombone" --msgbox "$INITIAL_MESSAGE" 15 50
1029 1076
 
1030 1077
     #choose_system_variant
1031
-    set_main_repo
1032 1078
     choose_username
1033 1079
     choose_full_name
1034 1080
     choose_social_key_management
@@ -1040,6 +1086,24 @@ function interactive_config {
1040 1086
     choose_email_address
1041 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 1107
     # delete the temporary configuration file
1044 1108
     if [ -f temp.cfg ]; then
1045 1109
         shred -zu temp.cfg

+ 161
- 157
src/freedombone-controlpanel 查看文件

@@ -33,6 +33,33 @@ PROJECT_NAME='freedombone'
33 33
 export TEXTDOMAIN=${PROJECT_NAME}-controlpanel
34 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 63
 UTILS_FILES=/usr/share/${PROJECT_NAME}/utils/${PROJECT_NAME}-utils-*
37 64
 for f in $UTILS_FILES
38 65
 do
@@ -45,6 +72,8 @@ do
45 72
     source $f
46 73
 done
47 74
 
75
+# End including files
76
+
48 77
 COMPLETION_FILE=$HOME/${PROJECT_NAME}-completed.txt
49 78
 SELECTED_USERNAME=
50 79
 SIP_CONFIGURATION_FILE=/etc/sipwitch.conf
@@ -94,16 +123,11 @@ read_config_param SMTP_PROXY_USERNAME
94 123
 read_config_param SMTP_PROXY_PASSWORD
95 124
 read_config_param USB_DRIVE
96 125
 read_config_param MY_USERNAME
126
+read_config_param ONION_ONLY
97 127
 if [[ $USB_DRIVE == *"dev"* ]]; then
98 128
     USB_DRIVE=$(echo ${USB_DRIVE} | awk -F '/' '{print $3}' | sed 's|1||g' | sed 's|2||g')
99 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 131
 function any_key {
108 132
     echo ' '
109 133
     read -n1 -r -p $"Press any key to continue..." key
@@ -123,7 +147,7 @@ function passwords_select_user {
123 147
 
124 148
     users_array=($(ls /home))
125 149
 
126
-    delete=(mirrors git)
150
+    delete=(git)
127 151
     for del in ${delete[@]}
128 152
     do
129 153
         users_array=(${users_array[@]/$del})
@@ -165,6 +189,9 @@ function passwords_show_apps {
165 189
             name+=("$a")
166 190
         fi
167 191
     done
192
+    i=$((i+1))
193
+    W+=($i "mariadb")
194
+    name+=("mariadb")
168 195
 
169 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,6 +242,13 @@ function view_or_change_passwords {
215 242
         fi
216 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 252
     data=$(tempfile 2>/dev/null)
219 253
     trap "rm -f $data" 0 1 2 5 15
220 254
     dialog --title "$titlestr" \
@@ -250,54 +284,6 @@ function check_for_updates {
250 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 287
 function add_user {
302 288
     data=$(tempfile 2>/dev/null)
303 289
     trap "rm -f $data" 0 1 2 5 15
@@ -390,6 +376,11 @@ function show_domains {
390 376
             if grep -q "SHOW_ICANN_ADDRESS_ON_ABOUT=0" /usr/share/${PROJECT_NAME}/apps/${PROJECT_NAME}-app-${app_name}; then
391 377
                 icann_address='-'
392 378
             fi
379
+            if [[ $ONION_ONLY != 'no' ]]; then
380
+                if [[ ${icann_address} != ${LOCAL_NAME}.local ]]; then
381
+                    icann_address='-'
382
+                fi
383
+            fi
393 384
             onion_address=$(get_app_onion_address "$app_name")
394 385
             if [ ${#onion_address} -eq 0 ]; then
395 386
                 onion_address="-"
@@ -469,20 +460,6 @@ function show_users {
469 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 463
 function show_tahoelafs {
487 464
     if [ ! -f /home/tahoelafs/storage/private/storage.furl ]; then
488 465
         return
@@ -561,19 +538,17 @@ function show_tahoelafs_introducer {
561 538
 }
562 539
 
563 540
 function show_about {
564
-    clear
565
-    echo ''
566
-    echo $'  Detecting installed apps...'
567 541
     detect_apps
568 542
     get_apps_installed_names
569 543
 
570 544
     clear
545
+    echo "==== ${PROJECT_NAME} version ${VERSION} ($DEBIAN_VERSION) ===="
546
+    echo ''
571 547
     show_ip_addresses
572 548
     show_tor_bridges
573 549
     show_ssh_public_key
574 550
     show_domains
575 551
     show_tahoelafs
576
-    show_mirrors_password
577 552
     show_users
578 553
     any_key
579 554
 }
@@ -583,7 +558,7 @@ function select_user {
583 558
 
584 559
     users_array=($(ls /home))
585 560
 
586
-    delete=(mirrors git)
561
+    delete=(git)
587 562
     for del in ${delete[@]}
588 563
     do
589 564
         users_array=(${users_array[@]/$del})
@@ -1018,7 +993,8 @@ function create_keydrive_master {
1018 993
     dialog --title $"USB Master Keydrive" \
1019 994
            --msgbox $"Plug in a LUKS encrypted USB drive" 6 40
1020 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 998
     any_key
1023 999
 }
1024 1000
 
@@ -1030,7 +1006,8 @@ function create_keydrive_fragment {
1030 1006
     dialog --title $"USB Fragment Keydrive" \
1031 1007
            --msgbox $"Plug in a LUKS encrypted USB drive" 6 40
1032 1008
     clear
1033
-    ${PROJECT_NAME}-keydrive -u $SELECTED_USERNAME
1009
+    detect_usb_drive
1010
+    ${PROJECT_NAME}-keydrive -u $SELECTED_USERNAME -d $USB_DRIVE
1034 1011
     any_key
1035 1012
 }
1036 1013
 
@@ -1064,6 +1041,7 @@ function restore_data_from_storage {
1064 1041
     fi
1065 1042
 
1066 1043
     utils_installed=(configfiles
1044
+                     blocklist
1067 1045
                      mariadb
1068 1046
                      letsencrypt
1069 1047
                      passwords
@@ -1137,6 +1115,7 @@ function restore_data_from_storage {
1137 1115
             $restore_command
1138 1116
             retcode="$?"
1139 1117
             if [[ "$retcode" != "0" ]]; then
1118
+                any_key
1140 1119
                 if [[ "$1" == "local" ]]; then
1141 1120
                     dialog --title $"Restore all apps from USB" \
1142 1121
                            --msgbox $"Restore failed with code $retcode" 6 60
@@ -1161,6 +1140,7 @@ function restore_data_from_storage {
1161 1140
         $restore_command "${app_name}"
1162 1141
         retcode="$?"
1163 1142
         if [[ "$retcode" != "0" ]]; then
1143
+            any_key
1164 1144
             dialog --title $"Restore apps from USB" \
1165 1145
                    --msgbox $"Restore of ${app_name} failed with code $retcode" 6 60
1166 1146
             return
@@ -1346,7 +1326,7 @@ function shut_down_system {
1346 1326
         1) return;;
1347 1327
         255) return;;
1348 1328
     esac
1349
-    shutdown now
1329
+    systemctl poweroff
1350 1330
 }
1351 1331
 
1352 1332
 function restart_system {
@@ -1359,7 +1339,7 @@ function restart_system {
1359 1339
         1) return;;
1360 1340
         255) return;;
1361 1341
     esac
1362
-    reboot
1342
+    systemctl reboot -i
1363 1343
 }
1364 1344
 
1365 1345
 function change_system_name {
@@ -1404,7 +1384,7 @@ function set_dynamic_IP {
1404 1384
         echo $'Changing to a dynamic IP address.'
1405 1385
         echo ''
1406 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 1388
     fi
1409 1389
 }
1410 1390
 
@@ -1416,9 +1396,9 @@ function set_static_IP {
1416 1396
 
1417 1397
     NEW_STATIC_IP=
1418 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 1402
     fi
1423 1403
 
1424 1404
     # get the IP for the box
@@ -1456,12 +1436,15 @@ Enter a static local IP address for this system.\n\nIt will typically be ${IPv4_
1456 1436
     esac
1457 1437
 
1458 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 1448
         fi
1466 1449
         if [ $ip_addresses_have_changed ]; then
1467 1450
             write_config_param "NETWORK_IS_STATIC" "1"
@@ -1483,44 +1466,19 @@ Enter a static local IP address for this system.\n\nIt will typically be ${IPv4_
1483 1466
                 esac
1484 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 1473
             if [ ! $static_wifi_address ]; then
1487 1474
                 # wired network
1488 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 1482
             else
1525 1483
                 # wifi network
1526 1484
                 wifi_settings
@@ -1540,7 +1498,7 @@ Enter a static local IP address for this system.\n\nIt will typically be ${IPv4_
1540 1498
                    --yesno $"\nFor the change to take effect your system will now need to reboot. Do this now?" 8 60
1541 1499
             sel=$?
1542 1500
             case $sel in
1543
-                0) reboot;;
1501
+                0) systemctl reboot -i;;
1544 1502
             esac
1545 1503
         fi
1546 1504
     fi
@@ -1645,6 +1603,10 @@ function hotspot_settings {
1645 1603
         WIFI_PASSPHRASE=$TEMP_WIFI_PASSPHRASE
1646 1604
 
1647 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 1610
     else
1649 1611
         WIFI_HOTSPOT=$TEMP_WIFI_HOTSPOT
1650 1612
         WIFI_SSID=$TEMP_WIFI_SSID
@@ -1762,14 +1724,14 @@ function email_smtp_proxy {
1762 1724
 
1763 1725
     # change muttrc
1764 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 1728
             echo "set smtp_url=\"${SMTP_PROXY_PROTOCOL}://${SMTP_PROXY_USERNAME}:${SMTP_PROXY_PASSWORD}@${SMTP_PROXY_SERVER}:${SMTP_PROXY_PORT}/\"" >> $MUTTRC_FILE
1767 1729
         else
1768 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 1731
         fi
1770 1732
         sed -i 's|#set smtp_url|set smtp_url|g' $MUTTRC_FILE
1771 1733
     else
1772
-        if grep "set smtp_url" $MUTTRC_FILE; then
1734
+        if grep -q "set smtp_url" $MUTTRC_FILE; then
1773 1735
             sed -i 's|set smtp_url|#set smtp_url|g' $MUTTRC_FILE
1774 1736
         fi
1775 1737
     fi
@@ -1883,6 +1845,29 @@ function domain_blocking_add {
1883 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 1871
 function domain_blocking_remove {
1887 1872
     data=$(tempfile 2>/dev/null)
1888 1873
     trap "rm -f $data" 0 1 2 5 15
@@ -1909,6 +1894,29 @@ function domain_blocking_remove {
1909 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 1920
 function domain_blocking_show {
1913 1921
     if [ -f $FIREWALL_DOMAINS ]; then
1914 1922
         clear
@@ -1930,11 +1938,13 @@ function domain_blocking {
1930 1938
         trap "rm -f $data" 0 1 2 5 15
1931 1939
         dialog --backtitle $"Freedombone Control Panel" \
1932 1940
                --title $"Domain or User Blocking" \
1933
-               --radiolist $"Choose an operation:" 12 60 4 \
1941
+               --radiolist $"Choose an operation:" 14 60 6 \
1934 1942
                1 $"Block a domain or user" off \
1935 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 1948
         sel=$?
1939 1949
         case $sel in
1940 1950
             1) break;;
@@ -1943,8 +1953,10 @@ function domain_blocking {
1943 1953
         case $(cat $data) in
1944 1954
             1) domain_blocking_add;;
1945 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 1960
         esac
1949 1961
     done
1950 1962
 }
@@ -2007,7 +2019,7 @@ function menu_wifi {
2007 2019
         if [ -f /etc/hostapd/hostapd.conf ]; then
2008 2020
             status_str=$'Hotspot ON'
2009 2021
         else
2010
-            if grep -q "# wifi enabled" /etc/network/interfaces; then
2022
+            if [ -f /etc/network/interfaces.d/wifi ]; then
2011 2023
                 status_str=$'Wifi ON'
2012 2024
             fi
2013 2025
         fi
@@ -2083,7 +2095,7 @@ function menu_top_level {
2083 2095
         trap "rm -f $data" 0 1 2 5 15
2084 2096
         dialog --backtitle $"Freedombone Control Panel" \
2085 2097
                --title $"Control Panel" \
2086
-               --radiolist $"Choose an operation:" 29 70 21 \
2098
+               --radiolist $"Choose an operation:" 28 70 20 \
2087 2099
                1 $"About this system" off \
2088 2100
                2 $"Passwords" off \
2089 2101
                3 $"Backup and Restore" off \
@@ -2097,19 +2109,19 @@ function menu_top_level {
2097 2109
                11 $"Email Menu" off \
2098 2110
                12 $"Domain or User Blocking" off \
2099 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 2119
         sel=$?
2109 2120
         case $sel in
2110 2121
             1) exit 1;;
2111 2122
             255) exit 1;;
2112 2123
         esac
2124
+        please_wait
2113 2125
         case $(cat $data) in
2114 2126
             1) show_about;;
2115 2127
             2) view_or_change_passwords;;
@@ -2117,7 +2129,7 @@ function menu_top_level {
2117 2129
             4) show_firewall;;
2118 2130
             5) reset_tripwire;;
2119 2131
             6) menu_app_settings;;
2120
-            7) ${PROJECT_NAME}-addremove
2132
+            7) /usr/local/bin/addremove
2121 2133
                if [ ! "$?" = "0" ]; then
2122 2134
                    any_key
2123 2135
                fi
@@ -2128,31 +2140,23 @@ function menu_top_level {
2128 2140
             11) menu_email;;
2129 2141
             12) domain_blocking;;
2130 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 2150
         esac
2140 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 2154
 if [ ! -f $COMPLETION_FILE ]; then
2150 2155
     echo $'This command should only be run on an installed Freedombone system'
2151 2156
     exit 1
2152 2157
 fi
2153 2158
 
2154 2159
 ADMIN_USER=$(get_completion_param "Admin user")
2155
-read_repo_servers
2156 2160
 menu_top_level
2157 2161
 clear
2158 2162
 cat /etc/motd

+ 10
- 6
src/freedombone-controlpanel-user 查看文件

@@ -34,8 +34,10 @@ export TEXTDOMAIN=${PROJECT_NAME}-controlpanel-user
34 34
 export TEXTDOMAINDIR="/usr/share/locale"
35 35
 
36 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 42
 UTILS_FILES=/usr/share/${PROJECT_NAME}/utils/${PROJECT_NAME}-utils-*
41 43
 for f in $UTILS_FILES
@@ -49,6 +51,8 @@ do
49 51
   source $f
50 52
 done
51 53
 
54
+# End including files
55
+
52 56
 function any_key {
53 57
     echo ' '
54 58
     read -n1 -r -p $"Press any key to continue..." key
@@ -398,8 +402,8 @@ function block_unblock_subject {
398 402
 }
399 403
 
400 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 407
     dialog --title $"My PGP/GPG Key" \
404 408
            --backtitle $"Freedombone User Control Panel" \
405 409
            --msgbox $"Email Address: $MY_EMAIL_ADDRESS\n\nKey ID: $GPG_ID\n\nFingerprint: $GPG_FINGERPRINT\n\nCreated: $GPG_DATE" 12 70
@@ -619,7 +623,7 @@ function smtp_proxy {
619 623
         fi
620 624
         sed -i 's|#set smtp_url|set smtp_url|g' $MUTTRC_FILE
621 625
     else
622
-        if grep "set smtp_url" $MUTTRC_FILE; then
626
+        if grep -q "set smtp_url" $MUTTRC_FILE; then
623 627
             sed -i 's|set smtp_url|#set smtp_url|g' $MUTTRC_FILE
624 628
         fi
625 629
     fi
@@ -750,7 +754,7 @@ function menu_admin {
750 754
         clear
751 755
         exit 0
752 756
     fi
753
-    sudo ${PROJECT_NAME}-controlpanel
757
+    sudo /usr/local/bin/control
754 758
 }
755 759
 
756 760
 function sign_keys {

+ 23
- 7
src/freedombone-freedns 查看文件

@@ -13,7 +13,7 @@
13 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 18
 # This program is free software: you can redistribute it and/or modify
19 19
 # it under the terms of the GNU Affero General Public License as published by
@@ -33,8 +33,13 @@ PROJECT_NAME='freedombone'
33 33
 export TEXTDOMAIN=${PROJECT_NAME}-freedns
34 34
 export TEXTDOMAINDIR="/usr/share/locale"
35 35
 
36
+VERBOSE=
36 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 44
 if [ ! -f $CONFIGURATION_FILE ]; then
40 45
     exit 0
@@ -47,15 +52,14 @@ function item_in_array {
47 52
 }
48 53
 
49 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 57
     code=$(echo "$line" | awk -F '=' '{print $2}')
54 58
     item_in_array "$code" "${detected_codes[@]}"
55 59
     if [[ $? != 0 ]]; then
56 60
         detected_codes+=("$code")
57 61
     fi
58
-done
62
+done <<< "$codelines"
59 63
 
60 64
 if [ ! -d $HOME/.freedns-update ]; then
61 65
     mkdir $HOME/.freedns-update
@@ -63,7 +67,19 @@ fi
63 67
 cd $HOME/.freedns-update
64 68
 for code in "${detected_codes[@]}"
65 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 79
 done
68 80
 
81
+if [ -f /tmp/freedns ]; then
82
+    rm /tmp/freedns
83
+fi
84
+
69 85
 exit 0

+ 19
- 2
src/freedombone-image 查看文件

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

+ 234
- 127
src/freedombone-image-customise 查看文件

@@ -30,6 +30,7 @@ set -e
30 30
 set -x
31 31
 
32 32
 PROJECT_NAME='freedombone'
33
+LOCAL_NAME=${PROJECT_NAME}
33 34
 INSTALL_DIR=/root/build
34 35
 COMPLETION_FILE=$HOME/${PROJECT_NAME}-completed.txt
35 36
 
@@ -106,6 +107,9 @@ MESH_INSTALL_DIR=/var/lib
106 107
 # a new identity at every shutdown/boot
107 108
 AMNESIC='no'
108 109
 
110
+# Whether this is a dedicated gnusocial or postactiv instance
111
+SOCIALINSTANCE=
112
+
109 113
 # defines the initial keyboard layout
110 114
 KEYBOARD_MAP='gb'
111 115
 
@@ -174,17 +178,21 @@ EOF
174 178
 }
175 179
 
176 180
 configure_networking() {
181
+    chroot "$rootdir" apt-get -yq install resolvconf
182
+
177 183
     if [[ "$MACHINE" == "beaglebonewifi" ]]; then
178 184
         # Allow networking over USB in order to configure the
179 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 196
         return
189 197
     fi
190 198
 
@@ -193,41 +201,15 @@ configure_networking() {
193 201
     fi
194 202
 
195 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 209
 iface eth0 inet static
206 210
     address $BOX_IP_ADDRESS
207 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 214
         hexarray=( 1 2 3 4 5 6 7 8 9 0 a b c d e f )
233 215
         a=${hexarray[$RANDOM%16]}${hexarray[$RANDOM%16]}
@@ -235,12 +217,20 @@ iface eth0 inet static
235 217
         c=${hexarray[$RANDOM%16]}${hexarray[$RANDOM%16]}
236 218
         d=${hexarray[$RANDOM%16]}${hexarray[$RANDOM%16]}
237 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 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 235
     if [[ $VARIANT != "meshclient" && $VARIANT != "meshusb" ]]; then
246 236
         # change the motd to show further install instructions
@@ -274,11 +264,12 @@ following commands, then enter your details.
274 264
 }
275 265
 
276 266
 configure_ssh() {
277
-    if [[ $VARIANT == "mesh" || $VARIANT == "meshclient" || $VARIANT == "meshusb" ]]; then
267
+    if [[ $VARIANT == "mesh"* ]]; then
278 268
         return
279 269
     fi
280 270
 
281 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 274
     if [[ "$SSH_PUBKEY" != "no" ]]; then
284 275
         if [ ! -d $rootdir/home/$MY_USERNAME/.ssh ]; then
@@ -287,6 +278,7 @@ configure_ssh() {
287 278
         echo "$SSH_PUBKEY" > $rootdir/home/$MY_USERNAME/.ssh/authorized_keys
288 279
         chroot $rootdir /bin/chown -R $MY_USERNAME:$MY_USERNAME /home/$MY_USERNAME/.ssh
289 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 282
         echo $"Using ssh public key:"
291 283
         echo $SSH_PUBKEY
292 284
         echo $'Password ssh authentication turned off'
@@ -307,7 +299,7 @@ create_generic_image() {
307 299
     fi
308 300
 
309 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 303
         CONFIG_FILENAME=
312 304
     else
313 305
         touch $rootdir/root/.initial_mesh_setup
@@ -387,56 +379,67 @@ EOF
387 379
     echo "    cd /root/${PROJECT_NAME}" >> $rootdir/root/.bashrc
388 380
     echo "    git stash" >> $rootdir/root/.bashrc
389 381
     echo "    git pull" >> $rootdir/root/.bashrc
390
-    echo "    git checkout jessie" >> $rootdir/root/.bashrc
382
+    echo "    git checkout stretch" >> $rootdir/root/.bashrc
391 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 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 401
             fi
400
-        else
401
-            echo "    ${PROJECT_NAME} menuconfig-onion" >> $rootdir/root/.bashrc
402 402
         fi
403 403
     else
404 404
         echo "    echo ''" >> $rootdir/root/.bashrc
405 405
     fi
406 406
     echo '    if [ "$?" = "0" ]; then' >> $rootdir/root/.bashrc
407 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 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 442
     echo '            fi' >> $rootdir/root/.bashrc
439
-    echo '            reboot' >> $rootdir/root/.bashrc
440 443
     echo '        fi' >> $rootdir/root/.bashrc
441 444
     echo '    else' >> $rootdir/root/.bashrc
442 445
     echo '        key=' >> $rootdir/root/.bashrc
@@ -526,15 +529,15 @@ BATMAN_CELLID='02:BA:00:00:03:01'
526 529
 WIFI_SSID='mesh'
527 530
 
528 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 538
 # These are some default nodes, but you can replace them with trusted nodes
536 539
 # as you prefer. See https://wiki.tox.im/Nodes
537
-TOX_NODES=
540
+#TOX_NODES=
538 541
 #TOX_NODES=(
539 542
 #  '192.254.75.102,2607:5600:284::2,33445,951C88B7E75C867418ACDB5D273821372BB5BD652740BCDF623A4FA293E75D2F,Tox RELENG,US'
540 543
 #  '144.76.60.215,2a01:4f8:191:64d6::1,33445,04119E835DF3E78BACF0F84235B300546AF8B936F035185E2A8E9E0A67C8924F,sonOfRa,DE'
@@ -559,7 +562,7 @@ INSTALL_DIR=$HOME/build
559 562
 INSTALLING_MESH=
560 563
 
561 564
 initialise_mesh() {
562
-    if [[ $VARIANT != "mesh" && $VARIANT != "meshclient" && $VARIANT != "meshusb" ]]; then
565
+    if [[ $VARIANT != "mesh"* ]]; then
563 566
         return
564 567
     fi
565 568
     if [[ $DEBIAN_INSTALL_ONLY != "no" ]]; then
@@ -581,11 +584,13 @@ initialise_mesh() {
581 584
 
582 585
         # install proprietary wifi drivers
583 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 588
     fi
586 589
 
587 590
     INSTALLING_MESH=1
588 591
 
592
+    chroot "$rootdir" apt-get -yq install apt-transport-https
593
+
589 594
     configure_firewall
590 595
     install_avahi
591 596
     install_batman
@@ -767,13 +772,13 @@ function configure_user_interface {
767 772
     chroot "$rootdir" apt-get -yq install libtheora-bin libvorbis-dev v4l-utils
768 773
 
769 774
     # a sane editor
770
-    chroot "$rootdir" apt-get -yq install emacs24
775
+    chroot "$rootdir" apt-get -yq install emacs
771 776
 
772 777
     # for wifi monitoring
773 778
     chroot "$rootdir" apt-get -yq install horst
774 779
 
775 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 783
     # to play various media types
779 784
     chroot "$rootdir" apt-get -yq install vlc
@@ -941,7 +946,7 @@ EOF
941 946
 
942 947
     if [[ $VARIANT == "usb" ]]; then
943 948
         # tor
944
-        chroot "$rootdir" apt-get -y install tor
949
+        chroot "$rootdir" apt-get -yq install tor
945 950
 
946 951
         # xmpp client
947 952
         chroot "$rootdir" echo "deb ftp://ftp.gajim.org/debian unstable main" > /etc/apt/sources.list.d/gajim.list
@@ -970,7 +975,16 @@ function image_install_inadyn {
970 975
         mkdir -p $rootdir/root/build
971 976
     fi
972 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 988
     if [ ! -d $rootdir/root/build/inadyn ]; then
975 989
         echo 'Failed to clone inadyn'
976 990
         exit 728252
@@ -1020,14 +1034,18 @@ function image_setup_utils {
1020 1034
     if [ $INSTALLING_MESH ]; then
1021 1035
         return
1022 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 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 1045
     fi
1028 1046
 
1029 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 1049
     fi
1032 1050
 
1033 1051
     chroot "$rootdir" apt-get -yq install locales locales-all debconf
@@ -1047,11 +1065,6 @@ function image_setup_utils {
1047 1065
     rm $rootdir/root/sysctl.conf
1048 1066
 
1049 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 1068
     chroot "$rootdir" apt-get -yq install cryptsetup libgfshare-bin obnam sshpass wget avahi-daemon
1056 1069
     chroot "$rootdir" apt-get -yq install avahi-utils avahi-discover connect-proxy openssh-server
1057 1070
     chroot "$rootdir" apt-get -yq install sudo git dialog build-essential avahi-daemon avahi-utils
@@ -1065,8 +1078,11 @@ function image_setup_utils {
1065 1078
 
1066 1079
     # Tor and ssh over tor
1067 1080
     chroot "$rootdir" apt-get -yq install tor connect-proxy
1081
+    chroot "$rootdir" connect-proxy
1068 1082
     sed -i 's|#Log notice file.*|Log notice file /dev/null|g' $rootdir/etc/tor/torrc
1069 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 1086
     if ! grep -q 'Host *.onion' $rootdir/root/.ssh/config; then
1071 1087
         if [ ! -d $rootdir/root/.ssh ]; then
1072 1088
             mkdir $rootdir/root/.ssh
@@ -1130,14 +1146,14 @@ function image_setup_utils {
1130 1146
     chroot "$rootdir" cd /root/build/tomb && make install
1131 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 1150
         echo '* hard maxsyslogins 10' >> $rootdir/etc/security/limits.conf
1135 1151
     else
1136 1152
         sed -i 's|hard maxsyslogins.*|hard maxsyslogins 10|g' $rootdir/etc/security/limits.conf
1137 1153
     fi
1138 1154
 
1139 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 1157
         echo '* hard maxlogins 2' >> $rootdir/etc/security/limits.conf
1142 1158
     else
1143 1159
         sed -i 's|hard maxlogins.*|hard maxlogins 2|g' $rootdir/etc/security/limits.conf
@@ -1147,9 +1163,7 @@ function image_setup_utils {
1147 1163
     chroot "$rootdir" apt-get -yq remove postfix
1148 1164
     chroot "$rootdir" apt-get -yq install exim4 exim4-daemon-heavy sasl2-bin swaks libnet-ssleay-perl procmail
1149 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 1168
     #backup
1155 1169
     chroot "$rootdir" apt-get -yq install obnam gnupg
@@ -1166,7 +1180,7 @@ function image_setup_utils {
1166 1180
     echo "gpgit commit:$GPGIT_COMMIT" >> $rootdir/root/freedombone-completed.txt
1167 1181
 
1168 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 1185
     git clone $CLEANUP_MAILDIR_REPO $rootdir/root/build/cleanup-maildir
1172 1186
     cd $rootdir/root/build/cleanup-maildir
@@ -1176,7 +1190,7 @@ function image_setup_utils {
1176 1190
 
1177 1191
     # web server
1178 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 1194
     git clone $NGINX_ENSITE_REPO $rootdir/root/build/nginx_ensite
1181 1195
     cd $rootdir/root/build/nginx_ensite
1182 1196
     git checkout $NGINX_ENSITE_COMMIT -b $NGINX_ENSITE_COMMIT
@@ -1190,24 +1204,79 @@ function image_setup_utils {
1190 1204
     fi
1191 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 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 1218
         return
1200 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 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,7 +1317,7 @@ if [ ! $DEBIAN_REPO ]; then
1248 1317
     DEBIAN_REPO='ftp.de.debian.org'
1249 1318
 fi
1250 1319
 if [ ! $DEBIAN_VERSION ]; then
1251
-    DEBIAN_VERSION='jessie'
1320
+    DEBIAN_VERSION='stretch'
1252 1321
 fi
1253 1322
 
1254 1323
 set_apt_sources $BUILD_MIRROR
@@ -1277,7 +1346,7 @@ if [ -n "$CUSTOM_SETUP" ]; then
1277 1346
     chroot "$rootdir" gdebi -n /tmp/"$(basename $CUSTOM_SETUP)"
1278 1347
 fi
1279 1348
 
1280
-if [[ $VARIANT != "meshclient" && $VARIANT != "meshusb" && $VARIANT != "mesh" ]]; then
1349
+if [[ $VARIANT != "mesh"* ]]; then
1281 1350
     chroot "$rootdir" apt-get install -y openssh-server
1282 1351
 fi
1283 1352
 chroot "$rootdir" apt-get install -y sudo git dialog build-essential
@@ -1287,17 +1356,50 @@ chroot "$rootdir" apt-get install -y libnss-mdns libnss-myhostname libnss-gw-nam
1287 1356
 chroot "$rootdir" apt-get install -y locales locales-all debconf wireless-tools wpasupplicant usbutils
1288 1357
 if [[ $ARCHITECTURE == 'qemu'* || $ARCHITECTURE == 'i386' || $ARCHITECTURE == 'i686' || $ARCHITECTURE == 'amd64' || $ARCHITECTURE == 'x86_64' ]]; then
1289 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 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 1397
 chroot "$rootdir" /bin/bash -x <<EOF
1297 1398
 git clone $PROJECT_REPO /root/$PROJECT_NAME
1298 1399
 cd /root/$PROJECT_NAME
1299
-git checkout jessie
1400
+git checkout stretch
1300 1401
 make install
1402
+cp image_build/bbb-4.9.0.tar.gz /boot/bbb.tar.gz
1301 1403
 EOF
1302 1404
 
1303 1405
 chroot "$rootdir" ${PROJECT_NAME}-image-hardware-setup 2>&1 | \
@@ -1308,7 +1410,11 @@ rm $rootdir/usr/sbin/policy-rc.d
1308 1410
 # Set up HRNG for systems known to have one
1309 1411
 # Otherwise install haveged
1310 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 1418
 else
1313 1419
     chroot $rootdir apt-get -yq install rng-tools
1314 1420
     sed -i 's|#HRNGDEVICE=/dev/hwrng|HRNGDEVICE=/dev/hwrng|g' $rootdir/etc/default/rng-tools
@@ -1356,6 +1462,7 @@ configure_user_interface
1356 1462
 image_setup_utils
1357 1463
 image_install_inadyn
1358 1464
 image_install_nodejs
1465
+image_preinstall_repos
1359 1466
 
1360 1467
 # remove downloaded packages
1361 1468
 chroot $rootdir apt-get -y autoremove

+ 32
- 35
src/freedombone-image-hardware-setup 查看文件

@@ -56,14 +56,9 @@ beaglebone_setup_boot() {
56 56
     initRd=initrd.img-$version
57 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 63
     # uEnv.txt for Beaglebone
69 64
     # based on https://github.com/beagleboard/image-builder/blob/master/target/boot/beagleboard.org.txt
@@ -89,7 +84,7 @@ loadinitrd=load mmc \${mmcdev}:\${mmcpart} \${initrd_addr} \${initrd_file}; sete
89 84
 loadfdt=load mmc \${mmcdev}:\${mmcpart} \${fdtaddr} /dtbs/\${fdtfile}
90 85
 
91 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 89
 uenvcmd=run loadfiles; run mmcargs; bootz \${loadaddr} \${initrd_addr}:\${initrd_size} \${fdtaddr}
95 90
 EOF
@@ -123,15 +118,29 @@ beaglebone_repack_kernel() {
123 118
 
124 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 124
     fi
125
+
126
+    kernelVersion=$(ls /usr/lib/*/${bbb_dtb}.dtb | head -1 | cut -d/ -f4)
131 127
     version=$(echo $kernelVersion | sed 's/linux-image-\(.*\)/\1/')
132 128
     initRd=initrd.img-$version
133 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 144
     mkdir /tmp/initrd-repack
136 145
 
137 146
     (cd /tmp/initrd-repack ; \
@@ -142,27 +151,15 @@ beaglebone_repack_kernel() {
142 151
 
143 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 165
 a20_setup_boot() {
@@ -206,7 +203,7 @@ setenv loadinitrd load mmc \${mmcdev}:\${mmcpart} \${initrd_addr} \${initrd_file
206 203
 setenv loadfdt load mmc \${mmcdev}:\${mmcpart} \${fdtaddr} /dtbs/\${fdtfile}
207 204
 
208 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 208
 run loadfiles; run mmcargs; bootz \${loadaddr} \${initrd_addr}:\${initrd_size} \${fdtaddr}
212 209
 EOF

+ 5
- 1
src/freedombone-image-make 查看文件

@@ -77,6 +77,8 @@ export VARIANT
77 77
 export MINIMUM_PASSWORD_LENGTH
78 78
 export INSECURE
79 79
 export AMNESIC
80
+export SOCIALINSTANCE
81
+export LOCAL_NAME
80 82
 
81 83
 # Locate vmdebootstrap program fetched in Makefile
82 84
 basedir=`pwd`
@@ -90,7 +92,7 @@ fi
90 92
 
91 93
 # Packages to install in all Freedombone environments
92 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 97
 # Packages needed on the beaglebone
96 98
 beaglebone_pkgs="linux-image-armmp u-boot-tools u-boot"
@@ -241,6 +243,8 @@ sed -i "s|VARIANT=.*|VARIANT=\"${VARIANT}\"|g" $TEMP_CUSTOMISE3
241 243
 sed -i "s|MINIMUM_PASSWORD_LENGTH=.*|MINIMUM_PASSWORD_LENGTH=\"${MINIMUM_PASSWORD_LENGTH}\"|g" $TEMP_CUSTOMISE3
242 244
 sed -i "s|INSECURE=.*|INSECURE=\"${INSECURE}\"|g" $TEMP_CUSTOMISE3
243 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 248
 sed -i 's|#!/bin/bash||g' $TEMP_CUSTOMISE3
245 249
 
246 250
 cat $TEMP_CUSTOMISE2 $TEMP_CUSTOMISE3 > $TEMP_CUSTOMISE4

+ 1
- 1
src/freedombone-image-makefile 查看文件

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

+ 14
- 4
src/freedombone-image-mesh 查看文件

@@ -42,8 +42,6 @@ INSTALL_LOG=/var/log/${PROJECT_NAME}.log
42 42
 
43 43
 DEFAULT_USERNAME=fbone
44 44
 
45
-GO_VERSION=1.7
46
-
47 45
 TOX_NODES=
48 46
 #TOX_NODES=(
49 47
 #  '192.254.75.102,2607:5600:284::2,33445,951C88B7E75C867418ACDB5D273821372BB5BD652740BCDF623A4FA293E75D2F,Tox RELENG,US'
@@ -74,6 +72,14 @@ IPFS_PORT=4001
74 72
 
75 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 83
 function create_avahi_mesh_service {
78 84
     service_name=$1
79 85
     service_type=$2
@@ -112,7 +118,7 @@ function create_ram_disk {
112 118
 
113 119
 function make_root_read_only {
114 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 122
             sed -i 's|subvol=@|ro,subvol=@|g' /etc/fstab
117 123
             echo $'Root filesystem set to read only' >> $INSTALL_LOG
118 124
         fi
@@ -591,6 +597,7 @@ if [ -f $MESH_INSTALL_SETUP ]; then
591 597
 
592 598
     #tomb slam all
593 599
     tmp_ram_disk 100
600
+    enable_predictable_device_names
594 601
     enable_batman_daemon
595 602
     #create_ram_disk 1
596 603
     #setup_amnesic_data
@@ -625,7 +632,10 @@ if [ -f $MESH_INSTALL_SETUP ]; then
625 632
             rm /usr/share/images/desktop-base/desktop-background
626 633
             ln -s /usr/share/images/desktop-base/${PROJECT_NAME}_mesh_background.png /usr/share/images/desktop-base/desktop-background
627 634
         fi
628
-        reboot
635
+        if [ -f /etc/default/grub ]; then
636
+            update-grub
637
+        fi
638
+        systemctl reboot -i
629 639
     fi
630 640
 fi
631 641
 

+ 126
- 72
src/freedombone-keydrive 查看文件

@@ -13,7 +13,7 @@
13 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 18
 # This program is free software: you can redistribute it and/or modify
19 19
 # it under the terms of the GNU Affero General Public License as published by
@@ -50,37 +50,41 @@ function show_help {
50 50
 
51 51
 while [[ $# > 1 ]]
52 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 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 88
 done
85 89
 
86 90
 if [ ! $MY_USERNAME ]; then
@@ -94,68 +98,118 @@ if [ ! -d /home/$MY_USERNAME ]; then
94 98
 fi
95 99
 
96 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 103
 fi
100 104
 
101 105
 umount -f $USB_MOUNT
102 106
 if [ ! -d $USB_MOUNT ]; then
103
-  mkdir $USB_MOUNT
107
+    mkdir $USB_MOUNT
104 108
 fi
105 109
 if [ -f /dev/mapper/encrypted_usb ]; then
106
-  rm -rf /dev/mapper/encrypted_usb
110
+    rm -rf /dev/mapper/encrypted_usb
107 111
 fi
108 112
 cryptsetup luksClose encrypted_usb
109 113
 
110 114
 # optionally format the drive
111 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 120
 fi
117 121
 
118 122
 cryptsetup luksOpen $USB_DRIVE encrypted_usb
119 123
 if [ "$?" = "0" ]; then
120
-  USB_DRIVE=/dev/mapper/encrypted_usb
124
+    USB_DRIVE=/dev/mapper/encrypted_usb
121 125
 fi
122 126
 mount $USB_DRIVE $USB_MOUNT
123 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 131
 fi
128 132
 
129 133
 # optionally create a master drive which contains the full GPG keyring
130 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 204
 fi
151 205
 
152 206
 # Don't use the USB drive if it already contains a full keyring
153 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 213
 fi
160 214
 
161 215
 # Append the username as a subdirectory.
@@ -167,14 +221,14 @@ FRAGMENTS_DIR=$FRAGMENTS_DIR/$MY_USERNAME
167 221
 
168 222
 # make a directory to contain the fragments
169 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 226
 fi
173 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 232
 fi
179 233
 
180 234
 cd $FRAGMENTS_DIR

+ 98
- 82
src/freedombone-logging 查看文件

@@ -35,6 +35,53 @@ export TEXTDOMAINDIR="/usr/share/locale"
35 35
 
36 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 85
 function turn_off_rsys_logging {
39 86
     sed -i 's|mail,news.none.*|mail,news.none      /dev/null|g' /etc/rsyslog.conf
40 87
     sed -i 's|auth,authpriv.\*.*|auth,authpriv.\*         /dev/null|g' /etc/rsyslog.conf
@@ -48,14 +95,14 @@ function turn_off_rsys_logging {
48 95
     sed -i 's|\*.\*;auth,authpriv.none.*|\*.\*;auth,authpriv.none      /dev/null|g' /etc/rsyslog.conf
49 96
     sed -i 's|#cron.\*|cron.\*|g' /etc/rsyslog.conf
50 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 108
 function turn_on_rsys_logging {
@@ -78,29 +125,26 @@ if [ ! "$1" ]; then
78 125
 fi
79 126
 
80 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 130
     if [ -f /etc/fail2ban/fail2ban.conf ]; then
88 131
         sed -i 's|loglevel.*|loglevel = 3|g' /etc/fail2ban/fail2ban.conf
89 132
         sed -i 's|logtarget.*|logtarget = /var/log/fail2ban.log|g' /etc/fail2ban/fail2ban.conf
90 133
     fi
91 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 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 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 148
     fi
105 149
     if [ -d /etc/nginx ]; then
106 150
         if [ ! -d /var/log/nginx ]; then
@@ -117,15 +161,6 @@ if [[ "$1" == "on" || "$1" == "On" || "$1" == "ON" ]]; then
117 161
     if [ -f /etc/init.d/spamassassin ]; then
118 162
         sed -i 's|DOPTIONS="-s null -d --pidfile=$PIDFILE"|DOPTIONS="-d --pidfile=$PIDFILE"|g' /etc/init.d/spamassassin
119 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 164
     if [ -d /etc/exim4 ]; then
130 165
         if [ ! -d /var/log/exim4 ]; then
131 166
             mkdir /var/log/exim4
@@ -149,40 +184,19 @@ if [[ "$1" == "on" || "$1" == "On" || "$1" == "ON" ]]; then
149 184
     fi
150 185
     turn_on_rsys_logging
151 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 189
     if [ -d /etc/tor ]; then
165 190
         sed -i 's|#Log notice file.*|Log notice file /dev/null|g' /etc/tor/torrc
166 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 192
     fi
179 193
     if [ -d /var/log/radicale ]; then
180
-        shred -zu /var/log/radicale/*
194
+        $REMOVE_FILES_COMMAND /var/log/radicale/*
181 195
         rm -rf /var/log/radicale
182 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 200
     fi
187 201
     if [ -d /etc/nginx ]; then
188 202
         for filename in /etc/nginx/sites-available/* ; do
@@ -192,40 +206,33 @@ else
192 206
         done
193 207
         sed -i 's|access_log.*|access_log /dev/null;|g' /etc/nginx/nginx.conf
194 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 210
     fi
197 211
     if [ -f /etc/init.d/spamassassin ]; then
198 212
         sed -i 's|DOPTIONS="-d --pidfile=$PIDFILE"|DOPTIONS="-s null -d --pidfile=$PIDFILE"|g' /etc/init.d/spamassassin
199 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 214
     if [ -d /etc/exim4 ]; then
208 215
         sed -i 's|MAIN_LOG_SELECTOR = .*|MAIN_LOG_SELECTOR = -all|g' /etc/exim4/conf.d/main/01_exim4-config_listmacrosdefs
209 216
         sed -i 's|MAIN_LOG_SELECTOR = .*|MAIN_LOG_SELECTOR = -all|g' /etc/exim4/exim4.conf.template
210 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 219
     fi
213 220
     if [ -f /etc/dovecot/dovecot.conf ]; then
214 221
         sed -i 's|log_path =.*|log_path = /dev/null|g' /etc/dovecot/dovecot.conf
215 222
         sed -i 's|info_log_path =.*|info_log_path = /dev/null|g' /etc/dovecot/dovecot.conf
216 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 226
     fi
220 227
     if [ -d /etc/mysql ]; then
221 228
         if [ -d /var/log/mysql ]; then
222
-            shred -zu /var/log/mysql/*
229
+            $REMOVE_FILES_COMMAND /var/log/mysql/*
223 230
         fi
224 231
         if [ -f /var/log/mysql.err ]; then
225
-            shred -zu /var/log/mysql.err
232
+            $REMOVE_FILES_COMMAND /var/log/mysql.err
226 233
         fi
227 234
         if [ -f /var/log/mysql.log ]; then
228
-            shred -zu /var/log/mysql.log
235
+            $REMOVE_FILES_COMMAND /var/log/mysql.log
229 236
         fi
230 237
         if [ -f /etc/mysql/my.cnf ]; then
231 238
             sed -i 's|log_error =.*|log_error = /dev/null|g' /etc/mysql/my.cnf
@@ -234,11 +241,26 @@ else
234 241
     if [ -f /etc/fail2ban/fail2ban.conf ]; then
235 242
         sed -i 's|loglevel.*|loglevel = 1|g' /etc/fail2ban/fail2ban.conf
236 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 245
     fi
239 246
     turn_off_rsys_logging
240 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 264
 systemctl restart syslog
243 265
 if [ -d /etc/tor ]; then
244 266
     if [[ "$2" != "--onion" ]]; then
@@ -246,7 +268,7 @@ if [ -d /etc/tor ]; then
246 268
     fi
247 269
 fi
248 270
 if [ -d /etc/nginx ]; then
249
-    systemctl restart php5-fpm
271
+    systemctl restart php7.0-fpm
250 272
     systemctl restart nginx
251 273
 fi
252 274
 if [ -f /etc/init.d/spamassassin ]; then
@@ -255,12 +277,6 @@ fi
255 277
 if [ -d /etc/prosody ]; then
256 278
     systemctl restart prosody
257 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 280
 if [ -d /etc/dovecot ]; then
265 281
     systemctl restart dovecot
266 282
 fi

+ 15
- 22
src/freedombone-mesh 查看文件

@@ -42,7 +42,7 @@ DHTNODES=/usr/share/toxic/DHTnodes
42 42
 PEERS_FILE=/tmp/meshpeers.txt
43 43
 
44 44
 TOX_PORT=33445
45
-TOXCORE_REPO='git://github.com/irungentoo/toxcore.git'
45
+TOXCORE_REPO='https://github.com/irungentoo/toxcore'
46 46
 TOXCORE_COMMIT=
47 47
 # obtain tox values from main install
48 48
 if grep -q "TOX_PORT=" $CONFIG_FILE; then
@@ -71,7 +71,7 @@ function install_toxcore {
71 71
 
72 72
     sudo apt-get -yq install build-essential libtool autotools-dev
73 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 75
     sudo apt-get -yq install libconfig9 libconfig-dev
76 76
 
77 77
     if [ ! -d ~/develop ]; then
@@ -121,29 +121,22 @@ function install_toxcore {
121 121
     sudo cp /tmp/tox-bootstrapd.conf /etc/tox-bootstrapd.conf
122 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 136
     fi
146 137
 
138
+    sudo systemctl restart tox-bootstrapd.service
139
+
147 140
     TOX_PUBLIC_KEY=$(cat /var/log/syslog | grep tox | grep "Public Key" | awk -F ' ' '{print $8}' | tail -1)
148 141
     if [ ${#TOX_PUBLIC_KEY} -lt 30 ]; then
149 142
         echo $'Could not obtain the tox node public key'

+ 3
- 2
src/freedombone-mesh-batman 查看文件

@@ -55,6 +55,7 @@ fi
55 55
 CELLID='any'
56 56
 
57 57
 CHANNEL=2
58
+HOTSPOT_CHANNEL=6
58 59
 if [ -f $COMPLETION_FILE ]; then
59 60
     if grep -q "Wifi channel:" $COMPLETION_FILE; then
60 61
         CHANNEL=$(cat $COMPLETION_FILE | grep "Wifi channel:" | awk -F ':' '{print $2}')
@@ -251,7 +252,7 @@ function start {
251 252
                 ifconfig $IFACE_SECONDARY mtu 1500
252 253
                 ifconfig $IFACE_SECONDARY hw ether $(assign_peer_address)
253 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 256
                 iwconfig $IFACE_SECONDARY ap $CELLID
256 257
 
257 258
                 brctl addbr $BRIDGE_HOTSPOT
@@ -268,7 +269,7 @@ function start {
268 269
                 echo "country_code=UK" >> /etc/hostapd/hostapd.conf
269 270
                 echo "ssid=$HOTSPOT_NAME" >> /etc/hostapd/hostapd.conf
270 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 273
                 echo 'wpa=2' >> /etc/hostapd/hostapd.conf
273 274
                 echo "wpa_passphrase=$HOTSPOT_PASSPHRASE" >> /etc/hostapd/hostapd.conf
274 275
                 echo 'wpa_key_mgmt=WPA-PSK' >> /etc/hostapd/hostapd.conf

+ 2
- 7
src/freedombone-mesh-install 查看文件

@@ -47,7 +47,6 @@ WIFI_SSID='mesh'
47 47
 rootdir=''
48 48
 FN=
49 49
 CHROOT_PREFIX=''
50
-FRIENDS_MIRRORS_SERVER=
51 50
 
52 51
 # To avoid confusions these are obtained from the main project file
53 52
 TOXID_REPO=
@@ -233,8 +232,8 @@ function mesh_firewall {
233 232
 }
234 233
 
235 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 237
     sudo sh -c "apt-key add - < Release.key"
239 238
     sudo apt-get update
240 239
     echo "Tox Repository Installed."
@@ -273,10 +272,6 @@ do
273 272
         shift
274 273
         WIFI_INTERFACE="$1"
275 274
         ;;
276
-    -m|--mirror)
277
-        shift
278
-        FRIENDS_MIRRORS_SERVER="$1"
279
-        ;;
280 275
     --remove)
281 276
         shift
282 277
         REMOVE="$1"

+ 0
- 288
src/freedombone-mirrors 查看文件

@@ -1,288 +0,0 @@
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 查看文件

@@ -22,7 +22,7 @@
22 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 27
 # This program is free software: you can redistribute it and/or modify
28 28
 # it under the terms of the GNU Affero General Public License as published by
@@ -57,9 +57,7 @@ MASTER_PASSWORD=''
57 57
 NO_PASSWORD_STORE_FILE=~/.nostore
58 58
 
59 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 61
     if [ ${#MY_BACKUP_KEY_ID} -lt 4 ]; then
64 62
         echo $"Error: gpg backup key was not found"
65 63
         return 58213
@@ -121,6 +119,11 @@ function run_tests {
121 119
         exit 78352
122 120
     fi
123 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 127
     returned_pass=$(${PROJECT_NAME}-pass -u root -a tests)
125 128
     if [[ "$pass" != "$returned_pass" ]]; then
126 129
         echo "pass     :${pass}:"
@@ -128,6 +131,7 @@ function run_tests {
128 131
         echo "returned :${returned_pass}:"
129 132
         exit 73825
130 133
     fi
134
+    echo $'Password decrypted'
131 135
     ${PROJECT_NAME}-pass -u root --rmapp tests
132 136
     echo "Tests passed"
133 137
 }
@@ -303,7 +307,7 @@ if [ ${#CURR_PASSWORD} -eq 0 ]; then
303 307
         echo ""
304 308
         exit 4
305 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 311
         remove_padding "${pass}"
308 312
     fi
309 313
 else
@@ -318,7 +322,7 @@ else
318 322
         mkdir -p ~/.passwords/$CURR_USERNAME
319 323
     fi
320 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 326
     if [ ! -f ~/.passwords/$CURR_USERNAME/$CURR_APP ]; then
323 327
         MASTER_PASSWORD=
324 328
         exit 5

+ 49
- 0
src/freedombone-prepare-scripts 查看文件

@@ -0,0 +1,49 @@
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 查看文件

@@ -42,20 +42,13 @@ do
42 42
     source $f
43 43
 done
44 44
 
45
-read_config_param USB_DRIVE
46
-
47 45
 FRIENDS_SERVERS_LIST=
48 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 48
 function show_help {
56 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 52
     echo ''
60 53
     exit 0
61 54
 }
@@ -78,10 +71,6 @@ do
78 71
             shift
79 72
             FRIENDS_SERVERS_LIST="$1"
80 73
             ;;
81
-        -d|--drive)
82
-            shift
83
-            GPG_USB_DRIVE=/dev/${1}1
84
-            ;;
85 74
         *)
86 75
             # unknown option
87 76
             ;;
@@ -174,7 +163,7 @@ fi
174 163
 echo $'Key fragments recombined'
175 164
 
176 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 167
 if [ ! "$?" = "0" ]; then
179 168
     echo $'Unable to import gpg key'
180 169
     shred -zu $KEYS_FILE

+ 1
- 1
src/freedombone-renew-cert 查看文件

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

+ 100
- 45
src/freedombone-restore-local 查看文件

@@ -13,7 +13,7 @@
13 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 18
 # This program is free software: you can redistribute it and/or modify
19 19
 # it under the terms of the GNU Affero General Public License as published by
@@ -44,6 +44,25 @@ if [ -f /usr/bin/${PROJECT_NAME} ]; then
44 44
     PROJECT_INSTALL_DIR=/usr/bin
45 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 66
 source $PROJECT_INSTALL_DIR/${PROJECT_NAME}-vars
48 67
 
49 68
 # include utils which allow function_check, go and drive mount
@@ -53,6 +72,8 @@ do
53 72
     source $f
54 73
 done
55 74
 
75
+clear
76
+
56 77
 USB_DRIVE=/dev/sdb1
57 78
 USB_MOUNT=/mnt/usb
58 79
 
@@ -65,9 +86,6 @@ if [ -f $COMPLETION_FILE ]; then
65 86
     ADMIN_USERNAME=$(get_completion_param "Admin user")
66 87
 fi
67 88
 
68
-# MariaDB password
69
-DATABASE_PASSWORD=$(${PROJECT_NAME}-pass -u root -a mariadb)
70
-
71 89
 function check_backup_exists {
72 90
     if [ ! -d $USB_MOUNT/backup ]; then
73 91
         echo $"No backup directory found on the USB drive."
@@ -90,6 +108,29 @@ function check_admin_user {
90 108
 function copy_gpg_keys {
91 109
     echo $"Copying GPG keys from admin user to root"
92 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 136
 function restore_configfiles {
@@ -100,9 +141,9 @@ function restore_configfiles {
100 141
     fi
101 142
 
102 143
     # this restores *.cfg and COMPLETION_FILE
103
-    if [ -d $USB_MOUNT/backup/config ]; then
144
+    if [ -d $USB_MOUNT/backup/configfiles ]; then
104 145
         echo $"Restoring configuration files"
105
-        temp_restore_dir=/root/tempconfig
146
+        temp_restore_dir=/root/tempconfigfiles
106 147
         restore_directory_from_usb $temp_restore_dir configfiles
107 148
 
108 149
         if [ -f $temp_restore_dir/root/.nostore ]; then
@@ -115,34 +156,34 @@ function restore_configfiles {
115 156
             fi
116 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 188
         if [ -f ${temp_restore_dir}${BACKUP_EXTRA_DIRECTORIES} ]; then
148 189
             cp -f ${temp_restore_dir}${BACKUP_EXTRA_DIRECTORIES} ${BACKUP_EXTRA_DIRECTORIES}
@@ -187,15 +228,20 @@ function restore_mariadb {
187 228
 
188 229
     if [ -d $USB_MOUNT/backup/mariadb ]; then
189 230
         echo $"Restoring mysql settings"
231
+        keep_database_running
190 232
         temp_restore_dir=/root/tempmariadb
191 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 239
         if [ ${#db_pass} -gt 0 ]; then
195 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 242
             if [ ! "$?" = "0" ]; then
198 243
                 echo $"Try again using the password obtained from backup"
244
+                db_pass=$(${PROJECT_NAME}-pass -u root -a mariadb)
199 245
                 mysqlsuccess=$(mysql -u root --password="$db_pass" mysql -o < ${temp_restore_dir}${temp_restore_dir}/mysql.sql)
200 246
             fi
201 247
             if [ ! "$?" = "0" ]; then
@@ -205,10 +251,11 @@ function restore_mariadb {
205 251
                 exit 962
206 252
             fi
207 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 259
         fi
213 260
         rm -rf $temp_restore_dir
214 261
     fi
@@ -235,6 +282,7 @@ function restore_passwordstore {
235 282
         fi
236 283
     fi
237 284
     if [ -d $USB_MOUNT/backup/passwordstore ]; then
285
+        store_original_mariadb_password
238 286
         echo $"Restoring password store"
239 287
         restore_directory_from_usb / passwordstore
240 288
     fi
@@ -270,9 +318,13 @@ function restore_mutt_settings {
270 318
                 restore_directory_from_usb $temp_restore_dir mutt/$USERNAME
271 319
                 if [ -f $temp_restore_dir/home/$USERNAME/tempbackup/.muttrc ]; then
272 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 323
                 fi
274 324
                 if [ -f $temp_restore_dir/home/$USERNAME/tempbackup/Muttrc ]; then
275 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 328
                 fi
277 329
                 if [ ! "$?" = "0" ]; then
278 330
                     rm -rf $temp_restore_dir
@@ -287,11 +339,10 @@ function restore_mutt_settings {
287 339
 }
288 340
 
289 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 344
     fi
345
+
295 346
     if [ -d $USB_MOUNT/backup/gnupg ]; then
296 347
         for d in $USB_MOUNT/backup/gnupg/*/ ; do
297 348
             USERNAME=$(echo "$d" | awk -F '/' '{print $6}')
@@ -310,6 +361,7 @@ function restore_gpg {
310 361
                     exit 276
311 362
                 fi
312 363
                 rm -rf $temp_restore_dir
364
+                gpg_set_permissions $USERNAME
313 365
                 if [[ "$USERNAME" == "$ADMIN_USERNAME" ]]; then
314 366
                     cp -r /home/$USERNAME/.gnupg /root
315 367
                     if [ ! "$?" = "0" ]; then
@@ -317,6 +369,7 @@ function restore_gpg {
317 369
                         backup_unmount_drive
318 370
                         exit 283
319 371
                     fi
372
+                    gpg_set_permissions root
320 373
                 fi
321 374
             fi
322 375
         done
@@ -585,6 +638,7 @@ function restore_certs {
585 638
             exit 276
586 639
         fi
587 640
         rm -rf /root/tempssl
641
+        update-ca-certificates
588 642
 
589 643
         # restore ownership
590 644
         if [ -f /etc/ssl/private/xmpp.key ]; then
@@ -710,6 +764,7 @@ backup_mount_drive ${1} ${ADMIN_USERNAME} ${2}
710 764
 check_backup_exists
711 765
 check_admin_user
712 766
 copy_gpg_keys
767
+restore_blocklist
713 768
 restore_configfiles
714 769
 same_admin_user
715 770
 restore_passwordstore

+ 73
- 39
src/freedombone-restore-remote 查看文件

@@ -13,7 +13,7 @@
13 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 18
 # This program is free software: you can redistribute it and/or modify
19 19
 # it under the terms of the GNU Affero General Public License as published by
@@ -99,6 +99,30 @@ DATABASE_PASSWORD=$(${PROJECT_NAME}-pass -u root -a mariadb)
99 99
 function copy_gpg_keys {
100 100
     echo $"Copying GPG keys from admin user to root"
101 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 128
 function restore_configfiles {
@@ -107,9 +131,9 @@ function restore_configfiles {
107 131
             return
108 132
         fi
109 133
     fi
110
-    if [ -d $SERVER_DIRECTORY/backup/config ]; then
134
+    if [ -d $SERVER_DIRECTORY/backup/configfiles ]; then
111 135
         echo $"Restoring configuration files"
112
-        temp_restore_dir=/root/tempconfig
136
+        temp_restore_dir=/root/tempconfigfiles
113 137
         restore_directory_from_friend $temp_restore_dir configfiles
114 138
 
115 139
         if [ -f $temp_restore_dir/root/.nostore ]; then
@@ -122,32 +146,32 @@ function restore_configfiles {
122 146
             fi
123 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 176
         if [ -f ${temp_restore_dir}${BACKUP_EXTRA_DIRECTORIES} ]; then
153 177
             cp -f ${temp_restore_dir}${BACKUP_EXTRA_DIRECTORIES} ${BACKUP_EXTRA_DIRECTORIES}
@@ -184,13 +208,16 @@ function restore_mariadb {
184 208
         temp_restore_dir=/root/tempmariadb
185 209
         restore_directory_from_friend $temp_restore_dir mariadb
186 210
 
211
+        store_original_mariadb_password
212
+
187 213
         echo $'Obtaining MariaDB password'
188
-        db_pass=$(${PROJECT_NAME}-pass -u root -a mariadb)
214
+        db_pass=$(cat /root/.mariadboriginal)
189 215
         if [ ${#db_pass} -gt 0 ]; then
190 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 218
             if [ ! "$?" = "0" ]; then
193 219
                 echo $"Try again using the password obtained from backup"
220
+                db_pass=$(${PROJECT_NAME}-pass -u root -a mariadb)
194 221
                 mysqlsuccess=$(mysql -u root --password="$db_pass" mysql -o < ${temp_restore_dir}${temp_restore_dir}/mysql.sql)
195 222
             fi
196 223
             if [ ! "$?" = "0" ]; then
@@ -198,10 +225,10 @@ function restore_mariadb {
198 225
                 exit 962
199 226
             fi
200 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 232
         fi
206 233
         rm -rf ${temp_restore_dir}
207 234
     fi
@@ -226,6 +253,7 @@ function restore_passwordstore {
226 253
         fi
227 254
     fi
228 255
     if [ -d $SERVER_DIRECTORY/backup/passwordstore ]; then
256
+        store_original_mariadb_password
229 257
         echo $"Restoring password store"
230 258
         restore_directory_from_friend / passwordstore
231 259
     fi
@@ -261,9 +289,13 @@ function restore_mutt_settings {
261 289
                 restore_directory_from_friend ${temp_restore_dir} mutt/$USERNAME
262 290
                 if [ -f ${temp_restore_dir}/home/$USERNAME/tempbackup/.muttrc ]; then
263 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 294
                 fi
265 295
                 if [ -f ${temp_restore_dir}/home/$USERNAME/tempbackup/Muttrc ]; then
266 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 299
                 fi
268 300
                 if [ ! "$?" = "0" ]; then
269 301
                     rm -rf ${temp_restore_dir}
@@ -276,11 +308,10 @@ function restore_mutt_settings {
276 308
 }
277 309
 
278 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 313
     fi
314
+
284 315
     for d in $SERVER_DIRECTORY/backup/gnupg/*/ ; do
285 316
         USERNAME=$(echo "$d" | awk -F '/' '{print $6}')
286 317
         if [[ $(is_valid_user "$USERNAME") == "1" ]]; then
@@ -302,6 +333,7 @@ function restore_gpg {
302 333
                     if [ ! "$?" = "0" ]; then
303 334
                         exit 283
304 335
                     fi
336
+                    gpg_set_permissions root
305 337
                 fi
306 338
             fi
307 339
         fi
@@ -538,6 +570,7 @@ function restore_certs {
538 570
             exit 276
539 571
         fi
540 572
         rm -rf /root/tempssl
573
+        update-ca-certificates
541 574
 
542 575
         # restore ownership
543 576
         if [ -f /etc/ssl/private/xmpp.key ]; then
@@ -646,6 +679,7 @@ function restore_email {
646 679
 ${PROJECT_NAME}-recoverkey -u ${ADMIN_USERNAME} -l $BACKUP_LIST
647 680
 
648 681
 copy_gpg_keys
682
+restore_blocklist
649 683
 restore_configfiles
650 684
 restore_passwordstore
651 685
 restore_mariadb

+ 1
- 1
src/freedombone-rmuser 查看文件

@@ -106,7 +106,7 @@ else
106 106
 fi
107 107
 
108 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 110
         htpasswd -D /etc/nginx/.htpasswd $REMOVE_USERNAME
111 111
     fi
112 112
 fi

+ 4
- 4
src/freedombone-sec 查看文件

@@ -566,7 +566,7 @@ function create_letsencrypt {
566 566
     if [ ! -d /var/www/${new_domain} ]; then
567 567
         domain_found=
568 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 570
                 domain_found=1
571 571
             fi
572 572
         fi
@@ -664,7 +664,7 @@ function enable_monkeysphere {
664 664
 
665 665
         MY_GPG_PUBLIC_KEY_ID=$(gpg_pubkey_from_email "$MY_USERNAME" "$MY_USERNAME@$HOSTNAME")
666 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 668
             exit 52825
669 669
         fi
670 670
 
@@ -856,12 +856,12 @@ function remove_tor_bridge {
856 856
             if [ ${#response} -gt 2 ]; then
857 857
                 if [[ "${response}" != *" "* ]]; then
858 858
                     if [[ "${response}" == *"."* ]]; then
859
-                        if grep "Bridge ${response}" /etc/tor/torrc; then
859
+                        if grep -q "Bridge ${response}" /etc/tor/torrc; then
860 860
                             tor_remove_bridge "${response}"
861 861
                             bridge_removed=1
862 862
                         fi
863 863
                     else
864
-                        if grep " $response" /etc/tor/torrc; then
864
+                        if grep -q " $response" /etc/tor/torrc; then
865 865
                             tor_remove_bridge "${response}"
866 866
                             bridge_removed=1
867 867
                         fi

+ 40
- 11
src/freedombone-splitkey 查看文件

@@ -39,10 +39,14 @@ PROJECT_NAME='freedombone'
39 39
 export TEXTDOMAIN=${PROJECT_NAME}-splitkey
40 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 45
 KEY_FRAGMENTS=3
43 46
 MY_USERNAME=
44 47
 MY_EMAIL_ADDRESS=
45 48
 MY_NAME=
49
+PASSWORD_FILE=
46 50
 
47 51
 function show_help {
48 52
     echo ''
@@ -75,6 +79,10 @@ case $key in
75 79
     shift
76 80
     MY_NAME=$1
77 81
     ;;
82
+    --passwordfile)
83
+    shift
84
+    PASSWORD_FILE=$1
85
+    ;;
78 86
     *)
79 87
     # unknown option
80 88
     ;;
@@ -95,6 +103,13 @@ if [ ! -d /home/$MY_USERNAME/.gnupg ]; then
95 103
     exit 5393
96 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 113
 FRAGMENTS_DIR=/home/$MY_USERNAME/.gnupg_fragments
99 114
 if [ -d $FRAGMENTS_DIR ]; then
100 115
     exit 0
@@ -104,31 +119,37 @@ fi
104 119
 if [ ! $MY_EMAIL_ADDRESS ]; then
105 120
     MY_EMAIL_ADDRESS=$MY_USERNAME@$HOSTNAME
106 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 124
 if [ ${#KEYID} -lt 4 ]; then
110 125
     echo $"gpg key for $MY_EMAIL_ADDRESS was not found"
111
-    return 3682
126
+    exit 3682
112 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 130
 if [ ${#MY_BACKUP_KEY_ID} -lt 4 ]; then
118 131
     echo $"gpg backup key for '$MY_NAME' was not found"
119
-    return 58213
132
+    exit 58213
120 133
 fi
121 134
 
122 135
 # create the key file
123 136
 mkdir -p $FRAGMENTS_DIR
137
+chown $MY_USERNAME:$MY_USERNAME $FRAGMENTS_DIR
124 138
 KEYS_FILE=$FRAGMENTS_DIR/keyshare.asc
125 139
 gpg --output $FRAGMENTS_DIR/pubkey.txt --armor --export $KEYID
126 140
 if [ ! "$?" = "0" ]; then
127 141
     echo $"Unable to extract public key for $KEYID"
128 142
     exit 7835
129 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 153
 if [ ! "$?" = "0" ]; then
133 154
     echo $"Unable to extract private key for $KEYID"
134 155
     exit 7823
@@ -136,16 +157,24 @@ fi
136 157
 gpg --output $FRAGMENTS_DIR/backup_pubkey.txt \
137 158
     --armor --export $MY_BACKUP_KEY_ID
138 159
 if [ ! "$?" = "0" ]; then
160
+    shred -zu $FRAGMENTS_DIR/privkey.txt
139 161
     echo $"Unable to extract backup public key for $MY_BACKUP_KEY_ID"
140 162
     exit 62928
141 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 168
 if [ ! "$?" = "0" ]; then
169
+    shred -zu $FRAGMENTS_DIR/privkey.txt
145 170
     echo $"Unable to extract backup private key for $MY_BACKUP_KEY_ID"
146 171
     exit 13783
147 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 178
 cat $FRAGMENTS_DIR/pubkey.txt \
150 179
     $FRAGMENTS_DIR/privkey.txt \
151 180
     $FRAGMENTS_DIR/backup_pubkey.txt \

+ 23
- 0
src/freedombone-syncthing 查看文件

@@ -266,6 +266,14 @@ function user_devices_changed {
266 266
 
267 267
     for d in /home/*/ ; do
268 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 277
         if [[ $(is_valid_user "$USERNAME") == "1" ]]; then
270 278
             if [ -f /home/$USERNAME/$SYNCTHING_UPDATE_FILE ]; then
271 279
                 CHANGED=1
@@ -294,10 +302,25 @@ function user_devices_changed {
294 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 317
 user_devices_changed
298 318
 if [ $CHANGED ]; then
299 319
     create_syncthing_config
320
+    syncthing_set_permissions
300 321
     systemctl restart syncthing
322
+else
323
+    syncthing_set_permissions
301 324
 fi
302 325
 
303 326
 exit 0

+ 121
- 48
src/freedombone-tests 查看文件

@@ -762,6 +762,126 @@ function test_stig {
762 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 885
     ##RHEL-06-000247
766 886
     ##The system clock must be synchronized continuously, or at least daily.
767 887
 
@@ -844,26 +964,6 @@ function test_stig {
844 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 967
     ##RHEL-06-000271
868 968
     ##The noexec option must be added to removable media partitions.
869 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,15 +1046,6 @@ function test_stig {
946 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 1049
     ##RHEL-06-000319
959 1050
     ##The system must limit users to 10 simultaneous system logins, or a site-defined number, in accordance with operational requirements.
960 1051
 
@@ -1010,16 +1101,6 @@ function test_stig {
1010 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 1104
     ##RHEL-06-000347
1024 1105
     ##There must be no .netrc files on the system.
1025 1106
 
@@ -1056,15 +1137,6 @@ function test_stig {
1056 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 1140
     ##RHEL-06-000523
1069 1141
     ##The systems local IPv6 firewall must implement a deny-all, allow-by-exception policy for inbound packets.
1070 1142
 
@@ -1149,6 +1221,7 @@ fi
1149 1221
 test_app_functions
1150 1222
 test_unique_onion_ports
1151 1223
 remove_management_engine_interface
1224
+freedombone-pass --test yes
1152 1225
 fix_stig
1153 1226
 test_stig
1154 1227
 

+ 0
- 0
src/freedombone-upgrade 查看文件


部分文件因为文件数量过多而无法显示