From 1788ef3b8e033af0ac3dd9370ce87d22c05c3e8c Mon Sep 17 00:00:00 2001 From: Nick Couchman Date: Sun, 24 May 2020 16:53:33 -0400 Subject: [PATCH] GUACAMOLE-343: Add setting for explicitly disabling recording. --- src/protocols/kubernetes/kubernetes.c | 2 +- src/protocols/kubernetes/settings.c | 14 ++++++++++++++ src/protocols/kubernetes/settings.h | 8 ++++++++ src/protocols/rdp/rdp.c | 2 +- src/protocols/rdp/settings.c | 14 ++++++++++++++ src/protocols/rdp/settings.h | 8 ++++++++ src/protocols/ssh/settings.c | 14 ++++++++++++++ src/protocols/ssh/settings.h | 8 ++++++++ src/protocols/ssh/ssh.c | 2 +- src/protocols/telnet/settings.c | 14 ++++++++++++++ src/protocols/telnet/settings.h | 8 ++++++++ src/protocols/telnet/telnet.c | 2 +- src/protocols/vnc/settings.c | 13 +++++++++++++ src/protocols/vnc/settings.h | 8 ++++++++ src/protocols/vnc/vnc.c | 2 +- 15 files changed, 114 insertions(+), 5 deletions(-) diff --git a/src/protocols/kubernetes/kubernetes.c b/src/protocols/kubernetes/kubernetes.c index 7158a989..5f6b5d3d 100644 --- a/src/protocols/kubernetes/kubernetes.c +++ b/src/protocols/kubernetes/kubernetes.c @@ -227,7 +227,7 @@ void* guac_kubernetes_client_thread(void* data) { "the requested Kubernetes pod is \"%s\".", endpoint_path); /* Set up screen recording, if requested */ - if (settings->recording_path != NULL) { + if (settings->recording_path != NULL && !settings->recording_disabled) { kubernetes_client->recording = guac_common_recording_create(client, settings->recording_path, settings->recording_name, diff --git a/src/protocols/kubernetes/settings.c b/src/protocols/kubernetes/settings.c index 4ed5f515..6d0865c7 100644 --- a/src/protocols/kubernetes/settings.c +++ b/src/protocols/kubernetes/settings.c @@ -41,6 +41,7 @@ const char* GUAC_KUBERNETES_CLIENT_ARGS[] = { "typescript-path", "typescript-name", "create-typescript-path", + "recording-disabled", "recording-path", "recording-name", "recording-exclude-output", @@ -157,6 +158,14 @@ enum KUBERNETES_ARGS_IDX { */ IDX_CREATE_TYPESCRIPT_PATH, + /** + * Whether or not recording should be explicitly disabled, even if the + * recording_path parameter is set. Normally setting the recording_path + * parameter to a non-null value will result in session recording being + * enabled - this provides the ability to override that. + */ + IDX_RECORDING_DISABLED, + /** * The full absolute path to the directory in which screen recordings * should be written. @@ -345,6 +354,11 @@ guac_kubernetes_settings* guac_kubernetes_parse_args(guac_user* user, guac_user_parse_args_boolean(user, GUAC_KUBERNETES_CLIENT_ARGS, argv, IDX_CREATE_TYPESCRIPT_PATH, false); + /* Read flag to disable recording */ + settings->recording_disabled = + guac_user_parse_args_boolean(user, GUAC_KUBERNETES_CLIENT_ARGS, argv, + IDX_RECORDING_DISABLED, false); + /* Read recording path */ settings->recording_path = guac_user_parse_args_string(user, GUAC_KUBERNETES_CLIENT_ARGS, argv, diff --git a/src/protocols/kubernetes/settings.h b/src/protocols/kubernetes/settings.h index eef4973e..609e2024 100644 --- a/src/protocols/kubernetes/settings.h +++ b/src/protocols/kubernetes/settings.h @@ -201,6 +201,14 @@ typedef struct guac_kubernetes_settings { */ bool create_typescript_path; + /** + * Whether or not recording should be explicitly disabled, even if the + * recording_path parameter is set. Normally setting the recording_path + * parameter to a non-null value will result in session recording being + * enabled - this provides the ability to override that. + */ + bool recording_disabled; + /** * The path in which the screen recording should be saved, if enabled. If * no screen recording should be saved, this will be NULL. diff --git a/src/protocols/rdp/rdp.c b/src/protocols/rdp/rdp.c index 9388d0cd..f9ed32d3 100644 --- a/src/protocols/rdp/rdp.c +++ b/src/protocols/rdp/rdp.c @@ -346,7 +346,7 @@ static int guac_rdp_handle_connection(guac_client* client) { srandom(time(NULL)); /* Set up screen recording, if requested */ - if (settings->recording_path != NULL) { + if (settings->recording_path != NULL && !settings->recording_disabled) { rdp_client->recording = guac_common_recording_create(client, settings->recording_path, settings->recording_name, diff --git a/src/protocols/rdp/settings.c b/src/protocols/rdp/settings.c index c6db3c8f..b81910f0 100644 --- a/src/protocols/rdp/settings.c +++ b/src/protocols/rdp/settings.c @@ -93,6 +93,7 @@ const char* GUAC_RDP_CLIENT_ARGS[] = { "sftp-server-alive-interval", #endif + "recording-disabled", "recording-path", "recording-name", "recording-exclude-output", @@ -432,6 +433,14 @@ enum RDP_ARGS_IDX { IDX_SFTP_SERVER_ALIVE_INTERVAL, #endif + /** + * Whether or not recording should be explicitly disabled, even if the + * recording_path parameter is set. Normally setting the recording_path + * parameter to a non-null value will result in session recording being + * enabled - this provides the ability to override that. + */ + IDX_RECORDING_DISABLED, + /** * The full absolute path to the directory in which screen recordings * should be written. @@ -920,6 +929,11 @@ guac_rdp_settings* guac_rdp_parse_args(guac_user* user, IDX_SFTP_SERVER_ALIVE_INTERVAL, 0); #endif + /* Parse flag for disabling recording */ + settings->recording_disabled = + guac_user_parse_args_boolean(user, GUAC_RDP_CLIENT_ARGS, argv, + IDX_RECORDING_DISABLED, false); + /* Read recording path */ settings->recording_path = guac_user_parse_args_string(user, GUAC_RDP_CLIENT_ARGS, argv, diff --git a/src/protocols/rdp/settings.h b/src/protocols/rdp/settings.h index 70199b8f..b01f156a 100644 --- a/src/protocols/rdp/settings.h +++ b/src/protocols/rdp/settings.h @@ -452,6 +452,14 @@ typedef struct guac_rdp_settings { int sftp_server_alive_interval; #endif + /** + * Whether or not recording should be explicitly disabled, even if the + * recording_path parameter is set. Normally setting the recording_path + * parameter to a non-null value will result in session recording being + * enabled - this provides the ability to override that. + */ + int recording_disabled; + /** * The path in which the screen recording should be saved, if enabled. If * no screen recording should be saved, this will be NULL. diff --git a/src/protocols/ssh/settings.c b/src/protocols/ssh/settings.c index 7dab3215..85d54060 100644 --- a/src/protocols/ssh/settings.c +++ b/src/protocols/ssh/settings.c @@ -49,6 +49,7 @@ const char* GUAC_SSH_CLIENT_ARGS[] = { "typescript-path", "typescript-name", "create-typescript-path", + "recording-disabled", "recording-path", "recording-name", "recording-exclude-output", @@ -167,6 +168,14 @@ enum SSH_ARGS_IDX { */ IDX_CREATE_TYPESCRIPT_PATH, + /** + * Whether or not recording should be explicitly disabled, even if the + * recording_path parameter is set. Normally setting the recording_path + * parameter to a non-null value will result in session recording being + * enabled - this provides the ability to override that. + */ + IDX_RECORDING_DISABLED, + /** * The full absolute path to the directory in which screen recordings * should be written. @@ -387,6 +396,11 @@ guac_ssh_settings* guac_ssh_parse_args(guac_user* user, guac_user_parse_args_boolean(user, GUAC_SSH_CLIENT_ARGS, argv, IDX_CREATE_TYPESCRIPT_PATH, false); + /* Parse setting to disable recording */ + settings->recording_disabled = + guac_user_parse_args_boolean(user, GUAC_SSH_CLIENT_ARGS, argv, + IDX_RECORDING_DISABLED, false); + /* Read recording path */ settings->recording_path = guac_user_parse_args_string(user, GUAC_SSH_CLIENT_ARGS, argv, diff --git a/src/protocols/ssh/settings.h b/src/protocols/ssh/settings.h index bab21bdf..1364af33 100644 --- a/src/protocols/ssh/settings.h +++ b/src/protocols/ssh/settings.h @@ -204,6 +204,14 @@ typedef struct guac_ssh_settings { */ bool create_typescript_path; + /** + * Whether or not recording should be explicitly disabled, even if the + * recording_path parameter is set. Normally setting the recording_path + * parameter to a non-null value will result in session recording being + * enabled - this provides the ability to override that. + */ + bool recording_disabled; + /** * The path in which the screen recording should be saved, if enabled. If * no screen recording should be saved, this will be NULL. diff --git a/src/protocols/ssh/ssh.c b/src/protocols/ssh/ssh.c index 89572050..4fd0d00b 100644 --- a/src/protocols/ssh/ssh.c +++ b/src/protocols/ssh/ssh.c @@ -211,7 +211,7 @@ void* ssh_client_thread(void* data) { char ssh_ttymodes[GUAC_SSH_TTYMODES_SIZE(1)]; /* Set up screen recording, if requested */ - if (settings->recording_path != NULL) { + if (settings->recording_path != NULL && !settings->recording_disabled) { ssh_client->recording = guac_common_recording_create(client, settings->recording_path, settings->recording_name, diff --git a/src/protocols/telnet/settings.c b/src/protocols/telnet/settings.c index e72359c9..765f48c7 100644 --- a/src/protocols/telnet/settings.c +++ b/src/protocols/telnet/settings.c @@ -43,6 +43,7 @@ const char* GUAC_TELNET_CLIENT_ARGS[] = { "typescript-path", "typescript-name", "create-typescript-path", + "recording-disabled", "recording-path", "recording-name", "recording-exclude-output", @@ -133,6 +134,14 @@ enum TELNET_ARGS_IDX { */ IDX_CREATE_TYPESCRIPT_PATH, + /** + * Whether or not recording should be explicitly disabled, even if the + * recording_path parameter is set. Normally setting the recording_path + * parameter to a non-null value will result in session recording being + * enabled - this provides the ability to override that. + */ + IDX_RECORDING_DISABLED, + /** * The full absolute path to the directory in which screen recordings * should be written. @@ -404,6 +413,11 @@ guac_telnet_settings* guac_telnet_parse_args(guac_user* user, guac_user_parse_args_boolean(user, GUAC_TELNET_CLIENT_ARGS, argv, IDX_CREATE_TYPESCRIPT_PATH, false); + /* Read flag for disabling recording */ + settings->recording_disabled = + guac_user_parse_args_boolean(user, GUAC_TELNET_CLIENT_ARGS, argv, + IDX_RECORDING_DISABLED, false); + /* Read recording path */ settings->recording_path = guac_user_parse_args_string(user, GUAC_TELNET_CLIENT_ARGS, argv, diff --git a/src/protocols/telnet/settings.h b/src/protocols/telnet/settings.h index 691669cb..63260ced 100644 --- a/src/protocols/telnet/settings.h +++ b/src/protocols/telnet/settings.h @@ -202,6 +202,14 @@ typedef struct guac_telnet_settings { */ bool create_typescript_path; + /** + * Whether or not recording should be explicitly disabled, even if the + * recording_path parameter is set. Normally setting the recording_path + * parameter to a non-null value will result in session recording being + * enabled - this provides the ability to override that. + */ + bool recording_disabled; + /** * The path in which the screen recording should be saved, if enabled. If * no screen recording should be saved, this will be NULL. diff --git a/src/protocols/telnet/telnet.c b/src/protocols/telnet/telnet.c index 5a5ca303..f438bb02 100644 --- a/src/protocols/telnet/telnet.c +++ b/src/protocols/telnet/telnet.c @@ -558,7 +558,7 @@ void* guac_telnet_client_thread(void* data) { int wait_result; /* Set up screen recording, if requested */ - if (settings->recording_path != NULL) { + if (settings->recording_path != NULL && !settings->recording_disabled) { telnet_client->recording = guac_common_recording_create(client, settings->recording_path, settings->recording_name, diff --git a/src/protocols/vnc/settings.c b/src/protocols/vnc/settings.c index 21f64057..8a37d3d3 100644 --- a/src/protocols/vnc/settings.c +++ b/src/protocols/vnc/settings.c @@ -261,6 +261,14 @@ enum VNC_ARGS_IDX { IDX_SFTP_SERVER_ALIVE_INTERVAL, #endif + /** + * Whether or not recording should be explicitly disabled, even if the + * recording_path parameter is set. Normally setting the recording_path + * parameter to a non-null value will result in session recording being + * enabled - this provides the ability to override that. + */ + IDX_RECORDING_DISABLED, + /** * The full absolute path to the directory in which screen recordings * should be written. @@ -488,6 +496,11 @@ guac_vnc_settings* guac_vnc_parse_args(guac_user* user, IDX_SFTP_SERVER_ALIVE_INTERVAL, 0); #endif + /* Read flag for disabling recording */ + settings->recording_disabled = + guac_user_parse_args_boolean(user, GUAC_VNC_CLIENT_ARGS, argv, + IDX_RECORDING_DISABLED, false); + /* Read recording path */ settings->recording_path = guac_user_parse_args_string(user, GUAC_VNC_CLIENT_ARGS, argv, diff --git a/src/protocols/vnc/settings.h b/src/protocols/vnc/settings.h index 34c08ec9..408b5844 100644 --- a/src/protocols/vnc/settings.h +++ b/src/protocols/vnc/settings.h @@ -213,6 +213,14 @@ typedef struct guac_vnc_settings { int sftp_server_alive_interval; #endif + /** + * Whether or not recording should be explicitly disabled, even if the + * recording_path parameter is set. Normally setting the recording_path + * parameter to a non-null value will result in session recording being + * enabled - this provides the ability to override that. + */ + bool recording_disabled; + /** * The path in which the screen recording should be saved, if enabled. If * no screen recording should be saved, this will be NULL. diff --git a/src/protocols/vnc/vnc.c b/src/protocols/vnc/vnc.c index f33b267a..d8186569 100644 --- a/src/protocols/vnc/vnc.c +++ b/src/protocols/vnc/vnc.c @@ -372,7 +372,7 @@ void* guac_vnc_client_thread(void* data) { vnc_client->rfb_client = rfb_client; /* Set up screen recording, if requested */ - if (settings->recording_path != NULL) { + if (settings->recording_path != NULL && !settings->recording_disabled) { vnc_client->recording = guac_common_recording_create(client, settings->recording_path, settings->recording_name,