【引數】REMOTE_LOGIN_PASSWORDFILE引數三種取值及其行為特性分析

不一樣的天空w發表於2018-10-18

在某些情況下可以使用REMOTE_LOGIN_PASSWORDFILE引數增強系統的安全性,所謂提高安全性就是禁止以SYSDBA或SYSOPER特權使用者從客戶端登陸到資料庫系統中。這是一種犧牲管理便捷性為前提的。需酌情使用。


本文主要闡述REMOTE_LOGIN_PASSWORDFILE引數的三種取值及對系統的影響。


1. 參考資訊

官方文件中有關REMOTE_LOGIN_PASSWORDFILE引數的描述:


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  835104768 bytes

Fixed Size                  2257840 bytes

Variable Size             549456976 bytes

Database Buffers          281018368 bytes

Redo Buffers                2371584 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  835104768 bytes

Fixed Size                  2257840 bytes

Variable Size             549456976 bytes

Database Buffers          281018368 bytes

Redo Buffers                2371584 bytes

Database mounted.

Database opened.


<2>此時客戶端依然能夠成功登陸

$ sqlplus secooler/secooler@172.17.193.211ora10g 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> show user

USER 為 "SYS"

SQL>

SQL> show parameter REMOTE_LOGIN_PASSWORDFILE


NAME                                 TYPE        VALUE

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

remote_login_passwordfile            string      EXCLUSIVE


結論:因此證明了當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> startup force;

ORACLE instance started.


Total System Global Area  835104768 bytes

Fixed Size                  2257840 bytes

Variable Size             549456976 bytes

Database Buffers          281018368 bytes

Redo Buffers                2371584 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>

SQL> show user

USER 為 "SYS"


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特權相同)。每一種取值都有其自己的應用場景。我們需要做的是根據不同的場景做出相應的取捨。


來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/31397003/viewspace-2216819/,如需轉載,請註明出處,否則將追究法律責任。

相關文章