Re: SSL confirmation - (could not accept SSL connection: - Mailing list pgsql-general

From Andrew M
Subject Re: SSL confirmation - (could not accept SSL connection:
Date
Msg-id F9BE447E-47DA-11D9-870C-0003938366A4@jibeya.com
Whole thread Raw
In response to Re: SSL confirmation - (could not accept SSL connection:  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: SSL confirmation - (could not accept SSL connection:
List pgsql-general
Hi Tom,

below is a breakdown of the problems i am experiencing with SSL

Connection String:

jdbc:postgresql://localhost:5432/mydatabase?ssl

my Driver is:

DriverVersion PostgreSQL 8.0devel JDBC3 with SSL (build 308)

The error message i'm getting is:



Code:


14:12:56,779 WARN  [SettingsFactory] Could not obtain connection
metadata
org.jboss.util.NestedSQLException: Could not create connection; -
nested throwable: (org.postgresql.
util.PSQLException: The connection attempt failed.); - nested
throwable: (org.jboss.resource.JBossRe
sourceException: Could not create connection; - nested throwable:
(org.postgresql.util.PSQLException
: The connection attempt failed.))
         at
org.jboss.resource.adapter.jdbc.WrapperDataSource.getConnection(WrapperD
ataSource.java:10
6)
         at
net.sf.hibernate.connection.DatasourceConnectionProvider.getConnection(D
atasourceConnecti
onProvider.java:59)
         at
net.sf.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:
73)
         at
net.sf.hibernate.cfg.Configuration.buildSettings(Configuration.java:
1132)
         at
net.sf.hibernate.cfg.Configuration.buildSessionFactory(Configuration.jav
a:766)
         at
org.jboss.hibernate.jmx.Hibernate.buildSessionFactory(Hibernate.java:
476)
         at
org.jboss.hibernate.jmx.Hibernate.startService(Hibernate.java:444)
         at
org.jboss.system.ServiceMBeanSupport.jbossInternalStart(ServiceMBeanSupp
ort.java:271)
         at
org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMBean
Support.java:221)

         at sun.reflect.GeneratedMethodAccessor2.invoke(Unknown Source)
         at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor
Impl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:324)
         at
org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.
java:141)
         at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)
         at org.jboss.mx.server.Invocation.invoke(Invocation.java:72)
         at
org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.jav
a:242)
         at
org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:642)
         at
org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController
.java:891)
         at $Proxy0.start(Unknown Source)
         at
org.jboss.system.ServiceController.start(ServiceController.java:416)
         at sun.reflect.GeneratedMethodAccessor6.invoke(Unknown Source)
         at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor
Impl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:324)
         at
org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.
java:141)
         at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)
         at org.jboss.mx.server.Invocation.invoke(Invocation.java:72)
         at
org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.jav
a:242)
         at
org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:642)
         at
org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:176)
         at $Proxy4.start(Unknown Source)
         at org.jboss.deployment.SARDeployer.start(SARDeployer.java:261)
         at
org.jboss.deployment.MainDeployer.start(MainDeployer.java:935)
         at
org.jboss.deployment.MainDeployer.start(MainDeployer.java:927)
         at
org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:746)
         at
org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:709)
         at sun.reflect.GeneratedMethodAccessor43.invoke(Unknown Source)
         at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor
Impl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:324)
         at
org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.
java:141)
         at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)
         at
org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.
java:119)
         at org.jboss.mx.server.Invocation.invoke(Invocation.java:74)
         at
org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBea
nOperationInterce
ptor.java:131)
         at org.jboss.mx.server.Invocation.invoke(Invocation.java:74)
         at
org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.jav
a:242)
         at
org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:642)
         at
org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:176)
         at $Proxy8.deploy(Unknown Source)
         at
org.jboss.deployment.scanner.URLDeploymentScanner.deploy(URLDeploymentSc
anner.java:305)
         at
org.jboss.deployment.scanner.URLDeploymentScanner.scan(URLDeploymentScan
ner.java:481)
         at
org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.doS
can(AbstractDeplo
ymentScanner.java:204)
         at
org.jboss.deployment.scanner.AbstractDeploymentScanner.startService(Abst
ractDeploymentSca
nner.java:277)
         at
org.jboss.system.ServiceMBeanSupport.jbossInternalStart(ServiceMBeanSupp
ort.java:271)
         at
org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMBean
Support.java:221)

         at sun.reflect.GeneratedMethodAccessor2.invoke(Unknown Source)
         at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor
Impl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:324)
         at
org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.
java:141)
         at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)
         at org.jboss.mx.server.Invocation.invoke(Invocation.java:72)
         at
org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.jav
a:242)
         at
org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:642)
         at
org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController
.java:891)
         at $Proxy0.start(Unknown Source)
         at
org.jboss.system.ServiceController.start(ServiceController.java:416)
         at sun.reflect.GeneratedMethodAccessor6.invoke(Unknown Source)
         at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor
Impl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:324)
         at
org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.
java:141)
         at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)
         at org.jboss.mx.server.Invocation.invoke(Invocation.java:72)
         at
org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.jav
a:242)
         at
org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:642)
         at
org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:176)
         at $Proxy4.start(Unknown Source)
         at org.jboss.deployment.SARDeployer.start(SARDeployer.java:261)
         at
org.jboss.deployment.MainDeployer.start(MainDeployer.java:935)
         at
org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:746)
         at
org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:709)
         at
org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:693)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.jav
a:39)
         at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor
Impl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:324)
         at
org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.
java:141)
         at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)
         at
org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.
java:119)
         at org.jboss.mx.server.Invocation.invoke(Invocation.java:74)
         at
org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBea
nOperationInterce
ptor.java:131)
         at org.jboss.mx.server.Invocation.invoke(Invocation.java:74)
         at
org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.jav
a:242)
         at
org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:642)
         at
org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:176)
         at $Proxy5.deploy(Unknown Source)
         at
org.jboss.system.server.ServerImpl.doStart(ServerImpl.java:396)
         at org.jboss.system.server.ServerImpl.start(ServerImpl.java:293)
         at org.jboss.Main.boot(Main.java:151)
         at org.jboss.Main$1.run(Main.java:405)
         at java.lang.Thread.run(Thread.java:552)
Caused by: org.jboss.resource.JBossResourceException: Could not create
connection; - nested throwabl
e: (org.postgresql.util.PSQLException: The connection attempt failed.)
         at
org.jboss.resource.adapter.jdbc.local.LocalManagedConnectionFactory.crea
teManagedConnecti
on(LocalManagedConnectionFactory.java:161)
         at
org.jboss.resource.connectionmanager.InternalManagedConnectionPool.creat
eConnectionEventL
istener(InternalManagedConnectionPool.java:508)
         at
org.jboss.resource.connectionmanager.InternalManagedConnectionPool.getCo
nnection(Internal
ManagedConnectionPool.java:207)
         at
org.jboss.resource.connectionmanager.JBossManagedConnectionPool$BasePool
.getConnection(JB
ossManagedConnectionPool.java:534)
         at
org.jboss.resource.connectionmanager.BaseConnectionManager2.getManagedCo
nnection(BaseConn
ectionManager2.java:396)
         at
org.jboss.resource.connectionmanager.TxConnectionManager.getManagedConne
ction(TxConnectio
nManager.java:299)
         at
org.jboss.resource.connectionmanager.BaseConnectionManager2.allocateConn
ection(BaseConnec
tionManager2.java:448)
         at
org.jboss.resource.connectionmanager.BaseConnectionManager2$ConnectionMa
nagerProxy.alloca
teConnection(BaseConnectionManager2.java:838)
         at
org.jboss.resource.adapter.jdbc.WrapperDataSource.getConnection(WrapperD
ataSource.java:10
2)
         ... 98 more
Caused by: org.postgresql.util.PSQLException: The connection attempt
failed.
         at
org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(Connecti
onFactoryImpl.jav
a:136)
         at
org.postgresql.core.ConnectionFactory.openConnection(ConnectionFactory.j
ava:63)
         at
org.postgresql.jdbc2.AbstractJdbc2Connection.<init>(AbstractJdbc2Connect
ion.java:117)
         at
org.postgresql.jdbc3.AbstractJdbc3Connection.<init>(AbstractJdbc3Connect
ion.java:30)
         at
org.postgresql.jdbc3.Jdbc3Connection.<init>(Jdbc3Connection.java:24)
         at org.postgresql.Driver.connect(Driver.java:183)
         at
org.jboss.resource.adapter.jdbc.local.LocalManagedConnectionFactory.crea
teManagedConnecti
on(LocalManagedConnectionFactory.java:151)
         ... 106 more
Caused by: javax.net.ssl.SSLHandshakeException:
sun.security.validator.ValidatorException: No truste
d certificate found
         at com.sun.net.ssl.internal.ssl.BaseSSLSocketImpl.a(DashoA12275)
         at com.sun.net.ssl.internal.ssl.SSLSocketImpl.a(DashoA12275)
         at com.sun.net.ssl.internal.ssl.SSLSocketImpl.a(DashoA12275)
         at com.sun.net.ssl.internal.ssl.SunJSSE_az.a(DashoA12275)
         at com.sun.net.ssl.internal.ssl.SunJSSE_az.a(DashoA12275)
         at com.sun.net.ssl.internal.ssl.SunJSSE_ax.a(DashoA12275)
         at com.sun.net.ssl.internal.ssl.SSLSocketImpl.a(DashoA12275)
         at com.sun.net.ssl.internal.ssl.SSLSocketImpl.j(DashoA12275)
         at com.sun.net.ssl.internal.ssl.SSLSocketImpl.a(DashoA12275)
         at
com.sun.net.ssl.internal.ssl.AppOutputStream.write(DashoA12275)
         at
java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:66)
         at
java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124)
         at org.postgresql.core.PGStream.flush(PGStream.java:486)
         at
org.postgresql.core.v3.ConnectionFactoryImpl.sendStartupPacket(Connectio
nFactoryImpl.java
:243)
         at
org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(Connecti
onFactoryImpl.jav
a:91)
         ... 112 more
Caused by: sun.security.validator.ValidatorException: No trusted
certificate found
         at
sun.security.validator.SimpleValidator.buildTrustedChain(SimpleValidator
.java:304)
         at
sun.security.validator.SimpleValidator.engineValidate(SimpleValidator.ja
va:107)
         at sun.security.validator.Validator.validate(Validator.java:202)
         at
com.sun.net.ssl.internal.ssl.X509TrustManagerImpl.checkServerTrusted(Das
hoA12275)
         at
com.sun.net.ssl.internal.ssl.JsseX509TrustManager.checkServerTrusted(Das
hoA12275)
         ... 124 more

I sent this message to the jboss forum and they confirmed that Jboss
had nothing to do with it:

http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3857569#3857569

Just to add, I re-built postgreSQl 7.4.6 and installed the appropriate
driver and also experienced the same thing with that build, So, either

1. ph_hba or postgresql.conf is incorrect or
2. the certificate has not been specified correctly...

regards


Andrew


On 6 Dec 2004, at 22:31, Tom Lane wrote:

> Andrew M <andrew@jibeya.com> writes:
>> the information I base my statements on is from the mail-list:
>
>> http://www.mail-archive.com/pgsql-bugs@postgresql.org/msg10008.html
>
> AFAICT that thread describes pilot error compounded by poor error
> messages from our SSL code.  The error message problem, at least,
> should be fixed in 8.0RC1.  If you can demonstrate a problem in RC1,
> let's see specifics.
>
>             regards, tom lane
>
> ---------------------------(end of
> broadcast)---------------------------
> TIP 7: don't forget to increase your free space map settings
>


pgsql-general by date:

Previous
From: Jamie Deppeler
Date:
Subject: More problems
Next
From: Greg Stark
Date:
Subject: Re: When to encrypt