token-validator: fix DS generation and management
This commit is contained in:
parent
eab1af36f4
commit
fbaad50fbd
@ -205,17 +205,17 @@ func parseZoneRead(globalDomain string, domain string) (rr []Entry, err error) {
|
|||||||
|
|
||||||
for _, r := range response.RR {
|
for _, r := range response.RR {
|
||||||
if strings.HasSuffix(r.Header().Name, domain) {
|
if strings.HasSuffix(r.Header().Name, domain) {
|
||||||
var z string
|
z := []string{}
|
||||||
if v, ok := r.(*dns.A); ok {
|
if v, ok := r.(*dns.A); ok {
|
||||||
z = fmt.Sprintf("%s", v.A)
|
z = append(z, fmt.Sprintf("%s", v.A))
|
||||||
} else if v, ok := r.(*dns.AAAA); ok {
|
} else if v, ok := r.(*dns.AAAA); ok {
|
||||||
z = fmt.Sprintf("%s", v.AAAA)
|
z = append(z, fmt.Sprintf("%s", v.AAAA))
|
||||||
} else if v, ok := r.(*dns.NS); ok {
|
} else if v, ok := r.(*dns.NS); ok {
|
||||||
z = fmt.Sprintf("%s", v.Ns)
|
z = append(z, fmt.Sprintf("%s", v.Ns))
|
||||||
} else if v, ok := r.(*dns.DS); ok {
|
} else if v, ok := r.(*dns.DS); ok {
|
||||||
z = fmt.Sprintf("%s", v.Digest)
|
z = append(z, fmt.Sprintf("%d", v.KeyTag), fmt.Sprintf("%d", v.Algorithm), fmt.Sprintf("%d", v.DigestType), fmt.Sprintf("%s", v.Digest))
|
||||||
}
|
}
|
||||||
rr = append(rr, Entry{r.Header().Name, r.Header().Ttl, dns.TypeToString[r.Header().Rrtype], "", []string{z}})
|
rr = append(rr, Entry{r.Header().Name, r.Header().Ttl, dns.TypeToString[r.Header().Rrtype], "", z})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -312,9 +312,11 @@ angular.module("AdLinApp")
|
|||||||
method: 'GET',
|
method: 'GET',
|
||||||
url: "api/adomains/" + domain,
|
url: "api/adomains/" + domain,
|
||||||
}).then(function(response) {
|
}).then(function(response) {
|
||||||
|
if (response.data) {
|
||||||
response.data.forEach(function(rr) {
|
response.data.forEach(function(rr) {
|
||||||
$scope.adomains.push(rr);
|
$scope.adomains.push(rr);
|
||||||
});
|
});
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}, function(response) {
|
}, function(response) {
|
||||||
console.log(response.data.errmsg);
|
console.log(response.data.errmsg);
|
||||||
@ -542,8 +544,8 @@ angular.module("AdLinApp")
|
|||||||
$scope.nsrr = {
|
$scope.nsrr = {
|
||||||
"domain": domain,
|
"domain": domain,
|
||||||
"ttl": 900,
|
"ttl": 900,
|
||||||
"rr": "DS",
|
"rr": "DNSKEY",
|
||||||
"labels": ["Key Tag", "Flag", "Algorithme", "Clef publique (base64)"],
|
"labels": ["Flags", "Protocole", "Algorithme", "Clef publique (base64)"],
|
||||||
"values": ["", "", "", ""],
|
"values": ["", "", "", ""],
|
||||||
}
|
}
|
||||||
$('#NSModal').modal('show');
|
$('#NSModal').modal('show');
|
||||||
@ -553,7 +555,7 @@ angular.module("AdLinApp")
|
|||||||
"domain": domain,
|
"domain": domain,
|
||||||
"ttl": rr.ttl,
|
"ttl": rr.ttl,
|
||||||
"rr": "DS",
|
"rr": "DS",
|
||||||
"labels": ["Key Tag", "Algo clef", "Algo hash", "Hash (hex)"],
|
"labels": ["Key Tag", "Algo clef", "Type de hash", "Hash (hex)"],
|
||||||
"valuesfrom": rr.values.join(" "),
|
"valuesfrom": rr.values.join(" "),
|
||||||
"values": rr.values,
|
"values": rr.values,
|
||||||
}
|
}
|
||||||
@ -563,6 +565,8 @@ angular.module("AdLinApp")
|
|||||||
$scope.saveNSRR = function(nsrr) {
|
$scope.saveNSRR = function(nsrr) {
|
||||||
if (nsrr.ttl)
|
if (nsrr.ttl)
|
||||||
nsrr.ttl = parseInt(nsrr.ttl)
|
nsrr.ttl = parseInt(nsrr.ttl)
|
||||||
|
if (nsrr.rr == "DNSKEY")
|
||||||
|
nsrr.rr = "DS"
|
||||||
$http({
|
$http({
|
||||||
method: (nsrr.valuesfrom !== undefined)?'PATCH':'POST',
|
method: (nsrr.valuesfrom !== undefined)?'PATCH':'POST',
|
||||||
url: "api/ddomains/" + nsrr.domain + "/" + nsrr.rr,
|
url: "api/ddomains/" + nsrr.domain + "/" + nsrr.rr,
|
||||||
|
Reference in New Issue
Block a user