Coder Social home page Coder Social logo

o365-imap-proxy's Introduction

Office 365 OAuth2 IMAP Proxy

o365-imap-proxy is a proxy server that allows you to connect to the Office 365 IMAP server using PLAIN AUTH authentication.

It uses the OAuth2 Password flow with the PLAIN AUTH credentials to obtain an access token and then uses it to authenticate to the IMAP server with XAUTH2.

The main use case is to allow incompatible email clients and legacy applications to connect to the Office 365 IMAP server.

Prerequisites

The proxy needs an Azure AD application to be registered in order to obtain the OAuth2 credentials.

The application must be configured with "Resource Owner Password Credential Flow" enabled and have the following permissions:

  • User.Read
  • IMAP.AccessAsUser.All

See Microsoft docs.

Installation

Docker

docker pull linkacloud/o365-imap-proxy:latest

From source

To build the binary from source, you need to have Go >= 1.18 installed on your machine.

git clone https://github.com/linka-cloud/o365-imap-proxy.git
cd o365-imap-proxy
make build

The binary will be available in the bin directory.

Usage

$ o365-imap-proxy --help 

Office365 IMAP proxy allows to keep using IMAP clients without XOAUTH2 support with Office365 accounts by providing PLAIN AUTH support.

Usage:
  o365-imap-proxy [flags]

Flags:
      --address string         The address to listen on [$ADDRESS] defaults to :143 or :993 if TLS is enabled
      --client-id string       The Azure App client id [$CLIENT_ID]
      --client-secret string   The Azure App client secret [$CLIENT_SECRET]
      --debug                  Enable debug logging
  -h, --help                   help for o365-imap-proxy
      --tenant string          The Azure AD tenant id [$TENANT]
      --tls                    Enable TLS using generated self-signed certificate

The proxy can be configured using environment variables:

  • TENANT: the Azure AD tenant ID
  • CLIENT_ID: the Azure AD application client ID
  • CLIENT_SECRET: the Azure AD application client secret

Docker

docker run --name o365-imap-proxy \
  -e TENANT=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx \
  -e CLIENT_ID=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx \
  -e CLIENT_SECRET=xxxxxxxxxxxxxxxxxxxx \
  -p 143:143 \
  linkacloud/o365-imap-proxy:latest

Docker Compose

The proxy can be deployed using docker-compose:

version: '3'
services:
  o365-imap-proxy:
    image: linkacloud/o365-imap-proxy:v0.0.1
    container_name: o365-imap-proxy
    restart: always
    command:
    - --tls
    ports:
      - "993:993"
    environment:
      TENANT: "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
      CLIENT_ID: "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
      CLIENT_SECRET: "xxxxxxxxxxxxxxxxxxxx"
docker-compose up -d

From source

export TENANT=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
export CLIENT_ID=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
export CLIENT_SECRET=xxxxxxxxxxxxxxxxxxxx
o365-imap-proxy --tls

o365-imap-proxy's People

Contributors

adphi avatar

Stargazers

 avatar

Watchers

 avatar

Forkers

luzifer nemu-x

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.