Develop and Download Open Source Software

OpenSource Downloads

7-Zip  (3,583)  
CrystalDiskInfo  (1,811)  
Tera Term  (1,787)  
HandBrake Japanese Language Version  (1,743)  
CrystalDiskMark  (980)  
FFFTP  (765)  
ffdshow  (719)  
mixfont-mplus-ipa  (615)  
MergeDoc  (571)  
10  TortoiseSVN  (555)  
11  Amateras  (437)  
12  BathyScaphe  (396)  
13  FreeMind  (372)  
14  Cabos  (327)  
15  ギコナビ  (316)  
More >>

Cryptmountでファイルシステムとスワップ空間を保護する

2008年04月24日 10:55 Ben-Martin(2008年3月6日(木)) 1 2 3 4
  Cryptmount を使えば、ファイルシステムとスワップ空間の両方を暗号化できる。暗号化されたファイルシステムは、通常のファイルシステムと同じように(たとえば「/dev/sda2」を使って)ブロックデバイスに格納できるほか、別のファイルシステムに属する普通のファイル内に格納することもできる。後者の方法が特に役立つのは、パーティションテーブルを変更したりLVM(Logical Volume Manager)を使ったりせずに暗号化されたファイルシステムを扱いたい場合だ。Cryptmountではスワップ空間も暗号化できるので、暗号化されたファイルシステムに含まれる情報のセキュリティが、プロセスをハードディスクにスワップアウトするLinuxカーネルによって不用意に損なわれることもない。

 Cryptmountで設定した暗号化は、Linuxカーネルのデバイスマッパのレベルで行われる。これは、サポートされている任意のファイルシステムタイプをデバイスマッパで暗号化されたブロックデバイスファイル上に作成できることを意味する。Cryptmountで扱える部分は、デバイスマッパによる暗号化の設定と、暗号化されたデバイスマッパレイヤ上に存在するファイルシステムのマウントである。ただし、Cryptmountの簡単な使い方では、これらの詳細を知る必要はない。

 CryptmountのパッケージはUbuntu GutsyのUniverseリポジトリにあるほか、SlackwareやGentoo向けのものもさまざまな形で入手できる。また、SourceForge.netのCryptmountのページには、Fedora 8にインストールできるRPMファイルが用意されている。

 Cryptmountを試す一番簡単な方法は、対話式スクリプトcryptmount-setupを使うことだ。暗号化されたファイルシステムを1つのファイルとして手早く作成できる。なお、cryptmount-setupのデフォルト設定は、暗号化されたコンテンツ用のディレクトリを「/home」の下に作成するものになっている。

# cryptmount-setup
********************************
* cryptmount setup script
*
* This program will allow you to setup a secure filing-system that will
* be managed by "cryptmount". You will be able to select basic features
* such as the location and size of the filesystem - if you want more
* advanced features, you should consult the cryptmount manual page.
*
...
  Please enter a target name for your filesystem
  [opaque]: my-encrypted-files
  Which user should own the filesystem (leave blank for root)
  []:
  Please specify where "my-encrypted-files" should be mounted
  [/home/crypt]:
  Enter the filesystem size (in MB)
  [64]: 256
  Enter a filename for your encrypted container
  [/home/crypto.fs]:
  Enter a location for the keyfile
  [/etc/cryptmount/my-encrypted-files.key]:
...
enter new password for target "my-encrypted-files":
confirm password:
Formatting encrypted filesystem...
enter password for target "my-encrypted-files":

Your new encrypted filesystem is now ready for use.
To access, try:
    cryptmount my-encrypted-files
    cd /home/crypt
After you have finished using the filesystem, try:
    cd
    cryptmount --unmount my-encrypted-files

# cryptmount my-encrypted-files
enter password for target "my-encrypted-files":
e2fsck 1.40.2 (12-Jul-2007)
/dev/mapper/my-encrypted-files: clean, 11/65536 files, 18561/262144 blocks

# df /home/crypt
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/mapper/my-encrypted-files
                        253871     10288    230476   5% /home/crypt

 「cryptmount --unmount」という部分に注意してほしい。Linuxカーネルは「/home/crypt」をごく普通のファイルシステムと見なすだろうが、「umount /home/crypt」としてはならない。Cryptmountではまだアクティブと見なされているからだ。これを実行すると、カーネルのファイルシステムはアンマウントされるが、Cryptmount側で再マウントしようとしても“create ioctl failed:Device or resource busy”というメッセージが出て失敗することになる。

 このようにファイルシステムのアンマウントが行われてしまうと、本来は正しい「cryptmount --unmount my-encrypted-files」というコマンドの実行にも失敗し、指定されたファイルシステムがマウントされていないとのメッセージがCryptmountから出力されることになる。この問題を解決するには、「--release」オプションを使って、ほかの方法ですでにアンマウントされたcryptmount関連のリソースを解放するようにCryptmountに指示すればよい。

最終更新:2008年06月24日 17:07
SourceForge.JP is a Japanese version of SourceForge.net. For developments that are not related to Japan, we recommend you to use SourceForge.net.