Set of python scripts to create our mail alias tables from alias definitions
Project description
mail_alias_creator
A python program to create our mail alias tables from alias definitions
Configuration
A configuration file is needed to configure this software.
By default it looks for mac.conf
in the current working directory,
but this can be changed by the -c
command line option or the MAC_CONFIG
environment variable.
The configuration file is read by python configparser and must adhere to its format.
A typical configuration file looks like this:
[main]
logging_conf = logging.conf
strict = false
check_syntax_only = false
dummy_sender_uid = mydummy
dummy_recipient_address = mydummy@example.com
[LDAP]
uri = ldaps://myldap.com
user_search_base = ou=users,dc=example,dc=com
group_search_base = ou=groups,dc=example,dc=com
user_filter = (objectClass=posixUser)
group_filter = (objectClass=posixGroup)
user_uid_field = uid
user_primary_mail_field = mail
group_id_field = cn
group_membership_field = memberUid
The logging_conf
is file path relative to the main configuration file (or absolute). At this path should be a python logging.conf
compatible logging configuration. This option may be omitted.
The strict
flag enables strict checking of the inputs. In this case the program exits with a non-zero exit code when a possible problem with the given files is detected. This option may be omitted, which set's it to false.
The check_syntax_only
flag can be used to abort the program after loading the alias files. This option may be omitted, which set's it to false.
The dummy_sender_uid
and dummy_recipient_address
fields are optional.
It is also possible to set one and omit the other
If set to a non-empty string the respective uid or address is used for all aliases that are defined but do not have an actual sender or recipient (this can be the case if the primary mail of a user can't be found, a group is empty, the forbidSend
or forbidReceive
flags are used or for the sender of an alias which only has entries of the external_address
kind).
This can be used to make sure the alias still appears in the generated lists giving the mail processing system the ability to
react accordingly.
In the LDAP section some more variables than shown are supported. For a complete list and some explanations see ldap.py.
Alias defintion format
All given files and all files (recursively) in given folders are parsed as yaml files.
Each file must be of the following format:
meta:
name: <name of the file>
description: <description of the file>
aliases:
<alias_mail>:
description: <description of the alias>
entries:
- kind: <kind>
...
- kind: <kind2>
...
<alias_mail2> ...
...
Alias entry kind
The following kinds of alias entries are currently supported.
User
The user alias kind can be used to allow users to send and receive emails to/from this alias.
Kind name: user
Format:
- kind: user
user: <username>
Optional attribues
The following optional attributes may be added.
name | default | description |
---|---|---|
forbidSend |
False |
Forbid the user to send via this alias. |
forbidReceive |
False |
Don't foward incoming mails to that user. |
Group
The group alias kind can be used to allow a whole group to send and receive emails to/from this alias.
Kind name: group
Format:
- kind: group
group: <groupname>
Optional attribues
The following optional attributes may be added.
name | default | description |
---|---|---|
forbidSend |
False |
Forbid the group to send via this alias. |
forbidReceive |
False |
Don't foward incoming mails to the users of this group. |
Include alias
The include alias kind can be used to include another alias in this alias. As the argument another alias defined in this repo must be given. Every recipient from that given alias is also forwared incoming mails to this alias. Every sender from that given alias send mails via this alias. If the given address is not an alias defined in this repo there will be an error.
Kind name: include_alias
Format:
- kind: include_alias
alias: <alias address>
Optional attribues
The following optional attributes may be added.
name | default | description |
---|---|---|
forbidSend |
False |
Forbid the members of the given alias to send via this alias. |
forbidReceive |
False |
Don't foward incoming mails to the members of the given alias. |
External address
The external address kind can be used to forward mails to external email addresses. Sending is not possible for entries with this kind.
Kind name: external_address
Format:
- kind: external_address
address: <email address>
Optional attribues
Even though they do not make much sense, the following optional attributes may be added.
name | default | description |
---|---|---|
forbidSend |
False |
Forbid the members of the given alias to send via this alias. |
forbidReceive |
False |
Don't foward incoming mails to the members of the given alias. |
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file mail_alias_creator-1.2.0.tar.gz
.
File metadata
- Download URL: mail_alias_creator-1.2.0.tar.gz
- Upload date:
- Size: 11.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.7.1 CPython/3.11.6 Linux/6.1.68
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 042dc316c9ff6d0ef4e3c88e0183672d2f6c0d6d995918f7ca5f0f1ab5629657 |
|
MD5 | c7d68e65004b9f203e4d593ecbcde586 |
|
BLAKE2b-256 | 6fda768d5165cc933633144067b63dff5adeeaa329c93ecfea4a5ebbfa0e93bd |
File details
Details for the file mail_alias_creator-1.2.0-py3-none-any.whl
.
File metadata
- Download URL: mail_alias_creator-1.2.0-py3-none-any.whl
- Upload date:
- Size: 14.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.7.1 CPython/3.11.6 Linux/6.1.68
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4ae9a4f8aed3a988cddad35b864598911cedcc087b1db846ae912eec660fb20f |
|
MD5 | bbbb893eed0430145620b9516656b31f |
|
BLAKE2b-256 | 22e8ac0d237fb0fc27019e5feb30bb49bb0e239484c45bb094ef696fb596682a |