AIX 7.2 TL5 で追加された機能の暗号化論理ボリュームを確認したログです。
以下のトピックでは論理ボリューム・データ暗号化に関する情報が追加されました。
論理ボリュームの暗号化
暗号化された論理ボリューム
hdcryptmgr コマンド
keysvrmgr コマンド
環境
・ AIX 7.2 TL5 SP1
# oslevel -s
7200-05-01-2038
シナリオ1
・暗号化を有効にしたボリューム・グループ、論理ボリュームの作成と暗号化の初期化
- hdisk確認
# lspv
hdisk0 none None
hdisk1 00fa00d6b552f41b rootvg active
- 暗号化VGの作成
# mkvg -f -k y -y testvg hdisk0
0516-1254 mkvg: Changing the PVID in the ODM.
testvg
# echo $?
0
# lspv
hdisk0 00c37e501d35eead testvg active
hdisk1 00fa00d6b552f41b rootvg active
#
参考:mkvgコマンド
- 暗号化LVの作成
# mklv -t jfs2 -k y -y testlv testvg 10
testlv
mklv: Please run :
hdcryptmgr authinit lvname [..] to define LV encryption options.
# echo $?
0
-> hpcrptmgr コマンドを実行するようにメッセージが出ています。
参考:mklvコマンド
- 論理ボリュームの暗号鍵を初期化
# hdcryptmgr authinit testlv
Enter Passphrase:
Passphrases length should be longer than 12 characters.
Please confirm usage of an unsecure passphrase (y|n): n
#
-> 12文字以上が推奨のようです...
#
# hdcryptmgr authinit testlv
Enter Passphrase:
Confirm Passphrase:
Passphrase authentication method with name "initpwd" added successfully.
# echo $?
0
- ファイルシステムの作成
# crfs -v jfs2 -d testlv -m /test -A no
File system created successfully.
163628 kilobytes total disk space.
New File System size is 327680
# echo $?
0
参考: crfsコマンド
- 確認
# hdcryptmgr showvg
VG NAME / ID ENCRYPTION ENABLED
testvg yes
rootvg no
# hdcryptmgr showlv testlv
LV NAME CRYPTO ENABLED AUTHENTICATED ENCRYPTION (%) CONVERSION
testlv yes no 100 done
#
# hdcryptmgr showmd testlv
.....
..... Tue Dec 1 02:04:44 2020
..... Device type : LV
..... Device name : testlv
.....
=============== B: LV HEADER ================
Version : 0
MasterKey : Defined
MasterKey size : 16 bytes
Encryption status : Fully encrypted
Data crypto algorithm : AES_XTS
=============== E: LV HEADER ================
============= B: LV AUTH METHODS ============
---- Index #0 -------------------------------
Method defined : yes
Method name : initpwd
Authentication type : Passphrase
Auto-auth method : no
MasterKey crypto algorithm : AES_GCM
---- Index #1 -------------------------------
Method defined : no
---- Index #2 -------------------------------
Method defined : no
---- Index #3 -------------------------------
Method defined : no
---- Index #4 -------------------------------
Method defined : no
---- Index #5 -------------------------------
Method defined : no
============= E: LV AUTH METHODS ============
-> LV の CRYPTO ENABLED や LV AUTH METHODS が確認できます。
- VG/LV の状態確認
# lsvg -o
testvg
rootvg
# lsvg -l testvg
testvg:
LV NAME TYPE LPs PPs PVs LV STATE MOUNT POINT
testlv jfs2 10 10 1 closed/syncd /test
loglv01 jfs2log 1 1 1 closed/syncd N/A
# mount | grep test
#
-> testがマウントされていないことを確認
- mount を実行
# mount /test
# lsvg -l testvg
testvg:
LV NAME TYPE LPs PPs PVs LV STATE MOUNT POINT
testlv jfs2 10 10 1 open/syncd /test
loglv01 jfs2log 1 1 1 open/syncd N/A
-> testvg の LV STATE が open/syncd になりました。
- 暗号化LVのファイルシステム内でファイル作成
# cd /test
# touch test1
# vi test1
"test1"
aaaaaa
"test1" 1 line, 7 characters
# cat test1
aaaaaa
シナリオ2 VG非活動化による暗号化認証の確認
hdcryptmgrコマンド よりVG がOFFになるかシステム再始動で暗号化LV認証が切れるそうです。
ボリューム・グループがオフに変更されるか、システムが再始動されると、暗号化 LV に対する認証は期限切れになります。 そのデータにアクセスするには、暗号化 LV に対する認証を行う必要があります。 暗号化 LV の構成済み鍵保護方式を使用してください。 暗号化が有効になっている LV を認証するには、以下の手順に従ってください。
- 暗号化ボリューム testvg を非活動化
# lsvg -o
testvg
rootvg
-> 活動化状態を確認
- ファイルシステム・アンマウント
# ls -l /test
total 8
drwxr-xr-x 2 root system 256 Dec 01 01:49 lost+found
-rw-r--r-- 1 root system 7 Dec 01 01:53 test1
# umount /test
# ls -l /test
total 0
- varyoff を実施
# varyoffvg testvg
# echo $?
0
# lsvg -o
rootvg
- 非活動が確認できたので、活動化(varyonvg)を実施
# varyonvg testvg
# echo $?
0
# lsvg -o
testvg
rootvg
-> メッセージは特に出ていない。
- 暗号化LV(testlv)にあるファイル・システム(/test)にマウントしてみる。
# mount /test
mount: /dev/testlv on /test: I/O error
-> mount が失敗する。
- hdcryptmgr コマンドで testlv に対するパスワード認証を実行
# hdcryptmgr authunlock -t pwd testlv
Enter Passphrase:
Passphrase authentication succeeded.
# echo $?
0
-> 12文字以上のパスワードなので打ち間違えないか心配でしたが通った様子...
- もう一度 mount を実行
# mount /test
# ls -l /test
total 8
drwxr-xr-x 2 root system 256 Dec 01 01:49 lost+found
-rw-r--r-- 1 root system 7 Dec 01 01:53 test1
# cat /test/test1
aaaaaa
-> 今度は成功。/test 下に作成した test1 も見えます。
シナリオ3 暗号化ファイル・システム の非暗号化
- hdcryptmgrコマンドの crypt2plain オプションを実行
# hdcryptmgr crypt2plain testlv
Created recovery file : /var/hdcrypt/conv.004000011606810661
In case of error or if the conversion is canceled, this file may be
necessary to be able to recover the LV. If the conversion is fully
successful, then the file will be removed automatically.
Successfully converted LV testlv to an encryption disabled LV.
# echo $?
0
-> 成功しました
- ボリューム・グループの非活動化
# umount /test
# varyoffvg testvg
# echo $?
0
# lsvg -o
rootvg
- 再度活動化
# varyonvg testvg
# mount /test
# ls -l /test
total 8
drwxr-xr-x 2 root system 256 Dec 01 01:49 lost+found
-rw-r--r-- 1 root system 7 Dec 01 01:53 test1
# cat /test/test1
aaaaaa
#
-> マウントも、ファイルの確認もパスフレーズを使用することなく可能になりました。
- hdcryptmgrで状態確認。
# hdcryptmgr showvg
VG NAME / ID ENCRYPTION ENABLED
testvg yes
rootvg no
# hdcryptmgr showlv testlv
LV NAME CRYPTO ENABLED AUTHENTICATED ENCRYPTION (%) CONVERSION
testlv no n/a 0 n/a
#
-> VGは暗号化状態ですが、LVの暗号化は解除されています。
・暗号化された LV の制限については下記を参考
暗号化された論理ボリューム
・keysvrmgrコマンド の使い方がまだよくわかっていませんが、今回はここまでにします。
以上です。