淺談禁用以操作系統(tǒng)認證方式登錄Oracle數(shù)據(jù)庫
操作系統(tǒng)認證的方式登錄數(shù)據(jù)庫在通常情況下,會對我們管理數(shù)據(jù)庫帶來極大的便利,也是Oracle數(shù)據(jù)庫連接的默認行為。操作系統(tǒng)認證方式登錄數(shù)據(jù)庫的含義是:只要是以oracle用戶登錄的用戶都可以使用"sqlplus / as sysdba"方式連接到數(shù)據(jù)庫中。
出于安全的考慮,我們可能需要禁用這個特性。當然,如果以操作系統(tǒng)認證方式無法順利登錄,也可以通過在這個方法來排查故障問題。
1.以操作系統(tǒng)認證方式登錄數(shù)據(jù)庫的方法
1)最基本的方法就是使用"sqlplus / as sysdba"登錄數(shù)據(jù)庫
- [oracle@secdb admin]$ sqlplus / as sysdba
 - SQL*Plus: Release 10.2.0.3.0 - Production on Sun Dec 26 21:00:10 2010
 - Copyright (c) 1982, 2006, Oracle. All Rights Reserved.
 - Connected to:
 - 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>
 
斜杠"/"左面是用戶名,右面是密碼,這里表示不給出用戶名和密碼一樣可以登錄到數(shù)據(jù)庫系統(tǒng)中。
2)使用正確的用戶名和密碼登陸數(shù)據(jù)庫
- [oracle@secdb admin]$ sqlplus sys/oracle as sysdba
 - SQL*Plus: Release 10.2.0.3.0 - Production on Sun Dec 26 21:00:52 2010
 - Copyright (c) 1982, 2006, Oracle. All Rights Reserved.
 - Connected to:
 - 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)使用錯誤的用戶名和密碼登陸數(shù)據(jù)庫
- [oracle@secdb admin]$ sqlplus sys_1/oracle_1 as sysdba
 - SQL*Plus: Release 10.2.0.3.0 - Production on Sun Dec 26 21:01:07 2010
 - Copyright (c) 1982, 2006, Oracle. All Rights Reserved.
 - Connected to:
 - 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>
 
這種操作系統(tǒng)認證方式登錄數(shù)據(jù)庫,即使使用的是錯誤的用戶名和密碼依然可以順利的登錄到數(shù)據(jù)庫中。
#p#
2.禁用操作系統(tǒng)認證方式登錄數(shù)據(jù)庫
禁用的方法很簡單,僅需在sqlnet.ora配置文件中添加一條"SQLNET.AUTHENTICATION_SERVICES=(NONE)"即可。
調整sqlnet.ora文件內容。
- [oracle@secdb ~]$ vi $ORACLE_HOME/network/admin/sqlnet.ora
 - SQLNET.AUTHENTICATION_SERVICES=(NONE)
 
1)必須使用正確的用戶名和密碼才能登陸到系統(tǒng)中
- [oracle@secdb admin]$ sqlplus sys/oracle as sysdba
 - SQL*Plus: Release 10.2.0.3.0 - Production on Sun Dec 26 21:58:29 2010
 - Copyright (c) 1982, 2006, Oracle. All Rights Reserved.
 - Connected to:
 - 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>
 
2)使用正確的用戶名和錯誤的密碼進行登錄測試
- [oracle@secdb admin]$ sqlplus sys/oracle_1 as sysdba
 - SQL*Plus: Release 10.2.0.3.0 - Production on Sun Dec 26 21:59:14 2010
 - Copyright (c) 1982, 2006, Oracle. All Rights Reserved.
 - ERROR:
 - ORA-01017: invalid username/password; logon denied
 - Enter user-name:
 
提示無效的用戶名和密碼,無法完成登錄!
3)使用"sqlplus / as sysdba"登錄方式進行驗證
- [oracle@secdb admin]$ sqlplus / as sysdba
 - SQL*Plus: Release 10.2.0.3.0 - Production on Sun Dec 26 21:58:05 2010
 - Copyright (c) 1982, 2006, Oracle. All Rights Reserved.
 - ERROR:
 - ORA-01031: insufficient privileges
 - Enter user-name:
 
此處顯示權限不足,不允許登錄!
因為sqlnet.ora文件默認條件下oracle用戶可以對其進行任意修改,我們可以通過調整sqlnet.ora文件的owner和權限的方式進一步提高系統(tǒng)的安全性。
1)默認條件下sqlnet.ora文件的權限和owner信息
- [oracle@secdb admin]$ ls -l sqlnet.ora
 - -rw-r--r-- 1 oracle oinstall 266 Dec 26 21:00 sqlnet.ora
 
2)調整sqlnet.ora文件的owner和權限信息
- [root@secdb admin]# chown root:root sqlnet.ora
 - [root@secdb admin]# chmod 744 sqlnet.ora
 - [root@secdb admin]# ls -l sqlnet.ora
 - -rwxr--r-- 1 root root 266 Dec 26 21:00 sqlnet.ora
 
調整之后,oracle用戶將再無權限對sqlnet.ora文件進行調整。
#p#
3.驗證是否生效
1)必須使用正確的用戶名和密碼才能登陸到系統(tǒng)中
- [oracle@secdb admin]$ sqlplus sys/oracle as sysdba
 - SQL*Plus: Release 10.2.0.3.0 - Production on Sun Dec 26 21:58:29 2010
 - Copyright (c) 1982, 2006, Oracle. All Rights Reserved.
 - Connected to:
 - 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>
 
2)使用正確的用戶名和錯誤的密碼進行登錄測試
- [oracle@secdb admin]$ sqlplus sys/oracle_1 as sysdba
 - SQL*Plus: Release 10.2.0.3.0 - Production on Sun Dec 26 21:59:14 2010
 - Copyright (c) 1982, 2006, Oracle. All Rights Reserved.
 - ERROR:
 - ORA-01017: invalid username/password; logon denied
 - Enter user-name:
 
提示無效的用戶名和密碼,無法完成登錄!
3)使用"sqlplus / as sysdba"登錄方式進行驗證
- [oracle@secdb admin]$ sqlplus / as sysdba
 - SQL*Plus: Release 10.2.0.3.0 - Production on Sun Dec 26 21:58:05 2010
 - Copyright (c) 1982, 2006, Oracle. All Rights Reserved.
 - ERROR:
 - ORA-01031: insufficient privileges
 - Enter user-name:
 
此處顯示權限不足,不允許登錄!
#p#
4.進一步提高系統(tǒng)的安全性
因為sqlnet.ora文件默認條件下oracle用戶可以對其進行任意修改,我們可以通過調整sqlnet.ora文件的owner和權限的方式進一步提高系統(tǒng)的安全性。
1)默認條件下sqlnet.ora文件的權限和owner信息
- [oracle@secdb admin]$ ls -l sqlnet.ora
 - -rw-r--r-- 1 oracle oinstall 266 Dec 26 21:00 sqlnet.ora
 
2)調整sqlnet.ora文件的owner和權限信息
- [root@secdb admin]# chown root:root sqlnet.ora
 - [root@secdb admin]# chmod 744 sqlnet.ora
 - [root@secdb admin]# ls -l sqlnet.ora
 - -rwxr--r-- 1 root root 266 Dec 26 21:00 sqlnet.ora
 
調整之后,oracle用戶將再無權限對sqlnet.ora文件進行調整。
【編輯推薦】















 
 
 

 
 
 
 