>> pam_mount(mount.c): crypt_activate_by_passphrase: Operation not
>> permitted
>
> I don't have a pam_mount, where does it come from? Perhaps it needs
> a reference to pam_ssh.so?
What do you mean with "where does it come from?" ?
# cat /etc/security/pam_mount.conf.xml
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE pam_mount SYSTEM "pam_mount.conf.xml.dtd">
<!--
See pam_mount.conf(5) for a description.
-->
<pam_mount>
<!-- debug should come before everything else,
since this file is still processed in a single pass
from top-to-bottom -->
<!-- Note that commenting out mntoptions will give you the defaults.
You will need to explicitly initialize it with the empty string
to reset the defaults to nothing. -->
<mntoptions
allow="nosuid,nodev,loop,encryption,fsck,nonempty, allow_root,allow_other" />
<!--
<mntoptions deny="suid,dev" />
<mntoptions allow="*" />
<mntoptions deny="*" />
-->
<mntoptions require="nosuid,nodev" />
<path>/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin</path>
<logout wait="0" hup="0" term="0" kill="0" />
<!-- pam_mount parameters: Volume-related -->
<mkmountpoint enable="1" remove="true" />
</pam_mount>
--- I didn't change both files except for the debug-parameter ...
[root@enzo]:~ # eix pam_mount
[i] sys-auth/pam_mount
Available versions: (~)1.20 (~)1.21 (~)1.22 (~)1.24 (~)1.25
(~)1.25-r1 (~)1.26 (~)1.31 (~)1.32 (~)1.33 (~)2.0 {crypt}
Installed versions: 2.0(12:45:53 04.05.2010)(crypt)
Homepage: http://pam-mount.sourceforge.net
Description: A PAM module that can mount volumes for a user
session
On 05/04/2010 10:38 AM, Stefan G. Weichinger wrote:
Am 04.05.2010 18:54, schrieb walt:
pam_mount(mount.c): crypt_activate_by_passphrase: Operation not
permitted
I don't have a pam_mount, where does it come from? Perhaps it needs
a reference to pam_ssh.so?
What do you mean with "where does it come from?" ?
It's in portage ...
Okay, I'm assuming pam_mount.so and mount.crypt come from the sys-auth/
pam_mount package but I can't check because all of those packages are
masked by the ~x86 keyword at the moment.
Could it be the case that my current setup somehow uses "the new API"
which isn't available yet in some package?
I don't yet have the whole picture ...
Daniel knows more than I do about this subject, so I recommend that you
follow his advice. However, all of the pam_mount packages being masked
at the same time makes me suspect that not everything is working exactly
as it should. I'll follow this thread, hoping to learn more.
05-05-2010, 04:42 AM
"Stefan G. Weichinger"
Kernel upgrade and now LUKS failure.
Am 04.05.2010 23:24, schrieb Daniel Troeder:
> I'm using sys-fs/cryptsetup-1.1.1_rc1 since 02.05.2010 and didn't have
> any issues.
> Please decrypt your partition from the command line, so we can see if it
> is a cryptsetup/luks/kernel problem or a pam_mount problem.
>
> Cmdline should something like:
> $ sudo cryptsetup -d /etc/security/verysekrit.key luksOpen
> /dev/mapper/VG01-crypthome myhome
> Which should create /dev/mapper/myhome.
My user sgw is currently not allowed to sudo this (should it be? it
never was).
And for root it says "Kein Schlüssel mit diesem Passsatz verfügbar."
(german) which should be "No key available with this passphrase." in
english.
Thanks, Stefan
05-05-2010, 08:00 AM
Daniel Troeder
Kernel upgrade and now LUKS failure.
On 05/05/2010 06:42 AM, Stefan G. Weichinger wrote:
> Am 04.05.2010 23:24, schrieb Daniel Troeder:
>
>> I'm using sys-fs/cryptsetup-1.1.1_rc1 since 02.05.2010 and didn't have
>> any issues.
>> Please decrypt your partition from the command line, so we can see if it
>> is a cryptsetup/luks/kernel problem or a pam_mount problem.
>>
>> Cmdline should something like:
>> $ sudo cryptsetup -d /etc/security/verysekrit.key luksOpen
>> /dev/mapper/VG01-crypthome myhome
>> Which should create /dev/mapper/myhome.
>
> My user sgw is currently not allowed to sudo this (should it be? it
> never was).
>
> And for root it says "Kein Schlüssel mit diesem Passsatz verfügbar."
> (german) which should be "No key available with this passphrase." in
> english.
That is a message from cryptsetup. As you are using openssl to get the
key, I think the problem might be there.
I followed the guide you linked here (website is down, but google-cache
works:
http://webcache.googleusercontent.com/search?q=cache:7eaSac72CoIJ:home.coming.dk/index.php/2009/05/20/encrypted_home_partition_using_luks_pam_+encrypted _home_partition_using_luks_pam&cd=2&hl=de&ct=clnk& gl=de&client=firefox-a)
and it works for me (kernel is 2.6.33-zen2):
The key that cryptsetup is given to decrypt the partition is created by
openssl from the file. Please check the output of
$ openssl aes-256-ecb -d -in verysekrit.key
under both kernel - it should be identical.
BTW: You'll get your error message if you run:
$ echo notmykey | cryptsetup luksOpen /dev/vg0/crypttest decryptedtes
> That is a message from cryptsetup. As you are using openssl to get
> the key, I think the problem might be there.
ok ....
> lvcreate -n crypttest -L 100M vg0 KEY=`tr -cd [:graph:] <
> /dev/urandom | head -c 79` echo $KEY | openssl aes-256-ecb >
> verysekrit.key openssl aes-256-ecb -d -in verysekrit.key # (aha
> openssl aes-256-ecb -d -in verysekrit.key | cryptsetup -v --cipher
> aes-cbc-plain --key-size 256 luksFormat /dev/vg0/crypttest openssl
> aes-256-ecb -d -in verysekrit.key | cryptsetup luksOpen
> /dev/vg0/crypttest decryptedtest cryptsetup luksClose crypttest # (i
> couldn't close it... don't know why...)
>
> The key that cryptsetup is given to decrypt the partition is created
> by openssl from the file. Please check the output of $ openssl
> aes-256-ecb -d -in verysekrit.key under both kernel - it should be
> identical.
At first, thank you for your time and work!
Tried that. I have to admit that I don't know the decryption password
... but as far as I understand it should be the same as the
unix-password of the user sgw. pam_mount.so should read it when I log
in, correct?
With this password I get a "bad decrypt" so this explains why it fails.
Please let me repeat/point out that it is the same for 3 kernels
(2.6.32-r1, 2.6.33-r[12] ... ), so I should change the subject to stay
correct ...
> BTW: You'll get your error message if you run: $ echo
> notmykey | cryptsetup luksOpen /dev/vg0/crypttest decryptedtes
Yes, correct.
-
I really wonder what the reason is ... should I downgrade openssl?
Thanks Stefan
05-05-2010, 07:39 PM
Daniel Troeder
Kernel upgrade and now LUKS failure.
On 05/05/2010 10:42 AM, Stefan G. Weichinger wrote:
> Am 05.05.2010 10:00, schrieb Daniel Troeder:
>
>> That is a message from cryptsetup. As you are using openssl to get
>> the key, I think the problem might be there.
>
> ok ....
>
>> lvcreate -n crypttest -L 100M vg0 KEY=`tr -cd [:graph:] <
>> /dev/urandom | head -c 79` echo $KEY | openssl aes-256-ecb >
>> verysekrit.key openssl aes-256-ecb -d -in verysekrit.key # (aha
>> openssl aes-256-ecb -d -in verysekrit.key | cryptsetup -v --cipher
>> aes-cbc-plain --key-size 256 luksFormat /dev/vg0/crypttest
>> openssl aes-256-ecb -d -in verysekrit.key | cryptsetup luksOpen
>> /dev/vg0/crypttest decryptedtest cryptsetup luksClose crypttest #
>> (i couldn't close it... don't know why...)
>>
>> The key that cryptsetup is given to decrypt the partition is
>> created by openssl from the file. Please check the output of $
>> openssl aes-256-ecb -d -in verysekrit.key under both kernel - it
>> should be identical.
>
> At first, thank you for your time and work!
>
> Tried that. I have to admit that I don't know the decryption
> password ... but as far as I understand it should be the same as the
> unix-password of the user sgw. pam_mount.so should read it when I
> log in, correct?
Yes. Than pam_mount man page (http://linux.die.net/man/8/pam_mount) says so.
It's actually quite verbose on the topic.
> With this password I get a "bad decrypt" so this explains why it
> fails.
If you cannot decrypt your keyfile (with openssl) then you have just
lost any way to decrypt your partition!
But there is an idea in the man page of which I didn't think: did you
maybe change your users password? If so, you need to use the old pw to
decrypt the keyfile. If you can, then you can use the new pw to encrypt
the key again (make backups of the original file).
There is also the possibility your keyfile was corrupted somehow (file
system corruption?). Do you have a backup of the keyfile (and your data?
BTW: a LUKS encrypted partition can have 8 keys (in so called "key
slots"), so that you can add a "fallback key" the next time, which you
store at a trusted place.
Good luck,
Daniel
> Please let me repeat/point out that it is the same for 3 kernels
> (2.6.32-r1, 2.6.33-r[12] ... ), so I should change the subject to
> stay correct ...
>
>> BTW: You'll get your error message if you run: $ echo notmykey |
>> cryptsetup luksOpen /dev/vg0/crypttest decryptedtes
>
> Yes, correct.
>
> -
>
> I really wonder what the reason is ... should I downgrade openssl?
>
> Thanks Stefan
>
>> With this password I get a "bad decrypt" so this explains why it
>> fails.
> If you cannot decrypt your keyfile (with openssl) then you have just
> lost any way to decrypt your partition!
>
> But there is an idea in the man page of which I didn't think: did
> you maybe change your users password? If so, you need to use the old
> pw to decrypt the keyfile. If you can, then you can use the new pw to
> encrypt the key again (make backups of the original file).
user-pw not changed, no ...
> There is also the possibility your keyfile was corrupted somehow
> (file system corruption?). Do you have a backup of the keyfile (and
> your data?
Restored the key-file from tape, no diff, no success.
I have some images as backup, would have to look closer ...
> BTW: a LUKS encrypted partition can have 8 keys (in so called "key
> slots"), so that you can add a "fallback key" the next time, which
> you store at a trusted place.
I am pretty sure that I used several slots, yes.
-
Remember that I said: "I am not sure which HOWTO I followed" ?
What if I didn't use aes-256-ecb?
I will try some other ciphers .... ;-)
Oh my, I luv documentation :-)
S
05-05-2010, 08:23 PM
"Stefan G. Weichinger"
Kernel upgrade and now LUKS failure.
Am 05.05.2010 22:17, schrieb Stefan G. Weichinger:
> Remember that I said: "I am not sure which HOWTO I followed" ?
>
> What if I didn't use aes-256-ecb?
Yep. See pam_mount.conf.xml:
It's "aes-256-cbc" in my case.
I was now able to luksOpen and I have the decrypted device mounted.
Nice.
So:
the user-pw didn't change and the keyfile is OK.
So why is pam_mount unable to mount it?
I will now pull another backup and check/add fallback keys ;-)