modoboa / modoboa

Mail hosting made simple
https://modoboa.org
ISC License
3.02k stars 394 forks source link

Browser receives html, expects json #1241

Closed stooj closed 6 years ago

stooj commented 7 years ago

Impacted versions

Steps to reproduce

Clean installation on a clean 2GB Digital Ocean Ubuntu 16.04 droplet, try to change the admin password to something else.

Current behavior

I enter in the default password and a new password (currently just alphanumeric characters, 17 characters long).

When I click on the Update button, a POST occurs, but nginx returns a 500 error and the page stays the same.

Expected behavior

The password should be updated and a success message should be shown.

I have had a look with developer tools in Chromium and Firefox, and it looks like an HTML payload is being received instead of a json payload.

The console log is:

mail.example.com/:270 GET https://mail.example.com/sitestatic/font-awesome/fonts/fontawesome-webfont.woff2?v=4.7.0 net::ERR_ABORTED
jquery.min.js:5 XHR finished loading: GET "https://mail.example.com/user/profile/?_=1505929434651".
send @ jquery.min.js:5
ajax @ jquery.min.js:5
check @ history.js:272
i @ jquery.min.js:3
setInterval (async)
History @ history.js:18
initialize @ listing.js:27
initialize @ twocols_nav.js:24
Listing @ listing.js:8
TwocolsNav @ twocols_nav.js:10
(anonymous) @ (index):331
c @ jquery.min.js:3
fireWith @ jquery.min.js:3
ready @ jquery.min.js:3
H @ jquery.min.js:3
jquery.min.js:5 POST https://mail.example.com/user/profile/ 500 (Internal Server Error)
send @ jquery.min.js:5
ajax @ jquery.min.js:5
simple_ajax_form_post @ global.js:171
(anonymous) @ twocols_nav.js:32
i @ jquery.min.js:3
dispatch @ jquery.min.js:3
v.handle @ jquery.min.js:3
VM168:1 Uncaught SyntaxError: Unexpected token < in JSON at position 0
    at JSON.parse (<anonymous>)
    at Function.parseJSON (jquery.min.js:3)
    at Object.<anonymous> (global.js:195)
    at c (jquery.min.js:3)
    at Object.fireWith [as rejectWith] (jquery.min.js:3)
    at k (jquery.min.js:5)
    at XMLHttpRequest.r (jquery.min.js:5)
parseJSON @ jquery.min.js:3
(anonymous) @ global.js:195
c @ jquery.min.js:3
fireWith @ jquery.min.js:3
k @ jquery.min.js:5
r @ jquery.min.js:5
XMLHttpRequest.send (async)
send @ jquery.min.js:5
ajax @ jquery.min.js:5
simple_ajax_form_post @ global.js:171
(anonymous) @ twocols_nav.js:32
i @ jquery.min.js:3
dispatch @ jquery.min.js:3
v.handle @ jquery.min.js:3
jquery.min.js:5 XHR failed loading: POST "https://mail.example.com/user/profile/".
send @ jquery.min.js:5
ajax @ jquery.min.js:5
simple_ajax_form_post @ global.js:171
(anonymous) @ twocols_nav.js:32
i @ jquery.min.js:3
dispatch @ jquery.min.js:3
v.handle @ jquery.min.js:3

VM168 seems to be at fault, which is:

<!DOCTYPE html>

<html lang="">
  <head>
    <meta charset="utf-8" />
    <title></title>
    <link rel="icon" type="image/png" href="/sitestatic/css/logo-icon.png" />
    <link rel="stylesheet" type="text/css" href="/sitestatic/bootstrap/dist/css/bootstrap.min.css" />
    <script src="/sitestatic/bootstrap/dist/js/bootstrap.min.js" type="text/javascript"></script>
    <script src="/sitestatic/eonasdan-bootstrap-datetimepicker/build/js/bootstrap-datetimepicker.min.js" type="text/javascript"></script>
    <script type="text/javascript" src="/jsi18n/"></script>
    <style>
      body {
          padding-top: 60px;
      }
    </style>
  </head>

  <body>
    <div class="container-fluid">
      <div class="row-fluid">

<div class="alert alert-danger">
  <h4>Sorry</h4>
  <p>An internal error occured.</p>
</div>

      </div>
    </div>
  </body>
</html>

Sorry if I have missed any information; please let me know if I can help with more.

Cheers!

tonioo commented 7 years ago

Please set DEBUG to True inside settings.py and reload uwsgi, you should see a complete traceback.

stooj commented 7 years ago

Aah!

Certificate is a letsencrypt one, generated using the installer.

ValueError at /user/profile/
Invalid key size (96) for AES.

Request Method: POST
Request URL: https://mail.example.com/user/profile/
Django Version: 1.10.8
Python Executable: /usr/bin/uwsgi-core
Python Version: 2.7.12
Python Path: ['.', '', '/srv/modoboa/env/lib/python2.7', '/srv/modoboa/env/lib/python2.7/plat-x86_64-linux-gnu', '/srv/modoboa/env/lib/python2.7/lib-tk', '/srv/modoboa/env/lib/python2.7/lib-old', '/srv/modoboa/env/lib/python2.7/lib-dynload', '/usr/lib/python2.7', '/usr/lib/python2.7/plat-x86_64-linux-gnu', '/usr/lib/python2.7/lib-tk', '/srv/modoboa/env/local/lib/python2.7/site-packages']
Server time: Thu, 21 Sep 2017 09:09:30 +0100
Installed Applications:
('django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.messages',
 'django.contrib.sites',
 'django.contrib.staticfiles',
 'reversion',
 'ckeditor',
 'ckeditor_uploader',
 'rest_framework',
 'rest_framework.authtoken',
 'modoboa',
 'modoboa.core',
 'modoboa.lib',
 'modoboa.admin',
 'modoboa.relaydomains',
 'modoboa.limits',
 'modoboa.parameters',
 'modoboa_amavis',
 'modoboa_pdfcredentials',
 'modoboa_postfix_autoreply',
 'modoboa_sievefilters',
 'modoboa_stats',
 'modoboa_webmail',
 'modoboa_contacts',
 'modoboa_dmarc',
 'modoboa_imap_migration',
 'webpack_loader')
Installed Middleware:
('x_forwarded_for.middleware.XForwardedForMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware',
 'django.middleware.common.CommonMiddleware',
 'django.middleware.csrf.CsrfViewMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.contrib.messages.middleware.MessageMiddleware',
 'django.middleware.locale.LocaleMiddleware',
 'django.middleware.clickjacking.XFrameOptionsMiddleware',
 'modoboa.core.middleware.LocalConfigMiddleware',
 'modoboa.lib.middleware.AjaxLoginRedirect',
 'modoboa.lib.middleware.CommonExceptionCatcher',
 'modoboa.lib.middleware.RequestCatcherMiddleware')

Traceback:  

File "/srv/modoboa/env/local/lib/python2.7/site-packages/django/core/handlers/exception.py" in inner
  42.             response = get_response(request)

File "/srv/modoboa/env/local/lib/python2.7/site-packages/django/core/handlers/base.py" in _legacy_get_response
  249.             response = self._get_response(request)

File "/srv/modoboa/env/local/lib/python2.7/site-packages/django/core/handlers/base.py" in _get_response
  187.                 response = self.process_exception_by_middleware(e, request)

File "/srv/modoboa/env/local/lib/python2.7/site-packages/django/core/handlers/base.py" in _get_response
  185.                 response = wrapped_callback(request, *callback_args, **callback_kwargs)

File "/srv/modoboa/env/local/lib/python2.7/site-packages/django/utils/decorators.py" in inner
  185.                     return func(*args, **kwargs)

File "/srv/modoboa/env/local/lib/python2.7/site-packages/django/utils/decorators.py" in inner
  185.                     return func(*args, **kwargs)

File "/srv/modoboa/env/local/lib/python2.7/site-packages/django/contrib/auth/decorators.py" in _wrapped_view
  23.                 return view_func(request, *args, **kwargs)

File "/srv/modoboa/env/local/lib/python2.7/site-packages/modoboa/core/views/user.py" in profile
  46.                     form.cleaned_data["confirmation"]

File "/srv/modoboa/env/local/lib/python2.7/site-packages/modoboa/lib/cryptutils.py" in encrypt
  36.     cipher = Cipher(algorithms.AES(key), modes.ECB(), backend=backend)

File "/srv/modoboa/env/local/lib/python2.7/site-packages/cryptography/hazmat/primitives/ciphers/algorithms.py" in __init__
  30.         self.key = _verify_key_size(self, key)

File "/srv/modoboa/env/local/lib/python2.7/site-packages/cryptography/hazmat/primitives/ciphers/algorithms.py" in _verify_key_size
  17.             len(key) * 8, algorithm.name

Exception Type: ValueError at /user/profile/
Exception Value: Invalid key size (96) for AES.
Request information:
USER: admin

GET: No GET data

POST:
phone_number = u''
first_name = u''
last_name = u''
language = u'en'
secondary_email = u''
confirmation = u'abcdefgpassword'
newpassword = u'abcdefgpassword'
oldpassword = u'password'
csrfmiddlewaretoken = u'uqEznDpMOJDKiUHz2Re1FIzyv0nCmpsrytY4zbMwzaXl1iRvnRkACyxIsgtkFCZh'

FILES: No FILES data

COOKIES:
csrftoken = 'GJdg3eWtrRKgkYS9YzyZQQ50BXpVaDchKMxLfMjdci4R3m25jzEyNG3aydvDtQJ7'
sessionid = '481nywi1ixyswif5ag2j2shrcusffk8g'

META:
CONTENT_LENGTH = '228'
CONTENT_TYPE = 'application/x-www-form-urlencoded; charset=UTF-8'
CSRF_COOKIE = 'GJdg3eWtrRKgkYS9YzyZQQ50BXpVaDchKMxLfMjdci4R3m25jzEyNG3aydvDtQJ7'
DOCUMENT_ROOT = '/srv/modoboa/instance'
HTTPS = 'on'
HTTP_ACCEPT = '*/*'
HTTP_ACCEPT_ENCODING = 'gzip, deflate, br'
HTTP_ACCEPT_LANGUAGE = 'en-GB,en-US;q=0.8,en;q=0.6'
HTTP_CONNECTION = 'keep-alive'
HTTP_CONTENT_LENGTH = '228'
HTTP_CONTENT_TYPE = 'application/x-www-form-urlencoded; charset=UTF-8'
HTTP_COOKIE = 'sessionid=481nywi1ixyswif5ag2j2shrcusffk8g; csrftoken=GJdg3eWtrRKgkYS9YzyZQQ50BXpVaDchKMxLfMjdci4R3m25jzEyNG3aydvDtQJ7'
HTTP_HOST = 'mail.example.com'
HTTP_ORIGIN = 'https://mail.example.com'
HTTP_REFERER = 'https://mail.example.com/user/'
HTTP_USER_AGENT = 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.91 Safari/537.36'
HTTP_X_CSRFTOKEN = 'GJdg3eWtrRKgkYS9YzyZQQ50BXpVaDchKMxLfMjdci4R3m25jzEyNG3aydvDtQJ7'
HTTP_X_REQUESTED_WITH = 'XMLHttpRequest'
PATH_INFO = u'/user/profile/'
QUERY_STRING = ''
REMOTE_ADDR = '88.98.252.50'
REMOTE_PORT = '33078'
REQUEST_METHOD = 'POST'
REQUEST_SCHEME = 'https'
REQUEST_URI = '/user/profile/'
SCRIPT_NAME = u''
SERVER_NAME = 'mail.example.com'
SERVER_PORT = '443'
SERVER_PROTOCOL = 'HTTP/1.1'
UWSGI_APPID = 'mail.example.com|'
UWSGI_SCRIPT = 'instance.wsgi:application'
uwsgi.node = 'cleef'
uwsgi.version = '2.0.12-debian'
wsgi.errors = <open file 'wsgi_errors', mode 'w' at 0x7f285562bdb0>
wsgi.file_wrapper = ''
wsgi.input = <uwsgi._Input object at 0x7f28510300d8>
wsgi.multiprocess = True
wsgi.multithread = False
wsgi.run_once = False
wsgi.url_scheme = 'https'
wsgi.version = 

Settings:
Using settings module instance.settings
ABSOLUTE_URL_OVERRIDES = {}
ADMINS = []
ALLOWED_HOSTS = ['mail.example.com']
APPEND_SLASH = True
AUTHENTICATION_BACKENDS = 'django.contrib.auth.backends.ModelBackend'
AUTH_PASSWORD_VALIDATORS = u'********************'
AUTH_USER_MODEL = 'core.User'
BASE_DIR = '/srv/modoboa/instance'
CACHES = {u'default': {u'BACKEND': u'django.core.cache.backends.locmem.LocMemCache'}}
CACHE_MIDDLEWARE_ALIAS = u'default'
CACHE_MIDDLEWARE_KEY_PREFIX = u'********************'
CACHE_MIDDLEWARE_SECONDS = 600
CKEDITOR_ALLOW_NONIMAGE_FILES = False
CKEDITOR_BROWSE_SHOW_DIRS = True
CKEDITOR_CONFIGS = {'default': {'toolbar_Modoboa': [['Bold', 'Italic', 'Underline'], ['JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock'], ['BidiLtr', 'BidiRtl', 'Language'], ['NumberedList', 'BulletedList', '-', 'Outdent', 'Indent'], ['Undo', 'Redo'], ['Link', 'Unlink', 'Anchor', '-', 'Smiley'], ['TextColor', 'BGColor', '-', 'Source'], ['Font', 'FontSize'], ['Image'], ['SpellChecker']], 'allowedContent': True, 'toolbar': 'Modoboa', 'width': None}}
CKEDITOR_IMAGE_BACKEND = 'pillow'
CKEDITOR_RESTRICT_BY_USER = True
CKEDITOR_UPLOAD_PATH = 'uploads/'
CSRF_COOKIE_AGE = 31449600
CSRF_COOKIE_DOMAIN = None
CSRF_COOKIE_HTTPONLY = False
CSRF_COOKIE_NAME = u'csrftoken'
CSRF_COOKIE_PATH = u'/'
CSRF_COOKIE_SECURE = False
CSRF_FAILURE_VIEW = u'django.views.csrf.csrf_failure'
CSRF_HEADER_NAME = u'HTTP_X_CSRFTOKEN'
CSRF_TRUSTED_ORIGINS = []
DATABASES = {'default': {'ENGINE': 'django.db.backends.postgresql_psycopg2', 'AUTOCOMMIT': True, 'ATOMIC_REQUESTS': True, 'NAME': 'modoboa', 'CONN_MAX_AGE': 0, 'TIME_ZONE': None, 'PORT': '', 'HOST': '127.0.0.1', 'USER': 'modoboa', 'TEST': {'COLLATION': None, 'CHARSET': None, 'NAME': None, 'MIRROR': None}, 'PASSWORD': u'********************', 'OPTIONS': {}}, 'amavis': {'ENGINE': 'django.db.backends.postgresql_psycopg2', 'AUTOCOMMIT': True, 'ATOMIC_REQUESTS': True, 'NAME': 'amavis', 'CONN_MAX_AGE': 0, 'TIME_ZONE': None, 'PORT': '', 'HOST': '127.0.0.1', 'USER': 'amavis', 'TEST': {'COLLATION': None, 'CHARSET': None, 'NAME': None, 'MIRROR': None}, 'PASSWORD': u'********************', 'OPTIONS': {}}}
DATABASE_ROUTERS = ['modoboa_amavis.dbrouter.AmavisRouter']
DATA_UPLOAD_MAX_MEMORY_SIZE = 2621440
DATA_UPLOAD_MAX_NUMBER_FIELDS = 1000
DATETIME_FORMAT = u'N j, Y, P'
DATETIME_INPUT_FORMATS = [u'%Y-%m-%d %H:%M:%S', u'%Y-%m-%d %H:%M:%S.%f', u'%Y-%m-%d %H:%M', u'%Y-%m-%d', u'%m/%d/%Y %H:%M:%S', u'%m/%d/%Y %H:%M:%S.%f', u'%m/%d/%Y %H:%M', u'%m/%d/%Y', u'%m/%d/%y %H:%M:%S', u'%m/%d/%y %H:%M:%S.%f', u'%m/%d/%y %H:%M', u'%m/%d/%y']
DATE_FORMAT = u'N j, Y'
DATE_INPUT_FORMATS = [u'%Y-%m-%d', u'%m/%d/%Y', u'%m/%d/%y', u'%b %d %Y', u'%b %d, %Y', u'%d %b %Y', u'%d %b, %Y', u'%B %d %Y', u'%B %d, %Y', u'%d %B %Y', u'%d %B, %Y']
DEBUG = True
DEBUG_PROPAGATE_EXCEPTIONS = False
DECIMAL_SEPARATOR = u'.'
DEFAULT_CHARSET = u'utf-8'
DEFAULT_CONTENT_TYPE = u'text/html'
DEFAULT_EXCEPTION_REPORTER_FILTER = u'django.views.debug.SafeExceptionReporterFilter'
DEFAULT_FILE_STORAGE = u'django.core.files.storage.FileSystemStorage'
DEFAULT_FROM_EMAIL = u'webmaster@localhost'
DEFAULT_INDEX_TABLESPACE = u''
DEFAULT_TABLESPACE = u''
DISALLOWED_USER_AGENTS = []
EMAIL_BACKEND = u'django.core.mail.backends.smtp.EmailBackend'
EMAIL_HOST = u'localhost'
EMAIL_HOST_PASSWORD = u'********************'
EMAIL_HOST_USER = u''
EMAIL_PORT = 25
EMAIL_SSL_CERTFILE = None
EMAIL_SSL_KEYFILE = u'********************'
EMAIL_SUBJECT_PREFIX = u'[Django] '
EMAIL_TIMEOUT = None
EMAIL_USE_SSL = False
EMAIL_USE_TLS = False
FILE_CHARSET = u'utf-8'
FILE_UPLOAD_DIRECTORY_PERMISSIONS = None
FILE_UPLOAD_HANDLERS = [u'django.core.files.uploadhandler.MemoryFileUploadHandler', u'django.core.files.uploadhandler.TemporaryFileUploadHandler']
FILE_UPLOAD_MAX_MEMORY_SIZE = 2621440
FILE_UPLOAD_PERMISSIONS = None
FILE_UPLOAD_TEMP_DIR = None
FIRST_DAY_OF_WEEK = 0
FIXTURE_DIRS = []
FORCE_SCRIPT_NAME = None
FORMAT_MODULE_PATH = None
IGNORABLE_404_URLS = []
INSTALLED_APPS = 
INTERNAL_IPS = []
LANGUAGES = [(u'af', u'Afrikaans'), (u'ar', u'Arabic'), (u'ast', u'Asturian'), (u'az', u'Azerbaijani'), (u'bg', u'Bulgarian'), (u'be', u'Belarusian'), (u'bn', u'Bengali'), (u'br', u'Breton'), (u'bs', u'Bosnian'), (u'ca', u'Catalan'), (u'cs', u'Czech'), (u'cy', u'Welsh'), (u'da', u'Danish'), (u'de', u'German'), (u'dsb', u'Lower Sorbian'), (u'el', u'Greek'), (u'en', u'English'), (u'en-au', u'Australian English'), (u'en-gb', u'British English'), (u'eo', u'Esperanto'), (u'es', u'Spanish'), (u'es-ar', u'Argentinian Spanish'), (u'es-co', u'Colombian Spanish'), (u'es-mx', u'Mexican Spanish'), (u'es-ni', u'Nicaraguan Spanish'), (u'es-ve', u'Venezuelan Spanish'), (u'et', u'Estonian'), (u'eu', u'Basque'), (u'fa', u'Persian'), (u'fi', u'Finnish'), (u'fr', u'French'), (u'fy', u'Frisian'), (u'ga', u'Irish'), (u'gd', u'Scottish Gaelic'), (u'gl', u'Galician'), (u'he', u'Hebrew'), (u'hi', u'Hindi'), (u'hr', u'Croatian'), (u'hsb', u'Upper Sorbian'), (u'hu', u'Hungarian'), (u'ia', u'Interlingua'), (u'id', u'Indonesian'), (u'io', u'Ido'), (u'is', u'Icelandic'), (u'it', u'Italian'), (u'ja', u'Japanese'), (u'ka', u'Georgian'), (u'kk', u'Kazakh'), (u'km', u'Khmer'), (u'kn', u'Kannada'), (u'ko', u'Korean'), (u'lb', u'Luxembourgish'), (u'lt', u'Lithuanian'), (u'lv', u'Latvian'), (u'mk', u'Macedonian'), (u'ml', u'Malayalam'), (u'mn', u'Mongolian'), (u'mr', u'Marathi'), (u'my', u'Burmese'), (u'nb', u'Norwegian Bokm\xe5l'), (u'ne', u'Nepali'), (u'nl', u'Dutch'), (u'nn', u'Norwegian Nynorsk'), (u'os', u'Ossetic'), (u'pa', u'Punjabi'), (u'pl', u'Polish'), (u'pt', u'Portuguese'), (u'pt-br', u'Brazilian Portuguese'), (u'ro', u'Romanian'), (u'ru', u'Russian'), (u'sk', u'Slovak'), (u'sl', u'Slovenian'), (u'sq', u'Albanian'), (u'sr', u'Serbian'), (u'sr-latn', u'Serbian Latin'), (u'sv', u'Swedish'), (u'sw', u'Swahili'), (u'ta', u'Tamil'), (u'te', u'Telugu'), (u'th', u'Thai'), (u'tr', u'Turkish'), (u'tt', u'Tatar'), (u'udm', u'Udmurt'), (u'uk', u'Ukrainian'), (u'ur', u'Urdu'), (u'vi', u'Vietnamese'), (u'zh-hans', u'Simplified Chinese'), (u'zh-hant', u'Traditional Chinese')]
LANGUAGES_BIDI = [u'he', u'ar', u'fa', u'ur']
LANGUAGE_CODE = 'en-us'
LANGUAGE_COOKIE_AGE = None
LANGUAGE_COOKIE_DOMAIN = None
LANGUAGE_COOKIE_NAME = u'django_language'
LANGUAGE_COOKIE_PATH = u'/'
LOCALE_PATHS = []
LOGGING = {'loggers': {'modoboa.auth': {'handlers': ['syslog-auth', 'modoboa'], 'propagate': False, 'level': 'INFO'}, 'modoboa.admin': {'handlers': ['modoboa'], 'propagate': False, 'level': 'INFO'}}, 'version': 1, 'formatters': {'syslog': {'format': '%(name)s: %(levelname)s %(message)s'}}, 'handlers': {'syslog-auth': {'formatter': 'syslog', 'class': 'logging.handlers.SysLogHandler', 'facility': 4}, 'modoboa': {'class': 'modoboa.core.loggers.SQLHandler'}}}
LOGGING_CONFIG = u'logging.config.dictConfig'
LOGIN_REDIRECT_URL = u'/accounts/profile/'
LOGIN_URL = u'/accounts/login/'
LOGOUT_REDIRECT_URL = None
MANAGERS = []
MEDIA_ROOT = '/srv/modoboa/instance/media'
MEDIA_URL = '/media/'
MESSAGE_STORAGE = u'django.contrib.messages.storage.fallback.FallbackStorage'
MIDDLEWARE = None
MIDDLEWARE_CLASSES = 
MIGRATION_MODULES = {}
MODOBOA_API_URL = u'********************'
MODOBOA_APPS = 
MONTH_DAY_FORMAT = u'F j'
NUMBER_GROUPING = 0
PASSWORD_HASHERS = u'********************'
PASSWORD_RESET_TIMEOUT_DAYS = u'********************'
PREPEND_WWW = False
REST_FRAMEWORK = {'DEFAULT_AUTHENTICATION_CLASSES': ('rest_framework.authentication.TokenAuthentication', 'rest_framework.authentication.SessionAuthentication')}
ROOT_URLCONF = 'instance.urls'
SECRET_KEY = u'********************'
SECURE_BROWSER_XSS_FILTER = False
SECURE_CONTENT_TYPE_NOSNIFF = False
SECURE_HSTS_INCLUDE_SUBDOMAINS = False
SECURE_HSTS_SECONDS = 0
SECURE_PROXY_SSL_HEADER = None
SECURE_REDIRECT_EXEMPT = []
SECURE_SSL_HOST = None
SECURE_SSL_REDIRECT = False
SERVER_EMAIL = u'root@localhost'
SESSION_CACHE_ALIAS = u'default'
SESSION_COOKIE_AGE = 1209600
SESSION_COOKIE_DOMAIN = None
SESSION_COOKIE_HTTPONLY = True
SESSION_COOKIE_NAME = u'sessionid'
SESSION_COOKIE_PATH = u'/'
SESSION_COOKIE_SECURE = False
SESSION_ENGINE = u'django.contrib.sessions.backends.db'
SESSION_EXPIRE_AT_BROWSER_CLOSE = False
SESSION_FILE_PATH = None
SESSION_SAVE_EVERY_REQUEST = False
SESSION_SERIALIZER = u'django.contrib.sessions.serializers.JSONSerializer'
SETTINGS_MODULE = 'instance.settings'
SHORT_DATETIME_FORMAT = u'm/d/Y P'
SHORT_DATE_FORMAT = u'm/d/Y'
SIGNING_BACKEND = u'django.core.signing.TimestampSigner'
SILENCED_SYSTEM_CHECKS = ['fields.W342']
SITE_ID = 1
STATICFILES_DIRS = '/srv/modoboa/env/lib/python2.7/site-packages/modoboa/bower_components'
STATICFILES_FINDERS = [u'django.contrib.staticfiles.finders.FileSystemFinder', u'django.contrib.staticfiles.finders.AppDirectoriesFinder']
STATICFILES_STORAGE = u'django.contrib.staticfiles.storage.StaticFilesStorage'
STATIC_ROOT = '/srv/modoboa/instance/sitestatic'
STATIC_URL = '/sitestatic/'
TEMPLATES = [{'DIRS': [], 'APP_DIRS': True, 'OPTIONS': {'debug': False, 'context_processors': ['django.template.context_processors.debug', 'django.template.context_processors.request', 'django.contrib.auth.context_processors.auth', 'django.template.context_processors.i18n', 'django.template.context_processors.media', 'django.template.context_processors.static', 'django.template.context_processors.tz', 'django.contrib.messages.context_processors.messages', 'modoboa.core.context_processors.top_notifications']}, 'BACKEND': 'django.template.backends.django.DjangoTemplates'}]
TEST_NON_SERIALIZED_APPS = []
TEST_RUNNER = u'django.test.runner.DiscoverRunner'
THOUSAND_SEPARATOR = u','
TIME_FORMAT = u'P'
TIME_INPUT_FORMATS = [u'%H:%M:%S', u'%H:%M:%S.%f', u'%H:%M']
TIME_ZONE = 'Europe/London'
USE_ETAGS = False
USE_I18N = True
USE_L10N = True
USE_THOUSAND_SEPARATOR = False
USE_TZ = True
USE_X_FORWARDED_HOST = False
USE_X_FORWARDED_PORT = False
WEBPACK_LOADER = {'CONTACTS': {'IGNORE': ['.+\\.hot-update.js', '.+\\.map'], 'BUNDLE_DIR_NAME': 'modoboa_contacts/', 'CACHE': False, 'STATS_FILE': '/srv/modoboa/env/local/lib/python2.7/site-packages/modoboa_contacts/../frontend/webpack-stats.json'}}
WSGI_APPLICATION = 'instance.wsgi.application'
X_FRAME_OPTIONS = 'SAMEORIGIN'
YEAR_MONTH_FORMAT = u'F Y'

You're seeing this error because you have DEBUG = True in your
Django settings file. Change that to False, and Django will
display a standard page generated by the handler for this status code.
tonioo commented 7 years ago

Looks your secret key is too long. Have you modified it?

stooj commented 7 years ago

No, I haven't. I customized the installer.cfg.template before I installed, but haven't made any changes to settings (apart from teh debug flag, obviously)

Here are the changes I made:

8c8
< type = self-signed
---
> type = letsencrypt
11c11
< email = admin@example.com
---
> email = stooj@example.com
35c35
< timezone = Europe/Paris
---
> timezone = Europe/London
41c41
< extensions = modoboa-amavis modoboa-pdfcredentials modoboa-postfix-autoreply modoboa-sievefilters modoboa-stats modoboa-webmail modoboa-contacts
---
> extensions = modoboa-amavis modoboa-pdfcredentials modoboa-postfix-autoreply modoboa-sievefilters modoboa-stats modoboa-webmail modoboa-contacts modoboa-dmarc modoboa-imap-migration
77c77
< postmaster_address = postmaster@localhost
---
> postmaster_address = postmaster@example.com

(domain is a real one, of course)

tonioo commented 7 years ago

The secret key is not in the config file, you can modify it through the admin panel.

stooj commented 7 years ago

OK, I'm sure I haven't edited the secret key accidentally, because I went straight to changing the admin password.

The length of the key is 12. When you say "too long", is there a hard-limit, or is it "too long for my instance"?

It starts with a % symbol, would that act as an escape somehow?

stooj commented 7 years ago

The secret key shown in the web interface is quite different to the secret key in settings.py. The one in settings.py looks like a proper django secret key, length 50.

tonioo commented 7 years ago

Yes, they are different and this is normal. The key len (the one in the web interface) should be 16, 24, or 32 characters. Can you try to change it?

stooj commented 7 years ago

Yes. That has solved the issue :D I am almost certain that I didn't change the secret key; I assumed it was the django one and would break the db if I changed it.

Is there any way that it may not have been set correctly during installation?

tonioo commented 6 years ago

I don't think so. I close the issue for now.