2023-04-17 12:43:22 +00:00
|
|
|
from typing import Any, Dict, Iterable
|
|
|
|
|
2023-04-17 19:35:57 +00:00
|
|
|
from listtypes import MathebauMLType as MLType
|
2023-04-17 12:43:22 +00:00
|
|
|
|
|
|
|
# source of which keys exist: https://docs.mailman3.org/projects/mailman/en/latest/src/mailman/rest/docs/listconf.html
|
|
|
|
_DEFAULTS: Dict[str, Any] = {
|
2023-04-17 19:35:57 +00:00
|
|
|
# individual
|
|
|
|
'display_name': None,
|
|
|
|
'description': None,
|
|
|
|
'info': None,
|
|
|
|
'subject_prefix': None,
|
|
|
|
'acceptable_aliases': [],
|
|
|
|
'accept_these_nonmembers': [], # TODO: for internal lists, allow @mathebau addresses?
|
|
|
|
'hold_these_nonmembers': [],
|
|
|
|
'reject_these_nonmembers': [],
|
|
|
|
'discard_these_nonmembers': [],
|
|
|
|
|
|
|
|
# type-specific
|
|
|
|
'advertised': {
|
|
|
|
MLType.internalPublic: True,
|
|
|
|
MLType.internalPrivate: False,
|
|
|
|
MLType.broadPublic: True,
|
|
|
|
MLType.broadPrivate: False,
|
|
|
|
},
|
|
|
|
'send_goodbye_message': False, # TODO: entscheiden was in diesen 4 zu tun
|
|
|
|
'send_welcome_message': False, # TODO
|
|
|
|
'admin_immed_notify': False, # TODO
|
|
|
|
'admin_notify_mchanges': True, # TODO
|
|
|
|
'default_member_action': {
|
|
|
|
MLType.internalPublic: 'accept',
|
|
|
|
MLType.internalPrivate: 'accept',
|
|
|
|
MLType.broadPublic: 'hold',
|
|
|
|
MLType.broadPrivate: 'hold',
|
|
|
|
},
|
|
|
|
'default_nonmember_action': {
|
|
|
|
MLType.internalPublic: 'hold', # TODO: wie strikt hier? erlauben?
|
|
|
|
MLType.internalPrivate: 'hold', # TODO: wie strikt hier? erlauben?
|
|
|
|
MLType.broadPublic: 'hold',
|
|
|
|
MLType.broadPrivate: 'hold',
|
|
|
|
},
|
|
|
|
'max_message_size': {
|
|
|
|
MLType.internalPublic: 0,
|
|
|
|
MLType.internalPrivate: 0,
|
|
|
|
MLType.broadPublic: 200,
|
|
|
|
MLType.broadPrivate: 200,
|
|
|
|
},
|
|
|
|
'subscription_policy': {
|
|
|
|
MLType.internalPublic: 'confirm',
|
|
|
|
MLType.internalPrivate: 'confirm_then_moderate',
|
|
|
|
MLType.broadPublic: 'confirm',
|
|
|
|
MLType.broadPrivate: 'confirm_then_moderate',
|
|
|
|
},
|
|
|
|
'unsubscription_policy': {
|
|
|
|
MLType.internalPublic: 'open',
|
|
|
|
MLType.internalPrivate: 'confirm',
|
|
|
|
MLType.broadPublic: 'open',
|
|
|
|
MLType.broadPrivate: 'confirm',
|
|
|
|
},
|
|
|
|
|
|
|
|
# general
|
|
|
|
# - list identity
|
|
|
|
'preferred_language': 'de',
|
|
|
|
'member_roster_visibility': 'members', # TODO: was hat das für Auswirkungen?
|
|
|
|
'gateway_to_mail': False,
|
|
|
|
'gateway_to_news': False,
|
|
|
|
'linked_newsgroup': '',
|
|
|
|
'newsgroup_moderation': 'moderated',
|
|
|
|
'nntp_prefix_subject_too': True,
|
|
|
|
# - automatic responses
|
|
|
|
'autorespond_owner': 'none',
|
|
|
|
'autoresponse_owner_text': '',
|
|
|
|
'autorespond_postings': 'none',
|
|
|
|
'autoresponse_postings_text': '',
|
|
|
|
'autorespond_requests': 'none',
|
|
|
|
'autoresponse_request_text': '',
|
|
|
|
'autoresponse_grace_period': '7d',
|
|
|
|
'respond_to_post_requests': True, # TODO: wie sieht diese Autoresponse aus?
|
|
|
|
# - alter messages
|
|
|
|
'personalize': 'none',
|
|
|
|
'filter_content': True, # TODO: entscheide folgende 5
|
|
|
|
'filter_extensions': ['.mkv'], # TODO
|
|
|
|
'filter_types': ['application/zip'], # TODO
|
|
|
|
'pass_extensions': ['.pdf'], # TODO
|
|
|
|
'pass_types': ['image/jpeg'], # TODO
|
|
|
|
'collapse_alternatives': False, # TODO: wie strikt sind wir? Hier True?
|
|
|
|
'filter_action': 'preserve', # TODO
|
|
|
|
'convert_html_to_plaintext': True, # TODO: wie strikt?
|
|
|
|
'anonymous_list': False,
|
|
|
|
'include_rfc2369_headers': True,
|
|
|
|
'allow_list_posts': False,
|
|
|
|
'reply_to_address': '',
|
|
|
|
'first_strip_reply_to': False,
|
|
|
|
'reply_goes_to_list': 'no_munging',
|
|
|
|
'posting_pipeline': 'default-posting-pipeline',
|
|
|
|
# - DMARC-Mitigations
|
|
|
|
'dmarc_mitigate_action': 'munge_from', # TODO: Serverteam fragen, was sie hier wollen
|
|
|
|
'dmarc_mitigate_unconditionally': False,
|
|
|
|
'dmarc_moderation_notice': 'Nachricht als DMARC-Gegenmaßnahme abgelehnt.',
|
|
|
|
'dmarc_wrapped_message_text': 'Diese Nachricht wurde eingepackt, da die DMARC-Sicherheitsrichtlinien'
|
|
|
|
' des sendenden Mailservers mit Mailinglisten inkompatibel sind.',
|
|
|
|
# - Digest
|
|
|
|
'digests_enabled': True,
|
|
|
|
'digest_send_periodic': True,
|
|
|
|
'digest_volume_frequency': 'monthly',
|
|
|
|
'digest_size_threshold': 30.0,
|
|
|
|
# - Message Acceptance
|
|
|
|
'require_explicit_destination': True,
|
|
|
|
'administrivia': True,
|
|
|
|
'emergency': False,
|
|
|
|
'max_num_recipients': '10',
|
|
|
|
# - Archiving
|
2023-04-17 12:43:22 +00:00
|
|
|
'archive_policy': 'never',
|
2023-04-17 19:35:57 +00:00
|
|
|
# - Member Policy
|
|
|
|
# --- only *_policy here, which is at type-specific
|
|
|
|
# - Bounce Processing
|
|
|
|
'process_bounces': True, # TODO: @Serverteam, what is your policy?
|
|
|
|
'bounce_score_threshold': 5,
|
|
|
|
'bounce_info_stale_after': '30d', # should be long enough for non-active mailinglists
|
2023-04-17 12:43:22 +00:00
|
|
|
'bounce_notify_owner_on_disable': True,
|
|
|
|
'bounce_notify_owner_on_removal': True,
|
2023-04-17 19:35:57 +00:00
|
|
|
'bounce_notify_owner_on_bounce_increment': False, # could be interesting, but probably only for debugging
|
|
|
|
'bounce_you_are_disabled_warnings_interval': '3d',
|
|
|
|
'bounce_you_are_disabled_warnings': 5,
|
|
|
|
# - those do not exist in Postorius' Webinterface
|
|
|
|
'archive_rendering_mode': 'text',
|
2023-04-17 12:43:22 +00:00
|
|
|
'forward_unrecognized_bounces_to': 'administrators',
|
2023-04-17 19:35:57 +00:00
|
|
|
'moderator_password': 'keinparkhaussondernmathebau',
|
|
|
|
'max_days_to_hold': '42',
|
2023-04-17 12:43:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2023-04-17 19:35:57 +00:00
|
|
|
def get_single_default(key: str, listtype: MLType) -> Any:
|
2023-04-17 12:43:22 +00:00
|
|
|
"""Get the default value for a single key of a specific list type"""
|
|
|
|
val = _DEFAULTS.get(key)
|
|
|
|
if isinstance(val, dict):
|
|
|
|
return val.get(listtype)
|
|
|
|
return val
|
|
|
|
|
|
|
|
|
|
|
|
def get_config_keys() -> Iterable[str]:
|
|
|
|
"""Get names of all config attributes a mailinglist has."""
|
|
|
|
return _DEFAULTS.keys()
|
|
|
|
|
|
|
|
|
2023-04-17 19:35:57 +00:00
|
|
|
def get_default_config(listtype: MLType) -> Dict[str, Any]:
|
|
|
|
"""Get the default config set for a mailinglist of a given type.
|
|
|
|
|
|
|
|
Keys with value `None` should be set individually for each list."""
|
2023-04-17 12:43:22 +00:00
|
|
|
ret = dict()
|
|
|
|
for key in get_config_keys():
|
|
|
|
ret[key] = get_single_default(key, listtype)
|
|
|
|
return ret
|