
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-23-2016 06:34 AM
Hi Experts,
I have a SSHCommand probe that runs a shell script to launch SQLplus to connect to Oracle instances on the target server. It is working fine, but at the moment I have the Oracle user/password hard coded in the script.
Can I, and how, have the database credential stored in the custom credential table, and then call it from, or pass it to the shell script ?
Thanks in advance for any help,
john
Solved! Go to Solution.
- Labels:
-
Discovery
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-23-2016 08:08 AM
Hey John,
Yes, you can use gs.getProperty() or gs.getMessage() to access it.
Or as you said, you can store credentials on a custom table and access it using Glide Record too.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-23-2016 06:39 AM
Hey John,
If I am not wrong, you can send the credential as a probe parameter.
On the SSH command line you will be able to access it.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-23-2016 07:51 AM
Hi,
Thanks for the answer.
Yes that does work, but then the password is in plain text for anyone that looks at the probe. I was hoping to add the credential in the custom credential table and call it by id or name.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-23-2016 08:08 AM
Hey John,
Yes, you can use gs.getProperty() or gs.getMessage() to access it.
Or as you said, you can store credentials on a custom table and access it using Glide Record too.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-30-2016 02:46 AM
Hi,
Thanks again for the tip.
So I am now accessing the credentials table with glideRecord within a probe parameter value script.
And it is almost working. Types are now my issue.
The value script below is passed to the SSHCommand as a parameter for the shell script as ora_cred
var gr = new GlideRecord('discovery_credentials');
gr.addQuery('name', 'oracle_user');
gr.Query();
var pw_hash = gr.password;
var crypt = new GlideEncrypter();
var pw_text = crypt.decrypt(pw_hash);
answer = pw_text[0];
pw_text is typeof object, so assume it is an array. But the error from the above script is : Replaceable simple parameter 'ora_cred' doesn't exist
If I remove the array index then ora_cred becomes "org.mozilla.javascript.NativeJavaObject@..."
I'll mark your answer as correct though - this will work and is a useful tool to have once I get my types sorted out.