diff --git a/Dockerfile b/Dockerfile index e797e33b..1c9b1387 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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 diff --git a/tmate-ssh-server.c b/tmate-ssh-server.c index bb8b0885..215b377d 100644 --- a/tmate-ssh-server.c +++ b/tmate-ssh-server.c @@ -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);