Giter Club home page Giter Club logo

github-mda's Introduction

Github Mail Delivery Agent

This directory contains a python script that acts like a Mail Delivery Agent (MDA) that can be used in fetchmail.

Motivation

Github Enterprise (GHE) supports replying by email to post comments on pull requests, issues, commit comments etc. But it requires that port 25 (SMTP) is directly exposed to the internet so external mail servers can relay messages to it. Depending on the security policies of your environment this might not be possible to do.

Solution

Github Enterprise sends out notification emails with the reply-to address set to reply+NN..NN@reply.[hostname]. Here [hostname] is the FQDN of the GHE instance. E.g: github.priv.mycompany.net.

  • Create DNS records for reply.github.priv.mycompany.net with your DNS provider.
    • You will at the minimum need MX records for this sub-domain.
  • Set up email delivery to reply.github.priv.mycompany.net with an external email provider (Google Apps, Zoho, Exchange Online or roll your own)
  • Use fetchmail to retrieve messages
  • When fetchmail downloads new emails it forwards them to a custom MDA. The MDA then filters messages that have a TO address of the form reply+NN..NN@reply.[hostname] and delivers them to the SMTP server on the GHE instance.

Setup

In a separate VM

  • Install fetchmail

  • Copy the etc/fetchmailrc to /etc on the target machine.

    • Replace imap.gmail.com to point to the right mail server
    • Replace [email protected] with the right username & domain for your mail server.
    • Replace INSERT PASSWORD with the password for the account
    • Replace the protocol IMAP with whatever mail download protocol you enable for this account.
  • Copy the script github_mda.py to some location on the target machine. e.g. /home/joe/github-fetchmail and update the mda line in /etc/fetchmailrc

    • Update the constants REPLY_SUBDOMAIN to the right reply subdomain for your GHE instance
    • Update SMTP_HOST to the hostname for your GHE instance
  • Create directory /var/github-fetchmail and change its owner to fetchmail

  • Edit /etc/default/fetchmail and set START_DAEMON to 'yes'

  • Enable fetchmail to start on boot

    # Ubuntu
    sudo updated-rc.d fetchmail enable
    
    # debian 8 / Arch
    sudo systemctl enable fetchmail
    
  • Start fetchmail

    # Ubuntu
    sudo /etc/init.d/fetchmail start
    
    # debian 8 / Arch
    sudo systemctl start fetchmail
    

Licensing

github-mda's People

Contributors

wrecker avatar

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.