ZoneMinder / zmeventnotification

Machine Learning powered Secure Websocket & MQTT based ZoneMinder event notification server
412 stars 128 forks source link

zmeventnotification.pl dies with "bad bcrypt settings at /usr/bin/zmeventnotification.pl line 1621" #325

Closed mludvig closed 3 years ago

mludvig commented 3 years ago

Event Server version

6.0.5

The version of ZoneMinder you are using:

1.34.22, upgraded from 1.32.x

What is the nature of your issue

Bug

Details

zmeventnotification.pl dies with error: bad bcrypt settings at /usr/bin/zmeventnotification.pl line 1621

It looke like the $saved_password value starts with -ZM-$2a$10$... - apparently the -ZM- prefix trips up bcrypt. I tried to simply remove it but then the comparison on the next line always fails.

Debug Logs (if applicable)

# sudo -u www-data /usr/bin/zmeventnotification.pl
10/22/20 19:06:32.473610 zmeventnotification[9894].INF [main:972] [PARENT: using config file: /etc/zm/zmeventnotification.ini]
10/22/20 19:06:32.491802 zmeventnotification[9894].INF [main:972] [PARENT: using secrets file: /etc/zm/secrets.ini]
CONSOLE DBG-2:2020-10-22,19:06:32 PARENT: Got secret token !ZMES_PICTURE_URL
CONSOLE DBG-2:2020-10-22,19:06:32 PARENT: Got secret token !ZM_PICTURE_USER
CONSOLE DBG-2:2020-10-22,19:06:32 PARENT: Got secret token !ZM_PICTURE_PASSWORD

Configuration (read /etc/zm/zmeventnotification.ini):

Secrets file.......................... /etc/zm/secrets.ini
Base data path........................ /var/lib/zmeventnotification
Restart interval (secs)............... (undefined)

Use admin interface .................. no
Admin interface password.............. (undefined)
Admin interface persistence file ..... /var/lib/zmeventnotification/misc/escontrol_interface.dat

Port ................................. 9000
Address .............................. [::]
Event check interval ................. 5
Monitor reload interval .............. 300
Skipped monitors...................... (undefined)

Auth enabled ......................... yes
Auth timeout ......................... 20

Use API Push.......................... no
API Push Script....................... (undefined)

Use FCM .............................. yes
Use FCM V1 APIs....................... yes
FCM Date Format....................... %I:%M %p, %d-%b
Only show latest FCMv1 message........ no
Token file ........................... /var/lib/zmeventnotification/push/tokens.txt

Use MQTT ............................. no
MQTT Server .......................... 127.0.0.1
MQTT Topic ........................... zoneminder
MQTT Username ........................ (undefined)
MQTT Password ........................ (undefined)
MQTT Retain .......................... no
MQTT Tick Interval ................... 15
MQTT TLS CA ........................ (undefined)
MQTT TLS Cert ........................ (undefined)
MQTT TLS Key ........................ (undefined)
MQTT TLS Insecure ........................ no

SSL enabled .......................... yes
SSL cert file ........................ /etc/letsencrypt/live/myserver.xyz/fullchain.pem
SSL key file ......................... /etc/letsencrypt/live/myserver.xyz/privkey.pem

Verbose .............................. yes
ES Debug level.........................2
Read alarm cause ..................... yes
Tag alarm event id ................... yes
Use custom notification sound ........ yes
Send event end notification............yes
Monitor rules JSON file................(undefined)

Use Hooks............................. yes
Hook Script on Event Start ........... '/var/lib/zmeventnotification/bin/zm_event_start.sh'
User Script on Event Start.............(undefined)
Hook Script on Event End.............. '/var/lib/zmeventnotification/bin/zm_event_end.sh'
User Script on Event End.............(undefined)
Hook Skipped monitors................. (undefined)

Notify on Event Start (hook success).. all
Notify on Event Start (hook fail)..... none
Notify on Event End (hook success).... fcm,web,api
Notify on Event End (hook fail)....... none
Notify End only if Start success...... yes

Use Hook Description.................. yes
Keep frame match type................. yes
Store Frame in ZM......................yes

Picture URL .......................... https://myserver.xyz/zm/index.php?view=image&eid=EVENTID&fid=objdetect&width=600
Include picture....................... yes
Picture username ..................... zmpicture
Picture password ..................... (defined)

CONSOLE INF:2020-10-22,19:06:32 PARENT: Push enabled via FCM
10/22/20 19:06:32.575568 zmeventnotification[9894].INF [main:972] [PARENT: Push enabled via FCM]
CONSOLE DBG-2:2020-10-22,19:06:32 PARENT: fcmv1: --> FCM V1 APIs: 1
CONSOLE INF:2020-10-22,19:06:32 PARENT: MQTT Disabled
10/22/20 19:06:32.577874 zmeventnotification[9894].INF [main:972] [PARENT: MQTT Disabled]
CONSOLE INF:2020-10-22,19:06:32 PARENT: |------- Starting ES version: 6.0.5 ---------|
10/22/20 19:06:32.578747 zmeventnotification[9894].INF [main:972] [PARENT: |------- Starting ES version: 6.0.5 ---------|]
CONSOLE DBG-1:2020-10-22,19:06:32 PARENT: Started with: perl:/usr/bin/perl and command:/usr/bin/zmeventnotification.pl
Can't ignore signal CHLD, forcing to default.
CONSOLE DBG-1:2020-10-22,19:06:32 PARENT: ES invoked via ZMDC. Will exit when needed and have zmdc restart it
CONSOLE DBG-2:2020-10-22,19:06:32 PARENT: Parent<--Child pipe ready
CONSOLE INF:2020-10-22,19:06:32 PARENT: Event Notification daemon v 6.0.5 starting

10/22/20 19:06:32.665568 zmeventnotification[9894].INF [main:972] [PARENT: Event Notification daemon v 6.0.5 starting]
CONSOLE DBG-1:2020-10-22,19:06:32 PARENT: Initializing FCM tokens...
CONSOLE DBG-1:2020-10-22,19:06:32 PARENT: Total event client connections: 0

CONSOLE INF:2020-10-22,19:06:32 PARENT: Re-loading monitors
10/22/20 19:06:32.689356 zmeventnotification[9894].INF [main:972] [PARENT: Re-loading monitors]
CONSOLE DBG-1:2020-10-22,19:06:32 PARENT: Loading Stairs
CONSOLE DBG-1:2020-10-22,19:06:32 PARENT: ESCONTROL_INTERFACE is disabled. Not saving control data
CONSOLE DBG-2:2020-10-22,19:06:32 PARENT: checkEvents() new events found=0
CONSOLE DBG-2:2020-10-22,19:06:32 PARENT: About to start listening to socket
CONSOLE INF:2020-10-22,19:06:32 PARENT: Secure WS(WSS) is enabled...
10/22/20 19:06:32.694879 zmeventnotification[9894].INF [main:972] [PARENT: Secure WS(WSS) is enabled...]
CONSOLE INF:2020-10-22,19:06:32 PARENT: Web Socket Event Server listening on port 9000
10/22/20 19:06:32.696790 zmeventnotification[9894].INF [main:972] [PARENT: Web Socket Event Server listening on port 9000]
CONSOLE DBG-2:2020-10-22,19:06:37 PARENT: ---------->Tick START<--------------
CONSOLE DBG-2:2020-10-22,19:06:37 PARENT: There are 0 active child forks...
CONSOLE DBG-2:2020-10-22,19:06:37 PARENT: checkEvents() new events found=0
CONSOLE DBG-2:2020-10-22,19:06:37 PARENT: There are 0 new Events to process
CONSOLE DBG-2:2020-10-22,19:06:37 PARENT: ---------->Tick END<--------------
CONSOLE DBG-2:2020-10-22,19:06:42 PARENT: ---------->Tick START<--------------
CONSOLE DBG-2:2020-10-22,19:06:42 PARENT: There are 0 active child forks...
CONSOLE DBG-2:2020-10-22,19:06:42 PARENT: checkEvents() new events found=0
CONSOLE DBG-2:2020-10-22,19:06:42 PARENT: There are 0 new Events to process
CONSOLE DBG-2:2020-10-22,19:06:42 PARENT: ---------->Tick END<--------------
CONSOLE DBG-2:2020-10-22,19:06:45 PARENT: ---------->onConnect START<--------------
CONSOLE DBG-1:2020-10-22,19:06:45 PARENT: got a websocket connection from ::ffff:122.56.xx.xx (0) active connections
CONSOLE DBG-2:2020-10-22,19:06:45 PARENT: ---------->onConnect STOP<--------------
CONSOLE DBG-2:2020-10-22,19:06:45 PARENT: ---------->onConnect:handshake START<--------------
CONSOLE DBG-1:2020-10-22,19:06:45 PARENT: Websockets: New Connection Handshake requested from ::ffff:122.56.xx.xx:35965 state=pending auth, id=1603346805.78428
CONSOLE DBG-2:2020-10-22,19:06:45 PARENT: ---------->onConnect:handshake END<--------------
CONSOLE DBG-2:2020-10-22,19:06:45 PARENT: ---------->onConnect msg START<--------------
bad bcrypt settings at /usr/bin/zmeventnotification.pl line 1621.

Thanks!

pliablepixels commented 3 years ago

Duplicate of #241 #192 #182 #122 your password needs to be migrated in ZM

mludvig commented 3 years ago

Created a PR #326 for a simple fix to prevent the crash and report what's the issue and the solution. Please merge.