Implications of setting sensitive data in ENV


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Implications of setting sensitive data in ENV
# 1  
Old 10-26-2006
Implications of setting sensitive data in ENV

Hello people,
In shell scripts if some sensitive data is set into the env so that it is available to other scripts called within those scripts -- Are there are security implications ?
-- I believe the scope of those environment variables ends with the execution of the script.
-- I see that while the script is running those env variables are not accessible from the command line.

Is my understanding correct? Any comments ? Please let me know.

Regards,
T.
# 2  
Old 10-26-2006
Hi ,
When ever you are setting any value to a varible its scope is limited to that script or any child script started by that parent.

In order to access those variables from any script which are not child of that parent script its better that you create a file where you keep those vairables and execute that file before each script run, by doing that you would be able to access those variable by any script.


Regards,
Manish Jha
# 3  
Old 10-27-2006
Quote:
Originally Posted by tipsy
-- I see that while the script is running those env variables are not accessible from the command line.

Is my understanding correct? Any comments ? Please let me know.
Which OS are you on ?

Ever looked into /proc/<pid>/environ ?
# 4  
Old 10-27-2006
The BSD version of ps has an option to display the environment of the processes it lists. So in general that is not secure. If you must do that, you can limit the window of exposure by putting the data in the environment just before invoking the script. And then in the script, reset the environment as the first operation.

Try to use a pipe instead.

echo $secretstuff | some_script

and in the script do:
read secretstuff
# 5  
Old 10-27-2006
Quote:
Originally Posted by vino
Which OS are you on ?

Ever looked into /proc/<pid>/environ ?
Very good point.
Code:
$ $ uname
Linux
$ while read -d $'\0' LINE
        do echo ${LINE}
done < /proc/$$/environ
USER=xxxxx
LOGNAME=xxxxx
HOME=/home/xxxxx
PATH=/usr/bin:/bin:/usr/sbin:/sbin
MAIL=/var/mail/xxxxx
SHELL=/bin/bash
SSH_CLIENT=xx.xx.xx.xx 63973 22
SSH_CONNECTION=xx.xx.xx.xx 63973 xx.xx.xx.xx 22
SSH_TTY=/dev/pts/0
TERM=xterm
$

It appears accessible by any programs running as the same user.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Post Here to Contact Site Administrators and Moderators

Please remove sensitive data

Hi Kindly remove the following from the post . These are confidential info posted by mistake https://www.unix.com/shell-programming-and-scripting/201037-perl-while-loop-each.html please remove the comments section which is first 16 lines in the perl script . Also please remove the ... (1 Reply)
Discussion started by: ptappeta
1 Replies

2. Post Here to Contact Site Administrators and Moderators

Remove sensitive data

Hi Sir, please remove following terms from post as it is sensitive data https://www.unix.com/shell-programming-and-scripting/235655-print-single-line.html ifeeds fidedev ironsides feedmgr thanks a lot prabhu (1 Reply)
Discussion started by: ptappeta
1 Replies

3. Post Here to Contact Site Administrators and Moderators

Please remove the sensitive data from post

Hi Sir , Please remove the following code from the post https://www.unix.com/unix-for-advanced-and-expert-users/210081-ftp-issue.html thanks Prabhu (7 Replies)
Discussion started by: ptappeta
7 Replies

4. Post Here to Contact Site Administrators and Moderators

Remove post with sensitive data

Hello, Can you please delete or modify a post that contains sensitive data. I can't post full links, here's the end of the link: shell-programming-and-scripting/94965-help-shell-scripting-modify-user-creation-script-oracle-database.html It's got a lot of data that should never be posted on... (2 Replies)
Discussion started by: JonHeller
2 Replies

5. Shell Programming and Scripting

Setting ENV variables in PERL

I have perl script and in the first line we are invoking .sh script to set ENV variables. e..g eval '. $envfile; exec $PERL -S $0 "$@"' I want to change some of the env variables while the program is running and I am settging it like this .. $ENV{ORACLE_HOME}=trim($oraclehome);... (1 Reply)
Discussion started by: talashil
1 Replies

6. Shell Programming and Scripting

Setting up env variable in ksh

I am facing a very strange issue. I have script in ksh with #!/bin/ksh as shebang. This script has function which sets the env variable before running other functions of the script. by set_up_env() { CONFIG_FILE="/opt/app/tools/deepmarking/latestVersion/script/UploadEnv" if then ... (7 Replies)
Discussion started by: Tuxidow
7 Replies

7. UNIX for Dummies Questions & Answers

Setting env variables using script

Hi, I wrote two small scripts to set env variables in a shell. java_env.csh #!/bin/csh -fn setenv JAVA_HOME '/scratch/software/jdk1.5.0_11' setenv PATH $PATH':'$JAVA_HOME'/bin' and run it using csh ./java_env.csh But the env variables are not set. I tried running each line on the... (5 Replies)
Discussion started by: NoviceAmod
5 Replies

8. Red Hat

Help with csh env setting in Fedora 8

Hi there, How can I change bash to csh when starting a terminal, and set some aliases for csh? I can't find such files like .cshrc in my home directory. Thanks a lot (1 Reply)
Discussion started by: dustinwang2003
1 Replies

9. AIX

edit env. setting

hi eveybody, i m trying to set acl using acledit command in AIX box but wat im gettung is 3002-100 acledit: EDITOR environment variable not set can anyone help me out how 2 set editor.................... thanks in advance (4 Replies)
Discussion started by: rrlog
4 Replies

10. Solaris

setting env

I am trying to set up my compiler, but when I go to look for gcc it not found but I get a message that stayed (/usr/oasys/bin) and when I go into the dir to set my env the following is type cp : cannot creat //pref/.environ: no such file or directory and I input ./setenv PATH=... (3 Replies)
Discussion started by: alsande
3 Replies
Login or Register to Ask a Question