Skip to content

Commit 655547b

Browse files
author
Till Brehm
committed
Add extended Log file controls for apache.
1 parent 442f257 commit 655547b

16 files changed

+132
-19
lines changed

install/lib/install.lib.php

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -859,6 +859,28 @@ function is_ispconfig_ssl_enabled() {
859859
}
860860
}
861861

862+
/*
863+
* Is anonymization enabled in ispconfig.conf file
864+
*/
865+
866+
function get_logging_state() {
867+
global $conf;
868+
$ispconfig_conf_file = $conf['apache']['vhost_conf_dir'].'/ispconfig.conf';
869+
870+
if(is_file($ispconfig_conf_file)) {
871+
$tmp = file_get_contents($ispconfig_conf_file);
872+
if(stristr($tmp, '/usr/local/ispconfig/server/scripts/vlogger -p -s access.log')) {
873+
return 'anon';
874+
} elseif(stristr($tmp, '/usr/local/ispconfig/server/scripts/vlogger -s access.log')) {
875+
return 'yes';
876+
} else {
877+
return 'no';
878+
}
879+
} else {
880+
return 'yes';
881+
}
882+
}
883+
862884
/**
863885
Function to find the hash file for timezone detection
864886
(c) 2012 Marius Cramer, pixcept KG, m.cramer@pixcept.de

install/lib/installer_base.lib.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2010,6 +2010,11 @@ public function configure_apps_vhost() {
20102010
$tpl->setVar('apps_vhost_basedir',$conf['web']['website_basedir']);
20112011
$tpl->setVar('apps_vhost_servername',$apps_vhost_servername);
20122012
$tpl->setVar('apache_version',getapacheversion());
2013+
if($this->is_update == true) {
2014+
$tpl->setVar('logging',get_logging_state());
2015+
} else {
2016+
$tpl->setVar('logging','yes');
2017+
}
20132018

20142019

20152020
// comment out the listen directive if port is 80 or 443

install/tpl/apache_ispconfig.conf.master

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,12 @@
66
SetEnvIf Request_URI "^/datalogstatus.php$" dontlog
77

88
LogFormat "%v %h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" combined_ispconfig
9+
<tmpl_if name='logging' op='==' value='anon'>
10+
CustomLog "| /usr/local/ispconfig/server/scripts/vlogger -p -s access.log -t \"%Y%m%d-access.log\" /var/log/ispconfig/httpd" combined_ispconfig env=!dontlog
11+
</tmpl_if>
12+
<tmpl_if name='logging' op='==' value='yes'>
913
CustomLog "| /usr/local/ispconfig/server/scripts/vlogger -s access.log -t \"%Y%m%d-access.log\" /var/log/ispconfig/httpd" combined_ispconfig env=!dontlog
14+
</tmpl_if>
1015

1116
<Directory /var/www/clients>
1217
AllowOverride None

install/tpl/server.ini.master

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ munin_user=
2929
munin_password=
3030
monitor_system_updates=y
3131
migration_mode=n
32+
log_retention=10
3233

3334
[mail]
3435
module=postfix_mysql
@@ -113,6 +114,7 @@ overquota_notify_freq=7
113114
overquota_db_notify_admin=y
114115
overquota_db_notify_client=y
115116
overquota_notify_onok=n
117+
logging=yes
116118

117119
[dns]
118120
bind_user=root

interface/web/admin/form/server_config.tform.php

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -395,6 +395,17 @@
395395
'default' => 'y',
396396
'value' => array(0 => 'n', 1 => 'y')
397397
),
398+
'log_retention' => array (
399+
'datatype' => 'INTEGER',
400+
'formtype' => 'TEXT',
401+
'validators' => array ( 0 => array ( 'type' => 'ISPOSITIVE',
402+
'errmsg'=> 'log_retention_error_ispositive'),
403+
),
404+
'default' => '30',
405+
'value' => '',
406+
'width' => '4',
407+
'maxlength' => '4'
408+
),
398409
'migration_mode' => array(
399410
'datatype' => 'VARCHAR',
400411
'formtype' => 'CHECKBOX',
@@ -910,6 +921,12 @@
910921
'default' => 'y',
911922
'value' => array(0 => 'n', 1 => 'y')
912923
),
924+
'logging' => array(
925+
'datatype' => 'VARCHAR',
926+
'formtype' => 'SELECT',
927+
'default' => 'yes',
928+
'value' => array('yes' => 'Yes', 'anon' => 'Anonymize IP', 'no' => 'No')
929+
),
913930
'overtraffic_notify_admin' => array(
914931
'datatype' => 'VARCHAR',
915932
'formtype' => 'CHECKBOX',

interface/web/admin/lib/lang/en_server_config.lng

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -288,4 +288,8 @@ $wb["apps_vhost_enabled_txt"] = "Apps-vhost enabled";
288288
$wb['skip_le_check_txt'] = 'Skip Lets Encrypt Check';
289289
$wb['migration_mode_txt'] = 'Server Migration Mode';
290290
$wb['nginx_enable_pagespeed_txt'] = 'Makes Pagespeed available';
291+
$wb['logging_txt'] = 'Store website access and error logs';
292+
$wb['logging_desc_txt'] = 'Use Tools > Resync to apply changes to existing sites.';
293+
$wb['log_retention_txt'] = 'Log retention (days)';
294+
$wb['log_retention_error_ispositive'] = 'Log retention must be a number > 0';
291295
?>

interface/web/admin/templates/server_config_server_edit.htm

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,10 @@ <h1><tmpl_var name="list_head_txt"></h1>
8080
</div>
8181
</div>
8282
<div class="form-group">
83+
<label for="log_retention" class="col-sm-3 control-label">{tmpl_var name='log_retention_txt'}</label>
84+
<div class="col-sm-9"><input type="text" name="log_retention" id="log_retention" value="{tmpl_var name='log_retention'}" class="form-control" /></div>
85+
</div>
86+
<div class="form-group">
8387
<label for="monit_url" class="col-sm-3 control-label">{tmpl_var name='monit_url_txt'}</label>
8488
<div class="col-sm-6"><input type="text" name="monit_url" id="monit_url" value="{tmpl_var name='monit_url'}" class="form-control" />&nbsp;{tmpl_var name='monit_url_note_txt'} <a href="javascript:void(0);" class="addPlaceholder">[SERVERNAME]</a></div>
8589
</div>

interface/web/admin/templates/server_config_web_edit.htm

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,14 @@ <h4 class="panel-title">
104104
<div class="col-sm-9">
105105
{tmpl_var name='enable_ip_wildcard'}
106106
</div>
107+
</div>
108+
<div class="form-group">
109+
<label class="col-sm-3 control-label">{tmpl_var name='logging_txt'}</label>
110+
<div class="col-sm-9">
111+
<select name="logging" id="logging" class="form-control">
112+
{tmpl_var name='logging'}
113+
</select>
114+
</div>
107115
</div>
108116
<div class="form-group">
109117
<label class="col-sm-3 control-label">{tmpl_var name='overtraffic_notify_admin_txt'}</label>

interface/web/client/form/message_template.tform.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@
6262
'datatype' => 'VARCHAR',
6363
'formtype' => 'SELECT',
6464
'default' => '',
65-
'value' => array('welcome' => 'Default welcome email', 'other' => 'Other')
65+
'value' => array('welcome' => 'Default welcome email', 'gdpr' => 'GDPR data send', 'other' => 'Other')
6666
),
6767
'template_name' => array (
6868
'datatype' => 'VARCHAR',

interface/web/client/lib/module.conf.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,22 @@
9494
unset($items);
9595
}
9696

97+
/*
98+
// GDPR functions for admin only, might be extended for resellers later
99+
if($_SESSION["s"]["user"]["typ"] == 'admin'){
100+
$items = array();
101+
$items[] = array( 'title' => 'Send Personal Data',
102+
'target' => 'content',
103+
'link' => 'client/gdpr_send.php');
104+
105+
$module['nav'][] = array( 'title' => 'GDPR',
106+
'open' => 1,
107+
'items' => $items);
108+
109+
unset($items);
110+
}
111+
*/
112+
97113
/*
98114
if($_SESSION["s"]["user"]["typ"] == 'admin'){
99115
$items[] = array( 'title' => "Interface Settings",

0 commit comments

Comments
 (0)