add premade configs

This commit is contained in:
fyr77 2020-10-24 21:18:37 +02:00
parent 869603abe2
commit 0792fb0db1
4 changed files with 196 additions and 24 deletions

View file

@ -8,6 +8,11 @@ input[type=text], select {
box-sizing: border-box; box-sizing: border-box;
} }
.optional::before {
content: "optional ";
color: grey
}
input[type=submit] { input[type=submit] {
width: 100%; width: 100%;
background-color: #4CAF50; background-color: #4CAF50;
@ -21,4 +26,5 @@ input[type=submit] {
input[type=submit]:hover { input[type=submit]:hover {
background-color: #45a049; background-color: #45a049;
} }

View file

@ -9,10 +9,44 @@
<script src="js/FileSaver.min.js"></script> <script src="js/FileSaver.min.js"></script>
<script src="js/uuidv4.min.js"></script> <script src="js/uuidv4.min.js"></script>
<script src="js/tool.js"></script> <script src="js/tool.js"></script>
<script src="js/premades.js"></script>
</head> </head>
<body class="w3-container"> <body class="w3-container">
<h1>Secure DNS profile creator</h1> <h1>Secure DNS profile creator</h1>
<h2>For iOS 14 or later and macOS Big Sur or later</h2> <h2>For iOS 14 or later and macOS Big Sur or later</h2>
<select name="premades" id="premades" onchange="loadPremade()">
<option value="custom">&lt;custom&gt;</option>
<optgroup label="AdGuard">
<option value="adguard-https">AdGuard DoH</option>
</optgroup>
<optgroup label="Alibaba">
<option value="alibaba-https">Alibaba DoH</option>
</optgroup>
<optgroup label="Cloudflare">
<option value="cloudflare-https">Cloudflare DoH</option>
<option value="cloudflare-tls">Cloudflare DoT</option>
<option value="cloudflare-security-https">Cloudflare Malware blocking DoH</option>
<option value="cloudflare-security-tls">Cloudflare Malware blocking DoT</option>
<option value="cloudflare-family-https">Cloudflare Malware &amp; Adult blocking DoH</option>
<option value="cloudflare-family-tls">Cloudflare Malware &amp; Adult blocking DoT</option>
</optgroup>
<optgroup label="DNSPOD">
<option value="dnspod-https">DNSPOD DoH</option>
</optgroup>
<optgroup label="Google">
<option value="google-https">Google DoH</option>
<option value="google-tls">Google DoT</option>
</optgroup>
<optgroup label="OpenDNS">
<option value="opendns-https">OpenDNS DoH</option>
</optgroup>
<optgroup label="Quad9">
<option value="quad9-https">Quad9 DoH</option>
<option value="quad9-tls">Quad9 DoT</option>
</optgroup>
</select>
<form action="javascript:saveDynamicDataToFile()"> <form action="javascript:saveDynamicDataToFile()">
<p> <p>
<label for="provName">Name of DNS provider:</label> <label for="provName">Name of DNS provider:</label>
@ -20,19 +54,19 @@
</p> </p>
<p> <p>
<input type="radio" id="doh" name="encryption" value="HTTPS" onclick="switchToHTTPS()" checked="checked" required> <input type="radio" id="doh" name="encryption" value="HTTPS" onclick="switchToHTTPS()" checked="checked" required>
<label for="doh">DNS-over-HTTPS (DoH)</label> <label for="doh">DNS-over-HTTPS (DoH)</label><br>
<input type="radio" id="dot" name="encryption" value="TLS" onclick="switchToTLS()" required> <input type="radio" id="dot" name="encryption" value="TLS" onclick="switchToTLS()" required>
<label for="dot">DNS-over-TLS (DoT)</label> <label for="dot">DNS-over-TLS (DoT)</label>
</p> </p>
<p> <p>
<label for="dns1v4">IPv4 primary DNS:</label> <label for="dns1v4" class="optional">IPv4 primary DNS:</label>
<input type="text" id="dns1v4" placeholder="0.0.0.0"> <input type="text" id="dns1v4" placeholder="0.0.0.0">
<label for="dns2v4">IPv4 secondary DNS:</label> <label for="dns2v4" class="optional">IPv4 secondary DNS:</label>
<input type="text" id="dns2v4" placeholder="0.0.0.1"> <input type="text" id="dns2v4" placeholder="0.0.0.1">
<label for="dns1v6">IPv6 primary DNS:</label> <label for="dns1v6" class="optional">IPv6 primary DNS:</label>
<input type="text" id="dns1v6" placeholder="0000:0000:0000:0000:0000:0000:0000:0000"> <input type="text" id="dns1v6" placeholder="0000:0000:0000:0000:0000:0000:0000:0000 - other formats also accepted">
<label for="dns2v6">IPv6 secondary DNS:</label> <label for="dns2v6" class="optional">IPv6 secondary DNS:</label>
<input type="text" id="dns2v6" placeholder="0000:0000:0000:0000:0000:0000:0000:0001"> <input type="text" id="dns2v6" placeholder="0000:0000:0000:0000:0000:0000:0000:0001 - other formats also accepted">
</p> </p>
<p> <p>
<label for="serverUrl" id="dohdotServerLabel">DoH server URL:</label> <label for="serverUrl" id="dohdotServerLabel">DoH server URL:</label>

147
js/premades.js Normal file
View file

@ -0,0 +1,147 @@
function loadPremade() {
var provName = document.getElementById("provName");
var checkDoH = document.getElementById("doh");
var checkDoT = document.getElementById("dot");
var dns1v4 = document.getElementById("dns1v4");
var dns2v4 = document.getElementById("dns2v4");
var dns1v6 = document.getElementById("dns1v6");
var dns2v6 = document.getElementById("dns2v6");
var serverUrl = document.getElementById("serverUrl");
switch(document.getElementById("premades").value) {
case "adguard-https":
provName.value = "AdGuard";
checkDoH.checked = true;
dns1v4.value = "94.140.14.14";
dns2v4.value = "94.140.15.15";
dns1v6.value = "2a10:50c0::ad1:ff";
dns2v6.value = "2a10:50c0::ad2:ff";
serverUrl.value = "https://dns.adguard.com/dns-query";
break;
case "alibaba-https":
provName.value = "Alibaba";
checkDoH.checked = true;
dns1v4.value = "223.5.5.5";
dns2v4.value = "223.6.6.6";
dns1v6.value = "2400:3200::1";
dns2v6.value = "2400:3200:baba::1";
serverUrl.value = "https://dns.alidns.com/dns-query";
break;
case "cloudflare-https":
provName.value = "Cloudflare";
checkDoH.checked = true;
dns1v4.value = "1.1.1.1";
dns2v4.value = "1.0.0.1";
dns1v6.value = "2606:4700:4700::1111";
dns2v6.value = "2606:4700:4700::1001";
serverUrl.value = "https://cloudflare-dns.com/dns-query";
break;
case "cloudflare-tls":
provName.value = "Cloudflare";
checkDoT.checked = true;
dns1v4.value = "1.1.1.1";
dns2v4.value = "1.0.0.1";
dns1v6.value = "2606:4700:4700::1111";
dns2v6.value = "2606:4700:4700::1001";
serverUrl.value = "cloudflare-dns.com";
break;
case "cloudflare-security-https":
provName.value = "Cloudflare Security";
checkDoH.checked = true;
dns1v4.value = "1.1.1.2";
dns2v4.value = "1.0.0.2";
dns1v6.value = "2606:4700:4700::1112";
dns2v6.value = "2606:4700:4700::1002";
serverUrl.value = "https://security.cloudflare-dns.com/dns-query";
break;
case "cloudflare-security-tls":
provName.value = "Cloudflare Security";
checkDoT.checked = true;
dns1v4.value = "1.1.1.2";
dns2v4.value = "1.0.0.2";
dns1v6.value = "2606:4700:4700::1112";
dns2v6.value = "2606:4700:4700::1002";
serverUrl.value = "security.cloudflare-dns.com";
break;
case "cloudflare-family-https":
provName.value = "Cloudflare Family";
checkDoH.checked = true;
dns1v4.value = "1.1.1.3";
dns2v4.value = "1.0.0.3";
dns1v6.value = "2606:4700:4700::1113";
dns2v6.value = "2606:4700:4700::1003";
serverUrl.value = "https://family.cloudflare-dns.com/dns-query";
break;
case "cloudflare-family-tls":
provName.value = "Cloudflare Family";
checkDoT.checked = true;
dns1v4.value = "1.1.1.3";
dns2v4.value = "1.0.0.3";
dns1v6.value = "2606:4700:4700::1113";
dns2v6.value = "2606:4700:4700::1003";
serverUrl.value = "family.cloudflare-dns.com";
break;
case "dnspod-https":
provName.value = "DNSPOD";
checkDoH.checked = true;
dns1v4.value = "162.14.21.56";
dns2v4.value = "162.14.21.178";
dns1v6.value = "";
dns2v6.value = "";
serverUrl.value = "https://doh.pub/dns-query";
break;
case "google-https":
provName.value = "Google";
checkDoH.checked = true;
dns1v4.value = "8.8.8.8";
dns2v4.value = "8.8.4.4";
dns1v6.value = "2001:4860:4860::8888";
dns2v6.value = "2001:4860:4860::8844";
serverUrl.value = "https://dns.google/dns-query";
break;
case "google-tls":
provName.value = "Google";
checkDoT.checked = true;
dns1v4.value = "8.8.8.8";
dns2v4.value = "8.8.4.4";
dns1v6.value = "2001:4860:4860::8888";
dns2v6.value = "2001:4860:4860::8844";
serverUrl.value = "dns.google";
break;
case "opendns-https":
provName.value = "OpenDNS";
checkDoH.checked = true;
dns1v4.value = "208.67.220.220";
dns2v4.value = "208.67.222.222";
dns1v6.value = "2620:119:35::35";
dns2v6.value = "2620:119:53::53";
serverUrl.value = "https://doh.opendns.com/dns-query";
break;
case "quad9-https":
provName.value = "";
checkDoH.checked = true;
dns1v4.value = "9.9.9.9";
dns2v4.value = "149.112.112.112";
dns1v6.value = "2620:fe::fe";
dns2v6.value = "2620:fe::9";
serverUrl.value = "https://dns.quad9.net/dns-query";
break;
case "quad9-tls":
provName.value = "";
checkDoT.checked = true;
dns1v4.value = "9.9.9.9";
dns2v4.value = "149.112.112.112";
dns1v6.value = "2620:fe::fe";
dns2v6.value = "2620:fe::9";
serverUrl.value = "dns.quad9.net";
break;
default:
provName.value = "";
checkDoH.checked = true;
dns1v4.value = "";
dns2v4.value = "";
dns1v6.value = "";
dns2v6.value = "";
serverUrl.value = "";
}
}

View file

@ -39,18 +39,6 @@ function getRegDNS() {
return ""; return "";
} }
} }
function createServerUrl(encValue) {
var returnstring = "";
if (encValue == "HTTPS") {
returnstring = "https://" + document.getElementById("serverUrl").value + "\n";
}
else {
returnstring = document.getElementById("serverUrl").value + "\n";
}
return returnstring;
}
function saveDynamicDataToFile() { function saveDynamicDataToFile() {
var encryption = document.getElementsByName('encryption'); var encryption = document.getElementsByName('encryption');
@ -78,7 +66,7 @@ function saveDynamicDataToFile() {
fileString += "<string>" + encValue + "</string>\n"; fileString += "<string>" + encValue + "</string>\n";
fileString += getRegDNS(); fileString += getRegDNS();
fileString += "<key>ServerURL</key>\n"; fileString += "<key>ServerURL</key>\n";
fileString += "<string>" + createServerUrl(encValue); fileString += "<string>" + document.getElementById("serverUrl").value + "</string>\n";
fileString += "</dict>\n"; fileString += "</dict>\n";
fileString += "<key>PayloadDescription</key>\n"; fileString += "<key>PayloadDescription</key>\n";
fileString += "<string>Configures device to use " + provName + " Encrypted DNS over " + encValue + "</string>\n"; fileString += "<string>Configures device to use " + provName + " Encrypted DNS over " + encValue + "</string>\n";
@ -116,9 +104,6 @@ function saveDynamicDataToFile() {
var blob = new Blob([fileString], { type: "text/plain;charset=utf-8" }); var blob = new Blob([fileString], { type: "text/plain;charset=utf-8" });
saveAs(blob, "dns.mobileconfig"); saveAs(blob, "dns.mobileconfig");
//TODO: Premade configs! Fill in fields
//TODO: Check for HTTPS in server field
} }
function switchToHTTPS() { function switchToHTTPS() {