Code Monkey home page Code Monkey logo

gasp's Introduction

gasp

CI


Google App Specific Password Validator

A simple and lightweight Docker image for validating Google App-Specific Passwords via Gmail and Mutt.

Uses simple authentication (over TLS1.3) to access a Gmail inbox from a headless environment (using the mutt email client for Linux), using Google's required App Passwords method.

This simple system allows access to certain service's API's to many types of environment in a secure manner - without providing your real password.

As such, Google allows you to provision your less secure applications with authentication methods for them to work, and for your account to be safe.

Generating an App Specific Password

Covered by Google Support

  1. Head over to your Google Account.
  2. On the left-hand drawer, open Security
  3. Under the section Signing in with Google, open App Passwords
  4. Select the app you'd like to generate a password, for this we need to use Gmail
  5. For the device select Other and provide it a name, such as mutt
  6. Copy the resulting 16-character-long string to a safe place.
    • Google will not reveal this password again.
    • You will need to use it as an environment variable when running this container

Mutt configuration file

By default, the Mutt configuration file is adequate to access Gmail (as of March 2020). This file is created by the entrypoint.sh script, and is placed under /data/muttrc.

The default configuration file is populated with the following environment variables, defined when you start the container:

  • APP_USER: The email address for you Google Account
  • APP_PASS: The App Password generated in your Google Account to access Gmail

And is dumped with cat via heredocs into /data/muttrc:

   cat << EOF >> muttrc
set from = "${APP_USER:-user@example.com}"
set use_from = yes
set envelope_from = yes

set smtp_url = "smtps://${APP_USER:-user@example.com}@smtp.gmail.com:465/"
set smtp_pass = "${APP_PASS:-secretpassword}"
set imap_user = "${APP_USER:-user@example.com}"
set imap_pass = "${APP_PASS:-secretpassword}"
set folder = "imaps://imap.gmail.com:993"
set spoolfile = "+INBOX"
set ssl_force_tls = yes
EOF

Mutt is, in turn, ran with this configuration file:

mutt -F /data/muttrc

Deploying the container and testing Gmail access

Simply load the variables to your environment (or define them when running the container):

docker run --rm -ti \
-e APP_USER=${APP_USER} \
-e APP_PASS=${APP_PASS} \
zalgonoise/gasp

To access your inbox, add anything as a parameter, after the repo/container reference:

docker run --rm -ti \
-e APP_USER=${APP_USER} \
-e APP_PASS=${APP_PASS} \
zalgonoise/gasp \
mail

Or if you'd like to run a custom .muttrc file, you can load it into the container as /data/muttrc, so it is loaded instead of the default one. Be sure to inclue your password in your .rc file in both SMTP/IMAP fields:

docker run --rm -ti \
-v /path/to/.muttrc:/data/muttrc \
-e APP_USER=${APP_USER} \
zalgonoise/gasp

~ ZalgoNoise ~ 2020

gasp's People

Contributors

zalgonoise avatar

Stargazers

 avatar

Watchers

James Cloos avatar  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.