Initial commit

This commit is contained in:
fyr77 2020-10-24 11:57:52 +02:00
parent 6e4a926951
commit b4bbf5b4af
3 changed files with 70 additions and 1 deletions

3
FileSaver.min.js vendored Normal file
View file

@ -0,0 +1,3 @@
(function(a,b){if("function"==typeof define&&define.amd)define([],b);else if("undefined"!=typeof exports)b();else{b(),a.FileSaver={exports:{}}.exports}})(this,function(){"use strict";function b(a,b){return"undefined"==typeof b?b={autoBom:!1}:"object"!=typeof b&&(console.warn("Deprecated: Expected third argument to be a object"),b={autoBom:!b}),b.autoBom&&/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(a.type)?new Blob(["\uFEFF",a],{type:a.type}):a}function c(a,b,c){var d=new XMLHttpRequest;d.open("GET",a),d.responseType="blob",d.onload=function(){g(d.response,b,c)},d.onerror=function(){console.error("could not download file")},d.send()}function d(a){var b=new XMLHttpRequest;b.open("HEAD",a,!1);try{b.send()}catch(a){}return 200<=b.status&&299>=b.status}function e(a){try{a.dispatchEvent(new MouseEvent("click"))}catch(c){var b=document.createEvent("MouseEvents");b.initMouseEvent("click",!0,!0,window,0,0,0,80,20,!1,!1,!1,!1,0,null),a.dispatchEvent(b)}}var f="object"==typeof window&&window.window===window?window:"object"==typeof self&&self.self===self?self:"object"==typeof global&&global.global===global?global:void 0,a=/Macintosh/.test(navigator.userAgent)&&/AppleWebKit/.test(navigator.userAgent)&&!/Safari/.test(navigator.userAgent),g=f.saveAs||("object"!=typeof window||window!==f?function(){}:"download"in HTMLAnchorElement.prototype&&!a?function(b,g,h){var i=f.URL||f.webkitURL,j=document.createElement("a");g=g||b.name||"download",j.download=g,j.rel="noopener","string"==typeof b?(j.href=b,j.origin===location.origin?e(j):d(j.href)?c(b,g,h):e(j,j.target="_blank")):(j.href=i.createObjectURL(b),setTimeout(function(){i.revokeObjectURL(j.href)},4E4),setTimeout(function(){e(j)},0))}:"msSaveOrOpenBlob"in navigator?function(f,g,h){if(g=g||f.name||"download","string"!=typeof f)navigator.msSaveOrOpenBlob(b(f,h),g);else if(d(f))c(f,g,h);else{var i=document.createElement("a");i.href=f,i.target="_blank",setTimeout(function(){e(i)})}}:function(b,d,e,g){if(g=g||open("","_blank"),g&&(g.document.title=g.document.body.innerText="downloading..."),"string"==typeof b)return c(b,d,e);var h="application/octet-stream"===b.type,i=/constructor/i.test(f.HTMLElement)||f.safari,j=/CriOS\/[\d]+/.test(navigator.userAgent);if((j||h&&i||a)&&"undefined"!=typeof FileReader){var k=new FileReader;k.onloadend=function(){var a=k.result;a=j?a:a.replace(/^data:[^;]*;/,"data:attachment/file;"),g?g.location.href=a:location=a,g=null},k.readAsDataURL(b)}else{var l=f.URL||f.webkitURL,m=l.createObjectURL(b);g?g.location=m:location.href=m,g=null,setTimeout(function(){l.revokeObjectURL(m)},4E4)}});f.saveAs=g.saveAs=g,"undefined"!=typeof module&&(module.exports=g)});
//# sourceMappingURL=FileSaver.min.js.map

View file

@ -1,2 +1,17 @@
# dns-mobileconfig # dns-mobileconfig
A simple website to create DoH and DoT config files for iOS (and macOS maybe?) A simple website to create DoH and DoT config files for iOS.
Might also work on macOS, I don't have a way to test that currently.
THIS IS STILL WIP. IT DOES NOT WORK YET.
## About
Encrypted DNS is getting more and more mainstream. With the release of iOS 14, Apple has included support for DoH and DoT standards, but has not provided a way of using these without an app or profiles.
This tool can generate these profiles from provided data and also provides some premade configurations.
## Thanks
- Eli Grey for [FileSaver.js](https://github.com/eligrey/FileSaver.js)
- Paul Miller for [his excellent article](https://paulmillr.com/posts/encrypted-dns/) and the [premade profiles](https://github.com/paulmillr/encrypted-dns).

51
index.html Normal file
View file

@ -0,0 +1,51 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>iOS secure DNS</title>
<script src="FileSaver.min.js"></script>
<script>
function saveDynamicDataToFile() {
var encryption = document.getElementsByName('encryption');
var encValue = null;
for (var i = 0, length = encryption.length; i < length; i++) {
if (encryption[i].checked) {
encValue = encryption[i].value;
// only one radio can be logically checked, don't check the rest
break;
}
}
//var blob = new Blob([userInput], { type: "text/plain;charset=utf-8" });
var blob = new Blob(["<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n<plist version=\"1.0\">\n<dict>\n<key>PayloadContent</key>\n<array>\n<dict>\n<key>DNSSettings</key>\n<dict>\n<key>DNSProtocol</key>\n<string>" + encValue + "</string>\n<key>ServerAddresses</key>\n<array>\n"], { type: "text/plain;charset=utf-8" });
saveAs(blob, "dns.mobileconfig");
//https://github.com/paulmillr/encrypted-dns/blob/master/cloudflare-https.mobileconfig
//Currently Line 13 done
//https://github.com/paulmillr/encrypted-dns/blob/master/cloudflare-tls.mobileconfig
//TODO: Premade configs! Fill in fields
}
</script>
</head>
<body>
<p>
<input type="radio" id="doh" name="encryption" value="HTTPS">
<label for="doh">DNS-over-HTTPS (DoH)</label><br>
<input type="radio" id="dot" name="encryption" value="TLS">
<label for="dot">DNS-over-TLS (DoT)</label>
</p>
<p>
</p>
<button type="button" onclick="saveDynamicDataToFile();">Click to Save</button>
</body>
</html>