Bob Mottram 8 лет назад
Родитель
Сommit
b59ab65795
1 измененных файлов: 4 добавлений и 3 удалений
  1. 4
    3
      src/freedombone-app-radicale

+ 4
- 3
src/freedombone-app-radicale Просмотреть файл

@@ -57,9 +57,10 @@ function remove_user_radicale {
57 57
 function add_user_radicale {
58 58
     new_username="$1"
59 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 64
         systemctl reload radicale
64 65
     fi
65 66
     echo '0'
@@ -225,7 +226,7 @@ function install_radicale {
225 226
     echo '[auth]' >  ${RADICALE_DIRECTORY}/config
226 227
     echo 'type = htpasswd' >> ${RADICALE_DIRECTORY}/config
227 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 230
     echo '' >> ${RADICALE_DIRECTORY}/config
230 231
     echo '[rights]' >> ${RADICALE_DIRECTORY}/config
231 232
     echo 'type = owner_only' >> ${RADICALE_DIRECTORY}/config