machined: add GetMachineSSHInfo method

Also adds three properties:
- VsockCid: the VSOCK CID of the VM
- SshAddress: the address of the VM in a format SSH can connect to
- SshPrivateKeyPath: the path to the SSH private key to use to connect
  to the VM.

GetMachineSSHInfo is essentially a convenience method to query both the
SshAddress and SshPrivateKeyPath properties at once.
This commit is contained in:
Sam Leonard
2024-05-08 09:56:42 +01:00
committed by Luca Boccassi
parent 885317f1ab
commit 1f815bf164
6 changed files with 87 additions and 3 deletions
+4
View File
@@ -27,6 +27,7 @@
#include "path-util.h"
#include "process-util.h"
#include "serialize.h"
#include "socket-util.h"
#include "special.h"
#include "stdio-util.h"
#include "string-table.h"
@@ -53,6 +54,7 @@ int machine_new(MachineClass class, const char *name, Machine **ret) {
*m = (Machine) {
.leader = PIDREF_NULL,
.vsock_cid = VMADDR_CID_ANY,
};
if (name) {
@@ -130,6 +132,8 @@ Machine* machine_free(Machine *m) {
free(m->service);
free(m->root_directory);
free(m->netif);
free(m->ssh_address);
free(m->ssh_private_key_path);
return mfree(m);
}