Browse Source

radicale hashed passwords

Bob Mottram 8 years ago
parent
commit
b59ab65795
1 changed files with 4 additions and 3 deletions
  1. 4
    3
      src/freedombone-app-radicale

+ 4
- 3
src/freedombone-app-radicale View File

57
 function add_user_radicale {
57
 function add_user_radicale {
58
     new_username="$1"
58
     new_username="$1"
59
     new_user_password="$2"
59
     new_user_password="$2"
60
+    new_user_hash=$(echo -n "$new_user_password" | sha1sum | awk -F ' ' '{print $1}')
60
 
61
 
61
-    if ! grep "$new_username:$new_user_password" ${RADICALE_DIRECTORY}/users; then
62
-        printf "$new_username:$new_user_password\n" >> ${RADICALE_DIRECTORY}/users
62
+    if ! grep "$new_username:$new_user_hash" ${RADICALE_DIRECTORY}/users; then
63
+        printf "$new_username:$new_user_hash\n" >> ${RADICALE_DIRECTORY}/users
63
         systemctl reload radicale
64
         systemctl reload radicale
64
     fi
65
     fi
65
     echo '0'
66
     echo '0'
225
     echo '[auth]' >  ${RADICALE_DIRECTORY}/config
226
     echo '[auth]' >  ${RADICALE_DIRECTORY}/config
226
     echo 'type = htpasswd' >> ${RADICALE_DIRECTORY}/config
227
     echo 'type = htpasswd' >> ${RADICALE_DIRECTORY}/config
227
     echo "htpasswd_filename = ${RADICALE_DIRECTORY}/users" >> ${RADICALE_DIRECTORY}/config
228
     echo "htpasswd_filename = ${RADICALE_DIRECTORY}/users" >> ${RADICALE_DIRECTORY}/config
228
-    echo 'htpasswd_encryption = crypt' >> ${RADICALE_DIRECTORY}/config
229
+    echo 'htpasswd_encryption = sha1' >> ${RADICALE_DIRECTORY}/config
229
     echo '' >> ${RADICALE_DIRECTORY}/config
230
     echo '' >> ${RADICALE_DIRECTORY}/config
230
     echo '[rights]' >> ${RADICALE_DIRECTORY}/config
231
     echo '[rights]' >> ${RADICALE_DIRECTORY}/config
231
     echo 'type = owner_only' >> ${RADICALE_DIRECTORY}/config
232
     echo 'type = owner_only' >> ${RADICALE_DIRECTORY}/config