1

Topic: Alias problem in 2.7.0

==== Required information ====
- iRedMail version (check /etc/iredmail-release): 0.9.7
- Linux/BSD distribution name and version: Debian 9.0
- Store mail accounts in which backend (LDAP/MySQL/PGSQL):  MySQL
- Web server (Apache or Nginx): Nginx
- Manage mail accounts with iRedAdmin-Pro? Yes 2.7.0
- [IMPORTANT] Related original log or error message is required if you're experiencing an issue.
====
Hi again,
second problem with New iRedAdmin-ProSQL. After upgrade i don't see all addreses in aliases. For example:
we have one alias test@example.com with 3 members and 10 moderators. Moderators are: 1@example.com, 2@example.com, *@example2.com, *@example3.com...
After upgrade in panel i only see 1@example.com and 2@example.com all others like *@example are not shown but in sql (alias_moderators) they exists.

----

Spider Email Archiver: On-Premises, lightweight email archiving software developed by iRedMail team. Supports Amazon S3 compatible storage and custom branding.

2

Re: Alias problem in 2.7.0

- Alias moderators are stored in SQL table "vmail.alias_moderators". (was in "vmail.alias", column "moderators" in iRedMail-0.9.6 and earlier releases)
- Alias members are stored in SQL table "vmail.forwardings". (was in "vmail.alias", column "goto")

Could you please check again?

3 (edited by lamagra 2017-07-12 16:13:12)

Re: Alias problem in 2.7.0

ZhangHuangbin wrote:

- Alias moderators are stored in SQL table "vmail.alias_moderators". (was in "vmail.alias", column "moderators" in iRedMail-0.9.6 and earlier releases)
- Alias members are stored in SQL table "vmail.forwardings". (was in "vmail.alias", column "goto")

Could you please check again?

OK, in vmail.alias_moderators i don't see addresses like *@example.com. Even if i add such entry in this table i still don't see it in iredadmin panel. Weird before upgrade it works fine and i can add such wildcard to moderators field.

4

Re: Alias problem in 2.7.0

Fixed. patch attached. If you're not familiar with patch, contact us to get a patched version, then upgrade it by following the upgrade tutorial:
http://www.iredmail.org/docs/migrate.or … admin.html

diff -r 3ee97e7e252d libs/sqllib/alias.py
--- a/libs/sqllib/alias.py    Wed Jul 12 15:33:51 2017 +0800
+++ b/libs/sqllib/alias.py    Wed Jul 12 16:45:25 2017 +0800
@@ -377,14 +377,17 @@
     _members = [str(v).strip().lower() for v in form.get('members', '').splitlines()]
     _members = list(set([iredutils.strip_mail_ext_address(v) for v in _members if iredutils.is_email(v)]))
     _moderators = [str(v).strip().lower() for v in form.get('moderators', '').splitlines()]
-    _moderators = list(set([iredutils.strip_mail_ext_address(v) for v in _moderators if iredutils.is_email(v)]))
+    _moderators = list(set([iredutils.strip_mail_ext_address(v)
+                            for v in _moderators
+                            if iredutils.is_email(v) or v.startswith('*@')]))
+    _moderators_wildcard = [v for v in _moderators if iredutils.is_domain(v.split('@', 1)[-1])]
 
     # Remove non-exist accounts in same domain.
     # Get members & moderators which in same domain.
     _members_in_domain = [i for i in _members if i.endswith('@' + domain)]
     _members_not_in_domain = [i for i in _members if not i.endswith('@' + domain)]
-    _moderators_in_domain = [i for i in _moderators if i.endswith('@' + domain)]
-    _moderators_not_in_domain = [i for i in _moderators if not i.endswith('@' + domain)]
+    _moderators_in_domain = [i for i in _moderators if i.endswith('@' + domain) and i not in _moderators_wildcard]
+    _moderators_not_in_domain = [i for i in _moderators if not (i.endswith('@' + domain) or i in _moderators_wildcard)]
 
     # Verify internal users
     addresses_in_domain = []
@@ -434,7 +437,7 @@
             conn.multiple_insert('forwardings', values=v)
 
         # Add moderators by inserting new records
-        _all_moderators = moderators_in_domain + _moderators_not_in_domain
+        _all_moderators = moderators_in_domain + _moderators_not_in_domain + _moderators_wildcard
         if _all_moderators:
             v = []
             for _moderator in _all_moderators:
@@ -503,7 +506,7 @@
                          what='moderator',
                          where='address=$mail')
 
-        _addresses = [str(i.moderator).lower() for i in qr if iredutils.is_email(i.moderator)]
+        _addresses = [str(i.moderator).lower() for i in qr if iredutils.is_email(i.moderator) or i.moderator.startswith('*@')]
         _addresses.sort()
 
         return (True, _addresses)

5

Re: Alias problem in 2.7.0

Now it works ;-) Thanks!