qga: add ssh-{add,remove}-authorized-keys
commit8d769ec777dccbff199711aba43aa6297fe4a0e0
authorMarc-André Lureau <marcandre.lureau@redhat.com>
Tue, 20 Oct 2020 08:12:52 +0000 (20 12:12 +0400)
committerMichael Roth <michael.roth@amd.com>
Tue, 3 Nov 2020 01:58:15 +0000 (2 19:58 -0600)
tree4b2cd07e60b695ac8a3d55c4b82871b2a68211b2
parent6d593ab451c490b0ca941c6a519894231634751e
qga: add ssh-{add,remove}-authorized-keys

Add new commands to add and remove SSH public keys from
~/.ssh/authorized_keys.

I took a different approach for testing, including the unit tests right
with the code. I wanted to overwrite the function to get the user
details, I couldn't easily do that over QMP. Furthermore, I prefer
having unit tests very close to the code, and unit files that are domain
specific (commands-posix is too crowded already). FWIW, that
coding/testing style is Rust-style (where tests can or should even be
part of the documentation!).

Fixes:
https://bugzilla.redhat.com/show_bug.cgi?id=1885332

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
*squashed in fix-ups for setting file ownership and use of QAPI
 conditionals for CONFIG_POSIX instead of stub definitions
*disable qga-ssh-test for now due to G_TEST_OPTION_ISOLATE_DIRS
 triggering leak detector in build-oss-fuzz
*fix disallowed g_assert* usage reported by checkpatch
Signed-off-by: Michael Roth <michael.roth@amd.com>
qga/commands-posix-ssh.c [new file with mode: 0644]
qga/meson.build
qga/qapi-schema.json