Skip to content

Commit

Permalink
CHANGE: Old SOA mbox format no longer a warning (#2191)
Browse files Browse the repository at this point in the history
  • Loading branch information
tlimoncelli committed Mar 17, 2023
1 parent 2796c36 commit 2162e19
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 11 deletions.
6 changes: 4 additions & 2 deletions documentation/functions/domain/SOA.md
Expand Up @@ -30,11 +30,13 @@ D("example.com", REG_THIRDPARTY, DnsProvider("DNS_BIND"),
```
{% endcode %}

The email address should be specified like a normal RFC822/RFC5322 address (user@hostname.com). It will be converted into the required format (e.g. BIND format: `user.hostname.com`) by the provider as required. This has the benefit of being more human-readable plus DNSControl can properly handle escaping and other issues.
If you accidentally include an `@` in the email field DNSControl will quietly
change it to a `.`. This way you can specify a human-readable email address
when you are making it easier for spammers how to find you.

## Notes
* Previously, the accepted format for the SOA mailbox field was `hostmaster.example.org`. This has been changed to `hostmaster@example.org`
* The serial number is managed automatically. It isn't even a field in `SOA()`.
* Most providers automatically generate SOA records. They will ignore any `SOA()` statements.
* The mbox field should not be set to a real email address unless you love spam and hate your privacy.

There is more info about `SOA` in the documentation for the [BIND provider](../../providers/bind.md).
6 changes: 2 additions & 4 deletions documentation/providers/bind.md
Expand Up @@ -42,7 +42,7 @@ In this example we set the default SOA settings and NS records.
var DSP_BIND = NewDnsProvider("bind", {
"default_soa": {
"master": "ns1.example.tld.",
"mbox": "sysadmin.example.tld.",
"mbox": "spamtrap.example.tld.",
"refresh": 3600,
"retry": 600,
"expire": 604800,
Expand All @@ -67,9 +67,7 @@ Because BIND is unique, BIND's SOA support is kind of a hack. It leaves the SOA
1. The serial number: If something in the zone changes, the serial number is incremented (see below).
2. Missing SOAs: If there is no SOA record in a zone (or the zone is being created for the first time), the SOA is created. The initial values are taken from the `default_soa` settings.

The `default_soa` values are only used when creating an SOA for the first time. The values are not used to update an SOA. *Therefore, the only way to change an existing SOA is to edit the zone file.*

There is an effort to make SOA records handled like A, CNAME, and other records. See https://github.com/StackExchange/dnscontrol/issues/1131
The `default_soa` values are only used when creating an SOA for the first time. The values are not used to update an SOA. Most people edit the SOA values by manually editing the zonefile or using the `SOA()` function.


# FYI: SOA serial numbers
Expand Down
7 changes: 2 additions & 5 deletions providers/bind/soa.go
@@ -1,10 +1,10 @@
package bind

import (
"fmt"
"strings"

"github.com/StackExchange/dnscontrol/v3/models"
"github.com/StackExchange/dnscontrol/v3/pkg/soautil"
"strings"
)

func makeSoa(origin string, defSoa *SoaDefaults, existing, desired *models.RecordConfig) (*models.RecordConfig, uint32) {
Expand All @@ -27,9 +27,6 @@ func makeSoa(origin string, defSoa *SoaDefaults, existing, desired *models.Recor
soaMail := firstNonNull(desired.SoaMbox, existing.SoaMbox, defSoa.Mbox, "DEFAULT_NOT_SET.")
if strings.Contains(soaMail, "@") {
soaMail = soautil.RFC5322MailToBind(soaMail)
} else {
fmt.Println("WARNING: SOA hostmaster address must be in the format hostmaster@example.com")
fmt.Println("WARNING: hostmaster.example.com is deprecated and will be dropped in a future version")
}

soaRec.TTL = firstNonZero(desired.TTL, defSoa.TTL, existing.TTL, models.DefaultTTL)
Expand Down

0 comments on commit 2162e19

Please sign in to comment.