Coder Social home page Coder Social logo

postlite's Introduction

Postlite

A set of commands to manipulate a postfix sqlite database. Supports adding users, domains and aliases and creating the DB schema.

Install

  1. Clone the repository

    $ git clone https://github.com/bkutil/postlite.git ~/.postlite
  2. Make sure ~/.postlite/bin is in your $PATH (use .bashrc on Debian/Ubuntu and .zshrc for ZSH):

    $ echo 'export PATH="$HOME/.postlite/bin:$PATH"' >> ~/.bash_profile
  3. Add postlite init to your shell to enable autocompletion.

    $ echo 'eval "$(postlite init -)"' >> ~/.bash_profile
  4. Restart the shell

  5. Create ~/.postliterc and configure path to your Postfix sqlite DB:

    POSTLITE_DB=/etc/postfix/postfix.db

  6. Run postlite db init to create the database and schema

Pre-requisites

Sqlite

Sqlite3 command line client needs to be installed.

Dovecot

doveadm pw is used to hash/prompt for user passwords.

Postfix maps

Postfix needs to be configured to use following virtual maps via main.cf:

sqlite-virtual-alias-maps.cf

dbpath = /etc/postfix/postfix.db
query = SELECT destination FROM virtual_aliases WHERE source='%s'

sqlite-virtual-mailbox-domains.cf

dbpath = /etc/postfix/postfix.db
query = SELECT 1 FROM virtual_domains WHERE name='%s'

sqlite-virtual-mailbox-maps.cf

dbpath = /etc/postfix/postfix.db
query = SELECT 1 FROM virtual_users WHERE email='%s'

Dovecot SQL conf

Dovecot needs to be configured to use sqlite as it's backend and use this password query:

dovecot-sql.conf.ext

driver = sqlite
connect = /etc/postfix/postfix.db
default_pass_scheme = SHA512-CRYPT
password_query = \
  SELECT email as user, password \
    FROM virtual_users WHERE email = '%u'

postlite's People

Contributors

bkutil avatar

Stargazers

 avatar  avatar

Watchers

 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.