<html><body><p><tt><font size="2"><br>Thanks Matt.<br></font></tt><br><tt><font size="2">You are right that dropbear is being run from inetd through a systemd service file. </font></tt><br><tt><font size="2">However, the logs are configured to go into syslog (i.e. _no_ -E switch). </font></tt><br><tt><font size="2"><br>-------------<br>The configuration in dropbear@.service is as follows:</font></tt><br><tt><font size="2">[Unit]<br>Description=SSH Per-Connection Server<br>Wants=dropbearkey.service<br>After=syslog.target dropbearkey.service</font></tt><br><tt><font size="2">[Service]<br>Environment=&quot;DROPBEAR_RSAKEY_DIR=/etc/dropbear&quot;<br>EnvironmentFile=-/etc/default/dropbear</font></tt><br><tt><font size="2"><br>ExecStart=-@SBINDIR@/dropbear -i -I 5 -v -r ${DROPBEAR_RSAKEY_DIR}/<br>dropbear_rsa_host_key</font></tt><br><tt><font size="2"><br>ExecReload=@BASE_BINDIR@/kill -HUP $MAINPID<br>StandardInput=socket<br>KillMode=process</font></tt><br><tt><font size="2"><br>-------------</font></tt><br><br><tt><font size="2">&gt; <br>&gt; From: Matt Johnston &lt;matt@ucc.asn.au&gt;</font></tt><br><tt><font size="2">&gt; To: Hariharasubramanian Ramasubramanian &lt;hramasub@in.ibm.com&gt;</font></tt><br><tt><font size="2">&gt; Cc: dropbear@ucc.asn.au</font></tt><br><tt><font size="2">&gt; Date: 10/11/2017 04:18 PM</font></tt><br><tt><font size="2">&gt; Subject: Re: ssh disconnects due to corrupt packet (dropbear <br>&gt; compiled with DEBUG_TRACE)</font></tt><br><tt><font size="2">&gt; <br>&gt; Hi,<br>&gt; <br>&gt; It looks like you're running in from inetd and the TRACE output is <br>&gt; ending up getting sent over the network socket. The length 1414676803 is <br>&gt; 'TRAC' converted to ascii.<br>&gt; I guess dropbear is running with &quot;-E&quot;, or what is the configuration? <br>&gt; That won't work, you'll need to log to syslog instead (the default) when <br>&gt; using inetd.<br>&gt; I can't think of any known issues in 2016.74 causing messages like that <br>&gt; - if you keep seeing it could you send me the logs/pcap off-list, <br>&gt; without -v.<br>&gt; <br>&gt; Cheers,<br>&gt; Matt<br>&gt; <br>&gt; On 2017-10-11 11:25 am, Hariharasubramanian Ramasubramanian wrote:<br>&gt; <br>&gt; &gt; I was observing occasional connection disconnect during session setup <br>&gt; &gt; with dropber version 2016.74.<br>&gt; &gt; <br>&gt; &gt; I compiled dropbear (version 2016.74) with DEBUG_TRACE flag on (in <br>&gt; &gt; debug.h) to help me debug these session setup errors.<br>&gt; &gt; <br>&gt; &gt; However when I run dropbear with the -v switch, client fails to <br>&gt; &gt; connect, _everytime_.<br>&gt; &gt; <br>&gt; &gt; The client (9.41.166.131) is OpenSSH_5.8p2 running on RHEL 6.4.<br>&gt; &gt; The server (9.3.21.44) is dropbear_2016.74<br>&gt; &gt; <br>&gt; &gt; 1) Is this a known issue in dropbear_2016.74 ?<br>&gt; &gt; 2) Also please suggest how I can debug ssh session setup failures with <br>&gt; &gt; dropbear server ?<br>&gt; &gt; <br>&gt; &gt; <br>&gt; ----------------------------------------------------------------------------------------------------------------------------<br>&gt; &gt; The output of ssh -vvv root@9.3.21.44 is as follows:<br>&gt; &gt; -bash-4.1$ ssh -vvv root@9.3.21.44<br>&gt; &gt; OpenSSH_5.8p2, OpenSSL 1.0.0g 18 Jan 2012<br>&gt; &gt; debug1: Reading configuration data /etc/ssh/ssh_config<br>&gt; &gt; debug1: Applying options for *<br>&gt; &gt; debug2: ssh_connect: needpriv 0<br>&gt; &gt; debug1: Connecting to 9.3.21.44 [9.3.21.44] port 22.<br>&gt; &gt; debug1: Connection established.<br>&gt; &gt; debug1: identity file <br>&gt; &gt; /afs/awd.austin.ibm.com/usr/u2/hramasub/.ssh/id_rsa type -1<br>&gt; &gt; debug1: identity file <br>&gt; &gt; /afs/awd.austin.ibm.com/usr/u2/hramasub/.ssh/id_rsa-cert type -1<br>&gt; &gt; debug1: identity file <br>&gt; &gt; /afs/awd.austin.ibm.com/usr/u2/hramasub/.ssh/id_dsa type -1<br>&gt; &gt; debug1: identity file <br>&gt; &gt; /afs/awd.austin.ibm.com/usr/u2/hramasub/.ssh/id_dsa-cert type -1<br>&gt; &gt; debug1: identity file <br>&gt; &gt; /afs/awd.austin.ibm.com/usr/u2/hramasub/.ssh/id_ecdsa type -1<br>&gt; &gt; debug1: identity file <br>&gt; &gt; /afs/awd.austin.ibm.com/usr/u2/hramasub/.ssh/id_ecdsa-cert type -1<br>&gt; &gt; debug1: ssh_exchange_identification: [1522] Oct 09 11:35:43 Failed <br>&gt; &gt; loading /var/lib/dropbear/dropbear_rsa_host_key<br>&gt; &gt; debug1: ssh_exchange_identification: TRACE (1522) 0.000000: leave <br>&gt; &gt; loadhostkey<br>&gt; &gt; debug1: ssh_exchange_identification: TRACE (1522) 0.001107: enter <br>&gt; &gt; buf_get_rsa_priv_key<br>&gt; &gt; debug1: ssh_exchange_identification: TRACE (1522) 0.001398: enter <br>&gt; &gt; buf_get_rsa_pub_key<br>&gt; &gt; debug1: ssh_exchange_identification: TRACE (1522) 0.002371: leave <br>&gt; &gt; buf_get_rsa_pub_key: success<br>&gt; &gt; debug1: ssh_exchange_identification: TRACE (1522) 0.003364: leave <br>&gt; &gt; buf_get_rsa_priv_key<br>&gt; &gt; debug1: ssh_exchange_identification: TRACE (1522) 0.003685: leave <br>&gt; &gt; loadhostkey<br>&gt; &gt; debug1: ssh_exchange_identification: [1522] Oct 09 11:35:43 Failed <br>&gt; &gt; loading /etc/dropbear/dropbear_dss_host_key<br>&gt; &gt; debug1: ssh_exchange_identification: TRACE (1522) 0.009414: leave <br>&gt; &gt; loadhostkey<br>&gt; &gt; debug1: ssh_exchange_identification: [1522] Oct 09 11:35:43 Failed <br>&gt; &gt; loading /etc/dropbear/dropbear_ecdsa_host_key<br>&gt; &gt; debug1: ssh_exchange_identification: TRACE (1522) 0.014786: leave <br>&gt; &gt; loadhostkey<br>&gt; &gt; debug1: ssh_exchange_identification: TRACE (1522) 0.014964: Disabling <br>&gt; &gt; key type 1<br>&gt; &gt; debug1: ssh_exchange_identification: TRACE (1522) 0.015427: Disabling <br>&gt; &gt; key type 2<br>&gt; &gt; debug1: ssh_exchange_identification: TRACE (1522) 0.016107: Disabling <br>&gt; &gt; key type 3<br>&gt; &gt; debug1: ssh_exchange_identification: TRACE (1522) 0.016541: Disabling <br>&gt; &gt; key type 4<br>&gt; &gt; debug1: ssh_exchange_identification: [1522] Oct 09 11:35:43 Child <br>&gt; &gt; connection from ::ffff:9.41.166.131:49818<br>&gt; &gt; debug1: ssh_exchange_identification: TRACE (1522) 0.030210: enter <br>&gt; &gt; session_init<br>&gt; &gt; debug1: ssh_exchange_identification: TRACE (1522) 0.030381: <br>&gt; &gt; setnonblocking: 0<br>&gt; &gt; debug1: ssh_exchange_identification: TRACE (1522) 0.031095: leave <br>&gt; &gt; setnonblocking<br>&gt; &gt; debug1: ssh_exchange_identification: TRACE (1522) 0.031521: <br>&gt; &gt; setnonblocking: 0<br>&gt; &gt; debug1: ssh_exchange_identification: TRACE (1522) 0.031948: leave <br>&gt; &gt; setnonblocking<br>&gt; &gt; debug1: ssh_exchange_identification: TRACE (1522) 0.032572: <br>&gt; &gt; update_channel_prio<br>&gt; &gt; debug1: ssh_exchange_identification: TRACE (1522) 0.033036: <br>&gt; &gt; update_channel_prio: not any<br>&gt; &gt; debug1: ssh_exchange_identification: TRACE (1522) 0.033453: Dropbear <br>&gt; &gt; priority transitioning 10 -&gt; 11<br>&gt; &gt; debug1: ssh_exchange_identification: TRACE (1522) 0.034171: <br>&gt; &gt; setnonblocking: 4<br>&gt; &gt; debug1: ssh_exchange_identification: TRACE (1522) 0.034642: leave <br>&gt; &gt; setnonblocking<br>&gt; &gt; debug1: ssh_exchange_identification: TRACE (1522) 0.035068: <br>&gt; &gt; setnonblocking: 5<br>&gt; &gt; debug1: ssh_exchange_identification: TRACE (1522) 0.035746: leave <br>&gt; &gt; setnonblocking<br>&gt; &gt; debug1: ssh_exchange_identification: TRACE (1522) 0.036801: leave <br>&gt; &gt; session_init<br>&gt; &gt; debug1: ssh_exchange_identification: TRACE (1522) 0.037927: <br>&gt; &gt; kexinitialise()<br>&gt; &gt; debug1: ssh_exchange_identification: TRACE (1522) 0.038795: <br>&gt; &gt; DATAALLOWED=0<br>&gt; &gt; debug1: ssh_exchange_identification: TRACE (1522) 0.039085: -&gt; KEXINIT<br>&gt; &gt; debug1: ssh_exchange_identification: TRACE (1522) 0.039748: enter <br>&gt; &gt; set_connect_fds<br>&gt; &gt; debug1: ssh_exchange_identification: TRACE (1522) 0.040495: <br>&gt; &gt; maybe_empty_reply_queue - no data allowed<br>&gt; &gt; debug1: ssh_exchange_identification: TRACE (1522) 0.040959: enter <br>&gt; &gt; handle_connect_fds<br>&gt; &gt; debug1: ssh_exchange_identification: TRACE (1522) 0.041604: leave <br>&gt; &gt; handle_connect_fds - end iter<br>&gt; &gt; debug1: Remote protocol version 2.0, remote software version <br>&gt; &gt; dropbear_2016.74<br>&gt; &gt; debug1: no match: dropbear_2016.74<br>&gt; &gt; debug1: Enabling compatibility mode for protocol 2.0<br>&gt; &gt; debug1: Local version string SSH-2.0-OpenSSH_5.8<br>&gt; &gt; debug2: fd 3 setting O_NONBLOCK<br>&gt; &gt; debug3: load_hostkeys: loading entries for host &quot;9.3.21.44&quot; from file <br>&gt; &gt; &quot;/afs/awd.austin.ibm.com/usr/u2/hramasub/.ssh/known_hosts&quot;<br>&gt; &gt; debug3: load_hostkeys: found key type RSA in file <br>&gt; &gt; /afs/awd.austin.ibm.com/usr/u2/hramasub/.ssh/known_hosts:6<br>&gt; &gt; debug3: load_hostkeys: loaded 1 keys<br>&gt; &gt; debug3: order_hostkeyalgs: prefer hostkeyalgs: <br>&gt; &gt; ssh-rsa-cert-v01@openssh.com,ssh-rsa-cert-v00@openssh.com,ssh-rsa<br>&gt; &gt; debug1: SSH2_MSG_KEXINIT sent<br>&gt; &gt; debug1: SSH2_MSG_KEXINIT received<br>&gt; &gt; debug2: kex_parse_kexinit: <br>&gt; &gt; ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-<br>&gt; hellman-group-exchange-sha256,diffie-hellman-group-exchange-<br>&gt; sha1,diffie-hellman-group14-sha1,diffie-hellman-group1-sha1<br>&gt; &gt; debug2: kex_parse_kexinit: <br>&gt; &gt; ssh-rsa-cert-v01@openssh.com,ssh-rsa-cert-v00@openssh.com,ssh-<br>&gt; rsa,ecdsa-sha2-nistp256-cert-v01@openssh.com,ecdsa-sha2-nistp384-<br>&gt; cert-v01@openssh.com,ecdsa-sha2-nistp521-cert-v01@openssh.com,ssh-<br>&gt; dss-cert-v01@openssh.com,ssh-dss-cert-v00@openssh.com,ecdsa-sha2-<br>&gt; nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,ssh-dss<br>&gt; &gt; debug2: kex_parse_kexinit: <br>&gt; &gt; aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,aes128-cbc,<br>&gt; 3des-cbc,blowfish-cbc,cast128-cbc,aes192-cbc,aes256-<br>&gt; cbc,arcfour,rijndael-cbc@lysator.liu.se<br>&gt; &gt; debug2: kex_parse_kexinit: <br>&gt; &gt; aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,aes128-cbc,<br>&gt; 3des-cbc,blowfish-cbc,cast128-cbc,aes192-cbc,aes256-<br>&gt; cbc,arcfour,rijndael-cbc@lysator.liu.se<br>&gt; &gt; debug2: kex_parse_kexinit: <br>&gt; &gt; hmac-md5,hmac-sha1,umac-64@openssh.com,hmac-ripemd160,hmac-<br>&gt; ripemd160@openssh.com,hmac-sha1-96,hmac-md5-96<br>&gt; &gt; debug2: kex_parse_kexinit: <br>&gt; &gt; hmac-md5,hmac-sha1,umac-64@openssh.com,hmac-ripemd160,hmac-<br>&gt; ripemd160@openssh.com,hmac-sha1-96,hmac-md5-96<br>&gt; &gt; debug2: kex_parse_kexinit: none,zlib@openssh.com,zlib<br>&gt; &gt; debug2: kex_parse_kexinit: none,zlib@openssh.com,zlib<br>&gt; &gt; debug2: kex_parse_kexinit:<br>&gt; &gt; debug2: kex_parse_kexinit:<br>&gt; &gt; debug2: kex_parse_kexinit: first_kex_follows 0<br>&gt; &gt; debug2: kex_parse_kexinit: reserved 0<br>&gt; &gt; debug2: kex_parse_kexinit: <br>&gt; &gt; curve25519-sha256@libssh.org,ecdh-sha2-nistp521,ecdh-sha2-<br>&gt; nistp384,ecdh-sha2-nistp256,diffie-hellman-group14-sha1,diffie-<br>&gt; hellman-group1-sha1,kexguess2@matt.ucc.asn.au<br>&gt; &gt; debug2: kex_parse_kexinit: ssh-rsa<br>&gt; &gt; debug2: kex_parse_kexinit: <br>&gt; &gt; aes128-ctr,aes256-ctr,aes128-cbc,aes256-cbc,twofish256-<br>&gt; cbc,twofish-cbc,twofish128-cbc,3des-ctr,3des-cbc<br>&gt; &gt; debug2: kex_parse_kexinit: <br>&gt; &gt; aes128-ctr,aes256-ctr,aes128-cbc,aes256-cbc,twofish256-<br>&gt; cbc,twofish-cbc,twofish128-cbc,3des-ctr,3des-cbc<br>&gt; &gt; debug2: kex_parse_kexinit: <br>&gt; &gt; hmac-sha1-96,hmac-sha1,hmac-sha2-256,hmac-sha2-512,hmac-md5<br>&gt; &gt; debug2: kex_parse_kexinit: <br>&gt; &gt; hmac-sha1-96,hmac-sha1,hmac-sha2-256,hmac-sha2-512,hmac-md5<br>&gt; &gt; debug2: kex_parse_kexinit: zlib@openssh.com,none<br>&gt; &gt; debug2: kex_parse_kexinit: zlib@openssh.com,none<br>&gt; &gt; debug2: kex_parse_kexinit:<br>&gt; &gt; debug2: kex_parse_kexinit:<br>&gt; &gt; debug2: kex_parse_kexinit: first_kex_follows 0<br>&gt; &gt; debug2: kex_parse_kexinit: reserved 0<br>&gt; &gt; debug2: mac_setup: found hmac-md5<br>&gt; &gt; debug1: kex: server-&gt;client aes128-ctr hmac-md5 none<br>&gt; &gt; debug2: mac_setup: found hmac-md5<br>&gt; &gt; debug1: kex: client-&gt;server aes128-ctr hmac-md5 none<br>&gt; &gt; debug1: sending SSH2_MSG_KEX_ECDH_INIT<br>&gt; &gt; debug1: expecting SSH2_MSG_KEX_ECDH_REPLY<br>&gt; &gt; Bad packet length 1414676803.<br>&gt; &gt; Disconnecting: Packet corrupt<br>&gt; &gt; <br>&gt; ----------------------------------------------------------------------------------------------------------------------------<br>&gt; &gt; tcpdump of the session setup sequence is attached.<br>&gt; &gt; <br>&gt; &gt; thanks in advance,<br>&gt; &gt; Hariharasubramanian R.<br>&gt; &gt; Power Firmware Development<br>&gt; &gt; IBM India Systems &amp; Technology Lab, Bangalore, India<br>&gt; &gt; Phone: +91 80 4025 5075<br>&gt; <br></font></tt><BR>
</body></html>