Greetings, I am trying to use the API function dns_templatezone_add , with the code : Code: function zoneAdd($ispapi, $session_id, $customer_id, $main_domain, $nameserver1, $nameserver2, $vhost_ipv4) $template_id = 3; $domain = $main_domain; $ip = $vhost_ipv4; $ns1 = $nameserver1; $ns2 = $nameserver2; $email = 'srv.server.com'; $ispapi->dns_templatezone_add($session_id, $customer_id, $template_id, $domain, $ip, $ns1, $ns2, $email); The problem that I am encountering is that this function does not seem to update the server_id column (gives it value 0) in dns_soa table. I think this is what causes the zone to not getting included into /etc/bind/named.conf.local (the zone gets created correctly, it is jut not included in named.conf.local and not loaded to the bind server (there are no zones with .err)). When I add the zone trough ispconfig UI with Zone Wizard, all gets added correctly (server_id gets a value of 1 which is the default server, and the zone gets included, using the same template and data in the fields). Could you please tell me if I'm missing something? Ca I pass a server_id paramater to dns_templatezone_add ? Thank you
Upon further debug I saw that this behavior might be caused by the fact that default_dnsserver field in client table, gets a value of 0, regardless if the client is added via WEB UI or API (even other default services servers get the value 0. like default_dbserver). If I manually edit the client table and set default_dnsserver to a value of 1 , all works . But the default_dnsserver gets overwritten back to 0 upon any modification of the client.
I found the cause of the issue. It seems to be : - client gets added via API -> All works fine - After -> in the web UI of ISPconfig, if I click save on the Limits page of the client , some of the settings of the client, including default DNS server gets overwritten with wrong values. I do not have client templates set or anything that could overwrite. I don't know if this is some bug or something on my end.
Good question. It would be best if you look into the client_edit.php file and also the interface/lib/plugins/clients_template_plugin.inc.php to check which exact code is causing this field to change. It might e.g. be that the field changes because the client has no DNS servers assigned at all or something similar.
Hello Till, Unfortunately I did not find any problem on my configuration. As to eliminate something I may have missed, I have installed a default ISPconfig using : "Perfect Server Automated ISPConfig 3 Installation on Debian 10 - 11 and Ubuntu 20.04" (I am using Ubuntu 20.04 btw). I did not touch any of the settings. Everything is default as it comes from that tutorial. I have only used the Web UI of ISPconfig to add a client. - I have added a client trough the WEB UI, with the default settings. - Checked client table -> all is good, everything has workable values (default_* are populated with value 1). I did not touch anything here either. - Back to the WEB UI. Just clicked the Save button at the end of the page on the limits tab. - Checked client table again -> the default_* fields get reset to 0. These fields seem to contain the keys/relations to the default services like web, dns, mail and so on. When this happens, things get buggy on the clients end of the panel. I have used both Firefox and Chrome to test this. The fields that contain the multiple services selection (with the boxes), seem to be causing this . I do not have enough know-how of how ISPconfig code works, to debug further. Will try to hardcode the value 1 on these fields in the php code of ISPconfig. I hope the devs can reproduce this, as it can cause problems.