1

Topic: Adding users to domain

==== REQUIRED BASIC INFO OF YOUR IREDMAIL SERVER ====
iRedMail    1.1
iRedAdmin-Pro    4.2 (MySQL)
Dployed with downloadable installed
Ubuntu 18.04 LTS
MySQL version with MariaDB installed
Web Server: NGINX
IredAdmin Pro

When trying to add a new user to a domain , get the message

You can NOT create more users under domain contoso.org. No free domain quota left.

Even when under domain advanced I leave max number of users to 0 or make it 5.

----

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

2

Re: Adding users to domain

I fixed this - needed to extend the domain storage quota.  For some reason the new user was defaulting to using all the remaining quota and then consequently failing.  this doesnt make sense.

3

Re: Adding users to domain

This happens when:

- you have a per-domain mailbox quota, but
- you do NOT set a default mailbox quota for new user (in domain profile page)

In this case iRedAdmin-Pro has to allocate all quota to this newly created user.

4 (edited by temabu 2020-03-25 03:14:01)

Re: Adding users to domain

So I updated to 4.2 again and tried to access users in one of the domains which gives the error.  Same error.  The error entry in syslog is this:

The last error line relates to this line:
File "/opt/www/iRedAdmin-Pro-SQL-4.2/libs/ireddate.py", line 198, in utc_to_timezone
#012    return ft.strftime(format)
#012ValueError: year=1000 is before 1900; the datetime strftime() methods require year >= 1900



Mar 24 18:57:38 ms iredadmin: Traceback (most recent call last):
#012  File "/usr/lib/python2.7/dist-packages/web/application.py", line 257, in process
#012    return self.handle()
#012  File "/usr/lib/python2.7/dist-packages/web/application.py", line 248, in handle
#012    return self._delegate(fn, self.fvars, args)
#012  File "/usr/lib/python2.7/dist-packages/web/application.py", line 488, in _delegate
#012    return handle_class(cls)
#012  File "/usr/lib/python2.7/dist-packages/web/application.py", line 466, in handle_class
#012    return tocall(*args)
#012  File "/opt/www/iRedAdmin-Pro-SQL-4.2/libs/sqllib/decorators.py", line 33, in proxyfunc
#012    return func(*args, **kw)
#012  File "/opt/www/iRedAdmin-Pro-SQL-4.2/controllers/sql/user.py", line 144, in GET
#012    msg=form.get('msg', None))
#012  File "/opt/www/iRedAdmin-Pro-SQL-4.2/libs/iredbase.py", line 191, in render_template
#012    return jinja_env.get_template(template_name).render(context)
#012  File "/usr/lib/python2.7/dist-packages/jinja2/environment.py", line 1008, in render
#012    return self.environment.handle_exception(exc_info, True)
#012  File "/usr/lib/python2.7/dist-packages/jinja2/environment.py", line 780, in handle_exception
#012    reraise(exc_type, exc_value, tb)
#012  File "/opt/www/iRedAdmin-Pro-SQL-4.2/libs/../templates/default/sql/user/list.html", line 23, in top-level template code
#012    {% from "macros/msg_handlers.html" import user_msg_handler with context %}
#012  File "/opt/www/iRedAdmin-Pro-SQL-4.2/libs/../templates/default/layout.html", line 201, in top-level template code
#012    {% block main %}{% endblock %}
#012  File "/opt/www/iRedAdmin-Pro-SQL-4.2/libs/../templates/default/sql/user/list.html", line 157, in block "main"
#012    <i class="fa fa-cog fa-lg fr-space" title="{{ _('Edit account profile') }}{% if r.passwordlastchange %} ({{ _('Password last change:') }} {{ r.passwordlastchange | utc_to_timezone(timezone=session.get('timezone')) }}){% endif %}"></i>
#012  File "/opt/www/iRedAdmin-Pro-SQL-4.2/libs/ireddate.py", line 198, in utc_to_timezone
#012    return ft.strftime(format)
#012ValueError: year=1000 is before 1900; the datetime strftime() methods require year >= 1900
Mar 24 18:57:38 ms iredadmin:
Mar 24 18:57:38 ms iredadmin: [82.129.66.113] GET /iredadmin/users/bario.com 500 211 "https://ms.bario.com/iredadmin/profile/ … /bario.com"

5

Re: Adding users to domain

Does this error mean something on my end needs changing or is this a bug or something in the later versions?

Certainly with version 3 I dont get this error.  But at least I can demonstrate that from 4.1.2 onwards I do.

Thanks

temabu wrote:

So I updated to 4.2 again and tried to access users in one of the domains which gives the error.  Same error.  The error entry in syslog is this:

The last error line relates to this line:
File "/opt/www/iRedAdmin-Pro-SQL-4.2/libs/ireddate.py", line 198, in utc_to_timezone
#012    return ft.strftime(format)
#012ValueError: year=1000 is before 1900; the datetime strftime() methods require year >= 1900



Mar 24 18:57:38 ms iredadmin: Traceback (most recent call last):
#012  File "/usr/lib/python2.7/dist-packages/web/application.py", line 257, in process
#012    return self.handle()
#012  File "/usr/lib/python2.7/dist-packages/web/application.py", line 248, in handle
#012    return self._delegate(fn, self.fvars, args)
#012  File "/usr/lib/python2.7/dist-packages/web/application.py", line 488, in _delegate
#012    return handle_class(cls)
#012  File "/usr/lib/python2.7/dist-packages/web/application.py", line 466, in handle_class
#012    return tocall(*args)
#012  File "/opt/www/iRedAdmin-Pro-SQL-4.2/libs/sqllib/decorators.py", line 33, in proxyfunc
#012    return func(*args, **kw)
#012  File "/opt/www/iRedAdmin-Pro-SQL-4.2/controllers/sql/user.py", line 144, in GET
#012    msg=form.get('msg', None))
#012  File "/opt/www/iRedAdmin-Pro-SQL-4.2/libs/iredbase.py", line 191, in render_template
#012    return jinja_env.get_template(template_name).render(context)
#012  File "/usr/lib/python2.7/dist-packages/jinja2/environment.py", line 1008, in render
#012    return self.environment.handle_exception(exc_info, True)
#012  File "/usr/lib/python2.7/dist-packages/jinja2/environment.py", line 780, in handle_exception
#012    reraise(exc_type, exc_value, tb)
#012  File "/opt/www/iRedAdmin-Pro-SQL-4.2/libs/../templates/default/sql/user/list.html", line 23, in top-level template code
#012    {% from "macros/msg_handlers.html" import user_msg_handler with context %}
#012  File "/opt/www/iRedAdmin-Pro-SQL-4.2/libs/../templates/default/layout.html", line 201, in top-level template code
#012    {% block main %}{% endblock %}
#012  File "/opt/www/iRedAdmin-Pro-SQL-4.2/libs/../templates/default/sql/user/list.html", line 157, in block "main"
#012    <i class="fa fa-cog fa-lg fr-space" title="{{ _('Edit account profile') }}{% if r.passwordlastchange %} ({{ _('Password last change:') }} {{ r.passwordlastchange | utc_to_timezone(timezone=session.get('timezone')) }}){% endif %}"></i>
#012  File "/opt/www/iRedAdmin-Pro-SQL-4.2/libs/ireddate.py", line 198, in utc_to_timezone
#012    return ft.strftime(format)
#012ValueError: year=1000 is before 1900; the datetime strftime() methods require year >= 1900
Mar 24 18:57:38 ms iredadmin:
Mar 24 18:57:38 ms iredadmin: [82.129.66.113] GET /iredadmin/users/bario.com 500 211 "https://ms.bario.com/iredadmin/profile/ … /bario.com"

6

Re: Adding users to domain

temabu wrote:

#012ValueError: year=1000 is before 1900; the datetime strftime() methods require year >= 1900

Which iRedAdmin-Pro web page did you access to trigger this error?
Seems there's a date with year 1000, and Python requires it to be no earlier than 1900.

7

Re: Adding users to domain

So I have been running 3.0 - been busy so havnt had time to look into this problem.  However, I am running 3.0 and most functions are all working.  BUT - I had the internal server error today immediately after logging into the 3.0 dashboard, so I logged on and reinstalled 3.0 - dashboard came back and all is well.  I recorded 2 videos, with only the time taken to upgrade from 3.0 to 4.1.2 between them.  I can send them and they show the problem.  The "internal server" error happens when accessing the USERS page of a domain with version 4.1.2 onwards (I only have 4.1.2 and 4.2).  It can happen with 1 or 70 users, but oddly, it sometimes works with 3 users...Any ideas?  PM me and I can send the small screen captures.

8

Re: Adding users to domain

When uploading video files - the message disappears and vanishes?

9

Re: Adding users to domain

temabu wrote:

#012    <i class="fa fa-cog fa-lg fr-space" title="{{ _('Edit account profile') }}{% if r.passwordlastchange %} ({{ _('Password last change:') }} {{ r.passwordlastchange | utc_to_timezone(timezone=session.get('timezone')) }}){% endif %}"></i>

In SQL table "vmail.mailbox", column "passwordlastchange", you have a record which has value with year "1000", but it should be at least "1970". Please double check.

10

Re: Adding users to domain

Well, since your data default for datetime is 1000-01-01 00:00:00 and this is what caused the error.....If no-one had ever changed their password this is what it was - but why your latest version caused a problem only you will know I guess.

`passwordlastchange` datetime NOT NULL DEFAULT '1000-01-01 00:00:00',

However, I exported and verified some accounts indeed had the default, so I modified the data in vmail database, mailbox table:

update mailbox set passwordlastchange = '1971-01-01 00:00:00' where passwordlastchange = '1000-01                            -01 00:00:00';

This changed some of the accounts.

Then reinstalled 4.2 and all seems fine now...
But now of course I need to upgrade to 4.3...





ZhangHuangbin wrote:
temabu wrote:

#012    <i class="fa fa-cog fa-lg fr-space" title="{{ _('Edit account profile') }}{% if r.passwordlastchange %} ({{ _('Password last change:') }} {{ r.passwordlastchange | utc_to_timezone(timezone=session.get('timezone')) }}){% endif %}"></i>

In SQL table "vmail.mailbox", column "passwordlastchange", you have a record which has value with year "1000", but it should be at least "1970". Please double check.

11

Re: Adding users to domain

temabu wrote:

Well, since your data default for datetime is 1000-01-01 00:00:00 and this is what caused the error.....If no-one had ever changed their password this is what it was - but why your latest version caused a problem only you will know I guess.

Old MySQL allows using '1000' as year, and we didn't realize this issue. In later MySQL release, the earliest year can be earlier than 1970, and we mentioned this fix in upgrade tutorial for iRedMail-0.9.6:
https://docs.iredmail.org/upgrade.iredm … l-database

Please apply this fix.