1
0
mirror of https://github.com/tmate-io/tmate-ssh-server.git synced 2020-11-18 19:53:51 -08:00

SSH verbosity can be set with CLI verbosity option

This commit is contained in:
Nicolas Viennot 2018-11-18 14:41:53 -05:00
parent 3c22f38db6
commit 91a2bf3c4d
2 changed files with 12 additions and 19 deletions

View File

@ -31,22 +31,6 @@ RUN cd /src/libssh &&\
RUN cd /src/msgpack-c &&\
mkdir build && cd build && cmake .. && make install
RUN cd /src/tmate-slave &&\
echo -e 'diff --git a/tmate-ssh-server.c b/tmate-ssh-server.c\n\
index 73a7df85..c4b387db 100644\n\
--- a/tmate-ssh-server.c\n\
+++ b/tmate-ssh-server.c\n\
@@ -315,7 +315,7 @@ static ssh_bind prepare_ssh(const char *keys_dir, const char *bind_addr, int por\n\
{\n\
ssh_bind bind;\n\
char buffer[PATH_MAX];\n\
- int verbosity = SSH_LOG_NOLOG;\n\
+ int verbosity = SSH_LOG_NOLOG + log_get_level();\n\
\n\
ssh_set_log_callback(ssh_log_function);\n\
\n\
' | git apply
RUN cd /src/tmate-slave &&\
sh autogen.sh && PKG_CONFIG_PATH=/usr/local/lib/pkgconfig ./configure && make

View File

@ -308,14 +308,23 @@ static int get_ip(int fd, char *dst, size_t len)
static void ssh_log_function(int priority, const char *function,
const char *buffer, __unused void *userdata)
{
tmate_info("[%d] [%s] %s", priority, function, buffer);
tmate_log(LOG_NOTICE + priority, "[%s] %s", function, buffer);
}
static inline int max(int a, int b)
{
if (a < b)
return b;
return a;
}
static ssh_bind prepare_ssh(const char *keys_dir, const char *bind_addr, int port)
{
ssh_bind bind;
char buffer[PATH_MAX];
int verbosity = SSH_LOG_NOLOG;
int ssh_log_level;
ssh_log_level = SSH_LOG_WARNING + max(log_get_level() - LOG_NOTICE, 0);
ssh_set_log_callback(ssh_log_function);
@ -327,7 +336,7 @@ static ssh_bind prepare_ssh(const char *keys_dir, const char *bind_addr, int por
ssh_bind_options_set(bind, SSH_BIND_OPTIONS_BINDADDR, bind_addr);
ssh_bind_options_set(bind, SSH_BIND_OPTIONS_BINDPORT, &port);
ssh_bind_options_set(bind, SSH_BIND_OPTIONS_BANNER, TMATE_SSH_BANNER);
ssh_bind_options_set(bind, SSH_BIND_OPTIONS_LOG_VERBOSITY, &verbosity);
ssh_bind_options_set(bind, SSH_BIND_OPTIONS_LOG_VERBOSITY, &ssh_log_level);
sprintf(buffer, "%s/ssh_host_rsa_key", keys_dir);
ssh_bind_options_set(bind, SSH_BIND_OPTIONS_RSAKEY, buffer);