

So you want encryption that doesn't need any password, dongle, biometric and so on? Sorry, but that's just impossible. After all, there must be "something" that gives you (i.e. your company) and nobody else access to the data. This doesn't have to be a password, but it should be clear that some kind of authentication is necessary.SilentShadow wrote:so I need a user log-on to have the file decrypted?


Code: Select all
.:[Managing 0/82 jobs.] [CPU Load: 0.24 Uptime: 0h13m]:.
.:[8 files using 1,1M] [root@localhost ~]:.
.:[21:09:35]:. $ cat /etc/conf.d/local.start
# /etc/conf.d/local.start:
# $Header: /home/cvsroot/gentoo-src/rc-scripts/etc/conf.d/local.start,v 1.4 2002/11/18 19:39:22 azarah Exp $
# This is a good place to load any misc.
# programs on startup ( 1>&2 )
cryptsetup -c aes create home /dev/hdb1
mount /dev/mapper/home /home
Code: Select all
.:[Managing 0/82 jobs.] [CPU Load: 0.24 Uptime: 0h13m]:.
.:[8 files using 1,1M] [root@HackXoR ~]:.
.:[21:09:36]:. $ cat /etc/conf.d/local.stop
# /etc/conf.d/local.stop:
# $Header: /home/cvsroot/gentoo-src/rc-scripts/etc/conf.d/local.stop,v 1.4 2002/11/18 19:39:22 azarah Exp $
# This is a good place to unload any misc.
# programs you started above.
# For example, if you are using OSS and have
# "/usr/local/bin/soundon" above, put
# "/usr/local/bin/soundoff" here.
/etc/init.d/mldonkey stop
umount /home/john/nfs && echo nfs unmounted
umount /home &&echo HOME unmounted
Code: Select all
.:[Managing 0/81 jobs.] [CPU Load: 0.62 Uptime: 0h15m]:.
.:[53 files using 746k] [root@localhost /home/john/bin]:.
.:[21:11:54]:. $ cat secmount
#!/bin/bash
su -c 'cd ~john; /sbin/losetup /dev/loop2 /home/john/secret;/bin/cryptsetup create secret /dev/loop2;mount /dev/mapper/secret /home/john/nfs;mount -o,remount exec ~john/nfs/'
Code: Select all
.:[Managing 0/81 jobs.] [CPU Load: 0.57 Uptime: 0h15m]:.
.:[53 files using 746k] [root@localhost /home/john/bin]:.
.:[21:11:59]:. $ cat secumount
su -c 'umount /home/john/nfs;cryptsetup remove secret;/sbin/losetup -d /dev/loop2'
Code: Select all
/bin/umount /home/<foo> && echo "/home/<foo> unmounted"
/bin/cryptsetup remove /dev/mapper/<bar> && echo "/dev/mapper/<bar> removed"
/sbin/losetup -d /dev/loop<number> && echo "loopdevice removed"
Thanks!ian! wrote:Nice How-To.
Yes, I should have added some lines about that problem. In fact there are still some processes left when you leave KDE, but only for a few ms. Adding a one second sleep to umount.crypt solves this problem. This should be more elegant.ian! wrote:I had to put some umount-foo into my local.stop so that the loop will be umounted when shutting down when the loop was mounted via kdm before.

I think if you follow the guide this is taken care ofyem wrote:1) Where it says that you can theoretically login now and try creating/deleting files. Might be worth noting that you need to chown the mount point to the user after it is mounted. Confused me for a few minutes because the mountpoint changed ownership to root:root when mounted.
Changed.yem wrote:2) | (cd /home/frodo2; tar xpf -) could be written more clearly as | tar -xpf - -C /home/frodo2
After emerge pam_mount you're advised to run etc-update which should point out the changes in the pam files.yem wrote:3) If you use a login manager (guessing most people do - particularly on laptops) you need to add the auth/session lines to /etc/pam.d/{xdm,gdm,kdm}. /etc/pam.d/login is not sufficient.
I've recently read somewhere (IIRC some remarks by Hans Reiser) that in order to have a completely fail-safe (even unencrypted!) reiserfs partition it's in fact necessary to turn off the drive's write buffering. That sounds quite reasonable since the HDD's buffering does a reordering of the write operations.yem wrote:Did you find anything more about using journalled filesystems on dm-crypted block devices? I have the backing file stored on an ext3 partition, but its not the same. Quick google didn't turn anything up.
I see that, but the instuctions to "relogin as frodo. try copying some files" (paraphrasing) wont work without a chown first.tuxophil wrote:I think if you follow the guide this is taken care of
(Have a closer look at the code in section 5.)
hmm or even "rsync -arv /home/frodo/ /home/frodo2/" ?yem wrote:2) | (cd /home/frodo2; tar xpf -) could be written more clearly as | tar -xpf - -C /home/frodo2
IIRC it modifies /etc/pam.d/login only, not the [xgk]dm profiles.tixophil wrote:After emerge pam_mount you're advised to run etc-update which should point out the changes in the pam files.

Crap! You're rightyem wrote:I see that, but the instuctions to "relogin as frodo. try copying some files" (paraphrasing) wont work without a chown first.tuxophil wrote:I think if you follow the guide this is taken care of
(Have a closer look at the code in section 5.)
I just had a look at man rsync, it seems that it should preserve everything (special files, attributes, etc.), but I'm not sure, since ACLs and extended attributes aren't mentioned. In man tar neither, but until somebody can confirm that rsync would work at least as good as tar, I'll stick to using tar.yem wrote:hmm or even "rsync -arv /home/frodo/ /home/frodo2/" ?
Hmm, strange, on the two systems I did this kdm was also modified. Hopefully nothing's wrong with the ebuild...yem wrote:IIRC it modifies /etc/pam.d/login only, not the [xgk]dm profiles.
Ah I see what happened. The ebuild includes kde (but not kdm - are they the same thing?) and login. However, I don't use kde and thus the kde file was created by pam_login. Being a new file, etc-update didn't show any diff on that file.tuxophil wrote:Hmm, strange, on the two systems I did this kdm was also modified. Hopefully nothing's wrong with the ebuild...
Code: Select all
--- pam_mount-0.9.22.ebuild 2005-03-12 22:58:46.000000000 +1300
+++ pam_mount-0.9.22-r1.ebuild 2005-03-12 23:06:22.000000000 +1300
@@ -29,7 +29,7 @@
insopts -m0644
doins ${FILESDIR}/pam_mount.conf
insinto /etc/pam.d
- doins ${FILESDIR}/login ${FILESDIR}/kde
+ doins ${FILESDIR}/login
# fixed mount.crypt
#insinto /usr/bin
#doins ${FILESDIR}/mount.crypt
@@ -38,3 +38,13 @@
dosym /usr/bin/mount.crypt /sbin/mount.crypt
dodoc README TODO AUTHORS ChangeLog FAQ INSTALL NEWS
}
+
+pkg_postinst() {
+ einfo "This ebuild modifies /etc/pam.d/login to include pam_mount hooks."
+ einfo "If you use a graphical login manager such as xdm, kdm or gdm, you"
+ einfo "will need to add the following lines to the appropriate file"
+ einfo "in /etc/pam.d/:"
+ einfo
+ einfo "auth optional /lib/security/pam_mount.so use_first_pass"
+ einfo "session optional /lib/security/pam_mount.so"
+}Code: Select all
dd if=/dev/urandom of=/dev/sda4 bs=1M
KEY=`tr -cd [:graph:] < /dev/urandom | head -c 79`
echo $KEY | cryptsetup create bleh /dev/sda4
mke2fs /dev/mapper/bleh
echo $KEY | openssl aes-256-ecb > /home/bleh.key
touch /home/bleh.key.old
chown bleh /home/bleh.key /home/bleh.key.old
chmod 600 /home/bleh.key /home/bleh.key.old
mkdir /home/bleh2
chown bleh /home/bleh2
chgrp users /home/bleh2
chmod 700 /home/bleh2
Code: Select all
volume bleh crypt - /dev/sda4 /home/bleh2 cipher=aes aes-256-ecb /home/bleh.key
Code: Select all
dd if=/dev/urandom of=/dev/sda4 bs=1M
KEY=`tr -cd [:graph:] < /dev/urandom | head -c 79`
echo $KEY | cryptsetup create bleh /dev/sda4
mke2fs /dev/mapper/bleh
echo $KEY | openssl aes-256-ecb > /etc/bleh.key
touch /etc/bleh.key.old
chown bleh /etc/bleh.key /etc/bleh.key.old
chmod 600 /etc/bleh.key /etc/bleh.key.old
Code: Select all
volume bleh crypt - /dev/sda4 /home cipher=aes aes-256-ecb /etc/bleh.key
Code: Select all
mv /home /home2
mkdir /home
chown bleh /home
chgrp users /home
chmod 700 /home
Code: Select all
su
mkdir /home/bleh
chown bleh /home/bleh
chgrp users /home/bleh
chown 700 /home/bleh


Unfortunately I don't think there's another way that doesn't require a second passphrase. If you want to enter your passphrase only once it must be passed by PAM to the mount command. I don't know of any other pam_mount-like program. It's a pity that it's discontinued. But then again, it works just fine. The only I thing I may try sometime is to hack LUKS-support into it. (But only if it doesn't require too much C code.)svf wrote:is there any other way to do this(mount cryptet home on login) because according to the webpage pam_mount is discontinuedmaybe there some other neat way with the new baselayout
My setup is as follows: large enough swap, mount a 2GiB maximum tmpfs-filesystem as /tmp. Since tmpfs is handled by the VM, it always resides in RAM or swap. Just encrypt your swap and everything's fine.svf wrote:and second.. are there any other howtos how i can secure some of my /var/spool files? (tmpfs and pgp on shutdown? and risking data loss on crash?)
any other ideas?

Normally yes. But don't forget about the unencrypted parts of your system...svf wrote:so the weakest point in the chain is my user password...
IIRC it's salted MD5. MD5 may not be the strongest hash around, but brute forcing it would still be quite a feat.svf wrote: i think i do have a really strong password but.. how is it stored? whats the algorithm used for /etc/shadow (blowfish? des?) somebody knows about that?


I don't think so. AFAIK conf.d/cryptfs requires the entry of a (system-level?) passphrase at boot time. To transparently mount a partition when the user logs in you'll have to use pam_mount.paoleela wrote:Is there a way to do your setup also with the new baselayout and /etc/conf.d/cryptfs ?

Code: Select all
pam_mount: received order to close things
pam_mount: real and effective user ID are 405 and 405.
pam_mount: user is guest
pam_mount: command: /usr/sbin/pmvarrun [-u] [guest] [-d] [-o] [-1]
pam_mount: could not open count file /var/run/pam_mount/guest
pam_mount: pmvarrun says login count is 0
pam_mount: going to unmount
pam_mount: information for mount:
pam_mount: --------
pam_mount: (defined by globalconf)
pam_mount: user: guest
pam_mount: server:
pam_mount: volume: /home/.guest.img
pam_mount: mountpoint: /home/.guest
pam_mount: options: loop,cipher=aes
pam_mount: fs_key_cipher: aes-256-ecb
pam_mount: fs_key_path: /home/.guest.key
pam_mount: use_fstab: 0
pam_mount: --------
pam_mount: command: /usr/sbin/lsof [/home/.guest]
pam_mount: lsof output (should be empty)...
pam_mount: waiting for lsof
pam_mount: command: /usr/bin/umount.crypt [/home/.guest]
pam_mount: umount errors (should be empty):
pam_mount: pam_mount: error setting uid to 0
pam_mount: mlockall failed: Cannot allocate memory
pam_mount: WARNING!!! Possibly insecure memory. Are you root?
pam_mount: Command failed: Invalid argument
pam_mount: umount: /home/.guest is not in the fstab (and you are not root)
pam_mount: umount.crypt: error unmounting /home/.guest
pam_mount: waiting for umount
pam_mount: unmount of /home/.guest.img failed
pam_mount: pam_mount execution complete