LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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 11-06-2004, 06:15 PM   #1
qwijibow
LQ Guru
 
Registered: Apr 2003
Location: nottingham england
Distribution: Gentoo
Posts: 2,672

Rep: Reputation: 47
using a random file as password to dm-crypt


In an attempt to get the very higest level of securety on my rncrypted home partiton,
rather than use a password, i decided to use a random file.

i filled a floppy disk like so....
Code:
dd if=/dev/urandom of=/dev/fd0
like expected, the disk was filled with random data.

and the home partiton is mounted from the local startup script like so...

Code:
losetup /dev/loop7 /home/chris.img
cryptsetup -c aes -s 256 -d /dev/fd0 -b `blockdev --getsize /dev/loop7` -h ripemd160  create chris /dev/loop7
mount /dev/mapper/chris /home/chris/
if the wrong floopy disk (or no floppy disk) is inserted before the local script runs, then my ecrypted partiton is not mounted, but other users with non encrypted disks are allowed to login.

this works fine except for one thing, i was expecting this setup to use the whole 1.44 megs of data as the password, but the disk activity only lasts a few seconds, and it takes 30 seconds to read the whole disk...

how do i work out how much random data is being used as the password ?
im worred that maybe the encryption program is finding a terminating null and stoping reading, leaving me wth a very short passoword.

the reason ive setup such a system, is to stop people picking short predicatable passwords, this is pointless if the system is only using 5 random characters (easily brute forced !)

any ideas ?

ive tried altering the keysize after the -s option, but 256 bits is its maximum, and i believe this only apply's the the key after its been hashed.

thanks.
 
Old 11-06-2004, 10:56 PM   #2
SciYro
Senior Member
 
Registered: Oct 2003
Location: hopefully not here
Distribution: Gentoo
Posts: 2,038

Rep: Reputation: 51
oooo, very nice approach .. ill have to do that for my documents (as well as a semi-random login password)

but try to fill the disk again and see ... also it might be the hashed thingy you spoke of .. maybe it can only hash X amount of characters ? ... maybe search thru hte floppy using some program to search for things like EOL or EOF
 
Old 11-06-2004, 11:20 PM   #3
n0sr
Member
 
Registered: Sep 2004
Location: 127.0.0.1
Distribution: Slackware 13; Ubuntu Raspberry Pi OS
Posts: 255

Rep: Reputation: 34
You might try using this command....

Code:
dd if=/dev/urandom of=/dev/fd0 bs=1k count=1440
That will force dd to write to the whole diskette.

Last edited by n0sr; 11-06-2004 at 11:21 PM.
 
Old 11-07-2004, 03:53 PM   #4
qwijibow
LQ Guru
 
Registered: Apr 2003
Location: nottingham england
Distribution: Gentoo
Posts: 2,672

Original Poster
Rep: Reputation: 47
How should i go about searching for EOF / EOL ?
does EOF and EOL have an ascii code ?
or should i look for the actual string "EOF" ?

thanks for the hep so far
 
Old 11-08-2004, 11:37 AM   #5
Matir
LQ Guru
 
Registered: Nov 2004
Location: San Jose, CA
Distribution: Debian, Arch
Posts: 8,507

Rep: Reputation: 128Reputation: 128
Of course EOF and EOL (really \n) have ascii codes. Most likely, however, is that only 256 bits of data are being used, or something along those lines. Note this:

If you are using a crypto algorithm with a keysize of N bits, then that is the maximum security you will get. It's just like DES using only 8 characters of a password... a 10 character password adds no additional security.

Even after hashing ANY amount of data, you still end up with one of 2^256 combinations for your key... meaning multiple hash datas could give you the SAME key.
 
Old 11-08-2004, 11:50 AM   #6
qwijibow
LQ Guru
 
Registered: Apr 2003
Location: nottingham england
Distribution: Gentoo
Posts: 2,672

Original Poster
Rep: Reputation: 47
there are approx 2^120 atoms in the universe (to put things into pursective)
so nobody ever attmepts to brute force the hashed key.

its much better to brute force the password that is hasjed to create the key.
therefore.... Securetty is Optimal when all the possible combinations of the hash (2^256) is equal to all the possible combinations of the password that is to be hashed... which means 32 bytes.

for optimal security, the sytem i setup MUST be using atleast 32 bytes from the floppy....
are there any ways of testing this ?

the only way i can think of, is to setup anouther floppy, and only copy over the first 31 bytes from the correct floppy.
if this 1 byte short floppy correctly decrypts the partition. then i am not using optimal security.
 
Old 11-08-2004, 11:57 AM   #7
Matir
LQ Guru
 
Registered: Nov 2004
Location: San Jose, CA
Distribution: Debian, Arch
Posts: 8,507

Rep: Reputation: 128Reputation: 128
to try this:

insert key disk
Code:
dd if=/dev/fd0 of=fd0.img bs=1 count=31
then just use cryptsetup -d fd0.img
 
  


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
wget a random file on phone server sub_moa Programming 16 07-01-2005 05:56 PM
random generated password LinuxRam Linux - Security 13 09-13-2004 05:25 AM
show contents of random file? iluvatar Linux - Software 6 07-13-2004 01:53 AM
netatalk, random file locks lukebeales Linux - Software 0 02-01-2004 10:22 AM
Help: Need random password generator linuxgamer Linux - Software 5 12-02-2003 01:01 PM

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

All times are GMT -5. The time now is 07:33 AM.

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