Skip to content
Commits on Source (233)
#!/bin/bash
IFS=$'\n'
EX=0
ERRS="" ;
WARNS="" ;
ERRCNT=0 ;
WARNCNT=0 ;
OUTCNT=0 ;
FILECNT=0 ;
DONECNT=0 ;
CMD="find . -type f \( -name \"*.php\" -o -name \"*.lng\" \) -print" ;
if [[ "$1" == "commit" ]] ; then
CMD="git diff-tree --no-commit-id --name-only -r ${CI_COMMIT_SHA} | grep -E '\.(php|lng)$'" ;
fi
FILECNT=$(eval "${CMD} | wc -l") ;
for F in $(eval "$CMD") ; do
if [[ ! -e "${F}" && -f "${F}" ]] ; then
continue ;
fi
R=$(php -d error_reporting=E_ALL -d display_errors=On -l "$F" 2>/dev/null) ;
RET=$? ;
R=$(echo "${R}" | sed "/^$/d")
if [ $RET -gt 0 ] ; then
EX=1 ;
echo -n "E" ;
ERRS="${ERRS}${F}:"$'\n'"${R}"$'\n\n' ;
ERRCNT=$((ERRCNT + 1)) ;
else
if [[ "$R" == "Deprecated: "* ]] ; then
echo -n "W" ;
WARNS="${WARNS}${F}:"$'\n'"${R}"$'\n\n' ;
WARNCNT=$((WARNCNT + 1)) ;
else
echo -n "." ;
fi
fi
OUTCNT=$((OUTCNT + 1)) ;
DONECNT=$((DONECNT + 1)) ;
if [ $OUTCNT -ge 40 ] ; then
OUTCNT=0 ;
echo "[${DONECNT}/${FILECNT}]" ;
fi
done
echo ""
echo "--------------------------";
echo "${DONECNT} Files done"
echo "${ERRCNT} Errors"
if [ $ERRCNT -gt 0 ] ; then
echo "${ERRS}"
echo ""
fi
echo "${WARNCNT} Warnings"
if [ $WARNCNT -gt 0 ] ; then
echo ""
echo "${WARNS}"
echo ""
fi
exit $EX
\ No newline at end of file
# Defines stages which are to be executed
stages:
- syntax
- syntax_diff
#
### Stage syntax
......@@ -13,10 +14,38 @@ syntax:lint:
only:
- schedules
- web
- merge_requests
script:
- composer require overtrue/phplint
- echo "Syntax checking PHP files"
- echo "For more information http://www.icosaedro.it/phplint/"
- vendor/bin/phplint
- bash ./.git-scripts/syntax.sh
syntax_diff:lint:
stage: syntax
image: edbizarro/gitlab-ci-pipeline-php:7.2
allow_failure: false
only:
- web
- pushes
- branches
script:
- echo "Syntax checking PHP files"
- bash ./.git-scripts/syntax.sh commit
#syntax:lint:
# stage: syntax
# image: edbizarro/gitlab-ci-pipeline-php:7.2
# allow_failure: false
# only:
# - schedules
# - web
# - merge_requests
#
# script:
# - composer require overtrue/phplint
# - echo "Syntax checking PHP files"
# - echo "For more information http://www.icosaedro.it/phplint/"
# - vendor/bin/phplint
path: ./
jobs: 10
jobs: 5
cache: .phplint-cache
extensions:
- php
......
......@@ -12,7 +12,7 @@ The master branch is used for code (mostly new features) that shall go into the
* Magic quotes is gone, get used to it now. config = magic_quotes_gpc() Everything must be quoted
* Don't use ereg, split and other old function -> gone in PHP 5.4
* Don't use features that are not supported in PHP 5.3, for compatibility with LTS OS releases, ISPConfig must support PHP 5.3+
* Don't use shorttags. A Shorttag is <? and that is confusing with <?xml -> always usw <?php
* Don't use shorttags. A Shorttag is <? and that is confusing with <?xml -> always use <?php
* Don't use namespaces
* Column names in database tables and database table names are in lowercase
* Classes for the interface are located in interface/lib/classes/ and loaded with $app->uses() or $app->load() functions.
......
<?php
/*
Copyright (c) 2020, Till Brehm, ISPConfig UG
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of ISPConfig nor the names of its contributors
may be used to endorse or promote products derived from this software without
specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
//*** Ubuntu 18.04 default settings
//* Main
$conf['language'] = 'en';
$conf['distname'] = 'ubuntu2004';
$conf['hostname'] = 'server1.domain.tld'; // Full hostname
$conf['ispconfig_install_dir'] = '/usr/local/ispconfig';
$conf['ispconfig_config_dir'] = '/usr/local/ispconfig';
$conf['ispconfig_log_priority'] = 2; // 0 = Debug, 1 = Warning, 2 = Error
$conf['ispconfig_log_dir'] = '/var/log/ispconfig';
$conf['server_id'] = 1;
$conf['init_scripts'] = '/etc/init.d';
$conf['runlevel'] = '/etc';
$conf['shells'] = '/etc/shells';
$conf['pam'] = '/etc/pam.d';
//* Services provided by this server, this selection will be overridden by the expert mode
$conf['services']['mail'] = true;
$conf['services']['web'] = true;
$conf['services']['dns'] = true;
$conf['services']['file'] = true;
$conf['services']['db'] = true;
$conf['services']['vserver'] = true;
$conf['services']['proxy'] = false;
$conf['services']['firewall'] = false;
//* MySQL
$conf['mysql']['installed'] = false; // will be detected automatically during installation
$conf['mysql']['init_script'] = 'mysql';
$conf['mysql']['host'] = 'localhost';
$conf['mysql']['ip'] = '127.0.0.1';
$conf['mysql']['port'] = '3306';
$conf['mysql']['database'] = 'dbispconfig';
$conf['mysql']['admin_user'] = 'root';
$conf['mysql']['admin_password'] = '';
$conf['mysql']['charset'] = 'utf8';
$conf['mysql']['ispconfig_user'] = 'ispconfig';
$conf['mysql']['ispconfig_password'] = md5(uniqid(rand()));
$conf['mysql']['master_slave_setup'] = 'n';
$conf['mysql']['master_host'] = '';
$conf['mysql']['master_database'] = 'dbispconfig';
$conf['mysql']['master_admin_user'] = 'root';
$conf['mysql']['master_admin_password'] = '';
$conf['mysql']['master_ispconfig_user'] = '';
$conf['mysql']['master_ispconfig_password'] = md5(uniqid(rand()));
//* Apache
$conf['apache']['installed'] = false; // will be detected automatically during installation
$conf['apache']['user'] = 'www-data';
$conf['apache']['group'] = 'www-data';
$conf['apache']['init_script'] = 'apache2';
$conf['apache']['version'] = '2.4';
$conf['apache']['vhost_conf_dir'] = '/etc/apache2/sites-available';
$conf['apache']['vhost_conf_enabled_dir'] = '/etc/apache2/sites-enabled';
$conf['apache']['vhost_port'] = '8080';
$conf['apache']['php_ini_path_apache'] = '/etc/php/7.4/apache2/php.ini';
$conf['apache']['php_ini_path_cgi'] = '/etc/php/7.4/cgi/php.ini';
//* Website base settings
$conf['web']['website_basedir'] = '/var/www';
$conf['web']['website_path'] = '/var/www/clients/client[client_id]/web[website_id]';
$conf['web']['website_symlinks'] = '/var/www/[website_domain]/:/var/www/clients/client[client_id]/[website_domain]/';
//* Apps base settings
$conf['web']['apps_vhost_ip'] = '_default_';
$conf['web']['apps_vhost_port'] = '8081';
$conf['web']['apps_vhost_servername'] = '';
$conf['web']['apps_vhost_user'] = 'ispapps';
$conf['web']['apps_vhost_group'] = 'ispapps';
//* Fastcgi
$conf['fastcgi']['fastcgi_phpini_path'] = '/etc/php/7.4/cgi/';
$conf['fastcgi']['fastcgi_starter_path'] = '/var/www/php-fcgi-scripts/[system_user]/';
$conf['fastcgi']['fastcgi_bin'] = '/usr/bin/php-cgi';
//* Postfix
$conf['postfix']['installed'] = false; // will be detected automatically during installation
$conf['postfix']['config_dir'] = '/etc/postfix';
$conf['postfix']['init_script'] = 'postfix';
$conf['postfix']['user'] = 'postfix';
$conf['postfix']['group'] = 'postfix';
$conf['postfix']['vmail_userid'] = '5000';
$conf['postfix']['vmail_username'] = 'vmail';
$conf['postfix']['vmail_groupid'] = '5000';
$conf['postfix']['vmail_groupname'] = 'vmail';
$conf['postfix']['vmail_mailbox_base'] = '/var/vmail';
//* Mailman
$conf['mailman']['installed'] = false; // will be detected automatically during installation
$conf['mailman']['config_dir'] = '/etc/mailman';
$conf['mailman']['init_script'] = 'mailman';
//* Getmail
$conf['getmail']['installed'] = false; // will be detected automatically during installation
$conf['getmail']['config_dir'] = '/etc/getmail';
$conf['getmail']['program'] = '/usr/bin/getmail';
//* Courier
$conf['courier']['installed'] = false; // will be detected automatically during installation
$conf['courier']['config_dir'] = '/etc/courier';
$conf['courier']['courier-authdaemon'] = 'courier-authdaemon';
$conf['courier']['courier-imap'] = 'courier-imap';
$conf['courier']['courier-imap-ssl'] = 'courier-imap-ssl';
$conf['courier']['courier-pop'] = 'courier-pop';
$conf['courier']['courier-pop-ssl'] = 'courier-pop-ssl';
//* Dovecot
$conf['dovecot']['installed'] = false; // will be detected automatically during installation
$conf['dovecot']['config_dir'] = '/etc/dovecot';
$conf['dovecot']['init_script'] = 'dovecot';
//* SASL
$conf['saslauthd']['installed'] = false; // will be detected automatically during installation
$conf['saslauthd']['config'] = '/etc/default/saslauthd';
$conf['saslauthd']['init_script'] = 'saslauthd';
//* Amavisd
$conf['amavis']['installed'] = false; // will be detected automatically during installation
$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';
//* Pureftpd
$conf['pureftpd']['installed'] = false; // will be detected automatically during installation
$conf['pureftpd']['config_dir'] = '/etc/pure-ftpd';
$conf['pureftpd']['init_script'] = 'pure-ftpd-mysql';
//* MyDNS
$conf['mydns']['installed'] = false; // will be detected automatically during installation
$conf['mydns']['config_dir'] = '/etc';
$conf['mydns']['init_script'] = 'mydns';
//* PowerDNS
$conf['powerdns']['installed'] = false; // will be detected automatically during installation
$conf['powerdns']['database'] = 'powerdns';
$conf["powerdns"]["config_dir"] = '/etc/powerdns/pdns.d';
$conf['powerdns']['init_script'] = 'pdns';
//* BIND DNS Server
$conf['bind']['installed'] = false; // will be detected automatically during installation
$conf['bind']['bind_user'] = 'root';
$conf['bind']['bind_group'] = 'bind';
$conf['bind']['bind_zonefiles_dir'] = '/etc/bind';
$conf['bind']['named_conf_path'] = '/etc/bind/named.conf';
$conf['bind']['named_conf_local_path'] = '/etc/bind/named.conf.local';
$conf['bind']['init_script'] = 'bind9';
//* Jailkit
$conf['jailkit']['installed'] = false; // will be detected automatically during installation
$conf['jailkit']['config_dir'] = '/etc/jailkit';
$conf['jailkit']['jk_init'] = 'jk_init.ini';
$conf['jailkit']['jk_chrootsh'] = 'jk_chrootsh.ini';
$conf['jailkit']['jailkit_chroot_app_programs'] = '/usr/bin/groups /usr/bin/id /usr/bin/dircolors /usr/bin/lesspipe /usr/bin/basename /usr/bin/dirname /usr/bin/nano /usr/bin/pico /usr/bin/mysql /usr/bin/mysqldump /usr/bin/git /usr/bin/git-receive-pack /usr/bin/git-upload-pack /usr/bin/unzip /usr/bin/zip /bin/tar /bin/rm /usr/bin/patch /etc/localtime';
$conf['jailkit']['jailkit_chroot_cron_programs'] = '/usr/bin/php /usr/bin/perl /usr/share/perl /usr/share/php';
//* Squid
$conf['squid']['installed'] = false; // will be detected automatically during installation
$conf['squid']['config_dir'] = '/etc/squid';
$conf['squid']['init_script'] = 'squid';
//* Nginx
$conf['nginx']['installed'] = false; // will be detected automatically during installation
$conf['nginx']['user'] = 'www-data';
$conf['nginx']['group'] = 'www-data';
$conf['nginx']['config_dir'] = '/etc/nginx';
$conf['nginx']['vhost_conf_dir'] = '/etc/nginx/sites-available';
$conf['nginx']['vhost_conf_enabled_dir'] = '/etc/nginx/sites-enabled';
$conf['nginx']['init_script'] = 'nginx';
$conf['nginx']['vhost_port'] = '8080';
$conf['nginx']['cgi_socket'] = '/var/run/fcgiwrap.socket';
$conf['nginx']['php_fpm_init_script'] = 'php7.4-fpm';
$conf['nginx']['php_fpm_ini_path'] = '/etc/php/7.4/fpm/php.ini';
$conf['nginx']['php_fpm_pool_dir'] = '/etc/php/7.4/fpm/pool.d';
$conf['nginx']['php_fpm_start_port'] = 9010;
$conf['nginx']['php_fpm_socket_dir'] = '/var/lib/php7.4-fpm';
//* OpenVZ
$conf['openvz']['installed'] = false;
//*Bastille-Firwall
$conf['bastille']['installed'] = false;
$conf['bastille']['config_dir'] = '/etc/Bastille';
//* vlogger
$conf['vlogger']['config_dir'] = '/etc';
//* cron
$conf['cron']['init_script'] = 'cron';
$conf['cron']['crontab_dir'] = '/etc/cron.d';
$conf['cron']['wget'] = '/usr/bin/wget';
//* Metronome XMPP
$conf['xmpp']['installed'] = false;
$conf['xmpp']['init_script'] = 'metronome';
?>
......@@ -33,11 +33,16 @@ class installer extends installer_base {
public function configure_dovecot()
{
global $conf;
$virtual_transport = 'dovecot';
$configure_lmtp = false;
// use lmtp if installed
if($configure_lmtp = is_file('/usr/lib/dovecot/lmtp')) {
$virtual_transport = 'lmtp:unix:private/dovecot-lmtp';
}
// 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']);
......@@ -138,7 +143,7 @@ class installer extends installer_base {
}
//remove #2.3+ comment
$content = file_get_contents($config_dir.'/'.$configfile);
$content = str_replace('#2.3+','',$content);
$content = str_replace('#2.3+ ','',$content);
file_put_contents($config_dir.'/'.$configfile,$content);
unset($content);
......@@ -155,11 +160,20 @@ class installer extends installer_base {
}
}
$dovecot_protocols = 'imap pop3';
//* dovecot-lmtpd
if($configure_lmtp) {
replaceLine($config_dir.'/'.$configfile, 'protocols = imap pop3', 'protocols = imap pop3 lmtp', 1, 0);
$dovecot_protocols .= ' lmtp';
}
//* dovecot-managesieved
if(is_file('/usr/lib/dovecot/managesieve')) {
$dovecot_protocols .= ' sieve';
}
replaceLine($config_dir.'/'.$configfile, 'protocols = imap pop3', "protocols = $dovecot_protocols", 1, 0);
//* dovecot-sql.conf
$configfile = 'dovecot-sql.conf';
if(is_file($config_dir.'/'.$configfile)){
......
......@@ -99,6 +99,8 @@ directories = /etc/joe, /etc/terminfo, /usr/share/vim, /usr/share/terminfo, /usr
comment = several internet utilities like wget, ftp, rsync, scp, ssh
executables = /usr/bin/wget, /usr/bin/lynx, /usr/bin/ftp, /usr/bin/host, /usr/bin/rsync, /usr/bin/smbclient
includesections = netbasics, ssh, sftp, scp
directories = /etc/ssl/certs/
regularfiles = /usr/lib/ssl/certs
[apacheutils]
comment = htpasswd utility
......
......@@ -95,6 +95,10 @@ function get_distname() {
$mainver = current($mainver).'.'.next($mainver);
}
switch ($mainver){
case "20.04":
$relname = "(Focal Fossa)";
$distconfid = 'ubuntu2004';
break;
case "18.04":
$relname = "(Bionic Beaver)";
$distconfid = 'ubuntu1804';
......@@ -186,7 +190,7 @@ function get_distname() {
break;
default:
$relname = "UNKNOWN";
$distconfid = 'ubuntu1804';
$distconfid = 'ubuntu2004';
}
$distver = $ver.$lts." ".$relname;
swriteln("Operating System: ".$distname.' '.$distver."\n");
......@@ -471,29 +475,38 @@ function rf($file){
}
function wf($file, $content){
mkdirs(dirname($file));
if(!$ret_val = mkdirs(dirname($file))) return false;
if(!$fp = fopen($file, 'wb')){
ilog('WARNING: could not open file '.$file);
// implicitly returned false because the following fwrite and fclose both fail,
// but to be explicit:
$ret_val = false;
}
fwrite($fp, $content);
fclose($fp);
fwrite($fp, $content) or $ret_val = false;
fclose($fp) or $ret_val = false;
return $ret_val;
}
function af($file, $content){
mkdirs(dirname($file));
if(!$ret_val = mkdirs(dirname($file))) return false;
if(!$fp = fopen($file, 'ab')){
ilog('WARNING: could not open file '.$file);
$ret_val = false;
}
fwrite($fp, $content);
fclose($fp);
fwrite($fp, $content) or $ret_val = false;
fclose($fp) or $ret_val = false;
return $ret_val;
}
function aftsl($file, $content){
$ret_val = true;
if(!$fp = fopen($file, 'ab')){
ilog('WARNING: could not open file '.$file);
$ret_val = false;
}
fwrite($fp, $content);
fclose($fp);
fwrite($fp, $content) or $ret_val = false;
fclose($fp) or $ret_val = false;
return $ret_val;
}
function unix_nl($input){
......@@ -678,8 +691,7 @@ function ini_to_array($ini) {
//* Converts a config array to a string
function array_to_ini($config_array = '') {
if($config_array == '') $config_array = $this->config;
function array_to_ini($config_array) {
$content = '';
foreach($config_array as $section => $data) {
$content .= "[$section]\n";
......
......@@ -864,7 +864,7 @@ class installer_base {
exec ("postconf -M $service.$type 2> /dev/null", $out, $ret);
}
$postfix_service = @($out[0]=='')?false:true;
} else { //* fallback - Postfix < 2.9
} 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;
......@@ -873,6 +873,68 @@ class installer_base {
return $postfix_service;
}
public function remove_postfix_service( $service, $type ) {
global $conf;
// nothing to do if the service isn't even defined.
if (! $this->get_postfix_service( $service, $type ) ) {
return true;
}
$postfix_version = `postconf -d mail_version 2>/dev/null`;
$postfix_version = preg_replace( '/mail_version\s*=\s*(.*)\s*/', '$1', $postfix_version );
if ( version_compare( $postfix_version, '2.11', '>=' ) ) {
exec("postconf -X -M $service/$type 2> /dev/null", $out, $ret);
# reduce 3 or more newlines to 2
$content = rf($conf['postfix']['config_dir'].'/master.cf');
$content = preg_replace( '/(\r?\n){3,}/', '$1$1', $content );
wf( $conf['postfix']['config_dir'].'/master.cf', $content );
} else { //* fallback - Postfix < 2.11
if ( ! $cf = fopen( $conf['postfix']['config_dir'].'/master.cf', 'r' ) ) {
return false;
}
$out = "";
$reading_service = false;
while ( !feof( $cf ) ) {
$line = fgets( $cf );
if ( $reading_service ) {
# regex matches a new service or "empty" (whitespace) line
if ( preg_match( '/^([^\s#]+.*|\s*)$/', $line ) &&
! preg_match( '/^'.$service.'\s+'.$type.'/', $line ) ) {
$out .= $line;
$reading_service = false;
}
# $skipped_lines .= $line;
# regex matches definition matching service to be removed
} else if ( preg_match( '/^'.$service.'\s+'.$type.'/', $line ) ) {
$reading_service = true;
# $skipped_lines .= $line;
} else {
$out .= $line;
}
}
fclose( $cf );
$out = preg_replace( '/(\r?\n){3,}/', '$1$1', $out ); # reduce 3 or more newlines to 2
return wf( $conf['postfix']['config_dir'].'/master.cf', $out );
}
return true;
}
public function configure_postfix($options = '') {
global $conf,$autoinstall;
$cf = $conf['postfix'];
......@@ -927,17 +989,26 @@ class installer_base {
//* mysql-virtual_uids.cf
$this->process_postfix_config('mysql-virtual_uids.cf');
// test if lmtp if available
$configure_lmtp = $this->get_postfix_service('lmtp','unix');
//* 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');
if($configure_lmtp) {
$content = preg_replace('/amavis:/', 'lmtp:', $content);
}
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');
if($configure_lmtp) {
$content = preg_replace('/amavis:/', 'lmtp:', $content);
}
wf($full_file_name, $content);
//* Changing mode and group of the new created config files.
......@@ -1233,11 +1304,16 @@ class installer_base {
public function configure_dovecot() {
global $conf;
$virtual_transport = 'dovecot';
$configure_lmtp = false;
// use lmtp if installed
if($configure_lmtp = is_file('/usr/lib/dovecot/lmtp')) {
$virtual_transport = 'lmtp:unix:private/dovecot-lmtp';
}
// 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']);
......@@ -1347,7 +1423,7 @@ class installer_base {
}
//remove #2.3+ comment
$content = file_get_contents($config_dir.'/'.$configfile);
$content = str_replace('#2.3+','',$content);
$content = str_replace('#2.3+ ','',$content);
file_put_contents($config_dir.'/'.$configfile,$content);
unset($content);
......@@ -1358,11 +1434,20 @@ class installer_base {
}
}
$dovecot_protocols = 'imap pop3';
//* dovecot-lmtpd
if($configure_lmtp) {
replaceLine($config_dir.'/'.$configfile, 'protocols = imap pop3', 'protocols = imap pop3 lmtp', 1, 0);
$dovecot_protocols .= ' lmtp';
}
//* dovecot-managesieved
if(is_file('/usr/lib/dovecot/managesieve')) {
$dovecot_protocols .= ' sieve';
}
replaceLine($config_dir.'/'.$configfile, 'protocols = imap pop3', "protocols = $dovecot_protocols", 1, 0);
//* dovecot-sql.conf
$configfile = 'dovecot-sql.conf';
if(is_file($config_dir.'/'.$configfile)) {
......@@ -1409,6 +1494,8 @@ class installer_base {
// TODO: chmod and chown on the config file
// test if lmtp if available
$configure_lmtp = $this->get_postfix_service('lmtp','unix');
// Adding the amavisd commands to the postfix configuration
// Add array for no error in foreach and maybe future options
......@@ -1416,7 +1503,8 @@ class installer_base {
// 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';
$content_filter_service = ($configure_lmtp) ? 'lmtp' : 'amavis';
$postconf_commands[] = "content_filter = ${content_filter_service}:[127.0.0.1]:10024";
$postconf_commands[] = 'receive_override_options = no_address_mappings';
}
......@@ -1432,11 +1520,16 @@ class installer_base {
$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');
// $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
// Or just remove the old service definitions and add them again?
$add_amavis = $this->remove_postfix_service('amavis','unix');
$add_amavis_10025 = $this->remove_postfix_service('127.0.0.1:10025','inet');
$add_amavis_10027 = $this->remove_postfix_service('127.0.0.1:10027','inet');
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~');
......@@ -2478,24 +2571,13 @@ class installer_base {
//* 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));
}
$configfile = 'security_settings.ini';
if(is_file($install_dir.'/security/'.$configfile)) {
copy($install_dir.'/security/'.$configfile, $install_dir.'/security/'.$configfile.'~');
}
$content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/'.$configfile.'.master', 'tpl/'.$configfile.'.master');
wf($install_dir.'/security/'.$configfile, $content);
//* Create a symlink, so ISPConfig is accessible via web
// Replaced by a separate vhost definition for port 8080
......@@ -3146,6 +3228,9 @@ class installer_base {
* @return bool
*/
protected function write_config_file($tConf, $tContents) {
$args = func_get_args();
// 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);
......@@ -3159,10 +3244,9 @@ class installer_base {
}
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)) {
......
......@@ -192,6 +192,8 @@ class db
}
private function _query($sQuery = '') {
$aArgs = func_get_args();
$this->do_connect();
if ($sQuery == '') {
......@@ -227,7 +229,6 @@ class db
}
} while($ok == false);
$aArgs = func_get_args();
$sQuery = call_user_func_array(array(&$this, '_build_query_string'), $aArgs);
$this->_iQueryId = mysqli_query($this->_iConnId, $sQuery);
......@@ -283,9 +284,11 @@ class db
* @return array result row or NULL if none found
*/
public function queryOneRecord($sQuery = '') {
if(!preg_match('/limit \d+\s*,\s*\d+$/i', $sQuery)) $sQuery .= ' LIMIT 0,1';
$aArgs = func_get_args();
if(!preg_match('/limit \d+\s*,\s*\d+$/i', $sQuery)) $sQuery .= ' LIMIT 0,1';
$oResult = call_user_func_array(array(&$this, 'query'), $aArgs);
if(!$oResult) return null;
......@@ -956,7 +959,7 @@ class fakedb_result {
if(!is_array($this->aLimitedData)) return $aItem;
if(list($vKey, $aItem) = each($this->aLimitedData)) {
foreach($this->aLimitedData as $vKey => $aItem) {
if(!$aItem) $aItem = null;
}
return $aItem;
......
......@@ -9,18 +9,24 @@ then follow these steps:
1) Add the field or table in the ispconfig3.sql file. This file contains the
complete database dump which is used when ISPConfig gets installed.
2) Create a new file in the "incremental" subfolder wich contains the alter
table, or if it is a complete new table then the add table, statement(s) in
MySQL syntax which is/are required to modify the current ispconfig database
during update. The naming scheme of the sql patch update files is
upd_0001.sql, upd_0002.sql, upd_0003.sql etc. Ensure that the number that
you choose for the new file is a +1 increment of the number of the last
existing file and that the number is formatted with 4 digits.
2) Edit the file "incremental/upd_dev_collection.sql" which contains the SQL
statements (alter table, add table, update, etc.) in MySQL syntax which
are required to modify the current ispconfig database during update.
The upd_dev_collection.sql file contains all db schema modifications
for changes made since the last ISPConfig release. If SQL statements
are already present in the file when you make your additions, add yours
to the end of the file, and do not remove any existing statements.
When a new ISPConfig update is released, the contents of
upd_dev_collections.sql will move to an sql patch file, using the naming
scheme upd_0001.sql, upd_0002.sql, upd_0003.sql etc.
A patch file may contain one or more alter table statements. Every patch file
gets executed once in the database, so do not modify older (already released)
A patch file may contain one or more SQL modification statements. Every patch
file gets executed once in the database, so do not modify older (already released)
patch files, they will not get executed again if the update was already run
once on a system.
once on a system, and will result in missing updates on any system where they
have not run yet.
After a patch has been executed, the dbversion field in the server table gets
increeased to the version number of the last installed patch.
......
-- add new proxy_protocol column
ALTER TABLE `web_domain`
ADD COLUMN `proxy_protocol` ENUM('n','y') NOT NULL DEFAULT 'n' AFTER `log_retention`;
-- backup format
ALTER TABLE `web_domain` ADD `backup_format_web` VARCHAR( 255 ) NOT NULL default 'default' AFTER `backup_copies`;
ALTER TABLE `web_domain` ADD `backup_format_db` VARCHAR( 255 ) NOT NULL default 'gzip' AFTER `backup_format_web`;
-- end of backup format
-- backup encryption
ALTER TABLE `web_domain` ADD `backup_encrypt` enum('n','y') NOT NULL DEFAULT 'n' AFTER `backup_format_db`;
ALTER TABLE `web_domain` ADD `backup_password` VARCHAR( 255 ) NOT NULL DEFAULT '' AFTER `backup_encrypt`;
ALTER TABLE `web_backup` ADD `backup_format` VARCHAR( 64 ) NOT NULL DEFAULT '' AFTER `backup_mode`;
ALTER TABLE `web_backup` ADD `backup_password` VARCHAR( 255 ) NOT NULL DEFAULT '' AFTER `filesize`;
-- end of backup encryption
-- rename Comodo to "Sectigo / Comodo CA"
UPDATE `dns_ssl_ca` SET `ca_name` = 'Sectigo / Comodo CA' WHERE `ca_issue` = 'comodoca.com';
-- default php-fpm to ondemand mode
ALTER TABLE `web_domain` ALTER pm SET DEFAULT 'ondemand';
ALTER TABLE `mail_user`
ADD `purge_trash_days` INT NOT NULL DEFAULT '0' AFTER `move_junk`,
ADD `purge_junk_days` INT NOT NULL DEFAULT '0' AFTER `purge_trash_days`;
-- doveadm should be enabled for all mailboxes
UPDATE `mail_user` set `disabledoveadm` = 'n';
-- add disablequota-status for quota-status policy daemon
ALTER TABLE `mail_user` ADD `disablequota-status` ENUM('n','y') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT 'n' AFTER `disabledoveadm`;
-- add disableindexer-worker for solr search
ALTER TABLE `mail_user` ADD `disableindexer-worker` ENUM('n','y') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT 'n' AFTER `disablequota-status`;
-- add SSHFP and DNAME record
ALTER TABLE `dns_rr` CHANGE `type` `type` ENUM('A','AAAA','ALIAS','CNAME','DNAME','CAA','DS','HINFO','LOC','MX','NAPTR','NS','PTR','RP','SRV','SSHFP','TXT','TLSA','DNSKEY') NULL DEFAULT NULL AFTER `name`;
This diff is collapsed.
......@@ -45,7 +45,6 @@ if( !empty($_SERVER['DOCUMENT_ROOT']) ) {
}
//** Set a few php.ini values
if(get_magic_quotes_runtime()) set_magic_quotes_runtime(false);
if(isset($app)) unset($app);
if(isset($conf)) unset($conf);
......
......@@ -57,7 +57,13 @@ plugin {
# the maildir quota does not need to be set.
# You do not need: quota = maildir
# no longer needed, as 'sieve' is in userdb extra fields:
sieve=/var/vmail/%d/%n/.sieve
sieve_after=/var/vmail/%d/%n/.ispconfig.sieve
sieve_max_script_size = 2M
sieve_max_actions = 100
sieve_max_redirects = 25
}
......
......@@ -9,7 +9,9 @@ ssl_key = </etc/postfix/smtpd.key
ssl_dh = </etc/dovecot/dh.pem
ssl_protocols = !SSLv2 !SSLv3
ssl_min_protocol = TLSv1
auth_verbose = yes
mail_max_userip_connections = 100
mail_plugins = quota
passdb {
args = /etc/dovecot/dovecot-sql.conf
driver = sql
......@@ -23,7 +25,13 @@ userdb {
}
plugin {
quota = dict:user::file:/var/vmail/%d/%n/.quotausage
# no longer needed, as 'sieve' is in userdb extra fields:
sieve=/var/vmail/%d/%n/.sieve
sieve_after=/var/vmail/%d/%n/.ispconfig.sieve
sieve_max_script_size = 2M
sieve_max_actions = 100
sieve_max_redirects = 25
}
service auth {
......@@ -44,11 +52,12 @@ service lmtp {
group = postfix
mode = 0600
user = postfix
# For higher volume sites, it may be desirable to increase the number of active listener processes.
# For higher volume sites, it may be desirable to increase the number of active listener processes.
# A range of 5 to 20 is probably good for most sites
# process_min_avail = 5
}
}
lmtp_rcpt_check_quota = yes
service imap-login {
client_limit = 1000
process_limit = 512
......@@ -75,7 +84,7 @@ protocol lmtp {
#2.3+ group = vmail
#2.3+ mode = 0660
#2.3+ }
#2.3+
#2.3+
#2.3+ unix_listener stats-writer {
#2.3+ user = vmail
#2.3+ group = vmail
......@@ -83,3 +92,38 @@ protocol lmtp {
#2.3+ }
#2.3+ }
service quota-status {
executable = quota-status -p postfix
unix_listener /var/spool/postfix/private/quota-status {
group = postfix
mode = 0660
user = postfix
}
client_limit = 1
}
plugin {
quota_status_success = DUNNO
quota_status_nouser = DUNNO
quota_status_overquota = "552 5.2.2 Mailbox is full"
}
imap_capability=+SEPCIAL-USE XLIST
namespace inbox {
inbox = yes
separator = .
mailbox Drafts {
special_use = \Drafts
}
mailbox Junk {
special_use = \Junk
}
mailbox Sent {
special_use = \Sent
}
mailbox "Sent Messages" {
special_use = \Sent
}
mailbox Trash {
special_use = \Trash
}
}
......@@ -682,7 +682,7 @@ protocol managesieve {
# the sieve storage directory. This must match the SIEVE setting used by
# deliver (refer to http://wiki.dovecot.org/LDA/Sieve#location for more
# info). Variable substitution with % is recognized.
sieve=~/.dovecot.sieve
sieve=~/.sieve
# This specifies the path to the directory where the uploaded scripts must
# be stored. In terms of '%' variable substitution it is identical to
......@@ -1144,4 +1144,9 @@ plugin {
# they're moved to a 3rd namespace. The mails won't be counted in quota,
# and they're not deleted automatically (use a cronjob or something).
#lazy_expunge = .EXPUNGED/ .DELETED/ .DELETED/.EXPUNGED/
sieve_after=/var/vmail/%d/%n/.ispconfig.sieve
sieve_max_script_size = 2M
sieve_max_actions = 100
sieve_max_redirects = 25
}
......@@ -8,6 +8,7 @@ postmaster_address = postmaster@example.com
ssl_cert = </etc/postfix/smtpd.cert
ssl_key = </etc/postfix/smtpd.key
ssl_protocols = !SSLv2 !SSLv3
auth_verbose = yes
mail_max_userip_connections = 100
mail_plugins = $mail_plugins quota
passdb {
......@@ -23,7 +24,13 @@ userdb {
}
plugin {
quota = dict:user::file:/var/vmail/%d/%n/.quotausage
# no longer needed, as 'sieve' is in userdb extra fields:
sieve=/var/vmail/%d/%n/.sieve
sieve_after=/var/vmail/%d/%n/.ispconfig.sieve
sieve_max_script_size = 2M
sieve_max_actions = 100
sieve_max_redirects = 25
}
service auth {
......@@ -46,6 +53,7 @@ service lmtp {
user = postfix
}
}
lmtp_rcpt_check_quota = yes
service imap-login {
client_limit = 1000
process_limit = 512
......@@ -73,10 +81,25 @@ protocol lmtp {
#2.3+ group = vmail
#2.3+ mode = 0660
#2.3+ }
#2.3+
#2.3+
#2.3+ unix_listener stats-writer {
#2.3+ user = vmail
#2.3+ group = vmail
#2.3+ mode = 0660
#2.3+ }
#2.3+ }
service quota-status {
executable = quota-status -p postfix
unix_listener /var/spool/postfix/private/quota-status {
group = postfix
mode = 0660
user = postfix
}
client_limit = 1
}
plugin {
quota_status_success = DUNNO
quota_status_nouser = DUNNO
quota_status_overquota = "552 5.2.2 Mailbox is full"
}
......@@ -15,7 +15,7 @@ broken_sasl_auth_clients = yes
smtpd_sasl_authenticated_header = yes
smtpd_restriction_classes = greylisting
greylisting = check_policy_service inet:127.0.0.1:10023
smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination{rbl_list}, check_recipient_access mysql:{config_dir}/mysql-virtual_recipient.cf{greylisting}
smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination, check_recipient_access mysql:{config_dir}/mysql-virtual_recipient.cf{rbl_list}{greylisting}, check_policy_service unix:private/quota-status
smtpd_use_tls = yes
smtpd_tls_security_level = may
smtpd_tls_cert_file = {config_dir}/smtpd.cert
......@@ -26,7 +26,7 @@ relay_recipient_maps = mysql:{config_dir}/mysql-virtual_relayrecipientmaps.cf
smtpd_sender_login_maps = proxy:mysql:{config_dir}/mysql-virtual_sender_login_maps.cf
proxy_read_maps = $local_recipient_maps $mydestination $virtual_alias_maps $virtual_alias_domains $sender_bcc_maps $virtual_mailbox_maps $virtual_mailbox_domains $relay_recipient_maps $relay_domains $canonical_maps $sender_canonical_maps $recipient_canonical_maps $relocated_maps $transport_maps $mynetworks $smtpd_sender_login_maps
smtpd_helo_required = yes
smtpd_helo_restrictions = permit_sasl_authenticated, permit_mynetworks, check_helo_access regexp:{config_dir}/helo_access, reject_invalid_hostname, reject_non_fqdn_hostname, reject_invalid_helo_hostname, reject_unknown_helo_hostname, check_helo_access regexp:{config_dir}/blacklist_helo
smtpd_helo_restrictions = permit_sasl_authenticated, permit_mynetworks, check_helo_access regexp:{config_dir}/helo_access, reject_non_fqdn_helo_hostname, reject_invalid_helo_hostname, reject_unknown_helo_hostname, check_helo_access regexp:{config_dir}/blacklist_helo
smtpd_sender_restrictions = check_sender_access regexp:{config_dir}/tag_as_originating.re {reject_slm}, permit_mynetworks, permit_sasl_authenticated, check_sender_access mysql:{config_dir}/mysql-virtual_sender.cf, check_sender_access regexp:{config_dir}/tag_as_foreign.re
smtpd_client_restrictions = check_client_access mysql:{config_dir}/mysql-virtual_client.cf
smtpd_client_message_rate_limit = 100
......
......@@ -1300,11 +1300,16 @@ plugin {
#
# Location of the active script. When ManageSieve is used this is actually
# a symlink pointing to the active script in the sieve storage directory.
#sieve=~/.dovecot.sieve
#
sieve=~/.sieve
# The path to the directory where the personal Sieve scripts are stored. For
# ManageSieve this is where the uploaded scripts are stored.
sieve_dir=~/sieve
sieve_after=/var/vmail/%d/%n/.ispconfig.sieve
sieve_max_script_size = 2M
sieve_max_actions = 100
sieve_max_redirects = 25
}
# Config files can also be included. deliver doesn't support them currently.
......