mirror of
https://github.com/jwinterm/modoboa.git
synced 2026-10-17 05:41:25 +02:00
Merge pull request #1622 from modoboa/feature/dns_config_page
Added DNS configuration page for domain.
This commit is contained in:
@@ -40,7 +40,7 @@ class DomainFormGeneral(forms.ModelForm, DynamicForm):
|
||||
)
|
||||
)
|
||||
dkim_key_selector = forms.CharField(
|
||||
label=ugettext_lazy("Key selector"), required=False)
|
||||
label=ugettext_lazy("Key selector"), initial="modoboa", required=False)
|
||||
quota = forms.CharField(
|
||||
label=ugettext_lazy("Quota"),
|
||||
initial=0,
|
||||
|
||||
@@ -237,7 +237,7 @@ class Domain(AdminObject):
|
||||
split_record.append(" \"%s\"" % record)
|
||||
break
|
||||
record = "\n".join(split_record)
|
||||
return "{}._domainkey.{}. 10800 IN TXT (\n{})".format(
|
||||
return "{}._domainkey.{}. IN TXT (\n{})".format(
|
||||
self.dkim_key_selector, self.name, record)
|
||||
|
||||
def add_admin(self, account):
|
||||
|
||||
@@ -22,6 +22,8 @@
|
||||
{% if enable_dkim_checks and domain.enable_dkim %}
|
||||
{% if not domain.dkim_public_key %}
|
||||
<span class="label label-mini label-default" title="{% trans 'Waiting for key to be generated' %}">DKIM</span>
|
||||
{% elif not domain.dkim_record %}
|
||||
<span class="label label-mini label-danger" title="{% trans 'No record found' %}">DKIM</span>
|
||||
{% else %}
|
||||
<span class="label label-mini label-{% if not domain.dkim_record %}danger{% elif not domain.dkim_record.is_valid %}warning{% else %}success{% endif %}">
|
||||
<a href="{% url 'dnstools:dns_record_detail' domain.dkim_record.pk %}" data-toggle="ajaxmodal">DKIM</a></span>
|
||||
|
||||
@@ -88,7 +88,11 @@
|
||||
<div class="col-xs-12 col-sm-6">
|
||||
<div class="panel panel-info">
|
||||
<div class="panel-heading">
|
||||
<h3 class="panel-title">{% trans "DNS" %}</h3>
|
||||
<h3 class="panel-title">
|
||||
{% trans "DNS" %}
|
||||
<a href="{% url 'dnstools:domain_dns_configuration' domain.pk %}"
|
||||
data-toggle="ajaxmodal"><span class="fa fa-info-circle"></span></a>
|
||||
</h3>
|
||||
</div>
|
||||
<table class="table">
|
||||
{% if enable_mx_checks or enable_dnsbl_checks %}
|
||||
|
||||
@@ -8,7 +8,7 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: PACKAGE VERSION\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2018-11-20 10:22+0100\n"
|
||||
"POT-Creation-Date: 2018-11-20 16:48+0100\n"
|
||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
@@ -133,6 +133,25 @@ msgstr ""
|
||||
msgid "A DNS record has been found but its syntax is not valid:"
|
||||
msgstr ""
|
||||
|
||||
#: templates/dnstools/domain_dns_configuration.html:7
|
||||
msgid ""
|
||||
"Here is an example of DNS configuration (bind format). Replace value between "
|
||||
"[ ] by the appropriate ones."
|
||||
msgstr ""
|
||||
|
||||
#: templates/dnstools/domain_dns_configuration.html:15
|
||||
msgid "IP address of your Modoboa server"
|
||||
msgstr ""
|
||||
|
||||
#: templates/dnstools/domain_dns_configuration.html:28
|
||||
msgid "Auto configuration"
|
||||
msgstr ""
|
||||
|
||||
#: templates/dnstools/domain_dns_configuration.html:30
|
||||
#: templates/dnstools/domain_dns_configuration.html:31
|
||||
msgid "hostname of your automx server"
|
||||
msgstr ""
|
||||
|
||||
#: views.py:36
|
||||
msgid "{} record of {}"
|
||||
msgstr ""
|
||||
@@ -140,3 +159,7 @@ msgstr ""
|
||||
#: views.py:64
|
||||
msgid "Auto configuration records for {}"
|
||||
msgstr ""
|
||||
|
||||
#: views.py:84
|
||||
msgid "DNS configuration for {}"
|
||||
msgstr ""
|
||||
|
||||
@@ -7,8 +7,8 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: PACKAGE VERSION\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2018-11-20 10:22+0100\n"
|
||||
"PO-Revision-Date: 2018-11-20 10:31+0100\n"
|
||||
"POT-Creation-Date: 2018-11-20 16:48+0100\n"
|
||||
"PO-Revision-Date: 2018-11-20 16:50+0100\n"
|
||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
"Language: \n"
|
||||
@@ -133,6 +133,25 @@ msgstr "Un enregistrement DNS a été trouvé et est correct."
|
||||
msgid "A DNS record has been found but its syntax is not valid:"
|
||||
msgstr "Un enregistrement DNS a été trouvé mais sa syntaxe est incorrecte :"
|
||||
|
||||
#: templates/dnstools/domain_dns_configuration.html:7
|
||||
msgid ""
|
||||
"Here is an example of DNS configuration (bind format). Replace value between "
|
||||
"[ ] by the appropriate ones."
|
||||
msgstr "Voici un exemple de configuration DNS (format bind). Remplacez les valeurs entre [ ] par celles appropriées."
|
||||
|
||||
#: templates/dnstools/domain_dns_configuration.html:15
|
||||
msgid "IP address of your Modoboa server"
|
||||
msgstr "Adresse IP de votre serveur Modoboa"
|
||||
|
||||
#: templates/dnstools/domain_dns_configuration.html:28
|
||||
msgid "Auto configuration"
|
||||
msgstr "Configuration automatique"
|
||||
|
||||
#: templates/dnstools/domain_dns_configuration.html:30
|
||||
#: templates/dnstools/domain_dns_configuration.html:31
|
||||
msgid "hostname of your automx server"
|
||||
msgstr "Nom d'hôte de votre serveur automx"
|
||||
|
||||
#: views.py:36
|
||||
msgid "{} record of {}"
|
||||
msgstr "Enregistrement {} de {}"
|
||||
@@ -140,3 +159,7 @@ msgstr "Enregistrement {} de {}"
|
||||
#: views.py:64
|
||||
msgid "Auto configuration records for {}"
|
||||
msgstr "Enregistrements d'autoconfiguration pour {}"
|
||||
|
||||
#: views.py:84
|
||||
msgid "DNS configuration for {}"
|
||||
msgstr "Configuration DNS pour {}"
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
{% extends "common/generic_modal.html" %}
|
||||
|
||||
{% load i18n %}
|
||||
|
||||
{% block modalbody %}
|
||||
<div class="alert alert-info">
|
||||
{% blocktrans trimmed %}
|
||||
Here is an example of DNS configuration (bind format). Replace value between
|
||||
[ ] by the appropriate ones.
|
||||
{% endblocktrans %}
|
||||
</div>
|
||||
|
||||
MX
|
||||
<pre>
|
||||
mail.{{ domain.name }}. IN A <strong>[{% trans "IP address of your Modoboa server" %}]</strong>
|
||||
@ IN MX 10 mail.{{ domain.name }}.</pre>
|
||||
SPF
|
||||
<pre>
|
||||
@ IN TXT "v=spf1 mx ~all"</pre>
|
||||
{% if domain.enable_dkim and domain.dkim_public_key %}
|
||||
DKIM
|
||||
<pre>
|
||||
{{ domain.bind_format_dkim_public_key }}</pre>
|
||||
{% endif %}
|
||||
DMARC
|
||||
<pre>
|
||||
_dmarc.{{ domain.name }}. IN TXT "v=DMARC1; p=quarantine; pct=100"</pre>
|
||||
{% trans "Auto configuration" %}
|
||||
<pre>
|
||||
autoconfig.{{ domain.name }}. IN CNAME <strong>[{% trans "hostname of your automx server" %}]</strong>
|
||||
autodiscover.{{ domain.name }}. IN CNAME <strong>[{% trans "hostname of your automx server" %}]</strong></pre>
|
||||
|
||||
{% endblock %}
|
||||
@@ -148,3 +148,9 @@ class ViewsTestCase(ModoTestCase):
|
||||
self.assertContains(response, "autoconfig record (Mozilla) found")
|
||||
self.assertContains(
|
||||
response, "autodiscover record (Microsoft) not found")
|
||||
|
||||
def test_domain_dns_configuration(self):
|
||||
url = reverse(
|
||||
"dnstools:domain_dns_configuration", args=[self.ac_rec.domain.pk])
|
||||
response = self.client.get(url)
|
||||
self.assertContains(response, "[IP address of your Modoboa server]")
|
||||
|
||||
@@ -11,4 +11,7 @@ urlpatterns = [
|
||||
url(r'^dnsrecords/autoconfig/(?P<pk>\d+)/$',
|
||||
views.AutoConfigRecordsStatusView.as_view(),
|
||||
name="autoconfig_records_status"),
|
||||
url(r'^configuration/(?P<pk>\d+)/$',
|
||||
views.DomainDNSConfigurationView.as_view(),
|
||||
name="domain_dns_configuration"),
|
||||
]
|
||||
|
||||
@@ -65,3 +65,22 @@ class AutoConfigRecordsStatusView(
|
||||
self.object.name)
|
||||
})
|
||||
return context
|
||||
|
||||
|
||||
class DomainDNSConfigurationView(
|
||||
auth_mixins.LoginRequiredMixin,
|
||||
DomainAccessRequiredMixin,
|
||||
generic.DetailView):
|
||||
"""Page to display DNS configuration for a domain."""
|
||||
|
||||
model = admin_models.Domain
|
||||
template_name = "dnstools/domain_dns_configuration.html"
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
"""Add extra variables."""
|
||||
context = super(DomainDNSConfigurationView, self).get_context_data(
|
||||
**kwargs)
|
||||
context.update({
|
||||
"title": _("DNS configuration for {}").format(self.object)
|
||||
})
|
||||
return context
|
||||
|
||||
Reference in New Issue
Block a user