Thanks.
--
At first I thought this may be the second coming of 'He Whose Name
Must Not Be Mentioned", but then I saw the post actually showed a bit
of intelligence. Sorry Bozo[tm]s.
> Anyone using loopback encryption?,
Not at the moment, but I intend to one day.
> I just started using it
> but wonder about it's reliability. I'm using it on two
> partitions at the moment, docs found seem very much out
> of date with limited info/data, some seems just to apply
> to other linux's.
Most things like this are generic and, although filenames and tools
mentioned in tutorials may relate to other distributions, it should
also be possible in any distribution.
> If you have a fault develop ie power
> goes down how does one check the filesystem? you dont
> seem to be able to use fsck, so if anyone has any
> experience of using loopback any info and experience
> would be useful.
I just tried fscking a loopback mounted filesystem (initrd.img from
the Slackware CD-ROM, to be precise) and you can fsck it by
specifying /dev/loop?. The only trouble is that it appears you need
to have the filesystem mounted to be able to fsck it.
--
Simon <si...@no-dns-yet.org.uk> **** PGP: 099977D0
"We demand rigidly defined areas of doubt and uncertainty."
- Douglas Adams
N.N. is an equal opportunity Messiah. Anyone can be Him. :)
>> Anyone using loopback encryption?,
There are 3 main variants: LoopAES, CryptoAPI (a/k/a international
kernel patch), and of course the simple XOR used by the unpatched
losetup of util-linux.
> Not at the moment, but I intend to one day.
I use it somewhat, but not for any permanently-mounted filesystems. My
swap partitions are used as encrypted loop devices. (I use CryptoAPI and
the Twofish algorithm.)
>> I just started using it
>> but wonder about it's reliability. I'm using it on two
>> partitions at the moment, docs found seem very much out
This question sometimes comes up on the Linux-Crypto mailing list. You
can find the archives in a Google search. Personally, I'd hesitate to
use it if there was much chance of unclean shutdowns. If you use it in
such an environment, make regular automated backups!
My own use of encrypted swap is immune to such problems because I have
it regenerate a new random passphrase every time. My swap is secure. I
myself have no way of recovering the passphrases.
>> If you have a fault develop ie power
>> goes down how does one check the filesystem? you dont
>> seem to be able to use fsck, so if anyone has any
>
> I just tried fscking a loopback mounted filesystem (initrd.img from
> the Slackware CD-ROM, to be precise) and you can fsck it by
> specifying /dev/loop?. The only trouble is that it appears you need
> to have the filesystem mounted to be able to fsck it.
No, here is where losetup does the job. You use losetup to link the file
with the loop device, and then fsck the loop device.
If you'd like I can post my swap encryption scripts. those will
illustrate the use of losetup.
--
/dev/rob0 - preferred_email=i$((28*28+28))@softhome.net
or put "not-spam" or "/dev/rob0" in Subject header to reply
I'd be interested in them too, please post or mail them.
I remember to have read something in the loop encryption howto about
deadlocks that can happen when you encrypt your swap partition. It went
something like -> system running out of memory -> requesting swap space ->
encryption requiring even more memory -> requesting more swap space ->
and the loop starts over again, causing a deadlock.
Have you noticed/experienced anything like that when you hit memory
limits?
Max
> * Nomen Nescio <nob...@dizum.com> wrote:
>
> At first I thought this may be the second coming of 'He Whose Name
> Must Not Be Mentioned", but then I saw the post actually showed a bit
> of intelligence. Sorry Bozo[tm]s.
Oh dear here we go, still the same old newsgroup, wont bother reading
anymore, see ya all in another few months, gee bozo's what do you do
with them?.
>
> > Anyone using loopback encryption?,
>
> Not at the moment, but I intend to one day.
>
> > I just started using it
> > but wonder about it's reliability. I'm using it on two
> > partitions at the moment, docs found seem very much out
> > of date with limited info/data, some seems just to apply
> > to other linux's.
>
> Most things like this are generic and, although filenames and tools
> mentioned in tutorials may relate to other distributions, it should
> also be possible in any distribution.
>
> > If you have a fault develop ie power
> > goes down how does one check the filesystem? you dont
> > seem to be able to use fsck, so if anyone has any
> > experience of using loopback any info and experience
> > would be useful.
>
> I just tried fscking a loopback mounted filesystem (initrd.img from
> the Slackware CD-ROM, to be precise) and you can fsck it by
> specifying /dev/loop?. The only trouble is that it appears you need
> to have the filesystem mounted to be able to fsck it.
>
>
> --
> Simon <si...@no-dns-yet.org.uk> **** PGP: 099977D0
> "We demand rigidly defined areas of doubt and uncertainty."
> - Douglas Adams
--
>
> Simon <use...@no-dns-yet.org.uk> writes:
>
>> * Nomen Nescio <nob...@dizum.com> wrote:
>>
>> At first I thought this may be the second coming of 'He Whose Name
>> Must Not Be Mentioned", but then I saw the post actually showed a bit
>> of intelligence. Sorry Bozo[tm]s.
>
> Oh dear here we go, still the same old newsgroup, wont bother reading
> anymore, see ya all in another few months, gee bozo's what do you do
> with them?.
OMG another visitation are you excited?
Richard :)
--
Again they chanted RTFM, RTFM, then one of the bozos who I was later to find
out was a Archbozo, he grabbed a large manual off the wall and beganeth to
club me unto death with it. -- Book Of the Newbie Chapter 1 --
i wonder if Nomen has purged his Bozo-killfile yet,
or will he be ignoring more good help from the Bozos
and Hated Regulars? and hardly even an RTFM in it!
anyway:
[...]
>>> If you have a fault develop ie power
>>> goes down how does one check the filesystem? you dont
>>> seem to be able to use fsck, so if anyone has any
>>
>> I just tried fscking a loopback mounted filesystem (initrd.img from
>> the Slackware CD-ROM, to be precise) and you can fsck it by
>> specifying /dev/loop?. The only trouble is that it appears you need
>> to have the filesystem mounted to be able to fsck it.
>
> No, here is where losetup does the job. You use losetup to link the file
> with the loop device, and then fsck the loop device.
or, it seems that one can simply fsck any unmounted filesystem image
by applying the "-f" 'force check' arg. man page only says this is
to force check of clean drive, but this also seems to override
requirement that the target be a block device. so,
e2fsck -f /cdrom/isolinux/initrd.img
> If you'd like I can post my swap encryption scripts. those will
> illustrate the use of losetup.
oooooooooo- donuts!
--
William Hunt, Portland Oregon USA
No, because I'm not convinced that the N.N. who started the thread is
Our Messiah. But the one who replied to Simon may be ... :)
IAC I'm going to continue in the thread because it's an interesting and
quasi-topical matter.
With encryption you have to use losetup anyway, else you're dealing with
an encrypted jumble.
>> If you'd like I can post my swap encryption scripts. those will
>> illustrate the use of losetup.
>
> oooooooooo- donuts!
Here's an excerpt from my rc.local:
#v+
### 2001/09/19 - encrypted swap devices
# load the main cryptoapi module
modprobe cryptoloop
# function to create encrypted swap devices
function doSwap() {
dd if=/dev/urandom bs=1 count=32 2> /dev/null | \
uuencode -m - | cut -c8-29 | tail -2 | head -1 | \
losetup -e blowfish -k128 -p0 /dev/loop${DEV[$X]} /dev/hd${PART[$X]}
mkswap /dev/loop${DEV[$X]} ;
}
# swap partitions: hda2 hdb1, loop devices: loop6 loop7
declare -a PART=(b1 a2)
declare -a DEV=(7 6)
for X in 0 1 ;
do echo "/dev/loop${DEV[$X]} is swap device /dev/hd${PART[$X]}"
doSwap
done
# activate swap devices
swapon -a
#v-
I also disabled the "/sbin/swapon -a" in rc.S.
Note that this is not workable for filesystems, because a new passphrase
is generated each time. :) The losetup "-p0" option tells it to read the
passphrase from stdin. The cool thing about it is that there's no way
even I could begin to guess these passphrases, so it's immune to the
traditional form of "brute force" attacks (such as to threaten "brute
force" upon the sysadmin, or more mundane stuff like dictionary attacks
or keyboard loggers.) The only potential weakness would come from the
urandom device.
You might also be interested in this "swap-reinit" script, which I run
at irregular intervals:
#v+
#!/bin/bash
### 2001/09/19-20: reinitialize encrypted swap devices
# This does the job
function go4it() {
swapoff $LO || giveUp
losetup -d $LO || giveUp
dd if=urandom bs=1 count=32 2> null | uuencode -m - | cut -c8-29 \
| tail -2 | head -1 | losetup -e blowfish -k128 -p0 $LO $PT || giveUp
mkswap $LO >& null || giveUp
swapon -p1 $LO || giveUp
sleep 10 ;
}
# failure message
function giveUp() {
/bin/echo "Aborted on $LO $PT" ; exit 65 ;
}
# An abbreviated $PATH will do
PATH=/usr/bin:/sbin:/bin
# all the action is in /dev so let's go there
cd /dev
# take down loop7 first
LOOP=(7 6)
PART=(b1 a2)
for X in 0 1
do LO="loop${LOOP[$X]}"
PT="hd${PART[$X]}"
go4it || giveUp
done
#v-
That script takes down each swap device and then restarts it with a new
passphrase.
Yes. But I don't know if losetup can accept non-printable characters.
Time for experimentation, I guess.
> hmmm, that is a lot of "ands" actally :)
Right. It's possible, but not bloody likely. :) Most successful attacks
would come *after* physical control of the machine has been taken from
me, in which case the swap won't reveal anything incriminating about my
plans for world domination, nor my secret recipe for chocolate biscuits.
;)
> i guess this qualifies as a good use for high quality randomness
> from /dev/random, in fact i've just noticed that the manpage mentions
> one-time key generation as a specific use :)
Interesting thought. When testing and deploying those scripts a year ago
I needed them to run quickly, but now that I'm only booting once a month
or so this is something to consider.