Using Kerberos enabled connections with Sybase

Using Kerberos enabled connections with Sybase

am 23.02.2006 20:51:38 von chuckfox2

--------------010105090000080504020004
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

Hello fellow dbi-users.

I am attempting to connect to a 12.5 Sybase server using kerberos
enabled connections. My isql and sqsh both correctly connect (sqsh
needed a small fix to load the security ). However, I am unable to get
DBD::Sybase to load the security modules.

Here are the details about the problem

1. Software
OS - RHEL4, 32 bit
ASE-15/OCS-15_0
isql from OCS-15_0
DBI-1.50
DBD-Sybase-1.07
perl 5.8.5

2. Enverionment variables

PATH=/apps/sybase/ASE15/SYSAM-2_0/bin:/apps/sybase/ASE15/OCS -15_0/bin:/apps/sybase/ASE15/ASE-15_0/bin:/apps/sybase/ASE15 /ASE-15_0/install:/usr/sbin:/usr/bsd:/sbin:/usr/bin:/bin:/us r/bin/X11:/usr/local/bin:/usr/local/bin/X11:/usr/openwin/bin :

LD_LIBRARY_PATH=/lib/i686:/apps/sybase/ASE15/DataAccess/ODBC /lib:/apps/sybase/ASE15/EFTS-15_0/verity/_ilnx21/bin:/apps/s ybase/ASE15/EFTS-15_0/verity/_ilnx21/filters:/apps/sybase/AS E15/OCS-15_0/lib:/apps/sybase/ASE15/OCS-15_0/lib3p:/apps/syb ase/ASE15/ASE-15_0/lib:/apps/sybase/local/lib:/lib:/usr/lib: /usr/ucblib:
NO PERLLIB PERL5LIB set

3. Build
cd DBI-1.50
/usr/bin/perl Makefile.PL
make
make install
cd ../DBD-Sybase-1.07
/usr/bin/perl Makefile.PL
make
make install

4. test
tested using t/login.t, can connect to my ASE with no problem
tested using isql to connect to my ASE using Kerberos (-V) with NO
PROBLEM
modified t/login.t as following
#!perl
#
# $Id: login.t,v 1.3 2004/12/16 12:06:01 mpeppler Exp $

use lib 'blib/lib';
use lib 'blib/arch';

BEGIN {
$ENV{SYBASE} = "/apps/sybase/ASE15";
$ENV{SYBASE_OCS} = "OCS-15_0";
}

use lib 't';
use _test;

use strict;

use Test::More tests => 5;

use vars qw($Pwd $Uid $Srv $Db);

BEGIN { use_ok('DBI');
use_ok('DBD::Sybase');}

($Uid, $Pwd, $Srv, $Db) = _test::get_info();

#DBI->trace(3);
my $dbh = DBI->connect("dbi:Sybase:server=$Srv;database=$Db", 'sa',
$Pwd, {PrintError => 1});
#DBI->trace(0);
ok(defined($dbh), 'Connect');

#DBI->trace(3);
my $dbh =
DBI->connect("dbi:Sybase:server=$Srv;kerberos=$Srv;database= $Db",
"chuckfox2", $Pwd, {PrintError => 1});
#DBI->trace(0);
ok(defined($dbh), 'Connect');

$dbh->disconnect if $dbh;

$dbh = DBI->connect("dbi:Sybase:server=$Srv;database=$Db", 'ohmygod',
'xzyzzy', {PrintError => 0});

ok(!defined($dbh), 'Connect fail');

$dbh->disconnect if $dbh;

exit(0);

> perl t/login.t
1..5
ok 1 - use DBI;
ok 2 - use DBD::Sybase;
ok 3 - Connect
ct_con_props(CS_SEC_NETWORKAUTH) failed at blib/lib/DBD/Sybase.pm line 94.
DBI
connect('server=MYTEST1_SYB;kerberos=MYTEST1_SYB;database=te mpdb','chuckfox2',...)
failed: OpenClient message: LAYER = (7) ORIGIN = (9) SEVERITY = (5)
NUMBER = (12)
Server MYTEST1_SYB, database
Message String: ct_con_props(SET): security service layer: internal
security control layer error: error string not available
at t/login.t line 33
not ok 4 - Connect
# Failed test (t/login.t at line 35)
ok 5 - Connect fail
# Looks like you failed 1 tests of 5.

Poking around in the DBD code (dbdimp.c) and it looks like that the
security driver cannot be loaded.

int
syb_db_login(dbh, imp_dbh, dsn, uid, pwd, attribs)



imp_dbh->kerberosPrincipal[0] = 0;
imp_dbh->kerbGetTicket = fetchSvAttrib(attribs, "syb_kerberos_serverprincipal");


if(strchr(dsn, '=')) {

extractFromDsn("kerberos=", dsn, imp_dbh->kerberosPrincipal, 32);

}


if(imp_dbh->kerbGetTicket) {
fetchKerbTicket(imp_dbh);
}


It appears that you have to pass the syb_kerberos_serverprincipal
through the attributes as opposed to using the DSN. Should the check be
against kerberosPrincipal instead of kerbGetTicket ?

Any help would be appreciated.

Regards,

Chuck


--------------010105090000080504020004--

Re: Using Kerberos enabled connections with Sybase

am 01.03.2006 12:05:20 von mpeppler

------=_Part_12119_4295050.1141211120623
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

On 2/23/06, Chuck Fox wrote:
>
> Hello fellow dbi-users.
>
> I am attempting to connect to a 12.5 Sybase server using kerberos
> enabled connections. My isql and sqsh both correctly connect (sqsh
> needed a small fix to load the security ). However, I am unable to get
> DBD::Sybase to load the security modules.



It appears that you have to pass the syb_kerberos_serverprincipal
> through the attributes as opposed to using the DSN. Should the check be
> against kerberosPrincipal instead of kerbGetTicket ?


The syb_kerberos_serverprincipal is a reference to a subroutine that fetche=
s
the principal. It was coded so that you could have a parametrized way of
retrieving the principal.

That being said there are other problems with loading the Kerberos libs and
DBD::Sybase that I'm looking into at the moment.

Michael

------=_Part_12119_4295050.1141211120623--