Skip to content

Commit

Permalink
CNR Provider: Review CI / Docs / Capabilities (add NAPTR, SSHFP) (#3241)
Browse files Browse the repository at this point in the history
Co-authored-by: Kai Schwarz <[email protected]>
Co-authored-by: AsifNawaz-cnic <[email protected]>
  • Loading branch information
3 people authored Dec 13, 2024
1 parent e2cf886 commit 0b85cf2
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ changelog:
regexp: "(?i)^.*(major|new provider|feature)[(\\w)]*:+.*$"
order: 1
- title: 'Provider-specific changes:'
regexp: "(?i)((akamaiedge|autodns|axfrd|azure|azure_private_dns|bind|bunnydns|cloudflare|cloudflareapi_old|cloudns|cscglobal|desec|digitalocean|dnsimple|dnsmadeeasy|doh|domainnameshop|dynadot|easyname|exoscale|gandi|gcloud|gcore|hedns|hetzner|hexonet|hostingde|huaweicloud|inwx|linode|loopia|luadns|msdns|mythicbeasts|namecheap|namedotcom|netcup|netlify|ns1|opensrs|oracle|ovh|packetframe|porkbun|powerdns|realtimeregister|route53|rwth|sakuracloud|softlayer|transip|vultr).*:)+.*"
regexp: "(?i)((akamaiedge|autodns|axfrd|azure|azure_private_dns|bind|bunnydns|cloudflare|cloudflareapi_old|cloudns|cnr|cscglobal|desec|digitalocean|dnsimple|dnsmadeeasy|doh|domainnameshop|dynadot|easyname|exoscale|gandi|gcloud|gcore|hedns|hetzner|hexonet|hostingde|huaweicloud|inwx|linode|loopia|luadns|msdns|mythicbeasts|namecheap|namedotcom|netcup|netlify|ns1|opensrs|oracle|ovh|packetframe|porkbun|powerdns|realtimeregister|route53|rwth|sakuracloud|softlayer|transip|vultr).*:)+.*"
order: 2
- title: 'Documentation:'
regexp: "(?i)^.*(docs)[(\\w)]*:+.*$"
Expand Down
1 change: 1 addition & 0 deletions documentation/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@
* [Azure Private DNS](provider/azure_private_dns.md)
* [BIND](provider/bind.md)
* [Bunny DNS](provider/bunny\_dns.md)
* [CentralNic Reseller (fka RRPproxy)](provider/cnr.md)
* [Cloudflare](provider/cloudflareapi.md)
* [ClouDNS](provider/cloudns.md)
* [CSC Global](provider/cscglobal.md)
Expand Down
4 changes: 2 additions & 2 deletions documentation/providers.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ If a feature is definitively not supported for whatever reason, we would also li
| [`BUNNY_DNS`](provider/bunny_dns.md) ||||||||||||||||||||||||
| [`CLOUDFLAREAPI`](provider/cloudflareapi.md) ||||||||||||||||||||||||
| [`CLOUDNS`](provider/cloudns.md) ||||||||||||||||||||||||
| [`CNR`](provider/cnr.md) |||||||| | | || || | ||| | |||||
| [`CNR`](provider/cnr.md) |||||||| | | || || | ||| | |||||
| [`CSCGLOBAL`](provider/cscglobal.md) ||||||||||||||||||||||||
| [`DESEC`](provider/desec.md) ||||||||||||||||||||||||
| [`DIGITALOCEAN`](provider/digitalocean.md) ||||||||||||||||||||||||
Expand Down Expand Up @@ -118,6 +118,7 @@ Providers in this category and their maintainers are:
|[`BUNNY_DNS`](provider/bunny_dns.md)|@ppmathis|
|[`CLOUDFLAREAPI`](provider/cloudflareapi.md)|@tresni|
|[`CLOUDNS`](provider/cloudns.md)|@pragmaton|
|[`CNR`](provider/cnr.md)|@KaiSchwarz-cnic|
|[`CSCGLOBAL`](provider/cscglobal.md)|@Air-New-Zealand|
|[`DESEC`](provider/desec.md)|@D3luxee|
|[`DIGITALOCEAN`](provider/digitalocean.md)|@Deraen|
Expand Down Expand Up @@ -172,7 +173,6 @@ code to support this provider, we'd be glad to help in any way.
* [Infoblox DNS](https://github.com/StackExchange/dnscontrol/issues/1077) (#1077)
* [Joker.com](https://github.com/StackExchange/dnscontrol/issues/854) (#854)
* [Plesk](https://github.com/StackExchange/dnscontrol/issues/2261) (#2261)
* [RRPPRoxy](https://github.com/StackExchange/dnscontrol/issues/1656) (#1656)
* [RcodeZero](https://github.com/StackExchange/dnscontrol/issues/884) (#884)
* [SynergyWholesale](https://github.com/StackExchange/dnscontrol/issues/1605) (#1605)
* [UltraDNS by Neustar / CSCGlobal](https://github.com/StackExchange/dnscontrol/issues/1533) (#1533)
Expand Down
34 changes: 25 additions & 9 deletions providers/cnr/cnrProvider.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,19 +25,35 @@ type CNRClient struct {
}

var features = providers.DocumentationNotes{
// The default for unlisted capabilities is 'Cannot'.
// See providers/capabilities.go for the entire list of capabilities.
providers.CanGetZones: providers.Can(),
// The default for unlisted capabilities is 'Cannot'.
// --- Supported Features ---
providers.CanAutoDNSSEC: providers.Unimplemented("Ask for this feature."),
providers.CanConcur: providers.Can(),
providers.CanUseAlias: providers.Cannot("Not supported. You may use CNAME records instead. An Alternative solution is planned."),
providers.CanUseCAA: providers.Can(),
providers.CanUseLOC: providers.Unimplemented(),
providers.CanUsePTR: providers.Can(),
providers.CanUseSRV: providers.Can("SRV records with empty targets are not supported"),
providers.CanUseTLSA: providers.Can(),
providers.CanGetZones: providers.Can(),
providers.DocCreateDomains: providers.Can(),
providers.DocDualHost: providers.Can(),
providers.DocOfficiallySupported: providers.Cannot("Actively maintained provider module."),
// --- Supported record types ---
// providers.CanUseAKAMAICDN: providers.Cannot(), // can only be supported by Akamai EdgeDns provider
providers.CanUseAlias: providers.Cannot("Not supported. You may use CNAME records instead. An Alternative solution is planned."),
// providers.CanUseAzureAlias: providers.Cannot(), // can only be supported by Azure provider
providers.CanUseCAA: providers.Can(),
providers.CanUseDHCID: providers.Cannot("Ask for this feature."),
providers.CanUseDNAME: providers.Cannot("Ask for this feature."),
providers.CanUseDNSKEY: providers.Unimplemented("Ask for this feature."),
providers.CanUseDS: providers.Unimplemented("Ask for this feature."),
providers.CanUseDSForChildren: providers.Unimplemented("Ask for this feature."), // CanUseDS implies CanUseDSForChildren
providers.CanUseHTTPS: providers.Cannot("Managed via (Query|Add|Modify|Delete)WebFwd API call. Data not accessible via the resource records list. Hard to integrate this into DNSControl by that."),
providers.CanUseLOC: providers.Cannot("Ask for this feature."),
providers.CanUseNAPTR: providers.Can(),
providers.CanUsePTR: providers.Can(),
// providers.CanUseRoute53Alias: providers.Cannot(), // can only be supported by AWS Route53 provider
providers.CanUseSOA: providers.Cannot("The SOA record is managed on the DNSZone directly. Data only accessible via StatusDNSZone Request, not via the resource records list. Hard to integrate this into DNSControl by that."), // supported by bind, honstingde
providers.CanUseSRV: providers.Can("SRV records with empty targets are not supported"),
providers.CanUseSSHFP: providers.Can(),
providers.CanUseSVCB: providers.Cannot("Ask for this feature."),
providers.CanUseTLSA: providers.Can(),
}

func newProvider(conf map[string]string) (*CNRClient, error) {
Expand All @@ -47,7 +63,7 @@ func newProvider(conf map[string]string) (*CNRClient, error) {
}
api.client.SetUserAgent("DNSControl", version)
api.APILogin, api.APIPassword, api.APIEntity = conf["apilogin"], conf["apipassword"], conf["apientity"]
if conf["debugmode"] == "1" {
if conf["debugmode"] == "2" {
api.client.EnableDebugMode()
}
if api.APIEntity != "OTE" && api.APIEntity != "LIVE" {
Expand Down
17 changes: 15 additions & 2 deletions providers/cnr/records.go
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,10 @@ func (n *CNRClient) getRecords(domain string) ([]*CNRRecord, error) {
if r.GetCode() == 545 {
// If dns zone does not exist create a new one automatically
if !isNoPopulate() {
n.EnsureZoneExists(domain)
err := n.EnsureZoneExists(domain)
if err != nil {
return nil, err
}
} else {
// Return specific error if the zone does not exist
return nil, n.GetCNRApiError("Use `dnscontrol create-domains` to create not-existing zone", domain, r)
Expand Down Expand Up @@ -293,6 +296,16 @@ func (n *CNRClient) createRecordString(rc *models.RecordConfig, domain string) (
if domain == host {
host = fmt.Sprintf(`%s.`, host)
}
case "SSHFP":
answer = fmt.Sprintf(`%v %v %s`, rc.SshfpAlgorithm, rc.SshfpFingerprint, rc.GetTargetField())
if domain == host {
host = fmt.Sprintf(`%s.`, host)
}
case "NAPTR":
answer = fmt.Sprintf(`%v %v "%v" "%v" "%v" %v`, rc.NaptrOrder, rc.NaptrPreference, rc.NaptrFlags, rc.NaptrService, rc.NaptrRegexp, rc.GetTargetField())
if domain == host {
host = fmt.Sprintf(`%s.`, host)
}
case "TLSA":
answer = fmt.Sprintf(`%v %v %v %s`, rc.TlsaUsage, rc.TlsaSelector, rc.TlsaMatchingType, rc.GetTargetField())
case "CAA":
Expand Down Expand Up @@ -363,5 +376,5 @@ func isNoPopulate() bool {

// Function to check if debug mode is enabled
func (n *CNRClient) isDebugOn() bool {
return n.conf["debugmode"] == "1"
return n.conf["debugmode"] == "1" || n.conf["debugmode"] == "2"
}

0 comments on commit 0b85cf2

Please sign in to comment.