From 2fa8b879dbd6d619ca2d39ffb7297b9e6f6afa4d Mon Sep 17 00:00:00 2001 From: Pierre Jaury Date: Sat, 25 Jun 2016 14:51:02 +0200 Subject: [PATCH] Display domain SPF and DMARC example entries, fixes #15 --- admin/freeposte/__init__.py | 3 ++ .../admin/templates/domain/details.html | 38 +++++++++++++++++++ .../admin/templates/domain/list.html | 5 ++- admin/freeposte/admin/views/domains.py | 8 ++++ 4 files changed, 53 insertions(+), 1 deletion(-) create mode 100644 admin/freeposte/admin/templates/domain/details.html diff --git a/admin/freeposte/__init__.py b/admin/freeposte/__init__.py index 6938381c..4e284305 100644 --- a/admin/freeposte/__init__.py +++ b/admin/freeposte/__init__.py @@ -17,6 +17,9 @@ default_config = { 'SQLALCHEMY_TRACK_MODIFICATIONS': False, 'SECRET_KEY': 'changeMe', 'DOCKER_SOCKET': 'unix:///var/run/docker.sock', + 'HOSTNAME': 'mail.freeposte.io', + 'DOMAIN': 'freeposte.io', + 'POSTMASTER': 'postmaster', 'DEBUG': False } diff --git a/admin/freeposte/admin/templates/domain/details.html b/admin/freeposte/admin/templates/domain/details.html new file mode 100644 index 00000000..f78b4244 --- /dev/null +++ b/admin/freeposte/admin/templates/domain/details.html @@ -0,0 +1,38 @@ +{% extends "base.html" %} + +{% block title %} +Domain details +{% endblock %} + +{% block subtitle %} +{{ domain.name }} +{% endblock %} + +{% block main_action %} +{% if current_user.global_admin %} +Regenerate keys +{% endif %} +{% endblock %} + +{% block box %} + + + + + + + + + + + + + + + + + + + +
Domain name{{ domain.name }}
DNS MX entry
{{ domain.name }}. 600 IN MX 10 {{ config["HOSTNAME"] }}.
DNS SPF entry
{{ domain.name }}. 600 IN TXT "v=spf1 mx a:{{ config["HOSTNAME"] }} -all"
DNS DMARC entry
_dmarc.{{ domain.name }}. 600 IN TXT "v=DMARC1; p=reject; rua=mailto:{{ config["POSTMASTER"] }}@{{ config["DOMAIN"] }}; adkim=s; aspf=s"
+{% endblock %} diff --git a/admin/freeposte/admin/templates/domain/list.html b/admin/freeposte/admin/templates/domain/list.html index ac380a54..4e7290e3 100644 --- a/admin/freeposte/admin/templates/domain/list.html +++ b/admin/freeposte/admin/templates/domain/list.html @@ -26,8 +26,11 @@ Domain list {% for domain in current_user.get_managed_domains() %} - +   + {% if current_user.global_admin %} +     + {% endif %}   diff --git a/admin/freeposte/admin/views/domains.py b/admin/freeposte/admin/views/domains.py index b728d718..4584b96b 100644 --- a/admin/freeposte/admin/views/domains.py +++ b/admin/freeposte/admin/views/domains.py @@ -1,4 +1,5 @@ from freeposte.admin import app, db, models, forms, utils +from freeposte import app as flask_app from flask.ext import login as flask_login import os @@ -55,3 +56,10 @@ def domain_delete(domain_name): db.session.commit() flask.flash('Domain %s deleted' % domain) return flask.redirect(flask.url_for('.domain_list')) + + +@app.route('/domain/details/', methods=['GET']) +def domain_details(domain_name): + domain = utils.get_domain_admin(domain_name) + return flask.render_template('domain/details.html', domain=domain, + config=flask_app.config)