1

Topic: Internal Server Error http 500 after upgrade of ireadmin 0.2.2 -> 0.3

==== Required information ====
- iRedMail version: 0.8.5
- Store mail accounts in which backend (LDAP/MySQL/PGSQL): mysql
- Linux/BSD distribution name and version: CentOS release 6.5 (Final)
- Related log if you're reporting an issue: /var/log/httpd/ssl_error_log
====
Hello,
I've followed instruction http://www.iredmail.org/wiki/index.php? … ce.Edition
But after an upgrade I get an error HTTP 500 only in iredadmin:
Here's output from /var/log/httpd/ssl_error_log
[Wed Jan 15 23:23:42 2014] [error] [client 10.10.30.154] mod_wsgi (pid=1537): Target WSGI script '/var/www/iredadmin/iredadmin.py' cannot be loaded as Python module.
[Wed Jan 15 23:23:42 2014] [error] [client 10.10.30.154] mod_wsgi (pid=1537): Exception occurred processing WSGI script '/var/www/iredadmin/iredadmin.py'.
[Wed Jan 15 23:23:42 2014] [error] [client 10.10.30.154] Traceback (most recent call last):
[Wed Jan 15 23:23:42 2014] [error] [client 10.10.30.154]   File "/var/www/iredadmin/iredadmin.py", line 9, in <module>
[Wed Jan 15 23:23:42 2014] [error] [client 10.10.30.154]     from libs import iredbase
[Wed Jan 15 23:23:42 2014] [error] [client 10.10.30.154]   File "/var/www/iredadmin/libs/iredbase.py", line 18, in <module>
[Wed Jan 15 23:23:42 2014] [error] [client 10.10.30.154]     import iredutils
[Wed Jan 15 23:23:42 2014] [error] [client 10.10.30.154]   File "/var/www/iredadmin/libs/iredutils.py", line 254, in <module>
[Wed Jan 15 23:23:42 2014] [error] [client 10.10.30.154]     min_passwd_length=settings.min_passwd_length,
[Wed Jan 15 23:23:42 2014] [error] [client 10.10.30.154] AttributeError: 'module' object has no attribute 'min_passwd_length'

2

Re: Internal Server Error http 500 after upgrade of ireadmin 0.2.2 -> 0.3

*) Which version of iRedAdmin open source edition are you running?
*) Do you have config file /var/www/iredadmin/settings.py?

3

Re: Internal Server Error http 500 after upgrade of ireadmin 0.2.2 -> 0.3

ZhangHuangbin wrote:

*) Which version of iRedAdmin open source edition are you running?

I was running 0.2.2 try to upgrade to 0.3

*) Do you have config file /var/www/iredadmin/settings.py?

Yes, It was converted  from settings.ini after invoking

bash tools/convert_ini_to_py.sh settings.ini

4

Re: Internal Server Error http 500 after upgrade of ireadmin 0.2.2 -> 0.3

Does your "settings.py" have variable "min_passwd_length"? For example:

min_passwd_length = 8

if not, please add below lines in settings.py:

# Min/Max admin password length.
#   - min_passwd_length: 0 means unlimited, but at least 1 character
#                        is required.
#   - max_passwd_length: 0 means unlimited.
# User password length is controlled in domain profile.
min_passwd_length = 8
max_passwd_length = 0

5 (edited by misieq 2014-01-16 20:42:44)

Re: Internal Server Error http 500 after upgrade of ireadmin 0.2.2 -> 0.3

Yes,
I have it set,
Previously it was 0 for both parameters, now I've modified min_pass_lenght to 8 but it still didn't help.
It seems like it's ignored in config file.

#grep -n passwd_length settings.py
30:#   - min_passwd_length: 0 means unlimited, but at least 1 character
32:#   - max_passwd_length: 0 means unlimited.
34:min_passwd_length = 8
35:max_passwd_length = 0

ssl_error_log_output:

[Thu Jan 16 13:26:50 2014] [error] [client 10.10.30.154] mod_wsgi (pid=29117): Target WSGI script '/var/www/iredadmin/iredadmin.py' cannot be loaded as Python module.
[Thu Jan 16 13:26:50 2014] [error] [client 10.10.30.154] mod_wsgi (pid=29117): Exception occurred processing WSGI script '/var/www/iredadmin/iredadmin.py'.
[Thu Jan 16 13:26:50 2014] [error] [client 10.10.30.154] Traceback (most recent call last):
[Thu Jan 16 13:26:50 2014] [error] [client 10.10.30.154]   File "/var/www/iredadmin/iredadmin.py", line 9, in <module>
[Thu Jan 16 13:26:50 2014] [error] [client 10.10.30.154]     from libs import iredbase
[Thu Jan 16 13:26:50 2014] [error] [client 10.10.30.154]   File "/var/www/iredadmin/libs/iredbase.py", line 18, in <module>
[Thu Jan 16 13:26:50 2014] [error] [client 10.10.30.154]     import iredutils
[Thu Jan 16 13:26:50 2014] [error] [client 10.10.30.154]   File "/var/www/iredadmin/libs/iredutils.py", line 254, in <module>
[Thu Jan 16 13:26:50 2014] [error] [client 10.10.30.154]     min_passwd_length=settings.min_passwd_length,
[Thu Jan 16 13:26:50 2014] [error] [client 10.10.30.154] AttributeError: 'module' object has no attribute 'min_passwd_length'
q^C

6

Re: Internal Server Error http 500 after upgrade of ireadmin 0.2.2 -> 0.3

What's the file owner and permission of file /var/www/iredadmin/settings.py? Please show us output of below command:

# ls -l /var/www/iredadmin/settings.py

it must be owned by user 'iredadmin', group 'iredadmin', file permission 0400.

7

Re: Internal Server Error http 500 after upgrade of ireadmin 0.2.2 -> 0.3

ZhangHuangbin wrote:

What's the file owner and permission of file /var/www/iredadmin/settings.py? Please show us output of below command:

# ls -l /var/www/iredadmin/settings.py

it must be owned by user 'iredadmin', group 'iredadmin', file permission 0400.

I have the settings you posted:

-r-------- 1 iredadmin iredadmin 3919 01-16 13:26 /var/www/iredadmin/settings.py

8

Re: Internal Server Error http 500 after upgrade of ireadmin 0.2.2 -> 0.3

Could you please try below steps:

1) Open file /var/www/iredadmin/settings.py, found below line:

import settings

2) Add one line after above one, then save change and close file.

import settings
print settings.__file__                 # <- Add this line

3) Restart Apache service, then try to access iRedAdmin with web browser again.

It will print one line in Apache log file, this line contains file location of your settings.py file. Please paste this log line here to help troubleshoot.

9 (edited by misieq 2014-01-18 20:56:03)

Re: Internal Server Error http 500 after upgrade of ireadmin 0.2.2 -> 0.3

I do not have such line in this file.
Here's my settings.py:

############################################################
# DO NOT TOUCH BELOW LINE.
#
from libs.default_settings import *

############################################################
# General settings.
#
# Site webmaster's mail address.
webmaster = "zhb@iredmail.org"

# Default language.
default_language = "en_US"

# Database backend: mysql.
backend = 'mysql'

# Base directory used to store all mail data.
# iRedMail uses '/var/vmail/vmail1' as default storage directory.
# Tip: You can set a per-domain storage directory in domain profile page.
storage_base_directory = "/var/vmail/vmail1"

# Default mta transport.
# iRedMail uses 'dovecot' as defualt transport.
# Tip: You can set a per-domain or per-user transport in domain or user
#      profile page.
default_mta_transport = "dovecot"

# Min/Max admin password length.
#   - min_passwd_length: 0 means unlimited, but at least 1 character
#                        is required.
#   - max_passwd_length: 0 means unlimited.
# User password length is controlled in domain profile.
min_passwd_length = 8
max_passwd_length = 0

#####################################################################
# Database used to store iRedAdmin data. e.g. sessions, log.
#
iredadmin_db_host = "127.0.0.1"
iredadmin_db_port = 3306
iredadmin_db_name = "iredadmin"
iredadmin_db_user = "iredadmin"
iredadmin_db_password = "XXXXX"

############################################
# Database used to store mail accounts.
#
vmail_db_host = "127.0.0.1"
vmail_db_port = 3306
vmail_db_name = "vmail"
vmail_db_user = "vmailadmin"
vmail_db_password = "XXXXX"

#################################################################
# Settings used for Policyd (1.8.x) integration. Provides global
# white-/blacklist, sender/recipient throttling, etc.
#
# Enable policyd integration: True, False.
policyd_enabled = True

# SQL Database used to store policyd data, eg. whitelist, blacklist.
# You can find related information in policyd config files:
#   - On RHEL/CentOS:   /etc/policyd.conf
#   - On Debian/Ubuntu: /etc/postfix-policyd.conf
#   - On FreeBSD:       /usr/local/etc/policyd.conf
# Related parameters:
#   host    -> MYSQLHOST
#   port    -> 3306 (Default)
#   db      -> MYSQLDBASE
#   user    -> MYSQLUSER
#   passwd  -> MYSQLPASS
policyd_db_host = "127.0.0.1"
policyd_db_port = 3306
policyd_db_name = "policyd"
policyd_db_user = "policyd"
policyd_db_password = "XXXXXX"

##############################################################################
# Settings used for Amavisd-new integration. Provides spam/virus quaranting,
# releasing, etc.
#
# Log basic info of in/out emails into SQL (@storage_sql_dsn): True, False.
# It's @storage_sql_dsn setting in amavisd. You can find this setting
# in amavisd-new config files:
#   - On RHEL/CentOS:   /etc/amavisd.conf or /etc/amavisd/amavisd.conf
#   - On Debian/Ubuntu: /etc/amavis/conf.d/50-user.conf
#   - On FreeBSD:       /usr/local/etc/amavisd.conf
# Reference:
# http://www.iredmail.org/wiki/index.php?title=IRedMail/FAQ/Integrate.MySQL.in.Amavisd
amavisd_enable_logging = True

amavisd_db_host = "127.0.0.1"
amavisd_db_port = 3306
amavisd_db_name = "amavisd"
amavisd_db_user = "amavisd"
amavisd_db_password = "XXXXXXX"

# #### Quarantining ####
# Release quarantined SPAM/Virus mails: True, False.
# iRedAdmin-Pro will connect to @quarantine_server to release quarantined mails.
# How to enable quarantining in Amavisd-new:
# http://www.iredmail.org/wiki/index.php?title=IRedMail/FAQ/Quarantining.SPAM
amavisd_enable_quarantine = True

# Port of Amavisd protocol 'AM.PDP-INET'. Default is 9998.
amavisd_quarantine_port = 9998

##############################################################################
# Place your custom settings below, you can override all settings in this file
# and libs/default_settings.py here.
#

10

Re: Internal Server Error http 500 after upgrade of ireadmin 0.2.2 -> 0.3

ZhangHuangbin wrote:

1) Open file /var/www/iredadmin/settings.py, found below line:

My fault. It's file /var/www/iredadmin/iredbase.py.
Sorry about this.

11

Re: Internal Server Error http 500 after upgrade of ireadmin 0.2.2 -> 0.3

my iredbase.py is located under /var/www/iredadmin/libs/iredbase.py

I still get http 500 and nithing had changed in log. I don't know where to find in log config name.
Here're some outputs:
/var/log/httpd/error_log

[Sat Jan 18 18:06:25 2014] [notice] caught SIGTERM, shutting down
[Sat Jan 18 18:06:26 2014] [notice] suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)
[Sat Jan 18 18:06:26 2014] [notice] Digest: generating secret for digest authentication ...
[Sat Jan 18 18:06:26 2014] [notice] Digest: done
[Sat Jan 18 18:06:26 2014] [notice] Apache/2.2.15 (Unix) DAV/2 mod_ssl/2.2.15 OpenSSL/1.0.0-fips mod_wsgi/3.2 Python/2.6.6 configured -- resuming normal operations
[Sat Jan 18 18:06:47 2014] [notice] caught SIGTERM, shutting down
[Sat Jan 18 18:06:48 2014] [notice] suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)
[Sat Jan 18 18:06:48 2014] [notice] Digest: generating secret for digest authentication ...
[Sat Jan 18 18:06:48 2014] [notice] Digest: done
[Sat Jan 18 18:06:48 2014] [notice] Apache/2.2.15 (Unix) DAV/2 mod_ssl/2.2.15 OpenSSL/1.0.0-fips mod_wsgi/3.2 Python/2.6.6 configured -- resuming normal operations

/var/log/httpd/ssl_error_log

[Sat Jan 18 18:06:48 2014] [warn] RSA server certificate is a CA certificate (BasicConstraints: CA == TRUE !?)
[Sat Jan 18 18:07:29 2014] [error] [client 10.10.30.154] mod_wsgi (pid=794): Target WSGI script '/var/www/iredadmin/iredadmin.py' cannot be loaded as Python module.
[Sat Jan 18 18:07:29 2014] [error] [client 10.10.30.154] mod_wsgi (pid=794): Exception occurred processing WSGI script '/var/www/iredadmin/iredadmin.py'.
[Sat Jan 18 18:07:29 2014] [error] [client 10.10.30.154] Traceback (most recent call last):
[Sat Jan 18 18:07:29 2014] [error] [client 10.10.30.154]   File "/var/www/iredadmin/iredadmin.py", line 9, in <module>
[Sat Jan 18 18:07:29 2014] [error] [client 10.10.30.154]     from libs import iredbase
[Sat Jan 18 18:07:29 2014] [error] [client 10.10.30.154]   File "/var/www/iredadmin/libs/iredbase.py", line 18, in <module>
[Sat Jan 18 18:07:29 2014] [error] [client 10.10.30.154]     import iredutils
[Sat Jan 18 18:07:29 2014] [error] [client 10.10.30.154]   File "/var/www/iredadmin/libs/iredutils.py", line 254, in <module>
[Sat Jan 18 18:07:29 2014] [error] [client 10.10.30.154]     min_passwd_length=settings.min_passwd_length,
[Sat Jan 18 18:07:29 2014] [error] [client 10.10.30.154] AttributeError: 'module' object has no attribute 'min_passwd_length'
[Sat Jan 18 18:07:39 2014] [error] [client 10.10.30.154] mod_wsgi (pid=794): Target WSGI script '/var/www/iredadmin/iredadmin.py' cannot be loaded as Python module.
[Sat Jan 18 18:07:39 2014] [error] [client 10.10.30.154] mod_wsgi (pid=794): Exception occurred processing WSGI script '/var/www/iredadmin/iredadmin.py'.
[Sat Jan 18 18:07:39 2014] [error] [client 10.10.30.154] Traceback (most recent call last):
[Sat Jan 18 18:07:39 2014] [error] [client 10.10.30.154]   File "/var/www/iredadmin/iredadmin.py", line 9, in <module>
[Sat Jan 18 18:07:39 2014] [error] [client 10.10.30.154]     from libs import iredbase
[Sat Jan 18 18:07:39 2014] [error] [client 10.10.30.154]   File "/var/www/iredadmin/libs/iredbase.py", line 18, in <module>
[Sat Jan 18 18:07:39 2014] [error] [client 10.10.30.154]     import iredutils
[Sat Jan 18 18:07:39 2014] [error] [client 10.10.30.154]   File "/var/www/iredadmin/libs/iredutils.py", line 254, in <module>
[Sat Jan 18 18:07:39 2014] [error] [client 10.10.30.154]     min_passwd_length=settings.min_passwd_length,
[Sat Jan 18 18:07:39 2014] [error] [client 10.10.30.154] AttributeError: 'module' object has no attribute 'min_passwd_length'

ssl_reqest_log

[18/Jan/2014:18:07:29 +0100] 10.10.30.154 TLSv1 DHE-RSA-CAMELLIA256-SHA "GET /iredadmin HTTP/1.1" 632
[18/Jan/2014:18:07:32 +0100] 10.10.30.154 TLSv1 DHE-RSA-CAMELLIA256-SHA "GET /mail/ HTTP/1.1" 4714
[18/Jan/2014:18:07:33 +0100] 10.10.30.154 TLSv1 DHE-RSA-CAMELLIA256-SHA "GET /mail/skins/larry/styles.css?s=1371395454 HTTP/1.1" -
[18/Jan/2014:18:07:33 +0100] 10.10.30.154 TLSv1 DHE-RSA-CAMELLIA256-SHA "GET /mail/plugins/jqueryui/themes/larry/jquery-ui-1.9.1.custom.css?s=1371395453 HTTP/1.1" -
[18/Jan/2014:18:07:33 +0100] 10.10.30.154 TLSv1 DHE-RSA-CAMELLIA256-SHA "GET /mail/skins/larry/ui.js?s=1371395454 HTTP/1.1" -
[18/Jan/2014:18:07:33 +0100] 10.10.30.154 TLSv1 DHE-RSA-CAMELLIA256-SHA "GET /mail/program/js/jquery.min.js?s=1371395453 HTTP/1.1" -
[18/Jan/2014:18:07:33 +0100] 10.10.30.154 TLSv1 DHE-RSA-CAMELLIA256-SHA "GET /mail/program/js/common.js?s=1371395453 HTTP/1.1" -
[18/Jan/2014:18:07:33 +0100] 10.10.30.154 TLSv1 DHE-RSA-CAMELLIA256-SHA "GET /mail/program/js/app.js?s=1371395453 HTTP/1.1" -
[18/Jan/2014:18:07:33 +0100] 10.10.30.154 TLSv1 DHE-RSA-CAMELLIA256-SHA "GET /mail/plugins/jqueryui/js/jquery-ui-1.9.1.custom.min.js?s=1371395453 HTTP/1.1" -
[18/Jan/2014:18:07:33 +0100] 10.10.30.154 TLSv1 DHE-RSA-CAMELLIA256-SHA "GET /mail/program/js/jstz.min.js?s=1371395453 HTTP/1.1" -
[18/Jan/2014:18:07:33 +0100] 10.10.30.154 TLSv1 DHE-RSA-CAMELLIA256-SHA "GET /mail/skins/larry/images/linen.jpg?v=0382.14157 HTTP/1.1" -
[18/Jan/2014:18:07:33 +0100] 10.10.30.154 TLSv1 DHE-RSA-CAMELLIA256-SHA "GET /mail/skins/larry/images/linen_login.jpg?v=0484.10363 HTTP/1.1" -
[18/Jan/2014:18:07:33 +0100] 10.10.30.154 TLSv1 DHE-RSA-CAMELLIA256-SHA "GET /mail/skins/larry/images/login_shadow.png?v=3337.1069 HTTP/1.1" -
[18/Jan/2014:18:07:39 +0100] 10.10.30.154 TLSv1 DHE-RSA-CAMELLIA256-SHA "GET /iredadmin HTTP/1.1" 632

ssl_access_log

10.10.30.154 - - [18/Jan/2014:18:07:29 +0100] "GET /iredadmin HTTP/1.1" 500 632
10.10.30.154 - - [18/Jan/2014:18:07:32 +0100] "GET /mail/ HTTP/1.1" 200 4714
10.10.30.154 - - [18/Jan/2014:18:07:33 +0100] "GET /mail/skins/larry/styles.css?s=1371395454 HTTP/1.1" 304 -
10.10.30.154 - - [18/Jan/2014:18:07:33 +0100] "GET /mail/plugins/jqueryui/themes/larry/jquery-ui-1.9.1.custom.css?s=1371395453 HTTP/1.1" 304 -
10.10.30.154 - - [18/Jan/2014:18:07:33 +0100] "GET /mail/skins/larry/ui.js?s=1371395454 HTTP/1.1" 304 -
10.10.30.154 - - [18/Jan/2014:18:07:33 +0100] "GET /mail/program/js/jquery.min.js?s=1371395453 HTTP/1.1" 304 -
10.10.30.154 - - [18/Jan/2014:18:07:33 +0100] "GET /mail/program/js/common.js?s=1371395453 HTTP/1.1" 304 -
10.10.30.154 - - [18/Jan/2014:18:07:33 +0100] "GET /mail/program/js/app.js?s=1371395453 HTTP/1.1" 304 -
10.10.30.154 - - [18/Jan/2014:18:07:33 +0100] "GET /mail/plugins/jqueryui/js/jquery-ui-1.9.1.custom.min.js?s=1371395453 HTTP/1.1" 304 -
10.10.30.154 - - [18/Jan/2014:18:07:33 +0100] "GET /mail/program/js/jstz.min.js?s=1371395453 HTTP/1.1" 304 -
10.10.30.154 - - [18/Jan/2014:18:07:33 +0100] "GET /mail/skins/larry/images/linen.jpg?v=0382.14157 HTTP/1.1" 304 -
10.10.30.154 - - [18/Jan/2014:18:07:33 +0100] "GET /mail/skins/larry/images/linen_login.jpg?v=0484.10363 HTTP/1.1" 304 -
10.10.30.154 - - [18/Jan/2014:18:07:33 +0100] "GET /mail/skins/larry/images/login_shadow.png?v=3337.1069 HTTP/1.1" 304 -
10.10.30.154 - - [18/Jan/2014:18:07:39 +0100] "GET /iredadmin HTTP/1.1" 500 632

12

Re: Internal Server Error http 500 after upgrade of ireadmin 0.2.2 -> 0.3

misieq wrote:

my iredbase.py is located under /var/www/iredadmin/libs/iredbase.py

Sorry about my mistake.

It really confuses me. Is it possible to let me login to your server remotely (via ssh) to check this issue? If ok, please mail me (zhb _at_ iredmail.org) ssh account info.

13

Re: Internal Server Error http 500 after upgrade of ireadmin 0.2.2 -> 0.3

Thanks for your help.
However I figured it out.
I redawnloaded package from your site, and did whole migration from scratch.
No it works so I guess I had made some stupid mistake previously.
I really appreciate your help