11 Commits

Author SHA1 Message Date
github-actions[bot]
00d79f518d [GitHub Action] Updated version file 2025-11-21 15:12:39 +00:00
Antoine Nguyen
03b124501e Updated nginx config to redirect autodiscover requests to modoboa 2025-11-21 16:10:58 +01:00
github-actions[bot]
5f357aef42 [GitHub Action] Updated version file 2025-11-17 08:13:43 +00:00
Antoine Nguyen
e1aa0ab723 Removed legacy option for radicale socket 2025-11-17 09:12:32 +01:00
github-actions[bot]
88b2384fa8 [GitHub Action] Updated version file 2025-11-07 15:22:17 +00:00
Antoine Nguyen
bb02255c0f Merge pull request #613 from modoboa/fix/oauth2-client-secrets
Make sure to reuse same client secrets between runs.
2025-11-07 16:21:09 +01:00
Antoine Nguyen
7a38a535f8 Make sure to reuse same client secrets between runs. 2025-11-07 16:09:51 +01:00
github-actions[bot]
2121cfe267 [GitHub Action] Updated version file 2025-11-02 10:01:31 +00:00
Antoine Nguyen
36c8352223 Added missing config param
fix #605
2025-11-02 10:59:54 +01:00
github-actions[bot]
01ec9b406f [GitHub Action] Updated version file 2025-11-02 09:33:05 +00:00
Antoine Nguyen
f2c7423296 Merge pull request #610 from modoboa/mailbox-auto-creation
Added mailbox file and activate the auto subscribe
2025-11-02 10:32:00 +01:00
8 changed files with 27 additions and 9 deletions

View File

@@ -1,5 +1,6 @@
import random
import string
import uuid
from .constants import DEFAULT_BACKUP_DIRECTORY
@@ -11,6 +12,10 @@ def make_password(length=16):
string.ascii_letters + string.digits) for _ in range(length))
def make_client_secret():
return str(uuid.uuid4())
# Validators should return a tuple bool, error message
def is_email(user_input):
"""Return True in input is a valid email"""
@@ -351,6 +356,10 @@ ConfigDictTemplate = [
"option": "move_spam_to_junk",
"default": "true",
},
{
"option": "oauth2_client_secret",
"default": make_client_secret
},
]
},
{
@@ -480,7 +489,11 @@ ConfigDictTemplate = [
{
"option": "venv_path",
"default": "%(home_dir)s/env",
}
},
{
"option": "oauth2_client_secret",
"default": make_client_secret
},
]
},
{

View File

@@ -154,7 +154,10 @@ class Dovecot(base.Installer):
protocols = ""
oauth2_client_id, oauth2_client_secret = utils.create_oauth2_app(
"Dovecot", "dovecot", self.config
"Dovecot",
"dovecot",
self.config.get("dovecot", "oauth2_client_secret"),
self.config
)
hostname = self.config.get("general", "hostname")
oauth2_introspection_url = (

View File

@@ -149,7 +149,6 @@ service auth {
%{radicale_enabled} mode = 0666
%{radicale_enabled} user = %{radicale_user}
%{radicale_enabled} group = %{radicale_user}
%{radicale_enabled} type = auth-legacy
%{radicale_enabled}}
# Auth process is run as this user.

View File

@@ -9,6 +9,7 @@ server {
location ~ ^/(mail/config-v1.1.xml|mobileconfig) {
include uwsgi_params;
uwsgi_param UWSGI_SCRIPT instance.wsgi:application;
uwsgi_pass modoboa;
}
}

View File

@@ -44,7 +44,7 @@ server {
%{rspamd_enabled} proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
%{rspamd_enabled} }
location ~ ^/(api|accounts) {
location ~ ^/(api|accounts|autodiscover) {
include uwsgi_params;
uwsgi_param UWSGI_SCRIPT instance.wsgi:application;
uwsgi_pass modoboa;

View File

@@ -41,7 +41,11 @@ class Radicale(base.Installer):
"""Additional variables."""
context = super().get_template_context()
oauth2_client_id, oauth2_client_secret = utils.create_oauth2_app(
"Radicale", "radicale", self.config)
"Radicale",
"radicale",
self.config.get("radicale", "oauth2_client_secret"),
self.config
)
hostname = self.config.get("general", "hostname")
oauth2_introspection_url = (
f"https://{oauth2_client_id}:{oauth2_client_secret}"

View File

@@ -13,7 +13,6 @@ import stat
import string
import subprocess
import sys
import uuid
from . import config_dict_template
from .compatibility_matrix import APP_INCOMPATIBILITY
@@ -515,14 +514,13 @@ def validate_backup_path(path: str, silent_mode: bool):
return backup_path
def create_oauth2_app(app_name: str, client_id: str, config) -> tuple[str, str]:
def create_oauth2_app(app_name: str, client_id: str, client_secret: str, config) -> tuple[str, str]:
"""Create a application for Oauth2 authentication."""
# FIXME: how can we check that application already exists ?
venv_path = config.get("modoboa", "venv_path")
python_path = os.path.join(venv_path, "bin", "python")
instance_path = config.get("modoboa", "instance_path")
script_path = os.path.join(instance_path, "manage.py")
client_secret = str(uuid.uuid4())
cmd = (
f"{python_path} {script_path} createapplication "
f"--name={app_name} --skip-authorization "

View File

@@ -1 +1 @@
1d701353d900f4b6e2f7ffba6f6b7a46d304f58b
03b124501ec1a61eaa3063ac9fb839fdbc64f00c