eygle.com   eygle.com
eygle.com  
 

« 关于PARALLEL_MAX_SERVERS参数的设置 | Blog首页 | 繁忙的一周 装修的进展 »

Oracle的监听口令及监听器安全

作者:eygle |【转载时请以超链接形式标明文章和作者信息及本声明
链接:
Oracle的监听器一直以来都存在一个严重的安全问题,那就是:
如果不设置安全措施,那么能够访问的用户就可以远程关闭监听器。

类似如下操作:
D:\>lsnrctl stop eygle

LSNRCTL for 32-bit Windows: Version 10.2.0.3.0 - Production on 28-11月-2007 10:02:40

Copyright (c) 1991, 2006, Oracle.  All rights reserved.

正在连接到 (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=172.16.33.11)(PORT=1521))
(CONNECT_DATA=(SERVICE_NAME=eygle)))
命令执行成功

而此时缺省的监听器的日志还无法记录操作地址:
No longer listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=172.16.33.11)(PORT=1521)))
28-NOV-2007 09:59:20 * (CONNECT_DATA=(CID=(PROGRAM=)(HOST=)(USER=Administrator))(COMMAND=stop)
(ARGUMENTS=64)(SERVICE=eygle)(VERSION=169870080)) * stop * 0

这个问题由来已久,为了保证监听器的安全,最好为监听设置密码:
[oracle@jumper log]$ lsnrctl     

LSNRCTL for Linux: Version 9.2.0.4.0 - Production on 28-NOV-2007 10:18:17

Copyright (c) 1991, 2002, Oracle Corporation.  All rights reserved.

Welcome to LSNRCTL, type "help" for information.

LSNRCTL> set current_listener listener
Current Listener is listener
LSNRCTL> change_password
Old password:
New password:
Reenter new password:
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=172.16.33.11)(PORT=1521)))
Password changed for listener
The command completed successfully
LSNRCTL> set password
Password:
The command completed successfully
LSNRCTL> save_config
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=172.16.33.11)(PORT=1521)))
Saved LISTENER configuration parameters.
Listener Parameter File  /opt/oracle/product/9.2.0/network/admin/listener.ora
Old Parameter File  /opt/oracle/product/9.2.0/network/admin/listener.bak
The command completed successfully

设置密码之后,远程操作将会因确实密码而失败:
D:\>lsnrctl stop eygle

LSNRCTL for 32-bit Windows: Version 10.2.0.3.0 - Production on 28-11月-2007 10:22:57
Copyright (c) 1991, 2006, Oracle.  All rights reserved.

正在连接到 (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=172.16.33.11)
(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=eygle)))
TNS-01169: 监听程序尚未识别口令

此时在服务器端或客户端,都需要通过密码来起停监听器:
LSNRCTL> set password
Password:
The command completed successfully
LSNRCTL> stop
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=172.16.33.11)(PORT=1521)))
The command completed successfully
LSNRCTL> start
Starting /opt/oracle/product/9.2.0/bin/tnslsnr: please wait...

TNSLSNR for Linux: Version 9.2.0.4.0 - Production
System parameter file is /opt/oracle/product/9.2.0/network/admin/listener.ora
Log messages written to /opt/oracle/product/9.2.0/network/log/listener.log
Trace information written to /opt/oracle/product/9.2.0/network/trace/listener.trc
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=172.16.33.11)(PORT=1521)))

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=172.16.33.11)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias                    LISTENER
Version                  TNSLSNR for Linux: Version 9.2.0.4.0 - Production
Start Date                28-NOV-2007 10:22:23
Uptime                    0 days 0 hr. 0 min. 0 sec
Trace Level              support
Security                  ON
SNMP                      OFF
Listener Parameter File  /opt/oracle/product/9.2.0/network/admin/listener.ora
Listener Log File        /opt/oracle/product/9.2.0/network/log/listener.log
Listener Trace File      /opt/oracle/product/9.2.0/network/trace/listener.trc
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=172.16.33.11)(PORT=1521)))
Services Summary...
Service "eygle" has 1 instance(s).
  Instance "eygle", status UNKNOWN, has 1 handler(s) for this service...
Service "julia" has 1 instance(s).
  Instance "eygle", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully

此外,ADMIN_RESTRICTIONS参数也是一个重要的安全选项,我们可以在 listener.ora 文件中设置 ADMIN_RESTRICTIONS_<listener name> 为 ON,此后所有在运行时对监听器的修改都将被阻止,所有对监听器的修改都必须通过手工修改 listener.ora 文件来完成。

关于监听器安全参考文档:
Integrigy_Oracle_Listener_TNS_Security.pdf

-The End-

By eygle on 2007-11-28 11:54 | Comments (9) | Posted to FAQ | Edit |Pageviews:

相关文章 随机文章
  • 通过SQLNET.ora文件限制Ip地址访问
  • SQL*Net more data to client意味着什么?
  • 案例学习:inode耗尽导致No space left on device错误
  • Oracle10g两个监听进程的故障
  • 求求你别搜索我
  • The Butterfly Effect
    关于Oracle学习以及DBA工作机会
    个人信用信息数据库在发挥作用
    How to Use Oracle10g release 2 ASM
    Resize datafile导致ASM Crash一例
    网上相关主题:
    Google

    留言 (9)

    学习了。

    Posted by: fwei_fengwei at November 29, 2007 8:34 AM

    真巧,昨天刚好研究了一下这个东西

    Posted by: space6212 at November 29, 2007 9:02 AM

    看看先。

    Posted by: 命运呼叫转移 at November 29, 2007 1:15 PM

    :)之前是看过这个问题,在9i的版本下测试:能对远程的stop,但是做start不行。设置密码后,哪怕知道密码,也不能对远程监听做stop。
    “此时在服务器端或客户端,都需要通过密码来起停监听器:”——这边,stop是要用密码,start监听不用密码吧?

    Posted by: 小荷 at November 30, 2007 9:34 AM

    这个在10g好象是不行了吧

    Posted by: 棉花糖ONE at December 9, 2007 1:01 PM

    好像有个问题,可以通过口令stop 监听,但是start 监听不需要任何密码?

    Posted by: chen_7733 at March 18, 2008 10:21 AM

    我在10G下测试,密码不起作用

    Posted by: lypflash at April 9, 2008 9:50 AM

    in 10g no

    Posted by: www at July 3, 2008 2:09 PM

    10g增强,已经不能通过远程来关闭监听器。

    Posted by: eygle at July 3, 2008 3:05 PM

    发表留言:



    Remember Me?
    (输入验证码后方可评论,谢谢支持)



    CopyRight © 2004 eygle.com, All rights reserved.