1 (edited by lamagra 2018-04-10 21:00:09)

Topic: Problem with edit user profile or add new user

==== Required information ====
- iRedMail version (check /etc/iredmail-release): 0.9.8
- Linux/BSD distribution name and version: Debian 9.4
- Store mail accounts in which backend (LDAP/MySQL/PGSQL): MySQL
- Web server (Apache or Nginx): Nginx
- Manage mail accounts with iRedAdmin-Pro? Yes 2.9.0
- [IMPORTANT] Related original log or error message is required if you're experiencing an issue.
====
After upgrade i can't edit user profile and got errors when adding new users.

I found errors in iredadmin.log:

xxx.yyy.pl [pid: 22723|app: 0|req: 7/8] 89.25.230.131 () {56 vars in 1346 bytes} [Tue Apr 10 07:44:37 2018] GET /iredadmin/profile/user/general/xxx@yyyy.pl => generated 21 bytes in 26 msecs (HTTP/1.1 500) 2 headers in 165 bytes (2 switches on core 0)
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/web/application.py", line 239, in process
    return self.handle()
  File "/usr/lib/python2.7/dist-packages/web/application.py", line 230, in handle
    return self._delegate(fn, self.fvars, args)
  File "/usr/lib/python2.7/dist-packages/web/application.py", line 462, in _delegate
    return handle_class(cls)
  File "/usr/lib/python2.7/dist-packages/web/application.py", line 438, in handle_class
    return tocall(*args)
  File "/usr/share/apache2/iRedAdmin-Pro-SQL-2.9.0/controllers/sql/user.py", line 322, in GET
    _qr = mlmmj.get_subscribed_lists(mail=mail, query_all_lists=False)
  File "/usr/share/apache2/iRedAdmin-Pro-SQL-2.9.0/libs/mlmmj/__init__.py", line 328, in get_subscribed_lists
    qr = r.json()
  File "/usr/lib/python2.7/dist-packages/requests/models.py", line 850, in json
    return complexjson.loads(self.text, **kwargs)
  File "/usr/lib/python2.7/json/__init__.py", line 339, in loads
    return _default_decoder.decode(s)
  File "/usr/lib/python2.7/json/decoder.py", line 364, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/lib/python2.7/json/decoder.py", line 382, in raw_decode
    raise ValueError("No JSON object could be decoded")
ValueError: No JSON object could be decoded

After all i got "internal server error" in iredadmin panel. If i refresh site few times error will dissapear and site will load normaly.


If i make # in this line -->   "/usr/share/apache2/iRedAdmin-Pro-SQL-2.9.0/controllers/sql/user.py", line 322" and restart uwsgi then i can edit user profile without any problem.

----

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

2 (edited by it-egt 2018-04-10 19:49:28)

Re: Problem with edit user profile or add new user

HI I have the same issue.
My installation is new-clean on Centos7


==== Required information ====
- iRedMail version (check /etc/iredmail-release): 0.9.8
- Linux/BSD distribution name and version: Centos 7
- Store mail accounts in which backend (LDAP/MySQL/PGSQL): MySQL
- Web server (Apache or Nginx): Nginx
- Manage mail accounts with iRedAdmin-Pro? Yes 2.9.0
- [IMPORTANT] Related original log or error message is required if you're experiencing an issue.
====

log error

Apr 10 12:42:30 mail uwsgi: Traceback (most recent call last):
Apr 10 12:42:30 mail uwsgi: File "/usr/lib/python2.7/site-packages/web/application.py", line 239, in process
Apr 10 12:42:30 mail uwsgi: return self.handle()
Apr 10 12:42:30 mail uwsgi: File "/usr/lib/python2.7/site-packages/web/application.py", line 230, in handle
Apr 10 12:42:30 mail uwsgi: return self._delegate(fn, self.fvars, args)
Apr 10 12:42:30 mail uwsgi: File "/usr/lib/python2.7/site-packages/web/application.py", line 420, in _delegate
Apr 10 12:42:30 mail uwsgi: return handle_class(cls)
Apr 10 12:42:30 mail uwsgi: File "/usr/lib/python2.7/site-packages/web/application.py", line 396, in handle_class
Apr 10 12:42:30 mail uwsgi: return tocall(*args)
Apr 10 12:42:30 mail uwsgi: File "/var/www/iRedAdmin-Pro-SQL-2.9.0/controllers/sql/user.py", line 322, in GET
Apr 10 12:42:30 mail uwsgi: _qr = mlmmj.get_subscribed_lists(mail=mail, query_all_lists=False)
Apr 10 12:42:30 mail uwsgi: File "/var/www/iRedAdmin-Pro-SQL-2.9.0/libs/mlmmj/__init__.py", line 327, in get_subscribed_lists
Apr 10 12:42:30 mail uwsgi: r = requests.get(url, params=params, headers=api_headers, verify=_verify_ssl)
Apr 10 12:42:30 mail uwsgi: File "/usr/lib/python2.7/site-packages/requests/api.py", line 68, in get
Apr 10 12:42:30 mail uwsgi: return request('get', url, **kwargs)
Apr 10 12:42:30 mail uwsgi: File "/usr/lib/python2.7/site-packages/requests/api.py", line 50, in request
Apr 10 12:42:30 mail uwsgi: response = session.request(method=method, url=url, **kwargs)
Apr 10 12:42:30 mail uwsgi: File "/usr/lib/python2.7/site-packages/requests/sessions.py", line 464, in request
Apr 10 12:42:30 mail uwsgi: resp = self.send(prep, **send_kwargs)
Apr 10 12:42:30 mail uwsgi: File "/usr/lib/python2.7/site-packages/requests/sessions.py", line 576, in send
Apr 10 12:42:30 mail uwsgi: r = adapter.send(request, **kwargs)
Apr 10 12:42:30 mail uwsgi: File "/usr/lib/python2.7/site-packages/requests/adapters.py", line 415, in send
Apr 10 12:42:30 mail uwsgi: raise ConnectionError(err, request=request)
Apr 10 12:42:30 mail uwsgi: ConnectionError: ('Connection aborted.', error(111, 'Connection refused'))
Apr 10 12:42:30 mail uwsgi: hostname [pid: 852|app: 0|req: 77/88] 10.101.7.9 () {56 vars in 1197 bytes} [Tue Apr 10 12:42:30 2018] GET /iredadmin/profile/user/general/user.name@domain.com => generated 21 bytes in 36 msecs (HTTP/1.1 500) 2 headers in 165 bytes (2 switches on core 0)

3

Re: Problem with edit user profile or add new user

Is service mlmmjadmin running?

4

Re: Problem with edit user profile or add new user

ZhangHuangbin wrote:

Is service mlmmjadmin running?

Yes it's running.

mlmmj    16632  0.0  0.1 114400 19968 ?        Ss   kwi10   0:01 /usr/bin/uwsgi --ini /opt/mlmmjadmin/rc_scripts/uwsgi/debian.ini --pidfile /var/run/mlmmjadmin/mlmmjadmin.pid
mlmmj    16633  0.0  0.1 114400 12528 ?        S    kwi10   0:00 /usr/bin/uwsgi --ini /opt/mlmmjadmin/rc_scripts/uwsgi/debian.ini --pidfile /var/run/mlmmjadmin/mlmmjadmin.pid
mlmmj    16634  0.0  0.1 114400 12460 ?        S    kwi10   0:00 /usr/bin/uwsgi --ini /opt/mlmmjadmin/rc_scripts/uwsgi/debian.ini --pidfile /var/run/mlmmjadmin/mlmmjadmin.pid
mlmmj    16635  0.0  0.1 114400 12528 ?        S    kwi10   0:00 /usr/bin/uwsgi --ini /opt/mlmmjadmin/rc_scripts/uwsgi/debian.ini --pidfile /var/run/mlmmjadmin/mlmmjadmin.pid
mlmmj    16636  0.0  0.1 114400 12460 ?        S    kwi10   0:00 /usr/bin/uwsgi --ini /opt/mlmmjadmin/rc_scripts/uwsgi/debian.ini --pidfile /var/run/mlmmjadmin/mlmmjadmin.pid
mlmmj    16637  0.0  0.1 114400 12528 ?        S    kwi10   0:00 /usr/bin/uwsgi --ini /opt/mlmmjadmin/rc_scripts/uwsgi/debian.ini --pidfile /var/run/mlmmjadmin/mlmmjadmin.pid

5

Re: Problem with edit user profile or add new user

also when i'm trying to add new mailing list with command line tool i'v got this same error:

Baldur:/opt/mlmmjadmin/tools# python maillist_admin.py create list222@domain.com only_subscriber_can_post=yes disable_archive=no
Traceback (most recent call last):
  File "maillist_admin.py", line 135, in <module>
    _json = r.json()
  File "/usr/lib/python2.7/dist-packages/requests/models.py", line 850, in json
    return complexjson.loads(self.text, **kwargs)
  File "/usr/lib/python2.7/dist-packages/simplejson/__init__.py", line 516, in loads
    return _default_decoder.decode(s)
  File "/usr/lib/python2.7/dist-packages/simplejson/decoder.py", line 374, in decode
    obj, end = self.raw_decode(s)
  File "/usr/lib/python2.7/dist-packages/simplejson/decoder.py", line 404, in raw_decode
    return self.scan_once(s, idx=_w(s, idx).end())
simplejson.scanner.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

6

Re: Problem with edit user profile or add new user

Please try this:

*) Stop mlmmjadmin service first
*) Start it manually:

service mlmmjadmin stop
cd /opt/mlmmjadmin/
python mlmmjadmin.py

Now run the maillist_admin.py script again (in another terminal or ssh session), does mlmmjadmin print any error message on console?

7

Re: Problem with edit user profile or add new user

ZhangHuangbin wrote:

Please try this:

*) Stop mlmmjadmin service first
*) Start it manually:

service mlmmjadmin stop
cd /opt/mlmmjadmin/
python mlmmjadmin.py

Now run the maillist_admin.py script again (in another terminal or ssh session), does mlmmjadmin print any error message on console?

After manual start maillist works without errors:

Baldur:/opt/mlmmjadmin/tools# python maillist_admin.py create list444@domain.com only_subscriber_can_post=yes disable_archive=no
Created.

Baldur:/opt/mlmmjadmin# python mlmmjadmin.py
http://127.0.0.1:7790/
127.0.0.1:33410 - - [12/Apr/2018 09:34:04] "HTTP/1.1 POST /api/list444@domain.com" - 200 OK

8

Re: Problem with edit user profile or add new user

Do you have correct API auth token in both /opt/mlmmjadmin/settings.py and iRedAdmin-Pro config file?

9 (edited by lamagra 2018-04-13 15:32:58)

Re: Problem with edit user profile or add new user

ZhangHuangbin wrote:

Do you have correct API auth token in both /opt/mlmmjadmin/settings.py and iRedAdmin-Pro config file?

Looks good for me.

Baldur:~# cat /opt/mlmmjadmin/settings.py |grep api_auth
api_auth_tokens = ['98cc3f88bbb0bf604b41f834fa971722']

Baldur:~# cat /usr/share/apache2/iredadmin/settings.py |grep api_auth
mlmmjadmin_api_auth_token = '98cc3f88bbb0bf604b41f834fa971722'

10

Re: Problem with edit user profile or add new user

Looks good to me. Is it working well after restarted both mlmmjadmin and uwsgi services?

11

Re: Problem with edit user profile or add new user

ZhangHuangbin wrote:

Looks good to me. Is it working well after restarted both mlmmjadmin and uwsgi services?

Unfortunately not.
Now mlmmjadmin is running on screen and everything is working. If I run mlmmjadmin as service the problem is coming back.

12

Re: Problem with edit user profile or add new user

Is it possible to give me direct ssh access for debugging? Running on screen is not acceptable at all.

13

Re: Problem with edit user profile or add new user

Issue solved.

Please run commands below to fix incorrect file owner/group and permission:

chown mlmmj:mlmmj /opt/mlmmjadmin/settings.py
chmod 0400 /opt/mlmmjadmin/settings.py

14

Re: Problem with edit user profile or add new user

Hello,

I have the same issue; more or less.

root@email:~# chown mlmmj:mlmmj /opt/mlmmjadmin/settings.py
root@email:~# chmod 0400 /opt/mlmmjadmin/settings.py
root@email:~# cat /opt/mlmmjadmin/settings.py |grep api_auth
api_auth_tokens = [f71def3c10ad195f769bcec99df66c42]
root@email:~# cat /opt/www/iredadmin/settings.py | grep api_auth
mlmmjadmin_api_auth_token = 'f71def3c10ad195f769bcec99df66c42'

root@email:~# service mlmmjadmin stop
root@email:~# cd /opt/mlmmjadmin/
root@email:/opt/mlmmjadmin# python mlmmjadmin.py
Traceback (most recent call last):
  File "mlmmjadmin.py", line 16, in <module>
    import settings
  File "/opt/mlmmjadmin-1.0/settings.py", line 47, in <module>
    api_auth_tokens = [f71def3c10ad195f769bcec99df66c42]
NameError: name 'f71def3c10ad195f769bcec99df66c42' is not defined


What am I missing?

15

Re: Problem with edit user profile or add new user

jwegge wrote:

Hello,

I have the same issue; more or less.

root@email:~# chown mlmmj:mlmmj /opt/mlmmjadmin/settings.py
root@email:~# chmod 0400 /opt/mlmmjadmin/settings.py
root@email:~# cat /opt/mlmmjadmin/settings.py |grep api_auth
api_auth_tokens = [f71def3c10ad195f769bcec99df66c42]
root@email:~# cat /opt/www/iredadmin/settings.py | grep api_auth
mlmmjadmin_api_auth_token = 'f71def3c10ad195f769bcec99df66c42'

root@email:~# service mlmmjadmin stop
root@email:~# cd /opt/mlmmjadmin/
root@email:/opt/mlmmjadmin# python mlmmjadmin.py
Traceback (most recent call last):
  File "mlmmjadmin.py", line 16, in <module>
    import settings
  File "/opt/mlmmjadmin-1.0/settings.py", line 47, in <module>
    api_auth_tokens = [f71def3c10ad195f769bcec99df66c42]
NameError: name 'f71def3c10ad195f769bcec99df66c42' is not defined


What am I missing?

Maybe missing '' -->  api_auth_tokens = ['f71def3c10ad195f769bcec99df66c42']

16

Re: Problem with edit user profile or add new user

lamagra wrote:

Maybe missing '' -->  api_auth_tokens = ['f71def3c10ad195f769bcec99df66c42']

Yes indeed! Thanks a million!