Перейти к основному содержимому

Ansible deployment

Reference for a Colander server deployed with the colander-ansible playbooks. To deploy one, see Deploy Colander on a server with Ansible.

Playbooks​

Run them from the colander-ansible folder: ansible-playbook -i production.yml playbooks/<playbook>.

PlaybookDescription
install-docker.ymlInstalls Docker on the server, in rootless mode.
generate-configuration.ymlGenerates the configuration vault group_vars/colander/vault. Accepts --extra-vars "root_domain=<domain>".
colander.ymlConfigures and deploys Colander. Equivalent to configure-colander.yml followed by deploy-colander.yml.
configure-colander.ymlConfigures Colander on the server.
deploy-colander.ymlDeploys the stack and creates the administrator accounts.
backup-colander.ymlCreates a backup on the server.
sanity-checks.ymlChecks that the DNS records of the services exist. The deployment playbooks run the same checks first.
teardown-colander.ymlPermanently deletes Colander, its data, its backups and its configuration.

Inventory file​

production.yml, created from production-example.yml:

production.yml
colander:
hosts:
production:
ansible_host: [IP address of the server]
ansible_user: colander
ansible_ssh_private_key_file: [path of your SSH private key]

Per-host customization​

host_vars/production.yml, created from host_vars/production-example.yml, overrides the default configuration of the host. It is optional.

SettingDefaultDescription
stack_overrides.flavor.use_threatrTrueDeploys Threatr.
stack_overrides.flavor.use_cyberchefTrueDeploys CyberChef.
stack_overrides.flavor.use_mandolinTrueDeploys Mandolin, which analyzes the uploaded artifacts.
stack_overrides.flavor.use_playwrightTrueDeploys Playwright, which takes the screenshots of URLs and captures their HAR files.
stack_overrides.services.elasticsearch.xmsInitial memory allocated to Elasticsearch, for instance 512m.
stack_overrides.services.elasticsearch.xmxMaximum memory allocated to Elasticsearch, for instance 512m.
host_vars/production.yml
stack_overrides:
flavor:
use_threatr: True
use_cyberchef: False
use_mandolin: False
use_playwright: True
services:
elasticsearch:
xms: 512m
xmx: 512m

Configuration vault​

group_vars/colander/vault, generated by generate-configuration.yml. The values marked randomly generated are created by the playbook; the email settings must be filled in by hand. Encrypt the file with ansible-vault encrypt group_vars/colander/vault, and never modify it after the deployment.

group_vars/colander/vault
colander_vault:
# Email
acme_email: "machines@my.domain"
admin_name: "Badass Admin"
admin_email: "admin@my.domain"
django_default_from_email: "admin@my.domain"
email_host: "smtp.my.provider.com"
email_host_user: "machines@my.domain"
email_host_password: "password"
email_port: 465
email_use_tls: false
email_use_ssl: true

# Domains & sub-domains
root_domain: "my.domain"
colander_base_url: "https://colander.my.domain"
colander_django_allowed_hosts: "colander.my.domain"
colander_fqdn: "colander.my.domain"
threatr_base_url: "https://threatr.my.domain"
threatr_django_allowed_hosts: "threatr.my.domain"
threatr_fqdn: "threatr.my.domain"
cyberchef_base_url: "https://cyberchef.my.domain"
cyberchef_fqdn: "cyberchef.my.domain"
traefik_base_url: "https://traefik.my.domain"
traefik_fqdn: "traefik.my.domain"

# Traefik
traefik_auth_salt: "randomly generated"
traefik_admin_user: "admin"
traefik_admin_password: "randomly generated"

# Colander
colander_django_secret_key: "randomly generated"
colander_django_admin_url: "randomly generated"
colander_postgres_user: "randomly generated"
colander_postgres_password: "randomly generated"
colander_admin_user: "admin"
colander_admin_password: "randomly generated"

# Threatr
threatr_django_secret_key: "randomly generated"
threatr_django_admin_url: "randomly generated"
threatr_postgres_user: "randomly generated"
threatr_postgres_password: "randomly generated"
threatr_admin_user: "admin"
threatr_admin_password: "randomly generated"

# Minio
minio_access_key: "randomly generated"
minio_secret_key: "randomly generated"
VariableDescription
acme_emailEmail address passed to Let's Encrypt.
admin_nameFull name of the server administrator.
admin_emailEmail address the crash reports are sent to.
django_default_from_emailEmail address used to send emails.
email_host, email_portHost and port of the SMTP server.
email_host_user, email_host_passwordCredentials for the SMTP server.
email_use_tls, email_use_ssltrue when the SMTP server uses TLS, respectively SSL.
colander_django_admin_url, threatr_django_admin_urlRandom path of the administration panels: ${colander_base_url}/${colander_django_admin_url} and ${threatr_base_url}/${threatr_django_admin_url}.
colander_admin_user, colander_admin_passwordAdministrator account of Colander, created by the deployment.
threatr_admin_user, threatr_admin_passwordAdministrator account of Threatr, created by the deployment.

DNS records​

An A record pointing to the public IP address of the server is required for each subdomain:

SubdomainRequired
colander.[root domain]Always
threatr.[root domain]When Threatr is deployed
cyberchef.[root domain]When CyberChef is deployed
traefik.[root domain]Always

Files on the server​

PathContent
/home/colander/colanderInstallation folder
/home/colander/colander/docker-compose.ymlDocker Compose file of the stack
/home/colander/colander/volumesDocker volumes
/home/colander/colander/backupsBackups, one folder per backup
/home/colander/colander/scripts/backupBackup script
/home/colander/colander/scripts/restoreRestore script, takes the name of a backup folder

Backups​

Each backup folder is named after the date and time of the backup and contains:

  • a dump of the Colander database
  • a dump of the Threatr database, when Threatr is deployed
  • a snapshot of the Elasticsearch indices
  • an archive of all the files stored in Minio
/home/colander/colander/backups/
`-- 2025_02_18-13_47_01
|-- colander-db
| `-- backup_2025_02_18T13_47_02.sql.gz
|-- elasticsearch
| `-- elasticsearch-2025_02_18-13_47_03.tgz
|-- minio
| `-- minio-2025_02_18-13_47_03.tgz
`-- threatr-db
`-- backup_2025_02_18T13_47_03.sql.gz

Log fields​

The logs of the containers are sent to journald and tagged with the following fields:

FieldDescriptionExample
IMAGE_NAMEName of the Docker imageghcr.io/piroguetoolsuite/colander:main
CONTAINER_NAMEName of the containercolander-colander-front-1
COLANDER_SERVICE_NAMEName of the servicecolander-front
COLANDER_SERVICE_TYPEType of serviceweb

The values are defined in the Docker Compose file installed on the server.

Authentication failures​

Every authentication failure is logged in journald with the following format:

<date> <hostname> <container>: ERROR <date> signals 19 <timestamp> COLANDER_AUTH_FAILURE username:[<user>] email:[<email address>] ip:[<IP address of the client>] datetime:[<date>] routable:[<True if the IP address is public, False otherwise>]