From 153c6b25725d1ae4eff83b4a5168fc3e3e069340 Mon Sep 17 00:00:00 2001 From: Disassembler Date: Sat, 14 Oct 2017 12:50:36 +0200 Subject: [PATCH] Add Kanboard admin password generation --- 60-kanboard.sh | 4 +--- kanboard/tmp/kanboard-adminpwd.sql | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/60-kanboard.sh b/60-kanboard.sh index f1785f1..60fc94b 100755 --- a/60-kanboard.sh +++ b/60-kanboard.sh @@ -38,6 +38,7 @@ psql -f /srv/kanboard/app/Schema/Sql/postgres.sql kanboard kanboard envsubst <${SOURCE_DIR}/kanboard/srv/kanboard/config.php >/srv/kanboard/config.php export KANBOARD_ADMIN_USER=admin export KANBOARD_ADMIN_PWD=$(head -c 12 /dev/urandom | base64) +export KANBOARD_ADMIN_HASH=$(php -r "echo password_hash('${KANBOARD_ADMIN_PWD}', PASSWORD_BCRYPT);") envsubst <${SOURCE_DIR}/kanboard/tmp/kanboard-adminpwd.sql >/tmp/kanboard-adminpwd.sql psql -f /tmp/kanboard-adminpwd.sql kanboard kanboard unset PGPASSWORD @@ -60,6 +61,3 @@ cp ${SOURCE_DIR}/kanboard/etc/cron.d/kanboard /etc/cron.d/kanboard # Add portal application definition ${SOURCE_DIR}/basic/portal-app-manager.py kanboard "/kanboard/" "${KANBOARD_ADMIN_USER}" "${KANBOARD_ADMIN_PWD}" - -# TODO: Admin pwd set -# TODO: Portal card diff --git a/kanboard/tmp/kanboard-adminpwd.sql b/kanboard/tmp/kanboard-adminpwd.sql index 330d395..c80afc5 100644 --- a/kanboard/tmp/kanboard-adminpwd.sql +++ b/kanboard/tmp/kanboard-adminpwd.sql @@ -2,4 +2,4 @@ UPDATE settings SET value = 'cs_CZ' WHERE option = 'application_language'; UPDATE settings SET value = 'Europe/Prague' WHERE option = 'application_timezone'; UPDATE settings SET value = 'd.m.Y' WHERE option = 'application_date_format'; --- UPDATE users SET password = '${KANBOARD_ADMIN_PWD}' WHERE username = 'admin'; +UPDATE users SET password = '${KANBOARD_ADMIN_HASH}' WHERE username = 'admin';