Don't use auth

This commit is contained in:
Bob Mottram 2016-11-16 18:56:37 +00:00
parent b7cd12c5c0
commit a3081d5c61
1 changed files with 13 additions and 17 deletions

View File

@ -42,6 +42,7 @@ RADICALE_PASSWORD=
RADICALE_ONION_PORT=8106
RADICALE_PORT=5232
RADICALE_DIRECTORY='/etc/radicale'
RADICALE_USERS=/var/www/radicale/users
radicale_variables=(ONION_ONLY
MY_USERNAME
@ -50,8 +51,8 @@ radicale_variables=(ONION_ONLY
function remove_user_radicale {
remove_username="$1"
if grep "$remove_username:" ${RADICALE_DIRECTORY}/users; then
sed -i "/$remove_username:/d" ${RADICALE_DIRECTORY}/users
if grep "$remove_username:" ${RADICALE_USERS}; then
sed -i "/$remove_username:/d" ${RADICALE_USERS}
systemctl reload radicale
fi
}
@ -60,12 +61,12 @@ function add_user_radicale {
new_username="$1"
new_user_password="$2"
if [ ! -f ${RADICALE_DIRECTORY}/users ]; then
touch ${RADICALE_DIRECTORY}/users
if [ ! -f ${RADICALE_USERS} ]; then
touch ${RADICALE_USERS}
fi
if ! grep "$new_username:" ${RADICALE_DIRECTORY}/users; then
htpasswd -bd ${RADICALE_DIRECTORY}/users "$new_username" "$new_user_password"
if ! grep "$new_username:" ${RADICALE_USERS}; then
htpasswd -bd ${RADICALE_USERS} "$new_username" "$new_user_password"
systemctl reload radicale
fi
echo '0'
@ -227,7 +228,7 @@ function install_radicale {
fi
chown -R www-data:www-data /var/log/radicale
apt-get -yq install apache2-utils
apt-get -yq install python-setuptools apache2-utils
if [ ! -d /var/www/radicale ]; then
mkdir -p /var/www/radicale
@ -270,17 +271,12 @@ function install_radicale {
echo 'ssl = False' >> ${RADICALE_DIRECTORY}/config
echo 'daemon = False' >> ${RADICALE_DIRECTORY}/config
echo '' >> ${RADICALE_DIRECTORY}/config
echo '[auth]' >> ${RADICALE_DIRECTORY}/config
echo 'type = htpasswd' >> ${RADICALE_DIRECTORY}/config
echo "htpasswd_filename = ${RADICALE_DIRECTORY}/users" >> ${RADICALE_DIRECTORY}/config
echo 'htpasswd_encryption = crypt' >> ${RADICALE_DIRECTORY}/config
echo '' >> ${RADICALE_DIRECTORY}/config
echo '[rights]' >> ${RADICALE_DIRECTORY}/config
echo 'type = owner_only' >> ${RADICALE_DIRECTORY}/config
echo '' >> ${RADICALE_DIRECTORY}/config
echo '[storage]' >> ${RADICALE_DIRECTORY}/config
echo 'type = filesystem' >> ${RADICALE_DIRECTORY}/config
echo "filesystem_folder = /var/www/radicale/collections" >> ${RADICALE_DIRECTORY}/config
echo '' >> ${RADICALE_DIRECTORY}/config
echo '[logging]' >> ${RADICALE_DIRECTORY}/config
echo 'debug = False' >> ${RADICALE_DIRECTORY}/config
# create an admin password
if [ ${#RADICALE_PASSWORD} -lt 8 ]; then
@ -327,7 +323,7 @@ function install_radicale {
echo '' >> /etc/nginx/sites-available/radicale
echo ' location / {' >> /etc/nginx/sites-available/radicale
echo ' auth_basic "Radicale";' >> /etc/nginx/sites-available/radicale
echo " auth_basic_user_file ${RADICALE_DIRECTORY}/users;" >> /etc/nginx/sites-available/radicale
echo " auth_basic_user_file ${RADICALE_USERS};" >> /etc/nginx/sites-available/radicale
echo ' proxy_pass http://localhost:52322;' >> /etc/nginx/sites-available/radicale
echo ' }' >> /etc/nginx/sites-available/radicale
echo '}' >> /etc/nginx/sites-available/radicale
@ -345,7 +341,7 @@ function install_radicale {
echo '' >> /etc/nginx/sites-available/radicale
echo ' location / {' >> /etc/nginx/sites-available/radicale
echo ' auth_basic "Radicale";' >> /etc/nginx/sites-available/radicale
echo " auth_basic_user_file ${RADICALE_DIRECTORY}/users;" >> /etc/nginx/sites-available/radicale
echo " auth_basic_user_file ${RADICALE_USERS};" >> /etc/nginx/sites-available/radicale
echo ' proxy_pass http://localhost:52322;' >> /etc/nginx/sites-available/radicale
echo ' }' >> /etc/nginx/sites-available/radicale
echo '}' >> /etc/nginx/sites-available/radicale