Gem Version

postfix_admin

Command Line Tools for Postfix Admin

Description

Requirements

  • Ruby 2.6 or higher
  • MySQL/MariaDB
  • Dovecot (required for setting passwords using the doveadm pw subcommand)

Installation

Install postfix_admin using:

$ gem install postfix_admin

Execute the postfix_admin command to generate your config file at ~/.postfix_admin.conf:

$ postfix_admin

Edit the file for your environment:

$ vi ~/.postfix_admin.conf
---
database: mysql2://postfix:password@localhost/postfix
aliases: 30
mailboxes: 30
maxquota: 100
scheme: CRAM-MD5

The configuration file format is as follows:

database: mysql2://<username>:<password>@<host>/<database>
aliases: Default maximum number of aliases allowed per domain
mailboxes: Default maximum number of mailboxes allowed per domain
maxquota: Default maximum quota (in MB) allowed per mailbox for a domain
scheme: Default password scheme

You can see the domains on your host if the database parameter is set properly:

$ postfix_admin show

Usage

List the postfix_admin subcommands with:

$ postfix_admin
Commands:
  postfix_admin account_passwd [email protected] new_password               # Change the password of an account
  postfix_admin add_account [email protected] password                      # Add a new account
  postfix_admin add_admin [email protected] password                       # Add a new admin user
  postfix_admin add_admin_domain [email protected] example.com             # Grant an admin user access to a specific domain
  postfix_admin add_alias [email protected] [email protected]               # Add a new alias
  postfix_admin add_domain example.com                                     # Add a new domain
  postfix_admin admin_passwd [email protected] new_password                # Change the password of an admin user
  postfix_admin delete_account [email protected]                            # Delete an account
  postfix_admin delete_admin [email protected]                             # Delete an admin user
  postfix_admin delete_admin_domain [email protected] example.com          # Revoke an admin user's access to a specific domain
  postfix_admin delete_alias [email protected]                             # Delete an alias
  postfix_admin delete_domain example.com                                  # Delete a domain
  postfix_admin dump                                                       # Dump all data
  postfix_admin edit_account [email protected]                              # Edit an account
  postfix_admin edit_admin [email protected]                               # Edit an admin user
  postfix_admin edit_alias [email protected]                               # Edit an alias
  postfix_admin edit_domain example.com                                    # Edit a domain
  postfix_admin help [COMMAND]                                             # Describe available commands or one specific command
  postfix_admin log                                                        # Display action logs
  postfix_admin schemes                                                    # List all supported password schemes
  postfix_admin setup example.com password                                 # Set up a domain
  postfix_admin show [example.com | [email protected] | [email protected]]  # Display details about domains, admins, or accounts
  postfix_admin summary [example.com]                                      # Summarize the usage of PostfixAdmin
  postfix_admin version                                                    # Show postfix_admin version