Database Reference
In-Depth Information
Secure Logon Script (secureStart.py)
start.py has a major flaw when it comes to security, as it contains a credential password. secureStart.py , however,
has the same capability as start.py to establish a connection between EM CLI and an OMS, without revealing the
credential password in the script. The script instead opens a file from the filesystem that contains the password and
reads the password into a variable. It then uses the contents of this variable as the credential password in the login()
function.
secureStart.py is used in the same way as start.py . However, there are additional requirements. The first
requirement is to create a file on a filesystem accessible from EM CLI that contains only the credential password in
plain text. Secure this file with permissions appropriate for your environment. In addition to updating the myurl and
the myuser script variables to match your environment, the mypassloc script variable needs to be changed to the full
path location of the file containing the credential password. Take a look at the following:
from emcli import *
myurl = ' https://em12cr3.example.com:7802/em '
mytrustall = 'TRUE'
myoutput = 'JSON'
myuser = 'sysman'
mypassloc = '/home/oracle/.secret'
set_client_property('EMCLI_OMS_URL', myurl)
set_client_property('EMCLI_TRUSTALL', mytrustall)
set_client_property('EMCLI_OUTPUT_TYPE', myoutput)
myfile = open(mypassloc,'r')
mypass = myfile.read()
print(login(username=myuser, password=mypass))
The logon scripts only establish a connection between EM CLI and an OMS. They do not have any effect on the
Enterprise Manager targets. The remaining samples in this section demonstrate how to manipulate targets using
interactive or scripting modes.
Update Target Properties Commands (updatePropsFunc.py)
The updatePropsFunc.py script contains the commands needed to update the properties of Enterprise Manager
targets. These commands can be copied individually into an EM CLI interactive session after establishing a logon. The
full sample can also be put into a script and executed directly (a logon will need to be established first) with EM CLI in
scripting mode using the command emcli @updatePropsFunc.py . This sample includes comments (lines beginning
with the hash character) about the script commands that should be included when copying to a script. In EM CLI
(as well as in Python and Jython), any line beginning with a hash character is ignored.
View the logon samples at the beginning of this section for information on how to establish a logon in scripting
or interactive mode.
Note
 
 
Search WWH ::




Custom Search