opennetadmin / build_bind

OpenNetAdmin plugin to manage and build BIND DNS server configurations
13 stars 13 forks source link

Bind9 forward named-* files are truncated after 76 lines when generated through an apache2 proxy #19

Open raabf opened 3 years ago

raabf commented 3 years ago

Let‘s assume you are running ONA (commit https://github.com/opennetadmin/ona/commit/0ab7fd7c163108e9dd060eb65ec1a2160823ff3f ) on an Apache2 server on port 8666 and this is again proxied via another apache server 1 with the configuration:

<Location /ona>
    RequestHeader unset Accept-Encoding
    ProxyPreserveHost on

    AddOutputFilterByType SUBSTITUTE text/html
    Substitute "s|http://server.example.org/ona|https://server.example.org/ona|ni"

    ProxyPassReverse /
</Location>

ProxyPass /ona http://127.0.0.1:8666/ona/
ProxyPassReverse /ona http://127.0.0.1:8666/ona/
ProxyRequests Off

And dcm.pl is configured to use:

url         => https://server.example.org/ona/dcm.php

Afterwards, the script build_bind at commit 5924d5cb259a21eaa724467c2cb36e391c3d6f77 is run which builds a bind9 /opt/ona/etc/bind/zone_data/named-sub.example.org zone file, then the file named-sub.example.org is truncated after 76 lines. Of course you need at least 66 entries (first 10 lines are zone file header) for sub.example.org, so that you can see that the file is truncated. The 76 lines of the file are completely correct, just the rest is missing. This error does not affect reverse lookup files, i.e. named-*.ip6.arpa or named-*.in-addr.arpa files; they are complete and can exceed 76 lines. I have no idea why exactly 76 lines, but the number seems to be constant and not changing.

When I remove the proxy, i.e. configure dcm.pl to use:

url         => http://127.0.0.1:8666/ona/dcm.php

then named-sub.example.org is complete and does exceed 76 lines, so the problem arises really by using the proxy. I did not observe any other problems with the proxy.

When you read until this point and think, this cannot be and is wired behavior, especially the 76 lines, then I agree. But I had this problem already ~2 years ago, forgot it meanwhile, and configured now a server again with a proxy and the same problem occurs, so I can reproduce it on a second machine. By the way, The apache proxy is just nice, I have no issues to run build_bind directly on http://127.0.0.1:8666/ona/ , just want to document the problem here.

1: When you wonder whey I am doing this, the first Apache server is running in a docker container.

MegaAndrey commented 2 years ago

By the way, has anyone been able to solve this problem? I am not using proxy but the problem is present. I noticed that the file cannot be more than 8 kilobytes. Is this due to some limitations of the perl?

MegaAndrey commented 2 years ago

Problem was solved by replacing Centos 8 to Centos 7.