security/acme-client: add support for selectel.ru V2 API (#4824)

* security/acme-client: add support for selectel.ru V2 API
* fix syntax depreciation warning in SecurityController.php
This commit is contained in:
Lis 2025-12-01 00:53:46 +03:00 committed by GitHub
parent e866e541da
commit a12012ad37
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 62 additions and 3 deletions

View file

@ -77,7 +77,7 @@ class SettingsController extends ApiMutableModelControllerBase
} else {
// Cron job NOT found. This should not happen, try to fix
// this automatically.
$this->getLogger()->error("AcmeClient: cron job with stored UUID not found in system config: ${cron_uuid}");
$this->getLogger()->error("AcmeClient: cron job with stored UUID not found in system config: {$cron_uuid}");
// Search for existing AcmeClient cron job.
foreach ((new Cron())->getNodeByReference('jobs.job')->iterateItems() as $cron) {
@ -86,7 +86,7 @@ class SettingsController extends ApiMutableModelControllerBase
if ($_origin == 'AcmeClient') {
// Found a matching AcmeClient cron job.
$cron_found = 1;
$this->getLogger()->notice("AcmeClient: found existing AcmeClient cron job, fixing inconsistency in config (new UUID: ${_uuid})");
$this->getLogger()->notice("AcmeClient: found existing AcmeClient cron job, fixing inconsistency in config (new UUID: {$_uuid})");
// Update UUID in Acme Client config.
$mdlAcme->settings->UpdateCron = $_uuid;
// Save updated configuration.

View file

@ -1236,9 +1236,43 @@
</field>
<field>
<id>validation.dns_sl_key</id>
<label>API Key</label>
<label>API Key (DEPRECIATED)</label>
<type>text</type>
</field>
<field>
<id>validation.dns_sl_apiver</id>
<label>API Version</label>
<type>text</type>
<help>Available Values: V2</help>
</field>
<field>
<id>validation.dns_sl_token_lifetime</id>
<label>Token lifetime</label>
<type>text</type>
<help>Token lifetime in minutes (0-1440)</help>
</field>
<field>
<id>validation.dns_sl_account_id</id>
<label>Account ID</label>
<type>text</type>
<help>Account number, can be seen in the upper right corner on the provider's website</help>
</field>
<field>
<id>validation.dns_sl_project_name</id>
<label>Project name</label>
<type>text</type>
</field>
<field>
<id>validation.dns_sl_login_name</id>
<label>Service username</label>
<type>text</type>
<help>Service username, can be seen in the control panel</help>
</field>
<field>
<id>validation.dns_sl_password</id>
<label>Password</label>
<type>password</type>
</field>
<field>
<label>Selfhost</label>
<type>header</type>

View file

@ -2,6 +2,7 @@
/*
* Copyright (C) 2020 Frank Wall
* Modifications Copyright (C) 2025 Renat Gorbushin
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -40,5 +41,11 @@ class DnsSelectel extends Base implements LeValidationInterface
public function prepare()
{
$this->acme_env['SL_Key'] = (string)$this->config->dns_sl_key;
$this->acme_env['SL_Ver'] = (string)$this->config->dns_sl_apiver;
$this->acme_env['SL_Expire'] = (string)$this->config->dns_slv2_token_lifetime;
$this->acme_env['SL_Login_ID'] = (string)$this->config->dns_sl_account_id;
$this->acme_env['SL_Project_Name'] = (string)$this->config->dns_sl_project_name;
$this->acme_env['SL_Login_Name'] = (string)$this->config->dns_sl_login_name;
$this->acme_env['SL_Pswd'] = (string)$this->config->dns_sl_password;
}
}

View file

@ -1056,6 +1056,24 @@
<dns_sl_key type="TextField">
<Required>N</Required>
</dns_sl_key>
<dns_sl_apiver type="TextField">
<Required>N</Required>
</dns_sl_apiver>
<dns_sl_token_lifetime type="TextField">
<Required>N</Required>
</dns_sl_token_lifetime>
<dns_sl_account_id type="TextField">
<Required>N</Required>
</dns_sl_account_id>
<dns_sl_project_name type="TextField">
<Required>N</Required>
</dns_sl_project_name>
<dns_sl_login_name type="TextField">
<Required>N</Required>
</dns_sl_login_name>
<dns_sl_password type="TextField">
<Required>N</Required>
</dns_sl_password>
<dns_selfhost_user type="TextField">
<Required>N</Required>
</dns_selfhost_user>