{"id":86,"date":"2006-07-29T11:59:00","date_gmt":"2006-07-29T19:59:00","guid":{"rendered":"http:\/\/outflux.net\/blog\/archives\/2006\/07\/29\/encrypted-network-filesystems\/"},"modified":"2008-07-17T11:55:53","modified_gmt":"2008-07-17T19:55:53","slug":"encrypted-network-filesystems","status":"publish","type":"post","link":"https:\/\/outflux.net\/blog\/archives\/2006\/07\/29\/encrypted-network-filesystems\/","title":{"rendered":"encrypted network filesystems"},"content":{"rendered":"<p>I run a machine in a colo across the country from me, and I wanted to have some backups closer to the machine.  So I signed up for a NAS login with my provider.  Since I didn&#8217;t want to leave all my files sitting on their disks in the clear, I built up an encrypted volume over the network.  It&#8217;s not fast, but it works.<\/p>\n<p>Here were the setup steps:<\/p>\n<ol>\n<li>mkdir -p \/mnt\/nas-raw \/mnt\/backups<\/li>\n<li>smbmount \/\/backup.server.at.my.isp\/mount.source.path \/mnt\/nas-raw -o username=myaccount,password=mypassword<\/li>\n<li>modprobe loop &#038;&#038; sleep 2<\/li>\n<li>dd if=\/dev\/zero of=\/mnt\/nas-raw\/volume bs=32k<\/li>\n<li>losetup \/dev\/loop0 \/mnt\/nas-raw\/volume<\/li>\n<li>cryptsetup create crypt-backups \/dev\/loop0 &#8211;cipher=aes-cbc-essiv:sha256<\/li>\n<li><em>Type volume pass-phrase<\/em><\/li>\n<li>mkfs.ext3 \/dev\/mapper\/crypt-backups<\/li>\n<li>mount \/dev\/mapper\/crypt-backups \/mnt\/backups<\/li>\n<\/ol>\n<p>To unmount it:<\/p>\n<ol>\n<li>umount \/mnt\/backups<\/li>\n<li>cryptsetup remove crypt-backups<\/li>\n<li>losetup -d \/dev\/loop0<\/li>\n<li>umount \/mnt\/nas-raw<\/li>\n<\/ol>\n<p>And then to remount it later:<\/p>\n<ol>\n<li>smbmount \/\/backup.server.at.my.isp\/mount.source.path \/mnt\/nas-raw -o username=myaccount,password=mypassword<\/li>\n<li>modprobe loop &#038;&#038; sleep 2<\/li>\n<li>losetup \/dev\/loop0 \/mnt\/nas-raw\/volume<\/li>\n<li>cryptsetup create crypt-backups \/dev\/loop0 &#8211;cipher=aes-cbc&#8211;essiv:sha256<\/li>\n<li><em>Type volume pass-phrase<\/em><\/li>\n<li>mount \/dev\/mapper\/crypt-backups \/mnt\/backups<\/li>\n<\/ol>\n<p>By scripting the &#8220;remount&#8221; steps, I can actually echo the volume password into an ssh connection:<\/p>\n<blockquote><p>\necho &#8216;my volume pass-phrase here&#8217; | ~\/bin\/do-crypto-mount<br \/>\nssh root@colo.machine.isp &#8220;\/etc\/dirvish\/dirvish-cronjob &#038;&#038; df -h \/mnt\/backups&#8221;<br \/>\n~\/bin\/do-crypto-umount\n<\/p><\/blockquote>\n<p>Very handy!<\/p>\n<p><strong>Update:<\/strong> I added the <code>--cipher<\/code> option to include the essiv type, which should be used.<\/p>\n<p style='text-align:left'>&copy; 2006 &#8211; 2008, <a href=\"https:\/\/outflux.net\/blog\/\">Kees Cook<\/a>. This work is licensed under a <a rel=\"license\" href=\"http:\/\/creativecommons.org\/licenses\/by-sa\/4.0\/\">Creative Commons Attribution-ShareAlike 4.0 License<\/a>.<br \/><a rel=\"license\" href=\"http:\/\/creativecommons.org\/licenses\/by-sa\/4.0\/\"><img decoding=\"async\" alt=\"CC BY-SA 4.0\" style=\"border-width:0\" src=\"https:\/\/i.creativecommons.org\/l\/by-sa\/4.0\/88x31.png\" \/><\/a> <\/p>\n","protected":false},"excerpt":{"rendered":"<p>I run a machine in a colo across the country from me, and I wanted to have some backups closer to the machine. So I signed up for a NAS login with my provider. Since I didn&#8217;t want to leave all my files sitting on their disks in the clear, I built up an encrypted [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[7,6],"tags":[],"_links":{"self":[{"href":"https:\/\/outflux.net\/blog\/wp-json\/wp\/v2\/posts\/86"}],"collection":[{"href":"https:\/\/outflux.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/outflux.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/outflux.net\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/outflux.net\/blog\/wp-json\/wp\/v2\/comments?post=86"}],"version-history":[{"count":0,"href":"https:\/\/outflux.net\/blog\/wp-json\/wp\/v2\/posts\/86\/revisions"}],"wp:attachment":[{"href":"https:\/\/outflux.net\/blog\/wp-json\/wp\/v2\/media?parent=86"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/outflux.net\/blog\/wp-json\/wp\/v2\/categories?post=86"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/outflux.net\/blog\/wp-json\/wp\/v2\/tags?post=86"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}