User with SSL website exceeds quota #277

Open
modcar opened this Issue Nov 5, 2016 · 2 comments

Projects

None yet

2 participants

@modcar
modcar commented Nov 5, 2016

Operating System: Ubuntu

Operating System Version number: 14.04

Sentora Version: 1.0.3

Today I found out, if a user who has SSL enabled exceeds their disk quota, it causes Apache2 to stop, an not start

Heres the Sentora generated vhost as normal:

# DOMAIN: youthinspire.dynamite.net.nz
<virtualhost *:443>
ServerName youthinspire.dynamite.net.nz
ServerAlias  www.youthinspire.dynamite.net.nz
ServerAdmin soa@dynamite.net.nz
DocumentRoot "/var/sentora/hostdata/youthinspire/public_html/youthinspire_org_nz"
ErrorLog "/var/sentora/logs/domains/youthinspire/youthinspire.dynamite.net.nz-error.log"
CustomLog "/var/sentora/logs/domains/youthinspire/youthinspire.dynamite.net.nz-access.log" combined
CustomLog "/var/sentora/logs/domains/youthinspire/youthinspire.dynamite.net.nz-bandwidth.log" common
<Directory "/var/sentora/hostdata/youthinspire/public_html/youthinspire_org_nz">
  Options +FollowSymLinks -Indexes
  AllowOverride All
  Require all granted
</Directory>
AddType application/x-httpd-php .php3 .php
ErrorDocument 510 /_errorpages/510.html
ErrorDocument 404 /_errorpages/404.html
ErrorDocument 500 /_errorpages/500.html
ErrorDocument 403 /_errorpages/403.html
DirectoryIndex index.php index.html index.htm index.asp index.aspx index.jsp index.jspa index.shtml index.shtm
# Custom Global Settings (if any exist)
#php_flag engine off
<Directory /usr/share/php>
php_admin_value open_basedir none
</Directory>
<Directory /usr/lib/php5/20121212+lfs>
php_admin_value open_basedir none
</Directory>
# Custom VH settings (if any exist)
SSLEngine on
ServerName youthinspire.dynamite.net.nz
ServerAlias youthinspire.dynamite.net.nz
SSLCertificateFile "/var/ssl/youthinspire.dynamite.net.nz.crt"
SSLCertificateKeyFile "/var/ssl/youthinspire.dynamite.net.nz.key"
SSLCertificateChainFile /var/ssl/startssl_256bit/sca.server1.crt
SSLCACertificateFile /var/ssl/startssl_256bit/root.crt

</virtualhost>
# END DOMAIN: youthinspire.dynamite.net.nz
################################################################

Once they exceed their disk quota, the vhost is changed to

# DOMAIN: youthinspire.dynamite.net.nz
# THIS DOMAIN HAS BEEN DISABLED FOR QUOTA OVERAGE
<virtualhost *:443>
ServerName youthinspire.dynamite.net.nz
ServerAlias www.youthinspire.dynamite.net.nz
ServerAdmin soa@dynamite.net.nz
DocumentRoot "/etc/sentora/panel/etc/static/diskexceeded"
<Directory "/etc/sentora/panel/etc/static/diskexceeded">
  Options +FollowSymLinks -Indexes
  AllowOverride All
  Require all granted
</Directory>
AddType application/x-httpd-php .php3 .php
DirectoryIndex index.php index.html index.htm index.asp index.aspx index.jsp index.jspa index.shtml index.shtm
</virtualhost>
# END DOMAIN: youthinspire.dynamite.net.nz

This appears in the /var/log/apache2/error.log

[Mon Oct 17 14:03:52.351362 2016] [ssl:emerg] [pid 2070] AH02240: Server should be SSL-aware but has no certificate configured [Hint: SSLC$
[Mon Oct 17 14:03:52.351430 2016] [ssl:emerg] [pid 2070] AH02312: Fatal error initialising mod_ssl, exiting.

I can get Apache working again by altering /etc/sentora/configs/apache/httpd-vhosts.conf from:

Listen 80
Listen 443

to

Listen 80
Listen 443 http

Ofcource, next time theres any changes, this is wiped, and Apache2 dies again

Is there any way to keep the cert info in the vhost when the disk is exceeded?
For bug reports please provide the following information:

@TGates71
Member
TGates71 commented Nov 7, 2016

As explained on our forums, there is no simple way. It needs to be hard coded into the core
@MBlagui

@modcar modcar added the bug label Nov 7, 2016
@modcar
modcar commented Dec 17, 2016

As posted in the forums - I believe this resolves the issue

In /etc/sentora/panel/modules/apache_admin/hooks/OnDaemonRun.hook.php

On lines 185 and 220
above:

$line .= "</virtualhost>" . fs_filehandler::NewLine();

Insert the following:

// Client custom vh entry
               $line .= "# Custom VH settings (if any exist)" . fs_filehandler::NewLine();
               $line .= $rowvhost['vh_custom_tx'] . fs_filehandler::NewLine();

Now when users exceed quotas, their custom vhost info is retained

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment