summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMark Sapiro2016-12-31 11:09:29 -0800
committerMark Sapiro2016-12-31 11:09:29 -0800
commit4fb6712f7519ff64d142a51779a40a1eb226cbe4 (patch)
treef92eeeeb6f01ee69cd09cf186d60df6802d216ac /src
parent437c4b6388244636b128d96fa817202ba0c39e28 (diff)
parent286eac42626b5a2989d9d1142bff8e8911cf77c2 (diff)
downloadmailman-4fb6712f7519ff64d142a51779a40a1eb226cbe4.tar.gz
mailman-4fb6712f7519ff64d142a51779a40a1eb226cbe4.tar.zst
mailman-4fb6712f7519ff64d142a51779a40a1eb226cbe4.zip
Diffstat (limited to 'src')
-rw-r--r--src/mailman/config/schema.cfg2
-rw-r--r--src/mailman/rest/docs/systemconf.rst14
-rw-r--r--src/mailman/rest/tests/test_systemconf.py19
-rw-r--r--src/mailman/rules/dmarc.py2
4 files changed, 27 insertions, 10 deletions
diff --git a/src/mailman/config/schema.cfg b/src/mailman/config/schema.cfg
index 33fac3716..c94582738 100644
--- a/src/mailman/config/schema.cfg
+++ b/src/mailman/config/schema.cfg
@@ -868,4 +868,4 @@ resolver_lifetime: 5s
# Organizational Domains for DMARC policy lookup purposes. This can be
# anything handled by the Python urllib.request.urlopen function. See
# https://publicsuffix.org/list/ for info.
-org_domain_data: https://publicsuffix.org/list/public_suffix_list.dat
+org_domain_data_url: https://publicsuffix.org/list/public_suffix_list.dat
diff --git a/src/mailman/rest/docs/systemconf.rst b/src/mailman/rest/docs/systemconf.rst
index 24c6bef4a..8f7144d97 100644
--- a/src/mailman/rest/docs/systemconf.rst
+++ b/src/mailman/rest/docs/systemconf.rst
@@ -9,14 +9,12 @@ get a list of all defined sections.
http_etag: ...
sections: ['antispam', 'archiver.mail_archive', 'archiver.master', ...
-You can also get all the values for a particular section.
+You can also get all the values for a particular section, such as the
+``[mailman]`` section...
>>> dump_json('http://localhost:9001/3.0/system/configuration/mailman')
cache_life: 7d
default_language: en
- dmarc_org_domain_data: https://publicsuffix.org/list/public_suffix_list.dat
- dmarc_resolver_lifetime: 5s
- dmarc_resolver_timeout: 3s
email_commands_max_lines: 10
filtered_messages_are_preservable: no
html_to_plain_text_command: /usr/bin/lynx -dump $filename
@@ -29,6 +27,14 @@ You can also get all the values for a particular section.
sender_headers: from from_ reply-to sender
site_owner: noreply@example.com
+...or the ``[dmarc]`` section (or any other).
+
+ >>> dump_json('http://localhost:9001/3.0/system/configuration/dmarc')
+ http_etag: ...
+ org_domain_data_url: https://publicsuffix.org/list/public_suffix_list.dat
+ resolver_lifetime: 5s
+ resolver_timeout: 3s
+
Dotted section names work too, for example, to get the French language
settings section.
diff --git a/src/mailman/rest/tests/test_systemconf.py b/src/mailman/rest/tests/test_systemconf.py
index 28fa315a9..9801badf0 100644
--- a/src/mailman/rest/tests/test_systemconf.py
+++ b/src/mailman/rest/tests/test_systemconf.py
@@ -39,10 +39,6 @@ class TestSystemConfiguration(unittest.TestCase):
self.assertEqual(json, dict(
cache_life='7d',
default_language='en',
- dmarc_org_domain_data= # noqa E251
- 'https://publicsuffix.org/list/public_suffix_list.dat',
- dmarc_resolver_lifetime='5s',
- dmarc_resolver_timeout='3s',
email_commands_max_lines='10',
filtered_messages_are_preservable='no',
html_to_plain_text_command='/usr/bin/lynx -dump $filename',
@@ -55,6 +51,20 @@ class TestSystemConfiguration(unittest.TestCase):
site_owner='noreply@example.com',
))
+ def test_dmarc_system_configuration(self):
+ # Test the [dmarc] section.
+ url = 'http://localhost:9001/3.0/system/configuration/dmarc'
+ json, response = call_api(url)
+ # There must be an `http_etag` key, but we don't care about its value.
+ self.assertIn('http_etag', json)
+ del json['http_etag']
+ self.assertEqual(json, dict(
+ org_domain_data_url= # noqa: E251
+ 'https://publicsuffix.org/list/public_suffix_list.dat',
+ resolver_lifetime='5s',
+ resolver_timeout='3s',
+ ))
+
def test_dotted_section(self):
# A dotted section works too.
url = 'http://localhost:9001/3.0/system/configuration/language.fr'
@@ -103,6 +113,7 @@ class TestSystemConfiguration(unittest.TestCase):
'database',
'devmode',
'digests',
+ 'dmarc',
'language.ar',
'language.ast',
'language.ca',
diff --git a/src/mailman/rules/dmarc.py b/src/mailman/rules/dmarc.py
index c8c4e56f4..5a1073970 100644
--- a/src/mailman/rules/dmarc.py
+++ b/src/mailman/rules/dmarc.py
@@ -83,7 +83,7 @@ def _get_org_dom(domain):
# Domain which may be the same as the input.
global s_dict
if not s_dict:
- _get_suffixes(config.dmarc.org_domain_data)
+ _get_suffixes(config.dmarc.org_domain_data_url)
hits = []
d = domain.lower().split('.')
d.reverse()