【参数】REMOTE_LOGIN_PASSWORDFILE参数三种取值及其行为特性分析

在某些情况下可以使用REMOTE_LOGIN_PASSWORDFILE参数增强系统的安全性,所谓提高安全性就是禁止以SYSDBA或SYSOPER特权用户从客户端登陆到数据库系统中。这是一种牺牲管理便捷性为前提的。需酌情使用。

本文主要阐述REMOTE_LOGIN_PASSWORDFILE参数的三种取值及对系统的影响。

1.参考信息
官方文档中有关REMOTE_LOGIN_PASSWORDFILE参数的描述:
http://download.oracle.com/docs/cd/B19306_01/server.102/b14237/initparams179.htm#REFRN10184

2.REMOTE_LOGIN_PASSWORDFILE参数默认值及其行为特性分析
1)REMOTE_LOGIN_PASSWORDFILE参数的默认值是EXCLUSIVE
sys@ora10g> show parameter REMOTE_LOGIN_PASSWORDFILE

NAME                       TYPE       VALUE
-------------------------- ---------- ----------------------
remote_login_passwordfile  string     EXCLUSIVE

2)尝试将SYSDBA特权授予给普通用户secooler
sys@ora10g> grant sysdba to secooler;
grant sysdba to secooler
*
ERROR at line 1:
ORA-01994: GRANT failed: password file missing or disabled

此处报错是由于密码文件丢失导致的,因为授予sysdba权限需要调整密码文件。

3)手工创建丢失的密码文件
ora10g@secdb /home/oracle$ cd $ORACLE_HOME/dbs
ora10g@secdb /oracle/app/oracle/product/10.2.0/db_1/dbs$
ora10g@secdb /oracle/app/oracle/product/10.2.0/db_1/dbs$ orapwd file=orapwora10g password=oracle entries=10

4)再次尝试SYSDBA授权成功
sys@ora10g> grant sysdba to secooler;

Grant succeeded.

5)密码文件的变化
此时在密码文件中记录了这个授权的信息。
ora10g@secdb /oracle/app/oracle/product/10.2.0/db_1/dbs$ strings orapwora10g
]\[Z
ORACLE Remote Password file
INTERNAL
AB27B53EDC5FEF41
8A8F025737A9097A
SECOOLER
034E4342BB2D437D

最后两行信息即是新增的内容。

6)客户端连接性测试
$ sqlplus secooler/secooler@ora10g as sysdba

SQL*Plus: Release 10.2.0.3.0 - Production on 星期二 12月 21 21:48:34 2010

Copyright (c) 1982, 2006, Oracle.  All Rights Reserved.


连接到:
Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - 64bit Production
With the Partitioning, Oracle Label Security, OLAP and Data Mining Scoring Engine options

SQL> show user;
USER 为 "SYS"
SQL>

注意,此处我们虽然使用的是普通用户secooler登录的数据库,但真实的用户名是SYS。因此我们便可以使用这种方法来管理数据库,这就是便捷所在。

7)人为移除密码文件测试
如果此时我们将密码文件删除,客户端将没有办法再以sysdba权限连接到数据库
$ sqlplus secooler/secooler@ora10g as sysdba

SQL*Plus: Release 10.2.0.3.0 - Production on 星期二 12月 21 21:53:50 2010

Copyright (c) 1982, 2006, Oracle.  All Rights Reserved.

ERROR:
ORA-01031: insufficient privileges


请输入用户名:

因此,通过REMOTE_LOGIN_PASSWORDFILE参数和密码文件共同实现了客户端以SYSDBA权限登录系统的目的。

3.REMOTE_LOGIN_PASSWORDFILE参数NONE值及其行为特性分析
1)调整参数REMOTE_LOGIN_PASSWORDFILE为NONE
sys@ora10g> alter system set remote_login_passwordfile=none scope=spfile;

System altered.

sys@ora10g> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
sys@ora10g> startup;
ORACLE instance started.

Total System Global Area  209715200 bytes
Fixed Size                  2071640 bytes
Variable Size             125830056 bytes
Database Buffers           75497472 bytes
Redo Buffers                6316032 bytes
Database mounted.
Database opened.

sys@ora10g> show parameter REMOTE_LOGIN_PASSWORDFILE

NAME                       TYPE       VALUE
-------------------------- ---------- ----------------------
remote_login_passwordfile  string     NONE

2)调整后,客户端将无法发起连接
$ sqlplus secooler/secooler@ora10g as sysdba

SQL*Plus: Release 10.2.0.3.0 - Production on 星期二 12月 21 22:00:02 2010

Copyright (c) 1982, 2006, Oracle.  All Rights Reserved.

ERROR:
ORA-01017: invalid username/password; logon denied


请输入用户名:

3)SYSDBA权限的授予与回收亦是被禁止的
(1)授权测试
sys@ora10g> grant sysdba to secooler;
grant sysdba to secooler
*
ERROR at line 1:
ORA-01994: GRANT failed: password file missing or disabled

注意,此处的报错原因是不是因为密码文件不存在,与前面曾经提到的报错信息有区别。

(2)回收测试
sys@ora10g> revoke sysdba from secooler;

Revoke succeeded.

此处虽然提示权限回收成功,但是实际上并没有生效,是无效操作。证明之。
<1>在此基础上调整参数为EXCLUSIVE
sys@ora10g> alter system set remote_login_passwordfile=EXCLUSIVE scope=spfile;

System altered.

sys@ora10g> startup force;
ORACLE instance started.

Total System Global Area  209715200 bytes
Fixed Size                  2071640 bytes
Variable Size             130024360 bytes
Database Buffers           71303168 bytes
Redo Buffers                6316032 bytes
Database mounted.
Database opened.

<2>此时客户端依然能够成功登陆
$ sqlplus secooler/[email protected] as sysdba

SQL*Plus: Release 10.2.0.3.0 - Production on 星期二 12月 21 22:06:05 2010

Copyright (c) 1982, 2006, Oracle.  All Rights Reserved.


连接到:
Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - 64bit Production
With the Partitioning, Oracle Label Security, OLAP and Data Mining Scoring Engine options

SQL>

因此证明了当REMOTE_LOGIN_PASSWORDFILE参数为NONE时回收SYSDBA权限是无效的。

4.REMOTE_LOGIN_PASSWORDFILE参数SHARED值及其行为特性分析
1)调整参数REMOTE_LOGIN_PASSWORDFILE为SHARED
sys@ora10g> alter system set remote_login_passwordfile=shared scope=spfile;

System altered.

sys@ora10g> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
sys@ora10g> startup;
ORACLE instance started.

Total System Global Area  209715200 bytes
Fixed Size                  2071640 bytes
Variable Size             125830056 bytes
Database Buffers           75497472 bytes
Redo Buffers                6316032 bytes
Database mounted.
Database opened.
sys@ora10g> show parameter REMOTE_LOGIN_PASSWORDFILE

NAME                       TYPE       VALUE
-------------------------- ---------- ----------------------
remote_login_passwordfile  string     SHARED

2)此时客户端的连接是不受限制的,连接通畅
$ sqlplus secooler/secooler@ora10g as sysdba

SQL*Plus: Release 10.2.0.3.0 - Production on 星期二 12月 21 22:08:04 2010

Copyright (c) 1982, 2006, Oracle.  All Rights Reserved.


连接到:
Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - 64bit Production
With the Partitioning, Oracle Label Security, OLAP and Data Mining Scoring Engine options

SQL>

3)此时服务器端授予和回收SYSDBA权限是不被允许的
sys@ora10g> grant sysdba to secooler;
grant sysdba to secooler
*
ERROR at line 1:
ORA-01999: password file cannot be updated in SHARED mode

sys@ora10g> revoke sysdba from secooler;
revoke sysdba from secooler
*
ERROR at line 1:
ORA-01999: password file cannot be updated in SHARED mode

5.小结
在此总结一下在REMOTE_LOGIN_PASSWORDFILE参数取不同值时的行为特性。
REMOTE_LOGIN_PASSWORDFILE参数可以有三种取值:EXCLUSIVE(默认)、NONE和SHARED。
1)当取值为EXCLUSIVE时
允许客户端以SYSDBA或SYSOPER权限登录到数据库实例中完成数据库管理操作;
允许授予和回收SYSDBA或SYSOPER权限。

2)当取值为NONE时
禁止客户端以SYSDBA或SYSOPER权限登录到数据库实例中完成数据库管理操作;
禁止授予和回收SYSDBA或SYSOPER权限。

3)当取值为SHARED时
允许客户端以SYSDBA或SYSOPER权限登录到数据库实例中完成数据库管理操作;
禁止授予和回收SYSDBA或SYSOPER权限。

以上便是参数REMOTE_LOGIN_PASSWORDFILE在不同取值情况下对系统的影响(本文是以SYSDBA特权为例,SYSOPER特权相同)。每一种取值都有其自己的应用场景。我们需要做的是根据不同的场景做出相应的取舍。


本文转自secooler的博客:http://blog.itpub.net/519536/viewspace-682282/

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章