]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
virsh: secret: Print warning that passing secret on command-line is insecure
authorPeter Krempa <pkrempa@redhat.com>
Fri, 24 Jan 2020 15:16:27 +0000 (16:16 +0100)
committerPeter Krempa <pkrempa@redhat.com>
Tue, 28 Jan 2020 17:09:57 +0000 (18:09 +0100)
Print a warning if users pass in secrets as command line arguments and
mention it in the man page.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
docs/manpages/virsh.rst
tools/virsh-secret.c

index a7551b970933c803e07ce5eba97be8ae5aea7681..823f130f1ce98b42eec982565a7825e93d4939df 100644 (file)
@@ -6571,6 +6571,9 @@ Base64-encoded value *base64* or Base-64-encoded contents of file named
 
 Note that *--file* and *base64* options are mutually exclusive.
 
+Passing secrets via the *base64* option on command line is INSECURE and
+deprecated. Use the *--file* option instead.
+
 
 secret-get-value
 ----------------
index 66852173b5b169d8e16fb5955daa5a48296c9a61..0ca08bc1331637669399f042c6babb5842ef183c 100644 (file)
@@ -217,6 +217,10 @@ cmdSecretSetValue(vshControl *ctl, const vshCmd *cmd)
         return false;
     }
 
+    /* warn users that the --base64 option passed from command line is wrong */
+    if (base64)
+        vshError(ctl, _("Passing secret value as command-line argument is insecure!"));
+
     if (filename) {
         ssize_t read_ret;
         if ((read_ret = virFileReadAll(filename, 1024, &file_buf)) < 0) {