配置oracle用安全套接层连接.doc_第1页
配置oracle用安全套接层连接.doc_第2页
配置oracle用安全套接层连接.doc_第3页
配置oracle用安全套接层连接.doc_第4页
配置oracle用安全套接层连接.doc_第5页
已阅读5页,还剩12页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

配置oracle安全套接层连接目录1.配置简介22.使用Wallet Manager创建Wallet和生成认证请求22.1.创建Wallet22.2.创建认证请求32.3.导出证书请求32.4.保存Wallet位置32.5.让Wallet自动登录43.使用openssl工具制作数字证书43.1.创建制作证书目录43.2.制作发行证书43.3.制作用户证书54.导入信认根证书和用户证书54.1.导入信认根证书54.2.导入用户证书55.配置使用SSL的TCP/IP连接服务端55.1.确认服务器已经生成Wallet65.2.指定监听服务Wallet存放位置65.3.创建监听使用ssl的TCP/IP协议75.4.配制数据库监听位置86.配置使用SSL的TCP/IP连接客户端106.1.确认客户端已经生成Wallet116.2.配置的Oracle网络服务名称116.3.客户端配置Wallet位置137.连接数据库148.疑难解答149.Wallet管理方案1810.参考文献181. 配置简介这里采用安全套接层连接oracle指的是使用ssl的tcp/ip协议连接oracle数据库,由于ssl的tcps/ip协议是采用公钥和私钥进行数据加密,为了解决通信双方的可信问题,使用了数字证书,而orcle是采用“Wallet Manager”来管理证书和公钥和私钥。配置ssl的tcp/ip协议连接oracle数据库,大体步骤分为以下6步:l 使用Wallet Manager创建Wallet和生成认证请求;l 使用openssl工具制作数字证书;l 导入信认根证书和用户证书;l 配置使用SSL的TCP/IP连接服务端;l 配置使用SSL的TCP/IP连接客户端;l 连接数据库。注意!以下例子使用的数据库版本为ORACLE 10g ,如果是其他版本,会有所差异。2. 使用Wallet Manager创建Wallet和生成认证请求Wallet Manager 有以下几点功能:l 产生公私密钥对,并生成证书请求;l 存储用户证书相匹配的私钥;l 配置可信任证书详细配置步骤如下:2.1. 创建Wallet首先启动Wallet Manager工具: (Windows) 选择 开始, 程序, Oracle-HOME_NAME, 集成管理工具, Wallet Manager (UNIX) 在命令行, 输入 owm。打开Wallet Manager工具后,选择Wallet,新建。在弹出对话框输入密码,此密码是oracle的Wallet密码,密必是字母和数字结合,而且大于8位字符,Wallet选择标准,点确定。2.2. 创建认证请求在上面操作点确定以后,提示“是否希望现在创建一个认证请求?”点是。也可以在选择 操作,添加认证请求,在弹出输入信息,信息内容如下表格:Field Name字段名称 Description描述 公用Common Name名称 Mandatory.必填项。 Enter the name of the users or services identity.输入的用户的名称或服务的身份。 Enter a users name in first name /last name format.输入用户的姓名。Example: Eileen.SangerOrganizational Unit组织单元 Optional.可选项。 Enter the name of the identitys organizational unit.输入部门的名称。 Example: Finance.例如:财务。 Organization组织 Optional.Enter the name of the identitys organization.可选项。输入组织的名称身。 Example: XYZ Corp.例如:某公司 Locality/City地区/城市 可选项。 Enter the name of the locality or city in which the identity resides.输入居住城市。 State/Province省/市/自治区 可选项。 Enter the full name of the state or province in which the identity resides.输入姓名的州或省的身份在其中居住。 Enter the full state name, because some certificate authorities do not accept twoletter abbreviations.输入完整的国家的名字,因为有些证书当局不接受两个字母的缩写。 Country国家 必填项。 Select Country to view a list of country abbreviations.选择国家 ,以查看清单,国家缩写。 Select the country in which the organization is located.选择在哪个国家组织的所在地。中国为CNKey Size密钥长度必填项。 Select Key Size to view a list of key sizes to use when creating the public/private key pair.选择密钥长度,建议选择1024以上长度。DNAdvanced可选项。 Select Advanced to view the Advanced Certificate Request dialog panel.选择高级 ,以查看高级证书申请对话。 Use this field to edit or customize the identitys distinguished name (DN).使用该字段编辑或自定义身份的辨别名称( DN ) 。 For example, you can edit the full state name and locality.例如,您可以编辑充分国家名称和地点。 以上表格必填项填好后,点确定生成认证表求。接下来的工作是导出证书请求了。2.3. 导出证书请求选择左边树的Wallet下的证书请求,在选择操作,导出认证请求。输入要保存文件名c:ssl request.txt,点保证后导出。导出认证请求后,接下来就需要使用第3节使用openssl工具来制作数字证书了。2.4. 保存Wallet位置Wallet创建以后,需要保存Wallet信息,oracle建议保存系统默认位置。系统默认的Wallet文件存放如下Unix和Windows平台: (UNIX) etc/ORACLE/WALLETS/username (Windows) %USERPROFILE%ORACLEWALLETS选择Wallet,系统默认位置,或保存,输入保存路径,点确认。注!如果Wallet不存放在默认位置,oracle一些程序无法使用。2.5. 让Wallet自动登录如果不选择Wallet自动登录,在连接数据库的时候会报ORA-28759: 无法打开文件。选择Wallet,自动登录,把自动登录勾打上。3. 使用openssl工具制作数字证书OpenSSL是一个开放源代码的实现了SSL及相关加密技术的软件包,由加拿大的Eric Yang等发起编写的。OpenSSL的官方网站为/,源代码可以从/source/上下载,也可以从OpenSSL的镜像网站下载。注!在redhat linux下,默认安装有安装好的openssl,而/都是原代码,而且需要懂的C语方的编译才能编译成功,此处从网上收集了for Windows openssl已经编译好的二进制代码。我们这里使用openssl用来生成根证书和信任的用户证书。由于网上收集这两个包压开来需要经过配置,而我的机器又装有MKS Toolkit for Developers Web-extracting tool带有openssl,以下例子使用openssl是MKS Toolkit for Developers Web-extracting tool工具上带的,如果是使用redhat linux,也可以在redhat linux下制作。3.1. 创建制作证书目录mkdir c:sslcd sslmkdir ca3.2. 制作发行证书由于证书需要一个发行机构,我们就用openssl制作一个发行证书。然后在把这个发行证书导入到可信任根证下面,这样这个发行的证书就全部生效了。首先来制作一个发行证书的请求。openssl req -new -newkey rsa:1024 -nodes -out c:/ssl/ca/ca.csr keyout c:/ssl/ca/ca.key输入发行机构的信息后,根据生成的证书请生成证书。openssl x509 -signkey c:/ssl/ca/ca.key -req -in c:/ssl/ca/ca.csr -out c:/ssl/ca/ca.crt -CAcreateserial -days 3653.3. 制作用户证书以上已经制作好发行的信任证书了,现在就根据上面发行的信任证书来制作用户证书。这里用户证书的请求就是第2节的导出证书请求的文件,此例中文件名为:c:ssl request.txt,输入如下命令:openssl x509 -req -in c:sslrequest.txt -out user.crt -CA c:/ssl/ca/ca.crt -CAkey c:/ssl/ca/ca.key -CAcreateserial -days 365以上命令生成用户证书名为user.crt,现在把c:/ssl/ca/ca.crt和user.crt文件都发给申请请求用户者。4. 导入信认根证书和用户证书通过第三节已经制作好用户证书了,但此用户证书制作机构不是“VeriSign Class 3 Public Primary CA”等在名顶顶的认证机构,我们首先需要把制作用户发行机构的证书导入到可信根证书,也就是第3节的c:/ssl/ca/ca.crt文件。4.1. 导入信认根证书打开oracle的Wallet Manager工具,选择操作,导入信任证书,选择包含证书的文件,点确定,选择c:sslcaca.crt文件。在左边的树中出现导入信任证书。4.2. 导入用户证书在以上导入了信任证书后,就可以导入用户证书了。选择操作,导入用户证书,选择包含证书的文件,点确定,选择c:ssluser.crt文件。在左边的树中出现证书就绪。至此,证书的制作和导入都已经完成。然后按快捷键Ctl+W来保存,同时检查Wallter菜单下自动登录旁边框打上小钩。接下来就配制服务端监听ssl的配置了。5. 配置使用SSL的TCP/IP连接服务端在配置服务器端的ssl的TCP/IP连接需要以下几步骤:l 确认服务器已经生成Wallterl 指定监听服务Wallter存放位置l 创建监听使用ssl的TCP/IP协议配置好以后,需要重新启动监听服务,在命令行下输入lsnrctl stoplsnrctl start5.1. 确认服务器已经生成Wallet确认第2节中的Wallet是否创建,确认用户证书是否就绪,同时检查Wallet是否自动登录。5.2. 指定监听服务Wallet存放位置首先启动Net Manager工具: (Windows) 选择 开始, 程序, Oracle-HOME_NAME, 配置和移植工具, Net Manager (UNIX) 在命令行, 输入 netmgr打开Net Manager工具后,选择右边Oracle Net配置,本地,概要文件,在右边最上面下拉框选择Oracle 高级安全性,单击SSL标签。配置方法:选择文件系统。Wallet目录:输入Wallet存放位置。为以下目标配置SSL选择服务器。输入以上信息后,点文件菜单下的保存网络配置。在sqlnet.ora和listener.ora文件更新如下:WALLET_LOCATION = (SOURCE = (METHOD = FILE) (METHOD_DATA = (DIRECTORY = d:oracleWALLETS) ) )5.3. 创建监听使用ssl的TCP/IP协议在Net Manager工具左边树中选择Oracle Net配置,本地,监听程序,LISTENER(如果不存在监听程序,程序编辑菜单下的创建来创建一个监听),在右边最上面下拉框选择监听位置,在下面点添加地址。协议:使用SSL的TCP/IP;主机:输入机器名或要监听的本机IP地址;端口:输入监听的端口号,Oracle 推荐使用的2484作为SSL的TCP/IP协议监听端口;点显示高级,出现高级协议参数;发送缓冲区大小总计:32768;接收缓冲区大小总计:32768。提示!由于windows默认缓冲区大小小于32K,而当数据库存有clob和log类型时候,此值要设置大于32k,否则会出现ORA-03114错误,exp时候会出ORA-03113和ORA-24324。输入以上信息后,点文件菜单下的保存网络配置。在listener.ora文件更新如下:LISTENER = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCPS)(HOST = zhoujunhe)(PORT = 2484)(SEND_BUF_SIZE = 32768)(RECV_BUF_SIZE = 32768) )在sqlnet.ora文件更新如下:SQLNET.AUTHENTICATION_SERVICES= (BEQ, TCPS, NTS)注意,TCPS必需存在,如果这行不存在或这行值没有TCPS,可以手工加sqlnet.ora这个文件内容。5.4. 配制数据库监听位置由于我们配制监听的时候使用了2484这个端口,而这个端口不是oracle默认动态PMON进程向监听注册端口,所以我们需要配置静态监听数据库服务。在Net Manager工具左边树中选择Oracle Net配置,本地,监听程序,LISTENER(如果不存在监听程序,程序编辑菜单下的创建来创建一个监听),在右边最上面下拉框选择数据库服务。如果要监听的数据服务已经配置,接下来就不需要配置了。点下面按钮的添加数据库。全局数据库名:输入创建数据时候的全局名。Oracle主目录:输入Oracle的Home目录,如:D:oracleproduct10.2.0db_1SID:输入数据库实例的sid。输入以上信息后,点文件菜单下的保存网络配置。在listener.ora文件更新如下:SID_LIST_LISTENER = (SID_LIST = (SID_DESC = (GLOBAL_DBNAME = ) (ORACLE_HOME = D:oracleproduct10.2.0db_1) (SID_NAME = ora10g) ) )至此,服务端的SSL的TCP/IP协议已经配置完,如果监听已经启动,可以重启监听了,在命令行下输入:lsnrctl stoplsnrctl start如果没有报错,证明配制正确。以下是重启监听信息:C:lsnrctl stopLSNRCTL for 32-bit Windows: Version .0 - Production on 28-7月 -2009 15:37:43Copyright (c) 1991, 2007, Oracle. All rights reserved.正在连接到 (DESCRIPTION=(ADDRESS=(PROTOCOL=TCPS)(HOST=zhoujunhe)(PORT=2484)命令执行成功C:lsnrctl startLSNRCTL for 32-bit Windows: Version .0 - Production on 28-7月 -2009 15:37:46Copyright (c) 1991, 2007, Oracle. All rights reserved.启动tnslsnr: 请稍候.TNSLSNR for 32-bit Windows: Version .0 - Production系统参数文件为D:oracleproduct10.2.0db_1networkadminlistener.ora写入D:oracleproduct10.2.0db_1networkloglistener.log的日志信息监听: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcps)(HOST=)(PORT=2484)正在连接到 (DESCRIPTION=(ADDRESS=(PROTOCOL=TCPS)(HOST=zhoujunhe)(PORT=2484)LISTENER 的 STATUS-别名 LISTENER版本 TNSLSNR for 32-bit Windows: Version .0 - Production启动日期 28-7月 -2009 15:37:48正常运行时间 0 天 0 小时 0 分 2 秒跟踪级别 off安全性 ON: Local OS AuthenticationSNMP OFF监听程序参数文件 D:oracleproduct10.2.0db_1networkadminlistener.ora监听程序日志文件 D:oracleproduct10.2.0db_1networkloglistener.log监听端点概要. (DESCRIPTION=(ADDRESS=(PROTOCOL=tcps)(HOST=)(PORT=2484)服务摘要.服务 包含 1 个例程。 例程 ora10g, 状态 UNKNOWN, 包含此服务的 1 个处理程序.命令执行成功如果启动过程有错误,证明配置有错误,查看后面疑难解答。6. 配置使用SSL的TCP/IP连接客户端在上面一节讲的是服务器端的配置,如果使用是本机连接,这节只需要配置第2小节就可以跳转到第7节连接数据库6.1. 确认客户端已经生成Wallet如果客户机和服务端不在同一台机器,在一步前必需确认Wallet是否创建,而且确认自动登录,如果没有创建好,请返回前面三节来创建Wallet,并生成证书。注!如果是本机连接,由于配置服务端的时候,Wallet和ssl都已经配置好了,只需要配置下面节的Oracle网络配置就可以连接数据库了。6.2. 配置的Oracle网络服务名称在Net Manager工具左边树中选择Oracle Net配置,本地,服务命名,选择要配制服务名(如果需要重新创建一个服务名,程序编辑菜单下的创建来创建一个服务名)。服务名:输入和配置数据库监听相同服务名;连接类型:选择数据库默认设置。在地址配置先项协议:选择使用SSL的TCP/IP;主机名:输入服务器的机器名或IP地址;端口号:输入服务配置使用SSL的TCP/IP协议端口号(oracle推荐使用2484),此处端口号和服务端端口一致。点显示高级,出现高级协议参数;发送缓冲区大小总计:32768;接收缓冲区大小总计:32768。提示!由于windows默认缓冲区大小小于32K,而当数据库存有clob和log类型时候,此值要设置大于32k,否则会出现ORA-03114错误,exp时候会出ORA-03113和ORA-24324。输入以上信息后,点文件菜单下的保存网络配置。在配置好以上信息后,须手动修改客户端的网络配置文件tnsnames.ora和sqlnet.ora。在不同系统位于不同位置l (UNIX) $ORACLE_HOME /network/admin/ l (Windows) %ORACLE_BASE%ORACLE_HOME%networkadmin在添加如下粗体信息SSL = (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCPS)(HOST = zhoujunhe)(PORT = 2484)(SEND_BUF_SIZE = 32768)(RECV_BUF_SIZE = 32768) ) (CONNECT_DATA = (SERVICE_NAME = ) ) (SECURITY= (SSL_SERVER_CERT_DN= cn=finance,cn=OracleContext,c=us,o=acme) )注意!双引号里的内容必必是服务端用户证书的DN(主题名),此DN可以用Wallet Mangaget打开服务端的Wallet来查看用户证书的DN(主题名)。在sqlnet.ora文件更新如下:SQLNET.AUTHENTICATION_SERVICES= (BEQ, TCPS, NTS)注意,TCPS必需存在,如果这行不存在或这行值没有TCPS,可以手工加sqlnet.ora这个文件内容。6.3. 客户端配置Wallet位置打开Net Manager工具,选择右边Oracle Net配置,本地,概要文件,在右边最上面下拉框选择Oracle 高级安全性,单击SSL标签。配置方法:选择文件系统。Wallet目录:输入客户端Wallet存放位置。为以下目标配置SSL选择客户机。输入以上信息后,点文件菜单下的保存网络配置。在sqlnet.ora文件更新如下:WALLET_LOCATION = (SOURCE = (METHOD = FILE) (METHOD_DATA = (DIRECTORY = d:oracleWALLETS) ) )这样,以上一个简单的ssl协议连接已经配置好,接下来测试连接数据了。7. 连接数据库sqlplus user/passwordssl连接信息如下:C:sqlplus test/testsslSQL*Plus: Release .0 - Production on 星期五 7月 31 11:41:49 2009Copyright (c) 1982, 2007, Oracle. All Rights Reserved.连接到:Oracle Database 10g Enterprise Edition Release .0 - ProductionWith the Partitioning, Oracle Label Security, OLAP, Data Miningand Real Application Testing optionsSQL如果连接报有错误,查看后面疑难解答。8. 疑难解答The following section lists the most common errors you may receive while using the Oracle Advanced Security SSL adapter.It may be necessary to enable Oracle Net tracing to determine the cause of an error. For information about setting tracing parameters to enable Oracle Net tracing, refer to Oracle Database Net Services Administrators Guide.ORA-28759: Failure to Open File Cause: The system could not open the specified file. Typically, this error occurs because the wallet cannot be found.Action: Check the following: Ensure that the correct wallet location is specified in the sqlnet.ora file. This should be the same directory location where you saved the wallet. Enable Oracle Net tracing to determine the name of the file that cannot be opened and the reason. Ensure that auto login was enabled when you saved the wallet. Refer to Using Auto LoginORA-28786: Decryption of Encrypted Private Key Failure Cause: An incorrect password was used to decrypt an encrypted private key. Frequently, this happens because an auto login wallet is not being used.Action: Use Oracle Wallet Manager to turn the auto login feature on for the wallet. Then save the wallet again. Refer to, Using Auto Login.ORA-28858: SSL Protocol Error Cause: This is a generic error that can occur during SSL handshake negotiation between two processes.Action: Enable Oracle Net tracing and attempt the connection again to produce trace output. Then contact Oracle customer support with the trace output.ORA-28859 SSL Negotiation Failure Cause: An error occurred during the negotiation between two processes as part of the SSL protocol. This error can occur when two sides of the connection do not support a common cipher suite.Action: Check the following: Use Oracle Net Manager to ensure that the SSL versions on both the client and the server match, or are compatible. For example, if the server accepts only SSL 3.0 and the client accepts only TLS 1.0, then the SSL connection will fail. Use Oracle Net Manager to check what cipher suites are configured on the client and the server, and ensure that compatible cipher suites are set on both.See Also:Step 4: Set the Client SSL Cipher Suites (Optional) for details about setting compatible cipher suites on the client and the serverNote:If you do not configure any cipher suites, then all available cipher suites are enabled.ORA-28862: SSL Connection Failed Cause: This error occurred because the peer closed the connection.Action: Check the following: Ensure that the correct wallet location is specified in the sqlnet.ora file so the system can find the wallet. Use Oracle Net Manager to ensure that cipher suites are set correctly in the sqlnet.ora file. Sometimes this error occurs because the sqlnet.ora has been manually edited and the cipher suite names are misspelled. Ensure that case sensitive string matching is used with cipher suite names. Use Oracle Net Manager to ensure that the SSL versions on both the client and the server match or are compatible. Sometimes this error occurs because the SSL version specified on the server and client do not match. For example, if the server accepts only SSL 3.0 and the client accepts only TLS 1.0, then the SSL connection will fail. For more diagnostic information, enable Oracle Net tracing on the peer.ORA-28865: SSL Connection Closed Cause: The SSL connection closed because of an error in the underlying transport layer, or because the peer process quit unexpectedly.Action: Check the following: Use Oracle Net Manager to ensure that the SSL versions on both the client and the server match, or are compatible. Sometimes this error occurs because the SSL version specified on the server and client do not match. For example, if the server accepts only SSL 3.0 and the client accepts only TLS 1.0, then the SSL connection will fail. If you are using a Diffie-Hellman anonymous cipher suite and the SSL_CLIENT_AUTHENTICATION parameter is set to true in the servers listener.ora file, then the client does not pass its certificate to the server. When the server does not receive the clients certificate, it (the server) cannot authenticate the client so the connection is closed. To resolve this use another cipher suite, or set this listener.ora parameter to false. Enable Oracle Net tracing and check the trace output for network errors. For details, refer to Actions listed for ORA-28862: SSL Connection FailedORA-28868: Peer Certificate Chain Check Failed Cause: When the peer presented the certificate chain, it was checked and that check failed. This failure can be caused by a number of problems, including: One of the certificates in the chain has expired. A certificate authority for one of the certificates in the chain is not recognized as a trust point. The signature in one of the certificates cannot be verified.Action: Refer to, Opening an Existing Wallet to use Oracle Wallet Manager to open your wallet and check the following: Ensure that all of the certificates installed in your wallet are current (not expired). Ensure that a certificate authoritys certificate from your peers certificate chain is added as a trusted certificate in your wallet. Refer to, Importing a Trusted Certificate to use Oracle Wallet Manager to import a trusted certificate.ORA-28885: No certificate with the required key usage found. Cause: Your certificate was not created with the appropriate X.509 version 3 key usage extension.Action: Use Oracle Wallet Manager to check the certificates key usage. Refer to, Table 9-1, KeyUsage Values.ORA-29024: Certificate Validation Failure Cause: The certificate sent by the other side could not be validated. This may occur if the certificate has expired, has been revoked, or is invalid for any other reason.Action: Check the following: Check the certificate to determine whether it is valid. If necessary, get a new certificate, inform th

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论