Ok, loaded the new script and saved it succesfully:
Code: Select all
2021-03-25 10:01:00.570 Error: dzVents: Error: (3.0.18) SSH_0.20210325_03: An error occurred when calling event handler VPN Status
2021-03-25 10:01:00.570 Error: dzVents: Error: (3.0.18) SSH_0.20210325_03: ...icz/var/scripts/dzVents/generated_scripts/VPN Status.lua:70: attempt to concatenate a nil value (global 'remotePort')
Found that the defined port parameter name should be remotePort instead, changed that.
The logfile now:
Code: Select all
2021-03-25 10:04:00.180 Status: dzVents: Info: SSH_0.20210325_03: ------ Start internal script: VPN Status:, trigger: "every minute"
2021-03-25 10:04:00.181 Status: dzVents: Debug: SSH_0.20210325_03: Processing device-adapter for VPN Status ON/OFF: Switch device adapter
2021-03-25 10:04:00.181 Status: dzVents: Debug: SSH_0.20210325_03: Executing Command: sudo ssh [email protected] -p 2211 'nvram get vpn_client1_state ;'
2021-03-25 10:04:00.409 Status: dzVents: Debug: SSH_0.20210325_03: Error ==>> Host key verification failed.
2021-03-25 10:04:00.409 Status: dzVents: Debug: SSH_0.20210325_03: Host key verification failed.
2021-03-25 10:04:00.409 ::ERROR::
2021-03-25 10:04:00.409
2021-03-25 10:04:00.409 Status: dzVents: Debug: SSH_0.20210325_03: Constructed timed-command: Off
2021-03-25 10:04:00.409 Status: dzVents: Debug: SSH_0.20210325_03: Executing Command: sudo ssh [email protected] -p 2211 'service stop_vpnclient1 ; service start_vpnclient1 ;'
2021-03-25 10:04:00.409 Error: dzVents: Error: (3.0.18) SSH_0.20210325_03: Result: Host key verification failed.
2021-03-25 10:04:00.409 ::ERROR::
2021-03-25 10:04:00.409 : OpenVPN not connected. Check it out
2021-03-25 10:04:01.797 Notification sent (email) => Success
When I manually run the command on the cli:
sudo ssh
[email protected] -p 2211 'nvram get vpn_client1_state'
Code: Select all
Chris@DS415:~$ sudo ssh [email protected] -p 2211 'nvram get vpn_client1_state'
The authenticity of host '[192.168.1.1]:2211 ([192.168.1.1]:2211)' can't be established.
without 'sudo' it goes fine:
So I removed the sudo part out of the script:
Code: Select all
2021-03-25 10:11:00.176 Status: dzVents: Info: SSH_0.20210325_03: ------ Start internal script: VPN Status:, trigger: "every minute"
2021-03-25 10:11:00.190 Status: dzVents: Debug: SSH_0.20210325_03: Processing device-adapter for VPN Status ON/OFF: Switch device adapter
2021-03-25 10:11:00.190 Status: dzVents: Debug: SSH_0.20210325_03: Executing Command: ssh [email protected] -p 2211 'nvram get vpn_client1_state ;'
2021-03-25 10:11:00.278 Status: dzVents: Debug: SSH_0.20210325_03: Error ==>> Host key verification failed.
2021-03-25 10:11:00.278 Status: dzVents: Debug: SSH_0.20210325_03: Host key verification failed.
2021-03-25 10:11:00.278 ::ERROR::
2021-03-25 10:11:00.278
2021-03-25 10:11:00.278 Status: dzVents: Debug: SSH_0.20210325_03: Constructed timed-command: Off
2021-03-25 10:11:00.279 Status: dzVents: Debug: SSH_0.20210325_03: Executing Command: ssh [email protected] -p 2211 'service stop_vpnclient1 ; service start_vpnclient1 ;'
2021-03-25 10:11:00.369 Status: dzVents: Debug: SSH_0.20210325_03: Error ==>> Host key verification failed.
2021-03-25 10:11:00.369 Status: dzVents: Info: SSH_0.20210325_03: ------ Finished VPN Status
2021-03-25 10:11:00.562 Status: Notification: SSH_0.20210325_03
2021-03-25 10:11:00.278 Error: dzVents: Error: (3.0.18) SSH_0.20210325_03: Result: Host key verification failed.
2021-03-25 10:11:00.278 ::ERROR::
2021-03-25 10:11:00.278 : OpenVPN not connected. Check it out
2021-03-25 10:11:01.577 Notification sent (email) => Success
I can also see a ';' behind the command, maybe that is causing the issue?
I removed the ';' in the script at the sshEOL part.
But still the hostkey verification failed:
Code: Select all
2021-03-25 10:14:00.232 Status: dzVents: Info: monit: ------ Finished Monit-status-data
2021-03-25 10:14:00.233 Status: dzVents: Info: SSH_0.20210325_03: ------ Start internal script: VPN Status:, trigger: "every minute"
2021-03-25 10:14:00.233 Status: dzVents: Debug: SSH_0.20210325_03: Processing device-adapter for VPN Status ON/OFF: Switch device adapter
2021-03-25 10:14:00.233 Status: dzVents: Debug: SSH_0.20210325_03: Executing Command: ssh [email protected] -p 2211 'nvram get vpn_client1_state '
2021-03-25 10:14:00.330 Status: dzVents: Debug: SSH_0.20210325_03: Error ==>> Host key verification failed.
2021-03-25 10:14:00.330 Status: dzVents: Debug: SSH_0.20210325_03: Host key verification failed.
2021-03-25 10:14:00.330 ::ERROR::
2021-03-25 10:14:00.330
2021-03-25 10:14:00.330 Status: dzVents: Debug: SSH_0.20210325_03: Constructed timed-command: Off
2021-03-25 10:14:00.331 Status: dzVents: Debug: SSH_0.20210325_03: Executing Command: ssh [email protected] -p 2211 'service stop_vpnclient1 ; service start_vpnclient1 '
2021-03-25 10:14:00.419 Status: dzVents: Debug: SSH_0.20210325_03: Error ==>> Host key verification failed.
2021-03-25 10:14:00.419 Status: dzVents: Info: SSH_0.20210325_03: ------ Finished VPN Status
2021-03-25 10:14:00.504 Status: Notification: SSH_0.20210325_03
2021-03-25 10:14:00.330 Error: dzVents: Error: (3.0.18) SSH_0.20210325_03: Result: Host key verification failed.
2021-03-25 10:14:00.330 ::ERROR::
2021-03-25 10:14:00.330 : OpenVPN not connected. Check it out
2021-03-25 10:14:01.447 Notification sent (email) => Success
I'm thinking it is still an issue with the user running the specific command, becuase when I log in on my NAS cli with user 'admin' the command does not run OK:
Code: Select all
admin@DS415:~$ ssh [email protected] -p 2211 'nvram get vpn_client1_state '
The authenticity of host '[192.168.1.1]:2211 ([192.168.1.1]:2211)' can't be established.
with the user 'Chris' logged in to the NAS cli it works fine:
Domoticz beta | Dashticz beta | Synology DS415+ | Wall tablet Teclast 11.6inch (Android) | TADO v3 controlled heating