1

Topic: User email forwarding ends up in internal server error

==== REQUIRED BASIC INFO OF YOUR IREDMAIL SERVER ====
- iRedMail version (check /etc/iredmail-release): 1.1
- Deployed with iRedMail Easy or the downloadable installer? installer
- Linux/BSD distribution name and version: Debian Stretch
- Store mail accounts in which backend (LDAP/MySQL/PGSQL): LDAP
- Web server (Apache or Nginx): Apache
- Manage mail accounts with iRedAdmin-Pro? yes
- [IMPORTANT] Related original log or error message is required if you're experiencing an issue.
====

Dear all,

when a user tries to add an email address in iredadmin-pro under preferences - forwarding it ends up in an internal server error. My apache's error.log shows this:

[Wed Mar 25 hh:mm:ss.271739 2020] [wsgi:error] [pid 2284] [remote x.x.x.x:33776] Traceback (most recent call last):
[Wed Mar 25 hh:mm:ss.271790 2020] [wsgi:error] [pid 2284] [remote x.x.x.x:33776]   File "/usr/lib/python2.7/dist-packages/web/application.py", line 239, in process
[Wed Mar 25 hh:mm:ss.271807 2020] [wsgi:error] [pid 2284] [remote x.x.x.x:33776]     return self.handle()
[Wed Mar 25 hh:mm:ss.271821 2020] [wsgi:error] [pid 2284] [remote x.x.x.x:33776]   File "/usr/lib/python2.7/dist-packages/web/application.py", line 230, in handle
[Wed Mar 25 hh:mm:ss.271836 2020] [wsgi:error] [pid 2284] [remote x.x.x.x:33776]     return self._delegate(fn, self.fvars, args)
[Wed Mar 25 hh:mm:ss.271850 2020] [wsgi:error] [pid 2284] [remote x.x.x.x:33776]   File "/usr/lib/python2.7/dist-packages/web/application.py", line 462, in _delegate
[Wed Mar 25 hh:mm:ss.271889 2020] [wsgi:error] [pid 2284] [remote x.x.x.x:33776]     return handle_class(cls)
[Wed Mar 25 hh:mm:ss.271916 2020] [wsgi:error] [pid 2284] [remote x.x.x.x:33776]   File "/usr/lib/python2.7/dist-packages/web/application.py", line 438, in handle_class
[Wed Mar 25 hh:mm:ss.271966 2020] [wsgi:error] [pid 2284] [remote x.x.x.x:33776]     return tocall(*args)
[Wed Mar 25 hh:mm:ss.271985 2020] [wsgi:error] [pid 2284] [remote x.x.x.x:33776]   File "/opt/www/iredadmin/controllers/decorators.py", line 125, in decorated
[Wed Mar 25 hh:mm:ss.272005 2020] [wsgi:error] [pid 2284] [remote x.x.x.x:33776]     return f(*args, **kw)
[Wed Mar 25 hh:mm:ss.272027 2020] [wsgi:error] [pid 2284] [remote x.x.x.x:33776]   File "/opt/www/iredadmin/controllers/decorators.py", line 104, in proxyfunc
[Wed Mar 25 hh:mm:ss.272048 2020] [wsgi:error] [pid 2284] [remote x.x.x.x:33776]     return func(*args, **kw)
[Wed Mar 25 hh:mm:ss.272059 2020] [wsgi:error] [pid 2284] [remote x.x.x.x:33776]   File "/opt/www/iredadmin/controllers/ldap/user.py", line 719, in POST
[Wed Mar 25 hh:mm:ss.272094 2020] [wsgi:error] [pid 2284] [remote x.x.x.x:33776]     conn=None)
[Wed Mar 25 hh:mm:ss.272106 2020] [wsgi:error] [pid 2284] [remote x.x.x.x:33776]   File "/opt/www/iredadmin/controllers/decorators.py", line 104, in proxyfunc
[Wed Mar 25 hh:mm:ss.272120 2020] [wsgi:error] [pid 2284] [remote x.x.x.x:33776]     return func(*args, **kw)
[Wed Mar 25 hh:mm:ss.272143 2020] [wsgi:error] [pid 2284] [remote x.x.x.x:33776]   File "/opt/www/iredadmin/libs/ldaplib/user.py", line 2035, in update_preferences
[Wed Mar 25 hh:mm:ss.272164 2020] [wsgi:error] [pid 2284] [remote x.x.x.x:33776]     _addresses = form_utils.get_multi_values_from_textare(form=form,
[Wed Mar 25 hh:mm:ss.272177 2020] [wsgi:error] [pid 2284] [remote x.x.x.x:33776] AttributeError: 'module' object has no attribute 'get_multi_values_from_textare'
[Wed Mar 25 hh:mm:ss.272214 2020] [wsgi:error] [pid 2284] [remote x.x.x.x:33776]

Adding a forwarding as postmaster works fine by the way.
Seems like a bug to me? And mostly since the last update from 1.0 to 1.1. Any other ideas?

Thanks for help in advance.

----

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

2

Re: User email forwarding ends up in internal server error

Sorry about this trouble. Turns out it's a stupid typo mistake. sad
Here's patch for iRedAdmin-Pro-LDAP-4.3, don't forget to restart "iredadmin" service after patched.

diff --git a/libs/ldaplib/user.py b/libs/ldaplib/user.py
index 5e8210cb..69105ef3 100644
--- a/libs/ldaplib/user.py
+++ b/libs/ldaplib/user.py
@@ -2033,10 +2033,10 @@ def update_preferences(mail, form, profile_type='general', conn=None):
                                                    action=_action,
                                                    conn=conn)
 
-        _addresses = form_utils.get_multi_values_from_textare(form=form,
-                                                              input_name='mailForwardingAddresses',
-                                                              to_lowercase=True,
-                                                              is_email=True)
+        _addresses = form_utils.get_multi_values_from_textarea(form=form,
+                                                               input_name='mailForwardingAddresses',
+                                                               to_lowercase=True,
+                                                               is_email=True)
         if 'savecopy' in form:
             _addresses.append(mail)
 

3

Re: User email forwarding ends up in internal server error

Dear ZhangHuangbin,

thanks for coming up with this patch. I went to /opt/www/iRedAdmin-Pro-LDAP-4.3 saved your code as irapl43.patch and applied it with ...

# patch --dry-run -p1 < irapl43.patch  
patching file libs/ldaplib/user.py
Hunk #1 succeeded at 2032 (offset -1 lines).

After service iredadmin restart istill get an internal server error.

[Wed Apr 01 hh:mm:ss.273643 2020] [wsgi:error] [pid 1517] [remote x.x.x.x:51062] Traceback (most recent call last):
[Wed Apr 01 hh:mm:ss.273681 2020] [wsgi:error] [pid 1517] [remote x.x.x.x:51062]   File "/usr/lib/python2.7/dist-packages/web/application.py", line 239, in process
[Wed Apr 01 hh:mm:ss.273697 2020] [wsgi:error] [pid 1517] [remote x.x.x.x:51062]     return self.handle()
[Wed Apr 01 hh:mm:ss.273712 2020] [wsgi:error] [pid 1517] [remote x.x.x.x:51062]   File "/usr/lib/python2.7/dist-packages/web/application.py", line 230, in handle
[Wed Apr 01 hh:mm:ss.273727 2020] [wsgi:error] [pid 1517] [remote x.x.x.x:51062]     return self._delegate(fn, self.fvars, args)
[Wed Apr 01 hh:mm:ss.273741 2020] [wsgi:error] [pid 1517] [remote x.x.x.x:51062]   File "/usr/lib/python2.7/dist-packages/web/application.py", line 462, in _delegate
[Wed Apr 01 hh:mm:ss.273756 2020] [wsgi:error] [pid 1517] [remote x.x.x.x:51062]     return handle_class(cls)
[Wed Apr 01 hh:mm:ss.273770 2020] [wsgi:error] [pid 1517] [remote x.x.x.x:51062]   File "/usr/lib/python2.7/dist-packages/web/application.py", line 438, in handle_class
[Wed Apr 01 hh:mm:ss.273785 2020] [wsgi:error] [pid 1517] [remote x.x.x.x:51062]     return tocall(*args)
[Wed Apr 01 hh:mm:ss.273799 2020] [wsgi:error] [pid 1517] [remote x.x.x.x:51062]   File "/opt/www/iredadmin/controllers/decorators.py", line 125, in decorated
[Wed Apr 01 hh:mm:ss.273814 2020] [wsgi:error] [pid 1517] [remote x.x.x.x:51062]     return f(*args, **kw)
[Wed Apr 01 hh:mm:ss.273828 2020] [wsgi:error] [pid 1517] [remote x.x.x.x:51062]   File "/opt/www/iredadmin/controllers/decorators.py", line 104, in proxyfunc
[Wed Apr 01 hh:mm:ss.273843 2020] [wsgi:error] [pid 1517] [remote x.x.x.x:51062]     return func(*args, **kw)
[Wed Apr 01 hh:mm:ss.273857 2020] [wsgi:error] [pid 1517] [remote x.x.x.x:51062]   File "/opt/www/iredadmin/controllers/ldap/user.py", line 719, in POST
[Wed Apr 01 hh:mm:ss.273872 2020] [wsgi:error] [pid 1517] [remote x.x.x.x:51062]     conn=None)
[Wed Apr 01 hh:mm:ss.273886 2020] [wsgi:error] [pid 1517] [remote x.x.x.x:51062]   File "/opt/www/iredadmin/controllers/decorators.py", line 104, in proxyfunc
[Wed Apr 01 hh:mm:ss.273912 2020] [wsgi:error] [pid 1517] [remote x.x.x.x:51062]     return func(*args, **kw)
[Wed Apr 01 hh:mm:ss.273928 2020] [wsgi:error] [pid 1517] [remote x.x.x.x:51062]   File "/opt/www/iredadmin/libs/ldaplib/user.py", line 2035, in update_preferences
[Wed Apr 01 hh:mm:ss.273942 2020] [wsgi:error] [pid 1517] [remote x.x.x.x:51062]     _addresses = form_utils.get_multi_values_from_textarea(form=form,
[Wed Apr 01 hh:mm:ss.273957 2020] [wsgi:error] [pid 1517] [remote x.x.x.x:51062] AttributeError: 'module' object has no attribute 'get_multi_values_from_textare'
[Wed Apr 01 hh:mm:ss.273979 2020] [wsgi:error] [pid 1517] [remote x.x.x.x:51062] 

Didi i do something wrong?

4

Re: User email forwarding ends up in internal server error

aha, you're running Apache as web server, please restart Apache service instead.

- If you're running Apache, iRedAdmin(-Pro) is running by Apache uwsgi module. So you need to restart apache service to load modified iRedAdmin(-Pro) files.
- If Nginx, iRedAdmin(-Pro) is running as a standalone service, and all http requests will be proxied by Nginx to iRedAdmin(-Pro) daemon service. In this case, restarting "iredadmin" service to load modified iRedAdmin files.

5

Re: User email forwarding ends up in internal server error

It works fine now, thanks - again!