]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
machine: extend io.systemd.Machine.List output with sshPrivateKeyPath field
authorIvan Kruglov <mail@ikruglov.com>
Tue, 24 Sep 2024 08:21:46 +0000 (10:21 +0200)
committerIvan Kruglov <mail@ikruglov.com>
Mon, 7 Oct 2024 12:50:16 +0000 (14:50 +0200)
Effectivelly, this is an implementation of GetMachineSSHInfo in dbus.

src/machine/machined-varlink.c
src/shared/varlink-io.systemd.Machine.c

index 6011780b6ffabafebffcad385e3e40de1408b5ee..6100024174197b7916f40570cc586b667279c04f 100644 (file)
@@ -406,7 +406,8 @@ static int list_machine_one(sd_varlink *link, Machine *m, bool more) {
                         SD_JSON_BUILD_PAIR_CONDITION(pidref_is_set(&m->leader), "leader", SD_JSON_BUILD_UNSIGNED(m->leader.pid)),
                         SD_JSON_BUILD_PAIR_CONDITION(dual_timestamp_is_set(&m->timestamp), "timestamp", JSON_BUILD_DUAL_TIMESTAMP(&m->timestamp)),
                         SD_JSON_BUILD_PAIR_CONDITION(m->vsock_cid != VMADDR_CID_ANY, "vSockCid", SD_JSON_BUILD_UNSIGNED(m->vsock_cid)),
-                        JSON_BUILD_PAIR_STRING_NON_EMPTY("sshAddress", m->ssh_address));
+                        JSON_BUILD_PAIR_STRING_NON_EMPTY("sshAddress", m->ssh_address),
+                        JSON_BUILD_PAIR_STRING_NON_EMPTY("sshPrivateKeyPath", m->ssh_private_key_path));
         if (r < 0)
                 return r;
 
index dfcf210b8a28eb8a781cc253712b758e0a9fd107..7a18f34df16096db515ef4696ad1dd506e71cde6 100644 (file)
@@ -73,7 +73,9 @@ static SD_VARLINK_DEFINE_METHOD_FULL(
                 SD_VARLINK_FIELD_COMMENT("AF_VSOCK CID of the machine if known and applicable"),
                 SD_VARLINK_DEFINE_OUTPUT(vSockCid, SD_VARLINK_INT, SD_VARLINK_NULLABLE),
                 SD_VARLINK_FIELD_COMMENT("SSH address to connect to"),
-                SD_VARLINK_DEFINE_OUTPUT(sshAddress, SD_VARLINK_STRING, SD_VARLINK_NULLABLE));
+                SD_VARLINK_DEFINE_OUTPUT(sshAddress, SD_VARLINK_STRING, SD_VARLINK_NULLABLE),
+                SD_VARLINK_FIELD_COMMENT("Path to private SSH key"),
+                SD_VARLINK_DEFINE_OUTPUT(sshPrivateKeyPath, SD_VARLINK_STRING, SD_VARLINK_NULLABLE));
 
 static SD_VARLINK_DEFINE_ERROR(NoSuchMachine);
 static SD_VARLINK_DEFINE_ERROR(MachineExists);