Re: [Pdns-users] Creating a www CNAME in powerDNS Admin (mysql backend) automatically pointing to @

2023-01-23 Thread Andrea Biancalani via Pdns-users


Seems pretty clear now.

I'm not interested into making redirect visible in public queries, so I 
suppose I'll go for the most standard one



@ SOA ...
@ NS ...
@ MX ...
@ ALIAS /*webhost.servername.tld.*//**/
www A 192.0.2.1
www  2001:db8::1


considering that this dns server is authoritative for 
/*webhost.servername.tld*/ it seems the simplest way to achieve my goal 
to standardize a template for any new domain with same structure.


Many thanks for your time Brian, very appreciated!

Andrea


Il 23/01/2023 13:21, Brian Candler ha scritto:

On 23/01/2023 12:10, Andrea Biancalani wrote:


my default template for new hosting is similar to this


@ SOA ...
@ NS ...
@ MX ...
@ A 192.0.2.1
@  2001:db8::1
www A 192.0.2.1
www  2001:db8::1


but if I try to use this template


@ SOA ...
@ NS ...
@ MX ...
@ ALIAS www. /*(added final dot)*/
www A 192.0.2.1
www  2001:db8::1


I can resolve the www.foo.bar record, but when trying to resolve 
foo.bar I get a "Server failed" answer ( dns-server is not able to 
find foo.bar)


That is as expected. If you add the final dot to www, then you are 
forcing it to resolve the top-level name, literally just "www" (not 
"www.foo.bar"), which of course does not exist.


If this were a BIND zonefile, then "www" without the dot would have 
the current domain appended implicitly.  I haven't tried this with PDNS.


Also, alias records only work if you've configured pdns-auth with a 
resolver to be able to look them up.





Trying to use a template like this instead, gave as result a "RRset 
foo.bar. IN CNAME: Conflicts with pre-existing RRset"



@ SOA ...
@ NS ...
@ MX ...
@ CNAME www. /*(added final dot)*/
www A 192.0.2.1
www  2001:db8::1


That is forbidden by the RFCs. A CNAME cannot exist at the same 
position in the DNS tree as any other records: in your case above, you 
have SOA, NS and MX records with the same label, which conflict with it.




that doesn't happens if I use the zone record as target of the CNAME


@ SOA ...
@ NS ...
@ MX ...
@ CNAME foo.bar. /*(added final dot)*/
www A 192.0.2.1
www  2001:db8::1


That should give the same error - it doesn't make any difference what 
the target of the CNAME is - except if the domain in question is 
foo.bar, then you have a CNAME from foo.bar pointing to foo.bar, which 
is meaningless anyway. It may have been silently discarded.


___
Pdns-users mailing list
Pdns-users@mailman.powerdns.com
https://mailman.powerdns.com/mailman/listinfo/pdns-users


Re: [Pdns-users] Creating a www CNAME in powerDNS Admin (mysql backend) automatically pointing to @

2023-01-23 Thread Brian Candler via Pdns-users

On 23/01/2023 12:10, Andrea Biancalani wrote:


my default template for new hosting is similar to this


@ SOA ...
@ NS ...
@ MX ...
@ A 192.0.2.1
@  2001:db8::1
www A 192.0.2.1
www  2001:db8::1


but if I try to use this template


@ SOA ...
@ NS ...
@ MX ...
@ ALIAS www. /*(added final dot)*/
www A 192.0.2.1
www  2001:db8::1


I can resolve the www.foo.bar record, but when trying to resolve 
foo.bar I get a "Server failed" answer ( dns-server is not able to 
find foo.bar)


That is as expected. If you add the final dot to www, then you are 
forcing it to resolve the top-level name, literally just "www" (not 
"www.foo.bar"), which of course does not exist.


If this were a BIND zonefile, then "www" without the dot would have the 
current domain appended implicitly.  I haven't tried this with PDNS.


Also, alias records only work if you've configured pdns-auth with a 
resolver to be able to look them up.





Trying to use a template like this instead, gave as result a "RRset 
foo.bar. IN CNAME: Conflicts with pre-existing RRset"



@ SOA ...
@ NS ...
@ MX ...
@ CNAME www. /*(added final dot)*/
www A 192.0.2.1
www  2001:db8::1


That is forbidden by the RFCs. A CNAME cannot exist at the same position 
in the DNS tree as any other records: in your case above, you have SOA, 
NS and MX records with the same label, which conflict with it.




that doesn't happens if I use the zone record as target of the CNAME


@ SOA ...
@ NS ...
@ MX ...
@ CNAME foo.bar. /*(added final dot)*/
www A 192.0.2.1
www  2001:db8::1


That should give the same error - it doesn't make any difference what 
the target of the CNAME is - except if the domain in question is 
foo.bar, then you have a CNAME from foo.bar pointing to foo.bar, which 
is meaningless anyway. It may have been silently discarded.
___
Pdns-users mailing list
Pdns-users@mailman.powerdns.com
https://mailman.powerdns.com/mailman/listinfo/pdns-users


Re: [Pdns-users] Creating a www CNAME in powerDNS Admin (mysql backend) automatically pointing to @

2023-01-23 Thread Andrea Biancalani via Pdns-users



Il 23/01/2023 10:32, Brian Candler ha scritto:

On 23/01/2023 08:39, Andrea Biancalani via Pdns-users wrote:


Hello there,

do you know if it is possible with pdns Admin GUI (using mysql backend)


Questions about a particular third-party project which integrates with 
PDNS would be better raised with that third-party project.


There are dozens of admin web interfaces:

https://github.com/PowerDNS/pdns/wiki/WebFrontends

If you are talking about the one called "PowerDNS-Admin" then it has 
its own discussion forum here:


https://github.com/PowerDNS-Admin/PowerDNS-Admin/discussions



Hello,

yeah, I'm talkin' about the latter one, I'll bookmark that link for 
future needs (thanks!).



Answering below for further investigations...


@ IN A 1.2.3.4
www IN CNAME *foo.bar*.


so how can I create a functional template to auto add the www record 
in my template based on domain name? Or... can I solve this using an 
ALIAS type or something different?


Suppose you had a template like this:

@ SOA ...
@ NS ...
@ MX ...
@ A 192.0.2.1
@  2001:db8::1
www A 192.0.2.1
www  2001:db8::1

An alias record can be used to simplify it to:

@ SOA ...
@ NS ...
@ MX ...
@ ALIAS www
www A 192.0.2.1
www  2001:db8::1



You got the point, my default template for new hosting is similar to this


@ SOA ...
@ NS ...
@ MX ...
@ A 192.0.2.1
@  2001:db8::1
www A 192.0.2.1
www  2001:db8::1


but if I try to use this template


@ SOA ...
@ NS ...
@ MX ...
@ ALIAS www. /*(added final dot)*/
www A 192.0.2.1
www  2001:db8::1


I can resolve the www.foo.bar record, but when trying to resolve foo.bar 
I get a "Server failed" answer ( dns-server is not able to find foo.bar)


Using instead the webhost server name it can be correctly resolved, so 
using below sample, is working



Or even:

@ SOA ...
@ NS ...
@ MX ...
@ ALIAS webhost.mycompany.com.
www ALIAS webhost.mycompany.com.    ; see [note] below

Behind the scenes, the auth server does a recursive lookup for the 
ALIAS target and returns the A/ records as if authoritative.  It 
can be used to avoid duplicating IP addresses across many zone files.




Trying to use a template like this instead, gave as result a "RRset 
foo.bar. IN CNAME: Conflicts with pre-existing RRset"



@ SOA ...
@ NS ...
@ MX ...
@ CNAME www. /*(added final dot)*/
www A 192.0.2.1
www  2001:db8::1


that doesn't happens if I use the zone record as target of the CNAME


@ SOA ...
@ NS ...
@ MX ...
@ CNAME foo.bar. /*(added final dot)*/
www A 192.0.2.1
www  2001:db8::1


I suppose this behavior is totally correct, so I'm asking if the best 
solution for my case is just pointing new zones to the template that 
contains ALIAS to webhost server name, to avoid specifing foo.bar as 
CNAME or ALIAS record for a non-www standard record.


Is this fine I suppose, isn't it?

Andrea___
Pdns-users mailing list
Pdns-users@mailman.powerdns.com
https://mailman.powerdns.com/mailman/listinfo/pdns-users


Re: [Pdns-users] Creating a www CNAME in powerDNS Admin (mysql backend) automatically pointing to @

2023-01-23 Thread Brian Candler via Pdns-users

On 23/01/2023 08:39, Andrea Biancalani via Pdns-users wrote:


Hello there,

do you know if it is possible with pdns Admin GUI (using mysql backend)


Questions about a particular third-party project which integrates with 
PDNS would be better raised with that third-party project.


There are dozens of admin web interfaces:

https://github.com/PowerDNS/pdns/wiki/WebFrontends

If you are talking about the one called "PowerDNS-Admin" then it has its 
own discussion forum here:


https://github.com/PowerDNS-Admin/PowerDNS-Admin/discussions



@ IN A 1.2.3.4
www IN CNAME *foo.bar*.


so how can I create a functional template to auto add the www record 
in my template based on domain name? Or... can I solve this using an 
ALIAS type or something different?


Suppose you had a template like this:

@ SOA ...
@ NS ...
@ MX ...
@ A 192.0.2.1
@  2001:db8::1
www A 192.0.2.1
www  2001:db8::1

An alias record can be used to simplify it to:

@ SOA ...
@ NS ...
@ MX ...
@ ALIAS www
www A 192.0.2.1
www  2001:db8::1

Or even:

@ SOA ...
@ NS ...
@ MX ...
@ ALIAS webhost.mycompany.com.
www ALIAS webhost.mycompany.com.    ; see [note] below

Behind the scenes, the auth server does a recursive lookup for the ALIAS 
target and returns the A/ records as if authoritative.  It can be 
used to avoid duplicating IP addresses across many zone files.


[note]: that particular one could also be a CNAME; the one above 
couldn't.  But CNAMEs are visible in DNS lookups, whilst ALIAS records 
are invisible.


See also: https://doc.powerdns.com/authoritative/guides/alias.html

HTH,

Brian.
___
Pdns-users mailing list
Pdns-users@mailman.powerdns.com
https://mailman.powerdns.com/mailman/listinfo/pdns-users