SUSE Linux で ファイルを完全削除 - 'シュレッダ'にかける

サーバから取り除いたディスクを完全に消去するには dd コマンドでランダムな数字を書き込むことが一番確実です。

Novell Open Enterprise Server(OES) には Data Shredding という属性があり、
http://www.novell.com/documentation/oes11/stor_nss_lx/data/bqq4w37.html
この機能を有効にすれば削除ファイルを自動的にランダムな数字でうめあわせてくれます。廃棄期限が来たサーバであれば、この属性を付けて Purge を行えば、自動的にファイルのシュレッディングを行ってくれるようです。
SUSE Linux で ファイルを完全削除 - \'シュレッダ\'にかける_a0056607_21173845.jpg

素の SUSE Linux ではこの機能はありません。

例えば、現在の開き領域のほぼ全てのブロックに巨大なランダムファイルを作って空き領域を埋め尽くすというのも一つの方法です。

-dd による方法-

ここでは 80Gb の空きを全て /dev/randam で埋めてみました。もちろん、廃棄するディスクをつないで of=/dev/sdX としてもいいわけですが....

sles11:~/tmp # dd if=/dev/random of=deleteme.file bs=1M count=80000 iflag=fullblock

^C4374+0 records in <--- あまりにも時間がかかりすぎるので中止
4374+0 records out
4586471424 bytes (4.6 GB) copied, 3141.68 s, 1.5 MB/s

sles11:~/tmp # ls -l
total 4483364
-rw-r--r-- 1 root root 4586471424 Aug 23 12:06 deleteme.file
sles11:~/tmp #


30分くらいかけてやっと4Gバイトほど埋めただけです。もっとも dd で /dev/randam で埋め尽くすことがHDDを下取りに出す場合一番推奨されることなのですが、(アメリカ国防省ではこの処理を三度やるのがルールらしい)いかにも時間がかかりすぎます。まぁこれだけやればどれほどのフォレンジック調査をしてもデータの復旧は不可能でしょう。

-Shred コマンド-

shred コマンドはディスク全体ではなく、「ファイル」を完全削除するのに最適な方法です。


sles11:~/tmp # ls -l
total 3249728
-rwxr--r-- 1 root root 3324467200 Aug 23 10:47 test.file
sles11:~/tmp # shred --help
Usage: shred [OPTION]... FILE...
Overwrite the specified FILE(s) repeatedly, in order to make it harder
for even very expensive hardware probing to recover the data.

Mandatory arguments to long options are mandatory for short options too.
-f, --force change permissions to allow writing if necessary
-n, --iterations=N overwrite N times instead of the default (3)
--random-source=FILE get random bytes from FILE
-s, --size=N shred this many bytes (suffixes like K, M, G accepted)
-u, --remove truncate and remove file after overwriting
-v, --verbose show progress
-x, --exact do not round file sizes up to the next full block;
this is the default for non-regular files
-z, --zero add a final overwrite with zeros to hide shredding
--help display this help and exit
--version output version information and exit

If FILE is -, shred standard output.

: 中略



ということなので -u (削除) -n 3(3回) -z (最後はNull書き) -v (進捗を表示) で約3.3Gのファイルを「シュレッダ」にかけてみました。


sles11:~/tmp #
sles11:~/tmp # shred -u -n 3 -z -v test.file
shred: test.file: pass 1/4 (random)...
shred: test.file: pass 1/4 (random)...2.9GiB/3.1GiB 94%
shred: test.file: pass 1/4 (random)...3.0GiB/3.1GiB 96%
shred: test.file: pass 1/4 (random)...3.1GiB/3.1GiB 100%
shred: test.file: pass 2/4 (random)...
shred: test.file: pass 3/4 (random)...
shred: test.file: pass 4/4 (000000)...
shred: test.file: removing
shred: test.file: renamed to 000000000
shred: 000000000: renamed to 00000000
shred: 00000000: renamed to 0000000
shred: 0000000: renamed to 000000
shred: 000000: renamed to 00000
shred: 00000: renamed to 0000
shred: 0000: renamed to 000
shred: 000: renamed to 00
shred: 00: renamed to 0
shred: test.file: removed
sles11:~/tmp #


3回目まではランダムな数字で産めて、最後に Null 書きして痕跡も消します。処理は数分で終わりました。

※追記 dd の進捗状態を調べることができます。こちらをご覧ください。
dd で進捗状態を確認するには
感触では dd if=/dev/random ... を使うより shred コマンドの方が早いという感じがしました。
以上追記終わり。


「削除証明書」を出すには dd でランダム埋めをするしかありませんが、ハイパーバイザーを使っている場合、仮想マシンのディスクイメージを shred するだけで、重要なデータを完全に破壊することが短時間でできるわけです。(もっともバックアップはどうするという問題もあるわけですが)

個人的には一番面倒のない「ディスクをバラしてプラッタを割る」のが一番確実だとおもうのですが、その上、HDDの外部のアルミ筐体とコントローラーボードを分別して処理業者に出せば喜ばれるのかなぁ。まぁそれはわかりませんが、捨てるのはもったいない、しリサイクルして欲しいな、という気持ちであれば、このような方法もありだということです。中にはアームを動かす強力な磁石があるので、子供の「夏休みの宿題」に使えるかもしれません。

また、なんらかの形でOSを起動してもOSが認識しない領域にデータが残っているじゃないか、だからハードウェア機器で完全消去するのがいいとおっしゃる方もいらっしゃいますが、一般的にそこまで必要かどうかは読者の皆さんのご判断に任せます。

実際にクラウドでレンタルサーバーなどを使っている場合、どのような形で運営事業者の中で扱われているかは不明です。「これはまずい」というデータがあれば「シュレッダにかけて解約する」こともかんがえておかなければならないと思います。



islandcenter.jp
by islandcenter | 2013-07-07 11:01 | SUSE | Comments(0)