Brad Gough, AIX 技术工程师, IBM Japan
2008 年 5 月 15 日 加密文件系统(EFS)是 AIX 6 的安全新特性之一。它实现了对单个文件的加密功能,从而提供了对文件系统更加精细地管理。本系列文章将比较详细地向您介绍这个新特性的详细内容,本文我们将介绍如何在各种组管理功能中集成新的加密特性。本文是摘自 IBM 红皮书《AIX V6 Advanced Security Features Introduction and Configuration》。
 | |
您可以访问“AIX 6 资源中心”了解更多的 AIX 6 的新特性:
|
|
定义组
每次当您创建新组时,都必须为其定义与安全相关的信息。示例 1 中显示已添加到 /etc/security/group 中的组安全属性。
示例 1 在组安全配置文件中添加的一些新的属性
# cat /etc/security/group|grep -ip group2
group2:
admin = false adms = root efs_keystore_access = file efs_initialks_mode = admin efs_keystore_algo = RSA_1024
为了支持这些实现组安全性的新属性,SMIT 的组管理界面上也相应增加了三个新的字段,如示例 2 所示。
示例 2 在 SMIT 面板中添加一些新字段以进行组的创建
Add a Group
Type or select values in entry fields.
Press Enter AFTER making all desired changes.
[Entry Fields]
* Group NAME [group1]
ADMINISTRATIVE group? false
+
Group ID []
#
USER list []
+
ADMINISTRATOR list []
+
Projects []
+
Initial Keystore Mode []
+
Keystore Encryption Algorithm []
+
Keystore Access []
+
F1=Help F2=Refresh F3=Cancel
F4=List
Esc+5=Reset Esc+6=Command Esc+7=Edit
Esc+8=Image
Esc+9=Shell Esc+0=Exit Enter=Do
|
示例 2 中新添加的几个字段的含义如下:
Initial Keystore Mode——这个字段用于描述用户密钥存储库的初始模式。
这个字段的值可能为 admin 或者 guard,分别对应于 root admin 模式或者 root guard admin 模式。
Keystore Encryption Algorithm——这个字段描述用户私钥和公钥所使用的算法和密钥长度。如果您更改这个字段的值,那么 /etc/security/user 中用户节的对应属性也会相应地更改。这个字段的值可能是以下值之一:
• RSA_1024
• RSA_2048
• RSA_4096
Key store access——这个字段的值必须为 file 或者 none。file 表示本地 的/var/efs/groups/*。none 表示没有密钥存储库。当由 root 创建组的时候,将使用缺省值初始化 /etc/security/group 中用户节的安全属性。此时,这个组并不存在密钥存储库。
当您在 root admin 模式中定义一个组的时候,会自动地将 root 分配作为组管理员。
组密钥存储库的设计和操作
组密钥存储库的内部设计与用户密钥存储库非常类似。
修改组密钥存储库的操作包括以下几种:
-
更改算法
-
更改密钥长度
-
生成新的密钥
-
删除已弃用的密钥
定义组并创建组密钥存储库
在示例 3 中,我们显示了如何通过进行下面的操作,为名为 group1 的组创建组密钥存储库:
-
定义一个名为 group1 的组。这个组中尚不包含任何用户。在 /var/efs/group 中,创建一个新的、名为 group1 的目录。这个目录中尚不包含任何密钥存储库。
-
创建一个名为 user3 的用户。将 user3 添加到 group1。
-
如果此时尝试创建一个组密钥存储库,那么该操作将再次失败,因为尽管该组中包含一个成员,但是对于这个用户,仍然不存在任何密钥存储库。
-
初始化 user3 的密码,因此创建了用户密钥存储库。
-
现在,可以成功地创建 group1 的密钥存储库。
-
自动地将 group1 密钥存储库的访问密钥发送到 user3 密钥存储库。当 user3 登录时,将自动地加载 group1 密钥存储库的访问密钥。
示例 3 创建组密钥存储库
# mkgroup group1
# lsgroup -a id users adms group1
group1 id=207 users=
# ls -al /var/efs/groups total 0
drwx------ 4 root system 256 May 02 14:12 .
drwxr-xr-x 5 root system 256 May 02 13:34 ..
-rw------- 1 root system 0 May 02 13:34 .lock
drwx------ 2 root system 256 May 02 14:12 group1
drwx------ 2 root system 256 May 02 13:34 security
# ls -al /var/efs/groups/group1
total 0
drwx------ 2 root system 256 May 02 14:12 .
drwx------ 4 root system 256 May 02 14:12 ..
-rw------- 1 root system 0 May 02 14:12 .lock
# efskeymgr -C group1
Encryption framework returned an error:
(The group does not contain any member with EFS crypto info)
kernel:The system call does not exist on this system.
# mkuser user3;chgroup users=user3 group1;lsgroup -a id users adms group1
group1 id=207 users=user3
# efskeymgr -C group1
Encryption framework returned an error:
(The group does not contain any member with EFS crypto info)
kernel:The system call does not exist on this system.
# passwd user3
Changing password for "user3"
user3's New password:
Enter the new password again:
# efskeymgr -C group1
# ls -al /var/efs/groups/group1
total 8
drwx------ 2 root system 256 May 02 14:27 .
drwx------ 4 root system 256 May 02 14:12 ..
-rw------- 1 root system 0 May 02 14:12 .lock
-rw------- 1 root system 1914 May 02 14:27 keystore
$ id uid=209(user3) gid=1(staff) groups=207(group1)
$ efskeymgr -v user3's EFS password:
Keystore content:
Keystore owner ............: uid 209
Keystore mode .............: admin:managed by EFS administrator
Password changed last on ..: 05/02/07 at 14:27:21
Private key:
Algorithm :RSA_1024
Fingerprint :7dc53a23:b8d1d7f0:c6f43e88:ae7be372:f585f4e4
Validity :This key is valid.
Access key to keystore group/group1
|

 |

|
将组密钥存储库的访问密钥发送给用户
当在 root admin 模式中运行时,通过下面的示例 4 中所示的步骤,您可以使用 efskeymgr 命令将组存储库的访问密钥发送到用户密钥存储库:
-
user5 不拥有 gruop1 的访问密钥。
-
将组密钥存储库的访问密钥发送到用户密钥存储库。
-
现在,user5 已经将组密钥存储库的访问密钥加载到了他或者她自己的用户密钥存储库中。但是,不会自动地将该密钥加载到活动进程中。
示例 4 将组密钥存储库的访问密钥发送给用户
$ id uid=207(user5) gid=1(staff) groups=202(group1)
$ efskeymgr -v
Keystore content:
Keystore owner ............: uid 207
Keystore mode .............: admin:managed by EFS administrator
Password changed last on ..: 05/03/07 at 17:39:43
Private key:
Algorithm :RSA_1024
Fingerprint :49e42532:e8c471bf:2be9ba03:3f9d12b4:4ba01cea
Validity :This key is valid.
# id uid=0(root) gid=0(system)
groups=2(bin),3(sys),7(security),8(cron),10(audit),11(lp)
# efskeymgr -k group/group1 -s user/user5
$ id uid=207(user5) gid=1(staff) groups=202(group1)
$ efskeymgr -v
Keystore content:
Keystore owner ............: uid 207
Keystore mode .............: admin:managed by EFS administrator
Password changed last on ..: 05/03/07 at 17:39:43
Private key:
Algorithm :RSA_1024
Fingerprint :49e42532:e8c471bf:2be9ba03:3f9d12b4:4ba01cea
Validity :This key is valid.
Access key to keystore group/group1
$ efskeymgr -V
List of keys loaded in the current process:
Key #0:
Kind .....................User key
Id (uid / gid) ......... 207
Type .....................Private key
Algorithm ................RSA_1024
Validity .................Key is valid
Fingerprint ..............
49e42532:e8c471bf:2be9ba03:3f9d12b4:4ba01cea
|
重要:当您使用 chuser 或者 chgroup 命令将用户添加到组的时候,会自动地将组访问密钥发送到用户密钥存储库。
当在 root admin 模式中运行时,root 可以将自己添加为任何组的成员,并且将自动地接收到相应的组访问密钥。任何组的成员用户都将在他的或者她的密钥存储库中自动地接受组访问密钥。
从用户密钥存储库中删除组密钥存储库的访问密钥
当在 root admin 模式中运行时,使用示例 5 中所示的步骤,您可以使用 efskeymgr 命令从用户密钥存储库中删除组密钥存储库的访问密钥:
-
user5 拥有对 group1 的访问密钥。当前 Shell 中加载了组访问密钥。
-
从用户密钥存储库中删除组密钥存储库的访问密钥。
-
尽管 user5 在他的或者她的用户密钥存储库中不包含组密钥存储库,但是并不会从活动的进程中自动地卸载组密钥存储库的访问密钥。
示例 5 将组密钥存储库的访问密钥发送给用户
$ id uid=207(user5) gid=1(staff) groups=202(group1)
$ efskeymgr -v
Keystore content:
Keystore owner ............: uid 207
Keystore mode .............: admin:managed by EFS administrator
Password changed last on ..: 05/03/07 at 17:39:43
Private key:
Algorithm :RSA_1024
Fingerprint :49e42532:e8c471bf:2be9ba03:3f9d12b4:4ba01cea
Validity :This key is valid.
Access key to keystore group/group1
$ efskeymgr -v
Keystore content:
Keystore owner ............: uid 207
Keystore mode .............: admin:managed by EFS administrator
Password changed last on ..: 05/03/07 at 17:39:43
Private key:
Algorithm :RSA_1024
Fingerprint :49e42532:e8c471bf:2be9ba03:3f9d12b4:4ba01cea
Validity :This key is valid.
Access key to keystore group/group1
$ efskeymgr -V
List of keys loaded in the current process:
Key #0:
Kind .....................User key
Id (uid / gid) ......... 207
Type .....................Private key
Algorithm ................RSA_1024
Validity .................Key is valid
Fingerprint ..............
49e42532:e8c471bf:2be9ba03:3f9d12b4:4ba01cea
Key #1:
Kind .....................Group key
Id (uid / gid) ......... 202
Type .....................Private key
Algorithm ................RSA_1024
Validity .................Key is valid
Fingerprint ..............
5100b522:fbee1dbe:2aeddbd3:c2e51fea:86ab4b5c
# id uid=0(root) gid=0(system)
groups=2(bin),3(sys),7(security),8(cron),10(audit),11(lp)
# efskeymgr -k user/user5 -S group/group1
$ id uid=207(user5) gid=1(staff) groups=202(group1)
$ efskeymgr -v
Keystore content:
Keystore owner ............: uid 207
Keystore mode .............: admin:managed by EFS administrator
Password changed last on ..: 05/03/07 at 17:39:43
Private key:
Algorithm :RSA_1024
Fingerprint :49e42532:e8c471bf:2be9ba03:3f9d12b4:4ba01cea
Validity :This key is valid.
$ efskeymgr -V
List of keys loaded in the current process:
Key #0:
Kind .....................User key
Id (uid / gid) ......... 207
Type .....................Private key
Algorithm ................RSA_1024
Validity .................Key is valid
Fingerprint ..............
49e42532:e8c471bf:2be9ba03:3f9d12b4:4ba01cea
Key #1:
Kind .....................Group key
Id (uid / gid) ......... 202
Type .....................Private key
Algorithm ................RSA_1024
Validity .................Key is valid
Fingerprint ..............
5100b522:fbee1dbe:2aeddbd3:c2e51fea:86ab4b5c
|
重要:当您使用 chuser 或者 chgroup 命令从组中删除用户的时候,不会自动地从用户密钥存储库中删除组访问密钥。
在 root guard 模式中添加/删除组访问密钥
当在 root guard 模式中运行时,root 不能够将自己添加为某个组的成员。当组管理员向组中添加一个组成员、或者从组中删除一个组成员时,会将对应的 cookie 发送到用户密钥存储库。
当用户第一次打开他的或者她的密钥存储库时,将提示他或者她接受/拒绝组访问密钥,如示例 6 所示。
示例 6 在 root guard 模式中接受/拒绝组访问密钥
$ efskeymgr -v
The following operation(s) is(are) pending on your EFS keystore:
You are granted access to group/group2 keystore.
Do you want to process this action now (y), later (n:default), or never (d)?[ y / n / d ]n
You are removed access to group/group2 keystore.
Do you want to process this action now (y), later (n:default), or never (d)?[ y / n / d ]n
Keystore content:
Keystore owner ............: uid 219
Keystore mode .............: guard:not managed by EFS
administrator
Password changed last on ..: 05/13/07 at 18:30:03
Private key:
Algorithm :RSA_1024
Fingerprint :1d0b0ee6:00ec743a:db95715c:ce04ff89:0b1ecfea
Validity :This key is valid.
Cookie:
Type ......: Remove (removes access to)
Keystore ..: group/group2
Cookie:
Type ......: Access (grants access to)
Keystore ..: group/group2
|
管理组密钥存储库的私钥
当在 root admin 模式中运行时,root 可以对组密钥存储库进行管理,如示例 7 中的场景所示:
-
lsgroup 命令显示,user3 属于 group1。
-
efskeymgr -v -k group/group1 命令显示组密钥的详细信息。
-
user3 在当前 Shell 中加载了组密钥。
-
root 生成一个新的组密钥。旧的密钥仍然保存于组密钥存储库中,并且被标记为已弃用。
-
自动地将新的密钥发送到用户密钥存储库。在用户密钥存储库中,旧的组密钥被标记为已弃用。在所有的新进程中,新的组密钥将成为活动密钥。
-
root 从组密钥存储库中删除已弃用的密钥。
-
已经删除了用户密钥存储库中已弃用的密钥,但是并没有在活动进程(在我们的示例中是当前的 Shell)中卸载这些密钥。新生成的 Shell 中将不再包含旧的密钥。
示例 7 更改组密钥存储库的私钥
# lsgroup -a users group1
group1 users=user1,user3
# efskeymgr -v -k group/group1
Keystore content:
Keystore owner ............: gid 202
Keystore mode .............: admin:managed by EFS administrator
Password changed last on ..: 05/09/07 at 19:43:52
Private key:
Algorithm :RSA_1024
Fingerprint :5967aba6:df046b56:8f4cc1b5:69f48c7a:ed88008f
Validity :This key is valid.
$ id uid=205(user3) gid=1(staff)
$ efskeymgr -v
Keystore content:
Keystore owner ............: uid 205
Keystore mode .............: admin:managed by EFS administrator
Password changed last on ..: 05/10/07 at 09:41:20
Private key:
Algorithm :RSA_1024
Fingerprint :44b0c7e1:53384985:ca1be27e:864b9431:3a57c0d1
Validity :This key is valid.
Access key to keystore group/group1
$ efskeymgr -V
List of keys loaded in the current process:
Key #0:
Kind .....................User key
Id (uid / gid) ......... 205
Type .....................Private key
Algorithm ................RSA_1024
Validity .................Key is valid
Fingerprint ..............
44b0c7e1:53384985:ca1be27e:864b9431:3a57c0d1
Key #1:
Kind .....................Group key
Id (uid / gid) ......... 202
Type .....................Private key
Algorithm ................RSA_1024
Validity .................Key is valid
Fingerprint ..............
5967aba6:df046b56:8f4cc1b5:69f48c7a:ed88008f
# efskeymgr -k group/group1 -R RSA_1024
# efskeymgr -v -k group/group1
Keystore content:
Keystore owner ............: gid 202
Keystore mode .............: admin:managed by EFS administrator
Password changed last on ..: 05/09/07 at 19:43:52
Private key:
Algorithm :RSA_1024
Fingerprint :9f5f057d:4f3f5a78:50058cd3:bf1a2e78:42ae3b20
Validity :This key is valid.
Private key:
Algorithm :RSA_1024
Fingerprint :5967aba6:df046b56:8f4cc1b5:69f48c7a:ed88008f
Validity :This key was deprecated on 05/10/07 at 20:15:53.
$ id uid=205(user3) gid=1(staff)
$ efskeymgr -o ksh
$ efskeymgr -V
List of keys loaded in the current process:
Key #0:
Kind .....................User key
Id (uid / gid) ......... 205
Type .....................Private key
Algorithm ................RSA_1024
Validity .................Key is valid
Fingerprint ..............
44b0c7e1:53384985:ca1be27e:864b9431:3a57c0d1
Key #1:
Kind .....................Group key
Id (uid / gid) ......... 202
Type .....................Private key
Algorithm ................RSA_1024
Validity .................Key is deprecated
Fingerprint ..............
5967aba6:df046b56:8f4cc1b5:69f48c7a:ed88008f
Key #2:
Kind .....................Group key
Id (uid / gid) ......... 202
Type .....................Private key
Algorithm ................RSA_1024
Validity .................Key is valid
Fingerprint ..............
9f5f057d:4f3f5a78:50058cd3:bf1a2e78:42ae3b20
# efskeymgr -k group/group1 -D
5967aba6:df046b56:8f4cc1b5:69f48c7a:ed88008f
# efskeymgr -v -k group/group1
Keystore content:
Keystore owner ............: gid 202
Keystore mode .............: admin:managed by EFS administrator
Password changed last on ..: 05/09/07 at 19:43:52
Private key:
Algorithm :RSA_1024
Fingerprint :9f5f057d:4f3f5a78:50058cd3:bf1a2e78:42ae3b20
Validity :This key is valid.
$ id uid=205(user3) gid=1(staff)
$ efskeymgr -o ksh
$ efskeymgr -V
List of keys loaded in the current process:
Key #0:
Kind .....................User key
Id (uid / gid) ......... 205
Type .....................Private key
Algorithm ................RSA_1024
Validity .................Key is valid
Fingerprint ..............
44b0c7e1:53384985:ca1be27e:864b9431:3a57c0d1
Key #1:
Kind .....................Group key
Id (uid / gid) ......... 202
Type .....................Private key
Algorithm ................RSA_1024
Validity .................Key is valid
Fingerprint ..............
9f5f057d:4f3f5a78:50058cd3:bf1a2e78:42ae3b20
|
当在 root guard 模式中运行时,只有组管理员可以生成新的组访问密钥、弃用密钥、或者删除已弃用的密钥。
更新到另一个组的密钥存储库的访问密钥
当在 root guard 模式中运行时,通过使用下面的示例 8 中所示的步骤,您可以使用 efskeymgr 命令将组密钥存储库的访问密钥发送到另一个用户组密钥存储库:
-
使用两次 efskeymgr 命令,以便显示 group1 和 group2 的组密钥存储库的内容。
-
正如 efskeymgr -v 命令所显示的,user3 是 group2 的成员。
-
root 使用 efskeymgr -s 命令将 group1 的访问密钥发送到 group2 密钥存储库。
-
efskeymgr -v -k group/group2 命令显示,group2 密钥存储库包含 group1 密钥存储库的访问密钥。
-
user3 密钥存储库的内容没有发生更改,因为没有直接向该用户授予任何附加的访问权限。
-
当使用 efskeymgr -o ksh 命令重新打开 user3 密钥存储库的内容时,新生成的 Shell 也将获得 group1 的组访问密钥。
-
root 使用 efskeymgr -S 命令从 group2 密钥存储库中删除 group1 的访问密钥。
-
efskeymgr -v -k group/group2 命令显示,group2 密钥存储库不再包含 group1 密钥存储库的访问密钥。
-
当使用 efskeymgr -o ksh 命令重新打开 user3 密钥存储库的内容时,新生成的 Shell 将不再拥有 group1 访问密钥。
示例 8 将一个组密钥存储库的访问密钥发送到另一个组
# efskeymgr -v -k group/group1
Keystore content:
Keystore owner ............: gid 204
Keystore mode .............: admin:managed by EFS administrator
Password changed last on ..: 05/13/07 at 13:17:25
Private key:
Algorithm :RSA_1024
Fingerprint :53cd3824:7c9d508e:b825a253:f3209fcf:76f1766f
Validity :This key is valid.
# efskeymgr -v -k group/group2
Keystore content:
Keystore owner ............: gid 205
Keystore mode .............: admin:managed by EFS administrator
Password changed last on ..: 05/13/07 at 13:51:07
Private key:
Algorithm :RSA_1024
Fingerprint :61e6538d:343c8313:df807f20:ab02451e:734309ca
Validity :This key is valid.
$ id uid=212(user3) gid=1(staff)
$ efskeymgr -v
Keystore content:
Keystore owner ............: uid 212
Keystore mode .............: admin:managed by EFS administrator
Password changed last on ..: 05/13/07 at 13:48:07
Private key:
Algorithm :RSA_1024
Fingerprint :1c9e287c:05a6b7b3:020ce4c5:0f578619:5c7ea3b6
Validity :This key is valid.
Access key to keystore group/group2
# efskeymgr -k group/group1 -s group/group2
# efskeymgr -v -k group/group2
Keystore content:
Keystore owner ............: gid 205
Keystore mode .............: admin:managed by EFS administrator
Password changed last on ..: 05/13/07 at 13:51:07
Private key:
Algorithm :RSA_1024
Fingerprint :61e6538d:343c8313:df807f20:ab02451e:734309ca
Validity :This key is valid.
Access key to keystore group/group1
$ id uid=212(user3) gid=1(staff)
$ efskeymgr -v
Keystore content:
Keystore owner ............: uid 212
Keystore mode .............: admin:managed by EFS administrator
Password changed last on ..: 05/13/07 at 13:48:07
Private key:
Algorithm :RSA_1024
Fingerprint :1c9e287c:05a6b7b3:020ce4c5:0f578619:5c7ea3b6
Validity :This key is valid.
Access key to keystore group/group2
$ efskeymgr -V
List of keys loaded in the current process:
Key #0:
Kind .....................User key
Id (uid / gid) ......... 212
Type .....................Private key
Algorithm ................RSA_1024
Validity .................Key is valid
Fingerprint ..............
61c9e287c:05a6b7b3:020ce4c5:0f578619:5c7ea3b6
Key #1:
Kind .....................Group key
Id (uid / gid) ......... 204
Type .....................Private key
Algorithm ................RSA_1024
Validity .................Key is valid
Fingerprint ..............
53cd3824:7c9d508e:b825a253:f3209fcf:76f1766f
Key #2:
Kind .....................Group key
Id (uid / gid) ......... 205
Type .....................Private key
Algorithm ................RSA_1024
Validity .................Key is valid
Fingerprint ..............
61e6538d:343c8313:df807f20:ab02451e:734309ca
# efskeymgr -k group/group2 -S group/group1
# efskeymgr -v -k group/group2
Keystore content:
Keystore owner ............: gid 205
Keystore mode .............: admin:managed by EFS administrator
Password changed last on ..: 05/13/07 at 13:51:07
Private key:
Algorithm :RSA_1024
Fingerprint :61e6538d:343c8313:df807f20:ab02451e:734309ca
Validity :This key is valid.
$ id uid=212(user3) gid=1(staff)
$ efskeymgr -o ksh
$ efskeymgr -V
List of keys loaded in the current process:
Key #0:
Kind .....................User key
Id (uid / gid) ......... 212
Type .....................Private key
Algorithm ................RSA_1024
Validity .................Key is valid
Fingerprint ..............
1c9e287c:05a6b7b3:020ce4c5:0f578619:5c7ea3b6
Key #1:
Kind .....................Group key
Id (uid / gid) ......... 205
Type .....................Private key
Algorithm ................RSA_1024
Validity .................Key is valid
Fingerprint ..............
61e6538d:343c8313:df807f20:ab02451e:734309ca
|
参考资料 学习
讨论
关于作者  | |  | Brad Gough 是 IBM 悉尼全球服务部门的一名 AIX 技术工程师,他从1987年进入 IBM,最开是一名 RS/6000 的硬件工程师,2000年他转做 AIX 的支持工作,主要擅长于AIX,NIM和HACMP。他目前主要负责澳大利亚和新西兰地区的 P 系列主机的安装以及实施工作。他拥有多个 IBM 的 P 系列认证。 |
对本文的评价
|