Onedb hidden password


(Jean Sébastien Frerot) #1

Hi,
I’m trying to automate opennebula DB backup. I was wondering if there is a way to load the credentials from some config file when using “onedb backup”. For the moment I know only the way of specifying the username/password on the command line and this is not very secure as password appears in process list and in the bash logs.

Thank you.


(Anton Todorov) #2

Hi,

The following patch to onedb enable using a shell variable named ONE_DB_PASSWORD for the database password:

--- /usr/lib/one/ruby/onedb/onedb.rb.orig	2018-10-15 17:45:31.189788519 +0300
+++ /usr/lib/one/ruby/onedb/onedb.rb	2018-10-15 17:42:01.375619618 +0300
@@ -44,6 +44,9 @@
 
             passwd = ops[:passwd]
             if !passwd
+                passwd = ENV['ONE_DB_PASSWORD']
+            end
+            if !passwd
                 passwd = get_password
             end

If this helps please open a feature request issue to move such patch upstream.

Best Regards,
Anton Todorov