transfersite: dnsbpass not working for addon domains

For transfersite, i have an addon domain that uses third party nameservers. as per searching on discord, i have added the domain to /etc/virtualhosting/dnsbypass.

Transfersite still fails with

NOTICE: aliases_add_domain failed... retrying...
NOTICE: aliases_add_domain failed... retrying...
NOTICE: aliases_add_domain failed... retrying...
NOTICE: aliases_add_domain failed... retrying...
FAILURE: aliases_add_domain
Aliases_Module::_verify(): `redacted.com': domain has DNS records delegated to nameservers dns1.registrar-servers.com, dns2.registrar-servers.com. Domain cannot be added to this account for security. Complete one of the following options to verify ownership:

dnsbypass must be located in /usr/local/apnscp/storage.

dnsbypass is a symlink to /usr/local/apnscp/storage/dnsbypass.

In updating this file, you unlinked the file and created a physical file in /etc/virtualhosting.

This is incorrect usage.

# ls -la /etc/virtualhosting/
total 16
drwx------.   2 apnscp root   155 Jun 20  2024 .
drwxr-xr-x. 149 root   root 12288 Jul  9 17:33 ..
lrwxrwxrwx    1 root   root    44 Apr 17  2024 dnsbypass -> /usr/local/apnscp/storage/opcenter/dnsbypass
lrwxrwxrwx.   1 root   root    44 Aug  4  2022 filelists -> /usr/local/apnscp/storage/opcenter/filelists
lrwxrwxrwx.   1 root   root    44 Aug  4  2022 interface -> /usr/local/apnscp/storage/opcenter/interface
lrwxrwxrwx.   1 root   root    43 Aug  4  2022 ipranges -> /usr/local/apnscp/storage/opcenter/ipranges
lrwxrwxrwx.   1 root   root    43 Aug  4  2022 mappings -> /usr/local/apnscp/storage/opcenter/mappings
lrwxrwxrwx.   1 root   root    54 Aug  4  2022 namebased_ip6_addrs -> /usr/local/apnscp/storage/opcenter/namebased_ip6_addrs
lrwxrwxrwx.   1 root   root    53 Aug  4  2022 namebased_ip_addrs -> /usr/local/apnscp/storage/opcenter/namebased_ip_addrs
lrwxrwxrwx.   1 root   root    43 Aug  4  2022 plans -> /usr/local/apnscp/resources/templates/plans

i did not unlink it i think.

total 12K
drwx------    2 apnscp root  155  5. Jul 12:51 .
drwxr-xr-x. 120 root   root 8,0K 10. Jul 15:45 ..
lrwxrwxrwx    1 root   root   44  5. Jul 12:51 dnsbypass -> /usr/local/apnscp/storage/opcenter/dnsbypass
lrwxrwxrwx    1 root   root   44  5. Jul 12:51 filelists -> /usr/local/apnscp/storage/opcenter/filelists
lrwxrwxrwx    1 root   root   44  5. Jul 12:51 interface -> /usr/local/apnscp/storage/opcenter/interface
lrwxrwxrwx    1 root   root   43  5. Jul 12:51 ipranges -> /usr/local/apnscp/storage/opcenter/ipranges
lrwxrwxrwx    1 root   root   43  5. Jul 12:51 mappings -> /usr/local/apnscp/storage/opcenter/mappings
lrwxrwxrwx    1 root   root   54  5. Jul 12:51 namebased_ip6_addrs -> /usr/local/apnscp/storage/opcenter/namebased_ip6_addrs
lrwxrwxrwx    1 root   root   53  5. Jul 12:51 namebased_ip_addrs -> /usr/local/apnscp/storage/opcenter/namebased_ip_addrs
lrwxrwxrwx    1 root   root   43  5. Jul 12:51 plans -> /usr/local/apnscp/resources/templates/plans

i have unlinked, relinked and edited the file you suggested. Will report back.

Then the domain is not listed on the destination server’s dnsbypass list.

It’s literally the second check in _verify():

			if (!$this->dns_domain_on_account($domain) /** domain under same invoice */ &&
				!$this->_verify_dns($domain) && !$this->_verify_url($domain)
			) {

All 3 conditions must be false. dnsbypass is checked in _verify_dns() as the first check:

	protected function _verify_dns(string $domain): bool
		{
			/*
			 * workaround for account migrations which
			 * duplicate domains across multiple servers
			 * that no longer have DNS properly delegated
			 *
			 * @XXX DNS checks can be bypassed via API: BAD
			 */
			if ($this->isBypass($domain)) {
				return true;
			}

isBypass() checks each domain name listed. File is ordered as 1 domain per line.

There’s not much more to it than that. If the domain matches (strict matching, case matters) then it returns true thus preventing the error (1 condition in 3 is true; remember all 3 must be false to produce that error).

You’ve encountered the error because you have something malformed either in the domain name or entered the domain name on the source rather than destination server.

destination server.

unlinked and linked the file again.


total 12K
drwx------    2 apnscp root  155 10. Jul 16:08 .
drwxr-xr-x. 120 root   root 8,0K 10. Jul 16:10 ..
lrwxrwxrwx    1 root   root   44 10. Jul 16:08 dnsbypass -> /usr/local/apnscp/storage/opcenter/dnsbypass
lrwxrwxrwx    1 root   root   44  5. Jul 12:51 filelists -> /usr/local/apnscp/storage/opcenter/filelists
lrwxrwxrwx    1 root   root   44  5. Jul 12:51 interface -> /usr/local/apnscp/storage/opcenter/interface
lrwxrwxrwx    1 root   root   43  5. Jul 12:51 ipranges -> /usr/local/apnscp/storage/opcenter/ipranges
lrwxrwxrwx    1 root   root   43  5. Jul 12:51 mappings -> /usr/local/apnscp/storage/opcenter/mappings
lrwxrwxrwx    1 root   root   54  5. Jul 12:51 namebased_ip6_addrs -> /usr/local/apnscp/storage/opcenter/namebased_ip6_addrs
lrwxrwxrwx    1 root   root   53  5. Jul 12:51 namebased_ip_addrs -> /usr/local/apnscp/storage/opcenter/namebased_ip_addrs
lrwxrwxrwx    1 root   root   43  5. Jul 12:51 plans -> /usr/local/apnscp/resources/templates/plans

edited /usr/local/apnscp/storage/opcenter/dnsbypass instead


total 36K
drwxr-xr-x.  4 apnscp apnscp  156  5. Jul 15:55 .
drwxr-xr-x. 17 apnscp apnscp 4,0K 10. Jul 14:44 ..
-rw-r--r--   1 apnscp apnscp  14K 10. Jul 16:16 dnsbypass
drwxr-xr-x.  4 apnscp apnscp   51  5. Jul 17:29 filelists
-rw-r--r--   1 apnscp apnscp    5  5. Jul 17:29 interface
-rw-r--r--   1 apnscp apnscp    0  5. Jul 17:29 ipranges
drwxr-xr-x.  2 apnscp apnscp 4,0K 10. Jul 16:13 mappings
-rw-r--r--   1 apnscp apnscp    0  5. Jul 17:29 namebased_ip6_addrs
-rw-r--r--   1 apnscp apnscp   12  5. Jul 17:29 namebased_ip_addrs
-rw-r--r--   1 apnscp apnscp  112  5. Jul 17:29 passwd

checked that the correct domain is listed as part of this list

# cat /usr/local/apnscp/storage/opcenter/dnsbypass |grep redacted.tld |wc -l
1

then the error persists.

No joy.

I retraced all my steps:

remove dnsbypass file (in …storage/opcenter), unlink (/etc/virtualhosting/dnsbypass), make a new dnsbypass file, make new link, insert domain list. ->nothing

checked line endings, just in case → nothing

rm /usr/local/apnscp/storage/opcenter/dnsbypass
unlink /etc/virtualhosting/dnsbypass
touch /usr/local/apnscp/storage/opcenter/dnsbypass
chown apnscp:apnscp  /usr/local/apnscp/storage/opcenter/dnsbypass 
ln -s /usr/local/apnscp/storage/opcenter/dnsbypass /etc/virtualhosting/dnsbypass
vi /usr/local/apnscp/storage/opcenter/dnsbypass

Can this just be straight up disabled?
Since when do we need to validate ownership of an addon domain?
Plenty of reasons to add a domain before nameservers are changed, and this shouldn’t be a blocker for a site transfer. I’m seeing this on recent migrations too. I’d like to just turn this “feature” off.
Is this new? I’ve done thousands of migrations and never encountered this.

Locate dnsbypass in /usr/local/apnscp/storage. Note the symlink is to storage/opcenter; this is incorrect.

[domains] => dns_check

Since doing so would allow one to add gmail.com and intercept all outbound mail and even direct DNS if /etc/resolv.conf uses these nameservers in non-split-view mode. It’s a Really Bad Idea :tm:.

Having this feature is better than dealing with the consequences of someone bitching when a malicious actor subverts their network.

No. You’re using cp-proxy, so it’s able to check the domain against its account database.

Welp that explains it, sorry for interjecting…

In general i agree that this is a good feature. But if doing server transfers as admin/root via cli, i think there should be a bit less security checks.

Use cp-proxy so the panel can track domain ownership across servers.

This enforcement occurs when [domains] => dns_check is enabled (default: true) and [dns] => hosting_ns is set (default: unset) or dns,provider is anything but “builtin” or “null”.

It uses the SOAP API, which is the same API any user with an API key could access; hence the need for security.