Oracle/Kerberos验证异机SQLPlus免密访问

接《Oracle/Kerberos验证SSH访问》《Oracle/Kerberos验证本地SQLPlus访问》

案例二:配置在异机KCT上通过SQLPlus连接KO2

三、配置SQL使用Kerberos登录
1、把KDC上抽取的Key table传输并部署KCT上

# 把keytab从KDC传输到KCT
[root@kdc ~]# scp /tmp/keytab root@kct.testko.com:/tmp
[root@kct ~]# chown oracle:oinstall /tmp/keytab
# 转换Key table
[root@kct ~]# mv /tmp/keytab /etc/v5srvtab

3、确认KO2上数据库初始参数:$ORACLE_HOME/dbs/init.ora已经修改为OS_AUTHENT_PREFIX=’’
4、配置KO2上Oracle Net Services: $ORACLE_HOME/network/admin/sqlnet.ora

# sqlnet.ora Network Configuration File: /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/sqlnet.ora
# Generated by Oracle configuration tools.
SQLNET.KERBEROS5_REALMS = /etc/krb.realms
SQLNET.KERBEROS5_CONF_MIT=TRUE
SQLNET.AUTHENTICATION_SERVICES= (BEQ, TCPS, KERBEROS5)
SQLNET.KERBEROS5_CONF = /etc/krb5.conf
SQLNET.AUTHENTICATION_KERBEROS5_SERVICE = oracle
SQLNET.KERBEROS5_CC_NAME=/usr/tmp/krbcache
ADR_BASE = /u01/app/oracle

5、配置KCT上TNSNAME: $ORACLE_HOME/network/admin/tnsnames.ora

# tnsnames.ora Network Configuration File: /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/tnsnames.ora
# Generated by Oracle configuration tools.

ORACLE =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = ko2.testko.com)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = orcl)
    )
  )

6、修改KCT上/etc/krb5.conf,添加

[libdefaults]
...
kdc_timesync = 1
ccache_type = 4

7、KDC上创建Kerberos User

[root@kdc ~]# kadmin.local
kadmin.local: addprinc testuser

8、KO2上创建Externally Authenticated Oracle User

sys@ORCL> CREATE USER "TESTUSER@TESTKO.COM" IDENTIFIED EXTERNALLY; 
sys@ORCL> GRANT CREATE SESSION TO "TESTUSER@TESTKO.COM"; 

9、初始化凭据

[oracle@kct ~]$ okinit testuser
[oracle@kct ~]$ oklist -f
Kerberos Utilities for Linux: Version 11.2.0.4.0 - Production on 26-MAY-2021 13:41:41
Copyright (c) 1996, 2013 Oracle.  All rights reserved.
Ticket cache: /usr/tmp/krbcache
Default principal: testuser@TESTKO.COM
   Valid Starting           Expires            Principal
26-May-2021 13:41:33  26-May-2021 21:41:31  krbtgt/TESTKO.COM@TESTKO.COM        Flags: I

10、登录

sqlplus /@oracle
[oracle@kct ~]$ sqlplus /@oracle
SQL*Plus: Release 11.2.0.4.0 Production on Wed May 26 13:42:08 2021
Copyright (c) 1982, 2013, Oracle.  All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
testuser@testko.com@ORCL>show user;
USER is "TESTUSER@TESTKO.COM"
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

O记DBA

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值