From 28767694a95aad53ceda22d345cb75a5deece1c5 Mon Sep 17 00:00:00 2001 From: Antt1995 Date: Thu, 21 Jul 2022 12:12:07 +0100 Subject: [PATCH 1/4] Added IMAP Microsoft Graph Configs --- README.md | 17 +++++++++++++++++ assets/runtime/config/gitlabhq/gitlab.yml | 7 +++++++ assets/runtime/env-defaults | 4 ++++ assets/runtime/functions | 6 +++++- 4 files changed, 33 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 59f5650e1..1df2727fe 100644 --- a/README.md +++ b/README.md @@ -409,6 +409,7 @@ docker run --name gitlab -d \ --volume /srv/docker/gitlab/gitlab:/home/git/data \ sameersbn/gitlab:15.1.2 ``` +IMAP [Microsoft Graph](https://docs.gitlab.com/ee/administration/incoming_email.html#microsoft-graph) Please refer the [Available Configuration Parameters](#available-configuration-parameters) section for the list of IMAP parameters that can be specified. @@ -1870,6 +1871,22 @@ Enable STARTSSL. Defaults to `false`. The name of the mailbox where incoming mail will end up. Defaults to `inbox`. +##### `IMAP_METHOD` + +Method blank or microsoft_graph + +##### `IMAP_TENANT_ID` + +Azure AD Tenant ID + +##### `IMAP_CLIENT_ID` + +Azure AD App Client ID + +##### `IMAP_CLIENT_SECRET` + +Azure AD App Client Secret + ##### `LDAP_ENABLED` Enable LDAP. Defaults to `false` diff --git a/assets/runtime/config/gitlabhq/gitlab.yml b/assets/runtime/config/gitlabhq/gitlab.yml index a0c478918..91ccd95b7 100644 --- a/assets/runtime/config/gitlabhq/gitlab.yml +++ b/assets/runtime/config/gitlabhq/gitlab.yml @@ -210,6 +210,13 @@ production: &base # Whether to expunge (permanently remove) messages from the mailbox when they are deleted after delivery expunge_deleted: false + + # For Microsoft Graph support + inbox_method: {{IMAP_METHOD}} + inbox_options: + tenant_id: "{{IMAP_TENANT_ID}}" + client_id: "{{IMAP_CLIENT_ID}}" + client_secret: "{{IMAP_CLIENT_SECRET}}" ## Build Artifacts artifacts: diff --git a/assets/runtime/env-defaults b/assets/runtime/env-defaults index 908d368fc..4d433b4bb 100644 --- a/assets/runtime/env-defaults +++ b/assets/runtime/env-defaults @@ -374,6 +374,10 @@ IMAP_SSL=${IMAP_SSL:-true} IMAP_STARTTLS=${IMAP_STARTTLS:-false} IMAP_MAILBOX=${IMAP_MAILBOX:-inbox} IMAP_TIMEOUT=${IMAP_TIMEOUT:-60} +IMAP_METHOD=${IMAP_METHOD:-} +IMAP_TENANT_ID=${IMAP_TENANT_ID:-} +IMAP_CLIENT_ID=${IMAP_CLIENT_ID:-} +IMAP_CLIENT_SECRET=${IMAP_CLIENT_SECRET:-} if [[ -n ${IMAP_USER} ]]; then IMAP_ENABLED=${IMAP_ENABLED:-true} diff --git a/assets/runtime/functions b/assets/runtime/functions index 07477a6ae..c59bce448 100644 --- a/assets/runtime/functions +++ b/assets/runtime/functions @@ -419,7 +419,11 @@ gitlab_configure_mailroom() { IMAP_SSL \ IMAP_STARTTLS \ IMAP_MAILBOX \ - IMAP_TIMEOUT + IMAP_TIMEOUT \ + IMAP_METHOD \ + IMAP_TENANT_ID \ + IMAP_CLIENT_ID \ + IMAP_CLIENT_SECRET # enable/disable startup of mailroom echo "mail_room_enabled=${GITLAB_INCOMING_EMAIL_ENABLED}" >> /etc/default/gitlab From a3614d19ad5e82cc8418db77410d4a6da5dc2c56 Mon Sep 17 00:00:00 2001 From: Antt1995 Date: Thu, 21 Jul 2022 18:31:09 +0100 Subject: [PATCH 2/4] Update README.md Co-authored-by: Kazunori Kimura <33391846+kkimurak@users.noreply.github.com> --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 1df2727fe..56d461b9d 100644 --- a/README.md +++ b/README.md @@ -1873,19 +1873,19 @@ The name of the mailbox where incoming mail will end up. Defaults to `inbox`. ##### `IMAP_METHOD` -Method blank or microsoft_graph +If you want to use Microsoft Graph API, set to `microsoft_graph`. No default ##### `IMAP_TENANT_ID` -Azure AD Tenant ID +Azure AD Tenant ID. No default ##### `IMAP_CLIENT_ID` -Azure AD App Client ID +Azure AD App Client ID. No default ##### `IMAP_CLIENT_SECRET` -Azure AD App Client Secret +Azure AD App Client Secret. No default ##### `LDAP_ENABLED` From 2a82402be79a5aca201a38d86878889897e20dde Mon Sep 17 00:00:00 2001 From: Antt1995 Date: Thu, 21 Jul 2022 18:31:28 +0100 Subject: [PATCH 3/4] Update README.md Co-authored-by: Kazunori Kimura <33391846+kkimurak@users.noreply.github.com> --- README.md | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 56d461b9d..c2eb48ca7 100644 --- a/README.md +++ b/README.md @@ -409,7 +409,19 @@ docker run --name gitlab -d \ --volume /srv/docker/gitlab/gitlab:/home/git/data \ sameersbn/gitlab:15.1.2 ``` -IMAP [Microsoft Graph](https://docs.gitlab.com/ee/administration/incoming_email.html#microsoft-graph) + +With [Microsoft deprecating basic authentication](https://techcommunity.microsoft.com/t5/exchange-team-blog/basic-authentication-deprecation-in-exchange-online-may-2022/ba-p/3301866), you may want to configure IMAP using the Microsoft Graph API. See details on [GitLab documentation for "incoming email with Microsoft Graph"](https://docs.gitlab.com/ee/administration/incoming_email.html#microsoft-graph) + +Here is a example command: + +```bash +docker run --name gitlab -d \ + --env 'GITLAB_INCOMING_EMAIL_ENABLED=true' --env `IMAP_USER=incoming@example.onmicrosoft.com' \ + --env 'GITLAB_INCOMING_EMAIL_ADDRESS=incoming+%{key}@example.onmicrosoft.com' \ + --env 'IMAP_METHOD=microsoft_graph' \ + --env 'IMAP_TENANT_ID=' --env 'IMAP_CLIENT_ID=' \ + --env 'IMAP_CLIENT_SECRET=' +``` Please refer the [Available Configuration Parameters](#available-configuration-parameters) section for the list of IMAP parameters that can be specified. From 4a75622e423c5285e99205bb8ef9650aba2830c5 Mon Sep 17 00:00:00 2001 From: Antt1995 Date: Thu, 21 Jul 2022 18:35:26 +0100 Subject: [PATCH 4/4] exec_as_git sed -i --- assets/runtime/functions | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/assets/runtime/functions b/assets/runtime/functions index c59bce448..5dd1c703d 100644 --- a/assets/runtime/functions +++ b/assets/runtime/functions @@ -406,6 +406,10 @@ gitlab_configure_mailroom() { -e "/{{IMAP_STARTTLS}}/d" \ -e "/{{IMAP_MAILBOX}}/d" \ -e "/{{IMAP_TIMEOUT}}/d" \ + -e "/{{IMAP_METHOD}}/d" \ + -e "/{{IMAP_TENANT_ID}}/d" \ + -e "/{{IMAP_CLIENT_ID}}/d" \ + -e "/{{IMAP_CLIENT_SECRET}}/d" \ ${GITLAB_CONFIG} fi