LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
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 07-02-2008, 06:33 AM   #1
rjlee
Senior Member
 
Registered: Jul 2004
Distribution: Ubuntu 7.04
Posts: 1,994

Rep: Reputation: 76
Loading encrypted filesystem password over LAN at boot time?


Hi.

I was just wondering how hard it would be to set up an encrypted / filesystem so that I could enter the password through another machine on the local network (possibly by sharing a USB memory stick)?

I am setting up a server with an encrypted / filesystem. Physical access is difficult, so this would make it a lot easier to reboot the server after kernel updates, power failures etc.

The machine is already installed, but I can re-install if needed.

When I boot, currently it asks me for a password to unlock the root filesystem (luks password from an Ubuntu 8.04 alternate CD install).
 
Old 07-02-2008, 07:52 AM   #2
nx5000
Senior Member
 
Registered: Sep 2005
Location: Out
Posts: 3,307

Rep: Reputation: 57
In common LUKS packages, there is already an option to have the passphrase stored on a local usb key.

The job is done by early-crypto.


Quote:
10. The "passdev" keyscript
----------------------------
If you have a keyfile on a removable device (e.g. a USB-key), you can use the
passdev keyscript. It will wait for the device to appear, mount it read-only,
read the key and then unmount the device.

The "key" part of /etc/crypttab will be interpreted as <device>:<path>, it is
strongly recommended that you use one of the persistent device names from
/dev/disk/*, e.g. /dev/disk/by-label/myusbkey.

This is an example of a suitable line in cryptsetup:
cryptroot /dev/hda2 /dev/disk/by-label/myusbkey:/keys/root.key cipher=aes-cbc-essiv:sha256,size=256,hash=plain,keyscript=/lib/cryptsetup/scripts/passdev

The above line would cause the boot to pause until /dev/disk/by-label/myusbkey
appears in the fs, then mount that device and use the file /keys/root.key
on the device as the key (without any hashing) as the key for the fs.
In /lib/cryptsetup/cryptdisks.functions, the usb key is mounted:

Quote:
# Premounts file systems
mount_fs () {
local point
MOUNTED=""

for point in $MOUNT; do
if mount "$point" >/dev/null; then
MOUNTED="$MOUNTED $point"
fi
done
}
So what you'll need is prior to that, enabling the network, mounting the remote usb key (sshfs with public/private key or any encrypted network file system)
Or you could setup an ssh client that would remotely copy the key to /tmp in RAM and then use the above method for early-crypto.

Here is someone that starts an ssh server then waits for the passphrase from the network. THere's also general info on creating an initrd:
http://gpl.coulmann.de/ssh_luks_unlock.html

Just a few ideas..
 
Old 07-02-2008, 11:12 AM   #3
rjlee
Senior Member
 
Registered: Jul 2004
Distribution: Ubuntu 7.04
Posts: 1,994

Original Poster
Rep: Reputation: 76
nx5000:

Thanks for that. I tried following that howto, but found it bombed out on Ubuntu repeatedly.

Luckily, someone else has already made it work for Ubuntu and posted a tutorial here: http://www.howtoforge.com/unlock-a-l...-ssh-on-ubuntu

So I've tried running that, and (after removing a line about /lib/tls, which I don't seem to have) it does seem to have booted the initrd. It seems to work fine entering the password at the terminal. When entering it over the network, it claims to set up the cryptographic volume without prompting me for a password (and also seems to fail to do so).

Hopefully I can get that working.
 
Old 07-10-2008, 02:59 PM   #4
simonapnic
Member
 
Registered: Jul 2008
Posts: 70

Rep: Reputation: 16
Lightbulb

Your LUKS solution might work, but have you ever heard of SSHFS ?
You can find the official site (I think) here: http://fuse.sourceforge.net/sshfs.html
I've used it in the past and I was pretty satisfied with it.
 
Old 07-12-2008, 03:15 PM   #5
rjlee
Senior Member
 
Registered: Jul 2004
Distribution: Ubuntu 7.04
Posts: 1,994

Original Poster
Rep: Reputation: 76
Quote:
Originally Posted by simonapnic View Post
Your LUKS solution might work, but have you ever heard of SSHFS ?
I think these do different jobs: LUKS encrypts the data stored on a disk, which SSHFS encrypts the transfer of data between one machine and another.

As far as I know, there's no way to use SSHFS to ensure that the data is encrypted on disk. Or am I missing something?
 
  


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
[SOLVED] Slackware 12.1 + RAID 1 + LVM: Can't boot with or without encrypted filesystem gargamel Slackware 29 08-04-2011 06:19 AM
Loading encrypted partitions at boot compu73rg33k Ubuntu 0 11-03-2007 07:59 PM
Encrypted filesystem and boot from flash Chinook06 Linux - Security 1 01-13-2007 08:59 PM
mount encrypted filesystem fails on boot blackcompany SUSE / openSUSE 0 06-12-2006 09:26 AM
How to boot an encrypted filesystem from removable medium? Vincent_Vega Linux - Security 2 11-19-2004 02:54 PM

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

All times are GMT -5. The time now is 10:52 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