|  | @@ -38,7 +38,7 @@ ETHERPAD_CODE=
 | 
	
		
			
			| 38 | 38 |  ETHERPAD_ONION_PORT=8101
 | 
	
		
			
			| 39 | 39 |  ETHERPAD_PORT=9001
 | 
	
		
			
			| 40 | 40 |  ETHERPAD_REPO="https://github.com/ether/etherpad-lite"
 | 
	
		
			
			| 41 |  | -ETHERPAD_COMMIT='223127bf39d2ba431d9c1965a7f2aadadc73d77a'
 | 
	
		
			
			|  | 41 | +ETHERPAD_COMMIT='454f539561a8d9de51ed107a29d974eb79198bc6'
 | 
	
		
			
			| 42 | 42 |  ETHERPAD_ADMIN_PASSWORD=
 | 
	
		
			
			| 43 | 43 |  ETHERPAD_TITLE=$'Freedombone Docs'
 | 
	
		
			
			| 44 | 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,22 +60,18 @@ function logging_off_etherpad {
 | 
	
		
			
			| 60 | 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 | 63 |  function change_password_etherpad {
 | 
	
		
			
			| 68 | 64 |      change_username="$1"
 | 
	
		
			
			| 69 |  | -    new_user_password=$(etherpad_password_hash "$2")
 | 
	
		
			
			|  | 65 | +    new_user_password="$2"
 | 
	
		
			
			| 70 | 66 |  
 | 
	
		
			
			| 71 | 67 |      read_config_param ETHERPAD_DOMAIN_NAME
 | 
	
		
			
			| 72 | 68 |  
 | 
	
		
			
			| 73 | 69 |      if grep -q "\"$change_username\": {" /var/www/${ETHERPAD_DOMAIN_NAME}/htdocs/settings.json; then
 | 
	
		
			
			| 74 | 70 |          user_line=$(cat /var/www/${ETHERPAD_DOMAIN_NAME}/htdocs/settings.json | grep "\"$change_username\": {")
 | 
	
		
			
			| 75 | 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 | 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 | 75 |          fi
 | 
	
		
			
			| 80 | 76 |          ${PROJECT_NAME}-pass -u $change_username -a etherpad -p "$2"
 | 
	
		
			
			| 81 | 77 |          systemctl restart etherpad
 | 
	
	
		
			
			|  | @@ -104,18 +100,10 @@ function create_etherpad_settings {
 | 
	
		
			
			| 104 | 100 |      echo "  \"title\": \"${ETHERPAD_TITLE}\"," >> $settings_file
 | 
	
		
			
			| 105 | 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 | 104 |      echo "  \"port\" : ${ETHERPAD_PORT}," >> $settings_file
 | 
	
		
			
			| 109 | 105 |  
 | 
	
		
			
			| 110 | 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 | 107 |      echo '   "dbType" : "mysql",' >> $settings_file
 | 
	
		
			
			| 120 | 108 |      echo '   "dbSettings" : {' >> $settings_file
 | 
	
		
			
			| 121 | 109 |      echo '                    "user"    : "root",' >> $settings_file
 | 
	
	
		
			
			|  | @@ -157,7 +145,7 @@ function create_etherpad_settings {
 | 
	
		
			
			| 157 | 145 |      echo '  "disableIPlogging" : true,' >> $settings_file
 | 
	
		
			
			| 158 | 146 |  
 | 
	
		
			
			| 159 | 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 | 149 |      echo '  },' >> $settings_file
 | 
	
		
			
			| 162 | 150 |  
 | 
	
		
			
			| 163 | 151 |      echo '  "socketTransportProtocols" : ["xhr-polling", "jsonp-polling", "htmlfile"],' >> $settings_file
 | 
	
	
		
			
			|  | @@ -199,12 +187,12 @@ function remove_user_etherpad {
 | 
	
		
			
			| 199 | 187 |  
 | 
	
		
			
			| 200 | 188 |  function add_user_etherpad {
 | 
	
		
			
			| 201 | 189 |      new_username="$1"
 | 
	
		
			
			| 202 |  | -    new_user_password=$(etherpad_password_hash "$2")
 | 
	
		
			
			|  | 190 | +    new_user_password="$2"
 | 
	
		
			
			| 203 | 191 |      settings_file=/var/www/${ETHERPAD_DOMAIN_NAME}/htdocs/settings.json
 | 
	
		
			
			| 204 | 192 |  
 | 
	
		
			
			| 205 | 193 |      if ! grep -q "\"$new_username\": {" $settings_file; then
 | 
	
		
			
			| 206 | 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 | 196 |          if grep -q "\"$new_username\": {" $settings_file; then
 | 
	
		
			
			| 209 | 197 |              systemctl restart etherpad
 | 
	
		
			
			| 210 | 198 |          else
 | 
	
	
		
			
			|  | @@ -628,6 +616,7 @@ function install_etherpad {
 | 
	
		
			
			| 628 | 616 |      if [ -f /etc/ssl/private/${ETHERPAD_DOMAIN_NAME}.key ]; then
 | 
	
		
			
			| 629 | 617 |          chown etherpad: /etc/ssl/private/${ETHERPAD_DOMAIN_NAME}.key
 | 
	
		
			
			| 630 | 618 |      fi
 | 
	
		
			
			|  | 619 | +    usermod -a -G ssl-cert etherpad
 | 
	
		
			
			| 631 | 620 |  
 | 
	
		
			
			| 632 | 621 |      # Ensure that the database gets backed up locally, if remote
 | 
	
		
			
			| 633 | 622 |      # backups are not being used
 |