Uploaded image for project: 'Quarkus'
  1. Quarkus
  2. QUARKUS-2070

Mysql datasource throw an error when is running over a RHEL8 + FIPS

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Not a Bug
    • Icon: Major Major
    • None
    • 2.7.5.ER1, 2.7.5.ER2, 2.7.5.ER3, 2.7.5.ER4, 2.7.5.CR1, 2.13-Fireball.GA
    • jdbc-mysql, mandrel, team/eng
    • False
    • None
    • False
    • +
    • ---

      Environment: Java11 + RHEL8 + FIPS
      Reproducer: 

      git clone git@github.com:quarkus-qe/quarkus-test-suite.git 

      cmd: 

      mvn clean verify -Dall-modules -pl sql-db/hibernate-reactive -Dit.test=MySQLDatabaseIT#getAll 

      Error:

      5:03:18,722 INFO  ## Running test MySQLDatabaseIT.getAll()
      15:03:21,136 INFO  [app] 15:03:20,873 HR000057: Failed to execute statement [$1select book0_.id as id1_1_, book0_.author as author2_1_, book0_.isbn as isbn3_1_, book0_.title as title4_1_ from books book0_]: $2could not execute query: java.util.concurrent.CompletionException: java.security.NoSuchAlgorithmException: Cannot find any provider supporting RSA/ECB/OAEPWithSHA-1AndMGF1Padding
      15:03:21,136 INFO  [app]     at java.base/java.util.concurrent.CompletableFuture.encodeThrowable(CompletableFuture.java:331)
      15:03:21,136 INFO  [app]     at java.base/java.util.concurrent.CompletableFuture.completeThrowable(CompletableFuture.java:346)
      15:03:21,137 INFO  [app]     at java.base/java.util.concurrent.CompletableFuture$UniApply.tryFire(CompletableFuture.java:632)
      15:03:21,137 INFO  [app]     at java.base/java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:506)
      15:03:21,137 INFO  [app]     at java.base/java.util.concurrent.CompletableFuture.completeExceptionally(CompletableFuture.java:2088)
      15:03:21,137 INFO  [app]     at io.vertx.core.Future.lambda$toCompletionStage$2(Future.java:362)
      15:03:21,137 INFO  [app]     at io.vertx.core.impl.future.FutureImpl$3.onFailure(FutureImpl.java:153)
      15:03:21,137 INFO  [app]     at io.vertx.core.impl.future.FutureBase.emitFailure(FutureBase.java:75)
      15:03:21,137 INFO  [app]     at io.vertx.core.impl.future.FutureImpl.tryFail(FutureImpl.java:230)
      15:03:21,137 INFO  [app]     at io.vertx.core.impl.future.Mapping.onFailure(Mapping.java:45)
      15:03:21,138 INFO  [app]     at io.vertx.core.impl.future.FutureBase.lambda$emitFailure$1(FutureBase.java:69)
      15:03:21,138 INFO  [app]     at io.vertx.core.impl.EventLoopContext.execute(EventLoopContext.java:81)
      15:03:21,138 INFO  [app]     at io.vertx.core.impl.DuplicatedContext.execute(DuplicatedContext.java:173)
      15:03:21,138 INFO  [app]     at io.vertx.core.impl.future.FutureBase.emitFailure(FutureBase.java:66)
      15:03:21,138 INFO  [app]     at io.vertx.core.impl.future.FutureImpl.tryFail(FutureImpl.java:230)
      15:03:21,138 INFO  [app]     at io.vertx.core.impl.future.PromiseImpl.tryFail(PromiseImpl.java:23)
      15:03:21,138 INFO  [app]     at io.vertx.core.impl.future.PromiseImpl.onFailure(PromiseImpl.java:54)
      15:03:21,138 INFO  [app]     at io.vertx.core.impl.future.PromiseImpl.handle(PromiseImpl.java:43)
      15:03:21,139 INFO  [app]     at io.vertx.core.impl.future.PromiseImpl.handle(PromiseImpl.java:23)
      15:03:21,139 INFO  [app]     at io.vertx.sqlclient.impl.pool.SqlConnectionPool$1PoolRequest.handle(SqlConnectionPool.java:198)
      15:03:21,139 INFO  [app]     at io.vertx.sqlclient.impl.pool.SqlConnectionPool$1PoolRequest.handle(SqlConnectionPool.java:175)
      15:03:21,139 INFO  [app]     at io.vertx.core.impl.EventLoopContext.emit(EventLoopContext.java:50)
      15:03:21,139 INFO  [app]     at io.vertx.core.impl.ContextImpl.emit(ContextImpl.java:274)
      15:03:21,139 INFO  [app]     at io.vertx.core.impl.EventLoopContext.emit(EventLoopContext.java:22)
      15:03:21,139 INFO  [app]     at io.vertx.core.net.impl.pool.SimpleConnectionPool$ConnectFailed$2.run(SimpleConnectionPool.java:382)
      15:03:21,139 INFO  [app]     at io.vertx.core.net.impl.pool.CombinerExecutor.submit(CombinerExecutor.java:50)
      15:03:21,139 INFO  [app]     at io.vertx.core.net.impl.pool.SimpleConnectionPool.execute(SimpleConnectionPool.java:245)
      15:03:21,140 INFO  [app]     at io.vertx.core.net.impl.pool.SimpleConnectionPool.lambda$connect$2(SimpleConnectionPool.java:259)
      15:03:21,140 INFO  [app]     at io.vertx.sqlclient.impl.pool.SqlConnectionPool$2.lambda$connect$0(SqlConnectionPool.java:123)
      15:03:21,140 INFO  [app]     at io.vertx.core.impl.future.FutureImpl$3.onFailure(FutureImpl.java:153)
      15:03:21,140 INFO  [app]     at io.vertx.core.impl.future.FutureBase.emitFailure(FutureBase.java:75)
      15:03:21,140 INFO  [app]     at io.vertx.core.impl.future.FutureImpl.tryFail(FutureImpl.java:230)
      15:03:21,140 INFO  [app]     at io.vertx.core.impl.future.PromiseImpl.tryFail(PromiseImpl.java:23)
      15:03:21,140 INFO  [app]     at io.vertx.core.impl.future.PromiseImpl.onFailure(PromiseImpl.java:54)
      15:03:21,140 INFO  [app]     at io.vertx.core.impl.future.FutureBase.emitFailure(FutureBase.java:75)
      15:03:21,146 INFO  [app]     at io.vertx.core.impl.future.FutureImpl.tryFail(FutureImpl.java:230)
      15:03:21,146 INFO  [app]     at io.vertx.core.impl.future.Mapping.onFailure(Mapping.java:45)
      15:03:21,146 INFO  [app]     at io.vertx.core.impl.future.FutureBase.emitFailure(FutureBase.java:75)
      15:03:21,146 INFO  [app]     at io.vertx.core.impl.future.FutureImpl.tryFail(FutureImpl.java:230)
      15:03:21,146 INFO  [app]     at io.vertx.core.impl.future.PromiseImpl.tryFail(PromiseImpl.java:23)
      15:03:21,146 INFO  [app]     at io.vertx.core.Promise.fail(Promise.java:89)
      15:03:21,146 INFO  [app]     at io.vertx.sqlclient.impl.ConnectionFactoryBase.lambda$doConnectWithRetry$2(ConnectionFactoryBase.java:118)
      15:03:21,147 INFO  [app]     at io.vertx.core.impl.future.FutureImpl$3.onFailure(FutureImpl.java:153)
      15:03:21,147 INFO  [app]     at io.vertx.core.impl.future.FutureBase.emitFailure(FutureBase.java:75)
      15:03:21,147 INFO  [app]     at io.vertx.core.impl.future.FutureImpl.tryFail(FutureImpl.java:230)
      15:03:21,147 INFO  [app]     at io.vertx.core.impl.future.Composition$1.onFailure(Composition.java:66)
      15:03:21,147 INFO  [app]     at io.vertx.core.impl.future.FutureBase.emitFailure(FutureBase.java:75)
      15:03:21,147 INFO  [app]     at io.vertx.core.impl.future.FutureImpl.tryFail(FutureImpl.java:230)
      15:03:21,147 INFO  [app]     at io.vertx.core.impl.future.PromiseImpl.tryFail(PromiseImpl.java:23)
      15:03:21,147 INFO  [app]     at io.vertx.core.impl.future.PromiseImpl.onFailure(PromiseImpl.java:54)
      15:03:21,148 INFO  [app]     at io.vertx.core.impl.future.FutureBase.emitFailure(FutureBase.java:75)
      15:03:21,148 INFO  [app]     at io.vertx.core.impl.future.FutureImpl.tryFail(FutureImpl.java:230)
      15:03:21,148 INFO  [app]     at io.vertx.core.impl.future.PromiseImpl.tryFail(PromiseImpl.java:23)
      15:03:21,148 INFO  [app]     at io.vertx.core.impl.future.PromiseImpl.onFailure(PromiseImpl.java:54)
      15:03:21,148 INFO  [app]     at io.vertx.core.impl.future.PromiseImpl.handle(PromiseImpl.java:43)
      15:03:21,148 INFO  [app]     at io.vertx.core.impl.future.PromiseImpl.handle(PromiseImpl.java:23)
      15:03:21,148 INFO  [app]     at io.vertx.sqlclient.impl.command.CommandResponse.fire(CommandResponse.java:46)
      15:03:21,148 INFO  [app]     at io.vertx.sqlclient.impl.SocketConnectionBase.handleMessage(SocketConnectionBase.java:287)
      15:03:21,148 INFO  [app]     at io.vertx.sqlclient.impl.SocketConnectionBase.lambda$init$0(SocketConnectionBase.java:99)
      15:03:21,148 INFO  [app]     at io.vertx.core.impl.EventLoopContext.emit(EventLoopContext.java:50)
      15:03:21,149 INFO  [app]     at io.vertx.core.impl.ContextImpl.emit(ContextImpl.java:274)
      15:03:21,149 INFO  [app]     at io.vertx.core.impl.EventLoopContext.emit(EventLoopContext.java:22)
      15:03:21,149 INFO  [app]     at io.vertx.core.net.impl.NetSocketImpl.handleMessage(NetSocketImpl.java:394)
      15:03:21,149 INFO  [app]     at io.vertx.core.net.impl.ConnectionBase.read(ConnectionBase.java:156)
      15:03:21,149 INFO  [app]     at io.vertx.core.net.impl.VertxHandler.channelRead(VertxHandler.java:153)
      15:03:21,149 INFO  [app]     at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
      15:03:21,149 INFO  [app]     at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
      15:03:21,149 INFO  [app]     at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357)
      15:03:21,149 INFO  [app]     at io.netty.channel.CombinedChannelDuplexHandler$DelegatingChannelHandlerContext.fireChannelRead(CombinedChannelDuplexHandler.java:436)
      15:03:21,149 INFO  [app]     at io.vertx.mysqlclient.impl.codec.MySQLEncoder.lambda$write$0(MySQLEncoder.java:58)
      15:03:21,150 INFO  [app]     at io.vertx.mysqlclient.impl.codec.AuthenticationCommandBaseCodec.sendEncryptedPasswordWithServerRsaPublicKey(AuthenticationCommandBaseCodec.java:90)
      15:03:21,150 INFO  [app]     at io.vertx.mysqlclient.impl.codec.AuthenticationCommandBaseCodec.handleAuthMoreData(AuthenticationCommandBaseCodec.java:47)
      15:03:21,150 INFO  [app]     at io.vertx.mysqlclient.impl.codec.InitialHandshakeCommandCodec.handleAuthentication(InitialHandshakeCommandCodec.java:179)
      15:03:21,150 INFO  [app]     at io.vertx.mysqlclient.impl.codec.InitialHandshakeCommandCodec.decodePayload(InitialHandshakeCommandCodec.java:63)
      15:03:21,150 INFO  [app]     at io.vertx.mysqlclient.impl.codec.MySQLDecoder.decodePacket(MySQLDecoder.java:77)
      15:03:21,150 INFO  [app]     at io.vertx.mysqlclient.impl.codec.MySQLDecoder.decode(MySQLDecoder.java:66)
      15:03:21,150 INFO  [app]     at io.netty.handler.codec.ByteToMessageDecoder.decodeRemovalReentryProtection(ByteToMessageDecoder.java:510)
      15:03:21,150 INFO  [app]     at io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:449)
      15:03:21,150 INFO  [app]     at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:279)
      15:03:21,162 INFO  [app]     at io.netty.channel.CombinedChannelDuplexHandler.channelRead(CombinedChannelDuplexHandler.java:251)
      15:03:21,163 INFO  [app]     at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
      15:03:21,163 INFO  [app]     at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
      15:03:21,163 INFO  [app]     at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357)
      15:03:21,163 INFO  [app]     at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1410)
      15:03:21,163 INFO  [app]     at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
      15:03:21,163 INFO  [app]     at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
      15:03:21,163 INFO  [app]     at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:919)
      15:03:21,163 INFO  [app]     at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:166)
      15:03:21,164 INFO  [app]     at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:722)
      15:03:21,164 INFO  [app]     at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:658)
      15:03:21,164 INFO  [app]     at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:584)
      15:03:21,164 INFO  [app]     at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:496)
      15:03:21,164 INFO  [app]     at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:986)
      15:03:21,164 INFO  [app]     at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
      15:03:21,164 INFO  [app]     at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
      15:03:21,164 INFO  [app]     at java.base/java.lang.Thread.run(Thread.java:829)
      15:03:21,164 INFO  [app] Caused by: java.security.NoSuchAlgorithmException: Cannot find any provider supporting RSA/ECB/OAEPWithSHA-1AndMGF1Padding
      15:03:21,164 INFO  [app]     at java.base/javax.crypto.Cipher.getInstance(Cipher.java:565)
      15:03:21,164 INFO  [app]     at io.vertx.mysqlclient.impl.util.RsaPublicKeyEncryptor.encrypt(RsaPublicKeyEncryptor.java:59)
      15:03:21,165 INFO  [app]     at io.vertx.mysqlclient.impl.util.RsaPublicKeyEncryptor.encrypt(RsaPublicKeyEncryptor.java:34)
      15:03:21,165 INFO  [app]     at io.vertx.mysqlclient.impl.codec.AuthenticationCommandBaseCodec.sendEncryptedPasswordWithServerRsaPublicKey(AuthenticationCommandBaseCodec.java:88)
      15:03:21,165 INFO  [app]     ... 25 more
      15:03:21,165 INFO  [app] Caused by: javax.crypto.NoSuchPaddingException: Unsupported padding OAEPWithSHA-1AndMGF1Padding
      15:03:21,165 INFO  [app]     at jdk.crypto.cryptoki/sun.security.pkcs11.P11RSACipher.engineSetPadding(P11RSACipher.java:137)
      15:03:21,165 INFO  [app]     at java.base/javax.crypto.Cipher$Transform.setModePadding(Cipher.java:391)
      15:03:21,165 INFO  [app]     at java.base/javax.crypto.Cipher.getInstance(Cipher.java:558)
      15:03:21,165 INFO  [app]     ... 28 more
        

      Looks that the MSQL connection doesn't have the required security providers. 

      Workaround

      A possible workaround is to add a dependency that implements the required methods

      NoSuchAlgorithmException: Cannot find any provider supporting RSA/ECB/OAEPWithSHA-1AndMGF1Padding 

      For example, looks like this dependency covers some of these cases

      <dependency>
          <groupId>org.bouncycastle</groupId>
          <artifactId>bctls-fips</artifactId>
      </dependency> 

      And then add this provider to the available java security providers

      @QuarkusMain
      public class Main {
          private static final Logger LOGGER = Logger.getLogger(Main.class);
      
          public static void main(String... args) {
              LOGGER.info("Running main method");
              Security.insertProviderAt(new BouncyCastleFipsProvider(), 1);
              Quarkus.run(args);
          }
      } 

      The issue is, that we are missing a clear path/Documentation about how to proceed with Mysql + FIPS + Quarkus.  And if this is the way, then this "main class" should be hidden for the end-user, and the provider should be added  by some extension (IMO) 

       

              mbabacek1@redhat.com Karm Karm
              rhn-support-pagonzal Pablo Gonzalez Granados (Inactive)
              Pablo Gonzalez Granados Pablo Gonzalez Granados (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              8 Start watching this issue

                Created:
                Updated:
                Resolved: