asc.xhack.services_mailcow role – Deploy the mailcow mail server for mail-security exercises

Note

This role is part of the asc.xhack collection (version 2.0.0).

It is not included in ansible-core. To check whether it is installed, run ansible-galaxy collection list.

To install it use: git clone git@ssh.dev.azure.com:v3/cloudasc/iac-ansible-collections/xhack $HOME/.ansible/collections/ansible_collections/asc/xhack.

To use it in a playbook, specify: asc.xhack.services_mailcow.

Entry point main – Deploy the mailcow mail server for mail-security exercises

Synopsis

  • Deploys a dockerised mailcow mail server on a VM, published as mail.<internal_domain> in the shared private DNS zone.

  • Hosts the @mail.xhack student mailboxes from files/users.csv and is the SMTP server the MP Bank app (lab_mpbank) sends its mails through.

Parameters

Parameter

Comments

services_mailcow_config

dictionary

‘services_mailcow’ role configuration

enabled

boolean

Whether to enable the ‘services_mailcow’ role

Choices:

  • false ← (default)

  • true

mailcow__config_api_allow_from

string

Extra comma-separated IPs allowed to call the Mailcow API; localhost and the docker gateway the role calls from are always allowed

Default: "127.0.0.1"

mailcow__config_api_key

string

Mailcow API key (read-write)

Default: "DUPIE73p839z38hGDUIDHEudp82"

mailcow__config_api_key_read_only

string

Mailcow API key (read-only)

Default: "DFGjhsajdg32186FGKDft7e2"

mailcow__config_doveadm_port

string

Bind address:port for the Doveadm admin socket (host-local by default)

Default: "127.0.0.1:19991"

mailcow__config_imap_port

integer

IMAP port exposed by the mailcow stack

Default: 143

mailcow__config_pop_port

integer

POP3 port exposed by the mailcow stack

Default: 110

mailcow__config_pops_port

integer

POP3S port exposed by the mailcow stack

Default: 995

mailcow__config_redis_port

string

Bind address:port for the Redis container port (host-local by default)

Default: "127.0.0.1:7654"

mailcow__config_sieve_port

integer

ManageSieve port exposed by the mailcow stack

Default: 4190

mailcow__config_smtp_port

integer

SMTP port exposed by the mailcow stack

Default: 25

mailcow__config_smtps_port

integer

SMTPS (implicit TLS) port exposed by the mailcow stack

Default: 465

mailcow__config_solr_port

string

Unused (current mailcow has no Solr); kept so existing configs still validate

Default: "127.0.0.1:18983"

mailcow__config_sql_port

string

Bind address:port for the MySQL container port (host-local by default)

Default: "127.0.0.1:13306"

mailcow__config_submission_port

integer

SMTP submission (STARTTLS) port exposed by the mailcow stack

Default: 587

mailcow__install_path

string

Install path for the mailcow-dockerized stack on the VM

Default: "/opt/mailcow-dockerized"

mcusers_tmp_file_path

string

Unused (mailboxes are created through the API directly); kept so existing configs still validate

Default: "/home/mailcow01/anstmp"

vm_name

string

Name of the VM

Default: "vmmailcow01"

vm_size

string

Size of the VM to deploy (Azure VM size)

Default: "Standard_B2as_v2"

services_mailcow_docker_compose_project_name

string

Docker Compose project name used for the mailcow stack

Default: "mailcowdockerized"

Authors

  • Ignace De Cock