LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Security
User Name
Password
Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.

Notices


Reply
  Search this Thread
Old 10-02-2007, 09:13 AM   #1
helptonewbie
Member
 
Registered: Aug 2006
Location: England Somewhere
Distribution: Mandriva, PCLinuxOS, Karoshi, Suse, Redhat, Ubuntu
Posts: 518

Rep: Reputation: 39
Question My Variables Encryption how good is it??


Hello all,
I've got a script set-up and i'm interested to know how good if at all it is for its purpose, i have a file which gets source'd in my script to get a couple of variables which hold user and password information. Basically this file is called like so:
source /FILENAME

however just before its call i do this:
mcrypt -ud /FILENAME.nc
(i get asked to input the de-cryption pass phrase done manually when i run the script)
source /FILENAME
mcrypt -u /FILENAME
(asked to input the encryption pass phrase done manually when i run the script)

returns the file back to encrypted and then to /FILENAME.nc

Now its by now obviously sourced in the username and password, how easy or difficult is it to get those variables once my script has been run say in an ssh session, and how long if longer than the ssh session is closed, does the variables stay visiable, its almost acting like a password file obviously.

is this reasonable for keeping username and password safe from say trying to view the file and also if access on the box was gained, not that i expect it to be!! you just never know ??

Thanks
 
Old 10-02-2007, 10:10 AM   #2
brianmcgee
Member
 
Registered: Jun 2007
Location: Munich, Germany
Distribution: RHEL, CentOS, Fedora, SLES (...)
Posts: 399

Rep: Reputation: 40
Passwords should be hashed. For example:

Code:
$ echo password | sha256sum
6b3a55e0261b0304143f805a24924d0c1c44524821305f31d9277843b8a10f4e  -
Then everytime you need to check the password calculate the hash from the user input and compare it to the hash digest.

Hash functions aim to be easily calculated in one way but not in reverse. So attackers should have a hard time generating the original password from the hash value.

In cases you need the original password (e.g. for ssh sessions) you should use asymmetric authentication.

Last edited by brianmcgee; 10-02-2007 at 10:12 AM.
 
Old 10-02-2007, 12:59 PM   #3
helptonewbie
Member
 
Registered: Aug 2006
Location: England Somewhere
Distribution: Mandriva, PCLinuxOS, Karoshi, Suse, Redhat, Ubuntu
Posts: 518

Original Poster
Rep: Reputation: 39
thats cool, but as the password, user name is only available unencrypted for no time at all i think it would still be ok. But second thoughts i could do away with that all together, and hash the password, and then when i run my script ask the user to enter the password and then compare the hashes, would that be just as good do people reckon its probably how people do it already? Especially as its sha hash and it always the same as long as the same key is used to generate the thing in the first place

Still looking for more information on how long a variable is kept alive for once source'd if anyone knows??

Cheers for the reply!

Last edited by helptonewbie; 10-02-2007 at 01:10 PM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Linux password encryption and data encryption Tux-Slack Programming 4 06-20-2007 06:46 AM
Threads synchronisation problem (mutex variables and contitional variables) zahadumy Programming 6 12-07-2005 12:30 PM
Good morning, Good evening, Good night. Cheeseboy LinuxQuestions.org Member Intro 2 11-04-2004 09:46 PM
Shel scripting: variables pointing to variables and case Dark_Helmet Programming 5 06-08-2003 11:07 AM
Mandrake 9.0 Wireless Works without encryption.. does not with encryption topcat Linux - Wireless Networking 3 05-04-2003 08:47 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Security

All times are GMT -5. The time now is 09:18 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration