Password Obscuring Technique


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Password Obscuring Technique
# 1  
Old 02-14-2013
Password Obscuring Technique

Hi,
We have a unix shell script which tries login to database. The user name and password to connect to database is stored in a file connection.sql.

Now connection.sql has contents
Code:
def ora_user =&1

CONNECT A_PROXY[&ora_user]/abc123@DEV01

When on UNIX server we connect to database and set spool on and invoke connection.sql .. in the output spooled file we see the password. We want the password to be in encrypted form .. how can we achieve that?
Code:
SQL> set echo on
SQL> set feed on
SQL> set termout on
SQL> set sqlblanklines on
SQL> @GTBIR_DW/dbscripts/connection.sql BIR
SQL> def ora_user =&1
SQL> 
SQL> CONNECT A_PROXY[&ora_user]/abc123@DEV01
Connected.

SQL> spool off

In the spooled file we want something like this instead of displaying the password.
Code:
SQL> CONNECT A_PROXY[&ora_user]/******@DEV01

Thanks,
GR
# 2  
Old 02-14-2013
Are we allowed to know if this is Oracle sql*plus? Connect before spool on? Remove in postprocessing? Access by UNIX login?
# 3  
Old 02-27-2013
Yes, this is Oracle sql*plus. The connect is after spool on. And accessed by UNIX login. One thing that we could do is set echo off .. which will not display the sql statements which are running. But we want to display all the sql statements running.Any way to encrypt/hide the password?
# 4  
Old 02-27-2013
Does it help if you put it on the command line?
Starting SQL*Plus

To connect to a remote database when you start command-line SQL*Plus, include the Oracle Net service name in your SQLPLUS command in the following form:
SQLPLUS HR/your_password@connect_identifierCan you spool on after connect?
# 5  
Old 02-28-2013
We connect after spool. There are statements which have to run with diff login's and hence we keeep on switching user's .. that's when the password is spooled in log file.
# 6  
Old 02-28-2013
Run each different login and query/report in a new or parallel sqlplus to a different scrolling file. It's easier to maintain.

The trick with very flexible tools, and UNIX is that and more, is, you 'can', but sometimes you 'should not'! Features get put in by committee, demanded by rich idiots, installed by money grubbing developers like me, but nobody says you have to use them!
# 7  
Old 02-28-2013
Quote:
Originally Posted by Gangadhar Reddy
...
In the spooled file we want something like this instead of displaying the password.
Code:
SQL> CONNECT A_PROXY[&ora_user]/******@DEV01

...
Oracle's sqlplus utility does not put asterisks like that. If you use it interactively, and enter your password when prompted, it will hide all characters, but never put asterisks.
So, if you do want to see those asterisks, then you'll have to process your log file after you're done with your task with sqlplus. I am assuming you do not want to do that. Log files are not supposed to be touched. They are used for auditing and trouble-shooting; you don't tamper with the evidence.

Quote:
Originally Posted by Gangadhar Reddy
...Any way to encrypt/hide the password?
You could avoid entering the password entirely if you configure your client use the external password store. Oracle stores the login credentials in a "wallet" in the client machine in that case. You could then use the "connect" statement like so -

Code:
CONNECT /@db_connect_string

and Oracle determines the login credentials from the wallet itself. More details are in the Oracle Database Security Guide in the documentation.

A simpler technique, however, would be to sandwich the "connect" statement between echo off and on -

Code:
def ora_user =&1
set echo off
CONNECT A_PROXY[&ora_user]/abc123@DEV01
set echo on
....
... rest of the stuff
...

If you feel like adding a diagnostic message at that point, then use the "prompt" command to print something relevant -

Code:
def ora_user =&1
set echo off
prompt Connecting to A_PROXY[&ora_user]@DEV01 now...
CONNECT A_PROXY[&ora_user]/abc123@DEV01
set echo on
....
... rest of the stuff
...

Login or Register to Ask a Question

Previous Thread | Next Thread

8 More Discussions You Might Find Interesting

1. Forum Support Area for Unregistered Users & Account Problems

Password sent via reset password email is 'weak' and won't allow me to change my password

I was unable to login and so used the "Forgotten Password' process. I was sent a NEWLY-PROVIDED password and a link through which my password could be changed. The NEWLY-PROVIDED password allowed me to login. Following the provided link I attempted to update my password to one of my own... (1 Reply)
Discussion started by: Rich Marton
1 Replies

2. Linux

Best Compression technique ?

Hi all, I am working on a sample backup code, where i read the files per 7200 bytes and send it to server. Before sending to server, i compress each 7200 bytes using zlib compression algorithm using dictionary max length of 1.5 MB . I find zlib is slow. Can anyone recommend me a... (3 Replies)
Discussion started by: selvarajvss
3 Replies

3. Shell Programming and Scripting

Encrypt/compile/obscuring scripts

It seems that the Francisco Rosales home page has gone off-line. Is there another source for this? I have found it very useful, but others may also find good use for it - and of course, in turbulent times, I may find myself in a new job too, where I'd like to use it again I'm sure. ... (5 Replies)
Discussion started by: rbatte1
5 Replies

4. UNIX for Dummies Questions & Answers

password protect a CSV file: better solution than ZIP password?

Hi We send *.csv with sensitive data to our customers. Our customers open those files with Excel. A new requirement is that we password protect those CSV files. I thought to pack them with ZIP and assign a password to the archive. But Solaris 10 can't encrypt ZIP files. $ zip -P... (12 Replies)
Discussion started by: slashdotweenie
12 Replies

5. Shell Programming and Scripting

Best search technique

I have a snippet file with the shown below: data file 1 2 1 3 1 3 4 2 3 2 2 1 2 2 5 1 3 2 3 2 2 3 1 4 Actual file has approx 50 Millions such lines with bigger number (9 Replies)
Discussion started by: chakrapani
9 Replies

6. UNIX for Advanced & Expert Users

sendmail header obscuring

hello, I have lots of mail clients, with private IPs, sending mail through our mail server. In the header of each mail outgoing I can find something like Received: from () by linux-virtua1.localhost (8.13.8/8.13.8/SuSE Linux 0.8) ... question is: is there any way to avoid the private... (2 Replies)
Discussion started by: neutrino
2 Replies

7. UNIX for Dummies Questions & Answers

FORK/EXEC technique

Hi! Can someone explain me exactly this technique? Why a process (PARENT) creates a copy of itself with FORK (CHILD)? What's the reason of this behaviour? Sorry, but I cannot understand the logic behind it. Thanks. (4 Replies)
Discussion started by: marshmallow
4 Replies

8. UNIX for Dummies Questions & Answers

Difference Technique's???

Is there any better way of doing this? I only want to find a status of a diff, ie diff the file and return to me whether it is different or not or non-existant. This example works, however I think it could be less messier: workd=`pwd`;find $workd -name "*.sum" | while read line ; do... (1 Reply)
Discussion started by: Shakey21
1 Replies
Login or Register to Ask a Question