in reply to Re: Net::OpenSSH + CGI problem
in thread Net::OpenSSH + CGI problem

Thanks!

error.log contents after debug

# open_ex: ['ssh','-V'] # io3 mloop, cin: 0, cout: 1, cerr: 0 # io3 fast, cin: 0, cout: 1, cerr: 0 # stdout, bytes read: 60 at offset 0 #> 4f 70 65 6e 53 53 48 5f 37 2e 32 70 32 20 55 62 75 6e 74 75 2d 34 7 +5 62 75 6e 74 75 32 2e 31 2c | OpenSSH_7.2p2 Ubuntu-4ubuntu2.1, #> 20 4f 70 65 6e 53 53 4c 20 31 2e 30 2e 32 67 20 20 31 20 4d 61 72 2 +0 32 30 31 36 0a | OpenSSL 1.0.2g 1 Mar 2016. # io3 fast, cin: 0, cout: 1, cerr: 0 # stdout, bytes read: 0 at offset 60 # leaving _io3() # _waitpid(11568) => pid: 11568, rc: 0, err: # OpenSSH version is 7.2p2 # ctl_path: /home/www-data/username-10.10.10.10-11567-450338, ctl_dir: + /home/www-data/ # set_error(0 - 0) # call args: ['ssh','-vvv','-o','ServerAliveInterval=30','-o','Control +Persist=no','-2MNx','-o','NumberOfPasswordPrompts=1','-o','PreferredA +uthentications=keyboard-interactive,password','-S','/home/www-data/us +ername-10.10.10.10-11567-450338','-l','username','10.10.10.10','--'] # master state jumping from _STATE_START to _STATE_LOGIN # file object not yet found at /home/www-data/username-10.10.10.10-115 +67-450338, state:_STATE_LOGIN # file object not yet found at /home/www-data/username-10.10.10.10-115 +67-450338, state:_STATE_LOGIN # file object not yet found at /home/www-data/username-10.10.10.10-115 +67-450338, state:_STATE_LOGIN # file object not yet found at /home/www-data/username-10.10.10.10-115 +67-450338, state:_STATE_LOGIN # file object not yet found at /home/www-data/username-10.10.10.10-115 +67-450338, state:_STATE_LOGIN # file object not yet found at /home/www-data/username-10.10.10.10-115 +67-450338, state:_STATE_LOGIN # tracer attached, ssh pid: 11569, tracer pid: 11570 OpenSSH_7.2p2 Ubuntu-4ubuntu2.1, OpenSSL 1.0.2g 1 Mar 2016 debug1: Reading configuration data /etc/ssh/ssh_config debug1: /etc/ssh/ssh_config line 19: Applying options for * debug2: resolving "10.10.10.10" port 22 debug2: ssh_connect_direct: needpriv 0 debug1: Connecting to 10.10.10.10 [10.10.10.10] port 22. debug1: Connection established. debug1: key_load_public: No such file or directory debug1: identity file /var/www/.ssh/id_rsa type -1 debug1: key_load_public: No such file or directory debug1: identity file /var/www/.ssh/id_rsa-cert type -1 debug1: key_load_public: No such file or directory debug1: identity file /var/www/.ssh/id_dsa type -1 debug1: key_load_public: No such file or directory debug1: identity file /var/www/.ssh/id_dsa-cert type -1 debug1: key_load_public: No such file or directory debug1: identity file /var/www/.ssh/id_ecdsa type -1 debug1: key_load_public: No such file or directory debug1: identity file /var/www/.ssh/id_ecdsa-cert type -1 debug1: key_load_public: No such file or directory debug1: identity file /var/www/.ssh/id_ed25519 type -1 debug1: key_load_public: No such file or directory debug1: identity file /var/www/.ssh/id_ed25519-cert type -1 debug1: Enabling compatibility mode for protocol 2.0 debug1: Local version string SSH-2.0-OpenSSH_7.2p2 Ubuntu-4ubuntu2.1 # file object not yet found at /home/www-data/username-10.10.10.10-115 +67-450338, state:_STATE_LOGIN debug1: Remote protocol version 2.0, remote software version Cisco-2.0 debug1: no match: Cisco-2.0 debug2: fd 3 setting O_NONBLOCK debug1: Authenticating to 10.10.10.10:22 as 'username' debug3: hostkeys_foreach: reading file "/var/www/.ssh/known_hosts" debug3: record_hostkey: found key type RSA in file /var/www/.ssh/known +_hosts:1 debug3: load_hostkeys: loaded 1 keys from 10.10.10.10 debug3: order_hostkeyalgs: prefer hostkeyalgs: ssh-rsa-cert-v01@openss +h.com,rsa-sha2-512,rsa-sha2-256,ssh-rsa debug3: send packet: type 20 debug1: SSH2_MSG_KEXINIT sent debug3: receive packet: type 20 debug1: SSH2_MSG_KEXINIT received debug2: local client KEXINIT proposal debug2: KEX algorithms: curve25519-sha256@libssh.org,ecdh-sha2-nistp25 +6,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange +-sha256,diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha +1,ext-info-c debug2: host key algorithms: ssh-rsa-cert-v01@openssh.com,rsa-sha2-512 +,rsa-sha2-256,ssh-rsa,ecdsa-sha2-nistp256-cert-v01@openssh.com,ecdsa- +sha2-nistp384-cert-v01@openssh.com,ecdsa-sha2-nistp521-cert-v01@opens +sh.com,ssh-ed25519-cert-v01@openssh.com,ecdsa-sha2-nistp256,ecdsa-sha +2-nistp384,ecdsa-sha2-nistp521,ssh-ed25519 debug2: ciphers ctos: chacha20-poly1305@openssh.com,aes128-ctr,aes192- +ctr,aes256-ctr,aes128-gcm@openssh.com,aes256-gcm@openssh.com,aes128-c +bc,aes192-cbc,aes256-cbc,3des-cbc debug2: ciphers stoc: chacha20-poly1305@openssh.com,aes128-ctr,aes192- +ctr,aes256-ctr,aes128-gcm@openssh.com,aes256-gcm@openssh.com,aes128-c +bc,aes192-cbc,aes256-cbc,3des-cbc debug2: MACs ctos: umac-64-etm@openssh.com,umac-128-etm@openssh.com,hm +ac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-sha1-e +tm@openssh.com,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256 +,hmac-sha2-512,hmac-sha1 debug2: MACs stoc: umac-64-etm@openssh.com,umac-128-etm@openssh.com,hm +ac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-sha1-e +tm@openssh.com,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256 +,hmac-sha2-512,hmac-sha1 debug2: compression ctos: none,zlib@openssh.com,zlib debug2: compression stoc: none,zlib@openssh.com,zlib debug2: languages ctos: debug2: languages stoc: debug2: first_kex_follows 0 debug2: reserved 0 debug2: peer server KEXINIT proposal debug2: KEX algorithms: diffie-hellman-group14-sha1,diffie-hellman-gro +up1-sha1 debug2: host key algorithms: ssh-rsa debug2: ciphers ctos: aes128-cbc,aes192-cbc,aes256-cbc,3des-cbc debug2: ciphers stoc: aes128-cbc,aes192-cbc,aes256-cbc,3des-cbc debug2: MACs ctos: hmac-sha1 debug2: MACs stoc: hmac-sha1 debug2: compression ctos: none debug2: compression stoc: none debug2: languages ctos: debug2: languages stoc: debug2: first_kex_follows 0 debug2: reserved 0 debug1: kex: algorithm: diffie-hellman-group14-sha1 debug1: kex: host key algorithm: ssh-rsa debug1: kex: server->client cipher: aes128-cbc MAC: hmac-sha1 compress +ion: none debug1: kex: client->server cipher: aes128-cbc MAC: hmac-sha1 compress +ion: none debug1: sending SSH2_MSG_KEXDH_INIT debug2: bits set: 1076/2048 debug3: send packet: type 30 debug1: expecting SSH2_MSG_KEXDH_REPLY # file object not yet found at /home/www-data/username-10.10.10.10-115 +67-450338, state:_STATE_LOGIN debug3: receive packet: type 31 debug1: Server host key: ssh-rsa SHA256:8t7tXh5nWhCGRevKBLgvnFNfkKGK6b +doqL0/pOFj5CY debug3: hostkeys_foreach: reading file "/var/www/.ssh/known_hosts" debug3: record_hostkey: found key type RSA in file /var/www/.ssh/known +_hosts:1 debug3: load_hostkeys: loaded 1 keys from 10.10.10.10 debug1: Host '10.10.10.10' is known and matches the RSA host key. debug1: Found key in /var/www/.ssh/known_hosts:1 debug2: bits set: 1032/2048 debug3: send packet: type 21 debug2: set_newkeys: mode 1 debug1: rekey after 4294967296 blocks debug1: SSH2_MSG_NEWKEYS sent debug1: expecting SSH2_MSG_NEWKEYS debug3: receive packet: type 21 debug2: set_newkeys: mode 0 debug1: rekey after 4294967296 blocks debug1: SSH2_MSG_NEWKEYS received debug2: key: /var/www/.ssh/id_rsa ((nil)) debug2: key: /var/www/.ssh/id_dsa ((nil)) debug2: key: /var/www/.ssh/id_ecdsa ((nil)) debug2: key: /var/www/.ssh/id_ed25519 ((nil)) debug3: send packet: type 5 debug3: receive packet: type 6 debug2: service_accept: ssh-userauth debug1: SSH2_MSG_SERVICE_ACCEPT received debug3: send packet: type 50 debug3: receive packet: type 53 debug3: input_userauth_banner This system is for authorized users only. Unauthorized access is prohi +bited. By accessing or using this system, you are expressly consenting to monitoring and recording, which may be --snip-- If monitoring reveals possible evidence of criminal activity, such evidence may be provided to Law Enforcement Personnel. SYSTEM USERS EXPRESSLY CONSENT TO SUCH MONITORING. debug3: receive packet: type 51 debug1: Authentications that can continue: password debug3: start over, passed a different list password debug3: preferred keyboard-interactive,password debug3: authmethod_lookup password debug3: remaining preferred: ,password debug3: authmethod_is_enabled password debug1: Next authentication method: password # file object not yet found at /home/www-data/username-10.10.10.10-115 +67-450338, state:_STATE_LOGIN # passwd/passphrase requested (username@10.10.10.10's password:) # file object not yet found at /home/www-data/username-10.10.10.10-115 +67-450338, state:_STATE_AWAITING_MUX debug3: send packet: type 50 debug2: we sent a password packet, wait for reply # file object not yet found at /home/www-data/username-10.10.10.10-115 +67-450338, state:_STATE_AWAITING_MUX # file object not yet found at /home/www-data/username-10.10.10.10-115 +67-450338, state:_STATE_AWAITING_MUX debug3: receive packet: type 52 debug1: Authentication succeeded (password). Authenticated to 10.10.10.10 ([10.10.10.10]:22). debug1: setting up multiplex master socket debug3: muxserver_listen: temporary control path /home/www-data/userna +me-10.10.10.10-11567-450338.RYqHeGfzKxnUwoNH debug2: fd 4 setting O_NONBLOCK debug3: fd 4 is O_NONBLOCK debug3: fd 4 is O_NONBLOCK debug1: channel 0: new [/home/www-data/username-10.10.10.10-11567-4503 +38] debug3: muxserver_listen: mux listener channel 0 fd 4 debug2: fd 3 setting TCP_NODELAY debug3: ssh_packet_set_tos: set IP_TOS 0x08 debug1: Entering interactive session. debug1: pledge: id # file object found at /home/www-data/username-10.10.10.10-11567-45033 +8 # master state jumping from _STATE_AWAITING_MUX to _STATE_RUNNING # call args: ['ssh','-O','check','-T','-S','/home/www-data/username-10 +.10.10.10-11567-450338','-l','username','10.10.10.10','--'] # open_ex: ['ssh','-O','check','-T','-S','/home/www-data/username-10.1 +0.10.10-11567-450338','-l','username','10.10.10.10','--'] # io3 mloop, cin: 0, cout: 1, cerr: 0 # io3 fast, cin: 0, cout: 1, cerr: 0 debug1: multiplexing control connection debug2: fd 5 setting O_NONBLOCK debug3: fd 5 is O_NONBLOCK debug1: channel 1: new [mux-control] debug3: channel_post_mux_listener: new mux channel 1 fd 5 debug3: mux_master_read_cb: channel 1: hello sent debug3: mux_master_read_cb: channel 1 packet type 0x00000001 len 4 debug2: process_mux_master_hello: channel 1 slave version 4 debug3: mux_master_read_cb: channel 1 packet type 0x10000004 len 4 debug2: process_mux_alive_check: channel 1: alive check # stdout, bytes read: 28 at offset 0 #> 4d 61 73 74 65 72 20 72 75 6e 6e 69 6e 67 20 28 70 69 64 3d 31 31 3 +5 36 39 29 0d 0a | Master running (pid=11569).. # io3 fast, cin: 0, cout: 1, cerr: 0 debug2: channel 1: ctl read<=0 rfd 5 len 0 # debug2: channel 1: read failed stdout, bytes read: debug2: channel 1: close_read 0debug2: channel 1: input open -> drain at offset 28debug2: channel 1: ibuf empty debug2: channel 1: input drain -> closed debug2: channel 1: rcvd close debug2: channel 1: output open -> drain debug2: channel 1: obuf empty debug2: channel 1: close_write debug2: channel 1: output drain -> closed # debug2: channel 1: is dead (local) leaving _io3()debug2: channel 1: gc: notify user debug3: mux_master_control_cleanup_cb: entering for channel 1 debug2: channel 1: gc: user detached debug2: channel 1: is dead (local) debug2: channel 1: garbage collecting debug1: channel 1: free: mux-control, nchannels 2 debug3: channel 1: status: The following connections are open: # _waitpid(11572) => pid: 11572, rc: 0, err: # call args: ['ssh','-S','/home/www-data/username-10.10.10.10-11567-45 +0338','-l','username','10.10.10.10','--','sh int desc'] # open_ex: ['ssh','-S','/home/www-data/username-10.10.10.10-11567-4503 +38','-l','username','10.10.10.10','--','sh int desc'] # io3 mloop, cin: 0, cout: 1, cerr: 0 # io3 fast, cin: 0, cout: 1, cerr: 0 debug1: multiplexing control connection debug2: fd 5 setting O_NONBLOCK debug3: fd 5 is O_NONBLOCK debug1: channel 1: new [mux-control] debug3: channel_post_mux_listener: new mux channel 1 fd 5 debug3: mux_master_read_cb: channel 1: hello sent debug3: mux_master_read_cb: channel 1 packet type 0x00000001 len 4 debug2: process_mux_master_hello: channel 1 slave version 4 debug3: mux_master_read_cb: channel 1 packet type 0x10000004 len 4 debug2: process_mux_alive_check: channel 1: alive check debug3: mux_master_read_cb: channel 1 packet type 0x10000002 len 47 debug2: process_mux_new_session: channel 1: request tty 0, X 0, agent +0, subsys 0, term "", cmd "sh int desc", env 0 debug3: process_mux_new_session: got fds stdin 6, stdout 7, stderr 8 debug2: fd 6 setting O_NONBLOCK debug2: fd 7 setting O_NONBLOCK debug2: fd 8 setting O_NONBLOCK debug1: channel 2: new [client-session] debug2: process_mux_new_session: channel_new: 2 linked to control chan +nel 1 debug2: channel 2: send open debug3: send packet: type 90 debug3: receive packet: type 91 debug2: callback start debug2: client_session2_setup: id 2 debug1: Sending command: sh int desc debug2: channel 2: request exec confirm 1 debug3: send packet: type 98 debug3: mux_session_confirm: sending success reply debug2: callback done debug2: channel 2: open confirm rwindow 2097152 rmax 32768 debug2: channel 2: read<=0 rfd 6 len 0 debug2: channel 2: read failed debug2: channel 2: close_read debug2: channel 2: input open -> drain debug2: channel 2: ibuf empty debug2: channel 2: send eof debug3: send packet: type 96 debug2: channel 2: input drain -> closed debug3: receive packet: type 99 debug2: channel_input_status_confirm: type 99 id 2 debug2: exec request accepted on channel 2 debug3: receive packet: type 98 debug1: client_input_channel_req: channel 2 rtype exit-status reply 0 debug3: mux_exit_message: channel 2: exit message, exitval 0 debug3: receive packet: type 96 debug2: channel 2: rcvd eof debug2: channel 2: output open -> drain debug2: channel 2: obuf empty debug2: channel 2: close_write debug2: channel 2: output drain -> closed debug3: receive packet: type 97 debug2: channel 2: rcvd close debug3: channel 2: will not send data after close debug2: channel 2: send close debug3: send packet: type 97 debug2: channel 2: is dead debug2: channel 2: gc: notify user debug3: mux_master_session_cleanup_cb: entering for channel 2 debug2: channel 1: rcvd close debug2: channel 1: output open -> drain debug2: channel 1: close_read debug2: channel 1: input open -> closed debug2: channel 2: gc: user detached debug2: channel 2: is dead debug2: channel 2: garbage collecting debug1: channel 2: free: client-session, nchannels 3 debug3: channel 2: status: The following connections are open: #2 client-session (t4 r1 i3/0 o3/0 fd -1/-1 cc -1) debug3: send packet: type 1 debug1: channel 0: free: /home/www-data/username-10.10.10.10-11567-450 +338, nchannels 2 debug3: channel 0: status: The following connections are open: debug1: channel 1: free: mux-control, nchannels 1 debug3: channel 1: status: The following connections are open: debug1: fd 0 clearing O_NONBLOCK debug3: fd 1 is not O_NONBLOCK debug1: fd 2 clearing O_NONBLOCK Connection to 10.10.10.10 closed by remote host. Transferred: sent 2008, received 2400 bytes, in 0.2 seconds Bytes per second: sent 10308.0, received 12320.3 debug1: Exit status -1 # stdout, bytes read: 0 at offset 0 # leaving _io3() # _waitpid(11573) => pid: 11573, rc: 0, err: remote command failed: 0 at /usr/lib/cgi-bin/test2.cgi line 36. # DESTROY(Net::OpenSSH=HASH(0xf74b10), pid: 11569) # sending exit control to master # master 11569 exited, rc:65280, err: # set_error(1 - control command failed: master process exited unexpect +edly) # master state jumping from _STATE_RUNNING to _STATE_GONE # master state jumping from _STATE_GONE to _STATE_GONE

Replies are listed 'Best First'.
Re^3: Net::OpenSSH + CGI problem
by fwalters (Novice) on Feb 16, 2017 at 14:51 UTC

    Quick followup...

    we run some Cisco ASR and IOS based routers, apparently the IOS based routers work fine, while the ASR (IOXR) based routers.

    The main difference, at least visually, is the prompt:

    For the working router the prompt I get is:

    1-CHI-RR1-Curly#

    While for the one that doesn't work I get:

    RP/0/RSP0/CPU0:1-CHI-PE14-SOB-QuiGon#
      Does Net::OpenSSH work against both kinds of routers when used outside the CGI environment?

      The module FAQ contains an entry about common issues when connecting to network equipment.

        Yes, works great on command line, and using the www-data user as well from command line...

        I read through the FAQ but I'll look again with fresh eyes. Any other thoughts?

        Maybe I'll put a sniffer on it and watch the packets.