Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom confirmation prompt acknowledgement at device login via SSH #130

Open
Kase0x opened this issue Sep 12, 2023 · 0 comments
Open

Custom confirmation prompt acknowledgement at device login via SSH #130

Kase0x opened this issue Sep 12, 2023 · 0 comments

Comments

@Kase0x
Copy link

Kase0x commented Sep 12, 2023

Feature Request

I would like to request a feature to add any number (or at least one) custom prompt to acknowledge prompts when remoting into a device via ssh.

Is your feature request related to a problem? Please describe

This is involving an ssh connection to an HPE Aruba switch that is a member of a stack.
There are two prompts that appear prior to arriving at the regular CLI prompts:
Press any key to continue
and
Enter switch number to connect to or <CR>:

The first prompt obviously needs any key press which I am normally able to bypass by adding a space prior to the "copy config tftp" command entry in the plugin since it appears the current plugin "Press any key" command happens after the copy TFTP command.

I can't bypass or find a way to get past the second prompt with the current fields.

Describe the solution you'd like

I would like an additional fields exactly like the "Any Key prompt" and the "Confirmation Prompt" but have them initiate right after ssh login (or prior to sending the copy TFTP command).

Describe alternatives you've considered

Perhaps add a custom comment field in the Device Types that accepts a comma seperate list or dictionary entries that match (1) the prompt that is asking for input and (2) the response that should be given.
If possible, allow for <return> keys to be specified in this comment field to allow for bypassing "Press any key to continue fields" or to allow for a number entry followed by a key for the stacked switch number.

Additional context

Example entry that appears:
Any key press works for the first.
A carriage return or number entry works for the second.
image

Added the "Enter switch number to connect to or <CR>" prompt to Confirmation Prompt field to see if it could work but only happens after the copy TFTP command. Same for Press any key to continue
image

Note, The "Not valid member 19" is probably from the copy TFTP command. The switch number field only accepts numbers so it took only the beginning of the IP addresses in the copy TFTP command.

2023-09-12 10:03:17 - CMDPHP PHP ERROR WARNING Backtrace: (/plugins/routerconfigs/router-download.php[133]:plugin_routerconfigs_download(), /plugins/routerconfigs/include/functions.php[165]:plugin_routerconfigs_download_config(), /plugins/routerconfigs/include/functions.php[490]:PHPShellConnection->Download(), /plugins/routerconfigs/classes/PHPShellConnection.php[150]:PHPConnection->DoCommand(), /plugins/routerconfigs/classes/PHPConnection.php[293]:fwrite(), CactiErrorHandler())
2023-09-12 10:03:17 - ERROR PHP WARNING in Plugin 'routerconfigs': fwrite(): Failure 'Failure while draining incoming flow' (-43) in file: /var/www/html/cacti/plugins/routerconfigs/classes/PHPConnection.php on line: 293
2023-09-12 10:03:17 - RCONFIG 192.168.13.2 (SSH) -> DEBUG: -->
2023-09-12 10:03:17 - RCONFIG 192.168.13.2 (SSH) -> DEBUG: Sending a return
2023-09-12 10:03:17 - RCONFIG 192.168.13.2 (SSH) -> DEBUG: Result: (8)
2023-09-12 10:03:17 - RCONFIG 192.168.13.2 (SSH) -> DEBUG: Line:
2023-09-12 10:03:17 - RCONFIG 192.168.13.2 (SSH) -> DEBUG: Timeout of 1 seconds has been reached
2023-09-12 10:03:16 - CMDPHP PHP ERROR WARNING Backtrace: (/plugins/routerconfigs/router-download.php[133]:plugin_routerconfigs_download(), /plugins/routerconfigs/include/functions.php[165]:plugin_routerconfigs_download_config(), /plugins/routerconfigs/include/functions.php[490]:PHPShellConnection->Download(), /plugins/routerconfigs/classes/PHPShellConnection.php[150]:PHPConnection->DoCommand(), /plugins/routerconfigs/classes/PHPConnection.php[293]:fwrite(), CactiErrorHandler())
2023-09-12 10:03:16 - ERROR PHP WARNING in Plugin 'routerconfigs': fwrite(): Failure 'Failure while draining incoming flow' (-43) in file: /var/www/html/cacti/plugins/routerconfigs/classes/PHPConnection.php on line: 293
2023-09-12 10:03:16 - RCONFIG 192.168.13.2 (SSH) -> DEBUG: -->
2023-09-12 10:03:16 - RCONFIG 192.168.13.2 (SSH) -> DEBUG: Sending a return
2023-09-12 10:03:16 - RCONFIG 192.168.13.2 (SSH) -> DEBUG: Result: (8)
2023-09-12 10:03:16 - RCONFIG 192.168.13.2 (SSH) -> DEBUG: Line:
2023-09-12 10:03:16 - RCONFIG 192.168.13.2 (SSH) -> DEBUG: Timeout of 1 seconds has been reached
2023-09-12 10:03:14 - CMDPHP PHP ERROR WARNING Backtrace: (/plugins/routerconfigs/router-download.php[133]:plugin_routerconfigs_download(), /plugins/routerconfigs/include/functions.php[165]:plugin_routerconfigs_download_config(), /plugins/routerconfigs/include/functions.php[490]:PHPShellConnection->Download(), /plugins/routerconfigs/classes/PHPShellConnection.php[150]:PHPConnection->DoCommand(), /plugins/routerconfigs/classes/PHPConnection.php[293]:fwrite(), CactiErrorHandler())
2023-09-12 10:03:14 - ERROR PHP WARNING in Plugin 'routerconfigs': fwrite(): Failure 'Failure while draining incoming flow' (-43) in file: /var/www/html/cacti/plugins/routerconfigs/classes/PHPConnection.php on line: 293
2023-09-12 10:03:14 - RCONFIG 192.168.13.2 (SSH) -> DEBUG: -->
2023-09-12 10:03:14 - RCONFIG 192.168.13.2 (SSH) -> DEBUG: Sending a return
2023-09-12 10:03:14 - RCONFIG 192.168.13.2 (SSH) -> DEBUG: Result: (8)
2023-09-12 10:03:14 - RCONFIG 192.168.13.2 (SSH) -> DEBUG: Line:
2023-09-12 10:03:14 - RCONFIG 192.168.13.2 (SSH) -> DEBUG: Timeout of 1 seconds has been reached
2023-09-12 10:03:13 - RCONFIG 192.168.13.2 (SSH) -> DEBUG: --> y
2023-09-12 10:03:13 - RCONFIG 192.168.13.2 (SSH) -> DEBUG: Sending confirmation: y
2023-09-12 10:03:13 - RCONFIG 192.168.13.2 (SSH) -> DEBUG: Confirmation prompt found
2023-09-12 10:03:13 - RCONFIG 192.168.13.2 (SSH) -> DEBUG: Result: (0)
2023-09-12 10:03:13 - RCONFIG 192.168.13.2 (SSH) -> DEBUG: Line:
2023-09-12 10:03:13 - RCONFIG 192.168.13.2 (SSH) -> DEBUG: Line: �[23;1HEnter switch number to connect to or :�[2;1H�[23;44H�[?25h�[2;1H�[?25h�[23;44H�[23;44H�[?25h�[23;44H�[?25h�[23;44H�[23;44H�[?25h�[23;44H�[?25h�[23;44H�[23;44H�[?25h�[23;44H�[?25h�[23;44H�[23;44H�[?25h�[23;44H�[?25h�[23;44H�[23;44H�[?25h�[23;44H�[?25h�[23;44H�[23;44H�[?25h�[23;44H�[?25h�[23;44H�[23;44H�[?25h�[23;44H�[?25h�[23;44H�[23;44H�[?25h�[23;44H�[?25h�[23;44H�[23;44H�[?25h�[23;44H�[?25h�[23;44H�[23;44H�[?25h�[23;44H�[?25h�[23;44H�[23;44H�[?25h�[23;44H�[?25h�[23;44H�[23;44H�[?25h�[23;44H�[?25h�[23;44H�[23;44H�[?25h�[23;44H�[?25h�[23;44H�[23;44H�[?25h�[23;44H�[?25h�[23;44H�[23;44H�[?25h�[23;44H�[?25h�[23;44H�[23;44H�[?25h�[23;44H�[?25h�[23;44H�[23;44H�[?25h�[23;44H�[?25h�[23;44H�[23;44H�[?25h�[23;44H�[?25h�[23;44H�[23;44H�[?25h�[23;44H�[?25h�[23;44H�[23;44H�[?25h�[23;44H�[?25h�[23;44H�[23;44H�[?25h�[23;44H�[?25h�[23;44H�[23;44H�[?25h�[23;44H�[?25h�[23;44H�[23;44H�[?25h�[23;44H�[?25h�[23;44H�[23;44H�[?25h�[23;44H�[?25h�[23;44H�[23;44H1�[?25h�[23;44H�[?25h�[23;45H�[23;44H19�[?25h�[23;45H�[?25h�[23;46H�[23;44H19�[?25h�[23;46H�[?25h�[23;46H�[23;44H19�[?25h�[23;46H�[?25h�[23;46H�[23;44H19�[?25h�[23;46H�[?25h�[23;46H�[23;44H19�[?25h�[23;46H�[?25h�[23;46H�[23;44H19�[?25h�[23;46H�[?25h�[23;46H�[23;44H19�[?25h�[23;46H�[?25h�[23;46H�[23;44H19�[?25h�[23;46H�[?25h�[23;46H�[23;44H19�[?25h�[23;46H�[?25h�[23;46H�[23;44H19�[?25h�[23;46H�[?25h�[23;46H�[23;44H19�[?25h�[23;46H�[?25h�[23;46H�[23;44H19�[?25h�[23;46H�[?25h�[23;46H�[23;44H19�[?25h�[23;46H�[?25h�[23;46H�[23;44H19�[?25h�[23;46H�[?25h�[23;46H�[23;44H19�[?25h�[23;46H�[?25h�[23;46H�[23;44H19�[?25h�[23;46H�[?25h�[23;46H�[23;44H19�[?25h�[23;46H�[?25h�[23;46H�[23;44H19�[?25h�[23;46H�[?25h�[23;46H�[23;44H19�[?25h�[23;46H�[?25h�[23;46H�[23;44H19�[?25h�[23;46H�[?25h�[23;46H�[23;44H19�[?25h�[23;46H�[?25h�[23;46H�[23;44H19�[?25h�[23;46H�[?25h�[23;46H�[23;44H19�[?25h�[23;46H�[?25h�[23;46H�[23;44H19�[?25h�[23;46H�[?25h�[23;46H�[23;44H19�[?25h�[23;46H�[?25h�[23;46H�[23;44H19�[?25h�[23;46H�[?25h�[23;46HNot Valid Member 19
2023-09-12 10:03:13 - RCONFIG 192.168.13.2 (SSH) -> DEBUG: Line:
2023-09-12 10:03:13 - RCONFIG 192.168.13.2 (SSH) -> DEBUG: Line: 1 ######-###### 13P-SW-1 HP 2530-48G-PoEP Member Up
2023-09-12 10:03:13 - RCONFIG 192.168.13.2 (SSH) -> DEBUG: Line: 0 ######-###### 13P-SW-0 HP 2530-48G-PoEP Commander Up
2023-09-12 10:03:13 - RCONFIG 192.168.13.2 (SSH) -> DEBUG: Line: -- ------------- ------------- -------------------- -------------------------
2023-09-12 10:03:13 - RCONFIG 192.168.13.2 (SSH) -> DEBUG: Line: SN MAC Address System Name Device Type Status
2023-09-12 10:03:13 - RCONFIG 192.168.13.2 (SSH) -> DEBUG: Line:
2023-09-12 10:03:13 - RCONFIG 192.168.13.2 (SSH) -> DEBUG: Found Prompt (Confirm)
2023-09-12 10:03:13 - RCONFIG 192.168.13.2 (SSH) -> DEBUG: -->
2023-09-12 10:03:13 - RCONFIG 192.168.13.2 (SSH) -> DEBUG: Sending a return
2023-09-12 10:03:13 - RCONFIG 192.168.13.2 (SSH) -> DEBUG: Result: (0)
2023-09-12 10:03:13 - RCONFIG 192.168.13.2 (SSH) -> DEBUG: Line:
2023-09-12 10:03:13 - RCONFIG 192.168.13.2 (SSH) -> DEBUG: Line: �[1;13r�[1;1H�[25;1HPress any key to continue�[13;1H�[?25h�[25;27H�[2J�[?7h�[1;13r�[?6l�[25;27H�[?25h�[2;1H Stack Members
2023-09-12 10:03:13 - RCONFIG 192.168.13.2 (SSH) -> DEBUG: Line: U.S. Government under vendor's standard commercial license.
2023-09-12 10:03:13 - RCONFIG 192.168.13.2 (SSH) -> DEBUG: Line: Documentation, and Technical Data for Commercial Items are licensed to the
2023-09-12 10:03:13 - RCONFIG 192.168.13.2 (SSH) -> DEBUG: Line: 12.211 and 12.212, Commercial Computer Software, Computer Software
2023-09-12 10:03:13 - RCONFIG 192.168.13.2 (SSH) -> DEBUG: Line: Development LP required for possession, use or copying. Consistent with FAR
2023-09-12 10:03:13 - RCONFIG 192.168.13.2 (SSH) -> DEBUG: Line: Confidential computer software. Valid license from Hewlett Packard Enterprise
2023-09-12 10:03:13 - RCONFIG 192.168.13.2 (SSH) -> DEBUG: Line: RESTRICTED RIGHTS LEGEND
2023-09-12 10:03:13 - RCONFIG 192.168.13.2 (SSH) -> DEBUG: Line: (C) Copyright 2021 Hewlett Packard Enterprise Development LP
2023-09-12 10:03:13 - RCONFIG 192.168.13.2 (SSH) -> DEBUG: Line: Software revision YA.16.10.0015
2023-09-12 10:03:13 - RCONFIG 192.168.13.2 (SSH) -> DEBUG: Line: HP J9772A 2530-48G-PoEP Switch
2023-09-12 10:03:13 - RCONFIG 192.168.13.2 (SSH) -> DEBUG: Found Prompt (AnyKey)
2023-09-12 10:03:13 - RCONFIG 192.168.13.2 (SSH) -> DEBUG: --> copy running-config tftp 192.168.13.104 192.168.13.2
2023-09-12 10:03:13 - RCONFIG 192.168.13.2 (SSH) -> NOTICE: Already enabled, continuing
2023-09-12 10:03:13 - RCONFIG 192.168.13.2 (SSH) -> DEBUG: Connected via SSH
2023-09-12 10:03:13 - RCONFIG 192.168.13.2 (SSH) -> DEBUG: okay: logged in...
2023-09-12 10:03:12 - RCONFIG 192.168.13.2 (SSH) -> DEBUG: Setting sleep time to 125000 microsecond(s)
2023-09-12 10:03:12 - RCONFIG 192.168.13.2 (SSH) -> DEBUG: Setting timeout to 1 second(s)
2023-09-12 10:03:12 - RCONFIG 192.168.13.2 (SSH) -> DEBUG: deviceType: {"id":6,"name":"Aruba Stacked","promptuser":"username:","promptpass":"password:","connecttype":"ssh","configfile":"/cfg/running-config","copytftp":"copy running-config tftp %SERVER% %FILE%","version":"show version","promptconfirm":"Enter switch number to connect to or :","confirm":"y","sleep":125000,"timeout":1,"forceconfirm":"","checkendinconfig":"","anykey":"Press any key to continue","elevated":"on"}
2023-09-12 10:03:12 - RCONFIG 192.168.13.2 (SSH) -> DEBUG: Creating SSH Server: 192.168.13.2, User: admin, Password: (11 chars), Enablepw: (Not Set), Elevated: on
2023-09-12 10:03:12 - RCONFIG 192.168.13.2 -> DEBUG: Attempting to use 'PHPSsh'
2023-09-12 10:03:12 - RCONFIG 192.168.13.2 -> DEBUG: ssh has 'PHPSsh'
2023-09-12 10:03:12 - CMDPHP PHP ERROR WARNING Backtrace: (/plugins/routerconfigs/router-download.php[133]:plugin_routerconfigs_download(), /plugins/routerconfigs/include/functions.php[165]:plugin_routerconfigs_download_config(), /plugins/routerconfigs/include/functions.php[396]:plugin_routerconfigs_retrieve_account(), /plugins/routerconfigs/include/functions.php[711]:plugin_routerconfigs_decode(), /plugins/routerconfigs/include/functions.php[724]:CactiErrorHandler())
2023-09-12 10:03:12 - ERROR PHP WARNING in Plugin 'routerconfigs': Trying to access array offset on value of type bool in file: /var/www/html/cacti/plugins/routerconfigs/include/functions.php on line: 724
2023-09-12 10:03:12 - CMDPHP PHP ERROR NOTICE Backtrace: (/plugins/routerconfigs/router-download.php[133]:plugin_routerconfigs_download(), /plugins/routerconfigs/include/functions.php[165]:plugin_routerconfigs_download_config(), /plugins/routerconfigs/include/functions.php[396]:plugin_routerconfigs_retrieve_account(), /plugins/routerconfigs/include/functions.php[711]:plugin_routerconfigs_decode(), /plugins/routerconfigs/include/functions.php[723]:unserialize(), CactiErrorHandler())
2023-09-12 10:03:12 - ERROR PHP NOTICE in Plugin 'routerconfigs': unserialize(): Error at offset 186 of 192 bytes in file: /var/www/html/cacti/plugins/routerconfigs/include/functions.php on line: 723
2023-09-12 10:03:12 - RCONFIG DEBUG: Base64 decoded: a:3:{i:363598930;i:106307570;s:8:"password";s:120:"(120: chars)";i:1566321684;i:8045
2023-09-12 10:03:12 - RCONFIG DEBUG: Base64 decoded: a:3:{i:1226248180;i:1039128432;s:8:"password";s:11:"(11: chars)";i:748124573;i:984540834;}
2023-09-12 10:03:12 - RCONFIG DEBUG: Attempting download for 192.168.13.2
2023-09-12 10:03:12 - RCONFIG DEBUG: SQL: SELECT * FROM plugin_routerconfigs_devices WHERE enabled = 'on' AND id IN (1)
2023-09-12 10:03:12 - RCONFIG NOTICE: Starting manual backup of 1 devices
2023-09-12 10:03:12 - POLLER: Poller[Main Poller] PID[21407] DEBUG: About to Spawn a Remote Process [CMD: /usr/bin/php, ARGS: -q /var/www/html/cacti/plugins/routerconfigs/router-download.php --devices=1]
2023-09-12 10:03:12 - RCONFIG DEBUG: Executing manual backup using '/usr/bin/php' with arguments ' -q /var/www/html/cacti/plugins/routerconfigs/router-download.php --devices=1'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant