email: Show reverse DNS entries to be configured

Imroves: https://salsa.debian.org/freedombox-team/freedombox/-/issues/56

[sunil]

- Show reverse DNS records for both IPv4 and IPv6 addresses.

- Use utility to lookup public IP addresses.

- Rename the template context variable and method to use less technical terms.

- Use Python's ipaddress module to compute the PTR record's domain value.

- Don't retrieve primary domain at the module level.

Signed-off-by: Benedek Nagy <contact@nbenedek.me>
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Benedek Nagy <contact@nbenedek.me>
This commit is contained in:
Benedek Nagy committed 2025-01-13 21:29:50 +01:00
1 parent a4b8f3e27f
commit 15291fdb8a
3 files changed
+63 -2

No files matched your search

+37
View File
@@ -58,4 +58,41 @@
</tbody>
</table>
</div>
<h4>{% trans "Reverse DNS" %}</h4>
<p>
{% blocktrans trimmed %}
If your {{ box_name }} runs on a cloud service infrastructure, you
should configure <a href="https://en.wikipedia.org/wiki/Reverse_DNS_lookup">
Reverse DNS lookup</a>. This isn't mandatory, however, it greatly improves
email deliverability. Reverse DNS isn't configured where your regular DNS
is. You should look for it in the settings of your VPS. Some providers
preconfigure the IP address part for you and you only have to set the domain part.
{% endblocktrans %}
</p>
<div class="table-responsive">
<table class="table table-sm">
<thead>
<tr>
<th>{% trans "Host" %}</th>
<th>{% trans "TTL" %}</th>
<th>{% trans "Type" %}</th>
<th>{% trans "Host/Target/Value" %}</th>
</tr>
</thead>
<tbody>
{% for dns_entry in reverse_dns_entries %}
<tr>
<td>{{ dns_entry.domain|default_if_none:"" }}</td>
<td>{{ dns_entry.ttl }}</td>
<td>{{ dns_entry.type_ }}</td>
<td class="text-break">{{ dns_entry.get_split_value }}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
{% endblock %}