[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Restrict SSH server to execute just a single program
[Thread Prev] | [Thread Next]
- Subject: Restrict SSH server to execute just a single program
- From: Jose David Bravo A <jbravo@xxxxxxxxxxxxxxxxxxxxxx>
- Reply-to: libssh@xxxxxxxxxx
- Date: Thu, 13 Apr 2023 14:41:24 -0500 (COT)
- To: libssh <libssh@xxxxxxxxxx>
Hello,
In the exec_pty function, I'm executing another program that uses ncurses.
I believe I need to pass the client's TERM environment variable to the PTY allocated to that client so that the ncurses program knows how to display itself properly. Am I correct?
How can I receive the TERM environment variable sent by the client and set it in the allocated PTY?
And my other question is:
I implemented an SSH server using the example in ssh_server.c as a base.
The purpose of this SSH server is to only allow the execution of a single program, without bash, port forwarding, or agent forwarding. Will these additional functionalities be disabled if my callbacks are configured like this?:
struct ssh_server_callbacks_struct server_cb = {
.userdata = &sdata,
.auth_password_function = auth_password,
.channel_open_request_session_function = channel_open};
struct ssh_channel_callbacks_struct channel_cb = {
.userdata = &cdata,
.channel_pty_request_function = pty_request,
.channel_pty_window_change_function = pty_resize,
.channel_shell_request_function = shell_request,
.channel_data_function = data_function};
ssh_callbacks_init(&server_cb);
ssh_callbacks_init(&channel_cb);
Or will the client be able to execute any of these "forbidden" functionalities?
In shell_request I'm calling exec_pty, where my ncurses program is being called using execl.
Thank you,
Jose Bravo
| Re: Restrict SSH server to execute just a single program | Jakub Jelen <jjelen@xxxxxxxxxx> |