You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@uima.apache.org by de...@apache.org on 2016/05/24 14:09:53 UTC

svn commit: r1745365 - in /uima/sandbox/uima-ducc/trunk: src/main/admin/ uima-ducc-duccdocs/src/site/tex/duccbook/part4/ uima-ducc-duccdocs/src/site/tex/duccbook/part4/admin/ uima-ducc-duccdocs/src/site/tex/duccbook/part5/

Author: degenaro
Date: Tue May 24 14:09:53 2016
New Revision: 1745365

URL: http://svn.apache.org/viewvc?rev=1745365&view=rev
Log:
UIMA-4926 No need to prompt for passwords when installing DUCC

2. db_password 

- make database password randomly generated by ducc_post_install
- update DUCC Book too

Modified:
    uima/sandbox/uima-ducc/trunk/src/main/admin/db_create
    uima/sandbox/uima-ducc/trunk/src/main/admin/ducc_post_install
    uima/sandbox/uima-ducc/trunk/src/main/admin/ducc_util.py
    uima/sandbox/uima-ducc/trunk/uima-ducc-duccdocs/src/site/tex/duccbook/part4/admin/admin-commands.tex
    uima/sandbox/uima-ducc/trunk/uima-ducc-duccdocs/src/site/tex/duccbook/part4/admin/ducc-database.tex
    uima/sandbox/uima-ducc/trunk/uima-ducc-duccdocs/src/site/tex/duccbook/part4/admin/ducc-properties.tex
    uima/sandbox/uima-ducc/trunk/uima-ducc-duccdocs/src/site/tex/duccbook/part4/install.tex
    uima/sandbox/uima-ducc/trunk/uima-ducc-duccdocs/src/site/tex/duccbook/part5/ducc-pops-component-database.tex

Modified: uima/sandbox/uima-ducc/trunk/src/main/admin/db_create
URL: http://svn.apache.org/viewvc/uima/sandbox/uima-ducc/trunk/src/main/admin/db_create?rev=1745365&r1=1745364&r2=1745365&view=diff
==============================================================================
--- uima/sandbox/uima-ducc/trunk/src/main/admin/db_create (original)
+++ uima/sandbox/uima-ducc/trunk/src/main/admin/db_create Tue May 24 14:09:53 2016
@@ -113,7 +113,7 @@ class DbCreate(DuccUtil):
             private_properties = Properties()
             private_properties.load(private_props_name)
             private_properties.delete('db_password')
-            private_properties.put('db_password', self.database_pw, ['#Db password']);
+            private_properties.put('db_password', self.database_pw, ['#Db password, default is randomly generated']);
             private_properties.write(private_props_name)
 
         # remerge to insure it's all correct and ready to go

Modified: uima/sandbox/uima-ducc/trunk/src/main/admin/ducc_post_install
URL: http://svn.apache.org/viewvc/uima/sandbox/uima-ducc/trunk/src/main/admin/ducc_post_install?rev=1745365&r1=1745364&r2=1745365&view=diff
==============================================================================
--- uima/sandbox/uima-ducc/trunk/src/main/admin/ducc_post_install (original)
+++ uima/sandbox/uima-ducc/trunk/src/main/admin/ducc_post_install Tue May 24 14:09:53 2016
@@ -108,13 +108,7 @@ class PostInstall():
             print 'Database is already defined.  Not configuring'
             return
 
-        if ( self.database_pw == None ):
-            db_pw = raw_input("Enter database password OR 'bypass' to disable database support:")
-            if ( db_pw == '' ):
-                print "Must enter a DB password to continue."
-                sys.exit(1);
-        else:
-            db_pw = self.database_pw
+        db_pw = self.get_pw(self.database_pw)
 
         if ( db_pw == 'bypass' ):
             print 'Database support will be disabled'
@@ -130,20 +124,16 @@ class PostInstall():
             self.update_property('ducc.rm.persistence.impl', 'org.apache.uima.ducc.database.RmStatePersistence', '# RM state persistence')
 
             self.ducc_private_properties.delete('db_password')
-            self.ducc_private_properties.put('db_password', db_pw, ['#Db password']);
+            self.ducc_private_properties.put('db_password', db_pw, ['#Db password, default is randomly generated']);
 
 
         return
 
-    def generate_pw(self, pwlen):
-        reply = ''.join([random.choice(string.ascii_letters + string.digits) for n in xrange(pwlen)])
-        return reply
-        
-    def get_keystore_pw(self, prompt):
-        if ( self.keystore_pw == None ):
-            reply = self.generate_pw(32)
-        else:    
-            reply = self.keystore_pw
+    def get_pw(self, given):
+        reply = given
+        if ( given == None ):
+            pwlen = random.randrange(8,16)
+            reply = ''.join([random.choice(string.ascii_letters + string.digits) for n in xrange(pwlen)])
         return reply
 
     def create_keystore(self, keytool):
@@ -169,7 +159,7 @@ class PostInstall():
         rc = 1
         reply = ''
         while ( rc != 0 ):
-            reply = self.get_keystore_pw(reply)
+            reply = self.get_pw(self.keystore_pw)
 
             cmd = keytool
             cmd += ' '

Modified: uima/sandbox/uima-ducc/trunk/src/main/admin/ducc_util.py
URL: http://svn.apache.org/viewvc/uima/sandbox/uima-ducc/trunk/src/main/admin/ducc_util.py?rev=1745365&r1=1745364&r2=1745365&view=diff
==============================================================================
--- uima/sandbox/uima-ducc/trunk/src/main/admin/ducc_util.py (original)
+++ uima/sandbox/uima-ducc/trunk/src/main/admin/ducc_util.py Tue May 24 14:09:53 2016
@@ -41,7 +41,7 @@ from local_hooks import find_other_proce
 try:
     os.getcwd()
 except:
-    print "ERROR getting current directory ... may have been replaced .. tryin cd'ing to it again"
+    print "ERROR getting current directory ... may have been replaced .. try cd'ing to it again"
     sys.exit(1)
 
 # simple bootstrap to establish DUCC_HOME and to set the python path so it can
@@ -180,7 +180,7 @@ class DuccUtil(DuccBase):
         dbprops.load(self.DUCC_HOME + '/resources.private/ducc.private.properties')
         self.db_password = dbprops.get('db_password')
         if ( self.db_password == None ):
-            print "bypassing database becase no password is set."
+            print "bypassing database because no password is set."
             self.db_bypass = True
 
     # does the database process exist?  

Modified: uima/sandbox/uima-ducc/trunk/uima-ducc-duccdocs/src/site/tex/duccbook/part4/admin/admin-commands.tex
URL: http://svn.apache.org/viewvc/uima/sandbox/uima-ducc/trunk/uima-ducc-duccdocs/src/site/tex/duccbook/part4/admin/admin-commands.tex?rev=1745365&r1=1745364&r2=1745365&view=diff
==============================================================================
--- uima/sandbox/uima-ducc/trunk/uima-ducc-duccdocs/src/site/tex/duccbook/part4/admin/admin-commands.tex (original)
+++ uima/sandbox/uima-ducc/trunk/uima-ducc-duccdocs/src/site/tex/duccbook/part4/admin/admin-commands.tex Tue May 24 14:09:53 2016
@@ -630,15 +630,14 @@ Nodepool power
           \item Starts the database.
           \item Disables the default database superuser.
           \item Installs a database superuser as ``ducc'' and sets the password
-            to a password of your choice, which you are prompted for.  The password is saved
+            to a random string.  The password is saved
             in DUCC\_HOME/resources.private/ducc.private.properties.
           \item Installs the DUCC database schema.
           \item Stops the database.
         \end{enumerate}
         
 
-         This command takes no parameters.  It prompts interactively for your desired
-         database superuser password.  
+         This command takes no parameters.
 
          NOTE: The database user and password are NOT RELATED to any login ID on the system,
          they are used and maintained by the database only.

Modified: uima/sandbox/uima-ducc/trunk/uima-ducc-duccdocs/src/site/tex/duccbook/part4/admin/ducc-database.tex
URL: http://svn.apache.org/viewvc/uima/sandbox/uima-ducc/trunk/uima-ducc-duccdocs/src/site/tex/duccbook/part4/admin/ducc-database.tex?rev=1745365&r1=1745364&r2=1745365&view=diff
==============================================================================
--- uima/sandbox/uima-ducc/trunk/uima-ducc-duccdocs/src/site/tex/duccbook/part4/admin/ducc-database.tex (original)
+++ uima/sandbox/uima-ducc/trunk/uima-ducc-duccdocs/src/site/tex/duccbook/part4/admin/ducc-database.tex Tue May 24 14:09:53 2016
@@ -26,15 +26,9 @@
 
    \subsection{Overview}
 
-    During first-time installaion, the \hyperref[subsec:install.single-user]{\em ducc\_post\_install} utility
-    prompts for a (database) super-user password.  If a password is provided, the utility 
-    proceeds to configure the database and install the schema.  If a password
-    of ``bypass'' is given, database installation is bypassed and the file system
-    is used for history and services.  The Resource Manager does not attempt to
-    persist its state in the filesystem.
-    
-    If database integration is bypased during \hyperref[subsec:install.single-user]{\em ducc\_post\_install}, it may be
-    installed later with the utilities \hyperref[subsec:cli.db.create]{\em db\_create} and \hyperref[subsec:cli.db.loader]{\em db\_loader}.
+    During first-time installation, the \hyperref[subsec:install.single-user]{\em ducc\_post\_install} utility
+    randomly generates a (database) super-user password, which is kept in the protected file {\em DUCC\_HOME/resources.private/ducc.private.properties}.
+    The utility proceeds to configure the database and install the schema.
 
     If DUCC is being upgraded, generally \hyperref[subsec:install.single-user]{\em ducc\_post\_install} is not used, in 
     which case, again, \hyperref[subsec:cli.db.create]{\em db\_create} and \hyperref[subsec:cli.db.loader]{\em db\_loader} may be used to
@@ -55,7 +49,7 @@
     \end{enumerate}
     
     \subsubsection{Service Manager use of the Database}
-    The service manager uses the database to store the service registy and all state
+    The service manager uses the database to store the service registry and all state
     of active services.  Prior to the database, this data was saved in Java properties files
     in the directory {\em DUCC\_HOME/state/services}.
 
@@ -70,7 +64,7 @@
 
     \subsubsection{Webserver use of the Database}
     The web server uses the database in read-only mode to fetch work history, service
-    registrations, and node status.  Previosly to the database most of this information
+    registrations, and node status.  Previously to the database most of this information
     was fetched from the filesystem.  Node status was inferred using the Agent publications;
     with the database, the webserver has direct access to the Resource Manager's view of the
     DUCC nodes, providing a much more accurate picture of the system.
@@ -88,14 +82,14 @@
         main DUCC super user ID.  Note that database IDs are in no way related to 
         operating system IDs.
       \item[db\_loader] The \hyperref[subsec:cli.db.loader]{db\_loader} utility migrates an existing file-based DUCC
-        system to use the database.  It copies in the job history, orchestrator checkpoint,
+        system to use the database.  It copies in the job history, Orchestrator checkpoint,
         and the service registry.
     \end{description}
       
     Use the cross-references above for additional details on the utilities.
     
 \subsection{Database Configuration}
-    Most database configuration is accomplished by setting approriate values into 
+    Most database configuration is accomplished by setting appropriate values into 
     your local \hyperref[subsec:ducc.database.properties]{\em site.ducc.properties}.  See
     the linked section for details.
     

Modified: uima/sandbox/uima-ducc/trunk/uima-ducc-duccdocs/src/site/tex/duccbook/part4/admin/ducc-properties.tex
URL: http://svn.apache.org/viewvc/uima/sandbox/uima-ducc/trunk/uima-ducc-duccdocs/src/site/tex/duccbook/part4/admin/ducc-properties.tex?rev=1745365&r1=1745364&r2=1745365&view=diff
==============================================================================
--- uima/sandbox/uima-ducc/trunk/uima-ducc-duccdocs/src/site/tex/duccbook/part4/admin/ducc-properties.tex (original)
+++ uima/sandbox/uima-ducc/trunk/uima-ducc-duccdocs/src/site/tex/duccbook/part4/admin/ducc-properties.tex Tue May 24 14:09:53 2016
@@ -1825,7 +1825,7 @@ org.apache.uima.ducc.common.persistence.
           This is the password used to generate the Web Server's keystore used for HTTPS requests.  Usually
           this keystore is created at initial installation time using \hyperref[subsec:install.single-user]{ducc\_post\_install.}
           \begin{description}
-            \item[Default Value] randomly generated at install time 
+            \item[Default Value] Randomly generated at install time. 
             \item[Type] Local
           \end{description}
     \end{description}    
@@ -1837,11 +1837,11 @@ org.apache.uima.ducc.common.persistence.
     
         \item[db\_password] \hfill \\
           This is the database superuser password.  It is set during {\em ducc\_post\_install} or {\em db\_create}.  Both
-          these procedures prompt for the password.  There is no default; the value must be supplied by the DUCC administrator.
+          these procedures randomly generate the password.
 
           NOTE: The database superuser ID is always ``ducc'', and is set during database installation.
           \begin{description}
-            \item[Default Value] None, must be set by the administrator.
+            \item[Default Value] Randomly generated at install time.
             \item[Type] Local
           \end{description}
     \end{description}    

Modified: uima/sandbox/uima-ducc/trunk/uima-ducc-duccdocs/src/site/tex/duccbook/part4/install.tex
URL: http://svn.apache.org/viewvc/uima/sandbox/uima-ducc/trunk/uima-ducc-duccdocs/src/site/tex/duccbook/part4/install.tex?rev=1745365&r1=1745364&r2=1745365&view=diff
==============================================================================
--- uima/sandbox/uima-ducc/trunk/uima-ducc-duccdocs/src/site/tex/duccbook/part4/install.tex (original)
+++ uima/sandbox/uima-ducc/trunk/uima-ducc-duccdocs/src/site/tex/duccbook/part4/install.tex Tue May 24 14:09:53 2016
@@ -226,9 +226,7 @@ The post-installation script performs th
     \item Verifies that the correct level of Java and Python are installed and available.
     \item Creates a default nodelist, \duccruntime/resources/ducc.nodes, containing the name of the node you are installing on.
     \item Defines the ``ducc head'' node to be to node you are installing from.
-    \item Initializes the database. A prompt for the database password is given; to bypass
-      database installation give the password {\em bypass}. (The database can be installed
-      at a later date.)
+    \item Initializes the database.
     \item Sets up the default https keystore for the webserver.
     \item Installs the DUCC documentation ``ducc book'' into the DUCC webserver root.
     \item Builds and installs the C program, ``ducc\_ling'', into the default location.

Modified: uima/sandbox/uima-ducc/trunk/uima-ducc-duccdocs/src/site/tex/duccbook/part5/ducc-pops-component-database.tex
URL: http://svn.apache.org/viewvc/uima/sandbox/uima-ducc/trunk/uima-ducc-duccdocs/src/site/tex/duccbook/part5/ducc-pops-component-database.tex?rev=1745365&r1=1745364&r2=1745365&view=diff
==============================================================================
--- uima/sandbox/uima-ducc/trunk/uima-ducc-duccdocs/src/site/tex/duccbook/part5/ducc-pops-component-database.tex (original)
+++ uima/sandbox/uima-ducc/trunk/uima-ducc-duccdocs/src/site/tex/duccbook/part5/ducc-pops-component-database.tex Tue May 24 14:09:53 2016
@@ -423,7 +423,7 @@ src/main/resources
           \item[stop\_ducc] This contains calls to {\em ducc\_util.py} to stop the DB.
           \item[check\_ducc] This contains calls to {\em ducc\_util.py} to determine if the DB is running or not.
           \item[ducc\_post\_install] This contains calls to {\em db\_util.py} to configure the
-            {\em ducc.head}, prompt for the database password, and initialize the schema.
+            {\em ducc.head}, generate a random database password, and initialize the schema.
           \item[db\_create] This contains methods to define a database, independently of
             {\em ducc\_post\_install} intended for migration purposes.
           \item[db\_loader] This contains calls to the java utility {\em DbLoader} to