暂无图片
暂无图片
1
暂无图片
暂无图片
暂无图片

Oracle 18c新特性:Schema-Only 帐号提升应用管理安全性

盖国强 2018-11-08
572

在 Oracle 18c 中,一个特殊类型的帐号被引入到数据库当中,这特特性被称为 Schema-Only 帐号,这个帐号通过 NO AUTHENTICATION 语句建立,没有密码,也就不允许直接登录,所以这种帐号类型是 纯模式类型

帐号不能直接登录也就具备了天然的安全受益:

可以强制通过应用(Application)来访问数据;

保护对象安全,例如阻止可能的误删除(DROP)操作;

Schema-Only账户具有一些限制:

不能被授予系统管理权限,如(SYSDBA、SYSASM)等;

不能通过DB Link访问;

只支持DB实例,不支持ASM实例;

针对这个特性,DBA_USERS 视图增加了一个新的字段 AUTHENTICATION_TYPE 用于标识帐号属性,当创建Schema-Only 帐号时显示为 NONE否则会显示 PASSWORD。


下面让我们通过简单的测试来看看这个新特性,首先在一个 PDB 上创建 NO AUTHENTICATION 的帐号,用户名是 enmotech:

SQL> connect as sysdba

Connected.

SQL> select name from v$pdbs;

NAME

---------------------------------------

PDB$SEED

ORCLPDB1


SQL> alter pluggable database ORCLPDB1 open;

Pluggable database altered.


SQL> alter session set container=ORCLPDB1;

Session altered.


SQL> create user enmotech NO AUTHENTICATION;

User created.

SQL> grant create session,create any table,create any view to enmotech;

Grant succeeded.

SQL> exec print_table('select username,password,password_versions,account_status,authentication_type from dba_users where username=''ENMOTECH''');

USERNAME       : ENMOTECH

PASSWORD       :

PASSWORD_VERSIONS       :

ACCOUNT_STATUS       : OPEN

AUTHENTICATION_TYPE       : NONE

-----------------

这个帐号没有口令,自然就无法直接登录,我们可以通过用户代理来访问这个用户,代理是很早的一个数据库功能,现在有了新的作用。


我们在 ORCLPDB1 创建一个新的用户 yhem,这个用户仅有 create session 权限;

SQL> create user yhem identified by enmotech;


User created.


SQL> grant create session to yhem;


Grant succeeded.

授予用户 yhem 代理权限,通过该用户可以连接到 enmotech 这个受限用户,以下示范中 bethune 是我建立的一个 TNS 连接串名:

SQL> alter user enmotech grant connect through yhem;


User altered.


SQL> connect yhem[enmotech]/enmotech@bethune

Connected.


SQL> show user

USER is "ENMOTECH"

SQL> create table acoug (id number,name varchar2(200));

Table created.


SQL> drop table acoug;


Table dropped.

基本上,这就是新特性的基本展示,最核心的功能,是可以将 Schema-Only 用户的对象增删数据权限授予应用用户,就防范了模式用户直接访问可能带来的种种风险。


验证一下,纯模式用户不能被授予 SYSDBA 权限,其角色切换也很简单,授予密码就解除了 NO AUTHENTICATION 状态,回收SYSDBA权限才可以重新NO AUTHENTICATION 。

SQL> grant sysdba to enmotech;

grant sysdba to enmotech

*

ERROR at line 1:

ORA-40366: Administrative privilege cannot be granted to this user.


SQL> alter user enmotech identified by eygle;


User altered.


SQL> grant sysdba to enmotech;


Grant succeeded.


SQL> alter user enmotech no authentication;

alter user enmotech no authentication

*

ERROR at line 1:

ORA-40367: An Administrative user cannot be altered to have no authentication

type.


SQL> revoke sysdba from enmotech;


Revoke succeeded.


SQL> alter user enmotech no authentication;


User altered.

当然也可以在 CDB 中创建 COMMON 用户,指定其为 NO AUTHENTICATION :

SQL> connect as sysdba

Connected.

SQL> create user c##enmo no authentication;


User created.


SQL> set serveroutput on


SQL> exec print_table('select con_id,username,authentication_type from cdb_users where username=''C##ENMO''');

CON_ID       : 1

USERNAME       : C##ENMO

AUTHENTICATION_TYPE       : NONE

-----------------

CON_ID       : 3

USERNAME       : C##ENMO

AUTHENTICATION_TYPE       : NONE

-----------------

至于这个小特性在实践中是否能发挥作用,大家可以留言表达一下各自的观点。



了解云时代数据变革,欢迎参加 11.16 ~ 11.17 在北京举行的『第八届数据技术嘉年华大会』,限时注册报名享受到场退费0元享活动

 

时间2018年11月16日-17日(周五、周六)

地址北京市东三环中路61号富力万丽酒店


超值赠送(限时优惠)


本次大会由 云和恩墨 鼎力支持,恰逢云平台【墨天轮】上线开放,注册云服务平台,您将可以得到大会『免费』参会的限时礼遇 + 云服务大礼包

注册获赠服务礼包:价值 ¥20000 云服务优惠券;

限时购票参会返还:现场参会即原路退还全部购票费用(仅限单价99元票种

注:退款在会后5个工作日内完成。


请扫描以下二维码,在网站完成注册即可购买限时优惠门票,并获赠云服务大礼包:


最后修改时间:2020-04-02 11:55:43
文章转载自盖国强,如果涉嫌侵权,请发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

评论