Configure the mail server

This guide contains:

The basics of your mail server configuration

To configure the mail server you'll need to:

  1. Grab a copy of the /opt/dradispro/dradispro/current/config/smtp.yml.template file and copy it to /opt/dradispro/dradispro/shared/config/ as smtp.yml (remove ".template").

    To do this, you can run the following command as dradispro:

    cp /opt/dradispro/dradispro/current/config/smtp.yml.template /opt/dradispro/dradispro/shared/config/smtp.yml
  2. Edit the contents of the new file. The file itself will walk you through how to configure the mail server.

  3. Add a symlink to the file in the config directory by running the following in the command line as dradispro:

    ln -s /opt/dradispro/dradispro/shared/config/smtp.yml /opt/dradispro/dradispro/current/config/
  4. Restart the app processes by running the following:

    god restart

Now, your Dradis instance should be ready to send out password reset emails or email digests. Since this change is not a local change, it will survive future upgrades!

Sample Gmail configuration

A sample for using your personal gmail account as smtp server:

default: &default
  default_url_options:
    host:         https://dradis.dev
    script_name:  '/pro'
  default_options:
    from:     from@dradis.dev
    reply_to: reply@dradis.dev
  smtp_settings:
    address:               smtp.gmail.com
    port:                  587
    domain:                dradis.com
    user_name:             example@gmail.com
    password:              insecure!!
    authentication:        plain
    enable_starttls_auto:  true
    openssl_verify_mode:   none

A sample for using an account in your Gsuite with custom domain as smtp server:

default: &default
  default_url_options:
    host:         https://dradis.dev
    script_name:  '/pro'
  default_options:
    from:     from@dradis.dev
    reply_to: reply@dradis.dev
  smtp_settings:
    address:               smtp.gmail.com
    port:                  587
    domain:                example.com
    user_name:             example@example.com
    password:              gsuite gmail account password
    authentication:        plain
    enable_starttls_auto:  true
    openssl_verify_mode:   none

As of July 15, 2014, Google increased its security measures and now blocks attempts from apps it deems less secure. You can change your Gmail settings here to allow the attempts.

If your Gmail account has 2-factor authentication enabled, then you will need to set an app password and use that instead of your regular password. (source: https://guides.rubyonrails.org/action_mailer_basics.html)

Also note that when trying to use a Gsuite account with a custom domain with 2FA enabled and an app password, we still needed to choose the option Allow users to manage their acccess to less secure appsin the gsuite admin panel, under Security > Basic Settings > Less secure apps:

Even with Less secure apps turned off for the account sending the mails, without that option selected, emails may not be sent, and you may keep seeing this error:

Net::SMTPAuthenticationError (535-5.7.8 Username and Password not accepted.)

Sample Outlook365 configuration

This configuration has been reported to work for several teams using Outlook365 as their mail server. You'll want to edit at least the domain, user_name, and password below to match your organization's values:

# This file is a template for configuring SMTP for Dradis. The actual settings
# will be read from config/smtp.yml.
# For a guide in configuring the mailer and a full list of options, see:
# https://guides.rubyonrails.org/action_mailer_basics.html#action-mailer-configuration

default: &default
  default_url_options:
    host:         https://dradis.dev
    script_name:  '/pro'
  default_options:
    from:     from@dradis.dev
    reply_to: reply@dradis.dev
  smtp_settings:
    address:               smtp.office365.com
    port:                  587
    domain:                starfleet.com
    user_name:             username
    password:              password
    authentication:        login
    enable_starttls_auto:  true
    openssl_verify_mode:   none

development:
  <<: *default

test:
  <<: *default

production:
  <<: *default

Sample Amazon Simple Email Service (SES) configuration

This configuration has bee reported to work for several teams using Amazon Simple Email Service (SES) for their mail server. You'll want to edit at least the address, domain, user_name, and password below to match your organization's values:

# This file is a template for configuring SMTP for Dradis. The actual settings
# will be read from config/smtp.yml.
# For a guide in configuring the mailer and a full list of options, see:
# https://guides.rubyonrails.org/action_mailer_basics.html#action-mailer-configuration


default: &default
  default_url_options:
    host:         https://dradis.dev
    script_name:  '/pro'
  default_options:
    from:     from@dradis.dev
    reply_to: reply@dradis.dev
  smtp_settings:
    address:              email-smtp.region.amazonaws.com
    port:                 465
    domain:               dradis.com
    user_name:            username
    password:             password
    authentication:       plain
    enable_starttls:      false
    enable_starttls_auto: false
    openssl_verify_mode:  peer
    tls:                  true

development:
  <<: *default

test:
  <<: *default

production:
  <<: *default

Troubleshooting the mail server

The easiest way to troubleshoot any issues with the mail server is to trigger an email via the command line by running the following as dradispro:

$ cd /opt/dradispro/dradispro/current
$ RAILS_ENV=production bin/rails console
> ActionMailer::Base.mail(
from: "mail@example.com",
to: "destination@example.com",
subject: "Test",
body: "Test"
).deliver_now

The command line output should give you an idea of the underlying issue with the mail server. Please send this output to our support team if you need additional help!

Streamline InfoSec Project Delivery

Learn practical tips to reduce the overhead that drags down security assessment delivery with this 5-day course. These proven, innovative, and straightforward techniques will optimize all areas of your next engagement including:

  • Scoping
  • Scheduling
  • Project Planning
  • Delivery
  • Intra-team Collaboration
  • Reporting and much more...

Your email is kept private. We don't do the spam thing.