6e7d01
From 4be6cb23235b29d6ce450c2dacaef09c52d1aeea Mon Sep 17 00:00:00 2001
6e7d01
From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= <marcandre.lureau@redhat.com>
6e7d01
Date: Thu, 29 Jul 2021 04:55:52 -0400
6e7d01
Subject: [PATCH 02/14] qga: add ssh-{add, remove}-authorized-keys
6e7d01
MIME-Version: 1.0
6e7d01
Content-Type: text/plain; charset=UTF-8
6e7d01
Content-Transfer-Encoding: 8bit
6e7d01
6e7d01
RH-Author: Marc-André Lureau <marcandre.lureau@redhat.com>
6e7d01
Message-id: <20210609100615.2501448-3-marcandre.lureau@redhat.com>
6e7d01
Patchwork-id: 101688
6e7d01
O-Subject: [RHEL-8.5.0 qemu-kvm PATCH 2/4] qga: add ssh-{add, remove}-authorized-keys
6e7d01
Bugzilla: 1967716
6e7d01
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
6e7d01
RH-Acked-by: Philippe Mathieu-Daudé <philmd@redhat.com>
6e7d01
RH-Acked-by: Michal Privoznik <mprivozn@redhat.com>
6e7d01
6e7d01
From: Marc-André Lureau <marcandre.lureau@redhat.com>
6e7d01
6e7d01
Add new commands to add and remove SSH public keys from
6e7d01
~/.ssh/authorized_keys.
6e7d01
6e7d01
I took a different approach for testing, including the unit tests right
6e7d01
with the code. I wanted to overwrite the function to get the user
6e7d01
details, I couldn't easily do that over QMP. Furthermore, I prefer
6e7d01
having unit tests very close to the code, and unit files that are domain
6e7d01
specific (commands-posix is too crowded already). FWIW, that
6e7d01
coding/testing style is Rust-style (where tests can or should even be
6e7d01
part of the documentation!).
6e7d01
6e7d01
Fixes:
6e7d01
https://bugzilla.redhat.com/show_bug.cgi?id=1885332
6e7d01
6e7d01
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
6e7d01
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
6e7d01
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
6e7d01
*squashed in fix-ups for setting file ownership and use of QAPI
6e7d01
 conditionals for CONFIG_POSIX instead of stub definitions
6e7d01
*disable qga-ssh-test for now due to G_TEST_OPTION_ISOLATE_DIRS
6e7d01
 triggering leak detector in build-oss-fuzz
6e7d01
*fix disallowed g_assert* usage reported by checkpatch
6e7d01
Signed-off-by: Michael Roth <michael.roth@amd.com>
6e7d01
6e7d01
(cherry picked from commit 8d769ec777dccbff199711aba43aa6297fe4a0e0)
6e7d01
[ Fixes trivial backport conflicts and use Makefile.objs build-sys ]
6e7d01
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
6e7d01
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
6e7d01
---
6e7d01
 qga/Makefile.objs        |   2 +-
6e7d01
 qga/commands-posix-ssh.c | 407 +++++++++++++++++++++++++++++++++++++++
6e7d01
 qga/qapi-schema.json     |  35 ++++
6e7d01
 3 files changed, 443 insertions(+), 1 deletion(-)
6e7d01
 create mode 100644 qga/commands-posix-ssh.c
6e7d01
6e7d01
diff --git a/qga/Makefile.objs b/qga/Makefile.objs
6e7d01
index 80e6bb3c2e..c8da634db0 100644
6e7d01
--- a/qga/Makefile.objs
6e7d01
+++ b/qga/Makefile.objs
6e7d01
@@ -1,6 +1,6 @@
6e7d01
 commands-posix.o-libs := $(LIBUDEV_LIBS)
6e7d01
 qga-obj-y = commands.o guest-agent-command-state.o main.o
6e7d01
-qga-obj-$(CONFIG_POSIX) += commands-posix.o channel-posix.o
6e7d01
+qga-obj-$(CONFIG_POSIX) += commands-posix.o channel-posix.o commands-posix-ssh.o
6e7d01
 qga-obj-$(CONFIG_WIN32) += commands-win32.o channel-win32.o service-win32.o
6e7d01
 qga-obj-$(CONFIG_WIN32) += vss-win32.o
6e7d01
 qga-obj-y += qapi-generated/qga-qapi-types.o qapi-generated/qga-qapi-visit.o
6e7d01
diff --git a/qga/commands-posix-ssh.c b/qga/commands-posix-ssh.c
6e7d01
new file mode 100644
6e7d01
index 0000000000..f74d89679c
6e7d01
--- /dev/null
6e7d01
+++ b/qga/commands-posix-ssh.c
6e7d01
@@ -0,0 +1,407 @@
6e7d01
+ /*
6e7d01
+  * This work is licensed under the terms of the GNU GPL, version 2 or later.
6e7d01
+  * See the COPYING file in the top-level directory.
6e7d01
+  */
6e7d01
+#include "qemu/osdep.h"
6e7d01
+
6e7d01
+#include <glib-unix.h>
6e7d01
+#include <glib/gstdio.h>
6e7d01
+#include <locale.h>
6e7d01
+#include <pwd.h>
6e7d01
+
6e7d01
+#include "qapi/error.h"
6e7d01
+#include "qga-qapi-commands.h"
6e7d01
+
6e7d01
+#ifdef QGA_BUILD_UNIT_TEST
6e7d01
+static struct passwd *
6e7d01
+test_get_passwd_entry(const gchar *user_name, GError **error)
6e7d01
+{
6e7d01
+    struct passwd *p;
6e7d01
+    int ret;
6e7d01
+
6e7d01
+    if (!user_name || g_strcmp0(user_name, g_get_user_name())) {
6e7d01
+        g_set_error(error, G_UNIX_ERROR, 0, "Invalid user name");
6e7d01
+        return NULL;
6e7d01
+    }
6e7d01
+
6e7d01
+    p = g_new0(struct passwd, 1);
6e7d01
+    p->pw_dir = (char *)g_get_home_dir();
6e7d01
+    p->pw_uid = geteuid();
6e7d01
+    p->pw_gid = getegid();
6e7d01
+
6e7d01
+    ret = g_mkdir_with_parents(p->pw_dir, 0700);
6e7d01
+    g_assert(ret == 0);
6e7d01
+
6e7d01
+    return p;
6e7d01
+}
6e7d01
+
6e7d01
+#define g_unix_get_passwd_entry_qemu(username, err) \
6e7d01
+   test_get_passwd_entry(username, err)
6e7d01
+#endif
6e7d01
+
6e7d01
+static struct passwd *
6e7d01
+get_passwd_entry(const char *username, Error **errp)
6e7d01
+{
6e7d01
+    g_autoptr(GError) err = NULL;
6e7d01
+    struct passwd *p;
6e7d01
+
6e7d01
+    ERRP_GUARD();
6e7d01
+
6e7d01
+    p = g_unix_get_passwd_entry_qemu(username, &err;;
6e7d01
+    if (p == NULL) {
6e7d01
+        error_setg(errp, "failed to lookup user '%s': %s",
6e7d01
+                   username, err->message);
6e7d01
+        return NULL;
6e7d01
+    }
6e7d01
+
6e7d01
+    return p;
6e7d01
+}
6e7d01
+
6e7d01
+static bool
6e7d01
+mkdir_for_user(const char *path, const struct passwd *p,
6e7d01
+               mode_t mode, Error **errp)
6e7d01
+{
6e7d01
+    ERRP_GUARD();
6e7d01
+
6e7d01
+    if (g_mkdir(path, mode) == -1) {
6e7d01
+        error_setg(errp, "failed to create directory '%s': %s",
6e7d01
+                   path, g_strerror(errno));
6e7d01
+        return false;
6e7d01
+    }
6e7d01
+
6e7d01
+    if (chown(path, p->pw_uid, p->pw_gid) == -1) {
6e7d01
+        error_setg(errp, "failed to set ownership of directory '%s': %s",
6e7d01
+                   path, g_strerror(errno));
6e7d01
+        return false;
6e7d01
+    }
6e7d01
+
6e7d01
+    if (chmod(path, mode) == -1) {
6e7d01
+        error_setg(errp, "failed to set permissions of directory '%s': %s",
6e7d01
+                   path, g_strerror(errno));
6e7d01
+        return false;
6e7d01
+    }
6e7d01
+
6e7d01
+    return true;
6e7d01
+}
6e7d01
+
6e7d01
+static bool
6e7d01
+check_openssh_pub_key(const char *key, Error **errp)
6e7d01
+{
6e7d01
+    ERRP_GUARD();
6e7d01
+
6e7d01
+    /* simple sanity-check, we may want more? */
6e7d01
+    if (!key || key[0] == '#' || strchr(key, '\n')) {
6e7d01
+        error_setg(errp, "invalid OpenSSH public key: '%s'", key);
6e7d01
+        return false;
6e7d01
+    }
6e7d01
+
6e7d01
+    return true;
6e7d01
+}
6e7d01
+
6e7d01
+static bool
6e7d01
+check_openssh_pub_keys(strList *keys, size_t *nkeys, Error **errp)
6e7d01
+{
6e7d01
+    size_t n = 0;
6e7d01
+    strList *k;
6e7d01
+
6e7d01
+    ERRP_GUARD();
6e7d01
+
6e7d01
+    for (k = keys; k != NULL; k = k->next) {
6e7d01
+        if (!check_openssh_pub_key(k->value, errp)) {
6e7d01
+            return false;
6e7d01
+        }
6e7d01
+        n++;
6e7d01
+    }
6e7d01
+
6e7d01
+    if (nkeys) {
6e7d01
+        *nkeys = n;
6e7d01
+    }
6e7d01
+    return true;
6e7d01
+}
6e7d01
+
6e7d01
+static bool
6e7d01
+write_authkeys(const char *path, const GStrv keys,
6e7d01
+               const struct passwd *p, Error **errp)
6e7d01
+{
6e7d01
+    g_autofree char *contents = NULL;
6e7d01
+    g_autoptr(GError) err = NULL;
6e7d01
+
6e7d01
+    ERRP_GUARD();
6e7d01
+
6e7d01
+    contents = g_strjoinv("\n", keys);
6e7d01
+    if (!g_file_set_contents(path, contents, -1, &err)) {
6e7d01
+        error_setg(errp, "failed to write to '%s': %s", path, err->message);
6e7d01
+        return false;
6e7d01
+    }
6e7d01
+
6e7d01
+    if (chown(path, p->pw_uid, p->pw_gid) == -1) {
6e7d01
+        error_setg(errp, "failed to set ownership of directory '%s': %s",
6e7d01
+                   path, g_strerror(errno));
6e7d01
+        return false;
6e7d01
+    }
6e7d01
+
6e7d01
+    if (chmod(path, 0600) == -1) {
6e7d01
+        error_setg(errp, "failed to set permissions of '%s': %s",
6e7d01
+                   path, g_strerror(errno));
6e7d01
+        return false;
6e7d01
+    }
6e7d01
+
6e7d01
+    return true;
6e7d01
+}
6e7d01
+
6e7d01
+static GStrv
6e7d01
+read_authkeys(const char *path, Error **errp)
6e7d01
+{
6e7d01
+    g_autoptr(GError) err = NULL;
6e7d01
+    g_autofree char *contents = NULL;
6e7d01
+
6e7d01
+    ERRP_GUARD();
6e7d01
+
6e7d01
+    if (!g_file_get_contents(path, &contents, NULL, &err)) {
6e7d01
+        error_setg(errp, "failed to read '%s': %s", path, err->message);
6e7d01
+        return NULL;
6e7d01
+    }
6e7d01
+
6e7d01
+    return g_strsplit(contents, "\n", -1);
6e7d01
+
6e7d01
+}
6e7d01
+
6e7d01
+void
6e7d01
+qmp_guest_ssh_add_authorized_keys(const char *username, strList *keys,
6e7d01
+                                  Error **errp)
6e7d01
+{
6e7d01
+    g_autofree struct passwd *p = NULL;
6e7d01
+    g_autofree char *ssh_path = NULL;
6e7d01
+    g_autofree char *authkeys_path = NULL;
6e7d01
+    g_auto(GStrv) authkeys = NULL;
6e7d01
+    strList *k;
6e7d01
+    size_t nkeys, nauthkeys;
6e7d01
+
6e7d01
+    ERRP_GUARD();
6e7d01
+
6e7d01
+    if (!check_openssh_pub_keys(keys, &nkeys, errp)) {
6e7d01
+        return;
6e7d01
+    }
6e7d01
+
6e7d01
+    p = get_passwd_entry(username, errp);
6e7d01
+    if (p == NULL) {
6e7d01
+        return;
6e7d01
+    }
6e7d01
+
6e7d01
+    ssh_path = g_build_filename(p->pw_dir, ".ssh", NULL);
6e7d01
+    authkeys_path = g_build_filename(ssh_path, "authorized_keys", NULL);
6e7d01
+
6e7d01
+    authkeys = read_authkeys(authkeys_path, NULL);
6e7d01
+    if (authkeys == NULL) {
6e7d01
+        if (!g_file_test(ssh_path, G_FILE_TEST_IS_DIR) &&
6e7d01
+            !mkdir_for_user(ssh_path, p, 0700, errp)) {
6e7d01
+            return;
6e7d01
+        }
6e7d01
+    }
6e7d01
+
6e7d01
+    nauthkeys = authkeys ? g_strv_length(authkeys) : 0;
6e7d01
+    authkeys = g_realloc_n(authkeys, nauthkeys + nkeys + 1, sizeof(char *));
6e7d01
+    memset(authkeys + nauthkeys, 0, (nkeys + 1) * sizeof(char *));
6e7d01
+
6e7d01
+    for (k = keys; k != NULL; k = k->next) {
6e7d01
+        if (g_strv_contains((const gchar * const *)authkeys, k->value)) {
6e7d01
+            continue;
6e7d01
+        }
6e7d01
+        authkeys[nauthkeys++] = g_strdup(k->value);
6e7d01
+    }
6e7d01
+
6e7d01
+    write_authkeys(authkeys_path, authkeys, p, errp);
6e7d01
+}
6e7d01
+
6e7d01
+void
6e7d01
+qmp_guest_ssh_remove_authorized_keys(const char *username, strList *keys,
6e7d01
+                                     Error **errp)
6e7d01
+{
6e7d01
+    g_autofree struct passwd *p = NULL;
6e7d01
+    g_autofree char *authkeys_path = NULL;
6e7d01
+    g_autofree GStrv new_keys = NULL; /* do not own the strings */
6e7d01
+    g_auto(GStrv) authkeys = NULL;
6e7d01
+    GStrv a;
6e7d01
+    size_t nkeys = 0;
6e7d01
+
6e7d01
+    ERRP_GUARD();
6e7d01
+
6e7d01
+    if (!check_openssh_pub_keys(keys, NULL, errp)) {
6e7d01
+        return;
6e7d01
+    }
6e7d01
+
6e7d01
+    p = get_passwd_entry(username, errp);
6e7d01
+    if (p == NULL) {
6e7d01
+        return;
6e7d01
+    }
6e7d01
+
6e7d01
+    authkeys_path = g_build_filename(p->pw_dir, ".ssh",
6e7d01
+                                     "authorized_keys", NULL);
6e7d01
+    if (!g_file_test(authkeys_path, G_FILE_TEST_EXISTS)) {
6e7d01
+        return;
6e7d01
+    }
6e7d01
+    authkeys = read_authkeys(authkeys_path, errp);
6e7d01
+    if (authkeys == NULL) {
6e7d01
+        return;
6e7d01
+    }
6e7d01
+
6e7d01
+    new_keys = g_new0(char *, g_strv_length(authkeys) + 1);
6e7d01
+    for (a = authkeys; *a != NULL; a++) {
6e7d01
+        strList *k;
6e7d01
+
6e7d01
+        for (k = keys; k != NULL; k = k->next) {
6e7d01
+            if (g_str_equal(k->value, *a)) {
6e7d01
+                break;
6e7d01
+            }
6e7d01
+        }
6e7d01
+        if (k != NULL) {
6e7d01
+            continue;
6e7d01
+        }
6e7d01
+
6e7d01
+        new_keys[nkeys++] = *a;
6e7d01
+    }
6e7d01
+
6e7d01
+    write_authkeys(authkeys_path, new_keys, p, errp);
6e7d01
+}
6e7d01
+
6e7d01
+
6e7d01
+#ifdef QGA_BUILD_UNIT_TEST
6e7d01
+#if GLIB_CHECK_VERSION(2, 60, 0)
6e7d01
+static const strList test_key2 = {
6e7d01
+    .value = (char *)"algo key2 comments"
6e7d01
+};
6e7d01
+
6e7d01
+static const strList test_key1_2 = {
6e7d01
+    .value = (char *)"algo key1 comments",
6e7d01
+    .next = (strList *)&test_key2,
6e7d01
+};
6e7d01
+
6e7d01
+static char *
6e7d01
+test_get_authorized_keys_path(void)
6e7d01
+{
6e7d01
+    return g_build_filename(g_get_home_dir(), ".ssh", "authorized_keys", NULL);
6e7d01
+}
6e7d01
+
6e7d01
+static void
6e7d01
+test_authorized_keys_set(const char *contents)
6e7d01
+{
6e7d01
+    g_autoptr(GError) err = NULL;
6e7d01
+    g_autofree char *path = NULL;
6e7d01
+    int ret;
6e7d01
+
6e7d01
+    path = g_build_filename(g_get_home_dir(), ".ssh", NULL);
6e7d01
+    ret = g_mkdir_with_parents(path, 0700);
6e7d01
+    g_assert(ret == 0);
6e7d01
+    g_free(path);
6e7d01
+
6e7d01
+    path = test_get_authorized_keys_path();
6e7d01
+    g_file_set_contents(path, contents, -1, &err;;
6e7d01
+    g_assert(err == NULL);
6e7d01
+}
6e7d01
+
6e7d01
+static void
6e7d01
+test_authorized_keys_equal(const char *expected)
6e7d01
+{
6e7d01
+    g_autoptr(GError) err = NULL;
6e7d01
+    g_autofree char *path = NULL;
6e7d01
+    g_autofree char *contents = NULL;
6e7d01
+
6e7d01
+    path = test_get_authorized_keys_path();
6e7d01
+    g_file_get_contents(path, &contents, NULL, &err;;
6e7d01
+    g_assert(err == NULL);
6e7d01
+
6e7d01
+    g_assert(g_strcmp0(contents, expected) == 0);
6e7d01
+}
6e7d01
+
6e7d01
+static void
6e7d01
+test_invalid_user(void)
6e7d01
+{
6e7d01
+    Error *err = NULL;
6e7d01
+
6e7d01
+    qmp_guest_ssh_add_authorized_keys("", NULL, &err;;
6e7d01
+    error_free_or_abort(&err;;
6e7d01
+
6e7d01
+    qmp_guest_ssh_remove_authorized_keys("", NULL, &err;;
6e7d01
+    error_free_or_abort(&err;;
6e7d01
+}
6e7d01
+
6e7d01
+static void
6e7d01
+test_invalid_key(void)
6e7d01
+{
6e7d01
+    strList key = {
6e7d01
+        .value = (char *)"not a valid\nkey"
6e7d01
+    };
6e7d01
+    Error *err = NULL;
6e7d01
+
6e7d01
+    qmp_guest_ssh_add_authorized_keys(g_get_user_name(), &key, &err;;
6e7d01
+    error_free_or_abort(&err;;
6e7d01
+
6e7d01
+    qmp_guest_ssh_remove_authorized_keys(g_get_user_name(), &key, &err;;
6e7d01
+    error_free_or_abort(&err;;
6e7d01
+}
6e7d01
+
6e7d01
+static void
6e7d01
+test_add_keys(void)
6e7d01
+{
6e7d01
+    Error *err = NULL;
6e7d01
+
6e7d01
+    qmp_guest_ssh_add_authorized_keys(g_get_user_name(),
6e7d01
+                                      (strList *)&test_key2, &err;;
6e7d01
+    g_assert(err == NULL);
6e7d01
+
6e7d01
+    test_authorized_keys_equal("algo key2 comments");
6e7d01
+
6e7d01
+    qmp_guest_ssh_add_authorized_keys(g_get_user_name(),
6e7d01
+                                      (strList *)&test_key1_2, &err;;
6e7d01
+    g_assert(err == NULL);
6e7d01
+
6e7d01
+    /*  key2 came first, and should'nt be duplicated */
6e7d01
+    test_authorized_keys_equal("algo key2 comments\n"
6e7d01
+                               "algo key1 comments");
6e7d01
+}
6e7d01
+
6e7d01
+static void
6e7d01
+test_remove_keys(void)
6e7d01
+{
6e7d01
+    Error *err = NULL;
6e7d01
+    static const char *authkeys =
6e7d01
+        "algo key1 comments\n"
6e7d01
+        /* originally duplicated */
6e7d01
+        "algo key1 comments\n"
6e7d01
+        "# a commented line\n"
6e7d01
+        "algo some-key another\n";
6e7d01
+
6e7d01
+    test_authorized_keys_set(authkeys);
6e7d01
+    qmp_guest_ssh_remove_authorized_keys(g_get_user_name(),
6e7d01
+                                         (strList *)&test_key2, &err;;
6e7d01
+    g_assert(err == NULL);
6e7d01
+    test_authorized_keys_equal(authkeys);
6e7d01
+
6e7d01
+    qmp_guest_ssh_remove_authorized_keys(g_get_user_name(),
6e7d01
+                                         (strList *)&test_key1_2, &err;;
6e7d01
+    g_assert(err == NULL);
6e7d01
+    test_authorized_keys_equal("# a commented line\n"
6e7d01
+                               "algo some-key another\n");
6e7d01
+}
6e7d01
+
6e7d01
+int main(int argc, char *argv[])
6e7d01
+{
6e7d01
+    setlocale(LC_ALL, "");
6e7d01
+
6e7d01
+    g_test_init(&argc, &argv, G_TEST_OPTION_ISOLATE_DIRS, NULL);
6e7d01
+
6e7d01
+    g_test_add_func("/qga/ssh/invalid_user", test_invalid_user);
6e7d01
+    g_test_add_func("/qga/ssh/invalid_key", test_invalid_key);
6e7d01
+    g_test_add_func("/qga/ssh/add_keys", test_add_keys);
6e7d01
+    g_test_add_func("/qga/ssh/remove_keys", test_remove_keys);
6e7d01
+
6e7d01
+    return g_test_run();
6e7d01
+}
6e7d01
+#else
6e7d01
+int main(int argc, char *argv[])
6e7d01
+{
6e7d01
+    g_test_message("test skipped, needs glib >= 2.60");
6e7d01
+    return 0;
6e7d01
+}
6e7d01
+#endif /* GLIB_2_60 */
6e7d01
+#endif /* BUILD_UNIT_TEST */
6e7d01
diff --git a/qga/qapi-schema.json b/qga/qapi-schema.json
6e7d01
index 4222cb92d3..3b85f5a03f 100644
6e7d01
--- a/qga/qapi-schema.json
6e7d01
+++ b/qga/qapi-schema.json
6e7d01
@@ -1273,3 +1273,38 @@
6e7d01
 ##
6e7d01
 { 'command': 'guest-get-osinfo',
6e7d01
   'returns': 'GuestOSInfo' }
6e7d01
+
6e7d01
+##
6e7d01
+# @guest-ssh-add-authorized-keys:
6e7d01
+#
6e7d01
+# @username: the user account to add the authorized keys
6e7d01
+# @keys: the public keys to add (in OpenSSH/sshd(8) authorized_keys format)
6e7d01
+#
6e7d01
+# Append public keys to user .ssh/authorized_keys on Unix systems (not
6e7d01
+# implemented for other systems).
6e7d01
+#
6e7d01
+# Returns: Nothing on success.
6e7d01
+#
6e7d01
+# Since: 5.2
6e7d01
+##
6e7d01
+{ 'command': 'guest-ssh-add-authorized-keys',
6e7d01
+  'data': { 'username': 'str', 'keys': ['str'] },
6e7d01
+  'if': 'defined(CONFIG_POSIX)' }
6e7d01
+
6e7d01
+##
6e7d01
+# @guest-ssh-remove-authorized-keys:
6e7d01
+#
6e7d01
+# @username: the user account to remove the authorized keys
6e7d01
+# @keys: the public keys to remove (in OpenSSH/sshd(8) authorized_keys format)
6e7d01
+#
6e7d01
+# Remove public keys from the user .ssh/authorized_keys on Unix systems (not
6e7d01
+# implemented for other systems). It's not an error if the key is already
6e7d01
+# missing.
6e7d01
+#
6e7d01
+# Returns: Nothing on success.
6e7d01
+#
6e7d01
+# Since: 5.2
6e7d01
+##
6e7d01
+{ 'command': 'guest-ssh-remove-authorized-keys',
6e7d01
+  'data': { 'username': 'str', 'keys': ['str'] },
6e7d01
+  'if': 'defined(CONFIG_POSIX)' }
6e7d01
-- 
6e7d01
2.27.0
6e7d01