diff --git a/interface/lib/classes/remote.d/dns.inc.php b/interface/lib/classes/remote.d/dns.inc.php index 3a2b11022f34cf96ec6d6a663b4cd1c6e9648d5b..c9a5031f0e9a877edc4f9b2dad7a5b77db06c226 100644 --- a/interface/lib/classes/remote.d/dns.inc.php +++ b/interface/lib/classes/remote.d/dns.inc.php @@ -742,6 +742,39 @@ class remoting_dns extends remoting { return false; } } + + /* + * Set DNSSec Algo and activate it if needed. + * + * @param int session id + * @param int client id + * @param string algorithm 'NSEC3RSASHA1', 'ECDSAP256SHA256' or 'NSEC3RSASHA1,ECDSAP256SHA256' string + * @param boolean update serial + * + * @author Tom Albers <kovoks@kovoks.nl> KovoKs B.V. 2023 + */ + + public function dns_zone_set_dnssec($session_id, $client_id, $primary_id, $algo, $update_serial=false) { + global $app; + if(!$this->checkPerm($session_id, 'dns_zone_set_status')) { + throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); + return false; + } + + if(!in_array($algo, ['NSEC3RSASHA1', 'ECDSAP256SHA256', 'NSEC3RSASHA1,ECDSAP256SHA256'])) { + throw new SoapFault('permission_denied', 'You are not using a valid algorithm for this function.'); + return false; + } + $params["dnssec_wanted"] = "Y"; + $params["dnssec_algo"] = $algo; + $affected_rows = $this->updateQuery('../dns/form/dns_soa.tform.php', $client_id, $primary_id, $params); + if($update_serial) { + $this->increase_serial($session_id, $client_id, ["zone" => $primary_id]); + + } + return $affected_rows; + } + private function increase_serial($session_id, $client_id, $params) { global $app; diff --git a/remoting_client/API-docs/dns_zone_set_dnssec.html b/remoting_client/API-docs/dns_zone_set_dnssec.html new file mode 100644 index 0000000000000000000000000000000000000000..c84dd4be27d265090ccc68da81866ace7e1f402c --- /dev/null +++ b/remoting_client/API-docs/dns_zone_set_dnssec.html @@ -0,0 +1,27 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> +<html><head><title>ISPCOnfig 3 remote API documentation</title> + + + + + + <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> + <link rel="stylesheet" type="text/css" href="definitionen.css"> + <style type="text/css"> + </style></head> + +<body> +<div style="padding:40px"> +<h1>dns_zone_get(<span class="var">$session_id</span>, <span class="var">$primary_id</span>);</h1> +<br> +<p class="headgrp">Description: </p> +<p class="margin"> Enables/disables DNSSEC for a zone</p><br> +<p class="headgrp">Input Variables: </p> $session_id, $client_id, $primary_id, $algo, $update_serial=false +<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> +<p class="headgrp">Output: </p> +<p class="margin"> Returns the affected rows.</p> +<!--<b>Output:</b> +<p style="margin-left:100px">Gives a record of </p> --> +</div> + +</body></html>