Support for DNS CAA record type

This commit is contained in:
usmannasir
2018-08-12 14:53:05 +05:00
parent 254e4976d4
commit 5fc0d06fb4
6 changed files with 78 additions and 21 deletions

View File

@@ -182,6 +182,7 @@ app.controller('addModifyDNSRecords', function($scope,$http) {
$(".nsRecord").hide();
$(".soaRecord").hide();
$(".srvRecord").hide();
$(".caaRecord").hide();
@@ -288,6 +289,13 @@ app.controller('addModifyDNSRecords', function($scope,$http) {
data.ttl = $scope.ttl;
data.recordType = type;
}
else if(type === "CAA"){
data.selectedZone = $scope.selectedZone;
data.recordName = $scope.recordName;
data.recordContentCAA = $scope.recordContentCAA;
data.ttl = $scope.ttl;
data.recordType = type;
}

View File

@@ -63,6 +63,7 @@
<li ng-click="fetchRecordsTabs('nsRecord')" id="nsRecord"><a href="">NS</a></li>
<li ng-click="fetchRecordsTabs('soaRecord')" id="soaRecord" ><a href="">SOA</a></li>
<li ng-click="fetchRecordsTabs('srvRecord')" id="srvRecord" ><a href="">SRV</a></li>
<li ng-click="fetchRecordsTabs('caaRecord')" id="caaRecord" ><a href="">CAA</a></li>
</ul>
</div>
@@ -289,6 +290,29 @@
<!------------- SRV Record box ------------->
<!------------- CAA Record box ------------->
<div class="col-sm-3 caaRecord">
<input placeholder="{% trans 'Name' %}" type="text" class="form-control" ng-model="recordName">
</div>
<div class="col-sm-3 caaRecord">
<input placeholder="{% trans 'TTL' %}" type="number" class="form-control" ng-model="ttl" required>
</div>
<div class="col-sm-3 caaRecord">
<input placeholder='Value e.g: 0 issue "letsencrypt.org"' type="text" class="form-control" ng-model="recordContentCAA" required>
</div>
<div class="col-sm-3 caaRecord">
<button style="width: 100%;" type="button" ng-click="addDNSRecord('CAA')" class="btn btn-primary">{% trans "Add" %}</button>
</div>
<!------------- CAA Record box ------------->
</div>

View File

@@ -342,6 +342,8 @@ def getCurrentRecordsForDomain(request):
fetchType = 'SOA'
elif currentSelection == 'srvRecord':
fetchType = 'SRV'
elif currentSelection == 'caaRecord':
fetchType = 'CAA'
json_data = "["
checker = 0
@@ -528,6 +530,19 @@ def addDNSRecord(request):
priority = data['priority']
DNS.createDNSRecord(zone, value, recordType, recordContentSRV, priority, ttl)
elif recordType == "CAA":
if recordName == "@":
value = zoneDomain
## re.match
elif match(r'([\da-z\.-]+\.[a-z\.]{2,12}|[\d\.]+)([\/:?=&#]{1}[\da-z\.-]+)*[\/\?]?', recordName, M | I):
value = recordName
else:
value = recordName + "." + zoneDomain
recordContentCAA = data['recordContentCAA'] ## IP or ponting value
DNS.createDNSRecord(zone, value, recordType, recordContentCAA, 0, ttl)
final_dic = {'add_status': 1, 'error_message': "None"}

View File

@@ -2929,10 +2929,12 @@ def main():
checks = preFlightsChecks("/usr/local/lsws/",args.publicip,"/usr/local",cwd,"/usr/local/CyberCP")
try:
mysql = args.mysql
except:
if args.mysql == None:
mysql = 'One'
preFlightsChecks.stdOut("Single MySQL instance version will be installed.")
else:
mysql = args.mysql
preFlightsChecks.stdOut("Dobule MySQL instance version will be installed.")
checks.checkPythonVersion()
@@ -2993,22 +2995,22 @@ def main():
checks.setupVirtualEnv()
checks.setupPHPAndComposer()
try:
postfix = args.postfix
checks.enableDisableEmail(postfix)
except:
if args.postfix != None:
checks.enableDisableEmail(args.postfix)
else:
preFlightsChecks.stdOut("Postfix will be installed and enabled.")
checks.enableDisableEmail('On')
try:
powerdns = args.powerdns
checks.enableDisableDNS(powerdns)
except:
if args.powerdns != None:
checks.enableDisableDNS(args.powerdns)
else:
preFlightsChecks.stdOut("PowerDNS will be installed and enabled.")
checks.enableDisableDNS('On')
try:
ftp = args.ftp
checks.enableDisableFTP(ftp)
except:
if args.ftp != None:
checks.enableDisableFTP(args.ftp)
else:
preFlightsChecks.stdOut("Pure-FTPD will be installed and enabled.")
checks.enableDisableFTP('On')
logging.InstallLog.writeToFile("CyberPanel installation successfully completed!")

View File

@@ -182,6 +182,7 @@ app.controller('addModifyDNSRecords', function($scope,$http) {
$(".nsRecord").hide();
$(".soaRecord").hide();
$(".srvRecord").hide();
$(".caaRecord").hide();
@@ -288,6 +289,13 @@ app.controller('addModifyDNSRecords', function($scope,$http) {
data.ttl = $scope.ttl;
data.recordType = type;
}
else if(type === "CAA"){
data.selectedZone = $scope.selectedZone;
data.recordName = $scope.recordName;
data.recordContentCAA = $scope.recordContentCAA;
data.ttl = $scope.ttl;
data.recordType = type;
}