<td colspan="2"/>
<td> Example: <code>netcat=/opt/netcat/bin/nc</code> </td>
</tr>
+
+ <tr>
+ <td>
+ <code>keyfile</code>
+ </td>
+ <td> ssh </td>
+ <td>
+ The name of the private key file to use to authentication to the remote
+ machine. If this option is not used the default keys are used.
+ </td>
+ </tr>
+ <tr>
+ <td colspan="2"/>
+ <td> Example: <code>keyfile=/root/.ssh/example_key</code> </td>
+ </tr>
+
<tr>
<td>
<code>no_verify</code>
char *name = NULL, *command = NULL, *sockname = NULL, *netcat = NULL;
char *port = NULL, *authtype = NULL, *username = NULL;
int no_verify = 0, no_tty = 0;
- char *pkipath = NULL;
+ char *pkipath = NULL, *keyfile = NULL;
/* Return code from this function, and the private data. */
int retcode = VIR_DRV_OPEN_ERROR;
netcat = strdup (var->value);
if (!netcat) goto out_of_memory;
var->ignore = 1;
+ } else if (STRCASEEQ (var->name, "keyfile")) {
+ VIR_FREE(keyfile);
+ keyfile = strdup (var->value);
+ if (!keyfile) goto out_of_memory;
+ var->ignore = 1;
} else if (STRCASEEQ (var->name, "no_verify")) {
no_verify = atoi (var->value);
var->ignore = 1;
no_tty,
no_verify,
netcat ? netcat : "nc",
+ keyfile,
sockname)))
goto failed;
VIR_FREE(sockname);
VIR_FREE(authtype);
VIR_FREE(netcat);
+ VIR_FREE(keyfile);
VIR_FREE(username);
VIR_FREE(port);
VIR_FREE(pkipath);
bool noTTY,
bool noVerify,
const char *netcat,
+ const char *keyfile,
const char *path)
{
virNetSocketPtr sock;
- if (virNetSocketNewConnectSSH(nodename, service, binary, username, noTTY, noVerify, netcat, path, &sock) < 0)
+ if (virNetSocketNewConnectSSH(nodename, service, binary, username, noTTY,
+ noVerify, netcat, keyfile, path, &sock) < 0)
return NULL;
return virNetClientNew(sock, NULL);
bool noTTY,
bool noVerify,
const char *netcat,
+ const char *keyfile,
const char *path);
virNetClientPtr virNetClientNewExternal(const char **cmdargv);
bool noTTY,
bool noVerify,
const char *netcat,
+ const char *keyfile,
const char *path,
virNetSocketPtr *retsock)
{
virCommandAddArgList(cmd, "-p", service, NULL);
if (username)
virCommandAddArgList(cmd, "-l", username, NULL);
+ if (keyfile)
+ virCommandAddArgList(cmd, "-i", keyfile, NULL);
if (noTTY)
virCommandAddArgList(cmd, "-T", "-o", "BatchMode=yes",
"-e", "none", NULL);
bool noTTY,
bool noVerify,
const char *netcat,
+ const char *keyfile,
const char *path,
virNetSocketPtr *addr);
bool noTTY;
bool noVerify;
const char *netcat;
+ const char *keyfile;
const char *path;
const char *expectOut;
data->noTTY,
data->noVerify,
data->netcat,
+ data->keyfile,
data->path,
&csock) < 0)
goto cleanup;
if (virtTestRun("SSH test 5", 1, testSocketSSH, &sshData5) < 0)
ret = -1;
+ struct testSSHData sshData6 = {
+ .nodename = "example.com",
+ .path = "/tmp/socket",
+ .keyfile = "/root/.ssh/example_key",
+ .noVerify = true,
+ .expectOut = "-i /root/.ssh/example_key -o StrictHostKeyChecking=no example.com nc -U /tmp/socket\n",
+ };
+ if (virtTestRun("SSH test 6", 1, testSocketSSH, &sshData6) < 0)
+ ret = -1;
+
#endif
return (ret==0 ? EXIT_SUCCESS : EXIT_FAILURE);