CESNET / libnetconf2

C NETCONF library
BSD 3-Clause "New" or "Revised" License
203 stars 147 forks source link

Question regarding implementing external netconf ssh authentication #111

Closed vprasad closed 5 years ago

vprasad commented 5 years ago

Hi ,

I have taken the reference of netopeer server code and trying to write netconf server code . i have written the netconf server code and on running the server i can see my application starts listening to 830 port for netconf ssh requests .

tcp 0 0 10.220.84.110.830 . LISTEN

However when i try to do a ssh to the ip ,it asks for password .

[viprasad@in-mvlb46 socket]$ ssh secadmin@10.220.84.110 -p 830 -s netconf Interactive SSH Authentication Type your password: Password:

This authentication i need control via my code of authenticating the user i.e, my code should get some cb in which i can authenticate the user and return appropriately on success /failure.

I Wanted to know how to implement this and what are the APi's/Cb's to be used for supporting this external authentication ?

Thanks, Vivek prasad

michalvasko commented 5 years ago

Hi Vivek, you want to use some/all of functions nc_server_ssh_set_passwd_auth_clb(), nc_server_ssh_set_interactive_auth_clb(), and nc_server_ssh_set_pubkey_auth_clb().

Regards, Michal

vprasad commented 5 years ago

Hi ,

I have taken the reference of netopeer server code and trying to write netconf server code . i have written the netconf server code and on running the server i can see my application starts listening to 830 port for netconf ssh requests .

tcp 0 0 10.220.84.110.830 . LISTEN

However when i try to do a ssh to the ip ,it asks for password .

[viprasad@in-mvlb46 socket]$ ssh secadmin@10.220.84.110 -p 830 -s netconf Interactive SSH Authentication Type your password: Password:

This authentication i need control via my code of authenticating the user i.e, my code should get some cb in which i can authenticate the user and return appropriately on success /failure.

I Wanted to know how to implement this and what are the APi's/Cb's to be used for supporting this external authentication ?

Thanks, Vivek prasad

Hi , I was able to register my authentication cb and now one doing ssh login ,my auth cb is getting called where i am authenticating the user and returning 0 as a part of that .Still i can see the below error :-

[viprasad@in-mvlb46 .ssh]$ ssh secadmin@10.220.84.110 -p 830 secadmin@10.220.84.110's password: PTY allocation request failed on channel 0 shell request failed on channel 0 [viprasad@in-mvlb46 .ssh]$

Below are the logs that i can see when this happens:-

NE110:1-40*:/tmp/vivek # ./server libyang[2]: Plugin "/tmp/vivek/extensions/metadata.so" successfully loaded. libyang[2]: Plugin "/tmp/vivek/extensions/nacm.so" successfully loaded. libyang[2]: Plugin "/tmp/vivek/extensions/yangdata.so" successfully loaded. libyang[2]: Plugin "/tmp/vivek/user_types//user_date_and_time.so" successfully loaded. libyang[2]: Reading module "ietf-yang-metadata". libyang[2]: Module "ietf-yang-metadata@2016-08-05" successfully parsed as implemented. libyang[2]: Reading module "yang". libyang[2]: Resolving "yang" unresolved schema nodes and their constraints... libyang[2]: All "yang" schema nodes and constraints resolved. libyang[2]: Module "yang@2017-02-20" successfully parsed as implemented. libyang[2]: Reading module "ietf-inet-types". libyang[2]: Resolving derived type "union" failed, it will be attempted later. libyang[2]: Resolving derived type "union" failed, it will be attempted later. libyang[2]: Resolving derived type "union" failed, it will be attempted later. libyang[2]: Resolving derived type "union" failed, it will be attempted later. libyang[2]: Resolving "ietf-inet-types" unresolved schema nodes and their constraints... libyang[2]: All "ietf-inet-types" schema nodes and constraints resolved. libyang[2]: Module "ietf-inet-types@2013-07-15" successfully parsed as implemented. libyang[2]: Reading module "ietf-yang-types". libyang[2]: Module "ietf-yang-types@2013-07-15" successfully parsed as implemented. libyang[2]: Reading module "ietf-datastores". libyang[2]: Module "ietf-datastores@2017-08-17" successfully parsed as implemented. libyang[2]: Reading module "ietf-yang-library". libyang[2]: Module "ietf-yang-library@2018-01-17" successfully parsed as implemented. libyang[2]: Searching for "ietf-netconf" in /tmp/vivek/files. libyang[2]: Searching for "ietf-netconf" in /tmp/vivek. libyang[2]: Loading schema from "/tmp/vivek/files/ietf-netconf.yin" file. libyang[2]: Reading module "ietf-netconf". libyang[2]: Searching for "ietf-netconf-acm" in /tmp/vivek/files. libyang[2]: Searching for "ietf-netconf-acm" in /tmp/vivek. libyang[2]: Loading schema from "/tmp/vivek/files/ietf-netconf-acm.yin" file. libyang[2]: Reading module "ietf-netconf-acm". libyang[2]: Module "ietf-netconf-acm@2018-02-14" successfully parsed as imported. libyang[2]: Module "ietf-netconf@2011-06-01" successfully parsed as implemented. libyang[2]: Searching for "ietf-netconf-monitoring" in /tmp/vivek/files. libyang[2]: Searching for "ietf-netconf-monitoring" in /tmp/vivek. libyang[2]: Loading schema from "/tmp/vivek/files/ietf-netconf-monitoring.yin" file. libyang[2]: Reading module "ietf-netconf-monitoring". libyang[2]: Module "ietf-netconf-monitoring@2010-10-04" successfully parsed as implemented. libyang[2]: Searching for "user" in /tmp/vivek/files. libyang[2]: Searching for "user" in /tmp/vivek. libyang[2]: Loading schema from "/tmp/vivek/files/user.yang" file. libyang[2]: Searching for "base" in /tmp/vivek/files. libyang[2]: Searching for "base" in /tmp/vivek. libyang[2]: Loading schema from "/tmp/vivek/files/base.yang" file. libyang[2]: Module "base@2015-12-25" successfully parsed as imported. libyang[2]: Module "user@2016-12-21" successfully parsed as implemented. VERBOSE: Listening on 0.0.0.0:830 for SSH connections. VERBOSE: Accepted a connection on 0.0.0.0:830. [2018/11/02 14:56:28.771950, 2] ssh_pki_import_privkey_base64: Trying to decode privkey passphrase=false [2018/11/02 14:56:28.773950, 3] ssh_socket_pollcallback: Received POLLOUT in connecting state [2018/11/02 14:56:28.774950, 3] ssh_handle_key_exchange: ssh_handle_key_exchange: current state : 2 [2018/11/02 14:56:28.776950, 3] ssh_socket_unbuffered_write: Enabling POLLOUT for socket [2018/11/02 14:56:28.776950, 3] ssh_handle_key_exchange: ssh_handle_key_exchange: current state : 2 [2018/11/02 14:56:28.778950, 3] callback_receive_banner: Received banner: SSH-2.0-OpenSSH_5.3 [2018/11/02 14:56:28.778950, 1] ssh_server_connection_callback: SSH client banner: SSH-2.0-OpenSSH_5.3 [2018/11/02 14:56:28.778950, 1] ssh_analyze_banner: Analyzing banner: SSH-2.0-OpenSSH_5.3 [2018/11/02 14:56:28.779950, 1] ssh_analyze_banner: We are talking to an OpenSSH client version: 5.3 (50300) [2018/11/02 14:56:28.779950, 3] packet_send2: packet: wrote [len=684,padding=10,comp=673,payload=673] [2018/11/02 14:56:28.780950, 3] ssh_socket_unbuffered_write: Enabling POLLOUT for socket [2018/11/02 14:56:28.780950, 3] ssh_handle_key_exchange: ssh_handle_key_exchange: current state : 4 [2018/11/02 14:56:28.783950, 3] ssh_packet_socket_callback: packet: read type 20 [len=956,padding=4,comp=951,payload=951] [2018/11/02 14:56:28.783950, 3] ssh_packet_process: Dispatching handler for packet type 20 [2018/11/02 14:56:28.783950, 2] ssh_kex_select_methods: Negotiated diffie-hellman-group14-sha1,ssh-rsa,aes128-ctr,aes128-ctr,hmac-sha1,hmac-sha1,none,none,, [2018/11/02 14:56:28.784950, 3] crypt_set_algorithms_server: Set output algorithm aes128-ctr [2018/11/02 14:56:28.784950, 3] crypt_set_algorithms_server: Set HMAC output algorithm to hmac-sha1 [2018/11/02 14:56:28.785950, 3] crypt_set_algorithms_server: Set input algorithm aes128-ctr [2018/11/02 14:56:28.785950, 3] crypt_set_algorithms_server: Set HMAC input algorithm to hmac-sha1 [2018/11/02 14:56:28.786950, 3] ssh_handle_key_exchange: ssh_handle_key_exchange: current state : 6 [2018/11/02 14:56:28.788950, 3] ssh_handle_key_exchange: ssh_handle_key_exchange: current state : 6 [2018/11/02 14:56:28.790950, 3] ssh_handle_key_exchange: ssh_handle_key_exchange: current state : 6 [2018/11/02 14:56:28.792950, 3] ssh_handle_key_exchange: ssh_handle_key_exchange: current state : 6 [2018/11/02 14:56:28.794950, 3] ssh_handle_key_exchange: ssh_handle_key_exchange: current state : 6 [2018/11/02 14:56:28.796950, 3] ssh_handle_key_exchange: ssh_handle_key_exchange: current state : 6 [2018/11/02 14:56:28.798950, 3] ssh_handle_key_exchange: ssh_handle_key_exchange: current state : 6 [2018/11/02 14:56:28.800950, 3] ssh_handle_key_exchange: ssh_handle_key_exchange: current state : 6 [2018/11/02 14:56:28.802950, 3] ssh_handle_key_exchange: ssh_handle_key_exchange: current state : 6 [2018/11/02 14:56:28.804950, 3] ssh_handle_key_exchange: ssh_handle_key_exchange: current state : 6 [2018/11/02 14:56:28.806950, 3] ssh_handle_key_exchange: ssh_handle_key_exchange: current state : 6 [2018/11/02 14:56:28.808950, 3] ssh_handle_key_exchange: ssh_handle_key_exchange: current state : 6 [2018/11/02 14:56:28.810950, 3] ssh_handle_key_exchange: ssh_handle_key_exchange: current state : 6 [2018/11/02 14:56:28.812950, 3] ssh_handle_key_exchange: ssh_handle_key_exchange: current state : 6 [2018/11/02 14:56:28.814950, 3] ssh_handle_key_exchange: ssh_handle_key_exchange: current state : 6 [2018/11/02 14:56:28.816950, 3] ssh_handle_key_exchange: ssh_handle_key_exchange: current state : 6 [2018/11/02 14:56:28.818950, 3] ssh_handle_key_exchange: ssh_handle_key_exchange: current state : 6 [2018/11/02 14:56:28.820950, 3] ssh_handle_key_exchange: ssh_handle_key_exchange: current state : 6 [2018/11/02 14:56:28.822950, 3] ssh_handle_key_exchange: ssh_handle_key_exchange: current state : 6 [2018/11/02 14:56:28.824950, 3] ssh_handle_key_exchange: ssh_handle_key_exchange: current state : 6 [2018/11/02 14:56:28.826950, 3] ssh_handle_key_exchange: ssh_handle_key_exchange: current state : 6 [2018/11/02 14:56:28.828950, 3] ssh_handle_key_exchange: ssh_handle_key_exchange: current state : 6 [2018/11/02 14:56:28.830950, 3] ssh_handle_key_exchange: ssh_handle_key_exchange: current state : 6 [2018/11/02 14:56:28.832950, 3] ssh_handle_key_exchange: ssh_handle_key_exchange: current state : 6 [2018/11/02 14:56:28.834950, 3] ssh_handle_key_exchange: ssh_handle_key_exchange: current state : 6 [2018/11/02 14:56:28.836950, 3] ssh_handle_key_exchange: ssh_handle_key_exchange: current state : 6 [2018/11/02 14:56:28.838950, 3] ssh_handle_key_exchange: ssh_handle_key_exchange: current state : 6 [2018/11/02 14:56:28.840950, 3] ssh_handle_key_exchange: ssh_handle_key_exchange: current state : 6 [2018/11/02 14:56:28.842950, 3] ssh_handle_key_exchange: ssh_handle_key_exchange: current state : 6 [2018/11/02 14:56:28.844950, 3] ssh_handle_key_exchange: ssh_handle_key_exchange: current state : 6 [2018/11/02 14:56:28.846950, 3] ssh_handle_key_exchange: ssh_handle_key_exchange: current state : 6 [2018/11/02 14:56:28.848950, 3] ssh_handle_key_exchange: ssh_handle_key_exchange: current state : 6 [2018/11/02 14:56:28.850950, 3] ssh_handle_key_exchange: ssh_handle_key_exchange: current state : 6 [2018/11/02 14:56:28.852950, 3] ssh_handle_key_exchange: ssh_handle_key_exchange: current state : 6 [2018/11/02 14:56:28.854950, 3] ssh_handle_key_exchange: ssh_handle_key_exchange: current state : 6 [2018/11/02 14:56:28.856950, 3] ssh_handle_key_exchange: ssh_handle_key_exchange: current state : 6 [2018/11/02 14:56:28.858950, 3] ssh_handle_key_exchange: ssh_handle_key_exchange: current state : 6 [2018/11/02 14:56:28.860950, 3] ssh_handle_key_exchange: ssh_handle_key_exchange: current state : 6 [2018/11/02 14:56:28.862950, 3] ssh_handle_key_exchange: ssh_handle_key_exchange: current state : 6 [2018/11/02 14:56:28.864950, 3] ssh_handle_key_exchange: ssh_handle_key_exchange: current state : 6 [2018/11/02 14:56:28.866950, 3] ssh_handle_key_exchange: ssh_handle_key_exchange: current state : 6 [2018/11/02 14:56:28.868950, 3] ssh_handle_key_exchange: ssh_handle_key_exchange: current state : 6 [2018/11/02 14:56:28.870950, 3] ssh_handle_key_exchange: ssh_handle_key_exchange: current state : 6 [2018/11/02 14:56:28.872950, 3] ssh_handle_key_exchange: ssh_handle_key_exchange: current state : 6 [2018/11/02 14:56:28.874950, 3] ssh_handle_key_exchange: ssh_handle_key_exchange: current state : 6 [2018/11/02 14:56:28.876950, 3] ssh_handle_key_exchange: ssh_handle_key_exchange: current state : 6 [2018/11/02 14:56:28.878950, 3] ssh_handle_key_exchange: ssh_handle_key_exchange: current state : 6 [2018/11/02 14:56:28.880950, 3] ssh_handle_key_exchange: ssh_handle_key_exchange: current state : 6 [2018/11/02 14:56:28.882950, 3] ssh_handle_key_exchange: ssh_handle_key_exchange: current state : 6 [2018/11/02 14:56:28.884950, 3] ssh_handle_key_exchange: ssh_handle_key_exchange: current state : 6 [2018/11/02 14:56:28.886950, 3] ssh_handle_key_exchange: ssh_handle_key_exchange: current state : 6 [2018/11/02 14:56:28.888950, 3] ssh_handle_key_exchange: ssh_handle_key_exchange: current state : 6 [2018/11/02 14:56:28.890950, 3] ssh_handle_key_exchange: ssh_handle_key_exchange: current state : 6 [2018/11/02 14:56:28.892950, 3] ssh_handle_key_exchange: ssh_handle_key_exchange: current state : 6 [2018/11/02 14:56:28.894950, 3] ssh_handle_key_exchange: ssh_handle_key_exchange: current state : 6 [2018/11/02 14:56:28.896950, 3] ssh_handle_key_exchange: ssh_handle_key_exchange: current state : 6 [2018/11/02 14:56:28.898950, 3] ssh_handle_key_exchange: ssh_handle_key_exchange: current state : 6 [2018/11/02 14:56:28.900950, 3] ssh_handle_key_exchange: ssh_handle_key_exchange: current state : 6 [2018/11/02 14:56:28.902950, 3] ssh_handle_key_exchange: ssh_handle_key_exchange: current state : 6 [2018/11/02 14:56:28.904950, 3] ssh_handle_key_exchange: ssh_handle_key_exchange: current state : 6 [2018/11/02 14:56:28.906950, 3] ssh_handle_key_exchange: ssh_handle_key_exchange: current state : 6 [2018/11/02 14:56:28.908950, 3] ssh_handle_key_exchange: ssh_handle_key_exchange: current state : 6 [2018/11/02 14:56:28.910950, 3] ssh_handle_key_exchange: ssh_handle_key_exchange: current state : 6 [2018/11/02 14:56:28.912950, 3] ssh_handle_key_exchange: ssh_handle_key_exchange: current state : 6 [2018/11/02 14:56:28.914950, 3] ssh_handle_key_exchange: ssh_handle_key_exchange: current state : 6 [2018/11/02 14:56:28.916950, 3] ssh_handle_key_exchange: ssh_handle_key_exchange: current state : 6 [2018/11/02 14:56:28.918950, 3] ssh_handle_key_exchange: ssh_handle_key_exchange: current state : 6 [2018/11/02 14:56:28.920950, 3] ssh_handle_key_exchange: ssh_handle_key_exchange: current state : 6 [2018/11/02 14:56:28.922950, 3] ssh_handle_key_exchange: ssh_handle_key_exchange: current state : 6 [2018/11/02 14:56:28.924950, 3] ssh_handle_key_exchange: ssh_handle_key_exchange: current state : 6 [2018/11/02 14:56:28.926950, 3] ssh_handle_key_exchange: ssh_handle_key_exchange: current state : 6 [2018/11/02 14:56:28.928950, 3] ssh_handle_key_exchange: ssh_handle_key_exchange: current state : 6 [2018/11/02 14:56:28.930950, 3] ssh_handle_key_exchange: ssh_handle_key_exchange: current state : 6 [2018/11/02 14:56:28.932950, 3] ssh_handle_key_exchange: ssh_handle_key_exchange: current state : 6 [2018/11/02 14:56:28.934950, 3] ssh_handle_key_exchange: ssh_handle_key_exchange: current state : 6 [2018/11/02 14:56:28.936950, 3] ssh_handle_key_exchange: ssh_handle_key_exchange: current state : 6 [2018/11/02 14:56:28.938950, 3] ssh_handle_key_exchange: ssh_handle_key_exchange: current state : 6 [2018/11/02 14:56:28.940950, 3] ssh_handle_key_exchange: ssh_handle_key_exchange: current state : 6 [2018/11/02 14:56:28.942950, 3] ssh_handle_key_exchange: ssh_handle_key_exchange: current state : 6 [2018/11/02 14:56:28.944950, 3] ssh_handle_key_exchange: ssh_handle_key_exchange: current state : 6 [2018/11/02 14:56:28.946950, 3] ssh_handle_key_exchange: ssh_handle_key_exchange: current state : 6 [2018/11/02 14:56:28.948950, 3] ssh_handle_key_exchange: ssh_handle_key_exchange: current state : 6 [2018/11/02 14:56:28.950950, 3] ssh_handle_key_exchange: ssh_handle_key_exchange: current state : 6 [2018/11/02 14:56:28.952950, 3] ssh_handle_key_exchange: ssh_handle_key_exchange: current state : 6 [2018/11/02 14:56:28.954950, 3] ssh_handle_key_exchange: ssh_handle_key_exchange: current state : 6 [2018/11/02 14:56:28.956950, 3] ssh_handle_key_exchange: ssh_handle_key_exchange: current state : 6 [2018/11/02 14:56:28.958950, 3] ssh_handle_key_exchange: ssh_handle_key_exchange: current state : 6 [2018/11/02 14:56:28.960950, 3] ssh_handle_key_exchange: ssh_handle_key_exchange: current state : 6 [2018/11/02 14:56:28.962950, 3] ssh_handle_key_exchange: ssh_handle_key_exchange: current state : 6 [2018/11/02 14:56:28.964950, 3] ssh_handle_key_exchange: ssh_handle_key_exchange: current state : 6 [2018/11/02 14:56:28.966950, 3] ssh_handle_key_exchange: ssh_handle_key_exchange: current state : 6 [2018/11/02 14:56:28.968950, 3] ssh_handle_key_exchange: ssh_handle_key_exchange: current state : 6 [2018/11/02 14:56:28.970950, 3] ssh_packet_socket_callback: packet: read type 30 [len=268,padding=5,comp=262,payload=262] [2018/11/02 14:56:28.970950, 3] ssh_packet_process: Dispatching handler for packet type 30 [2018/11/02 14:56:28.970950, 3] ssh_packet_kexdh_init: Received SSH_MSG_KEXDH_INIT [2018/11/02 14:56:31.502950, 3] ssh_key_algorithm_allowed: Checking rsa-sha2-512 with list <ssh-ed25519,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,ssh-rsa,rsa-sha2-512,rsa-sha2-256,ssh-dss> [2018/11/02 14:56:31.503950, 3] ssh_key_algorithm_allowed: Checking rsa-sha2-256 with list <ssh-ed25519,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,ssh-rsa,rsa-sha2-512,rsa-sha2-256,ssh-dss> [2018/11/02 14:56:31.938950, 3] ssh_socket_unbuffered_write: Enabling POLLOUT for socket [2018/11/02 14:56:31.939950, 3] packet_send2: packet: wrote [len=828,padding=10,comp=817,payload=817] [2018/11/02 14:56:31.939950, 3] packet_send2: packet: wrote [len=12,padding=10,comp=1,payload=1] [2018/11/02 14:56:31.939950, 3] dh_handshake_server: SSH_MSG_NEWKEYS sent [2018/11/02 14:56:31.940950, 3] ssh_handle_key_exchange: ssh_handle_key_exchange: current state : 6 [2018/11/02 14:56:31.942950, 3] ssh_packet_socket_callback: packet: read type 21 [len=12,padding=10,comp=1,payload=1] [2018/11/02 14:56:31.942950, 3] ssh_packet_process: Dispatching handler for packet type 21 [2018/11/02 14:56:31.942950, 2] ssh_packet_newkeys: Received SSH_MSG_NEWKEYS [2018/11/02 14:56:31.943950, 3] ssh_socket_unbuffered_write: Enabling POLLOUT for socket [2018/11/02 14:56:31.944950, 3] ssh_handle_key_exchange: ssh_handle_key_exchange: current state : 7 [2018/11/02 14:56:31.944950, 3] ssh_packet_socket_callback: packet: read type 5 [len=28,padding=10,comp=17,payload=17] [2018/11/02 14:56:31.945950, 3] ssh_packet_process: Dispatching handler for packet type 5 [2018/11/02 14:56:31.945950, 3] ssh_packet_service_request: Received a SERVICE_REQUEST for service ssh-userauth VERBOSE: Received an SSH message "request-service" of subtype "ssh-userauth". [2018/11/02 14:56:31.946950, 3] ssh_message_service_reply_success: Sending a SERVICE_ACCEPT for service ssh-userauth [2018/11/02 14:56:31.946950, 3] packet_send2: packet: wrote [len=28,padding=10,comp=17,payload=17] [2018/11/02 14:56:31.947950, 3] ssh_socket_unbuffered_write: Enabling POLLOUT for socket [2018/11/02 14:56:31.949950, 3] ssh_packet_socket_callback: packet: read type 50 [len=44,padding=4,comp=39,payload=39] [2018/11/02 14:56:31.949950, 3] ssh_packet_process: Dispatching handler for packet type 50 [2018/11/02 14:56:31.949950, 3] ssh_packet_userauth_request: Auth request for service ssh-connection, method none for user 'secadmin' VERBOSE: Received an SSH message "request-auth" of subtype "none". [2018/11/02 14:56:31.950950, 3] ssh_auth_reply_default: Sending a auth failure. methods that can continue: password [2018/11/02 14:56:31.951950, 3] packet_send2: packet: wrote [len=28,padding=13,comp=14,payload=14] [2018/11/02 14:56:31.951950, 3] ssh_socket_unbuffered_write: Enabling POLLOUT for socket [2018/11/02 14:56:34.186949, 3] ssh_packet_socket_callback: packet: read type 50 [len=124,padding=73,comp=50,payload=50] [2018/11/02 14:56:34.186949, 3] ssh_packet_process: Dispatching handler for packet type 50 [2018/11/02 14:56:34.187949, 3] ssh_packet_userauth_request: Auth request for service ssh-connection, method password for user 'secadmin' VERBOSE: Received an SSH message "request-auth" of subtype "password". VERBOSE: User "secadmin" authenticated. [2018/11/02 14:56:34.188949, 3] ssh_socket_unbuffered_write: Enabling POLLOUT for socket [2018/11/02 14:56:34.188949, 3] packet_send2: packet: wrote [len=12,padding=10,comp=1,payload=1] [2018/11/02 14:56:34.189949, 3] ssh_packet_socket_callback: packet: read type 90 [len=44,padding=19,comp=24,payload=24] [2018/11/02 14:56:34.189949, 3] ssh_packet_process: Dispatching handler for packet type 90 [2018/11/02 14:56:34.190949, 3] ssh_packet_channel_open: Clients wants to open a session channel VERBOSE: Received an SSH message "request-channel-open" of subtype "session". [2018/11/02 14:56:34.190949, 3] ssh_message_channel_request_open_reply_accept_channel: Accepting a channel request_open for chan 0 [2018/11/02 14:56:34.191949, 3] packet_send2: packet: wrote [len=28,padding=10,comp=17,payload=17] [2018/11/02 14:56:34.191949, 3] ssh_socket_unbuffered_write: Enabling POLLOUT for socket [2018/11/02 14:56:34.194949, 3] ssh_packet_socket_callback: packet: read type 98 [len=316,padding=13,comp=302,payload=302] [2018/11/02 14:56:34.194949, 3] ssh_packet_process: Dispatching handler for packet type 98 [2018/11/02 14:56:34.194949, 3] ssh_message_handle_channel_request: Received a pty-req channel_request for channel (43:0) (want_reply=1) VERBOSE: Received an SSH message "request-channel" of subtype "pty". [2018/11/02 14:56:34.195949, 3] ssh_message_channel_request_reply_default: Sending a default channel_request denied to channel 0 [2018/11/02 14:56:34.196949, 3] packet_send2: packet: wrote [len=12,padding=6,comp=5,payload=5] [2018/11/02 14:56:34.196949, 3] ssh_packet_socket_callback: Processing 188 bytes left in socket buffer [2018/11/02 14:56:34.196949, 3] ssh_packet_socket_callback: packet: read type 98 [len=44,padding=4,comp=39,payload=39] [2018/11/02 14:56:34.197949, 3] ssh_packet_process: Dispatching handler for packet type 98 [2018/11/02 14:56:34.197949, 3] ssh_message_handle_channel_request: Received a env channel_request for channel (43:0) (want_reply=0) VERBOSE: Received an SSH message "request-channel" of subtype "env". [2018/11/02 14:56:34.198949, 3] ssh_message_channel_request_reply_default: The client doesn't want to know the request failed! [2018/11/02 14:56:34.198949, 3] ssh_packet_socket_callback: Processing 120 bytes left in socket buffer [2018/11/02 14:56:34.199949, 3] ssh_packet_socket_callback: packet: read type 98 [len=44,padding=7,comp=36,payload=36] [2018/11/02 14:56:34.199949, 3] ssh_packet_process: Dispatching handler for packet type 98 [2018/11/02 14:56:34.199949, 3] ssh_message_handle_channel_request: Received a env channel_request for channel (43:0) (want_reply=0) VERBOSE: Received an SSH message "request-channel" of subtype "env". [2018/11/02 14:56:34.200949, 3] ssh_message_channel_request_reply_default: The client doesn't want to know the request failed! [2018/11/02 14:56:34.200949, 3] ssh_packet_socket_callback: Processing 52 bytes left in socket buffer [2018/11/02 14:56:34.201949, 3] ssh_packet_socket_callback: packet: read type 98 [len=28,padding=12,comp=15,payload=15] [2018/11/02 14:56:34.201949, 3] ssh_packet_process: Dispatching handler for packet type 98 [2018/11/02 14:56:34.202949, 3] ssh_message_handle_channel_request: Received a shell channel_request for channel (43:0) (want_reply=1) VERBOSE: Received an SSH message "request-channel" of subtype "shell". [2018/11/02 14:56:34.202949, 3] ssh_message_channel_request_reply_default: Sending a default channel_request denied to channel 0 [2018/11/02 14:56:34.203949, 3] packet_send2: packet: wrote [len=12,padding=6,comp=5,payload=5] [2018/11/02 14:56:34.203949, 3] ssh_socket_unbuffered_write: Enabling POLLOUT for socket [2018/11/02 14:56:34.206949, 1] ssh_socket_exception_callback: Socket exception callback: 1 (0) [2018/11/02 14:56:34.206949, 1] ssh_socket_exception_callback: Socket error: disconnected ERROR: Communication socket unexpectedly closed (libssh).

Can you please help me .

Thanks, Vivek Prasad

michalvasko commented 5 years ago

Hi Vivek, it seems your SSH client is behaving as if speaking to a common SSH server (sshd(7)) requesting a virtual terminal and a shell. This is not supported by libnetconf2, the client must ask for a new channel and then for a netconf subsystem, that is strictly required by NETCONF. After that a NETCONF session is started. If you use our netopeer2-cli, you can test your server knowing the client behaves as it should.

Regards, Michal

vprasad commented 5 years ago

Hi Michal,

My requirement is to use the libnetconf2 to support netconf which would be managing/configuring our optical router/chassis .

So i have installed the netconf server written by me in my router and i was trying to do the ssh from my local machine outside of the router. Assuming if the authenication is successful and capabilities are exchanged,then i can provide the corresponding xml requests for the get/create/delete RPC in the ssh terminal to get those data/conf from the router . This is how we used to do when we used tail-f/Confd for supporting netconf.

So if i can;t do a direct ssh connection to the router while using libnetconf2 as server ,what is the alternate way to achieve this? One according to me would be to write some netconf client similar to netoper-cli and run that from the machine instead of doing a direct ssh. Do you think of any other ways to achieve my requirements .?

Thanks, Vivek prasad

michalvasko commented 5 years ago

Hi Vivek, I understand all that and you can do that by direct SSH connection or however you want to name it. A proper NETCONF is almost a must because otherwise sending any message is really painful. However, you can test the connection to your server easily even with ssh(3) but you must specify that you want to use a subsystem (-s netconf) and probably also the port (-p 830) because you should not use the SSH default port 22. If it connects successfully, you should see the list of capabilities sent by the server.

Regards, Michal

vprasad commented 5 years ago

Hi Michal, I did tried to login via providing the subsytem option (-s netconf).And now it seems user is getting authenticated successfully .But the server crashes .Below is the o/p from the logs:-

VERBOSE: Listening on 0.0.0.0:830 for SSH connections. VERBOSE: Accepted a connection on 0.0.0.0:830. [2018/11/02 16:38:18.018332, 2] ssh_pki_import_privkey_base64: Trying to decode privkey passphrase=false [2018/11/02 16:38:18.020332, 3] ssh_socket_pollcallback: Received POLLOUT in connecting state [2018/11/02 16:38:18.020332, 3] ssh_handle_key_exchange: ssh_handle_key_exchange: current state : 2 [2018/11/02 16:38:18.023332, 3] ssh_socket_unbuffered_write: Enabling POLLOUT for socket [2018/11/02 16:38:18.023332, 3] ssh_handle_key_exchange: ssh_handle_key_exchange: current state : 2 [2018/11/02 16:38:18.025332, 3] callback_receive_banner: Received banner: SSH-2.0-OpenSSH_5.3 [2018/11/02 16:38:18.025332, 1] ssh_server_connection_callback: SSH client banner: SSH-2.0-OpenSSH_5.3 [2018/11/02 16:38:18.025332, 1] ssh_analyze_banner: Analyzing banner: SSH-2.0-OpenSSH_5.3 [2018/11/02 16:38:18.026332, 1] ssh_analyze_banner: We are talking to an OpenSSH client version: 5.3 (50300) [2018/11/02 16:38:18.026332, 3] packet_send2: packet: wrote [len=684,padding=10,comp=673,payload=673] [2018/11/02 16:38:18.027332, 3] ssh_socket_unbuffered_write: Enabling POLLOUT for socket [2018/11/02 16:38:18.027332, 3] ssh_handle_key_exchange: ssh_handle_key_exchange: current state : 4 [2018/11/02 16:38:18.030332, 3] ssh_packet_socket_callback: packet: read type 20 [len=956,padding=4,comp=951,payload=951] [2018/11/02 16:38:18.030332, 3] ssh_packet_process: Dispatching handler for packet type 20 [2018/11/02 16:38:18.031332, 2] ssh_kex_select_methods: Negotiated diffie-hellman-group14-sha1,ssh-rsa,aes128-ctr,aes128-ctr,hmac-sha1,hmac-sha1,none,none,, [2018/11/02 16:38:18.031332, 3] crypt_set_algorithms_server: Set output algorithm aes128-ctr [2018/11/02 16:38:18.031332, 3] crypt_set_algorithms_server: Set HMAC output algorithm to hmac-sha1 [2018/11/02 16:38:18.032332, 3] crypt_set_algorithms_server: Set input algorithm aes128-ctr [2018/11/02 16:38:18.032332, 3] crypt_set_algorithms_server: Set HMAC input algorithm to hmac-sha1 [2018/11/02 16:38:18.033332, 3] ssh_handle_key_exchange: ssh_handle_key_exchange: current state : 6 [2018/11/02 16:38:18.035332, 3] ssh_handle_key_exchange: ssh_handle_key_exchange: current state : 6 [2018/11/02 16:38:18.037332, 3] ssh_handle_key_exchange: ssh_handle_key_exchange: current state : 6 [2018/11/02 16:38:18.039332, 3] ssh_handle_key_exchange: ssh_handle_key_exchange: current state : 6 [2018/11/02 16:38:18.041332, 3] ssh_handle_key_exchange: ssh_handle_key_exchange: current state : 6 [2018/11/02 16:38:18.043332, 3] ssh_handle_key_exchange: ssh_handle_key_exchange: current state : 6 [2018/11/02 16:38:18.045332, 3] ssh_handle_key_exchange: ssh_handle_key_exchange: current state : 6 [2018/11/02 16:38:18.047332, 3] ssh_handle_key_exchange: ssh_handle_key_exchange: current state : 6 [2018/11/02 16:38:18.049332, 3] ssh_handle_key_exchange: ssh_handle_key_exchange: current state : 6 [2018/11/02 16:38:18.051332, 3] ssh_handle_key_exchange: ssh_handle_key_exchange: current state : 6 [2018/11/02 16:38:18.053332, 3] ssh_handle_key_exchange: ssh_handle_key_exchange: current state : 6 [2018/11/02 16:38:18.055332, 3] ssh_handle_key_exchange: ssh_handle_key_exchange: current state : 6 [2018/11/02 16:38:18.057332, 3] ssh_handle_key_exchange: ssh_handle_key_exchange: current state : 6 [2018/11/02 16:38:18.059332, 3] ssh_handle_key_exchange: ssh_handle_key_exchange: current state : 6 [2018/11/02 16:38:18.061332, 3] ssh_handle_key_exchange: ssh_handle_key_exchange: current state : 6 [2018/11/02 16:38:18.063332, 3] ssh_handle_key_exchange: ssh_handle_key_exchange: current state : 6 [2018/11/02 16:38:18.065332, 3] ssh_handle_key_exchange: ssh_handle_key_exchange: current state : 6 [2018/11/02 16:38:18.067332, 3] ssh_handle_key_exchange: ssh_handle_key_exchange: current state : 6 [2018/11/02 16:38:18.069332, 3] ssh_handle_key_exchange: ssh_handle_key_exchange: current state : 6 [2018/11/02 16:38:18.071332, 3] ssh_handle_key_exchange: ssh_handle_key_exchange: current state : 6 [2018/11/02 16:38:18.073332, 3] ssh_handle_key_exchange: ssh_handle_key_exchange: current state : 6 [2018/11/02 16:38:18.075332, 3] ssh_handle_key_exchange: ssh_handle_key_exchange: current state : 6 [2018/11/02 16:38:18.077332, 3] ssh_handle_key_exchange: ssh_handle_key_exchange: current state : 6 [2018/11/02 16:38:18.079332, 3] ssh_handle_key_exchange: ssh_handle_key_exchange: current state : 6 [2018/11/02 16:38:18.081332, 3] ssh_handle_key_exchange: ssh_handle_key_exchange: current state : 6 [2018/11/02 16:38:18.083332, 3] ssh_handle_key_exchange: ssh_handle_key_exchange: current state : 6 [2018/11/02 16:38:18.085332, 3] ssh_handle_key_exchange: ssh_handle_key_exchange: current state : 6 [2018/11/02 16:38:18.087332, 3] ssh_handle_key_exchange: ssh_handle_key_exchange: current state : 6 [2018/11/02 16:38:18.089332, 3] ssh_handle_key_exchange: ssh_handle_key_exchange: current state : 6 [2018/11/02 16:38:18.091332, 3] ssh_handle_key_exchange: ssh_handle_key_exchange: current state : 6 [2018/11/02 16:38:18.093332, 3] ssh_handle_key_exchange: ssh_handle_key_exchange: current state : 6 [2018/11/02 16:38:18.095332, 3] ssh_handle_key_exchange: ssh_handle_key_exchange: current state : 6 [2018/11/02 16:38:18.097332, 3] ssh_handle_key_exchange: ssh_handle_key_exchange: current state : 6 [2018/11/02 16:38:18.099332, 3] ssh_handle_key_exchange: ssh_handle_key_exchange: current state : 6 [2018/11/02 16:38:18.101332, 3] ssh_handle_key_exchange: ssh_handle_key_exchange: current state : 6 [2018/11/02 16:38:18.103332, 3] ssh_handle_key_exchange: ssh_handle_key_exchange: current state : 6 [2018/11/02 16:38:18.105332, 3] ssh_handle_key_exchange: ssh_handle_key_exchange: current state : 6 [2018/11/02 16:38:18.107332, 3] ssh_handle_key_exchange: ssh_handle_key_exchange: current state : 6 [2018/11/02 16:38:18.109332, 3] ssh_handle_key_exchange: ssh_handle_key_exchange: current state : 6 [2018/11/02 16:38:18.111332, 3] ssh_handle_key_exchange: ssh_handle_key_exchange: current state : 6 [2018/11/02 16:38:18.113332, 3] ssh_handle_key_exchange: ssh_handle_key_exchange: current state : 6 [2018/11/02 16:38:18.115332, 3] ssh_handle_key_exchange: ssh_handle_key_exchange: current state : 6 [2018/11/02 16:38:18.117332, 3] ssh_handle_key_exchange: ssh_handle_key_exchange: current state : 6 [2018/11/02 16:38:18.119332, 3] ssh_handle_key_exchange: ssh_handle_key_exchange: current state : 6 [2018/11/02 16:38:18.121332, 3] ssh_handle_key_exchange: ssh_handle_key_exchange: current state : 6 [2018/11/02 16:38:18.123332, 3] ssh_handle_key_exchange: ssh_handle_key_exchange: current state : 6 [2018/11/02 16:38:18.125332, 3] ssh_handle_key_exchange: ssh_handle_key_exchange: current state : 6 [2018/11/02 16:38:18.127332, 3] ssh_handle_key_exchange: ssh_handle_key_exchange: current state : 6 [2018/11/02 16:38:18.129332, 3] ssh_handle_key_exchange: ssh_handle_key_exchange: current state : 6 [2018/11/02 16:38:18.131332, 3] ssh_handle_key_exchange: ssh_handle_key_exchange: current state : 6 [2018/11/02 16:38:18.133332, 3] ssh_handle_key_exchange: ssh_handle_key_exchange: current state : 6 [2018/11/02 16:38:18.135332, 3] ssh_handle_key_exchange: ssh_handle_key_exchange: current state : 6 [2018/11/02 16:38:18.137332, 3] ssh_handle_key_exchange: ssh_handle_key_exchange: current state : 6 [2018/11/02 16:38:18.139332, 3] ssh_handle_key_exchange: ssh_handle_key_exchange: current state : 6 [2018/11/02 16:38:18.141332, 3] ssh_handle_key_exchange: ssh_handle_key_exchange: current state : 6 [2018/11/02 16:38:18.143332, 3] ssh_handle_key_exchange: ssh_handle_key_exchange: current state : 6 [2018/11/02 16:38:18.145332, 3] ssh_handle_key_exchange: ssh_handle_key_exchange: current state : 6 [2018/11/02 16:38:18.147332, 3] ssh_handle_key_exchange: ssh_handle_key_exchange: current state : 6 [2018/11/02 16:38:18.149332, 3] ssh_handle_key_exchange: ssh_handle_key_exchange: current state : 6 [2018/11/02 16:38:18.151332, 3] ssh_handle_key_exchange: ssh_handle_key_exchange: current state : 6 [2018/11/02 16:38:18.153332, 3] ssh_handle_key_exchange: ssh_handle_key_exchange: current state : 6 [2018/11/02 16:38:18.155332, 3] ssh_handle_key_exchange: ssh_handle_key_exchange: current state : 6 [2018/11/02 16:38:18.157332, 3] ssh_handle_key_exchange: ssh_handle_key_exchange: current state : 6 [2018/11/02 16:38:18.159332, 3] ssh_handle_key_exchange: ssh_handle_key_exchange: current state : 6 [2018/11/02 16:38:18.161332, 3] ssh_handle_key_exchange: ssh_handle_key_exchange: current state : 6 [2018/11/02 16:38:18.163332, 3] ssh_handle_key_exchange: ssh_handle_key_exchange: current state : 6 [2018/11/02 16:38:18.165332, 3] ssh_handle_key_exchange: ssh_handle_key_exchange: current state : 6 [2018/11/02 16:38:18.167332, 3] ssh_handle_key_exchange: ssh_handle_key_exchange: current state : 6 [2018/11/02 16:38:18.169332, 3] ssh_handle_key_exchange: ssh_handle_key_exchange: current state : 6 [2018/11/02 16:38:18.171332, 3] ssh_handle_key_exchange: ssh_handle_key_exchange: current state : 6 [2018/11/02 16:38:18.173332, 3] ssh_handle_key_exchange: ssh_handle_key_exchange: current state : 6 [2018/11/02 16:38:18.175332, 3] ssh_handle_key_exchange: ssh_handle_key_exchange: current state : 6 [2018/11/02 16:38:18.177332, 3] ssh_handle_key_exchange: ssh_handle_key_exchange: current state : 6 [2018/11/02 16:38:18.179332, 3] ssh_handle_key_exchange: ssh_handle_key_exchange: current state : 6 [2018/11/02 16:38:18.181332, 3] ssh_handle_key_exchange: ssh_handle_key_exchange: current state : 6 [2018/11/02 16:38:18.183332, 3] ssh_handle_key_exchange: ssh_handle_key_exchange: current state : 6 [2018/11/02 16:38:18.185332, 3] ssh_handle_key_exchange: ssh_handle_key_exchange: current state : 6 [2018/11/02 16:38:18.187332, 3] ssh_handle_key_exchange: ssh_handle_key_exchange: current state : 6 [2018/11/02 16:38:18.189332, 3] ssh_handle_key_exchange: ssh_handle_key_exchange: current state : 6 [2018/11/02 16:38:18.191332, 3] ssh_handle_key_exchange: ssh_handle_key_exchange: current state : 6 [2018/11/02 16:38:18.193332, 3] ssh_handle_key_exchange: ssh_handle_key_exchange: current state : 6 [2018/11/02 16:38:18.195332, 3] ssh_handle_key_exchange: ssh_handle_key_exchange: current state : 6 [2018/11/02 16:38:18.197332, 3] ssh_handle_key_exchange: ssh_handle_key_exchange: current state : 6 [2018/11/02 16:38:18.199332, 3] ssh_handle_key_exchange: ssh_handle_key_exchange: current state : 6 [2018/11/02 16:38:18.201332, 3] ssh_handle_key_exchange: ssh_handle_key_exchange: current state : 6 [2018/11/02 16:38:18.203332, 3] ssh_handle_key_exchange: ssh_handle_key_exchange: current state : 6 [2018/11/02 16:38:18.205332, 3] ssh_handle_key_exchange: ssh_handle_key_exchange: current state : 6 [2018/11/02 16:38:18.207332, 3] ssh_handle_key_exchange: ssh_handle_key_exchange: current state : 6 [2018/11/02 16:38:18.209332, 3] ssh_handle_key_exchange: ssh_handle_key_exchange: current state : 6 [2018/11/02 16:38:18.211332, 3] ssh_handle_key_exchange: ssh_handle_key_exchange: current state : 6 [2018/11/02 16:38:18.213332, 3] ssh_handle_key_exchange: ssh_handle_key_exchange: current state : 6 [2018/11/02 16:38:18.215332, 3] ssh_packet_socket_callback: packet: read type 30 [len=268,padding=6,comp=261,payload=261] [2018/11/02 16:38:18.215332, 3] ssh_packet_process: Dispatching handler for packet type 30 [2018/11/02 16:38:18.215332, 3] ssh_packet_kexdh_init: Received SSH_MSG_KEXDH_INIT [2018/11/02 16:38:20.758332, 3] ssh_key_algorithm_allowed: Checking rsa-sha2-512 with list <ssh-ed25519,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,ssh-rsa,rsa-sha2-512,rsa-sha2-256,ssh-dss> [2018/11/02 16:38:20.759332, 3] ssh_key_algorithm_allowed: Checking rsa-sha2-256 with list <ssh-ed25519,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,ssh-rsa,rsa-sha2-512,rsa-sha2-256,ssh-dss> [2018/11/02 16:38:21.199332, 3] ssh_socket_unbuffered_write: Enabling POLLOUT for socket [2018/11/02 16:38:21.199332, 3] packet_send2: packet: wrote [len=828,padding=9,comp=818,payload=818] [2018/11/02 16:38:21.200332, 3] packet_send2: packet: wrote [len=12,padding=10,comp=1,payload=1] [2018/11/02 16:38:21.200332, 3] dh_handshake_server: SSH_MSG_NEWKEYS sent [2018/11/02 16:38:21.201332, 3] ssh_handle_key_exchange: ssh_handle_key_exchange: current state : 6 [2018/11/02 16:38:21.203332, 3] ssh_packet_socket_callback: packet: read type 21 [len=12,padding=10,comp=1,payload=1] [2018/11/02 16:38:21.203332, 3] ssh_packet_process: Dispatching handler for packet type 21 [2018/11/02 16:38:21.203332, 2] ssh_packet_newkeys: Received SSH_MSG_NEWKEYS [2018/11/02 16:38:21.204332, 3] ssh_socket_unbuffered_write: Enabling POLLOUT for socket [2018/11/02 16:38:21.204332, 3] ssh_handle_key_exchange: ssh_handle_key_exchange: current state : 7 [2018/11/02 16:38:21.205332, 3] ssh_packet_socket_callback: packet: read type 5 [len=28,padding=10,comp=17,payload=17] [2018/11/02 16:38:21.206332, 3] ssh_packet_process: Dispatching handler for packet type 5 [2018/11/02 16:38:21.206332, 3] ssh_packet_service_request: Received a SERVICE_REQUEST for service ssh-userauth VERBOSE: Received an SSH message "request-service" of subtype "ssh-userauth". [2018/11/02 16:38:21.207332, 3] ssh_message_service_reply_success: Sending a SERVICE_ACCEPT for service ssh-userauth [2018/11/02 16:38:21.207332, 3] packet_send2: packet: wrote [len=28,padding=10,comp=17,payload=17] [2018/11/02 16:38:21.208332, 3] ssh_socket_unbuffered_write: Enabling POLLOUT for socket [2018/11/02 16:38:21.210332, 3] ssh_packet_socket_callback: packet: read type 50 [len=44,padding=4,comp=39,payload=39] [2018/11/02 16:38:21.210332, 3] ssh_packet_process: Dispatching handler for packet type 50 [2018/11/02 16:38:21.210332, 3] ssh_packet_userauth_request: Auth request for service ssh-connection, method none for user 'secadmin' VERBOSE: Received an SSH message "request-auth" of subtype "none". [2018/11/02 16:38:21.211332, 3] ssh_auth_reply_default: Sending a auth failure. methods that can continue: password [2018/11/02 16:38:21.211332, 3] packet_send2: packet: wrote [len=28,padding=13,comp=14,payload=14] [2018/11/02 16:38:21.212332, 3] ssh_socket_unbuffered_write: Enabling POLLOUT for socket [2018/11/02 16:38:25.976332, 3] ssh_packet_socket_callback: packet: read type 50 [len=124,padding=74,comp=49,payload=49] [2018/11/02 16:38:25.976332, 3] ssh_packet_process: Dispatching handler for packet type 50 [2018/11/02 16:38:25.977332, 3] ssh_packet_userauth_request: Auth request for service ssh-connection, method password for user 'secadmin' VERBOSE: Received an SSH message "request-auth" of subtype "password". VERBOSE: User "secadmin" authenticated. [2018/11/02 16:38:25.978332, 3] ssh_socket_unbuffered_write: Enabling POLLOUT for socket [2018/11/02 16:38:25.978332, 3] packet_send2: packet: wrote [len=12,padding=10,comp=1,payload=1] [2018/11/02 16:38:25.979332, 3] ssh_packet_socket_callback: packet: read type 90 [len=44,padding=19,comp=24,payload=24] [2018/11/02 16:38:25.979332, 3] ssh_packet_process: Dispatching handler for packet type 90 [2018/11/02 16:38:25.979332, 3] ssh_packet_channel_open: Clients wants to open a session channel VERBOSE: Received an SSH message "request-channel-open" of subtype "session". [2018/11/02 16:38:25.980332, 3] ssh_message_channel_request_open_reply_accept_channel: Accepting a channel request_open for chan 0 [2018/11/02 16:38:25.980332, 3] packet_send2: packet: wrote [len=28,padding=10,comp=17,payload=17] [2018/11/02 16:38:25.981332, 3] ssh_socket_unbuffered_write: Enabling POLLOUT for socket [2018/11/02 16:38:25.983332, 3] ssh_packet_socket_callback: packet: read type 98 [len=44,padding=4,comp=39,payload=39] [2018/11/02 16:38:25.983332, 3] ssh_packet_process: Dispatching handler for packet type 98 [2018/11/02 16:38:25.983332, 3] ssh_message_handle_channel_request: Received a env channel_request for channel (43:0) (want_reply=0) VERBOSE: Received an SSH message "request-channel" of subtype "env". [2018/11/02 16:38:25.984332, 3] ssh_message_channel_request_reply_default: The client doesn't want to know the request failed! [2018/11/02 16:38:25.984332, 3] ssh_packet_socket_callback: Processing 136 bytes left in socket buffer [2018/11/02 16:38:25.985332, 3] ssh_packet_socket_callback: packet: read type 98 [len=44,padding=7,comp=36,payload=36] [2018/11/02 16:38:25.985332, 3] ssh_packet_process: Dispatching handler for packet type 98 [2018/11/02 16:38:25.986332, 3] ssh_message_handle_channel_request: Received a env channel_request for channel (43:0) (want_reply=0) VERBOSE: Received an SSH message "request-channel" of subtype "env". [2018/11/02 16:38:25.986332, 3] ssh_message_channel_request_reply_default: The client doesn't want to know the request failed! [2018/11/02 16:38:25.987332, 3] ssh_packet_socket_callback: Processing 68 bytes left in socket buffer [2018/11/02 16:38:25.987332, 3] ssh_packet_socket_callback: packet: read type 98 [len=44,padding=13,comp=30,payload=30] [2018/11/02 16:38:25.988332, 3] ssh_packet_process: Dispatching handler for packet type 98 [2018/11/02 16:38:25.988332, 3] ssh_message_handle_channel_request: Received a subsystem channel_request for channel (43:0) (want_reply=1) VERBOSE: Received an SSH message "request-channel" of subtype "subsystem". [2018/11/02 16:38:25.988332, 3] ssh_message_channel_request_reply_success: Sending a channel_request success to channel 0 [2018/11/02 16:38:25.989332, 3] packet_send2: packet: wrote [len=12,padding=6,comp=5,payload=5] [2018/11/02 16:38:25.989332, 3] ssh_socket_unbuffered_write: Enabling POLLOUT for socket

Process 1966329956 (server) terminated SIGSEGV code=1 fltno=11 ip=fe364a7c(/usr/lib/ldqnx.so.2@memcpy+0x68) mapaddr=00064a7c. ref=3c68656c

For you info i have i am using NC_SSH_AUTH_PASSWORD method for authetication :-

nc_server_ssh_endpt_set_auth_methods("vivekP",NC_SSH_AUTH_PASSWORD); nc_server_ssh_set_passwd_auth_clb(password_auth_cb,NULL,NULL); Any clue why its crashing? Thanks, Vivek prasad

michalvasko commented 5 years ago

Hi Vivek, I have no idea why it crashes as you have provided very little information, I know nothing about your server implementation. Please, look into netopeer2-server, which is not crashing and try to follow its code.

Regards, Michal

vprasad commented 5 years ago

Hi Michal,

I have referred to netopeer2-server code only to write my server code .I am attaching my sample server code. Currently intention of this server code is only to authenticate the user and list the capabilities it supports. Will appreciate if you can please have a look to my code once to find what exactly wrong i am doing which is leading to this crash .

One point i have observed is , crash is coming only after the addition of the authentication cb.If i remove the registration of authentication cb ,then the crash is not seen.

Please help.

server.txt

Thanks, Vivek Prasad

michalvasko commented 5 years ago

Hi Vivek, I am not really here to debug anyone else's code but ours. Try to run your server with gdb or valgrind and if you discover a problem with libnetconf2 then let us know. Otherwise you are on your own.

Regards, Michal

vprasad commented 5 years ago

Hi Vivek, I am not really here to debug anyone else's code but ours. Try to run your server with gdb or valgrind and if you discover a problem with libnetconf2 then let us know. Otherwise you are on your own.

Regards, Michal

Hi Michal, Thanks a lot for help. I did found the RCA and fixed the same . Now the netconf authentication is working fine and capabilities are being displayed . So just to update you,i am able to do the ssh authentication with libnetcon2 in qnx ppc successfully.

Thanks, Vivek prasad

michalvasko commented 5 years ago

Glad to hear that.

Regards, Michal