Closed mpet closed 1 year ago
This is the log from the ToxiProxy docker instance.
`ToxiProxy log
Successful connect
{"level":"info","host":"0.0.0.0","port":"8474","version":"2.5.0","caller":"api.go:119","time":"2022-11-16T16:44:13Z","message":"Starting HTTP server on endpoint 0.0.0.0:8474"}
{"level":"info","name":"netopeer2","listen":"0.0.0.0:8666","upstream":"netopeer2:830","caller":"proxy.go:118","time":"2022-11-16T16:44:16Z","message":"Started proxy"}
{"level":"info","name":"netopeer2","listen":"0.0.0.0:8666","upstream":"netopeer2:830","client":"192.168.144.1:33614","caller":"proxy.go:186","time":"2022-11-16T16:44:39Z","message":"Accepted client"}
Rest peer:
{"level":"warn","name":"netopeer2","listen":"0.0.0.0:8666","upstream":"netopeer2:830","bytes":2257,"error":"read tcp 192.168.144.2:8666->192.168.144.1:33614: use of closed network connection","caller":"link.go:127","time":"2022-11-16T16:45:48Z","message":"Source terminated"}
New ssh connection after reset peer.
After reset:
{"level":"info","name":"netopeer2","listen":"0.0.0.0:8666","upstream":"netopeer2:830","client":"192.168.144.1:35340","caller":"proxy.go:186","time":"2022-11-16T16:47:21Z","message":"Accepted client"}
{"level":"warn","name":"netopeer2","listen":"0.0.0.0:8666","upstream":"netopeer2:830","bytes":22,"error":"read tcp 192.168.144.2:57290->192.168.144.3:830: use of closed network connection","caller":"link.go:127","time":"2022-11-16T16:47:21Z","message":"Source terminated"}
{"level":"warn","name":"netopeer2","listen":"0.0.0.0:8666","upstream":"netopeer2:830","bytes":21,"error":"read tcp 192.168.144.2:8666->192.168.144.1:35340: use of closed network connection","caller":"link.go:127","time":"2022-11-16T16:47:21Z","message":"Source terminated"} `
Bump! Anyone with input? What am I missing for SSH connections?
@mpet There is no 24/7 support for such type of questions. You should take in account, that I have work to do and does not have time to help with networking debugging, without have environment similar to yours.
I can only suggest to use tools like Wireshark or tcpdump to debug network packets. If you find some issue with Toxiproxy could not process packates, than I would like to work on it.
If you want see more logs from Toxiproxy you can add environment LOG_LEVEL=debug
.
Thank you for understanding.
@miry I perfectly understand since I maintained an opensource plugin for clearcase and eclipse for a long time. But it is natural to turn to maintainers when you have problems since the experts are you. I mean you could have experience of similar situations that happened in the past. If nothing from the past has happened I guess your hints could be a step on the way.
//mike
I have now verified that the issue is with toxiproxy.
I have tested with just the regular ssh client, OpenSSH_9.0
Setup is as before with the following modification:
OpenSSH client -- SSH --> ToxiProxy -- SSH --> Netopeer2
Then I debug my attached testcase and stop at first breakpoint.
System.out.println("before toxi");
At this point is possible to perform a successful SSH connect. See log below:
`$ ssh -v netconf@localhost -p 54456 -s netconf OpenSSH_9.0p1, OpenSSL 1.1.1o 3 May 2022 debug1: Reading configuration data /etc/ssh/ssh_config debug1: Connecting to localhost [::1] port 54456. debug1: Connection established. debug1: identity file /c/Users/eraonel/.ssh/id_rsa type 0 debug1: identity file /c/Users/eraonel/.ssh/id_rsa-cert type -1 debug1: identity file /c/Users/eraonel/.ssh/id_ecdsa type -1 debug1: identity file /c/Users/eraonel/.ssh/id_ecdsa-cert type -1 debug1: identity file /c/Users/eraonel/.ssh/id_ecdsa_sk type -1 debug1: identity file /c/Users/eraonel/.ssh/id_ecdsa_sk-cert type -1 debug1: identity file /c/Users/eraonel/.ssh/id_ed25519 type -1 debug1: identity file /c/Users/eraonel/.ssh/id_ed25519-cert type -1 debug1: identity file /c/Users/eraonel/.ssh/id_ed25519_sk type -1 debug1: identity file /c/Users/eraonel/.ssh/id_ed25519_sk-cert type -1 debug1: identity file /c/Users/eraonel/.ssh/id_xmss type -1 debug1: identity file /c/Users/eraonel/.ssh/id_xmss-cert type -1 debug1: identity file /c/Users/eraonel/.ssh/id_dsa type -1 debug1: identity file /c/Users/eraonel/.ssh/id_dsa-cert type -1 debug1: Local version string SSH-2.0-OpenSSH_9.0 debug1: Remote protocol version 2.0, remote software version libssh_0.9.5 debug1: compat_banner: no match: libssh_0.9.5 debug1: Authenticating to localhost:54456 as 'netconf' debug1: load_hostkeys: fopen /c/Users/eraonel/.ssh/known_hosts2: No such file or directory debug1: load_hostkeys: fopen /etc/ssh/ssh_known_hosts: No such file or directory debug1: load_hostkeys: fopen /etc/ssh/ssh_known_hosts2: No such file or directory debug1: SSH2_MSG_KEXINIT sent debug1: SSH2_MSG_KEXINIT received debug1: kex: algorithm: curve25519-sha256 debug1: kex: host key algorithm: rsa-sha2-512 debug1: kex: server->client cipher: aes128-ctr MAC: hmac-sha2-256-etm@openssh.com compression: none debug1: kex: client->server cipher: aes128-ctr MAC: hmac-sha2-256-etm@openssh.com compression: none debug1: expecting SSH2_MSG_KEX_ECDH_REPLY debug1: SSH2_MSG_KEX_ECDH_REPLY received debug1: Server host key: ssh-rsa SHA256:4dfREFhjQJ9Mpv1PJOJHaM2n0NTM4oJLoLIx8z+xAJU debug1: load_hostkeys: fopen /c/Users/eraonel/.ssh/known_hosts2: No such file or directory debug1: load_hostkeys: fopen /etc/ssh/ssh_known_hosts: No such file or directory debug1: load_hostkeys: fopen /etc/ssh/ssh_known_hosts2: No such file or directory debug1: checking without port identifier debug1: load_hostkeys: fopen /c/Users/eraonel/.ssh/known_hosts2: No such file or directory debug1: load_hostkeys: fopen /etc/ssh/ssh_known_hosts: No such file or directory debug1: load_hostkeys: fopen /etc/ssh/ssh_known_hosts2: No such file or directory debug1: hostkeys_find_by_key_cb: found matching key in ~/.ssh/known_hosts:22 debug1: hostkeys_find_by_key_cb: found matching key in ~/.ssh/known_hosts:23 debug1: hostkeys_find_by_key_cb: found matching key in ~/.ssh/known_hosts:24 debug1: hostkeys_find_by_key_cb: found matching key in ~/.ssh/known_hosts:25 debug1: hostkeys_find_by_key_cb: found matching key in ~/.ssh/known_hosts:26 debug1: hostkeys_find_by_key_cb: found matching key in ~/.ssh/known_hosts:27 debug1: hostkeys_find_by_key_cb: found matching key in ~/.ssh/known_hosts:28 debug1: hostkeys_find_by_key_cb: found matching key in ~/.ssh/known_hosts:29 debug1: hostkeys_find_by_key_cb: found matching key in ~/.ssh/known_hosts:30 debug1: hostkeys_find_by_key_cb: found matching key in ~/.ssh/known_hosts:31 debug1: hostkeys_find_by_key_hostfile: hostkeys file /c/Users/eraonel/.ssh/known_hosts2 does not exist debug1: hostkeys_find_by_key_hostfile: hostkeys file /etc/ssh/ssh_known_hosts does not exist debug1: hostkeys_find_by_key_hostfile: hostkeys file /etc/ssh/ssh_known_hosts2 does not exist The authenticity of host '[localhost]:54456 ([::1]:54456)' can't be established. RSA key fingerprint is SHA256:4dfREFhjQJ9Mpv1PJOJHaM2n0NTM4oJLoLIx8z+xAJU. This host key is known by the following other names/addresses: ~/.ssh/known_hosts:22: [localhost]:53619 ~/.ssh/known_hosts:23: [localhost]:57115 ~/.ssh/known_hosts:24: [localhost]:57798 ~/.ssh/known_hosts:25: [localhost]:57880 ~/.ssh/known_hosts:26: [localhost]:58041 ~/.ssh/known_hosts:27: [localhost]:58127 ~/.ssh/known_hosts:28: [localhost]:58130 ~/.ssh/known_hosts:29: [localhost]:58351 (2 additional names omitted) Are you sure you want to continue connecting (yes/no/[fingerprint])? y Please type 'yes', 'no' or the fingerprint: yes Warning: Permanently added '[localhost]:54456' (RSA) to the list of known hosts. debug1: rekey out after 4294967296 blocks debug1: SSH2_MSG_NEWKEYS sent debug1: expecting SSH2_MSG_NEWKEYS debug1: SSH2_MSG_NEWKEYS received debug1: rekey in after 4294967296 blocks debug1: Will attempt key: /c/Users/eraonel/.ssh/id_rsa RSA SHA256:t6hityJf63hWTgutnks2UPKCbKlnpi41TUOd3qVtfWw debug1: Will attempt key: /c/Users/eraonel/.ssh/id_ecdsa debug1: Will attempt key: /c/Users/eraonel/.ssh/id_ecdsa_sk debug1: Will attempt key: /c/Users/eraonel/.ssh/id_ed25519 debug1: Will attempt key: /c/Users/eraonel/.ssh/id_ed25519_sk debug1: Will attempt key: /c/Users/eraonel/.ssh/id_xmss debug1: Will attempt key: /c/Users/eraonel/.ssh/id_dsa debug1: SSH2_MSG_EXT_INFO received debug1: kex_input_ext_info: server-sig-algs=ssh-ed25519-cert-v01@openssh.com,ecdsa-sha2-nistp521-cert-v01@openssh.com,ecdsa-sha2-nistp384-cert-v01@openssh.com,ecdsa-sha2-nistp256-cert-v01@openssh.com,rsa-sha2-512-cert-v01@openssh.com,rsa-sha2-256-cert-v01@openssh.com,ssh-rsa-cert-v01@openssh.com,ssh-dss-cert-v01@openssh.com,ssh-ed25519,ecdsa-sha2-nistp521,ecdsa-sha2-nistp384,ecdsa-sha2-nistp256,rsa-sha2-512,rsa-sha2-256,ssh-rsa,ssh-dss debug1: SSH2_MSG_SERVICE_ACCEPT received debug1: Authentications that can continue: publickey,keyboard-interactive,password debug1: Next authentication method: publickey debug1: Offering public key: /c/Users/eraonel/.ssh/id_rsa RSA SHA256:t6hityJf63hWTgutnks2UPKCbKlnpi41TUOd3qVtfWw debug1: Authentications that can continue: publickey,keyboard-interactive,password debug1: Trying private key: /c/Users/eraonel/.ssh/id_ecdsa debug1: Trying private key: /c/Users/eraonel/.ssh/id_ecdsa_sk debug1: Trying private key: /c/Users/eraonel/.ssh/id_ed25519 debug1: Trying private key: /c/Users/eraonel/.ssh/id_ed25519_sk debug1: Trying private key: /c/Users/eraonel/.ssh/id_xmss debug1: Trying private key: /c/Users/eraonel/.ssh/id_dsa debug1: Next authentication method: keyboard-interactive Interactive SSH Authentication Type your password: (netconf@localhost) Password: Authenticated to localhost ([::1]:54456) using "keyboard-interactive". debug1: channel 0: new [client-session] debug1: Entering interactive session. debug1: pledge: filesystem debug1: Sending subsystem: netconf
@miry skip above I found out why mine is not working. I should not use proxy.disable and enable. It took some reading to find since it was not listed under toxies() method.
Hi again :-)
I am using the following code ( see below).
This is the scenario:
ssh netconf@localhost -p 58127 -s netconf < rpc.xml
Port is from this line:
LOGGER.info("mapped port for toxiproxy {}",toxiproxy.getMappedPort(8666));
This is successful!! I can connect.
netopeer2Proxy.toxics().resetPeer("reset-peer-down", ToxicDirection.UPSTREAM, 10);
I test:
ssh netconf@localhost -p 58127 -s netconf < rpc.xml kex_exchange_identification: Connection closed by remote host Connection closed by ::1 port 58127
That seems ok! No connection since we reset peer.
System.out.println("after toxi");
I try to connect using.
ssh netconf@localhost -p 58127 -s netconf < rpc.xml kex_exchange_identification: Connection closed by remote host Connection closed by ::1 port 58127
But this time it does not work!Any hints! Do you know if anyone tried with SSH?
br,
//mike
Code used: `public class ToxiProxyTest {