Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Create a secure Grpc Channel without specifying certificates

Create a secure Grpc Channel without specifying certificates

Scheduled Pinned Locked Moved Unsolved General and Desktop
11 Posts 6 Posters 2.3k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    ChrisW67
    wrote on last edited by
    #2

    @rey1996 Do you have the OpenSSL libraries in your runtime environment?

    R 1 Reply Last reply
    0
    • C ChrisW67

      @rey1996 Do you have the OpenSSL libraries in your runtime environment?

      R Offline
      R Offline
      rey1996
      wrote on last edited by
      #3

      @ChrisW67 I've been thinking that maybe it's something related to OpenSsl because I had to downgrade it once to version 1.0 in order to run a project developed in Qt 5.15. But I've been using QSslConfiguration in Qt 6.7 with Mqtt to call connectToHostEncrypted() and works fine.
      That's why I haven't tried to upgrade OpenSsl again.

      C 1 Reply Last reply
      0
      • R rey1996

        @ChrisW67 I've been thinking that maybe it's something related to OpenSsl because I had to downgrade it once to version 1.0 in order to run a project developed in Qt 5.15. But I've been using QSslConfiguration in Qt 6.7 with Mqtt to call connectToHostEncrypted() and works fine.
        That's why I haven't tried to upgrade OpenSsl again.

        C Offline
        C Offline
        ChrisW67
        wrote on last edited by
        #4

        @rey1996 As long as Qt 6.7 is finding OpenSSL 1.1.1 or later, and Qt 5.15 finds OpenSSL 1.0.x all should be well.

        R 1 Reply Last reply
        0
        • C ChrisW67

          @rey1996 As long as Qt 6.7 is finding OpenSSL 1.1.1 or later, and Qt 5.15 finds OpenSSL 1.0.x all should be well.

          R Offline
          R Offline
          rey1996
          wrote on last edited by
          #5

          @ChrisW67 I checked. I have installed OpenSsl 1.1.1.
          I run other test. I was able to connect to the server using QSslSocket with default QSslConfiguration. So that proves that OpenSsl is working fine.
          But still I can't connect using Qt Grpc library.

          SGaistS 1 Reply Last reply
          0
          • R rey1996

            @ChrisW67 I checked. I have installed OpenSsl 1.1.1.
            I run other test. I was able to connect to the server using QSslSocket with default QSslConfiguration. So that proves that OpenSsl is working fine.
            But still I can't connect using Qt Grpc library.

            SGaistS Offline
            SGaistS Offline
            SGaist
            Lifetime Qt Champion
            wrote on last edited by
            #6

            Hi,

            Did you try to analyze the communication using something like wireshark to see what happens differently between the two variants ?

            Interested in AI ? www.idiap.ch
            Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

            R 1 Reply Last reply
            0
            • SGaistS SGaist

              Hi,

              Did you try to analyze the communication using something like wireshark to see what happens differently between the two variants ?

              R Offline
              R Offline
              rey1996
              wrote on last edited by
              #7

              @SGaist Hi.
              I haven't tried that. I switched back to gRPC library. And it's working perfectly. But I'll try with Wireshark and see what's happening. Thank you.

              1 Reply Last reply
              0
              • semlanikS Offline
                semlanikS Offline
                semlanik
                wrote on last edited by
                #8

                It should work in general. I suspect you use the self-signed certificate somewhere in your server certificate chain. If so you must probably need to set the respective options, especially https://doc.qt.io/qt-6/qsslconfiguration.html#setPeerVerifyMode , to VerifyNone

                1 Reply Last reply
                0
                • T Offline
                  T Offline
                  talksik
                  wrote on last edited by
                  #9

                  Has anyone found a workaround here? I have a grpc server behind a load balancer that I successfully hit with grpcurl, postman, and golang client. However, it doesn't work with QGrpc using

                  qt.network.http2: stream 1 finished with error: "Connection 
                  greeterviewmodel: error occurred:  "" QGrpcStatus::Unavailable
                  qt.network.http2: stream 3 finished with error: "Connection closed"
                  
                  1 Reply Last reply
                  0
                  • T Offline
                    T Offline
                    talksik
                    wrote on last edited by
                    #10

                    Okay, for some reason, I needed to set the QSslConfiguration's setAllowedNextProtocols({ "h2" }). Leaky abstraction, poor API design, but I can understand it because the Ssl configuration is not just used for grpc servers, but also just standard rest apis and socket connections.

                    This is something that the Qt team likely didn't test. I will log it in the bug report. Perhaps QGrpcChannelOptions.setSslConfiguration should take a wrapper function or QSslConfiguration should have a defaultGrpcConfiguration? Or maybe just better docs for this, as I'm sure enterprise customers will need secure channel for grpc.

                    J 1 Reply Last reply
                    2
                    • T talksik

                      Okay, for some reason, I needed to set the QSslConfiguration's setAllowedNextProtocols({ "h2" }). Leaky abstraction, poor API design, but I can understand it because the Ssl configuration is not just used for grpc servers, but also just standard rest apis and socket connections.

                      This is something that the Qt team likely didn't test. I will log it in the bug report. Perhaps QGrpcChannelOptions.setSslConfiguration should take a wrapper function or QSslConfiguration should have a defaultGrpcConfiguration? Or maybe just better docs for this, as I'm sure enterprise customers will need secure channel for grpc.

                      J Offline
                      J Offline
                      Jololol
                      wrote on last edited by
                      #11

                      @talksik
                      Thanks for that answer. I spent a few hours trying to figure out why my QGrpc client wouldn't connect using SSL. Calling the below on my SSLConfiguration fixed it.

                      setAllowedNextProtocols({ "h2" }).
                      

                      I agree the documentation isn't great for this, which is a shame.

                      1 Reply Last reply
                      0

                      • Login

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • Users
                      • Groups
                      • Search
                      • Get Qt Extensions
                      • Unsolved