[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 13/14] qga: add command line to block user authentication command
From: |
Daniel P . Berrangé |
Subject: |
[PATCH 13/14] qga: add command line to block user authentication commands |
Date: |
Tue, 4 Jun 2024 16:32:41 +0100 |
Historically there has been no default policy on command usage in
the QEMU guest agent. A wide variety of commands have been added
for various purposes
* Co-ordinating host mgmt tasks (FS freezing, CPU hotplug,
memory block hotplug)
* Guest information querying (CPU stats, mount info, etc)
* Arbitrary file read/write and command execution
* User account auth setup (passwords, SSH keys)
All of these have valid use cases, but they come with very different
levels of risk to the guest OS.
The commands supporting alteration of user authentication credentials
are giving the guest agent client effectively unrestricted access to
do anything at all in the guest OS by enabling them to subsequently
access a user login shell.
The guest agent client is the host OS, so in effect running the QEMU
guest agent gives the host admin a trivial direct backdoor into the
guest OS.
In the absense of confidential computing, the host admin already has
to be considered largely trustworthy, as they will typically have
direct access to any guest RAM regardless.
None the less, to limit their exposure, guest OS admins may choose
to limit these commands by passing '--no-user-auth' / '-e' to
QGA
The --allowedrpcs / --blockedrpcs arguments take precedence over the
--unrestricted arg (whether present or not), thus allowing fine tuning
the defaults further.
Signed-off-by: Daniel P. Berrangé <[email protected]>
---
qga/main.c | 15 +++++++++++++++
qga/qapi-schema.json | 5 ++++-
2 files changed, 19 insertions(+), 1 deletion(-)
diff --git a/qga/main.c b/qga/main.c
index 66068ad535..0d792cd92e 100644
--- a/qga/main.c
+++ b/qga/main.c
@@ -88,6 +88,7 @@ struct GAConfig {
GList *allowedrpcs;
bool only_confidential;
bool no_unrestricted;
+ bool no_user_auth;
int daemonize;
GLogLevelFlags log_level;
int dumpconf;
@@ -436,6 +437,16 @@ static bool ga_command_is_allowed(const QmpCommand *cmd,
GAState *state)
allowed = false;
}
+ /*
+ * If user auth commands are not allowed that sets
+ * a new default, but an explicit allow/block list can
+ * override
+ */
+ if (config->no_user_auth &&
+ qmp_command_has_feature(cmd, QAPI_FEATURE_USER_AUTH)) {
+ allowed = false;
+ }
+
if (config->allowedrpcs) {
/*
* If an allow-list is given, this changes the fallback
@@ -1220,6 +1231,7 @@ static void config_parse(GAConfig *config, int argc, char
**argv)
{ "retry-path", 0, NULL, 'r' },
{ "confidential", 0, NULL, 'i' },
{ "no-unrestricted", 0, NULL, 'u' },
+ { "no-user-auth", 0, NULL, 'e' },
{ NULL, 0, NULL, 0 }
};
@@ -1322,6 +1334,9 @@ static void config_parse(GAConfig *config, int argc, char
**argv)
case 'u':
config->no_unrestricted = true;
break;
+ case 'e':
+ config->no_user_auth = true;
+ break;
case 'h':
usage(argv[0]);
exit(EXIT_SUCCESS);
diff --git a/qga/qapi-schema.json b/qga/qapi-schema.json
index a4f8653446..25068b8110 100644
--- a/qga/qapi-schema.json
+++ b/qga/qapi-schema.json
@@ -45,7 +45,10 @@
'confidential',
# Commands which allow unrestricted access to or
# modification of guest files or execute arbitrary commands
- 'unrestricted'
+ 'unrestricted',
+ # Commands which allow changes to user account
+ # authentication credentials (keys, passwords)
+ 'user-auth'
] } }
##
--
2.45.1
- [PATCH 05/14] qapi: stop hardcoding list of special features, (continued)
- [PATCH 05/14] qapi: stop hardcoding list of special features, Daniel P . Berrangé, 2024/06/04
- [PATCH 06/14] qapi: define enum for custom special features on commands, Daniel P . Berrangé, 2024/06/04
- [PATCH 04/14] qapi: add a 'command-features' pragma, Daniel P . Berrangé, 2024/06/04
- [PATCH 10/14] qga: add command line to block unrestricted command/file access, Daniel P . Berrangé, 2024/06/04
- [PATCH 12/14] qga: mark guest-exec-* commands with 'unrestricted' flag, Daniel P . Berrangé, 2024/06/04
- [PATCH 08/14] qga: add command line to limit commands for confidential guests, Daniel P . Berrangé, 2024/06/04
- [PATCH 07/14] qga: use special feature to mark those that can run when FS are frozen, Daniel P . Berrangé, 2024/06/04
- [PATCH 09/14] qga: define commands which can be run in confidential mode, Daniel P . Berrangé, 2024/06/04
- [PATCH 11/14] qga: mark guest-file-* commands with 'unrestricted' flag, Daniel P . Berrangé, 2024/06/04
- [PATCH 14/14] qga: mark guest-ssh-* / guest-*-password commands with 'unrestricted' flag, Daniel P . Berrangé, 2024/06/04
- [PATCH 13/14] qga: add command line to block user authentication commands,
Daniel P . Berrangé <=