From 5614f66a1aa40c9c93ce6bc43c2ab34daffaf35f Mon Sep 17 00:00:00 2001 From: Disassembler Date: Sat, 16 Sep 2017 21:35:44 +0200 Subject: [PATCH] Add SeedDMS admin password generator --- 10-seeddms.sh | 9 +++++++-- seeddms/srv/seeddms/www/conf/settings.xml | 20 ++++++++++---------- seeddms/tmp/seeddms-adminpwd.sql | 1 + 3 files changed, 18 insertions(+), 12 deletions(-) create mode 100644 seeddms/tmp/seeddms-adminpwd.sql diff --git a/10-seeddms.sh b/10-seeddms.sh index 75b71f5..b4318b6 100755 --- a/10-seeddms.sh +++ b/10-seeddms.sh @@ -18,11 +18,16 @@ sudo -u postgres psql -f /tmp/seeddms-createdb.sql rm -f /tmp/seeddms-createdb.sql export PGPASSWORD=${SEEDDMS_PWD} psql -f /srv/seeddms/www/install/create_tables-postgres.sql seeddms seeddms -unset PGPASSWORD # Configure SeedDMS envsubst <${SOURCE_DIR}/seeddms/srv/seeddms/www/conf/settings.xml >/srv/seeddms/www/conf/settings.xml rm -rf /srv/seeddms/www/install/ +export SEEDDMS_ADMIN_USER=admin +export SEEDDMS_ADMIN_PWD=$(head -c 12 /dev/urandom | base64) +export SEEDDMS_ADMIN_EMAIL=admin@example.com +envsubst <${SOURCE_DIR}/seeddms/tmp/seeddms-adminpwd.sql >/tmp/seeddms-adminpwd.sql +psql -f /tmp/seeddms-adminpwd.sql seeddms seeddms +unset PGPASSWORD # Create OS user adduser --system --group --home /srv/seeddms --shell /bin/false seeddms @@ -38,7 +43,7 @@ systemctl restart php7.0-fpm systemctl restart nginx # Add portal application definition -${SOURCE_DIR}/basic/portal-app-manager.py seeddms "https://{host}/seeddms/" +${SOURCE_DIR}/basic/portal-app-manager.py seeddms "https://{host}/seeddms/" "${SEEDDMS_ADMIN_USER}" "${SEEDDMS_ADMIN_PWD}" # TODO: id3 ssconvers pdftotext catdoc # TODO: Test Lucene fulltext search diff --git a/seeddms/srv/seeddms/www/conf/settings.xml b/seeddms/srv/seeddms/www/conf/settings.xml index 354571a..1dd457e 100644 --- a/seeddms/srv/seeddms/www/conf/settings.xml +++ b/seeddms/srv/seeddms/www/conf/settings.xml @@ -8,10 +8,10 @@ - - - - + + + + @@ -23,12 +23,12 @@ - pdftotext -enc UTF-8 -nopgbrk %s - | sed -e 's/ [a-zA-Z0-9.]\{1\} / /g' -e 's/[0-9.]//g' - catdoc %s - ssconvert -T Gnumeric_stf:stf_csv -S %s fd://1 - id3 -l -R %s | egrep '(Title|Artist|Album)' | sed 's/^[^:]*: //g' - id3 -l -R %s | egrep '(Title|Artist|Album)' | sed 's/^[^:]*: //g' - cat %s + pdftotext -enc UTF-8 -nopgbrk %s - | sed -e 's/ [a-zA-Z0-9.]\{1\} / /g' -e 's/[0-9.]//g' + catdoc %s + ssconvert -T Gnumeric_stf:stf_csv -S %s fd://1 + id3 -l -R %s | egrep '(Title|Artist|Album)' | sed 's/^[^:]*: //g' + id3 -l -R %s | egrep '(Title|Artist|Album)' | sed 's/^[^:]*: //g' + cat %s diff --git a/seeddms/tmp/seeddms-adminpwd.sql b/seeddms/tmp/seeddms-adminpwd.sql new file mode 100644 index 0000000..4935a83 --- /dev/null +++ b/seeddms/tmp/seeddms-adminpwd.sql @@ -0,0 +1 @@ +UPDATE "tblUsers" SET login = '${SEEDDMS_ADMIN_USER}', pwd = MD5('${SEEDDMS_ADMIN_PWD}'), email = '${SEEDDMS_ADMIN_EMAIL}' WHERE login = 'admin';