Skip to content

Monitor the reputation of your mail server IPs with ease.

License

Notifications You must be signed in to change notification settings

trustedshops-public/mail-blocklist-monitor

Repository files navigation

mail-blocklist-monitor

GitHub License pre-commit CircleCI codecov semantic-release

Monitor the reputation of your mail server IPs with ease.

Features

  • Monitor your server IP reputation on common block lists
  • Specify the IPs with AWS SES or env variable
  • Export findings to PagerDuty alerts and more
  • Easily extendable plugin architecture
  • Ready to use terraform modules for AWS

Usage

Terraform

# Create lambda resources
module "monitor" {
  source = "github.com/trustedshops-public/mail-blocklist-monitor//terraform/modules/lambda?ref=<version>"

  environment_variables = {
    LOG_LEVEL                          = "INFO"
    MAX_CLASSIFICATION                 = "yellow"
    EXPORTER_PAGERDUTY_ENABLED         = "true"
    EXPORTER_PAGERDUTY_INTEGRATION_KEY = local.pagerduty_integration_key
    # just pull ips from ses in the example
    IP_PROVIDER_SES_REGIONS            = "eu-central-1,eu-west-1"
  }

  create_cloudwatch_alarm = true
}

# Execute lambda every day
module "cron" {
  source               = "github.com/trustedshops-public/mail-blocklist-monitor//terraform/modules/cron?ref=<version>"
  lambda_arn           = module.monitor.lambda_arn
  lambda_function_name = module.monitor.lambda_function_name
}

See monitor/README.md for all configuration environment variables

Standalone

  1. Download the latest binary for your supported platform from GitHub releases
  2. Configure the monitor using environment variables (see monitor/README.md) for more details
    1. Make sure ENVIRONMENT is set to standalone
  3. Execute the binary with crontab, manually etc

Motivation

There are some paid tools out there or even some board resources for some providers. But none satisfied our needs so we built a small customizable solution to make monitoring easy and effortless. It integrates well with PagerDuty and requires no maintenance.

Components

This project consists of two parts:

  • monitor: Go application (to be run in AWS Lambda or standalone) with plugin architecture that checks again block lists, getting IPs from sources and exporting to targets (e. g. PagerDuty incidents).
  • terraform modules: Terraform modules to easily deploy the monitor using AWS Serverless ecosystem.

The monitor is built using a plugin architecture. So if you need additional sources, targets and exporters feel free to create a PR or fork to customize to match your demands.

Development

Prerequisites

Required Tools

Name Version
Go 1.20+
terraform 1.3+
pre-commit *