All of lore.kernel.org
 help / color / mirror / Atom feed
* [dm-crypt] Encrypting DVD or CDROM from iso
@ 2020-11-10 16:22 Davide Marchi
  2020-11-10 16:59 ` Ondrej Kozina
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Davide Marchi @ 2020-11-10 16:22 UTC (permalink / raw)
  To: dm-crypt

Hi to all,

I'm wondering how to create a DVD or CDROM encrypted using dm-crypt.
I've followed this tutorial, with no luck: 
http://www.sourcentral.org/luks/iso9660/

and the DVD or cdrom created cannot be activated:



     cryptsetup --debug -r luksOpen /dev/sr1 dvdati
     # cryptsetup 2.0.2 processing "cryptsetup --debug -r luksOpen 
/dev/sr1 dvdati"
     # Running command open.
     # Locking memory.
     # Installing SIGINT/SIGTERM handler.
     # Unblocking interruption on signal.
     # Allocating context for crypt device /dev/sr1.
     # Trying to open and read device /dev/sr1 with direct-io.
     # Initialising device-mapper backend library.
     # Trying to load any crypt type from device /dev/sr1.
     # Crypto backend (gcrypt 1.8.1) initialized in cryptsetup library 
version 2.0.2.
     # Detected kernel Linux 5.3.1-050301-lowlatency x86_64.
     # PBKDF pbkdf2, hash sha256, time_ms 2000 (iterations 0), 
max_memory_kb 0, parallel_threads 0.
     # Reading LUKS header of size 1024 from device /dev/sr1
     # Key length 32, device size 2097151 sectors, header size 2050 
sectors.
     # Activating volume dvdati using token -1.
     # Interactive passphrase entry requested.
     Inserire la passphrase per /dev/sr1:
     # Activating volume dvdati [keyslot -1] using passphrase.
     # dm version   [ opencount flush ]   [16384] (*1)
     # dm versions   [ opencount flush ]   [16384] (*1)
     # Detected dm-ioctl version 4.40.0.
     # Detected dm-crypt version 1.19.0.
     # Device-mapper backend running with UDEV support enabled.
     # dm status dvdati  [ opencount flush ]   [16384] (*1)
     # Trying to open key slot 0 [ACTIVE_LAST].
     # Reading key slot 0 area.
     # Using userspace crypto wrapper to access keyslot area.
     Slot di chiave 0 sbloccato.
     # Calculated device size is 2093055 sectors (RW), offset 4096.
     # DM-UUID is CRYPT-LUKS1-fc00404de1784730ae9492929a0db06c-dvdati
     # Udev cookie 0xd4d0652 (semid 10) created
     # Udev cookie 0xd4d0652 (semid 10) incremented to 1
     # Udev cookie 0xd4d0652 (semid 10) incremented to 2
     # Udev cookie 0xd4d0652 (semid 10) assigned to CREATE task(0) with 
flags DISABLE_LIBRARY_FALLBACK         (0x20)
     # dm create dvdati 
CRYPT-LUKS1-fc00404de1784730ae9492929a0db06c-dvdati [ opencount flush ]  
  [16384] (*1)
     # dm reload dvdati  [ opencount flush readonly securedata ]   
[16384] (*1)
     device-mapper: reload ioctl on   failed: Argomento non valido
     # Udev cookie 0xd4d0652 (semid 10) decremented to 1
     # Udev cookie 0xd4d0652 (semid 10) incremented to 2
     # Udev cookie 0xd4d0652 (semid 10) assigned to REMOVE task(2) with 
flags DISABLE_LIBRARY_FALLBACK         (0x20)
     # dm remove dvdati  [ opencount flush readonly securedata ]   
[16384] (*1)
     # Udev cookie 0xd4d0652 (semid 10) decremented to 1
     # Udev cookie 0xd4d0652 (semid 10) waiting for zero
     # Udev cookie 0xd4d0652 (semid 10) destroyed
     # Releasing crypt device /dev/sr1 context.
     # Releasing device-mapper backend.
     # Unlocking memory.
     Comando non riuscito con codice -1 (parametri errati o mancanti).



and also the iso not dockable to the loopback device:

     #cryptsetup -r luksOpen /dev/loop20 volume1
     #The required offset is beyond the actual size of the /dev/loop20 
device




Could you give me a tips for make it working?


Many thanks!


Davide

^ permalink raw reply	[flat|nested] 10+ messages in thread
* Re: [dm-crypt] Encrypting DVD or CDROM from iso
@ 2020-11-18 14:59 Davide Marchi
  0 siblings, 0 replies; 10+ messages in thread
From: Davide Marchi @ 2020-11-18 14:59 UTC (permalink / raw)
  To: dm-crypt

Hi to all and excuse me for delay but lately the life seems to me more 
complicated :-D

Coming to us, I've repeat all procedure using Cryptsetup 2.3.3, with the 
same tutorial -> "http://www.sourcentral.org/luks/iso9660/" and the 
results seems the same, as you can see:

> cryptsetup --debug -r luksOpen image.iso volume1
> # cryptsetup 2.3.3 processing "cryptsetup --debug -r luksOpen image.iso 
> volume1"
> # Running command open.
> # Locking memory.
> # Installing SIGINT/SIGTERM handler.
> # Unblocking interruption on signal.
> # Allocating context for crypt device image.iso.
> # Trying to open and read device image.iso with direct-io.
> # Trying to open device image.iso without direct-io.
> # Initialising device-mapper backend library.
> # Trying to load any crypt type from device image.iso.
> # Crypto backend (OpenSSL 1.1.1f  31 Mar 2020) initialized in 
> cryptsetup library version 2.3.3.
> # Detected kernel Linux 5.8.0-25-generic x86_64.
> # Loading LUKS2 header (repair disabled).
> # Acquiring read lock for device image.iso.
> # Verifying lock handle for image.iso.
> # Device image.iso READ lock taken.
> # Trying to read primary LUKS2 header at offset 0x0.
> # Opening locked device image.iso
> # Veryfing locked device handle (regular file)
> # LUKS2 header version 2 of size 16384 bytes, checksum sha256.
> # 
> Checksum:47874913fa24493aa71dc39d3ff41d1dc1f36719eea32c2fb1b6a1aef1a09ac9 
> (on-disk)
> # 
> Checksum:47874913fa24493aa71dc39d3ff41d1dc1f36719eea32c2fb1b6a1aef1a09ac9 
> (in-memory)
> # Trying to read secondary LUKS2 header at offset 0x4000.
> # Reusing open ro fd on device image.iso
> # LUKS2 header version 2 of size 16384 bytes, checksum sha256.
> # 
> Checksum:29975a514962a03e116133c091e725a47e5b6ccb077cf6e1502a259618737297 
> (on-disk)
> # 
> Checksum:29975a514962a03e116133c091e725a47e5b6ccb077cf6e1502a259618737297 
> (in-memory)
> # Device size 16777216, offset 16777216.
> # Device image.iso READ lock released.
> # Only 2 active CPUs detected, PBKDF threads decreased from 4 to 2.
> # PBKDF argon2i, time_ms 2000 (iterations 0), max_memory_kb 1048576, 
> parallel_threads 2.
> # Activating volume volume1 using token -1.
> # Interactive passphrase entry requested.
> Enter passphrase for image.iso:
> # Activating volume volume1 [keyslot -1] using passphrase.
> # dm version   [ opencount flush ]   [16384] (*1)
> # dm versions   [ opencount flush ]   [16384] (*1)
> # Detected dm-ioctl version 4.42.0.
> # Detected dm-crypt version 1.21.0.
> # Device-mapper backend running with UDEV support enabled.
> # dm status volume1  [ opencount noflush ]   [16384] (*1)
> # Keyslot 0 priority 1 != 2 (required), skipped.
> # Trying to open LUKS2 keyslot 0.
> # Reading keyslot area [0x8000].
> # Acquiring read lock for device image.iso.
> # Verifying lock handle for image.iso.
> # Device image.iso READ lock taken.
> # Reusing open ro fd on device image.iso
> # Device image.iso READ lock released.
> # Verifying key from keyslot 0, digest 0.
> # Loading key (64 bytes, type logon) in thread keyring.
> # dm versions   [ opencount flush ]   [16384] (*1)
> # dm status volume1  [ opencount noflush ]   [16384] (*1)
> # Allocating a free loop device.
> # Trying to open device /dev/loop6 without direct-io.
> Requested offset is beyond real size of device image.iso.
> # Requesting keyring logon key for revoke and unlink.
> # Releasing crypt device image.iso context.
> # Releasing device-mapper backend.
> # Closing read only fd for image.iso.
> # Closed loop /dev/loop6 (image.iso).
> # Unlocking memory.
> Command failed with code -1 (wrong or missing parameters).



I've not tested jet the Carlos way, but in the next days I will let you 
know:

"Carlos E. R." ha scritto:
> Hum. I created encrypted DVD years ago with a similar procedure,
> somewhat simpler. Basically, I created an empty file of the same size 
> as
> the CD or DVD, mounted it as a loop device, then I encrypted that loop
> device, and then I formatted the resulting luks device with any
> filesystem type I wished, typically XFS.
> 
> This, so far, still works.
> 
> Then I just burn that file to DVD.


and

"Milan Broz" ha scritto:
> Are you sure that your *.iso image was correctly created? It seems to 
> me that
> it is just LUKS header without data (that's why "beyond offset" error).
> 
> Milan

No I'm not sure, indeed I think it's as you say. And I think this is a 
block size problem almost certainly!


Eventually if you have any other way, maybe tested by you, for the 
creation of encrypted cdroms/cdvs, would you please me ;-)

Many thanks!


Davide

^ permalink raw reply	[flat|nested] 10+ messages in thread
* Re: [dm-crypt] Encrypting DVD or CDROM from iso
@ 2020-11-18 17:25 Davide Marchi
  2020-11-18 18:03 ` Milan Broz
  0 siblings, 1 reply; 10+ messages in thread
From: Davide Marchi @ 2020-11-18 17:25 UTC (permalink / raw)
  To: dm-crypt

Hi to All,
finally I've found the right (and tested) procedure in this simple 
script, made by sowbug: 
https://gist.github.com/sowbug/c7f83140581fbe3e6a9b3ddf24891e77#gistcomment-3531970


# All the code from 
http://billauer.co.il/blog/2010/10/encrypted-iso-dvd-luks-dm-crypt-fedora-linux/

MB_COUNT=100
VOL_NAME=MyVolName
DIR_TO_COPY=/tmp/mydir

# Make a 100MB disk image
dd if=/dev/zero of=disk.img bs=1M count=$MB_COUNT

# become root
sudo su

# write to the image
# ****** NOTE that you'll be prompted three times for a passphrase
losetup /dev/loop1 disk.img && \
   cryptsetup luksFormat /dev/loop1 && \
   cryptsetup luksOpen /dev/loop1 mybackupdisk && \
   genisoimage -R -J -joliet-long -graft-points -V $VOL_NAME -o 
/dev/mapper/mybackupdisk $DIR_TO_COPY

# close the device
cryptsetup luksClose /dev/mapper/mybackupdisk && \
   losetup -d /dev/loop1

# Now you have disk.img that can be burned to a CD/DVD, or just mount it 
in Linux.
# You'll be prompted for the passphrase each time you mount it.


Thanks

Davide
Italy

^ permalink raw reply	[flat|nested] 10+ messages in thread
[parent not found: <mailman.1.1605783602.13300.dm-crypt@saout.de>]

end of thread, other threads:[~2020-11-19 13:06 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-10 16:22 [dm-crypt] Encrypting DVD or CDROM from iso Davide Marchi
2020-11-10 16:59 ` Ondrej Kozina
2020-11-11 19:16 ` Carlos E. R.
2020-11-12  9:36   ` Milan Broz
2020-11-12 10:08     ` Carlos E. R.
2020-11-12  9:32 ` Milan Broz
2020-11-18 14:59 Davide Marchi
2020-11-18 17:25 Davide Marchi
2020-11-18 18:03 ` Milan Broz
     [not found] <mailman.1.1605783602.13300.dm-crypt@saout.de>
2020-11-19 13:05 ` Davide Marchi

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.