Compare commits

...

2 Commits

Author SHA1 Message Date
Matthew Saunders Brown
5835cef7ca add dns checks for vhosts 2023-07-05 11:02:13 -07:00
Matthew Saunders Brown
999993855a set process_control_timeout in php-fpm to prevent web admin failing to redirect after website/user installs 2023-07-05 11:01:35 -07:00
3 changed files with 73 additions and 26 deletions

View File

@ -5,6 +5,7 @@ chmod 755 /usr/local/bin/vpanel-verify-access.sh
cp -a etc/* /etc/ cp -a etc/* /etc/
chmod 440 /etc/sudoers.d/vpanel chmod 440 /etc/sudoers.d/vpanel
a2enconf vpanel a2enconf vpanel
sed -i "s|;process_control_timeout = 0|process_control_timeout = 1s|g" /etc/php/8.1/fpm/php-fpm.conf
service php8.1-fpm restart service php8.1-fpm restart
service apache2 restart service apache2 restart
cp -a panel /srv/www/html/ cp -a panel /srv/www/html/
@ -14,4 +15,3 @@ rm -r /srv/www/html/panel/f3/.git
find /srv/www/html/panel -type d -exec chmod 755 {} + find /srv/www/html/panel -type d -exec chmod 755 {} +
find /srv/www/html/panel -type f -exec chmod 644 {} + find /srv/www/html/panel -type f -exec chmod 644 {} +
chown -R vpanel:vpanel /srv/www/html/panel chown -R vpanel:vpanel /srv/www/html/panel

View File

@ -37,6 +37,24 @@ class Vhosts extends \Panel\Vhost {
$cert_array['alternative'] = $alternative; $cert_array['alternative'] = $alternative;
$f3->set('cert_array', $cert_array); $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 */ /* get user info */
$username = $vhost_array[0]['username']; $username = $vhost_array[0]['username'];
@ -66,12 +84,12 @@ class Vhosts extends \Panel\Vhost {
if ($f3->exists('PARAMS.vhost')) { if ($f3->exists('PARAMS.vhost')) {
$vhost_array = $f3->get('vhost_array'); // $vhost_array = $f3->get('vhost_array');
/* convert data for frontend display */ /* convert data for frontend display */
// nothing to convert // nothing to convert
$f3->set('vhost_array', $vhost_array); // $f3->set('vhost_array', $vhost_array);
$vhost = $f3->get('PARAMS.vhost'); $vhost = $f3->get('PARAMS.vhost');
$f3->set('page_header', "Details for $vhost"); $f3->set('page_header', "Details for $vhost");

View File

@ -34,10 +34,9 @@
</tr> </tr>
</table> </table>
<br><br>
<check if="isset(@cert_array)"> <check if="isset(@cert_array)">
<true> <true>
<br><br>
<table> <table>
<tr> <tr>
<th style="white-space: nowrap;">Certificate</th> <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> <td style="white-space: nowrap;"><a href="{{@BASE}}/Certs/{{@vhost_array.virtualhost}}/Delete?r={{@PATH}}">Delete</a></td>
</tr> </tr>
</table> </table>
<br><br>
</true> </true>
<false> <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> </false>
</check> </check>
<br><br>
<table> <table>
<tr><th colspan="2">Remote Access</th></tr> <tr><th colspan="2">Remote Access</th></tr>