plesk / ext-slave-dns-manager

The extension for managing a remote slave DNS server via rndc protocol (bind).
Other
16 stars 12 forks source link

Can't select the server IP #13

Closed glanchow closed 7 years ago

glanchow commented 7 years ago

I have 2 IPs, because I have 2 network interfaces, and ofc the wrong one is automatically selected. In Rdnc.php There is a statement with $address->default, but I don't get how it can be set to true. Then, the first IP is selected, the one with the lower ID in database.

Is it possible to make a IP as default ? Or maybe we could add some more configuration parameters ? Or maybe use the subscription IP ?

What do you think ?

dotnull commented 7 years ago

I didnt get that to work too, having multiple IP addresses and PUBLIC IP ADRESSES behind them. The current implementation always uses the first ip while having lower id, and default (which should reflect table cell main in IP_Adresses?) is not available in the response. So i decided hack into it to get the correct ip address. I added the following code in the first line of /opt/psa/admin/plib/modules/slave-dns-manager/library/Rndc.php:

self::$_serverIp = @trim(preg_replace('#ip\:|\s*#','',@explode("\n",shell_exec('plesk db "SELECT IF(public_ip_address!=\'\',public_ip_address,ip_address) AS ip FROM IP_Addresses WHERE main = \'true\'\\G;"'))[1]));

It is currently a dirty hack using the command line to get the right IP, but it works. Hope that helps someone.

It would be nice to implement SlaveDNSManager as per ip basis, or am i wrong?

glanchow commented 7 years ago

I agree that we should be able to select the desired IP. For the time being I'm also using a dirty patch.