{"id":772,"date":"2009-08-28T20:59:49","date_gmt":"2009-08-28T17:59:49","guid":{"rendered":"http:\/\/www.void.gr\/kargig\/blog\/?p=772"},"modified":"2009-08-28T21:03:26","modified_gmt":"2009-08-28T18:03:26","slug":"how-to-use-encrypted-loop-files-with-a-gpg-passphrase-in-debian","status":"publish","type":"post","link":"https:\/\/www.void.gr\/kargig\/blog\/2009\/08\/28\/how-to-use-encrypted-loop-files-with-a-gpg-passphrase-in-debian\/","title":{"rendered":"how to use encrypted loop files with a gpg passphrase in Debian"},"content":{"rendered":"<p>Fast howto (mostly a note for personal use) on what&#8217;s needed on Debian to use an encrypted loop:<\/p>\n<p>1.  The necessary utilities (patched losetup)<br \/>\n<code># aptitude install loop-aes-utils <\/code><br \/>\n2. The necessary kernel-module<br \/>\n<code># aptitude install loop-aes-modules-2.6.30-1-686-bigmem<\/code><br \/>\n3. Create the keyfile (keep your computer as busy as possible while doing this to increase entropy)<br \/>\n<code># head -c 2925 \/dev\/urandom | uuencode -m - | head -n 66 | tail -n 65| gpg --symmetric -a >\/path\/to\/keyfile.gpg<\/code><br \/>\n4.  Loopfile creation (10Mb)<br \/>\n<code># dd if=\/dev\/urandom of=\/my-encrypted-loop.aes bs=1k count=10000<\/code><br \/>\n5. Initialize loopfile<br \/>\n<code># losetup -K \/path\/to\/keyfile.gpg -e AES256 \/dev\/loop5 \/home\/username\/crypto-loop.img<\/code><br \/>\n6. Format loopfile<br \/>\n<code># mke2fs \/dev\/loop5<\/code><br \/>\n7. Delete loop device<br \/>\n<code># losetup -d \/dev\/loop5<\/code><br \/>\n8. Create mount point for loopfile<br \/>\n<code># mkdir \/mnt\/crypto-loop<\/code><br \/>\n9. Add entry to fstab<\/p>\n<blockquote><p>\/home\/username\/crypto-loop.img \/mnt\/crypt-loop ext2 defaults,noauto,user,loop=\/dev\/loop7,encryption=AES256,gpgkey=\/path\/to\/keyfile.gpg 0 0<\/p><\/blockquote>\n<p>10. Try mounting the loopfile as user<br \/>\n<code>$ mount \/mnt\/crypto-loop<\/code><br \/>\n11. Check it&#8217;s mounted properly<br \/>\n<code>$ mount | grep -i aes<\/code><\/p>\n<p>and use it!<\/p>\n<p>P.S. Secure your keyfile.gpg, if it gets lost you won&#8217;t _ever_ be able to decrypt what was inside crypto-loop.img!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Fast howto (mostly a note for personal use) on what&#8217;s needed on Debian to use an encrypted loop: 1. The necessary utilities (patched losetup) # aptitude install loop-aes-utils 2. The necessary kernel-module # aptitude install loop-aes-modules-2.6.30-1-686-bigmem 3. Create the keyfile (keep your computer as busy as possible while doing this to increase entropy) # head [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"ep_exclude_from_search":false,"footnotes":""},"categories":[6,3],"tags":[189,33,598,82,595,187,188],"class_list":["post-772","post","type-post","status-publish","format-standard","hentry","category-encryption","category-linux","tag-aes","tag-debian","tag-encryption","tag-gpg","tag-linux","tag-loop","tag-loop-aes"],"aioseo_notices":[],"views":24151,"_links":{"self":[{"href":"https:\/\/www.void.gr\/kargig\/blog\/wp-json\/wp\/v2\/posts\/772","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.void.gr\/kargig\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.void.gr\/kargig\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.void.gr\/kargig\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.void.gr\/kargig\/blog\/wp-json\/wp\/v2\/comments?post=772"}],"version-history":[{"count":5,"href":"https:\/\/www.void.gr\/kargig\/blog\/wp-json\/wp\/v2\/posts\/772\/revisions"}],"predecessor-version":[{"id":777,"href":"https:\/\/www.void.gr\/kargig\/blog\/wp-json\/wp\/v2\/posts\/772\/revisions\/777"}],"wp:attachment":[{"href":"https:\/\/www.void.gr\/kargig\/blog\/wp-json\/wp\/v2\/media?parent=772"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.void.gr\/kargig\/blog\/wp-json\/wp\/v2\/categories?post=772"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.void.gr\/kargig\/blog\/wp-json\/wp\/v2\/tags?post=772"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}