]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
Added a no_tty param to remote URIs to stop SSH prompting for password
authorDaniel P. Berrange <berrange@redhat.com>
Fri, 21 Sep 2007 20:17:09 +0000 (20:17 +0000)
committerDaniel P. Berrange <berrange@redhat.com>
Fri, 21 Sep 2007 20:17:09 +0000 (20:17 +0000)
ChangeLog
docs/libvir.html
docs/remote.html
src/remote_internal.c

index 1be07f2234a5a67d00d9bacf25aff3f9c92498b1..2763f79dc8afb2644bbf8cbf76147f49de4dd031 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -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 
index e5382bb2ccedb8a474cf5168e5df40929bb6d21c..9e0276c886be386ddc32113ecd6729a4332a4ea2 100644 (file)
@@ -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>
index 976fd5682fdd88e70a2c06ffba874f105a2430bd..7598a268828362209811209b97d84d173e1125f3 100644 (file)
@@ -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.
index 6eb896ffe564f59f49da55a488b76d981845cf41..d567374d4b25433715111a47ba226676873c9394 100644 (file)
@@ -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");