2017-11-02 20:05:12 +01:00
Mailu command line
==================
Managing users and aliases can be done from CLI using commands:
* alias
2019-01-24 22:38:09 +01:00
* alias-delete
2019-02-13 10:53:40 +01:00
* domain
2019-07-08 10:35:59 +02:00
* password
2017-11-02 20:05:12 +01:00
* user
2019-01-24 22:38:09 +01:00
* user-import
* user-delete
2020-08-26 23:23:03 +02:00
* config-dump
2019-01-24 22:38:09 +01:00
* config-update
2017-11-02 20:05:12 +01:00
alias
-----
.. code-block :: bash
2018-11-08 21:35:41 +01:00
docker-compose exec admin flask mailu alias foo example.net "mail1@example.com,mail2@example.com"
2017-11-02 20:05:12 +01:00
2019-01-24 22:38:09 +01:00
alias-delete
2017-11-02 20:05:12 +01:00
------------
.. code-block :: bash
2019-01-24 22:38:09 +01:00
docker-compose exec admin flask mailu alias-delete foo@example.net
2017-11-02 20:05:12 +01:00
2019-02-13 10:53:40 +01:00
domain
2019-08-27 10:34:46 +03:00
------
2019-02-13 10:53:40 +01:00
.. code-block :: bash
docker-compose exec admin flask mailu domain example.net
2019-07-08 10:35:59 +02:00
password
--------
.. code-block :: bash
docker-compose exec admin flask mailu password myuser example.net 'password123'
2017-11-02 20:05:12 +01:00
user
----
.. code-block :: bash
2019-02-13 10:30:08 +01:00
docker-compose exec admin flask mailu user myuser example.net 'password123'
2017-11-02 20:05:12 +01:00
2019-01-24 22:38:09 +01:00
user-import
2017-11-02 20:05:12 +01:00
-----------
primary difference with simple `user` command is that password is being imported as a hash - very useful when migrating users from other systems where only hash is known.
.. code-block :: bash
2019-02-09 15:12:24 +01:00
docker-compose run --rm admin flask mailu user-import myuser example.net '$6$51ebe0cb9f1dab48effa2a0ad8660cb489b445936b9ffd812a0b8f46bca66dd549fea530ce' 'SHA512-CRYPT'
2017-11-02 20:05:12 +01:00
2019-01-24 22:38:09 +01:00
user-delete
2020-08-26 23:23:03 +02:00
-----------
2017-11-02 20:05:12 +01:00
.. code-block :: bash
2019-01-24 22:38:09 +01:00
docker-compose exec admin flask mailu user-delete foo@example.net
2017-11-02 20:05:12 +01:00
2020-08-26 23:23:03 +02:00
config-dump
-----------
The purpose of this command is to dump domain-, relay-, alias- and user-configuration to a YAML template.
2020-09-04 12:57:40 +02:00
.. code-block :: bash
# docker-compose exec admin flask mailu config-dump --help
Usage: flask mailu config-dump [OPTIONS]
dump configuration as YAML-formatted data to stdout
Options:
-f, --full Include default attributes
-s, --secrets Include secrets (plain-text / not hashed)
--help Show this message and exit.
If you want to export secrets (plain-text / not hashed) you have to add the `` --secrets `` option.
Only non-default attributes are dumped. If you want to dump all attributes use `` --full `` .
2020-08-26 23:23:03 +02:00
.. code-block :: bash
docker-compose exec admin flask mailu config-dump > mail-config.yml
2019-01-24 22:38:09 +01:00
config-update
2017-11-02 20:05:12 +01:00
-------------
2020-08-26 23:23:03 +02:00
The purpose of this command is for importing domain-, relay-, alias- and user-configuration in bulk and synchronizing DB entries with an external YAML template.
2017-11-02 20:05:12 +01:00
2020-09-04 12:57:40 +02:00
.. code-block :: bash
# docker-compose exec admin flask mailu config-update --help
Usage: flask mailu config-update [OPTIONS]
sync configuration with data from YAML-formatted stdin
Options:
-v, --verbose Increase verbosity
-d, --delete-objects Remove objects not included in yaml
-n, --dry-run Perform a trial run with no changes made
--help Show this message and exit.
The current version of docker-compose exec does not pass stdin correctly, so you have to user docker exec instead:
2017-11-02 20:05:12 +01:00
.. code-block :: bash
2020-08-26 23:23:03 +02:00
docker exec -i $(docker-compose ps -q admin) flask mailu config-update -nvd < mail-config.yml
2017-11-02 20:05:12 +01:00
2020-09-04 12:57:40 +02:00
mail-config.yml looks like this:
2020-08-26 23:23:03 +02:00
.. code-block :: yaml
domains:
- name: example.com
alternatives:
- alternative.example.com
2017-11-02 20:05:12 +01:00
users:
2020-08-26 23:23:03 +02:00
- email: foo@example.com
2017-11-02 20:05:12 +01:00
password_hash: klkjhumnzxcjkajahsdqweqqwr
hash_scheme: MD5-CRYPT
aliases:
2020-08-26 23:23:03 +02:00
- email: alias1@example.com
2017-11-02 20:05:12 +01:00
destination: "user1@example.com,user2@example.com"
2020-08-26 23:23:03 +02:00
relays:
- name: relay.example.com
comment: test
smtp: mx.example.com
2017-11-02 20:05:12 +01:00
2020-08-27 16:10:53 +02:00
You can use `` --dry-run `` to test your YAML without comitting any changes to the database.
2020-08-26 23:23:03 +02:00
With `` --verbose `` config-update will show exactly what it changes in the database.
2020-09-04 12:57:40 +02:00
Without `` --delete-object `` option config-update will only add/update changed values but will *not* remove any entries missing in provided YAML input.
2017-11-02 20:05:12 +01:00
2020-08-26 23:23:03 +02:00
This is a complete YAML template with all additional parameters that could be defined:
2017-11-02 20:05:12 +01:00
2020-08-26 23:23:03 +02:00
.. code-block :: yaml
aliases:
- email: email@example.com
comment: ''
destination:
- address@example.com
wildcard: false
domains:
- name: example.com
alternatives:
- alternative.tld
comment: ''
dkim_key: ''
max_aliases: -1
max_quota_bytes: 0
max_users: -1
signup_enabled: false
relays:
- name: relay.example.com
comment: ''
smtp: mx.example.com
users:
- email: postmaster@example.com
comment: ''
displayed_name: 'Postmaster'
enable_imap: true
enable_pop: false
enabled: true
fetches:
- id: 1
comment: 'test fetch'
username: fetch-user
host: other.example.com
password: 'secret'
port: 993
protocol: imap
tls: true
keep: true
forward_destination:
- address@remote.example.com
forward_enabled: true
forward_keep: true
global_admin: true
manager_of:
- example.com
password: '{BLF-CRYPT}$2b$12$...'
quota_bytes: 1000000000
reply_body: ''
reply_enabled: false
reply_enddate: 2999-12-31
reply_startdate: 1900-01-01
reply_subject: ''
spam_enabled: true
spam_threshold: 80
tokens:
- id: 1
comment: email-client
ip: 192.168.1.1
password: '$5$rounds=1000$...'
2017-11-02 20:05:12 +01:00