Skip to main content

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

[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.

In the LDAP section some more variables then 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

NOT IMPLEMENTED

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

NOT IMPLEMENTED

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

NOT IMPLEMENTED

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>

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

mail_alias_creator-1.0.1.tar.gz (10.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mail_alias_creator-1.0.1-py3-none-any.whl (13.3 kB view details)

Uploaded Python 3

File details

Details for the file mail_alias_creator-1.0.1.tar.gz.

File metadata

  • Download URL: mail_alias_creator-1.0.1.tar.gz
  • Upload date:
  • Size: 10.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.0.10 CPython/3.8.5 Linux/5.4.89

File hashes

Hashes for mail_alias_creator-1.0.1.tar.gz
Algorithm Hash digest
SHA256 f1e853141ad3ac5795084c4f58e98021108027bed2ca0375edca2ad7a7994562
MD5 a25bfbe7fd0991c43dfea6e7d4c9b1c3
BLAKE2b-256 622f94f1eef38c013ae5f879957f2168fc8a342538f8e2ea2bb7cc7b2fcbf694

See more details on using hashes here.

File details

Details for the file mail_alias_creator-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: mail_alias_creator-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 13.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.0.10 CPython/3.8.5 Linux/5.4.89

File hashes

Hashes for mail_alias_creator-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 919730c07d40b336fa59ae449923966e90655892270d834e83528eb200e0ef08
MD5 1c0b7aa56bce18bee1ee0b424db54477
BLAKE2b-256 2dad15f748c8167ef0b53768602b26bf0df5e5c27feeb820c439a28e30011888

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page