Skip to content

Commit f4e5e1c

Browse files
author
Till Brehm
committed
Merge branch '6476-api-call-to-set-dnssec-algorithm-and-activate-it' into 'develop'
Resolve "API call to set DNSSEC algorithm and activate it." Closes #6476 See merge request ispconfig/ispconfig3!1731
2 parents d1a632c + 71b537a commit f4e5e1c

File tree

2 files changed

+60
-0
lines changed

2 files changed

+60
-0
lines changed

interface/lib/classes/remote.d/dns.inc.php

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -742,6 +742,39 @@ public function dns_zone_set_status($session_id, $primary_id, $status) {
742742
return false;
743743
}
744744
}
745+
746+
/*
747+
* Set DNSSec Algo and activate it if needed.
748+
*
749+
* @param int session id
750+
* @param int client id
751+
* @param string algorithm 'NSEC3RSASHA1', 'ECDSAP256SHA256' or 'NSEC3RSASHA1,ECDSAP256SHA256' string
752+
* @param boolean update serial
753+
*
754+
* @author Tom Albers <kovoks@kovoks.nl> KovoKs B.V. 2023
755+
*/
756+
757+
public function dns_zone_set_dnssec($session_id, $client_id, $primary_id, $algo, $update_serial=false) {
758+
global $app;
759+
if(!$this->checkPerm($session_id, 'dns_zone_set_status')) {
760+
throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
761+
return false;
762+
}
763+
764+
if(!in_array($algo, ['NSEC3RSASHA1', 'ECDSAP256SHA256', 'NSEC3RSASHA1,ECDSAP256SHA256'])) {
765+
throw new SoapFault('permission_denied', 'You are not using a valid algorithm for this function.');
766+
return false;
767+
}
768+
$params["dnssec_wanted"] = "Y";
769+
$params["dnssec_algo"] = $algo;
770+
$affected_rows = $this->updateQuery('../dns/form/dns_soa.tform.php', $client_id, $primary_id, $params);
771+
if($update_serial) {
772+
$this->increase_serial($session_id, $client_id, ["zone" => $primary_id]);
773+
774+
}
775+
return $affected_rows;
776+
}
777+
745778

746779
private function increase_serial($session_id, $client_id, $params) {
747780
global $app;
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
2+
<html><head><title>ISPCOnfig 3 remote API documentation</title>
3+
4+
5+
6+
7+
8+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
9+
<link rel="stylesheet" type="text/css" href="definitionen.css">
10+
<style type="text/css">
11+
</style></head>
12+
13+
<body>
14+
<div style="padding:40px">
15+
<h1>dns_zone_get(<span class="var">$session_id</span>, <span class="var">$primary_id</span>);</h1>
16+
<br>
17+
<p class="headgrp">Description: </p>
18+
<p class="margin"> Enables/disables DNSSEC for a zone</p><br>
19+
<p class="headgrp">Input Variables: </p> $session_id, $client_id, $primary_id, $algo, $update_serial=false
20+
<p class="margin"> <span class="var">$session_id</span>, <span class="var">$client_id</span>, <span class="var">$primary_id</span>, <span class="var">$algo</span>, <span class="var">$update_serial</span> </p>
21+
<p class="headgrp">Output: </p>
22+
<p class="margin"> Returns the affected rows.</p>
23+
<!--<b>Output:</b>
24+
<p style="margin-left:100px">Gives a record of </p> -->
25+
</div>
26+
27+
</body></html>

0 commit comments

Comments
 (0)