Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[enh] Avoid to generate tons of lines to grant permissions #18

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from
Draft
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 2 additions & 18 deletions templates/named.conf.j2
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,9 @@ zone "{{ domain.name }}" {
type master;
file "/var/lib/bind/{{ domain.name }}.db";
update-policy {
{% for subdomain in domain.subdomains %}
grant {{ subdomain.name }}. name {{ subdomain.name }}. A AAAA TXT MX CAA;
grant {{ subdomain.name }}. name *.{{ subdomain.name }}. A AAAA;
grant {{ subdomain.name }}. name mail._domainkey.{{ subdomain.name }}. TXT;
grant {{ subdomain.name }}. name _dmarc.{{ subdomain.name }}. TXT;
grant {{ subdomain.name }}. name _xmpp-client._tcp.{{ subdomain.name }}. SRV;
grant {{ subdomain.name }}. name _xmpp-server._tcp.{{ subdomain.name }}. SRV;
grant {{ subdomain.name }}. name xmpp-upload.{{ subdomain.name }}. A AAAA CNAME;
grant {{ subdomain.name }}. name muc.{{ subdomain.name }}. A AAAA CNAME;
grant {{ subdomain.name }}. name vjud.{{ subdomain.name }}. A AAAA CNAME;
grant {{ subdomain.name }}. name pubsub.{{ subdomain.name }}. A AAAA CNAME;
{% endfor %}
grant * selfsub . A AAAA TXT MX CAA CNAME SRV DNAME;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See https://bind9.readthedocs.io/en/v9.18.31/reference.html#namedconf-statement-update-policy

If i understand well, all identity matched by * (referring to a tsig key containing the domain name) could edit domain and subdomain related to the name the key...

};
};

{% for subdomain in domain.subdomains %}
key {{ subdomain.name }}. {
algorithm hmac-sha512;
secret "{{ subdomain.key }}";
};
{% endfor %}
include "/etc/bind/keys/*.conf"
{% endfor %}