This is an automated email from the ASF dual-hosted git repository. mmartell pushed a commit to branch develop in repository https://gitbox.apache.org/repos/asf/geode-native.git
The following commit(s) were added to refs/heads/develop by this push: new 3c38571 GEODE-4348: dotnet SSL example (#445) 3c38571 is described below commit 3c38571590088a4f15a48441a6abed273a6723c8 Author: Ivan Godwin <igod...@pivotal.io> AuthorDate: Fri Feb 22 09:33:11 2019 -0800 GEODE-4348: dotnet SSL example (#445) * Enable SSL for all server components. * GEODE-4348: Add SSL example Co-authored-by: Ivan Godwin <igod...@pivotal.io> * GEODE-4728 - User Guide, Incorporate reviewer suggestions * cmake updated to place ssl certs in example dir * Updates for SslPutGet example: - ps1 scripts pull keys from keys subdirs - Only build SSL examples when OpenSSL is installed - Update the BUILD-EXAMPLES.md Coauthored-by: Matt Reddington <mredding...@pivotal.io> * GEODE-4348: Added missing newline Co-authored-by: Matthew Reddington <mredding...@pivotal.io> * GEODE-6211: Fix dotnet example renaming (#444) GEODE-6211: Fix dotnet example renaming - Windows packaging step failed because CMakeLists.txt.in still had old names - pdxautoserializable directory was misnamed - function execution directory still had old name - install target works again on Windows - examples build works again on Windows Co-authored-by: Mike Martell <mmart...@pivotal.io> * GEODE-4348: Rebasing on develop and renaming work * GEODE-4348: Rename example directory * GEODE-4348: Add renamed subdirectory --- clicache/integration-test2/Cluster.cs | 4 +- examples/BUILD-EXAMPLES.md | 9 +-- examples/CMakeLists.txt | 2 + examples/CMakeLists.txt.in | 4 ++ examples/cmake/FindGeodeNative.cmake.in | 35 ++++++++++- examples/dotnet/CMakeLists.txt | 2 + examples/dotnet/CMakeLists.txt.dotnet_example.in | 3 + examples/dotnet/CMakeLists.txt.in | 3 + .../sslputget/CMakeLists.txt} | 14 +++-- .../CMakeLists.txt.in} | 31 ++++++++-- examples/dotnet/sslputget/Program.cs | 66 +++++++++++++++++++++ examples/dotnet/sslputget/README.md | 22 +++++++ examples/dotnet/sslputget/startserver.ps1 | 39 ++++++++++++ .../stopserver.ps1} | 38 +++++++----- examples/utilities/CMakeLists.txt.in | 7 +++ .../ClientSslKeys/client_keystore.password.pem | 48 +++++++++++++++ .../utilities/ClientSslKeys/client_truststore.pem | 16 +++++ .../utilities/ServerSslKeys/server_keystore.jks | Bin 0 -> 2102 bytes .../utilities/ServerSslKeys/server_truststore.jks | Bin 0 -> 1596 bytes 19 files changed, 312 insertions(+), 31 deletions(-) diff --git a/clicache/integration-test2/Cluster.cs b/clicache/integration-test2/Cluster.cs index 4d59740..8ceb219 100644 --- a/clicache/integration-test2/Cluster.cs +++ b/clicache/integration-test2/Cluster.cs @@ -202,7 +202,7 @@ namespace Apache.Geode.Client.IntegrationTests { locator .withConnect(false) - .withSslEnableComponents("locator,jmx") + .withSslEnableComponents("all") .withSslKeyStore(cluster_.keyStore_) .withSslKeyStorePassword(cluster_.keyStorePassword_) .withSslTrustStore(cluster_.trustStore_) @@ -276,7 +276,7 @@ namespace Apache.Geode.Client.IntegrationTests if (cluster_.UseSSL) { server - .withSslEnableComponents("server,locator,jmx") + .withSslEnableComponents("all") .withSslKeyStore(cluster_.keyStore_) .withSslKeyStorePassword(cluster_.keyStorePassword_) .withSslTrustStore(cluster_.trustStore_) diff --git a/examples/BUILD-EXAMPLES.md b/examples/BUILD-EXAMPLES.md index bdd1b97..d05079c 100644 --- a/examples/BUILD-EXAMPLES.md +++ b/examples/BUILD-EXAMPLES.md @@ -1,10 +1,11 @@ -# Geode Native C++ Examples +# Geode Native C++ and .Net Examples ## Prerequisites * Install [Apache Geode](https://geode.apache.org) * Install [CMake](https://cmake.org/download/) * Build and install [Apache Geode Native](https://github.com/apache/geode-native) -* **For Windows:** Visual Studio 2015 +* **For Windows:** Visual Studio 2017 +* Optional: OpenSSL (to build and run the SSL examples) ## Building the Examples @@ -18,7 +19,7 @@ $ cd workspace/examples $ mkdir build $ cd build - $ cmake .. -DGEODE_ROOT="<geode-install-root-dir>" + $ cmake .. -DGEODE_ROOT="<geode-install-dir>" $ cmake --build . -- <optional parallelism parameter> ``` where the optional parallelism parameter is of the form `-j n`. @@ -29,7 +30,7 @@ $ cd workspace/examples/ $ mkdir build $ cd build - $ cmake .. -G"Visual Studio 14 2015 Win64" -Thost=x64 -DGeodeNative_ROOT="<NC-install-root-dir>" + $ cmake .. -G"Visual Studio 15 2017 Win64" -Thost=x64 -DGeodeNative_ROOT="<NC-install-root-dir>" -DGEODE_ROOT="<geode-install-dir>" $ cmake --build . -- <optional parallelism parameter> ``` where the optional parallelism parameter is `/m`. diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index f5db00f..b5099ab 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -48,5 +48,7 @@ if (BUILD_CLI) PATTERN "*.in" EXCLUDE) add_subdirectory(dotnet) + find_package(OpenSSL) + endif() add_subdirectory(utilities) diff --git a/examples/CMakeLists.txt.in b/examples/CMakeLists.txt.in index 6e363b6..8705564 100644 --- a/examples/CMakeLists.txt.in +++ b/examples/CMakeLists.txt.in @@ -17,7 +17,11 @@ cmake_minimum_required(VERSION 3.10) project(examples LANGUAGES NONE) +find_package(OpenSSL) + add_subdirectory(cpp) @DOTNET_SUB_DIRECTORY@ add_subdirectory(utilities) + + diff --git a/examples/cmake/FindGeodeNative.cmake.in b/examples/cmake/FindGeodeNative.cmake.in index d2964de..97bb0b1 100644 --- a/examples/cmake/FindGeodeNative.cmake.in +++ b/examples/cmake/FindGeodeNative.cmake.in @@ -25,7 +25,8 @@ # This module defines the following :prop_tgt:`IMPORTED` targets: # # ``@PRODUCT_NAME_NOSPACE@::cpp`` -# ``@PRODUCT_NAME_NOSPACE@:dotnet`` +# ``@PRODUCT_NAME_NOSPACE@::dotnet`` +# ``@PRODUCT_NAME_NOSPACE@::crypto`` # # Result Variables # ^^^^^^^^^^^^^^^^ @@ -71,6 +72,7 @@ endif() # Begin - component "cpp" set(_@PRODUCT_NAME_NOSPACE@_CPP_NAMES @PRODUCT_LIB_NAME@) + find_library(@PRODUCT_NAME_NOSPACE@_CPP_LIBRARY NAMES ${_@PRODUCT_NAME_NOSPACE@_CPP_NAMES} HINTS ${_@PRODUCT_NAME_NOSPACE@_HINTS} @@ -86,6 +88,22 @@ find_path(@PRODUCT_NAME_NOSPACE@_CPP_INCLUDE_DIR NAMES geode/CacheFactory.hpp ) # End - component "cpp" + +# Begin - component "crypto" +set(_@PRODUCT_NAME_NOSPACE@_CRYPTO_NAMES cryptoImpl) + +set(_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES}) +set(CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_SHARED_LIBRARY_SUFFIX}) +find_library(@PRODUCT_NAME_NOSPACE@_CRYPTO_LIBRARY + NAMES ${_@PRODUCT_NAME_NOSPACE@_CRYPTO_NAMES} + HINTS ${_@PRODUCT_NAME_NOSPACE@_HINTS} + PATHS ${_@PRODUCT_NAME_NOSPACE@_PATHS} + PATH_SUFFIXES @PRODUCT_LIB_NAME@/lib lib @PRODUCT_LIB_NAME@/bin bin +) +set(CMAKE_FIND_LIBRARY_SUFFIXES ${_CMAKE_FIND_LIBRARY_SUFFIXES}) +# End - component "crypto" + + # Begin - component "dotnet" set(_@PRODUCT_NAME_NOSPACE@_DOTNET_NAMES @PRODUCT_DLL_NAME@.dll) @@ -97,6 +115,7 @@ find_file(@PRODUCT_NAME_NOSPACE@_DOTNET_LIBRARY ) # End - component "dotnet" + # TODO find version set(@PRODUCT_NAME_NOSPACE@_VERSION_STRING 1.0) @@ -106,6 +125,9 @@ if (@PRODUCT_NAME_NOSPACE@_FIND_COMPONENTS) if (component STREQUAL "cpp") list(APPEND _@PRODUCT_NAME_NOSPACE@_REQUIRED_VARS @PRODUCT_NAME_NOSPACE@_CPP_LIBRARY @PRODUCT_NAME_NOSPACE@_CPP_INCLUDE_DIR) endif() + if (component STREQUAL "crypto") + list(APPEND _@PRODUCT_NAME_NOSPACE@_REQUIRED_VARS @PRODUCT_NAME_NOSPACE@_CRYPTO_LIBRARY) + endif() if (component STREQUAL "dotnet") list(APPEND _@PRODUCT_NAME_NOSPACE@_REQUIRED_VARS @PRODUCT_NAME_NOSPACE@_DOTNET_LIBRARY) endif() @@ -127,8 +149,17 @@ if(@PRODUCT_NAME_NOSPACE@_FOUND) IMPORTED_LOCATION "${@PRODUCT_NAME_NOSPACE@_CPP_LIBRARY}" INTERFACE_INCLUDE_DIRECTORIES "${@PRODUCT_NAME_NOSPACE@_CPP_INCLUDE_DIR}") endif() + + set(@PRODUCT_NAME_NOSPACE@_CRYPTO_TARGET "GeodeNative::crypto") + if(NOT TARGET ${@PRODUCT_NAME_NOSPACE@_CRYPTO_TARGET}) + add_library(${@PRODUCT_NAME_NOSPACE@_CRYPTO_TARGET} UNKNOWN IMPORTED) + set_target_properties(${@PRODUCT_NAME_NOSPACE@_CRYPTO_TARGET} PROPERTIES + IMPORTED_LINK_INTERFACE_LANGUAGES "CXX" + IMPORTED_LOCATION "${@PRODUCT_NAME_NOSPACE@_CRYPTO_LIBRARY}") + endif() + + set(@PRODUCT_NAME_NOSPACE@_DOTNET_TARGET "@PRODUCT_NAME_NOSPACE@::dotnet") if(NOT TARGET ${@PRODUCT_NAME_NOSPACE@_DOTNET_TARGET}) - set(@PRODUCT_NAME_NOSPACE@_DOTNET_TARGET "@PRODUCT_NAME_NOSPACE@::dotnet") add_library(${@PRODUCT_NAME_NOSPACE@_DOTNET_TARGET} UNKNOWN IMPORTED) set_target_properties(${@PRODUCT_NAME_NOSPACE@_DOTNET_TARGET} PROPERTIES IMPORTED_LINK_INTERFACE_LANGUAGES "CSharp" diff --git a/examples/dotnet/CMakeLists.txt b/examples/dotnet/CMakeLists.txt index 92e448f..0c05a97 100644 --- a/examples/dotnet/CMakeLists.txt +++ b/examples/dotnet/CMakeLists.txt @@ -70,5 +70,7 @@ add_example(NAME put-get-remove add_example(NAME remotequery SOURCE Order.cs Program.cs) +add_subdirectory(sslputget) + add_example(NAME transaction SOURCE Program.cs) diff --git a/examples/dotnet/CMakeLists.txt.dotnet_example.in b/examples/dotnet/CMakeLists.txt.dotnet_example.in index 82ab10c..978a013 100644 --- a/examples/dotnet/CMakeLists.txt.dotnet_example.in +++ b/examples/dotnet/CMakeLists.txt.dotnet_example.in @@ -23,6 +23,9 @@ find_package(@PRODUCT_NAME_NOSPACE@ REQUIRED COMPONENTS dotnet) add_executable(${PROJECT_NAME} @ADD_EXAMPLE_SOURCE@) +configure_file("startserver.ps1" ${CMAKE_CURRENT_BINARY_DIR} COPYONLY) +configure_file("stopserver.ps1" ${CMAKE_CURRENT_BINARY_DIR} COPYONLY) + target_link_libraries(${PROJECT_NAME} @PRODUCT_NAME_NOSPACE@::dotnet) diff --git a/examples/dotnet/CMakeLists.txt.in b/examples/dotnet/CMakeLists.txt.in index cb7a825..9d8c962 100644 --- a/examples/dotnet/CMakeLists.txt.in +++ b/examples/dotnet/CMakeLists.txt.in @@ -27,3 +27,6 @@ add_subdirectory(put-get-remove) add_subdirectory(remotequery) add_subdirectory(transaction) +if(OPENSSL_FOUND) + add_subdirectory(sslputget) +endif() diff --git a/examples/CMakeLists.txt.in b/examples/dotnet/sslputget/CMakeLists.txt similarity index 72% copy from examples/CMakeLists.txt.in copy to examples/dotnet/sslputget/CMakeLists.txt index 6e363b6..0c24a30 100644 --- a/examples/CMakeLists.txt.in +++ b/examples/dotnet/sslputget/CMakeLists.txt @@ -15,9 +15,15 @@ cmake_minimum_required(VERSION 3.10) -project(examples LANGUAGES NONE) +project(dotnet-sslputget LANGUAGES NONE) -add_subdirectory(cpp) -@DOTNET_SUB_DIRECTORY@ -add_subdirectory(utilities) +configure_file(${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt.in ${CMAKE_CURRENT_BINARY_DIR}/CMakeLists.txt @ONLY) + +install(FILES + ${CMAKE_CURRENT_BINARY_DIR}/CMakeLists.txt + Program.cs + README.md + startserver.ps1 + stopserver.ps1 + DESTINATION examples/dotnet/sslputget) diff --git a/examples/dotnet/CMakeLists.txt.dotnet_example.in b/examples/dotnet/sslputget/CMakeLists.txt.in similarity index 52% copy from examples/dotnet/CMakeLists.txt.dotnet_example.in copy to examples/dotnet/sslputget/CMakeLists.txt.in index 82ab10c..df64a97 100644 --- a/examples/dotnet/CMakeLists.txt.dotnet_example.in +++ b/examples/dotnet/sslputget/CMakeLists.txt.in @@ -15,17 +15,38 @@ cmake_minimum_required(VERSION 3.10) -project(dotnet-@ADD_EXAMPLE_NAME@ LANGUAGES CSharp) +project(dotnet-sslputget LANGUAGES CSharp) set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/../../cmake) -find_package(@PRODUCT_NAME_NOSPACE@ REQUIRED COMPONENTS dotnet) +find_package(GeodeNative REQUIRED COMPONENTS dotnet crypto) +find_package(OpenSSL REQUIRED COMPONENTS SSL) -add_executable(${PROJECT_NAME} @ADD_EXAMPLE_SOURCE@) +add_executable(${PROJECT_NAME} Program.cs) + +configure_file("startserver.ps1" ${CMAKE_CURRENT_BINARY_DIR} COPYONLY) +configure_file("stopserver.ps1" ${CMAKE_CURRENT_BINARY_DIR} COPYONLY) + +file(GLOB SSL_CERTIFICATES + "${CMAKE_CURRENT_SOURCE_DIR}/../../utilities/*Keys" +) + +file(INSTALL ${SSL_CERTIFICATES} DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) target_link_libraries(${PROJECT_NAME} - @PRODUCT_NAME_NOSPACE@::dotnet) + GeodeNative::dotnet +) set_target_properties(${PROJECT_NAME} PROPERTIES VS_DOTNET_TARGET_FRAMEWORK_VERSION "v4.5.2" - VS_DOTNET_REFERENCES "System;${@PRODUCT_NAME_NOSPACE@_DOTNET_LIBRARY}") + VS_DOTNET_REFERENCES "System" +) + +add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy_directory + $<SHELL_PATH:$<TARGET_FILE_DIR:OpenSSL::SSL>/../bin> + $<SHELL_PATH:$<TARGET_FILE_DIR:${PROJECT_NAME}>> + COMMAND ${CMAKE_COMMAND} -E copy + $<SHELL_PATH:$<TARGET_FILE:GeodeNative::crypto>> + $<SHELL_PATH:$<TARGET_FILE_DIR:${PROJECT_NAME}>> +) diff --git a/examples/dotnet/sslputget/Program.cs b/examples/dotnet/sslputget/Program.cs new file mode 100644 index 0000000..1f0af75 --- /dev/null +++ b/examples/dotnet/sslputget/Program.cs @@ -0,0 +1,66 @@ +/* +* Licensed to the Apache Software Foundation (ASF) under one or more +* contributor license agreements. See the NOTICE file distributed with +* this work for additional information regarding copyright ownership. +* The ASF licenses this file to You under the Apache License, Version 2.0 +* (the "License"); you may not use this file except in compliance with +* the License. You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +using System; +using System.Collections; +using System.Collections.Generic; +using Apache.Geode.Client; + +namespace Apache.Geode.Examples.FunctionExecution +{ + class Program + { + static void Main(string[] args) + { + var cacheFactory = new CacheFactory(); + cacheFactory.Set("log-level", "none"); + cacheFactory.Set("ssl-enabled", "true"); + cacheFactory.Set("ssl-keystore", Environment.CurrentDirectory + @"\..\ClientSslKeys\client_keystore.password.pem"); + cacheFactory.Set("ssl-keystore-password", "gemstone"); + cacheFactory.Set("ssl-truststore", Environment.CurrentDirectory + @"\..\ClientSslKeys\client_truststore.pem"); + + var cache = cacheFactory.Create(); + + var poolFactory = cache.GetPoolFactory() + .AddLocator("localhost", 10334); + var pool = poolFactory.Create("pool"); + + var regionFactory = cache.CreateRegionFactory(RegionShortcut.PROXY) + .SetPoolName("pool"); + var region = regionFactory.Create<object, object>("testSSLRegion"); + + Console.WriteLine("Storing id and username in the region"); + + string rtimmonsKey = "rtimmons"; + string rtimmonsValue = "Robert Timmons"; + string scharlesKey = "scharles"; + string scharlesValue = "Sylvia Charles"; + + region.Put(rtimmonsKey, rtimmonsValue, null); + region.Put(scharlesKey, scharlesValue, null); + + Console.WriteLine("Getting the user info from the region"); + var user1 = region.Get(rtimmonsKey, null); + var user2 = region.Get(scharlesKey, null); + + Console.WriteLine(rtimmonsKey + " = " + user1); + Console.WriteLine(scharlesKey + " = " + user2); + + cache.Close(); + } + } +} diff --git a/examples/dotnet/sslputget/README.md b/examples/dotnet/sslputget/README.md new file mode 100644 index 0000000..a70b334 --- /dev/null +++ b/examples/dotnet/sslputget/README.md @@ -0,0 +1,22 @@ +# SSLPutGet Example +This example illustrates how to use SSL encryption for all traffic between a .NET application and Apache Geode. + +## Prerequisites +* Install [Apache Geode](https://geode.apache.org) +* Build and install [Apache Geode Native](https://github.com/apache/geode-native) +* Install [OpenSSL]() + +## Running +* Run the following Powershell script which starts the Geode Locator, defines the keystore and truststore certificates, starts the Geode Server, and creates the region. + ``` + PS> startserver.ps1 + ``` +* Execute `Apache.Geode.Examples.SSLPutGetCs.exe`. + + output: + ``` + Storing id and username in the region + Getting the user info from the region + rtimmons = Robert Timmons + scharles = Sylvia Charles + ``` diff --git a/examples/dotnet/sslputget/startserver.ps1 b/examples/dotnet/sslputget/startserver.ps1 new file mode 100644 index 0000000..78c0f76 --- /dev/null +++ b/examples/dotnet/sslputget/startserver.ps1 @@ -0,0 +1,39 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +$GFSH_PATH = "" +if (Get-Command gfsh -ErrorAction SilentlyContinue) +{ + $GFSH_PATH = "gfsh" +} +else +{ + if (-not (Test-Path env:GEODE_HOME)) + { + Write-Host "Could not find gfsh. Please set the GEODE_HOME path. e.g. " + Write-Host "(Powershell) `$env:GEODE_HOME = <path to Geode>" + Write-Host " OR" + Write-Host "(Command-line) set %GEODE_HOME% = <path to Geode>" + } + else + { + $GFSH_PATH = "$env:GEODE_HOME\bin\gfsh.bat" + } +} + +if ($GFSH_PATH -ne "") +{ + Invoke-Expression "$GFSH_PATH -e 'start locator --name=locator --dir=$PSScriptRoot/locator --connect=false --J=-Dgemfire.ssl-enabled-components=all --J=-Dgemfire.ssl-keystore=$PSScriptRoot\..\..\Utilities\ServerSslKeys\server_keystore.jks --J=-Dgemfire.ssl-truststore=$PSScriptRoot\..\..\Utilities\ServerSslKeys\server_truststore.jks --J=-Dgemfire.ssl-keystore-password=gemstone --J=-Dgemfire.ssl-truststore-password=gemstone' -e 'connect --use-ssl=true --key-store=$PSScriptRoot\..\..\Ut [...] +} \ No newline at end of file diff --git a/examples/dotnet/CMakeLists.txt.in b/examples/dotnet/sslputget/stopserver.ps1 similarity index 52% copy from examples/dotnet/CMakeLists.txt.in copy to examples/dotnet/sslputget/stopserver.ps1 index cb7a825..742ce8d 100644 --- a/examples/dotnet/CMakeLists.txt.in +++ b/examples/dotnet/sslputget/stopserver.ps1 @@ -1,4 +1,4 @@ -# Licensed to the Apache Software Foundation (ASF) under one or more +# Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 @@ -13,17 +13,27 @@ # See the License for the specific language governing permissions and # limitations under the License. -cmake_minimum_required(VERSION 3.10) - -project(@PRODUCT_DLL_NAME@.DotNet.Examples LANGUAGES NONE) - -add_subdirectory(authinitialize) -add_subdirectory(continuousquery) -add_subdirectory(dataserializable) -add_subdirectory(functionexecution) -add_subdirectory(pdxautoserializer) -add_subdirectory(pdxserializable) -add_subdirectory(put-get-remove) -add_subdirectory(remotequery) -add_subdirectory(transaction) +$GFSH_PATH = "" +if (Get-Command gfsh -ErrorAction SilentlyContinue) +{ + $GFSH_PATH = "gfsh" +} +else +{ + if (-not (Test-Path env:GEODE_HOME)) + { + Write-Host "Could not find gfsh. Please set the GEODE_HOME path. e.g. " + Write-Host "(Powershell) `$env:GEODE_HOME = <path to Geode>" + Write-Host " OR" + Write-Host "(Command-line) set %GEODE_HOME% = <path to Geode>" + } + else + { + $GFSH_PATH = "$env:GEODE_HOME\bin\gfsh.bat" + } +} +if ($GFSH_PATH -ne "") +{ + Invoke-Expression "$GFSH_PATH -e 'connect' -e 'shutdown --include-locators=true'" +} \ No newline at end of file diff --git a/examples/utilities/CMakeLists.txt.in b/examples/utilities/CMakeLists.txt.in index 3859d0d..1e7fd24 100644 --- a/examples/utilities/CMakeLists.txt.in +++ b/examples/utilities/CMakeLists.txt.in @@ -27,3 +27,10 @@ file(GLOB_RECURSE SOURCES "*.java") add_jar(example ${SOURCES} INCLUDE_JARS ${Geode_CLASSPATH} ) + +file(GLOB SSL_CERTIFICATES + "${CMAKE_CURRENT_SOURCE_DIR}/*Keys" +) + +file(INSTALL ${SSL_CERTIFICATES} DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) + \ No newline at end of file diff --git a/examples/utilities/ClientSslKeys/client_keystore.password.pem b/examples/utilities/ClientSslKeys/client_keystore.password.pem new file mode 100644 index 0000000..e92e35c --- /dev/null +++ b/examples/utilities/ClientSslKeys/client_keystore.password.pem @@ -0,0 +1,48 @@ +-----BEGIN RSA PRIVATE KEY----- +Proc-Type: 4,ENCRYPTED +DEK-Info: DES-EDE3-CBC,8C6F1D87BBC9DAD8 + +Cckb6pFRtWdt8M1FXlNstAMSCX93T1irvlsqxWdIK4kXy3vqYDgurUGzlPKPBC2p +jDjo8xazebSrtqi+qyYEBnO3Z6HNCPyGe0iUea8WVnN0ckvAe93Lro9WMdpD2+i8 +YGW9b7oo/OKz2qdUT1GLXYD8IBRXGXmEPCcOF4czQoA1eAXYuo6/Ksf+J0qsd9I5 +BJUeBWI+m58zB8dTulBtO96og03//MqTCJ6INwXDZ1XPbOfQM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ChwQY8P5GlDvyj5oLJ6VZFMAaidWvFrR5oDLm8Khkq +2vLQXnnchje9hm6jDxaO58XsfU5zicfYRuXi2vYmOgltyCixBWQvEwbI+Uf7F6Lw +Da7bpNwTgiYs3snB83trYe17hlUaiF7MNC6lCVdy1/F7FbN/ToQQIDpxHVx7jm6n +SrOtPnOMLoXB9Gcfrtidu1k/ZFyySskK/HnYc1bfGJ9+B1GzbVahuzr/Jdfp62sE +XxEVh9pXSb0gkB/CUpTEx7ve9jU8tEYNUqMDUj87Qg== +-----END CERTIFICATE----- diff --git a/examples/utilities/ClientSslKeys/client_truststore.pem b/examples/utilities/ClientSslKeys/client_truststore.pem new file mode 100644 index 0000000..def668f --- /dev/null +++ b/examples/utilities/ClientSslKeys/client_truststore.pem @@ -0,0 +1,16 @@ +-----BEGIN CERTIFICATE----- +MIIC6zCCAdOgAwIBAgIEUCOimzANBgkqhkiG9w0BAQUFADAeMQswCQYDVQQGEwJVUzEPMA0GA1UE +AwwGc2VydmVyMB4XDTEyMDgwOTExNDQyN1oXDTM3MDgwMzExNDQyN1owHjELMAkGA1UEBhMCVVMx +DzANBgNVBAMMBnNlcnZlcjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAMKe/Phwhj/V +KcFrQuEcnlsWgDGYedyAYwUXItmolvyTeqPRI89H+NktE0zxsn3FjINN/ioz/LLSk6n4y68RGwg+ +8/7EBnYJ/zWYnmPdFeDjzQP6B81YR2YHZH7h+FweQpSpWvo4tZEeiMskQHVMO6t8tE/rwNqcoNfa +BEFUxPWm/S2q22rueS71ft1MtcGRAUr31fGuKslmoBeT8PqBavo0eVeFu4x/b0TbVg5+arJ/JcOc +0qFtSBacnY4hMs4uvTKe4yWd0g3wEEMpy5NpImew1be9nDuCnmP2jorvH4RMfNmq4bNWTJJr6sbt +cCooOE7wEB20Gx69jIATxoXkzHkCAwEAAaMxMC8wHQYDVR0lBBYwFAYIKwYBBQUHAwEGCCsGAQUF +BwMCMA4GA1UdDwEB/wQEAwIEsDANBgkqhkiG9w0BAQUFAAOCAQEAYEt4ia2UcU21clHqzsyg1X1R +nyImw/AKg8D62U1XCdJtqE9JN1H56cijZGKKJqItEtk/ZvsKSUvvBx9tnrrtR/Tz4UZudhG6L/2R +CeU2A2FXk4t0o1PhWY7aOyNfJ9Y7PRRhYuZ5gXCVGy3c+Aiemb1JUF+pwOs92OvALpv+cG6UfxU7 +gZ/VucKvHROFLMru6Kx0luS3SxdAcYa1XhX0OlbYtbZ+8kzfUbKUvNHFfamsHJzfVzuFENQmDNU0 +wtDX7OgyAhUH/UB1TSk0JFa/upODpZNwyy5OVfF4aFQJ7TH//x8vaiy1zo/V7HBhxU8yzk+GlOTD +x/VMmE7x5hJakA== +-----END CERTIFICATE----- diff --git a/examples/utilities/ServerSslKeys/server_keystore.jks b/examples/utilities/ServerSslKeys/server_keystore.jks new file mode 100644 index 0000000..f67f87b Binary files /dev/null and b/examples/utilities/ServerSslKeys/server_keystore.jks differ diff --git a/examples/utilities/ServerSslKeys/server_truststore.jks b/examples/utilities/ServerSslKeys/server_truststore.jks new file mode 100644 index 0000000..eca7330 Binary files /dev/null and b/examples/utilities/ServerSslKeys/server_truststore.jks differ