mirror of
https://github.com/usmannasir/cyberpanel.git
synced 2025-11-01 10:56:23 +01:00
Support for DNS CAA record type
This commit is contained in:
@@ -182,6 +182,7 @@ app.controller('addModifyDNSRecords', function($scope,$http) {
|
|||||||
$(".nsRecord").hide();
|
$(".nsRecord").hide();
|
||||||
$(".soaRecord").hide();
|
$(".soaRecord").hide();
|
||||||
$(".srvRecord").hide();
|
$(".srvRecord").hide();
|
||||||
|
$(".caaRecord").hide();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -288,6 +289,13 @@ app.controller('addModifyDNSRecords', function($scope,$http) {
|
|||||||
data.ttl = $scope.ttl;
|
data.ttl = $scope.ttl;
|
||||||
data.recordType = type;
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -63,6 +63,7 @@
|
|||||||
<li ng-click="fetchRecordsTabs('nsRecord')" id="nsRecord"><a href="">NS</a></li>
|
<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('soaRecord')" id="soaRecord" ><a href="">SOA</a></li>
|
||||||
<li ng-click="fetchRecordsTabs('srvRecord')" id="srvRecord" ><a href="">SRV</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>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -289,6 +290,29 @@
|
|||||||
<!------------- SRV Record box ------------->
|
<!------------- 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>
|
</div>
|
||||||
|
|
||||||
|
|||||||
15
dns/views.py
15
dns/views.py
@@ -342,6 +342,8 @@ def getCurrentRecordsForDomain(request):
|
|||||||
fetchType = 'SOA'
|
fetchType = 'SOA'
|
||||||
elif currentSelection == 'srvRecord':
|
elif currentSelection == 'srvRecord':
|
||||||
fetchType = 'SRV'
|
fetchType = 'SRV'
|
||||||
|
elif currentSelection == 'caaRecord':
|
||||||
|
fetchType = 'CAA'
|
||||||
|
|
||||||
json_data = "["
|
json_data = "["
|
||||||
checker = 0
|
checker = 0
|
||||||
@@ -528,6 +530,19 @@ def addDNSRecord(request):
|
|||||||
priority = data['priority']
|
priority = data['priority']
|
||||||
|
|
||||||
DNS.createDNSRecord(zone, value, recordType, recordContentSRV, priority, ttl)
|
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"}
|
final_dic = {'add_status': 1, 'error_message': "None"}
|
||||||
|
|||||||
@@ -2929,10 +2929,12 @@ def main():
|
|||||||
|
|
||||||
checks = preFlightsChecks("/usr/local/lsws/",args.publicip,"/usr/local",cwd,"/usr/local/CyberCP")
|
checks = preFlightsChecks("/usr/local/lsws/",args.publicip,"/usr/local",cwd,"/usr/local/CyberCP")
|
||||||
|
|
||||||
try:
|
if args.mysql == None:
|
||||||
mysql = args.mysql
|
|
||||||
except:
|
|
||||||
mysql = 'One'
|
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()
|
checks.checkPythonVersion()
|
||||||
@@ -2993,22 +2995,22 @@ def main():
|
|||||||
checks.setupVirtualEnv()
|
checks.setupVirtualEnv()
|
||||||
checks.setupPHPAndComposer()
|
checks.setupPHPAndComposer()
|
||||||
|
|
||||||
try:
|
if args.postfix != None:
|
||||||
postfix = args.postfix
|
checks.enableDisableEmail(args.postfix)
|
||||||
checks.enableDisableEmail(postfix)
|
else:
|
||||||
except:
|
preFlightsChecks.stdOut("Postfix will be installed and enabled.")
|
||||||
checks.enableDisableEmail('On')
|
checks.enableDisableEmail('On')
|
||||||
|
|
||||||
try:
|
if args.powerdns != None:
|
||||||
powerdns = args.powerdns
|
checks.enableDisableDNS(args.powerdns)
|
||||||
checks.enableDisableDNS(powerdns)
|
else:
|
||||||
except:
|
preFlightsChecks.stdOut("PowerDNS will be installed and enabled.")
|
||||||
checks.enableDisableDNS('On')
|
checks.enableDisableDNS('On')
|
||||||
|
|
||||||
try:
|
if args.ftp != None:
|
||||||
ftp = args.ftp
|
checks.enableDisableFTP(args.ftp)
|
||||||
checks.enableDisableFTP(ftp)
|
else:
|
||||||
except:
|
preFlightsChecks.stdOut("Pure-FTPD will be installed and enabled.")
|
||||||
checks.enableDisableFTP('On')
|
checks.enableDisableFTP('On')
|
||||||
|
|
||||||
logging.InstallLog.writeToFile("CyberPanel installation successfully completed!")
|
logging.InstallLog.writeToFile("CyberPanel installation successfully completed!")
|
||||||
|
|||||||
@@ -182,6 +182,7 @@ app.controller('addModifyDNSRecords', function($scope,$http) {
|
|||||||
$(".nsRecord").hide();
|
$(".nsRecord").hide();
|
||||||
$(".soaRecord").hide();
|
$(".soaRecord").hide();
|
||||||
$(".srvRecord").hide();
|
$(".srvRecord").hide();
|
||||||
|
$(".caaRecord").hide();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -288,6 +289,13 @@ app.controller('addModifyDNSRecords', function($scope,$http) {
|
|||||||
data.ttl = $scope.ttl;
|
data.ttl = $scope.ttl;
|
||||||
data.recordType = type;
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1262,12 +1262,12 @@ def saveRewriteRules(request):
|
|||||||
except:
|
except:
|
||||||
filePath = "/home/" + virtualHost + "/public_html/.htaccess"
|
filePath = "/home/" + virtualHost + "/public_html/.htaccess"
|
||||||
|
|
||||||
if admin.type != 1:
|
if admin.type != 1:
|
||||||
website = Websites.objects.get(domain=virtualHost)
|
website = Websites.objects.get(domain=virtualHost)
|
||||||
if website.admin != admin:
|
if website.admin != admin:
|
||||||
data_ret = {'rewriteStatus': 0, 'error_message': 'You do not own this website.'}
|
data_ret = {'rewriteStatus': 0, 'error_message': 'You do not own this website.'}
|
||||||
json_data = json.dumps(data_ret)
|
json_data = json.dumps(data_ret)
|
||||||
return HttpResponse(json_data)
|
return HttpResponse(json_data)
|
||||||
|
|
||||||
|
|
||||||
## save configuration data
|
## save configuration data
|
||||||
|
|||||||
Reference in New Issue
Block a user