[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Key exchange fail
[Thread Prev] | [Thread Next]
- Subject: Re: Key exchange fail
- From: Yusuf Saka <yusufsaka5481@xxxxxxxxx>
- Reply-to: libssh@xxxxxxxxxx
- Date: Fri, 28 Mar 2025 10:02:06 -0500
- To: libssh@xxxxxxxxxx
Hey, Thank you for replying back so soon I believe key exchange fail is somehow related to race conditions in my class which which can be solved but I am unable to figure out the other problem and why it persists I get the following output after key exchange which indicates that client requested authentication. I already set the appropriate callback functions to handle these requests. I also checked in my debugger that session is indeed connected, session is not NULL event is not NULL and ssh_event_add_session is also succesful. [2025/03/28 09:50:02.784775, 4] ssh_socket_pollcallback: Poll callback on socket 4 (POLLIN POLLOUT ), out buffer 0 [2025/03/28 09:50:02.784863, 4] ssh_socket_unbuffered_read: read 44 [2025/03/28 09:50:02.784899, 3] ssh_packet_socket_callback: packet: read type 5 [len=24,padding=6,comp=17,payload=17] [2025/03/28 09:50:02.784905, 3] ssh_packet_process: Dispatching handler for packet type 5 [2025/03/28 09:50:02.784911, 3] ssh_packet_service_request: Received a SERVICE_REQUEST for service ssh-userauth But ssh_event_dopoll causes segmentation fault. What would be the following debugging processes ``` // Authenticate and open a channel while (sdata.authenticated == 0 || sdata.channel == NULL) { /* To Do! Simulate a successful brute force attempt at random X attempts to make the attacker get inside*/ if (sdata.auth_attempts >= 3) { std::cout << YELLOW << "[SSHServer::handle_session]: Auth attempts exceeded" << RESET << std::endl; goto cleanup; } if (ssh_event_dopoll(event, 100) == SSH_ERROR) { std::cerr << RED << "[SSHServer::handle_session]: " << ssh_get_error(session) << RESET << std::endl; goto cleanup; } } std::cout << GREEN << "[SSHServer::handle_session]: Authenticated user" << RESET << std::endl; On Fri, Mar 28, 2025 at 7:54 AM Jakub Jelen <jjelen@xxxxxxxxxx> wrote: > Hi, > do you have some error? > > Please, try to set the libssh log level to SSH_LOG_TRACE. It will then > print more information about what is going on under the hood and might > show up some path to the failure. > > Jakub > > On Fri, Mar 28, 2025 at 12:20 PM Yusuf Saka <yusufsaka5481@xxxxxxxxx> > wrote: > > > > Hey there, > > > > I recently read your docs on implementing a ssh connection and read one > of your example codes called ssh_server.c which works quite fine in my own > device. I've been trying to implement the C++ version of this code with > classes in play for days but the code just won't work. I am trying to > create a ssh server with threads (pthread) mainly and it fails in > > ssh_server.cpp > > in handle_session function at line 187. > > KEY_FILE macro is defined in my cmake file. I've been able to get > connection but key exchange fails somehow. > > I've been trying to solve the problem for few days now and being a > beginner in programming it is starting to get quite frustrating so I've > decided to reach out for help. > > > > Best regards > > > > > > >
Re: Key exchange fail | Yusuf Saka <yusufsaka5481@xxxxxxxxx> |
Key exchange fail | Yusuf Saka <yusufsaka5481@xxxxxxxxx> |
Re: Key exchange fail | Jakub Jelen <jjelen@xxxxxxxxxx> |