diff --git a/install/dist/conf/centos70.conf.php b/install/dist/conf/centos70.conf.php index a40e88ed70e50d7d0bdffaa6a4235b1b96d0fe48..0465e5618a0a33e6e4dc27813b237356c275d090 100644 --- a/install/dist/conf/centos70.conf.php +++ b/install/dist/conf/centos70.conf.php @@ -147,6 +147,11 @@ $conf['amavis']['installed'] = false; // will be detected automatically during i $conf['amavis']['config_dir'] = '/etc/amavisd'; $conf['amavis']['init_script'] = 'amavisd'; +//* Rspamd +$conf['rspamd']['installed'] = false; // will be detected automatically during installation +$conf['rspamd']['config_dir'] = '/etc/rspamd'; +$conf['rspamd']['init_script'] = 'rspamd'; + //* ClamAV $conf['clamav']['installed'] = false; // will be detected automatically during installation $conf['clamav']['init_script'] = 'clamd@amavisd'; diff --git a/install/dist/conf/centos72.conf.php b/install/dist/conf/centos72.conf.php index e7ab6030b7210051697de71425724ceaac4a1119..221cc5d7c40cbaf72a014f61bdb2bb2947f646e8 100644 --- a/install/dist/conf/centos72.conf.php +++ b/install/dist/conf/centos72.conf.php @@ -147,6 +147,11 @@ $conf['amavis']['installed'] = false; // will be detected automatically during i $conf['amavis']['config_dir'] = '/etc/amavisd'; $conf['amavis']['init_script'] = 'amavisd'; +//* Rspamd +$conf['rspamd']['installed'] = false; // will be detected automatically during installation +$conf['rspamd']['config_dir'] = '/etc/rspamd'; +$conf['rspamd']['init_script'] = 'rspamd'; + //* ClamAV $conf['clamav']['installed'] = false; // will be detected automatically during installation $conf['clamav']['init_script'] = 'clamd@amavisd'; diff --git a/install/dist/conf/debian40.conf.php b/install/dist/conf/debian40.conf.php index 613c828d14906474fbda3a3b475508e5b8b2f997..c04a54e998e5224e6d061937527184e18b27cc34 100644 --- a/install/dist/conf/debian40.conf.php +++ b/install/dist/conf/debian40.conf.php @@ -149,6 +149,11 @@ $conf['amavis']['installed'] = false; // will be detected automatically during i $conf['amavis']['config_dir'] = '/etc/amavis'; $conf['amavis']['init_script'] = 'amavis'; +//* Rspamd +$conf['rspamd']['installed'] = false; // will be detected automatically during installation +$conf['rspamd']['config_dir'] = '/etc/rspamd'; +$conf['rspamd']['init_script'] = 'rspamd'; + //* ClamAV $conf['clamav']['installed'] = false; // will be detected automatically during installation $conf['clamav']['init_script'] = 'clamav-daemon'; diff --git a/install/dist/conf/debian60.conf.php b/install/dist/conf/debian60.conf.php index 2c26dcb9cbb26ae89f1126ce15440471485b028a..e7c8f59845f5cf4b957c5c5fc791f61990ce493f 100644 --- a/install/dist/conf/debian60.conf.php +++ b/install/dist/conf/debian60.conf.php @@ -149,6 +149,11 @@ $conf['amavis']['installed'] = false; // will be detected automatically during i $conf['amavis']['config_dir'] = '/etc/amavis'; $conf['amavis']['init_script'] = 'amavis'; +//* Rspamd +$conf['rspamd']['installed'] = false; // will be detected automatically during installation +$conf['rspamd']['config_dir'] = '/etc/rspamd'; +$conf['rspamd']['init_script'] = 'rspamd'; + //* ClamAV $conf['clamav']['installed'] = false; // will be detected automatically during installation $conf['clamav']['init_script'] = 'clamav-daemon'; diff --git a/install/dist/conf/debian90.conf.php b/install/dist/conf/debian90.conf.php index cdaf7aa9a0f1bba39ea7d0ec367e0c0f36d9a4f0..13fd2306543450d27d88f72319388f3ffe07abd8 100644 --- a/install/dist/conf/debian90.conf.php +++ b/install/dist/conf/debian90.conf.php @@ -153,6 +153,11 @@ $conf['amavis']['installed'] = false; // will be detected automatically during i $conf['amavis']['config_dir'] = '/etc/amavis'; $conf['amavis']['init_script'] = 'amavis'; +//* Rspamd +$conf['rspamd']['installed'] = false; // will be detected automatically during installation +$conf['rspamd']['config_dir'] = '/etc/rspamd'; +$conf['rspamd']['init_script'] = 'rspamd'; + //* ClamAV $conf['clamav']['installed'] = false; // will be detected automatically during installation $conf['clamav']['init_script'] = 'clamav-daemon'; diff --git a/install/dist/conf/debiantesting.conf.php b/install/dist/conf/debiantesting.conf.php index 5e5e32f4749666f9a32d8ad55e844be71815e980..6ea9112dff854e87e39fac2c521d48cecf5fe840 100644 --- a/install/dist/conf/debiantesting.conf.php +++ b/install/dist/conf/debiantesting.conf.php @@ -153,6 +153,11 @@ $conf['amavis']['installed'] = false; // will be detected automatically during i $conf['amavis']['config_dir'] = '/etc/amavis'; $conf['amavis']['init_script'] = 'amavis'; +//* Rspamd +$conf['rspamd']['installed'] = false; // will be detected automatically during installation +$conf['rspamd']['config_dir'] = '/etc/rspamd'; +$conf['rspamd']['init_script'] = 'rspamd'; + //* ClamAV $conf['clamav']['installed'] = false; // will be detected automatically during installation $conf['clamav']['init_script'] = 'clamav-daemon'; diff --git a/install/dist/conf/debiantesting.conf.php.orig b/install/dist/conf/debiantesting.conf.php.orig new file mode 100644 index 0000000000000000000000000000000000000000..5e5e32f4749666f9a32d8ad55e844be71815e980 --- /dev/null +++ b/install/dist/conf/debiantesting.conf.php.orig @@ -0,0 +1,234 @@ + diff --git a/install/dist/conf/fedora9.conf.php b/install/dist/conf/fedora9.conf.php index 80539a78593827e76bb7828ee684833f557b9dd7..19c9a4f6259600499d493c66718cf64bb7ff0a13 100644 --- a/install/dist/conf/fedora9.conf.php +++ b/install/dist/conf/fedora9.conf.php @@ -147,6 +147,11 @@ $conf['amavis']['installed'] = false; // will be detected automatically during i $conf['amavis']['config_dir'] = '/etc/amavisd'; $conf['amavis']['init_script'] = 'amavisd'; +//* Rspamd +$conf['rspamd']['installed'] = false; // will be detected automatically during installation +$conf['rspamd']['config_dir'] = '/etc/rspamd'; +$conf['rspamd']['init_script'] = 'rspamd'; + //* ClamAV $conf['clamav']['installed'] = false; // will be detected automatically during installation $conf['clamav']['init_script'] = 'clamd.amavisd'; diff --git a/install/dist/conf/gentoo.conf.php b/install/dist/conf/gentoo.conf.php index 2955cfa71dd391743f705449ea6849428005a367..24c7d0633e0b5b62db4004f329e83d503fb66aad 100644 --- a/install/dist/conf/gentoo.conf.php +++ b/install/dist/conf/gentoo.conf.php @@ -162,6 +162,11 @@ $conf['amavis']['installed'] = false; // will be detected automatically during i $conf['amavis']['config_file'] = '/etc/amavisd.conf'; $conf['amavis']['init_script'] = 'amavisd'; +//* Rspamd +$conf['rspamd']['installed'] = false; // will be detected automatically during installation +$conf['rspamd']['config_dir'] = '/etc/rspamd'; +$conf['rspamd']['init_script'] = 'rspamd'; + //* ClamAV $conf['clamav']['installed'] = false; // will be detected automatically during installation $conf['clamav']['init_script'] = 'clamd'; diff --git a/install/dist/conf/opensuse112.conf.php b/install/dist/conf/opensuse112.conf.php index fa0504652e9e75d908186507a6c69c67c271f4b9..378320a144eb645262d39e645a1e994d7d2823d7 100644 --- a/install/dist/conf/opensuse112.conf.php +++ b/install/dist/conf/opensuse112.conf.php @@ -147,6 +147,11 @@ $conf['amavis']['installed'] = false; // will be detected automatically during i $conf['amavis']['config_dir'] = '/etc'; $conf['amavis']['init_script'] = 'amavis'; +//* Rspamd +$conf['rspamd']['installed'] = false; // will be detected automatically during installation +$conf['rspamd']['config_dir'] = '/etc/rspamd'; +$conf['rspamd']['init_script'] = 'rspamd'; + //* ClamAV $conf['clamav']['installed'] = false; // will be detected automatically during installation $conf['clamav']['init_script'] = 'clamd'; diff --git a/install/dist/conf/ubuntu1604.conf.php b/install/dist/conf/ubuntu1604.conf.php index 9ac56de3f871479033df0a742554ed6e905a3d39..0d3fe23bada198df3c9aae42b6cb42784973a6c1 100644 --- a/install/dist/conf/ubuntu1604.conf.php +++ b/install/dist/conf/ubuntu1604.conf.php @@ -149,6 +149,11 @@ $conf['amavis']['installed'] = false; // will be detected automatically during i $conf['amavis']['config_dir'] = '/etc/amavis'; $conf['amavis']['init_script'] = 'amavis'; +//* Rspamd +$conf['rspamd']['installed'] = false; // will be detected automatically during installation +$conf['rspamd']['config_dir'] = '/etc/rspamd'; +$conf['rspamd']['init_script'] = 'rspamd'; + //* ClamAV $conf['clamav']['installed'] = false; // will be detected automatically during installation $conf['clamav']['init_script'] = 'clamav-daemon'; diff --git a/install/dist/conf/ubuntu1710.conf.php b/install/dist/conf/ubuntu1710.conf.php index 0c87005910a61f8625735be1a6a130eaaee0cd54..0730f8f2d533c712ee78173ebb28b3fed477c514 100644 --- a/install/dist/conf/ubuntu1710.conf.php +++ b/install/dist/conf/ubuntu1710.conf.php @@ -149,6 +149,11 @@ $conf['amavis']['installed'] = false; // will be detected automatically during i $conf['amavis']['config_dir'] = '/etc/amavis'; $conf['amavis']['init_script'] = 'amavis'; +//* Rspamd +$conf['rspamd']['installed'] = false; // will be detected automatically during installation +$conf['rspamd']['config_dir'] = '/etc/rspamd'; +$conf['rspamd']['init_script'] = 'rspamd'; + //* ClamAV $conf['clamav']['installed'] = false; // will be detected automatically during installation $conf['clamav']['init_script'] = 'clamav-daemon'; diff --git a/install/dist/conf/ubuntu1804.conf.php b/install/dist/conf/ubuntu1804.conf.php index 15cdb1c5ebbb74c45ab1f1df2f1c5caf8a008464..2a09f787db46f5abf8fc7d2e15e4804dfe9d3222 100644 --- a/install/dist/conf/ubuntu1804.conf.php +++ b/install/dist/conf/ubuntu1804.conf.php @@ -149,6 +149,11 @@ $conf['amavis']['installed'] = false; // will be detected automatically during i $conf['amavis']['config_dir'] = '/etc/amavis'; $conf['amavis']['init_script'] = 'amavis'; +//* Rspamd +$conf['rspamd']['installed'] = false; // will be detected automatically during installation +$conf['rspamd']['config_dir'] = '/etc/rspamd'; +$conf['rspamd']['init_script'] = 'rspamd'; + //* ClamAV $conf['clamav']['installed'] = false; // will be detected automatically during installation $conf['clamav']['init_script'] = 'clamav-daemon'; @@ -227,4 +232,4 @@ $conf['xmpp']['installed'] = false; $conf['xmpp']['init_script'] = 'metronome'; -?> \ No newline at end of file +?> diff --git a/install/dist/lib/debian60.lib.php b/install/dist/lib/debian60.lib.php index 022d35893206aaeaa4140819cde1f1406e9fb4fc..487d3505125941c7d23ad56a958c3b3e616b274b 100644 --- a/install/dist/lib/debian60.lib.php +++ b/install/dist/lib/debian60.lib.php @@ -68,7 +68,6 @@ class installer extends installer_base { } //* Reconfigure postfix to use dovecot authentication - // Adding the amavisd commands to the postfix configuration $postconf_commands = array ( 'dovecot_destination_recipient_limit = 1', 'virtual_transport = '.$virtual_transport, diff --git a/install/dist/lib/fedora.lib.php b/install/dist/lib/fedora.lib.php index 889bd4288dd7119e719de99505c829a77610148d..5bb8fc0d2566b0dbf0006f384580c31131d37b23 100644 --- a/install/dist/lib/fedora.lib.php +++ b/install/dist/lib/fedora.lib.php @@ -401,7 +401,6 @@ class installer_dist extends installer_base { } //* Reconfigure postfix to use dovecot authentication - // Adding the amavisd commands to the postfix configuration $postconf_commands = array ( 'dovecot_destination_recipient_limit = 1', 'virtual_transport = '.$virtual_transport, diff --git a/install/install.php b/install/install.php index a324669867fc1a06bbf8c5acb76f76bc3ed87ef3..9dff3facf2e71a085e1cbc0994eb7cc8e967957b 100644 --- a/install/install.php +++ b/install/install.php @@ -385,7 +385,14 @@ if($install_mode == 'standard' || strtolower($inst->simple_query('Configure Mail $inst->configure_amavis(); } - //* Configure Getmail + //* Configure Rspamd + $force = @($conf['rspamd']['installed']) ? true : $inst->force_configure_app('Rspamd', ($install_mode == 'expert')); + if($force) { + swriteln('Configuring Rspamd'); + $inst->configure_rspamd(); + } + +//* Configure Getmail $force = @($conf['getmail']['installed']) ? true : $inst->force_configure_app('Getmail', ($install_mode == 'expert')); if($force) { swriteln('Configuring Getmail'); @@ -538,20 +545,6 @@ $install_ispconfig_interface_default = ($conf['mysql']['master_slave_setup'] == if($install_mode == 'standard' || strtolower($inst->simple_query('Install ISPConfig Web Interface', array('y', 'n'), $install_ispconfig_interface_default,'install_ispconfig_web_interface')) == 'y') { swriteln('Installing ISPConfig'); - //** We want to check if the server is a module or cgi based php enabled server - //** TODO: Don't always ask for this somehow ? - /* - $fast_cgi = $inst->simple_query('CGI PHP Enabled Server?', array('yes','no'),'no'); - - if($fast_cgi == 'yes') { - $alias = $inst->free_query('Script Alias', '/php/'); - $path = $inst->free_query('Script Alias Path', '/path/to/cgi/bin'); - $conf['apache']['vhost_cgi_alias'] = sprintf('ScriptAlias %s %s', $alias, $path); - } else { - $conf['apache']['vhost_cgi_alias'] = ""; - } - */ - //** Customise the port ISPConfig runs on $ispconfig_vhost_port = $inst->free_query('ISPConfig Port', '8080','ispconfig_port'); $temp_admin_password = str_shuffle(bin2hex(openssl_random_pseudo_bytes(4))); @@ -602,6 +595,7 @@ if($conf['mysql']['installed'] == true && $conf['mysql']['init_script'] != '') s if($conf['postfix']['installed'] == true && $conf['postfix']['init_script'] != '') system($inst->getinitcommand($conf['postfix']['init_script'], 'restart')); if($conf['saslauthd']['installed'] == true && $conf['saslauthd']['init_script'] != '') system($inst->getinitcommand($conf['saslauthd']['init_script'], 'restart')); if($conf['amavis']['installed'] == true && $conf['amavis']['init_script'] != '') system($inst->getinitcommand($conf['amavis']['init_script'], 'restart')); +if($conf['rspamd']['installed'] == true && $conf['rspamd']['init_script'] != '') system($inst->getinitcommand($conf['rspamd']['init_script'], 'restart')); if($conf['clamav']['installed'] == true && $conf['clamav']['init_script'] != '') system($inst->getinitcommand($conf['clamav']['init_script'], 'restart')); if($conf['courier']['installed'] == true){ if($conf['courier']['courier-authdaemon'] != '') system($inst->getinitcommand($conf['courier']['courier-authdaemon'], 'restart')); diff --git a/install/lib/classes/tpl.inc.php b/install/lib/classes/tpl.inc.php index 73ff19230b6b95f83e8e32d26b86f1e8f243fec8..5bd8ded1f8818f2e1bb8b6d473d479facc1a0db0 100644 --- a/install/lib/classes/tpl.inc.php +++ b/install/lib/classes/tpl.inc.php @@ -357,147 +357,6 @@ if (!defined('vlibTemplateClassLoaded')) { return true; } - /** - * [** EXPERIMENTAL **] - * Function to create a loop from a Db result resource link. - * @param string $loopname to commit loop. If not set, will use last loopname set using newLoop() - * @param string $result link to a Db result resource - * @param string $db_type, type of db that the result resource belongs to. - * @return boolean true/false - * @access public - */ - public function setDbLoop($loopname, $result, $db_type = 'MYSQL') - { - /* - $db_type = strtoupper($db_type); - if (!in_array($db_type, $this->allowed_loop_dbs)) { - vlibTemplateError::raiseError('VT_WARNING_INVALID_LOOP_DB', WARNING, $db_type); - return false; - } - - $loop_arr = array(); - // TODO: Are all these necessary as were onyl using mysql and possible postgres ? - pedro - switch ($db_type) { - - case 'MYSQL': - if (get_resource_type($result) != 'mysql result') { - vlibTemplateError::raiseError('VT_WARNING_INVALID_RESOURCE', WARNING, $db_type); - return false; - } - while($r = mysql_fetch_assoc($result)) { - $loop_arr[] = $r; - } - break; - - case 'POSTGRESQL': - if (get_resource_type($result) != 'pgsql result') { - vlibTemplateError::raiseError('VT_WARNING_INVALID_RESOURCE', WARNING, $db_type); - return false; - } - - $nr = (function_exists('pg_num_rows')) ? pg_num_rows($result) : pg_numrows($result); - - for ($i=0; $i < $nr; $i++) { - $loop_arr[] = pg_fetch_array($result, $i, PGSQL_ASSOC); - } - break; - - case 'INFORMIX': - if (!$result) { - vlibTemplateError::raiseError('VT_WARNING_INVALID_RESOURCE', WARNING, $db_type); - return false; - } - while($r = ifx_fetch_row($result, 'NEXT')) { - $loop_arr[] = $r; - } - break; - - case 'INTERBASE': - if (get_resource_type($result) != 'interbase result') { - vlibTemplateError::raiseError('VT_WARNING_INVALID_RESOURCE', WARNING, $db_type); - return false; - } - while($r = ibase_fetch_row($result)) { - $loop_arr[] = $r; - } - break; - - case 'INGRES': - if (!$result) { - vlibTemplateError::raiseError('VT_WARNING_INVALID_RESOURCE', WARNING, $db_type); - return false; - } - while($r = ingres_fetch_array(INGRES_ASSOC, $result)) { - $loop_arr[] = $r; - } - break; - - case 'MSSQL': - if (get_resource_type($result) != 'mssql result') { - vlibTemplateError::raiseError('VT_WARNING_INVALID_RESOURCE', WARNING, $db_type); - return false; - } - while($r = mssql_fetch_array($result)) { - $loop_arr[] = $r; - } - break; - - case 'MSQL': - if (get_resource_type($result) != 'msql result') { - vlibTemplateError::raiseError('VT_WARNING_INVALID_RESOURCE', WARNING, $db_type); - return false; - } - while($r = msql_fetch_array($result, MSQL_ASSOC)) { - $loop_arr[] = $r; - } - break; - - case 'OCI8': - if (get_resource_type($result) != 'oci8 statement') { - vlibTemplateError::raiseError('VT_WARNING_INVALID_RESOURCE', WARNING, $db_type); - return false; - } - while(OCIFetchInto($result, &$r, OCI_ASSOC+OCI_RETURN_LOBS)) { - $loop_arr[] = $r; - } - break; - - case 'ORACLE': - if (get_resource_type($result) != 'oracle Cursor') { - vlibTemplateError::raiseError('VT_WARNING_INVALID_RESOURCE', WARNING, $db_type); - return false; - } - while(ora_fetch_into($result, &$r, ORA_FETCHINTO_ASSOC)) { - $loop_arr[] = $r; - } - break; - - case 'OVRIMOS': - if (!$result) { - vlibTemplateError::raiseError('VT_WARNING_INVALID_RESOURCE', WARNING, $db_type); - return false; - } - while(ovrimos_fetch_into($result, &$r, 'NEXT')) { - $loop_arr[] = $r; - } - break; - - case 'SYBASE': - if (get_resource_type($result) != 'sybase-db result') { - vlibTemplateError::raiseError('VT_WARNING_INVALID_RESOURCE', WARNING, $db_type); - return false; - } - - while($r = sybase_fetch_array($result)) { - $loop_arr[] = $r; - } - break; - } - $this->setLoop($loopname, $loop_arr); - return true; - */ - } - /** * Sets the name for the curent loop in the 3 step loop process. * @param string $name string to define loop name diff --git a/install/lib/installer_base.lib.php b/install/lib/installer_base.lib.php index 8d0456ef5b632a83b8450cd95b26ff2eddc4dfb4..4db0da1ecfd5a44ad177c9daacdb65e379f7f55a 100644 --- a/install/lib/installer_base.lib.php +++ b/install/lib/installer_base.lib.php @@ -163,6 +163,7 @@ class installer_base { if(is_installed('dovecot')) $conf['dovecot']['installed'] = true; if(is_installed('saslauthd')) $conf['saslauthd']['installed'] = true; if(is_installed('amavisd-new') || is_installed('amavisd')) $conf['amavis']['installed'] = true; + if(is_installed('rspamd')) $conf['rspamd']['installed'] = true; if(is_installed('clamdscan')) $conf['clamav']['installed'] = true; if(is_installed('pure-ftpd') || is_installed('pure-ftpd-wrapper')) $conf['pureftpd']['installed'] = true; if(is_installed('mydns') || is_installed('mydns-ng')) $conf['mydns']['installed'] = true; @@ -1426,6 +1427,192 @@ class installer_base { } + public function configure_rspamd() { + global $conf; + + //* These postconf commands will be executed on installation and update + $server_ini_rec = $this->db->queryOneRecord("SELECT config FROM ?? WHERE server_id = ?", $conf["mysql"]["database"] . '.server', $conf['server_id']); + $server_ini_array = ini_to_array(stripslashes($server_ini_rec['config'])); + unset($server_ini_rec); + + $mail_config = $server_ini_array['mail']; + if($mail_config['content_filter'] === 'rspamd') { + exec("postconf -X 'receive_override_options'"); + exec("postconf -X 'content_filter'"); + + exec("postconf -e 'smtpd_milters = inet:localhost:11332'"); + exec("postconf -e 'non_smtpd_milters = inet:localhost:11332'"); + exec("postconf -e 'milter_protocol = 6'"); + exec("postconf -e 'milter_mail_macros = i {mail_addr} {client_addr} {client_name} {auth_authen}'"); + exec("postconf -e 'milter_default_action = accept'"); + + exec("postconf -e 'smtpd_sender_restrictions = check_sender_access mysql:/etc/postfix/mysql-virtual_sender.cf, permit_mynetworks, permit_sasl_authenticated'"); + + $new_options = array(); + $options = preg_split("/,\s*/", exec("postconf -h smtpd_recipient_restrictions")); + foreach ($options as $value) { + if (!preg_match('/check_policy_service\s+inet:127.0.0.1:10023/', $value)) { + $new_options[] = $value; + } + } + exec("postconf -e 'smtpd_recipient_restrictions = ".implode(", ", $new_options)."'"); + + } + + if(is_user('_rspamd') && is_group('amavis')) { + exec("usermod -G amavis _rspamd"); + } elseif(is_user('rspamd') && is_group('amavis')) { + exec("usermod -G amavis rspamd"); + } + + if(!is_dir('/etc/rspamd/local.d/')){ + mkdir('/etc/rspamd/local.d/', 0755, true); + } + + if(!is_dir('/etc/rspamd/override.d/')){ + mkdir('/etc/rspamd/override.d/', 0755, true); + } + + if ( substr($mail_config['dkim_path'], strlen($mail_config['dkim_path'])-1) == '/' ) { + $mail_config['dkim_path'] = substr($mail_config['dkim_path'], 0, strlen($mail_config['dkim_path'])-1); + } + $dkim_domains = $this->db->queryAllRecords('SELECT `dkim_selector`, `domain` FROM ?? WHERE `dkim` = ? ORDER BY `domain` ASC', $conf['mysql']['database'] . '.mail_domain', 'y'); + $fpp = fopen('/etc/rspamd/local.d/dkim_domains.map', 'w'); + $fps = fopen('/etc/rspamd/local.d/dkim_selectors.map', 'w'); + foreach($dkim_domains as $dkim_domain) { + fwrite($fpp, $dkim_domain['domain'] . ' ' . $mail_config['dkim_path'] . '/' . $dkim_domain['domain'] . '.private' . "\n"); + fwrite($fps, $dkim_domain['domain'] . ' ' . $dkim_domain['dkim_selector'] . "\n"); + } + fclose($fpp); + fclose($fps); + unset($dkim_domains); + + $tpl = new tpl(); + $tpl->newTemplate('rspamd_users.conf.master'); + + $whitelist_ips = array(); + $ips = $this->db->queryAllRecords("SELECT * FROM server_ip WHERE server_id = ?", $conf['server_id']); + if(is_array($ips) && !empty($ips)){ + foreach($ips as $ip){ + $whitelist_ips[] = array('ip' => $ip['ip_address']); + } + } + $tpl->setLoop('whitelist_ips', $whitelist_ips); + wf('/etc/rspamd/local.d/users.conf', $tpl->grab()); + + if(file_exists($conf['ispconfig_install_dir'].'/server/conf-custom/install/rspamd_groups.conf.master')) { + exec('cp '.$conf['ispconfig_install_dir'].'/server/conf-custom/install/rspamd_groups.conf.master /etc/rspamd/local.d/groups.conf'); + } else { + exec('cp tpl/rspamd_groups.conf.master /etc/rspamd/local.d/groups.conf'); + } + + if(file_exists($conf['ispconfig_install_dir'].'/server/conf-custom/install/rspamd_antivirus.conf.master')) { + exec('cp '.$conf['ispconfig_install_dir'].'/server/conf-custom/install/rspamd_antivirus.conf.master /etc/rspamd/local.d/antivirus.conf'); + } else { + exec('cp tpl/rspamd_antivirus.conf.master /etc/rspamd/local.d/antivirus.conf'); + } + + if(file_exists($conf['ispconfig_install_dir'].'/server/conf-custom/install/rspamd_classifier-bayes.conf.master')) { + exec('cp '.$conf['ispconfig_install_dir'].'/server/conf-custom/install/rspamd_classifier-bayes.conf.master /etc/rspamd/local.d/classifier-bayes.conf'); + } else { + exec('cp tpl/rspamd_classifier-bayes.conf.master /etc/rspamd/local.d/classifier-bayes.conf'); + } + + if(file_exists($conf['ispconfig_install_dir'].'/server/conf-custom/install/rspamd_greylist.conf.master')) { + exec('cp '.$conf['ispconfig_install_dir'].'/server/conf-custom/install/rspamd_greylist.conf.master /etc/rspamd/local.d/greylist.conf'); + } else { + exec('cp tpl/rspamd_greylist.conf.master /etc/rspamd/local.d/greylist.conf'); + } + + if(file_exists($conf['ispconfig_install_dir'].'/server/conf-custom/install/rspamd_symbols_antivirus.conf.master')) { + exec('cp '.$conf['ispconfig_install_dir'].'/server/conf-custom/install/rspamd_symbols_antivirus.conf.master /etc/rspamd/local.d/antivirus_group.conf'); + } else { + exec('cp tpl/rspamd_symbols_antivirus.conf.master /etc/rspamd/local.d/antivirus_group.conf'); + } + + if(file_exists($conf['ispconfig_install_dir'].'/server/conf-custom/install/rspamd_override_rbl.conf.master')) { + exec('cp '.$conf['ispconfig_install_dir'].'/server/conf-custom/install/rspamd_override_rbl.conf.master /etc/rspamd/override.d/rbl_group.conf'); + } else { + exec('cp tpl/rspamd_override_rbl.conf.master /etc/rspamd/override.d/rbl_group.conf'); + } + + if(file_exists($conf['ispconfig_install_dir'].'/server/conf-custom/install/rspamd_override_surbl.conf.master')) { + exec('cp '.$conf['ispconfig_install_dir'].'/server/conf-custom/install/rspamd_override_surbl.conf.master /etc/rspamd/override.d/surbl_group.conf'); + } else { + exec('cp tpl/rspamd_override_surbl.conf.master /etc/rspamd/override.d/surbl_group.conf'); + } + + if(file_exists($conf['ispconfig_install_dir'].'/server/conf-custom/install/rspamd_mx_check.conf.master')) { + exec('cp '.$conf['ispconfig_install_dir'].'/server/conf-custom/install/rspamd_mx_check.conf.master /etc/rspamd/local.d/mx_check.conf'); + } else { + exec('cp tpl/rspamd_mx_check.conf.master /etc/rspamd/local.d/mx_check.conf'); + } + + if(file_exists($conf['ispconfig_install_dir'].'/server/conf-custom/install/rspamd_redis.conf.master')) { + exec('cp '.$conf['ispconfig_install_dir'].'/server/conf-custom/install/rspamd_redis.conf.master /etc/rspamd/local.d/redis.conf'); + } else { + exec('cp tpl/rspamd_redis.conf.master /etc/rspamd/local.d/redis.conf'); + } + + if(file_exists($conf['ispconfig_install_dir'].'/server/conf-custom/install/rspamd_milter_headers.conf.master')) { + exec('cp '.$conf['ispconfig_install_dir'].'/server/conf-custom/install/rspamd_milter_headers.conf.master /etc/rspamd/local.d/milter_headers.conf'); + } else { + exec('cp tpl/rspamd_milter_headers.conf.master /etc/rspamd/local.d/milter_headers.conf'); + } + + if(file_exists($conf['ispconfig_install_dir'].'/server/conf-custom/install/rspamd_options.inc.master')) { + exec('cp '.$conf['ispconfig_install_dir'].'/server/conf-custom/install/rspamd_options.inc.master /etc/rspamd/local.d/options.inc'); + } else { + exec('cp tpl/rspamd_options.inc.master /etc/rspamd/local.d/options.inc'); + } + + if(file_exists($conf['ispconfig_install_dir'].'/server/conf-custom/install/rspamd_neural.conf.master')) { + exec('cp '.$conf['ispconfig_install_dir'].'/server/conf-custom/install/rspamd_neural.conf.master /etc/rspamd/local.d/neural.conf'); + } else { + exec('cp tpl/rspamd_neural.conf.master /etc/rspamd/local.d/neural.conf'); + } + + if(file_exists($conf['ispconfig_install_dir'].'/server/conf-custom/install/rspamd_neural_group.conf.master')) { + exec('cp '.$conf['ispconfig_install_dir'].'/server/conf-custom/install/rspamd_neural_group.conf.master /etc/rspamd/local.d/neural_group.conf'); + } else { + exec('cp tpl/rspamd_neural_group.conf.master /etc/rspamd/local.d/neural_group.conf'); + } + + exec('chmod a+r /etc/rspamd/local.d/* /etc/rspamd/override.d/*'); + + $tpl = new tpl(); + $tpl->newTemplate('rspamd_dkim_signing.conf.master'); + $tpl->setVar('dkim_path', $mail_config['dkim_path']); + wf('/etc/rspamd/local.d/dkim_signing.conf', $tpl->grab()); + + $command = 'usermod -a -G amavis _rspamd'; + caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command"); + + if(strpos(rf('/etc/rspamd/rspamd.conf'), '.include "$LOCAL_CONFDIR/local.d/users.conf"') === false){ + af('/etc/rspamd/rspamd.conf', '.include "$LOCAL_CONFDIR/local.d/users.conf"'); + } + + if(!isset($mail_config['rspamd_password']) || !$mail_config['rspamd_password']) { + $mail_config['rspamd_password'] = str_shuffle(bin2hex(openssl_random_pseudo_bytes(12))); + + $server_ini_array['mail']['rspamd_password'] = $mail_config['rspamd_password']; + } + + $server_ini_array['mail']['rspamd_available'] = 'y'; + $server_ini_string = array_to_ini($server_ini_array); + if($this->dbmaster != $this->db) { + $this->dbmaster->query('UPDATE `server` SET `config` = ? WHERE `server_id` = ?', $server_ini_string, $conf['server_id']); + } + $this->db->query('UPDATE `server` SET `config` = ? WHERE `server_id` = ?', $server_ini_string, $conf['server_id']); + unset($server_ini_array); + unset($server_ini_string); + + $tpl = new tpl(); + $tpl->newTemplate('rspamd_worker-controller.inc.master'); + $tpl->setVar('rspamd_password', $mail_config['rspamd_password']); + wf('/etc/rspamd/local.d/worker-controller.inc', $tpl->grab()); + } + public function configure_spamassassin() { global $conf; diff --git a/install/lib/installer_base.lib.php.orig b/install/lib/installer_base.lib.php.orig new file mode 100644 index 0000000000000000000000000000000000000000..8d0456ef5b632a83b8450cd95b26ff2eddc4dfb4 --- /dev/null +++ b/install/lib/installer_base.lib.php.orig @@ -0,0 +1,2962 @@ +conf = $conf; + } + + //: TODO Implement the translation function and language files for the installer. + public function lng($text) { + return $text; + } + + public function error($msg) { + die('ERROR: '.$msg."\n"); + } + + public function warning($msg) { + echo 'WARNING: '.$msg."\n"; + } + + public function simple_query($query, $answers, $default, $name = '') { + global $autoinstall, $autoupdate; + $finished = false; + do { + if($name != '' && $autoinstall[$name] != '') { + if($autoinstall[$name] == 'default') { + $input = $default; + } else { + $input = $autoinstall[$name]; + } + } elseif($name != '' && $autoupdate[$name] != '') { + if($autoupdate[$name] == 'default') { + $input = $default; + } else { + $input = $autoupdate[$name]; + } + } else { + $answers_str = implode(',', $answers); + swrite($this->lng($query).' ('.$answers_str.') ['.$default.']: '); + $input = sread(); + } + + //* Stop the installation + if($input == 'quit') { + swriteln($this->lng("Installation terminated by user.\n")); + die(); + } + + //* Select the default + if($input == '') { + $answer = $default; + $finished = true; + } + + //* Set answer id valid + if(in_array($input, $answers)) { + $answer = $input; + $finished = true; + } + + } while ($finished == false); + swriteln(); + return $answer; + } + + public function free_query($query, $default, $name = '') { + global $autoinstall, $autoupdate; + if($name != '' && $autoinstall[$name] != '') { + if($autoinstall[$name] == 'default') { + $input = $default; + } else { + $input = $autoinstall[$name]; + } + } elseif($name != '' && $autoupdate[$name] != '') { + if($autoupdate[$name] == 'default') { + $input = $default; + } else { + $input = $autoupdate[$name]; + } + } else { + swrite($this->lng($query).' ['.$default.']: '); + $input = sread(); + } + + //* Stop the installation + if($input == 'quit') { + swriteln($this->lng("Installation terminated by user.\n")); + die(); + } + + $answer = ($input == '') ? $default : $input; + swriteln(); + return $answer; + } + + /* + // TODO: this function is not used atmo I think - pedro + function request_language(){ + + swriteln(lng('Enter your language')); + swriteln(lng('de, en')); + + } + */ + + //** Detect PHP-Version + public function get_php_version() { + if(version_compare(PHP_VERSION, $this->min_php, '<')) return false; + else return true; + } + + //** Detect installed applications + public function find_installed_apps() { + global $conf; + + if(is_installed('mysql') || is_installed('mysqld')) $conf['mysql']['installed'] = true; + if(is_installed('postfix')) $conf['postfix']['installed'] = true; + if(is_installed('postgrey')) $conf['postgrey']['installed'] = true; + if(is_installed('mailman') || is_installed('mmsitepass')) $conf['mailman']['installed'] = true; + if(is_installed('apache') || is_installed('apache2') || is_installed('httpd') || is_installed('httpd2')) $conf['apache']['installed'] = true; + if(is_installed('getmail')) $conf['getmail']['installed'] = true; + if(is_installed('courierlogger')) $conf['courier']['installed'] = true; + if(is_installed('dovecot')) $conf['dovecot']['installed'] = true; + if(is_installed('saslauthd')) $conf['saslauthd']['installed'] = true; + if(is_installed('amavisd-new') || is_installed('amavisd')) $conf['amavis']['installed'] = true; + if(is_installed('clamdscan')) $conf['clamav']['installed'] = true; + if(is_installed('pure-ftpd') || is_installed('pure-ftpd-wrapper')) $conf['pureftpd']['installed'] = true; + if(is_installed('mydns') || is_installed('mydns-ng')) $conf['mydns']['installed'] = true; + if(is_installed('jk_chrootsh')) $conf['jailkit']['installed'] = true; + if(is_installed('pdns_server') || is_installed('pdns_control')) $conf['powerdns']['installed'] = true; + if(is_installed('named') || is_installed('bind') || is_installed('bind9')) $conf['bind']['installed'] = true; + if(is_installed('squid')) $conf['squid']['installed'] = true; + if(is_installed('nginx')) $conf['nginx']['installed'] = true; + if(is_installed('iptables') && is_installed('ufw')) { + $conf['ufw']['installed'] = true; + } elseif(is_installed('iptables')) { + $conf['firewall']['installed'] = true; + } + if(is_installed('fail2ban-server')) $conf['fail2ban']['installed'] = true; + if(is_installed('vzctl')) $conf['openvz']['installed'] = true; + if(is_installed('metronome') && is_installed('metronomectl')) $conf['xmpp']['installed'] = true; + if(is_installed('spamassassin')) $conf['spamassassin']['installed'] = true; + // if(is_installed('vlogger')) $conf['vlogger']['installed'] = true; + // ISPConfig ships with vlogger, so it is always installed. + $conf['vlogger']['installed'] = true; + if(is_installed('cron') || is_installed('anacron')) $conf['cron']['installed'] = true; + + if (($conf['apache']['installed'] && is_file($conf['apache']["vhost_conf_enabled_dir"]."/000-ispconfig.vhost")) || ($conf['nginx']['installed'] && is_file($conf['nginx']["vhost_conf_enabled_dir"]."/000-ispconfig.vhost"))) $this->ispconfig_interface_installed = true; + } + + public function force_configure_app($service, $enable_force=true) { + $force = false; + if(AUTOINSTALL == true) return false; + if($enable_force == true) { + swriteln("[WARN] autodetect for $service failed"); + } else { + swriteln("[INFO] service $service not detected"); + } + if($enable_force) { + if(strtolower($this->simple_query("Force configure $service", array('y', 'n'), 'n') ) == 'y') { + $force = true; + } else swriteln("Skipping $service\n"); + } + return $force; + } + + public function reconfigure_app($service, $reconfigure_services_answer) { + $reconfigure = false; + if ($reconfigure_services_answer != 'selected') { + $reconfigure = true; + } else { + if(strtolower($this->simple_query("Reconfigure $service", array('y', 'n'), 'y') ) == 'y') { + $reconfigure = true; + } else { + swriteln("Skip reconfigure $service\n"); + } + } + return $reconfigure; + } + + /** Create the database for ISPConfig */ + + + public function configure_database() { + global $conf; + + //* check sql-mode + /*$check_sql_mode = $this->db->queryOneRecord("SELECT @@sql_mode"); + + if ($check_sql_mode['@@sql_mode'] != '' && $check_sql_mode['@@sql_mode'] != 'NO_ENGINE_SUBSTITUTION') { + echo "Wrong SQL-mode. You should use NO_ENGINE_SUBSTITUTION. Add\n\n"; + echo " sql-mode=\"NO_ENGINE_SUBSTITUTION\"\n\n"; + echo"to the mysqld-section in your mysql-config on this server and restart mysqld afterwards\n"; + die(); + }*/ + + $unwanted_sql_plugins = array('validate_password'); + $sql_plugins = $this->db->queryAllRecords("SELECT plugin_name FROM information_schema.plugins WHERE plugin_status='ACTIVE' AND plugin_name IN ?", $unwanted_sql_plugins); + if(is_array($sql_plugins) && !empty($sql_plugins)) { + foreach ($sql_plugins as $plugin) echo "Login in to MySQL and disable $plugin[plugin_name] with:\n\n UNINSTALL PLUGIN $plugin[plugin_name];"; + die(); + } + + //** Create the database + if(!$this->db->query('CREATE DATABASE IF NOT EXISTS ?? DEFAULT CHARACTER SET ?', $conf['mysql']['database'], $conf['mysql']['charset'])) { + $this->error('Unable to create MySQL database: '.$conf['mysql']['database'].'.'); + } + + //* Set the database name in the DB library + $this->db->setDBName($conf['mysql']['database']); + + //* Load the database dump into the database, if database contains no tables + $db_tables = $this->db->getTables(); + if(count($db_tables) > 0) { + $this->error('Stopped: Database already contains some tables.'); + } else { + if($conf['mysql']['admin_password'] == '') { + caselog("mysql --default-character-set=".escapeshellarg($conf['mysql']['charset'])." -h ".escapeshellarg($conf['mysql']['host'])." -u ".escapeshellarg($conf['mysql']['admin_user'])." -P ".escapeshellarg($conf['mysql']['port'])." ".escapeshellarg($conf['mysql']['database'])." < '".ISPC_INSTALL_ROOT."/install/sql/ispconfig3.sql' &> /dev/null", + __FILE__, __LINE__, 'read in ispconfig3.sql', 'could not read in ispconfig3.sql'); + } else { + caselog("mysql --default-character-set=".escapeshellarg($conf['mysql']['charset'])." -h ".escapeshellarg($conf['mysql']['host'])." -u ".escapeshellarg($conf['mysql']['admin_user'])." -p".escapeshellarg($conf['mysql']['admin_password'])." -P ".escapeshellarg($conf['mysql']['port'])." ".escapeshellarg($conf['mysql']['database'])." < '".ISPC_INSTALL_ROOT."/install/sql/ispconfig3.sql' &> /dev/null", + __FILE__, __LINE__, 'read in ispconfig3.sql', 'could not read in ispconfig3.sql'); + } + $db_tables = $this->db->getTables(); + if(count($db_tables) == 0) { + $this->error('Unable to load SQL-Dump into database table.'); + } + + //* Load system.ini into the sys_ini table + $system_ini = rf('tpl/system.ini.master'); + $this->db->query("UPDATE sys_ini SET config = ? WHERE sysini_id = 1", $system_ini); + + } + } + + //** Create the server record in the database + public function add_database_server_record() { + + global $conf; + + if($conf['mysql']['host'] == 'localhost') { + $from_host = 'localhost'; + } else { + $from_host = $conf['hostname']; + } + + // Delete ISPConfig user in the local database, in case that it exists + $this->db->query("DROP USER ?@?", $conf['mysql']['ispconfig_user'], $from_host); + $this->db->query("DROP DATABASE IF EXISTS ?", $conf['mysql']['database']); + + //* Create the ISPConfig database user and grant permissions in the local database + $query = 'CREATE USER ?@? IDENTIFIED BY ?'; + if(!$this->db->query($query, $conf['mysql']['ispconfig_user'], $from_host, $conf['mysql']['ispconfig_password'])) { + $this->error('Unable to create database user: '.$conf['mysql']['ispconfig_user'].' Error: '.$this->db->errorMessage); + } + $query = 'GRANT SELECT, INSERT, UPDATE, DELETE ON ?? TO ?@?'; + if(!$this->db->query($query, $conf['mysql']['database'] . ".*", $conf['mysql']['ispconfig_user'], $from_host)) { + $this->error('Unable to grant databse permissions to user: '.$conf['mysql']['ispconfig_user'].' Error: '.$this->db->errorMessage); + } + + //* Set the database name in the DB library + $this->db->setDBName($conf['mysql']['database']); + + $tpl_ini_array = ini_to_array(rf('tpl/server.ini.master')); + + //* Update further distribution specific parameters for server config here + //* HINT: Every line added here has to be added in update.lib.php too!! + $tpl_ini_array['web']['vhost_conf_dir'] = $conf['apache']['vhost_conf_dir']; + $tpl_ini_array['web']['vhost_conf_enabled_dir'] = $conf['apache']['vhost_conf_enabled_dir']; + $tpl_ini_array['jailkit']['jailkit_chroot_app_programs'] = $conf['jailkit']['jailkit_chroot_app_programs']; + $tpl_ini_array['fastcgi']['fastcgi_phpini_path'] = $conf['fastcgi']['fastcgi_phpini_path']; + $tpl_ini_array['fastcgi']['fastcgi_starter_path'] = $conf['fastcgi']['fastcgi_starter_path']; + $tpl_ini_array['fastcgi']['fastcgi_bin'] = $conf['fastcgi']['fastcgi_bin']; + $tpl_ini_array['server']['hostname'] = $conf['hostname']; + $tpl_ini_array['server']['ip_address'] = @gethostbyname($conf['hostname']); + $tpl_ini_array['server']['firewall'] = ($conf['ufw']['installed'] == true)?'ufw':'bastille'; + $tpl_ini_array['web']['website_basedir'] = $conf['web']['website_basedir']; + $tpl_ini_array['web']['website_path'] = $conf['web']['website_path']; + $tpl_ini_array['web']['website_symlinks'] = $conf['web']['website_symlinks']; + $tpl_ini_array['cron']['crontab_dir'] = $conf['cron']['crontab_dir']; + $tpl_ini_array['web']['security_level'] = 20; + $tpl_ini_array['web']['user'] = $conf['apache']['user']; + $tpl_ini_array['web']['group'] = $conf['apache']['group']; + $tpl_ini_array['web']['php_ini_path_apache'] = $conf['apache']['php_ini_path_apache']; + $tpl_ini_array['web']['php_ini_path_cgi'] = $conf['apache']['php_ini_path_cgi']; + $tpl_ini_array['mail']['pop3_imap_daemon'] = ($conf['dovecot']['installed'] == true)?'dovecot':'courier'; + $tpl_ini_array['mail']['mail_filter_syntax'] = ($conf['dovecot']['installed'] == true)?'sieve':'maildrop'; + $tpl_ini_array['dns']['bind_user'] = $conf['bind']['bind_user']; + $tpl_ini_array['dns']['bind_group'] = $conf['bind']['bind_group']; + $tpl_ini_array['dns']['bind_zonefiles_dir'] = $conf['bind']['bind_zonefiles_dir']; + $tpl_ini_array['dns']['named_conf_path'] = $conf['bind']['named_conf_path']; + $tpl_ini_array['dns']['named_conf_local_path'] = $conf['bind']['named_conf_local_path']; + + $tpl_ini_array['web']['nginx_vhost_conf_dir'] = $conf['nginx']['vhost_conf_dir']; + $tpl_ini_array['web']['nginx_vhost_conf_enabled_dir'] = $conf['nginx']['vhost_conf_enabled_dir']; + $tpl_ini_array['web']['nginx_user'] = $conf['nginx']['user']; + $tpl_ini_array['web']['nginx_group'] = $conf['nginx']['group']; + $tpl_ini_array['web']['nginx_cgi_socket'] = $conf['nginx']['cgi_socket']; + $tpl_ini_array['web']['php_fpm_init_script'] = $conf['nginx']['php_fpm_init_script']; + $tpl_ini_array['web']['php_fpm_ini_path'] = $conf['nginx']['php_fpm_ini_path']; + $tpl_ini_array['web']['php_fpm_pool_dir'] = $conf['nginx']['php_fpm_pool_dir']; + $tpl_ini_array['web']['php_fpm_start_port'] = $conf['nginx']['php_fpm_start_port']; + $tpl_ini_array['web']['php_fpm_socket_dir'] = $conf['nginx']['php_fpm_socket_dir']; + + if ($conf['nginx']['installed'] == true) { + $tpl_ini_array['web']['server_type'] = 'nginx'; + $tpl_ini_array['global']['webserver'] = 'nginx'; + } + + if (array_key_exists('awstats', $conf)) { + foreach ($conf['awstats'] as $aw_sett => $aw_value) { + $tpl_ini_array['web']['awstats_'.$aw_sett] = $aw_value; + } + } + + $server_ini_content = array_to_ini($tpl_ini_array); + + $mail_server_enabled = ($conf['services']['mail'])?1:0; + $web_server_enabled = ($conf['services']['web'])?1:0; + $dns_server_enabled = ($conf['services']['dns'])?1:0; + $file_server_enabled = ($conf['services']['file'])?1:0; + $db_server_enabled = ($conf['services']['db'])?1:0; + $vserver_server_enabled = ($conf['openvz']['installed'])?1:0; + $proxy_server_enabled = (isset($conf['services']['proxy']) && $conf['services']['proxy'])?1:0; + $firewall_server_enabled = (isset($conf['services']['firewall']) && $conf['services']['firewall'])?1:0; + + //** Get the database version number based on the patchfiles + $found = true; + $current_db_version = 1; + while($found == true) { + $next_db_version = intval($current_db_version + 1); + $patch_filename = realpath(dirname(__FILE__).'/../').'/sql/incremental/upd_'.str_pad($next_db_version, 4, '0', STR_PAD_LEFT).'.sql'; + if(is_file($patch_filename)) { + $current_db_version = $next_db_version; + } else { + $found = false; + } + } + $current_db_version = intval($current_db_version); + + + if($conf['mysql']['master_slave_setup'] == 'y') { + + //* Insert the server record in master DB + $sql = "INSERT INTO `server` (`sys_userid`, `sys_groupid`, `sys_perm_user`, `sys_perm_group`, `sys_perm_other`, `server_name`, `mail_server`, `web_server`, `dns_server`, `file_server`, `db_server`, `vserver_server`, `config`, `updated`, `active`, `dbversion`,`firewall_server`,`proxy_server`) VALUES (1, 1, 'riud', 'riud', 'r', ?, ?, ?, ?, ?, ?, ?, ?, 0, 1, ?, ?, ?);"; + $this->dbmaster->query($sql, $conf['hostname'], $mail_server_enabled, $web_server_enabled, $dns_server_enabled, $file_server_enabled, $db_server_enabled, $vserver_server_enabled, $server_ini_content, $current_db_version, $proxy_server_enabled, $firewall_server_enabled); + $conf['server_id'] = $this->dbmaster->insertID(); + $conf['server_id'] = $conf['server_id']; + + //* Insert the same record in the local DB + $sql = "INSERT INTO `server` (`server_id`, `sys_userid`, `sys_groupid`, `sys_perm_user`, `sys_perm_group`, `sys_perm_other`, `server_name`, `mail_server`, `web_server`, `dns_server`, `file_server`, `db_server`, `vserver_server`, `config`, `updated`, `active`, `dbversion`,`firewall_server`,`proxy_server`) VALUES (?,1, 1, 'riud', 'riud', 'r', ?, ?, ?, ?, ?, ?, ?, ?, 0, 1, ?, ?, ?);"; + $this->db->query($sql, $conf['server_id'], $conf['hostname'], $mail_server_enabled, $web_server_enabled, $dns_server_enabled, $file_server_enabled, $db_server_enabled, $vserver_server_enabled, $server_ini_content, $current_db_version, $proxy_server_enabled, $firewall_server_enabled); + + //* username for the ispconfig user + $conf['mysql']['master_ispconfig_user'] = 'ispcsrv'.$conf['server_id']; + + $this->grant_master_database_rights(); + + } else { + //* Insert the server, if its not a mster / slave setup + $sql = "INSERT INTO `server` (`sys_userid`, `sys_groupid`, `sys_perm_user`, `sys_perm_group`, `sys_perm_other`, `server_name`, `mail_server`, `web_server`, `dns_server`, `file_server`, `db_server`, `vserver_server`, `config`, `updated`, `active`, `dbversion`,`firewall_server`,`proxy_server`) VALUES (1, 1, 'riud', 'riud', 'r', ?, ?, ?, ?, ?, ?, ?, ?, 0, 1, ?, ?, ?);"; + $this->db->query($sql, $conf['hostname'], $mail_server_enabled, $web_server_enabled, $dns_server_enabled, $file_server_enabled, $db_server_enabled, $vserver_server_enabled, $server_ini_content, $current_db_version, $proxy_server_enabled, $firewall_server_enabled); + $conf['server_id'] = $this->db->insertID(); + $conf['server_id'] = $conf['server_id']; + } + + + } + + public function detect_ips(){ + global $conf; + + exec("ip addr show | awk '/global/ { print $2 }' | cut -d '/' -f 1", $output, $retval); + + if($retval == 0){ + if(is_array($output) && !empty($output)){ + foreach($output as $line){ + $line = trim($line); + $ip_type = ''; + if (filter_var($line, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4)) { + $ip_type = 'IPv4'; + } + if (filter_var($line, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6)) { + $ip_type = 'IPv6'; + } + if($ip_type == '') continue; + if($this->db->dbHost != $this->dbmaster->dbHost){ + $this->dbmaster->query('INSERT INTO server_ip ( + sys_userid, sys_groupid, sys_perm_user, sys_perm_group, + sys_perm_other, server_id, client_id, ip_type, ip_address, + virtualhost, virtualhost_port + ) VALUES ( + 1, + 1, + "riud", + "riud", + "", + ?, + 0, + ?, + ?, + "y", + "80,443" + )', $conf['server_id'], $ip_type, $line); + $server_ip_id = $this->dbmaster->insertID(); + $this->db->query('INSERT INTO server_ip ( + server_php_id, sys_userid, sys_groupid, sys_perm_user, sys_perm_group, + sys_perm_other, server_id, client_id, ip_type, ip_address, + virtualhost, virtualhost_port + ) VALUES ( + ?, + 1, + 1, + "riud", + "riud", + "", + ?, + 0, + ?, + ?, + "y", + "80,443" + )', $server_ip_id, $conf['server_id'], $ip_type, $line); + } else { + $this->db->query('INSERT INTO server_ip ( + sys_userid, sys_groupid, sys_perm_user, sys_perm_group, + sys_perm_other, server_id, client_id, ip_type, ip_address, + virtualhost, virtualhost_port + ) VALUES ( + 1, + 1, + "riud", + "riud", + "", + ?, + 0, + ?, + ?, + "y", + "80,443" + )', $conf['server_id'], $ip_type, $line); + } + } + } + } + } + + public function grant_master_database_rights($verbose = false) { + global $conf; + + /* + * The following code is a little bit tricky: + * * If we HAVE a master-slave - Setup then the client has to grant the rights for himself + * at the master. + * * If we DO NOT have a master-slave - Setup then we have two possibilities + * 1) it is a single server + * 2) it is the MASTER of n clients + */ + $hosts = array(); + + if($conf['mysql']['master_slave_setup'] == 'y') { + /* + * it is a master-slave - Setup so the slave has to grant its rights in the master + * database + */ + + //* insert the ispconfig user in the remote server + $from_host = $conf['hostname']; + $from_ip = gethostbyname($conf['hostname']); + + $hosts[$from_host]['user'] = $conf['mysql']['master_ispconfig_user']; + $hosts[$from_host]['db'] = $conf['mysql']['master_database']; + $hosts[$from_host]['pwd'] = $conf['mysql']['master_ispconfig_password']; + + $hosts[$from_ip]['user'] = $conf['mysql']['master_ispconfig_user']; + $hosts[$from_ip]['db'] = $conf['mysql']['master_database']; + $hosts[$from_ip]['pwd'] = $conf['mysql']['master_ispconfig_password']; + } else{ + /* + * it is NOT a master-slave - Setup so we have to find out all clients and their + * host + */ + $query = "SELECT Host, User FROM mysql.user WHERE User like 'ispcsrv%' ORDER BY User, Host"; + $data = $this->dbmaster->queryAllRecords($query); + if($data === false) { + $this->error('Unable to get the user rights: '.$value['db'].' Error: '.$this->dbmaster->errorMessage); + } + foreach ($data as $item){ + $hosts[$item['Host']]['user'] = $item['User']; + $hosts[$item['Host']]['db'] = $conf['mysql']['master_database']; + $hosts[$item['Host']]['pwd'] = ''; // the user already exists, so we need no pwd! + } + } + + if(count($hosts) > 0) { + foreach($hosts as $host => $value) { + /* + * If a pwd exists, this means, we have to add the new user (and his pwd). + * if not, the user already exists and we do not need the pwd + */ + if ($value['pwd'] != ''){ + $query = "CREATE USER ?@? IDENTIFIED BY ?"; + if ($verbose){ + echo "\n\n" . $query ."\n"; + } + $this->dbmaster->query($query, $value['user'], $host, $value['pwd']); // ignore the error + } + + /* + * Try to delete all rights of the user in case that it exists. + * In Case that it will not exist, do nothing (ignore the error!) + */ + $query = "REVOKE ALL PRIVILEGES, GRANT OPTION FROM ?@?"; + if ($verbose){ + echo "\n\n" . $query ."\n"; + } + $this->dbmaster->query($query, $value['user'], $host); // ignore the error + + //* Create the ISPConfig database user in the remote database + $query = "GRANT SELECT ON ?? TO ?@?"; + if ($verbose){ + echo $query ."\n"; + } + if(!$this->dbmaster->query($query, $value['db'] . '.server', $value['user'], $host)) { + $this->warning('Unable to set rights of user in master database: '.$value['db']."\n Query: ".$query."\n Error: ".$this->dbmaster->errorMessage); + } + + $query = "GRANT SELECT, INSERT ON ?? TO ?@?"; + if ($verbose){ + echo $query ."\n"; + } + if(!$this->dbmaster->query($query, $value['db'] . '.sys_log', $value['user'], $host)) { + $this->warning('Unable to set rights of user in master database: '.$value['db']."\n Query: ".$query."\n Error: ".$this->dbmaster->errorMessage); + } + + $query = "GRANT SELECT, UPDATE(`status`, `error`) ON ?? TO ?@?"; + if ($verbose){ + echo $query ."\n"; + } + if(!$this->dbmaster->query($query, $value['db'] . '.sys_datalog', $value['user'], $host)) { + $this->warning('Unable to set rights of user in master database: '.$value['db']."\n Query: ".$query."\n Error: ".$this->dbmaster->errorMessage); + } + + $query = "GRANT SELECT, UPDATE(`status`) ON ?? TO ?@?"; + if ($verbose){ + echo $query ."\n"; + } + if(!$this->dbmaster->query($query, $value['db'] . '.software_update_inst', $value['user'], $host)) { + $this->warning('Unable to set rights of user in master database: '.$value['db']."\n Query: ".$query."\n Error: ".$this->dbmaster->errorMessage); + } + + $query = "GRANT SELECT, UPDATE(`updated`) ON ?? TO ?@?"; + if ($verbose){ + echo $query ."\n"; + } + if(!$this->dbmaster->query($query, $value['db'] . '.server', $value['user'], $host)) { + $this->warning('Unable to set rights of user in master database: '.$value['db']."\n Query: ".$query."\n Error: ".$this->dbmaster->errorMessage); + } + + $query = "GRANT SELECT, UPDATE (`ssl`, `ssl_letsencrypt`, `ssl_request`, `ssl_cert`, `ssl_action`, `ssl_key`) ON ?? TO ?@?"; + if ($verbose){ + echo $query ."\n"; + } + if(!$this->dbmaster->query($query, $value['db'] . '.web_domain', $value['user'], $host)) { + $this->warning('Unable to set rights of user in master database: '.$value['db']."\n Query: ".$query."\n Error: ".$this->dbmaster->errorMessage); + } + + $query = "GRANT SELECT ON ?? TO ?@?"; + if ($verbose){ + echo $query ."\n"; + } + if(!$this->dbmaster->query($query, $value['db'] . '.sys_group', $value['user'], $host)) { + $this->warning('Unable to set rights of user in master database: '.$value['db']."\n Query: ".$query."\n Error: ".$this->dbmaster->errorMessage); + } + + $query = "GRANT SELECT, UPDATE (`action_state`, `response`) ON ?? TO ?@?"; + if ($verbose){ + echo $query ."\n"; + } + if(!$this->dbmaster->query($query, $value['db'] . '.sys_remoteaction', $value['user'], $host)) { + $this->warning('Unable to set rights of user in master database: '.$value['db']."\n Query: ".$query."\n Error: ".$this->dbmaster->errorMessage); + } + + $query = "GRANT SELECT, INSERT , DELETE ON ?? TO ?@?"; + if ($verbose){ + echo $query ."\n"; + } + if(!$this->dbmaster->query($query, $value['db'] . '.monitor_data', $value['user'], $host)) { + $this->warning('Unable to set rights of user in master database: '.$value['db']."\n Query: ".$query."\n Error: ".$this->dbmaster->errorMessage); + } + + $query = "GRANT SELECT, INSERT, UPDATE ON ?? TO ?@?"; + if ($verbose){ + echo $query ."\n"; + } + if(!$this->dbmaster->query($query, $value['db'] . '.mail_traffic', $value['user'], $host)) { + $this->warning('Unable to set rights of user in master database: '.$value['db']."\n Query: ".$query."\n Error: ".$this->dbmaster->errorMessage); + } + + $query = "GRANT SELECT, INSERT, UPDATE ON ?? TO ?@?"; + if ($verbose){ + echo $query ."\n"; + } + if(!$this->dbmaster->query($query, $value['db'] . '.web_traffic', $value['user'], $host)) { + $this->warning('Unable to set rights of user in master database: '.$value['db']."\n Query: ".$query."\n Error: ".$this->dbmaster->errorMessage); + } + + $query = "GRANT SELECT, UPDATE, DELETE ON ?? TO ?@?"; + if ($verbose){ + echo $query ."\n"; + } + if(!$this->dbmaster->query($query, $value['db'] . '.aps_instances', $value['user'], $host)) { + $this->warning('Unable to set rights of user in master database: '.$value['db']."\n Query: ".$query."\n Error: ".$this->dbmaster->errorMessage); + } + + $query = "GRANT SELECT, DELETE ON ?? TO ?@?"; + if ($verbose){ + echo $query ."\n"; + } + if(!$this->dbmaster->query($query, $value['db'] . '.aps_instances_settings', $value['user'], $host)) { + $this->warning('Unable to set rights of user in master database: '.$value['db']."\n Query: ".$query."\n Error: ".$this->dbmaster->errorMessage); + } + + $query = "GRANT SELECT, INSERT, DELETE ON ?? TO ?@?"; + if ($verbose){ + echo $query ."\n"; + } + if(!$this->dbmaster->query($query, $value['db'] . '.web_backup', $value['user'], $host)) { + $this->warning('Unable to set rights of user in master database: '.$value['db']."\n Query: ".$query."\n Error: ".$this->dbmaster->errorMessage); + } + + $query = "GRANT SELECT, INSERT, DELETE ON ?? TO ?@?"; + if ($verbose){ + echo $query ."\n"; + } + if(!$this->dbmaster->query($query, $value['db'] . '.mail_backup', $value['user'], $host)) { + $this->warning('Unable to set rights of user in master database: '.$value['db']."\n Query: ".$query."\n Error: ".$this->dbmaster->errorMessage); + } + + $query = "GRANT SELECT, UPDATE(`dnssec_initialized`, `dnssec_info`, `dnssec_last_signed`) ON ?? TO ?@?"; + if ($verbose){ + echo $query ."\n"; + } + if(!$this->dbmaster->query($query, $value['db'] . '.dns_soa', $value['user'], $host)) { + $this->warning('Unable to set rights of user in master database: '.$value['db']."\n Query: ".$query."\n Error: ".$this->dbmaster->errorMessage); + } + + $query = "GRANT SELECT, INSERT, UPDATE ON ?? TO ?@?"; + if ($verbose){ + echo $query ."\n"; + } + if(!$this->dbmaster->query($query, $value['db'] . '.ftp_traffic', $value['user'], $host)) { + $this->warning('Unable to set rights of user in master database: '.$value['db']."\n Query: ".$query."\n Error: ".$this->dbmaster->errorMessage); + } + + } + + } + + } + + //** writes postfix configuration files + public function process_postfix_config($configfile) { + global $conf; + + $config_dir = $conf['postfix']['config_dir'].'/'; + $full_file_name = $config_dir.$configfile; + //* Backup exiting file + if(is_file($full_file_name)) { + copy($full_file_name, $config_dir.$configfile.'~'); + } + $content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/'.$configfile.'.master', 'tpl/'.$configfile.'.master'); + $content = str_replace('{mysql_server_ispconfig_user}', $conf['mysql']['ispconfig_user'], $content); + $content = str_replace('{mysql_server_ispconfig_password}', $conf['mysql']['ispconfig_password'], $content); + $content = str_replace('{mysql_server_database}', $conf['mysql']['database'], $content); + $content = str_replace('{mysql_server_ip}', $conf['mysql']['ip'], $content); + $content = str_replace('{server_id}', $conf['server_id'], $content); + wf($full_file_name, $content); + } + + public function configure_jailkit() { + global $conf; + + $cf = $conf['jailkit']; + $config_dir = $cf['config_dir']; + $jk_init = $cf['jk_init']; + $jk_chrootsh = $cf['jk_chrootsh']; + + if (is_dir($config_dir)) { + if(is_file($config_dir.'/'.$jk_init)) copy($config_dir.'/'.$jk_init, $config_dir.'/'.$jk_init.'~'); + if(is_file($config_dir.'/'.$jk_chrootsh.'.master')) copy($config_dir.'/'.$jk_chrootsh.'.master', $config_dir.'/'.$jk_chrootsh.'~'); + + if(is_file($conf['ispconfig_install_dir'].'/server/conf-custom/install/'.$jk_init.'.master')) { + copy($conf['ispconfig_install_dir'].'/server/conf-custom/install/'.$jk_init.'.master', $config_dir.'/'.$jk_init); + } else { + copy('tpl/'.$jk_init.'.master', $config_dir.'/'.$jk_init); + } + if(is_file($conf['ispconfig_install_dir'].'/server/conf-custom/install/'.$jk_chrootsh.'.master')) { + copy($conf['ispconfig_install_dir'].'/server/conf-custom/install/'.$jk_chrootsh.'.master', $config_dir.'/'.$jk_chrootsh); + } else { + copy('tpl/'.$jk_chrootsh.'.master', $config_dir.'/'.$jk_chrootsh); + } + } + + //* help jailkit fo find its ini files + if(!is_link('/usr/jk_socketd.ini')) exec('ln -s /etc/jailkit/jk_socketd.ini /usr/jk_socketd.ini'); + if(!is_link('/usr/jk_init.ini')) exec('ln -s /etc/jailkit/jk_init.ini /usr/jk_init.ini'); + + } + + public function configure_mailman($status = 'insert') { + global $conf; + + $config_dir = $conf['mailman']['config_dir'].'/'; + $full_file_name = $config_dir.'mm_cfg.py'; + //* Backup exiting file + if(is_file($full_file_name)) { + copy($full_file_name, $config_dir.'mm_cfg.py~'); + } + + // load files + $content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/mm_cfg.py.master', 'tpl/mm_cfg.py.master'); + $old_file = rf($full_file_name); + + $old_options = array(); + $lines = explode("\n", $old_file); + foreach ($lines as $line) + { + if (trim($line) != '' && substr($line, 0, 1) != '#') + { + @list($key, $value) = @explode("=", $line); + if (isset($value) && $value !== '') + { + $key = rtrim($key); + $old_options[$key] = trim($value); + } + } + } + + $virtual_domains = ''; + if($status == 'update') + { + // create virtual_domains list + $domainAll = $this->db->queryAllRecords("SELECT domain FROM mail_mailinglist GROUP BY domain"); + + if(is_array($domainAll)) { + foreach($domainAll as $domain) + { + if ($domainAll[0]['domain'] == $domain['domain']) + $virtual_domains .= "'".$domain['domain']."'"; + else + $virtual_domains .= ", '".$domain['domain']."'"; + } + } + } + else + $virtual_domains = "' '"; + + $content = str_replace('{hostname}', $conf['hostname'], $content); + if(!isset($old_options['DEFAULT_SERVER_LANGUAGE']) || $old_options['DEFAULT_SERVER_LANGUAGE'] == '') $old_options['DEFAULT_SERVER_LANGUAGE'] = "'en'"; + $content = str_replace('{default_language}', $old_options['DEFAULT_SERVER_LANGUAGE'], $content); + $content = str_replace('{virtual_domains}', $virtual_domains, $content); + + wf($full_file_name, $content); + + //* Write virtual_to_transport.sh script + $config_dir = $conf['mailman']['config_dir'].'/'; + $full_file_name = $config_dir.'virtual_to_transport.sh'; + + //* Backup exiting virtual_to_transport.sh script + if(is_file($full_file_name)) { + copy($full_file_name, $config_dir.'virtual_to_transport.sh~'); + } + + if(is_dir('/etc/mailman')) { + if(is_file($conf['ispconfig_install_dir'].'/server/conf-custom/install/mailman-virtual_to_transport.sh')) { + copy($conf['ispconfig_install_dir'].'/server/conf-custom/install/mailman-virtual_to_transport.sh', $full_file_name); + } else { + copy('tpl/mailman-virtual_to_transport.sh', $full_file_name); + } + chgrp($full_file_name, $this->mailman_group); + chmod($full_file_name, 0755); + } + + //* Create aliasaes + if($status == 'install') exec('/usr/lib/mailman/bin/genaliases 2>/dev/null'); + + if(!is_file('/var/lib/mailman/data/transport-mailman')) touch('/var/lib/mailman/data/transport-mailman'); + exec('/usr/sbin/postmap /var/lib/mailman/data/transport-mailman'); + } + + public function get_postfix_service($service, $type) { + global $conf; + + exec("postconf -M 2> /dev/null", $out, $ret); + + if ($ret === 0) { //* with postfix >= 2.9 we can detect configured services with postconf + unset($out); + exec ("postconf -M $service/$type 2> /dev/null", $out, $ret); //* Postfix >= 2.11 + if (!isset($out[0])) { //* try Postfix 2.9 + exec ("postconf -M $service.$type 2> /dev/null", $out, $ret); + } + $postfix_service = @($out[0]=='')?false:true; + } else { //* fallback - Postfix < 2.9 + $content = rf($conf['postfix']['config_dir'].'/master.cf'); + $regex = "/^((?!#)".$service.".*".$type.".*)$/m"; + $postfix_service = @(preg_match($regex, $content))?true:false; + } + + return $postfix_service; + } + + public function configure_postfix($options = '') { + global $conf,$autoinstall; + $cf = $conf['postfix']; + $config_dir = $cf['config_dir']; + + if(!is_dir($config_dir)) { + $this->error("The postfix configuration directory '$config_dir' does not exist."); + } + + //* mysql-virtual_domains.cf + $this->process_postfix_config('mysql-virtual_domains.cf'); + + //* mysql-virtual_forwardings.cf + $this->process_postfix_config('mysql-virtual_forwardings.cf'); + + //* mysql-virtual_mailboxes.cf + $this->process_postfix_config('mysql-virtual_mailboxes.cf'); + + //* mysql-virtual_email2email.cf + $this->process_postfix_config('mysql-virtual_email2email.cf'); + + //* mysql-virtual_transports.cf + $this->process_postfix_config('mysql-virtual_transports.cf'); + + //* mysql-virtual_recipient.cf + $this->process_postfix_config('mysql-virtual_recipient.cf'); + + //* mysql-virtual_sender.cf + $this->process_postfix_config('mysql-virtual_sender.cf'); + + //* mysql-virtual_sender_login_maps.cf + $this->process_postfix_config('mysql-virtual_sender_login_maps.cf'); + + //* mysql-virtual_client.cf + $this->process_postfix_config('mysql-virtual_client.cf'); + + //* mysql-virtual_relaydomains.cf + $this->process_postfix_config('mysql-virtual_relaydomains.cf'); + + //* mysql-virtual_relayrecipientmaps.cf + $this->process_postfix_config('mysql-virtual_relayrecipientmaps.cf'); + + //* mysql-virtual_outgoing_bcc.cf + $this->process_postfix_config('mysql-virtual_outgoing_bcc.cf'); + + //* mysql-virtual_policy_greylist.cf + $this->process_postfix_config('mysql-virtual_policy_greylist.cf'); + + //* mysql-virtual_gids.cf.master + $this->process_postfix_config('mysql-virtual_gids.cf'); + + //* mysql-virtual_uids.cf + $this->process_postfix_config('mysql-virtual_uids.cf'); + + //* postfix-dkim + $filename='tag_as_originating.re'; + $full_file_name=$config_dir.'/'.$filename; + if(is_file($full_file_name)) copy($full_file_name, $full_file_name.'~'); + $content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/postfix-'.$filename.'.master', 'tpl/postfix-'.$filename.'.master'); + wf($full_file_name, $content); + + $filename='tag_as_foreign.re'; + $full_file_name=$config_dir.'/'.$filename; + if(is_file($full_file_name)) copy($full_file_name, $full_file_name.'~'); + $content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/postfix-'.$filename.'.master', 'tpl/postfix-'.$filename.'.master'); + wf($full_file_name, $content); + + //* Changing mode and group of the new created config files. + caselog('chmod u=rw,g=r,o= '.$config_dir.'/mysql-virtual_*.cf* &> /dev/null', + __FILE__, __LINE__, 'chmod on mysql-virtual_*.cf*', 'chmod on mysql-virtual_*.cf* failed'); + caselog('chgrp '.$cf['group'].' '.$config_dir.'/mysql-virtual_*.cf* &> /dev/null', + __FILE__, __LINE__, 'chgrp on mysql-virtual_*.cf*', 'chgrp on mysql-virtual_*.cf* failed'); + + //* Creating virtual mail user and group + $command = 'groupadd -g '.$cf['vmail_groupid'].' '.$cf['vmail_groupname']; + if(!is_group($cf['vmail_groupname'])) caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command"); + + $command = 'useradd -g '.$cf['vmail_groupname'].' -u '.$cf['vmail_userid'].' '.$cf['vmail_username'].' -d '.$cf['vmail_mailbox_base'].' -m'; + if(!is_user($cf['vmail_username'])) caselog("$command &> /dev/null", __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command"); + + //* These postconf commands will be executed on installation and update + $server_ini_rec = $this->db->queryOneRecord("SELECT config FROM ?? WHERE server_id = ?", $conf["mysql"]["database"] . '.server', $conf['server_id']); + $server_ini_array = ini_to_array(stripslashes($server_ini_rec['config'])); + unset($server_ini_rec); + + //* If there are RBL's defined, format the list and add them to smtp_recipient_restrictions to prevent removeal after an update + $rbl_list = ''; + if (@isset($server_ini_array['mail']['realtime_blackhole_list']) && $server_ini_array['mail']['realtime_blackhole_list'] != '') { + $rbl_hosts = explode(",", str_replace(" ", "", $server_ini_array['mail']['realtime_blackhole_list'])); + foreach ($rbl_hosts as $key => $value) { + $rbl_list .= ", reject_rbl_client ". $value; + } + } + unset($rbl_hosts); + + //* If Postgrey is installed, configure it + $greylisting = ''; + if($conf['postgrey']['installed'] == true) { + $greylisting = ', check_recipient_access mysql:/etc/postfix/mysql-virtual_policy_greylist.cf'; + } + + $reject_sender_login_mismatch = ''; + if(isset($server_ini_array['mail']['reject_sender_login_mismatch']) && ($server_ini_array['mail']['reject_sender_login_mismatch'] == 'y')) { + $reject_sender_login_mismatch = ', reject_authenticated_sender_login_mismatch'; + } + unset($server_ini_array); + + $tmp = str_replace('.','\.',$conf['hostname']); + + $postconf_placeholders = array('{config_dir}' => $config_dir, + '{vmail_mailbox_base}' => $cf['vmail_mailbox_base'], + '{vmail_userid}' => $cf['vmail_userid'], + '{vmail_groupid}' => $cf['vmail_groupid'], + '{rbl_list}' => $rbl_list, + '{greylisting}' => $greylisting, + '{reject_slm}' => $reject_sender_login_mismatch, + '{myhostname}' => $tmp, + ); + + $postconf_tpl = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/debian_postfix.conf.master', 'tpl/debian_postfix.conf.master'); + $postconf_tpl = strtr($postconf_tpl, $postconf_placeholders); + $postconf_commands = array_filter(explode("\n", $postconf_tpl)); // read and remove empty lines + + //* These postconf commands will be executed on installation only + if($this->is_update == false) { + $postconf_commands = array_merge($postconf_commands, array( + 'myhostname = '.$conf['hostname'], + 'mydestination = '.$conf['hostname'].', localhost, localhost.localdomain', + 'mynetworks = 127.0.0.0/8 [::1]/128' + )); + } + + //* Create the header and body check files + touch($config_dir.'/header_checks'); + touch($config_dir.'/mime_header_checks'); + touch($config_dir.'/nested_header_checks'); + touch($config_dir.'/body_checks'); + + //* Create the mailman files + if(!is_dir('/var/lib/mailman/data')) exec('mkdir -p /var/lib/mailman/data'); + if(!is_file('/var/lib/mailman/data/aliases')) touch('/var/lib/mailman/data/aliases'); + exec('postalias /var/lib/mailman/data/aliases'); + if(!is_file('/var/lib/mailman/data/virtual-mailman')) touch('/var/lib/mailman/data/virtual-mailman'); + exec('postmap /var/lib/mailman/data/virtual-mailman'); + if(!is_file('/var/lib/mailman/data/transport-mailman')) touch('/var/lib/mailman/data/transport-mailman'); + exec('/usr/sbin/postmap /var/lib/mailman/data/transport-mailman'); + + //* Create auxillary postfix conf files + $configfile = 'helo_access'; + if(is_file($config_dir.'/'.$configfile)) { + copy($config_dir.'/'.$configfile, $config_dir.'/'.$configfile.'~'); + chmod($config_dir.'/'.$configfile.'~', 0400); + } + $content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/'.$configfile.'.master', 'tpl/'.$configfile.'.master'); + $content = strtr($content, $postconf_placeholders); + # todo: look up this server's ip addrs and loop through each + # todo: look up domains hosted on this server and loop through each + wf($config_dir.'/'.$configfile, $content); + + $configfile = 'blacklist_helo'; + if(is_file($config_dir.'/'.$configfile)) { + copy($config_dir.'/'.$configfile, $config_dir.'/'.$configfile.'~'); + chmod($config_dir.'/'.$configfile.'~', 0400); + } + $content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/'.$configfile.'.master', 'tpl/'.$configfile.'.master'); + $content = strtr($content, $postconf_placeholders); + wf($config_dir.'/'.$configfile, $content); + + //* Make a backup copy of the main.cf file + copy($config_dir.'/main.cf', $config_dir.'/main.cf~'); + + //* Executing the postconf commands + foreach($postconf_commands as $cmd) { + $command = "postconf -e '$cmd'"; + caselog($command." &> /dev/null", __FILE__, __LINE__, 'EXECUTED: '.$command, 'Failed to execute the command '.$command); + } + + if(!stristr($options, 'dont-create-certs')) { + //* Create the SSL certificate + if(AUTOINSTALL){ + $command = 'cd '.$config_dir.'; ' + ."openssl req -new -subj '/C=".escapeshellcmd($autoinstall['ssl_cert_country'])."/ST=".escapeshellcmd($autoinstall['ssl_cert_state'])."/L=".escapeshellcmd($autoinstall['ssl_cert_locality'])."/O=".escapeshellcmd($autoinstall['ssl_cert_organisation'])."/OU=".escapeshellcmd($autoinstall['ssl_cert_organisation_unit'])."/CN=".escapeshellcmd($autoinstall['ssl_cert_common_name'])."' -outform PEM -out smtpd.cert -newkey rsa:4096 -nodes -keyout smtpd.key -keyform PEM -days 3650 -x509"; + } else { + $command = 'cd '.$config_dir.'; ' + .'openssl req -new -outform PEM -out smtpd.cert -newkey rsa:4096 -nodes -keyout smtpd.key -keyform PEM -days 3650 -x509'; + } + exec($command); + + $command = 'chmod o= '.$config_dir.'/smtpd.key'; + caselog($command.' &> /dev/null', __FILE__, __LINE__, 'EXECUTED: '.$command, 'Failed to execute the command '.$command); + } + + //** We have to change the permissions of the courier authdaemon directory to make it accessible for maildrop. + $command = 'chmod 755 /var/run/courier/authdaemon/'; + if(is_file('/var/run/courier/authdaemon/')) caselog($command.' &> /dev/null', __FILE__, __LINE__, 'EXECUTED: '.$command, 'Failed to execute the command '.$command); + + //* Check maildrop service in posfix master.cf + $regex = "/^maildrop unix.*pipe flags=DRhu user=vmail argv=\\/usr\\/bin\\/maildrop -d ".$cf['vmail_username']." \\$\{extension} \\$\{recipient} \\$\{user} \\$\{nexthop} \\$\{sender}/"; + $configfile = $config_dir.'/master.cf'; + if($this->get_postfix_service('maildrop', 'unix')) { + exec ("postconf -M maildrop.unix 2> /dev/null", $out, $ret); + $change_maildrop_flags = @(preg_match($regex, $out[0]) && $out[0] !='')?false:true; + } else { + $change_maildrop_flags = @(preg_match($regex, $configfile))?false:true; + } + if ($change_maildrop_flags) { + //* Change maildrop service in posfix master.cf + if(is_file($config_dir.'/master.cf')) { + copy($config_dir.'/master.cf', $config_dir.'/master.cf~'); + } + if(is_file($config_dir.'/master.cf~')) { + chmod($config_dir.'/master.cf~', 0400); + } + $configfile = $config_dir.'/master.cf'; + $content = rf($configfile); + $content = str_replace('flags=DRhu user=vmail argv=/usr/bin/maildrop -d ${recipient}', + 'flags=DRhu user='.$cf['vmail_username'].' argv=/usr/bin/maildrop -d '.$cf['vmail_username'].' ${extension} ${recipient} ${user} ${nexthop} ${sender}', + $content); + wf($configfile, $content); + } + + //* Writing the Maildrop mailfilter file + $configfile = 'mailfilter'; + if(is_file($cf['vmail_mailbox_base'].'/.'.$configfile)) { + copy($cf['vmail_mailbox_base'].'/.'.$configfile, $cf['vmail_mailbox_base'].'/.'.$configfile.'~'); + } + $content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/'.$configfile.'.master', 'tpl/'.$configfile.'.master'); + $content = str_replace('{dist_postfix_vmail_mailbox_base}', $cf['vmail_mailbox_base'], $content); + wf($cf['vmail_mailbox_base'].'/.'.$configfile, $content); + + //* Create the directory for the custom mailfilters + if(!is_dir($cf['vmail_mailbox_base'].'/mailfilters')) { + $command = 'mkdir '.$cf['vmail_mailbox_base'].'/mailfilters'; + caselog($command." &> /dev/null", __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command"); + } + + //* Chmod and chown the .mailfilter file + $command = 'chown '.$cf['vmail_username'].':'.$cf['vmail_groupname'].' '.$cf['vmail_mailbox_base'].'/.mailfilter'; + caselog($command." &> /dev/null", __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command"); + + $command = 'chmod 600 '.$cf['vmail_mailbox_base'].'/.mailfilter'; + caselog($command." &> /dev/null", __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command"); + + } + + public function configure_saslauthd() { + global $conf; + + //* Get saslsauthd version + exec('saslauthd -v 2>&1', $out); + $parts = explode(' ', $out[0]); + $saslversion = $parts[1]; + unset($parts); + unset($out); + + if(version_compare($saslversion , '2.1.23', '<=')) { + //* Configfile for saslauthd versions up to 2.1.23 + $configfile = 'sasl_smtpd.conf'; + } else { + //* Configfile for saslauthd versions 2.1.24 and newer + $configfile = 'sasl_smtpd2.conf'; + } + + if(is_file($conf['postfix']['config_dir'].'/sasl/smtpd.conf')) copy($conf['postfix']['config_dir'].'/sasl/smtpd.conf', $conf['postfix']['config_dir'].'/sasl/smtpd.conf~'); + if(is_file($conf['postfix']['config_dir'].'/sasl/smtpd.conf~')) chmod($conf['postfix']['config_dir'].'/sasl/smtpd.conf~', 0400); + $content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/'.$configfile.'.master', 'tpl/'.$configfile.'.master'); + $content = str_replace('{mysql_server_ispconfig_user}', $conf['mysql']['ispconfig_user'], $content); + $content = str_replace('{mysql_server_ispconfig_password}', $conf['mysql']['ispconfig_password'], $content); + $content = str_replace('{mysql_server_database}', $conf['mysql']['database'], $content); + $content = str_replace('{mysql_server_ip}', $conf['mysql']['ip'], $content); + wf($conf['postfix']['config_dir'].'/sasl/smtpd.conf', $content); + + // TODO: Chmod and chown on the config file + + + // Recursively create the spool directory + if(!@is_dir('/var/spool/postfix/var/run/saslauthd')) mkdir('/var/spool/postfix/var/run/saslauthd', 0755, true); + + // Edit the file /etc/default/saslauthd + $configfile = $conf['saslauthd']['config']; + if(is_file($configfile)) copy($configfile, $configfile.'~'); + if(is_file($configfile.'~')) chmod($configfile.'~', 0400); + $content = rf($configfile); + $content = str_replace('START=no', 'START=yes', $content); + // Debian + $content = str_replace('OPTIONS="-c"', 'OPTIONS="-m /var/spool/postfix/var/run/saslauthd -r"', $content); + // Ubuntu + $content = str_replace('OPTIONS="-c -m /var/run/saslauthd"', 'OPTIONS="-c -m /var/spool/postfix/var/run/saslauthd -r"', $content); + wf($configfile, $content); + + // Edit the file /etc/init.d/saslauthd + $configfile = $conf['init_scripts'].'/'.$conf['saslauthd']['init_script']; + $content = rf($configfile); + $content = str_replace('PIDFILE=$RUN_DIR/saslauthd.pid', 'PIDFILE="/var/spool/postfix/var/run/${NAME}/saslauthd.pid"', $content); + wf($configfile, $content); + + // add the postfix user to the sasl group (at least necessary for Ubuntu 8.04 and most likely Debian Lenny as well. + exec('adduser postfix sasl'); + + + } + + public function configure_pam() { + global $conf; + $pam = $conf['pam']; + //* configure pam for SMTP authentication agains the ispconfig database + $configfile = 'pamd_smtp'; + if(is_file($pam.'/smtp')) copy($pam.'/smtp', $pam.'/smtp~'); + if(is_file($pam.'/smtp~')) chmod($pam.'/smtp~', 0400); + + $content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/'.$configfile.'.master', 'tpl/'.$configfile.'.master'); + $content = str_replace('{mysql_server_ispconfig_user}', $conf['mysql']['ispconfig_user'], $content); + $content = str_replace('{mysql_server_ispconfig_password}', $conf['mysql']['ispconfig_password'], $content); + $content = str_replace('{mysql_server_database}', $conf['mysql']['database'], $content); + $content = str_replace('{mysql_server_ip}', $conf['mysql']['ip'], $content); + wf($pam.'/smtp', $content); + // On some OSes smtp is world readable which allows for reading database information. Removing world readable rights should have no effect. + if(is_file($pam.'/smtp')) exec("chmod o= $pam/smtp"); + chmod($pam.'/smtp', 0660); + chown($pam.'/smtp', 'daemon'); + chgrp($pam.'/smtp', 'daemon'); + + } + + public function configure_courier() { + global $conf; + $config_dir = $conf['courier']['config_dir']; + //* authmysqlrc + $configfile = 'authmysqlrc'; + if(is_file($config_dir.'/'.$configfile)) { + copy($config_dir.'/'.$configfile, $config_dir.'/'.$configfile.'~'); + } + chmod($config_dir.'/'.$configfile.'~', 0400); + $content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/'.$configfile.'.master', 'tpl/'.$configfile.'.master'); + $content = str_replace('{mysql_server_ispconfig_user}', $conf['mysql']['ispconfig_user'], $content); + $content = str_replace('{mysql_server_ispconfig_password}', $conf['mysql']['ispconfig_password'], $content); + $content = str_replace('{mysql_server_database}', $conf['mysql']['database'], $content); + $content = str_replace('{mysql_server_host}', $conf['mysql']['host'], $content); + $content = str_replace('{mysql_server_port}', $conf['mysql']['port'], $content); + wf($config_dir.'/'.$configfile, $content); + + chmod($config_dir.'/'.$configfile, 0660); + chown($config_dir.'/'.$configfile, 'daemon'); + chgrp($config_dir.'/'.$configfile, 'daemon'); + + //* authdaemonrc + $configfile = $config_dir.'/authdaemonrc'; + if(is_file($configfile)) { + copy($configfile, $configfile.'~'); + } + if(is_file($configfile.'~')) { + chmod($configfile.'~', 0400); + } + $content = rf($configfile); + $content = str_replace('authmodulelist="authpam"', 'authmodulelist="authmysql"', $content); + wf($configfile, $content); + } + + public function configure_dovecot() { + global $conf; + + $virtual_transport = 'dovecot'; + + $configure_lmtp = false; + + // check if virtual_transport must be changed + if ($this->is_update) { + $tmp = $this->db->queryOneRecord("SELECT * FROM ?? WHERE server_id = ?", $conf["mysql"]["database"] . ".server", $conf['server_id']); + $ini_array = ini_to_array(stripslashes($tmp['config'])); + // ini_array needs not to be checked, because already done in update.php -> updateDbAndIni() + + if(isset($ini_array['mail']['mailbox_virtual_uidgid_maps']) && $ini_array['mail']['mailbox_virtual_uidgid_maps'] == 'y') { + $virtual_transport = 'lmtp:unix:private/dovecot-lmtp'; + $configure_lmtp = true; + } + } + + $config_dir = $conf['postfix']['config_dir']; + + //* Configure master.cf and add a line for deliver + if(!$this->get_postfix_service('dovecot', 'unix')) { + //* backup + if(is_file($config_dir.'/master.cf')){ + copy($config_dir.'/master.cf', $config_dir.'/master.cf~2'); + } + if(is_file($config_dir.'/master.cf~')){ + chmod($config_dir.'/master.cf~2', 0400); + } + //* Configure master.cf and add a line for deliver + $content = rf($conf["postfix"]["config_dir"].'/master.cf'); + $deliver_content = 'dovecot unix - n n - - pipe'."\n".' flags=DRhu user=vmail:vmail argv=/usr/lib/dovecot/deliver -f ${sender} -d ${user}@${nexthop}'."\n"; + af($config_dir.'/master.cf', $deliver_content); + unset($content); + unset($deliver_content); + } + + //* Reconfigure postfix to use dovecot authentication + // Adding the amavisd commands to the postfix configuration + $postconf_commands = array ( + 'dovecot_destination_recipient_limit = 1', + 'virtual_transport = '.$virtual_transport, + 'smtpd_sasl_type = dovecot', + 'smtpd_sasl_path = private/auth' + ); + + // Make a backup copy of the main.cf file + copy($conf['postfix']['config_dir'].'/main.cf', $conf['postfix']['config_dir'].'/main.cf~3'); + + // Executing the postconf commands + foreach($postconf_commands as $cmd) { + $command = "postconf -e '$cmd'"; + caselog($command." &> /dev/null", __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command"); + } + + //* backup dovecot.conf + $config_dir = $conf['dovecot']['config_dir']; + $configfile = 'dovecot.conf'; + if(is_file($config_dir.'/'.$configfile)) { + copy($config_dir.'/'.$configfile, $config_dir.'/'.$configfile.'~'); + } + + //* Get the dovecot version + exec('dovecot --version', $tmp); + $dovecot_version = $tmp[0]; + unset($tmp); + + //* Copy dovecot configuration file + if(version_compare($dovecot_version,1, '<=')) { //* Dovecot 1.x + if(is_file($conf['ispconfig_install_dir'].'/server/conf-custom/install/debian_dovecot.conf.master')) { + copy($conf['ispconfig_install_dir'].'/server/conf-custom/install/debian_dovecot.conf.master', $config_dir.'/'.$configfile); + } else { + copy('tpl/debian_dovecot.conf.master', $config_dir.'/'.$configfile); + } + } else { //* Dovecot 2.x + if(is_file($conf['ispconfig_install_dir'].'/server/conf-custom/install/debian_dovecot2.conf.master')) { + copy($conf['ispconfig_install_dir'].'/server/conf-custom/install/debian_dovecot2.conf.master', $config_dir.'/'.$configfile); + } else { + copy('tpl/debian_dovecot2.conf.master', $config_dir.'/'.$configfile); + } + replaceLine($config_dir.'/'.$configfile, 'postmaster_address = postmaster@example.com', 'postmaster_address = postmaster@'.$conf['hostname'], 1, 0); + replaceLine($config_dir.'/'.$configfile, 'postmaster_address = webmaster@localhost', 'postmaster_address = postmaster@'.$conf['hostname'], 1, 0); + if(version_compare($dovecot_version, 2.1, '<')) { + removeLine($config_dir.'/'.$configfile, 'ssl_protocols ='); + } + if(version_compare($dovecot_version,2.2) >= 0) { + // Dovecot > 2.2 does not recognize !SSLv2 anymore on Debian 9 + $content = file_get_contents($config_dir.'/'.$configfile); + $content = str_replace('!SSLv2','',$content); + file_put_contents($config_dir.'/'.$configfile,$content); + unset($content); + } + } + + //* dovecot-lmtpd + if($configure_lmtp) { + replaceLine($config_dir.'/'.$configfile, 'protocols = imap pop3', 'protocols = imap pop3 lmtp', 1, 0); + } + + //* dovecot-sql.conf + $configfile = 'dovecot-sql.conf'; + if(is_file($config_dir.'/'.$configfile)) { + copy($config_dir.'/'.$configfile, $config_dir.'/'.$configfile.'~'); + } + if(is_file($config_dir.'/'.$configfile.'~')) chmod($config_dir.'/'.$configfile.'~', 0400); + $content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/debian_dovecot-sql.conf.master', 'tpl/debian_dovecot-sql.conf.master'); + $content = str_replace('{mysql_server_ispconfig_user}', $conf['mysql']['ispconfig_user'], $content); + $content = str_replace('{mysql_server_ispconfig_password}', $conf['mysql']['ispconfig_password'], $content); + $content = str_replace('{mysql_server_database}', $conf['mysql']['database'], $content); + $content = str_replace('{mysql_server_host}', $conf['mysql']['host'], $content); + $content = str_replace('{mysql_server_port}', $conf['mysql']['port'], $content); + $content = str_replace('{server_id}', $conf['server_id'], $content); + # enable iterate_query for dovecot2 + if(version_compare($dovecot_version,2, '>=')) { + $content = str_replace('# iterate_query', 'iterate_query', $content); + } + wf($config_dir.'/'.$configfile, $content); + + chmod($config_dir.'/'.$configfile, 0600); + chown($config_dir.'/'.$configfile, 'root'); + chgrp($config_dir.'/'.$configfile, 'root'); + + // Dovecot shall ignore mounts in website directory + if(is_installed('doveadm')) exec("doveadm mount add '/var/www/*' ignore > /dev/null 2> /dev/null"); + + } + + public function configure_amavis() { + global $conf; + + // amavisd user config file + $configfile = 'amavisd_user_config'; + if(is_file($conf['amavis']['config_dir'].'/conf.d/50-user')) copy($conf['amavis']['config_dir'].'/conf.d/50-user', $conf['amavis']['config_dir'].'/50-user~'); + if(is_file($conf['amavis']['config_dir'].'/conf.d/50-user~')) chmod($conf['amavis']['config_dir'].'/50-user~', 0400); + $content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/'.$configfile.'.master', 'tpl/'.$configfile.'.master'); + $content = str_replace('{mysql_server_ispconfig_user}', $conf['mysql']['ispconfig_user'], $content); + $content = str_replace('{mysql_server_ispconfig_password}', $conf['mysql']['ispconfig_password'], $content); + $content = str_replace('{mysql_server_database}', $conf['mysql']['database'], $content); + $content = str_replace('{mysql_server_port}', $conf['mysql']['port'], $content); + $content = str_replace('{mysql_server_ip}', $conf['mysql']['ip'], $content); + wf($conf['amavis']['config_dir'].'/conf.d/50-user', $content); + chmod($conf['amavis']['config_dir'].'/conf.d/50-user', 0640); + + // TODO: chmod and chown on the config file + + + // Adding the amavisd commands to the postfix configuration + // Add array for no error in foreach and maybe future options + $postconf_commands = array (); + + // Check for amavisd -> pure webserver with postfix for mailing without antispam + if ($conf['amavis']['installed']) { + $postconf_commands[] = 'content_filter = amavis:[127.0.0.1]:10024'; + $postconf_commands[] = 'receive_override_options = no_address_mappings'; + } + + // Make a backup copy of the main.cf file + copy($conf['postfix']['config_dir'].'/main.cf', $conf['postfix']['config_dir'].'/main.cf~2'); + + // Executing the postconf commands + foreach($postconf_commands as $cmd) { + $command = "postconf -e '$cmd'"; + caselog($command." &> /dev/null", __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command"); + } + + $config_dir = $conf['postfix']['config_dir']; + + // Adding amavis-services to the master.cf file if the service does not already exists + $add_amavis = !$this->get_postfix_service('amavis','unix'); + $add_amavis_10025 = !$this->get_postfix_service('127.0.0.1:10025','inet'); + $add_amavis_10027 = !$this->get_postfix_service('127.0.0.1:10027','inet'); + //*TODO: check templates against existing postfix-services to make sure we use the template + + if ($add_amavis || $add_amavis_10025 || $add_amavis_10027) { + //* backup master.cf + if(is_file($config_dir.'/master.cf')) copy($config_dir.'/master.cf', $config_dir.'/master.cf~'); + // adjust amavis-config + if($add_amavis) { + $content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/master_cf_amavis.master', 'tpl/master_cf_amavis.master'); + af($config_dir.'/master.cf', $content); + unset($content); + } + if ($add_amavis_10025) { + $content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/master_cf_amavis10025.master', 'tpl/master_cf_amavis10025.master'); + af($config_dir.'/master.cf', $content); + unset($content); + } + if ($add_amavis_10027) { + $content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/master_cf_amavis10027.master', 'tpl/master_cf_amavis10027.master'); + af($config_dir.'/master.cf', $content); + unset($content); + } + } + + // Add the clamav user to the amavis group + exec('adduser clamav amavis'); + // get shell-group for amavis + $amavis_group=exec('grep -o "^amavis:\|^vscan:" /etc/group'); + if(!empty($amavis_group)) { + $amavis_group=rtrim($amavis_group, ":"); + } + // get shell-user for amavis + $amavis_user=exec('grep -o "^amavis:\|^vscan:" /etc/passwd'); + if(!empty($amavis_user)) { + $amavis_user=rtrim($amavis_user, ":"); + } + + // Create the director for DKIM-Keys + if(!is_dir('/var/lib/amavis')) mkdir('/var/lib/amavis', 0750, true); + if(!empty($amavis_user)) exec('chown '.$amavis_user.' /var/lib/amavis'); + if(!empty($amavis_group)) exec('chgrp '.$amavis_group.' /var/lib/amavis'); + if(!is_dir('/var/lib/amavis/dkim')) mkdir('/var/lib/amavis/dkim', 0750); + if(!empty($amavis_user)) exec('chown -R '.$amavis_user.' /var/lib/amavis/dkim'); + if(!empty($amavis_group)) exec('chgrp -R '.$amavis_group.' /var/lib/amavis/dkim'); + + } + + public function configure_spamassassin() { + global $conf; + + //* Enable spamasasssin on debian and ubuntu + $configfile = '/etc/default/spamassassin'; + if(is_file($configfile)) { + copy($configfile, $configfile.'~'); + } + $content = rf($configfile); + $content = str_replace('ENABLED=0', 'ENABLED=1', $content); + wf($configfile, $content); + } + + public function configure_getmail() { + global $conf; + + $config_dir = $conf['getmail']['config_dir']; + + if(!@is_dir($config_dir)) mkdir(escapeshellcmd($config_dir), 0700, true); + + $command = 'useradd -d '.$config_dir.' getmail'; + if(!is_user('getmail')) caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command"); + + $command = "chown -R getmail $config_dir"; + caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command"); + + $command = "chmod -R 700 $config_dir"; + caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command"); + } + + + public function configure_pureftpd() { + global $conf; + + $config_dir = $conf['pureftpd']['config_dir']; + + //* configure pure-ftpd for MySQL authentication against the ispconfig database + $configfile = 'db/mysql.conf'; + if(is_file($config_dir.'/'.$configfile)) { + copy($config_dir.'/'.$configfile, $config_dir.'/'.$configfile.'~'); + } + if(is_file($config_dir.'/'.$configfile.'~')) { + chmod($config_dir.'/'.$configfile.'~', 0400); + } + $content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/pureftpd_mysql.conf.master', 'tpl/pureftpd_mysql.conf.master'); + $content = str_replace('{mysql_server_ispconfig_user}', $conf['mysql']['ispconfig_user'], $content); + $content = str_replace('{mysql_server_ispconfig_password}', $conf['mysql']['ispconfig_password'], $content); + $content = str_replace('{mysql_server_database}', $conf['mysql']['database'], $content); + $content = str_replace('{mysql_server_ip}', $conf['mysql']['ip'], $content); + $content = str_replace('{server_id}', $conf['server_id'], $content); + wf($config_dir.'/'.$configfile, $content); + chmod($config_dir.'/'.$configfile, 0600); + chown($config_dir.'/'.$configfile, 'root'); + chgrp($config_dir.'/'.$configfile, 'root'); + // **enable chrooting + //exec('mkdir -p '.$config_dir.'/conf/ChrootEveryone'); + exec('echo "yes" > '.$config_dir.'/conf/ChrootEveryone'); + exec('echo "yes" > '.$config_dir.'/conf/BrokenClientsCompatibility'); + exec('echo "yes" > '.$config_dir.'/conf/DisplayDotFiles'); + + if(is_file('/etc/default/pure-ftpd-common')) { + replaceLine('/etc/default/pure-ftpd-common', 'STANDALONE_OR_INETD=inetd', 'STANDALONE_OR_INETD=standalone', 1, 0); + replaceLine('/etc/default/pure-ftpd-common', 'VIRTUALCHROOT=false', 'VIRTUALCHROOT=true', 1, 0); + } + + if(is_file('/etc/inetd.conf')) { + replaceLine('/etc/inetd.conf', '/usr/sbin/pure-ftpd-wrapper', '#ftp stream tcp nowait root /usr/sbin/tcpd /usr/sbin/pure-ftpd-wrapper', 0, 0); + exec($this->getinitcommand('openbsd-inetd', 'restart')); + //if(is_file($conf['init_scripts'].'/'.'openbsd-inetd')) exec($conf['init_scripts'].'/'.'openbsd-inetd restart'); + } + + if(!is_file('/etc/pure-ftpd/conf/DontResolve')) exec('echo "yes" > /etc/pure-ftpd/conf/DontResolve'); + } + + public function configure_mydns() { + global $conf; + + // configure pam for SMTP authentication agains the ispconfig database + $configfile = 'mydns.conf'; + if(is_file($conf['mydns']['config_dir'].'/'.$configfile)) copy($conf['mydns']['config_dir'].'/'.$configfile, $conf['mydns']['config_dir'].'/'.$configfile.'~'); + if(is_file($conf['mydns']['config_dir'].'/'.$configfile.'~')) chmod($conf['mydns']['config_dir'].'/'.$configfile.'~', 0400); + $content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/'.$configfile.'.master', 'tpl/'.$configfile.'.master'); + $content = str_replace('{mysql_server_ispconfig_user}', $conf['mysql']['ispconfig_user'], $content); + $content = str_replace('{mysql_server_ispconfig_password}', $conf['mysql']['ispconfig_password'], $content); + $content = str_replace('{mysql_server_database}', $conf['mysql']['database'], $content); + $content = str_replace('{mysql_server_host}', $conf['mysql']['host'], $content); + $content = str_replace('{mysql_server_port}', $conf['mysql']['port'], $content); + $content = str_replace('{server_id}', $conf['server_id'], $content); + wf($conf['mydns']['config_dir'].'/'.$configfile, $content); + chmod($conf['mydns']['config_dir'].'/'.$configfile, 0600); + chown($conf['mydns']['config_dir'].'/'.$configfile, 'root'); + chgrp($conf['mydns']['config_dir'].'/'.$configfile, 'root'); + + } + + public function configure_powerdns() { + global $conf; + + //* Create the database + if(!$this->db->query('CREATE DATABASE IF NOT EXISTS ?? DEFAULT CHARACTER SET ?', $conf['powerdns']['database'], $conf['mysql']['charset'])) { + $this->error('Unable to create MySQL database: '.$conf['powerdns']['database'].'.'); + } + + //* Create the ISPConfig database user in the local database + $query = "GRANT ALL ON ?? TO ?@'localhost'"; + if(!$this->db->query($query, $conf['powerdns']['database'] . '.*', $conf['mysql']['ispconfig_user'])) { + $this->error('Unable to create user for powerdns database Error: '.$this->db->errorMessage); + } + + //* load the powerdns databse dump + if($conf['mysql']['admin_password'] == '') { + caselog("mysql --default-character-set=".$conf['mysql']['charset']." -h '".$conf['mysql']['host']."' -u '".$conf['mysql']['admin_user']."' '".$conf['powerdns']['database']."' < '".ISPC_INSTALL_ROOT."/install/sql/powerdns.sql' &> /dev/null", + __FILE__, __LINE__, 'read in ispconfig3.sql', 'could not read in powerdns.sql'); + } else { + caselog("mysql --default-character-set=".$conf['mysql']['charset']." -h '".$conf['mysql']['host']."' -u '".$conf['mysql']['admin_user']."' -p'".$conf['mysql']['admin_password']."' '".$conf['powerdns']['database']."' < '".ISPC_INSTALL_ROOT."/install/sql/powerdns.sql' &> /dev/null", + __FILE__, __LINE__, 'read in ispconfig3.sql', 'could not read in powerdns.sql'); + } + + //* Create the powerdns config file + $configfile = 'pdns.local'; + if(is_file($conf['powerdns']['config_dir'].'/'.$configfile)) copy($conf['powerdns']['config_dir'].'/'.$configfile, $conf['powerdns']['config_dir'].'/'.$configfile.'~'); + if(is_file($conf['powerdns']['config_dir'].'/'.$configfile.'~')) chmod($conf['powerdns']['config_dir'].'/'.$configfile.'~', 0400); + $content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/'.$configfile.'.master', 'tpl/'.$configfile.'.master'); + $content = str_replace('{mysql_server_ispconfig_user}', $conf['mysql']['ispconfig_user'], $content); + $content = str_replace('{mysql_server_ispconfig_password}', $conf['mysql']['ispconfig_password'], $content); + $content = str_replace('{powerdns_database}', $conf['powerdns']['database'], $content); + $content = str_replace('{mysql_server_host}', $conf['mysql']['host'], $content); + $content = str_replace('{mysql_server_port}', $conf['mysql']['port'], $content); + wf($conf['powerdns']['config_dir'].'/'.$configfile, $content); + chmod($conf['powerdns']['config_dir'].'/'.$configfile, 0600); + chown($conf['powerdns']['config_dir'].'/'.$configfile, 'root'); + chgrp($conf['powerdns']['config_dir'].'/'.$configfile, 'root'); + + + } + + //** writes bind configuration files + public function process_bind_file($configfile, $target='/', $absolute=false) { + global $conf; + + if ($absolute) $full_file_name = $target.$configfile; + else $full_file_name = $conf['ispconfig_install_dir'].$target.$configfile; + + //* Backup exiting file + if(is_file($full_file_name)) { + copy($full_file_name, $config_dir.$configfile.'~'); + } + $content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/'.$configfile.'.master', 'tpl/'.$configfile.'.master'); + $content = str_replace('{mysql_server_ispconfig_user}', $conf['mysql']['ispconfig_user'], $content); + $content = str_replace('{mysql_server_ispconfig_password}', $conf['mysql']['ispconfig_password'], $content); + $content = str_replace('{mysql_server_ispconfig_database}', $conf['mysql']['database'], $content); + $content = str_replace('{mysql_server_ip}', $conf['mysql']['ip'], $content); + $content = str_replace('{ispconfig_install_dir}', $conf['ispconfig_install_dir'], $content); + $content = str_replace('{dnssec_conffile}', $conf['ispconfig_install_dir'].'/server/scripts/dnssec-config.sh', $content); + wf($full_file_name, $content); + } + + public function configure_bind() { + global $conf; + + //* Check if the zonefile directory has a slash at the end + $content=$conf['bind']['bind_zonefiles_dir']; + if(substr($content, -1, 1) != '/') { + $content .= '/'; + } + + //* Create the slave subdirectory + $content .= 'slave'; + if(!@is_dir($content)) mkdir($content, 02770, true); + + //* Chown the slave subdirectory to $conf['bind']['bind_user'] + chown($content, $conf['bind']['bind_user']); + chgrp($content, $conf['bind']['bind_group']); + chmod($content, 02770); + + //* Install scripts for dnssec implementation + $this->process_bind_file('named.conf.options', '/etc/bind/', true); //TODO replace hardcoded path + } + + + public function configure_xmpp($options = '') { + global $conf; + + if($conf['xmpp']['installed'] == false) return; + //* Create the logging directory for xmpp server + if(!@is_dir('/var/log/metronome')) mkdir('/var/log/metronome', 0755, true); + chown('/var/log/metronome', 'metronome'); + if(!@is_dir('/var/run/metronome')) mkdir('/var/run/metronome', 0755, true); + chown('/var/run/metronome', 'metronome'); + if(!@is_dir('/var/lib/metronome')) mkdir('/var/lib/metronome', 0755, true); + chown('/var/lib/metronome', 'metronome'); + if(!@is_dir('/etc/metronome/hosts')) mkdir('/etc/metronome/hosts', 0755, true); + if(!@is_dir('/etc/metronome/status')) mkdir('/etc/metronome/status', 0755, true); + unlink('/etc/metronome/metronome.cfg.lua'); + + $row = $this->db->queryOneRecord("SELECT server_name FROM server WHERE server_id = ?", $conf["server_id"]); + $server_name = $row["server_name"]; + + $tpl = new tpl('metronome_conf_main.master'); + wf('/etc/metronome/metronome.cfg.lua', $tpl->grab()); + unset($tpl); + + $tpl = new tpl('metronome_conf_global.master'); + $tpl->setVar('xmpp_admins',''); + wf('/etc/metronome/global.cfg.lua', $tpl->grab()); + unset($tpl); + + // Copy isp libs + if(!@is_dir('/usr/lib/metronome/isp-modules')) mkdir('/usr/lib/metronome/isp-modules', 0755, true); + caselog('cp -rf apps/metronome_libs/* /usr/lib/metronome/isp-modules/', __FILE__, __LINE__); + caselog('chmod 755 /usr/lib/metronome/isp-modules/mod_auth_external/authenticate_isp.sh', __FILE__, __LINE__); + // Process db config + $full_file_name = '/usr/lib/metronome/isp-modules/mod_auth_external/db_conf.inc.php'; + $content = rf($full_file_name); + $content = str_replace('{mysql_server_ispconfig_user}', $conf['mysql']['ispconfig_user'], $content); + $content = str_replace('{mysql_server_ispconfig_password}', $conf['mysql']['ispconfig_password'], $content); + $content = str_replace('{mysql_server_database}', $conf['mysql']['database'], $content); + $content = str_replace('{mysql_server_ip}', $conf['mysql']['ip'], $content); + $content = str_replace('{server_id}', $conf['server_id'], $content); + wf($full_file_name, $content); + + if(!stristr($options, 'dont-create-certs')){ + // Create SSL Certificate for localhost + // Ensure no line is left blank + echo "writing new private key to 'localhost.key'\n-----\n"; + $ssl_country = $this->free_query('Country Name (2 letter code)', 'AU','ssl_cert_country'); + $ssl_locality = $this->free_query('Locality Name (eg, city)', 'City Name','ssl_cert_locality'); + $ssl_organisation = $this->free_query('Organization Name (eg, company)', 'Internet Widgits Pty Ltd','ssl_cert_organisation'); + $ssl_organisation_unit = $this->free_query('Organizational Unit Name (eg, section)', 'Infrastructure','ssl_cert_organisation_unit'); + $ssl_domain = $this->free_query('Common Name (e.g. server FQDN or YOUR name)', $conf['hostname'],'ssl_cert_common_name'); + $ssl_email = $this->free_query('Email Address', 'hostmaster@'.$conf['hostname'],'ssl_cert_email'); + + $tpl = new tpl('metronome_conf_ssl.master'); + $tpl->setVar('ssl_country',$ssl_country); + $tpl->setVar('ssl_locality',$ssl_locality); + $tpl->setVar('ssl_organisation',$ssl_organisation); + $tpl->setVar('ssl_organisation_unit',$ssl_organisation_unit); + $tpl->setVar('domain',$ssl_domain); + $tpl->setVar('ssl_email',$ssl_email); + wf('/etc/metronome/certs/localhost.cnf', $tpl->grab()); + unset($tpl); + // Generate new key, csr and cert + exec("(cd /etc/metronome/certs && make localhost.key)"); + exec("(cd /etc/metronome/certs && make localhost.csr)"); + exec("(cd /etc/metronome/certs && make localhost.cert)"); + exec('chmod 0400 /etc/metronome/certs/localhost.key'); + exec('chown metronome /etc/metronome/certs/localhost.key'); + + echo "IMPORTANT:\n"; + echo "Localhost Key, Csr and a self-signed Cert have been saved to /etc/metronome/certs\n"; + echo "In order to work with all clients, the server must have a trusted certificate, so use the Csr\n"; + echo "to get a trusted certificate from your CA or replace Key and Cert with already signed files for\n"; + echo "your domain. Clients like Pidgin dont allow to use untrusted self-signed certificates.\n"; + echo "\n"; + + }else{ + /* + echo "-----\n"; + echo "Metronome XMPP SSL server certificate is not renewed. Run the following command manual as root to recreate it:\n"; + echo "# (cd /etc/metronome/certs && make localhost.key && make localhost.csr && make localhost.cert && chmod 0400 localhost.key && chown metronome localhost.key)\n"; + echo "-----\n"; + */ + } + + // Copy init script + caselog('cp -f apps/metronome-init /etc/init.d/metronome', __FILE__, __LINE__); + caselog('chmod u+x /etc/init.d/metronome', __FILE__, __LINE__); + caselog('update-rc.d metronome defaults', __FILE__, __LINE__); + + exec($this->getinitcommand($conf['xmpp']['init_script'], 'restart')); + } + + + public function configure_apache() { + global $conf; + + if($conf['apache']['installed'] == false) return; + //* Create the logging directory for the vhost logfiles + if(!@is_dir($conf['ispconfig_log_dir'].'/httpd')) mkdir($conf['ispconfig_log_dir'].'/httpd', 0755, true); + + if(is_file('/etc/suphp/suphp.conf')) { + replaceLine('/etc/suphp/suphp.conf', 'php="php:/usr/bin', 'x-httpd-suphp="php:/usr/bin/php-cgi"', 0); + //replaceLine('/etc/suphp/suphp.conf','docroot=','docroot=/var/clients',0); + replaceLine('/etc/suphp/suphp.conf', 'umask=00', 'umask=0022', 0); + } + + if(is_file('/etc/apache2/sites-enabled/000-default')) { + replaceLine('/etc/apache2/sites-available/000-default', 'NameVirtualHost *', 'NameVirtualHost *:80', 1, 0); + replaceLine('/etc/apache2/sites-available/000-default', '', '', 1, 0); + } + + if(is_file('/etc/apache2/ports.conf')) { + // add a line "Listen 443" to ports conf if line does not exist + replaceLine('/etc/apache2/ports.conf', 'Listen 443', 'Listen 443', 1); + + // Comment out the namevirtualhost lines, as they were added by ispconfig in ispconfig.conf file again + replaceLine('/etc/apache2/ports.conf', 'NameVirtualHost *:80', '# NameVirtualHost *:80', 1); + replaceLine('/etc/apache2/ports.conf', 'NameVirtualHost *:443', '# NameVirtualHost *:443', 1); + } + + if(is_file('/etc/apache2/mods-available/fcgid.conf')) { + // add or modify the parameters for fcgid.conf + replaceLine('/etc/apache2/mods-available/fcgid.conf','MaxRequestLen','MaxRequestLen 15728640',1); + } + + if(is_file('/etc/apache2/apache.conf')) { + if(hasLine('/etc/apache2/apache.conf', 'Include sites-enabled/', 1) == false) { + if(hasLine('/etc/apache2/apache.conf', 'IncludeOptional sites-enabled/*.conf', 1) == false && hasLine('/etc/apache2/apache.conf', 'IncludeOptional sites-enabled/', 1) == false) { + replaceLine('/etc/apache2/apache.conf', 'Include sites-enabled/', 'Include sites-enabled/', 1, 1); + } elseif(hasLine('/etc/apache2/apache.conf', 'IncludeOptional sites-enabled/*.vhost', 1) == false) { + replaceLine('/etc/apache2/apache.conf', 'IncludeOptional sites-enabled/*.vhost', 'IncludeOptional sites-enabled/', 1, 1); + } + } + } + + if(is_file('/etc/apache2/apache2.conf')) { + if(hasLine('/etc/apache2/apache2.conf', 'Include sites-enabled/', 1) == false && hasLine('/etc/apache2/apache2.conf', 'IncludeOptional sites-enabled/', 1) == false) { + if(hasLine('/etc/apache2/apache2.conf', 'Include sites-enabled/*.conf', 1) == true) { + replaceLine('/etc/apache2/apache2.conf', 'Include sites-enabled/*.conf', 'Include sites-enabled/', 1, 1); + } elseif(hasLine('/etc/apache2/apache2.conf', 'IncludeOptional sites-enabled/*.conf', 1) == true) { + replaceLine('/etc/apache2/apache2.conf', 'IncludeOptional sites-enabled/*.conf', 'IncludeOptional sites-enabled/', 1, 1); + } + } + } + + //* Copy the ISPConfig configuration include + $vhost_conf_dir = $conf['apache']['vhost_conf_dir']; + $vhost_conf_enabled_dir = $conf['apache']['vhost_conf_enabled_dir']; + + $tpl = new tpl('apache_ispconfig.conf.master'); + $tpl->setVar('apache_version',getapacheversion()); + + if($this->is_update == true) { + $tpl->setVar('logging',get_logging_state()); + } else { + $tpl->setVar('logging','yes'); + } + + $records = $this->db->queryAllRecords("SELECT * FROM ?? WHERE server_id = ? AND virtualhost = 'y'", $conf['mysql']['master_database'] . '.server_ip', $conf['server_id']); + $ip_addresses = array(); + + if(is_array($records) && count($records) > 0) { + foreach($records as $rec) { + if($rec['ip_type'] == 'IPv6') { + $ip_address = '['.$rec['ip_address'].']'; + } else { + $ip_address = $rec['ip_address']; + } + $ports = explode(',', $rec['virtualhost_port']); + if(is_array($ports)) { + foreach($ports as $port) { + $port = intval($port); + if($port > 0 && $port < 65536 && $ip_address != '') { + $ip_addresses[] = array('ip_address' => $ip_address, 'port' => $port); + } + } + } + } + } + + if(count($ip_addresses) > 0) $tpl->setLoop('ip_adresses',$ip_addresses); + + wf($vhost_conf_dir.'/ispconfig.conf', $tpl->grab()); + unset($tpl); + + if(!@is_link($vhost_conf_enabled_dir.'/000-ispconfig.conf')) { + symlink($vhost_conf_dir.'/ispconfig.conf', $vhost_conf_enabled_dir.'/000-ispconfig.conf'); + } + + //* make sure that webalizer finds its config file when it is directly in /etc + if(@is_file('/etc/webalizer.conf') && !@is_dir('/etc/webalizer')) { + mkdir('/etc/webalizer'); + symlink('/etc/webalizer.conf', '/etc/webalizer/webalizer.conf'); + } + + if(is_file('/etc/webalizer/webalizer.conf')) { + // Change webalizer mode to incremental + replaceLine('/etc/webalizer/webalizer.conf', '#IncrementalName', 'IncrementalName webalizer.current', 0, 0); + replaceLine('/etc/webalizer/webalizer.conf', '#Incremental', 'Incremental yes', 0, 0); + replaceLine('/etc/webalizer/webalizer.conf', '#HistoryName', 'HistoryName webalizer.hist', 0, 0); + } + + // Check the awsatst script + if(!is_dir('/usr/share/awstats/tools')) exec('mkdir -p /usr/share/awstats/tools'); + if(!file_exists('/usr/share/awstats/tools/awstats_buildstaticpages.pl') && file_exists('/usr/share/doc/awstats/examples/awstats_buildstaticpages.pl')) symlink('/usr/share/doc/awstats/examples/awstats_buildstaticpages.pl', '/usr/share/awstats/tools/awstats_buildstaticpages.pl'); + if(file_exists('/etc/awstats/awstats.conf.local')) replaceLine('/etc/awstats/awstats.conf.local', 'LogFormat=4', 'LogFormat=1', 0, 1); + + //* add a sshusers group + $command = 'groupadd sshusers'; + if(!is_group('sshusers')) caselog($command.' &> /dev/null 2> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command"); + + } + + public function configure_nginx(){ + global $conf; + + if($conf['nginx']['installed'] == false) return; + //* Create the logging directory for the vhost logfiles + if(!@is_dir($conf['ispconfig_log_dir'].'/httpd')) mkdir($conf['ispconfig_log_dir'].'/httpd', 0755, true); + + //* make sure that webalizer finds its config file when it is directly in /etc + if(@is_file('/etc/webalizer.conf') && !@is_dir('/etc/webalizer')) { + mkdir('/etc/webalizer'); + symlink('/etc/webalizer.conf', '/etc/webalizer/webalizer.conf'); + } + + if(is_file('/etc/webalizer/webalizer.conf')) { + // Change webalizer mode to incremental + replaceLine('/etc/webalizer/webalizer.conf', '#IncrementalName', 'IncrementalName webalizer.current', 0, 0); + replaceLine('/etc/webalizer/webalizer.conf', '#Incremental', 'Incremental yes', 0, 0); + replaceLine('/etc/webalizer/webalizer.conf', '#HistoryName', 'HistoryName webalizer.hist', 0, 0); + } + + // Check the awsatst script + if(!is_dir('/usr/share/awstats/tools')) exec('mkdir -p /usr/share/awstats/tools'); + if(!file_exists('/usr/share/awstats/tools/awstats_buildstaticpages.pl') && file_exists('/usr/share/doc/awstats/examples/awstats_buildstaticpages.pl')) symlink('/usr/share/doc/awstats/examples/awstats_buildstaticpages.pl', '/usr/share/awstats/tools/awstats_buildstaticpages.pl'); + if(file_exists('/etc/awstats/awstats.conf.local')) replaceLine('/etc/awstats/awstats.conf.local', 'LogFormat=4', 'LogFormat=1', 0, 1); + + //* add a sshusers group + $command = 'groupadd sshusers'; + if(!is_group('sshusers')) caselog($command.' &> /dev/null 2> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command"); + + // add anonymized log option to nginxx.conf file + $nginx_conf_file = $conf['nginx']['config_dir'].'/nginx.conf'; + if(is_file($nginx_conf_file)) { + $tmp = file_get_contents($nginx_conf_file); + if(!stristr($tmp, 'log_format anonymized')) { + copy($nginx_conf_file,$nginx_conf_file.'~'); + replaceLine($nginx_conf_file, 'http {', "http {\n\n".file_get_contents('tpl/nginx_anonlog.master'), 0, 0); + } + } + + } + + public function configure_fail2ban() { + // To Do + } + + public function configure_squid() + { + global $conf; + $row = $this->db->queryOneRecord("SELECT server_name FROM server WHERE server_id = ?", $conf["server_id"]); + $ip_address = gethostbyname($row["server_name"]); + $server_name = $row["server_name"]; + + $configfile = 'squid.conf'; + if(is_file($conf["squid"]["config_dir"].'/'.$configfile)) copy($conf["squid"]["config_dir"].'/'.$configfile, $conf["squid"]["config_dir"].'/'.$configfile.'~'); + if(is_file($conf["squid"]["config_dir"].'/'.$configfile.'~')) exec('chmod 400 '.$conf["squid"]["config_dir"].'/'.$configfile.'~'); + $content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/'.$configfile.'.master', "tpl/".$configfile.".master"); + $content = str_replace('{server_name}', $server_name, $content); + $content = str_replace('{ip_address}', $ip_address, $content); + $content = str_replace('{config_dir}', $conf['squid']['config_dir'], $content); + wf($conf["squid"]["config_dir"].'/'.$configfile, $content); + exec('chmod 600 '.$conf["squid"]["config_dir"].'/'.$configfile); + exec('chown root:root '.$conf["squid"]["config_dir"].'/'.$configfile); + } + + public function configure_ufw_firewall() + { + if($this->is_update == false) { + $configfile = 'ufw.conf'; + if(is_file('/etc/ufw/ufw.conf')) copy('/etc/ufw/ufw.conf', '/etc/ufw/ufw.conf~'); + $content = rf("tpl/".$configfile.".master"); + wf('/etc/ufw/ufw.conf', $content); + exec('chmod 600 /etc/ufw/ufw.conf'); + exec('chown root:root /etc/ufw/ufw.conf'); + } + } + + public function configure_bastille_firewall() { + global $conf; + + $dist_init_scripts = $conf['init_scripts']; + + if(is_dir('/etc/Bastille.backup')) caselog('rm -rf /etc/Bastille.backup', __FILE__, __LINE__); + if(is_dir('/etc/Bastille')) caselog('mv -f /etc/Bastille /etc/Bastille.backup', __FILE__, __LINE__); + @mkdir('/etc/Bastille', 0700); + if(is_dir('/etc/Bastille.backup/firewall.d')) caselog('cp -pfr /etc/Bastille.backup/firewall.d /etc/Bastille/', __FILE__, __LINE__); + if(is_file($conf['ispconfig_install_dir'].'/server/conf-custom/install/bastille-firewall.cfg.master')) { + caselog('cp -f ' . $conf['ispconfig_install_dir'].'/server/conf-custom/install/bastille-firewall.cfg.master /etc/Bastille/bastille-firewall.cfg', __FILE__, __LINE__); + } else { + caselog('cp -f tpl/bastille-firewall.cfg.master /etc/Bastille/bastille-firewall.cfg', __FILE__, __LINE__); + } + caselog('chmod 644 /etc/Bastille/bastille-firewall.cfg', __FILE__, __LINE__); + $content = rf('/etc/Bastille/bastille-firewall.cfg'); + $content = str_replace('{DNS_SERVERS}', '', $content); + + $tcp_public_services = ''; + $udp_public_services = ''; + + $row = $this->db->queryOneRecord('SELECT * FROM ?? WHERE server_id = ?', $conf["mysql"]["database"] . '.firewall', $conf['server_id']); + + if(trim($row['tcp_port']) != '' || trim($row['udp_port']) != '') { + $tcp_public_services = trim(str_replace(',', ' ', $row['tcp_port'])); + $udp_public_services = trim(str_replace(',', ' ', $row['udp_port'])); + } else { + $tcp_public_services = '21 22 25 53 80 110 143 443 3306 8080 10000'; + $udp_public_services = '53'; + } + + if(!stristr($tcp_public_services, $conf['apache']['vhost_port'])) { + $tcp_public_services .= ' '.intval($conf['apache']['vhost_port']); + if($row['tcp_port'] != '') $this->db->query("UPDATE firewall SET tcp_port = tcp_port + ? WHERE server_id = ?", ',' . intval($conf['apache']['vhost_port']), $conf['server_id']); + } + + $content = str_replace('{TCP_PUBLIC_SERVICES}', $tcp_public_services, $content); + $content = str_replace('{UDP_PUBLIC_SERVICES}', $udp_public_services, $content); + + wf('/etc/Bastille/bastille-firewall.cfg', $content); + + if(is_file($dist_init_scripts.'/bastille-firewall')) caselog('mv -f '.$dist_init_scripts.'/bastille-firewall '.$dist_init_scripts.'/bastille-firewall.backup', __FILE__, __LINE__); + caselog('cp -f apps/bastille-firewall '.$dist_init_scripts, __FILE__, __LINE__); + caselog('chmod 700 '.$dist_init_scripts.'/bastille-firewall', __FILE__, __LINE__); + + if(is_file('/sbin/bastille-ipchains')) caselog('mv -f /sbin/bastille-ipchains /sbin/bastille-ipchains.backup', __FILE__, __LINE__); + caselog('cp -f apps/bastille-ipchains /sbin', __FILE__, __LINE__); + caselog('chmod 700 /sbin/bastille-ipchains', __FILE__, __LINE__); + + if(is_file('/sbin/bastille-netfilter')) caselog('mv -f /sbin/bastille-netfilter /sbin/bastille-netfilter.backup', __FILE__, __LINE__); + caselog('cp -f apps/bastille-netfilter /sbin', __FILE__, __LINE__); + caselog('chmod 700 /sbin/bastille-netfilter', __FILE__, __LINE__); + + if(!@is_dir('/var/lock/subsys')) caselog('mkdir /var/lock/subsys', __FILE__, __LINE__); + + exec('which ipchains &> /dev/null', $ipchains_location, $ret_val); + if(!is_file('/sbin/ipchains') && !is_link('/sbin/ipchains') && $ret_val == 0) phpcaselog(@symlink(shell_exec('which ipchains'), '/sbin/ipchains'), 'create symlink', __FILE__, __LINE__); + unset($ipchains_location); + exec('which iptables &> /dev/null', $iptables_location, $ret_val); + if(!is_file('/sbin/iptables') && !is_link('/sbin/iptables') && $ret_val == 0) phpcaselog(@symlink(trim(shell_exec('which iptables')), '/sbin/iptables'), 'create symlink', __FILE__, __LINE__); + unset($iptables_location); + + } + + public function configure_vlogger() { + global $conf; + + //** Configure vlogger to use traffic logging to mysql (master) db + $configfile = 'vlogger-dbi.conf'; + if(is_file($conf['vlogger']['config_dir'].'/'.$configfile)) copy($conf['vlogger']['config_dir'].'/'.$configfile, $conf['vlogger']['config_dir'].'/'.$configfile.'~'); + if(is_file($conf['vlogger']['config_dir'].'/'.$configfile.'~')) chmod($conf['vlogger']['config_dir'].'/'.$configfile.'~', 0400); + $content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/'.$configfile.'.master', 'tpl/'.$configfile.'.master'); + if($conf['mysql']['master_slave_setup'] == 'y') { + $content = str_replace('{mysql_server_ispconfig_user}', $conf['mysql']['master_ispconfig_user'], $content); + $content = str_replace('{mysql_server_ispconfig_password}', $conf['mysql']['master_ispconfig_password'], $content); + $content = str_replace('{mysql_server_database}', $conf['mysql']['master_database'], $content); + $content = str_replace('{mysql_server_ip}', $conf['mysql']['master_host'], $content); + } else { + $content = str_replace('{mysql_server_ispconfig_user}', $conf['mysql']['ispconfig_user'], $content); + $content = str_replace('{mysql_server_ispconfig_password}', $conf['mysql']['ispconfig_password'], $content); + $content = str_replace('{mysql_server_database}', $conf['mysql']['database'], $content); + $content = str_replace('{mysql_server_ip}', $conf['mysql']['ip'], $content); + } + wf($conf['vlogger']['config_dir'].'/'.$configfile, $content); + chmod($conf['vlogger']['config_dir'].'/'.$configfile, 0600); + chown($conf['vlogger']['config_dir'].'/'.$configfile, 'root'); + chgrp($conf['vlogger']['config_dir'].'/'.$configfile, 'root'); + + } + + public function configure_apps_vhost() { + global $conf; + + //* Create the ispconfig apps vhost user and group + if($conf['apache']['installed'] == true){ + $apps_vhost_user = escapeshellcmd($conf['web']['apps_vhost_user']); + $apps_vhost_group = escapeshellcmd($conf['web']['apps_vhost_group']); + $install_dir = escapeshellcmd($conf['web']['website_basedir'].'/apps'); + + $command = 'groupadd '.$apps_vhost_user; + if(!is_group($apps_vhost_group)) caselog($command.' &> /dev/null 2> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command"); + + $command = 'useradd -g '.$apps_vhost_group.' -d '.$install_dir.' '.$apps_vhost_group; + if(!is_user($apps_vhost_user)) caselog($command.' &> /dev/null 2> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command"); + + + //$command = 'adduser '.$conf['apache']['user'].' '.$apps_vhost_group; + $command = 'usermod -a -G '.$apps_vhost_group.' '.$conf['apache']['user']; + caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command"); + + if(!@is_dir($install_dir)){ + mkdir($install_dir, 0755, true); + } else { + chmod($install_dir, 0755); + } + chown($install_dir, $apps_vhost_user); + chgrp($install_dir, $apps_vhost_group); + + //* Copy the apps vhost file + $vhost_conf_dir = $conf['apache']['vhost_conf_dir']; + $vhost_conf_enabled_dir = $conf['apache']['vhost_conf_enabled_dir']; + $apps_vhost_servername = ($conf['web']['apps_vhost_servername'] == '')?'':'ServerName '.$conf['web']['apps_vhost_servername']; + + //* Get the apps vhost port + if($this->is_update == true) { + $conf['web']['apps_vhost_port'] = get_apps_vhost_port_number(); + } + + // Dont just copy over the virtualhost template but add some custom settings + $tpl = new tpl('apache_apps.vhost.master'); + $tpl->setVar('apps_vhost_ip',$conf['web']['apps_vhost_ip']); + $tpl->setVar('apps_vhost_port',$conf['web']['apps_vhost_port']); + $tpl->setVar('apps_vhost_dir',$conf['web']['website_basedir'].'/apps'); + $tpl->setVar('apps_vhost_basedir',$conf['web']['website_basedir']); + $tpl->setVar('apps_vhost_servername',$apps_vhost_servername); + $tpl->setVar('apache_version',getapacheversion()); + if($this->is_update == true) { + $tpl->setVar('logging',get_logging_state()); + } else { + $tpl->setVar('logging','yes'); + } + + + // comment out the listen directive if port is 80 or 443 + if($conf['web']['apps_vhost_ip'] == 80 or $conf['web']['apps_vhost_ip'] == 443) { + $tpl->setVar('vhost_port_listen','#'); + } else { + $tpl->setVar('vhost_port_listen',''); + } + + wf($vhost_conf_dir.'/apps.vhost', $tpl->grab()); + unset($tpl); + + //copy('tpl/apache_ispconfig.vhost.master', "$vhost_conf_dir/ispconfig.vhost"); + //* and create the symlink + if(@is_link($vhost_conf_enabled_dir.'/apps.vhost')) unlink($vhost_conf_enabled_dir.'/apps.vhost'); + if(!@is_link($vhost_conf_enabled_dir.'/000-apps.vhost') && @is_file($vhost_conf_dir.'/apps.vhost')) { + @symlink($vhost_conf_dir.'/apps.vhost', $vhost_conf_enabled_dir.'/000-apps.vhost'); + } + + if(!is_file($conf['web']['website_basedir'].'/php-fcgi-scripts/apps/.php-fcgi-starter')) { + $content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/apache_apps_fcgi_starter.master', 'tpl/apache_apps_fcgi_starter.master'); + $content = str_replace('{fastcgi_bin}', $conf['fastcgi']['fastcgi_bin'], $content); + $content = str_replace('{fastcgi_phpini_path}', $conf['fastcgi']['fastcgi_phpini_path'], $content); + mkdir($conf['web']['website_basedir'].'/php-fcgi-scripts/apps', 0755, true); + //copy('tpl/apache_apps_fcgi_starter.master',$conf['web']['website_basedir'].'/php-fcgi-scripts/apps/.php-fcgi-starter'); + wf($conf['web']['website_basedir'].'/php-fcgi-scripts/apps/.php-fcgi-starter', $content); + exec('chmod +x '.$conf['web']['website_basedir'].'/php-fcgi-scripts/apps/.php-fcgi-starter'); + exec('chown -R ispapps:ispapps '.$conf['web']['website_basedir'].'/php-fcgi-scripts/apps'); + + } + } + if($conf['nginx']['installed'] == true){ + $apps_vhost_user = escapeshellcmd($conf['web']['apps_vhost_user']); + $apps_vhost_group = escapeshellcmd($conf['web']['apps_vhost_group']); + $install_dir = escapeshellcmd($conf['web']['website_basedir'].'/apps'); + + $command = 'groupadd '.$apps_vhost_user; + if(!is_group($apps_vhost_group)) caselog($command.' &> /dev/null 2> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command"); + + $command = 'useradd -g '.$apps_vhost_group.' -d '.$install_dir.' '.$apps_vhost_group; + if(!is_user($apps_vhost_user)) caselog($command.' &> /dev/null 2> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command"); + + + //$command = 'adduser '.$conf['nginx']['user'].' '.$apps_vhost_group; + $command = 'usermod -a -G '.$apps_vhost_group.' '.$conf['nginx']['user']; + caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command"); + + if(!@is_dir($install_dir)){ + mkdir($install_dir, 0755, true); + } else { + chmod($install_dir, 0755); + } + chown($install_dir, $apps_vhost_user); + chgrp($install_dir, $apps_vhost_group); + + //* Copy the apps vhost file + $vhost_conf_dir = $conf['nginx']['vhost_conf_dir']; + $vhost_conf_enabled_dir = $conf['nginx']['vhost_conf_enabled_dir']; + $apps_vhost_servername = ($conf['web']['apps_vhost_servername'] == '')?'_':$conf['web']['apps_vhost_servername']; + + // Dont just copy over the virtualhost template but add some custom settings + $content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/nginx_apps.vhost.master', 'tpl/nginx_apps.vhost.master'); + + if($conf['web']['apps_vhost_ip'] == '_default_'){ + $apps_vhost_ip = ''; + } else { + $apps_vhost_ip = $conf['web']['apps_vhost_ip'].':'; + } + + $socket_dir = escapeshellcmd($conf['nginx']['php_fpm_socket_dir']); + if(substr($socket_dir, -1) != '/') $socket_dir .= '/'; + if(!is_dir($socket_dir)) exec('mkdir -p '.$socket_dir); + $fpm_socket = $socket_dir.'apps.sock'; + $cgi_socket = escapeshellcmd($conf['nginx']['cgi_socket']); + + $content = str_replace('{apps_vhost_ip}', $apps_vhost_ip, $content); + $content = str_replace('{apps_vhost_port}', $conf['web']['apps_vhost_port'], $content); + $content = str_replace('{apps_vhost_dir}', $conf['web']['website_basedir'].'/apps', $content); + $content = str_replace('{apps_vhost_servername}', $apps_vhost_servername, $content); + //$content = str_replace('{fpm_port}', ($conf['nginx']['php_fpm_start_port']+1), $content); + $content = str_replace('{fpm_socket}', $fpm_socket, $content); + $content = str_replace('{cgi_socket}', $cgi_socket, $content); + + if( file_exists('/var/run/php5-fpm.sock') + || file_exists('/var/run/php/php7.0-fpm.sock') + || file_exists('/var/run/php/php7.1-fpm.sock') + || file_exists('/var/run/php/php7.2-fpm.sock') + || file_exists('/var/run/php/php7.3-fpm.sock') + ){ + $use_tcp = '#'; + $use_socket = ''; + } else { + $use_tcp = ''; + $use_socket = '#'; + } + $content = str_replace('{use_tcp}', $use_tcp, $content); + $content = str_replace('{use_socket}', $use_socket, $content); + + // SSL in apps vhost is off by default. Might change later. + $content = str_replace('{ssl_on}', '', $content); + $content = str_replace('{ssl_comment}', '#', $content); + + // Fix socket path on PHP 7 systems + if(file_exists('/var/run/php/php7.0-fpm.sock')) $content = str_replace('/var/run/php5-fpm.sock', '/var/run/php/php7.0-fpm.sock', $content); + if(file_exists('/var/run/php/php7.1-fpm.sock')) $content = str_replace('/var/run/php5-fpm.sock', '/var/run/php/php7.1-fpm.sock', $content); + if(file_exists('/var/run/php/php7.2-fpm.sock')) $content = str_replace('/var/run/php5-fpm.sock', '/var/run/php/php7.2-fpm.sock', $content); + + wf($vhost_conf_dir.'/apps.vhost', $content); + + // PHP-FPM + // Dont just copy over the php-fpm pool template but add some custom settings + $content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/apps_php_fpm_pool.conf.master', 'tpl/apps_php_fpm_pool.conf.master'); + $content = str_replace('{fpm_pool}', 'apps', $content); + //$content = str_replace('{fpm_port}', ($conf['nginx']['php_fpm_start_port']+1), $content); + $content = str_replace('{fpm_socket}', $fpm_socket, $content); + $content = str_replace('{fpm_user}', $apps_vhost_user, $content); + $content = str_replace('{fpm_group}', $apps_vhost_group, $content); + wf($conf['nginx']['php_fpm_pool_dir'].'/apps.conf', $content); + + //copy('tpl/nginx_ispconfig.vhost.master', "$vhost_conf_dir/ispconfig.vhost"); + //* and create the symlink + if(@is_link($vhost_conf_enabled_dir.'/apps.vhost')) unlink($vhost_conf_enabled_dir.'/apps.vhost'); + if(!@is_link($vhost_conf_enabled_dir.'/000-apps.vhost')) { + symlink($vhost_conf_dir.'/apps.vhost', $vhost_conf_enabled_dir.'/000-apps.vhost'); + } + + } + } + + public function make_ispconfig_ssl_cert() { + global $conf,$autoinstall; + + $install_dir = $conf['ispconfig_install_dir']; + + $ssl_crt_file = $install_dir.'/interface/ssl/ispserver.crt'; + $ssl_csr_file = $install_dir.'/interface/ssl/ispserver.csr'; + $ssl_key_file = $install_dir.'/interface/ssl/ispserver.key'; + + if(!@is_dir($install_dir.'/interface/ssl')) mkdir($install_dir.'/interface/ssl', 0755, true); + + $ssl_pw = substr(md5(mt_rand()), 0, 6); + exec("openssl genrsa -des3 -passout pass:$ssl_pw -out $ssl_key_file 4096"); + if(AUTOINSTALL){ + exec("openssl req -new -passin pass:$ssl_pw -passout pass:$ssl_pw -subj '/C=".escapeshellcmd($autoinstall['ssl_cert_country'])."/ST=".escapeshellcmd($autoinstall['ssl_cert_state'])."/L=".escapeshellcmd($autoinstall['ssl_cert_locality'])."/O=".escapeshellcmd($autoinstall['ssl_cert_organisation'])."/OU=".escapeshellcmd($autoinstall['ssl_cert_organisation_unit'])."/CN=".escapeshellcmd($autoinstall['ssl_cert_common_name'])."' -key $ssl_key_file -out $ssl_csr_file"); + } else { + exec("openssl req -new -passin pass:$ssl_pw -passout pass:$ssl_pw -key $ssl_key_file -out $ssl_csr_file"); + } + exec("openssl req -x509 -passin pass:$ssl_pw -passout pass:$ssl_pw -key $ssl_key_file -in $ssl_csr_file -out $ssl_crt_file -days 3650"); + exec("openssl rsa -passin pass:$ssl_pw -in $ssl_key_file -out $ssl_key_file.insecure"); + rename($ssl_key_file, $ssl_key_file.'.secure'); + rename($ssl_key_file.'.insecure', $ssl_key_file); + + exec('chown -R root:root /usr/local/ispconfig/interface/ssl'); + + } + + public function install_ispconfig() { + global $conf; + + $install_dir = $conf['ispconfig_install_dir']; + + //* Create the ISPConfig installation directory + if(!@is_dir($install_dir)) { + $command = "mkdir $install_dir"; + caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command"); + } + + //* Create a ISPConfig user and group + $command = 'groupadd ispconfig'; + if(!is_group('ispconfig')) caselog($command.' &> /dev/null 2> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command"); + + $command = 'useradd -g ispconfig -d '.$install_dir.' ispconfig'; + if(!is_user('ispconfig')) caselog($command.' &> /dev/null 2> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command"); + + //* copy the ISPConfig interface part + $command = 'cp -rf ../interface '.$install_dir; + caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command"); + + //* copy the ISPConfig server part + $command = 'cp -rf ../server '.$install_dir; + caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command"); + + //* Make a backup of the security settings + if(is_file('/usr/local/ispconfig/security/security_settings.ini')) copy('/usr/local/ispconfig/security/security_settings.ini','/usr/local/ispconfig/security/security_settings.ini~'); + + //* copy the ISPConfig security part + $command = 'cp -rf ../security '.$install_dir; + caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command"); + + //* Apply changed security_settings.ini values to new security_settings.ini file + if(is_file('/usr/local/ispconfig/security/security_settings.ini~')) { + $security_settings_old = ini_to_array(file_get_contents('/usr/local/ispconfig/security/security_settings.ini~')); + $security_settings_new = ini_to_array(file_get_contents('/usr/local/ispconfig/security/security_settings.ini')); + if(is_array($security_settings_new) && is_array($security_settings_old)) { + foreach($security_settings_new as $section => $sval) { + if(is_array($sval)) { + foreach($sval as $key => $val) { + if(isset($security_settings_old[$section]) && isset($security_settings_old[$section][$key])) { + $security_settings_new[$section][$key] = $security_settings_old[$section][$key]; + } + } + } + } + file_put_contents('/usr/local/ispconfig/security/security_settings.ini',array_to_ini($security_settings_new)); + } + } + + //* Create a symlink, so ISPConfig is accessible via web + // Replaced by a separate vhost definition for port 8080 + // $command = "ln -s $install_dir/interface/web/ /var/www/ispconfig"; + // caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command"); + + //* Create the config file for ISPConfig interface + $configfile = 'config.inc.php'; + if(is_file($install_dir.'/interface/lib/'.$configfile)) { + copy($install_dir.'/interface/lib/'.$configfile, $install_dir.'/interface/lib/'.$configfile.'~'); + } + $content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/'.$configfile.'.master', 'tpl/'.$configfile.'.master'); + $content = str_replace('{mysql_server_ispconfig_user}', $conf['mysql']['ispconfig_user'], $content); + $content = str_replace('{mysql_server_ispconfig_password}', $conf['mysql']['ispconfig_password'], $content); + $content = str_replace('{mysql_server_database}', $conf['mysql']['database'], $content); + $content = str_replace('{mysql_server_host}', $conf['mysql']['host'], $content); + $content = str_replace('{mysql_server_port}', $conf['mysql']['port'], $content); + + $content = str_replace('{mysql_master_server_ispconfig_user}', $conf['mysql']['master_ispconfig_user'], $content); + $content = str_replace('{mysql_master_server_ispconfig_password}', $conf['mysql']['master_ispconfig_password'], $content); + $content = str_replace('{mysql_master_server_database}', $conf['mysql']['master_database'], $content); + $content = str_replace('{mysql_master_server_host}', $conf['mysql']['master_host'], $content); + $content = str_replace('{mysql_master_server_port}', $conf['mysql']['master_port'], $content); + + $content = str_replace('{server_id}', $conf['server_id'], $content); + $content = str_replace('{ispconfig_log_priority}', $conf['ispconfig_log_priority'], $content); + $content = str_replace('{language}', $conf['language'], $content); + $content = str_replace('{timezone}', $conf['timezone'], $content); + $content = str_replace('{theme}', $conf['theme'], $content); + $content = str_replace('{language_file_import_enabled}', ($conf['language_file_import_enabled'] == true)?'true':'false', $content); + + wf($install_dir.'/interface/lib/'.$configfile, $content); + + //* Create the config file for ISPConfig server + $configfile = 'config.inc.php'; + if(is_file($install_dir.'/server/lib/'.$configfile)) { + copy($install_dir.'/server/lib/'.$configfile, $install_dir.'/interface/lib/'.$configfile.'~'); + } + $content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/'.$configfile.'.master', 'tpl/'.$configfile.'.master'); + $content = str_replace('{mysql_server_ispconfig_user}', $conf['mysql']['ispconfig_user'], $content); + $content = str_replace('{mysql_server_ispconfig_password}', $conf['mysql']['ispconfig_password'], $content); + $content = str_replace('{mysql_server_database}', $conf['mysql']['database'], $content); + $content = str_replace('{mysql_server_host}', $conf['mysql']['host'], $content); + $content = str_replace('{mysql_server_port}', $conf['mysql']['port'], $content); + + $content = str_replace('{mysql_master_server_ispconfig_user}', $conf['mysql']['master_ispconfig_user'], $content); + $content = str_replace('{mysql_master_server_ispconfig_password}', $conf['mysql']['master_ispconfig_password'], $content); + $content = str_replace('{mysql_master_server_database}', $conf['mysql']['master_database'], $content); + $content = str_replace('{mysql_master_server_host}', $conf['mysql']['master_host'], $content); + $content = str_replace('{mysql_master_server_port}', $conf['mysql']['master_port'], $content); + + $content = str_replace('{server_id}', $conf['server_id'], $content); + $content = str_replace('{ispconfig_log_priority}', $conf['ispconfig_log_priority'], $content); + $content = str_replace('{language}', $conf['language'], $content); + $content = str_replace('{timezone}', $conf['timezone'], $content); + $content = str_replace('{theme}', $conf['theme'], $content); + $content = str_replace('{language_file_import_enabled}', ($conf['language_file_import_enabled'] == true)?'true':'false', $content); + + wf($install_dir.'/server/lib/'.$configfile, $content); + + //* Create the config file for remote-actions (but only, if it does not exist, because + // the value is a autoinc-value and so changed by the remoteaction_core_module + if (!file_exists($install_dir.'/server/lib/remote_action.inc.php')) { + $content = ''; + wf($install_dir.'/server/lib/remote_action.inc.php', $content); + } + + //* Enable the server modules and plugins. + // TODO: Implement a selector which modules and plugins shall be enabled. + $dir = $install_dir.'/server/mods-available/'; + if (is_dir($dir)) { + if ($dh = opendir($dir)) { + while (($file = readdir($dh)) !== false) { + if($file != '.' && $file != '..' && substr($file, -8, 8) == '.inc.php') { + include_once $install_dir.'/server/mods-available/'.$file; + $module_name = substr($file, 0, -8); + $tmp = new $module_name; + if($tmp->onInstall()) { + if(!@is_link($install_dir.'/server/mods-enabled/'.$file)) { + @symlink($install_dir.'/server/mods-available/'.$file, $install_dir.'/server/mods-enabled/'.$file); + // @symlink($install_dir.'/server/mods-available/'.$file, '../mods-enabled/'.$file); + } + if (strpos($file, '_core_module') !== false) { + if(!@is_link($install_dir.'/server/mods-core/'.$file)) { + @symlink($install_dir.'/server/mods-available/'.$file, $install_dir.'/server/mods-core/'.$file); + // @symlink($install_dir.'/server/mods-available/'.$file, '../mods-core/'.$file); + } + } + } + unset($tmp); + } + } + closedir($dh); + } + } + + $dir = $install_dir.'/server/plugins-available/'; + if (is_dir($dir)) { + if ($dh = opendir($dir)) { + while (($file = readdir($dh)) !== false) { + if($conf['apache']['installed'] == true && $file == 'nginx_plugin.inc.php') continue; + if($conf['nginx']['installed'] == true && $file == 'apache2_plugin.inc.php') continue; + if($file != '.' && $file != '..' && substr($file, -8, 8) == '.inc.php') { + include_once $install_dir.'/server/plugins-available/'.$file; + $plugin_name = substr($file, 0, -8); + $tmp = new $plugin_name; + if(method_exists($tmp, 'onInstall') && $tmp->onInstall()) { + if(!@is_link($install_dir.'/server/plugins-enabled/'.$file)) { + @symlink($install_dir.'/server/plugins-available/'.$file, $install_dir.'/server/plugins-enabled/'.$file); + //@symlink($install_dir.'/server/plugins-available/'.$file, '../plugins-enabled/'.$file); + } + if (strpos($file, '_core_plugin') !== false) { + if(!@is_link($install_dir.'/server/plugins-core/'.$file)) { + @symlink($install_dir.'/server/plugins-available/'.$file, $install_dir.'/server/plugins-core/'.$file); + //@symlink($install_dir.'/server/plugins-available/'.$file, '../plugins-core/'.$file); + } + } + } + unset($tmp); + } + } + closedir($dh); + } + } + + // Update the server config + $mail_server_enabled = ($conf['services']['mail'])?1:0; + $web_server_enabled = ($conf['services']['web'])?1:0; + $dns_server_enabled = ($conf['services']['dns'])?1:0; + $file_server_enabled = ($conf['services']['file'])?1:0; + $db_server_enabled = ($conf['services']['db'])?1:0; + $vserver_server_enabled = ($conf['openvz']['installed'])?1:0; + $proxy_server_enabled = ($conf['services']['proxy'])?1:0; + $firewall_server_enabled = ($conf['services']['firewall'])?1:0; + $xmpp_server_enabled = ($conf['services']['xmpp'])?1:0; + + $sql = "UPDATE `server` SET mail_server = '$mail_server_enabled', web_server = '$web_server_enabled', dns_server = '$dns_server_enabled', file_server = '$file_server_enabled', db_server = '$db_server_enabled', vserver_server = '$vserver_server_enabled', proxy_server = '$proxy_server_enabled', firewall_server = '$firewall_server_enabled', xmpp_server = '$xmpp_server_enabled' WHERE server_id = ?"; + + $this->db->query($sql, $conf['server_id']); + if($conf['mysql']['master_slave_setup'] == 'y') { + $this->dbmaster->query($sql, $conf['server_id']); + } + + + // chown install dir to root and chmod 755 + $command = 'chown root:root '.$install_dir; + caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command"); + $command = 'chmod 755 '.$install_dir; + caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command"); + + //* Chmod the files and directories in the install dir + $command = 'chmod -R 750 '.$install_dir.'/*'; + caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command"); + + //* chown the interface files to the ispconfig user and group + $command = 'chown -R ispconfig:ispconfig '.$install_dir.'/interface'; + caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command"); + + //* Chmod the files and directories in the acme dir + $command = 'chmod -R 755 '.$install_dir.'/interface/acme'; + caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command"); + + //* chown the server files to the root user and group + $command = 'chown -R root:root '.$install_dir.'/server'; + caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command"); + + //* chown the security files to the root user and group + $command = 'chown -R root:root '.$install_dir.'/security'; + caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command"); + + //* chown the security directory and security_settings.ini to root:ispconfig + $command = 'chown root:ispconfig '.$install_dir.'/security/security_settings.ini'; + caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command"); + $command = 'chown root:ispconfig '.$install_dir.'/security'; + caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command"); + $command = 'chown root:ispconfig '.$install_dir.'/security/ids.whitelist'; + caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command"); + $command = 'chown root:ispconfig '.$install_dir.'/security/ids.htmlfield'; + caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command"); + $command = 'chown root:ispconfig '.$install_dir.'/security/apache_directives.blacklist'; + caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command"); + $command = 'chown root:ispconfig '.$install_dir.'/security/nginx_directives.blacklist'; + caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command"); + + //* Make the global language file directory group writable + exec("chmod -R 770 $install_dir/interface/lib/lang"); + + //* Make the temp directory for language file exports writable + if(is_dir($install_dir.'/interface/web/temp')) exec("chmod -R 770 $install_dir/interface/web/temp"); + + //* Make all interface language file directories group writable + $handle = @opendir($install_dir.'/interface/web'); + while ($file = @readdir($handle)) { + if ($file != '.' && $file != '..') { + if(@is_dir($install_dir.'/interface/web'.'/'.$file.'/lib/lang')) { + $handle2 = opendir($install_dir.'/interface/web'.'/'.$file.'/lib/lang'); + chmod($install_dir.'/interface/web'.'/'.$file.'/lib/lang', 0770); + while ($lang_file = @readdir($handle2)) { + if ($lang_file != '.' && $lang_file != '..') { + chmod($install_dir.'/interface/web'.'/'.$file.'/lib/lang/'.$lang_file, 0770); + } + } + } + } + } + + //* Make the APS directories group writable + exec("chmod -R 770 $install_dir/interface/web/sites/aps_meta_packages"); + exec("chmod -R 770 $install_dir/server/aps_packages"); + + //* make sure that the server config file (not the interface one) is only readable by the root user + chmod($install_dir.'/server/lib/config.inc.php', 0600); + chown($install_dir.'/server/lib/config.inc.php', 'root'); + chgrp($install_dir.'/server/lib/config.inc.php', 'root'); + + //* Make sure thet the interface config file is readable by user ispconfig only + chmod($install_dir.'/interface/lib/config.inc.php', 0600); + chown($install_dir.'/interface/lib/config.inc.php', 'ispconfig'); + chgrp($install_dir.'/interface/lib/config.inc.php', 'ispconfig'); + + chmod($install_dir.'/server/lib/remote_action.inc.php', 0600); + chown($install_dir.'/server/lib/remote_action.inc.php', 'root'); + chgrp($install_dir.'/server/lib/remote_action.inc.php', 'root'); + + if(@is_file($install_dir.'/server/lib/mysql_clientdb.conf')) { + chmod($install_dir.'/server/lib/mysql_clientdb.conf', 0600); + chown($install_dir.'/server/lib/mysql_clientdb.conf', 'root'); + chgrp($install_dir.'/server/lib/mysql_clientdb.conf', 'root'); + } + + if(is_dir($install_dir.'/interface/invoices')) { + exec('chmod -R 770 '.escapeshellarg($install_dir.'/interface/invoices')); + exec('chown -R ispconfig:ispconfig '.escapeshellarg($install_dir.'/interface/invoices')); + } + + exec('chown -R root:root /usr/local/ispconfig/interface/ssl'); + + // TODO: FIXME: add the www-data user to the ispconfig group. This is just for testing + // and must be fixed as this will allow the apache user to read the ispconfig files. + // Later this must run as own apache server or via suexec! + if($conf['apache']['installed'] == true){ + $command = 'adduser '.$conf['apache']['user'].' ispconfig'; + caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command"); + if(is_group('ispapps')){ + $command = 'adduser '.$conf['apache']['user'].' ispapps'; + caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command"); + } + } + if($conf['nginx']['installed'] == true){ + $command = 'adduser '.$conf['nginx']['user'].' ispconfig'; + caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command"); + if(is_group('ispapps')){ + $command = 'adduser '.$conf['nginx']['user'].' ispapps'; + caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command"); + } + } + + //* Make the shell scripts executable + $command = "chmod +x $install_dir/server/scripts/*.sh"; + caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command"); + + if ($this->install_ispconfig_interface == true && isset($conf['interface_password']) && $conf['interface_password']!='admin') { + $sql = "UPDATE sys_user SET passwort = md5(?) WHERE username = 'admin';"; + $this->db->query($sql, $conf['interface_password']); + } + + if($conf['apache']['installed'] == true && $this->install_ispconfig_interface == true){ + //* Copy the ISPConfig vhost for the controlpanel + $vhost_conf_dir = $conf['apache']['vhost_conf_dir']; + $vhost_conf_enabled_dir = $conf['apache']['vhost_conf_enabled_dir']; + + // Dont just copy over the virtualhost template but add some custom settings + $tpl = new tpl('apache_ispconfig.vhost.master'); + $tpl->setVar('vhost_port',$conf['apache']['vhost_port']); + + // comment out the listen directive if port is 80 or 443 + if($conf['apache']['vhost_port'] == 80 or $conf['apache']['vhost_port'] == 443) { + $tpl->setVar('vhost_port_listen','#'); + } else { + $tpl->setVar('vhost_port_listen',''); + } + + if(is_file($install_dir.'/interface/ssl/ispserver.crt') && is_file($install_dir.'/interface/ssl/ispserver.key')) { + $tpl->setVar('ssl_comment',''); + } else { + $tpl->setVar('ssl_comment','#'); + } + if(is_file($install_dir.'/interface/ssl/ispserver.crt') && is_file($install_dir.'/interface/ssl/ispserver.key') && is_file($install_dir.'/interface/ssl/ispserver.bundle')) { + $tpl->setVar('ssl_bundle_comment',''); + } else { + $tpl->setVar('ssl_bundle_comment','#'); + } + + $tpl->setVar('apache_version',getapacheversion()); + + wf($vhost_conf_dir.'/ispconfig.vhost', $tpl->grab()); + + //* and create the symlink + if($this->is_update == false) { + if(@is_link($vhost_conf_enabled_dir.'/ispconfig.vhost')) unlink($vhost_conf_enabled_dir.'/ispconfig.vhost'); + if(!@is_link($vhost_conf_enabled_dir.'/000-ispconfig.vhost')) { + symlink($vhost_conf_dir.'/ispconfig.vhost', $vhost_conf_enabled_dir.'/000-ispconfig.vhost'); + } + } + //if(!is_file('/var/www/php-fcgi-scripts/ispconfig/.php-fcgi-starter')) { + $content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/apache_ispconfig_fcgi_starter.master', 'tpl/apache_ispconfig_fcgi_starter.master'); + $content = str_replace('{fastcgi_bin}', $conf['fastcgi']['fastcgi_bin'], $content); + $content = str_replace('{fastcgi_phpini_path}', $conf['fastcgi']['fastcgi_phpini_path'], $content); + @mkdir('/var/www/php-fcgi-scripts/ispconfig', 0755, true); + wf('/var/www/php-fcgi-scripts/ispconfig/.php-fcgi-starter', $content); + exec('chmod +x /var/www/php-fcgi-scripts/ispconfig/.php-fcgi-starter'); + @symlink($install_dir.'/interface/web', '/var/www/ispconfig'); + exec('chown -R ispconfig:ispconfig /var/www/php-fcgi-scripts/ispconfig'); + //} + } + + if($conf['nginx']['installed'] == true && $this->install_ispconfig_interface == true){ + //* Copy the ISPConfig vhost for the controlpanel + $vhost_conf_dir = $conf['nginx']['vhost_conf_dir']; + $vhost_conf_enabled_dir = $conf['nginx']['vhost_conf_enabled_dir']; + + // Dont just copy over the virtualhost template but add some custom settings + $content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/nginx_ispconfig.vhost.master', 'tpl/nginx_ispconfig.vhost.master'); + $content = str_replace('{vhost_port}', $conf['nginx']['vhost_port'], $content); + + if(is_file($install_dir.'/interface/ssl/ispserver.crt') && is_file($install_dir.'/interface/ssl/ispserver.key')) { + $content = str_replace('{ssl_on}', 'ssl', $content); + $content = str_replace('{ssl_comment}', '', $content); + $content = str_replace('{fastcgi_ssl}', 'on', $content); + } else { + $content = str_replace('{ssl_on}', '', $content); + $content = str_replace('{ssl_comment}', '#', $content); + $content = str_replace('{fastcgi_ssl}', 'off', $content); + } + + $socket_dir = escapeshellcmd($conf['nginx']['php_fpm_socket_dir']); + if(substr($socket_dir, -1) != '/') $socket_dir .= '/'; + if(!is_dir($socket_dir)) exec('mkdir -p '.$socket_dir); + $fpm_socket = $socket_dir.'ispconfig.sock'; + + //$content = str_replace('{fpm_port}', $conf['nginx']['php_fpm_start_port'], $content); + $content = str_replace('{fpm_socket}', $fpm_socket, $content); + + wf($vhost_conf_dir.'/ispconfig.vhost', $content); + + unset($content); + + // PHP-FPM + // Dont just copy over the php-fpm pool template but add some custom settings + $content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/php_fpm_pool.conf.master', 'tpl/php_fpm_pool.conf.master'); + $content = str_replace('{fpm_pool}', 'ispconfig', $content); + //$content = str_replace('{fpm_port}', $conf['nginx']['php_fpm_start_port'], $content); + $content = str_replace('{fpm_socket}', $fpm_socket, $content); + $content = str_replace('{fpm_user}', 'ispconfig', $content); + $content = str_replace('{fpm_group}', 'ispconfig', $content); + wf($conf['nginx']['php_fpm_pool_dir'].'/ispconfig.conf', $content); + + //copy('tpl/nginx_ispconfig.vhost.master', $vhost_conf_dir.'/ispconfig.vhost'); + //* and create the symlink + if($this->is_update == false) { + if(@is_link($vhost_conf_enabled_dir.'/ispconfig.vhost')) unlink($vhost_conf_enabled_dir.'/ispconfig.vhost'); + if(!@is_link($vhost_conf_enabled_dir.'/000-ispconfig.vhost')) { + symlink($vhost_conf_dir.'/ispconfig.vhost', $vhost_conf_enabled_dir.'/000-ispconfig.vhost'); + } + } + } + + //* Install the update script + if(is_file('/usr/local/bin/ispconfig_update_from_dev.sh')) unlink('/usr/local/bin/ispconfig_update_from_dev.sh'); + chown($install_dir.'/server/scripts/update_from_dev.sh', 'root'); + chmod($install_dir.'/server/scripts/update_from_dev.sh', 0700); +// chown($install_dir.'/server/scripts/update_from_tgz.sh', 'root'); +// chmod($install_dir.'/server/scripts/update_from_tgz.sh', 0700); + chown($install_dir.'/server/scripts/ispconfig_update.sh', 'root'); + chmod($install_dir.'/server/scripts/ispconfig_update.sh', 0700); + if(!is_link('/usr/local/bin/ispconfig_update_from_dev.sh')) symlink($install_dir.'/server/scripts/ispconfig_update.sh', '/usr/local/bin/ispconfig_update_from_dev.sh'); + if(!is_link('/usr/local/bin/ispconfig_update.sh')) symlink($install_dir.'/server/scripts/ispconfig_update.sh', '/usr/local/bin/ispconfig_update.sh'); + + //* Make the logs readable for the ispconfig user + if(@is_file('/var/log/mail.log')) exec('chmod +r /var/log/mail.log'); + if(@is_file('/var/log/mail.warn')) exec('chmod +r /var/log/mail.warn'); + if(@is_file('/var/log/mail.err')) exec('chmod +r /var/log/mail.err'); + if(@is_file('/var/log/messages')) exec('chmod +r /var/log/messages'); + if(@is_file('/var/log/clamav/clamav.log')) exec('chmod +r /var/log/clamav/clamav.log'); + if(@is_file('/var/log/clamav/freshclam.log')) exec('chmod +r /var/log/clamav/freshclam.log'); + + //* Create the ispconfig log file and directory + if(!is_file($conf['ispconfig_log_dir'].'/ispconfig.log')) { + if(!is_dir($conf['ispconfig_log_dir'])) mkdir($conf['ispconfig_log_dir'], 0755); + touch($conf['ispconfig_log_dir'].'/ispconfig.log'); + } + + //* Create the ispconfig auth log file and set uid/gid + if(!is_file($conf['ispconfig_log_dir'].'/auth.log')) { + touch($conf['ispconfig_log_dir'].'/auth.log'); + } + exec('chown ispconfig:ispconfig '. $conf['ispconfig_log_dir'].'/auth.log'); + exec('chmod 660 '. $conf['ispconfig_log_dir'].'/auth.log'); + + if(is_user('getmail')) { + rename($install_dir.'/server/scripts/run-getmail.sh', '/usr/local/bin/run-getmail.sh'); + if(is_user('getmail')) chown('/usr/local/bin/run-getmail.sh', 'getmail'); + chmod('/usr/local/bin/run-getmail.sh', 0744); + } + + //* Add Log-Rotation + if (is_dir('/etc/logrotate.d')) { + @unlink('/etc/logrotate.d/logispc3'); // ignore, if the file is not there + /* We rotate these logs in cron_daily.php + $fh = fopen('/etc/logrotate.d/logispc3', 'w'); + fwrite($fh, + "$conf['ispconfig_log_dir']/ispconfig.log { \n" . + " weekly \n" . + " missingok \n" . + " rotate 4 \n" . + " compress \n" . + " delaycompress \n" . + "} \n" . + "$conf['ispconfig_log_dir']/cron.log { \n" . + " weekly \n" . + " missingok \n" . + " rotate 4 \n" . + " compress \n" . + " delaycompress \n" . + "}"); + fclose($fh); + */ + } + + //* Remove Domain module as its functions are available in the client module now + if(@is_dir('/usr/local/ispconfig/interface/web/domain')) exec('rm -rf /usr/local/ispconfig/interface/web/domain'); + + //* Disable rkhunter run and update in debian cronjob as ispconfig is running and updating rkhunter + if(is_file('/etc/default/rkhunter')) { + replaceLine('/etc/default/rkhunter', 'CRON_DAILY_RUN="yes"', 'CRON_DAILY_RUN="no"', 1, 0); + replaceLine('/etc/default/rkhunter', 'CRON_DB_UPDATE="yes"', 'CRON_DB_UPDATE="no"', 1, 0); + } + + // Add symlink for patch tool + if(!is_link('/usr/local/bin/ispconfig_patch')) exec('ln -s /usr/local/ispconfig/server/scripts/ispconfig_patch /usr/local/bin/ispconfig_patch'); + + // Change mode of a few files from amavisd + if(is_file($conf['amavis']['config_dir'].'/conf.d/50-user')) chmod($conf['amavis']['config_dir'].'/conf.d/50-user', 0640); + if(is_file($conf['amavis']['config_dir'].'/50-user~')) chmod($conf['amavis']['config_dir'].'/50-user~', 0400); + if(is_file($conf['amavis']['config_dir'].'/amavisd.conf')) chmod($conf['amavis']['config_dir'].'/amavisd.conf', 0640); + if(is_file($conf['amavis']['config_dir'].'/amavisd.conf~')) chmod($conf['amavis']['config_dir'].'/amavisd.conf~', 0400); + } + + public function configure_dbserver() { + global $conf; + + //* If this server shall act as database server for client DB's, we configure this here + $install_dir = $conf['ispconfig_install_dir']; + + // Create a file with the database login details which + // are used to create the client databases. + + if(!is_dir($install_dir.'/server/lib')) { + $command = "mkdir $install_dir/server/lib"; + caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command"); + } + + $content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/mysql_clientdb.conf.master', 'tpl/mysql_clientdb.conf.master'); + $content = str_replace('{hostname}', $conf['mysql']['host'], $content); + $content = str_replace('{username}', $conf['mysql']['admin_user'], $content); + $content = str_replace('{password}', addslashes($conf['mysql']['admin_password']), $content); + wf($install_dir.'/server/lib/mysql_clientdb.conf', $content); + chmod($install_dir.'/server/lib/mysql_clientdb.conf', 0600); + chown($install_dir.'/server/lib/mysql_clientdb.conf', 'root'); + chgrp($install_dir.'/server/lib/mysql_clientdb.conf', 'root'); + + } + + public function install_crontab() { + global $conf; + + $install_dir = $conf['ispconfig_install_dir']; + + //* Root Crontab + exec('crontab -u root -l > crontab.txt'); + $existing_root_cron_jobs = file('crontab.txt'); + + // remove existing ispconfig cronjobs, in case the syntax has changed + foreach($existing_root_cron_jobs as $key => $val) { + if(stristr($val, $install_dir)) unset($existing_root_cron_jobs[$key]); + } + + $root_cron_jobs = array( + "* * * * * ".$install_dir."/server/server.sh 2>&1 | while read line; do echo `/bin/date` \"\$line\" >> ".$conf['ispconfig_log_dir']."/cron.log; done", + "* * * * * ".$install_dir."/server/cron.sh 2>&1 | while read line; do echo `/bin/date` \"\$line\" >> ".$conf['ispconfig_log_dir']."/cron.log; done" + ); + + if ($conf['nginx']['installed'] == true) { + $root_cron_jobs[] = "0 0 * * * ".$install_dir."/server/scripts/create_daily_nginx_access_logs.sh &> /dev/null"; + } + + foreach($root_cron_jobs as $cron_job) { + if(!in_array($cron_job."\n", $existing_root_cron_jobs)) { + $existing_root_cron_jobs[] = $cron_job."\n"; + } + } + file_put_contents('crontab.txt', $existing_root_cron_jobs); + exec('crontab -u root crontab.txt &> /dev/null'); + unlink('crontab.txt'); + + //* Getmail crontab + if(is_user('getmail')) { + $cf = $conf['getmail']; + exec('crontab -u getmail -l > crontab.txt'); + $existing_cron_jobs = file('crontab.txt'); + + $cron_jobs = array( + '*/5 * * * * /usr/local/bin/run-getmail.sh > /dev/null 2>> /dev/null' + ); + + // remove existing ispconfig cronjobs, in case the syntax has changed + foreach($existing_cron_jobs as $key => $val) { + if(stristr($val, 'getmail')) unset($existing_cron_jobs[$key]); + } + + foreach($cron_jobs as $cron_job) { + if(!in_array($cron_job."\n", $existing_cron_jobs)) { + $existing_cron_jobs[] = $cron_job."\n"; + } + } + file_put_contents('crontab.txt', $existing_cron_jobs); + exec('crontab -u getmail crontab.txt &> /dev/null'); + unlink('crontab.txt'); + } + + touch($conf['ispconfig_log_dir'].'/cron.log'); + chmod($conf['ispconfig_log_dir'].'/cron.log', 0660); + + } + + public function create_mount_script(){ + global $app, $conf; + $mount_script = '/usr/local/ispconfig/server/scripts/backup_dir_mount.sh'; + $mount_command = ''; + + if(is_file($mount_script)) return; + if(is_file('/etc/rc.local')){ + $rc_local = file('/etc/rc.local'); + if(is_array($rc_local) && !empty($rc_local)){ + foreach($rc_local as $line){ + $line = trim($line); + if(substr($line, 0, 1) == '#') continue; + if(strpos($line, 'sshfs') !== false && strpos($line, '/var/backup') !== false){ + $mount_command = "#!/bin/sh\n\n"; + $mount_command .= $line."\n\n"; + file_put_contents($mount_script, $mount_command); + chmod($mount_script, 0755); + chown($mount_script, 'root'); + chgrp($mount_script, 'root'); + break; + } + } + } + } + } + + // This function is called at the end of the update process and contains code to clean up parts of old ISPCONfig releases + public function cleanup_ispconfig() { + global $app,$conf; + + // Remove directories recursively + if(is_dir('/usr/local/ispconfig/interface/web/designer')) exec('rm -rf /usr/local/ispconfig/interface/web/designer'); + if(is_dir('/usr/local/ispconfig/interface/web/themes/default-304')) exec('rm -rf /usr/local/ispconfig/interface/web/themes/default-304'); + + // Remove files + if(is_file('/usr/local/ispconfig/interface/lib/classes/db_firebird.inc.php')) unlink('/usr/local/ispconfig/interface/lib/classes/db_firebird.inc.php'); + if(is_file('/usr/local/ispconfig/interface/lib/classes/form.inc.php')) unlink('/usr/local/ispconfig/interface/lib/classes/form.inc.php'); + + // Change mode of a few files from amavisd + if(is_file($conf['amavis']['config_dir'].'/conf.d/50-user')) chmod($conf['amavis']['config_dir'].'/conf.d/50-user', 0640); + if(is_file($conf['amavis']['config_dir'].'/50-user~')) chmod($conf['amavis']['config_dir'].'/50-user~', 0400); + if(is_file($conf['amavis']['config_dir'].'/amavisd.conf')) chmod($conf['amavis']['config_dir'].'/amavisd.conf', 0640); + if(is_file($conf['amavis']['config_dir'].'/amavisd.conf~')) chmod($conf['amavis']['config_dir'].'/amavisd.conf~', 0400); + + } + + public function getinitcommand($servicename, $action, $init_script_directory = ''){ + global $conf; + // upstart + if(is_executable('/sbin/initctl')){ + exec('/sbin/initctl version 2>/dev/null | /bin/grep -q upstart', $retval['output'], $retval['retval']); + if(intval($retval['retval']) == 0) return 'service '.$servicename.' '.$action; + } + // systemd + if(is_executable('/bin/systemd') || is_executable('/usr/bin/systemctl')){ + return 'systemctl '.$action.' '.$servicename.'.service'; + } + // sysvinit + if($init_script_directory == '') $init_script_directory = $conf['init_scripts']; + if(substr($init_script_directory, -1) === '/') $init_script_directory = substr($init_script_directory, 0, -1); + return $init_script_directory.'/'.$servicename.' '.$action; + } + + /** + * Helper function - get the path to a template file based on + * the local part of the filename. Checks first for the existence + * of a distribution specific file and if not found looks in the + * base template folder. Optionally the behaviour can be changed + * by setting the 2nd parameter which will fetch the contents + * of the template file and return it instead of the path. The 3rd + * parameter further extends this behaviour by filtering the contents + * by inserting the ispconfig database credentials using the {} placeholders. + * + * @param string $tLocal local part of filename + * @param bool $tRf + * @param bool $tDBCred + * @return string Relative path to the chosen template file + */ + protected function get_template_file($tLocal, $tRf=false, $tDBCred=false) { + global $conf, $dist; + + $final_path = ''; + $dist_template = $conf['ispconfig_install_dir'] . '/server/conf-custom/install/' . $tLocal . '.master'; + if (file_exists($dist_template)) { + $final_path = $dist_template; + } else { + $dist_template = 'dist/tpl/'.strtolower($dist['name'])."/$tLocal.master"; + if (file_exists($dist_template)) { + $final_path = $dist_template; + } else { + $final_path = "tpl/$tLocal.master"; + } + } + + if (!$tRf) { + return $final_path; + } else { + return (!$tDBCred) ? rf($final_path) : $this->insert_db_credentials(rf($final_path)); + } + } + + /** + * Helper function - writes the contents to a config file + * and performs a backup if the file exist. Additionally + * if the file exists the new file will be given the + * same rights and ownership as the original. Optionally the + * rights and/or ownership can be overriden by appending umask, + * user and group to the parameters. Providing only uid and gid + * values will result in only a chown. + * + * @param $tConf + * @param $tContents + * @return bool + */ + protected function write_config_file($tConf, $tContents) { + // Backup config file before writing new contents and stat file + if ( is_file($tConf) ) { + $stat = exec('stat -c \'%a %U %G\' '.escapeshellarg($tConf), $output, $res); + if ($res == 0) { // stat successfull + list($access, $user, $group) = explode(" ", $stat); + } + + if ( copy($tConf, $tConf.'~') ) { + chmod($tConf.'~', 0400); + } + } + + wf($tConf, $tContents); // write file + + if (func_num_args() >= 4) // override rights and/or ownership + { + $args = func_get_args(); + $output = array_slice($args, 2); + + switch (sizeof($output)) { + case 3: + $umask = array_shift($output); + if (is_numeric($umask) && preg_match('/^0?[0-7]{3}$/', $umask)) { + $access = $umask; + } + case 2: + if (is_user($output[0]) && is_group($output[1])) { + list($user, $group) = $output; + } + break; + } + } + + if (!empty($user) && !empty($group)) { + chown($tConf, $user); + chgrp($tConf, $group); + } + + if (!empty($access)) { + exec("chmod $access $tConf"); + } + } + + /** + * Helper function - filter the contents of a config + * file by inserting the common ispconfig database + * credentials. + * + * @param $tContents + * @return string + */ + protected function insert_db_credentials($tContents) { + global $conf; + + $tContents = str_replace('{mysql_server_ispconfig_user}', $conf["mysql"]["ispconfig_user"], $tContents); + $tContents = str_replace('{mysql_server_ispconfig_password}', $conf["mysql"]["ispconfig_password"], $tContents); + $tContents = str_replace('{mysql_server_database}', $conf["mysql"]["database"], $tContents); + $tContents = str_replace('{mysql_server_ip}', $conf["mysql"]["ip"], $tContents); + $tContents = str_replace('{mysql_server_host}', $conf['mysql']['host'], $tContents); + $tContents = str_replace('{mysql_server_port}', $conf['mysql']['port'], $tContents); + $tContents = str_replace('{mysql_server_port}', $conf["mysql"]["port"], $tContents); + + return $tContents; + } + +} + +?> diff --git a/install/lib/update.lib.php b/install/lib/update.lib.php index 3406b760b0565049562acbfb06200e05ec7f8cc8..fd1a34b2ca34eb929bf8522abd768a67f90e0c95 100644 --- a/install/lib/update.lib.php +++ b/install/lib/update.lib.php @@ -103,7 +103,7 @@ function checkDbHealth() { $notok = array(); echo "Checking ISPConfig database .. "; - exec("mysqlcheck -h ".escapeshellarg($conf['mysql']['host'])." -u ".escapeshellarg($conf['mysql']['admin_user'])." -p".escapeshellarg($conf['mysql']['admin_password'])." -P ".escapeshellarg($conf['mysql']['port'])." -r ".escapeshellarg($conf["mysql"]["database"]), $result); + exec("mysqlcheck -h ".escapeshellarg($conf['mysql']['host'])." -u ".escapeshellarg($conf['mysql']['admin_user'])." -p".escapeshellarg($conf['mysql']['admin_password'])." -P ".escapeshellarg($conf['mysql']['port'])." --auto-repair ".escapeshellarg($conf["mysql"]["database"]), $result); for( $i=0; $i +-- + +-- +-- ISPConfig 3 +-- DB-Version: 3.0.0.9 +-- + +SET FOREIGN_KEY_CHECKS = 0; + +-- -------------------------------------------------------- +-- -------------------------------------------------------- +-- DB-STRUCTURE +-- -------------------------------------------------------- +-- -------------------------------------------------------- + +-- +-- Table structure for table `aps_instances` +-- + +CREATE TABLE IF NOT EXISTS `aps_instances` ( + `id` int(4) NOT NULL AUTO_INCREMENT, + `sys_userid` int(11) unsigned NOT NULL DEFAULT '0', + `sys_groupid` int(11) unsigned NOT NULL DEFAULT '0', + `sys_perm_user` varchar(5) DEFAULT NULL, + `sys_perm_group` varchar(5) DEFAULT NULL, + `sys_perm_other` varchar(5) DEFAULT NULL, + `server_id` int(11) NOT NULL DEFAULT '0', + `customer_id` int(4) NOT NULL DEFAULT '0', + `package_id` int(4) NOT NULL DEFAULT '0', + `instance_status` int(4) NOT NULL DEFAULT '0', + PRIMARY KEY (`id`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 ; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `aps_instances_settings` +-- + +CREATE TABLE IF NOT EXISTS `aps_instances_settings` ( + `id` int(4) NOT NULL AUTO_INCREMENT, + `server_id` int(11) NOT NULL DEFAULT '0', + `instance_id` int(4) NOT NULL DEFAULT '0', + `name` varchar(255) NOT NULL DEFAULT '', + `value` text, + PRIMARY KEY (`id`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 ; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `aps_packages` +-- + +CREATE TABLE IF NOT EXISTS `aps_packages` ( + `id` int(4) NOT NULL AUTO_INCREMENT, + `path` varchar(255) NOT NULL DEFAULT '', + `name` varchar(255) NOT NULL DEFAULT '', + `category` varchar(255) NOT NULL DEFAULT '', + `version` varchar(20) NOT NULL DEFAULT '', + `release` int(4) NOT NULL DEFAULT '0', + `package_url` TEXT, + `package_status` int(1) NOT NULL DEFAULT '2', + PRIMARY KEY (`id`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 ; + +-- -------------------------------------------------------- + +-- +-- Tabellenstruktur für Tabelle `aps_settings` +-- + +CREATE TABLE IF NOT EXISTS `aps_settings` ( + `id` int(4) NOT NULL AUTO_INCREMENT, + `name` varchar(255) NOT NULL DEFAULT '', + `value` text, + PRIMARY KEY (`id`), + UNIQUE KEY `name` (`name`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 ; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `attempts_login` +-- + +CREATE TABLE `attempts_login` ( + `ip` varchar(39) NOT NULL DEFAULT '', + `times` int(11) DEFAULT NULL, + `login_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP +) ENGINE=MyISAM DEFAULT CHARSET=utf8 ; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `client` +-- + +CREATE TABLE `client` ( + `client_id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `sys_userid` int(11) unsigned NOT NULL DEFAULT '0', + `sys_groupid` int(11) unsigned NOT NULL DEFAULT '0', + `sys_perm_user` varchar(5) DEFAULT NULL, + `sys_perm_group` varchar(5) DEFAULT NULL, + `sys_perm_other` varchar(5) DEFAULT NULL, + `company_name` varchar(64) DEFAULT NULL, + `company_id` varchar(255) DEFAULT NULL, + `gender` enum('','m','f') NOT NULL DEFAULT '', + `contact_firstname` varchar( 64 ) NOT NULL DEFAULT '', + `contact_name` varchar(64) DEFAULT NULL, + `customer_no` varchar(64) DEFAULT NULL, + `vat_id` varchar(64) DEFAULT NULL, + `street` varchar(255) DEFAULT NULL, + `zip` varchar(32) DEFAULT NULL, + `city` varchar(64) DEFAULT NULL, + `state` varchar(32) DEFAULT NULL, + `country` char(2) DEFAULT NULL, + `telephone` varchar(32) DEFAULT NULL, + `mobile` varchar(32) DEFAULT NULL, + `fax` varchar(32) DEFAULT NULL, + `email` varchar(255) DEFAULT NULL, + `internet` varchar(255) NOT NULL DEFAULT '', + `icq` varchar(16) DEFAULT NULL, + `notes` text, + `bank_account_owner` varchar(255) DEFAULT NULL, + `bank_account_number` varchar(255) DEFAULT NULL, + `bank_code` varchar(255) DEFAULT NULL, + `bank_name` varchar(255) DEFAULT NULL, + `bank_account_iban` varchar(255) DEFAULT NULL, + `bank_account_swift` varchar(255) DEFAULT NULL, + `paypal_email` varchar(255) DEFAULT NULL, + `default_mailserver` int(11) unsigned NOT NULL DEFAULT '1', + `mail_servers` text, + `limit_maildomain` int(11) NOT NULL DEFAULT '-1', + `limit_mailbox` int(11) NOT NULL DEFAULT '-1', + `limit_mailalias` int(11) NOT NULL DEFAULT '-1', + `limit_mailaliasdomain` int(11) NOT NULL DEFAULT '-1', + `limit_mailforward` int(11) NOT NULL DEFAULT '-1', + `limit_mailcatchall` int(11) NOT NULL DEFAULT '-1', + `limit_mailrouting` int(11) NOT NULL DEFAULT '0', + `limit_mailfilter` int(11) NOT NULL DEFAULT '-1', + `limit_fetchmail` int(11) NOT NULL DEFAULT '-1', + `limit_mailquota` int(11) NOT NULL DEFAULT '-1', + `limit_spamfilter_wblist` int(11) NOT NULL DEFAULT '0', + `limit_spamfilter_user` int(11) NOT NULL DEFAULT '0', + `limit_spamfilter_policy` int(11) NOT NULL DEFAULT '0', + `default_xmppserver` int(11) unsigned NOT NULL DEFAULT '1', + `xmpp_servers` text, + `limit_xmpp_domain` int(11) NOT NULL DEFAULT '-1', + `limit_xmpp_user` int(11) NOT NULL DEFAULT '-1', + `limit_xmpp_muc` ENUM( 'n', 'y' ) NOT NULL default 'n', + `limit_xmpp_anon` ENUM( 'n', 'y' ) NOT NULL default 'n', + `limit_xmpp_auth_options` varchar(255) NOT NULL DEFAULT 'plain,hashed,isp', + `limit_xmpp_vjud` ENUM( 'n', 'y' ) NOT NULL default 'n', + `limit_xmpp_proxy` ENUM( 'n', 'y' ) NOT NULL default 'n', + `limit_xmpp_status` ENUM( 'n', 'y' ) NOT NULL default 'n', + `limit_xmpp_pastebin` ENUM( 'n', 'y' ) NOT NULL default 'n', + `limit_xmpp_httparchive` ENUM( 'n', 'y' ) NOT NULL default 'n', + `default_webserver` int(11) unsigned NOT NULL DEFAULT '1', + `web_servers` text, + `limit_web_ip` text, + `limit_web_domain` int(11) NOT NULL DEFAULT '-1', + `limit_web_quota` int(11) NOT NULL DEFAULT '-1', + `web_php_options` varchar(255) NOT NULL DEFAULT 'no,fast-cgi,cgi,mod,suphp,php-fpm,hhvm', + `limit_cgi` enum('n','y') NOT NULL DEFAULT 'n', + `limit_ssi` enum('n','y') NOT NULL DEFAULT 'n', + `limit_perl` enum('n','y') NOT NULL DEFAULT 'n', + `limit_ruby` enum('n','y') NOT NULL DEFAULT 'n', + `limit_python` enum('n','y') NOT NULL DEFAULT 'n', + `force_suexec` enum('n','y') NOT NULL DEFAULT 'y', + `limit_hterror` enum('n','y') NOT NULL DEFAULT 'n', + `limit_wildcard` enum('n','y') NOT NULL DEFAULT 'n', + `limit_ssl` enum('n','y') NOT NULL DEFAULT 'n', + `limit_ssl_letsencrypt` enum('n','y') NOT NULL DEFAULT 'n', + `limit_web_subdomain` int(11) NOT NULL DEFAULT '-1', + `limit_web_aliasdomain` int(11) NOT NULL DEFAULT '-1', + `limit_ftp_user` int(11) NOT NULL DEFAULT '-1', + `limit_shell_user` int(11) NOT NULL DEFAULT '0', + `ssh_chroot` varchar(255) NOT NULL DEFAULT 'no,jailkit,ssh-chroot', + `limit_webdav_user` int(11) NOT NULL DEFAULT '0', + `limit_backup` ENUM( 'n', 'y' ) NOT NULL DEFAULT 'y', + `limit_directive_snippets` ENUM( 'n', 'y' ) NOT NULL DEFAULT 'n', + `limit_aps` int(11) NOT NULL DEFAULT '-1', + `default_dnsserver` int(11) unsigned NOT NULL DEFAULT '1', + `db_servers` text, + `limit_dns_zone` int(11) NOT NULL DEFAULT '-1', + `default_slave_dnsserver` int(11) unsigned NOT NULL DEFAULT '1', + `limit_dns_slave_zone` int(11) NOT NULL DEFAULT '-1', + `limit_dns_record` int(11) NOT NULL DEFAULT '-1', + `default_dbserver` int(11) NOT NULL DEFAULT '1', + `dns_servers` text, + `limit_database` int(11) NOT NULL DEFAULT '-1', + `limit_database_user` int(11) NOT NULL DEFAULT '-1', + `limit_database_quota` int(11) NOT NULL default '-1', + `limit_cron` int(11) NOT NULL DEFAULT '0', + `limit_cron_type` enum('url','chrooted','full') NOT NULL DEFAULT 'url', + `limit_cron_frequency` int(11) NOT NULL DEFAULT '5', + `limit_traffic_quota` int(11) NOT NULL DEFAULT '-1', + `limit_client` int(11) NOT NULL DEFAULT '0', + `limit_domainmodule` int(11) NOT NULL DEFAULT '0', + `limit_mailmailinglist` int(11) NOT NULL DEFAULT '-1', + `limit_openvz_vm` int(11) NOT NULL DEFAULT '0', + `limit_openvz_vm_template_id` int(11) NOT NULL DEFAULT '0', + `parent_client_id` int(11) unsigned NOT NULL DEFAULT '0', + `username` varchar(64) DEFAULT NULL, + `password` varchar(64) DEFAULT NULL, + `language` char(2) NOT NULL DEFAULT 'en', + `usertheme` varchar(32) NOT NULL DEFAULT 'default', + `template_master` int(11) unsigned NOT NULL DEFAULT '0', + `template_additional` text, + `created_at` bigint(20) DEFAULT NULL, + `locked` enum('n','y') NOT NULL DEFAULT 'n', + `canceled` enum('n','y') NOT NULL DEFAULT 'n', + `can_use_api` enum('n','y') NOT NULL DEFAULT 'n', + `tmp_data` mediumblob, + `id_rsa` varchar(2000) NOT NULL DEFAULT '', + `ssh_rsa` varchar(600) NOT NULL DEFAULT '', + `customer_no_template` varchar(255) DEFAULT 'R[CLIENTID]C[CUSTOMER_NO]', + `customer_no_start` int(11) NOT NULL DEFAULT '1', + `customer_no_counter` int(11) NOT NULL DEFAULT '0', + `added_date` date NULL DEFAULT NULL, + `added_by` varchar(255) DEFAULT NULL, + `validation_status` enum('accept','review','reject') NOT NULL DEFAULT 'accept', + `risk_score` int(10) unsigned NOT NULL DEFAULT '0', + `activation_code` varchar(10) NOT NULL DEFAULT '', + PRIMARY KEY (`client_id`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `client_circle` +-- + +CREATE TABLE `client_circle` ( + `circle_id` int(11) NOT NULL AUTO_INCREMENT, + `sys_userid` int(11) NOT NULL DEFAULT '0', + `sys_groupid` int(11) NOT NULL DEFAULT '0', + `sys_perm_user` varchar(5) DEFAULT NULL, + `sys_perm_group` varchar(5) DEFAULT NULL, + `sys_perm_other` varchar(5) DEFAULT NULL, + `circle_name` varchar(64) DEFAULT NULL, + `client_ids` text, + `description` text, + `active` enum('n','y') NOT NULL default 'y', + PRIMARY KEY (`circle_id`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `client_template` +-- + +CREATE TABLE `client_template` ( + `template_id` int(11) unsigned NOT NULL auto_increment, + `sys_userid` int(11) unsigned NOT NULL default '0', + `sys_groupid` int(11) unsigned NOT NULL default '0', + `sys_perm_user` varchar(5) default NULL, + `sys_perm_group` varchar(5) default NULL, + `sys_perm_other` varchar(5) default NULL, + `template_name` varchar(64) NOT NULL DEFAULT '', + `template_type` varchar(1) NOT NULL default 'm', + `mail_servers` text, + `limit_maildomain` int(11) NOT NULL default '-1', + `limit_mailbox` int(11) NOT NULL default '-1', + `limit_mailalias` int(11) NOT NULL default '-1', + `limit_mailaliasdomain` int(11) NOT NULL default '-1', + `limit_mailforward` int(11) NOT NULL default '-1', + `limit_mailcatchall` int(11) NOT NULL default '-1', + `limit_mailrouting` int(11) NOT NULL default '0', + `limit_mailfilter` int(11) NOT NULL default '-1', + `limit_fetchmail` int(11) NOT NULL default '-1', + `limit_mailquota` int(11) NOT NULL default '-1', + `limit_spamfilter_wblist` int(11) NOT NULL default '0', + `limit_spamfilter_user` int(11) NOT NULL default '0', + `limit_spamfilter_policy` int(11) NOT NULL default '0', + `default_xmppserver` int(11) unsigned NOT NULL DEFAULT '1', + `xmpp_servers` text, + `limit_xmpp_domain` int(11) NOT NULL DEFAULT '-1', + `limit_xmpp_user` int(11) NOT NULL DEFAULT '-1', + `limit_xmpp_muc` ENUM( 'n', 'y' ) NOT NULL default 'n', + `limit_xmpp_anon` ENUM( 'n', 'y' ) NOT NULL default 'n', + `limit_xmpp_vjud` ENUM( 'n', 'y' ) NOT NULL default 'n', + `limit_xmpp_proxy` ENUM( 'n', 'y' ) NOT NULL default 'n', + `limit_xmpp_status` ENUM( 'n', 'y' ) NOT NULL default 'n', + `limit_xmpp_pastebin` ENUM( 'n', 'y' ) NOT NULL default 'n', + `limit_xmpp_httparchive` ENUM( 'n', 'y' ) NOT NULL default 'n', + `web_servers` text, + `limit_web_ip` text, + `limit_web_domain` int(11) NOT NULL default '-1', + `limit_web_quota` int(11) NOT NULL default '-1', + `web_php_options` varchar(255) NOT NULL DEFAULT 'no', + `limit_cgi` enum('n','y') NOT NULL DEFAULT 'n', + `limit_ssi` enum('n','y') NOT NULL DEFAULT 'n', + `limit_perl` enum('n','y') NOT NULL DEFAULT 'n', + `limit_ruby` enum('n','y') NOT NULL DEFAULT 'n', + `limit_python` enum('n','y') NOT NULL DEFAULT 'n', + `force_suexec` enum('n','y') NOT NULL DEFAULT 'y', + `limit_hterror` enum('n','y') NOT NULL DEFAULT 'n', + `limit_wildcard` enum('n','y') NOT NULL DEFAULT 'n', + `limit_ssl` enum('n','y') NOT NULL DEFAULT 'n', + `limit_ssl_letsencrypt` enum('n','y') NOT NULL DEFAULT 'n', + `limit_web_subdomain` int(11) NOT NULL default '-1', + `limit_web_aliasdomain` int(11) NOT NULL default '-1', + `limit_ftp_user` int(11) NOT NULL default '-1', + `limit_shell_user` int(11) NOT NULL default '0', + `ssh_chroot` varchar(255) NOT NULL DEFAULT 'no', + `limit_webdav_user` int(11) NOT NULL default '0', + `limit_backup` ENUM( 'n', 'y' ) NOT NULL DEFAULT 'y', + `limit_directive_snippets` ENUM( 'n', 'y' ) NOT NULL DEFAULT 'n', + `limit_aps` int(11) NOT NULL DEFAULT '-1', + `dns_servers` text, + `limit_dns_zone` int(11) NOT NULL default '-1', + `default_slave_dnsserver` int(11) NOT NULL DEFAULT '0', + `limit_dns_slave_zone` int(11) NOT NULL default '-1', + `limit_dns_record` int(11) NOT NULL default '-1', + `db_servers` text, + `limit_database` int(11) NOT NULL default '-1', + `limit_database_user` int(11) NOT NULL DEFAULT '-1', + `limit_database_quota` int(11) NOT NULL default '-1', + `limit_cron` int(11) NOT NULL default '0', + `limit_cron_type` enum('url','chrooted','full') NOT NULL default 'url', + `limit_cron_frequency` int(11) NOT NULL default '5', + `limit_traffic_quota` int(11) NOT NULL default '-1', + `limit_client` int(11) NOT NULL default '0', + `limit_domainmodule` int(11) NOT NULL DEFAULT '0', + `limit_mailmailinglist` int(11) NOT NULL default '-1', + `limit_openvz_vm` int(11) NOT NULL DEFAULT '0', + `limit_openvz_vm_template_id` int(11) NOT NULL DEFAULT '0', + PRIMARY KEY (`template_id`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `client_template_assigned` +-- + +CREATE TABLE `client_template_assigned` ( + `assigned_template_id` bigint(20) NOT NULL auto_increment, + `client_id` bigint(11) NOT NULL DEFAULT '0', + `client_template_id` int(11) NOT NULL DEFAULT '0', + PRIMARY KEY (`assigned_template_id`), + KEY `client_id` (`client_id`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; +-- -------------------------------------------------------- + +-- +-- Table structure for table `invoice_message_template` +-- + +CREATE TABLE `client_message_template` ( + `client_message_template_id` bigint(20) NOT NULL AUTO_INCREMENT, + `sys_userid` int(11) NOT NULL DEFAULT '0', + `sys_groupid` int(11) NOT NULL DEFAULT '0', + `sys_perm_user` varchar(5) DEFAULT NULL, + `sys_perm_group` varchar(5) DEFAULT NULL, + `sys_perm_other` varchar(5) DEFAULT NULL, + `template_type` varchar(255) DEFAULT NULL, + `template_name` varchar(255) DEFAULT NULL, + `subject` varchar(255) DEFAULT NULL, + `message` text, + PRIMARY KEY (`client_message_template_id`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; + +-- +-- Dumping data for table `invoice_message_template` +-- + +-- -------------------------------------------------------- + +-- +-- Table structure for table `country` +-- + +CREATE TABLE `country` ( + `iso` char(2) NOT NULL DEFAULT '', + `name` varchar(64) NOT NULL DEFAULT '', + `printable_name` varchar(64) NOT NULL DEFAULT '', + `iso3` char(3) DEFAULT NULL, + `numcode` smallint(6) DEFAULT NULL, + `eu` enum('n','y') NOT NULL DEFAULT 'n', + PRIMARY KEY (`iso`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 ; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `cron` +-- +CREATE TABLE `cron` ( + `id` int(11) unsigned NOT NULL auto_increment, + `sys_userid` int(11) unsigned NOT NULL default '0', + `sys_groupid` int(11) unsigned NOT NULL default '0', + `sys_perm_user` varchar(5) NULL default NULL, + `sys_perm_group` varchar(5) NULL default NULL, + `sys_perm_other` varchar(5) NULL default NULL, + `server_id` int(11) unsigned NOT NULL default '0', + `parent_domain_id` int(11) unsigned NOT NULL default '0', + `type` enum('url','chrooted','full') NOT NULL default 'url', + `command` TEXT, + `run_min` varchar(100) NULL, + `run_hour` varchar(100) NULL, + `run_mday` varchar(100) NULL, + `run_month` varchar(100) NULL, + `run_wday` varchar(100) NULL, + `log` enum('n','y') NOT NULL default 'n', + `active` enum('n','y') NOT NULL default 'y', + PRIMARY KEY (`id`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `directive_snippets` +-- + +CREATE TABLE IF NOT EXISTS `directive_snippets` ( + `directive_snippets_id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `sys_userid` int(11) unsigned NOT NULL DEFAULT '0', + `sys_groupid` int(11) unsigned NOT NULL DEFAULT '0', + `sys_perm_user` varchar(5) DEFAULT NULL, + `sys_perm_group` varchar(5) DEFAULT NULL, + `sys_perm_other` varchar(5) DEFAULT NULL, + `name` varchar(255) DEFAULT NULL, + `type` varchar(255) DEFAULT NULL, + `snippet` mediumtext, + `customer_viewable` ENUM('n','y') NOT NULL DEFAULT 'n', + `required_php_snippets` varchar(255) NOT NULL DEFAULT '', + `active` enum('n','y') NOT NULL DEFAULT 'y', + `master_directive_snippets_id` int(11) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`directive_snippets_id`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `dns_rr` +-- +CREATE TABLE `dns_rr` ( + `id` int(11) unsigned NOT NULL auto_increment, + `sys_userid` int(11) unsigned NOT NULL DEFAULT '0', + `sys_groupid` int(11) unsigned NOT NULL DEFAULT '0', + `sys_perm_user` varchar(5) NOT NULL DEFAULT '', + `sys_perm_group` varchar(5) NOT NULL DEFAULT '', + `sys_perm_other` varchar(5) NOT NULL DEFAULT '', + `server_id` int(11) NOT NULL default '1', + `zone` int(11) unsigned NOT NULL DEFAULT '0', + `name` varchar(255) NOT NULL DEFAULT '', + `type` enum('A','AAAA','ALIAS','CNAME','CAA','DS','HINFO','LOC','MX','NAPTR','NS','PTR','RP','SRV','TXT','TLSA','DNSKEY') default NULL, + `data` TEXT NOT NULL, + `aux` int(11) unsigned NOT NULL default '0', + `ttl` int(11) unsigned NOT NULL default '3600', + `active` enum('N','Y') NOT NULL default 'Y', + `stamp` timestamp NOT NULL default CURRENT_TIMESTAMP, + `serial` int(10) unsigned default NULL, + PRIMARY KEY (`id`), + KEY `rr` (`zone`,`type`,`name`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `dns_slave` +-- + +CREATE TABLE `dns_slave` ( + `id` int(10) unsigned NOT NULL auto_increment, + `sys_userid` int(11) unsigned NOT NULL DEFAULT '0', + `sys_groupid` int(11) unsigned NOT NULL DEFAULT '0', + `sys_perm_user` varchar(5) NOT NULL DEFAULT '', + `sys_perm_group` varchar(5) NOT NULL DEFAULT '', + `sys_perm_other` varchar(5) NOT NULL DEFAULT '', + `server_id` int(11) NOT NULL default '1', + `origin` varchar(255) NOT NULL DEFAULT '', + `ns` varchar(255) NOT NULL DEFAULT '', + `active` enum('N','Y') NOT NULL DEFAULT 'N', + `xfer` TEXT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `slave` (`origin`,`server_id`), + KEY `active` (`active`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `dns_ssl_ca` +-- + +CREATE TABLE IF NOT EXISTS `dns_ssl_ca` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `sys_userid` int(11) unsigned NOT NULL DEFAULT '0', + `sys_groupid` int(11) unsigned NOT NULL DEFAULT '0', + `sys_perm_user` varchar(5) NOT NULL DEFAULT '', + `sys_perm_group` varchar(5) NOT NULL DEFAULT '', + `sys_perm_other` varchar(5) NOT NULL DEFAULT '', + `active` enum('N','Y') NOT NULL DEFAULT 'N', + `ca_name` varchar(255) NOT NULL DEFAULT '', + `ca_issue` varchar(255) NOT NULL DEFAULT '', + `ca_wildcard` enum('Y','N') NOT NULL DEFAULT 'N', + `ca_iodef` text NOT NULL, + `ca_critical` tinyint(1) NOT NULL DEFAULT '0', + PRIMARY KEY (`id`), + UNIQUE KEY (`ca_issue`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; + +ALTER TABLE `dns_ssl_ca` ADD UNIQUE(`ca_issue`); + +INSERT INTO `dns_ssl_ca` (`id`, `sys_userid`, `sys_groupid`, `sys_perm_user`, `sys_perm_group`, `sys_perm_other`, `active`, `ca_name`, `ca_issue`, `ca_wildcard`, `ca_iodef`, `ca_critical`) VALUES +(NULL, 1, 1, 'riud', 'riud', '', 'Y', 'AC Camerfirma', 'camerfirma.com', 'Y', '', 0), +(NULL, 1, 1, 'riud', 'riud', '', 'Y', 'ACCV', 'accv.es', 'Y', '', 0), +(NULL, 1, 1, 'riud', 'riud', '', 'Y', 'Actalis', 'actalis.it', 'Y', '', 0), +(NULL, 1, 1, 'riud', 'riud', '', 'Y', 'Amazon', 'amazon.com', 'Y', '', 0), +(NULL, 1, 1, 'riud', 'riud', '', 'Y', 'Asseco', 'certum.pl', 'Y', '', 0), +(NULL, 1, 1, 'riud', 'riud', '', 'Y', 'Buypass', 'buypass.com', 'Y', '', 0), +(NULL, 1, 1, 'riud', 'riud', '', 'Y', 'CA Disig', 'disig.sk', 'Y', '', 0), +(NULL, 1, 1, 'riud', 'riud', '', 'Y', 'CATCert', 'aoc.cat', 'Y', '', 0), +(NULL, 1, 1, 'riud', 'riud', '', 'Y', 'Certinomis', 'www.certinomis.com', 'Y', '', 0), +(NULL, 1, 1, 'riud', 'riud', '', 'Y', 'Certizen', 'hongkongpost.gov.hk', 'Y', '', 0), +(NULL, 1, 1, 'riud', 'riud', '', 'Y', 'certSIGN', 'certsign.ro', 'Y', '', 0), +(NULL, 1, 1, 'riud', 'riud', '', 'Y', 'CFCA', 'cfca.com.cn', 'Y', '', 0), +(NULL, 1, 1, 'riud', 'riud', '', 'Y', 'Chunghwa Telecom', 'cht.com.tw', 'Y', '', 0), +(NULL, 1, 1, 'riud', 'riud', '', 'Y', 'Comodo', 'comodoca.com', 'Y', '', 0), +(NULL, 1, 1, 'riud', 'riud', '', 'Y', 'D-TRUST', 'd-trust.net', 'Y', '', 0), +(NULL, 1, 1, 'riud', 'riud', '', 'Y', 'DigiCert', 'digicert.com', 'Y', '', 0), +(NULL, 1, 1, 'riud', 'riud', '', 'Y', 'DocuSign', 'docusign.fr', 'Y', '', 0), +(NULL, 1, 1, 'riud', 'riud', '', 'Y', 'e-tugra', 'e-tugra.com', 'Y', '', 0), +(NULL, 1, 1, 'riud', 'riud', '', 'Y', 'EDICOM', 'edicomgroup.com', 'Y', '', 0), +(NULL, 1, 1, 'riud', 'riud', '', 'Y', 'Entrust', 'entrust.net', 'Y', '', 0), +(NULL, 1, 1, 'riud', 'riud', '', 'Y', 'Firmaprofesional', 'firmaprofesional.com', 'Y', '', 0), +(NULL, 1, 1, 'riud', 'riud', '', 'Y', 'FNMT', 'fnmt.es', 'Y', '', 0), +(NULL, 1, 1, 'riud', 'riud', '', 'Y', 'GlobalSign', 'globalsign.com', 'Y', '', 0), +(NULL, 1, 1, 'riud', 'riud', '', 'Y', 'GoDaddy', 'godaddy.com', 'Y', '', 0), +(NULL, 1, 1, 'riud', 'riud', '', 'Y', 'Google Trust Services', 'pki.goog', 'Y', '', 0), +(NULL, 1, 1, 'riud', 'riud', '', 'Y', 'GRCA', 'gca.nat.gov.tw', 'Y', '', 0), +(NULL, 1, 1, 'riud', 'riud', '', 'Y', 'HARICA', 'harica.gr', 'Y', '', 0), +(NULL, 1, 1, 'riud', 'riud', '', 'Y', 'IdenTrust', 'identrust.com', 'Y', '', 0), +(NULL, 1, 1, 'riud', 'riud', '', 'Y', 'Izenpe', 'izenpe.com', 'Y', '', 0), +(NULL, 1, 1, 'riud', 'riud', '', 'Y', 'Kamu SM', 'kamusm.gov.tr', 'Y', '', 0), +(NULL, 1, 1, 'riud', 'riud', '', 'Y', 'Let''s Encrypt', 'letsencrypt.org', 'Y', '', 0), +(NULL, 1, 1, 'riud', 'riud', '', 'Y', 'Microsec e-Szigno', 'e-szigno.hu', 'Y', '', 0), +(NULL, 1, 1, 'riud', 'riud', '', 'Y', 'NetLock', 'netlock.hu', 'Y', '', 0), +(NULL, 1, 1, 'riud', 'riud', '', 'Y', 'PKIoverheid', 'www.pkioverheid.nl', 'Y', '', 0), +(NULL, 1, 1, 'riud', 'riud', '', 'Y', 'PROCERT', 'procert.net.ve', 'Y', '', 0), +(NULL, 1, 1, 'riud', 'riud', '', 'Y', 'QuoVadis', 'quovadisglobal.com', 'Y', '', 0), +(NULL, 1, 1, 'riud', 'riud', '', 'Y', 'SECOM', 'secomtrust.net', 'Y', '', 0), +(NULL, 1, 1, 'riud', 'riud', '', 'Y', 'Sertifitseerimiskeskuse', 'sk.ee', 'Y', '', 0), +(NULL, 1, 1, 'riud', 'riud', '', 'Y', 'StartCom', 'startcomca.com', 'Y', '', 0), +(NULL, 1, 1, 'riud', 'riud', '', 'Y', 'SwissSign', 'swisssign.com', 'Y', '', 0), +(NULL, 1, 1, 'riud', 'riud', '', 'Y', 'Symantec / Thawte / GeoTrust', 'symantec.com', 'Y', '', 0), +(NULL, 1, 1, 'riud', 'riud', '', 'Y', 'T-Systems', 'telesec.de', 'Y', '', 0), +(NULL, 1, 1, 'riud', 'riud', '', 'Y', 'Telia', 'telia.com', 'Y', '', 0), +(NULL, 1, 1, 'riud', 'riud', '', 'Y', 'Trustwave', 'trustwave.com', 'Y', '', 0), +(NULL, 1, 1, 'riud', 'riud', '', 'Y', 'Web.com', 'web.com', 'Y', '', 0), +(NULL, 1, 1, 'riud', 'riud', '', 'Y', 'WISeKey', 'wisekey.com', 'Y', '', 0), +(NULL, 1, 1, 'riud', 'riud', '', 'Y', 'WoSign', 'wosign.com', 'Y', '', 0); + +-- -------------------------------------------------------- + +-- +-- Table structure for table `dns_soa` +-- + +CREATE TABLE `dns_soa` ( + `id` int(10) unsigned NOT NULL auto_increment, + `sys_userid` int(11) unsigned NOT NULL DEFAULT '0', + `sys_groupid` int(11) unsigned NOT NULL DEFAULT '0', + `sys_perm_user` varchar(5) NOT NULL DEFAULT '', + `sys_perm_group` varchar(5) NOT NULL DEFAULT '', + `sys_perm_other` varchar(5) NOT NULL DEFAULT '', + `server_id` int(11) NOT NULL default '1', + `origin` varchar(255) NOT NULL DEFAULT '', + `ns` varchar(255) NOT NULL DEFAULT '', + `mbox` varchar(255) NOT NULL DEFAULT '', + `serial` int(11) unsigned NOT NULL default '1', + `refresh` int(11) unsigned NOT NULL default '28800', + `retry` int(11) unsigned NOT NULL default '7200', + `expire` int(11) unsigned NOT NULL default '604800', + `minimum` int(11) unsigned NOT NULL default '3600', + `ttl` int(11) unsigned NOT NULL default '3600', + `active` enum('N','Y') NOT NULL DEFAULT 'N', + `xfer` TEXT NULL, + `also_notify` TEXT NULL, + `update_acl` varchar(255) default NULL, + `dnssec_initialized` ENUM('Y','N') NOT NULL DEFAULT 'N', + `dnssec_wanted` ENUM('Y','N') NOT NULL DEFAULT 'N', + `dnssec_last_signed` BIGINT NOT NULL DEFAULT '0', + `dnssec_info` TEXT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `origin` (`origin`), + KEY `active` (`active`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `dns_template` +-- + +CREATE TABLE `dns_template` ( + `template_id` int(11) unsigned NOT NULL auto_increment, + `sys_userid` int(11) unsigned NOT NULL default '0', + `sys_groupid` int(11) unsigned NOT NULL default '0', + `sys_perm_user` varchar(5) default NULL, + `sys_perm_group` varchar(5) default NULL, + `sys_perm_other` varchar(5) default NULL, + `name` varchar(64) default NULL, + `fields` varchar(255) default NULL, + `template` text, + `visible` enum('N','Y') NOT NULL default 'Y', + PRIMARY KEY (`template_id`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; + +-- +-- Table structure for table `domain` +-- + +CREATE TABLE `domain` ( + `domain_id` int(11) unsigned NOT NULL auto_increment, + `sys_userid` int(11) unsigned NOT NULL default '0', + `sys_groupid` int(11) unsigned NOT NULL default '0', + `sys_perm_user` varchar(5) NOT NULL default '', + `sys_perm_group` varchar(5) NOT NULL default '', + `sys_perm_other` varchar(5) NOT NULL default '', + `domain` varchar(255) NOT NULL default '', + PRIMARY KEY (`domain_id`), + UNIQUE KEY `domain` (`domain`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 ; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `firewall` +-- + +CREATE TABLE `firewall` ( + `firewall_id` int(11) unsigned NOT NULL auto_increment, + `sys_userid` int(11) unsigned NOT NULL default '0', + `sys_groupid` int(11) unsigned NOT NULL default '0', + `sys_perm_user` varchar(5) default NULL, + `sys_perm_group` varchar(5) default NULL, + `sys_perm_other` varchar(5) default NULL, + `server_id` int(11) unsigned NOT NULL default '0', + `tcp_port` text, + `udp_port` text, + `active` enum('n','y') NOT NULL default 'y', + PRIMARY KEY (`firewall_id`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `ftp_user` +-- + +CREATE TABLE `ftp_user` ( + `ftp_user_id` int(11) unsigned NOT NULL auto_increment, + `sys_userid` int(11) unsigned NOT NULL default '0', + `sys_groupid` int(11) unsigned NOT NULL default '0', + `sys_perm_user` varchar(5) default NULL, + `sys_perm_group` varchar(5) default NULL, + `sys_perm_other` varchar(5) default NULL, + `server_id` int(11) unsigned NOT NULL default '0', + `parent_domain_id` int(11) unsigned NOT NULL default '0', + `username` varchar(64) default NULL, + `username_prefix` varchar(50) NOT NULL default '', + `password` varchar(64) default NULL, + `quota_size` bigint(20) NOT NULL default '-1', + `active` enum('n','y') NOT NULL default 'y', + `uid` varchar(64) default NULL, + `gid` varchar(64) default NULL, + `dir` varchar(255) default NULL, + `quota_files` bigint(20) NOT NULL default '-1', + `ul_ratio` int(11) NOT NULL default '-1', + `dl_ratio` int(11) NOT NULL default '-1', + `ul_bandwidth` int(11) NOT NULL default '-1', + `dl_bandwidth` int(11) NOT NULL default '-1', + `expires` datetime NULL DEFAULT NULL, + `user_type` set('user','system') NOT NULL DEFAULT 'user', + `user_config` text, + PRIMARY KEY (`ftp_user_id`), + KEY `active` (`active`), + KEY `server_id` (`server_id`), + KEY `username` (`username`), + KEY `quota_files` (`quota_files`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `ftp_traffic` +-- + +CREATE TABLE `ftp_traffic` ( + `hostname` varchar(255) NOT NULL, + `traffic_date` date NOT NULL, + `in_bytes` bigint(32) unsigned NOT NULL, + `out_bytes` bigint(32) unsigned NOT NULL, + UNIQUE KEY (`hostname`,`traffic_date`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `help_faq` +-- + +CREATE TABLE `help_faq` ( + `hf_id` int(11) NOT NULL AUTO_INCREMENT, + `hf_section` int(11) DEFAULT NULL, + `hf_order` int(11) DEFAULT '0', + `hf_question` text, + `hf_answer` text, + `sys_userid` int(11) DEFAULT NULL, + `sys_groupid` int(11) DEFAULT NULL, + `sys_perm_user` varchar(5) DEFAULT NULL, + `sys_perm_group` varchar(5) DEFAULT NULL, + `sys_perm_other` varchar(5) DEFAULT NULL, + PRIMARY KEY (`hf_id`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `help_faq_sections` +-- + +CREATE TABLE `help_faq_sections` ( + `hfs_id` int(11) NOT NULL AUTO_INCREMENT, + `hfs_name` varchar(255) DEFAULT NULL, + `hfs_order` int(11) DEFAULT '0', + `sys_userid` int(11) DEFAULT NULL, + `sys_groupid` int(11) DEFAULT NULL, + `sys_perm_user` varchar(5) DEFAULT NULL, + `sys_perm_group` varchar(5) DEFAULT NULL, + `sys_perm_other` varchar(5) DEFAULT NULL, + PRIMARY KEY (`hfs_id`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; + +-- -------------------------------------------------------- + +-- Table structure for table `iptables` +-- + +DROP TABLE IF EXISTS `iptables`; +CREATE TABLE `iptables` ( + `iptables_id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `server_id` int(10) unsigned NOT NULL DEFAULT '0', + `table` varchar(10) DEFAULT NULL COMMENT 'INPUT OUTPUT FORWARD', + `source_ip` varchar(16) DEFAULT NULL, + `destination_ip` varchar(16) DEFAULT NULL, + `protocol` varchar(10) DEFAULT 'TCP' COMMENT 'TCP UDP GRE', + `singleport` varchar(10) DEFAULT NULL, + `multiport` varchar(40) DEFAULT NULL, + `state` varchar(20) DEFAULT NULL COMMENT 'NEW ESTABLISHED RECNET etc', + `target` varchar(10) DEFAULT NULL COMMENT 'ACCEPT DROP REJECT LOG', + `active` enum('n','y') NOT NULL DEFAULT 'y', + PRIMARY KEY (`iptables_id`) +) ENGINE=MyISAM AUTO_INCREMENT=5 DEFAULT CHARSET=utf8; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `mail_access` +-- + +CREATE TABLE `mail_access` ( + `access_id` int(11) unsigned NOT NULL auto_increment, + `sys_userid` int(11) unsigned NOT NULL default '0', + `sys_groupid` int(11) unsigned NOT NULL default '0', + `sys_perm_user` varchar(5) NOT NULL default '', + `sys_perm_group` varchar(5) NOT NULL default '', + `sys_perm_other` varchar(5) NOT NULL default '', + `server_id` int(11) NOT NULL default '0', + `source` varchar(255) NOT NULL DEFAULT '', + `access` varchar(255) NOT NULL DEFAULT '', + `type` set('recipient','sender','client') NOT NULL DEFAULT 'recipient', + `active` enum('n','y') NOT NULL default 'y', + PRIMARY KEY (`access_id`), + KEY `server_id` (`server_id`,`source`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `mail_backup` +-- + +CREATE TABLE `mail_backup` ( + `backup_id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `server_id` int(10) unsigned NOT NULL DEFAULT '0', + `parent_domain_id` int(10) unsigned NOT NULL DEFAULT '0', + `mailuser_id` int(10) unsigned NOT NULL DEFAULT '0', + `backup_mode` varchar(64) NOT NULL DEFAULT '', + `tstamp` int(10) unsigned NOT NULL DEFAULT '0', + `filename` varchar(255) NOT NULL DEFAULT '', + `filesize` VARCHAR(20) NOT NULL DEFAULT '', + PRIMARY KEY (`backup_id`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `mail_content_filter` +-- + +CREATE TABLE `mail_content_filter` ( + `content_filter_id` int(11) unsigned NOT NULL auto_increment, + `sys_userid` int(11) unsigned NOT NULL default '0', + `sys_groupid` int(11) unsigned NOT NULL default '0', + `sys_perm_user` varchar(5) default NULL, + `sys_perm_group` varchar(5) default NULL, + `sys_perm_other` varchar(5) default NULL, + `server_id` int(11) NOT NULL default '0', + `type` varchar(255) default NULL, + `pattern` varchar(255) default NULL, + `data` varchar(255) default NULL, + `action` varchar(255) default NULL, + `active` varchar(255) NOT NULL default 'y', + PRIMARY KEY (`content_filter_id`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `mail_domain` +-- + +CREATE TABLE `mail_domain` ( + `domain_id` int(11) unsigned NOT NULL auto_increment, + `sys_userid` int(11) unsigned NOT NULL default '0', + `sys_groupid` int(11) unsigned NOT NULL default '0', + `sys_perm_user` varchar(5) NOT NULL default '', + `sys_perm_group` varchar(5) NOT NULL default '', + `sys_perm_other` varchar(5) NOT NULL default '', + `server_id` int(11) unsigned NOT NULL default '0', + `domain` varchar(255) NOT NULL default '', + `dkim` ENUM( 'n', 'y' ) NOT NULL default 'n', + `dkim_selector` varchar(63) NOT NULL DEFAULT 'default', + `dkim_private` mediumtext NULL, + `dkim_public` mediumtext NULL, + `active` enum('n','y') NOT NULL DEFAULT 'n', + PRIMARY KEY (`domain_id`), + KEY `server_id` (`server_id`,`domain`), + KEY `domain_active` (`domain`,`active`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `mail_forwarding` +-- + +CREATE TABLE `mail_forwarding` ( + `forwarding_id` int(11) unsigned NOT NULL auto_increment, + `sys_userid` int(11) unsigned NOT NULL default '0', + `sys_groupid` int(11) unsigned NOT NULL default '0', + `sys_perm_user` varchar(5) NOT NULL default '', + `sys_perm_group` varchar(5) NOT NULL default '', + `sys_perm_other` varchar(5) NOT NULL default '', + `server_id` int(11) unsigned NOT NULL default '0', + `source` varchar(255) NOT NULL DEFAULT '', + `destination` text, + `type` enum('alias','aliasdomain','forward','catchall') NOT NULL default 'alias', + `active` enum('n','y') NOT NULL DEFAULT 'n', + `allow_send_as` ENUM('n','y') NOT NULL DEFAULT 'n', + `greylisting` enum('n','y' ) NOT NULL DEFAULT 'n', + PRIMARY KEY (`forwarding_id`), + KEY `server_id` (`server_id`,`source`), + KEY `type` (`type`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `mail_get` +-- + +CREATE TABLE `mail_get` ( + `mailget_id` int(11) unsigned NOT NULL auto_increment, + `sys_userid` int(11) unsigned NOT NULL default '0', + `sys_groupid` int(11) unsigned NOT NULL default '0', + `sys_perm_user` varchar(5) default NULL, + `sys_perm_group` varchar(5) default NULL, + `sys_perm_other` varchar(5) default NULL, + `server_id` int(11) unsigned NOT NULL default '0', + `type` varchar(255) default NULL, + `source_server` varchar(255) default NULL, + `source_username` varchar(255) default NULL, + `source_password` varchar(64) default NULL, + `source_delete` varchar(255) NOT NULL default 'y', + `source_read_all` varchar(255) NOT NULL default 'y', + `destination` varchar(255) default NULL, + `active` varchar(255) NOT NULL default 'y', + PRIMARY KEY (`mailget_id`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; + +-- -------------------------------------------------------- + +-- +-- Tabellenstruktur für Tabelle `mail_mailinglist` +-- + +CREATE TABLE `mail_mailinglist` ( + `mailinglist_id` int(11) unsigned NOT NULL auto_increment, + `sys_userid` int(11) unsigned NOT NULL default '0', + `sys_groupid` int(11) unsigned NOT NULL default '0', + `sys_perm_user` varchar(5) NOT NULL DEFAULT '', + `sys_perm_group` varchar(5) NOT NULL DEFAULT '', + `sys_perm_other` varchar(5) NOT NULL DEFAULT '', + `server_id` int(11) unsigned NOT NULL default '0', + `domain` varchar(255) NOT NULL DEFAULT '', + `listname` varchar(255) NOT NULL DEFAULT '', + `email` varchar(255) NOT NULL DEFAULT '', + `password` varchar(255) NOT NULL DEFAULT '', + PRIMARY KEY (`mailinglist_id`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; + +-- -------------------------------------------------------- + +-- +-- Table structure for Table `mail_relay_recipient` +-- + +CREATE TABLE IF NOT EXISTS `mail_relay_recipient` ( + `relay_recipient_id` bigint(20) NOT NULL AUTO_INCREMENT, + `sys_userid` int(11) NOT NULL DEFAULT '0', + `sys_groupid` int(11) NOT NULL DEFAULT '0', + `sys_perm_user` varchar(5) DEFAULT NULL, + `sys_perm_group` varchar(5) DEFAULT NULL, + `sys_perm_other` varchar(5) DEFAULT NULL, + `server_id` int(11) NOT NULL DEFAULT '0', + `source` varchar(255) DEFAULT NULL, + `access` varchar(255) NOT NULL DEFAULT 'OK', + `active` varchar(255) NOT NULL DEFAULT 'y', + PRIMARY KEY (`relay_recipient_id`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `mail_traffic` +-- + +CREATE TABLE `mail_traffic` ( + `traffic_id` int(11) unsigned NOT NULL auto_increment, + `mailuser_id` int(11) unsigned NOT NULL DEFAULT '0', + `month` char(7) NOT NULL DEFAULT '', + `traffic` bigint(20) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`traffic_id`), + KEY `mailuser_id` (`mailuser_id`,`month`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `mail_transport` +-- + +CREATE TABLE `mail_transport` ( + `transport_id` int(11) unsigned NOT NULL auto_increment, + `sys_userid` int(11) unsigned NOT NULL default '0', + `sys_groupid` int(11) unsigned NOT NULL default '0', + `sys_perm_user` varchar(5) NOT NULL default '', + `sys_perm_group` varchar(5) NOT NULL default '', + `sys_perm_other` varchar(5) NOT NULL default '', + `server_id` int(11) unsigned NOT NULL default '0', + `domain` varchar(255) NOT NULL default '', + `transport` varchar(255) NOT NULL DEFAULT '', + `sort_order` int(11) unsigned NOT NULL default '5', + `active` enum('n','y') NOT NULL DEFAULT 'n', + PRIMARY KEY (`transport_id`), + KEY `server_id` (`server_id`,`transport`), + KEY `server_id_2` (`server_id`,`domain`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `mail_user` +-- + +CREATE TABLE `mail_user` ( + `mailuser_id` int(11) unsigned NOT NULL auto_increment, + `sys_userid` int(11) unsigned NOT NULL default '0', + `sys_groupid` int(11) unsigned NOT NULL default '0', + `sys_perm_user` varchar(5) NOT NULL default '', + `sys_perm_group` varchar(5) NOT NULL default '', + `sys_perm_other` varchar(5) NOT NULL default '', + `server_id` int(11) unsigned NOT NULL default '0', + `email` varchar(255) NOT NULL default '', + `login` varchar(255) NOT NULL default '', + `password` varchar(255) NOT NULL default '', + `name` varchar(255) NOT NULL default '', + `uid` int(11) NOT NULL default '5000', + `gid` int(11) NOT NULL default '5000', + `maildir` varchar(255) NOT NULL default '', + `maildir_format` varchar(255) NOT NULL default 'maildir', + `quota` bigint(20) NOT NULL default '-1', + `cc` varchar(255) NOT NULL default '', + `sender_cc` varchar(255) NOT NULL default '', + `homedir` varchar(255) NOT NULL default '', + `autoresponder` enum('n','y') NOT NULL default 'n', + `autoresponder_start_date` datetime NULL default NULL, + `autoresponder_end_date` datetime NULL default NULL, + `autoresponder_subject` varchar(255) NOT NULL default 'Out of office reply', + `autoresponder_text` mediumtext NULL, + `move_junk` enum('n','y') NOT NULL default 'n', + `custom_mailfilter` mediumtext, + `postfix` enum('n','y') NOT NULL default 'y', + `greylisting` enum('n','y' ) NOT NULL DEFAULT 'n', + `access` enum('n','y') NOT NULL default 'y', + `disableimap` enum('n','y') NOT NULL default 'n', + `disablepop3` enum('n','y') NOT NULL default 'n', + `disabledeliver` enum('n','y') NOT NULL default 'n', + `disablesmtp` enum('n','y') NOT NULL default 'n', + `disablesieve` enum('n','y') NOT NULL default 'n', + `disablesieve-filter` enum('n','y') NOT NULL default 'n', + `disablelda` enum('n','y') NOT NULL default 'n', + `disablelmtp` enum('n','y') NOT NULL default 'n', + `disabledoveadm` enum('n','y') NOT NULL default 'n', + `last_quota_notification` date NULL default NULL, + `backup_interval` VARCHAR( 255 ) NOT NULL default 'none', + `backup_copies` INT NOT NULL DEFAULT '1', + PRIMARY KEY (`mailuser_id`), + KEY `server_id` (`server_id`,`email`), + KEY `email_access` (`email`,`access`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `mail_user_filter` +-- + +CREATE TABLE `mail_user_filter` ( + `filter_id` int(11) unsigned NOT NULL auto_increment, + `sys_userid` int(11) unsigned NOT NULL default '0', + `sys_groupid` int(11) unsigned NOT NULL default '0', + `sys_perm_user` varchar(5) default NULL, + `sys_perm_group` varchar(5) default NULL, + `sys_perm_other` varchar(5) default NULL, + `mailuser_id` int(11) unsigned NOT NULL default '0', + `rulename` varchar(64) default NULL, + `source` varchar(255) default NULL, + `searchterm` varchar(255) default NULL, + `op` varchar(255) default NULL, + `action` varchar(255) default NULL, + `target` varchar(255) default NULL, + `active` enum('n','y') NOT NULL default 'y', + PRIMARY KEY (`filter_id`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `monitor_data` +-- + +CREATE TABLE `monitor_data` ( + `server_id` int(11) unsigned NOT NULL default '0', + `type` varchar(255) NOT NULL default '', + `created` int(11) unsigned NOT NULL default '0', + `data` mediumtext, + `state` enum('no_state','unknown','ok','info','warning','critical','error') NOT NULL DEFAULT 'unknown', + PRIMARY KEY (`server_id`,`type`,`created`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 ; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `openvz_ip` +-- + +CREATE TABLE IF NOT EXISTS `openvz_ip` ( + `ip_address_id` bigint(20) NOT NULL AUTO_INCREMENT, + `sys_userid` int(11) NOT NULL DEFAULT '0', + `sys_groupid` int(11) NOT NULL DEFAULT '0', + `sys_perm_user` varchar(5) DEFAULT NULL, + `sys_perm_group` varchar(5) DEFAULT NULL, + `sys_perm_other` varchar(5) DEFAULT NULL, + `server_id` int(11) NOT NULL DEFAULT '0', + `ip_address` varchar(39) DEFAULT NULL, + `vm_id` int(11) NOT NULL DEFAULT '0', + `reserved` varchar(255) NOT NULL DEFAULT 'n', + `additional` varchar(255) NOT NULL DEFAULT 'n', + PRIMARY KEY (`ip_address_id`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 ; + +-- +-- Dumping data for table `openvz_ip` +-- + +-- -------------------------------------------------------- + +-- +-- Table structure for table `openvz_ostemplate` +-- + +CREATE TABLE IF NOT EXISTS `openvz_ostemplate` ( + `ostemplate_id` bigint(20) NOT NULL AUTO_INCREMENT, + `sys_userid` int(11) NOT NULL DEFAULT '0', + `sys_groupid` int(11) NOT NULL DEFAULT '0', + `sys_perm_user` varchar(5) DEFAULT NULL, + `sys_perm_group` varchar(5) DEFAULT NULL, + `sys_perm_other` varchar(5) DEFAULT NULL, + `template_name` varchar(255) DEFAULT NULL, + `template_file` varchar(255) NOT NULL DEFAULT '', + `server_id` int(11) NOT NULL DEFAULT '0', + `allservers` varchar(255) NOT NULL DEFAULT 'y', + `active` varchar(255) NOT NULL DEFAULT 'y', + `description` text, + PRIMARY KEY (`ostemplate_id`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 ; + +-- +-- Dumping data for table `openvz_ostemplate` +-- + +INSERT INTO `openvz_ostemplate` (`ostemplate_id`, `sys_userid`, `sys_groupid`, `sys_perm_user`, `sys_perm_group`, `sys_perm_other`, `template_name`, `template_file`, `server_id`, `allservers`, `active`, `description`) VALUES(1, 1, 1, 'riud', 'riud', '', 'Debian minimal', 'debian-minimal-x86', 1, 'y', 'y', 'Debian minimal image.'); + +-- -------------------------------------------------------- + +-- +-- Table structure for table `openvz_template` +-- + +CREATE TABLE IF NOT EXISTS `openvz_template` ( + `template_id` bigint(20) NOT NULL AUTO_INCREMENT, + `sys_userid` int(11) NOT NULL DEFAULT '0', + `sys_groupid` int(11) NOT NULL DEFAULT '0', + `sys_perm_user` varchar(5) DEFAULT NULL, + `sys_perm_group` varchar(5) DEFAULT NULL, + `sys_perm_other` varchar(5) DEFAULT NULL, + `template_name` varchar(255) DEFAULT NULL, + `diskspace` int(11) NOT NULL DEFAULT '0', + `traffic` int(11) NOT NULL DEFAULT '-1', + `bandwidth` int(11) NOT NULL DEFAULT '-1', + `ram` int(11) NOT NULL DEFAULT '0', + `ram_burst` int(11) NOT NULL DEFAULT '0', + `cpu_units` int(11) NOT NULL DEFAULT '1000', + `cpu_num` int(11) NOT NULL DEFAULT '4', + `cpu_limit` int(11) NOT NULL DEFAULT '400', + `io_priority` int(11) NOT NULL DEFAULT '4', + `active` varchar(255) NOT NULL DEFAULT 'y', + `description` text, + `numproc` varchar(255) DEFAULT NULL, + `numtcpsock` varchar(255) DEFAULT NULL, + `numothersock` varchar(255) DEFAULT NULL, + `vmguarpages` varchar(255) DEFAULT NULL, + `kmemsize` varchar(255) DEFAULT NULL, + `tcpsndbuf` varchar(255) DEFAULT NULL, + `tcprcvbuf` varchar(255) DEFAULT NULL, + `othersockbuf` varchar(255) DEFAULT NULL, + `dgramrcvbuf` varchar(255) DEFAULT NULL, + `oomguarpages` varchar(255) DEFAULT NULL, + `privvmpages` varchar(255) DEFAULT NULL, + `lockedpages` varchar(255) DEFAULT NULL, + `shmpages` varchar(255) DEFAULT NULL, + `physpages` varchar(255) DEFAULT NULL, + `numfile` varchar(255) DEFAULT NULL, + `avnumproc` varchar(255) DEFAULT NULL, + `numflock` varchar(255) DEFAULT NULL, + `numpty` varchar(255) DEFAULT NULL, + `numsiginfo` varchar(255) DEFAULT NULL, + `dcachesize` varchar(255) DEFAULT NULL, + `numiptent` varchar(255) DEFAULT NULL, + `swappages` varchar(255) DEFAULT NULL, + `hostname` varchar(255) DEFAULT NULL, + `nameserver` varchar(255) DEFAULT NULL, + `create_dns` varchar(1) NOT NULL DEFAULT 'n', + `capability` varchar(255) DEFAULT NULL, + `features` varchar(255) DEFAULT NULL, + `iptables` varchar(255) DEFAULT NULL, + `custom` text, + PRIMARY KEY (`template_id`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 ; + +-- +-- Dumping data for table `openvz_template` +-- + +INSERT INTO `openvz_template` (`template_id`, `sys_userid`, `sys_groupid`, `sys_perm_user`, `sys_perm_group`, `sys_perm_other`, `template_name`, `diskspace`, `traffic`, `bandwidth`, `ram`, `ram_burst`, `cpu_units`, `cpu_num`, `cpu_limit`, `io_priority`, `active`, `description`, `numproc`, `numtcpsock`, `numothersock`, `vmguarpages`, `kmemsize`, `tcpsndbuf`, `tcprcvbuf`, `othersockbuf`, `dgramrcvbuf`, `oomguarpages`, `privvmpages`, `lockedpages`, `shmpages`, `physpages`, `numfile`, `avnumproc`, `numflock`, `numpty`, `numsiginfo`, `dcachesize`, `numiptent`, `swappages`, `hostname`, `nameserver`, `create_dns`, `capability`, `features`, `iptables`, `custom`) VALUES(1, 1, 1, 'riud', 'riud', '', 'small', 10, -1, -1, 256, 512, 1000, 4, 400, 4, 'y', '', '999999:999999', '7999992:7999992', '7999992:7999992', '65536:unlimited', '2147483646:2147483646', '214748160:396774400', '214748160:396774400', '214748160:396774400', '214748160:396774400', '65536:65536', '131072:139264', '999999:999999', '65536:65536', '0:2147483647', '23999976:23999976', '180:180', '999999:999999', '500000:500000', '999999:999999', '2147483646:2147483646', '999999:999999', '256000:256000', 'v{VEID}.test.tld', '8.8.8.8 8.8.4.4', 'n', '', '', '', ''); + +-- -------------------------------------------------------- + +-- +-- Table structure for table `openvz_traffic` +-- + +CREATE TABLE IF NOT EXISTS `openvz_traffic` ( + `veid` int(11) NOT NULL DEFAULT '0', + `traffic_date` date NULL DEFAULT NULL, + `traffic_bytes` bigint(32) unsigned NOT NULL DEFAULT '0', + UNIQUE KEY (`veid`,`traffic_date`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8; + +-- +-- Dumping data for table `openvz_traffic` +-- + + +-- -------------------------------------------------------- + +-- +-- Table structure for table `openvz_vm` +-- + +CREATE TABLE IF NOT EXISTS `openvz_vm` ( + `vm_id` bigint(20) NOT NULL AUTO_INCREMENT, + `sys_userid` int(11) NOT NULL DEFAULT '0', + `sys_groupid` int(11) NOT NULL DEFAULT '0', + `sys_perm_user` varchar(5) DEFAULT NULL, + `sys_perm_group` varchar(5) DEFAULT NULL, + `sys_perm_other` varchar(5) DEFAULT NULL, + `server_id` int(11) NOT NULL DEFAULT '0', + `veid` int(10) unsigned NOT NULL DEFAULT '0', + `ostemplate_id` int(11) NOT NULL DEFAULT '0', + `template_id` int(11) NOT NULL DEFAULT '0', + `ip_address` varchar(255) NOT NULL DEFAULT '', + `hostname` varchar(255) DEFAULT NULL, + `vm_password` varchar(255) DEFAULT NULL, + `start_boot` varchar(255) NOT NULL DEFAULT 'y', + `bootorder` int(11) NOT NULL DEFAULT '1', + `active` varchar(255) NOT NULL DEFAULT 'y', + `active_until_date` date NULL DEFAULT NULL, + `description` text, + `diskspace` int(11) NOT NULL DEFAULT '0', + `traffic` int(11) NOT NULL DEFAULT '-1', + `bandwidth` int(11) NOT NULL DEFAULT '-1', + `ram` int(11) NOT NULL DEFAULT '0', + `ram_burst` int(11) NOT NULL DEFAULT '0', + `cpu_units` int(11) NOT NULL DEFAULT '1000', + `cpu_num` int(11) NOT NULL DEFAULT '4', + `cpu_limit` int(11) NOT NULL DEFAULT '400', + `io_priority` int(11) NOT NULL DEFAULT '4', + `nameserver` varchar(255) NOT NULL DEFAULT '8.8.8.8 8.8.4.4', + `create_dns` varchar(1) NOT NULL DEFAULT 'n', + `capability` text, + `features` text, + `iptabless` text, + `config` mediumtext, + `custom` text, + PRIMARY KEY (`vm_id`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 ; + +-- +-- Dumping data for table `openvz_vm` +-- + +-- -------------------------------------------------------- + +-- +-- Table structure for table `remote_session` +-- + +CREATE TABLE `remote_session` ( + `remote_session` varchar(64) NOT NULL DEFAULT '', + `remote_userid` int(11) unsigned NOT NULL DEFAULT '0', + `remote_functions` text, + `client_login` tinyint(1) unsigned NOT NULL default '0', + `tstamp` int(10) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`remote_session`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 ; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `remote_user` +-- + +CREATE TABLE `remote_user` ( + `remote_userid` int(11) unsigned NOT NULL auto_increment, + `sys_userid` int(11) unsigned NOT NULL default '0', + `sys_groupid` int(11) unsigned NOT NULL default '0', + `sys_perm_user` varchar(5) default NULL, + `sys_perm_group` varchar(5) default NULL, + `sys_perm_other` varchar(5) default NULL, + `remote_username` varchar(64) NOT NULL DEFAULT '', + `remote_password` varchar(64) NOT NULL DEFAULT '', + `remote_access` enum('y','n') NOT NULL DEFAULT 'y', + `remote_ips` TEXT, + `remote_functions` text, + PRIMARY KEY (`remote_userid`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `server` +-- + +CREATE TABLE `server` ( + `server_id` int(11) unsigned NOT NULL auto_increment, + `sys_userid` int(11) unsigned NOT NULL default '0', + `sys_groupid` int(11) unsigned NOT NULL default '0', + `sys_perm_user` varchar(5) NOT NULL default '', + `sys_perm_group` varchar(5) NOT NULL default '', + `sys_perm_other` varchar(5) NOT NULL default '', + `server_name` varchar(255) NOT NULL default '', + `mail_server` tinyint(1) NOT NULL default '0', + `web_server` tinyint(1) NOT NULL default '0', + `dns_server` tinyint(1) NOT NULL default '0', + `file_server` tinyint(1) NOT NULL default '0', + `db_server` tinyint(1) NOT NULL default '0', + `vserver_server` tinyint(1) NOT NULL default '0', + `proxy_server` tinyint(1) NOT NULL default '0', + `firewall_server` tinyint(1) NOT NULL default '0', + `xmpp_server` tinyint(1) NOT NULL default '0', + `config` text, + `updated` bigint(20) unsigned NOT NULL default '0', + `mirror_server_id` int(11) unsigned NOT NULL default '0', + `dbversion` int(11) unsigned NOT NULL default '1', + `active` tinyint(1) NOT NULL default '1', + PRIMARY KEY (`server_id`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `server_ip` +-- + +CREATE TABLE `server_ip` ( + `server_ip_id` int(11) unsigned NOT NULL auto_increment, + `sys_userid` int(11) unsigned NOT NULL default '0', + `sys_groupid` int(11) unsigned NOT NULL default '0', + `sys_perm_user` varchar(5) default NULL, + `sys_perm_group` varchar(5) default NULL, + `sys_perm_other` varchar(5) default NULL, + `server_id` int(11) unsigned NOT NULL default '0', + `client_id` int(11) unsigned NOT NULL default '0', + `ip_type` enum( 'IPv4', 'IPv6' ) NOT NULL DEFAULT 'IPv4', + `ip_address` varchar(39) default NULL, + `virtualhost` enum('n','y') NOT NULL default 'y', + `virtualhost_port` varchar(255) default '80,443', + PRIMARY KEY (`server_ip_id`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `server_ip_map` +-- + +CREATE TABLE `server_ip_map` ( + `server_ip_map_id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `sys_userid` int(11) unsigned NOT NULL DEFAULT '0', + `sys_groupid` int(11) unsigned NOT NULL DEFAULT '0', + `sys_perm_user` varchar(5) DEFAULT NULL, + `sys_perm_group` varchar(5) DEFAULT NULL, + `sys_perm_other` varchar(5) DEFAULT NULL, + `server_id` int(11) unsigned NOT NULL DEFAULT '0', + `source_ip` varchar(15) DEFAULT NULL, + `destination_ip` varchar(35) DEFAULT '', + `active` enum('n','y') NOT NULL DEFAULT 'y', + PRIMARY KEY (`server_ip_map_id`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `server_php` +-- + +CREATE TABLE `server_php` ( + `server_php_id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `sys_userid` int(11) unsigned NOT NULL DEFAULT '0', + `sys_groupid` int(11) unsigned NOT NULL DEFAULT '0', + `sys_perm_user` varchar(5) DEFAULT NULL, + `sys_perm_group` varchar(5) DEFAULT NULL, + `sys_perm_other` varchar(5) DEFAULT NULL, + `server_id` int(11) unsigned NOT NULL DEFAULT '0', + `client_id` int(11) unsigned NOT NULL DEFAULT '0', + `name` varchar(255) DEFAULT NULL, + `php_fastcgi_binary` varchar(255) DEFAULT NULL, + `php_fastcgi_ini_dir` varchar(255) DEFAULT NULL, + `php_fpm_init_script` varchar(255) DEFAULT NULL, + `php_fpm_ini_dir` varchar(255) DEFAULT NULL, + `php_fpm_pool_dir` varchar(255) DEFAULT NULL, + `active` enum('n','y') NOT NULL DEFAULT 'y', + PRIMARY KEY (`server_php_id`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `shell_user` +-- + +CREATE TABLE `shell_user` ( + `shell_user_id` int(11) unsigned NOT NULL auto_increment, + `sys_userid` int(11) unsigned NOT NULL default '0', + `sys_groupid` int(11) unsigned NOT NULL default '0', + `sys_perm_user` varchar(5) default NULL, + `sys_perm_group` varchar(5) default NULL, + `sys_perm_other` varchar(5) default NULL, + `server_id` int(11) unsigned NOT NULL default '0', + `parent_domain_id` int(11) unsigned NOT NULL default '0', + `username` varchar(64) default NULL, + `username_prefix` varchar(50) NOT NULL default '', + `password` varchar(64) default NULL, + `quota_size` bigint(20) NOT NULL default '-1', + `active` enum('n','y') NOT NULL default 'y', + `puser` varchar(255) default NULL, + `pgroup` varchar(255) default NULL, + `shell` varchar(255) NOT NULL default '/bin/bash', + `dir` varchar(255) default NULL, + `chroot` varchar(255) NOT NULL DEFAULT '', + `ssh_rsa` text, + PRIMARY KEY (`shell_user_id`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `software_package` +-- + +CREATE TABLE `software_package` ( + `package_id` int(11) unsigned NOT NULL auto_increment, + `software_repo_id` int(11) unsigned NOT NULL DEFAULT '0', + `package_name` varchar(64) NOT NULL DEFAULT '', + `package_title` varchar(64) NOT NULL DEFAULT '', + `package_description` text, + `package_version` varchar(8) default NULL, + `package_type` enum('ispconfig','app','web') NOT NULL default 'app', + `package_installable` enum('yes','no','key') NOT NULL default 'yes', + `package_requires_db` enum('no','mysql') NOT NULL default 'no', + `package_remote_functions` text, + `package_key` varchar(255) NOT NULL DEFAULT '', + `package_config` text, + PRIMARY KEY (`package_id`), + UNIQUE KEY `package_name` (`package_name`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `software_repo` +-- + +CREATE TABLE `software_repo` ( + `software_repo_id` int(11) unsigned NOT NULL auto_increment, + `sys_userid` int(11) unsigned NOT NULL default '0', + `sys_groupid` int(11) unsigned NOT NULL default '0', + `sys_perm_user` varchar(5) default NULL, + `sys_perm_group` varchar(5) default NULL, + `sys_perm_other` varchar(5) default NULL, + `repo_name` varchar(64) default NULL, + `repo_url` varchar(255) default NULL, + `repo_username` varchar(64) default NULL, + `repo_password` varchar(64) default NULL, + `active` enum('n','y') NOT NULL default 'y', + PRIMARY KEY (`software_repo_id`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `software_update` +-- + +CREATE TABLE `software_update` ( + `software_update_id` int(11) unsigned NOT NULL auto_increment, + `software_repo_id` int(11) unsigned NOT NULL DEFAULT '0', + `package_name` varchar(64) NOT NULL DEFAULT '', + `update_url` varchar(255) NOT NULL DEFAULT '', + `update_md5` varchar(255) NOT NULL DEFAULT '', + `update_dependencies` varchar(255) NOT NULL DEFAULT '', + `update_title` varchar(64) NOT NULL DEFAULT '', + `v1` tinyint(1) NOT NULL default '0', + `v2` tinyint(1) NOT NULL default '0', + `v3` tinyint(1) NOT NULL default '0', + `v4` tinyint(1) NOT NULL default '0', + `type` enum('full','update') NOT NULL default 'full', + PRIMARY KEY (`software_update_id`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `software_update_inst` +-- + +CREATE TABLE `software_update_inst` ( + `software_update_inst_id` int(11) unsigned NOT NULL auto_increment, + `software_update_id` int(11) unsigned NOT NULL default '0', + `package_name` varchar(64) NOT NULL DEFAULT '', + `server_id` int(11) unsigned NOT NULL DEFAULT '0', + `status` enum('none','installing','installed','deleting','deleted','failed') NOT NULL default 'none', + PRIMARY KEY (`software_update_inst_id`), + UNIQUE KEY `software_update_id` (`software_update_id`,`package_name`,`server_id`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `spamfilter_policy` +-- + +CREATE TABLE `spamfilter_policy` ( + `id` int(11) unsigned NOT NULL auto_increment, + `sys_userid` int(11) unsigned NOT NULL DEFAULT '0', + `sys_groupid` int(11) unsigned NOT NULL DEFAULT '0', + `sys_perm_user` varchar(5) NOT NULL DEFAULT '', + `sys_perm_group` varchar(5) NOT NULL DEFAULT '', + `sys_perm_other` varchar(5) NOT NULL DEFAULT '', + `policy_name` varchar(64) default NULL, + `virus_lover` enum('N','Y') default 'N', + `spam_lover` enum('N','Y') default 'N', + `banned_files_lover` enum('N','Y') default 'N', + `bad_header_lover` enum('N','Y') default 'N', + `bypass_virus_checks` enum('N','Y') default 'N', + `bypass_spam_checks` enum('N','Y') default 'N', + `bypass_banned_checks` enum('N','Y') default 'N', + `bypass_header_checks` enum('N','Y') default 'N', + `spam_modifies_subj` enum('N','Y') default 'N', + `virus_quarantine_to` varchar(255) default NULL, + `spam_quarantine_to` varchar(255) default NULL, + `banned_quarantine_to` varchar(255) default NULL, + `bad_header_quarantine_to` varchar(255) default NULL, + `clean_quarantine_to` varchar(255) default NULL, + `other_quarantine_to` varchar(255) default NULL, + `spam_tag_level` DECIMAL(5,2) default NULL, + `spam_tag2_level` DECIMAL(5,2) default NULL, + `spam_kill_level` DECIMAL(5,2) default NULL, + `spam_dsn_cutoff_level` DECIMAL(5,2) default NULL, + `spam_quarantine_cutoff_level` DECIMAL(5,2) default NULL, + `addr_extension_virus` varchar(64) default NULL, + `addr_extension_spam` varchar(64) default NULL, + `addr_extension_banned` varchar(64) default NULL, + `addr_extension_bad_header` varchar(64) default NULL, + `warnvirusrecip` enum('N','Y') default 'N', + `warnbannedrecip` enum('N','Y') default 'N', + `warnbadhrecip` enum('N','Y') default 'N', + `newvirus_admin` varchar(64) default NULL, + `virus_admin` varchar(64) default NULL, + `banned_admin` varchar(64) default NULL, + `bad_header_admin` varchar(64) default NULL, + `spam_admin` varchar(64) default NULL, + `spam_subject_tag` varchar(64) default NULL, + `spam_subject_tag2` varchar(64) default NULL, + `message_size_limit` int(11) unsigned default NULL, + `banned_rulenames` varchar(64) default NULL, + `policyd_quota_in` int(11) NOT NULL DEFAULT '-1', + `policyd_quota_in_period` int(11) NOT NULL DEFAULT '24', + `policyd_quota_out` int(11) NOT NULL DEFAULT '-1', + `policyd_quota_out_period` int(11) NOT NULL DEFAULT '24', + `policyd_greylist` ENUM( 'Y', 'N' ) NOT NULL DEFAULT 'N', + PRIMARY KEY (`id`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `spamfilter_users` +-- + +CREATE TABLE `spamfilter_users` ( + `id` int(11) unsigned NOT NULL auto_increment, + `sys_userid` int(11) unsigned NOT NULL DEFAULT '0', + `sys_groupid` int(11) unsigned NOT NULL DEFAULT '0', + `sys_perm_user` varchar(5) NOT NULL DEFAULT '', + `sys_perm_group` varchar(5) NOT NULL DEFAULT '', + `sys_perm_other` varchar(5) NOT NULL DEFAULT '', + `server_id` int(11) unsigned NOT NULL DEFAULT '0', + `priority` tinyint(3) unsigned NOT NULL default '7', + `policy_id` int(11) unsigned NOT NULL default '1', + `email` varchar(255) NOT NULL DEFAULT '', + `fullname` varchar(64) default NULL, + `local` varchar(1) default NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `email` (`email`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `spamfilter_wblist` +-- + +CREATE TABLE `spamfilter_wblist` ( + `wblist_id` int(11) unsigned NOT NULL auto_increment, + `sys_userid` int(11) unsigned NOT NULL DEFAULT '0', + `sys_groupid` int(11) unsigned NOT NULL DEFAULT '0', + `sys_perm_user` varchar(5) NOT NULL DEFAULT '', + `sys_perm_group` varchar(5) NOT NULL DEFAULT '', + `sys_perm_other` varchar(5) NOT NULL DEFAULT '', + `server_id` int(11) unsigned NOT NULL DEFAULT '0', + `wb` enum('W','B') NOT NULL default 'W', + `rid` int(11) unsigned NOT NULL DEFAULT '0', + `email` varchar(255) NOT NULL DEFAULT '', + `priority` tinyint(3) unsigned NOT NULL DEFAULT '0', + `active` enum('y','n') NOT NULL default 'y', + PRIMARY KEY (`wblist_id`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `support_message` +-- + +CREATE TABLE `support_message` ( + `support_message_id` int(11) unsigned NOT NULL auto_increment, + `sys_userid` int(11) unsigned NOT NULL default '0', + `sys_groupid` int(11) unsigned NOT NULL default '0', + `sys_perm_user` varchar(5) default NULL, + `sys_perm_group` varchar(5) default NULL, + `sys_perm_other` varchar(5) default NULL, + `recipient_id` int(11) unsigned NOT NULL default '0', + `sender_id` int(11) unsigned NOT NULL default '0', + `subject` varchar(255) default NULL, + `message` text default NULL, + `tstamp` int(11) NOT NULL default '0', + PRIMARY KEY (`support_message_id`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `sys_config` +-- + +CREATE TABLE `sys_config` ( + `group` varchar(64) NOT NULL DEFAULT '', + `name` varchar(64) NOT NULL DEFAULT '', + `value` varchar(255) NOT NULL DEFAULT '', + PRIMARY KEY (`group`, `name`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8; + + +-- -------------------------------------------------------- + +-- +-- Table structure for table `sys_cron` +-- + +CREATE TABLE IF NOT EXISTS `sys_cron` ( + `name` varchar(50) NOT NULL DEFAULT '', + `last_run` datetime NULL DEFAULT NULL, + `next_run` datetime NULL DEFAULT NULL, + `running` tinyint(1) UNSIGNED NOT NULL DEFAULT '0', + PRIMARY KEY (`name`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8; + + +-- -------------------------------------------------------- + +-- +-- Table structure for table `sys_datalog` +-- + +CREATE TABLE `sys_datalog` ( + `datalog_id` int(11) unsigned NOT NULL auto_increment, + `server_id` int(11) unsigned NOT NULL DEFAULT '0', + `dbtable` varchar(255) NOT NULL default '', + `dbidx` varchar(255) NOT NULL default '', + `action` char(1) NOT NULL default '', + `tstamp` int(11) NOT NULL default '0', + `user` varchar(255) NOT NULL default '', + `data` longtext, + `status` set('pending','ok','warning','error') NOT NULL default 'ok', + `error` mediumtext, + `session_id` varchar(64) NOT NULL DEFAULT '', + PRIMARY KEY (`datalog_id`), + KEY `server_id` (`server_id`,`status`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `sys_dbsync` +-- + +CREATE TABLE `sys_dbsync` ( + `id` int(11) unsigned NOT NULL auto_increment, + `jobname` varchar(64) NOT NULL default '', + `sync_interval_minutes` int(11) unsigned NOT NULL default '0', + `db_type` varchar(16) NOT NULL default '', + `db_host` varchar(255) NOT NULL default '', + `db_name` varchar(64) NOT NULL default '', + `db_username` varchar(64) NOT NULL default '', + `db_password` varchar(64) NOT NULL default '', + `db_tables` varchar(255) NOT NULL default 'admin,forms', + `empty_datalog` int(11) unsigned NOT NULL default '0', + `sync_datalog_external` int(11) unsigned NOT NULL default '0', + `active` tinyint(1) NOT NULL default '1', + `last_datalog_id` int(11) unsigned NOT NULL default '0', + PRIMARY KEY (`id`), + KEY `last_datalog_id` (`last_datalog_id`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `sys_filesync` +-- + +CREATE TABLE `sys_filesync` ( + `id` int(11) unsigned NOT NULL auto_increment, + `jobname` varchar(64) NOT NULL default '', + `sync_interval_minutes` int(11) unsigned NOT NULL default '0', + `ftp_host` varchar(255) NOT NULL default '', + `ftp_path` varchar(255) NOT NULL default '', + `ftp_username` varchar(64) NOT NULL default '', + `ftp_password` varchar(64) NOT NULL default '', + `local_path` varchar(255) NOT NULL default '', + `wput_options` varchar(255) NOT NULL default '--timestamping --reupload --dont-continue', + `active` tinyint(1) NOT NULL default '1', + PRIMARY KEY (`id`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `sys_group` +-- + +CREATE TABLE `sys_group` ( + `groupid` int(11) unsigned NOT NULL auto_increment, + `name` varchar(64) NOT NULL default '', + `description` text, + `client_id` int(11) unsigned NOT NULL default '0', + PRIMARY KEY (`groupid`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `sys_ini` +-- + +CREATE TABLE `sys_ini` ( + `sysini_id` int(11) unsigned NOT NULL auto_increment, + `config` longtext, + `default_logo` text NOT NULL, + `custom_logo` text NOT NULL, + PRIMARY KEY (`sysini_id`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `sys_log` +-- + +CREATE TABLE `sys_log` ( + `syslog_id` int(11) unsigned NOT NULL auto_increment, + `server_id` int(11) unsigned NOT NULL default '0', + `datalog_id` int(11) unsigned NOT NULL default '0', + `loglevel` tinyint(4) NOT NULL default '0', + `tstamp` int(11) unsigned NOT NULL DEFAULT '0', + `message` text, + PRIMARY KEY (`syslog_id`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `sys_remoteaction` +-- + +CREATE TABLE `sys_remoteaction` ( + `action_id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `server_id` int(11) unsigned NOT NULL DEFAULT '0', + `tstamp` int(11) NOT NULL DEFAULT '0', + `action_type` varchar(20) NOT NULL DEFAULT '', + `action_param` mediumtext, + `action_state` enum('pending','ok','warning','error') NOT NULL DEFAULT 'pending', + `response` mediumtext, + PRIMARY KEY (`action_id`), + KEY `server_id` (`server_id`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `sys_session` +-- + +CREATE TABLE `sys_session` ( + `session_id` varchar(64) NOT NULL DEFAULT '', + `date_created` datetime NULL DEFAULT NULL, + `last_updated` datetime NULL DEFAULT NULL, + `permanent` enum('n','y') NOT NULL DEFAULT 'n', + `session_data` longtext, + PRIMARY KEY (`session_id`), + KEY `last_updated` (`last_updated`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 ; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `sys_theme` +-- + +CREATE TABLE IF NOT EXISTS `sys_theme` ( + `sys_userid` int(11) unsigned NOT NULL DEFAULT '0', + `sys_groupid` int(11) unsigned NOT NULL DEFAULT '0', + `sys_perm_user` varchar(5) DEFAULT NULL, + `sys_perm_group` varchar(5) DEFAULT NULL, + `sys_perm_other` varchar(5) DEFAULT NULL, + `var_id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `tpl_name` varchar(32) NOT NULL DEFAULT '', + `username` varchar(64) NOT NULL DEFAULT '', + `logo_url` varchar(255) NOT NULL DEFAULT '', + PRIMARY KEY (`var_id`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 ; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `sys_user` +-- + +CREATE TABLE `sys_user` ( + `userid` int(11) unsigned NOT NULL auto_increment, + `sys_userid` int(11) unsigned NOT NULL default '1' COMMENT 'Created by userid', + `sys_groupid` int(11) unsigned NOT NULL default '1' COMMENT 'Created by groupid', + `sys_perm_user` varchar(5) NOT NULL default 'riud', + `sys_perm_group` varchar(5) NOT NULL default 'riud', + `sys_perm_other` varchar(5) NOT NULL default '', + `username` varchar(64) NOT NULL default '', + `passwort` varchar(64) NOT NULL default '', + `modules` varchar(255) NOT NULL default '', + `startmodule` varchar(255) NOT NULL default '', + `app_theme` varchar(32) NOT NULL default 'default', + `typ` varchar(16) NOT NULL default 'user', + `active` tinyint(1) NOT NULL default '1', + `language` varchar(2) NOT NULL default 'en', + `groups` TEXT, + `default_group` int(11) unsigned NOT NULL default '0', + `client_id` int(11) unsigned NOT NULL default '0', + `id_rsa` VARCHAR( 2000 ) NOT NULL default '', + `ssh_rsa` VARCHAR( 600 ) NOT NULL default '', + `lost_password_function` tinyint(1) NOT NULL default '1', + `lost_password_hash` VARCHAR(50) NOT NULL default '', + `lost_password_reqtime` DATETIME NULL default NULL, + PRIMARY KEY (`userid`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `webdav_user` +-- + +CREATE TABLE `webdav_user` ( + `webdav_user_id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `sys_userid` int(11) unsigned NOT NULL DEFAULT '0', + `sys_groupid` int(11) unsigned NOT NULL DEFAULT '0', + `sys_perm_user` varchar(5) DEFAULT NULL, + `sys_perm_group` varchar(5) DEFAULT NULL, + `sys_perm_other` varchar(5) DEFAULT NULL, + `server_id` int(11) unsigned NOT NULL DEFAULT '0', + `parent_domain_id` int(11) unsigned NOT NULL DEFAULT '0', + `username` varchar(64) DEFAULT NULL, + `username_prefix` varchar(50) NOT NULL default '', + `password` varchar(64) DEFAULT NULL, + `active` enum('n','y') NOT NULL DEFAULT 'y', + `dir` varchar(255) DEFAULT NULL, + PRIMARY KEY (`webdav_user_id`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `web_backup` +-- + +CREATE TABLE `web_backup` ( + `backup_id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `server_id` int(10) unsigned NOT NULL DEFAULT '0', + `parent_domain_id` int(10) unsigned NOT NULL DEFAULT '0', + `backup_type` enum('web','mysql','mongodb') NOT NULL DEFAULT 'web', + `backup_mode` varchar(64) NOT NULL DEFAULT '', + `tstamp` int(10) unsigned NOT NULL DEFAULT '0', + `filename` varchar(255) NOT NULL DEFAULT '', + `filesize` VARCHAR(20) NOT NULL DEFAULT '', + PRIMARY KEY (`backup_id`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `web_database` +-- + +CREATE TABLE `web_database` ( + `database_id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `sys_userid` int(11) unsigned NOT NULL DEFAULT '0', + `sys_groupid` int(11) unsigned NOT NULL DEFAULT '0', + `sys_perm_user` varchar(5) DEFAULT NULL, + `sys_perm_group` varchar(5) DEFAULT NULL, + `sys_perm_other` varchar(5) DEFAULT NULL, + `server_id` int(11) unsigned NOT NULL DEFAULT '0', + `parent_domain_id` int(11) unsigned NOT NULL DEFAULT '0', + `type` varchar(16) NOT NULL DEFAULT 'y', + `database_name` varchar(64) DEFAULT NULL, + `database_name_prefix` varchar(50) NOT NULL default '', + `database_quota` int(11) DEFAULT NULL, + `quota_exceeded` enum('n','y') NOT NULL DEFAULT 'n', + `last_quota_notification` date NULL default NULL, + `database_user_id` int(11) unsigned DEFAULT NULL, + `database_ro_user_id` int(11) unsigned DEFAULT NULL, + `database_charset` varchar(64) DEFAULT NULL, + `remote_access` enum('n','y') NOT NULL DEFAULT 'y', + `remote_ips` text, + `backup_interval` VARCHAR( 255 ) NOT NULL DEFAULT 'none', + `backup_copies` INT NOT NULL DEFAULT '1', + `active` enum('n','y') NOT NULL DEFAULT 'y', + PRIMARY KEY (`database_id`), + KEY `database_user_id` (`database_user_id`), + KEY `database_ro_user_id` (`database_ro_user_id`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; + +-- -------------------------------------------------------- + +-- +-- Tabellenstruktur für Tabelle `web_database_user` +-- + +CREATE TABLE IF NOT EXISTS `web_database_user` ( + `database_user_id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `sys_userid` int(11) unsigned NOT NULL DEFAULT '0', + `sys_groupid` int(11) unsigned NOT NULL DEFAULT '0', + `sys_perm_user` varchar(5) DEFAULT NULL, + `sys_perm_group` varchar(5) DEFAULT NULL, + `sys_perm_other` varchar(5) DEFAULT NULL, + `server_id` int(11) UNSIGNED NOT NULL DEFAULT '0', + `database_user` varchar(64) DEFAULT NULL, + `database_user_prefix` varchar(50) NOT NULL default '', + `database_password` varchar(64) DEFAULT NULL, + `database_password_mongo` varchar(32) DEFAULT NULL, + PRIMARY KEY (`database_user_id`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `web_domain` +-- + +CREATE TABLE `web_domain` ( + `domain_id` int(11) unsigned NOT NULL auto_increment, + `sys_userid` int(11) unsigned NOT NULL default '0', + `sys_groupid` int(11) unsigned NOT NULL default '0', + `sys_perm_user` varchar(5) default NULL, + `sys_perm_group` varchar(5) default NULL, + `sys_perm_other` varchar(5) default NULL, + `server_id` int(11) unsigned NOT NULL default '0', + `ip_address` varchar(39) default NULL, + `ipv6_address` VARCHAR( 255 ) default NULL, + `domain` varchar(255) default NULL, + `type` varchar(32) default NULL, + `parent_domain_id` int(11) unsigned NOT NULL default '0', + `vhost_type` varchar(32) default NULL, + `document_root` varchar(255) default NULL, + `web_folder` varchar(100) default NULL, + `system_user` varchar(255) default NULL, + `system_group` varchar(255) default NULL, + `hd_quota` bigint(20) NOT NULL default '0', + `traffic_quota` bigint(20) NOT NULL default '-1', + `cgi` enum('n','y') NOT NULL default 'y', + `ssi` enum('n','y') NOT NULL default 'y', + `suexec` enum('n','y') NOT NULL default 'y', + `errordocs` tinyint(1) NOT NULL default '1', + `is_subdomainwww` tinyint(1) NOT NULL default '1', + `subdomain` enum('none','www','*') NOT NULL default 'none', + `php` varchar(32) NOT NULL default 'y', + `ruby` enum('n','y') NOT NULL default 'n', + `python` enum('n','y') NOT NULL default 'n', + `perl` enum('n','y') NOT NULL default 'n', + `redirect_type` varchar(255) default NULL, + `redirect_path` varchar(255) default NULL, + `seo_redirect` varchar(255) default NULL, + `rewrite_to_https` ENUM('y','n') NOT NULL DEFAULT 'n', + `ssl` enum('n','y') NOT NULL default 'n', + `ssl_letsencrypt` enum('n','y') NOT NULL DEFAULT 'n', + `ssl_letsencrypt_exclude` enum('n','y') NOT NULL DEFAULT 'n', + `ssl_state` varchar(255) NULL, + `ssl_locality` varchar(255) NULL, + `ssl_organisation` varchar(255) NULL, + `ssl_organisation_unit` varchar(255) NULL, + `ssl_country` varchar(255) NULL, + `ssl_domain` varchar(255) NULL, + `ssl_request` mediumtext NULL, + `ssl_cert` mediumtext NULL, + `ssl_bundle` mediumtext NULL, + `ssl_key` mediumtext NULL, + `ssl_action` varchar(16) NULL, + `stats_password` varchar(255) default NULL, + `stats_type` varchar(255) default 'awstats', + `allow_override` varchar(255) NOT NULL default 'All', + `apache_directives` mediumtext, + `nginx_directives` mediumtext, + `php_fpm_use_socket` ENUM('n','y') NOT NULL DEFAULT 'y', + `php_fpm_chroot` enum('n','y') NOT NULL DEFAULT 'n', + `pm` enum('static','dynamic','ondemand') NOT NULL DEFAULT 'dynamic', + `pm_max_children` int(11) NOT NULL DEFAULT '10', + `pm_start_servers` int(11) NOT NULL DEFAULT '2', + `pm_min_spare_servers` int(11) NOT NULL DEFAULT '1', + `pm_max_spare_servers` int(11) NOT NULL DEFAULT '5', + `pm_process_idle_timeout` int(11) NOT NULL DEFAULT '10', + `pm_max_requests` int(11) NOT NULL DEFAULT '0', + `php_open_basedir` mediumtext, + `custom_php_ini` mediumtext, + `backup_interval` VARCHAR( 255 ) NOT NULL DEFAULT 'none', + `backup_copies` INT NOT NULL DEFAULT '1', + `backup_excludes` mediumtext, + `active` enum('n','y') NOT NULL default 'y', + `traffic_quota_lock` enum('n','y') NOT NULL default 'n', + `fastcgi_php_version` varchar(255) DEFAULT NULL, + `proxy_directives` mediumtext, + `enable_spdy` ENUM('y','n') NULL DEFAULT 'n', + `last_quota_notification` date NULL default NULL, + `rewrite_rules` mediumtext, + `added_date` date NULL DEFAULT NULL, + `added_by` varchar(255) DEFAULT NULL, + `directive_snippets_id` int(11) unsigned NOT NULL default '0', + `enable_pagespeed` ENUM('y','n') NOT NULL DEFAULT 'n', + `http_port` int(11) unsigned NOT NULL DEFAULT '80', + `https_port` int(11) unsigned NOT NULL DEFAULT '443', + `folder_directive_snippets` text, + `log_retention` int(11) NOT NULL DEFAULT '10', + PRIMARY KEY (`domain_id`), + UNIQUE KEY `serverdomain` ( `server_id` , `ip_address`, `domain` ) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `web_folder` +-- + +CREATE TABLE IF NOT EXISTS `web_folder` ( + `web_folder_id` bigint(20) NOT NULL AUTO_INCREMENT, + `sys_userid` int(11) NOT NULL DEFAULT '0', + `sys_groupid` int(11) NOT NULL DEFAULT '0', + `sys_perm_user` varchar(5) DEFAULT NULL, + `sys_perm_group` varchar(5) DEFAULT NULL, + `sys_perm_other` varchar(5) DEFAULT NULL, + `server_id` int(11) NOT NULL DEFAULT '0', + `parent_domain_id` int(11) NOT NULL DEFAULT '0', + `path` varchar(255) DEFAULT NULL, + `active` varchar(255) NOT NULL DEFAULT 'y', + PRIMARY KEY (`web_folder_id`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; + +-- +-- Dumping data for table `web_folder` +-- + + +-- -------------------------------------------------------- + +-- +-- Table structure for table `web_folder_user` +-- + +CREATE TABLE IF NOT EXISTS `web_folder_user` ( + `web_folder_user_id` bigint(20) NOT NULL AUTO_INCREMENT, + `sys_userid` int(11) NOT NULL DEFAULT '0', + `sys_groupid` int(11) NOT NULL DEFAULT '0', + `sys_perm_user` varchar(5) DEFAULT NULL, + `sys_perm_group` varchar(5) DEFAULT NULL, + `sys_perm_other` varchar(5) DEFAULT NULL, + `server_id` int(11) NOT NULL DEFAULT '0', + `web_folder_id` int(11) NOT NULL DEFAULT '0', + `username` varchar(255) DEFAULT NULL, + `password` varchar(255) DEFAULT NULL, + `active` varchar(255) NOT NULL DEFAULT 'y', + PRIMARY KEY (`web_folder_user_id`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; + +-- +-- Dumping data for table `web_folder_user` +-- + +-- -------------------------------------------------------- + +-- +-- Table structure for table `web_traffic` +-- + +CREATE TABLE `web_traffic` ( + `hostname` varchar(255) NOT NULL DEFAULT '', + `traffic_date` date NULL DEFAULT NULL, + `traffic_bytes` bigint(32) unsigned NOT NULL default '0', + UNIQUE KEY (`hostname`,`traffic_date`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 ; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `xmpp_domain` +-- + +CREATE TABLE `xmpp_domain` ( + `domain_id` int(11) unsigned NOT NULL auto_increment, + `sys_userid` int(11) unsigned NOT NULL default '0', + `sys_groupid` int(11) unsigned NOT NULL default '0', + `sys_perm_user` varchar(5) NOT NULL default '', + `sys_perm_group` varchar(5) NOT NULL default '', + `sys_perm_other` varchar(5) NOT NULL default '', + `server_id` int(11) unsigned NOT NULL default '0', + `domain` varchar(255) NOT NULL default '', + + `management_method` ENUM( 'normal', 'maildomain' ) NOT NULL default 'normal', + `public_registration` ENUM( 'n', 'y' ) NOT NULL default 'n', + `registration_url` varchar(255) NOT NULL DEFAULT '', + `registration_message` varchar(255) NOT NULL DEFAULT '', + `domain_admins` text, + + `use_pubsub` enum('n','y') NOT NULL DEFAULT 'n', + `use_proxy` enum('n','y') NOT NULL DEFAULT 'n', + `use_anon_host` enum('n','y') NOT NULL DEFAULT 'n', + + `use_vjud` enum('n','y') NOT NULL DEFAULT 'n', + `vjud_opt_mode` enum('in', 'out') NOT NULL DEFAULT 'in', + + `use_muc_host` enum('n','y') NOT NULL DEFAULT 'n', + `muc_name` varchar(30) NOT NULL DEFAULT '', + `muc_restrict_room_creation` enum('n', 'y', 'm') NOT NULL DEFAULT 'm', + `muc_admins` text, + `use_pastebin` enum('n','y') NOT NULL DEFAULT 'n', + `pastebin_expire_after` int(3) NOT NULL DEFAULT 48, + `pastebin_trigger` varchar(10) NOT NULL DEFAULT '!paste', + `use_http_archive` enum('n','y') NOT NULL DEFAULT 'n', + `http_archive_show_join` enum('n', 'y') NOT NULL DEFAULT 'n', + `http_archive_show_status` enum('n', 'y') NOT NULL DEFAULT 'n', + `use_status_host` enum('n','y') NOT NULL DEFAULT 'n', + + `ssl_state` varchar(255) NULL, + `ssl_locality` varchar(255) NULL, + `ssl_organisation` varchar(255) NULL, + `ssl_organisation_unit` varchar(255) NULL, + `ssl_country` varchar(255) NULL, + `ssl_email` varchar(255) NULL, + `ssl_request` mediumtext NULL, + `ssl_cert` mediumtext NULL, + `ssl_bundle` mediumtext NULL, + `ssl_key` mediumtext NULL, + `ssl_action` varchar(16) NULL, + + `active` enum('n','y') NOT NULL DEFAULT 'n', + PRIMARY KEY (`domain_id`), + KEY `server_id` (`server_id`,`domain`), + KEY `domain_active` (`domain`,`active`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `xmpp_user` +-- + +CREATE TABLE `xmpp_user` ( + `xmppuser_id` int(11) unsigned NOT NULL auto_increment, + `sys_userid` int(11) unsigned NOT NULL default '0', + `sys_groupid` int(11) unsigned NOT NULL default '0', + `sys_perm_user` varchar(5) NOT NULL default '', + `sys_perm_group` varchar(5) NOT NULL default '', + `sys_perm_other` varchar(5) NOT NULL default '', + `server_id` int(11) unsigned NOT NULL default '0', + `jid` varchar(255) NOT NULL default '', + `password` varchar(255) NOT NULL default '', + `active` enum('n','y') NOT NULL DEFAULT 'n', + PRIMARY KEY (`xmppuser_id`), + KEY `server_id` (`server_id`,`jid`), + KEY `jid_active` (`jid`,`active`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; + +-- -------------------------------------------------------- + +-- -------------------------------------------------------- +-- -------------------------------------------------------- +-- DB-DATA +-- -------------------------------------------------------- +-- -------------------------------------------------------- + +-- +-- Dumping data for table `aps_settings` +-- + +INSERT INTO `aps_settings` (`id`, `name`, `value`) VALUES(1, 'ignore-php-extension', ''); +INSERT INTO `aps_settings` (`id`, `name`, `value`) VALUES(2, 'ignore-php-configuration', ''); +INSERT INTO `aps_settings` (`id`, `name`, `value`) VALUES(3, 'ignore-webserver-module', ''); + +-- -------------------------------------------------------- + +-- +-- Dumping data for table `country` +-- + +INSERT INTO `country` (`iso`, `name`, `printable_name`, `iso3`, `numcode`, `eu`) VALUES +('AF', 'AFGHANISTAN', 'Afghanistan', 'AFG', 4, 'n'), +('AL', 'ALBANIA', 'Albania', 'ALB', 8, 'n'), +('DZ', 'ALGERIA', 'Algeria', 'DZA', 12, 'n'), +('AS', 'AMERICAN SAMOA', 'American Samoa', 'ASM', 16, 'n'), +('AD', 'ANDORRA', 'Andorra', 'AND', 20, 'n'), +('AO', 'ANGOLA', 'Angola', 'AGO', 24, 'n'), +('AI', 'ANGUILLA', 'Anguilla', 'AIA', 660, 'n'), +('AQ', 'ANTARCTICA', 'Antarctica', NULL, NULL, 'n'), +('AG', 'ANTIGUA AND BARBUDA', 'Antigua and Barbuda', 'ATG', 28, 'n'), +('AR', 'ARGENTINA', 'Argentina', 'ARG', 32, 'n'), +('AM', 'ARMENIA', 'Armenia', 'ARM', 51, 'n'), +('AW', 'ARUBA', 'Aruba', 'ABW', 533, 'n'), +('AU', 'AUSTRALIA', 'Australia', 'AUS', 36, 'n'), +('AT', 'AUSTRIA', 'Austria', 'AUT', 40, 'y'), +('AZ', 'AZERBAIJAN', 'Azerbaijan', 'AZE', 31, 'n'), +('BS', 'BAHAMAS', 'Bahamas', 'BHS', 44, 'n'), +('BH', 'BAHRAIN', 'Bahrain', 'BHR', 48, 'n'), +('BD', 'BANGLADESH', 'Bangladesh', 'BGD', 50, 'n'), +('BB', 'BARBADOS', 'Barbados', 'BRB', 52, 'n'), +('BY', 'BELARUS', 'Belarus', 'BLR', 112, 'n'), +('BE', 'BELGIUM', 'Belgium', 'BEL', 56, 'y'), +('BZ', 'BELIZE', 'Belize', 'BLZ', 84, 'n'), +('BJ', 'BENIN', 'Benin', 'BEN', 204, 'n'), +('BM', 'BERMUDA', 'Bermuda', 'BMU', 60, 'n'), +('BT', 'BHUTAN', 'Bhutan', 'BTN', 64, 'n'), +('BO', 'BOLIVIA', 'Bolivia', 'BOL', 68, 'n'), +('BA', 'BOSNIA AND HERZEGOVINA', 'Bosnia and Herzegovina', 'BIH', 70, 'n'), +('BW', 'BOTSWANA', 'Botswana', 'BWA', 72, 'n'), +('BV', 'BOUVET ISLAND', 'Bouvet Island', NULL, NULL, 'n'), +('BR', 'BRAZIL', 'Brazil', 'BRA', 76, 'n'), +('IO', 'BRITISH INDIAN OCEAN TERRITORY', 'British Indian Ocean Territory', NULL, NULL, 'n'), +('BN', 'BRUNEI DARUSSALAM', 'Brunei Darussalam', 'BRN', 96, 'n'), +('BG', 'BULGARIA', 'Bulgaria', 'BGR', 100, 'y'), +('BF', 'BURKINA FASO', 'Burkina Faso', 'BFA', 854, 'n'), +('BI', 'BURUNDI', 'Burundi', 'BDI', 108, 'n'), +('KH', 'CAMBODIA', 'Cambodia', 'KHM', 116, 'n'), +('CM', 'CAMEROON', 'Cameroon', 'CMR', 120, 'n'), +('CA', 'CANADA', 'Canada', 'CAN', 124, 'n'), +('CV', 'CAPE VERDE', 'Cape Verde', 'CPV', 132, 'n'), +('KY', 'CAYMAN ISLANDS', 'Cayman Islands', 'CYM', 136, 'n'), +('CF', 'CENTRAL AFRICAN REPUBLIC', 'Central African Republic', 'CAF', 140, 'n'), +('TD', 'CHAD', 'Chad', 'TCD', 148, 'n'), +('CL', 'CHILE', 'Chile', 'CHL', 152, 'n'), +('CN', 'CHINA', 'China', 'CHN', 156, 'n'), +('CX', 'CHRISTMAS ISLAND', 'Christmas Island', NULL, NULL, 'n'), +('CC', 'COCOS (KEELING) ISLANDS', 'Cocos (Keeling) Islands', NULL, NULL, 'n'), +('CO', 'COLOMBIA', 'Colombia', 'COL', 170, 'n'), +('KM', 'COMOROS', 'Comoros', 'COM', 174, 'n'), +('CG', 'CONGO', 'Congo', 'COG', 178, 'n'), +('CD', 'CONGO, THE DEMOCRATIC REPUBLIC OF THE', 'Congo, the Democratic Republic of the', 'COD', 180, 'n'), +('CK', 'COOK ISLANDS', 'Cook Islands', 'COK', 184, 'n'), +('CR', 'COSTA RICA', 'Costa Rica', 'CRI', 188, 'n'), +('CI', 'COTE D''IVOIRE', 'Cote D''Ivoire', 'CIV', 384, 'n'), +('HR', 'CROATIA', 'Croatia', 'HRV', 191, 'y'), +('CU', 'CUBA', 'Cuba', 'CUB', 192, 'n'), +('CY', 'CYPRUS', 'Cyprus', 'CYP', 196, 'y'), +('CZ', 'CZECH REPUBLIC', 'Czech Republic', 'CZE', 203, 'y'), +('DK', 'DENMARK', 'Denmark', 'DNK', 208, 'y'), +('DJ', 'DJIBOUTI', 'Djibouti', 'DJI', 262, 'n'), +('DM', 'DOMINICA', 'Dominica', 'DMA', 212, 'n'), +('DO', 'DOMINICAN REPUBLIC', 'Dominican Republic', 'DOM', 214, 'n'), +('EC', 'ECUADOR', 'Ecuador', 'ECU', 218, 'n'), +('EG', 'EGYPT', 'Egypt', 'EGY', 818, 'n'), +('SV', 'EL SALVADOR', 'El Salvador', 'SLV', 222, 'n'), +('GQ', 'EQUATORIAL GUINEA', 'Equatorial Guinea', 'GNQ', 226, 'n'), +('ER', 'ERITREA', 'Eritrea', 'ERI', 232, 'n'), +('EE', 'ESTONIA', 'Estonia', 'EST', 233, 'y'), +('ET', 'ETHIOPIA', 'Ethiopia', 'ETH', 231, 'n'), +('FK', 'FALKLAND ISLANDS (MALVINAS)', 'Falkland Islands (Malvinas)', 'FLK', 238, 'n'), +('FO', 'FAROE ISLANDS', 'Faroe Islands', 'FRO', 234, 'n'), +('FJ', 'FIJI', 'Fiji', 'FJI', 242, 'n'), +('FI', 'FINLAND', 'Finland', 'FIN', 246, 'y'), +('FR', 'FRANCE', 'France', 'FRA', 250, 'y'), +('GF', 'FRENCH GUIANA', 'French Guiana', 'GUF', 254, 'n'), +('PF', 'FRENCH POLYNESIA', 'French Polynesia', 'PYF', 258, 'n'), +('TF', 'FRENCH SOUTHERN TERRITORIES', 'French Southern Territories', NULL, NULL, 'n'), +('GA', 'GABON', 'Gabon', 'GAB', 266, 'n'), +('GM', 'GAMBIA', 'Gambia', 'GMB', 270, 'n'), +('GE', 'GEORGIA', 'Georgia', 'GEO', 268, 'n'), +('DE', 'GERMANY', 'Germany', 'DEU', 276, 'y'), +('GH', 'GHANA', 'Ghana', 'GHA', 288, 'n'), +('GI', 'GIBRALTAR', 'Gibraltar', 'GIB', 292, 'n'), +('GR', 'GREECE', 'Greece', 'GRC', 300, 'y'), +('GL', 'GREENLAND', 'Greenland', 'GRL', 304, 'n'), +('GD', 'GRENADA', 'Grenada', 'GRD', 308, 'n'), +('GP', 'GUADELOUPE', 'Guadeloupe', 'GLP', 312, 'n'), +('GU', 'GUAM', 'Guam', 'GUM', 316, 'n'), +('GT', 'GUATEMALA', 'Guatemala', 'GTM', 320, 'n'), +('GN', 'GUINEA', 'Guinea', 'GIN', 324, 'n'), +('GW', 'GUINEA-BISSAU', 'Guinea-Bissau', 'GNB', 624, 'n'), +('GY', 'GUYANA', 'Guyana', 'GUY', 328, 'n'), +('HT', 'HAITI', 'Haiti', 'HTI', 332, 'n'), +('HM', 'HEARD ISLAND AND MCDONALD ISLANDS', 'Heard Island and Mcdonald Islands', NULL, NULL, 'n'), +('VA', 'HOLY SEE (VATICAN CITY STATE)', 'Holy See (Vatican City State)', 'VAT', 336, 'n'), +('HN', 'HONDURAS', 'Honduras', 'HND', 340, 'n'), +('HK', 'HONG KONG', 'Hong Kong', 'HKG', 344, 'n'), +('HU', 'HUNGARY', 'Hungary', 'HUN', 348, 'y'), +('IS', 'ICELAND', 'Iceland', 'ISL', 352, 'n'), +('IN', 'INDIA', 'India', 'IND', 356, 'n'), +('ID', 'INDONESIA', 'Indonesia', 'IDN', 360, 'n'), +('IR', 'IRAN, ISLAMIC REPUBLIC OF', 'Iran, Islamic Republic of', 'IRN', 364, 'n'), +('IQ', 'IRAQ', 'Iraq', 'IRQ', 368, 'n'), +('IE', 'IRELAND', 'Ireland', 'IRL', 372, 'y'), +('IL', 'ISRAEL', 'Israel', 'ISR', 376, 'n'), +('IT', 'ITALY', 'Italy', 'ITA', 380, 'y'), +('JM', 'JAMAICA', 'Jamaica', 'JAM', 388, 'n'), +('JP', 'JAPAN', 'Japan', 'JPN', 392, 'n'), +('JO', 'JORDAN', 'Jordan', 'JOR', 400, 'n'), +('KZ', 'KAZAKHSTAN', 'Kazakhstan', 'KAZ', 398, 'n'), +('KE', 'KENYA', 'Kenya', 'KEN', 404, 'n'), +('KI', 'KIRIBATI', 'Kiribati', 'KIR', 296, 'n'), +('KP', 'KOREA, DEMOCRATIC PEOPLE''S REPUBLIC OF', 'Korea, Democratic People''s Republic of', 'PRK', 408, 'n'), +('KR', 'KOREA, REPUBLIC OF', 'Korea, Republic of', 'KOR', 410, 'n'), +('KW', 'KUWAIT', 'Kuwait', 'KWT', 414, 'n'), +('KG', 'KYRGYZSTAN', 'Kyrgyzstan', 'KGZ', 417, 'n'), +('LA', 'LAO PEOPLE''S DEMOCRATIC REPUBLIC', 'Lao People''s Democratic Republic', 'LAO', 418, 'n'), +('LV', 'LATVIA', 'Latvia', 'LVA', 428, 'y'), +('LB', 'LEBANON', 'Lebanon', 'LBN', 422, 'n'), +('LS', 'LESOTHO', 'Lesotho', 'LSO', 426, 'n'), +('LR', 'LIBERIA', 'Liberia', 'LBR', 430, 'n'), +('LY', 'LIBYAN ARAB JAMAHIRIYA', 'Libyan Arab Jamahiriya', 'LBY', 434, 'n'), +('LI', 'LIECHTENSTEIN', 'Liechtenstein', 'LIE', 438, 'n'), +('LT', 'LITHUANIA', 'Lithuania', 'LTU', 440, 'y'), +('LU', 'LUXEMBOURG', 'Luxembourg', 'LUX', 442, 'y'), +('MO', 'MACAO', 'Macao', 'MAC', 446, 'n'), +('MK', 'MACEDONIA, THE FORMER YUGOSLAV REPUBLIC OF', 'Macedonia, the Former Yugoslav Republic of', 'MKD', 807, 'n'), +('MG', 'MADAGASCAR', 'Madagascar', 'MDG', 450, 'n'), +('MW', 'MALAWI', 'Malawi', 'MWI', 454, 'n'), +('MY', 'MALAYSIA', 'Malaysia', 'MYS', 458, 'n'), +('MV', 'MALDIVES', 'Maldives', 'MDV', 462, 'n'), +('ML', 'MALI', 'Mali', 'MLI', 466, 'n'), +('MT', 'MALTA', 'Malta', 'MLT', 470, 'y'), +('MH', 'MARSHALL ISLANDS', 'Marshall Islands', 'MHL', 584, 'n'), +('MQ', 'MARTINIQUE', 'Martinique', 'MTQ', 474, 'n'), +('MR', 'MAURITANIA', 'Mauritania', 'MRT', 478, 'n'), +('MU', 'MAURITIUS', 'Mauritius', 'MUS', 480, 'n'), +('YT', 'MAYOTTE', 'Mayotte', NULL, NULL, 'n'), +('MX', 'MEXICO', 'Mexico', 'MEX', 484, 'n'), +('FM', 'MICRONESIA, FEDERATED STATES OF', 'Micronesia, Federated States of', 'FSM', 583, 'n'), +('MD', 'MOLDOVA, REPUBLIC OF', 'Moldova, Republic of', 'MDA', 498, 'n'), +('MC', 'MONACO', 'Monaco', 'MCO', 492, 'n'), +('MN', 'MONGOLIA', 'Mongolia', 'MNG', 496, 'n'), +('MS', 'MONTSERRAT', 'Montserrat', 'MSR', 500, 'n'), +('MA', 'MOROCCO', 'Morocco', 'MAR', 504, 'n'), +('MZ', 'MOZAMBIQUE', 'Mozambique', 'MOZ', 508, 'n'), +('MM', 'MYANMAR', 'Myanmar', 'MMR', 104, 'n'), +('NA', 'NAMIBIA', 'Namibia', 'NAM', 516, 'n'), +('NR', 'NAURU', 'Nauru', 'NRU', 520, 'n'), +('NP', 'NEPAL', 'Nepal', 'NPL', 524, 'n'), +('NL', 'NETHERLANDS', 'Netherlands', 'NLD', 528, 'y'), +('AN', 'NETHERLANDS ANTILLES', 'Netherlands Antilles', 'ANT', 530, 'n'), +('NC', 'NEW CALEDONIA', 'New Caledonia', 'NCL', 540, 'n'), +('NZ', 'NEW ZEALAND', 'New Zealand', 'NZL', 554, 'n'), +('NI', 'NICARAGUA', 'Nicaragua', 'NIC', 558, 'n'), +('NE', 'NIGER', 'Niger', 'NER', 562, 'n'), +('NG', 'NIGERIA', 'Nigeria', 'NGA', 566, 'n'), +('NU', 'NIUE', 'Niue', 'NIU', 570, 'n'), +('NF', 'NORFOLK ISLAND', 'Norfolk Island', 'NFK', 574, 'n'), +('MP', 'NORTHERN MARIANA ISLANDS', 'Northern Mariana Islands', 'MNP', 580, 'n'), +('NO', 'NORWAY', 'Norway', 'NOR', 578, 'n'), +('OM', 'OMAN', 'Oman', 'OMN', 512, 'n'), +('PK', 'PAKISTAN', 'Pakistan', 'PAK', 586, 'n'), +('PW', 'PALAU', 'Palau', 'PLW', 585, 'n'), +('PS', 'PALESTINIAN TERRITORY, OCCUPIED', 'Palestinian Territory, Occupied', NULL, NULL, 'n'), +('PA', 'PANAMA', 'Panama', 'PAN', 591, 'n'), +('PG', 'PAPUA NEW GUINEA', 'Papua New Guinea', 'PNG', 598, 'n'), +('PY', 'PARAGUAY', 'Paraguay', 'PRY', 600, 'n'), +('PE', 'PERU', 'Peru', 'PER', 604, 'n'), +('PH', 'PHILIPPINES', 'Philippines', 'PHL', 608, 'n'), +('PN', 'PITCAIRN', 'Pitcairn', 'PCN', 612, 'n'), +('PL', 'POLAND', 'Poland', 'POL', 616, 'y'), +('PT', 'PORTUGAL', 'Portugal', 'PRT', 620, 'y'), +('PR', 'PUERTO RICO', 'Puerto Rico', 'PRI', 630, 'n'), +('QA', 'QATAR', 'Qatar', 'QAT', 634, 'n'), +('RE', 'REUNION', 'Reunion', 'REU', 638, 'n'), +('RO', 'ROMANIA', 'Romania', 'ROM', 642, 'y'), +('RU', 'RUSSIAN FEDERATION', 'Russian Federation', 'RUS', 643, 'n'), +('RW', 'RWANDA', 'Rwanda', 'RWA', 646, 'n'), +('SH', 'SAINT HELENA', 'Saint Helena', 'SHN', 654, 'n'), +('KN', 'SAINT KITTS AND NEVIS', 'Saint Kitts and Nevis', 'KNA', 659, 'n'), +('LC', 'SAINT LUCIA', 'Saint Lucia', 'LCA', 662, 'n'), +('PM', 'SAINT PIERRE AND MIQUELON', 'Saint Pierre and Miquelon', 'SPM', 666, 'n'), +('VC', 'SAINT VINCENT AND THE GRENADINES', 'Saint Vincent and the Grenadines', 'VCT', 670, 'n'), +('WS', 'SAMOA', 'Samoa', 'WSM', 882, 'n'), +('SM', 'SAN MARINO', 'San Marino', 'SMR', 674, 'n'), +('ST', 'SAO TOME AND PRINCIPE', 'Sao Tome and Principe', 'STP', 678, 'n'), +('SA', 'SAUDI ARABIA', 'Saudi Arabia', 'SAU', 682, 'n'), +('SN', 'SENEGAL', 'Senegal', 'SEN', 686, 'n'), +('RS', 'SERBIA', 'Serbia', 'SRB', 381, 'n'), +('SC', 'SEYCHELLES', 'Seychelles', 'SYC', 690, 'n'), +('SL', 'SIERRA LEONE', 'Sierra Leone', 'SLE', 694, 'n'), +('SG', 'SINGAPORE', 'Singapore', 'SGP', 702, 'n'), +('SK', 'SLOVAKIA', 'Slovakia', 'SVK', 703, 'y'), +('SI', 'SLOVENIA', 'Slovenia', 'SVN', 705, 'y'), +('SB', 'SOLOMON ISLANDS', 'Solomon Islands', 'SLB', 90, 'n'), +('SO', 'SOMALIA', 'Somalia', 'SOM', 706, 'n'), +('ZA', 'SOUTH AFRICA', 'South Africa', 'ZAF', 710, 'n'), +('GS', 'SOUTH GEORGIA AND THE SOUTH SANDWICH ISLANDS', 'South Georgia and the South Sandwich Islands', NULL, NULL, 'n'), +('ES', 'SPAIN', 'Spain', 'ESP', 724, 'y'), +('LK', 'SRI LANKA', 'Sri Lanka', 'LKA', 144, 'n'), +('SD', 'SUDAN', 'Sudan', 'SDN', 736, 'n'), +('SR', 'SURINAME', 'Suriname', 'SUR', 740, 'n'), +('SJ', 'SVALBARD AND JAN MAYEN', 'Svalbard and Jan Mayen', 'SJM', 744, 'n'), +('SZ', 'SWAZILAND', 'Swaziland', 'SWZ', 748, 'n'), +('SE', 'SWEDEN', 'Sweden', 'SWE', 752, 'y'), +('CH', 'SWITZERLAND', 'Switzerland', 'CHE', 756, 'n'), +('SY', 'SYRIAN ARAB REPUBLIC', 'Syrian Arab Republic', 'SYR', 760, 'n'), +('TW', 'TAIWAN, PROVINCE OF CHINA', 'Taiwan, Province of China', 'TWN', 158, 'n'), +('TJ', 'TAJIKISTAN', 'Tajikistan', 'TJK', 762, 'n'), +('TZ', 'TANZANIA, UNITED REPUBLIC OF', 'Tanzania, United Republic of', 'TZA', 834, 'n'), +('TH', 'THAILAND', 'Thailand', 'THA', 764, 'n'), +('TL', 'TIMOR-LESTE', 'Timor-Leste', NULL, NULL, 'n'), +('TG', 'TOGO', 'Togo', 'TGO', 768, 'n'), +('TK', 'TOKELAU', 'Tokelau', 'TKL', 772, 'n'), +('TO', 'TONGA', 'Tonga', 'TON', 776, 'n'), +('TT', 'TRINIDAD AND TOBAGO', 'Trinidad and Tobago', 'TTO', 780, 'n'), +('TN', 'TUNISIA', 'Tunisia', 'TUN', 788, 'n'), +('TR', 'TURKEY', 'Turkey', 'TUR', 792, 'n'), +('TM', 'TURKMENISTAN', 'Turkmenistan', 'TKM', 795, 'n'), +('TC', 'TURKS AND CAICOS ISLANDS', 'Turks and Caicos Islands', 'TCA', 796, 'n'), +('TV', 'TUVALU', 'Tuvalu', 'TUV', 798, 'n'), +('UG', 'UGANDA', 'Uganda', 'UGA', 800, 'n'), +('UA', 'UKRAINE', 'Ukraine', 'UKR', 804, 'n'), +('AE', 'UNITED ARAB EMIRATES', 'United Arab Emirates', 'ARE', 784, 'n'), +('GB', 'UNITED KINGDOM', 'United Kingdom', 'GBR', 826, 'y'), +('US', 'UNITED STATES', 'United States', 'USA', 840, 'n'), +('UM', 'UNITED STATES MINOR OUTLYING ISLANDS', 'United States Minor Outlying Islands', NULL, NULL, 'n'), +('UY', 'URUGUAY', 'Uruguay', 'URY', 858, 'n'), +('UZ', 'UZBEKISTAN', 'Uzbekistan', 'UZB', 860, 'n'), +('VU', 'VANUATU', 'Vanuatu', 'VUT', 548, 'n'), +('VE', 'VENEZUELA', 'Venezuela', 'VEN', 862, 'n'), +('VN', 'VIET NAM', 'Viet Nam', 'VNM', 704, 'n'), +('VG', 'VIRGIN ISLANDS, BRITISH', 'Virgin Islands, British', 'VGB', 92, 'n'), +('VI', 'VIRGIN ISLANDS, U.S.', 'Virgin Islands, U.s.', 'VIR', 850, 'n'), +('WF', 'WALLIS AND FUTUNA', 'Wallis and Futuna', 'WLF', 876, 'n'), +('EH', 'WESTERN SAHARA', 'Western Sahara', 'ESH', 732, 'n'), +('YE', 'YEMEN', 'Yemen', 'YEM', 887, 'n'), +('ZM', 'ZAMBIA', 'Zambia', 'ZMB', 894, 'n'), +('ZW', 'ZIMBABWE', 'Zimbabwe', 'ZWE', 716, 'n'), +('ME', 'MONTENEGRO', 'Montenegro', 'MNE', 382, 'n'); + +-- -------------------------------------------------------- + +-- +-- Dumping data for table `dns_template` +-- + +INSERT INTO `dns_template` (`template_id`, `sys_userid`, `sys_groupid`, `sys_perm_user`, `sys_perm_group`, `sys_perm_other`, `name`, `fields`, `template`, `visible`) VALUES (1, 1, 1, 'riud', 'riud', '', 'Default', 'DOMAIN,IP,NS1,NS2,EMAIL,DKIM,DNSSEC', '[ZONE]\norigin={DOMAIN}.\nns={NS1}.\nmbox={EMAIL}.\nrefresh=7200\nretry=540\nexpire=604800\nminimum=3600\nttl=3600\n\n[DNS_RECORDS]\nA|{DOMAIN}.|{IP}|0|3600\nA|www|{IP}|0|3600\nA|mail|{IP}|0|3600\nNS|{DOMAIN}.|{NS1}.|0|3600\nNS|{DOMAIN}.|{NS2}.|0|3600\nMX|{DOMAIN}.|mail.{DOMAIN}.|10|3600\nTXT|{DOMAIN}.|v=spf1 mx a ~all|0|3600', 'y'); + + +-- -------------------------------------------------------- + +-- +-- Dumping data for table `help_faq` +-- + +INSERT INTO `help_faq` VALUES (1,1,0,'I would like to know ...','Yes, of course.',1,1,'riud','riud','r'); + +-- -------------------------------------------------------- + +-- +-- Dumping data for table `help_faq_sections` +-- + +INSERT INTO `help_faq_sections` VALUES (1,'General',0,NULL,NULL,NULL,NULL,NULL); + +-- -------------------------------------------------------- + +-- +-- Dumping data for table `software_repo` +-- + +INSERT INTO `software_repo` (`software_repo_id`, `sys_userid`, `sys_groupid`, `sys_perm_user`, `sys_perm_group`, `sys_perm_other`, `repo_name`, `repo_url`, `repo_username`, `repo_password`, `active`) VALUES (1, 1, 1, 'riud', 'riud', '', 'ISPConfig Addons', 'http://repo.ispconfig.org/addons/', '', '', 'n'); + +-- -------------------------------------------------------- + +-- +-- Dumping data for table `spamfilter_policy` +-- + +INSERT INTO `spamfilter_policy` (`id`, `sys_userid`, `sys_groupid`, `sys_perm_user`, `sys_perm_group`, `sys_perm_other`, `policy_name`, `virus_lover`, `spam_lover`, `banned_files_lover`, `bad_header_lover`, `bypass_virus_checks`, `bypass_spam_checks`, `bypass_banned_checks`, `bypass_header_checks`, `spam_modifies_subj`, `virus_quarantine_to`, `spam_quarantine_to`, `banned_quarantine_to`, `bad_header_quarantine_to`, `clean_quarantine_to`, `other_quarantine_to`, `spam_tag_level`, `spam_tag2_level`, `spam_kill_level`, `spam_dsn_cutoff_level`, `spam_quarantine_cutoff_level`, `addr_extension_virus`, `addr_extension_spam`, `addr_extension_banned`, `addr_extension_bad_header`, `warnvirusrecip`, `warnbannedrecip`, `warnbadhrecip`, `newvirus_admin`, `virus_admin`, `banned_admin`, `bad_header_admin`, `spam_admin`, `spam_subject_tag`, `spam_subject_tag2`, `message_size_limit`, `banned_rulenames`) VALUES(1, 1, 0, 'riud', 'riud', 'r', 'Non-paying', 'N', 'N', 'N', 'N', 'Y', 'Y', 'Y', 'N', 'Y', '', '', '', '', '', '', 3, 7, 10, 0, 0, '', '', '', '', 'N', 'N', 'N', '', '', '', '', '', '', '', 0, ''); +INSERT INTO `spamfilter_policy` (`id`, `sys_userid`, `sys_groupid`, `sys_perm_user`, `sys_perm_group`, `sys_perm_other`, `policy_name`, `virus_lover`, `spam_lover`, `banned_files_lover`, `bad_header_lover`, `bypass_virus_checks`, `bypass_spam_checks`, `bypass_banned_checks`, `bypass_header_checks`, `spam_modifies_subj`, `virus_quarantine_to`, `spam_quarantine_to`, `banned_quarantine_to`, `bad_header_quarantine_to`, `clean_quarantine_to`, `other_quarantine_to`, `spam_tag_level`, `spam_tag2_level`, `spam_kill_level`, `spam_dsn_cutoff_level`, `spam_quarantine_cutoff_level`, `addr_extension_virus`, `addr_extension_spam`, `addr_extension_banned`, `addr_extension_bad_header`, `warnvirusrecip`, `warnbannedrecip`, `warnbadhrecip`, `newvirus_admin`, `virus_admin`, `banned_admin`, `bad_header_admin`, `spam_admin`, `spam_subject_tag`, `spam_subject_tag2`, `message_size_limit`, `banned_rulenames`) VALUES(2, 1, 0, 'riud', 'riud', 'r', 'Uncensored', 'Y', 'Y', 'Y', 'Y', 'N', 'N', 'N', 'N', 'N', NULL, NULL, NULL, NULL, NULL, NULL, 3, 999, 999, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); +INSERT INTO `spamfilter_policy` (`id`, `sys_userid`, `sys_groupid`, `sys_perm_user`, `sys_perm_group`, `sys_perm_other`, `policy_name`, `virus_lover`, `spam_lover`, `banned_files_lover`, `bad_header_lover`, `bypass_virus_checks`, `bypass_spam_checks`, `bypass_banned_checks`, `bypass_header_checks`, `spam_modifies_subj`, `virus_quarantine_to`, `spam_quarantine_to`, `banned_quarantine_to`, `bad_header_quarantine_to`, `clean_quarantine_to`, `other_quarantine_to`, `spam_tag_level`, `spam_tag2_level`, `spam_kill_level`, `spam_dsn_cutoff_level`, `spam_quarantine_cutoff_level`, `addr_extension_virus`, `addr_extension_spam`, `addr_extension_banned`, `addr_extension_bad_header`, `warnvirusrecip`, `warnbannedrecip`, `warnbadhrecip`, `newvirus_admin`, `virus_admin`, `banned_admin`, `bad_header_admin`, `spam_admin`, `spam_subject_tag`, `spam_subject_tag2`, `message_size_limit`, `banned_rulenames`) VALUES(3, 1, 0, 'riud', 'riud', 'r', 'Wants all spam', 'N', 'Y', 'N', 'N', 'N', 'N', 'N', 'N', 'Y', NULL, NULL, NULL, NULL, NULL, NULL, 3, 999, 999, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); +INSERT INTO `spamfilter_policy` (`id`, `sys_userid`, `sys_groupid`, `sys_perm_user`, `sys_perm_group`, `sys_perm_other`, `policy_name`, `virus_lover`, `spam_lover`, `banned_files_lover`, `bad_header_lover`, `bypass_virus_checks`, `bypass_spam_checks`, `bypass_banned_checks`, `bypass_header_checks`, `spam_modifies_subj`, `virus_quarantine_to`, `spam_quarantine_to`, `banned_quarantine_to`, `bad_header_quarantine_to`, `clean_quarantine_to`, `other_quarantine_to`, `spam_tag_level`, `spam_tag2_level`, `spam_kill_level`, `spam_dsn_cutoff_level`, `spam_quarantine_cutoff_level`, `addr_extension_virus`, `addr_extension_spam`, `addr_extension_banned`, `addr_extension_bad_header`, `warnvirusrecip`, `warnbannedrecip`, `warnbadhrecip`, `newvirus_admin`, `virus_admin`, `banned_admin`, `bad_header_admin`, `spam_admin`, `spam_subject_tag`, `spam_subject_tag2`, `message_size_limit`, `banned_rulenames`) VALUES(4, 1, 0, 'riud', 'riud', 'r', 'Wants viruses', 'Y', 'N', 'Y', 'Y', 'N', 'N', 'N', 'N', 'Y', NULL, NULL, NULL, NULL, NULL, NULL, 3, 6.9, 6.9, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); +INSERT INTO `spamfilter_policy` (`id`, `sys_userid`, `sys_groupid`, `sys_perm_user`, `sys_perm_group`, `sys_perm_other`, `policy_name`, `virus_lover`, `spam_lover`, `banned_files_lover`, `bad_header_lover`, `bypass_virus_checks`, `bypass_spam_checks`, `bypass_banned_checks`, `bypass_header_checks`, `spam_modifies_subj`, `virus_quarantine_to`, `spam_quarantine_to`, `banned_quarantine_to`, `bad_header_quarantine_to`, `clean_quarantine_to`, `other_quarantine_to`, `spam_tag_level`, `spam_tag2_level`, `spam_kill_level`, `spam_dsn_cutoff_level`, `spam_quarantine_cutoff_level`, `addr_extension_virus`, `addr_extension_spam`, `addr_extension_banned`, `addr_extension_bad_header`, `warnvirusrecip`, `warnbannedrecip`, `warnbadhrecip`, `newvirus_admin`, `virus_admin`, `banned_admin`, `bad_header_admin`, `spam_admin`, `spam_subject_tag`, `spam_subject_tag2`, `message_size_limit`, `banned_rulenames`) VALUES(5, 1, 0, 'riud', 'riud', 'r', 'Normal', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'Y', '', '', '', '', '', '', 1, 4.5, 50, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '', '***SPAM*** ', NULL, NULL); +INSERT INTO `spamfilter_policy` (`id`, `sys_userid`, `sys_groupid`, `sys_perm_user`, `sys_perm_group`, `sys_perm_other`, `policy_name`, `virus_lover`, `spam_lover`, `banned_files_lover`, `bad_header_lover`, `bypass_virus_checks`, `bypass_spam_checks`, `bypass_banned_checks`, `bypass_header_checks`, `spam_modifies_subj`, `virus_quarantine_to`, `spam_quarantine_to`, `banned_quarantine_to`, `bad_header_quarantine_to`, `clean_quarantine_to`, `other_quarantine_to`, `spam_tag_level`, `spam_tag2_level`, `spam_kill_level`, `spam_dsn_cutoff_level`, `spam_quarantine_cutoff_level`, `addr_extension_virus`, `addr_extension_spam`, `addr_extension_banned`, `addr_extension_bad_header`, `warnvirusrecip`, `warnbannedrecip`, `warnbadhrecip`, `newvirus_admin`, `virus_admin`, `banned_admin`, `bad_header_admin`, `spam_admin`, `spam_subject_tag`, `spam_subject_tag2`, `message_size_limit`, `banned_rulenames`) VALUES(6, 1, 0, 'riud', 'riud', 'r', 'Trigger happy', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'Y', NULL, NULL, NULL, NULL, NULL, NULL, 3, 5, 5, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); +INSERT INTO `spamfilter_policy` (`id`, `sys_userid`, `sys_groupid`, `sys_perm_user`, `sys_perm_group`, `sys_perm_other`, `policy_name`, `virus_lover`, `spam_lover`, `banned_files_lover`, `bad_header_lover`, `bypass_virus_checks`, `bypass_spam_checks`, `bypass_banned_checks`, `bypass_header_checks`, `spam_modifies_subj`, `virus_quarantine_to`, `spam_quarantine_to`, `banned_quarantine_to`, `bad_header_quarantine_to`, `clean_quarantine_to`, `other_quarantine_to`, `spam_tag_level`, `spam_tag2_level`, `spam_kill_level`, `spam_dsn_cutoff_level`, `spam_quarantine_cutoff_level`, `addr_extension_virus`, `addr_extension_spam`, `addr_extension_banned`, `addr_extension_bad_header`, `warnvirusrecip`, `warnbannedrecip`, `warnbadhrecip`, `newvirus_admin`, `virus_admin`, `banned_admin`, `bad_header_admin`, `spam_admin`, `spam_subject_tag`, `spam_subject_tag2`, `message_size_limit`, `banned_rulenames`) VALUES(7, 1, 0, 'riud', 'riud', 'r', 'Permissive', 'N', 'N', 'N', 'Y', 'N', 'N', 'N', 'N', 'Y', NULL, NULL, NULL, NULL, NULL, NULL, 3, 10, 20, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + +-- -------------------------------------------------------- + +-- +-- Dumping data for table `sys_group` +-- + +INSERT INTO `sys_group` (`groupid`, `name`, `description`, `client_id`) VALUES (1, 'admin', 'Administrators group', 0); + +-- -------------------------------------------------------- + +-- +-- Dumping data for table `sys_ini` +-- + +INSERT INTO `sys_ini` (`sysini_id`, `config`, `default_logo`, `custom_logo`) VALUES (1, '', 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMgAAABBCAYAAACU5+uOAAAItUlEQVR42u1dCWwVVRStUJZCK6HsFNAgWpaCJkKICZKApKUFhURQpEnZF4EEUJZYEEpBIamgkQpUQBZRW7YCBqQsggsQEAgKLbIGCYsSCNqyQ8D76h18Hd/MvJk/n/bXc5KT+TNz79vPzNv+/2FhAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAe++s0akTsRZxMnE6cGkKcxkwhPofaBPwWRzxxB/EO8UGI8xhxEGoV8EscY8qBKFRcgdoFAhXHC+VUHAbHo5aBQASyrZwL5DoxEjUNeBXI9XIuEMEE1DTgVSA3FA3qIDEtBLnTQiBDUNOAV4EUKhpURojmZQQEAjwKgSwK0bykWQgEU74ABAKBABAIBOIJffoNrkRsS0whDiMO5uNw4gBiSxvfGOJrbDtMOgr2JNa18HmZmETsopnGp4h9xdF0TcQRb8NEPkawTzv2qaWIoybnZYRUBoJD+difGAuBlCy0qsRM4mfERcTFfGygsBUF/xFxE/EQ8RixwIbi/j7il8R3iE8qwuxAXMJxuuFiTvNMYleb/E0gXiI+cOBaISTJrzLxcw2/+8Q5pjjfNNkM0RDILLadpbimw+bsc4DPkxRpuqkZ1orisoBAiguuhkUhPSvZRBA3u6gsK94g9jDFP9aHcAV3EKNNYX8i3RcNJ4M4nTiROJCYykIzbGZKvouk68vYbyS/cUbz+RrJZpzkO5Sv3eajaJhRDvUwg21nKK4VcF5WKPgFH6PZZw/7dJXC6S6lczunfbIQLpeDkZ+lJcoCAikuvChioaLBtfD4JHPiXSFKKexBPoa9Wwr3ael6skMZDGO7K3z+uOSb5OA7mu2KiOGmPH3ADVh8/sohnDS2S1NcG+uiO/kd+8RL146YRWzj359tb0Eg+gIpsHkjFNrQqiF3DZJABDtyuCP5/FuNRlHN8Ofz9nx+XLNR3jR1c4w8TSFGSmnr4FEgU7wKhI51jAeTpv+/ZQGBOAuEu1d/Ku6LV35t9rdigkUjHuMgkHPEecQsxdjjUx4zHbMI+10OdzqfZ2o0iiqSfzgPfMXnzZqN6iTbJ5jytMTU0E97FEhaAAJ5kc/PuJjQOCoIgegJpKbUl5b5vGaBT+A+vOgn5/JYIdFBIOs1wo1kIZl93+P70/h8oUZYFXkmKInPU9h3m2YeT8lvRilPyyWbi3xt4iMWSDc+P4lp3uAIRDxdryjui6dmuujXcr91IDcMmaJv31WISfTrLeJXCUT3yb1a4Ztmalyu61MaZG/XtD9tapRGnpZKNp2lNNZ3KZARAQgk3untBYEEPgbJ92FsIAax34v1AQ2B5Go2BlW60n0QyCC/BWISdJ5LgewWU8k86DdTzMyNh0BKVyAzfB5I93YQyBGeTlW9lQbwIle2Rdgzy7BAxJT6Hb6X6EIgTrznRSCiHli02cwcPor1pbkQiL5AKvOA+ZZPAtkfxFms3j4IZHAwBGJaRPxdjH00BSImJRqKOlEwjtjUo0Dm2pWla4HMzsyqQIxSMKI8C8RkL9YXuhDf5gqcw4NweaZJiGkh8UeLwi+Utkb4KZCrYszkVSDiQRDMN4hkf5DvZ2gKZJyLPJgFkmAjEDEF3EYSWzPeklO8Q8CLQGKJhQquK+eDdLFNZBJxFLEf8XUXFTbcYv2kRhAEIq+vGNO88zTTKVaRzxPrSSvPW11O8yZqCiROSnMsX0sP0ixWops1Hfbx/AaJIz5QcFc5n+ZVNcbxmoWtEsBNB4EU8Tgk32Gv1wneEybeWG1N8RoNbplmOo2neiyxE3/eoun7G9t31hGIqXuzl8/HB0kgxhvhD03/KoEIpIWFQPLK+UJhkWpgKLZP8IKhajNhJg8A7yt8/5K6QoFM8z5mc68Ph3VWM6wTbN+a+AR/vqThV13KYyMXAgmXps9FnK8GSSA17KaXFf7R3gUyd8H/TiBss9fngfQehzfMpkDLgxcS73J4k1y85WrxtTtOjZPuVZA2O55RhLfUId5XpI2UHwZDIHxtp7HtRrVL25SfhWy7z7VAMuYvipszd0FJcfxzHspdrMctGnGcZNPTZ4F0VszqyPSlPHm8JG9f2SDtgF3Nq/rnJZssyXeUdP0CN64c9l/FDfGyZNNNkaeVGmnMM+Vdtd19los8/2e7Ow/E70lxiG7pRmkn8AaeULlcoo4sBDLfKvL0nLUxablfX0hfmfuQ01avI65fUQYEkupRIJHcAMwbDWNNdmLgupV4zeMO3stcIZ1M4aYo4vZt0oO7Locd0ndGTEQofN+QxiZ22+y7W+RpgUb66vOU7232SZXupZqvaYT3Dfu8ZLrejtc47mvkJ9FoVEWKBmW7dyc7ZXD1Nb2TH3JVn5Tqa3r1repzY6/gwWeqhUCGO/XjWSTmjYYVLOzFoP0Z/qJTks033brxrtjmxCbGtK4ivEqKuH2fNuc0tDatIYgna4yGbz2eeTL8WhJbic2aDnmqqpm2KlLeK5vWn0pc0wirGvtUtBkzNdPKDzWe24oGdZX4CzGfWCD4U93GBQdqNSw4Uiny8K9h4buOhlU2scq+Q1G1i233k63hFwBPEfcS04l1FGJoynbH+fgz8ZKFQJLDAMDjk/psCPzw20XxE6mmdLd24d8KNQ14FciUEPl1xHvEhlK6W2j65aOWgUAEUpV4NEREstyDQNqjloFARVKL/xukrAvkGjGC09zGwfYKsQdqF/BTKMnEJcTtxC3EPAU3iic5cRkfjc/ZFvZuuZm4gXjOouG35LQ2Yfutkq/4pfpN/E9TDVCjQGkJqQExho+CjYlRPseRiQE3EIriaMZTw4K3mOJv23J8jme23RsEAMqqQJrb9PnnEbPEVpUAuJD4Mf/PoCqeONQCUJYFElGKf7ojpnqjUQtAWRdJaf1t2w8ofSAUBNKulATSEaUPhIpIRj9icbyFUgdCTSRTeR0i2HwfpQ0AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQBnG392D9QU+JXhxAAAAAElFTkSuQmCC', ''); + +-- -------------------------------------------------------- + +-- +-- Dumping data for table `sys_user` +-- + +INSERT INTO `sys_theme` (`var_id`, `tpl_name`, `username`, `logo_url`) VALUES (NULL, 'default', 'global', 'themes/default/images/header_logo.png'); +INSERT INTO `sys_theme` (`var_id`, `tpl_name`, `username`, `logo_url`) VALUES (NULL, 'default-v2', 'global', 'themes/default-v2/images/header_logo.png'); + +-- -------------------------------------------------------- + +-- +-- Dumping data for table `sys_user` +-- + +INSERT INTO `sys_user` (`userid`, `sys_userid`, `sys_groupid`, `sys_perm_user`, `sys_perm_group`, `sys_perm_other`, `username`, `passwort`, `modules`, `startmodule`, `app_theme`, `typ`, `active`, `language`, `groups`, `default_group`, `client_id`) VALUES (1, 1, 0, 'riud', 'riud', '', 'admin', '21232f297a57a5a743894a0e4a801fc3', 'dashboard,admin,client,mail,monitor,sites,dns,vm,tools,help', 'dashboard', 'default', 'admin', 1, 'en', '1,2', 1, 0); + +-- -------------------------------------------------------- + +-- +-- Dumping data for table `sys_config` +-- + +INSERT INTO sys_config VALUES ('db','db_version','3.1dev'); +INSERT INTO sys_config VALUES ('interface','session_timeout','0'); + +SET FOREIGN_KEY_CHECKS = 1; diff --git a/install/sql/ispconfig3.sql.rej b/install/sql/ispconfig3.sql.rej new file mode 100644 index 0000000000000000000000000000000000000000..6c8d2e4a9c9d6db64b46a8a35091a5af6d064ca5 --- /dev/null +++ b/install/sql/ispconfig3.sql.rej @@ -0,0 +1,23 @@ +--- install/sql/ispconfig3.sql ++++ install/sql/ispconfig3.sql +@@ -2522,13 +2527,13 @@ INSERT INTO `software_repo` (`software_repo_id`, `sys_userid`, `sys_groupid`, `s + -- Dumping data for table `spamfilter_policy` + -- + +-INSERT INTO `spamfilter_policy` (`id`, `sys_userid`, `sys_groupid`, `sys_perm_user`, `sys_perm_group`, `sys_perm_other`, `policy_name`, `virus_lover`, `spam_lover`, `banned_files_lover`, `bad_header_lover`, `bypass_virus_checks`, `bypass_spam_checks`, `bypass_banned_checks`, `bypass_header_checks`, `spam_modifies_subj`, `virus_quarantine_to`, `spam_quarantine_to`, `banned_quarantine_to`, `bad_header_quarantine_to`, `clean_quarantine_to`, `other_quarantine_to`, `spam_tag_level`, `spam_tag2_level`, `spam_kill_level`, `spam_dsn_cutoff_level`, `spam_quarantine_cutoff_level`, `addr_extension_virus`, `addr_extension_spam`, `addr_extension_banned`, `addr_extension_bad_header`, `warnvirusrecip`, `warnbannedrecip`, `warnbadhrecip`, `newvirus_admin`, `virus_admin`, `banned_admin`, `bad_header_admin`, `spam_admin`, `spam_subject_tag`, `spam_subject_tag2`, `message_size_limit`, `banned_rulenames`) VALUES(1, 1, 0, 'riud', 'riud', 'r', 'Non-paying', 'N', 'N', 'N', 'N', 'Y', 'Y', 'Y', 'N', 'Y', '', '', '', '', '', '', 3, 7, 10, 0, 0, '', '', '', '', 'N', 'N', 'N', '', '', '', '', '', '', '', 0, ''); +-INSERT INTO `spamfilter_policy` (`id`, `sys_userid`, `sys_groupid`, `sys_perm_user`, `sys_perm_group`, `sys_perm_other`, `policy_name`, `virus_lover`, `spam_lover`, `banned_files_lover`, `bad_header_lover`, `bypass_virus_checks`, `bypass_spam_checks`, `bypass_banned_checks`, `bypass_header_checks`, `spam_modifies_subj`, `virus_quarantine_to`, `spam_quarantine_to`, `banned_quarantine_to`, `bad_header_quarantine_to`, `clean_quarantine_to`, `other_quarantine_to`, `spam_tag_level`, `spam_tag2_level`, `spam_kill_level`, `spam_dsn_cutoff_level`, `spam_quarantine_cutoff_level`, `addr_extension_virus`, `addr_extension_spam`, `addr_extension_banned`, `addr_extension_bad_header`, `warnvirusrecip`, `warnbannedrecip`, `warnbadhrecip`, `newvirus_admin`, `virus_admin`, `banned_admin`, `bad_header_admin`, `spam_admin`, `spam_subject_tag`, `spam_subject_tag2`, `message_size_limit`, `banned_rulenames`) VALUES(2, 1, 0, 'riud', 'riud', 'r', 'Uncensored', 'Y', 'Y', 'Y', 'Y', 'N', 'N', 'N', 'N', 'N', NULL, NULL, NULL, NULL, NULL, NULL, 3, 999, 999, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); +-INSERT INTO `spamfilter_policy` (`id`, `sys_userid`, `sys_groupid`, `sys_perm_user`, `sys_perm_group`, `sys_perm_other`, `policy_name`, `virus_lover`, `spam_lover`, `banned_files_lover`, `bad_header_lover`, `bypass_virus_checks`, `bypass_spam_checks`, `bypass_banned_checks`, `bypass_header_checks`, `spam_modifies_subj`, `virus_quarantine_to`, `spam_quarantine_to`, `banned_quarantine_to`, `bad_header_quarantine_to`, `clean_quarantine_to`, `other_quarantine_to`, `spam_tag_level`, `spam_tag2_level`, `spam_kill_level`, `spam_dsn_cutoff_level`, `spam_quarantine_cutoff_level`, `addr_extension_virus`, `addr_extension_spam`, `addr_extension_banned`, `addr_extension_bad_header`, `warnvirusrecip`, `warnbannedrecip`, `warnbadhrecip`, `newvirus_admin`, `virus_admin`, `banned_admin`, `bad_header_admin`, `spam_admin`, `spam_subject_tag`, `spam_subject_tag2`, `message_size_limit`, `banned_rulenames`) VALUES(3, 1, 0, 'riud', 'riud', 'r', 'Wants all spam', 'N', 'Y', 'N', 'N', 'N', 'N', 'N', 'N', 'Y', NULL, NULL, NULL, NULL, NULL, NULL, 3, 999, 999, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); +-INSERT INTO `spamfilter_policy` (`id`, `sys_userid`, `sys_groupid`, `sys_perm_user`, `sys_perm_group`, `sys_perm_other`, `policy_name`, `virus_lover`, `spam_lover`, `banned_files_lover`, `bad_header_lover`, `bypass_virus_checks`, `bypass_spam_checks`, `bypass_banned_checks`, `bypass_header_checks`, `spam_modifies_subj`, `virus_quarantine_to`, `spam_quarantine_to`, `banned_quarantine_to`, `bad_header_quarantine_to`, `clean_quarantine_to`, `other_quarantine_to`, `spam_tag_level`, `spam_tag2_level`, `spam_kill_level`, `spam_dsn_cutoff_level`, `spam_quarantine_cutoff_level`, `addr_extension_virus`, `addr_extension_spam`, `addr_extension_banned`, `addr_extension_bad_header`, `warnvirusrecip`, `warnbannedrecip`, `warnbadhrecip`, `newvirus_admin`, `virus_admin`, `banned_admin`, `bad_header_admin`, `spam_admin`, `spam_subject_tag`, `spam_subject_tag2`, `message_size_limit`, `banned_rulenames`) VALUES(4, 1, 0, 'riud', 'riud', 'r', 'Wants viruses', 'Y', 'N', 'Y', 'Y', 'N', 'N', 'N', 'N', 'Y', NULL, NULL, NULL, NULL, NULL, NULL, 3, 6.9, 6.9, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); +-INSERT INTO `spamfilter_policy` (`id`, `sys_userid`, `sys_groupid`, `sys_perm_user`, `sys_perm_group`, `sys_perm_other`, `policy_name`, `virus_lover`, `spam_lover`, `banned_files_lover`, `bad_header_lover`, `bypass_virus_checks`, `bypass_spam_checks`, `bypass_banned_checks`, `bypass_header_checks`, `spam_modifies_subj`, `virus_quarantine_to`, `spam_quarantine_to`, `banned_quarantine_to`, `bad_header_quarantine_to`, `clean_quarantine_to`, `other_quarantine_to`, `spam_tag_level`, `spam_tag2_level`, `spam_kill_level`, `spam_dsn_cutoff_level`, `spam_quarantine_cutoff_level`, `addr_extension_virus`, `addr_extension_spam`, `addr_extension_banned`, `addr_extension_bad_header`, `warnvirusrecip`, `warnbannedrecip`, `warnbadhrecip`, `newvirus_admin`, `virus_admin`, `banned_admin`, `bad_header_admin`, `spam_admin`, `spam_subject_tag`, `spam_subject_tag2`, `message_size_limit`, `banned_rulenames`) VALUES(5, 1, 0, 'riud', 'riud', 'r', 'Normal', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'Y', '', '', '', '', '', '', 1, 4.5, 50, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '', '***SPAM***', NULL, NULL); +-INSERT INTO `spamfilter_policy` (`id`, `sys_userid`, `sys_groupid`, `sys_perm_user`, `sys_perm_group`, `sys_perm_other`, `policy_name`, `virus_lover`, `spam_lover`, `banned_files_lover`, `bad_header_lover`, `bypass_virus_checks`, `bypass_spam_checks`, `bypass_banned_checks`, `bypass_header_checks`, `spam_modifies_subj`, `virus_quarantine_to`, `spam_quarantine_to`, `banned_quarantine_to`, `bad_header_quarantine_to`, `clean_quarantine_to`, `other_quarantine_to`, `spam_tag_level`, `spam_tag2_level`, `spam_kill_level`, `spam_dsn_cutoff_level`, `spam_quarantine_cutoff_level`, `addr_extension_virus`, `addr_extension_spam`, `addr_extension_banned`, `addr_extension_bad_header`, `warnvirusrecip`, `warnbannedrecip`, `warnbadhrecip`, `newvirus_admin`, `virus_admin`, `banned_admin`, `bad_header_admin`, `spam_admin`, `spam_subject_tag`, `spam_subject_tag2`, `message_size_limit`, `banned_rulenames`) VALUES(6, 1, 0, 'riud', 'riud', 'r', 'Trigger happy', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'Y', NULL, NULL, NULL, NULL, NULL, NULL, 3, 5, 5, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); +-INSERT INTO `spamfilter_policy` (`id`, `sys_userid`, `sys_groupid`, `sys_perm_user`, `sys_perm_group`, `sys_perm_other`, `policy_name`, `virus_lover`, `spam_lover`, `banned_files_lover`, `bad_header_lover`, `bypass_virus_checks`, `bypass_spam_checks`, `bypass_banned_checks`, `bypass_header_checks`, `spam_modifies_subj`, `virus_quarantine_to`, `spam_quarantine_to`, `banned_quarantine_to`, `bad_header_quarantine_to`, `clean_quarantine_to`, `other_quarantine_to`, `spam_tag_level`, `spam_tag2_level`, `spam_kill_level`, `spam_dsn_cutoff_level`, `spam_quarantine_cutoff_level`, `addr_extension_virus`, `addr_extension_spam`, `addr_extension_banned`, `addr_extension_bad_header`, `warnvirusrecip`, `warnbannedrecip`, `warnbadhrecip`, `newvirus_admin`, `virus_admin`, `banned_admin`, `bad_header_admin`, `spam_admin`, `spam_subject_tag`, `spam_subject_tag2`, `message_size_limit`, `banned_rulenames`) VALUES(7, 1, 0, 'riud', 'riud', 'r', 'Permissive', 'N', 'N', 'N', 'Y', 'N', 'N', 'N', 'N', 'Y', NULL, NULL, NULL, NULL, NULL, NULL, 3, 10, 20, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); ++INSERT INTO `spamfilter_policy` (`id`, `sys_userid`, `sys_groupid`, `sys_perm_user`, `sys_perm_group`, `sys_perm_other`, `policy_name`, `virus_lover`, `spam_lover`, `banned_files_lover`, `bad_header_lover`, `bypass_virus_checks`, `bypass_spam_checks`, `bypass_banned_checks`, `bypass_header_checks`, `spam_modifies_subj`, `virus_quarantine_to`, `spam_quarantine_to`, `banned_quarantine_to`, `bad_header_quarantine_to`, `clean_quarantine_to`, `other_quarantine_to`, `spam_tag_level`, `spam_tag2_level`, `spam_kill_level`, `spam_dsn_cutoff_level`, `spam_quarantine_cutoff_level`, `addr_extension_virus`, `addr_extension_spam`, `addr_extension_banned`, `addr_extension_bad_header`, `warnvirusrecip`, `warnbannedrecip`, `warnbadhrecip`, `newvirus_admin`, `virus_admin`, `banned_admin`, `bad_header_admin`, `spam_admin`, `spam_subject_tag`, `spam_subject_tag2`, `message_size_limit`, `banned_rulenames`, `rspamd_greylisting`, `rspamd_spam_greylisting_level`, `rspamd_spam_tag_level`, `rspamd_spam_tag_method`, `rspamd_spam_kill_level`) VALUES(1, 1, 0, 'riud', 'riud', 'r', 'Non-paying', 'N', 'N', 'N', 'N', 'Y', 'Y', 'Y', 'N', 'Y', '', '', '', '', '', '', 3, 7, 10, 0, 0, '', '', '', '', 'N', 'N', 'N', '', '', '', '', '', '', '', 0, '', 'n', 6.00, 8.00, 'rewrite_subject', 12.00); ++INSERT INTO `spamfilter_policy` (`id`, `sys_userid`, `sys_groupid`, `sys_perm_user`, `sys_perm_group`, `sys_perm_other`, `policy_name`, `virus_lover`, `spam_lover`, `banned_files_lover`, `bad_header_lover`, `bypass_virus_checks`, `bypass_spam_checks`, `bypass_banned_checks`, `bypass_header_checks`, `spam_modifies_subj`, `virus_quarantine_to`, `spam_quarantine_to`, `banned_quarantine_to`, `bad_header_quarantine_to`, `clean_quarantine_to`, `other_quarantine_to`, `spam_tag_level`, `spam_tag2_level`, `spam_kill_level`, `spam_dsn_cutoff_level`, `spam_quarantine_cutoff_level`, `addr_extension_virus`, `addr_extension_spam`, `addr_extension_banned`, `addr_extension_bad_header`, `warnvirusrecip`, `warnbannedrecip`, `warnbadhrecip`, `newvirus_admin`, `virus_admin`, `banned_admin`, `bad_header_admin`, `spam_admin`, `spam_subject_tag`, `spam_subject_tag2`, `message_size_limit`, `banned_rulenames`, `rspamd_greylisting`, `rspamd_spam_greylisting_level`, `rspamd_spam_tag_level`, `rspamd_spam_tag_method`, `rspamd_spam_kill_level`) VALUES(2, 1, 0, 'riud', 'riud', 'r', 'Uncensored', 'Y', 'Y', 'Y', 'Y', 'N', 'N', 'N', 'N', 'N', NULL, NULL, NULL, NULL, NULL, NULL, 3, 999, 999, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'n', 999.00, 999.00, 'rewrite_subject', 999.00); ++INSERT INTO `spamfilter_policy` (`id`, `sys_userid`, `sys_groupid`, `sys_perm_user`, `sys_perm_group`, `sys_perm_other`, `policy_name`, `virus_lover`, `spam_lover`, `banned_files_lover`, `bad_header_lover`, `bypass_virus_checks`, `bypass_spam_checks`, `bypass_banned_checks`, `bypass_header_checks`, `spam_modifies_subj`, `virus_quarantine_to`, `spam_quarantine_to`, `banned_quarantine_to`, `bad_header_quarantine_to`, `clean_quarantine_to`, `other_quarantine_to`, `spam_tag_level`, `spam_tag2_level`, `spam_kill_level`, `spam_dsn_cutoff_level`, `spam_quarantine_cutoff_level`, `addr_extension_virus`, `addr_extension_spam`, `addr_extension_banned`, `addr_extension_bad_header`, `warnvirusrecip`, `warnbannedrecip`, `warnbadhrecip`, `newvirus_admin`, `virus_admin`, `banned_admin`, `bad_header_admin`, `spam_admin`, `spam_subject_tag`, `spam_subject_tag2`, `message_size_limit`, `banned_rulenames`, `rspamd_greylisting`, `rspamd_spam_greylisting_level`, `rspamd_spam_tag_level`, `rspamd_spam_tag_method`, `rspamd_spam_kill_level`) VALUES(3, 1, 0, 'riud', 'riud', 'r', 'Wants all spam', 'N', 'Y', 'N', 'N', 'N', 'N', 'N', 'N', 'Y', NULL, NULL, NULL, NULL, NULL, NULL, 3, 999, 999, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'n', 999.00, 999.00, 'rewrite_subject', 999.00); ++INSERT INTO `spamfilter_policy` (`id`, `sys_userid`, `sys_groupid`, `sys_perm_user`, `sys_perm_group`, `sys_perm_other`, `policy_name`, `virus_lover`, `spam_lover`, `banned_files_lover`, `bad_header_lover`, `bypass_virus_checks`, `bypass_spam_checks`, `bypass_banned_checks`, `bypass_header_checks`, `spam_modifies_subj`, `virus_quarantine_to`, `spam_quarantine_to`, `banned_quarantine_to`, `bad_header_quarantine_to`, `clean_quarantine_to`, `other_quarantine_to`, `spam_tag_level`, `spam_tag2_level`, `spam_kill_level`, `spam_dsn_cutoff_level`, `spam_quarantine_cutoff_level`, `addr_extension_virus`, `addr_extension_spam`, `addr_extension_banned`, `addr_extension_bad_header`, `warnvirusrecip`, `warnbannedrecip`, `warnbadhrecip`, `newvirus_admin`, `virus_admin`, `banned_admin`, `bad_header_admin`, `spam_admin`, `spam_subject_tag`, `spam_subject_tag2`, `message_size_limit`, `banned_rulenames`, `rspamd_greylisting`, `rspamd_spam_greylisting_level`, `rspamd_spam_tag_level`, `rspamd_spam_tag_method`, `rspamd_spam_kill_level`) VALUES(4, 1, 0, 'riud', 'riud', 'r', 'Wants viruses', 'Y', 'N', 'Y', 'Y', 'N', 'N', 'N', 'N', 'Y', NULL, NULL, NULL, NULL, NULL, NULL, 3, 6.9, 6.9, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'y', 4.00, 6.00, 'rewrite_subject', 10.00); ++INSERT INTO `spamfilter_policy` (`id`, `sys_userid`, `sys_groupid`, `sys_perm_user`, `sys_perm_group`, `sys_perm_other`, `policy_name`, `virus_lover`, `spam_lover`, `banned_files_lover`, `bad_header_lover`, `bypass_virus_checks`, `bypass_spam_checks`, `bypass_banned_checks`, `bypass_header_checks`, `spam_modifies_subj`, `virus_quarantine_to`, `spam_quarantine_to`, `banned_quarantine_to`, `bad_header_quarantine_to`, `clean_quarantine_to`, `other_quarantine_to`, `spam_tag_level`, `spam_tag2_level`, `spam_kill_level`, `spam_dsn_cutoff_level`, `spam_quarantine_cutoff_level`, `addr_extension_virus`, `addr_extension_spam`, `addr_extension_banned`, `addr_extension_bad_header`, `warnvirusrecip`, `warnbannedrecip`, `warnbadhrecip`, `newvirus_admin`, `virus_admin`, `banned_admin`, `bad_header_admin`, `spam_admin`, `spam_subject_tag`, `spam_subject_tag2`, `message_size_limit`, `banned_rulenames`, `rspamd_greylisting`, `rspamd_spam_greylisting_level`, `rspamd_spam_tag_level`, `rspamd_spam_tag_method`, `rspamd_spam_kill_level`) VALUES(5, 1, 0, 'riud', 'riud', 'r', 'Normal', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'Y', '', '', '', '', '', '', 1, 4.5, 50, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '', '***SPAM***', NULL, NULL, 'y', 4.00, 6.00, 'rewrite_subject', 10.00); ++INSERT INTO `spamfilter_policy` (`id`, `sys_userid`, `sys_groupid`, `sys_perm_user`, `sys_perm_group`, `sys_perm_other`, `policy_name`, `virus_lover`, `spam_lover`, `banned_files_lover`, `bad_header_lover`, `bypass_virus_checks`, `bypass_spam_checks`, `bypass_banned_checks`, `bypass_header_checks`, `spam_modifies_subj`, `virus_quarantine_to`, `spam_quarantine_to`, `banned_quarantine_to`, `bad_header_quarantine_to`, `clean_quarantine_to`, `other_quarantine_to`, `spam_tag_level`, `spam_tag2_level`, `spam_kill_level`, `spam_dsn_cutoff_level`, `spam_quarantine_cutoff_level`, `addr_extension_virus`, `addr_extension_spam`, `addr_extension_banned`, `addr_extension_bad_header`, `warnvirusrecip`, `warnbannedrecip`, `warnbadhrecip`, `newvirus_admin`, `virus_admin`, `banned_admin`, `bad_header_admin`, `spam_admin`, `spam_subject_tag`, `spam_subject_tag2`, `message_size_limit`, `banned_rulenames`, `rspamd_greylisting`, `rspamd_spam_greylisting_level`, `rspamd_spam_tag_level`, `rspamd_spam_tag_method`, `rspamd_spam_kill_level`) VALUES(6, 1, 0, 'riud', 'riud', 'r', 'Trigger happy', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'Y', NULL, NULL, NULL, NULL, NULL, NULL, 3, 5, 5, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'y', 2.00, 4.00, 'rewrite_subject', 8.00); ++INSERT INTO `spamfilter_policy` (`id`, `sys_userid`, `sys_groupid`, `sys_perm_user`, `sys_perm_group`, `sys_perm_other`, `policy_name`, `virus_lover`, `spam_lover`, `banned_files_lover`, `bad_header_lover`, `bypass_virus_checks`, `bypass_spam_checks`, `bypass_banned_checks`, `bypass_header_checks`, `spam_modifies_subj`, `virus_quarantine_to`, `spam_quarantine_to`, `banned_quarantine_to`, `bad_header_quarantine_to`, `clean_quarantine_to`, `other_quarantine_to`, `spam_tag_level`, `spam_tag2_level`, `spam_kill_level`, `spam_dsn_cutoff_level`, `spam_quarantine_cutoff_level`, `addr_extension_virus`, `addr_extension_spam`, `addr_extension_banned`, `addr_extension_bad_header`, `warnvirusrecip`, `warnbannedrecip`, `warnbadhrecip`, `newvirus_admin`, `virus_admin`, `banned_admin`, `bad_header_admin`, `spam_admin`, `spam_subject_tag`, `spam_subject_tag2`, `message_size_limit`, `banned_rulenames`, `rspamd_greylisting`, `rspamd_spam_greylisting_level`, `rspamd_spam_tag_level`, `rspamd_spam_tag_method`, `rspamd_spam_kill_level`) VALUES(7, 1, 0, 'riud', 'riud', 'r', 'Permissive', 'N', 'N', 'N', 'Y', 'N', 'N', 'N', 'N', 'Y', NULL, NULL, NULL, NULL, NULL, NULL, 3, 10, 20, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'n', 7.00, 10.00, 'rewrite_subject', 20.00); + + -- -------------------------------------------------------- + diff --git a/install/tpl/rspamd_antivirus.conf.master b/install/tpl/rspamd_antivirus.conf.master new file mode 100644 index 0000000000000000000000000000000000000000..f88d81ac7ce94c881087b93e0d08bc2f1849f429 --- /dev/null +++ b/install/tpl/rspamd_antivirus.conf.master @@ -0,0 +1,30 @@ +clamav { + # If set force this action if any virus is found (default unset: no action is forced) + #action = "reject"; + # if `true` only messages with non-image attachments will be checked (default true) + scan_mime_parts = true; + # If `max_size` is set, messages > n bytes in size are not scanned + #max_size = 20000000; + # symbol to add (add it to metric if you want non-zero weight) + symbol = "CLAM_VIRUS"; + # type of scanner: "clamav", "fprot", "sophos" or "savapi" + type = "clamav"; + # For "savapi" you must also specify the following variable + #product_id = 12345; + # You can enable logging for clean messages + #log_clean = true; + # servers to query (if port is unspecified, scanner-specific default is used) + # can be specified multiple times to pool servers + # can be set to a path to a unix socket + # Enable this in local.d/antivirus.conf + #servers = "127.0.0.1:3310"; + servers = "/var/run/clamav/clamd.ctl"; + # if `patterns` is specified virus name will be matched against provided regexes and the related + # symbol will be yielded if a match is found. If no match is found, default symbol is yielded. + patterns { + # symbol_name = "pattern"; + JUST_EICAR = "^Eicar-Test-Signature$"; + } + # `whitelist` points to a map of IP addresses. Mail from these addresses is not scanned. + whitelist = "/etc/rspamd/antivirus.wl"; +} \ No newline at end of file diff --git a/install/tpl/rspamd_classifier-bayes.conf.master b/install/tpl/rspamd_classifier-bayes.conf.master new file mode 100644 index 0000000000000000000000000000000000000000..1688d57e217673cdfa50ff36c31f4beb782aae70 --- /dev/null +++ b/install/tpl/rspamd_classifier-bayes.conf.master @@ -0,0 +1,3 @@ +autolearn = [-0.01, 5.00]; +per_user = true; +per_language = true; \ No newline at end of file diff --git a/install/tpl/rspamd_dkim_signing.conf.master b/install/tpl/rspamd_dkim_signing.conf.master new file mode 100644 index 0000000000000000000000000000000000000000..ed9abe40eebb060bc0a2eeec1da55074dc4eeaf7 --- /dev/null +++ b/install/tpl/rspamd_dkim_signing.conf.master @@ -0,0 +1,3 @@ +try_fallback = false; +path_map = "/etc/rspamd/local.d/dkim_domains.map"; +selector_map = "/etc/rspamd/local.d/dkim_selectors.map"; \ No newline at end of file diff --git a/install/tpl/rspamd_greylist.conf.master b/install/tpl/rspamd_greylist.conf.master new file mode 100644 index 0000000000000000000000000000000000000000..74ea715a22cc6fa76671fd47a3f1bf89cfe92d49 --- /dev/null +++ b/install/tpl/rspamd_greylist.conf.master @@ -0,0 +1 @@ +servers = "127.0.0.1:6379"; \ No newline at end of file diff --git a/install/tpl/rspamd_groups.conf.master b/install/tpl/rspamd_groups.conf.master new file mode 100644 index 0000000000000000000000000000000000000000..62a986533abb66fe28203358f0d6ef5854f9e0e6 --- /dev/null +++ b/install/tpl/rspamd_groups.conf.master @@ -0,0 +1,4 @@ +group "antivirus" { + .include(try=true; priority=1; duplicate=merge) "$LOCAL_CONFDIR/local.d/antivirus_group.conf" + .include(try=true; priority=10) "$LOCAL_CONFDIR/override.d/antivirus_group.conf" +} diff --git a/install/tpl/rspamd_milter_headers.conf.master b/install/tpl/rspamd_milter_headers.conf.master new file mode 100644 index 0000000000000000000000000000000000000000..d399bbf4ecc37e39ff900260a4884335767e9957 --- /dev/null +++ b/install/tpl/rspamd_milter_headers.conf.master @@ -0,0 +1,2 @@ +use = ["x-spamd-bar", "x-spam-level", "authentication-results"]; +authenticated_headers = ["authentication-results"]; \ No newline at end of file diff --git a/install/tpl/rspamd_mx_check.conf.master b/install/tpl/rspamd_mx_check.conf.master new file mode 100644 index 0000000000000000000000000000000000000000..0a628f9c8382ee1f0def03883c91b91d7701e625 --- /dev/null +++ b/install/tpl/rspamd_mx_check.conf.master @@ -0,0 +1,9 @@ +enabled = true; +servers = "localhost"; +key_prefix = "rmx"; +symbol_bad_mx = "MX_INVALID"; +symbol_no_mx = "MX_MISSING"; +symbol_good_mx = "MX_GOOD"; +expire = 86400; +expire_novalid = 7200; +greylist_invalid = false; \ No newline at end of file diff --git a/install/tpl/rspamd_neural.conf.master b/install/tpl/rspamd_neural.conf.master new file mode 100644 index 0000000000000000000000000000000000000000..76f8a6d34479f05dfb638d736fdb5c975b31a7a0 --- /dev/null +++ b/install/tpl/rspamd_neural.conf.master @@ -0,0 +1,31 @@ +servers = 127.0.0.1:6379; +enabled = true; + +rules { + "LONG" { + train { + max_trains = 5000; + max_usages = 200; + max_iterations = 25; + learning_rate = 0.01, + spam_score = 10; + ham_score = -2; + } + symbol_spam = "NEURAL_SPAM_LONG"; + symbol_ham = "NEURAL_HAM_LONG"; + ann_expire = 100d; + } + "SHORT" { + train { + max_trains = 100; + max_usages = 2; + max_iterations = 25; + learning_rate = 0.01, + spam_score = 10; + ham_score = -2; + } + symbol_spam = "NEURAL_SPAM_SHORT"; + symbol_ham = "NEURAL_HAM_SHORT"; + ann_expire = 1d; + } +} \ No newline at end of file diff --git a/install/tpl/rspamd_neural_group.conf.master b/install/tpl/rspamd_neural_group.conf.master new file mode 100644 index 0000000000000000000000000000000000000000..5aabdefaff0599b633b5589eb80c6c85f7e4692f --- /dev/null +++ b/install/tpl/rspamd_neural_group.conf.master @@ -0,0 +1,18 @@ +symbols = { + "NEURAL_SPAM_LONG" { + weight = 1.0; # sample weight + description = "Neural network spam (long)"; + } + "NEURAL_HAM_LONG" { + weight = -2.0; # sample weight + description = "Neural network ham (long)"; + } + "NEURAL_SPAM_SHORT" { + weight = 0.5; # sample weight + description = "Neural network spam (short)"; + } + "NEURAL_HAM_SHORT" { + weight = -1.0; # sample weight + description = "Neural network ham (short)"; + } +} diff --git a/install/tpl/rspamd_options.inc.master b/install/tpl/rspamd_options.inc.master new file mode 100644 index 0000000000000000000000000000000000000000..69e40365b7dc653b046b6e3cb3ff0539936a816e --- /dev/null +++ b/install/tpl/rspamd_options.inc.master @@ -0,0 +1,5 @@ +local_addrs = "127.0.0.0/8, ::1"; + +dns { + nameserver = ["127.0.0.1:53:10"]; +} diff --git a/install/tpl/rspamd_override_rbl.conf.master b/install/tpl/rspamd_override_rbl.conf.master new file mode 100644 index 0000000000000000000000000000000000000000..310e722832376f6e049fc2e1ac4c4179a3c3259e --- /dev/null +++ b/install/tpl/rspamd_override_rbl.conf.master @@ -0,0 +1,53 @@ +# RBL +symbols = { + "RBL_SENDERSCORE" { + weight = 4.0; + description = "From address is listed in senderscore.com BL"; + } + "RBL_SPAMHAUS_SBL" { + weight = 2.0; + description = "From address is listed in zen sbl"; + } + "RBL_SPAMHAUS_CSS" { + weight = 2.0; + description = "From address is listed in zen css"; + } + "RBL_SPAMHAUS_XBL" { + weight = 4.0; + description = "From address is listed in zen xbl"; + } + "RBL_SPAMHAUS_XBL_ANY" { + weight = 4.0; + description = "From or receive address is listed in zen xbl (any list)"; + } + "RBL_SPAMHAUS_PBL" { + weight = 2.0; + description = "From address is listed in zen pbl (ISP list)"; + } + "RBL_SPAMHAUS_DROP" { + weight = 7.0; + description = "From address is listed in zen drop bl"; + } + "RECEIVED_SPAMHAUS_XBL" { + weight = 3.0; + description = "Received address is listed in zen xbl"; + one_shot = true; + } + "RBL_MAILSPIKE_WORST" { + weight = 2.0; + description = "From address is listed in RBL - worst possible reputation"; + } + "RBL_MAILSPIKE_VERYBAD" { + weight = 1.5; + description = "From address is listed in RBL - very bad reputation"; + } + "RBL_MAILSPIKE_BAD" { + weight = 1.0; + description = "From address is listed in RBL - bad reputation"; + } + "RBL_SEM" { + weight = 1.0; + description = "Address is listed in Spameatingmonkey RBL"; + } + # /RBL +} diff --git a/install/tpl/rspamd_override_surbl.conf.master b/install/tpl/rspamd_override_surbl.conf.master new file mode 100644 index 0000000000000000000000000000000000000000..30676a46fde75e4e4d21bf3e5cc1e6aabc4e749d --- /dev/null +++ b/install/tpl/rspamd_override_surbl.conf.master @@ -0,0 +1,108 @@ +symbols = { + # SURBL + "PH_SURBL_MULTI" { + weight = 5.5; + description = "SURBL: Phishing sites"; + } + "MW_SURBL_MULTI" { + weight = 5.5; + description = "SURBL: Malware sites"; + } + "ABUSE_SURBL" { + weight = 5.5; + description = "SURBL: ABUSE"; + } + "CRACKED_SURBL" { + weight = 4.0; + description = "SURBL: cracked site"; + } + "RAMBLER_URIBL" { + weight = 4.5; + description = "Rambler uribl"; + one_shot = true; + } + "RAMBLER_EMAILBL" { + weight = 9.5; + description = "Rambler emailbl"; + one_shot = true; + } + "MSBL_EBL" { + weight = 7.5; + description = "MSBL emailbl"; + one_shot = true; + } + "SEM_URIBL" { + weight = 3.5; + description = "Spameatingmonkey uribl"; + } + "SEM_URIBL_FRESH15" { + weight = 3.0; + description = "Spameatingmonkey uribl. Domains registered in the last 15 days (.AERO,.BIZ,.COM,.INFO,.NAME,.NET,.PRO,.SK,.TEL,.US)"; + } + "DBL" { + weight = 0.0; + description = "DBL unknown result"; + } + "DBL_SPAM" { + weight = 6.5; + description = "DBL uribl spam"; + } + "DBL_PHISH" { + weight = 6.5; + description = "DBL uribl phishing"; + } + "DBL_MALWARE" { + weight = 6.5; + description = "DBL uribl malware"; + } + "DBL_BOTNET" { + weight = 5.5; + description = "DBL uribl botnet C&C domain"; + } + "DBL_ABUSE" { + weight = 6.5; + description = "DBL uribl abused legit spam"; + } + "DBL_ABUSE_REDIR" { + weight = 1.5; + description = "DBL uribl abused spammed redirector domain"; + } + "DBL_ABUSE_PHISH" { + weight = 7.5; + description = "DBL uribl abused legit phish"; + } + "DBL_ABUSE_MALWARE" { + weight = 7.5; + description = "DBL uribl abused legit malware"; + } + "DBL_ABUSE_BOTNET" { + weight = 5.5; + description = "DBL uribl abused legit botnet C&C"; + } + "URIBL_BLACK" { + weight = 7.5; + description = "uribl.com black url"; + } + "URIBL_RED" { + weight = 3.5; + description = "uribl.com red url"; + } + "URIBL_GREY" { + weight = 1.5; + description = "uribl.com grey url"; + one_shot = true; + } + "URIBL_SBL" { + weight = 6.5; + description = "Spamhaus SBL URIBL"; + } + "URIBL_SBL_CSS" { + weight = 6.5; + description = "Spamhaus SBL CSS URIBL"; + } + "RBL_SARBL_BAD" { + weight = 2.5; + description = "A domain listed in the mail is blacklisted in SARBL"; + } + # /SURBL +} diff --git a/install/tpl/rspamd_redis.conf.master b/install/tpl/rspamd_redis.conf.master new file mode 100644 index 0000000000000000000000000000000000000000..b908af9f5ebe0e23293797e234eb9dd455838a01 --- /dev/null +++ b/install/tpl/rspamd_redis.conf.master @@ -0,0 +1 @@ +servers = "127.0.0.1"; \ No newline at end of file diff --git a/install/tpl/rspamd_symbols_antivirus.conf.master b/install/tpl/rspamd_symbols_antivirus.conf.master new file mode 100644 index 0000000000000000000000000000000000000000..8c2d93d89eeacf816ad870f5bab97a7d406cc143 --- /dev/null +++ b/install/tpl/rspamd_symbols_antivirus.conf.master @@ -0,0 +1,15 @@ +subject = "***SPAM*** %s"; +symbols = { + "CLAM_VIRUS" { + weight = 50; + description = "Clamav has found a virus."; + } + "JUST_EICAR" { + weight = 50; + description = "Clamav has found a virus."; + } + "R_DUMMY" { + weight = 0.0; + description = "Dummy symbol"; + } +} \ No newline at end of file diff --git a/install/tpl/rspamd_users.conf.master b/install/tpl/rspamd_users.conf.master new file mode 100644 index 0000000000000000000000000000000000000000..73d437d6cbdd3a7292af84855364cdfee7de977a --- /dev/null +++ b/install/tpl/rspamd_users.conf.master @@ -0,0 +1,43 @@ +settings { + authenticated { + priority = 10; + authenticated = yes; + #apply "default" { groups_disabled = ["rbl", "spf"]; } + apply "default" { + #symbols_enabled = []; + symbols_disabled = []; + #groups_enabled = []; + groups_disabled = ["rbl"]; + } + } + whitelist { + priority = 10; + rcpt = "postmaster"; + rcpt = "hostmaster"; + rcpt = "abuse"; + want_spam = yes; + } + whitelist-ip { + priority = 10; + + ip = ""; + + + want_spam = yes; + } +# whitelist-timmehosting { +# priority = 20; +# from = "@xxx"; +# from = "@xxx"; +# want_spam = yes; +# } + whitelist-ca { + priority = 20; + from = "@comodo.com"; + from = "@geotrust.com"; + from = "@geotrusteurope.com"; + want_spam = yes; + } + .include(try=true; glob=true) "$LOCAL_CONFDIR/local.d/users/*.conf" + .include(try=true; priority=1,duplicate=merge) "$LOCAL_CONFDIR/local.d/users.local.conf" +} diff --git a/install/tpl/rspamd_users.inc.conf.master b/install/tpl/rspamd_users.inc.conf.master new file mode 120000 index 0000000000000000000000000000000000000000..30bb52fd8e22d629bca9e28459d4d04e44e08ea0 --- /dev/null +++ b/install/tpl/rspamd_users.inc.conf.master @@ -0,0 +1 @@ +../../server/conf/rspamd_users.inc.conf.master \ No newline at end of file diff --git a/install/tpl/rspamd_wblist.inc.conf.master b/install/tpl/rspamd_wblist.inc.conf.master new file mode 120000 index 0000000000000000000000000000000000000000..1ab3744b99aa456982f0a360377797543aeca60f --- /dev/null +++ b/install/tpl/rspamd_wblist.inc.conf.master @@ -0,0 +1 @@ +../../server/conf/rspamd_wblist.inc.conf.master \ No newline at end of file diff --git a/install/tpl/rspamd_worker-controller.inc.master b/install/tpl/rspamd_worker-controller.inc.master new file mode 120000 index 0000000000000000000000000000000000000000..dae19323690f604babdb0682108b49f420476fb7 --- /dev/null +++ b/install/tpl/rspamd_worker-controller.inc.master @@ -0,0 +1 @@ +../../server/conf/rspamd_worker-controller.inc.master \ No newline at end of file diff --git a/install/tpl/server.ini.master b/install/tpl/server.ini.master index 6441609cabd2a1c326bdd22bc31abfe8a623b321..36f157d8e6ef80a5e4029b2c9ac6963e35bc3d60 100644 --- a/install/tpl/server.ini.master +++ b/install/tpl/server.ini.master @@ -38,6 +38,8 @@ homedir_path=/var/vmail maildir_format=maildir dkim_path=/var/lib/amavis/dkim dkim_strength=1024 +content_filter=amavis +rspamd_password= pop3_imap_daemon=courier mail_filter_syntax=maildrop mailuser_uid=5000 diff --git a/install/update.php b/install/update.php index 104aab57ff65dc8db731af338721e67af8d2e46c..42ddd625f5aca69cebcf2b8d1c8064d1b1735ba2 100644 --- a/install/update.php +++ b/install/update.php @@ -397,6 +397,12 @@ if($reconfigure_services_answer == 'yes' || $reconfigure_services_answer == 'sel $inst->configure_amavis(); } + //** Configure Rspamd + if($conf['rspamd']['installed'] == true && $inst->reconfigure_app('Rspamd', $reconfigure_services_answer)) { + swriteln('Configuring Rspamd'); + $inst->configure_rspamd(); + } + //** Configure Getmail if ($inst->reconfigure_app('Getmail', $reconfigure_services_answer)) { swriteln('Configuring Getmail'); @@ -532,6 +538,7 @@ if($reconfigure_services_answer == 'yes') { if($conf['postfix']['installed'] == true && $conf['postfix']['init_script'] != '') system($inst->getinitcommand($conf['postfix']['init_script'], 'restart')); if($conf['saslauthd']['installed'] == true && $conf['saslauthd']['init_script'] != '') system($inst->getinitcommand($conf['saslauthd']['init_script'], 'restart')); if($conf['amavis']['installed'] == true && $conf['amavis']['init_script'] != '') system($inst->getinitcommand($conf['amavis']['init_script'], 'restart')); + if($conf['rspamd']['installed'] == true && $conf['rspamd']['init_script'] != '') system($inst->getinitcommand($conf['rspamd']['init_script'], 'restart')); if($conf['clamav']['installed'] == true && $conf['clamav']['init_script'] != '') system($inst->getinitcommand($conf['clamav']['init_script'], 'restart')); if($conf['courier']['installed'] == true){ if($conf['courier']['courier-authdaemon'] != '') system($inst->getinitcommand($conf['courier']['courier-authdaemon'], 'restart')); diff --git a/interface/lib/lang/de.lng b/interface/lib/lang/de.lng index 6f2e2d00bafe438f65c4bbd31e7f42c0e46979cf..bc217c30b0977e1b829721241b0e84b50d811408 100644 --- a/interface/lib/lang/de.lng +++ b/interface/lib/lang/de.lng @@ -158,4 +158,5 @@ $wb['security_check1_txt'] = 'Sicherheitsüberprüfung für:'; $wb['security_check2_txt'] = 'fehlgeschlagen.'; $wb['select_directive_snippet_txt'] = 'Direktiven Schnipsel'; $wb['select_master_directive_snippet_txt'] = 'Master Direktiven Schnipsel'; -?> +$wb['add_header_txt'] = 'Header (fügt "X-Spam: Yes" hinzu)'; +$wb['rewrite_subject_txt'] = 'Betreff (fügt "***SPAM***" am Anfang hinzu)'; diff --git a/interface/web/admin/form/server_config.tform.php b/interface/web/admin/form/server_config.tform.php index 1a6c8070cb462ef079efa137b6f297b4456f01af..1c19d0928b03bedef4b12da20a53146ec51445b8 100644 --- a/interface/web/admin/form/server_config.tform.php +++ b/interface/web/admin/form/server_config.tform.php @@ -466,6 +466,29 @@ $form["tabs"]['mail'] = array( 'width' => '40', 'maxlength' => '255' ), + 'content_filter' => array( + 'datatype' => 'VARCHAR', + 'formtype' => 'SELECT', + 'default' => 'rspamd', + 'value' => array('amavisd' => 'Amavisd', 'rspamd' => 'Rspamd') + ), + 'rspamd_password' => array( + 'datatype' => 'VARCHAR', + 'formtype' => 'TEXT', + 'default' => '', + 'value' => '', + 'width' => '40', + 'maxlength' => '255', + 'filters' => array( 0 => array( 'event' => 'SAVE', + 'type' => 'TRIM'), + ), + ), + 'rspamd_available' => array( + 'datatype' => 'VARCHAR', + 'formtype' => 'CHECKBOX', + 'default' => 'n', + 'value' => array(0 => 'n', 1 => 'y') + ), 'dkim_path' => array( 'datatype' => 'VARCHAR', 'formtype' => 'TEXT', @@ -1953,4 +1976,10 @@ $form["tabs"]['rescue'] = array( //################################# ) ); -?> + +/*$mail_config = $app->getconf->get_server_config($conf['server_id'], 'mail'); +if(!isset($mail_config['rspamd_available']) || $mail_config['rspamd_available'] != 'y') { + $form['tabs']['mail']['fields']['content_filter']['default'] = 'amavisd'; + unset($form['tabs']['mail']['fields']['content_filter']['value']['rspamd']); + unset($form['tabs']['mail']['fields']['rspamd_password']); +}*/ \ No newline at end of file diff --git a/interface/web/admin/form/server_config.tform.php.orig b/interface/web/admin/form/server_config.tform.php.orig new file mode 100644 index 0000000000000000000000000000000000000000..1a6c8070cb462ef079efa137b6f297b4456f01af --- /dev/null +++ b/interface/web/admin/form/server_config.tform.php.orig @@ -0,0 +1,1956 @@ + 0 id must match with id of current user +$form["auth_preset"]["groupid"] = 0; // 0 = default groupid of the user, > 0 id must match with groupid of current user +$form["auth_preset"]["perm_user"] = 'riud'; //r = read, i = insert, u = update, d = delete +$form["auth_preset"]["perm_group"] = 'riud'; //r = read, i = insert, u = update, d = delete +$form["auth_preset"]["perm_other"] = ''; //r = read, i = insert, u = update, d = delete + +$form["tabs"]['server'] = array( + 'title' => "Server", + 'width' => 70, + 'template' => "templates/server_config_server_edit.htm", + 'fields' => array( + //################################# + // Begin Datatable fields + //################################# + 'auto_network_configuration' => array( + 'datatype' => 'VARCHAR', + 'formtype' => 'CHECKBOX', + 'default' => 'n', + 'value' => array(0 => 'n', 1 => 'y') + ), + 'ip_address' => array( + 'datatype' => 'VARCHAR', + 'formtype' => 'TEXT', + 'default' => '192.168.0.105', + 'validators' => array(0 => array('type' => 'ISIPV4', + 'errmsg' => 'ip_address_error_wrong'), + ), + 'value' => '', + 'width' => '15', + 'maxlength' => '255' + ), + 'netmask' => array( + 'datatype' => 'VARCHAR', + 'formtype' => 'TEXT', + 'default' => '255.255.255.0', + 'validators' => array(0 => array('type' => 'ISIPV4', + 'errmsg' => 'netmask_error_wrong'), + ), + 'value' => '', + 'width' => '15', + 'maxlength' => '255' + ), + 'v6_prefix' => array( + 'datatype' => 'VARCHAR', + 'formtype' => 'TEXT', + 'validators' => array( 0 => array('type' => 'ISV6PREFIX', + 'errmsg' => 'v6_prefix_wrong'), + 1 => array('type' => 'V6PREFIXEND', + 'errmsg' => 'v6_prefix_end'), + 2 => array('type' => 'V6PREFIXLENGTH', + 'errmsg' => 'v6_prefix_length') + ), + 'default' => '' + ), + 'gateway' => array( + 'datatype' => 'VARCHAR', + 'formtype' => 'TEXT', + 'default' => '192.168.0.1', + 'validators' => array(0 => array('type' => 'ISIPV4', + 'errmsg' => 'gateway_error_wrong'), + ), + 'value' => '', + 'width' => '15', + 'maxlength' => '255' + ), + 'firewall' => array( + 'datatype' => 'VARCHAR', + 'formtype' => 'SELECT', + 'default' => 'bastille', + 'value' => array('bastille' => 'bastille', 'ufw' => 'ufw'), + 'width' => '40', + 'maxlength' => '255' + ), + 'hostname' => array( + 'datatype' => 'VARCHAR', + 'formtype' => 'TEXT', + 'default' => 'server1.domain.tld', + 'filters' => array( 0 => array( 'event' => 'SAVE', + 'type' => 'IDNTOASCII'), + 1 => array( 'event' => 'SHOW', + 'type' => 'IDNTOUTF8'), + 2 => array( 'event' => 'SAVE', + 'type' => 'TOLOWER') + ), + 'validators' => array( 0 => array('type' => 'NOTEMPTY', + 'errmsg' => 'hostname_error_empty'), + 1 => array ('type' => 'REGEX', + 'regex' => '/^[\w\.\-]{2,255}\.[a-zA-Z0-9\-]{2,30}$/', + 'errmsg'=> 'hostname_error_regex'), + ), + 'value' => '', + 'width' => '40', + 'maxlength' => '255' + ), + 'nameservers' => array( + 'datatype' => 'VARCHAR', + 'formtype' => 'TEXT', + 'default' => '192.168.0.1,192.168.0.2', + 'validators' => array(0 => array('type' => 'NOTEMPTY', + 'errmsg' => 'nameservers_error_empty'), + ), + 'filters' => array( + 0 => array( 'event' => 'SAVE', + 'type' => 'STRIPTAGS'), + 1 => array( 'event' => 'SAVE', + 'type' => 'STRIPNL') + ), + 'value' => '', + 'width' => '40', + 'maxlength' => '255' + ), + 'loglevel' => array( + 'datatype' => 'INTEGER', + 'formtype' => 'SELECT', + 'default' => '2', + 'value' => array('0' => 'Debug', '1' => 'Warnings', '2' => 'Errors'), + 'width' => '40', + 'maxlength' => '255' + ), + 'admin_notify_events' => array( + 'datatype' => 'INTEGER', + 'formtype' => 'SELECT', + 'default' => '1', + 'value' => array('3' => 'no_notifications_txt', '0' => 'Debug', '1' => 'Warnings', '2' => 'Errors'), + 'width' => '40', + 'maxlength' => '255' + ), + 'backup_dir' => array( + 'datatype' => 'VARCHAR', + 'formtype' => 'TEXT', + 'default' => '/var/backup', + 'validators' => array( 0 => array ( 'type' => 'REGEX', + 'regex' => "/(|^\\/{1,2}(?:[\\w-]+[.]?\\/?){5,128})$/", + 'errmsg'=> 'backup_dir_error_regex'), + ), + 'value' => '', + 'width' => '40', + 'maxlength' => '255' + ), + 'backup_tmp' => array( + 'datatype' => 'VARCHAR', + 'formtype' => 'TEXT', + 'default' => '/tmp/', + 'validators' => array( 0 => array('type' => 'NOTEMPTY', + 'errmsg' => 'tmpdir_path_error_empty'), + 1 => array ( 'type' => 'REGEX', + 'regex' => "/^\/[a-zA-Z0-9\.\-\_\/]{3,128}$/", + 'errmsg'=> 'tmpdir_path_error_regex'), + ), + 'value' => '', + 'width' => '40', + 'maxlength' => '255' + ), + 'backup_dir_is_mount' => array( + 'datatype' => 'VARCHAR', + 'formtype' => 'CHECKBOX', + 'default' => 'y', + 'value' => array(0 => 'n', 1 => 'y') + ), + 'backup_mode' => array( + 'datatype' => 'VARCHAR', + 'formtype' => 'SELECT', + 'default' => 'userzip', + 'value' => array('userzip' => 'backup_mode_userzip', 'rootgz' => 'backup_mode_rootgz'), + 'width' => '40', + 'maxlength' => '255' + ), + 'backup_time' => array( + 'datatype' => 'VARCHAR', + 'formtype' => 'SELECT', + 'default' => '0:00', + 'value' => array( '0:00' => '0:00h', + '0:15' => '0:15h', + '0:30' => '0:30h', + '0:45' => '0:45h', + '1:00' => '1:00h', + '1:15' => '1:15h', + '1:30' => '1:30h', + '1:45' => '1:45h', + '2:00' => '2:00h', + '2:15' => '2:15h', + '2:30' => '2:30h', + '2:45' => '2:45h', + '3:00' => '3:00h', + '3:15' => '3:15h', + '3:30' => '3:30h', + '3:45' => '3:45h', + '4:00' => '4:00h', + '4:15' => '4:15h', + '4:30' => '4:30h', + '4:45' => '4:45h', + '5:00' => '5:00h', + '5:15' => '5:15h', + '5:30' => '5:30h', + '5:45' => '5:45h', + '6:00' => '6:00h', + '6:15' => '6:15h', + '6:30' => '6:30h', + '6:45' => '6:45h', + '7:00' => '7:00h', + '7:15' => '7:15h', + '7:30' => '7:30h', + '7:45' => '7:45h', + '8:00' => '8:00h', + '8:15' => '8:15h', + '8:30' => '8:30h', + '8:45' => '8:45h', + '9:00' => '9:00h', + '9:15' => '9:15h', + '9:30' => '9:30h', + '9:45' => '9:45h', + '10:00' => '10:00h', + '10:15' => '10:15h', + '10:30' => '10:30h', + '10:45' => '10:45h', + '11:00' => '11:00h', + '11:15' => '11:15h', + '11:30' => '11:30h', + '11:45' => '11:45h', + '12:00' => '12:00h', + '12:15' => '12:15h', + '12:30' => '12:30h', + '12:45' => '12:45h', + '13:00' => '13:00h', + '13:15' => '13:15h', + '13:30' => '13:30h', + '13:45' => '13:45h', + '14:00' => '14:00h', + '14:15' => '14:15h', + '14:30' => '14:30h', + '14:45' => '14:45h', + '15:00' => '15:00h', + '15:15' => '15:15h', + '15:30' => '15:30h', + '15:45' => '15:45h', + '16:00' => '16:00h', + '16:15' => '16:15h', + '16:30' => '16:30h', + '16:45' => '16:45h', + '17:00' => '17:00h', + '17:15' => '17:15h', + '17:30' => '17:30h', + '17:45' => '17:45h', + '18:00' => '18:00h', + '18:15' => '18:15h', + '18:30' => '18:30h', + '18:45' => '18:45h', + '19:00' => '19:00h', + '19:15' => '19:15h', + '19:30' => '19:30h', + '19:45' => '19:45h', + '20:00' => '20:00h', + '20:15' => '20:15h', + '20:30' => '20:30h', + '20:45' => '20:45h', + '21:00' => '21:00h', + '21:15' => '21:15h', + '21:30' => '21:30h', + '21:45' => '21:45h', + '22:00' => '22:00h', + '22:15' => '22:15h', + '22:30' => '22:30h', + '22:45' => '22:45h', + '23:00' => '23:00h', + '23:15' => '23:15h', + '23:30' => '23:30h', + '23:45' => '23:45h', + ), + 'width' => '40', + 'maxlength' => '255' + ), + 'backup_delete' => array( + 'datatype' => 'VARCHAR', + 'formtype' => 'CHECKBOX', + 'default' => 'y', + 'value' => array(0 => 'n', 1 => 'y') + ), + 'monit_url' => array( + 'datatype' => 'VARCHAR', + 'formtype' => 'TEXT', + 'default' => '', + 'validators' => array ( 0 => array ( 'type' => 'REGEX', + 'regex' => '/^[0-9a-zA-Z\:\/\-\.\[\]]{0,255}$/', + 'errmsg'=> 'monit_url_error_regex'), + ), + 'value' => '', + 'width' => '40', + 'maxlength' => '255' + ), + 'monit_user' => array( + 'datatype' => 'VARCHAR', + 'formtype' => 'TEXT', + 'filters' => array( + 0 => array( 'event' => 'SAVE', + 'type' => 'STRIPTAGS'), + 1 => array( 'event' => 'SAVE', + 'type' => 'STRIPNL') + ), + 'default' => '', + 'value' => '', + 'width' => '40', + 'maxlength' => '255' + ), + 'monit_password' => array( + 'datatype' => 'VARCHAR', + 'formtype' => 'TEXT', + 'default' => '', + 'value' => '', + 'width' => '40', + 'maxlength' => '255' + ), + 'munin_url' => array( + 'datatype' => 'VARCHAR', + 'formtype' => 'TEXT', + 'default' => '', + 'validators' => array ( 0 => array ( 'type' => 'REGEX', + 'regex' => '/^[0-9a-zA-Z\:\/\-\.\[\]]{0,255}$/', + 'errmsg'=> 'munin_url_error_regex'), + ), + 'value' => '', + 'width' => '40', + 'maxlength' => '255' + ), + 'munin_user' => array( + 'datatype' => 'VARCHAR', + 'formtype' => 'TEXT', + 'filters' => array( + 0 => array( 'event' => 'SAVE', + 'type' => 'STRIPTAGS'), + 1 => array( 'event' => 'SAVE', + 'type' => 'STRIPNL') + ), + 'default' => '', + 'value' => '', + 'width' => '40', + 'maxlength' => '255' + ), + 'munin_password' => array( + 'datatype' => 'VARCHAR', + 'formtype' => 'TEXT', + 'default' => '', + 'value' => '', + 'width' => '40', + 'maxlength' => '255' + ), + 'monitor_system_updates' => array( + 'datatype' => 'VARCHAR', + 'formtype' => 'CHECKBOX', + 'default' => 'y', + 'value' => array(0 => 'n', 1 => 'y') + ), + 'log_retention' => array ( + 'datatype' => 'INTEGER', + 'formtype' => 'TEXT', + 'validators' => array ( 0 => array ( 'type' => 'ISPOSITIVE', + 'errmsg'=> 'log_retention_error_ispositive'), + ), + 'default' => '30', + 'value' => '', + 'width' => '4', + 'maxlength' => '4' + ), + 'migration_mode' => array( + 'datatype' => 'VARCHAR', + 'formtype' => 'CHECKBOX', + 'default' => 'n', + 'value' => array(0 => 'n', 1 => 'y') + ), + //################################# + // ENDE Datatable fields + //################################# + ) +); + +$form["tabs"]['mail'] = array( + 'title' => "Mail", + 'width' => 60, + 'template' => "templates/server_config_mail_edit.htm", + 'fields' => array( + //################################# + // Begin Datatable fields + //################################# + 'module' => array( + 'datatype' => 'VARCHAR', + 'formtype' => 'SELECT', + 'default' => '', + 'value' => array('postfix_mysql' => 'postfix_mysql') + ), + 'maildir_path' => array( + 'datatype' => 'VARCHAR', + 'formtype' => 'TEXT', + 'default' => '/home/vmail/[domain]/[localpart]/', + 'validators' => array( 0 => array('type' => 'NOTEMPTY', + 'errmsg' => 'maildir_path_error_empty'), + 1 => array ( 'type' => 'REGEX', + 'regex' => '/^\/[a-zA-Z0-9\.\-\_\/\[\]]{5,128}$/', + 'errmsg'=> 'maildir_path_error_regex'), + ), + 'value' => '', + 'width' => '40', + 'maxlength' => '255' + ), + 'maildir_format' => array( + 'datatype' => 'VARCHAR', + 'formtype' => 'SELECT', + 'default' => '20', + 'value' => array('maildir' => 'Maildir', 'mdbox' => 'mdbox') + ), + 'homedir_path' => array( + 'datatype' => 'VARCHAR', + 'formtype' => 'TEXT', + 'default' => '/home/vmail/', + 'validators' => array( 0 => array('type' => 'NOTEMPTY', + 'errmsg' => 'homedir_path_error_empty'), + 1 => array ( 'type' => 'REGEX', + 'regex' => '/^\/[a-zA-Z0-9\.\-\_\/]{5,128}$/', + 'errmsg'=> 'homedir_path_error_regex'), + ), + 'value' => '', + 'width' => '40', + 'maxlength' => '255' + ), + 'dkim_path' => array( + 'datatype' => 'VARCHAR', + 'formtype' => 'TEXT', + 'filters' => array( + 0 => array( 'event' => 'SAVE', + 'type' => 'STRIPTAGS'), + 1 => array( 'event' => 'SAVE', + 'type' => 'STRIPNL') + ), + 'default' => '/var/lib/amavis/dkim', + 'value' => '', + 'width' => '40', + 'maxlength' => '255' + ), + 'dkim_strength' => array( + 'datatype' => 'INTEGER', + 'formtype' => 'SELECT', + 'default' => '2048', + 'value' => array('1024' => 'weak (1024)', '2048' => 'normal (2048)', '4096' => 'strong (4096)') + ), + 'relayhost_password' => array( + 'datatype' => 'VARCHAR', + 'formtype' => 'TEXT', + 'default' => '', + 'value' => '', + 'width' => '40', + 'maxlength' => '255' + ), + + 'pop3_imap_daemon' => array( + 'datatype' => 'VARCHAR', + 'formtype' => 'SELECT', + 'default' => '20', + 'value' => array('courier' => 'Courier', 'dovecot' => 'Dovecot') + ), + 'mail_filter_syntax' => array( + 'datatype' => 'VARCHAR', + 'formtype' => 'SELECT', + 'default' => '20', + 'value' => array('maildrop' => 'Maildrop', 'sieve' => 'Sieve') + ), + 'mailuser_uid' => array( + 'datatype' => 'INTEGER', + 'formtype' => 'TEXT', + 'default' => '5000', + 'validators' => array( 0 => array('type' => 'NOTEMPTY', + 'errmsg' => 'mailuser_uid_error_empty'), + 1 => array('type' => 'RANGE', + 'range' => '1999:', + 'errmsg' => 'mailuser_uid_error_range'), + ), + 'value' => '', + 'width' => '10', + 'maxlength' => '255' + ), + 'mailuser_gid' => array( + 'datatype' => 'INTEGER', + 'formtype' => 'TEXT', + 'default' => '5000', + 'validators' => array( 0 => array('type' => 'NOTEMPTY', + 'errmsg' => 'mailuser_gid_error_empty'), + 1 => array('type' => 'RANGE', + 'range' => '1999:', + 'errmsg' => 'mailuser_gid_error_range'), + ), + 'value' => '', + 'width' => '10', + 'maxlength' => '255' + ), + 'mailuser_name' => array( + 'datatype' => 'VARCHAR', + 'formtype' => 'TEXT', + 'default' => 'vmail', + 'validators' => array( 0 => array('type' => 'NOTEMPTY', + 'errmsg' => 'mailuser_name_error_empty'), + 1 => array ( 'type' => 'REGEX', + 'regex' => '/^(?!ispconfig|root)([a-zA-Z0-9]{1,20})$/', + 'errmsg'=> 'mailuser_name_error_regex'), + ), + 'value' => '', + 'width' => '10', + 'maxlength' => '255' + ), + 'mailuser_group' => array( + 'datatype' => 'VARCHAR', + 'formtype' => 'TEXT', + 'default' => 'vmail', + 'validators' => array( 0 => array('type' => 'NOTEMPTY', + 'errmsg' => 'mailuser_group_error_empty'), + 1 => array ( 'type' => 'REGEX', + 'regex' => '/^(?!ispconfig|root)([a-zA-Z0-9]{1,20})$/', + 'errmsg'=> 'mailuser_group_name_error_regex'), + ), + 'value' => '', + 'width' => '10', + 'maxlength' => '255' + ), + 'mailbox_virtual_uidgid_maps' => array( + 'datatype' => 'VARCHAR', + 'formtype' => 'CHECKBOX', + 'validators' => array (0 => array ( 'type' => 'CUSTOM', + 'class' => 'validate_server_mail_config', + 'function' => 'mailbox_virtual_uidgid_maps'), + ), + 'default' => 'n', + 'value' => array(0 => 'n', 1 => 'y') + ), + 'relayhost' => array( + 'datatype' => 'VARCHAR', + 'formtype' => 'TEXT', + 'filters' => array( + 0 => array( 'event' => 'SAVE', + 'type' => 'STRIPTAGS'), + 1 => array( 'event' => 'SAVE', + 'type' => 'STRIPNL') + ), + 'default' => '', + 'value' => '', + 'width' => '40', + 'maxlength' => '255' + ), + 'relayhost_user' => array( + 'datatype' => 'VARCHAR', + 'formtype' => 'TEXT', + 'filters' => array( + 0 => array( 'event' => 'SAVE', + 'type' => 'STRIPTAGS'), + 1 => array( 'event' => 'SAVE', + 'type' => 'STRIPNL') + ), + 'default' => '', + 'value' => '', + 'width' => '40', + 'maxlength' => '255' + ), + 'relayhost_password' => array( + 'datatype' => 'VARCHAR', + 'formtype' => 'TEXT', + 'default' => '', + 'value' => '', + 'width' => '40', + 'maxlength' => '255' + ), + 'reject_sender_login_mismatch' => array ( + 'datatype' => 'VARCHAR', + 'formtype' => 'CHECKBOX', + 'default' => 'n', + 'value' => array(0 => 'n', 1 => 'y') + ), + 'mailbox_size_limit' => array( + 'datatype' => 'INTEGER', + 'formtype' => 'TEXT', + 'default' => '0', + 'value' => '', + 'width' => '10', + 'maxlength' => '15' + ), + 'message_size_limit' => array( + 'datatype' => 'INTEGER', + 'formtype' => 'TEXT', + 'default' => '0', + 'value' => '', + 'width' => '10', + 'maxlength' => '15' + ), + 'mailbox_quota_stats' => array ( + 'datatype' => 'VARCHAR', + 'formtype' => 'CHECKBOX', + 'default' => 'y', + 'value' => array(0 => 'n', 1 => 'y') + ), + 'realtime_blackhole_list' => array( + 'datatype' => 'VARCHAR', + 'formtype' => 'TEXT', + 'default' => '', + 'validators' => array ( 0 => array ( 'type' => 'REGEX', + 'regex' => '/^((([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]*[a-zA-Z0-9])\.)+([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\-]*[A-Za-z0-9])(,\s*(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]*[a-zA-Z0-9])\.)+([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\-]*[A-Za-z0-9]))*)?$/', + 'errmsg'=> 'rbl_error_regex'), + ), + 'value' => '', + 'width' => '40', + 'maxlength' => '255' + ), + 'overquota_notify_admin' => array( + 'datatype' => 'VARCHAR', + 'formtype' => 'CHECKBOX', + 'default' => 'y', + 'value' => array(0 => 'n', 1 => 'y') + ), + 'overquota_notify_client' => array( + 'datatype' => 'VARCHAR', + 'formtype' => 'CHECKBOX', + 'default' => 'y', + 'value' => array(0 => 'n', 1 => 'y') + ), + 'overquota_notify_freq' => array( + 'datatype' => 'INTEGER', + 'formtype' => 'TEXT', + 'default' => '7', + 'value' => '', + 'width' => '20', + 'maxlength' => '255' + ), + 'overquota_notify_onok' => array( + 'datatype' => 'VARCHAR', + 'formtype' => 'CHECKBOX', + 'default' => 'n', + 'value' => array(0 => 'n', 1 => 'y') + ), + //################################# + // ENDE Datatable fields + //################################# + ) +); + +$form["tabs"]['getmail'] = array( + 'title' => "Getmail", + 'width' => 80, + 'template' => "templates/server_config_getmail_edit.htm", + 'fields' => array( + //################################# + // Begin Datatable fields + //################################# + 'getmail_config_dir' => array( + 'datatype' => 'VARCHAR', + 'formtype' => 'TEXT', + 'default' => '', + 'validators' => array( 0 => array('type' => 'NOTEMPTY', + 'errmsg' => 'getmail_config_dir_error_empty'), + 1 => array ( 'type' => 'REGEX', + 'regex' => '/^\/[a-zA-Z0-9\.\-\_\/]{5,128}$/', + 'errmsg'=> 'getmail_config_dir_error_regex'), + ), + 'value' => '', + 'width' => '40', + 'maxlength' => '255' + ), + //################################# + // ENDE Datatable fields + //################################# + ) +); + +$form["tabs"]['web'] = array( + 'title' => "Web", + 'width' => 60, + 'template' => "templates/server_config_web_edit.htm", + 'fields' => array( + //################################# + // Begin Datatable fields + //################################# + 'server_type' => array( + 'datatype' => 'VARCHAR', + 'formtype' => 'SELECT', + 'default' => 'apache', + 'value' => array('apache' => 'Apache', 'nginx' => 'Nginx') + ), + 'website_basedir' => array( + 'datatype' => 'VARCHAR', + 'formtype' => 'TEXT', + 'default' => '', + 'validators' => array( 0 => array('type' => 'NOTEMPTY', + 'errmsg' => 'website_basedir_error_empty'), + 1 => array ( 'type' => 'REGEX', + 'regex' => '/^\/[a-zA-Z0-9\.\-\_\/]{5,128}$/', + 'errmsg'=> 'website_basedir_error_regex'), + ), + 'value' => '', + 'width' => '40', + 'maxlength' => '255' + ), + 'website_path' => array( + 'datatype' => 'VARCHAR', + 'formtype' => 'TEXT', + 'default' => '', + 'validators' => array( 0 => array( 'type' => 'NOTEMPTY', + 'errmsg' => 'website_path_error_empty'), + 1 => array ( 'type' => 'REGEX', + 'regex' => '/^\/[a-zA-Z0-9\.\-\_\/\[\]]{5,128}$/', + 'errmsg'=> 'website_path_error_regex'), + ), + 'value' => '', + 'width' => '40', + 'maxlength' => '255' + ), + 'website_symlinks' => array( + 'datatype' => 'VARCHAR', + 'formtype' => 'TEXT', + 'default' => '', + 'validators' => array( 0 => array('type' => 'NOTEMPTY', + 'errmsg' => 'website_symlinks_error_empty'), + 1 => array ( 'type' => 'REGEX', + 'regex' => '/^\/[a-zA-Z0-9\.\-\_\/\[\]\:]{5,128}$/', + 'errmsg'=> 'website_symlinks_error_regex'), + ), + 'value' => '', + 'width' => '40', + 'maxlength' => '255' + ), + 'website_symlinks_rel' => array ( + 'datatype' => 'VARCHAR', + 'formtype' => 'CHECKBOX', + 'default' => 'n', + 'value' => array(0 => 'n', 1 => 'y') + ), + 'network_filesystem' => array ( + 'datatype' => 'VARCHAR', + 'formtype' => 'CHECKBOX', + 'default' => 'n', + 'value' => array(0 => 'n', 1 => 'y') + ), + 'website_autoalias' => array( + 'datatype' => 'VARCHAR', + 'formtype' => 'TEXT', + 'filters' => array( + 0 => array( 'event' => 'SAVE', + 'type' => 'STRIPTAGS'), + 1 => array( 'event' => 'SAVE', + 'type' => 'STRIPNL') + ), + 'default' => '', + 'value' => '', + 'width' => '40', + 'maxlength' => '255' + ), + 'vhost_rewrite_v6' => array ( + 'datatype' => 'VARCHAR', + 'formtype' => 'CHECKBOX', + 'default' => 'n', + 'value' => array(0 => 'n',1 => 'y') + ), + 'vhost_conf_dir' => array( + 'datatype' => 'VARCHAR', + 'formtype' => 'TEXT', + 'default' => '', + 'validators' => array( 0 => array('type' => 'NOTEMPTY', + 'errmsg' => 'vhost_conf_dir_error_empty'), + 1 => array ( 'type' => 'REGEX', + 'regex' => '/^\/[a-zA-Z0-9\.\-\_\/]{5,128}$/', + 'errmsg'=> 'vhost_conf_dir_error_regex'), + ), + 'value' => '', + 'width' => '40', + 'maxlength' => '255' + ), + 'vhost_conf_enabled_dir' => array( + 'datatype' => 'VARCHAR', + 'formtype' => 'TEXT', + 'default' => '', + 'validators' => array( 0 => array('type' => 'NOTEMPTY', + 'errmsg' => 'vhost_conf_enabled_dir_error_empty'), + 1 => array ( 'type' => 'REGEX', + 'regex' => '/^\/[a-zA-Z0-9\.\-\_\/]{5,128}$/', + 'errmsg'=> 'vhost_conf_enabled_dir_error_regex'), + ), + 'value' => '', + 'width' => '40', + 'maxlength' => '255' + ), + 'nginx_enable_pagespeed' => array ( + 'datatype' => 'VARCHAR', + 'formtype' => 'CHECKBOX', + 'default' => 'n', + 'value' => array(0 => 'n',1 => 'y') + ), + 'nginx_vhost_conf_dir' => array( + 'datatype' => 'VARCHAR', + 'formtype' => 'TEXT', + 'default' => '', + 'validators' => array( 0 => array('type' => 'NOTEMPTY', + 'errmsg' => 'nginx_vhost_conf_dir_error_empty'), + 1 => array ( 'type' => 'REGEX', + 'regex' => '/^\/[a-zA-Z0-9\.\-\_\/]{5,128}$/', + 'errmsg'=> 'nginx_vhost_conf_dir_error_regex'), + ), + 'value' => '', + 'width' => '40', + 'maxlength' => '255' + ), + 'nginx_vhost_conf_enabled_dir' => array( + 'datatype' => 'VARCHAR', + 'formtype' => 'TEXT', + 'default' => '', + 'validators' => array( 0 => array('type' => 'NOTEMPTY', + 'errmsg' => 'nginx_vhost_conf_enabled_dir_error_empty'), + 1 => array ( 'type' => 'REGEX', + 'regex' => '/^\/[a-zA-Z0-9\.\-\_\/]{5,128}$/', + 'errmsg'=> 'nginx_vhost_conf_enabled_dir_error_regex'), + ), + 'value' => '', + 'width' => '40', + 'maxlength' => '255' + ), + 'CA_path' => array( + 'datatype' => 'VARCHAR', + 'formtype' => 'TEXT', + 'validators' => array( 0 => array ( 'type' => 'REGEX', + 'regex' => '/^[a-zA-Z0-9\.\-\_\/]{0,128}$/', + 'errmsg'=> 'ca_path_error_regex'), + ), + 'default' => '', + 'value' => '', + 'width' => '40', + 'maxlength' => '255' + ), + 'CA_pass' => array( + 'datatype' => 'VARCHAR', + 'formtype' => 'TEXT', + 'default' => '', + 'value' => '', + 'width' => '40', + 'maxlength' => '255' + ), + 'security_level' => array( + 'datatype' => 'VARCHAR', + 'formtype' => 'SELECT', + 'default' => '20', + 'value' => array('10' => 'Medium', '20' => 'High') + ), + 'set_folder_permissions_on_update' => array( + 'datatype' => 'VARCHAR', + 'formtype' => 'CHECKBOX', + 'default' => 'n', + 'value' => array(0 => 'n', 1 => 'y') + ), + 'web_folder_protection' => array( + 'datatype' => 'VARCHAR', + 'formtype' => 'CHECKBOX', + 'default' => 'y', + 'value' => array(0 => 'n', 1 => 'y') + ), + 'add_web_users_to_sshusers_group' => array( + 'datatype' => 'VARCHAR', + 'formtype' => 'CHECKBOX', + 'default' => 'y', + 'value' => array(0 => 'n', 1 => 'y') + ), + 'check_apache_config' => array( + 'datatype' => 'VARCHAR', + 'formtype' => 'CHECKBOX', + 'default' => 'y', + 'value' => array(0 => 'n', 1 => 'y') + ), + 'enable_sni' => array( + 'datatype' => 'VARCHAR', + 'formtype' => 'CHECKBOX', + 'default' => 'y', + 'value' => array(0 => 'n', 1 => 'y') + ), + 'enable_ip_wildcard' => array( + 'datatype' => 'VARCHAR', + 'formtype' => 'CHECKBOX', + 'default' => 'y', + 'value' => array(0 => 'n', 1 => 'y') + ), + 'logging' => array( + 'datatype' => 'VARCHAR', + 'formtype' => 'SELECT', + 'default' => 'yes', + 'value' => array('yes' => 'Yes', 'anon' => 'Anonymize IP', 'no' => 'No') + ), + 'overtraffic_notify_admin' => array( + 'datatype' => 'VARCHAR', + 'formtype' => 'CHECKBOX', + 'default' => 'y', + 'value' => array(0 => 'n', 1 => 'y') + ), + 'overtraffic_notify_client' => array( + 'datatype' => 'VARCHAR', + 'formtype' => 'CHECKBOX', + 'default' => 'y', + 'value' => array(0 => 'n', 1 => 'y') + ), + 'overquota_notify_admin' => array( + 'datatype' => 'VARCHAR', + 'formtype' => 'CHECKBOX', + 'default' => 'y', + 'value' => array(0 => 'n', 1 => 'y') + ), + 'overquota_notify_client' => array( + 'datatype' => 'VARCHAR', + 'formtype' => 'CHECKBOX', + 'default' => 'y', + 'value' => array(0 => 'n', 1 => 'y') + ), + 'overquota_db_notify_admin' => array( + 'datatype' => 'VARCHAR', + 'formtype' => 'CHECKBOX', + 'default' => 'y', + 'value' => array(0 => 'n', 1 => 'y') + ), + 'overquota_db_notify_client' => array( + 'datatype' => 'VARCHAR', + 'formtype' => 'CHECKBOX', + 'default' => 'y', + 'value' => array(0 => 'n', 1 => 'y') + ), + 'overquota_notify_freq' => array( + 'datatype' => 'INTEGER', + 'formtype' => 'TEXT', + 'default' => '7', + 'value' => '', + 'width' => '20', + 'maxlength' => '255' + ), + 'overquota_notify_onok' => array( + 'datatype' => 'VARCHAR', + 'formtype' => 'CHECKBOX', + 'default' => 'n', + 'value' => array(0 => 'n', 1 => 'y') + ), + 'user' => array( + 'datatype' => 'VARCHAR', + 'formtype' => 'TEXT', + 'default' => '', + 'validators' => array(0 => array('type' => 'NOTEMPTY', + 'errmsg' => 'apache_user_error_empty'), + 1 => array( + 'type' => 'CUSTOM', + 'class' => 'validate_systemuser', + 'function' => 'check_sysuser', + 'check_names' => false, + 'errmsg' => 'invalid_apache_user_txt' + ), + ), + 'value' => '', + 'width' => '40', + 'maxlength' => '255' + ), + 'group' => array( + 'datatype' => 'VARCHAR', + 'formtype' => 'TEXT', + 'default' => '', + 'validators' => array(0 => array('type' => 'NOTEMPTY', + 'errmsg' => 'apache_group_error_empty'), + 1 => array( + 'type' => 'CUSTOM', + 'class' => 'validate_systemuser', + 'function' => 'check_sysgroup', + 'check_names' => false, + 'errmsg' => 'invalid_apache_group_txt' + ), + ), + 'value' => '', + 'width' => '40', + 'maxlength' => '255' + ), + 'connect_userid_to_webid' => array( + 'datatype' => 'VARCHAR', + 'formtype' => 'CHECKBOX', + 'default' => 'n', + 'value' => array(0 => 'n', 1 => 'y') + ), + 'connect_userid_to_webid_start' => array( + 'datatype' => 'VARCHAR', + 'formtype' => 'TEXT', + 'default' => '10000', + 'validators' => array(0 => array('type' => 'ISINT', + 'errmsg' => 'connect_userid_to_webid_startid_isint'), + ), + 'value' => '', + 'width' => '40', + 'maxlength' => '255' + ), + 'nginx_user' => array( + 'datatype' => 'VARCHAR', + 'formtype' => 'TEXT', + 'default' => '', + 'validators' => array( 0 => array('type' => 'NOTEMPTY', + 'errmsg' => 'nginx_user_error_empty'), + 1 => array( + 'type' => 'CUSTOM', + 'class' => 'validate_systemuser', + 'function' => 'check_sysuser', + 'check_names' => false, + 'errmsg' => 'invalid_nginx_user_txt' + ), + ), + 'value' => '', + 'width' => '40', + 'maxlength' => '255' + ), + 'nginx_group' => array( + 'datatype' => 'VARCHAR', + 'formtype' => 'TEXT', + 'default' => '', + 'validators' => array( 0 => array('type' => 'NOTEMPTY', + 'errmsg' => 'nginx_group_error_empty'), + 1 => array( + 'type' => 'CUSTOM', + 'class' => 'validate_systemuser', + 'function' => 'check_sysgroup', + 'check_names' => false, + 'errmsg' => 'invalid_nginx_group_txt' + ), + ), + 'value' => '', + 'width' => '40', + 'maxlength' => '255' + ), + 'php_ini_path_apache' => array( + 'datatype' => 'VARCHAR', + 'formtype' => 'TEXT', + 'default' => '', + 'validators' => array( 0 => array('type' => 'NOTEMPTY', + 'errmsg' => 'php_ini_path_apache_error_empty'), + 1 => array ( 'type' => 'REGEX', + 'regex' => '/^\/[a-zA-Z0-9\.\-\_\/]{5,128}$/', + 'errmsg'=> 'php_ini_path_apache_error_regex'), + ), + 'value' => '', + 'width' => '40', + 'maxlength' => '255' + ), + 'php_ini_path_cgi' => array( + 'datatype' => 'VARCHAR', + 'formtype' => 'TEXT', + 'default' => '', + 'validators' => array( 0 => array('type' => 'NOTEMPTY', + 'errmsg' => 'php_ini_path_cgi_error_empty'), + 1 => array ( 'type' => 'REGEX', + 'regex' => '/^\/[a-zA-Z0-9\.\-\_\/]{5,128}$/', + 'errmsg'=> 'php_ini_path_cgi_error_regex'), + ), + 'value' => '', + 'width' => '40', + 'maxlength' => '255' + ), + 'php_default_name' => array( + 'datatype' => 'VARCHAR', + 'formtype' => 'TEXT', + 'default' => 'Default', + 'validators' => array( 0 => array('type' => 'NOTEMPTY', + 'errmsg' => 'php_default_name_error_empty'), + ), + 'filters' => array( + 0 => array( 'event' => 'SAVE', + 'type' => 'TRIM'), + 1 => array( 'event' => 'SAVE', + 'type' => 'STRIPTAGS'), + 2 => array( 'event' => 'SAVE', + 'type' => 'STRIPNL') + ), + 'width' => '40', + 'maxlength' => '255' + ), + 'php_fpm_init_script' => array( + 'datatype' => 'VARCHAR', + 'formtype' => 'TEXT', + 'default' => '', + 'validators' => array( 0 => array('type' => 'NOTEMPTY', + 'errmsg' => 'php_fpm_init_script_error_empty'), + 1 => array ( 'type' => 'REGEX', + 'regex' => '/^[a-zA-Z0-9\.\-\_]{1,128}$/', + 'errmsg'=> 'php_fpm_init_script_error_regex'), + ), + 'value' => '', + 'width' => '40', + 'maxlength' => '255' + ), + 'php_fpm_ini_path' => array( + 'datatype' => 'VARCHAR', + 'formtype' => 'TEXT', + 'default' => '', + 'validators' => array( 0 => array('type' => 'NOTEMPTY', + 'errmsg' => 'php_fpm_ini_path_error_empty'), + 1 => array ( 'type' => 'REGEX', + 'regex' => '/^\/[a-zA-Z0-9\.\-\_\/]{5,128}$/', + 'errmsg'=> 'php_fpm_ini_path_error_regex'), + ), + 'value' => '', + 'width' => '40', + 'maxlength' => '255' + ), + 'php_fpm_pool_dir' => array( + 'datatype' => 'VARCHAR', + 'formtype' => 'TEXT', + 'default' => '', + 'validators' => array( 0 => array('type' => 'NOTEMPTY', + 'errmsg' => 'php_fpm_pool_dir_error_empty'), + 1 => array ( 'type' => 'REGEX', + 'regex' => '/^\/[a-zA-Z0-9\.\-\_\/]{5,128}$/', + 'errmsg'=> 'php_fpm_pool_dir_error_regex'), + ), + 'value' => '', + 'width' => '40', + 'maxlength' => '255' + ), + 'php_fpm_start_port' => array( + 'datatype' => 'VARCHAR', + 'formtype' => 'TEXT', + 'default' => '', + 'validators' => array(0 => array('type' => 'ISPOSITIVE', + 'errmsg' => 'php_fpm_start_port_error_empty'), + ), + 'value' => '', + 'width' => '40', + 'maxlength' => '255' + ), + 'php_fpm_socket_dir' => array( + 'datatype' => 'VARCHAR', + 'formtype' => 'TEXT', + 'default' => '', + 'validators' => array( 0 => array('type' => 'NOTEMPTY', + 'errmsg' => 'php_fpm_socket_dir_error_empty'), + 1 => array ( 'type' => 'REGEX', + 'regex' => '/^\/[a-zA-Z0-9\.\-\_\/]{5,128}$/', + 'errmsg'=> 'php_fpm_socket_dir_error_regex'), + ), + 'value' => '', + 'width' => '40', + 'maxlength' => '255' + ), + 'php_open_basedir' => array( + 'datatype' => 'VARCHAR', + 'formtype' => 'TEXT', + 'default' => '', + 'validators' => array( 0 => array('type' => 'NOTEMPTY', + 'errmsg' => 'php_open_basedir_error_empty'), + 1 => array ( 'type' => 'REGEX', + 'regex' => '/^[a-zA-Z0-9\.\-\_\/\]\[\:]{1,}$/', + 'errmsg'=> 'php_open_basedir_error_regex'), + ), + 'value' => '', + 'width' => '40', + 'maxlength' => '4000' + ), + 'php_ini_check_minutes' => array( + 'datatype' => 'INTEGER', + 'formtype' => 'TEXT', + 'default' => '1', + 'validators' => array(0 => array('type' => 'NOTEMPTY', + 'errmsg' => 'php_ini_check_minutes_error_empty'), + ), + 'value' => '', + 'width' => '10', + 'maxlength' => '255' + ), + 'php_handler' => array( + 'datatype' => 'VARCHAR', + 'formtype' => 'SELECT', + 'default' => 'fast-cgi', + 'value' => array('no' => 'disabled_txt', 'fast-cgi' => 'Fast-CGI', 'cgi' => 'CGI', 'mod' => 'Mod-PHP', 'suphp' => 'SuPHP', 'php-fpm' => 'PHP-FPM', 'hhvm' => 'HHVM'), + 'searchable' => 2 + ), + 'php_fpm_incron_reload' => array( + 'datatype' => 'VARCHAR', + 'formtype' => 'CHECKBOX', + 'default' => 'y', + 'value' => array(0 => 'n', 1 => 'y') + ), + 'nginx_cgi_socket' => array( + 'datatype' => 'VARCHAR', + 'formtype' => 'TEXT', + 'default' => '', + 'validators' => array( 0 => array('type' => 'NOTEMPTY', + 'errmsg' => 'nginx_cgi_socket_empty'), + 1 => array ( 'type' => 'REGEX', + 'regex' => '/^\/[a-zA-Z0-9\.\-\_\/]{1,128}$/', + 'errmsg'=> 'nginx_cgi_socket_error_regex'), + ), + 'value' => '', + 'width' => '40', + 'maxlength' => '255' + ), + 'htaccess_allow_override' => array( + 'datatype' => 'VARCHAR', + 'formtype' => 'TEXT', + 'default' => '', + 'validators' => array( 0 => array('type' => 'NOTEMPTY', + 'errmsg' => 'htaccess_allow_override_error_empty'), + ), + 'filters' => array( + 0 => array( 'event' => 'SAVE', + 'type' => 'STRIPTAGS'), + 1 => array( 'event' => 'SAVE', + 'type' => 'STRIPNL') + ), + 'value' => '', + 'width' => '40', + 'maxlength' => '255' + ), + 'enable_spdy' => array ( + 'datatype' => 'VARCHAR', + 'formtype' => 'CHECKBOX', + 'default' => 'y', + 'value' => array ( + 0 => 'n', + 1 => 'y' + ) + ), + 'apps_vhost_enabled' => array ( + 'datatype' => 'VARCHAR', + 'formtype' => 'CHECKBOX', + 'default' => 'y', + 'value' => array (0 => 'n', 1 => 'y') + ), + 'apps_vhost_port' => array( + 'datatype' => 'VARCHAR', + 'formtype' => 'TEXT', + 'default' => '8081', + 'validators' => array(0 => array('type' => 'NOTEMPTY', + 'errmsg' => 'apps_vhost_port_error_empty'), + ), + 'filters' => array( + 0 => array( 'event' => 'SAVE', + 'type' => 'STRIPTAGS'), + 1 => array( 'event' => 'SAVE', + 'type' => 'STRIPNL') + ), + 'value' => '', + 'width' => '40', + 'maxlength' => '255' + ), + 'apps_vhost_ip' => array( + 'datatype' => 'VARCHAR', + 'formtype' => 'TEXT', + 'default' => '_default_', + 'validators' => array(0 => array('type' => 'NOTEMPTY', + 'errmsg' => 'apps_vhost_ip_error_empty'), + ), + 'filters' => array( + 0 => array( 'event' => 'SAVE', + 'type' => 'STRIPTAGS'), + 1 => array( 'event' => 'SAVE', + 'type' => 'STRIPNL') + ), + 'value' => '', + 'width' => '40', + 'maxlength' => '255' + ), + 'apps_vhost_servername' => array( + 'datatype' => 'VARCHAR', + 'formtype' => 'TEXT', + 'filters' => array( + 0 => array( 'event' => 'SAVE', + 'type' => 'STRIPTAGS'), + 1 => array( 'event' => 'SAVE', + 'type' => 'STRIPNL') + ), + 'default' => '', + 'value' => '', + 'width' => '40', + 'maxlength' => '255' + ), + 'awstats_conf_dir' => array( + 'datatype' => 'VARCHAR', + 'formtype' => 'TEXT', + 'filters' => array( + 0 => array( 'event' => 'SAVE', + 'type' => 'STRIPTAGS'), + 1 => array( 'event' => 'SAVE', + 'type' => 'STRIPNL') + ), + 'default' => '', + 'value' => '', + 'width' => '40', + 'maxlength' => '255' + ), + 'awstats_data_dir' => array( + 'datatype' => 'VARCHAR', + 'formtype' => 'TEXT', + 'validators' => array( 0 => array('type' => 'NOTEMPTY', + 'errmsg' => 'awstats_data_dir_empty'), + 1 => array ( 'type' => 'REGEX', + 'regex' => '/^\/[a-zA-Z0-9\.\-\_\/]{1,128}$/', + 'errmsg'=> 'awstats_data_dir_error_regex'), + ), + 'default' => '', + 'value' => '', + 'width' => '40', + 'maxlength' => '255' + ), + 'awstats_pl' => array( + 'datatype' => 'VARCHAR', + 'formtype' => 'TEXT', + 'validators' => array( 0 => array('type' => 'NOTEMPTY', + 'errmsg' => 'awstats_pl_empty'), + 1 => array ( 'type' => 'REGEX', + 'regex' => '/^\/[a-zA-Z0-9\.\-\_\/]{1,128}$/', + 'errmsg'=> 'awstats_pl_error_regex'), + ), + 'default' => '', + 'value' => '', + 'width' => '40', + 'maxlength' => '255' + ), + 'awstats_buildstaticpages_pl' => array( + 'datatype' => 'VARCHAR', + 'formtype' => 'TEXT', + 'validators' => array( 0 => array('type' => 'NOTEMPTY', + 'errmsg' => 'awstats_buildstaticpages_pl_empty'), + 1 => array ( 'type' => 'REGEX', + 'regex' => '/^\/[a-zA-Z0-9\.\-\_\/]{1,128}$/', + 'errmsg'=> 'awstats_buildstaticpages_pl_error_regex'), + ), + 'default' => '', + 'value' => '', + 'width' => '40', + 'maxlength' => '255' + ), + 'skip_le_check' => array ( + 'datatype' => 'VARCHAR', + 'formtype' => 'CHECKBOX', + 'default' => 'n', + 'value' => array ( + 0 => 'n', + 1 => 'y' + ) + ), + 'php_fpm_reload_mode' => array( + 'datatype' => 'VARCHAR', + 'formtype' => 'SELECT', + 'default' => 'reload', + 'value' => array('reload' => 'Reload', 'restart' => 'Restart'), + 'width' => '40', + 'maxlength' => '255' + ), + //################################# + // ENDE Datatable fields + //################################# + ) +); + +$form["tabs"]['dns'] = array( + 'title' => "DNS", + 'width' => 60, + 'template' => "templates/server_config_dns_edit.htm", + 'fields' => array( + //################################# + // Begin Datatable fields + //################################# + 'bind_user' => array( + 'datatype' => 'VARCHAR', + 'formtype' => 'TEXT', + 'default' => '', + 'validators' => array( 0 => array('type' => 'NOTEMPTY', + 'errmsg' => 'bind_user_error_empty'), + 1 => array ( 'type' => 'REGEX', + 'regex' => '/^(?!ispconfig)([a-zA-Z0-9]{1,20})$/', + 'errmsg'=> 'invalid_bind_user_txt'), + ), + 'value' => '', + 'width' => '40', + 'maxlength' => '255' + ), + 'bind_group' => array( + 'datatype' => 'VARCHAR', + 'formtype' => 'TEXT', + 'default' => '', + 'validators' => array( 0 => array('type' => 'NOTEMPTY', + 'errmsg' => 'bind_group_error_empty'), + 1 => array ( 'type' => 'REGEX', + 'regex' => '/^(?!ispconfig)([a-zA-Z0-9]{1,20})$/', + 'errmsg'=> 'invalid_bind_group_txt'), + ), + 'value' => '', + 'width' => '40', + 'maxlength' => '255' + ), + 'bind_zonefiles_dir' => array( + 'datatype' => 'VARCHAR', + 'formtype' => 'TEXT', + 'default' => '', + 'validators' => array( 0 => array('type' => 'NOTEMPTY', + 'errmsg' => 'bind_zonefiles_dir_error_empty'), + 1 => array ( 'type' => 'REGEX', + 'regex' => '/^\/[a-zA-Z0-9\.\-\_\/]{1,128}$/', + 'errmsg'=> 'bind_zonefiles_dir_error_regex'), + ), + 'value' => '', + 'width' => '40', + 'maxlength' => '255' + ), + 'named_conf_path' => array( + 'datatype' => 'VARCHAR', + 'formtype' => 'TEXT', + 'default' => '', + 'validators' => array( 0 => array('type' => 'NOTEMPTY', + 'errmsg' => 'named_conf_path_error_empty'), + 1 => array ( 'type' => 'REGEX', + 'regex' => '/^\/[a-zA-Z0-9\.\-\_\/]{1,128}$/', + 'errmsg'=> 'named_conf_path_error_regex'), + ), + 'value' => '', + 'width' => '40', + 'maxlength' => '255' + ), + 'named_conf_local_path' => array( + 'datatype' => 'VARCHAR', + 'formtype' => 'TEXT', + 'default' => '', + 'validators' => array( 0 => array('type' => 'NOTEMPTY', + 'errmsg' => 'named_conf_local_path_error_empty'), + 1 => array ( 'type' => 'REGEX', + 'regex' => '/^\/[a-zA-Z0-9\.\-\_\/]{1,128}$/', + 'errmsg'=> 'named_conf_local_path_error_regex'), + ), + 'value' => '', + 'width' => '40', + 'maxlength' => '255' + ), + 'disable_bind_log' => array ( + 'datatype' => 'VARCHAR', + 'formtype' => 'CHECKBOX', + 'default' => 'n', + 'value' => array(0 => 'n', 1 => 'y') + ), + //################################# + // ENDE Datatable fields + //################################# + ) +); + +$form["tabs"]['fastcgi'] = array( + 'title' => "FastCGI", + 'width' => 80, + 'template' => "templates/server_config_fastcgi_edit.htm", + 'fields' => array( + //################################# + // Begin Datatable fields + //################################# + 'fastcgi_starter_path' => array( + 'datatype' => 'VARCHAR', + 'formtype' => 'TEXT', + 'default' => '', + 'validators' => array( 0 => array('type' => 'NOTEMPTY', + 'errmsg' => 'fastcgi_starter_path_error_empty'), + 1 => array ( 'type' => 'REGEX', + 'regex' => '/^\/[a-zA-Z0-9\.\-\_\/\[\]]{1,128}$/', + 'errmsg'=> 'fastcgi_starter_path_error_regex'), + ), + 'value' => '', + 'width' => '40', + 'maxlength' => '255' + ), + 'fastcgi_starter_script' => array( + 'datatype' => 'VARCHAR', + 'formtype' => 'TEXT', + 'default' => '', + 'validators' => array( 0 => array('type' => 'NOTEMPTY', + 'errmsg' => 'fastcgi_starter_script_error_empty'), + 1 => array ( 'type' => 'REGEX', + 'regex' => '/^[a-zA-Z0-9\.\-\_\/]{1,128}$/', + 'errmsg'=> 'fastcgi_starter_script_error_regex'), + ), + 'value' => '', + 'width' => '40', + 'maxlength' => '255' + ), + 'fastcgi_alias' => array( + 'datatype' => 'VARCHAR', + 'formtype' => 'TEXT', + 'default' => '', + 'validators' => array( 0 => array('type' => 'NOTEMPTY', + 'errmsg' => 'fastcgi_alias_error_empty'), + 1 => array ( 'type' => 'REGEX', + 'regex' => '/^[a-zA-Z0-9\.\-\_\/]{1,128}$/', + 'errmsg'=> 'fastcgi_alias_error_regex'), + ), + 'value' => '', + 'width' => '40', + 'maxlength' => '255' + ), + 'fastcgi_phpini_path' => array( + 'datatype' => 'VARCHAR', + 'formtype' => 'TEXT', + 'default' => '', + 'validators' => array( 0 => array('type' => 'NOTEMPTY', + 'errmsg' => 'fastcgi_phpini_path_error_empty'), + 1 => array ( 'type' => 'REGEX', + 'regex' => '/^\/[a-zA-Z0-9\.\-\_\/\[\]]{1,128}$/', + 'errmsg'=> 'fastcgi_phpini_path_error_regex'), + ), + 'value' => '', + 'width' => '40', + 'maxlength' => '255' + ), + 'fastcgi_children' => array( + 'datatype' => 'VARCHAR', + 'formtype' => 'TEXT', + 'default' => '', + 'validators' => array(0 => array('type' => 'ISPOSITIVE', + 'errmsg' => 'fastcgi_children_error_empty'), + ), + 'value' => '', + 'width' => '40', + 'maxlength' => '255' + ), + 'fastcgi_max_requests' => array( + 'datatype' => 'VARCHAR', + 'formtype' => 'TEXT', + 'default' => '', + 'validators' => array( 0 => array( 'type' => 'ISINT', + 'errmsg' => 'fastcgi_max_requests_error_empty'), + 1 => array( 'type' => 'RANGE', + 'range' => '0:', + 'errmsg' => 'fastcgi_max_requests_error_empty'), + ), + 'value' => '', + 'width' => '40', + 'maxlength' => '255' + ), + 'fastcgi_bin' => array( + 'datatype' => 'VARCHAR', + 'formtype' => 'TEXT', + 'default' => '', + 'validators' => array( 0 => array('type' => 'NOTEMPTY', + 'errmsg' => 'fastcgi_bin_error_empty'), + 1 => array ( 'type' => 'REGEX', + 'regex' => '/^\/[a-zA-Z0-9\.\-\_\/\[\]]{1,128}$/', + 'errmsg'=> 'fastcgi_bin_error_regex'), + ), + 'value' => '', + 'width' => '40', + 'maxlength' => '255' + ), + 'fastcgi_config_syntax' => array( + 'datatype' => 'INTEGER', + 'formtype' => 'SELECT', + 'default' => '2', + 'value' => array('1' => 'Old (apache 2.0)', '2' => 'New (apache 2.2)'), + 'width' => '40', + 'maxlength' => '255' + ), + //################################# + // ENDE Datatable fields + //################################# + ) +); + + +$form["tabs"]['xmpp'] = array( + 'title' => "XMPP", + 'width' => 80, + 'template' => "templates/server_config_xmpp_edit.htm", + 'fields' => array( + //################################# + // Begin Datatable fields + //################################# + 'xmpp_use_ipv6' => array( + 'datatype' => 'VARCHAR', + 'formtype' => 'CHECKBOX', + 'default' => 'n', + 'value' => array(0 => 'n', 1 => 'y') + ), + 'xmpp_bosh_max_inactivity' => array( + 'datatype' => 'VARCHAR', + 'formtype' => 'TEXT', + 'default' => '30', + 'validators' => array(0 => array('type' => 'ISINT', + 'errmsg' => 'ip_address_error_wrong'), + array('type'=>'RANGE', 'range'=>'15:360', 'errmsg' => 'xmpp_bosh_timeout_range_wrong') + ), + 'value' => '', + 'width' => '15' + ), + + 'xmpp_server_admins' => array( + 'datatype' => 'VARCHAR', + 'formtype' => 'TEXT', + 'filters' => array( + 0 => array( 'event' => 'SAVE', + 'type' => 'STRIPTAGS'), + 1 => array( 'event' => 'SAVE', + 'type' => 'STRIPNL') + ), + 'default' => 'admin@service.com, superuser@service.com', + 'value' => '', + 'width' => '15' + ), + + 'xmpp_modules_enabled' => array( + 'datatype' => 'TEXT', + 'formtype' => 'TEXT', + 'filters' => array( + 0 => array( 'event' => 'SAVE', + 'type' => 'STRIPTAGS'), + 1 => array( 'event' => 'SAVE', + 'type' => 'STRIPNL') + ), + 'default' => "saslauth, tls, dialback, disco, discoitems, version, uptime, time, ping, admin_adhoc, admin_telnet, bosh, posix, announce, offline, webpresence, mam, stream_management, message_carbons", + 'value' => '', + 'separator' => "," + ), + + 'xmpp_port_http' => array( + 'datatype' => 'VARCHAR', + 'formtype' => 'TEXT', + 'default' => '5290', + 'validators' => array(0 => array('type' => 'ISINT')), + 'value' => '5290', + 'width' => '15' + ), + 'xmpp_port_https' => array( + 'datatype' => 'VARCHAR', + 'formtype' => 'TEXT', + 'default' => '5291', + 'validators' => array(0 => array('type' => 'ISINT')), + 'value' => '5291', + 'width' => '15' + ), + 'xmpp_port_pastebin' => array( + 'datatype' => 'VARCHAR', + 'formtype' => 'TEXT', + 'default' => '5292', + 'validators' => array(0 => array('type' => 'ISINT')), + 'value' => '5292', + 'width' => '15' + ), + 'xmpp_port_bosh' => array( + 'datatype' => 'VARCHAR', + 'formtype' => 'TEXT', + 'default' => '5280', + 'validators' => array(0 => array('type' => 'ISINT')), + 'value' => '5280', + 'width' => '15' + ), + //################################# + // ENDE Datatable fields + //################################# + ) +); + +$form["tabs"]['jailkit'] = array( + 'title' => "Jailkit", + 'width' => 80, + 'template' => "templates/server_config_jailkit_edit.htm", + 'fields' => array( + //################################# + // Begin Datatable fields + //################################# + 'jailkit_chroot_home' => array( + 'datatype' => 'VARCHAR', + 'formtype' => 'TEXT', + 'default' => '', + 'validators' => array( 0 => array('type' => 'NOTEMPTY', + 'errmsg' => 'jailkit_chroot_home_error_empty'), + 1 => array ( 'type' => 'REGEX', + 'regex' => '/^\/[a-zA-Z0-9\.\-\_\/\[\]]{1,128}$/', + 'errmsg'=> 'jailkit_chroot_home_error_regex'), + ), + 'value' => '', + 'width' => '40', + 'maxlength' => '255' + ), + 'jailkit_chroot_app_sections' => array( + 'datatype' => 'VARCHAR', + 'formtype' => 'TEXT', + 'default' => '', + 'validators' => array( 0 => array('type' => 'NOTEMPTY', + 'errmsg' => 'jailkit_chroot_app_sections_error_empty'), + 1 => array ( 'type' => 'REGEX', + 'regex' => '/^[a-zA-Z0-9\-\_\ ]{1,128}$/', + 'errmsg'=> 'jailkit_chroot_app_sections_error_regex'), + ), + 'value' => '', + 'width' => '40', + 'maxlength' => '1000' + ), + 'jailkit_chroot_app_programs' => array( + 'datatype' => 'VARCHAR', + 'formtype' => 'TEXT', + 'default' => '', + 'validators' => array( 0 => array('type' => 'NOTEMPTY', + 'errmsg' => 'jailkit_chroot_app_programs_error_empty'), + 1 => array ( 'type' => 'REGEX', + 'regex' => '/^[a-zA-Z0-9\.\-\_\/\ ]{1,}$/', + 'errmsg'=> 'jailkit_chroot_app_programs_error_regex'), + ), + 'value' => '', + 'width' => '40', + 'maxlength' => '1000' + ), + 'jailkit_chroot_cron_programs' => array( + 'datatype' => 'VARCHAR', + 'formtype' => 'TEXT', + 'default' => '', + 'validators' => array( 0 => array('type' => 'NOTEMPTY', + 'errmsg' => 'jailkit_chroot_cron_programs_error_empty'), + 1 => array ( 'type' => 'REGEX', + 'regex' => '/^[a-zA-Z0-9\.\-\_\/\ ]{1,}$/', + 'errmsg'=> 'jailkit_chroot_cron_programs_error_regex'), + ), + 'value' => '', + 'width' => '40', + 'maxlength' => '1000' + ), + //################################# + // ENDE Datatable fields + //################################# + ) +); + +/* +$form["tabs"]['ufw_firewall'] = array ( + 'title' => "UFW Firewall", + 'width' => 80, + 'template' => "templates/server_config_ufw_edit.htm", + 'fields' => array ( + ################################## + # Begin Datatable fields + ################################## + 'ufw_enable' => array ( + 'datatype' => 'VARCHAR', + 'formtype' => 'CHECKBOX', + 'default' => 'no', + 'value' => array(0 => 'no',1 => 'yes') + ), + 'ufw_manage_builtins' => array ( + 'datatype' => 'VARCHAR', + 'formtype' => 'CHECKBOX', + 'default' => 'no', + 'value' => array(0 => 'no',1 => 'yes') + ), + 'ufw_ipv6' => array ( + 'datatype' => 'VARCHAR', + 'formtype' => 'CHECKBOX', + 'default' => 'no', + 'value' => array(0 => 'no',1 => 'yes') + ), + 'ufw_default_input_policy' => array ( + 'datatype' => 'VARCHAR', + 'formtype' => 'SELECT', + 'default' => 'ACCEPT', + 'value' => array('ACCEPT' => 'accept', 'DROP' => 'drop', 'REJECT' => 'reject') + ), + 'ufw_default_output_policy' => array ( + 'datatype' => 'VARCHAR', + 'formtype' => 'SELECT', + 'default' => 'ACCEPT', + 'value' => array('ACCEPT' => 'accept', 'DROP' => 'drop', 'REJECT' => 'reject') + ), + 'ufw_default_forward_policy' => array ( + 'datatype' => 'VARCHAR', + 'formtype' => 'SELECT', + 'default' => 'ACCEPT', + 'value' => array('ACCEPT' => 'accept', 'DROP' => 'drop', 'REJECT' => 'reject') + ), + 'ufw_default_application_policy' => array ( + 'datatype' => 'VARCHAR', + 'formtype' => 'SELECT', + 'default' => 'DROP', + 'value' => array('ACCEPT' => 'accept', 'DROP' => 'drop', 'REJECT' => 'reject') + ), + 'ufw_log_level' => array ( + 'datatype' => 'VARCHAR', + 'formtype' => 'SELECT', + 'default' => 'low', + 'value' => array('low' => 'low', 'medium' => 'medium', 'high' => 'high') + ) + ################################## + # ENDE Datatable fields + ################################## + ) +); +*/ + +$form["tabs"]['vlogger'] = array( + 'title' => "vlogger", + 'width' => 80, + 'template' => "templates/server_config_vlogger_edit.htm", + 'fields' => array( + //################################# + // Begin Datatable fields + //################################# + 'config_dir' => array( + 'datatype' => 'VARCHAR', + 'formtype' => 'TEXT', + 'default' => '', + 'validators' => array( 0 => array('type' => 'NOTEMPTY', + 'errmsg' => 'vlogger_config_dir_error_empty'), + 1 => array ( 'type' => 'REGEX', + 'regex' => '/^\/[a-zA-Z0-9\.\-\_\/]{1,128}$/', + 'errmsg'=> 'vlogger_config_dir_error_regex'), + ), + 'value' => '', + 'width' => '40', + 'maxlength' => '255' + ), + //################################# + // ENDE Datatable fields + //################################# + ) +); + + + +$form["tabs"]['cron'] = array( + 'title' => "Cron", + 'width' => 80, + 'template' => "templates/server_config_cron_edit.htm", + 'fields' => array( + //################################# + // Begin Datatable fields + //################################# + 'init_script' => array( + 'datatype' => 'VARCHAR', + 'formtype' => 'TEXT', + 'default' => '', + 'validators' => array( 0 => array('type' => 'NOTEMPTY', + 'errmsg' => 'cron_init_script_error_empty'), + 1 => array ( 'type' => 'REGEX', + 'regex' => '/^[a-zA-Z0-9\-\_]{1,30}$/', + 'errmsg'=> 'cron_init_script_error_regex'), + ), + 'value' => '', + 'width' => '40', + 'maxlength' => '255' + ), + 'crontab_dir' => array( + 'datatype' => 'VARCHAR', + 'formtype' => 'TEXT', + 'default' => '', + 'validators' => array( 0 => array('type' => 'NOTEMPTY', + 'errmsg' => 'crontab_dir_error_empty'), + 1 => array ( 'type' => 'REGEX', + 'regex' => '/^\/[a-zA-Z0-9\.\-\_\/]{1,128}$/', + 'errmsg'=> 'crontab_dir_error_regex'), + ), + 'value' => '', + 'width' => '40', + 'maxlength' => '255' + ), + 'wget' => array( + 'datatype' => 'VARCHAR', + 'formtype' => 'TEXT', + 'default' => '', + 'validators' => array( 0 => array('type' => 'NOTEMPTY', + 'errmsg' => 'cron_wget_error_empty'), + 1 => array ( 'type' => 'REGEX', + 'regex' => '/^\/[a-zA-Z0-9\.\-\_\/]{1,128}$/', + 'errmsg'=> 'cron_wget_error_regex'), + ), + 'value' => '', + 'width' => '40', + 'maxlength' => '255' + ), + //################################# + // ENDE Datatable fields + //################################# + ) +); + +$form["tabs"]['rescue'] = array( + 'title' => "Rescue", + 'width' => 80, + 'template' => "templates/server_config_rescue_edit.htm", + 'fields' => array( + //################################# + // Begin Datatable fields + //################################# + 'try_rescue' => array( + 'datatype' => 'VARCHAR', + 'formtype' => 'CHECKBOX', + 'default' => 'n', + 'value' => array(0 => 'n', 1 => 'y') + ), + 'do_not_try_rescue_httpd' => array( + 'datatype' => 'VARCHAR', + 'formtype' => 'CHECKBOX', + 'default' => 'n', + 'value' => array(0 => 'n', 1 => 'y') + ), + 'do_not_try_rescue_mongodb' => array( + 'datatype' => 'VARCHAR', + 'formtype' => 'CHECKBOX', + 'default' => 'n', + 'value' => array(0 => 'n', 1 => 'y') + ), + 'do_not_try_rescue_mysql' => array( + 'datatype' => 'VARCHAR', + 'formtype' => 'CHECKBOX', + 'default' => 'n', + 'value' => array(0 => 'n', 1 => 'y') + ), + 'do_not_try_rescue_mail' => array( + 'datatype' => 'VARCHAR', + 'formtype' => 'CHECKBOX', + 'default' => 'n', + 'value' => array(0 => 'n', 1 => 'y') + ), + //################################# + // ENDE Datatable fields + //################################# + ) +); +?> diff --git a/interface/web/admin/lib/lang/de_server_config.lng b/interface/web/admin/lib/lang/de_server_config.lng index 108bf96de8799eab514ed5e6940a07fbe7308396..50b3514564aece2b8b16c1a54dad6e4893b9896c 100644 --- a/interface/web/admin/lib/lang/de_server_config.lng +++ b/interface/web/admin/lib/lang/de_server_config.lng @@ -296,4 +296,7 @@ $wb['php_default_name_txt'] = 'Beschreibung Standard PHP'; $wb['php_default_name_error_empty'] = 'Beschreibung Standard PHP ist leer.'; $wb['error_mailbox_message_size_txt'] = 'Mailboxgröße muss gleich oder größer als max. Nachrichtengröße sein.'; $wb['php_fpm_reload_mode_txt'] = 'PHP-FPM reload Modus'; -?> +$wb['content_filter_txt'] = 'Content-Filter'; +$wb['rspamd_url_txt'] = 'Rspamd-URL'; +$wb['rspamd_user_txt'] = 'Rspamd-Benutzer'; +$wb['rspamd_password_txt'] = 'Rspamd-Passwort'; \ No newline at end of file diff --git a/interface/web/admin/lib/lang/de_server_config.lng.orig b/interface/web/admin/lib/lang/de_server_config.lng.orig new file mode 100644 index 0000000000000000000000000000000000000000..108bf96de8799eab514ed5e6940a07fbe7308396 --- /dev/null +++ b/interface/web/admin/lib/lang/de_server_config.lng.orig @@ -0,0 +1,299 @@ +Information: Falls Sie MySQL stoppen möchten, wählen Sie die Funktion \'Deaktiviere MySQL Monitoring\' und warten Sie 2 bis 3 Minuten. Wenn Sie nicht 2 bis 3 Minuten warten wird ISPConfig versuchen MySQL wieder zu starten.'; +$wb['enable_sni_txt'] = 'Aktiviere SNI'; +$wb['set_folder_permissions_on_update_txt'] = 'Verzeichnisberechtigungen beim Update setzen'; +$wb['add_web_users_to_sshusers_group_txt'] = 'Webbenutzer zur -sshusers- hinzufügen'; +$wb['connect_userid_to_webid_txt'] = 'Linux Userid mit webid verknüpfen'; +$wb['connect_userid_to_webid_start_txt'] = 'Start ID für userid/webid Verknüpfung'; +$wb['realtime_blackhole_list_txt'] = 'Realtime Blackhole Liste'; +$wb['realtime_blackhole_list_note_txt'] = '(Mehrere Realtime Blackhole Listen mit Kommas trennen)'; +$wb['ssl_settings_txt'] = 'SSL Einstellungen'; +$wb['permissions_txt'] = 'Berechtigungen'; +$wb['php_settings_txt'] = 'PHP Einstellungen'; +$wb['apps_vhost_settings_txt'] = 'Apps vHost Einstellungen'; +$wb['awstats_settings_txt'] = 'AWStats Einstellungen'; +$wb['backup_mode_txt'] = 'Backupmodus'; +$wb['backup_mode_userzip'] = 'Backup Dateien gehören dem Web Benutzer (.zip Datei)'; +$wb['backup_mode_rootgz'] = 'Backup aller Dateien des Webverzeichnisses als Root Benutzer'; +$wb['backup_time_txt'] = 'Backupzeit'; +$wb['firewall_txt'] = 'Firewall'; +$wb['mailbox_quota_stats_txt'] = 'E-Mailkonto Beschränkung Statistiken'; +$wb['enable_ip_wildcard_txt'] = 'IP Adressen Wildcard (*) aktivieren'; +$wb['web_folder_protection_txt'] = 'Webverzeichnis unveränderlich machen (erweiterte Attribute)'; +$wb['overtraffic_notify_admin_txt'] = 'Überschreiten des Datentransfer Limits an den Administrator senden'; +$wb['overtraffic_notify_client_txt'] = 'Überschreiten des Datentransfer Limits an den Kunden senden'; +$wb['rbl_error_regex'] = 'Bitte geben Sie gültige RBL-Hostnamen an.'; +$wb['overquota_notify_admin_txt'] = 'Quota-Warnungen an den Administrator senden'; +$wb['overquota_notify_client_txt'] = 'Quota-Warnungen an den Kunden senden'; +$wb['overquota_notify_onok_txt'] = 'Meldung an den Kunden senden, wenn Belegung wieder ok'; +$wb['overquota_notify_freq_txt'] = 'Quota-Warnung alle X Tage versenden'; +$wb['overquota_notify_freq_note_txt'] = '0 = Meldung nur einmalig versenden, keine Wiederholung'; +$wb['admin_notify_events_txt'] = 'Sende E-Mail an Administrator ab folgendem Level'; +$wb['no_notifications_txt'] = 'Keine Benachrichtigungen'; +$wb['monit_url_txt'] = 'Monit-URL'; +$wb['monit_user_txt'] = 'Monit-Benutzer'; +$wb['monit_password_txt'] = 'Monit-Passwort'; +$wb['monit_url_error_regex'] = 'Ungültige Monit-URL'; +$wb['monit_url_note_txt'] = 'Platzhalter:'; +$wb['munin_url_txt'] = 'Munin-URL'; +$wb['munin_user_txt'] = 'Munin-Benutzer'; +$wb['munin_password_txt'] = 'Munin-Passwort'; +$wb['munin_url_error_regex'] = 'Ungültige Munin-URL'; +$wb['munin_url_note_txt'] = 'Platzhalter:'; +$wb['backup_dir_is_mount_txt'] = 'Backupverzeichnis ist ein eigener Mount?'; +$wb['backup_dir_mount_cmd_txt'] = 'Mount-Befehl, falls Backupverzeichnis nicht gemountet'; +$wb['backup_delete_txt'] = 'Backups loeschen wenn eine Domain / Webseite geloescht wird'; +$wb['v6_prefix_txt'] = 'IPv6 Prefix'; +$wb['vhost_rewrite_v6_txt'] = 'Rewrite IPv6 on Mirror'; +$wb['v6_prefix_length'] = 'Prefix zu lang fuer angegebene IPv6-Adresse '; +$wb['monitor_system_updates_txt'] = 'Suche nach Linux updates'; +$wb['dkim_strength_txt'] = 'DKIM Stärke'; +$wb['hostname_error_regex'] = 'Invalid Hostname.'; +$wb['invalid_apache_user_txt'] = 'Invalid apache user.'; +$wb['invalid_apache_group_txt'] = 'Invalid apache group.'; +$wb['backup_dir_error_regex'] = 'Invalid backup directory.'; +$wb['maildir_path_error_regex'] = 'Invalid maildir path.'; +$wb['homedir_path_error_regex'] = 'Invalid homedir path.'; +$wb['mailuser_name_error_regex'] = 'Invalid mailuser name.'; +$wb['mailuser_group_name_error_regex'] = 'Invalid mailuser group name.'; +$wb['mailuser_uid_error_range'] = 'Mailuser uid must be >= 2000'; +$wb['mailuser_gid_error_range'] = 'Mailuser gid must be >= 2000'; +$wb['getmail_config_dir_error_regex'] = 'Invalid getmail config directory.'; +$wb['website_basedir_error_regex'] = 'Invalid website basedir or path too short, min. length 5 chars.'; +$wb['website_symlinks_error_regex'] = 'Invalid website symlinks.'; +$wb['vhost_conf_dir_error_regex'] = 'Invalid vhost config directory.'; +$wb['vhost_conf_enabled_dir_error_regex'] = 'Invalid vhost conf enabled directory.'; +$wb['nginx_vhost_conf_dir_error_regex'] = 'Invalid nginx config directory.'; +$wb['nginx_vhost_conf_enabled_dir_error_regex'] = 'Invalid nginx conf enabled directory.'; +$wb['ca_path_error_regex'] = 'Invalid CA path.'; +$wb['invalid_nginx_user_txt'] = 'Invalid nginx user.'; +$wb['invalid_nginx_group_txt'] = 'Invalid nginx group.'; +$wb['php_ini_path_apache_error_regex'] = 'Invalid apache php.ini path.'; +$wb['php_ini_path_cgi_error_regex'] = 'Invalid cgi php.ini path.'; +$wb['php_fpm_init_script_error_regex'] = 'Invalid php-fpm init script.'; +$wb['php_fpm_ini_path_error_regex'] = 'Invalid php-fpm ini path.'; +$wb['php_fpm_pool_dir_error_regex'] = 'Invalid php-fpm pool directory.'; +$wb['php_fpm_socket_dir_error_regex'] = 'Invalid php-fpm socket directory.'; +$wb['php_open_basedir_error_regex'] = 'Invalid php open_basedir.'; +$wb['awstats_data_dir_empty'] = 'awstats data directory is empty'; +$wb['awstats_data_dir_error_regex'] = 'Invalid awstats data directory.'; +$wb['awstats_pl_empty'] = 'awstats.pl setting is empty.'; +$wb['awstats_pl_error_regex'] = 'Invalid awstats.pl path.'; +$wb['awstats_buildstaticpages_pl_empty'] = 'awstats_buildstaticpages.pl is empty'; +$wb['awstats_buildstaticpages_pl_error_regex'] = 'Invalid awstats_buildstaticpages.pl path.'; +$wb['invalid_bind_user_txt'] = 'Invalid BIND user.'; +$wb['invalid_bind_group_txt'] = 'Invalid BIND group.'; +$wb['bind_zonefiles_dir_error_regex'] = 'Invalid BIND zonefiles directory.'; +$wb['named_conf_path_error_regex'] = 'Invalid named.conf path.'; +$wb['named_conf_local_path_error_regex'] = 'Invalid named.conf.local path.'; +$wb['fastcgi_starter_path_error_regex'] = 'Invalid fastcgi starter path.'; +$wb['fastcgi_starter_script_error_regex'] = 'Invalid fastcgi starter script.'; +$wb['fastcgi_alias_error_regex'] = 'Invalid fastcgi alias.'; +$wb['fastcgi_phpini_path_error_regex'] = 'Invalid fastcgi path.'; +$wb['fastcgi_bin_error_regex'] = 'Invalid fastcgi bin.'; +$wb['jailkit_chroot_home_error_regex'] = 'Invalid jaikit chroot home.'; +$wb['jailkit_chroot_app_sections_error_regex'] = 'Invalid jaikit chroot sections.'; +$wb['jailkit_chroot_app_programs_error_regex'] = 'Invalid jaikit chroot app programs.'; +$wb['jailkit_chroot_cron_programs_error_regex'] = 'Invalid jaikit chroot cron programs.'; +$wb['vlogger_config_dir_error_regex'] = 'Invalid vlogger config dir.'; +$wb['cron_init_script_error_regex'] = 'Invalid cron init script.'; +$wb['crontab_dir_error_regex'] = 'Invalid crontab directory.'; +$wb['cron_wget_error_regex'] = 'Invalid cron wget path.'; +$wb['network_filesystem_txt'] = 'Netzwerk-Dateisystem'; +$wb['overquota_db_notify_admin_txt'] = 'Datenbank-Quota-Warnungen an den Administrator senden'; +$wb['overquota_db_notify_client_txt'] = 'Datenbank-Quota-Warnungen an den Kunden senden'; +$wb['php_ini_check_minutes_txt'] = 'Prüfe php.ini alle X Minuten auf Änderungen'; +$wb['php_ini_check_minutes_error_empty'] = 'Bitte geben Sie einen Wert an, wie oft die php.ini auf Änderungen geprüft werden soll.'; +$wb['php_ini_check_minutes_info_txt'] = '0 = keine Prüfung'; +$wb['php_handler_txt'] = 'Standard-PHP-Handler'; +$wb['php_fpm_incron_reload_txt'] = 'Install incron trigger file to reload PHP-FPM'; +$wb['enable_spdy_txt'] = 'Stellt SPDY/HTTP2 zur Verfügung'; +$wb['disable_bind_log_txt'] = 'Disable bind9 messages for Loglevel WARN'; +$wb['apps_vhost_enabled_txt'] = 'Apps-vhost enabled'; +$wb['disabled_txt'] = 'Disabled'; +$wb['web_settings_txt'] = 'Web Server'; +$wb['xmpp_server_txt'] = 'XMPP Server'; +$wb['xmpp_use_ipv6_txt'] = 'Use IPv6'; +$wb['xmpp_bosh_max_inactivity_txt'] = 'Max. BOSH inactivity time'; +$wb['xmpp_bosh_timeout_range_wrong'] = 'Please enter a bosh timeout range between 15 - 360'; +$wb['xmpp_module_saslauth'] = 'saslauth'; +$wb['xmpp_server_admins_txt'] = 'Server Admins (JIDs)'; +$wb['xmpp_modules_enabled_txt'] = 'Serverwide enabled plugins (one per line)'; +$wb['xmpp_ports_txt'] = 'Component ports'; +$wb['xmpp_port_http_txt'] = 'HTTP'; +$wb['xmpp_port_https_txt'] = 'HTTPS'; +$wb['xmpp_port_pastebin_txt'] = 'Pastebin'; +$wb['xmpp_port_bosh_txt'] = 'BOSH'; +$wb['skip_le_check_txt'] = 'Skip Lets Encrypt Check'; +$wb['migration_mode_txt'] = 'Server Migration Mode'; +$wb['nginx_enable_pagespeed_txt'] = 'Makes Pagespeed available'; +$wb['logging_txt'] = 'Store website access and error logs'; +$wb['logging_desc_txt'] = 'Use Tools > Resync to apply changes to existing sites. For Apache, access and error log can be anonymized. For nginx, only the access log is anonymized, the error log will contain IP addresses.'; +$wb['log_retention_txt'] = 'Log retention (days)'; +$wb['log_retention_error_ispositive'] = 'Log retention must be a number > 0'; +$wb['php_default_name_txt'] = 'Beschreibung Standard PHP'; +$wb['php_default_name_error_empty'] = 'Beschreibung Standard PHP ist leer.'; +$wb['error_mailbox_message_size_txt'] = 'Mailboxgröße muss gleich oder größer als max. Nachrichtengröße sein.'; +$wb['php_fpm_reload_mode_txt'] = 'PHP-FPM reload Modus'; +?> diff --git a/interface/web/admin/lib/lang/de_server_config.lng.rej b/interface/web/admin/lib/lang/de_server_config.lng.rej new file mode 100644 index 0000000000000000000000000000000000000000..eeed14711ee6a597e9e81aa5a413674229984528 --- /dev/null +++ b/interface/web/admin/lib/lang/de_server_config.lng.rej @@ -0,0 +1,11 @@ +--- interface/web/admin/lib/lang/de_server_config.lng ++++ interface/web/admin/lib/lang/de_server_config.lng +@@ -295,4 +295,7 @@ $wb['log_retention_error_ispositive'] = 'Log retention must be a number > 0'; + $wb['php_default_name_txt'] = 'Beschreibung Standard PHP'; + $wb['php_default_name_error_empty'] = 'Beschreibung Standard PHP ist leer.'; + $wb['error_mailbox_message_size_txt'] = 'Mailboxgröße muss gleich oder größer als max. Nachrichtengröße sein.'; +-?> ++$wb['content_filter_txt'] = 'Content-Filter'; ++$wb['rspamd_url_txt'] = 'Rspamd-URL'; ++$wb['rspamd_user_txt'] = 'Rspamd-Benutzer'; ++$wb['rspamd_password_txt'] = 'Rspamd-Passwort'; \ No newline at end of file diff --git a/interface/web/admin/lib/lang/en_server_config.lng b/interface/web/admin/lib/lang/en_server_config.lng index ac0ee42b9015004de1b0a9aa458e2436ea9c8af7..0ba3638a0a06de1f9cd3e914f8a1c44ec569a2ae 100644 --- a/interface/web/admin/lib/lang/en_server_config.lng +++ b/interface/web/admin/lib/lang/en_server_config.lng @@ -297,4 +297,7 @@ $wb['php_default_name_txt'] = 'Description Default PHP-Version'; $wb['php_default_name_error_empty'] = 'Description Default PHP-Version must not be empty'; $wb['error_mailbox_message_size_txt'] = 'Mailbox size must be larger or equal to message size'; $wb['php_fpm_reload_mode_txt'] = 'PHP-FPM reload mode'; -?> +$wb['content_filter_txt'] = 'Content Filter'; +$wb['rspamd_url_txt'] = 'Rspamd URL'; +$wb['rspamd_user_txt'] = 'Rspamd User'; +$wb['rspamd_password_txt'] = 'Rspamd Password'; diff --git a/interface/web/admin/lib/lang/en_server_config.lng.orig b/interface/web/admin/lib/lang/en_server_config.lng.orig new file mode 100644 index 0000000000000000000000000000000000000000..ac0ee42b9015004de1b0a9aa458e2436ea9c8af7 --- /dev/null +++ b/interface/web/admin/lib/lang/en_server_config.lng.orig @@ -0,0 +1,300 @@ +Information: If you want to shut down mysql you have to select the "Disable MySQL monitor" checkbox and then wait 2-3 minutes.
If you do not wait 2-3 minutes, rescue will try to restart mysql!'; +$wb["enable_sni_txt"] = 'Enable SNI'; +$wb["set_folder_permissions_on_update_txt"] = 'Set folder permissions on update'; +$wb["add_web_users_to_sshusers_group_txt"] = 'Add web users to -sshusers- group'; +$wb["connect_userid_to_webid_txt"] = 'Connect Linux userid to webid'; +$wb["connect_userid_to_webid_start_txt"] = 'Start ID for userid/webid connect'; +$wb["realtime_blackhole_list_txt"] = 'Real-time Blackhole List'; +$wb["realtime_blackhole_list_note_txt"] = '(Separate RBL\'s with commas)'; +$wb["ssl_settings_txt"] = 'SSL Settings'; +$wb["permissions_txt"] = 'Permissions'; +$wb["php_settings_txt"] = 'PHP Settings'; +$wb["apps_vhost_settings_txt"] = 'Apps Vhost Settings'; +$wb["awstats_settings_txt"] = 'AWStats Settings'; +$wb["firewall_txt"] = 'Firewall'; +$wb["mailbox_quota_stats_txt"] = 'Mailbox quota statistics'; +$wb["enable_ip_wildcard_txt"] = 'Enable IP wildcard (*)'; +$wb["web_folder_protection_txt"] = 'Make web folders immutable (extended attributes)'; +$wb["overtraffic_notify_admin_txt"] = 'Send overtraffic notification to admin'; +$wb["overtraffic_notify_client_txt"] = 'Send overtraffic notification to client'; +$wb["rbl_error_regex"] = 'Please specify valid RBL hostnames.'; +$wb["overquota_notify_admin_txt"] = 'Send quota warnings to admin'; +$wb["overquota_notify_client_txt"] = 'Send quota warnings to client'; +$wb["overquota_notify_onok_txt"] = 'Send quota ok message to client'; +$wb['overquota_notify_freq_txt'] = 'Send quota warning each X days'; +$wb['overquota_notify_freq_note_txt'] = '0 = send message just once, no repeated messages'; +$wb['admin_notify_events_txt'] = 'Send email to admin starting with the following level'; +$wb['no_notifications_txt'] = 'No Notifications'; +$wb['monit_url_txt'] = 'Monit URL'; +$wb['monit_user_txt'] = 'Monit User'; +$wb['monit_password_txt'] = 'Monit Password'; +$wb['monit_url_error_regex'] = 'Invalid Monit URL'; +$wb['monit_url_note_txt'] = 'Placeholder:'; +$wb['munin_url_txt'] = 'Munin URL'; +$wb['munin_user_txt'] = 'Munin User'; +$wb['munin_password_txt'] = 'Munin Password'; +$wb['munin_url_error_regex'] = 'Invalid Munin URL'; +$wb['munin_url_note_txt'] = 'Placeholder:'; +$wb["v6_prefix_txt"] = 'IPv6 Prefix'; +$wb["vhost_rewrite_v6_txt"] = 'Rewrite IPv6 on Mirror'; +$wb["v6_prefix_length"] = 'Prefix too long according to defined IPv6 '; +$wb['backup_dir_is_mount_txt'] = 'Backup directory is a mount?'; +$wb['backup_dir_mount_cmd_txt'] = 'Mount command, if backup directory not mounted'; +$wb['backup_delete_txt'] = 'Delete backups on domain/website delete'; +$wb["overquota_db_notify_admin_txt"] = 'Send DB quota warnings to admin'; +$wb["overquota_db_notify_client_txt"] = 'Send DB quota warnings to client'; +$wb['monitor_system_updates_txt'] = 'Check for Linux updates'; +$wb['php_handler_txt'] = "Default PHP Handler"; +$wb['php_fpm_incron_reload_txt'] = 'Install incron trigger file to reload PHP-FPM'; +$wb['disabled_txt'] = 'Disabled'; +$wb['dkim_strength_txt'] = 'DKIM strength'; +$wb['monitor_system_updates_txt'] = 'Check for Linux updates'; +$wb['invalid_apache_user_txt'] = 'Invalid apache user.'; +$wb['invalid_apache_group_txt'] = 'Invalid apache group.'; +$wb['backup_dir_error_regex'] = 'Invalid backup directory.'; +$wb['maildir_path_error_regex'] = 'Invalid maildir path.'; +$wb['homedir_path_error_regex'] = 'Invalid homedir path.'; +$wb['mailuser_name_error_regex'] = 'Invalid mailuser name.'; +$wb['mailuser_group_name_error_regex'] = 'Invalid mailuser group name.'; +$wb['mailuser_uid_error_range'] = 'Mailuser uid must be >= 2000'; +$wb['mailuser_gid_error_range'] = 'Mailuser gid must be >= 2000'; +$wb['getmail_config_dir_error_regex'] = 'Invalid getmail config directory.'; +$wb['website_basedir_error_regex'] = 'Invalid website basedir path, min. length 5 chars.'; +$wb['website_symlinks_error_regex'] = 'Invalid website symlinks.'; +$wb['vhost_conf_dir_error_regex'] = 'Invalid vhost config directory.'; +$wb['vhost_conf_enabled_dir_error_regex'] = 'Invalid vhost conf enabled directory.'; +$wb['nginx_vhost_conf_dir_error_regex'] = 'Invalid nginx config directory.'; +$wb['nginx_vhost_conf_enabled_dir_error_regex'] = 'Invalid nginx conf enabled directory.'; +$wb['ca_path_error_regex'] = 'Invalid CA path.'; +$wb['invalid_nginx_user_txt'] = 'Invalid nginx user.'; +$wb['invalid_nginx_group_txt'] = 'Invalid nginx group.'; +$wb['php_ini_path_apache_error_regex'] = 'Invalid apache php.ini path.'; +$wb['php_ini_path_cgi_error_regex'] = 'Invalid cgi php.ini path.'; +$wb['php_fpm_init_script_error_regex'] = 'Invalid php-fpm init script.'; +$wb['php_fpm_ini_path_error_regex'] = 'Invalid php-fpm ini path.'; +$wb['php_fpm_pool_dir_error_regex'] = 'Invalid php-fpm pool directory.'; +$wb['php_fpm_socket_dir_error_regex'] = 'Invalid php-fpm socket directory.'; +$wb['php_open_basedir_error_regex'] = 'Invalid php open_basedir.'; +$wb['awstats_data_dir_empty'] = 'awstats data directory is empty'; +$wb['awstats_data_dir_error_regex'] = 'Invalid awstats data directory.'; +$wb['awstats_pl_empty'] = 'awstats.pl setting is empty.'; +$wb['awstats_pl_error_regex'] = 'Invalid awstats.pl path.'; +$wb['awstats_buildstaticpages_pl_empty'] = 'awstats_buildstaticpages.pl is empty'; +$wb['awstats_buildstaticpages_pl_error_regex'] = 'Invalid awstats_buildstaticpages.pl path.'; +$wb['invalid_bind_user_txt'] = 'Invalid BIND user.'; +$wb['invalid_bind_group_txt'] = 'Invalid BIND group.'; +$wb['bind_zonefiles_dir_error_regex'] = 'Invalid BIND zonefiles directory.'; +$wb['named_conf_path_error_regex'] = 'Invalid named.conf path.'; +$wb['named_conf_local_path_error_regex'] = 'Invalid named.conf.local path.'; +$wb['fastcgi_starter_path_error_regex'] = 'Invalid fastcgi starter path.'; +$wb['fastcgi_starter_script_error_regex'] = 'Invalid fastcgi starter script.'; +$wb['fastcgi_alias_error_regex'] = 'Invalid fastcgi alias.'; +$wb['fastcgi_phpini_path_error_regex'] = 'Invalid fastcgi path.'; +$wb['fastcgi_bin_error_regex'] = 'Invalid fastcgi bin.'; +$wb['jailkit_chroot_home_error_regex'] = 'Invalid jaikit chroot home.'; +$wb['jailkit_chroot_app_sections_error_regex'] = 'Invalid jaikit chroot sections.'; +$wb['jailkit_chroot_app_programs_error_regex'] = 'Invalid jaikit chroot app programs.'; +$wb['jailkit_chroot_cron_programs_error_regex'] = 'Invalid jaikit chroot cron programs.'; +$wb['vlogger_config_dir_error_regex'] = 'Invalid vlogger config dir.'; +$wb['cron_init_script_error_regex'] = 'Invalid cron init script.'; +$wb['crontab_dir_error_regex'] = 'Invalid crontab directory.'; +$wb['cron_wget_error_regex'] = 'Invalid cron wget path.'; +$wb['network_filesystem_txt'] = 'Network Filesystem'; +$wb['php_ini_check_minutes_txt'] = 'Check php.ini every X minutes for changes'; +$wb['php_ini_check_minutes_error_empty'] = 'Please specify a value how often php.ini should be checked for changes.'; +$wb['php_ini_check_minutes_info_txt'] = '0 = no check'; +$wb['enable_spdy_txt'] = 'Makes SPDY/HTTP2 available'; +$wb['web_settings_txt'] = 'Web Server'; +$wb['xmpp_server_txt'] = 'XMPP Server'; +$wb['xmpp_use_ipv6_txt'] = 'Use IPv6'; +$wb['xmpp_bosh_max_inactivity_txt'] = 'Max. BOSH inactivity time'; +$wb['xmpp_bosh_timeout_range_wrong'] = 'Please enter a bosh timeout range between 15 - 360'; +$wb['xmpp_module_saslauth'] = 'saslauth'; +$wb['xmpp_server_admins_txt'] = 'Server Admins (JIDs)'; +$wb['xmpp_modules_enabled_txt'] = 'Serverwide enabled plugins (one per line)'; +$wb['xmpp_ports_txt'] = 'Component ports'; +$wb['xmpp_port_http_txt'] = 'HTTP'; +$wb['xmpp_port_https_txt'] = 'HTTPS'; +$wb['xmpp_port_pastebin_txt'] = 'Pastebin'; +$wb['xmpp_port_bosh_txt'] = 'BOSH'; +$wb["disable_bind_log_txt"] = "Disable bind9 messages for Loglevel WARN"; +$wb["apps_vhost_enabled_txt"] = "Apps-vhost enabled"; +$wb['skip_le_check_txt'] = 'Skip Lets Encrypt Check'; +$wb['migration_mode_txt'] = 'Server Migration Mode'; +$wb['nginx_enable_pagespeed_txt'] = 'Makes Pagespeed available'; +$wb['logging_txt'] = 'Store website access and error logs'; +$wb['logging_desc_txt'] = 'Use Tools > Resync to apply changes to existing sites. For Apache, access and error log can be anonymized. For nginx, only the access log is anonymized, the error log will contain IP addresses.'; +$wb['log_retention_txt'] = 'Log retention (days)'; +$wb['log_retention_error_ispositive'] = 'Log retention must be a number > 0'; +$wb['php_default_name_txt'] = 'Description Default PHP-Version'; +$wb['php_default_name_error_empty'] = 'Description Default PHP-Version must not be empty'; +$wb['error_mailbox_message_size_txt'] = 'Mailbox size must be larger or equal to message size'; +$wb['php_fpm_reload_mode_txt'] = 'PHP-FPM reload mode'; +?> diff --git a/interface/web/admin/lib/lang/en_server_config.lng.rej b/interface/web/admin/lib/lang/en_server_config.lng.rej new file mode 100644 index 0000000000000000000000000000000000000000..146024976587ac1a70f4dfa9c114bda40eff7661 --- /dev/null +++ b/interface/web/admin/lib/lang/en_server_config.lng.rej @@ -0,0 +1,11 @@ +--- interface/web/admin/lib/lang/en_server_config.lng ++++ interface/web/admin/lib/lang/en_server_config.lng +@@ -296,4 +296,7 @@ $wb['log_retention_error_ispositive'] = 'Log retention must be a number > 0'; + $wb['php_default_name_txt'] = 'Description Default PHP-Version'; + $wb['php_default_name_error_empty'] = 'Description Default PHP-Version must not be empty'; + $wb['error_mailbox_message_size_txt'] = 'Mailbox size must be larger or equal to message size'; +-?> ++$wb['content_filter_txt'] = 'Content Filter'; ++$wb['rspamd_url_txt'] = 'Rspamd URL'; ++$wb['rspamd_user_txt'] = 'Rspamd User'; ++$wb['rspamd_password_txt'] = 'Rspamd Password'; \ No newline at end of file diff --git a/interface/web/admin/server_config_edit.php b/interface/web/admin/server_config_edit.php index 523671c0c7d251eac5fdf005784933a5924c796a..8a7cd770a365801123af3f39ee69266629f2a775 100644 --- a/interface/web/admin/server_config_edit.php +++ b/interface/web/admin/server_config_edit.php @@ -52,6 +52,21 @@ $app->load('tform_actions'); class page_action extends tform_actions { + function onShow() { + global $app, $conf; + + // get the config + $app->uses('getconf'); + $web_config = $app->getconf->get_server_config($conf['server_id'], 'web'); + + if($web_config['server_type'] == 'nginx'){ + unset($app->tform->formDef["tabs"]["fastcgi"]); + unset($app->tform->formDef["tabs"]["vlogger"]); + } + + parent::onShow(); + } + function onSubmit() { global $app, $conf; @@ -73,11 +88,17 @@ class page_action extends tform_actions { $server_id = $this->id; $this->dataRecord = $app->getconf->get_server_config($server_id, $section); + + if($section == 'mail'){ + $server_config = $app->getconf->get_server_config($server_id, 'server'); + $rspamd_url = 'https://'.$server_config['hostname'].':8081/rspamd/'; + } } $record = $app->tform->getHTML($this->dataRecord, $this->active_tab, 'EDIT'); $record['id'] = $this->id; + if(isset($rspamd_url)) $record['rspamd_url'] = $rspamd_url; $app->tpl->setVar($record); } @@ -112,6 +133,14 @@ class page_action extends tform_actions { } } + if($section === 'mail') { + if(isset($server_config_array['mail']['rspamd_available']) && $server_config_array['mail']['rspamd_available'] === 'y') { + $this->dataRecord['rspamd_available'] = 'y'; + } else { + $this->dataRecord['rspamd_available'] = 'n'; + } + } + if($app->tform->errorMessage == '') { $server_config_array[$section] = $app->tform->encode($this->dataRecord, $section); $server_config_str = $app->ini_parser->get_ini_string($server_config_array); @@ -123,6 +152,48 @@ class page_action extends tform_actions { } } + function onAfterUpdate() { + global $app; + + if(isset($this->dataRecord['content_filter'])){ + $app->uses('ini_parser'); + $old_config = $app->ini_parser->parse_ini_string(stripslashes($this->oldDataRecord['config'])); + if($this->dataRecord['content_filter'] == 'rspamd' && $old_config['mail']['content_filter'] != $this->dataRecord['content_filter']){ + + $spamfilter_users = $app->db->queryAllRecords("SELECT * FROM spamfilter_users WHERE server_id = ?", intval($this->id)); + if(is_array($spamfilter_users) && !empty($spamfilter_users)){ + foreach($spamfilter_users as $spamfilter_user){ + $app->db->datalogUpdate('spamfilter_users', $spamfilter_user, 'id', $spamfilter_user["id"], true); + } + } + + $spamfilter_wblists = $app->db->queryAllRecords("SELECT * FROM spamfilter_wblist WHERE server_id = ?", intval($this->id)); + if(is_array($spamfilter_wblists) && !empty($spamfilter_wblists)){ + foreach($spamfilter_wblists as $spamfilter_wblist){ + $app->db->datalogUpdate('spamfilter_wblist', $spamfilter_wblist, 'wblist_id', $spamfilter_wblist["wblist_id"], true); + } + } + + $mail_users = $app->db->queryAllRecords("SELECT * FROM mail_user WHERE server_id = ? AND (autoresponder = 'y' OR move_junk = 'y')", intval($this->id)); + if(is_array($mail_users) && !empty($mail_users)){ + foreach($mail_users as $mail_user){ + if($mail_user['autoresponder'] == 'y'){ + $mail_user['autoresponder'] = 'n'; + $app->db->datalogUpdate('mail_user', $mail_user, 'mailuser_id', $mail_user["mailuser_id"], true); + $mail_user['autoresponder'] = 'y'; + $app->db->datalogUpdate('mail_user', $mail_user, 'mailuser_id', $mail_user["mailuser_id"], true); + } else { + $mail_user['move_junk'] = 'n'; + $app->db->datalogUpdate('mail_user', $mail_user, 'mailuser_id', $mail_user["mailuser_id"], true); + $mail_user['move_junk'] = 'y'; + $app->db->datalogUpdate('mail_user', $mail_user, 'mailuser_id', $mail_user["mailuser_id"], true); + } + + } + } + } + } + } } $app->tform_actions = new page_action; diff --git a/interface/web/admin/templates/server_config_mail_edit.htm b/interface/web/admin/templates/server_config_mail_edit.htm index c1531c654a18b1a430bb1a856600667d4fdeab58..6ba37104ef111f91d555c2fd8610e88f7dae6660 100644 --- a/interface/web/admin/templates/server_config_mail_edit.htm +++ b/interface/web/admin/templates/server_config_mail_edit.htm @@ -44,6 +44,20 @@ {tmpl_var name='mail_filter_syntax'} +
+ +
+
+
+ + +
+
+ +
+
@@ -125,3 +139,23 @@ + diff --git a/interface/web/mail/form/spamfilter_policy.tform.php b/interface/web/mail/form/spamfilter_policy.tform.php index 31e8b8092a0833023f677dc7ea9a6ccef7e40a0a..d6ecef9bbc42ef55bee22ce309c5a4b364697189 100644 --- a/interface/web/mail/form/spamfilter_policy.tform.php +++ b/interface/web/mail/form/spamfilter_policy.tform.php @@ -304,6 +304,42 @@ $form["tabs"]['taglevel'] = array ( 'width' => '30', 'maxlength' => '255' ), + 'rspamd_greylisting' => array ( + 'datatype' => 'VARCHAR', + 'formtype' => 'CHECKBOX', + 'default' => 'y', + 'value' => array(0 => 'n', 1 => 'y') + ), + 'rspamd_spam_greylisting_level' => array ( + 'datatype' => 'DOUBLE', + 'formtype' => 'TEXT', + 'default' => '0', + 'value' => '', + 'width' => '10', + 'maxlength' => '255' + ), + 'rspamd_spam_tag_level' => array ( + 'datatype' => 'DOUBLE', + 'formtype' => 'TEXT', + 'default' => '0', + 'value' => '', + 'width' => '10', + 'maxlength' => '255' + ), + 'rspamd_spam_tag_method' => array ( + 'datatype' => 'VARCHAR', + 'formtype' => 'SELECT', + 'default' => 'rewrite_subject', + 'value' => array('add_header' => $app->lng('add_header_txt'), 'rewrite_subject' => $app->lng('rewrite_subject_txt')) + ), + 'rspamd_spam_kill_level' => array ( + 'datatype' => 'DOUBLE', + 'formtype' => 'TEXT', + 'default' => '0', + 'value' => '', + 'width' => '10', + 'maxlength' => '255' + ), //################################# // ENDE Datatable fields //################################# diff --git a/interface/web/mail/form/spamfilter_policy.tform.php.orig b/interface/web/mail/form/spamfilter_policy.tform.php.orig new file mode 100644 index 0000000000000000000000000000000000000000..31e8b8092a0833023f677dc7ea9a6ccef7e40a0a --- /dev/null +++ b/interface/web/mail/form/spamfilter_policy.tform.php.orig @@ -0,0 +1,496 @@ + 0 id must match with id of current user +$form["auth_preset"]["groupid"] = 0; // 0 = default groupid of the user, > 0 id must match with groupid of current user +$form["auth_preset"]["perm_user"] = 'riud'; //r = read, i = insert, u = update, d = delete +$form["auth_preset"]["perm_group"] = 'riud'; //r = read, i = insert, u = update, d = delete +$form["auth_preset"]["perm_other"] = 'r'; //r = read, i = insert, u = update, d = delete + +$form["tabs"]['policy'] = array ( + 'title' => "Policy", + 'width' => 100, + 'template' => "templates/spamfilter_policy_edit.htm", + 'fields' => array ( + //################################# + // Begin Datatable fields + //################################# + 'policy_name' => array ( + 'datatype' => 'VARCHAR', + 'formtype' => 'TEXT', + 'default' => '', + 'validators' => array ( 0 => array ( 'type' => 'NOTEMPTY', + 'errmsg'=> 'policyname_error_notempty'), + ), + 'filters' => array( + 0 => array( 'event' => 'SAVE', + 'type' => 'STRIPTAGS'), + 1 => array( 'event' => 'SAVE', + 'type' => 'STRIPNL') + ), + 'value' => '', + 'width' => '30', + 'maxlength' => '255' + ), + 'virus_lover' => array ( + 'datatype' => 'VARCHAR', + 'formtype' => 'SELECT', + 'default' => 'N', + 'value' => array('N' => 'No', 'Y' => 'Yes') + ), + 'spam_lover' => array ( + 'datatype' => 'VARCHAR', + 'formtype' => 'SELECT', + 'default' => 'N', + 'value' => array('N' => 'No', 'Y' => 'Yes') + ), + 'banned_files_lover' => array ( + 'datatype' => 'VARCHAR', + 'formtype' => 'SELECT', + 'default' => 'N', + 'value' => array('N' => 'No', 'Y' => 'Yes') + ), + 'bad_header_lover' => array ( + 'datatype' => 'VARCHAR', + 'formtype' => 'SELECT', + 'default' => 'N', + 'value' => array('N' => 'No', 'Y' => 'Yes') + ), + 'bypass_virus_checks' => array ( + 'datatype' => 'VARCHAR', + 'formtype' => 'SELECT', + 'default' => 'N', + 'value' => array('N' => 'No', 'Y' => 'Yes') + ), + 'bypass_banned_checks' => array ( + 'datatype' => 'VARCHAR', + 'formtype' => 'SELECT', + 'default' => 'N', + 'value' => array('N' => 'No', 'Y' => 'Yes') + ), + 'bypass_header_checks' => array ( + 'datatype' => 'VARCHAR', + 'formtype' => 'SELECT', + 'default' => 'N', + 'value' => array('N' => 'No', 'Y' => 'Yes') + ), + //################################# + // ENDE Datatable fields + //################################# + ) +); + + +$form["tabs"]['quarantine'] = array ( + 'title' => "Quarantine", + 'width' => 100, + 'template' => "templates/spamfilter_quarantine_edit.htm", + 'fields' => array ( + //################################# + // Begin Datatable fields + //################################# + 'virus_quarantine_to' => array ( + 'datatype' => 'VARCHAR', + 'formtype' => 'TEXT', + 'filters' => array( + 0 => array( 'event' => 'SAVE', + 'type' => 'STRIPTAGS'), + 1 => array( 'event' => 'SAVE', + 'type' => 'STRIPNL') + ), + 'default' => '', + 'value' => '', + 'width' => '30', + 'maxlength' => '255' + ), + 'spam_quarantine_to' => array ( + 'datatype' => 'VARCHAR', + 'formtype' => 'TEXT', + 'filters' => array( + 0 => array( 'event' => 'SAVE', + 'type' => 'STRIPTAGS'), + 1 => array( 'event' => 'SAVE', + 'type' => 'STRIPNL') + ), + 'default' => '', + 'value' => '', + 'width' => '30', + 'maxlength' => '255' + ), + 'banned_quarantine_to' => array ( + 'datatype' => 'VARCHAR', + 'formtype' => 'TEXT', + 'filters' => array( + 0 => array( 'event' => 'SAVE', + 'type' => 'STRIPTAGS'), + 1 => array( 'event' => 'SAVE', + 'type' => 'STRIPNL') + ), + 'default' => '', + 'value' => '', + 'width' => '30', + 'maxlength' => '255' + ), + 'bad_header_quarantine_to' => array ( + 'datatype' => 'VARCHAR', + 'formtype' => 'TEXT', + 'filters' => array( + 0 => array( 'event' => 'SAVE', + 'type' => 'STRIPTAGS'), + 1 => array( 'event' => 'SAVE', + 'type' => 'STRIPNL') + ), + 'default' => '', + 'value' => '', + 'width' => '30', + 'maxlength' => '255' + ), + 'clean_quarantine_to' => array ( + 'datatype' => 'VARCHAR', + 'formtype' => 'TEXT', + 'filters' => array( + 0 => array( 'event' => 'SAVE', + 'type' => 'STRIPTAGS'), + 1 => array( 'event' => 'SAVE', + 'type' => 'STRIPNL') + ), + 'default' => '', + 'value' => '', + 'width' => '30', + 'maxlength' => '255' + ), + 'other_quarantine_to' => array ( + 'datatype' => 'VARCHAR', + 'formtype' => 'TEXT', + 'filters' => array( + 0 => array( 'event' => 'SAVE', + 'type' => 'STRIPTAGS'), + 1 => array( 'event' => 'SAVE', + 'type' => 'STRIPNL') + ), + 'default' => '', + 'value' => '', + 'width' => '30', + 'maxlength' => '255' + ), + //################################# + // ENDE Datatable fields + //################################# + ) +); + +$form["tabs"]['taglevel'] = array ( + 'title' => "Tag-Level", + 'width' => 100, + 'template' => "templates/spamfilter_taglevel_edit.htm", + 'fields' => array ( + //################################# + // Begin Datatable fields + //################################# + 'spam_tag_level' => array ( + 'datatype' => 'DOUBLE', + 'formtype' => 'TEXT', + 'default' => '0', + 'value' => '', + 'width' => '10', + 'maxlength' => '255' + ), + 'spam_tag2_level' => array ( + 'datatype' => 'DOUBLE', + 'formtype' => 'TEXT', + 'default' => '0', + 'value' => '', + 'width' => '10', + 'maxlength' => '255' + ), + 'spam_kill_level' => array ( + 'datatype' => 'DOUBLE', + 'formtype' => 'TEXT', + 'default' => '0', + 'value' => '', + 'width' => '10', + 'maxlength' => '255' + ), + 'spam_dsn_cutoff_level' => array ( + 'datatype' => 'DOUBLE', + 'formtype' => 'TEXT', + 'default' => '0', + 'value' => '', + 'width' => '10', + 'maxlength' => '255' + ), + 'spam_quarantine_cutoff_level' => array ( + 'datatype' => 'DOUBLE', + 'formtype' => 'TEXT', + 'default' => '0', + 'value' => '', + 'width' => '10', + 'maxlength' => '255' + ), + 'spam_modifies_subj' => array ( + 'datatype' => 'VARCHAR', + 'formtype' => 'SELECT', + 'default' => 'N', + 'value' => array('N' => 'No', 'Y' => 'Yes') + ), + 'spam_subject_tag' => array ( + 'datatype' => 'VARCHAR', + 'formtype' => 'TEXT', + 'filters' => array( + 0 => array( 'event' => 'SAVE', + 'type' => 'STRIPTAGS'), + 1 => array( 'event' => 'SAVE', + 'type' => 'STRIPNL') + ), + 'default' => '', + 'value' => '', + 'width' => '30', + 'maxlength' => '255' + ), + 'spam_subject_tag2' => array ( + 'datatype' => 'VARCHAR', + 'formtype' => 'TEXT', + 'filters' => array( + 0 => array( 'event' => 'SAVE', + 'type' => 'STRIPTAGS'), + 1 => array( 'event' => 'SAVE', + 'type' => 'STRIPNL') + ), + 'default' => '', + 'value' => '', + 'width' => '30', + 'maxlength' => '255' + ), + //################################# + // ENDE Datatable fields + //################################# + ) +); + + +$form["tabs"]['other'] = array ( + 'title' => "Other", + 'width' => 100, + 'template' => "templates/spamfilter_other_edit.htm", + 'fields' => array ( + //################################# + // Begin Datatable fields + //################################# + 'addr_extension_virus' => array ( + 'datatype' => 'VARCHAR', + 'formtype' => 'TEXT', + 'filters' => array( + 0 => array( 'event' => 'SAVE', + 'type' => 'STRIPTAGS'), + 1 => array( 'event' => 'SAVE', + 'type' => 'STRIPNL') + ), + 'default' => '', + 'value' => '', + 'width' => '30', + 'maxlength' => '255' + ), + 'addr_extension_spam' => array ( + 'datatype' => 'VARCHAR', + 'formtype' => 'TEXT', + 'filters' => array( + 0 => array( 'event' => 'SAVE', + 'type' => 'STRIPTAGS'), + 1 => array( 'event' => 'SAVE', + 'type' => 'STRIPNL') + ), + 'default' => '', + 'value' => '', + 'width' => '30', + 'maxlength' => '255' + ), + 'addr_extension_banned' => array ( + 'datatype' => 'VARCHAR', + 'formtype' => 'TEXT', + 'filters' => array( + 0 => array( 'event' => 'SAVE', + 'type' => 'STRIPTAGS'), + 1 => array( 'event' => 'SAVE', + 'type' => 'STRIPNL') + ), + 'default' => '', + 'value' => '', + 'width' => '30', + 'maxlength' => '255' + ), + 'addr_extension_bad_header' => array ( + 'datatype' => 'VARCHAR', + 'formtype' => 'TEXT', + 'filters' => array( + 0 => array( 'event' => 'SAVE', + 'type' => 'STRIPTAGS'), + 1 => array( 'event' => 'SAVE', + 'type' => 'STRIPNL') + ), + 'default' => '', + 'value' => '', + 'width' => '30', + 'maxlength' => '255' + ), + 'warnvirusrecip' => array ( + 'datatype' => 'VARCHAR', + 'formtype' => 'SELECT', + 'default' => 'N', + 'value' => array('N' => 'No', 'Y' => 'Yes') + ), + 'warnbannedrecip' => array ( + 'datatype' => 'VARCHAR', + 'formtype' => 'SELECT', + 'default' => 'N', + 'value' => array('N' => 'No', 'Y' => 'Yes') + ), + 'warnbadhrecip' => array ( + 'datatype' => 'VARCHAR', + 'formtype' => 'SELECT', + 'default' => 'N', + 'value' => array('N' => 'No', 'Y' => 'Yes') + ), + 'newvirus_admin' => array ( + 'datatype' => 'VARCHAR', + 'formtype' => 'TEXT', + 'filters' => array( + 0 => array( 'event' => 'SAVE', + 'type' => 'STRIPTAGS'), + 1 => array( 'event' => 'SAVE', + 'type' => 'STRIPNL') + ), + 'default' => '', + 'value' => '', + 'width' => '30', + 'maxlength' => '255' + ), + 'virus_admin' => array ( + 'datatype' => 'VARCHAR', + 'formtype' => 'TEXT', + 'filters' => array( + 0 => array( 'event' => 'SAVE', + 'type' => 'STRIPTAGS'), + 1 => array( 'event' => 'SAVE', + 'type' => 'STRIPNL') + ), + 'default' => '', + 'value' => '', + 'width' => '30', + 'maxlength' => '255' + ), + 'banned_admin' => array ( + 'datatype' => 'VARCHAR', + 'formtype' => 'TEXT', + 'filters' => array( + 0 => array( 'event' => 'SAVE', + 'type' => 'STRIPTAGS'), + 1 => array( 'event' => 'SAVE', + 'type' => 'STRIPNL') + ), + 'default' => '', + 'value' => '', + 'width' => '30', + 'maxlength' => '255' + ), + 'bad_header_admin' => array ( + 'datatype' => 'VARCHAR', + 'formtype' => 'TEXT', + 'filters' => array( + 0 => array( 'event' => 'SAVE', + 'type' => 'STRIPTAGS'), + 1 => array( 'event' => 'SAVE', + 'type' => 'STRIPNL') + ), + 'default' => '', + 'value' => '', + 'width' => '30', + 'maxlength' => '255' + ), + 'spam_admin' => array ( + 'datatype' => 'VARCHAR', + 'formtype' => 'TEXT', + 'filters' => array( + 0 => array( 'event' => 'SAVE', + 'type' => 'STRIPTAGS'), + 1 => array( 'event' => 'SAVE', + 'type' => 'STRIPNL') + ), + 'default' => '', + 'value' => '', + 'width' => '30', + 'maxlength' => '255' + ), + + 'message_size_limit' => array ( + 'datatype' => 'INTEGER', + 'formtype' => 'TEXT', + 'default' => '', + 'value' => '', + 'width' => '10', + 'maxlength' => '255' + ), + 'banned_rulenames' => array ( + 'datatype' => 'VARCHAR', + 'formtype' => 'TEXT', + 'filters' => array( + 0 => array( 'event' => 'SAVE', + 'type' => 'STRIPTAGS'), + 1 => array( 'event' => 'SAVE', + 'type' => 'STRIPNL') + ), + 'default' => '', + 'value' => '', + 'width' => '30', + 'maxlength' => '255' + ), + + //################################# + // ENDE Datatable fields + //################################# + ) +); + +?> diff --git a/interface/web/mail/lib/lang/de_spamfilter_policy.lng b/interface/web/mail/lib/lang/de_spamfilter_policy.lng index 32acca46860822f960c1d03ce316e047a29a3afc..04b8274478a369f73d4a4b77eaf8f5bd669b8392 100644 --- a/interface/web/mail/lib/lang/de_spamfilter_policy.lng +++ b/interface/web/mail/lib/lang/de_spamfilter_policy.lng @@ -35,4 +35,10 @@ $wb['bad_header_admin_txt'] = 'Bad Header Administrator'; $wb['spam_admin_txt'] = 'SPAM Administrator'; $wb['message_size_limit_txt'] = 'Nachrichtengrößen Limit'; $wb['banned_rulenames_txt'] = 'Banned Richtliniennamen'; -?> +$wb['rspamd_greylisting_txt'] = 'Greylisting nutzen'; +$wb['rspamd_spam_greylisting_level_txt'] = 'Greylisting-Level'; +$wb['rspamd_spam_tag_level_txt'] = 'SPAM-Markierungslevel'; +$wb['rspamd_spam_tag_method_txt'] = 'SPAM-Markierungsmethode'; +$wb['rspamd_spam_kill_level_txt'] = 'SPAM-Reject-Level'; +$wb['btn_save_txt'] = 'Speichern'; +$wb['btn_cancel_txt'] = 'Abbrechen'; diff --git a/interface/web/mail/lib/lang/en.lng b/interface/web/mail/lib/lang/en.lng index e5f9e678c79eda6a4741562f06f1b337cfedeaef..22c67a286b0d3d7d40ab647f87aa0b067a5d9e0b 100644 --- a/interface/web/mail/lib/lang/en.lng +++ b/interface/web/mail/lib/lang/en.lng @@ -48,4 +48,5 @@ $wb['Global Filters'] = 'Global Filters'; $wb['Domain Alias'] = 'Domain Alias'; $wb["Relay Recipients"] = 'Relay Recipients'; $wb['Mailbox quota'] = 'Mailbox quota'; -?> \ No newline at end of file +$wb['add_header_txt'] = 'Header (adds "X-Spam: Yes")'; +$wb['rewrite_subject_txt'] = 'Subject (adds "***SPAM***" at the beginning)'; diff --git a/interface/web/mail/lib/lang/en_spamfilter_policy.lng b/interface/web/mail/lib/lang/en_spamfilter_policy.lng index 2e0f05d6c0019511862054456e91a503b60a29af..f9e8a8e30387eeabbee9d84d60df590056943c7a 100644 --- a/interface/web/mail/lib/lang/en_spamfilter_policy.lng +++ b/interface/web/mail/lib/lang/en_spamfilter_policy.lng @@ -35,4 +35,11 @@ $wb["bad_header_admin_txt"] = 'Bad header admin'; $wb["spam_admin_txt"] = 'SPAM admin'; $wb["message_size_limit_txt"] = 'Message size limit'; $wb["banned_rulenames_txt"] = 'Banned rulenames'; -?> +$wb['rspamd_greylisting_txt'] = 'Use greylisting'; +$wb['rspamd_spam_greylisting_level_txt'] = 'Greylisting level'; +$wb['rspamd_spam_tag_level_txt'] = 'SPAM tag level'; +$wb['rspamd_spam_tag_method_txt'] = 'SPAM tag method'; +$wb['rspamd_spam_kill_level_txt'] = 'SPAM reject level'; +$wb['btn_save_txt'] = 'Save'; +$wb['btn_cancel_txt'] = 'Cancel'; +?> \ No newline at end of file diff --git a/interface/web/mail/mail_blacklist_del.php b/interface/web/mail/mail_blacklist_del.php index 3cb83a50a00dcc3859335bc5f7e3df4546c1994b..d3bbc5d5d581991078d44997aa583d1550243181 100644 --- a/interface/web/mail/mail_blacklist_del.php +++ b/interface/web/mail/mail_blacklist_del.php @@ -42,6 +42,9 @@ $tform_def_file = "form/mail_blacklist.tform.php"; require_once '../../lib/config.inc.php'; require_once '../../lib/app.inc.php'; + +if($_SESSION["s"]["user"]["typ"] != 'admin') $app->error('This function needs admin priveliges'); + //* Check permissions for module $app->auth->check_module_permissions('mail'); diff --git a/interface/web/mail/mail_blacklist_edit.php b/interface/web/mail/mail_blacklist_edit.php index f7e2d15e3f519c1c79690b5b0fd0a47ba0107eb9..e2f284a34ed84df3a0c397aee67107eeabb15468 100644 --- a/interface/web/mail/mail_blacklist_edit.php +++ b/interface/web/mail/mail_blacklist_edit.php @@ -53,16 +53,7 @@ class page_action extends tform_actions { function onShowNew() { global $app, $conf; - // we will check only users, not admins - if($_SESSION["s"]["user"]["typ"] == 'user') { - if(!$app->tform->checkClientLimit('limit_mailfilter')) { - $app->error($app->tform->wordbook["limit_mailfilter_txt"]); - } - if(!$app->tform->checkResellerLimit('limit_mailfilter')) { - $app->error('Reseller: '.$app->tform->wordbook["limit_mailfilter_txt"]); - } - } - + if($_SESSION["s"]["user"]["typ"] != 'admin') die('This function needs admin priveliges'); parent::onShowNew(); } @@ -70,6 +61,8 @@ class page_action extends tform_actions { function onBeforeUpdate() { global $app, $conf; + if($_SESSION["s"]["user"]["typ"] != 'admin') die('This function needs admin priveliges'); + //* Check if the server has been changed // We do this only for the admin or reseller users, as normal clients can not change the server ID anyway if($_SESSION["s"]["user"]["typ"] == 'admin' || $app->auth->has_clients($_SESSION['s']['user']['userid'])) { @@ -86,24 +79,10 @@ class page_action extends tform_actions { function onSubmit() { global $app, $conf; + if($_SESSION["s"]["user"]["typ"] != 'admin') die('This function needs admin priveliges'); + if(substr($this->dataRecord['source'], 0, 1) === '@') $this->dataRecord['source'] = substr($this->dataRecord['source'], 1); - // Check the client limits, if user is not the admin - if($_SESSION["s"]["user"]["typ"] != 'admin') { // if user is not admin - // Get the limits of the client - $client_group_id = $app->functions->intval($_SESSION["s"]["user"]["default_group"]); - $client = $app->db->queryOneRecord("SELECT limit_mailfilter FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = ?" , $client_group_id); - - // Check if the user may add another mailbox. - if($this->id == 0 && $client["limit_mailfilter"] >= 0) { - $tmp = $app->db->queryOneRecord("SELECT count(access_id) as number FROM mail_access WHERE sys_groupid = ?", $client_group_id); - if($tmp["number"] >= $client["limit_mailfilter"]) { - $app->tform->errorMessage .= $app->tform->wordbook["limit_mailfilter_txt"]."
"; - } - unset($tmp); - } - } // end if user is not admin - parent::onSubmit(); } diff --git a/interface/web/mail/mail_blacklist_list.php b/interface/web/mail/mail_blacklist_list.php index cf1e50ddaaf5a319cc605f1376ac47d0e6921a4a..2bdc1e93b8270148285eb4d705dfa7b47cadcfce 100644 --- a/interface/web/mail/mail_blacklist_list.php +++ b/interface/web/mail/mail_blacklist_list.php @@ -12,6 +12,8 @@ $list_def_file = "list/mail_blacklist.list.php"; * End Form configuration ******************************************/ +if($_SESSION["s"]["user"]["typ"] != 'admin') $app->error('This function needs admin priveliges'); + //* Check permissions for module $app->auth->check_module_permissions('mail'); diff --git a/interface/web/mail/mail_domain_edit.php b/interface/web/mail/mail_domain_edit.php index 72877a774ddd2766b244690b2451f118c78d1c74..28d4f40917045d3f731260699baadfa26ea3fa77 100644 --- a/interface/web/mail/mail_domain_edit.php +++ b/interface/web/mail/mail_domain_edit.php @@ -273,7 +273,10 @@ class page_action extends tform_actions { } //* make sure that the email domain is lowercase - if(isset($this->dataRecord["domain"])) $this->dataRecord["domain"] = strtolower($this->dataRecord["domain"]); + if(isset($this->dataRecord["domain"])){ + $this->dataRecord["domain"] = $app->functions->idn_encode($this->dataRecord["domain"]); + $this->dataRecord["domain"] = strtolower($this->dataRecord["domain"]); + } parent::onSubmit(); @@ -317,7 +320,7 @@ class page_action extends tform_actions { $soaDomain = $this->dataRecord['domain'].'.'; while ((!isset($soa) && (substr_count($soaDomain,'.') > 1))) { $soa = $app->db->queryOneRecord("SELECT id AS zone, sys_userid, sys_groupid, sys_perm_user, sys_perm_group, sys_perm_other, server_id, ttl, serial FROM dns_soa WHERE active = 'Y' AND origin = ?", $soaDomain); - $soaDomain = preg_replace("/^\w+\./","",$soaDomain); + $soaDomain = preg_replace("/^[^\.]+\./","",$soaDomain); } if ( isset($soa) && !empty($soa) ) $this->update_dns($this->dataRecord, $soa); } @@ -450,7 +453,7 @@ class page_action extends tform_actions { $soaDomain = $domain.'.'; while ((!isset($soa) && (substr_count($soaDomain,'.') > 1))) { $soa = $app->db->queryOneRecord("SELECT id AS zone, sys_userid, sys_groupid, sys_perm_user, sys_perm_group, sys_perm_other, server_id, ttl, serial FROM dns_soa WHERE active = 'Y' AND origin = ?", $soaDomain); - $soaDomain = preg_replace("/^[\w\-]+\./","",$soaDomain); + $soaDomain = preg_replace("/^[^\.]+\./","",$soaDomain); } if ( ($selector || $dkim_private || $dkim_active) && $dkim_active ) diff --git a/interface/web/mail/mail_user_edit.php b/interface/web/mail/mail_user_edit.php index 910d7a096a5f1acb49c3e231d1966895a2eeac45..263b98ef31a6054dd0965b33157d33c09992f2f3 100644 --- a/interface/web/mail/mail_user_edit.php +++ b/interface/web/mail/mail_user_edit.php @@ -295,7 +295,7 @@ class page_action extends tform_actions { "priority" => 10, "policy_id" => $policy_id, "email" => $this->dataRecord["email"], - "fullname" => $this->dataRecord["email"], + "fullname" => $app->functions->idn_decode($this->dataRecord["email"]), "local" => 'Y' ); $app->db->datalogInsert('spamfilter_users', $insert_data, 'id'); @@ -342,7 +342,7 @@ class page_action extends tform_actions { "priority" => 10, "policy_id" => $policy_id, "email" => $this->dataRecord["email"], - "fullname" => $this->dataRecord["email"], + "fullname" => $app->functions->idn_decode($this->dataRecord["email"]), "local" => 'Y' ); $app->db->datalogInsert('spamfilter_users', $insert_data, 'id'); diff --git a/interface/web/mail/mail_whitelist_del.php b/interface/web/mail/mail_whitelist_del.php index 94be228f67035481bbfc4dd24057b325ce8a8445..2294f4486806d41ffc7777d5bec207ae9c519c48 100644 --- a/interface/web/mail/mail_whitelist_del.php +++ b/interface/web/mail/mail_whitelist_del.php @@ -42,6 +42,8 @@ $tform_def_file = "form/mail_whitelist.tform.php"; require_once '../../lib/config.inc.php'; require_once '../../lib/app.inc.php'; +if($_SESSION["s"]["user"]["typ"] != 'admin') $app->error('This function needs admin priveliges'); + //* Check permissions for module $app->auth->check_module_permissions('mail'); diff --git a/interface/web/mail/mail_whitelist_edit.php b/interface/web/mail/mail_whitelist_edit.php index 9bb04fab7a21155e9197893106ce9801751ec6e3..2cf56b1ec451626491830f41acb54196341d6505 100644 --- a/interface/web/mail/mail_whitelist_edit.php +++ b/interface/web/mail/mail_whitelist_edit.php @@ -53,55 +53,33 @@ class page_action extends tform_actions { function onShowNew() { global $app, $conf; - // we will check only users, not admins - if($_SESSION["s"]["user"]["typ"] == 'user') { - if(!$app->tform->checkClientLimit('limit_mailfilter')) { - $app->error($app->tform->wordbook["limit_mailfilter_txt"]); - } - if(!$app->tform->checkResellerLimit('limit_mailfilter')) { - $app->error('Reseller: '.$app->tform->wordbook["limit_mailfilter_txt"]); - } - } - + if($_SESSION["s"]["user"]["typ"] != 'admin') die('This function needs admin priveliges'); + parent::onShowNew(); } function onBeforeUpdate() { global $app, $conf; + if($_SESSION["s"]["user"]["typ"] != 'admin') die('This function needs admin priveliges'); + //* Check if the server has been changed // We do this only for the admin or reseller users, as normal clients can not change the server ID anyway - if($_SESSION["s"]["user"]["typ"] == 'admin' || $app->auth->has_clients($_SESSION['s']['user']['userid'])) { - $rec = $app->db->queryOneRecord("SELECT server_id from mail_access WHERE access_id = ?", $this->id); - if($rec['server_id'] != $this->dataRecord["server_id"]) { - //* Add a error message and switch back to old server - $app->tform->errorMessage .= $app->lng('The Server can not be changed.'); - $this->dataRecord["server_id"] = $rec['server_id']; - } - unset($rec); + $rec = $app->db->queryOneRecord("SELECT server_id from mail_access WHERE access_id = ?", $this->id); + if($rec['server_id'] != $this->dataRecord["server_id"]) { + //* Add a error message and switch back to old server + $app->tform->errorMessage .= $app->lng('The Server can not be changed.'); + $this->dataRecord["server_id"] = $rec['server_id']; } + unset($rec); } function onSubmit() { global $app, $conf; + if($_SESSION["s"]["user"]["typ"] != 'admin') die('This function needs admin priveliges'); + if(substr($this->dataRecord['source'], 0, 1) === '@') $this->dataRecord['source'] = substr($this->dataRecord['source'], 1); - - // Check the client limits, if user is not the admin - if($_SESSION["s"]["user"]["typ"] != 'admin') { // if user is not admin - // Get the limits of the client - $client_group_id = $app->functions->intval($_SESSION["s"]["user"]["default_group"]); - $client = $app->db->queryOneRecord("SELECT limit_mailfilter FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = ?", $client_group_id); - - // Check if the user may add another mailbox. - if($this->id == 0 && $client["limit_mailfilter"] >= 0) { - $tmp = $app->db->queryOneRecord("SELECT count(access_id) as number FROM mail_access WHERE sys_groupid = ?", $client_group_id); - if($tmp["number"] >= $client["limit_mailfilter"]) { - $app->tform->errorMessage .= $app->tform->wordbook["limit_mailfilter_txt"]."
"; - } - unset($tmp); - } - } // end if user is not admin parent::onSubmit(); } diff --git a/interface/web/mail/mail_whitelist_list.php b/interface/web/mail/mail_whitelist_list.php index 4fd33dd977b0259f46c83c2f2634ff787a9f7910..1a09b6b16578dd81455536a425d110597ed99168 100644 --- a/interface/web/mail/mail_whitelist_list.php +++ b/interface/web/mail/mail_whitelist_list.php @@ -12,6 +12,8 @@ $list_def_file = "list/mail_whitelist.list.php"; * End Form configuration ******************************************/ +if($_SESSION["s"]["user"]["typ"] != 'admin') $app->error('This function needs admin priveliges'); + //* Check permissions for module $app->auth->check_module_permissions('mail'); diff --git a/interface/web/mail/spamfilter_policy_edit.php b/interface/web/mail/spamfilter_policy_edit.php index 5320506846fc3e36364a482a0e1c5c0c5d993373..55a42fe8471338b9aaa10897956587f4b4367cd9 100644 --- a/interface/web/mail/spamfilter_policy_edit.php +++ b/interface/web/mail/spamfilter_policy_edit.php @@ -49,6 +49,46 @@ $app->uses('tpl,tform,tform_actions'); $app->load('tform_actions'); class page_action extends tform_actions { + + function onShow() { + global $app, $conf; + + // get the config + $app->uses('getconf'); + $mail_config = $app->getconf->get_server_config($conf['server_id'], 'mail'); + + $content_filter = 'amavisd'; + if($mail_config['content_filter'] == 'rspamd'){ + $content_filter = 'rspamd'; + unset($app->tform->formDef["tabs"]["policy"]['fields']['banned_files_lover']); + unset($app->tform->formDef["tabs"]["policy"]['fields']['bad_header_lover']); + unset($app->tform->formDef["tabs"]["policy"]['fields']['bypass_virus_checks']); + unset($app->tform->formDef["tabs"]["policy"]['fields']['bypass_banned_checks']); + unset($app->tform->formDef["tabs"]["policy"]['fields']['bypass_header_checks']); + + unset($app->tform->formDef["tabs"]["taglevel"]['fields']['spam_tag_level']); + unset($app->tform->formDef["tabs"]["taglevel"]['fields']['spam_tag2_level']); + unset($app->tform->formDef["tabs"]["taglevel"]['fields']['spam_kill_level']); + unset($app->tform->formDef["tabs"]["taglevel"]['fields']['spam_dsn_cutoff_level']); + unset($app->tform->formDef["tabs"]["taglevel"]['fields']['spam_quarantine_cutoff_level']); + unset($app->tform->formDef["tabs"]["taglevel"]['fields']['spam_modifies_subj']); + unset($app->tform->formDef["tabs"]["taglevel"]['fields']['spam_subject_tag']); + unset($app->tform->formDef["tabs"]["taglevel"]['fields']['spam_subject_tag2']); + + unset($app->tform->formDef["tabs"]["quarantine"]); + unset($app->tform->formDef["tabs"]["other"]); + } else { + unset($app->tform->formDef["tabs"]["taglevel"]['fields']['rspamd_greylisting']); + unset($app->tform->formDef["tabs"]["taglevel"]['fields']['rspamd_spam_greylisting_level']); + unset($app->tform->formDef["tabs"]["taglevel"]['fields']['rspamd_spam_tag_level']); + unset($app->tform->formDef["tabs"]["taglevel"]['fields']['rspamd_spam_tag_method']); + unset($app->tform->formDef["tabs"]["taglevel"]['fields']['rspamd_spam_kill_level']); + } + $app->tpl->setVar("content_filter", $content_filter); + + parent::onShow(); + } + function onShowNew() { global $app, $conf; @@ -86,11 +126,37 @@ class page_action extends tform_actions { parent::onSubmit(); } + + function onAfterUpdate() { + global $app, $conf; + + $app->uses('getconf'); + $mail_config = $app->getconf->get_server_config($conf['server_id'], 'mail'); + + if($mail_config['content_filter'] == 'rspamd'){ + $record_has_changed = false; + if(isset($this->dataRecord['rspamd_spam_greylisting_level']) && !isset($this->dataRecord['rspamd_greylisting'])) $this->dataRecord['rspamd_greylisting'] = 'n'; + foreach($this->dataRecord as $key => $val) { + if(isset($this->oldDataRecord[$key]) && @$this->oldDataRecord[$key] != $val) { + // Record has changed + $record_has_changed = true; + } + } + + if($record_has_changed){ + $spamfilter_users = $app->db->queryAllRecords("SELECT * FROM spamfilter_users WHERE policy_id = ?", intval($this->id)); + + if(is_array($spamfilter_users) && !empty($spamfilter_users)){ + foreach($spamfilter_users as $spamfilter_user){ + $app->db->datalogUpdate('spamfilter_users', $spamfilter_user, 'id', $spamfilter_user["id"], true); + } + } + } + } + } } $app->tform_actions = new page_action; $app->tform_actions->onLoad(); - - -?> +?> \ No newline at end of file diff --git a/interface/web/mail/spamfilter_policy_list.php b/interface/web/mail/spamfilter_policy_list.php index c2ab38d5f7eea35dd36a9fac367ebea1e1c443ca..2aa7c7bec132ea3bc80d59d6c4b7545284ffc052 100644 --- a/interface/web/mail/spamfilter_policy_list.php +++ b/interface/web/mail/spamfilter_policy_list.php @@ -16,9 +16,28 @@ $list_def_file = "list/spamfilter_policy.list.php"; $app->auth->check_module_permissions('mail'); $app->uses('listform_actions'); -//$app->listform_actions->SQLExtWhere = "wb = 'W'"; -$app->listform_actions->onLoad(); - - -?> +class list_action extends listform_actions { + + function onShow() { + global $app, $conf; + + // get the config + $app->uses('getconf'); + $mail_config = $app->getconf->get_server_config($conf['server_id'], 'mail'); + + $content_filter = 'amavisd'; + if($mail_config['content_filter'] == 'rspamd'){ + $content_filter = 'rspamd'; + } + $app->tpl->setVar("content_filter", $content_filter); + + parent::onShow(); + } + +} + +$list = new list_action; +//$list->SQLExtWhere = "wb = 'W'"; +$list->onLoad(); +?> \ No newline at end of file diff --git a/interface/web/mail/templates/spamfilter_policy_edit.htm b/interface/web/mail/templates/spamfilter_policy_edit.htm index 317bbdb82283b5a6be84558c5e7bc9ca98a726e4..0496d3a85a887e76ae40ea5d323b0b1f53854fc1 100644 --- a/interface/web/mail/templates/spamfilter_policy_edit.htm +++ b/interface/web/mail/templates/spamfilter_policy_edit.htm @@ -20,6 +20,7 @@ {tmpl_var name='spam_lover'} +
- +
diff --git a/interface/web/mail/templates/spamfilter_policy_list.htm b/interface/web/mail/templates/spamfilter_policy_list.htm index da1183d75f9af0dcbf526e0ac68cb400c33d6942..0dd72dee54ac4d55ca10c8fe5086d9967f88b1de 100644 --- a/interface/web/mail/templates/spamfilter_policy_list.htm +++ b/interface/web/mail/templates/spamfilter_policy_list.htm @@ -19,16 +19,20 @@ + + {tmpl_var name='search_limit'} + + @@ -40,8 +44,10 @@ {tmpl_var name="policy_name"} {tmpl_var name="virus_lover"} {tmpl_var name="spam_lover"} + {tmpl_var name="banned_files_lover"} {tmpl_var name="bad_header_lover"} + @@ -49,14 +55,14 @@ - {tmpl_var name='globalsearch_noresults_text_txt'} + {tmpl_var name='globalsearch_noresults_text_txt'} - + diff --git a/interface/web/mail/templates/spamfilter_taglevel_edit.htm b/interface/web/mail/templates/spamfilter_taglevel_edit.htm index ba92662ba6f1b96a138dc0afcfc43136eac68cf3..1b3c3b482c2fe270cfe2acc357e4e8848645acf5 100644 --- a/interface/web/mail/templates/spamfilter_taglevel_edit.htm +++ b/interface/web/mail/templates/spamfilter_taglevel_edit.htm @@ -4,7 +4,7 @@

- +
@@ -32,6 +32,33 @@
+
+ +
+ +
+ {tmpl_var name='rspamd_greylisting'} +
+
+
+ +
+
+
+ +
+
+
+ +
+
+
+ +
+
+
@@ -39,4 +66,4 @@
-
\ No newline at end of file + diff --git a/server/conf/apache_apps.vhost.master b/server/conf/apache_apps.vhost.master index d533f7b3c0a6f3dcbde989b93f39a0a8e37854c0..94982a6dc11ee3ec1f46289cd05c27d8727575c7 100644 --- a/server/conf/apache_apps.vhost.master +++ b/server/conf/apache_apps.vhost.master @@ -74,6 +74,16 @@ +{tmpl_if name="use_rspamd"} + + Order allow,deny + Allow from all + + RewriteEngine On + RewriteRule ^/rspamd$ /rspamd/ [R,L] + RewriteRule ^/rspamd/(.*) http://127.0.0.1:11334/$1 [P] +{/tmpl_if} +
diff --git a/server/conf/autoresponder.master b/server/conf/autoresponder.master index 0126c998d49f8177d28e147c1642a6e9fe4532c4..114db23d640125eccc0fb4ba4f9454d704ad92c0 100644 --- a/server/conf/autoresponder.master +++ b/server/conf/autoresponder.master @@ -4,7 +4,7 @@ if ($RETURNCODE==1) { if (!/^List-Unsubscribe:.*/:h ) { - if (!/^X-Spam-Flag: YES/:h ) + if (!/^(X-Spam-Flag: YES|X-Spam: Yes|Subject: \*\*\*\s*SPAM\s*\*\*\*.*)/:h ) { NOW=time if ({start_date} lt $NOW && {end_date} gt $NOW) diff --git a/server/conf/nginx_apps.vhost.master b/server/conf/nginx_apps.vhost.master index ed5e3a49ae5160842cfbc25bbd25e7e22f6c4822..8a97f82a439cd596d341cf91b313ad4a52625a6b 100644 --- a/server/conf/nginx_apps.vhost.master +++ b/server/conf/nginx_apps.vhost.master @@ -199,4 +199,29 @@ server { alias /var/lib/mailman/archives/public; autoindex on; } + + {use_rspamd}location /rspamd/ { + {use_rspamd}proxy_pass http://127.0.0.1:11334/; + {use_rspamd}rewrite ^//(.*) /$1; + {use_rspamd}proxy_set_header X-Forwarded-Proto $scheme; + {use_rspamd}proxy_set_header Host $host; + {use_rspamd}proxy_set_header X-Real-IP $remote_addr; + {use_rspamd}proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + {use_rspamd}proxy_pass_header Authorization; + {use_rspamd}client_max_body_size 0; + {use_rspamd}client_body_buffer_size 1m; + {use_rspamd}proxy_intercept_errors on; + {use_rspamd}proxy_buffering on; + {use_rspamd}proxy_buffer_size 128k; + {use_rspamd}proxy_buffers 256 16k; + {use_rspamd}proxy_busy_buffers_size 256k; + {use_rspamd}proxy_temp_file_write_size 256k; + {use_rspamd}proxy_max_temp_file_size 0; + {use_rspamd}proxy_read_timeout 300; + {use_rspamd} + {use_rspamd}location ~* ^/rspamd/(.+\.(jpg|jpeg|gif|css|png|js|ico|html?|xml|txt))$ { + {use_rspamd}alias /usr/share/rspamd/www/$1; + {use_rspamd}} + {use_rspamd}} + } diff --git a/server/conf/rspamd_users.inc.conf.master b/server/conf/rspamd_users.inc.conf.master new file mode 100644 index 0000000000000000000000000000000000000000..43890e8135fce340b5973f5eab925577da1764b6 --- /dev/null +++ b/server/conf/rspamd_users.inc.conf.master @@ -0,0 +1,41 @@ +spamfilter_users- { + priority = ; + rcptfrom = ""; + + want_spam = yes; + + + apply { + CLAM_VIRUS = 1999.0; + JUST_EICAR = 1999.0; + actions { + reject = null; + } + } + + + apply { + CLAM_VIRUS = -999.0; + JUST_EICAR = -999.0; + actions { + greylist = ; + "rewrite subject" = ; + "add header" = ; + reject = ; + } + } + + + apply { + CLAM_VIRUS = ; + JUST_EICAR = ; + actions { + greylist = ; + "rewrite subject" = ; + "add header" = ; + reject = ; + } + } + + +} \ No newline at end of file diff --git a/server/conf/rspamd_wblist.inc.conf.master b/server/conf/rspamd_wblist.inc.conf.master new file mode 100644 index 0000000000000000000000000000000000000000..b614244515b4ea55089fcc9f347796a40766b3c4 --- /dev/null +++ b/server/conf/rspamd_wblist.inc.conf.master @@ -0,0 +1,36 @@ +_wblist- { + priority = ; + + from = ""; + + + rcpt = ""; + + + ip = ""; + + + hostname = ""; + + + want_spam = yes; + apply { + actions { + reject = null; + "add header" = null; + greylist = null; + "rewrite subject" = null; + } + } + + apply { + R_DUMMY = 999.0; + actions { + reject = 0.2; + "add header" = 0.1; + greylist = 0.1; + "rewrite subject" = 0.1; + } + } + +} \ No newline at end of file diff --git a/server/conf/rspamd_worker-controller.inc.master b/server/conf/rspamd_worker-controller.inc.master new file mode 100644 index 0000000000000000000000000000000000000000..75b744c88380c3ce63394caaadf79653e0fa8815 --- /dev/null +++ b/server/conf/rspamd_worker-controller.inc.master @@ -0,0 +1,8 @@ +# Included from top-level .conf file + +type = "controller"; +count = 1; +password = ""; +secure_ip = "127.0.0.1"; +secure_ip = "::1"; +static_dir = "${WWWDIR}"; \ No newline at end of file diff --git a/server/conf/sieve_filter.master b/server/conf/sieve_filter.master index 8e78c6c83aa87fdeb53f03a42d771aacd0c0b5e5..13c08dd56b18987573c18fd1fe1aee432db17e44 100644 --- a/server/conf/sieve_filter.master +++ b/server/conf/sieve_filter.master @@ -1,4 +1,4 @@ -require ["fileinto", "regex", "vacation"]; +require ["fileinto", "regex", "date", "relational", "vacation", "imap4flags", "envelope", "subaddress", "copy", "reject"]; # Send a copy of email to @@ -9,7 +9,7 @@ redirect ""; # Move spam to spam folder -if header :contains "X-Spam-Flag" "YES" { +if anyof (header :contains "X-Spam-Flag" "YES", header :contains "X-Spam" "Yes", header :contains "subject" "*** SPAM ***", header :contains "subject" "***SPAM***") { fileinto "Junk"; # Stop here so that we do not reply on spams stop; @@ -26,7 +26,7 @@ keep; ################################################################# # Move spam to spam folder -if header :contains "X-Spam-Flag" "YES" { +if anyof (header :contains "X-Spam-Flag" "YES", header :contains "X-Spam" "Yes", header :contains "subject" "*** SPAM ***", header :contains "subject" "***SPAM***") { fileinto "Junk"; # Stop here so that we do not reply on spams stop; diff --git a/server/conf/sieve_filter_1.2.master b/server/conf/sieve_filter_1.2.master index b1f7fcb87d1802bac7205cde7b15385f1e15dd0e..5244693102ce0778964ce2e25b61c377b1b2bf8a 100644 --- a/server/conf/sieve_filter_1.2.master +++ b/server/conf/sieve_filter_1.2.master @@ -1,8 +1,8 @@ -require ["fileinto", "regex", "date", "relational", "vacation"]; +require ["fileinto", "regex", "date", "relational", "vacation", "imap4flags", "envelope", "subaddress", "copy", "reject"]; # Move spam to spam folder -if header :contains "X-Spam-Flag" "YES" { +if anyof (header :contains "X-Spam-Flag" "YES", header :contains "X-Spam" "Yes", header :contains "subject" "*** SPAM ***", header :contains "subject" "***SPAM***") { fileinto "Junk"; # Stop here so that we do not reply on spams stop; @@ -26,7 +26,7 @@ keep; ################################################################# # Move spam to spam folder -if header :contains "X-Spam-Flag" "YES" { +if anyof (header :contains "X-Spam-Flag" "YES", header :contains "X-Spam" "Yes", header :contains "subject" "*** SPAM ***", header :contains "subject" "***SPAM***") { # Stop here so that we do not reply on spams stop; } diff --git a/server/lib/classes/system.inc.php b/server/lib/classes/system.inc.php index dafae52c8598109ce2a8f5b5ebd2d2a5483ad701..88cf83eeba5d1331e5d2331a4197d1bead52d906 100644 --- a/server/lib/classes/system.inc.php +++ b/server/lib/classes/system.inc.php @@ -1540,7 +1540,14 @@ class system{ $found = 0; if(is_array($lines)) { foreach($lines as $line) { - if($strict == 0) { + if($strict == 0 && preg_match('/^REGEX:(.*)$/', $search_pattern)) { + if(preg_match(substr($search_pattern, 6), $line)) { + $out .= $new_line."\n"; + $found = 1; + } else { + $out .= $line; + } + } elseif($strict == 0) { if(stristr($line, $search_pattern)) { $out .= $new_line."\n"; $found = 1; @@ -1578,7 +1585,14 @@ class system{ if($lines = @file($filename)) { $out = ''; foreach($lines as $line) { - if($strict == 0) { + if($strict == 0 && preg_match('/^REGEX:(.*)$/', $search_pattern)) { + if(preg_match(substr($search_pattern, 6), $line)) { + $out .= $new_line."\n"; + $found = 1; + } else { + $out .= $line; + } + } elseif($strict == 0) { if(!stristr($line, $search_pattern)) { $out .= $line; } diff --git a/server/mods-available/mail_module.inc.php b/server/mods-available/mail_module.inc.php index bc6d2901457169db191ef871c8acbabff74c03a1..14cbbb24e4262aee504da7db97c6d99112e12025 100644 --- a/server/mods-available/mail_module.inc.php +++ b/server/mods-available/mail_module.inc.php @@ -55,7 +55,14 @@ class mail_module { 'mail_content_filter_delete', 'mail_mailinglist_insert', 'mail_mailinglist_update', - 'mail_mailinglist_delete'); + 'mail_mailinglist_delete', + 'spamfilter_users_insert', + 'spamfilter_users_update', + 'spamfilter_users_delete', + 'spamfilter_wblist_insert', + 'spamfilter_wblist_update', + 'spamfilter_wblist_delete' + ); //* This function is called during ispconfig installation to determine // if a symlink shall be created for this plugin. @@ -102,7 +109,10 @@ class mail_module { $app->modules->registerTableHook('mail_get', 'mail_module', 'process'); $app->modules->registerTableHook('mail_content_filter', 'mail_module', 'process'); $app->modules->registerTableHook('mail_mailinglist', 'mail_module', 'process'); + $app->modules->registerTableHook('spamfilter_users', 'mail_module', 'process'); + $app->modules->registerTableHook('spamfilter_wblist', 'mail_module', 'process'); + $app->services->registerService('rspamd', 'mail_module', 'restartRspamd'); } /* @@ -154,9 +164,34 @@ class mail_module { if($action == 'u') $app->plugins->raiseEvent('mail_mailinglist_update', $data); if($action == 'd') $app->plugins->raiseEvent('mail_mailinglist_delete', $data); break; + case 'spamfilter_users': + if($action == 'i') $app->plugins->raiseEvent('spamfilter_users_insert', $data); + if($action == 'u') $app->plugins->raiseEvent('spamfilter_users_update', $data); + if($action == 'd') $app->plugins->raiseEvent('spamfilter_users_delete', $data); + break; + case 'spamfilter_wblist': + if($action == 'i') $app->plugins->raiseEvent('spamfilter_wblist_insert', $data); + if($action == 'u') $app->plugins->raiseEvent('spamfilter_wblist_update', $data); + if($action == 'd') $app->plugins->raiseEvent('spamfilter_wblist_delete', $data); + break; } // end switch } // end function + function restartRspamd($action = 'reload') { + global $app; + + $app->uses('system'); + + $daemon = 'rspamd'; + + $retval = array('output' => '', 'retval' => 0); + if($action == 'restart') { + exec($app->system->getinitcommand($daemon, 'restart').' 2>&1', $retval['output'], $retval['retval']); + } else { + exec($app->system->getinitcommand($daemon, 'reload').' 2>&1', $retval['output'], $retval['retval']); + } + return $retval; + } } // end class ?> diff --git a/server/plugins-available/apps_vhost_plugin.inc.php b/server/plugins-available/apps_vhost_plugin.inc.php index ea2359d6026f06658d926d448993aa0a48c10940..4d0866d1de9f283d25e23c857d6b652bf6975e15 100644 --- a/server/plugins-available/apps_vhost_plugin.inc.php +++ b/server/plugins-available/apps_vhost_plugin.inc.php @@ -106,6 +106,16 @@ class apps_vhost_plugin { $vhost_port_listen = '#'; } $tpl->setVar('vhost_port_listen', $vhost_port_listen); + + $mail_config = $app->getconf->get_server_config($conf['server_id'], 'mail'); + if($mail_config['content_filter'] == 'rspamd'){ + $use_rspamd = true; + exec('/usr/sbin/a2enmod proxy'); + exec('/usr/sbin/a2enmod proxy_http'); + } else { + $use_rspamd = false; + } + $tpl->setVar('use_rspamd', $use_rspamd); $content = $tpl->grab(); @@ -184,6 +194,14 @@ class apps_vhost_plugin { $content = str_replace('{use_tcp}', $use_tcp, $content); $content = str_replace('{use_socket}', $use_socket, $content); + $mail_config = $app->getconf->get_server_config($conf['server_id'], 'mail'); + if($mail_config['content_filter'] == 'rspamd'){ + $use_rspamd = ''; + } else { + $use_rspamd = '#'; + } + $content = str_replace('{use_rspamd}', $use_rspamd, $content); + // Fix socket path on PHP 7 systems if(file_exists('/var/run/php/php7.0-fpm.sock')) $content = str_replace('/var/run/php5-fpm.sock', '/var/run/php/php7.0-fpm.sock', $content); if(file_exists('/var/run/php/php7.1-fpm.sock')) $content = str_replace('/var/run/php5-fpm.sock', '/var/run/php/php7.1-fpm.sock', $content); @@ -221,7 +239,3 @@ class apps_vhost_plugin { } // end class - - - -?> diff --git a/server/plugins-available/mail_plugin_dkim.inc.php b/server/plugins-available/mail_plugin_dkim.inc.php index b54f4f56c76312aba7572c41e099f5a31da0980a..b937f82275192fbcef06f19e2e9f14eebb79a240 100755 --- a/server/plugins-available/mail_plugin_dkim.inc.php +++ b/server/plugins-available/mail_plugin_dkim.inc.php @@ -29,6 +29,7 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. @author Florian Schaal, info@schaal-24.de + @author Marius Burkard, m.burkard@ispconfig.org (modified for rspamd) @copyright Florian Schaal, info@schaal-24.de */ @@ -59,8 +60,8 @@ class mail_plugin_dkim { /** * This function is called when the plugin is loaded */ - function onLoad() { - global $app, $conf; + public function onLoad() { + global $app; /* Register for the events */ @@ -73,7 +74,7 @@ class mail_plugin_dkim { * This function gets the amavisd-config file * @return string path to the amavisd-config for dkim-keys */ - function get_amavis_config() { + private function get_amavis_config() { $pos_config=array( '/etc/amavisd.conf/50-user', '/etc/amavis/conf.d/50-user', @@ -101,42 +102,59 @@ class mail_plugin_dkim { * @param array $data mail-settings * @return boolean - true when the amavis-config and the dkim-dir are writeable */ - function check_system($data) { - global $app, $mail_config; + private function check_system() { + global $app, $conf, $mail_config; $app->uses('getconf'); - $check=true; + $check = true; - /* check for amavis-config */ - $amavis_configfile = $this->get_amavis_config(); - - //* Create the file if it does not exists. - if (substr_compare($amavis_configfile, '60-dkim', -7) === 0 && !file_exists($amavis_configfile)) - $app->system->touch($amavis_configfile); + $mail_config = $app->getconf->get_server_config($conf['server_id'], 'mail'); + if($mail_config['content_filter'] != 'rspamd') { + /* check for amavis-config */ + $amavis_configfile = $this->get_amavis_config(); - if ( $amavis_configfile == '' || !is_writeable($amavis_configfile) ) { - $app->log('Amavis-config not found or not writeable.', LOGLEVEL_ERROR); - $check=false; + //* Create the file if it does not exists. + if (substr_compare($amavis_configfile, '60-dkim', -7) === 0 && !file_exists($amavis_configfile)) { + $app->system->touch($amavis_configfile); + } + + if ( $amavis_configfile == '' || !is_writeable($amavis_configfile) ) { + $app->log('Amavis-config not found or not writeable.', LOGLEVEL_ERROR); + $check = false; + } } /* dir for dkim-keys writeable? */ - $mail_config = $app->getconf->get_server_config($conf['server_id'], 'mail'); if (isset($mail_config['dkim_path']) && !empty($mail_config['dkim_path']) && $mail_config['dkim_path'] != '/') { if (!is_dir($mail_config['dkim_path'])) { $app->log('DKIM Path '.$mail_config['dkim_path'].' not found - (re)created.', LOGLEVEL_DEBUG); if($app->system->is_user('amavis')) { $amavis_user='amavis'; + } elseif($app->system->is_user('_rspamd')) { + $amavis_user = '_rspamd'; + } elseif($app->system->is_user('rspamd')) { + $amavis_user = 'rspamd'; } elseif ($app->system->is_user('vscan')) { - $amavis_user='vscan'; + $amavis_user = 'vscan'; + } else { + $amavis_user = ''; } - else { - $amavis_user=''; + if($app->system->is_user('amavis')) { + $amavis_group='amavis'; + } elseif($app->system->is_user('_rspamd')) { + $amavis_group = '_rspamd'; + } elseif($app->system->is_user('rspamd')) { + $amavis_group = 'rspamd'; + } elseif ($app->system->is_user('vscan')) { + $amavis_group = 'vscan'; + } else { + $amavis_group = ''; } + if(!empty($amavis_user)) { - mkdir($mail_config['dkim_path'], 0750, true); - $app->system->chown($mail_config['dkim_path'], $amavis_user); + $app->system->mkdirpath($mail_config['dkim_path'], 0750, $amavis_user, $amavis_group); } else { - mkdir($mail_config['dkim_path'], 0755, true); + $app->system->mkdirpath($mail_config['dkim_path'], 0755); $app->log('No user amavis or vscan found - using root for '.$mail_config['dkim_path'], LOGLEVEL_WARNING); } } else { @@ -166,12 +184,15 @@ class mail_plugin_dkim { /** * This function restarts amavis */ - function restart_amavis() { + private function restart_amavis() { global $app; + $output = null; $initcommand = $app->system->getinitcommand(array('amavis', 'amavisd'), 'restart'); $app->log('Restarting amavis: '.$initcommand.'.', LOGLEVEL_DEBUG); exec($initcommand, $output); - foreach($output as $logline) $app->log($logline, LOGLEVEL_DEBUG); + foreach($output as $logline) { + $app->log($logline, LOGLEVEL_DEBUG); + } } /** @@ -181,8 +202,8 @@ class mail_plugin_dkim { * @param string $key_domain mail-domain * @return bool - true when the private key was written to disk */ - function write_dkim_key($key_file, $key_value, $key_domain) { - global $app, $mailconfig; + private function write_dkim_key($key_file, $key_value, $key_domain) { + global $app; $success=false; if ($key_file == '' || $key_value == '' || $key_domain == '') { $app->log('DKIM internal error for domain '.$key_domain, LOGLEVEL_ERROR); @@ -191,15 +212,21 @@ class mail_plugin_dkim { if ( $app->system->file_put_contents($key_file.'.private', $key_value) ) { $app->log('Saved DKIM Private-key to '.$key_file.'.private', LOGLEVEL_DEBUG); $success=true; + $pubkey = null; + $result = 0; /* now we get the DKIM Public-key */ $app->system->exec_safe('cat ?|openssl rsa -pubout 2> /dev/null', $key_file.'.private'); $pubkey = $app->system->last_exec_out(); $public_key=''; - foreach($pubkey as $values) $public_key=$public_key.$values."\n"; + foreach($pubkey as $values) { + $public_key = $public_key . $values . "\n"; + } /* save the DKIM Public-key in dkim-dir */ - if ( $app->system->file_put_contents($key_file.'.public', $public_key) ) + if($app->system->file_put_contents($key_file.'.public', $public_key)) { $app->log('Saved DKIM Public to '.$key_domain.'.', LOGLEVEL_DEBUG); - else $app->log('Unable to save DKIM Public to '.$key_domain.'.', LOGLEVEL_DEBUG); + } else { + $app->log('Unable to save DKIM Public to '.$key_domain.'.', LOGLEVEL_DEBUG); + } } else { $app->log('Unable to save DKIM Private-key to '.$key_file.'.private', LOGLEVEL_ERROR); } @@ -211,26 +238,32 @@ class mail_plugin_dkim { * @param string $key_file full path to the key-file * @param string $key_domain mail-domain */ - function remove_dkim_key($key_file, $key_domain) { + private function remove_dkim_key($key_file, $key_domain) { global $app; if (file_exists($key_file.'.private')) { $app->system->unlink($key_file.'.private'); $app->log('Deleted the DKIM Private-key for '.$key_domain.'.', LOGLEVEL_DEBUG); - } else $app->log('Unable to delete the DKIM Private-key for '.$key_domain.' (not found).', LOGLEVEL_DEBUG); + } else { + $app->log('Unable to delete the DKIM Private-key for '.$key_domain.' (not found).', LOGLEVEL_DEBUG); + } if (file_exists($key_file.'.public')) { $app->system->unlink($key_file.'.public'); $app->log('Deleted the DKIM Public-key for '.$key_domain.'.', LOGLEVEL_DEBUG); - } else $app->log('Unable to delete the DKIM Public-key for '.$key_domain.' (not found).', LOGLEVEL_DEBUG); + } else { + $app->log('Unable to delete the DKIM Public-key for '.$key_domain.' (not found).', LOGLEVEL_DEBUG); + } } /** * This function adds the entry to the amavisd-config * @param string $key_domain mail-domain */ - function add_to_amavis($key_domain, $selector, $old_selector) { + private function add_to_amavis($key_domain, $selector, $old_selector) { global $app, $mail_config; - if (empty($selector)) $selector = 'default'; + if (empty($selector)) { + $selector = 'default'; + } $restart = false; $amavis_configfile = $this->get_amavis_config(); @@ -268,7 +301,7 @@ class mail_plugin_dkim { * This function removes the entry from the amavisd-config * @param string $key_domain mail-domain */ - function remove_from_amavis($key_domain) { + private function remove_from_amavis($key_domain) { global $app; $restart = false; @@ -306,14 +339,20 @@ class mail_plugin_dkim { * This function controlls new key-files and amavisd-entries * @param array $data mail-settings */ - function add_dkim($data) { - global $app; + private function add_dkim($data) { + global $app, $conf; if ($data['new']['active'] == 'y') { $mail_config = $app->getconf->get_server_config($conf['server_id'], 'mail'); - if ( substr($mail_config['dkim_path'], strlen($mail_config['dkim_path'])-1) == '/' ) + if ( substr($mail_config['dkim_path'], strlen($mail_config['dkim_path'])-1) == '/' ) { $mail_config['dkim_path'] = substr($mail_config['dkim_path'], 0, strlen($mail_config['dkim_path'])-1); + } if ($this->write_dkim_key($mail_config['dkim_path']."/".$data['new']['domain'], $data['new']['dkim_private'], $data['new']['domain'])) { - if ($this->add_to_amavis($data['new']['domain'], $data['new']['dkim_selector'], $data['old']['dkim_selector'] )) { + if($mail_config['content_filter'] == 'rspamd') { + $app->system->replaceLine('/etc/rspamd/local.d/dkim_domains.map', 'REGEX:/^' . preg_quote($data['new']['domain'], '/') . ' /', $data['new']['domain'] . ' ' . $mail_config['dkim_path']."/".$data['new']['domain'] . '.private'); + $app->system->replaceLine('/etc/rspamd/local.d/dkim_selectors.map', 'REGEX:/^' . preg_quote($data['new']['domain'], '/') . ' /', $data['new']['domain'] . ' ' . $data['new']['dkim_selector']); + + $app->services->restartServiceDelayed('rspamd', 'reload'); + } elseif ($this->add_to_amavis($data['new']['domain'], $data['new']['dkim_selector'], $data['old']['dkim_selector'] )) { $this->restart_amavis(); } else { $this->remove_dkim_key($mail_config['dkim_path']."/".$data['new']['domain'], $data['new']['domain']); @@ -327,86 +366,91 @@ class mail_plugin_dkim { /** * This function controlls the removement of keyfiles (public and private) * and the entry in the amavisd-config - * @param array $data mail-settings + * @param array $_data mail-settings */ - function remove_dkim($_data) { - global $app; + private function remove_dkim($_data) { + global $app, $conf; $mail_config = $app->getconf->get_server_config($conf['server_id'], 'mail'); - if ( substr($mail_config['dkim_path'], strlen($mail_config['dkim_path'])-1) == '/' ) + if ( substr($mail_config['dkim_path'], strlen($mail_config['dkim_path'])-1) == '/' ) { $mail_config['dkim_path'] = substr($mail_config['dkim_path'], 0, strlen($mail_config['dkim_path'])-1); + } $this->remove_dkim_key($mail_config['dkim_path']."/".$_data['domain'], $_data['domain']); - if ($this->remove_from_amavis($_data['domain'])) + + if($mail_config['content_filter'] == 'rspamd') { + $app->system->removeLine('/etc/rspamd/local.d/dkim_domains.map', 'REGEX:/^' . preg_quote($_data['domain'], '/') . ' /'); + $app->system->removeLine('/etc/rspamd/local.d/dkim_selectors.map', 'REGEX:/^' . preg_quote($_data['domain'], '/') . ' /'); + $app->services->restartServiceDelayed('rspamd', 'reload'); + } elseif ($this->remove_from_amavis($_data['domain'])) { $this->restart_amavis(); + } } /** * Function called by onLoad * deletes dkim-keys */ - function domain_dkim_delete($event_name, $data) { - if (isset($data['old']['dkim']) && $data['old']['dkim'] == 'y' && $data['old']['active'] == 'y') + public function domain_dkim_delete($event_name, $data) { + if (isset($data['old']['dkim']) && $data['old']['dkim'] == 'y' && $data['old']['active'] == 'y') { $this->remove_dkim($data['old']); + } } /** * Function called by onLoad * insert dkim-keys */ - function domain_dkim_insert($event_name, $data) { - if (isset($data['new']['dkim']) && $data['new']['dkim']=='y' && $this->check_system($data)) + public function domain_dkim_insert($event_name, $data) { + if (isset($data['new']['dkim']) && $data['new']['dkim']=='y' && $this->check_system()) { $this->add_dkim($data); + } } /** * Function called by onLoad * chang dkim-settings */ - function domain_dkim_update($event_name, $data) { + public function domain_dkim_update($event_name, $data) { global $app; if($data['new']['dkim'] == 'y' || $data['old']['dkim'] == 'y'){ - if ($this->check_system($data)) { + if ($this->check_system()) { /* maildomain disabled */ if ($data['new']['active'] == 'n' && $data['old']['active'] == 'y' && $data['new']['dkim']=='y') { $app->log('Maildomain '.$data['new']['domain'].' disabled - remove DKIM-settings', LOGLEVEL_DEBUG); $this->remove_dkim($data['new']); } /* maildomain re-enabled */ - if ($data['new']['active'] == 'y' && $data['old']['active'] == 'n' && $data['new']['dkim']=='y') + if ($data['new']['active'] == 'y' && $data['old']['active'] == 'n' && $data['new']['dkim']=='y') { $this->add_dkim($data); - + } + /* maildomain active - only dkim changes */ if ($data['new']['active'] == 'y' && $data['old']['active'] == 'y') { /* dkim disabled */ if ($data['new']['dkim'] != $data['old']['dkim'] && $data['new']['dkim'] == 'n') { $this->remove_dkim($data['new']); } - /* dkim enabled */ - elseif ($data['new']['dkim'] != $data['old']['dkim'] && $data['new']['dkim'] == 'y') { - $this->add_dkim($data); - } - /* new private-key */ - if ($data['new']['dkim_private'] != $data['old']['dkim_private'] && $data['new']['dkim'] == 'y') { - $this->add_dkim($data); - } - /* new selector */ - if ($data['new']['dkim_selector'] != $data['old']['dkim_selector'] && $data['new']['dkim'] == 'y') { + /* dkim enabled + * or new private-key + * or new selector + * or new domain-name + */ + elseif ( + ($data['new']['dkim'] != $data['old']['dkim'] && $data['new']['dkim'] == 'y') + || ($data['new']['dkim_private'] != $data['old']['dkim_private'] && $data['new']['dkim'] == 'y') + || ($data['new']['dkim_selector'] != $data['old']['dkim_selector'] && $data['new']['dkim'] == 'y') + || ($data['new']['domain'] != $data['old']['domain']) + ) { + if ($data['new']['domain'] != $data['old']['domain']) { + $this->remove_dkim($data['old']); + } $this->add_dkim($data); } - /* new domain-name */ - if ($data['new']['domain'] != $data['old']['domain']) { - $this->remove_dkim($data['old']); + /* resync */ + elseif($data['new'] == $data['old'] && $data['new']['dkim']=='y') { $this->add_dkim($data); } } - - /* resync */ - if ($data['new']['active'] == 'y' && $data['new'] == $data['old'] && $data['new']['dkim']=='y') { - $this->add_dkim($data); - } } } } - } - -?> diff --git a/server/plugins-available/postfix_server_plugin.inc.php b/server/plugins-available/postfix_server_plugin.inc.php index 569959b84f59c5b495912179789624487eaa5147..bec1c5498d786d6abf60eef2b990dc18448991af 100644 --- a/server/plugins-available/postfix_server_plugin.inc.php +++ b/server/plugins-available/postfix_server_plugin.inc.php @@ -60,15 +60,11 @@ class postfix_server_plugin { Register for the events */ - $app->plugins->registerEvent('server_insert', 'postfix_server_plugin', 'insert'); - $app->plugins->registerEvent('server_update', 'postfix_server_plugin', 'update'); - - - + $app->plugins->registerEvent('server_insert', $this->plugin_name, 'insert'); + $app->plugins->registerEvent('server_update', $this->plugin_name, 'update'); } function insert($event_name, $data) { - global $app, $conf; $this->update($event_name, $data); @@ -116,7 +112,7 @@ class postfix_server_plugin { if($rbl_hosts != ''){ $rbl_hosts = explode(",", $rbl_hosts); } - $options = explode(", ", exec("postconf -h smtpd_recipient_restrictions")); + $options = preg_split("/,\s*/", exec("postconf -h smtpd_recipient_restrictions")); $new_options = array(); foreach ($options as $key => $value) { if (!preg_match('/reject_rbl_client/', $value)) { @@ -162,7 +158,8 @@ class postfix_server_plugin { } if($app->system->is_installed('dovecot')) { - $temp = exec("postconf -n virtual_transport", $out); + $out = null; + exec("postconf -n virtual_transport", $out); if ($mail_config["mailbox_virtual_uidgid_maps"] == 'y') { // If dovecot switch to lmtp if($out[0] != "virtual_transport = lmtp:unix:private/dovecot-lmtp") { @@ -182,12 +179,74 @@ class postfix_server_plugin { } } + if($mail_config['content_filter'] != $old_ini_data['mail']['content_filter']) { + if($mail_config['content_filter'] == 'rspamd'){ + exec("postconf -X 'receive_override_options'"); + exec("postconf -X 'content_filter'"); + + exec("postconf -e 'smtpd_milters = inet:localhost:11332'"); + exec("postconf -e 'non_smtpd_milters = inet:localhost:11332'"); + exec("postconf -e 'milter_protocol = 6'"); + exec("postconf -e 'milter_mail_macros = i {mail_addr} {client_addr} {client_name} {auth_authen}'"); + exec("postconf -e 'milter_default_action = accept'"); + + exec("postconf -e 'smtpd_sender_restrictions = check_sender_access mysql:/etc/postfix/mysql-virtual_sender.cf, permit_mynetworks, permit_sasl_authenticated'"); + + $new_options = array(); + $options = preg_split("/,\s*/", exec("postconf -h smtpd_recipient_restrictions")); + foreach ($options as $key => $value) { + if (!preg_match('/check_policy_service\s+inet:127.0.0.1:10023/', $value)) { + $new_options[] = $value; + } + } + exec("postconf -e 'smtpd_recipient_restrictions = ".implode(", ", $new_options)."'"); + + // get all domains that have dkim enabled + if ( substr($mail_config['dkim_path'], strlen($mail_config['dkim_path'])-1) == '/' ) { + $mail_config['dkim_path'] = substr($mail_config['dkim_path'], 0, strlen($mail_config['dkim_path'])-1); + } + $dkim_domains = $app->db->queryAllRecords('SELECT `dkim_selector`, `domain` FROM `mail_domain` WHERE `dkim` = ? ORDER BY `domain` ASC', 'y'); + $fpp = fopen('/etc/rspamd/local.d/dkim_domains.map', 'w'); + $fps = fopen('/etc/rspamd/local.d/dkim_selectors.map', 'w'); + foreach($dkim_domains as $dkim_domain) { + fwrite($fpp, $dkim_domain['domain'] . ' ' . $mail_config['dkim_path'] . '/' . $dkim_domain['domain'] . '.private' . "\n"); + fwrite($fps, $dkim_domain['domain'] . ' ' . $dkim_domain['dkim_selector'] . "\n"); + } + fclose($fpp); + fclose($fps); + unset($dkim_domains); + } + if($mail_config['content_filter'] == 'amavisd'){ + exec("postconf -X 'smtpd_milters'"); + exec("postconf -X 'milter_protocol'"); + exec("postconf -X 'milter_mail_macros'"); + exec("postconf -X 'milter_default_action'"); + + exec("postconf -e 'receive_override_options = no_address_mappings'"); + exec("postconf -e 'content_filter = amavis:[127.0.0.1]:10024'"); + + exec("postconf -e 'smtpd_sender_restrictions = check_sender_access mysql:/etc/postfix/mysql-virtual_sender.cf regexp:/etc/postfix/tag_as_originating.re, permit_mynetworks, permit_sasl_authenticated, check_sender_access regexp:/etc/postfix/tag_as_foreign.re'"); + } + } + + if($mail_config['content_filter'] == 'rspamd' && ($mail_config['rspamd_password'] != $old_ini_data['mail']['rspamd_password'] || $mail_config['content_filter'] != $old_ini_data['mail']['content_filter'])) { + $app->load('tpl'); + + $rspamd_password = $mail_config['rspamd_password']; + $crypted_password = trim(exec('rspamadm pw -p ' . escapeshellarg($rspamd_password))); + if($crypted_password) { + $rspamd_password = $crypted_password; + } + + $tpl = new tpl(); + $tpl->newTemplate('rspamd_worker-controller.inc.master'); + $tpl->setVar('rspamd_password', $rspamd_password); + $app->system->file_put_contents('/etc/rspamd/local.d/worker-controller.inc', $tpl->grab()); + $app->services->restartServiceDelayed('rspamd', 'reload'); + } + exec("postconf -e 'mailbox_size_limit = ".intval($mail_config['mailbox_size_limit']*1024*1024)."'"); exec("postconf -e 'message_size_limit = ".intval($mail_config['message_size_limit']*1024*1024)."'"); - exec('postfix reload'); - + $app->services->restartServiceDelayed('postfix', 'reload'); } - } // end class - -?> diff --git a/server/plugins-available/rspamd_plugin.inc.php b/server/plugins-available/rspamd_plugin.inc.php new file mode 100644 index 0000000000000000000000000000000000000000..7fd3ebf7731521788decc1ab3de2ee402f78ed64 --- /dev/null +++ b/server/plugins-available/rspamd_plugin.inc.php @@ -0,0 +1,319 @@ +plugins->registerEvent('spamfilter_users_insert', $this->plugin_name, 'spamfilter_users_insert'); + $app->plugins->registerEvent('spamfilter_users_update', $this->plugin_name, 'spamfilter_users_update'); + $app->plugins->registerEvent('spamfilter_users_delete', $this->plugin_name, 'spamfilter_users_delete'); + + //* spamfilter_wblist + $app->plugins->registerEvent('spamfilter_wblist_insert', $this->plugin_name, 'spamfilter_wblist_insert'); + $app->plugins->registerEvent('spamfilter_wblist_update', $this->plugin_name, 'spamfilter_wblist_update'); + $app->plugins->registerEvent('spamfilter_wblist_delete', $this->plugin_name, 'spamfilter_wblist_delete'); + + //* server ip + $app->plugins->registerEvent('server_ip_insert', $this->plugin_name, 'server_ip'); + $app->plugins->registerEvent('server_ip_update', $this->plugin_name, 'server_ip'); + $app->plugins->registerEvent('server_ip_delete', $this->plugin_name, 'server_ip'); + + //* global mail access filters + $app->plugins->registerEvent('mail_access_insert', $this->plugin_name, 'spamfilter_wblist_insert'); + $app->plugins->registerEvent('mail_access_update', $this->plugin_name, 'spamfilter_wblist_update'); + $app->plugins->registerEvent('mail_access_delete', $this->plugin_name, 'spamfilter_wblist_delete'); + } + + function spamfilter_users_insert($event_name, $data) { + $this->action = 'insert'; + // just run the spamfilter_users_update function + $this->spamfilter_users_update($event_name, $data); + } + + function spamfilter_users_update($event_name, $data) { + global $app, $conf; + + // get the config + $app->uses('getconf,system,functions'); + $mail_config = $app->getconf->get_server_config($conf['server_id'], 'mail'); + + if(is_dir('/etc/rspamd')) { + $policy = $app->db->queryOneRecord("SELECT * FROM spamfilter_policy WHERE id = ?", intval($data['new']['policy_id'])); + + //* Create the config file + $user_file = $this->users_config_dir.'spamfilter_user_'.intval($data['new']['id']).'.conf'; + + if(is_array($policy) && !empty($policy)){ + if(!is_dir($this->users_config_dir)){ + $app->system->mkdirpath($this->users_config_dir); + } + + $app->load('tpl'); + + $tpl = new tpl(); + $tpl->newTemplate('rspamd_users.inc.conf.master'); + $tpl->setVar('record_id', intval($data['new']['id'])); + $tpl->setVar('priority', intval($data['new']['priority'])); + $tpl->setVar('email', $app->functions->idn_encode($data['new']['email'])); + $tpl->setVar('local', $data['new']['local']); + + $tpl->setVar('rspamd_greylisting', $policy['rspamd_greylisting']); + $tpl->setVar('rspamd_spam_greylisting_level', floatval($policy['rspamd_spam_greylisting_level'])); + + $tpl->setVar('rspamd_spam_tag_level', floatval($policy['rspamd_spam_tag_level'])); + $tpl->setVar('rspamd_spam_tag_method', $policy['rspamd_spam_tag_method']); + + $tpl->setVar('rspamd_spam_kill_level', floatval($policy['rspamd_spam_kill_level'])); + $tpl->setVar('rspamd_virus_kill_level', floatval($policy['rspamd_spam_kill_level']) + 1000); + + $spam_lover_virus_lover = ''; + if($policy['spam_lover'] == 'Y' && $policy['virus_lover'] == 'Y') $spam_lover_virus_lover = 'spam_lover_AND_virus_lover'; + if($policy['spam_lover'] == 'Y' && $policy['virus_lover'] != 'Y') $spam_lover_virus_lover = 'spam_lover_AND_NOTvirus_lover'; + if($policy['spam_lover'] != 'Y' && $policy['virus_lover'] == 'Y') $spam_lover_virus_lover = 'NOTspam_lover_AND_virus_lover'; + if($policy['spam_lover'] != 'Y' && $policy['virus_lover'] != 'Y') $spam_lover_virus_lover = 'NOTspam_lover_AND_NOTvirus_lover'; + + $tpl->setVar('spam_lover_virus_lover', $spam_lover_virus_lover); + + //$groups_disabled = array(); + //if($policy['virus_lover'] == 'Y') $groups_disabled[] = ''; + + $app->system->file_put_contents($user_file, $tpl->grab()); + } else { + if(is_file($user_file)) { + unlink($user_file); + } + } + + if($mail_config['content_filter'] == 'rspamd'){ + if(is_file('/etc/init.d/rspamd')) $app->services->restartServiceDelayed('rspamd', 'reload'); + } + } + } + + function spamfilter_users_delete($event_name, $data) { + global $app, $conf; + + // get the config + $app->uses('getconf'); + $mail_config = $app->getconf->get_server_config($conf['server_id'], 'mail'); + + if(is_dir('/etc/rspamd')) { + //* delete the config file + $user_file = $this->users_config_dir.'spamfilter_user_'.intval($data['old']['id']).'.conf'; + if(is_file($user_file)) unlink($user_file); + + } + + if($mail_config['content_filter'] == 'rspamd') { + if(is_file('/etc/init.d/rspamd')) $app->services->restartServiceDelayed('rspamd', 'reload'); + } + } + + function spamfilter_wblist_insert($event_name, $data) { + $this->action = 'insert'; + // just run the spamfilter_wblist_update function + $this->spamfilter_wblist_update($event_name, $data); + } + + function spamfilter_wblist_update($event_name, $data) { + global $app, $conf; + + $app->uses('getconf,system,functions'); + $mail_config = $app->getconf->get_server_config($conf['server_id'], 'mail'); + + if(is_dir('/etc/rspamd')) { + $global_filter = false; + //* Create the config file + $filter = null; + if($event_name === 'mail_access_insert' || $event_name === 'mail_access_update') { + $global_filter = true; + $record_id = intval($data['new']['access_id']); + $wblist_file = $this->users_config_dir.'global_wblist_'.$record_id.'.conf'; + $filter = array( + 'wb' => ($data['new']['access'] === 'OK' ? 'W' : 'B'), + 'from' => ($data['new']['type'] === 'sender' ? $app->functions->idn_encode($data['new']['source']) : ''), + 'rcpt' => ($data['new']['type'] === 'recipient' ? $app->functions->idn_encode($data['new']['source']) : ''), + 'ip' => ($data['new']['type'] === 'client' && $this->_is_valid_ip_address($data['new']['source']) ? $data['new']['source'] : ''), + 'hostname' => ($data['new']['type'] === 'client' && !$this->_is_valid_ip_address($data['new']['source']) ? $data['new']['source'] : '') + ); + } else { + $record_id = intval($data['new']['wblist_id']); + $wblist_file = $this->users_config_dir.'spamfilter_wblist_'.$record_id.'.conf'; + $tmp = $app->db->queryOneRecord("SELECT email FROM spamfilter_users WHERE id = ?", intval($data['new']['rid'])); + if($tmp && !empty($tmp)) { + $filter = array( + 'wb' => $data['new']['wb'], + 'from' => $app->functions->idn_encode($data['new']['email']), + 'rcpt' => $app->functions->idn_encode($tmp['email']), + 'ip' => '', + 'hostname' => '' + ); + } + } + + if($data['new']['active'] == 'y' && is_array($filter) && !empty($filter)){ + if(!is_dir($this->users_config_dir)){ + $app->system->mkdirpath($this->users_config_dir); + } + + $app->load('tpl'); + + $filter_from = $filter['from']; + if($filter_from != '') { + if(strpos($filter_from, '@') === false) { + $filter_from = '@' . $filter_from; + } elseif(substr($filter_from, 0, 2) === '*@') { + $filter_from = substr($filter_from, 1); + } + } + $filter_rcpt = $filter['rcpt']; + if($filter_rcpt != '') { + if(strpos($filter_rcpt, '@') === false) { + $filter_rcpt = '@' . $filter_rcpt; + } elseif(substr($filter_rcpt, 0, 2) === '*@') { + $filter_rcpt = substr($filter_rcpt, 1); + } + } + + $tpl = new tpl(); + $tpl->newTemplate('rspamd_wblist.inc.conf.master'); + $tpl->setVar('list_scope', ($global_filter ? 'global' : 'spamfilter')); + $tpl->setVar('record_id', $record_id); + // we need to add 10 to priority to avoid mailbox/domain spamfilter settings overriding white/blacklists + $tpl->setVar('priority', intval($data['new']['priority']) + ($global_filter ? 20 : 10)); + $tpl->setVar('from', $filter_from); + $tpl->setVar('recipient', $filter_rcpt); + $tpl->setVar('hostname', $filter['hostname']); + $tpl->setVar('ip', $filter['ip']); + $tpl->setVar('wblist', $filter['wb']); + + $app->system->file_put_contents($wblist_file, $tpl->grab()); + } elseif(is_file($wblist_file)) { + unlink($wblist_file); + } + + if($mail_config['content_filter'] == 'rspamd' && is_file('/etc/init.d/rspamd')) { + $app->services->restartServiceDelayed('rspamd', 'reload'); + } + } + } + + function spamfilter_wblist_delete($event_name, $data) { + global $app, $conf; + + $app->uses('getconf'); + $mail_config = $app->getconf->get_server_config($conf['server_id'], 'mail'); + + if(is_dir('/etc/rspamd')) { + //* delete the config file + if($event_name === 'mail_access_delete') { + $wblist_file = $this->users_config_dir.'global_wblist_'.intval($data['old']['access_id']).'.conf'; + } else { + $wblist_file = $this->users_config_dir.'spamfilter_wblist_'.intval($data['old']['wblist_id']).'.conf'; + } + if(is_file($wblist_file)) { + unlink($wblist_file); + } + + if($mail_config['content_filter'] == 'rspamd'){ + if(is_file('/etc/init.d/rspamd')) $app->services->restartServiceDelayed('rspamd', 'reload'); + } + } + } + + function server_ip($event_name, $data) { + global $app, $conf; + + // get the config + $app->uses("getconf,system"); + $app->load('tpl'); + + $mail_config = $app->getconf->get_server_config($conf['server_id'], 'mail'); + + if(is_dir('/etc/rspamd')) { + $tpl = new tpl(); + $tpl->newTemplate('rspamd_users.conf.master'); + + $whitelist_ips = array(); + $ips = $app->db->queryAllRecords("SELECT * FROM server_ip WHERE server_id = ?", $conf['server_id']); + if(is_array($ips) && !empty($ips)){ + foreach($ips as $ip){ + $whitelist_ips[] = array('ip' => $ip['ip_address']); + } + } + $tpl->setLoop('whitelist_ips', $whitelist_ips); + $app->system->file_put_contents('/etc/rspamd/local.d/users.conf', $tpl->grab()); + + if($mail_config['content_filter'] == 'rspamd'){ + $app->services->restartServiceDelayed('rspamd', 'reload'); + } + } + } + + private function _is_valid_ip_address($ip) { + if(function_exists('filter_var')) { + if(!filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4 | FILTER_FLAG_IPV6)) { + return false; + } else { + return true; + } + } else { + return false; + } + } + +} // end class