Pārlūkot izejas kodu

Added test to check ssl errors handling ( #111 )

Viktor Kopp 5 gadi atpakaļ
vecāks
revīzija
a6ae63d211

+ 6 - 0
src/grpc/http2channel.cpp

@@ -126,6 +126,12 @@ struct Http2ChannelPrivate {
 
         QNetworkReply *networkReply = nm.post(request, msg);
 
+        QObject::connect(networkReply, &QNetworkReply::sslErrors, [networkReply](const QList<QSslError> &errors) {
+           qProtoCritical() << errors;
+           // TODO: filter out noncritical SSL handshake errors
+           Http2ChannelPrivate::abortNetworkReply(networkReply);
+        });
+
         if (!stream) {
             //TODO: Add configurable timeout logic
             QTimer::singleShot(6000, networkReply, [networkReply]() {

+ 1 - 1
src/protobuf/qprotobufobject_p.h

@@ -708,7 +708,7 @@ public:
     }
 
     // this set of 3 methods is used to skip bytes corresponding to an unexpected property
-    // in a serialized message met while the message being serialized
+    // in a serialized message met while the message being deserialized
     static void skipVarint(SelfcheckIterator &it);
     static void skipLengthDelimited(SelfcheckIterator &it);
     static int skipSerializedFieldBytes(SelfcheckIterator &it, WireTypes type);

+ 10 - 8
tests/test_grpc/CMakeLists.txt

@@ -4,23 +4,25 @@ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/testfile ${CMAKE_CURRENT_BINARY_DIR}/
 
 include(${CMAKE_SOURCE_DIR}/cmake/QtProtobufCommon.cmake)
 
-set(TARGET qtgrpc_test)
 set(GENERATED_HEADERS
     simplestringmessage.h
     testserviceclient.h
     blobmessage.h
-#    testserviceserver.h
+#   testserviceserver.h
 )
 
-file(GLOB SOURCES main.cpp
-#    servertest.cpp
-    clienttest.cpp)
-
-add_test_target(TARGET ${TARGET}
+# clients
+add_test_target(TARGET qtgrpc_test
+    GENERATED_HEADERS ${GENERATED_HEADERS}
+    SOURCES clienttest.cpp)
+    
+add_test_target(TARGET qtgrpc_secure_test
     GENERATED_HEADERS ${GENERATED_HEADERS}
-    SOURCES ${SOURCES})
+    SOURCES sslclienttest.cpp)
 
+# servers
 add_subdirectory(echoserver)
+add_subdirectory(secureechoserver)
 
 add_test(NAME qtgrpc_echo_test
          COMMAND test_driver.sh ./tests/test_grpc/qtgrpc_test ./tests/test_grpc/echoserver/echoserver

+ 2 - 0
tests/test_grpc/clienttest.cpp

@@ -27,10 +27,12 @@
 #include "http2channel.h"
 #include "insecurecredentials.h"
 #include "blobmessage.h"
+#include <sslcredentials.h>
 
 #include <QTimer>
 #include <QFile>
 #include <QCryptographicHash>
+#include <QSslConfiguration>
 
 #include <QCoreApplication>
 #include <gtest/gtest.h>

+ 21 - 0
tests/test_grpc/secureechoserver/CMakeLists.txt

@@ -0,0 +1,21 @@
+set(TARGET secureechoserver)
+
+set(GENERATED_SOURCES
+    ${CMAKE_CURRENT_BINARY_DIR}/simpletest.grpc.pb.cc
+    ${CMAKE_CURRENT_BINARY_DIR}/simpletest.pb.cc
+    ${CMAKE_CURRENT_BINARY_DIR}/testservice.grpc.pb.cc
+    ${CMAKE_CURRENT_BINARY_DIR}/testservice.pb.cc)
+set_source_files_properties(${GENERATED_SOURCES} PROPERTIES GENERATED TRUE)
+
+add_executable(${TARGET} main.cpp ${GENERATED_SOURCES})
+target_link_libraries(${TARGET} gRPC::grpc++ protobuf::libprotobuf)
+target_include_directories(${TARGET} PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
+if(MSVC)
+   target_compile_definitions(${TARGET} PRIVATE _WIN32_WINNT=0x600 _SCL_SECURE_NO_WARNINGS _CRT_SECURE_NO_WARNINGS _WINSOCK_DEPRECATED_NO_WARNINGS)
+endif()
+file(GLOB PROTO_FILES ABSOLUTE ${CMAKE_CURRENT_SOURCE_DIR}/../proto/*.proto)
+protobuf_generate_all(TARGET ${TARGET}
+    GENERATED_SOURCES ${GENERATED_SOURCES}
+    PROTO_FILES ${PROTO_FILES})
+    
+file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/cert.pem ${CMAKE_CURRENT_SOURCE_DIR}/key.pem DESTINATION ${CMAKE_CURRENT_BINARY_DIR})

+ 34 - 0
tests/test_grpc/secureechoserver/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R8oj/gKFPS
+L7DqR8DsvyGg/JuHx+sdSG3T5q5zGzz2w03mDkoSyxWe36u3F3EyChhPfjcaSape
+0mVZG9D69wbsZefVDJii9NLvWThGog==
+-----END PRIVATE KEY-----

+ 89 - 0
tests/test_grpc/secureechoserver/main.cpp

@@ -0,0 +1,89 @@
+#include <iostream>
+#include <grpc++/grpc++.h>
+#include <testservice.pb.h>
+#include <testservice.grpc.pb.h>
+#include <simpletest.pb.h>
+#include <simpletest.grpc.pb.h>
+#include <thread>
+#include <fstream>
+#include <sstream>
+
+class SimpleTestImpl final : public qtprotobufnamespace::tests::TestService::Service {
+public:
+    ::grpc::Status testMethod(grpc::ServerContext *, const qtprotobufnamespace::tests::SimpleStringMessage *request, qtprotobufnamespace::tests::SimpleStringMessage *response) override
+    {
+        std::cerr << "testMethod called" << std::endl << request->testfieldstring() << std::endl;
+        response->set_testfieldstring(request->testfieldstring());
+        if(request->testfieldstring() == "sleep") {
+            std::this_thread::sleep_for(std::chrono::seconds(3));
+        }
+        return ::grpc::Status();
+    }
+
+    ::grpc::Status testMethodServerStream(grpc::ServerContext *, const qtprotobufnamespace::tests::SimpleStringMessage *request,
+                                          ::grpc::ServerWriter<qtprotobufnamespace::tests::SimpleStringMessage> *writer) override
+    {
+        std::cerr << "testMethodServerStream called" << std::endl << request->testfieldstring() << std::endl;
+        qtprotobufnamespace::tests::SimpleStringMessage msg;
+
+        msg.set_testfieldstring(request->testfieldstring() + "1");
+        std::this_thread::sleep_for(std::chrono::seconds(3));
+        std::cerr << "send back " << (request->testfieldstring() + "1") << std::endl;
+        writer->Write(msg);
+
+        msg.set_testfieldstring(request->testfieldstring() + "2");
+        std::this_thread::sleep_for(std::chrono::seconds(3));
+        std::cerr << "send back " << (request->testfieldstring() + "2") << std::endl;
+        writer->Write(msg);
+
+        msg.set_testfieldstring(request->testfieldstring() + "3");
+        std::this_thread::sleep_for(std::chrono::seconds(3));
+        std::cerr << "send back " << (request->testfieldstring() + "3") << std::endl;
+        writer->Write(msg);
+
+        msg.set_testfieldstring(request->testfieldstring() + "4");
+        std::this_thread::sleep_for(std::chrono::seconds(3));
+        std::cerr << "send back " << (request->testfieldstring() + "4") << std::endl;
+        writer->WriteLast(msg, grpc::WriteOptions());
+
+        return ::grpc::Status();
+    }
+
+    ::grpc::Status testMethodBlobServerStream(grpc::ServerContext *, const qtprotobufnamespace::tests::BlobMessage *request,
+                                          ::grpc::ServerWriter<qtprotobufnamespace::tests::BlobMessage> *writer) override
+    {
+        std::cerr << "testMethodBlobServerStream called" << std::endl;
+        qtprotobufnamespace::tests::BlobMessage msg;
+        msg.set_allocated_testbytes(new std::string(request->testbytes()));
+        writer->Write(msg);
+        return ::grpc::Status();
+    }
+};
+
+int main(int, char *[])
+{
+    std::ifstream tfile("cert.pem");
+    std::stringstream cert;
+    cert << tfile.rdbuf();
+    tfile.close();
+
+    tfile.open("key.pem");
+    std::stringstream key;
+    key << tfile.rdbuf();
+    tfile.close();
+
+    grpc::ServerBuilder builder;
+    grpc::SslServerCredentialsOptions opts(GRPC_SSL_DONT_REQUEST_CLIENT_CERTIFICATE);
+    opts.pem_key_cert_pairs.push_back({key.str(), cert.str()});
+
+    std::string server_uri("localhost:60051");
+    builder.AddListeningPort(server_uri, grpc::SslServerCredentials(opts));
+
+    SimpleTestImpl service;
+    builder.RegisterService(&service);
+
+    std::unique_ptr<grpc::Server> server(builder.BuildAndStart());
+    std::cout << "Server listening on " << server_uri << std::endl;
+
+    server->Wait();
+}

+ 77 - 0
tests/test_grpc/sslclienttest.cpp

@@ -0,0 +1,77 @@
+/*
+ * MIT License
+ *
+ * Copyright (c) 2019 Alexey Edelev <semlanik@gmail.com>
+ *
+ * This file is part of qtprotobuf project https://git.semlanik.org/semlanik/qtprotobuf
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of this
+ * software and associated documentation files (the "Software"), to deal in the Software
+ * without restriction, including without limitation the rights to use, copy, modify,
+ * merge, publish, distribute, sublicense, and/or sell copies of the Software, and
+ * to permit persons to whom the Software is furnished to do so, subject to the following
+ * conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all copies
+ * or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
+ * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
+ * PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
+ * FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+#include "testserviceclient.h"
+#include "http2channel.h"
+#include "blobmessage.h"
+#include <sslcredentials.h>
+
+#include <QTimer>
+#include <QFile>
+#include <QCryptographicHash>
+#include <QSslConfiguration>
+
+#include <QCoreApplication>
+#include <gtest/gtest.h>
+
+using namespace qtprotobufnamespace::tests;
+using namespace qtprotobuf;
+
+class ClientTest : public ::testing::Test
+{
+protected:
+    static QCoreApplication m_app;
+    static int m_argc;
+    static QUrl m_echoServerAddress;
+};
+
+int ClientTest::m_argc(0);
+QCoreApplication ClientTest::m_app(m_argc, nullptr);
+QUrl ClientTest::m_echoServerAddress("https://localhost:60051", QUrl::StrictMode);
+
+TEST_F(ClientTest, IncorrectSecureCredentialsTest)
+{
+    //Prepare ssl configuration
+    QSslConfiguration conf = QSslConfiguration::defaultConfiguration();
+
+    //NOTE: CA certificate setup is ommited on purpose
+    //  QFile certFile("cert.pem");
+    //  certFile.open(QIODevice::ReadOnly);
+    //  QByteArray cert = certFile.readAll();
+    //  conf.setCaCertificates({QSslCertificate(cert)});
+
+    conf.setProtocol(QSsl::TlsV1_2);
+    //conf.setAllowedNextProtocols({QSslConfiguration::ALPNProtocolHTTP2});
+
+    std::shared_ptr<qtprotobuf::AbstractChannel> channel(new qtprotobuf::Http2Channel(m_echoServerAddress, qtprotobuf::SslCredentials(conf)));
+
+    TestServiceClient testClient;
+    testClient.attachChannel(channel);
+
+    QPointer<SimpleStringMessage> result(new SimpleStringMessage);
+    EXPECT_FALSE(testClient.testMethod(SimpleStringMessage{"Hello beach!"}, result));
+
+    delete result;
+}