add dns checks for vhosts
This commit is contained in:
parent
999993855a
commit
5835cef7ca
|
@ -37,6 +37,24 @@ class Vhosts extends \Panel\Vhost {
|
|||
$cert_array['alternative'] = $alternative;
|
||||
$f3->set('cert_array', $cert_array);
|
||||
}
|
||||
} else {
|
||||
/* no cert, get dns info */
|
||||
$dnsinfo = array();
|
||||
$dnsinfo['server_addr'] = $_SERVER['SERVER_ADDR'];
|
||||
# A record
|
||||
$dnsinfo['a']['color'] = "red";
|
||||
if ($certdomain_dns = dns_get_record("$vhost", DNS_A)) {
|
||||
if ($certdomain_dns[0]['ip'] == $dnsinfo['server_addr']) {
|
||||
$dnsinfo['a']['status'] = "Verified";
|
||||
$dnsinfo['a']['color'] = "black";
|
||||
$dnsinfo['verified_count']++;
|
||||
} else {
|
||||
$dnsinfo['a']['status'] = "Update";
|
||||
}
|
||||
} else {
|
||||
$dnsinfo['a']['status'] = "Create";
|
||||
}
|
||||
$f3->set('dnsinfo', $dnsinfo);
|
||||
}
|
||||
/* get user info */
|
||||
$username = $vhost_array[0]['username'];
|
||||
|
@ -66,12 +84,12 @@ class Vhosts extends \Panel\Vhost {
|
|||
|
||||
if ($f3->exists('PARAMS.vhost')) {
|
||||
|
||||
$vhost_array = $f3->get('vhost_array');
|
||||
// $vhost_array = $f3->get('vhost_array');
|
||||
|
||||
/* convert data for frontend display */
|
||||
// nothing to convert
|
||||
|
||||
$f3->set('vhost_array', $vhost_array);
|
||||
// $f3->set('vhost_array', $vhost_array);
|
||||
|
||||
$vhost = $f3->get('PARAMS.vhost');
|
||||
$f3->set('page_header', "Details for $vhost");
|
||||
|
|
|
@ -34,10 +34,9 @@
|
|||
</tr>
|
||||
</table>
|
||||
|
||||
<br><br>
|
||||
|
||||
<check if="isset(@cert_array)">
|
||||
<true>
|
||||
<br><br>
|
||||
<table>
|
||||
<tr>
|
||||
<th style="white-space: nowrap;">Certificate</th>
|
||||
|
@ -52,13 +51,43 @@
|
|||
<td style="white-space: nowrap;"><a href="{{@BASE}}/Certs/{{@vhost_array.virtualhost}}/Delete?r={{@PATH}}">Delete</a></td>
|
||||
</tr>
|
||||
</table>
|
||||
<br><br>
|
||||
</true>
|
||||
<false>
|
||||
<a href="{{@BASE}}/Certs/{{@vhost_array.virtualhost}}/Add?r={{@PATH}}">Add Security Certificate</a>
|
||||
<hr>
|
||||
<check if="{{ @dnsinfo.a.status=='Verified' }}">
|
||||
<true>
|
||||
You need a Security Certificate. <a href="{{@BASE}}/Certs/{{@vhost_array.virtualhost}}/Add?r={{@PATH}}">Click Here</a> to add one now.
|
||||
</true>
|
||||
<false>
|
||||
<span style="color:red">You need a Security Certificate for {{ @vhost_array.virtualhost }}.</span>
|
||||
<br>
|
||||
Before you can add one you must make the DNS change listed below. Once that's completed come back here and this message will change to an option to create a Security Certificate.
|
||||
<br>
|
||||
<small>Note that after you add DNS records it can take some time for the changes to propagate and show up here.</small>
|
||||
<br><br>
|
||||
<table>
|
||||
<tr><th style="color:{{ @dnsinfo.a.color }}" colspan="2">{{ @dnsinfo.a.status }} A Record for {{ @vhost_array.virtualhost }}</th></tr>
|
||||
<tr><td style="text-align: right;">Type:</td><td>A</td></tr>
|
||||
<tr><td style="text-align: right;">Host:</td><td>{{ @vhost_array.virtualhost }}</td></tr>
|
||||
<tr><td style="text-align: right;">Value:</td><td>{{ @dnsinfo.server_addr }}</td></tr>
|
||||
<tr><td style="text-align: right;">TTL:</td><td>3600 (or default)</td></tr>
|
||||
<tr><td></td><td><small>This should be the only A record for {{ @vhost_array.virtualhost }}.</small></td></tr>
|
||||
</table>
|
||||
<br><br>
|
||||
<table>
|
||||
<tr><th style="color:{{ @dnsinfo.a.color }}" colspan="2">Verify CNAME Record for www.{{ @vhost_array.virtualhost }}</th></tr>
|
||||
<tr><td style="text-align: right;">Type:</td><td>CNAME</td></tr>
|
||||
<tr><td style="text-align: right;">Host:</td><td>www.{{ @vhost_array.virtualhost }}</td></tr>
|
||||
<tr><td style="text-align: right;">Value:</td><td>{{ @vhost_array.virtualhost }}</td></tr>
|
||||
<tr><td style="text-align: right;">TTL:</td><td>3600 (or default)</td></tr>
|
||||
<tr><td></td><td><small>This should be the only record for www.{{ @vhost_array.virtualhost }}.<br>Note this admin did not check for this record, it may already exist.</small></td></tr>
|
||||
</table>
|
||||
</false>
|
||||
</check>
|
||||
<hr>
|
||||
</false>
|
||||
</check>
|
||||
|
||||
<br><br>
|
||||
|
||||
<table>
|
||||
<tr><th colspan="2">Remote Access</th></tr>
|
||||
|
|
Loading…
Reference in New Issue
Block a user