Skip to content

Conversation

@kaganjd
Copy link

@kaganjd kaganjd commented Apr 5, 2021

Ran into an issue where, if the record was inheriting the origin, the parser would set the TTL as a subdomain and the TTL to -1 due to https://github.com/wpalmer/gozone/blob/master/gozone.go#L951

For a file like this:

$ORIGIN example.com.
@                      3600 SOA   ns1.p30.dynect.net. (
                              zone-admin.dyndns.com.     ; address of responsible party
                              2016072701                 ; serial number
                              3600                       ; refresh period
                              600                        ; retry period
                              604800                     ; expire time
                              1800                     ) ; minimum ttl
                    86400 NS    ns1.p30.dynect.net.
                    86400 NS    ns2.p30.dynect.net.
                    86400 NS    ns3.p30.dynect.net.
                    86400 NS    ns4.p30.dynect.net.
                     3600 MX    10 mail.example.com.
                     3600 MX    20 vpn.example.com.
                     3600 MX    30 mail.example.com.
                       60 A     204.13.248.106
                     3600 TXT   "v=spf1 includespf.dynect.net ~all"
mail                  14400 A     204.13.248.106
vpn                      60 A     216.146.45.240
webapp                   60 A     216.146.46.10
webapp                   60 A     216.146.46.11
www                   43200 CNAME example.com.

Output would look like this (I added some extra log lines but you can still see the issue):

SOA Record points to [ns1.p30.dynect.net. ( zone-admin.dyndns.com. 2016072701 3600 600 604800 1800 )] for domain/subdomain example.com. with TTL 3600
NS Record points to [ns1.p30.dynect.net.] for domain/subdomain 86400.example.com. with TTL -1
NS Record points to [ns2.p30.dynect.net.] for domain/subdomain 86400.example.com. with TTL -1
NS Record points to [ns3.p30.dynect.net.] for domain/subdomain 86400.example.com. with TTL -1
NS Record points to [ns4.p30.dynect.net.] for domain/subdomain 86400.example.com. with TTL -1
MX Record points to [10 mail.example.com.] for domain/subdomain 3600.example.com. with TTL -1
MX Record points to [20 vpn.example.com.] for domain/subdomain 3600.example.com. with TTL -1
MX Record points to [30 mail.example.com.] for domain/subdomain 3600.example.com. with TTL -1
A Record points to [204.13.248.106] for domain/subdomain 60.example.com. with TTL -1
TXT Record points to ["v=spf1 includespf.dynect.net ~all"] for domain/subdomain 3600.example.com. with TTL -1
A Record points to [204.13.248.106] for domain/subdomain mail.example.com. with TTL 14400
A Record points to [216.146.45.240] for domain/subdomain vpn.example.com. with TTL 60
A Record points to [216.146.46.10] for domain/subdomain webapp.example.com. with TTL 60
A Record points to [216.146.46.11] for domain/subdomain webapp.example.com. with TTL 60
CNAME Record points to [example.com.] for domain/subdomain www.example.com. with TTL 43200

This PR fixes by updating an existing test to check for this and adds a condition that checks if the token is the TTL.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant