X-Original-To: pgsql-jdbc-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id B0C2C32A84B for ; Tue, 12 Oct 2004 20:49:18 +0100 (BST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 96128-07 for ; Tue, 12 Oct 2004 19:49:08 +0000 (GMT) Received: from ms-dienst.rz.rwth-aachen.de (ms-1.rz.RWTH-Aachen.DE [134.130.3.130]) by svr1.postgresql.org (Postfix) with ESMTP id 5FAF732A7BC for ; Tue, 12 Oct 2004 20:49:08 +0100 (BST) Received: from r220-1 (r220-1.rz.RWTH-Aachen.DE [134.130.3.31]) by ms-dienst.rz.rwth-aachen.de (iPlanet Messaging Server 5.2 HotFix 1.12 (built Feb 13 2003)) with ESMTP id <0I5H00JB5LPU6Z@ms-dienst.rz.rwth-aachen.de> for pgsql-jdbc@postgresql.org; Tue, 12 Oct 2004 21:49:07 +0200 (MEST) Received: from relay.rwth-aachen.de ([134.130.3.1]) by r220-1 (MailMonitor for SMTP v1.2.2 ) ; Tue, 12 Oct 2004 21:49:06 +0200 (MEST) Received: from post.halifax.rwth-aachen.de (post.halifax.RWTH-Aachen.DE [134.130.49.251]) by relay.rwth-aachen.de (8.13.0/8.13.0/1) with ESMTP id i9CJn5IL024259 for ; Tue, 12 Oct 2004 21:49:05 +0200 (MEST) Received: (qmail 8576 invoked from network); Tue, 12 Oct 2004 19:49:12 +0000 Received: from darkenemy.halifax.rwth-aachen.de ([134.130.48.36]) (envelope-sender ) by mail.halifax.rwth-aachen.de (qmail-ldap-1.03) with SMTP for ; Tue, 12 Oct 2004 19:49:12 +0000 Date: Tue, 12 Oct 2004 21:49:00 +0200 From: Ulrich Meis Subject: Re: A solution to the SSL customizing problem In-reply-to: <416B949E.5070502@opencloud.com> To: Oliver Jowett Cc: pgsql-jdbc@postgresql.org Message-id: <200410122149.00987.kenobi@halifax.rwth-aachen.de> MIME-version: 1.0 Content-type: text/plain; charset=iso-8859-1 Content-transfer-encoding: 7BIT Content-disposition: inline User-Agent: KMail/1.7 References: <200410111752.33375.kenobi@halifax.rwth-aachen.de> <200410120742.30677.kenobi@halifax.rwth-aachen.de> <416B949E.5070502@opencloud.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200410/111 X-Sequence-Number: 11216 On Tuesday 12 October 2004 10:23, Oliver Jowett wrote: > >>The "conid" stuff looks really grotty. How do you coordinate the > >>URL-level configuration with the PGSSLHandler implementation? > > > > That coordination is up to the user. > > He provides the conid in the URL and the driver just forwards it to the > > handler method. I don't see a problem here. > > It's a maintenance nightmare. The configuration used by the handler > method has to somehow be kept in sync with the user configuration (the > URL). However, the handler method's configuration is not managed by the > same mechanisms that the user configuration is (namely "edit the JDBC > URL"). In an app server environment I would think that either the user obtains a datasource object and provides handler and connection id as in datasource.setjdbcurl("jdbc://server1/db1?handlerclass=mysslhandler&conid=1");con1=... datasource.setjdbcurl("jdbc://server1/db1?handlerclass=mysslhandlerconid=2");con2=... or uses a configuration file like .......conid=1 ......conid=2 where in this case the connection id identifies a database and not a particular connection. Maybe it would better be called dbid. > There is a related problem to do with passing around classnames in that > you cannot do multiple configurations just by instantiating new handlers > with different details, you either have to have lots of wrapper > implementations or something like the 'conid' scheme above along with > all the associated baggage. If you can forward a class name from the URL to makeSSL, you can forward an id as well and avoid the wrapper classes. Associated baggage stays the same. > > ... > > Thinking about this a bit more, it seems to me that the use case that > hits the classloader issue (user code wanting feedback from the driver > via a nonstandard callback in a managed environment) is actually a hard > problem to solve anyway. It seems like if you need to do that you're > placing too high a burden on the appserver to magically know about the > behaviour of the nonstandard callback. The SSL configuration is really a > configuration property of the connection/connection pool, not something > that should be managed by user code in a managed environment. So maybe > we should forget about that case for the moment. Anyway.. I agree that if you want to customize SSL settings and use multiple configurations, you probably don't want to use the app server's connection pool anyway. > > I'd be OK with something like: > > - a URL parameter that specifies name of a subclass of SSLSocketFactory > to use, and > - a method on the PG DataSource implementations that allows setting a > SSLSocketFactory *instance*. This instance is passed via a PG-private > API to the driver when creating connections from the DataSource. This > overrides use of the URL parameter. Sounds good to me. I would suggest an additional URL parameter and method on PG DataSource for the connection/database id. Another completely different idea that I haven't tested and/or thought through yet: How about passing a JNDI name in the URL that users and/or app servers bind their custom SSLSocketFactory to? something like context.bind("org/somewhere/sslfactory_companyA",new mysslfactory("companyA")); jdbcurl = "jdbc:postgresql://companyA/workdb?sslsocketfactory=org/somewhere/sslfactory_companyA"; con=... context.bind("org/somewhere/sslfactory_companyB",new mysslfactory("companyB"); jdbcurl = "jdbc:postgresql://companyB/workdb?sslsocketfactory=org/somewhere/sslfactory_companyB"; con=... Then you could forget about ids and the second class loading option. JNDI is included since jdk1.3 and there's a jndi.jar for jdk1.2. Uli