|
|
|
|
38
|
ETHERPAD_ONION_PORT=8101
|
38
|
ETHERPAD_ONION_PORT=8101
|
39
|
ETHERPAD_PORT=9001
|
39
|
ETHERPAD_PORT=9001
|
40
|
ETHERPAD_REPO="https://github.com/ether/etherpad-lite"
|
40
|
ETHERPAD_REPO="https://github.com/ether/etherpad-lite"
|
41
|
-ETHERPAD_COMMIT='223127bf39d2ba431d9c1965a7f2aadadc73d77a'
|
|
|
|
|
41
|
+ETHERPAD_COMMIT='454f539561a8d9de51ed107a29d974eb79198bc6'
|
42
|
ETHERPAD_ADMIN_PASSWORD=
|
42
|
ETHERPAD_ADMIN_PASSWORD=
|
43
|
ETHERPAD_TITLE=$'Freedombone Docs'
|
43
|
ETHERPAD_TITLE=$'Freedombone Docs'
|
44
|
ETHERPAD_WELCOME_MESSAGE=$"Welcome to ${ETHERPAD_TITLE}!\n\nThis pad text is synchronized as you type, so that everyone viewing this page sees the same text. This allows you to collaborate seamlessly on documents!"
|
44
|
ETHERPAD_WELCOME_MESSAGE=$"Welcome to ${ETHERPAD_TITLE}!\n\nThis pad text is synchronized as you type, so that everyone viewing this page sees the same text. This allows you to collaborate seamlessly on documents!"
|
|
|
|
|
60
|
echo -n ''
|
60
|
echo -n ''
|
61
|
}
|
61
|
}
|
62
|
|
62
|
|
63
|
-function etherpad_password_hash {
|
|
|
64
|
- echo $(python -c "from passlib.hash import bcrypt;print(bcrypt.encrypt(\"$1\", rounds=10))")
|
|
|
65
|
-}
|
|
|
66
|
-
|
|
|
67
|
function change_password_etherpad {
|
63
|
function change_password_etherpad {
|
68
|
change_username="$1"
|
64
|
change_username="$1"
|
69
|
- new_user_password=$(etherpad_password_hash "$2")
|
|
|
|
|
65
|
+ new_user_password="$2"
|
70
|
|
66
|
|
71
|
read_config_param ETHERPAD_DOMAIN_NAME
|
67
|
read_config_param ETHERPAD_DOMAIN_NAME
|
72
|
|
68
|
|
73
|
if grep -q "\"$change_username\": {" /var/www/${ETHERPAD_DOMAIN_NAME}/htdocs/settings.json; then
|
69
|
if grep -q "\"$change_username\": {" /var/www/${ETHERPAD_DOMAIN_NAME}/htdocs/settings.json; then
|
74
|
user_line=$(cat /var/www/${ETHERPAD_DOMAIN_NAME}/htdocs/settings.json | grep "\"$change_username\": {")
|
70
|
user_line=$(cat /var/www/${ETHERPAD_DOMAIN_NAME}/htdocs/settings.json | grep "\"$change_username\": {")
|
75
|
if [[ "$user_line" == *"\"is_admin\": true"* ]]; then
|
71
|
if [[ "$user_line" == *"\"is_admin\": true"* ]]; then
|
76
|
- sed -i "s|\"$change_username\": {.*|\"$change_username\": { \"hash\": \"$new_user_password\", \"is_admin\": true }|g" /var/www/${ETHERPAD_DOMAIN_NAME}/htdocs/settings.json
|
|
|
|
|
72
|
+ sed -i "s|\"$change_username\": {.*|\"$change_username\": { \"password\": "$new_user_password", \"is_admin\": true }|g" /var/www/${ETHERPAD_DOMAIN_NAME}/htdocs/settings.json
|
77
|
else
|
73
|
else
|
78
|
- sed -i "s|\"$change_username\": {.*|\"$change_username\": { \"hash\": \"$new_user_password\", \"is_admin\": false },|g" /var/www/${ETHERPAD_DOMAIN_NAME}/htdocs/settings.json
|
|
|
|
|
74
|
+ sed -i "s|\"$change_username\": {.*|\"$change_username\": { \"password\": "$new_user_password", \"is_admin\": false },|g" /var/www/${ETHERPAD_DOMAIN_NAME}/htdocs/settings.json
|
79
|
fi
|
75
|
fi
|
80
|
${PROJECT_NAME}-pass -u $change_username -a etherpad -p "$2"
|
76
|
${PROJECT_NAME}-pass -u $change_username -a etherpad -p "$2"
|
81
|
systemctl restart etherpad
|
77
|
systemctl restart etherpad
|
|
|
|
|
104
|
echo " \"title\": \"${ETHERPAD_TITLE}\"," >> $settings_file
|
100
|
echo " \"title\": \"${ETHERPAD_TITLE}\"," >> $settings_file
|
105
|
echo ' "favicon": "favicon.ico",' >> $settings_file
|
101
|
echo ' "favicon": "favicon.ico",' >> $settings_file
|
106
|
|
102
|
|
107
|
- echo ' "ip": "0.0.0.0",' >> $settings_file
|
|
|
|
|
103
|
+ echo ' "ip": "127.0.0.1",' >> $settings_file
|
108
|
echo " \"port\" : ${ETHERPAD_PORT}," >> $settings_file
|
104
|
echo " \"port\" : ${ETHERPAD_PORT}," >> $settings_file
|
109
|
|
105
|
|
110
|
echo ' "showSettingsInAdminPage" : true,' >> $settings_file
|
106
|
echo ' "showSettingsInAdminPage" : true,' >> $settings_file
|
111
|
-
|
|
|
112
|
- if [[ $ONION_ONLY == 'no' ]]; then
|
|
|
113
|
- echo ' "ssl" : {' >> $settings_file
|
|
|
114
|
- echo " \"key\" : \"/etc/ssl/private/${ETHERPAD_DOMAIN_NAME}.key\"," >> $settings_file
|
|
|
115
|
- echo " \"cert\" : \"/etc/ssl/certs/${ETHERPAD_DOMAIN_NAME}.pem\"," >> $settings_file
|
|
|
116
|
- echo ' },' >> $settings_file
|
|
|
117
|
- fi
|
|
|
118
|
-
|
|
|
119
|
echo ' "dbType" : "mysql",' >> $settings_file
|
107
|
echo ' "dbType" : "mysql",' >> $settings_file
|
120
|
echo ' "dbSettings" : {' >> $settings_file
|
108
|
echo ' "dbSettings" : {' >> $settings_file
|
121
|
echo ' "user" : "root",' >> $settings_file
|
109
|
echo ' "user" : "root",' >> $settings_file
|
|
|
|
|
157
|
echo ' "disableIPlogging" : true,' >> $settings_file
|
145
|
echo ' "disableIPlogging" : true,' >> $settings_file
|
158
|
|
146
|
|
159
|
echo ' "users": {' >> $settings_file
|
147
|
echo ' "users": {' >> $settings_file
|
160
|
- echo " \"${MY_USERNAME}\": { \"hash\": \"$(etherpad_password_hash "${ETHERPAD_ADMIN_PASSWORD}")\", \"is_admin\": true }" >> $settings_file
|
|
|
|
|
148
|
+ echo " \"${MY_USERNAME}\": { \"password\": \"${ETHERPAD_ADMIN_PASSWORD}\", \"is_admin\": true }" >> $settings_file
|
161
|
echo ' },' >> $settings_file
|
149
|
echo ' },' >> $settings_file
|
162
|
|
150
|
|
163
|
echo ' "socketTransportProtocols" : ["xhr-polling", "jsonp-polling", "htmlfile"],' >> $settings_file
|
151
|
echo ' "socketTransportProtocols" : ["xhr-polling", "jsonp-polling", "htmlfile"],' >> $settings_file
|
|
|
|
|
199
|
|
187
|
|
200
|
function add_user_etherpad {
|
188
|
function add_user_etherpad {
|
201
|
new_username="$1"
|
189
|
new_username="$1"
|
202
|
- new_user_password=$(etherpad_password_hash "$2")
|
|
|
|
|
190
|
+ new_user_password="$2"
|
203
|
settings_file=/var/www/${ETHERPAD_DOMAIN_NAME}/htdocs/settings.json
|
191
|
settings_file=/var/www/${ETHERPAD_DOMAIN_NAME}/htdocs/settings.json
|
204
|
|
192
|
|
205
|
if ! grep -q "\"$new_username\": {" $settings_file; then
|
193
|
if ! grep -q "\"$new_username\": {" $settings_file; then
|
206
|
${PROJECT_NAME}-pass -u $new_username -a etherpad -p "$2"
|
194
|
${PROJECT_NAME}-pass -u $new_username -a etherpad -p "$2"
|
207
|
- sed -i "/\"users\": {/a \"$new_username\": { \"hash\": \"$new_user_password\", \"is_admin\": false }," $settings_file
|
|
|
|
|
195
|
+ sed -i "/\"users\": {/a \"$new_username\": { \"password\": \"$new_user_password\", \"is_admin\": false }," $settings_file
|
208
|
if grep -q "\"$new_username\": {" $settings_file; then
|
196
|
if grep -q "\"$new_username\": {" $settings_file; then
|
209
|
systemctl restart etherpad
|
197
|
systemctl restart etherpad
|
210
|
else
|
198
|
else
|
|
|
|
|
628
|
if [ -f /etc/ssl/private/${ETHERPAD_DOMAIN_NAME}.key ]; then
|
616
|
if [ -f /etc/ssl/private/${ETHERPAD_DOMAIN_NAME}.key ]; then
|
629
|
chown etherpad: /etc/ssl/private/${ETHERPAD_DOMAIN_NAME}.key
|
617
|
chown etherpad: /etc/ssl/private/${ETHERPAD_DOMAIN_NAME}.key
|
630
|
fi
|
618
|
fi
|
|
|
619
|
+ usermod -a -G ssl-cert etherpad
|
631
|
|
620
|
|
632
|
# Ensure that the database gets backed up locally, if remote
|
621
|
# Ensure that the database gets backed up locally, if remote
|
633
|
# backups are not being used
|
622
|
# backups are not being used
|