From fec58bf028b0fa07039e2eb732c2e925f1c57eff Mon Sep 17 00:00:00 2001 From: leiweibau <105860611+leiweibau@users.noreply.github.com> Date: Fri, 22 Jul 2022 21:21:43 +0200 Subject: [PATCH] Basic Login - Default password is "123456" - there is a warning on the login page, when the default password is active - to set ne new password, use the reset_password.sh in the config folder (./reset_password.sh newpassword) - the password is stored as a sha256 hash - the script creates a backup of the config file, just in case --- config/pialert.conf | 1 + config/reset_password.sh | 7 ++ front/deviceDetails.php | 8 ++ front/devices.php | 8 ++ front/events.php | 8 ++ front/index.php | 137 ++++++++++++++++++++++++++++++++- front/maintenance.php | 8 ++ front/php/templates/header.php | 28 ++----- front/presence.php | 8 ++ 9 files changed, 188 insertions(+), 25 deletions(-) create mode 100644 config/reset_password.sh diff --git a/config/pialert.conf b/config/pialert.conf index d58f0f3d..8b9628e0 100644 --- a/config/pialert.conf +++ b/config/pialert.conf @@ -12,6 +12,7 @@ DB_PATH = PIALERT_PATH + '/db/pialert.db' LOG_PATH = PIALERT_PATH + '/log' VENDORS_DB = '/usr/share/arp-scan/ieee-oui.txt' PRINT_LOG = False +PIALERT_WEB_PASSWORD = '8d969eef6ecad3c29a3a629280e686cf0c3f5d5a86aff3ca12020c923adc6c92' SMTP_SERVER = 'smtp.gmail.com' SMTP_PORT = 587 diff --git a/config/reset_password.sh b/config/reset_password.sh new file mode 100644 index 00000000..a7f933ee --- /dev/null +++ b/config/reset_password.sh @@ -0,0 +1,7 @@ +cp pialert.conf pialert.conf.bak +PIA_PASS=$1 +echo "The password '$1' is hashed" +PIA_PASS_HASH=$(echo -n $PIA_PASS | sha256sum | awk '{print $1}') +echo "The hashed password is: $PIA_PASS_HASH" +sed -i "/PIALERT_WEB_PASSWORD/c\PIALERT_WEB_PASSWORD = '$PIA_PASS_HASH'" pialert.conf +echo "The hash was saved in the configuration file" \ No newline at end of file diff --git a/front/deviceDetails.php b/front/deviceDetails.php index b5b11762..aefd7542 100644 --- a/front/deviceDetails.php +++ b/front/deviceDetails.php @@ -8,6 +8,14 @@ #--------------------------------------------------------------------------- --> diff --git a/front/devices.php b/front/devices.php index dcdea723..f0033d05 100644 --- a/front/devices.php +++ b/front/devices.php @@ -8,6 +8,14 @@ #--------------------------------------------------------------------------- --> diff --git a/front/events.php b/front/events.php index 0655c08a..597cca30 100644 --- a/front/events.php +++ b/front/events.php @@ -8,6 +8,14 @@ #--------------------------------------------------------------------------- --> diff --git a/front/index.php b/front/index.php index a1338922..6c4a1c74 100644 --- a/front/index.php +++ b/front/index.php @@ -1,5 +1,136 @@ + + + +
+ + + + + +Sign in to start your session
+ + + +To set a new password run:
./reset_password.sh yournewpassword
in the config folder.