Source
'Invalid parameter "'.$parameter.'": another tls_psk value is already associated with given tls_psk_identity.'
<?php
/*
** Copyright (C) 2001-2025 Zabbix SIA
**
** This program is free software: you can redistribute it and/or modify it under the terms of
** the GNU Affero General Public License as published by the Free Software Foundation, version 3.
**
** This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
** without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
** See the GNU Affero General Public License for more details.
**
** You should have received a copy of the GNU Affero General Public License along with this program.
** If not, see <https://www.gnu.org/licenses/>.
**/
require_once dirname(__FILE__).'/../include/CWebTest.php';
/**
* @backup config, config_autoreg_tls
*
* @onBefore prepareHostProxyData
*
* @onAfter clearAutoregistrationData
*/
class testPSKEncryption extends CWebTest {
const UPDATE_SAME_HOST = 'A Same host with PSK Encryption';
const UPDATE_SAME_PROXY = 'A Same proxy with PSK Encryption';
const HOST_NAME = 'A Host with PSK Encryption';
const PROXY_NAME = 'A Proxy with PSK Encryption';
/**
* Attach MessageBehavior to the test.
*
* @return array
*/
public function getBehaviors() {
return [CMessageBehavior::class];
}
public function prepareHostProxyData() {
$groupid = CDataHelper::call('hostgroup.create', [['name' => 'Group for Encryption']])['groupids'][0];
CDataHelper::call('host.create', [
[
'host' => self::HOST_NAME,
'groups' => [['groupid' => $groupid]],
'tls_connect' => HOST_ENCRYPTION_PSK,
'tls_psk_identity' => 'host_identity',
'tls_psk' => '41b4d07b27a8efdcc15d4742e03857eba377fe010853a1499b0522df171282cb'
],
[
'host' => self::UPDATE_SAME_HOST,
'groups' => [['groupid' => $groupid]],
'tls_connect' => HOST_ENCRYPTION_PSK,
'tls_psk_identity' => 'same_host_identity',
'tls_psk' => '978d5dfe7ddc50489078860a5c9c902632acf8efb0c88c869e3812a4c1a4de04'
],
[
'host' => 'Existing host with PSK',
'groups' => [['groupid' => $groupid]],
'tls_connect' => HOST_ENCRYPTION_PSK,
'tls_psk_identity' => 'existing_host_identity',