前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >Oracle 18c新特性:Schema-Only 帐号提升应用管理安全性

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

作者头像
数据和云
发布2018-12-07 14:39:28
6180
发布2018-12-07 14:39:28
举报
文章被收录于专栏:数据和云数据和云

在 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 -----------------

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

本文参与 腾讯云自媒体分享计划,分享自微信公众号。
原始发表:2018-11-08,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 数据和云 微信公众号,前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档