Password Encryption – Business Rule Batch Files
I recently learned the importance of encrypted passwords in batch files. Without a password file, the scripts will still run, but the user is prompted to input a password in the command prompt after initialization. Encrypted passwords allow for the automation of these scripts. Shout out to Sumit Deo for his patience in guiding me through the initial process and helping me with my batch scripting skills along the way.
From Oracle’s documentation, a password file in business rule batch files is optional.
However, when executing the batch, the user will be prompted to input the password:
In order to automate this batch file, the password file becomes a necessity. We could put the password in a .txt file and reference that, but for security purposes it makes more sense to encrypt the password. To create an encrypted password, use the “PasswordEncryption.cmd” Windows command file which is located at D:\Oracle\Middleware\user_projects\foundation1\Planning\planning1
In this folder, create a new folder called Password and save a blank notepad file titled Password.txt. Next, open up a command prompt and enter the following command (the first half calls the password encryption file & the 2nd half is the path and file name where the encrypted password will be saved:
D:\Oracle\Middleware\user_projects\foundation1\Planning\planning1\PasswordEncryption.cmd D:\Oracle\Middleware\user_projects\foundation1\Planning\planning1\Password\password.txt
Upon hitting enter, the screen will prompt for a password to be encrypted. Type in the password (nothing will appear on the screen) and hit enter again.
The screen will display as follows, noting that the password has been encrypted to the desired location & file:
Check the password file for the encrypted password:
The next step is to include the encrypted password into the business rule batch file, so that the rule will run automatically when called from the script. The syntax for the command is as follows:
CalcMgrCmdLineLauncher.cmd [-f:passwordFile] /A:appname /U:username /D:database [/R:business rule name | /S:business ruleset name] /F:runtime prompts file [/validate]
We will be focusing on the -f:passwordFile portion of the command. To specify where the encrypted password is stored, -f:passwordFile becomes:
The %CALCLAUNCHER% variable is equal to D:\Oracle\Middleware\user_projects\foundation1\Planning\planning1
Now that the encrypted password has been inserted into the command line of the business rule batch file, the batch will run to completion without stopping to ask the user to input a password. This comes in very handy when attempting to automate multiple tasks in one batch script.
Leave a Reply
Want to join the discussion?Feel free to contribute!