From 2469b539305698cc22804f988f002c23f74a84a8 Mon Sep 17 00:00:00 2001 From: pmishev Date: Mon, 31 Jul 2023 19:32:56 +0300 Subject: [PATCH] Added ssl_verification parameter to the connections configuration --- src/DependencyInjection/Configuration.php | 4 ++++ src/Manager/ConnectionManager.php | 3 +++ 2 files changed, 7 insertions(+) diff --git a/src/DependencyInjection/Configuration.php b/src/DependencyInjection/Configuration.php index 3726cb4..b624650 100644 --- a/src/DependencyInjection/Configuration.php +++ b/src/DependencyInjection/Configuration.php @@ -93,6 +93,10 @@ private function getConnectionsNode(): NodeDefinition ->prototype('scalar') ->end() ->end() + ->scalarNode('ssl_verification') + ->defaultNull() + ->info('Set to true to enable SSL certificate verification and use the default CA bundle provided by operating system or provide the path to a CA bundle to enable verification using a custom certificate') + ->end() ->scalarNode('profiling') ->defaultTrue() ->info('Enable/disable profiling.') diff --git a/src/Manager/ConnectionManager.php b/src/Manager/ConnectionManager.php index 60e8fe3..344318d 100644 --- a/src/Manager/ConnectionManager.php +++ b/src/Manager/ConnectionManager.php @@ -112,6 +112,9 @@ public function getClient(): Client if (!$this->client) { $clientBuilder = ClientBuilder::create(); $clientBuilder->setHosts($this->connectionSettings['hosts']); + if (isset($this->connectionSettings['ssl_verification'])) { + $clientBuilder->setSSLVerification($this->connectionSettings['ssl_verification']); + } if ($this->tracer && $this->kernelDebug) { $clientBuilder->setTracer($this->tracer); }