GBase8s–label安全标签的使用
一、 启动/停止服务/登录
数据库启动命令:oninit -vy
数据库停止命令:onmode -ky
查看进程命令:ps -ef | grep oninit
登录:dbaccess - - 数据库名称
二、 Admin模式
a) 在这种模式下只有 DBSA 和 gbasedbt能够连接到 IDS 服务器
b) 在执行数据库维护工作时非常有用
c) 可以使用以下命令进入Admin模式
i. onmode -j (在On-Line 模式下)
oninit -j (在Off-Line模式下)
三、 创建用户
1、Informix数据库支持两种用户访问方式,数据库内部用户和操作系统用户。
数据库内部用户是指使用create user命令创建的用户,通过映射配置,新建用户可以映射到操作系统用户。这种方法使系统可以通过映射系统中已存在的除gbasedbt和root以外的其他用户,来访问数据库。这种机制将会减少为了使用数据库儿创建的大量系统用户。减少DBA的工作量,增加系统的安全系数。
2、创建系统用户
groupadd gbasedbt
useradd -g gbasedbt gbasedbt
passwd gbasedbt
密码:huaku521
3、创建非系统用户
useradd USER //USER为非系统用户&映射用户
passwd huaku123
4、编辑/etc/gbasedbt/allow.surrogates文件来确定使用USER为用户的映射账户
5、将USER设为默认用户
6、dbacess sysuser登录创建映射用户
7、为用户赋权限
8、分别用ysu1、ysu2、ysu3检验权限问题是否匹配
四、 LBAC
TEST创建5个映射用户
tu1 tu2 tu3 tu4 tu5
创立lable标签时,需要先给用户赋DBSECADM的管理权限
创建lable安全标签构件
Level型
对于列
创建安全策略
创建安全标签
创建表
将安全标签赋予用户
插入数据
验证;
对于行
创建表
用户tu3创建
用户tu2创建
用户tu1创建
用户tu1 select
用户tu2 select
用户tu3 select
Set型
创建策略department
创建安全标签:
create security label set1.t1 component department 'marking';
创建表
create table tb7 (sl idssecuritylabel,name char(20) not null,class char(2) not null, status char(20) not null )security policy set1;
将标签赋予用户
grant security label testset.t11 to tu1 for all access;
插入数据
Tu1
insert into tb7 values (seclabel_by_name('set1' ,'t1' ),'wangyi','1','student');
insert into tb7 values (seclabel_by_name('set1' ,'t2' ),'wanger','2','student');
insert into tb7 values (seclabel_by_name('set1' ,'t3' ),'wangsa','0','teacher');
Select验证
Tu3
Tu2
Tu1
Tree树形验证
创建lable安全标签构件
create security label component region tree ('entire region'root ,'east' under
'entire region','west' under 'entire region');
创建安全策略
create security policy tree1 components region;
创建安全标签
create security label tree1.t1 component region 'east'
create security label tree1.t3 component region 'west';
create security label tree1.t3 component region 'entire region';
将权限赋予用户
创建表
插入数据
insert into tb8 values (seclabel_by_name('tree1' ,'t3' ),'annimal','0');
insert into tb8 values (seclabel_by_name('tree1' ,'t1' ),'cat ', ' 3');
insert into tb8 values (seclabel_by_name('tree1' ,'t2' ),'dog ', '5 ');
验证搜索
Tu1
Tu2
tu3