Coder Social home page Coder Social logo

jordan-warne / openbsd-mailserver-ansible Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 46 KB

Ansible playbook that automates setting up an OpenBSD mail server using secure defaults.

License: GNU General Public License v3.0

Jinja 97.76% Sieve 1.82% Shell 0.34% C++ 0.08%

openbsd-mailserver-ansible's Introduction

openbsd-mailserver

Setup mail server using ansible, based on the wonderful guide by TuM'Fatig (Joel Carnat) https://www.tumfatig.net/2023/self-hosted-email-services-on-openbsd/

Requirements

  • Ansible >= 2.7
  • Server with OpenBSD (tested working as of OpenBSD 7.4)
  • SSH key to login to the server
  • Public domain resolving to the server (MX, AAAA and A)

Configuration

  • Dovecot
  • OpenSMTPD
  • RspamD
  • acme-client
  • httpd

Setup your DNS!

A       @       123.123.123.123
AAAA    @       0000:0000:0000:000:00
A       mail    123.123.123.123
AAAA    mail       0000:0000:0000:000:00
A       mta-sts    123.123.123.123
AAAA    mta-sts       0000:0000:0000:000:00
MX      @       mail.example.com

SPF domain rules

TXT     @       v=spf1 mx:example.com -all ~all

DMARC domain policy

TXT     _dmarc       v=DMARC1; p=reject; adkim=s; aspf=s;

MTA-STS and TLSRPT policies

You can use the current date as the mta-sts ID

TXT     _mta-sts        v=STSv1; id=20190811231231

Make sure to edit the reporting address to a address you control

TXT     _smtp._tls      v=TLSRPTv1; rua=mailto:[email protected]

Inventory

Set the hostname in the inventory file hosts

Variables

All variables are stored in the vars file. Set the values according to your server.

Run the playbook

ansible-playbook install.yml

Set your DKIM DNS

The playbook will generate the DKIM DNS, check this file for what to enter in your DNS

/etc/mail/dkim-dns-example.txt

Don't skip this step unless you want to go to the spam folder.

Setup DANE email security

Make sure to enable DNSSEC at your domain provider!

Now you need to create a TLSA record, you can use this tool to generate one:

https://www.huque.com/bin/gen_tlsa

Use the public key from your domain to generate the TLSA record.

  • Usage field: DANE-EE
  • Selector field: SPKI
  • Matching type field: SHA-256: SHA-256 hash
  • Port: 25
  • Transport protocol: tcp
  • Domain name: (your mail server fqdn)

Check rspamd reporting

You can use the rspamd web GUI to view spam:

# ssh -L 11334:localhost:11334 <mail server>

Browse to http://localhost:11334/

Contributions

Contributions welcome

Credits

Check out these articles and tutorials that I used to create this Ansible-Playbook

openbsd-mailserver-ansible's People

Contributors

jordan-warne avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.