radicale hashed passwords

This commit is contained in:
Bob Mottram 2016-11-16 10:46:58 +00:00
parent 30ab5e9e9b
commit b59ab65795
1 changed files with 4 additions and 3 deletions

View File

@ -57,9 +57,10 @@ function remove_user_radicale {
function add_user_radicale { function add_user_radicale {
new_username="$1" new_username="$1"
new_user_password="$2" new_user_password="$2"
new_user_hash=$(echo -n "$new_user_password" | sha1sum | awk -F ' ' '{print $1}')
if ! grep "$new_username:$new_user_password" ${RADICALE_DIRECTORY}/users; then if ! grep "$new_username:$new_user_hash" ${RADICALE_DIRECTORY}/users; then
printf "$new_username:$new_user_password\n" >> ${RADICALE_DIRECTORY}/users printf "$new_username:$new_user_hash\n" >> ${RADICALE_DIRECTORY}/users
systemctl reload radicale systemctl reload radicale
fi fi
echo '0' echo '0'
@ -225,7 +226,7 @@ function install_radicale {
echo '[auth]' > ${RADICALE_DIRECTORY}/config echo '[auth]' > ${RADICALE_DIRECTORY}/config
echo 'type = htpasswd' >> ${RADICALE_DIRECTORY}/config echo 'type = htpasswd' >> ${RADICALE_DIRECTORY}/config
echo "htpasswd_filename = ${RADICALE_DIRECTORY}/users" >> ${RADICALE_DIRECTORY}/config echo "htpasswd_filename = ${RADICALE_DIRECTORY}/users" >> ${RADICALE_DIRECTORY}/config
echo 'htpasswd_encryption = crypt' >> ${RADICALE_DIRECTORY}/config echo 'htpasswd_encryption = sha1' >> ${RADICALE_DIRECTORY}/config
echo '' >> ${RADICALE_DIRECTORY}/config echo '' >> ${RADICALE_DIRECTORY}/config
echo '[rights]' >> ${RADICALE_DIRECTORY}/config echo '[rights]' >> ${RADICALE_DIRECTORY}/config
echo 'type = owner_only' >> ${RADICALE_DIRECTORY}/config echo 'type = owner_only' >> ${RADICALE_DIRECTORY}/config