mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-22 04:25:18 +00:00
Added a no_tty param to remote URIs to stop SSH prompting for password
This commit is contained in:
parent
6f44e36e15
commit
b32f429849
@ -1,3 +1,9 @@
|
||||
Fri Sep 21 16:22:00 EST 2007 Daniel P. Berrange <berrange@redhat.com>
|
||||
|
||||
* src/remote_internal.c: Add a no_tty flag to stop SSH prompting
|
||||
for passwords on console
|
||||
* docs/libvir.html, docs/remote.html: Document no_tty flag
|
||||
|
||||
Fri Sep 21 15:06:00 EST 2007 Daniel P. Berrange <berrange@redhat.com>
|
||||
|
||||
* acinclude.m4: Check all compiler flags link successfully
|
||||
|
@ -1762,6 +1762,20 @@ Note that parameter values must be
|
||||
<td> Example: <code>no_verify=1</code> </td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td> <code>no_tty</code> </td>
|
||||
<td> ssh </td>
|
||||
<td>
|
||||
If set to a non-zero value, this stops ssh from asking for
|
||||
a password if it cannot log in to the remote machine automatically
|
||||
(eg. using ssh-agent etc.). Use this when you don't have access
|
||||
to a terminal - for example in graphical programs which use libvirt.
|
||||
</td>
|
||||
</tr>
|
||||
<tr> <td colspan="2"></td>
|
||||
<td> Example: <code>no_tty=1</code> </td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
|
||||
<h3><a name="Remote_certificates">Generating TLS certificates</a></h3>
|
||||
|
@ -195,6 +195,16 @@ Note that parameter values must be
|
||||
</td>
|
||||
</tr><tr><td colspan="2"></td>
|
||||
<td> Example: <code>no_verify=1</code> </td>
|
||||
</tr><tr><td> <code>no_tty</code> </td>
|
||||
<td> ssh </td>
|
||||
<td>
|
||||
If set to a non-zero value, this stops ssh from asking for
|
||||
a password if it cannot log in to the remote machine automatically
|
||||
(eg. using ssh-agent etc.). Use this when you don't have access
|
||||
to a terminal - for example in graphical programs which use libvirt.
|
||||
</td>
|
||||
</tr><tr><td colspan="2"></td>
|
||||
<td> Example: <code>no_tty=1</code> </td>
|
||||
</tr></table><h3><a name="Remote_certificates" id="Remote_certificates">Generating TLS certificates</a></h3><h4><a name="Remote_PKI" id="Remote_PKI">Public Key Infrastructure set up</a></h4><p>
|
||||
If you are unsure how to create TLS certificates, skip to the
|
||||
next section.
|
||||
|
@ -291,7 +291,7 @@ doRemoteOpen (virConnectPtr conn, struct private_data *priv, const char *uri_str
|
||||
*/
|
||||
char *name = 0, *command = 0, *sockname = 0, *netcat = 0, *username = 0;
|
||||
char *server = 0, *port = 0;
|
||||
int no_verify = 0;
|
||||
int no_verify = 0, no_tty = 0;
|
||||
char **cmd_argv = 0;
|
||||
|
||||
/* Return code from this function, and the private data. */
|
||||
@ -356,6 +356,9 @@ doRemoteOpen (virConnectPtr conn, struct private_data *priv, const char *uri_str
|
||||
} else if (strcasecmp (var->name, "no_verify") == 0) {
|
||||
no_verify = atoi (var->value);
|
||||
var->ignore = 1;
|
||||
} else if (strcasecmp (var->name, "no_tty") == 0) {
|
||||
no_tty = atoi (var->value);
|
||||
var->ignore = 1;
|
||||
}
|
||||
#if DEBUG
|
||||
else
|
||||
@ -554,7 +557,10 @@ doRemoteOpen (virConnectPtr conn, struct private_data *priv, const char *uri_str
|
||||
}
|
||||
|
||||
case trans_ssh: {
|
||||
int j, nr_args = username ? 10 : 8;
|
||||
int j, nr_args = 8;
|
||||
|
||||
if (username) nr_args += 2; /* For -l username */
|
||||
if (no_tty) nr_args += 5; /* For -T -o BatchMode=yes -e none */
|
||||
|
||||
command = command ? : strdup ("ssh");
|
||||
|
||||
@ -569,6 +575,13 @@ doRemoteOpen (virConnectPtr conn, struct private_data *priv, const char *uri_str
|
||||
cmd_argv[j++] = strdup ("-l");
|
||||
cmd_argv[j++] = strdup (username);
|
||||
}
|
||||
if (no_tty) {
|
||||
cmd_argv[j++] = strdup ("-T");
|
||||
cmd_argv[j++] = strdup ("-o");
|
||||
cmd_argv[j++] = strdup ("BatchMode=yes");
|
||||
cmd_argv[j++] = strdup ("-e");
|
||||
cmd_argv[j++] = strdup ("none");
|
||||
}
|
||||
cmd_argv[j++] = strdup (server);
|
||||
cmd_argv[j++] = strdup (netcat ? netcat : "nc");
|
||||
cmd_argv[j++] = strdup ("-U");
|
||||
|
Loading…
x
Reference in New Issue
Block a user