-
Notifications
You must be signed in to change notification settings - Fork 1
Remove "p_" from mailadresses, change subject on lists #2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
1306b1d
8d95a30
5c11895
96ef7d3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -78,7 +78,7 @@ def _sync(self): | |
logging.info(" * Loading groups from AD") | ||
ret, adLists = self._ldap.search( | ||
self.ldapMailingListFilter, | ||
["mail", "proxyAddresses", "distinguishedName", | ||
["mail", "proxyAddresses", "distinguishedName", "description", | ||
"sophomorixMailList", "sAMAccountName"] | ||
) | ||
|
||
|
@@ -133,6 +133,9 @@ def _sync(self): | |
continue | ||
|
||
mail = mailingList["mail"] | ||
if mail.startswith("p_"): | ||
mail = mail[2:] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't like this. As @PLanB2008 mentioned previously, there can be conflicts by blindly doing this. I could imagine adding an option to automatically create aliases without the p_ prefix, as this would not break existing setups and would have to be enabled manually. |
||
desc = mailingList["description"] | ||
maildomain = mail.split("@")[-1] | ||
ret, members = self._ldap.search( | ||
self.ldapMailingListMemberFilter.replace( | ||
|
@@ -150,13 +153,13 @@ def _sync(self): | |
"mail": mail, | ||
"sophomorixStatus": "U", | ||
"sophomorixMailQuotaCalculated": 1, | ||
"displayName": mailingList["sAMAccountName"] + " (list)" | ||
"displayName": "Verteiler " + desc | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please revert this or make it configurable (see @PLanB2008 's comment). |
||
}, mailcowMailboxes) | ||
self._addAliasesFromProxyAddresses( | ||
mailingList, mail, mailcowAliases) | ||
|
||
self._addListFilter(mail, list( | ||
map(lambda x: x["mail"], members)), mailcowFilters) | ||
map(lambda x: x["mail"], members)), desc, mailcowFilters) | ||
|
||
if mailcowDomains.queuesAreEmpty() and mailcowMailboxes.queuesAreEmpty() and mailcowAliases.queuesAreEmpty() and mailcowFilters.queuesAreEmpty(): | ||
logging.info(" * Everything up-to-date!") | ||
|
@@ -262,9 +265,19 @@ def _addAlias(self, alias, goto, mailcowAliases): | |
}, alias) | ||
pass | ||
|
||
def _addListFilter(self, listAddress, memberAddresses, mailcowFilters): | ||
def _addListFilter(self, listAddress, memberAddresses, description, mailcowFilters): | ||
scriptData = "### Auto-generated mailinglist filter by linuxmuster ###\r\n\r\n" | ||
scriptData += "require \"copy\";\r\n\r\n" | ||
scriptData += "require \"editheader\";\r\n" | ||
scriptData += "require \"copy\";\r\n" | ||
scriptData += "require \"variables\";\r\n" | ||
scriptData += "set \"addendum\" \""+description+"\";\r\n" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why are you using description here instead of cn? Is there a way to alter the description from the webui? |
||
scriptData += "# Match the entire subject ...\r\n" | ||
scriptData += "if header :matches \"Subject\" \"*\" {\r\n" | ||
scriptData += " # ... to get it in a match group that can then be stored in a variable:\r\n" | ||
scriptData += " set \"subject\" \"${1}\";\r\n" | ||
scriptData += " }\r\n" | ||
scriptData += "deleteheader \"Subject\";\r\n" | ||
scriptData += "addheader :last \"Subject\" \"[${addendum}] ${subject}\";\r\n" | ||
for memberAddress in memberAddresses: | ||
scriptData += f"redirect :copy \"{memberAddress}\";\r\n" | ||
scriptData += "\r\ndiscard;stop;" | ||
|
@@ -289,6 +302,8 @@ def _readConfig(self): | |
] | ||
|
||
allowedConfigKeys = [ | ||
"LINUXMUSTER_MAILCOW_LDAP_SOGO_USER_FILTER", | ||
"LINUXMUSTER_MAILCOW_LDAP_USER_FILTER", | ||
"LINUXMUSTER_MAILCOW_DOCKERAPI_URI", | ||
"LINUXMUSTER_MAILCOW_API_URI" | ||
] | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see how a normal user would be able to use this. They would have to build their own docker image. If you want to add this, please make it configurable using an env variable.