mailinabox

package module
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 2, 2025 License: MIT Imports: 3 Imported by: 0

README

Mail-In-A-Box custom DNS API module for Caddy

This package contains a DNS provider module for Caddy. It can be used to manage DNS records with Mail-In-A-Box.

Caddy Mail-In-A-Box

dns.providers.mailinabox

Config examples

To use this module for the ACME DNS challenge, configure the ACME issuer in your Caddy JSON like so:

{
	"module": "acme",
	"challenges": {
		"dns": {
			"provider": {
				"name": "mailinabox",
				"api_url": "https://[your main-in-a-box domain name]/admin"
                "email_address": "{$MIAB_EMAIL}"
                "password": "{$MIAB_PASS}"
                "totp_secret": "{TOTP_SECRET}" 
			}
		}
	}
}

Note that the TOTP secret only has to be provided if you have enabled multi factor authentication on the admin account you're using to access the dns api.

or with the Caddyfile:

# globally
{
	acme_dns mailinabox {
        api_url https://[your main-in-a-box domain name]/admin
        email_address {$MIAB_EMAIL}
        password {$MIAB_PASS}
        totp_secret {$TOTP_SECRET} 
    }
}
# wild card
*.[your-root-domain] {
	tls {
		dns mailinabox {
			api_url https://[your box domain name]/admin
			email_address {$MIAB_EMAIL}
			password {$MIAB_PASS}
                        totp_secret        {$TOTP_SECRET} 
		}
	}

	@subdomain host subdomain.[your-root-domain]
	handle @subdomain {
        response "Hello on subdomain"
	}
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Provider

type Provider struct{ *mailinabox.Provider }

Provider lets Caddy read and manipulate DNS records hosted by this DNS provider.

func (Provider) CaddyModule

func (Provider) CaddyModule() caddy.ModuleInfo

CaddyModule returns the Caddy module information.

func (*Provider) Provision

func (p *Provider) Provision(ctx caddy.Context) error

Provision sets up the module. Implements caddy.Provisioner.

func (*Provider) UnmarshalCaddyfile

func (p *Provider) UnmarshalCaddyfile(d *caddyfile.Dispenser) error

UnmarshalCaddyfile sets up the DNS provider from Caddyfile tokens. Syntax:

mailinabox {
    api_url <api_url>
    email_address <email_address>
    password <password>
    totp_secret <totp_secret>
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL