当缺省安全在安装时选择时,只有最少的一部分文件集被安装(大约 100 个文件集)。这明显少于正常饱满安装时安装的至少 250 文件集。但是缺省安全提供最少的文件集至少能让 AIX 启动。当然在此后我们可以根据需要任意添加需要的文件集。
- 如何使用 NIM 安装缺省安全模式系统(Secure by Default)
我们接下来应该根据如下步骤。
1. 初始化和创建 NIM Master 资源
2. 修改 NIM bosinst_data 资源特性
3. 定义 NIM 客户端
4. 分配 NIM 资源给 NIM 客户端
5. 执行 bos_inst 操作
6. 开始安装
用户需要从安装网卡网络启动 NIM 客户机。
首先,我们需要初始化 NIM Master 资源,我们可以通过命令行和 smit 两种方式来实现:
命令行方式:
nim_master_setup
Smit 方式:
smit nim -> Configure the NIM Environment -> Configure a Basic NIM Environment (Easy Startup)
完成后我们可以通过 lsnim 来列出所有的 nim 中的资源,包括 lpp_source, spot,
bash-2.05b# lsnim
master machines master
boot resources boot
nim_script resources nim_script
network1 networks ent
lpp_source1 resources lpp_source
Spot1 resources spot
bid_ow resources bosinst_data
61_src_grp groups res_group
testnode machines standalone
osprereboot resources script
|
命令中重要选项含义:
nim_master_setup: NIM 中用初始化网络安装管理(NIM)主控机文件集,配置 NIM 主控机和创建安装所需的资源。
在 nim 中,我们需要修改 bosinst_data 资源的属性 SECURE_BY_DEFAULT。
首先我们可以通过如下命令 lsnim –l 列出 bosinst_data 资源的详细信息:
bash-2.05b# lsnim -l bid_ow
bid_ow:
class = resources
type = bosinst_data
Rstate = ready for use
prev_state = unavailable for use
location = /export/bosinst_data/bid_ow
alloc_count = 4
server = master
|
命令中重要选项含义:
alloc_count 本资源被划分给其他 client 的次数
然后,我们需要编辑 /export/bosinst_data/bid_ow 文件,把其中 SECURE_BY_DEFAULT 属性从 no 改为 yes.
….
MKSYSB_MIGRATION_DEVICE =
TRUSTED_AIX = no
TRUSTED_AIX_LSPP = no
TRUSTED_AIX_SYSMGT = yes
|
SECURE_BY_DEFAULT = yes ------> 设为 yes
该文件中重要选项含义:
TRUSTED_AIX: 可以通过将这个参数设为 yes 来安装可信任的 AIX 系统
SECURE_BY_DEFAULT:缺省安全模式参数,如果被设为 yes,在 bosinst 安装中将会安装缺省安全模式的 AIX 系统。
按照如下步骤,NIM 客户机资源 testnode 将被建立
命令行方式:
#/usr/sbin/nim -o define -a netboot_kernel=64 -a platform=chrp
-a net_settings1='auto auto' -a if1='10_1_1_0_net testnode.ibm.com 720AF0C200000 ent'
-a cable_type1=N/A testnode
|
命令中的重要选项含义:
netboot_kernel:网络启动内核类型
net_settings1:网络速率(100,1000 或者 auto)和半 / 全双工设定(half,full 或者 auto)
cable_type1:缆线类型 ( 可以设为 bnc,dix,tp 或者 N/A)
SMIT 方式:
smit nim -> Perform NIM Administration Tasks -> Manage Machines -> Define a Machine
如下图所示:
首先:选择 ent(ethernet 网络类型)
------------------------------------------------------------------------------
Define a Machine
Type or select a value for the entry field.
Press Enter AFTER making all desired changes.
[Entry Fields]
* Host Name of Machine [testnode]
(Primary Network Install Interface)
+--------------------------------------------------------------------------+
| Type of Network Attached to Primary Network Install Interface |
| Move cursor to desired item and press Enter. |
| tok = token ring network |
| ent = ethernet network <<<< |
| fddi = FDDI network |
| generic = generic network (no network boot capability) |
| atm = ATM network |
| ent6 = IPv6 ethernet network
|
其次,在如下图表中,填写相关的 NIM 信息。
Define a Machine
Type or select values in entry fields.
Press Enter AFTER making all desired changes.
[Entry Fields]
* NIM Machine Name [testnode]
* Machine Type [standalone]
* Hardware Platform Type [chrp]
Kernel to use for Network Boot [64]
Communication Protocol used by client []
Primary Network Install Interface
* Cable Type bnc
Network Speed Setting [auto]
Network Duplex Setting [auto]
* NIM Network [ent-Network5]
* Network Type ent
* Ethernet Type Standard
* Subnetmask []
* Default Gateway Used by Machine []
* Default Gateway Used by Master [1.0.0.10]
* Host Name testnode
Network Adapter Hardware Address [0]
Network Adapter Logical Device Name []
IPL ROM Emulation Device []
CPU Id []
Machine Group []
Comments
|
其中命令中重要参数含义:
NIM Machine Name: NIM 客户机名
Machine Type: NIM 客户机类型
Hardware Platform Type:硬件平台类型
NIM Network: NIM 网络资源名
Cable Type:缆线类型
Network Type:网络类型
Network Speed Setting: NIM 网卡速度设定
Subnetmask:NIM 网络资源的子网掩码
NIM 客户端在 NIM 中被定义后,我们需要把可以相应要装的 AIX 系统 NIM 资源非配给它,比如说 lppsource 和 spot。
命令行方式:
# nim -o bos_inst -a source=rte -a boot_client=no -a lpp_source= lpp_source1
-a spot=spot1 -a bosinst_data=bid_ow -a accept_licenses=yes testnode
|
SMIT 方式:
mit nim -> Perform NIM Administration Tasks -> Manage Machines -> Manage Network Install Resource Allocation
或者:smitty nim_mac_res
具体步骤如下:
首先,在 Manage Machine 中选择 Manage Network Install Resource Allocation
Manage Network Install Resource Allocation
Move cursor to desired item and press Enter.
List Allocated Network Install Resources
Allocate Network Install Resources <<<<<<<<<<<<<<<<<<<
Deallocate Network Install Resources
|
其次,选择要被分配的客户端机器,选择需要分配的 lppsource 和 spot 资源,然后确认。
至此,NIM 客户端所需要的 NIM 资源分配完毕。
在 NIM 客户端定义完毕,并且已经分配了相应的 NIM 资源后,我们可以进行系统的安装了。
命令行方式:
# nim -o bos_inst -a source=rte -a boot_client=no -a lpp_source= lpp_source1
-a spot=spot1 -a bosinst_data=bid_ow -a accept_licenses=yes testnode
|
SMIT 方式:
smit nim -> Perform NIM Administration Tasks ->
Manage Machines -> Manage Network Install Resource Allocation
或者 smitty nim_mac_op
然后选择 testnode 作为 NIM 客户端,并且选择 bos_inst = perform a BOS installation
首先,在选择 Manage Machines 中选择你要按转的客户端 testnode,
Change/Show Characteristics of a Machine
Type or select values in entry fields.
Press Enter AFTER making all desired changes.
|
其次在如下的界面中选择 bos_inst
Manage Machines
+--------------------------------------------------------------------------+
| Operation to Perform |
| |
| Move cursor to desired item and press Enter. Use arrow keys to scroll. |
| |
| [TOP] |
| diag = enable a machine to boot a diagnostic image |
| cust = perform software customization |
| bos_inst = perform a BOS installation |
| maint = perform software maintenance |
| reset = reset an object's NIM state |
| fix_query = perform queries on installed fixes |
| check = check the status of a NIM object |
| reboot = reboot specified machines |
| maint_boot = enable a machine to boot in maintenance mode |
| showlog = display a log in the NIM environment |
[TOP] [Entry Fields]
|
最后,选择 bos_inst 后,填写如下参数,把 accept license 改为 yes,Initiate Boot Operation on Client 改为 no。
Perform a Network Install
Type or select values in entry fields.
Press Enter AFTER making all desired changes.
[Entry Fields]
Target Name testnode
Source for BOS Runtime Files rte +
installp Flags [-agX]
Fileset Names []
Remain NIM client after install? yes +
Initiate Boot Operation on Client? no +
Set Boot List if Boot not Initiated on Client? no +
Force Unattended Installation Enablement? no +
ACCEPT new license agreements? [yes] +
|
在 NIM 客户端的 SMS 中把 server IP 设为 NIM Master,启动 testnode,系统开始安装。通过 csm rconsole 或者 HMC 上开一个客户端的 console,用户可以看到 NIM 客户端的客户端输出。
这时候,我们会看到安装停在如下的界面,
>>> 1 Type 1 and press Enter to have English during install.
……
88 Help ?
>>> Choice [1]: 1
|
我们选择 1 继续
我们会看到安装停在如下的 Overwrite Installation Summary
Welcome to Base Operating System
Installation and Maintenance
Type the number of your choice and press Enter. Choice is indicated by >>>.
>>> 1 Start Install Now with Default Settings
2 Change/Show Installation Settings and Install
3 Start Maintenance Mode for System Recovery
4 Configure Network Disks (iSCSI)
5 Select Storage Adapters
BOSINST_DEBUG enabled
88 Help ?
99 Previous Menu
>>> Choice [1]:
|
在 Installation and Maintenance 对话框中选择 1 Continue with Install 如下所示:
Overwrite Installation Summary
Disks: hdisk0
Cultural Convention: C
Language: C
Keyboard: C
JFS2 File Systems Created: yes
System Management Software for Secure by Default: yes
System Management Client Software: yes
Enable System Backups to install any system: yes
Security: Secure by Default Enabled
>>> 1 Continue with Install
+-----------------------------------------------------
88 Help ? | WARNING: Base Operating System Installation will
99 Previous Menu | destroy or impair recovery of ALL data on the
| destination disk hdisk0.
>>> Choice [1]:
|
在 Overwrite Installation Summary 对话框中选择 1
此后正常默认安装即可。
在整个安装结束后,我们登入客户端可以通过 ODM 查询 SbD 的状态。
缺省安全是存储在 ODM 中的系统状态(就如同 TCB 或者 CCEBVAL)。我们可以在运行的系统上通过运行如下命令查询缺省安全的状态。deflt = "sbd_enabled" 表明系统正处于缺省安全的状态。
# odmget -q attribute=SbD_STATE PdAt
PdAt:
uniquetype = ""
attribute = "SbD_STATE"
deflt = "sbd_enabled"
values = ""
width = ""
type = ""
generic = ""
rep = ""
nls_index = 0
|
在安装过程中,是由 TCP 客户端的安装流程来确认安装的状态的。如果检测到 sbd_enabled,大量的二进制文件就会被移除,因为他们看起来是不安全的(也就是说,这些功能仅需要很小的授权即可获得)。
bos.net.tcp.client 文件集中,下面这些文件将会被移除:
/usr/bin/rcp, /usr/bin/rexec, /usr/bin/rsh,/usr/bin/remsh,/usr/bin/tftp,/usr/bin/utftp,/usr/lib/boot/tftp,/usr/bin/traceroute,/usr/sbin/sendmail_nonssl,/usr/sbin/sendmail_ssl,/usr/sbin/sendmail,/usr/sbin/mailq,/usr/sbin/newaliases,/usr/lib/sendmail,/usr/sbin/sendmail_load,/usr/sbin/netcd,/usr/sbin/netcdctrl,/usr/samples/tcpip/netcd.conf,/usr/lib/drivers/if_op
在 bos.net.tcp.server 文件集中,下面这些文件被移除:
/usr/sbin/gated,/usr/sbin/imapd,/usr/sbin/ipreport,/usr/sbin/iptrace,/usr/sbin/named8,/usr/sbin/named8-xfer,/usr/sbin/named9,/usr/sbin/pop3ds,/usr/sbin/routed,/usr/sbin/tcpdump,/usr/sbin/timed
一旦安装结束,系统重启后,aixpert 就会先在 /etc/firstboot,使用预先设定的规则 SbD.xml,即命令 aixpert –f /etc/security/aixpert/core/SbD.xml。
注意:该文件也可以记录在一个缺省安全的系统中的在初始选择时的文件变化。
如下为系统在安装完毕重启时的信息:
Welcome to AIX.
boot image timestamp: 20:42 10/07
The current time and date: 20:43:14 10/07/2008
processor count: 2; memory size: 4224MB; kernel size: 26074804
boot device: /pci@800000020000001/pci@2/pci1069,b166@1/scsi@0/sd@4:2
-------------------------------------------------------------------------------
Saving Base Customize Data to boot disk
Starting the sync daemon
Starting the error daemon
System initialization completed.
TE=OFF
CHKEXEC=OFF
CHKSHLIB=OFF
CHKSCRIPT=OFF
CHKKERNEXT=OFF
STOP_UNTRUSTD=OFF
STOP_ON_CHKFAIL=OFF
LOCK_KERN_POLICIES=OFF
TSD_FILES_LOCK=OFF
TSD_LOCK=OFF
TEP=OFF
TLP=OFF
Successfully updated the Kernel Authorization Table.
Successfully updated the Kernel Role Table.
Successfully updated the Kernel Command Table.
Successfully updated the Kernel Device Table.
OPERATIONAL MODE Security Flags
ROOT : ENABLED
System runtime mode is now OPERATIONAL MODE.
Setting tunable parameters...complete
Starting Multi-user Initialization
Performing auto-varyon of Volume Groups
Activating all paging spaces
swapon: Paging device /dev/hd6 is already active.
The current volume is: /dev/hd1
Primary superblock is valid.
|
当初始配置结束,如同正常 AIX 安装一样重启,安装辅助应用一些系统的基本设制(接受 license,设定时间和日期,设定 root 和密码等)已经完成。由于缺省安全规则是基于高安全等级的规则,严格密码规则已经包含在内。
用户想要加入文件集的个人定制化的包可以通过以下两个方式:
1. 在一个安全和隔离的网络环境中安装
2. 通过 CD/DVD 安装
我们推荐在初始安装后安装 openssh,因为缺省安装将会删除所有使用明码密码的远程服务(例如,telnet,ftp,rlogin 等)。这样的话用户任何进一步的定制都可以通过远程安全方式完成。
缺省安全下安装的任何系统都可以恢复成正常的系统,比如说,用户需要从 bos.net 包中添加在缺省安全状态下删除的文件集。
如果要恢复成正常的 AIX 系统,我们可以按照以下步骤:
在 ODM 中修改 sdb_state 的属性
- 运行 odmget -q attribute=SbD_STATE PdAt > sbd_state.
- 编辑 sbd_state 文件,把 sbd_enabled 改成 sbd_disabled.
PdAt:
uniquetype = ""
attribute = "SbD_STATE"
deflt = "sbd_enabled" ---> 把 sbd_enabled 改成 sbd_disabled
values = ""
width = ""
type = ""
generic = ""
rep = ""
nls_index = 0
|
- 运行 odmdelete -o PdAt -q attribute=SbD_STATE .
# odmdelete -o PdAt -q attribute=SbD_STATE
0518-307 odmdelete: 1 objects deleted.
|
bash-2.05b# odmget -q attribute=SbD_STATE PdAt
PdAt:
uniquetype = ""
attribute = "SbD_STATE"
deflt = "sbd_disabled"
values = ""
width = ""
type = ""
generic = ""
rep = ""
nls_index = 0
|
- 重新强制安装 bos.net.tcp.client 和 bos.net.tcp.server.
运行安装命令后,可以看到如下输出。
installp -IaXF -d . bos.net.tcp
….
Some configuration files could not be automatically merged into the system
during the installation. The previous versions of these files have been
saved in a configuration directory as listed below. Compare the saved files
and the newly installed files to determine if you need to recover
configuration data. Consult product documentation to determine how to
merge the data.
Configuration files which were saved in /lpp/save.config:
/etc/3270.keys
/etc/3270keys.hft
/etc/aixmibd.conf
/etc/bootptab
/etc/hostmibd.conf
/etc/inetd.conf
/etc/mail/sendmail.cf
/etc/map3270
/etc/mib.defs
/etc/ntp.conf
/etc/rc.bsdnet
/etc/rc.net
/etc/rc.tcpip
/etc/rpc
/etc/services
/etc/slip.hosts
/etc/slp.conf
/etc/snmpd.conf
/etc/snmpd.peers
/etc/snmpmibd.conf
/etc/syslog.conf
/etc/telnet.conf
installp: bosboot verification starting...
installp: bosboot verification completed.
installp: bosboot process starting...
bosboot: Boot image is 39994 512 byte blocks.
0503-292 This update will not fully take effect until after a
system reboot.
* * * A T T E N T I O N * * *
System boot image has been updated. You should reboot the
system as soon as possible to properly integrate the changes
and to avoid disruption of current functionality.
|
从上面的信息可以看出,真正使安装生效,我们需要在安装结束后,重启机器。
在机器重写启动完成后,我们可以运行:aixpert -l d
此时,系统就由缺省安全状态恢复到正常安装的安全模式下了