Merge branch 'feature/KASM-3371_keystroke_logging' into 'master'

Move keypress logging behind the DLP_Log verbose option

Closes KASM-3371

See merge request kasm-technologies/internal/KasmVNC!71
This commit is contained in:
Matthew McClaskey 2022-10-14 18:06:37 +00:00
commit 3b1a72738e
4 changed files with 22 additions and 3 deletions

View File

@ -831,9 +831,11 @@ void VNCSConnectionST::keyEvent(rdr::U32 keysym, rdr::U32 keycode, bool down) {
if (down) {
keylog(keysym, sock->getPeerAddress());
kbdLogTimer.start(60 * 1000);
vlog.debug("Key pressed: 0x%x / 0x%x", keysym, keycode);
if (Server::DLP_ClipLog[0] == 'v')
vlog.debug("Key pressed: 0x%x / 0x%x", keysym, keycode);
} else {
vlog.debug("Key released: 0x%x / 0x%x", keysym, keycode);
if (Server::DLP_ClipLog[0] == 'v')
vlog.debug("Key released: 0x%x / 0x%x", keysym, keycode);
}
// Remap the key if required

View File

@ -83,6 +83,7 @@ static void vncKeysymKeyboardEvent(KeySym keysym, int down);
#define LOG_STATUS(...) vncLogStatus(LOG_NAME, __VA_ARGS__)
#define LOG_INFO(...) vncLogInfo(LOG_NAME, __VA_ARGS__)
#define LOG_DEBUG(...) vncLogDebug(LOG_NAME, __VA_ARGS__)
#define LOG_DLP_VERBOSE(...) vncLogDLPVerbose(LOG_NAME, __VA_ARGS__)
/*
* Init input device.
@ -406,7 +407,7 @@ static inline void pressKey(DeviceIntPtr dev, int kc, Bool down, const char *msg
#endif
if (msg != NULL)
LOG_DEBUG("%s %d %s", msg, kc, down ? "down" : "up");
LOG_DLP_VERBOSE("%s %d %s", msg, kc, down ? "down" : "up");
action = down ? KeyPress : KeyRelease;
#if XORG < 111

View File

@ -24,6 +24,7 @@
#include <rfb/LogWriter.h>
#include <rfb/Logger_stdio.h>
#include <rfb/Logger_syslog.h>
#include <rfb/ServerCore.h>
#include "RFBGlue.h"
@ -89,6 +90,20 @@ void vncLogDebug(const char *name, const char *format, ...)
va_end(ap);
}
void vncLogDLPVerbose(const char *name, const char *format, ...)
{
if (Server::DLP_ClipLog[0] != 'v')
return;
LogWriter *vlog;
va_list ap;
vlog = LogWriter::getLogWriter(name);
if (vlog == NULL)
return;
va_start(ap, format);
vlog->vdebug(format, ap);
va_end(ap);
}
int vncSetParam(const char *name, const char *value)
{
if (value != NULL)

View File

@ -36,6 +36,7 @@ void vncLogError(const char *name, const char *format, ...) __printf_attr(2, 3);
void vncLogStatus(const char *name, const char *format, ...) __printf_attr(2, 3);
void vncLogInfo(const char *name, const char *format, ...) __printf_attr(2, 3);
void vncLogDebug(const char *name, const char *format, ...) __printf_attr(2, 3);
void vncLogDLPVerbose(const char *name, const char *format, ...) __printf_attr(2, 3);
int vncSetParam(const char *name, const char *value);
int vncSetParamSimple(const char *nameAndValue);