Browse Source

Don't use auth

Bob Mottram 8 years ago
parent
commit
a3081d5c61
1 changed files with 13 additions and 17 deletions
  1. 13
    17
      src/freedombone-app-radicale

+ 13
- 17
src/freedombone-app-radicale View File

@@ -42,6 +42,7 @@ RADICALE_PASSWORD=
42 42
 RADICALE_ONION_PORT=8106
43 43
 RADICALE_PORT=5232
44 44
 RADICALE_DIRECTORY='/etc/radicale'
45
+RADICALE_USERS=/var/www/radicale/users
45 46
 
46 47
 radicale_variables=(ONION_ONLY
47 48
                     MY_USERNAME
@@ -50,8 +51,8 @@ radicale_variables=(ONION_ONLY
50 51
 
51 52
 function remove_user_radicale {
52 53
     remove_username="$1"
53
-    if grep "$remove_username:" ${RADICALE_DIRECTORY}/users; then
54
-        sed -i "/$remove_username:/d" ${RADICALE_DIRECTORY}/users
54
+    if grep "$remove_username:" ${RADICALE_USERS}; then
55
+        sed -i "/$remove_username:/d" ${RADICALE_USERS}
55 56
         systemctl reload radicale
56 57
     fi
57 58
 }
@@ -60,12 +61,12 @@ function add_user_radicale {
60 61
     new_username="$1"
61 62
     new_user_password="$2"
62 63
 
63
-    if [ ! -f ${RADICALE_DIRECTORY}/users ]; then
64
-        touch ${RADICALE_DIRECTORY}/users
64
+    if [ ! -f ${RADICALE_USERS} ]; then
65
+        touch ${RADICALE_USERS}
65 66
     fi
66 67
 
67
-    if ! grep "$new_username:" ${RADICALE_DIRECTORY}/users; then
68
-        htpasswd -bd ${RADICALE_DIRECTORY}/users "$new_username" "$new_user_password"
68
+    if ! grep "$new_username:" ${RADICALE_USERS}; then
69
+        htpasswd -bd ${RADICALE_USERS} "$new_username" "$new_user_password"
69 70
         systemctl reload radicale
70 71
     fi
71 72
     echo '0'
@@ -227,7 +228,7 @@ function install_radicale {
227 228
     fi
228 229
     chown -R www-data:www-data /var/log/radicale
229 230
 
230
-    apt-get -yq install apache2-utils
231
+    apt-get -yq install python-setuptools apache2-utils
231 232
 
232 233
     if [ ! -d /var/www/radicale ]; then
233 234
         mkdir -p /var/www/radicale
@@ -270,17 +271,12 @@ function install_radicale {
270 271
     echo 'ssl = False' >> ${RADICALE_DIRECTORY}/config
271 272
     echo 'daemon = False' >> ${RADICALE_DIRECTORY}/config
272 273
     echo '' >> ${RADICALE_DIRECTORY}/config
273
-    echo '[auth]' >>  ${RADICALE_DIRECTORY}/config
274
-    echo 'type = htpasswd' >> ${RADICALE_DIRECTORY}/config
275
-    echo "htpasswd_filename = ${RADICALE_DIRECTORY}/users" >> ${RADICALE_DIRECTORY}/config
276
-    echo 'htpasswd_encryption = crypt' >> ${RADICALE_DIRECTORY}/config
277
-    echo '' >> ${RADICALE_DIRECTORY}/config
278
-    echo '[rights]' >> ${RADICALE_DIRECTORY}/config
279
-    echo 'type = owner_only' >> ${RADICALE_DIRECTORY}/config
280
-    echo '' >> ${RADICALE_DIRECTORY}/config
281 274
     echo '[storage]' >> ${RADICALE_DIRECTORY}/config
282 275
     echo 'type = filesystem' >> ${RADICALE_DIRECTORY}/config
283 276
     echo "filesystem_folder = /var/www/radicale/collections" >> ${RADICALE_DIRECTORY}/config
277
+    echo '' >> ${RADICALE_DIRECTORY}/config
278
+    echo '[logging]' >> ${RADICALE_DIRECTORY}/config
279
+    echo 'debug = False' >> ${RADICALE_DIRECTORY}/config
284 280
 
285 281
     # create an admin password
286 282
     if [ ${#RADICALE_PASSWORD} -lt 8 ]; then
@@ -327,7 +323,7 @@ function install_radicale {
327 323
         echo '' >> /etc/nginx/sites-available/radicale
328 324
         echo '    location / {' >> /etc/nginx/sites-available/radicale
329 325
         echo '        auth_basic "Radicale";' >> /etc/nginx/sites-available/radicale
330
-        echo "        auth_basic_user_file ${RADICALE_DIRECTORY}/users;" >> /etc/nginx/sites-available/radicale
326
+        echo "        auth_basic_user_file ${RADICALE_USERS};" >> /etc/nginx/sites-available/radicale
331 327
         echo '        proxy_pass http://localhost:52322;' >> /etc/nginx/sites-available/radicale
332 328
         echo '    }' >> /etc/nginx/sites-available/radicale
333 329
         echo '}' >> /etc/nginx/sites-available/radicale
@@ -345,7 +341,7 @@ function install_radicale {
345 341
     echo '' >> /etc/nginx/sites-available/radicale
346 342
     echo '    location / {' >> /etc/nginx/sites-available/radicale
347 343
     echo '        auth_basic "Radicale";' >> /etc/nginx/sites-available/radicale
348
-    echo "        auth_basic_user_file ${RADICALE_DIRECTORY}/users;" >> /etc/nginx/sites-available/radicale
344
+    echo "        auth_basic_user_file ${RADICALE_USERS};" >> /etc/nginx/sites-available/radicale
349 345
     echo '        proxy_pass http://localhost:52322;' >> /etc/nginx/sites-available/radicale
350 346
     echo '    }' >> /etc/nginx/sites-available/radicale
351 347
     echo '}' >> /etc/nginx/sites-available/radicale