SSL connection between CA & MySQL

anhvh
2012-10-14
2013-02-18
  • anhvh

    anhvh - 2012-10-14

    hi, everyone!
    I have a question and hope everyone will help me!
    I want to create an SSL connection between CA (JBoss 5.1 - EJBCA 4.0.12 - JDK 6)  and MySQL, how do I do?
    thank u very much!

     
  • Anonymous - 2012-10-14

    You do that with MySQL JDBC URL properties.  See MySQL docs for details.

    cheers
    Anders
    tech support

     
  • anhvh

    anhvh - 2012-10-14

    can you say detail about that?
    I was configured SSL on database (MySQL), but i don't know config it on CA . I just know config the connection between CA and the database in / EJBCA / conf / database.properties.

    # Default: jdbc:hsqldb:${jboss.server.data.dir}${/}hypersonic${/}localDB
    database.url=jdbc:mysql://192.168.132.11:3306/ejbca
    ….
    # Default: org.hsqldb.jdbcDriver
    database.driver=com.mysql.jdbc.Driver
    ….
    # Database username.
    # Default: sa (works with hsqldb)
    database.username=root

    # Database password.
    # Default: (blank works with hsqldb)
    database.password=123q123Q

     
  • Anonymous - 2012-10-14

    Hi,
    This is the MySQL JDBC URL:

    database.url=jdbc:mysql://192.168.132.11:3306/ejbca

    You need to look into the MySQL docs for details.  There are several options.
    There are no specific EJBCA settings for DB SSL since all DBs are different.

    Cheers
    Anders

     
  • anhvh

    anhvh - 2012-10-14

    ok, thk u very much!  :)  I'm gonna read this document, now.

     
  • anhvh

    anhvh - 2012-10-14

    i was configured connection SSL on server database MySQL
    when i running:

    #mysql -u root -p123q123Q -ssl-ca=/root/Desktop/cert/ca-cert.pem -h 192.168.132.135 on client  -> ok
    IP 192.168.132.135: server database MySQL

    but i run jboss -> error
    i was configured in /EJBCA/conf/database.properties

    #database.url=jdbc:mysql://192.168.132.11:3306/ejbca?useSSL=true

    Log:
    15:19:43,532 WARN   Throwable while attempting to get a new connection: null
    org.jboss.resource.JBossResourceException: Could not create connection; - nested throwable: (com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure

    The last packet successfully received from the server was 1,350,253,183,530 milliseconds ago.  The last packet sent successfully to the server was 0 milliseconds ago.)
            at org.jboss.resource.adapter.jdbc.local.LocalManagedConnectionFactory.getLocalManagedConnection(LocalManagedConnectionFactory.java:225)
            at org.jboss.resource.adapter.jdbc.local.LocalManagedConnectionFactory.createManagedConnection(LocalManagedConnectionFactory.java:195)
            at org.jboss.resource.connectionmanager.InternalManagedConnectionPool.createConnectionEventListener(InternalManagedConnectionPool.java:633)
            at org.jboss.resource.connectionmanager.InternalManagedConnectionPool.getConnection(InternalManagedConnectionPool.java:267)
            at org.jboss.resource.connectionmanager.JBossManagedConnectionPool$BasePool.getConnection(JBossManagedConnectionPool.java:622)
            at org.jboss.resource.connectionmanager.BaseConnectionManager2.getManagedConnection(BaseConnectionManager2.java:404)
            at org.jboss.resource.connectionmanager.TxConnectionManager.getManagedConnection(TxConnectionManager.java:381)
            at org.jboss.resource.connectionmanager.BaseConnectionManager2.allocateConnection(BaseConnectionManager2.java:496)
            at org.jboss.resource.connectionmanager.BaseConnectionManager2$ConnectionManagerProxy.allocateConnection(BaseConnectionManager2.java:941)
            at org.jboss.resource.adapter.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:89)
            at org.jboss.ejb.plugins.cmp.jdbc.SQLUtil.fixTableName(SQLUtil.java:172)
            at org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCEntityBridge.init(JDBCEntityBridge.java:157)
            at org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.initStoreManager(JDBCStoreManager.java:435)
            at org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.start(JDBCStoreManager.java:368)
            at org.jboss.ejb.plugins.CMPPersistenceManager.start(CMPPersistenceManager.java:172)
            at org.jboss.ejb.EjbModule.startService(EjbModule.java:495)
            at org.jboss.system.ServiceMBeanSupport.jbossInternalStart(ServiceMBeanSupport.java:376)
            at org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMBeanSupport.java:322)
            at sun.reflect.GeneratedMethodAccessor80.invoke(Unknown Source)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
            at java.lang.reflect.Method.invoke(Method.java:597)
            at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:157)
            at org.jboss.mx.server.Invocation.dispatch(Invocation.java:96)
            at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
            at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
            at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:668)
            at org.jboss.system.microcontainer.ServiceProxy.invoke(ServiceProxy.java:189)
            at $Proxy38.start(Unknown Source)
            at org.jboss.system.microcontainer.StartStopLifecycleAction.installAction(StartStopLifecycleAction.java:42)
            at org.jboss.system.microcontainer.StartStopLifecycleAction.installAction(StartStopLifecycleAction.java:37)
            at org.jboss.dependency.plugins.action.SimpleControllerContextAction.simpleInstallAction(SimpleControllerContextAction.java:62)
            at org.jboss.dependency.plugins.action.AccessControllerContextAction.install(AccessControllerContextAction.java:71)
            at org.jboss.dependency.plugins.AbstractControllerContextActions.install(AbstractControllerContextActions.java:51)
            at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:348)
            at org.jboss.system.microcontainer.ServiceControllerContext.install(ServiceControllerContext.java:286)
            at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:1631)
            at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:934)
            at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1082)
            at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:984)
            at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:822)
            at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:553)
            at org.jboss.system.ServiceController.doChange(ServiceController.java:688)
            at org.jboss.system.ServiceController.start(ServiceController.java:460)
            at org.jboss.system.deployers.ServiceDeployer.start(ServiceDeployer.java:163)
            at org.jboss.system.deployers.ServiceDeployer.deploy(ServiceDeployer.java:99)
            at org.jboss.system.deployers.ServiceDeployer.deploy(ServiceDeployer.java:46)
            at org.jboss.deployers.spi.deployer.helpers.AbstractSimpleRealDeployer.internalDeploy(AbstractSimpleRealDeployer.java:62)
            at org.jboss.deployers.spi.deployer.helpers.AbstractRealDeployer.deploy(AbstractRealDeployer.java:50)
            at org.jboss.deployers.plugins.deployers.DeployerWrapper.deploy(DeployerWrapper.java:171)
            at org.jboss.deployers.plugins.deployers.DeployersImpl.doDeploy(DeployersImpl.java:1439)
            at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:1157)
            at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:1178)
            at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:1210)
            at org.jboss.deployers.plugins.deployers.DeployersImpl.install(DeployersImpl.java:1098)
            at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:348)
            at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:1631)
            at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:934)
            at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1082)
            at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:984)
            at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:822)
            at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:553)
            at org.jboss.deployers.plugins.deployers.DeployersImpl.process(DeployersImpl.java:781)
            at org.jboss.deployers.plugins.main.MainDeployerImpl.process(MainDeployerImpl.java:702)
            at org.jboss.system.server.profileservice.repository.MainDeployerAdapter.process(MainDeployerAdapter.java:117)
            at org.jboss.system.server.profileservice.repository.ProfileDeployAction.install(ProfileDeployAction.java:70)
            at org.jboss.system.server.profileservice.repository.AbstractProfileAction.install(AbstractProfileAction.java:53)
            at org.jboss.system.server.profileservice.repository.AbstractProfileService.install(AbstractProfileService.java:361)
            at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:348)
            at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:1631)
            at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:934)
            at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1082)
            at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:984)
            at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:822)
            at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:553)
            at org.jboss.system.server.profileservice.repository.AbstractProfileService.activateProfile(AbstractProfileService.java:306)
            at org.jboss.system.server.profileservice.ProfileServiceBootstrap.start(ProfileServiceBootstrap.java:271)
            at org.jboss.bootstrap.AbstractServerImpl.start(AbstractServerImpl.java:461)
            at org.jboss.Main.boot(Main.java:221)
            at org.jboss.Main$1.run(Main.java:556)
            at java.lang.Thread.run(Thread.java:619)
    Caused by: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure

    The last packet successfully received from the server was 1,350,253,183,530 milliseconds ago.  The last packet sent successfully to the server was 0 milliseconds ago.
            at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
            at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
            at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
            at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
            at com.mysql.jdbc.Util.handleNewInstance(Util.java:406)
            at com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:1074)
            at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2214)
            at com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:773)
            at com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connection.java:46)
            at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
            at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
            at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
            at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
            at com.mysql.jdbc.Util.handleNewInstance(Util.java:406)
            at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:352)
            at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:282)
            at org.jboss.resource.adapter.jdbc.local.LocalManagedConnectionFactory.getLocalManagedConnection(LocalManagedConnectionFactory.java:207)
            … 79 more
    Caused by: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure

    The last packet successfully received from the server was 1,350,253,183,516 milliseconds ago.  The last packet sent successfully to the server was 0 milliseconds ago.
            at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
            at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
            at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
            at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
            at com.mysql.jdbc.Util.handleNewInstance(Util.java:406)
            at com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:1074)
            at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:341)
            at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2137)
            … 89 more
    Caused by: java.net.SocketException: Network is unreachable
            at java.net.PlainSocketImpl.socketConnect(Native Method)
            at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)
            at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195)
            at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)
            at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
            at java.net.Socket.connect(Socket.java:525)
            at java.net.Socket.connect(Socket.java:475)
            at java.net.Socket.<init>(Socket.java:372)
            at java.net.Socket.<init>(Socket.java:215)
            at com.mysql.jdbc.StandardSocketFactory.connect(StandardSocketFactory.java:253)
            at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:290)
            … 90 more

     
  • Tham Wickenberg

    Tham Wickenberg - 2012-10-15

    Hello,

    could the fact that you are using different ip addresses when you are using command line and /database.properties have anything to do with it?

    BR,
    Tham

     
  • anhvh

    anhvh - 2012-10-15

    oh, sorry, ip adress is the same 192.168.132.135
    #mysql -u root -p123q123Q -ssl-ca=/root/Desktop/cert/ca-cert.pem -h 192.168.132.135 on client
    and
    /EJBCA/conf/database.propertise
    #database.url=jdbc:mysql://192.168.132.135:3306/ejbca?useSSL=true
    user=root
    pass=123q123Q

     
  • Anonymous - 2012-10-15

    It still looks like a connection problem but you could try this:

    http://www.razorsql.com/articles/mysql_ssl_jdbc.html

    MySQL log file may also be useful.

    Cheers,
    anders
    tech support

     
  • anhvh

    anhvh - 2012-10-15

    help me! :(

     
  • Anonymous - 2012-10-15

    A non-SSL connection works, right?
    If not there's something else that's wrong like a firewall or proxy setting.

    You may try the java stand-alone program I mentioned in a previous post.

    Cheers,
    Anders
    tech support

     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks