Source
'Invalid parameter "'.$parameter.'": another tls_psk value is already associated with given tls_psk_identity.'
<?php
/*
** Zabbix
** 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 General Public License as published by
** the Free Software Foundation; either version 2 of the License, or
** (at your option) any later version.
**
** 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 General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
**/
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'
],