maatma: distinct add/update/delete fonctions
This commit is contained in:
parent
748939c3b4
commit
b8179583e6
@ -1,6 +1,10 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"crypto/sha256"
|
||||
"encoding/base64"
|
||||
"encoding/binary"
|
||||
"encoding/hex"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
@ -43,10 +47,21 @@ func init() {
|
||||
if err := json.Unmarshal(body, &ue); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return true, student.UpdateNSDelegatedDomain(ps.ByName("dn"), ue.TTL, ue.Values[0])
|
||||
return true, student.AddNSDelegatedDomain(ps.ByName("dn"), ue.TTL, ue.Values[0])
|
||||
}))
|
||||
router.PATCH("/api/ddomains/:dn/NS", apiAuthHandler(func (student Student, ps httprouter.Params, body []byte) (interface{}, error) {
|
||||
var ue Entry
|
||||
if err := json.Unmarshal(body, &ue); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return true, student.UpdateNSDelegatedDomain(ps.ByName("dn"), ue.TTL, ue.ValuesFrom[0], ue.Values[0])
|
||||
}))
|
||||
router.DELETE("/api/ddomains/:dn/NS", apiAuthHandler(func (student Student, ps httprouter.Params, body []byte) (interface{}, error) {
|
||||
return true, student.DeleteRRDelegatedDomain(ps.ByName("dn"), "NS")
|
||||
var ue Entry
|
||||
if err := json.Unmarshal(body, &ue); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return true, student.DeleteRRDelegatedDomain(ps.ByName("dn"), "NS", ue.Values...)
|
||||
}))
|
||||
router.GET("/api/ddomains/:dn/GLUE", apiAuthHandler(func (student Student, ps httprouter.Params, body []byte) (interface{}, error) {
|
||||
return student.getRRDelegatedDomain(ps.ByName("dn"), "AAAA")
|
||||
@ -56,17 +71,28 @@ func init() {
|
||||
if err := json.Unmarshal(body, &ue); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return true, student.UpdateGLUEDelegatedDomain(ps.ByName("dn"), ue.TTL, ue.Values[0])
|
||||
return true, student.AddGLUEDelegatedDomain(ps.ByName("dn"), ue.TTL, ue.Values[0])
|
||||
}))
|
||||
router.PATCH("/api/ddomains/:dn/AAAA", apiAuthHandler(func (student Student, ps httprouter.Params, body []byte) (interface{}, error) {
|
||||
var ue Entry
|
||||
if err := json.Unmarshal(body, &ue); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return true, student.UpdateGLUEDelegatedDomain(ps.ByName("dn"), ue.TTL, ue.ValuesFrom[0], ue.Values[0])
|
||||
}))
|
||||
router.POST("/api/ddomains/:dn/GLUE", apiAuthHandler(func (student Student, ps httprouter.Params, body []byte) (interface{}, error) {
|
||||
var ue Entry
|
||||
if err := json.Unmarshal(body, &ue); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return true, student.UpdateGLUEDelegatedDomain(ps.ByName("dn"), ue.TTL, ue.Values[0])
|
||||
return true, student.UpdateGLUEDelegatedDomain(ps.ByName("dn"), ue.TTL, ue.ValuesFrom[0], ue.Values[0])
|
||||
}))
|
||||
router.DELETE("/api/ddomains/:dn/AAAA", apiAuthHandler(func (student Student, ps httprouter.Params, body []byte) (interface{}, error) {
|
||||
return true, student.DeleteRRDelegatedDomain(ps.ByName("dn"), "AAAA")
|
||||
var ue Entry
|
||||
if err := json.Unmarshal(body, &ue); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return true, student.DeleteRRDelegatedDomain(ps.ByName("dn"), "AAAA", ue.Values...)
|
||||
}))
|
||||
router.GET("/api/ddomains/:dn/DS", apiAuthHandler(func (student Student, ps httprouter.Params, body []byte) (interface{}, error) {
|
||||
return student.getRRDelegatedDomain(ps.ByName("dn"), "DS")
|
||||
@ -76,18 +102,30 @@ func init() {
|
||||
if err := json.Unmarshal(body, &ue); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return true, student.UpdateDSDelegatedDomain(ps.ByName("dn"), ue.TTL, ue.Values)
|
||||
return true, student.AddDSDelegatedDomain(ps.ByName("dn"), ue.TTL, ue.Values)
|
||||
}))
|
||||
router.PATCH("/api/ddomains/:dn/DS", apiAuthHandler(func (student Student, ps httprouter.Params, body []byte) (interface{}, error) {
|
||||
var ue Entry
|
||||
if err := json.Unmarshal(body, &ue); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return true, student.UpdateDSDelegatedDomain(ps.ByName("dn"), ue.TTL, ue.ValuesFrom, ue.Values)
|
||||
}))
|
||||
router.DELETE("/api/ddomains/:dn/DS", apiAuthHandler(func (student Student, ps httprouter.Params, body []byte) (interface{}, error) {
|
||||
return true, student.DeleteRRDelegatedDomain(ps.ByName("dn"), "DS")
|
||||
var ue Entry
|
||||
if err := json.Unmarshal(body, &ue); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return true, student.DeleteRRDelegatedDomain(ps.ByName("dn"), "DS", ue.Values...)
|
||||
}))
|
||||
}
|
||||
|
||||
type Entry struct {
|
||||
Domain string `json:"domain"`
|
||||
TTL uint64 `json:"ttl"`
|
||||
RR string `json:"rr"`
|
||||
Values []string `json:"values"`
|
||||
Domain string `json:"domain"`
|
||||
TTL uint64 `json:"ttl"`
|
||||
RR string `json:"rr"`
|
||||
ValuesFrom []string `json:"valuesfrom,omitempty"`
|
||||
Values []string `json:"values"`
|
||||
}
|
||||
|
||||
func runKnotc(args ...string) (out []byte, err error) {
|
||||
@ -113,7 +151,7 @@ func parseKnotZoneRead(args ...string) (rr []Entry, err error) {
|
||||
return
|
||||
}
|
||||
|
||||
rr = append(rr, Entry{cols[1], ttl, cols[3], cols[4:]})
|
||||
rr = append(rr, Entry{cols[1], ttl, cols[3], nil, cols[4:]})
|
||||
}
|
||||
}
|
||||
|
||||
@ -197,11 +235,32 @@ func (student Student) getRRDelegatedDomain(dn string, rr string) (rrs []Entry,
|
||||
return
|
||||
}
|
||||
|
||||
func (student Student) UpdateNSDelegatedDomain(dn string, ttl uint64, ns string) (err error) {
|
||||
func (student Student) AddNSDelegatedDomain(dn string, ttl uint64, ns string) (err error) {
|
||||
for _, d := range []string{student.MyDelegatedDomain()} {
|
||||
for _, cmd := range [][]string{
|
||||
[]string{"zone-begin", DelegatedDomainSuffix},
|
||||
[]string{"zone-unset", DelegatedDomainSuffix, d, "NS"},
|
||||
[]string{"zone-set", DelegatedDomainSuffix, d, fmt.Sprintf("%d", ttl), "NS", ns},
|
||||
[]string{"zone-commit", DelegatedDomainSuffix},
|
||||
} {
|
||||
var out []byte
|
||||
out, err = runKnotc(cmd...)
|
||||
if err != nil && cmd[0] != "zone-unset" {
|
||||
err = errors.New(fmt.Sprintf("An error occurs on command '%s': %s", strings.Join(cmd, " "), err.Error()))
|
||||
log.Println(string(out))
|
||||
runKnotc("zone-abort", DelegatedDomainSuffix)
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
func (student Student) UpdateNSDelegatedDomain(dn string, ttl uint64, oldns string, ns string) (err error) {
|
||||
for _, d := range []string{student.MyDelegatedDomain()} {
|
||||
for _, cmd := range [][]string{
|
||||
[]string{"zone-begin", DelegatedDomainSuffix},
|
||||
[]string{"zone-unset", DelegatedDomainSuffix, d, "NS", oldns},
|
||||
[]string{"zone-set", DelegatedDomainSuffix, d, fmt.Sprintf("%d", ttl), "NS", ns},
|
||||
[]string{"zone-commit", DelegatedDomainSuffix},
|
||||
} {
|
||||
@ -220,7 +279,7 @@ func (student Student) UpdateNSDelegatedDomain(dn string, ttl uint64, ns string)
|
||||
}
|
||||
|
||||
|
||||
func (student Student) UpdateGLUEDelegatedDomain(dn string, ttl uint64, aaaa string) (err error) {
|
||||
func (student Student) AddGLUEDelegatedDomain(dn string, ttl uint64, aaaa string) (err error) {
|
||||
domains := []string{student.MyDelegatedDomain()}
|
||||
found := false
|
||||
for _, d := range domains {
|
||||
@ -236,8 +295,40 @@ func (student Student) UpdateGLUEDelegatedDomain(dn string, ttl uint64, aaaa str
|
||||
|
||||
for _, cmd := range [][]string{
|
||||
[]string{"zone-begin", DelegatedDomainSuffix},
|
||||
[]string{"zone-unset", DelegatedDomainSuffix, student.MyDelegatedDomain(), "AAAA"},
|
||||
[]string{"zone-unset", DelegatedDomainSuffix, dn, "AAAA"},
|
||||
[]string{"zone-set", DelegatedDomainSuffix, dn, fmt.Sprintf("%d", ttl), "AAAA", aaaa},
|
||||
[]string{"zone-commit", DelegatedDomainSuffix},
|
||||
} {
|
||||
var out []byte
|
||||
out, err = runKnotc(cmd...)
|
||||
if err != nil && cmd[0] != "zone-unset" {
|
||||
err = errors.New(fmt.Sprintf("An error occurs on command '%s': %s", strings.Join(cmd, " "), err.Error()))
|
||||
log.Println(string(out))
|
||||
runKnotc("zone-abort", DelegatedDomainSuffix)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
func (student Student) UpdateGLUEDelegatedDomain(dn string, ttl uint64, oldaaaa string, aaaa string) (err error) {
|
||||
domains := []string{student.MyDelegatedDomain()}
|
||||
found := false
|
||||
for _, d := range domains {
|
||||
if strings.HasSuffix(dn, d) {
|
||||
found = true
|
||||
}
|
||||
}
|
||||
|
||||
if !found {
|
||||
err = errors.New(fmt.Sprintf("Unable to find domain %q in your whitelist.", dn))
|
||||
return
|
||||
}
|
||||
|
||||
for _, cmd := range [][]string{
|
||||
[]string{"zone-begin", DelegatedDomainSuffix},
|
||||
[]string{"zone-unset", DelegatedDomainSuffix, student.MyDelegatedDomain(), "AAAA", oldaaaa},
|
||||
[]string{"zone-unset", DelegatedDomainSuffix, dn, "AAAA", oldaaaa},
|
||||
[]string{"zone-set", DelegatedDomainSuffix, dn, fmt.Sprintf("%d", ttl), "AAAA", aaaa},
|
||||
[]string{"zone-commit", DelegatedDomainSuffix},
|
||||
} {
|
||||
@ -255,11 +346,60 @@ func (student Student) UpdateGLUEDelegatedDomain(dn string, ttl uint64, aaaa str
|
||||
}
|
||||
|
||||
|
||||
func (student Student) UpdateDSDelegatedDomain(dn string, ttl uint64, ds []string) (err error) {
|
||||
func (student Student) AddDSDelegatedDomain(dn string, ttl uint64, dnskey []string) (err error) {
|
||||
if len(dnskey) != 4 {
|
||||
return errors.New("Wrong number of value for this record")
|
||||
}
|
||||
|
||||
dshash := sha256.New()
|
||||
dshash.Write([]byte("nemunai.re"))
|
||||
|
||||
var flag uint64
|
||||
if flag, err = strconv.ParseUint(dnskey[1], 10, 16); err != nil {
|
||||
return
|
||||
}
|
||||
binary.Write(dshash, binary.BigEndian, flag)
|
||||
|
||||
var proto uint8 = 3
|
||||
dshash.Write([]byte{proto})
|
||||
|
||||
var alg uint64
|
||||
if alg, err = strconv.ParseUint(dnskey[2], 10, 8); err != nil {
|
||||
return
|
||||
}
|
||||
dshash.Write([]byte{uint8(alg)})
|
||||
|
||||
var pubkey []byte
|
||||
if pubkey, err = base64.StdEncoding.DecodeString(strings.Replace(dnskey[3], " ", "", -1)); err != nil {
|
||||
return
|
||||
}
|
||||
dshash.Write(pubkey)
|
||||
|
||||
for _, d := range []string{student.MyDelegatedDomain()} {
|
||||
for _, cmd := range [][]string{
|
||||
[]string{"zone-begin", DelegatedDomainSuffix},
|
||||
[]string{"zone-unset", DelegatedDomainSuffix, d, "DS"},
|
||||
[]string{"zone-set", DelegatedDomainSuffix, d, fmt.Sprintf("%d", ttl), "DS", dnskey[0], dnskey[2], hex.EncodeToString(dshash.Sum(nil))},
|
||||
[]string{"zone-commit", DelegatedDomainSuffix},
|
||||
} {
|
||||
var out []byte
|
||||
out, err = runKnotc(cmd...)
|
||||
if err != nil && cmd[0] != "zone-unset" {
|
||||
err = errors.New(fmt.Sprintf("An error occurs on command '%s': %s", strings.Join(cmd, " "), err.Error()))
|
||||
log.Println(string(out))
|
||||
runKnotc("zone-abort", DelegatedDomainSuffix)
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
func (student Student) UpdateDSDelegatedDomain(dn string, ttl uint64, oldds []string, ds []string) (err error) {
|
||||
for _, d := range []string{student.MyDelegatedDomain()} {
|
||||
for _, cmd := range [][]string{
|
||||
[]string{"zone-begin", DelegatedDomainSuffix},
|
||||
[]string{"zone-unset", DelegatedDomainSuffix, d, "DS", strings.Join(oldds, " ")},
|
||||
[]string{"zone-set", DelegatedDomainSuffix, d, fmt.Sprintf("%d", ttl), "DS", strings.Join(ds, " ")},
|
||||
[]string{"zone-commit", DelegatedDomainSuffix},
|
||||
} {
|
||||
@ -278,7 +418,7 @@ func (student Student) UpdateDSDelegatedDomain(dn string, ttl uint64, ds []strin
|
||||
}
|
||||
|
||||
|
||||
func (student Student) DeleteRRDelegatedDomain(dn string, rr string) (err error) {
|
||||
func (student Student) DeleteRRDelegatedDomain(dn string, rr string, values ...string) (err error) {
|
||||
domains := []string{student.MyDelegatedDomain()}
|
||||
found := false
|
||||
for _, d := range domains {
|
||||
@ -292,9 +432,12 @@ func (student Student) DeleteRRDelegatedDomain(dn string, rr string) (err error)
|
||||
return
|
||||
}
|
||||
|
||||
zu := []string{"zone-unset", DelegatedDomainSuffix, dn, rr}
|
||||
zu = append(zu, values...)
|
||||
|
||||
for _, cmd := range [][]string{
|
||||
[]string{"zone-begin", DelegatedDomainSuffix},
|
||||
[]string{"zone-unset", DelegatedDomainSuffix, dn, rr},
|
||||
zu,
|
||||
[]string{"zone-commit", DelegatedDomainSuffix},
|
||||
} {
|
||||
var out []byte
|
||||
|
@ -155,6 +155,17 @@ angular.module("AdLinApp")
|
||||
})
|
||||
|
||||
.controller("DomainsController", function($scope, $http, $interval, $location) {
|
||||
var onUpdateEvt = [];
|
||||
var callOnUpdateEvt = function() {
|
||||
angular.forEach(onUpdateEvt, function(cb) {
|
||||
cb();
|
||||
});
|
||||
}
|
||||
|
||||
$scope.addOnUpdateEvent = function(cb) {
|
||||
onUpdateEvt.push(cb);
|
||||
}
|
||||
|
||||
$scope.updateAssociationD = function() {
|
||||
$http({
|
||||
method: 'GET',
|
||||
@ -218,25 +229,45 @@ angular.module("AdLinApp")
|
||||
});
|
||||
}
|
||||
|
||||
$scope.updateNS = function(domain) {
|
||||
$scope.addNS = function(domain) {
|
||||
$scope.nsrr = {
|
||||
"domain": domain,
|
||||
"ttl": 900,
|
||||
"rr": "NS",
|
||||
"value": "",
|
||||
"values": [""],
|
||||
}
|
||||
$('#NSModal').modal('show');
|
||||
}
|
||||
$scope.updateGLUE = function(domain) {
|
||||
$scope.updateNS = function(domain, rr) {
|
||||
$scope.nsrr = {
|
||||
"domain": domain,
|
||||
"ttl": 900,
|
||||
"rr": "NS",
|
||||
"valuesfrom": rr.values,
|
||||
"values": rr.values,
|
||||
}
|
||||
$('#NSModal').modal('show');
|
||||
}
|
||||
$scope.addGLUE = function(domain) {
|
||||
$scope.nsrr = {
|
||||
"domain": domain,
|
||||
"ttl": 900,
|
||||
"rr": "AAAA",
|
||||
"value": "",
|
||||
"values": [""],
|
||||
}
|
||||
$('#NSModal').modal('show');
|
||||
}
|
||||
$scope.updateDS = function(domain) {
|
||||
$scope.updateGLUE = function(domain, rr) {
|
||||
$scope.nsrr = {
|
||||
"domain": domain,
|
||||
"ttl": 900,
|
||||
"rr": "AAAA",
|
||||
"valuesfrom": rr.values,
|
||||
"values": rr.values,
|
||||
}
|
||||
$('#NSModal').modal('show');
|
||||
}
|
||||
$scope.addDS = function(domain) {
|
||||
$scope.nsrr = {
|
||||
"domain": domain,
|
||||
"ttl": 900,
|
||||
@ -246,13 +277,21 @@ angular.module("AdLinApp")
|
||||
}
|
||||
$('#NSModal').modal('show');
|
||||
}
|
||||
$scope.updateDS = function(domain, rr) {
|
||||
$scope.nsrr = {
|
||||
"domain": domain,
|
||||
"ttl": 900,
|
||||
"rr": "DS",
|
||||
"labels": ["Key Tag", "Algo clef", "Algo hash", "Hash (hex)"],
|
||||
"valuesfrom": rr.values,
|
||||
"values": rr.values,
|
||||
}
|
||||
$('#NSModal').modal('show');
|
||||
}
|
||||
|
||||
$scope.saveNSRR = function(nsrr) {
|
||||
if (nsrr.values === undefined)
|
||||
nsrr.values = [nsrr.value];
|
||||
|
||||
$http({
|
||||
method: 'POST',
|
||||
method: (nsrr.valuesfrom !== undefined)?'PATCH':'POST',
|
||||
url: "/api/ddomains/" + nsrr.domain + "/" + nsrr.rr,
|
||||
headers: {
|
||||
'Authorization': "Bearer " + sessionStorage.token
|
||||
@ -260,62 +299,75 @@ angular.module("AdLinApp")
|
||||
data: nsrr,
|
||||
}).then(function(response) {
|
||||
$('#NSModal').modal('hide');
|
||||
$location.url("./domains");
|
||||
callOnUpdateEvt();
|
||||
}, function(response) {
|
||||
alert(response.data.errmsg);
|
||||
});
|
||||
}
|
||||
|
||||
$scope.delNSRR = function(nsrr) {
|
||||
$scope.deleteRR = function(domain, rr) {
|
||||
rr["pleaseWait" + rr.rr + "del"] = true;
|
||||
$http({
|
||||
method: 'DELETE',
|
||||
url: "/api/ddomains/" + nsrr.domain + "/" + nsrr.rr,
|
||||
url: "/api/ddomains/" + domain + "/" + rr.rr,
|
||||
headers: {
|
||||
'Authorization': "Bearer " + sessionStorage.token
|
||||
},
|
||||
data: rr,
|
||||
}).then(function(response) {
|
||||
$('#NSModal').modal('hide');
|
||||
$location.url("./domains");
|
||||
callOnUpdateEvt();
|
||||
rr["pleaseWait" + rr.rr + "del"] = false;
|
||||
}, function(response) {
|
||||
rr["pleaseWait" + rr.rr + "del"] = false;
|
||||
alert(response.data.errmsg);
|
||||
});
|
||||
}
|
||||
})
|
||||
|
||||
.controller("NSDomainsController", function($scope, $http) {
|
||||
$http({
|
||||
method: 'GET',
|
||||
url: "/api/ddomains/" + $scope.domain + "/NS",
|
||||
headers: {
|
||||
'Authorization': "Bearer " + sessionStorage.token
|
||||
},
|
||||
}).then(function(response) {
|
||||
$scope.domainNS = response.data;
|
||||
});
|
||||
var updateNS = function() {
|
||||
$http({
|
||||
method: 'GET',
|
||||
url: "/api/ddomains/" + $scope.domain + "/NS",
|
||||
headers: {
|
||||
'Authorization': "Bearer " + sessionStorage.token
|
||||
},
|
||||
}).then(function(response) {
|
||||
$scope.domainNS = response.data;
|
||||
});
|
||||
}
|
||||
updateNS();
|
||||
$scope.addOnUpdateEvent(updateNS);
|
||||
})
|
||||
|
||||
.controller("GLUEDomainsController", function($scope, $http) {
|
||||
$http({
|
||||
method: 'GET',
|
||||
url: "/api/ddomains/" + $scope.domain + "/GLUE",
|
||||
headers: {
|
||||
'Authorization': "Bearer " + sessionStorage.token
|
||||
},
|
||||
}).then(function(response) {
|
||||
$scope.domainGLUE = response.data;
|
||||
});
|
||||
|
||||
var updateGLUE = function() {
|
||||
$http({
|
||||
method: 'GET',
|
||||
url: "/api/ddomains/" + $scope.domain + "/GLUE",
|
||||
headers: {
|
||||
'Authorization': "Bearer " + sessionStorage.token
|
||||
},
|
||||
}).then(function(response) {
|
||||
$scope.domainGLUE = response.data;
|
||||
});
|
||||
}
|
||||
updateGLUE();
|
||||
$scope.addOnUpdateEvent(updateGLUE);
|
||||
})
|
||||
|
||||
.controller("DSDomainsController", function($scope, $http) {
|
||||
$http({
|
||||
method: 'GET',
|
||||
url: "/api/ddomains/" + $scope.domain + "/DS",
|
||||
headers: {
|
||||
'Authorization': "Bearer " + sessionStorage.token
|
||||
},
|
||||
}).then(function(response) {
|
||||
$scope.domainDS = response.data;
|
||||
});
|
||||
|
||||
var updateDS = function() {
|
||||
$http({
|
||||
method: 'GET',
|
||||
url: "/api/ddomains/" + $scope.domain + "/DS",
|
||||
headers: {
|
||||
'Authorization': "Bearer " + sessionStorage.token
|
||||
},
|
||||
}).then(function(response) {
|
||||
$scope.domainDS = response.data;
|
||||
});
|
||||
}
|
||||
updateDS();
|
||||
$scope.addOnUpdateEvent(updateDS);
|
||||
})
|
||||
|
@ -37,69 +37,150 @@
|
||||
|
||||
<h3>Délégation</h3>
|
||||
|
||||
<table class="table table-striped table-hover">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Domaine</th>
|
||||
<th>NS</th>
|
||||
<th>GLUE</th>
|
||||
<th>DNSSEC</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody style="font-family: monospace">
|
||||
<tr ng-repeat="domain in ddomains">
|
||||
<td>{{ domain }}</td>
|
||||
<td ng-controller="NSDomainsController">
|
||||
<span ng-if="!domainNS" class="badge badge-pill badge-danger">Non défini</span>
|
||||
<div ng-repeat="rr in domainNS">
|
||||
{{ rr.domain }}
|
||||
{{ rr.ttl }}
|
||||
{{ rr.rr }}
|
||||
<span ng-repeat="val in rr.values">{{ val }} </span>
|
||||
</div>
|
||||
<button class="btn btn-primary" ng-click="updateNS(domain)">
|
||||
Mettre à jour
|
||||
</button>
|
||||
</td>
|
||||
<td ng-controller="GLUEDomainsController">
|
||||
<span ng-if="!domainGLUE" class="badge badge-pill badge-danger">Non défini</span>
|
||||
<div ng-repeat="rr in domainGLUE">
|
||||
{{ rr.domain }}
|
||||
{{ rr.ttl }}
|
||||
{{ rr.rr }}
|
||||
<span ng-repeat="val in rr.values">{{ val }} </span>
|
||||
</div>
|
||||
<br>
|
||||
<button class="btn btn-primary" ng-click="updateGLUE(domain)">
|
||||
Mettre à jour
|
||||
</button>
|
||||
</td>
|
||||
<td ng-controller="DSDomainsController">
|
||||
<span class="badge badge-pill badge-danger" ng-show="!domainDS">Non configuré</span>
|
||||
<div ng-repeat="rr in domainDS">
|
||||
{{ rr.domain }}
|
||||
{{ rr.ttl }}
|
||||
{{ rr.rr }}
|
||||
<span ng-repeat="val in rr.values">{{ val }} </span>
|
||||
</div>
|
||||
<br>
|
||||
<button class="btn btn-primary" ng-click="updateDS(domain)">
|
||||
Mettre à jour
|
||||
</button>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<td colspan="4">
|
||||
<button class="btn btn-primary" ng-click="newDelegation()" disabled>
|
||||
<span class="spinner-border spinner-border-sm" role="status" aria-hidden="true" ng-show="pleaseWaitNewDelegation"></span>
|
||||
Demander un nouveau nom de domaine
|
||||
</button>
|
||||
</td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
<ul class="nav nav-tabs" id="ddomainTabs" role="tablist">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link active" data-toggle="tab" data-target="#NS" role="tab" aria-controls="ns" aria-selected="true">Serveurs de nom</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-toggle="tab" data-target="#GLUE" role="tab" aria-controls="glue" aria-selected="false">GLUE</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-toggle="tab" data-target="#DNSSEC" role="tab" aria-controls="dnssec" aria-selected="false">DNSSEC</a>
|
||||
</li>
|
||||
</ul>
|
||||
<div class="tab-content" id="myTabContent">
|
||||
<div class="tab-pane fade show active" id="NS" role="tabpanel" aria-labelledby="ns-tab">
|
||||
|
||||
<div ng-repeat="domain in ddomains">
|
||||
<h4 class="text-muted">{{ domain }}</h4>
|
||||
|
||||
<table class="table table-striped table-hover" ng-controller="NSDomainsController">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Serveur DNS</th>
|
||||
<th>Joignable</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody style="font-family: monospace" ng-if="domainNS">
|
||||
<tr ng-repeat="rr in domainNS">
|
||||
<td><span ng-repeat="val in rr.values">{{ val }} </span></td>
|
||||
<td>
|
||||
<span class="badge badge-pill badge-secondary">Not implemented yet</span>
|
||||
</td>
|
||||
<td>
|
||||
<button class="btn btn-warning" ng-click="updateNS(domain, rr)">Modifier</button>
|
||||
<button class="btn btn-danger" ng-click="deleteRR(domain, rr)">
|
||||
<span class="spinner-border spinner-border-sm" role="status" aria-hidden="true" ng-show="rr.pleaseWaitNSdel"></span>
|
||||
Supprimer
|
||||
</button>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
<tbody style="font-family: monospace" ng-if="!domainNS">
|
||||
<tr>
|
||||
<td colspan="4">Vous n'avez défini aucun serveur de noms pour l'instant</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<td colspan="3">
|
||||
<button class="btn btn-primary" ng-click="addNS(domain)">Ajouter un nouveau serveur de noms</button>
|
||||
</td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="tab-pane fade" id="GLUE" role="tabpanel" aria-labelledby="glue-tab">
|
||||
|
||||
<div ng-repeat="domain in ddomains">
|
||||
<h4 class="text-muted">{{ domain }}</h4>
|
||||
|
||||
<table class="table table-striped table-hover" ng-controller="GLUEDomainsController">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Domaine DNS</th>
|
||||
<th>IP</th>
|
||||
<th>Joignable</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody style="font-family: monospace" ng-if="domainGLUE">
|
||||
<tr ng-repeat="rr in domainGLUE">
|
||||
<td>{{ domain }}</td>
|
||||
<td><span ng-repeat="val in rr.values">{{ val }} </span></td>
|
||||
<td>
|
||||
<span class="badge badge-pill badge-secondary">Not implemented yet</span>
|
||||
</td>
|
||||
<td>
|
||||
<button class="btn btn-warning" ng-click="updateGLUE(domain, rr)">Modifier</button>
|
||||
<button class="btn btn-danger" ng-click="deleteRR(domain, rr)">
|
||||
<span class="spinner-border spinner-border-sm" role="status" aria-hidden="true" ng-show="rr.pleaseWaitAAAAdel"></span>
|
||||
Supprimer
|
||||
</button>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
<tbody style="font-family: monospace" ng-if="!domainGLUE">
|
||||
<tr>
|
||||
<td colspan="4">Vous n'avez défini aucun enregistrement glue pour l'instant</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<td colspan="4">
|
||||
<button class="btn btn-primary" ng-click="addGLUE(domain)">Ajouter un enregistrement glue</button>
|
||||
</td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="tab-pane fade" id="DNSSEC" role="tabpanel" aria-labelledby="dnssec-tab">
|
||||
|
||||
<div ng-repeat="domain in ddomains">
|
||||
<h4 class="text-muted">{{ domain }}</h4>
|
||||
|
||||
<table class="table table-striped table-hover" ng-controller="DSDomainsController">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Key Tag</th>
|
||||
<th>Algorithme de la clef</th>
|
||||
<th>Algorithme de hash</th>
|
||||
<th>Hash (hex)</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody style="font-family: monospace" ng-if="domainDS">
|
||||
<tr ng-repeat="rr in domainDS">
|
||||
<td ng-repeat="val in rr.values">{{ val }}</td>
|
||||
<td>
|
||||
<button class="btn btn-warning" ng-click="updateDS(domain, rr)">Modifier</button>
|
||||
<button class="btn btn-danger" ng-click="deleteRR(domain, rr)">
|
||||
<span class="spinner-border spinner-border-sm" role="status" aria-hidden="true" ng-show="rr.pleaseWaitDSdel"></span>
|
||||
Supprimer
|
||||
</button>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
<tbody style="font-family: monospace" ng-if="!domainDS">
|
||||
<tr>
|
||||
<td colspan="4">Vous n'avez défini aucun enregistrement DS pour l'instant</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<td colspan="5">
|
||||
<button class="btn btn-primary" ng-click="addDS(domain)">Ajouter un enregistrement DS</button>
|
||||
</td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="modal" id="NSModal" tabindex="-1" role="dialog">
|
||||
<div class="modal-dialog" role="document">
|
||||
@ -133,14 +214,9 @@
|
||||
<input class="form-control-plaintext" ng-model="nsrr.rr" readonly>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row" ng-if="nsrr.value !== undefined">
|
||||
<label for="value" class="col-sm-2 col-form-label">Valeur</label>
|
||||
<div class="col-sm-10">
|
||||
<input class="form-control" id="value" ng-model="nsrr.value" autofocus>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row" ng-repeat="v in nsrr.values track by $index">
|
||||
<label for="value{{$index}}" class="col-sm-2 col-form-label">{{ nsrr.labels[$index] }}</label>
|
||||
<label for="value{{$index}}" class="col-sm-2 col-form-label" ng-if="nsrr.labels">{{ nsrr.labels[$index] }}</label>
|
||||
<label for="value{{$index}}" class="col-sm-2 col-form-label" ng-if="!nsrr.labels">Valeur</label>
|
||||
<div class="col-sm-10">
|
||||
<input class="form-control" id="value{{$index}}" ng-model="nsrr.values[$index]">
|
||||
</div>
|
||||
@ -150,7 +226,6 @@
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" data-dismiss="modal">Annuler</button>
|
||||
<button type="button" class="btn btn-primary" ng-click="saveNSRR(nsrr)">Enregistrer</button>
|
||||
<button type="button" class="btn btn-danger" ng-click="delNSRR(nsrr)">Supprimer</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
Reference in New Issue
Block a user