fix wildcard certificate verification

This commit is contained in:
John Shaver 2019-03-16 21:51:41 -07:00
parent 268f83b49e
commit b1fc2bcc14
2 changed files with 33 additions and 36 deletions

View File

@ -168,6 +168,7 @@
<form class="js-acme-form js-acme-form-challenges"> <form class="js-acme-form js-acme-form-challenges">
<h1>Let's verify your domain</h1> <h1>Let's verify your domain</h1>
<div class="js-acme-challenges">
<div class="tabbed-selector"> <div class="tabbed-selector">
<label> <label>
<input class="js-acme-challenge-type" name="acme-challenge-type" type="radio" value="http-01" checked required> <input class="js-acme-challenge-type" name="acme-challenge-type" type="radio" value="http-01" checked required>
@ -180,61 +181,53 @@
<div></div> <div></div>
</label> </label>
</div> </div>
<div class="js-acme-challenges">
<div class="js-acme-verification-http-01"> <div class="js-acme-verification-http-01">
<h3>Upload this file</h3> <h3>Upload this file</h3>
<div class="http-verification-info file-preview"> <div class="http-verification-info file-preview">
<div class="paper-fold"></div> <div class="paper-fold"></div>
<div> <div>
<div class="file-ver-info-header">FILENAME</div> <div class="file-ver-info-header">FILENAME</div>
<pre id="js-acme-ver-file-location">...loading</pre> <pre class="js-acme-ver-file-location">...loading</pre>
</div> </div>
<hr> <hr>
<div> <div>
<div class="file-ver-info-header">CONTENTS</div> <div class="file-ver-info-header">CONTENTS</div>
<pre id="js-acme-ver-content">...loading</pre> <pre class="js-acme-ver-content">...loading</pre>
</div> </div>
</div> </div>
<div class="download-file"> <div class="download-file">
<svg class="mdicon icon-download" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"> <svg class="mdicon icon-download" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
<use xlink:href="#svg-download"></use> <use xlink:href="#svg-download"></use>
</svg> </svg>
<a id="js-download-verify-link" href="data:text/octet-stream;base64,SGVsbG8gV29ybGQuLi4=" download="hello.txt" target="_blank"> <a class="js-download-verify-link" href="data:text/octet-stream;base64,SGVsbG8gV29ybGQuLi4=" download="hello.txt" target="_blank">
Download Download
</a> </a>
</div> </div>
<h3>To this location</h3> <h3>To this location</h3>
<div id="js-acme-ver-uri" class="acme-ver-uri">..loading</div> <div class="js-acme-ver-uri" class="acme-ver-uri">..loading</div>
</div> </div>
<div class="js-acme-verification-dns-01"> <div class="js-acme-verification-dns-01">
<h3>Set this DNS Record</h3> <h3>Set this DNS Record</h3>
<div class="acme-ver-dns-label">Hostname</div> <div class="acme-ver-dns-label">Hostname</div>
<div id="js-acme-ver-hostname">loading...</div> <div class="js-acme-ver-hostname">loading...</div>
<div class="acme-ver-dns-label">TXT Host</div> <div class="acme-ver-dns-label">TXT Host</div>
<div id="js-acme-ver-txt-host">loading...</div> <div class="js-acme-ver-txt-host">loading...</div>
<div class="acme-ver-dns-label">TXT Value</div> <div class="acme-ver-dns-label">TXT Value</div>
<div id="js-acme-ver-txt-value">loading...</div> <div class="js-acme-ver-txt-value">loading...</div>
</div> </div>
</div>
<div class="js-acme-wildcard-challenges">
<div class="js-acme-wildcard"> <div class="js-acme-wildcard">
<h2>Verify Wildcard Domains</h2> <div class="js-acme-verification-wildcard">
<h3>Set this DNS Record</h3>
<table class="js-acme-verification-wildcard"> <div class="acme-ver-dns-label">Hostname</div>
<thead> <div class="js-acme-ver-hostname">loading...</div>
<tr> <div class="acme-ver-dns-label">TXT Host</div>
<th>Hostname</th> <div class="js-acme-ver-txt-host">loading...</div>
<th>TXT Host</th> <div class="acme-ver-dns-label">TXT Value</div>
<th>TXT Value</th> <div class="js-acme-ver-txt-value">loading...</div>
</tr> </div>
</thead>
<tbody>
<tr>
<td>example.com</td>
<td>_acme-challenge.example.com</td>
<td>4A54</td>
</tr>
</tbody>
</table>
</div> </div>
</div> </div>

View File

@ -346,23 +346,27 @@
if (claim.wildcard) { if (claim.wildcard) {
obj.wildcard.push(data); obj.wildcard.push(data);
let verification = $qs(".js-acme-verification-wildcard");
verification.querySelector(".js-acme-ver-hostname").innerHTML = data.hostname;
verification.querySelector(".js-acme-ver-txt-host").innerHTML = data.dnsHost;
verification.querySelector(".js-acme-ver-txt-value").innerHTML = data.dnsAnswer;
$qs(map.wildcard).innerHTML += '<tr><td>' + data.hostname + '</td><td>' + data.dnsHost + '</td><td>' + data.dnsAnswer + '</td></tr>';
} else if(obj[data.type]) { } else if(obj[data.type]) {
obj[data.type].push(data); obj[data.type].push(data);
if ('dns-01' === data.type) { if ('dns-01' === data.type) {
$qs("#js-acme-ver-hostname").innerHTML = data.hostname; let verification = $qs(".js-acme-verification-dns-01");
$qs("#js-acme-ver-txt-host").innerHTML = data.dnsHost; verification.querySelector(".js-acme-ver-hostname").innerHTML = data.hostname;
$qs("#js-acme-ver-txt-value").innerHTML = data.dnsAnswer; verification.querySelector(".js-acme-ver-txt-host").innerHTML = data.dnsHost;
verification.querySelector(".js-acme-ver-txt-value").innerHTML = data.dnsAnswer;
} else if ('http-01' === data.type) { } else if ('http-01' === data.type) {
$qs("#js-acme-ver-file-location").innerHTML = data.httpPath.split("/").slice(-1); $qs(".js-acme-ver-file-location").innerHTML = data.httpPath.split("/").slice(-1);
$qs("#js-acme-ver-content").innerHTML = data.httpAuth; $qs(".js-acme-ver-content").innerHTML = data.httpAuth;
$qs("#js-acme-ver-uri").innerHTML = data.httpPath; $qs(".js-acme-ver-uri").innerHTML = data.httpPath;
$qs("#js-download-verify-link").href = $qs(".js-download-verify-link").href =
"data:text/octet-stream;base64," + window.btoa(data.httpAuth); "data:text/octet-stream;base64," + window.btoa(data.httpAuth);
$qs("#js-download-verify-link").download = data.httpPath.split("/").slice(-1); $qs(".js-download-verify-link").download = data.httpPath.split("/").slice(-1);
} }
} }
@ -374,7 +378,7 @@
// hide wildcard if no wildcard // hide wildcard if no wildcard
// hide http-01 and dns-01 if only wildcard // hide http-01 and dns-01 if only wildcard
if (!obj.wildcard.length) { if (!obj.wildcard.length) {
$qs('.js-acme-wildcard').hidden = true; $qs('.js-acme-wildcard-challenges').hidden = true;
} }
if (!obj['http-01'].length) { if (!obj['http-01'].length) {
$qs('.js-acme-challenges').hidden = true; $qs('.js-acme-challenges').hidden = true;