Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added IMAP Microsoft Graph Configs #2610

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -410,6 +410,19 @@ docker run --name gitlab -d \
sameersbn/gitlab:15.1.3
```

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 `[email protected]' \
--env 'GITLAB_INCOMING_EMAIL_ADDRESS=incoming+%{key}@example.onmicrosoft.com' \
--env 'IMAP_METHOD=microsoft_graph' \
--env 'IMAP_TENANT_ID=<YOUR-TENANT-ID>' --env 'IMAP_CLIENT_ID=<YOUR-CLIENT-ID>' \
--env 'IMAP_CLIENT_SECRET=<YOUR-CLIENT-SECRET>'
```

Please refer the [Available Configuration Parameters](#available-configuration-parameters) section for the list of IMAP parameters that can be specified.

#### SSL
Expand Down Expand Up @@ -1870,6 +1883,22 @@ Enable STARTSSL. Defaults to `false`.

The name of the mailbox where incoming mail will end up. Defaults to `inbox`.

##### `IMAP_METHOD`

If you want to use Microsoft Graph API, set to `microsoft_graph`. No default

##### `IMAP_TENANT_ID`

Azure AD Tenant ID. No default

##### `IMAP_CLIENT_ID`

Azure AD App Client ID. No default

##### `IMAP_CLIENT_SECRET`

Azure AD App Client Secret. No default

##### `LDAP_ENABLED`

Enable LDAP. Defaults to `false`
Expand Down
7 changes: 7 additions & 0 deletions assets/runtime/config/gitlabhq/gitlab.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
4 changes: 4 additions & 0 deletions assets/runtime/env-defaults
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down
10 changes: 9 additions & 1 deletion assets/runtime/functions
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -419,7 +423,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
antt1995 marked this conversation as resolved.
Show resolved Hide resolved

# enable/disable startup of mailroom
echo "mail_room_enabled=${GITLAB_INCOMING_EMAIL_ENABLED}" >> /etc/default/gitlab
Expand Down