[GH-ISSUE #3527] ALLOWED_HOSTS #1855

Open
opened 2026-02-27 11:19:32 +03:00 by kerem · 4 comments
Owner

Originally created by @olaf7 on GitHub (Apr 13, 2025).
Original GitHub issue: https://github.com/modoboa/modoboa/issues/3527

This has probably been in Modoboa for a some time. The name of the variable in settings.py is filled with a single setting by the installer. However a manual installation and/or one with tweaked configuration might have an effect.
The name suggests multiple hostnames (aliases) can be user/added as ALLOWED_HOSTS is plural.
However the data initialization code only takes the first hostname into consideration making the others irrelevant?

lines 30-36 : /modoboa/core/commands/templates/settings.py.tpl

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = {{ devmode }}
ALLOWED_HOSTS = [
    '{{ allowed_host }}',
]

lines 105-111 : /modoboa/core/management/commands/load_initial_data.py

            return
        app_model = get_application_model()
        allowed_host = getattr(settings, "ALLOWED_HOSTS", None)
        if allowed_host is not None:
            allowed_host = allowed_host[0]
        else:

Suggested solution:
Validate value(s) and report when running manage.py load_initial_data and/or document the behaviour.

Originally created by @olaf7 on GitHub (Apr 13, 2025). Original GitHub issue: https://github.com/modoboa/modoboa/issues/3527 This has probably been in Modoboa for a some time. The name of the variable in settings.py is filled with a single setting by the installer. However a manual installation and/or one with tweaked configuration might have an effect. The name suggests multiple hostnames (aliases) can be user/added as ALLOWED_HOSTS is plural. However the data initialization code only takes the first hostname into consideration making the others irrelevant? lines 30-36 : /modoboa/core/commands/templates/settings.py.tpl ``` # SECURITY WARNING: don't run with debug turned on in production! DEBUG = {{ devmode }} ALLOWED_HOSTS = [ '{{ allowed_host }}', ] ``` lines 105-111 : /modoboa/core/management/commands/load_initial_data.py ``` return app_model = get_application_model() allowed_host = getattr(settings, "ALLOWED_HOSTS", None) if allowed_host is not None: allowed_host = allowed_host[0] else: ``` Suggested solution: Validate value(s) and report when running manage.py load_initial_data and/or document the behaviour.
Author
Owner

@stale[bot] commented on GitHub (Jun 26, 2025):

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

<!-- gh-comment-id:3009817781 --> @stale[bot] commented on GitHub (Jun 26, 2025): This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Author
Owner

@tonioo commented on GitHub (Jul 2, 2025):

@olaf7 Could you create a PR for that please?

<!-- gh-comment-id:3027255716 --> @tonioo commented on GitHub (Jul 2, 2025): @olaf7 Could you create a PR for that please?
Author
Owner

@olaf7 commented on GitHub (Jul 4, 2025):

Time permitting I can do that. Is there a guideline, template, test procedure or something else I should take into consideration?
Is the docker setup currently working on Debian stable for development and test purposes?

<!-- gh-comment-id:3037235084 --> @olaf7 commented on GitHub (Jul 4, 2025): Time permitting I can do that. Is there a guideline, template, test procedure or something else I should take into consideration? Is the docker setup currently working on Debian stable for development and test purposes?
Author
Owner

@tonioo commented on GitHub (Jul 5, 2025):

You can find some information here: https://modoboa.readthedocs.io/en/latest/contributing/getting_started.html.

<!-- gh-comment-id:3038524356 --> @tonioo commented on GitHub (Jul 5, 2025): You can find some information here: https://modoboa.readthedocs.io/en/latest/contributing/getting_started.html.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/modoboa-modoboa#1855
No description provided.