2123 lines
		
	
	
		
			76 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
			
		
		
	
	
			2123 lines
		
	
	
		
			76 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
| 
 | |
| ## ----------------------------------- ##
 | |
| ## --- install roundcube Webmailer --- ##
 | |
| ## ----------------------------------- ##
 | |
| 
 | |
| ## ----------------------
 | |
| ## - webmail.warenform.de
 | |
| ## -
 | |
| 
 | |
| . roundcube.env.webmail.warenform.de
 | |
| 
 | |
| ## -
 | |
| ## - END: webmail.warenform.de
 | |
| ## ----------------------------
 | |
| 
 | |
| 
 | |
| ## ------------------
 | |
| ## - webmail.oopen.de
 | |
| ## -
 | |
| 
 | |
| . roundcube.env.webmail.oopen.de
 | |
| 
 | |
| ## -
 | |
| ## - END: webmail.oopen.de
 | |
| ## -----------------------
 | |
| 
 | |
| 
 | |
| ## ---------------------------------------
 | |
| ## - webmail.interventionistische-linke.org
 | |
| ## -
 | |
| 
 | |
| . roundcube.env.webmail.interventionistische-linke.org
 | |
| 
 | |
| ## -
 | |
| ## - END: webmail.interventionistische-linke.org
 | |
| ## ---------------------------------------------
 | |
| 
 | |
| 
 | |
| ## ----------------------------
 | |
| ## - Begin Installation
 | |
| 
 | |
| ## - REQUIREMENTS
 | |
| ## - ============
 | |
| ## - 
 | |
| ## - * The Apache, Lighttpd, Cherokee or Hiawatha web server
 | |
| ## - * .htaccess support allowing overrides for DirectoryIndex
 | |
| ## - * PHP Version 5.2.1 or greater including
 | |
| ## -    - PCRE, DOM, JSON, XML, Session, Sockets (required)
 | |
| ## -    - libiconv (recommended)
 | |
| ## -    - mbstring, fileinfo, mcrypt (optional)
 | |
| ## - * PEAR packages distributed with Roundcube or external:
 | |
| ## -    - MDB2 2.5.0 or newer
 | |
| ## -    - Mail_Mime 1.8.1 or newer
 | |
| ## -    - Mail_mimeDecode 1.5.5 or newer
 | |
| ## -    - Net_SMTP 1.4.2 or newer
 | |
| ## -    - Net_IDNA2 0.1.1 or newer
 | |
| ## -    - Auth_SASL 1.0.6 or newer
 | |
| ## - * php.ini options (see .htaccess file):
 | |
| ## -    - error_reporting E_ALL & ~E_NOTICE (or lower)
 | |
| ## -    - memory_limit > 16MB (increase as suitable to support large attachments)
 | |
| ## -    - file_uploads enabled (for attachment upload features)
 | |
| ## -    - session.auto_start disabled
 | |
| ## -    - zend.ze1_compatibility_mode disabled
 | |
| ## -    - suhosin.session.encrypt disabled
 | |
| ## -    - mbstring.func_overload disabled
 | |
| ## -    - magic_quotes_runtime disabled
 | |
| ## -    - magic_quotes_sybase disabled
 | |
| ## - * PHP compiled with OpenSSL to connect to IMAPS and to use the spell checker
 | |
| ## - * A MySQL (4.0.8 or newer), PostgreSQL, MSSQL database engine
 | |
| ## -   or the SQLite extension for PHP
 | |
| ## - * One of the above databases with permission to create tables
 | |
| ## - * An SMTP server (recommended) or PHP configured for mail delivery
 | |
| 
 | |
| ## - install php PEAR packages
 | |
| ## -
 | |
| ## - !! Take care to do this for all php installations (PHP 5.5/5.6/..)
 | |
| ## -
 | |
| 
 | |
| _php_major_versions=`find /usr/local/ -maxdepth 1 -mindepth 1 -type l -name "php-*" -print | cut -d "-" -f2 | sort`
 | |
| for _version in $_php_major_versions ; do
 | |
|    rm /usr/local/php
 | |
|    ln -s /usr/local/php-$_version /usr/local/php
 | |
| 
 | |
|    pear install MDB2
 | |
| 
 | |
|    if [ "$_db_type" = "pgsql" ]; then
 | |
|       pear install MDB2_Driver_pgsql
 | |
|    elif [ "$_db_type" = "mysql" ];then
 | |
|       pear install MDB2_Driver_mysql
 | |
|       pear install MDB2_Driver_mysqli
 | |
|    else
 | |
|       echo -e "\n\t[ ERROR ]: Unknown database type \"$_db_type\"\n\n"
 | |
|    fi
 | |
| 
 | |
|    pear install Mail_Mime
 | |
|    pear install Mail_mimeDecode
 | |
|    pear install Net_SMTP
 | |
|    #pear install Net_IDNA2
 | |
|    pear install channel://pear.php.net/Net_IDNA2-0.1.1
 | |
|    #pear install Auth_SASL
 | |
|    #pear install Auth_SASL2
 | |
|    pear install channel://pear.php.net/Auth_SASL2-0.1.0
 | |
|  
 | |
| done
 | |
| 
 | |
| mkdir -p $WEBMAIL_BASEDIR/{sessions,tmp,temp,logs}
 | |
| chown ${WEBSERVER_USER}:${WEBSERVER_GROUP}  ${WEBMAIL_BASEDIR}/{sessions,tmp}
 | |
| 
 | |
| 
 | |
| 
 | |
| if ! $_use_mod_php ; then
 | |
|    mkdir -p ${WEBMAIL_BASEDIR}/conf
 | |
|    chown root:$WEBSERVER_USER ${WEBMAIL_BASEDIR}/conf
 | |
|    chmod 750 ${WEBMAIL_BASEDIR}/conf
 | |
| 
 | |
|    _php_major_versions=`find /usr/local/ -maxdepth 1 -mindepth 1 -type l -name "php-*" -print | cut -d "-" -f2 | sort`
 | |
|    for _version in $_php_major_versions ; do
 | |
|       cp /usr/local/php-${_version}/etc/php.ini ${WEBMAIL_BASEDIR}/conf/php.ini-$_version
 | |
| 
 | |
|       chown root:$WEBSERVER_USER ${WEBMAIL_BASEDIR}/conf/php.ini-$_version
 | |
|       chmod 640 ${WEBMAIL_BASEDIR}/conf/php.ini-$_version
 | |
| 
 | |
|       cat <<EOF > ${WEBMAIL_BASEDIR}/conf/fcgid-$_version
 | |
| #!/bin/sh
 | |
| export PHPRC="${WEBMAIL_BASEDIR}/conf/"
 | |
| export TMPDIR="${WEBMAIL_BASEDIR}/tmp"
 | |
| # PHP child process management (PHP_FCGI_CHILDREN) should 
 | |
| # always be disabled with mod_fcgid, which will only route one 
 | |
| # request at a time to application processes it has spawned; 
 | |
| # thus, any child processes created by PHP will not be used 
 | |
| # effectively. (Additionally, the PHP child processes may not 
 | |
| # be terminated properly.) By default, and with the environment 
 | |
| # variable setting PHP_FCGI_CHILDREN=0, PHP child process 
 | |
| # management is disabled.
 | |
| PHP_FCGI_CHILDREN=0
 | |
| export PHP_FCGI_CHILDREN
 | |
| 
 | |
| exec /usr/local/php-${_version}/bin/php-cgi
 | |
| EOF
 | |
| 
 | |
|       chown root:$WEBSERVER_USER ${WEBMAIL_BASEDIR}/conf/fcgid-$_version
 | |
|       chmod 750 ${WEBMAIL_BASEDIR}/conf/fcgid-$_version
 | |
|    done
 | |
| 
 | |
|    ln -s php.ini-$_version ${WEBMAIL_BASEDIR}/conf/php.ini
 | |
|    ln -s fcgid-$_version ${WEBMAIL_BASEDIR}/conf/fcgid
 | |
| 
 | |
|    cat << EOF > ${WEBMAIL_BASEDIR}/conf/changes.php.ini.txt
 | |
| error_log = "${WEBMAIL_BASEDIR}/logs/php_errors.log"
 | |
| sys_temp_dir = "${WEBMAIL_BASEDIR}/tmp"
 | |
| upload_tmp_dir = "${WEBMAIL_BASEDIR}/tmp"
 | |
| session.save_path = "${WEBMAIL_BASEDIR}/sessions"
 | |
| soap.wsdl_cache_dir = "${WEBMAIL_BASEDIR}/tmp"
 | |
| EOF
 | |
| 
 | |
|    touch ${WEBMAIL_BASEDIR}/logs/php_errors.log
 | |
|    chown ${WEBSERVER_USER}:${WEBSERVER_GROUP} ${WEBMAIL_BASEDIR}/logs/php_errors.log
 | |
| 
 | |
|    _php_ini_file="${WEBMAIL_BASEDIR}/conf/php.ini-*"
 | |
| 
 | |
|    _key=error_log
 | |
|    _val="${WEBMAIL_BASEDIR}/logs/php_errors.log"
 | |
|    if grep -e "^\s*${_key}\s*=" $_php_ini_file > /dev/null 2>&1 ; then
 | |
|       #sed -i "0,/^\([ \t]*${_key}[ \t]*=.*\)/ s##;\1\n${_key} = \"${_val}\"#" $_php_ini_file
 | |
|       perl -i -n -p -e "s#^(\s*${_key}\s*=.*)#;\1\n${_key} = ${_val}#" $_php_ini_file
 | |
|       _retval=$?
 | |
|    elif grep -e "^\s*;\s*${_key}\s*=" $_php_ini_file > /dev/null 2>&1 ; then
 | |
|       sed -i "0,/^\([ \t]*;[ \t]*${_key}[ \t]*=.*\)/ s##\1\n${_key} = \"${_val}\"\n#" $_php_ini_file
 | |
|       _retval=$?
 | |
|    fi
 | |
| 
 | |
|    _key="sys_temp_dir"
 | |
|    _val="${WEBMAIL_BASEDIR}/tmp"
 | |
|    _key="sys_temp_dir"
 | |
|    _val="${WEBMAIL_BASEDIR}/tmp"
 | |
|    if grep -e "^\s*${_key}\s*=" $_php_ini_file > /dev/null 2>&1 ; then
 | |
|       #sed -i "0,/^\([ \t]*${_key}[ \t]*=.*\)/ s##;\1\n${_key} = \"${_val}\"#" $_php_ini_file
 | |
|       perl -i -n -p -e "s#^(\s*${_key}\s*=.*)#;\1\n${_key} = ${_val}#" $_php_ini_file
 | |
|       _retval=$?
 | |
|    elif grep -e "^\s*;\s*${_key}\s*=" $_php_ini_file > /dev/null 2>&1 ; then
 | |
|       sed -i "0,/^\([ \t]*;[ \t]*${_key}[ \t]*=.*\)/ s##\1\n${_key} = \"${_val}\"\n#" $_php_ini_file
 | |
|       _retval=$?
 | |
|    fi
 | |
| 
 | |
|    _key="upload_tmp_dir"
 | |
|    _val="${WEBMAIL_BASEDIR}/tmp"
 | |
|    if grep -e "^\s*${_key}\s*=" $_php_ini_file > /dev/null 2>&1 ; then
 | |
|       #sed -i "0,/^\([ \t]*${_key}[ \t]*=.*\)/ s##;\1\n${_key} = \"${_val}\"#" $_php_ini_file
 | |
|       perl -i -n -p -e "s#^(\s*${_key}\s*=.*)#;\1\n${_key} = ${_val}#" $_php_ini_file
 | |
|       _retval=$?
 | |
|    elif grep -e "^\s*;\s*${_key}\s*=" $_php_ini_file > /dev/null 2>&1 ; then
 | |
|       sed -i "0,/^\([ \t]*;[ \t]*${_key}[ \t]*=.*\)/ s##\1\n${_key} = \"${_val}\"\n#" $_php_ini_file
 | |
|       _retval=$?
 | |
|    fi
 | |
| 
 | |
|    _key="session.save_path"
 | |
|    _val="${WEBMAIL_BASEDIR}/sessions"
 | |
|    if grep -e "^\s*${_key}\s*=" $_php_ini_file > /dev/null 2>&1 ; then
 | |
|       #sed -i "0,/^\([ \t]*${_key}[ \t]*=.*\)/ s##;\1\n${_key} = \"${_val}\"#" $_php_ini_file
 | |
|       perl -i -n -p -e "s#^(\s*${_key}\s*=.*)#;\1\n${_key} = ${_val}#" $_php_ini_file
 | |
|       _retval=$?
 | |
|    elif grep -e "^\s*;\s*${_key}\s*=" $_php_ini_file > /dev/null 2>&1 ; then
 | |
|       sed -i "0,/^\([ \t]*;[ \t]*${_key}[ \t]*=.*\)/ s##\1\n${_key} = \"${_val}\"\n#" $_php_ini_file
 | |
|       _retval=$?
 | |
|    fi
 | |
| 
 | |
|    _key="soap.wsdl_cache_dir"
 | |
|    _val="${WEBMAIL_BASEDIR}/tmp"
 | |
|    if grep -e "^\s*${_key}\s*=" $_php_ini_file > /dev/null 2>&1 ; then
 | |
|       #sed -i "0,/^\([ \t]*${_key}[ \t]*=.*\)/ s##;\1\n${_key} = \"${_val}\"#" $_php_ini_file
 | |
|       perl -i -n -p -e "s#^(\s*${_key}\s*=.*)#;\1\n${_key} = ${_val}#" $_php_ini_file
 | |
|       _retval=$?
 | |
|    elif grep -e "^\s*;\s*${_key}\s*=" $_php_ini_file > /dev/null 2>&1 ; then
 | |
|       sed -i "0,/^\([ \t]*;[ \t]*${_key}[ \t]*=.*\)/ s##\1\n${_key} = \"${_val}\"\n#" $_php_ini_file
 | |
|       _retval=$?
 | |
|    fi
 | |
| 
 | |
| fi
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| ## - create vhost entry for webmail.warenform.de
 | |
| ## -
 | |
| if [ -f ${_vhost_dir}/${WEBSITE}.conf ];then
 | |
|    mv ${_vhost_dir}/${WEBSITE}.conf ${_vhost_dir}/${WEBSITE}.conf.`date +%Y%m%d-%H%M`
 | |
| fi
 | |
| 
 | |
| cat <<EOF > ${_vhost_dir}/${WEBSITE}.conf
 | |
| # -- $WEBSITE -- #
 | |
| 
 | |
| <VirtualHost $IPV4:80>
 | |
| 
 | |
|    ServerAdmin $WEBMASTER_EMAIL
 | |
| 
 | |
|    ServerName $WEBSITE
 | |
| 
 | |
|    RewriteEngine on
 | |
|    RewriteCond %{HTTPS} !=on
 | |
|    RewriteRule (.*) https://%{SERVER_NAME}%{REQUEST_URI} [R=301,L]
 | |
| 
 | |
|    CustomLog ${APACHE_LOG_DIR}/${WEBSITE}-access.log combined
 | |
|    ErrorLog ${APACHE_LOG_DIR}/${WEBSITE}-error.log
 | |
| 
 | |
| </VirtualHost>
 | |
| 
 | |
| 
 | |
| <VirtualHost $IPV4:443>
 | |
| 
 | |
|    ServerAdmin $WEBMASTER_EMAIL
 | |
| 
 | |
|    ServerName $WEBSITE
 | |
| 
 | |
| EOF
 | |
| 
 | |
| if $_use_mod_php ; then
 | |
|    cat <<EOF >> ${_vhost_dir}/${WEBSITE}.conf
 | |
|    ## - its allowed to overwrite by .htaccess
 | |
|    ## -
 | |
|    php_value error_reporting "E_ALL & ~E_NOTICE"
 | |
| 
 | |
|    ## - Overwriting by .htaccess NOT allowd
 | |
|    ## -
 | |
|    php_admin_value upload_tmp_dir "${WEBMAIL_BASEDIR}/tmp/"
 | |
|    php_admin_flag log_errors  on
 | |
|    php_admin_value error_log "${WEBMAIL_BASEDIR}/logs/php_error.log"
 | |
|    php_admin_value session.save_path "${WEBMAIL_BASEDIR}/sessions"
 | |
| 
 | |
|    DocumentRoot "${WEBMAIL_BASEDIR}/htdocs/"
 | |
| EOF
 | |
| else
 | |
|    cat <<EOF >> ${_vhost_dir}/${WEBSITE}.conf
 | |
|    DocumentRoot "${WEBMAIL_BASEDIR}/htdocs/"
 | |
|    <Directory "${WEBMAIL_BASEDIR}/htdocs">
 | |
|       Require all granted
 | |
|       FCGIWrapper ${WEBMAIL_BASEDIR}/conf/fcgid .php
 | |
|       <FilesMatch \.php$>
 | |
|          SetHandler fcgid-script
 | |
|       </FilesMatch>
 | |
|       Options +ExecCGI
 | |
|    </Directory>
 | |
| EOF
 | |
| fi
 | |
| cat <<EOF >> ${_vhost_dir}/${WEBSITE}.conf
 | |
| 
 | |
|    SSLEngine on
 | |
| 
 | |
|    ## - HTTP Strict Transport Security (HSTS)
 | |
|    ## -
 | |
|    ## - HSTS tells a browser that the website should only be accessed through
 | |
|    ## - a secure connection. The HSTS header will be remembered by a standard
 | |
|    ## compliant browser for max-age seconds.
 | |
|    ## -
 | |
|    ## - Remember this settings for 1 year
 | |
|    ## -
 | |
|    Header add Strict-Transport-Security "max-age=31536000"
 | |
| 
 | |
|    SSLCertificateFile   ${_apache_cert_dir}/$APACHE_SERVER_CERT
 | |
|    SSLCertificateKeyFile ${_apache_cert_dir}/$APACHE_SERVER_KEY
 | |
|    $_SSLCertificateChainFile
 | |
| 
 | |
|    CustomLog ${APACHE_LOG_DIR}/${WEBSITE}-access.log combined
 | |
|    ErrorLog ${APACHE_LOG_DIR}/${WEBSITE}-error.log
 | |
| 
 | |
| </VirtualHost>
 | |
| 
 | |
| 
 | |
| ## - IPv6
 | |
| ## -
 | |
| <VirtualHost [$IPV6]:80>
 | |
| 
 | |
|    ServerAdmin $WEBMASTER_EMAIL
 | |
| 
 | |
|    ServerName $WEBSITE
 | |
| 
 | |
|    RewriteEngine on
 | |
|    RewriteCond %{HTTPS} !=on
 | |
|    RewriteRule (.*) https://%{SERVER_NAME}%{REQUEST_URI} [R=301,L]
 | |
| 
 | |
|    CustomLog ${APACHE_LOG_DIR}/${WEBSITE}-access.log combined
 | |
|    ErrorLog ${APACHE_LOG_DIR}/${WEBSITE}-error.log
 | |
| 
 | |
| </VirtualHost>
 | |
| 
 | |
| 
 | |
| <VirtualHost [$IPV6]:443>
 | |
| 
 | |
|    ServerAdmin $WEBMASTER_EMAIL
 | |
| 
 | |
|    ServerName $WEBSITE
 | |
| 
 | |
| EOF
 | |
| 
 | |
| if $_use_mod_php ; then
 | |
| 
 | |
|    cat <<EOF >> ${_vhost_dir}/${WEBSITE}.conf
 | |
|    ## - its allowed to overwrite by .htaccess
 | |
|    ## -
 | |
|    php_value error_reporting "E_ALL & ~E_NOTICE"
 | |
| 
 | |
|    ## - Overwriting by .htaccess NOT allowd
 | |
|    ## -
 | |
|    php_admin_value upload_tmp_dir "${WEBMAIL_BASEDIR}/tmp/"
 | |
|    php_admin_flag log_errors  on
 | |
|    php_admin_value error_log "${WEBMAIL_BASEDIR}/logs/php_error.log"
 | |
|    php_admin_value session.save_path "${WEBMAIL_BASEDIR}/sessions"
 | |
| 
 | |
|    DocumentRoot "${WEBMAIL_BASEDIR}/htdocs/"
 | |
| EOF
 | |
| else
 | |
|    cat <<EOF >> ${_vhost_dir}/${WEBSITE}.conf
 | |
|    DocumentRoot "${WEBMAIL_BASEDIR}/htdocs/"
 | |
|    <Directory "${WEBMAIL_BASEDIR}/htdocs">
 | |
|       Require all granted
 | |
|       FCGIWrapper ${WEBMAIL_BASEDIR}/conf/fcgid .php
 | |
|       <FilesMatch \.php$>
 | |
|          SetHandler fcgid-script
 | |
|       </FilesMatch>
 | |
|       Options +ExecCGI
 | |
|    </Directory>
 | |
| EOF
 | |
| fi
 | |
| cat <<EOF >> ${_vhost_dir}/${WEBSITE}.conf
 | |
| 
 | |
|    SSLEngine on
 | |
| 
 | |
|    ## - HTTP Strict Transport Security (HSTS)
 | |
|    ## -
 | |
|    ## - HSTS tells a browser that the website should only be accessed through
 | |
|    ## - a secure connection. The HSTS header will be remembered by a standard
 | |
|    ## compliant browser for max-age seconds.
 | |
|    ## -
 | |
|    ## - Remember this settings for 1 year
 | |
|    ## -
 | |
|    Header add Strict-Transport-Security "max-age=31536000"
 | |
| 
 | |
|    SSLCertificateFile   ${_apache_cert_dir}/$APACHE_SERVER_CERT
 | |
|    SSLCertificateKeyFile ${_apache_cert_dir}/$APACHE_SERVER_KEY
 | |
|    $_SSLCertificateChainFile
 | |
| 
 | |
|    CustomLog ${APACHE_LOG_DIR}/${WEBSITE}-access.log combined
 | |
|    ErrorLog ${APACHE_LOG_DIR}/${WEBSITE}-error.log
 | |
| 
 | |
| </VirtualHost>
 | |
| EOF
 | |
| 
 | |
| 
 | |
| ## - install roundcube
 | |
| ## -
 | |
| cd $SRC_ARCHIVE_DIR
 | |
| if [ ! -f roundcubemail-${ROUNDCUBE_VERSION}.tar.gz ]; then
 | |
|    wget http://downloads.sourceforge.net/project/roundcubemail/roundcubemail/${ROUNDCUBE_VERSION}/roundcubemail-${ROUNDCUBE_VERSION}.tar.gz
 | |
| fi
 | |
| 
 | |
| cd $SRC_BASE_DIR
 | |
| if [ -d roundcubemail-${ROUNDCUBE_VERSION} ];then
 | |
|    mv roundcubemail-${ROUNDCUBE_VERSION} roundcubemail-${ROUNDCUBE_VERSION}.`date +%Y%m%d-%H%M`
 | |
| fi
 | |
| gunzip < ${SRC_ARCHIVE_DIR}/roundcubemail-${ROUNDCUBE_VERSION}.tar.gz | tar -xf -
 | |
| 
 | |
| mkdir -p $WEBMAIL_BASEDIR
 | |
| cp -a ${SRC_BASE_DIR}/roundcubemail-${ROUNDCUBE_VERSION} $WEBMAIL_BASEDIR/
 | |
| chown -R root:root $WEBMAIL_BASEDIR/roundcubemail-${ROUNDCUBE_VERSION}
 | |
| 
 | |
| #mkdir -p $WEBMAIL_BASEDIR/{sessions,tmp,temp,logs}
 | |
| #if [ -h "${WEBMAIL_BASEDIR}/htdocs" ]; then
 | |
| #   rm ${WEBMAIL_BASEDIR}/htdocs
 | |
| #elif [ -d "${WEBMAIL_BASEDIR}/htdocs" ]; then
 | |
| #   mv ${WEBMAIL_BASEDIR}/htdocs ${WEBMAIL_BASEDIR}/htdocs.`date +%Y%m%d-%H%M`
 | |
| #elif [ -f "${WEBMAIL_BASEDIR}/htdocs" ]; then
 | |
| #   mv ${WEBMAIL_BASEDIR}/htdocs ${WEBMAIL_BASEDIR}/htdocs.`date +%Y%m%d-%H%M`
 | |
| #fi
 | |
| 
 | |
| ln -s roundcubemail-${ROUNDCUBE_VERSION} ${WEBMAIL_BASEDIR}/htdocs
 | |
| 
 | |
| ###########################
 | |
| 
 | |
| chown -R ${WEBSERVER_USER}:${WEBSERVER_GROUP} $WEBMAIL_BASEDIR/{sessions,temp,tmp,logs}
 | |
| 
 | |
| if $_apache_debian  ; then
 | |
|    ## - add to /etc/apache2/ports.conf
 | |
|    ## -
 | |
|    ## -    NameVirtualHost 46.4.73.217:80
 | |
|    ## -    NameVirtualHost [2a01:4f8:140:34c1::4]:80
 | |
|    ## -    Listen 46.4.73.217:80
 | |
|    ## -    Listen [2a01:4f8:140:34c1::4]:80
 | |
|    ## -    <IfModule mod_ssl.c>
 | |
|    ## -       ..
 | |
|    ## -       NameVirtualHost 46.4.73.217:443
 | |
|    ## -       NameVirtualHost [2a01:4f8:140:34c1::4]:443
 | |
|    ## -       Listen 46.4.73.217:443
 | |
|    ## -       Listen [2a01:4f8:140:34c1::4]:443
 | |
|    ## -    </IfModule>
 | |
|    ## -    ..
 | |
|    vim /etc/apache2/ports.conf
 | |
| 
 | |
| 
 | |
|    ## - enable site webmail.warenform.de
 | |
|    ## -
 | |
|    a2ensite ${WEBSITE}.conf
 | |
|    /etc/init.d/apache2 reload
 | |
| else
 | |
|    /etc/init.d/apache2 restart
 | |
| fi
 | |
| 
 | |
| ## - install a cronjob for cleaning up tmp-directory
 | |
| ## -
 | |
| crontab -l > /tmp/tmp_crontab
 | |
| echo "" >> /tmp/tmp_crontab
 | |
| echo "## - cleanup temp directory of the webmailer" >> /tmp/tmp_crontab
 | |
| echo "## -" >> /tmp/tmp_crontab
 | |
| echo "23 3 * * * find $WEBMAIL_BASEDIR/tmp -type f -mtime +1 -exec rm -f {} \;" >> /tmp/tmp_crontab
 | |
| crontab /tmp/tmp_crontab
 | |
| rm /tmp/tmp_crontab
 | |
| 
 | |
| 
 | |
| ## - logrotate logfiles from webmailer, locatet at $WEBMAIL_BASEDIR/logs
 | |
| ## -
 | |
| cat <<EOF > /etc/logrotate.d/roundcube
 | |
| $WEBMAIL_BASEDIR/logs/errors
 | |
| $WEBMAIL_BASEDIR/logs/sql
 | |
| $WEBMAIL_BASEDIR/logs/sendmail
 | |
| $WEBMAIL_BASEDIR/logs/*.log {
 | |
|    daily
 | |
|    start 0
 | |
|    rotate 7
 | |
|    missingok
 | |
|    notifempty
 | |
|    compress
 | |
|    delaycompress
 | |
|    create 640 www-data www-data
 | |
|    copytruncate
 | |
| }
 | |
| EOF
 | |
| 
 | |
| 
 | |
| ## - 
 | |
| 
 | |
| 
 | |
| ## - Datenbank etstellen:
 | |
| ## -
 | |
| ## - MySQL/PostgreSQL Datenbank erstellen
 | |
| ## -
 | |
| ## -
 | |
| 
 | |
| if [ "$_db_type" = "mysql" ]; then
 | |
|    if ! mysql -u$_mysql_rootuser -p$_mysql_rootpass -N -s -e \
 | |
|       "SELECT SCHEMA_NAME FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME = '$_db_name'" 2>/dev/null \
 | |
|       | grep $_db_name > /dev/null 2>&1 ; then
 | |
|       mysql -u$_mysql_rootuser -p$_mysql_rootpass -N -s -e \
 | |
|          "CREATE DATABASE IF NOT EXISTS $_db_name CHARACTER SET utf8 COLLATE utf8_general_ci"
 | |
|       mysql -u$_mysql_rootuser -p$_mysql_rootpass -N -s -e \
 | |
|          "GRANT ALL ON $_db_name.* TO '$_db_user'@'localhost' IDENTIFIED BY '$_db_pass'"
 | |
|       mysql -u$_mysql_rootuser -p$_mysql_rootpass -N -s -e "FLUSH PRIVILEGES"
 | |
|    fi
 | |
| elif [ "$_db_type" = "pgsql" ]; then
 | |
|    count=`su - postgres -c "psql -q -A -t -l" | grep -c -e "^$_db_name"`
 | |
|    if [ $count -eq 0 ];then
 | |
|       echo "CREATE ROLE $_db_user WITH LOGIN NOCREATEDB NOCREATEROLE NOSUPERUSER ENCRYPTED PASSWORD '$_db_pass'" \
 | |
|          | su - postgres -c "psql" > /dev/null
 | |
|       su - postgres -c "createdb -E utf8 -O $_db_user $_db_name"
 | |
|    fi
 | |
| fi
 | |
| 
 | |
| 
 | |
| ## - run roundcube installer in webbrowser
 | |
| ## -
 | |
| ## - change:
 | |
| ## - 
 | |
| ## - General configuration:
 | |
| ## -
 | |
| ## -    temp_dir -> $WEBMAIL_TMPDIR
 | |
| ## -                i.e. /var/www/webmail2.oopen.de/temp/
 | |
| ## -
 | |
| ## - Logging and Debugging:
 | |
| 
 | |
| ## -    log_dir  -> <installdir-of roundcube>/logs/
 | |
| ## -                i.e. /var/www/webmail2.oopen.de/logs/
 | |
| ## - 
 | |
| ## - Database setup as needed
 | |
| ## -
 | |
| ## - IMAP Settings:
 | |
| ## - 
 | |
| ## -    default_host -> localhost
 | |
| ## -    default_port -> 143
 | |
| ## -    junk_mbox    -> as needed i.e. Spam
 | |
| ## - 
 | |
| ## - SMTP Settings
 | |
| ## -
 | |
| ## -    smtp_server -> localhost
 | |
| ## -    smtp_port   -> 25
 | |
| ## -    smtp_user/smtp_pass -> [x] Use the current IMAP username and password for SMTP authentication
 | |
| ## -
 | |
| ## - Display settings & user prefs
 | |
| ## -
 | |
| ## -    language    -> de_DE
 | |
| ## -    skin        -> classic
 | |
| ## -
 | |
| http://${WEBSITE}/installer
 | |
| cat <<EOF
 | |
| 
 | |
|    Browse to site: http://${WEBSITE}/installer
 | |
| 
 | |
|    Maybe change values - Note this is an example!!
 | |
| 
 | |
|    General configuration:"
 | |
|       product_name...........: Webmail - IL"
 | |
|       support_url............: http://www.interventionistische-linge.org
 | |
|       skin_logo..............: images/oopen-logo.png
 | |
|       temp_dir...............: $WEBMAIL_TMPDIR
 | |
| 
 | |
|    Logging and Debugging:"
 | |
|       log_dir................: ${WEBMAIL_BASEDIR}/logs
 | |
| 
 | |
|    Database setup:"
 | |
|       Database type..........: $_db_type
 | |
|       Database server........: $_db_host
 | |
|       Database name..........: $_db_name
 | |
|       Database user name.....: $_db_user
 | |
|       Database password......: $_db_pass
 | |
| 
 | |
|    IMAP Settings:"
 | |
|       default_host...........: localhost
 | |
|       default_port...........: 143
 | |
|       junk_mbox..............: $SPAM_FOLDER_NAME
 | |
| 
 | |
|    SMTP Settings:"
 | |
|       smtp_server............: localhost
 | |
|       smtp_port..............: 25
 | |
| 
 | |
|       smtp_user/smtp_pass....: 
 | |
|          [ ] Use the current IMAP username and password for SMTP authentication
 | |
| 
 | |
|    Display settings & user prefs:
 | |
|       language...............: de_DE
 | |
|       skin...................: larry
 | |
| 
 | |
| EOF
 | |
| 
 | |
| 
 | |
| mv $WEBMAIL_BASEDIR/roundcubemail-${ROUNDCUBE_VERSION}/installer $WEBMAIL_BASEDIR/roundcubemail-${ROUNDCUBE_VERSION}/installer.BAK
 | |
| 
 | |
| 
 | |
| ## - after successfully installation, make a few changes
 | |
| ## - to file $WEBMAIL_BASEDIR/roundcubemail-${ROUNDCUBE_VERSION}/config/main.inc.php
 | |
| ## -
 | |
| ## - Bereits via webinterface (installer) eingestellt:
 | |
| ## -
 | |
| ## -    $rcmail_config['product_name'] = 'Webmail - IL';
 | |
| ## -    $rcmail_config['imap_auth_type'] = 'LOGIN';
 | |
| ## -    $rcmail_config['skin_logo'] = 'images/logo_il.png';
 | |
| ## -    $rcmail_config['language'] = 'de_DE';
 | |
| ## -    $rcmail_config['create_default_folders'] = false;
 | |
| ## -    $rcmail_config['quota_zero_as_unlimited'] = false;
 | |
| ## -    $rcmail_config['preview_pane'] = false;
 | |
| ## -
 | |
| ## - Sind schon dioe default werte:
 | |
| 
 | |
| ## -    #$rcmail_config['password_charset'] = 'ISO-8859-1';
 | |
| ## -    #$rcmail_config['plugins'] = array();
 | |
| ## -    #$rcmail_config['message_sort_col'] = '';
 | |
| ## -
 | |
| ## - Ändern:
 | |
| ## -
 | |
| ## -    $rcmail_config['login_autocomplete'] = 1;
 | |
| ## -    $rcmail_config['logout_purge'] = true;
 | |
| ## -    $rcmail_config['delete_always'] = true;
 | |
| ## -    $rcmail_config['mime_magic'] = '/usr/share/misc/magic';
 | |
| ## -
 | |
| cat <<EOF >>$WEBMAIL_BASEDIR/roundcubemail-${ROUNDCUBE_VERSION}/config/config.inc.php
 | |
| 
 | |
| // ==================================
 | |
| // Added after basic installation 
 | |
| // ==================================
 | |
| 
 | |
| // ----------------------------------
 | |
| // SYSTEM
 | |
| // ----------------------------------
 | |
| 
 | |
| // Allow browser-autocompletion on login form.
 | |
| // 0 - disabled, 1 - username and host only, 2 - username, host, password
 | |
| \$config['login_autocomplete'] = 1;
 | |
| 
 | |
| // Path to a local mime magic database file for PHPs finfo extension.
 | |
| // Set to null if the default path should be used.
 | |
| \$config['mime_magic'] = '/usr/share/misc/magic';
 | |
| 
 | |
| 
 | |
| // ----------------------------------
 | |
| // USER PREFERENCES
 | |
| // ----------------------------------
 | |
| 
 | |
| // Clear Trash on logout
 | |
| \$config['logout_purge'] = true;
 | |
| 
 | |
| // 'Delete always'
 | |
| // This setting reflects if mail should be always deleted
 | |
| // when moving to Trash fails. This is necessary in some setups
 | |
| // when user is over quota and Trash is included in the quota.
 | |
| \$config['delete_always'] = true;
 | |
| 
 | |
| EOF
 | |
| 
 | |
| 
 | |
| ## - edit $WEBMAIL_BASEDIR/roundcubemail-${ROUNDCUBE_VERSION}//program/localization/de_DE/labels.inc
 | |
| ## -    $labels['welcome'] = 'Login $product';
 | |
| ## -
 | |
| vim $WEBMAIL_BASEDIR/roundcubemail-${ROUNDCUBE_VERSION}//program/localization/de_DE/labels.inc
 | |
| 
 | |
| ## - to display/print the logo if a message is printed
 | |
| ## -
 | |
| ## - edit skins/default/print.css
 | |
| ## -
 | |
| ## - add to section "#header"
 | |
| ## -    visibility: hidden;
 | |
| ## -
 | |
| 
 | |
| 
 | |
| ## --------
 | |
| ## - Enable Spellchecking
 | |
| ## -
 | |
| ## - i.e for languages
 | |
| ## -    English Deutsch Dansk Français Italiano Español
 | |
| ## -
 | |
| apt-get install aspell-en aspell-de aspell-da aspell-es aspell-fr aspell-it
 | |
| 
 | |
| ## - In config.inc.pgp add/change:
 | |
| ## -
 | |
| ## -    // Make use of the built-in spell checker. It is based on GoogieSpell.
 | |
| ## -    // Since Google only accepts connections over https your PHP installatation
 | |
| ## -    // requires to be compiled with Open SSL support
 | |
| ## -    $config['enable_spellcheck'] = true;
 | |
| ## -    
 | |
| ## -    // Set the spell checking engine. Possible values:
 | |
| ## -    // - 'googie'  - the default
 | |
| ## -    // - 'pspell'  - requires the PHP Pspell module and aspell installed
 | |
| ## -    // - 'enchant' - requires the PHP Enchant module
 | |
| ## -    // - 'atd'     - install your own After the Deadline server or check with the people at http://www.afterthedeadline.com before using their API
 | |
| ## -    // Since Google shut down their public spell checking service, you need to 
 | |
| ## -    // connect to a Nox Spell Server when using 'googie' here. Therefore specify the 'spellcheck_uri'
 | |
| ## -    //$config['spellcheck_engine'] = 'googie';
 | |
| ## -    $config['spellcheck_engine'] = 'pspell';
 | |
| ## -    
 | |
| ## -    // These languages can be selected for spell checking.
 | |
| ## -    // Configure as a PHP style hash array: array('en'=>'English', 'de'=>'Deutsch');
 | |
| ## -    // Leave empty for default set of available language.
 | |
| ## -    //
 | |
| ## -    // Take care tha dictionaries for aspell ar installed !
 | |
| ## -    //    for debian:
 | |
| ## -    //    apt-get install aspell-en aspell-de aspell-da aspell-es aspell-fr aspell-it
 | |
| ## -    $config['enable_spellcheck'] = true;
 | |
| ## -    $config['spellcheck_engine'] = 'pspell';
 | |
| ## -    $config['spellcheck_languages'] = array(
 | |
| ## -      'en' => 'English',
 | |
| ## -      'de' => 'Deutsch',
 | |
| ## -      'da' => 'Dansk',
 | |
| ## -      'fr' => 'Français',
 | |
| ## -      'it' => 'Italiano',
 | |
| ## -      'es' => 'Español',
 | |
| ## -    );
 | |
| ## -    // Makes that words with all letters capitalized will be ignored (e.g. GOOGLE)
 | |
| ## -    $config['spellcheck_ignore_caps'] = true;
 | |
| ## -    
 | |
| ## -    // Makes that words with numbers will be ignored (e.g. g00gle)
 | |
| ## -    $config['spellcheck_ignore_nums'] = true;
 | |
| ## -    
 | |
| ## -    // Makes that words with symbols will be ignored (e.g. g@@gle)
 | |
| ## -    $config['spellcheck_ignore_syms'] = true;
 | |
| ## -
 | |
| cat <<EOF >>$WEBMAIL_BASEDIR/roundcubemail-${ROUNDCUBE_VERSION}/config/config.inc.php
 | |
| 
 | |
| // ----------------------------------
 | |
| // USER INTERFACE
 | |
| // ----------------------------------
 | |
| 
 | |
| // Make use of the built-in spell checker. It is based on GoogieSpell.
 | |
| // Since Google only accepts connections over https your PHP installatation
 | |
| // requires to be compiled with Open SSL support
 | |
| \$config['enable_spellcheck'] = true;
 | |
| 
 | |
| // Enables spellchecker exceptions dictionary.
 | |
| // Setting it to 'shared' will make the dictionary shared by all users.
 | |
| \$config['spellcheck_dictionary'] = false;
 | |
| 
 | |
| // Set the spell checking engine. Possible values:
 | |
| // - 'googie'  - the default
 | |
| // - 'pspell'  - requires the PHP Pspell module and aspell installed
 | |
| // - 'enchant' - requires the PHP Enchant module
 | |
| // - 'atd'     - install your own After the Deadline server or check with the people at http://www.afterthedeadline.com before using their API
 | |
| // Since Google shut down their public spell checking service, you need to 
 | |
| // connect to a Nox Spell Server when using 'googie' here. Therefore specify the 'spellcheck_uri'
 | |
| \$config['spellcheck_engine'] = 'pspell';
 | |
| 
 | |
| // For locally installed Nox Spell Server or After the Deadline services,
 | |
| // please specify the URI to call it.
 | |
| // Get Nox Spell Server from http://orangoo.com/labs/?page_id=72 or
 | |
| // the After the Deadline package from http://www.afterthedeadline.com.
 | |
| // Leave empty to use the public API of service.afterthedeadline.com
 | |
| \$config['spellcheck_uri'] = '';
 | |
| 
 | |
| // These languages can be selected for spell checking.
 | |
| // Configure as a PHP style hash array: array('en'=>'English', 'de'=>'Deutsch');
 | |
| // Leave empty for default set of available language.
 | |
| //
 | |
| // Take care tha dictionaries for aspell ar installed !
 | |
| //    for debian:
 | |
| //    apt-get install aspell-en aspell-de aspell-da aspell-es aspell-fr aspell-it
 | |
| \$config['spellcheck_languages'] = array(
 | |
|   'en' => 'English',
 | |
|   'de' => 'Deutsch',
 | |
|   'da' => 'Dansk',
 | |
|   'fr' => 'Français',
 | |
|   'it' => 'Italiano',
 | |
|   'es' => 'Español',
 | |
| );
 | |
| // Makes that words with all letters capitalized will be ignored (e.g. GOOGLE)
 | |
| \$config['spellcheck_ignore_caps'] = true;
 | |
| 
 | |
| // Makes that words with numbers will be ignored (e.g. g00gle)
 | |
| \$config['spellcheck_ignore_nums'] = true;
 | |
| 
 | |
| // Makes that words with symbols will be ignored (e.g. g@@gle)
 | |
| \$config['spellcheck_ignore_syms'] = true;
 | |
| 
 | |
| EOF
 | |
| 
 | |
| 
 | |
| ## - Notice:
 | |
| ## - 
 | |
| ## -    - robots.txt
 | |
| ## -    - favicon.ico
 | |
| 
 | |
| 
 | |
| ## -------------------------------------------- #
 | |
| ## --- Install Plugin Manager for Roundcube --- #
 | |
| ## -------------------------------------------- #
 | |
| 
 | |
| ## - Download base plugins from:
 | |
| ## -    http://myroundcube.com/myroundcube-plugins/plugin-manager
 | |
| ## -
 | |
| ## - See also:
 | |
| ## -    https://code.google.com/p/myroundcube/
 | |
| ## -
 | |
| 
 | |
| ## - unzip downloaded plugins.zip file into plugin folder
 | |
| ## - of roundcube installation.
 | |
| 
 | |
| ## - register plugin, add "plugin_manager" to array plugins
 | |
| ## -    $rcmail_config['plugins'] = array('plugin_manager');
 | |
| ## -
 | |
| vim $WEBMAIL_BASEDIR/roundcubemail-${ROUNDCUBE_VERSION}/config/main.inc.php
 | |
| 
 | |
| ## - Notice:
 | |
| ## - This install also plugins:
 | |
| ## -    - codemirror_ui
 | |
| ## -    - db_version
 | |
| ## -    - http_request
 | |
| ## -    - plugin_manager
 | |
| ## -    - qtip
 | |
| ## -    - settings
 | |
| 
 | |
| 
 | |
| ## ------------------------------- #
 | |
| ## --- Install plugin lang_sel --- #
 | |
| ## ------------------------------- #
 | |
| 
 | |
| ## - Download Plugin from roundcube webmail interface
 | |
| ## -
 | |
| ## -    Settings -> Plugins downloads
 | |
| ## -
 | |
| ## - Unpack to "$WEBMAIL_BASEDIR/roundcubemail-${ROUNDCUBE_VERSION}/plugins/" directory
 | |
| ## -
 | |
| 
 | |
| cp $WEBMAIL_BASEDIR/roundcubemail-${ROUNDCUBE_VERSION}/plugins/lang_sel/config.inc.php.dist \
 | |
|    $WEBMAIL_BASEDIR/roundcubemail-${ROUNDCUBE_VERSION}/plugins/lang_sel/config.inc.php
 | |
| 
 | |
| 
 | |
| ## ----------
 | |
| ## --- Provied Language selection on logon screen - ##
 | |
| ## ----------
 | |
| 
 | |
| ## - !!
 | |
| ## -
 | |
| ## - For that to work, plugin's "settings" and "lang_sel" must be present
 | |
| ## - if not yet authenticated (logged in into roundcube)
 | |
| 
 | |
| 
 | |
| ## - Notice! 
 | |
| ## -    Currently (at time of that installation) pluginmanager in conjunction with
 | |
| ## -    plugins 'lang_sel' and 'settings' does not work as exspected:
 | |
| ## -
 | |
| ## -       $rcmail_config['plugin_manager_unauth'] = array(
 | |
| ## -          ..
 | |
| ## -         'settings' => true,
 | |
| ## -         'lang_sel' => true,
 | |
| ## -       );
 | |
| ## -
 | |
| ## -
 | |
| ## -       $rcmail_config['plugin_manager_defaults'] = array(
 | |
| ## -         ...
 | |
| ## -         'globalplugins' => array(
 | |
| ## -           'settings' => array('protected' => true, 'active' => true),
 | |
| ## -           'lang_sel' => array('protected' => true, 'active' => true),
 | |
| ## -       ..
 | |
| ## -
 | |
| ## -    Configuring that way, a language selection is shown. but the selected language
 | |
| ## -    IS NOT loaded.
 | |
| ## -
 | |
| ## - But if registering within roundcube providing a Language selection on logon screen
 | |
| ## - works fine WITH loadind the selected language:
 | |
| ## -
 | |
| ## -    Comment out all settings in plugin_manager concerning plugins 'lang_sel' and
 | |
| ## -    settings
 | |
| ## -
 | |
| vim $WEBMAIL_BASEDIR/roundcubemail-${ROUNDCUBE_VERSION}/plugins/plugin_manager/config.inc.php
 | |
| ## -
 | |
| ## - Afterwards register plugins in roundcube( maybe the registration order in that array
 | |
| ## - is :
 | |
| ## -
 | |
| ## -    $rcmail_config['plugins'] = array('settings', 'lang_sel','plugin_manager');
 | |
| ## -
 | |
| vim $WEBMAIL_BASEDIR/roundcubemail-${ROUNDCUBE_VERSION}/config/main.inc.php
 | |
| 
 | |
| 
 | |
| ## -------------------------------- #
 | |
| ## --- Install plugin vkeyboard --- #
 | |
| ## -------------------------------- #
 | |
| 
 | |
| ## - Download Plugin from roundcube webmail interface
 | |
| ## -
 | |
| ## -    Settings -> Plugins downloads
 | |
| ## -
 | |
| ## - Unpack to "$WEBMAIL_BASEDIR/roundcubemail-${ROUNDCUBE_VERSION}/plugins/" directory
 | |
| ## -
 | |
| 
 | |
| 
 | |
| ## --------------------------------- #
 | |
| ## --- Install plugin timepicker --- #
 | |
| ## --------------------------------- #
 | |
| 
 | |
| ## - Download Plugin from roundcube webmail interface
 | |
| ## -
 | |
| ## -    Settings -> Plugins downloads
 | |
| ## -
 | |
| ## - Unpack to "$WEBMAIL_BASEDIR/roundcubemail-${ROUNDCUBE_VERSION}/plugins/" directory
 | |
| ## -
 | |
| 
 | |
| 
 | |
| ## ----------------------------------- #
 | |
| ## --- Install plugin idle_timeout --- #
 | |
| ## ----------------------------------- #
 | |
| 
 | |
| ## - Download Plugin from roundcube webmail interface
 | |
| ## -
 | |
| ## -    Settings -> Plugins downloads
 | |
| ## -
 | |
| ## - Unpack to "$WEBMAIL_BASEDIR/roundcubemail-${ROUNDCUBE_VERSION}/plugins/" directory
 | |
| ## -
 | |
| cp $WEBMAIL_BASEDIR/roundcubemail-${ROUNDCUBE_VERSION}/plugins/idle_timeout/config.inc.php.dist \
 | |
|    $WEBMAIL_BASEDIR/roundcubemail-${ROUNDCUBE_VERSION}/plugins/idle_timeout/config.inc.php
 | |
| 
 | |
| ## - Edit plugins configuration file (config.inc.php)
 | |
| ## -
 | |
| ## - add/change:
 | |
| ## -
 | |
| ## -    $rcmail_config['idle_timeout_warning'] = 28;
 | |
| ## -    $rcmail_config['idle_timeout_logout'] = 2;
 | |
| ## -
 | |
| vim $WEBMAIL_BASEDIR/roundcubemail-${ROUNDCUBE_VERSION}/plugins/idle_timeout/config.inc.php
 | |
| 
 | |
| 
 | |
| ## ----------------------------------------------- #
 | |
| ## --- integrate password plugin for roundcube --- #
 | |
| ## ----------------------------------------------- #
 | |
| 
 | |
| cp $WEBMAIL_BASEDIR/roundcubemail-${ROUNDCUBE_VERSION}/plugins/password/config.inc.php.dist \
 | |
|    $WEBMAIL_BASEDIR/roundcubemail-${ROUNDCUBE_VERSION}/plugins/password/config.inc.php
 | |
| 
 | |
| ## - edit $WEBMAIL_BASEDIR/roundcubemail-${ROUNDCUBE_VERSION}/plugins/password/config.inc.php
 | |
| ## -
 | |
| ## - adjust:
 | |
| ## -
 | |
| ## -    $rcmail_config['password_driver'] = 'sql';
 | |
| ## -    $rcmail_config['password_confirm_current'] = true;
 | |
| ## -
 | |
| ## -    NOTE: The database configuration data from POSTFIX Dateabase are needed !!
 | |
| ## -          Put in your database credentials
 | |
| ## -
 | |
| ## -    $rcmail_config['password_db_dsn'] = '${_db_type}://${_db_user}:${_db_pass}@localhost/${_db_name}';
 | |
| ## -
 | |
| ## -    $rcmail_config['password_query'] = 'UPDATE mailbox SET password=%p WHERE username=%u';
 | |
| ## - 
 | |
| vim $WEBMAIL_BASEDIR/roundcubemail-${ROUNDCUBE_VERSION}/plugins/password/config.inc.php
 | |
| 
 | |
| 
 | |
| ## ------------------------------------------ #
 | |
| ## --- integrate acl plugin for roundcube --- #
 | |
| ## ------------------------------------------ #
 | |
| 
 | |
| cp $WEBMAIL_BASEDIR/roundcubemail-${ROUNDCUBE_VERSION}/plugins/acl/config.inc.php.dist \
 | |
|    $WEBMAIL_BASEDIR/roundcubemail-${ROUNDCUBE_VERSION}/plugins/acl/config.inc.php
 | |
| 
 | |
| ## - edit $WEBMAIL_BASEDIR/roundcubemail-${ROUNDCUBE_VERSION}/plugins/acl/config.inc.php
 | |
| ## -
 | |
| ## - change:
 | |
| ## -    $rcmail_config['acl_advanced_mode'] = true;
 | |
| ## -
 | |
| vim $WEBMAIL_BASEDIR/roundcubemail-${ROUNDCUBE_VERSION}/plugins/acl/config.inc.php
 | |
| 
 | |
| 
 | |
| ## - Note: register plugin either with plugin_manager or with roundcube methode NOT BOTH
 | |
| 
 | |
| 
 | |
| ## - register acl plugin with plugin_manager
 | |
| ## -
 | |
| ## - edit: $WEBMAIL_BASEDIR/roundcubemail-${ROUNDCUBE_VERSION}/plugins/plugin_manager/config.inc.php
 | |
| ## -
 | |
| ## - add to array $rcmail_config['plugin_manager_defaults'] (Section globalplugins)
 | |
| ## - after line "'globalplugins' => array("
 | |
| ## -
 | |
| ## -        'acl' => array('protected' => true, 'active' => true),
 | |
| ## -
 | |
| vim $WEBMAIL_BASEDIR/roundcubemail-${ROUNDCUBE_VERSION}/plugins/plugin_manager/config.inc.php
 | |
| 
 | |
| 
 | |
| ## - register acl plugin with roundcube
 | |
| ## -
 | |
| ## - edit $WEBMAIL_BASEDIR/roundcubemail-${ROUNDCUBE_VERSION}/config/main.inc.php
 | |
| ## -
 | |
| ## - add "acl" to array plugins
 | |
| ## -    $rcmail_config['plugins'] = array('global_alias','contextmenue', 'password', 'acl');
 | |
| ## -
 | |
| vim $WEBMAIL_BASEDIR/roundcubemail-${ROUNDCUBE_VERSION}/config/main.inc.php
 | |
| 
 | |
| 
 | |
| ## -------------------------------------------------- #
 | |
| ## --- integrate managesieve plugin for roundcube --- #
 | |
| ## -------------------------------------------------- #
 | |
| 
 | |
| 
 | |
| cp $WEBMAIL_BASEDIR/roundcubemail-${ROUNDCUBE_VERSION}/plugins/managesieve/config.inc.php.dist \
 | |
|    $WEBMAIL_BASEDIR/roundcubemail-${ROUNDCUBE_VERSION}/plugins/managesieve/config.inc.php
 | |
| 
 | |
| ## - edit $WEBMAIL_BASEDIR/roundcubemail-${ROUNDCUBE_VERSION}/plugins/managesieve/config.inc.php
 | |
| ## -
 | |
| ## - adjust the following variables:
 | |
| ## -    $rcmail_config['managesieve_port'] = 4190;
 | |
| ## -    $rcmail_config['managesieve_default'] = '/usr/local/dovecot/etc/dovecot/sieve/move-spam.sieve';
 | |
| ## - 
 | |
| ## -
 | |
| vim $WEBMAIL_BASEDIR/roundcubemail-${ROUNDCUBE_VERSION}/plugins/managesieve/config.inc.php
 | |
| 
 | |
| 
 | |
| 
 | |
| ## ----------------------
 | |
| ## - Install contextmenue
 | |
| ## -
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| ## ---------------------------------- #
 | |
| ## --- Install plugin markasjunk2 --- #
 | |
| ## ---------------------------------- #
 | |
| 
 | |
| cd $WEBMAIL_BASEDIR
 | |
| rm markasjunk2.tar.gz
 | |
| wget http://www.tehinterweb.co.uk/roundcube/plugins/markasjunk2.tar.gz
 | |
| 
 | |
| gunzip < $WEBMAIL_BASEDIR/markasjunk2.tar.gz | tar -C $WEBMAIL_BASEDIR/roundcubemail-${ROUNDCUBE_VERSION}/plugins -xf -
 | |
| 
 | |
| cp $WEBMAIL_BASEDIR/roundcubemail-${ROUNDCUBE_VERSION}/plugins/markasjunk2/config.inc.php.dist \
 | |
|    $WEBMAIL_BASEDIR/roundcubemail-${ROUNDCUBE_VERSION}/plugins/markasjunk2/config.inc.php
 | |
| 
 | |
| ## ----------------------------------------------------------------------
 | |
| ## ----------------------------------------------------------------------
 | |
| ## ----------------------------------------------------------------------
 | |
| 
 | |
| 
 | |
| ## ----------------------
 | |
| ## - Install global_alias
 | |
| ## -
 | |
| 
 | |
| cp -a $WEBMAIL_TMPDIR/plugins/global_alias $WEBMAIL_BASEDIR/roundcubemail-${ROUNDCUBE_VERSION}/plugins/
 | |
| 
 | |
| cp -a $WEBMAIL_BASEDIR/roundcubemail-${ROUNDCUBE_VERSION}/plugins/global_alias/config.inc.php.dist \
 | |
|    $WEBMAIL_BASEDIR/roundcubemail-${ROUNDCUBE_VERSION}/plugins/global_alias/config.inc.php
 | |
| 
 | |
| 
 | |
| ## - Note: register plugin either with plugin_manager or with roundcube methode NOT BOTH
 | |
| 
 | |
| 
 | |
| ## - register global_alias plugin with plugin_manager
 | |
| ## -
 | |
| ## - edit: $WEBMAIL_BASEDIR/roundcubemail-${ROUNDCUBE_VERSION}/plugins/plugin_manager/config.inc.php
 | |
| ## -
 | |
| ## - add to array $rcmail_config['plugin_manager_defaults'] (Section globalplugins)
 | |
| ## - after line "'globalplugins' => array("
 | |
| ## -    
 | |
| ## -        'global_alias' => array(
 | |
| ## -          'protected' => true,
 | |
| ## -          /*
 | |
| ## -          'hosts' => array('mail4us.net', 'svn.mail4us.net'),
 | |
| ## -          */
 | |
| ## -          'hosts' => false,
 | |
| ## -          'active' => true
 | |
| ## -        ),
 | |
| ## -
 | |
| vim $WEBMAIL_BASEDIR/roundcubemail-${ROUNDCUBE_VERSION}/plugins/plugin_manager/config.inc.php
 | |
| 
 | |
| 
 | |
| ## - register global_alias with roundcube
 | |
| ## -
 | |
| ## - edit $WEBMAIL_BASEDIR/roundcubemail-${ROUNDCUBE_VERSION}/config/main.inc.php
 | |
| ## -
 | |
| ## - register plugin, add "global_alias" to array plugins
 | |
| ## -    $rcmail_config['plugins'] = array('global_alias');
 | |
| ## -
 | |
| vim $WEBMAIL_BASEDIR/roundcubemail-${ROUNDCUBE_VERSION}/config/main.inc.php
 | |
| 
 | |
| 
 | |
| ## ----------------------------------------------- #
 | |
| ## --- integrate calendar plugin for roundcube --- #
 | |
| ## ----------------------------------------------- #
 | |
| 
 | |
| ## - requirements:
 | |
| ## -    - plugin jqueryui
 | |
| ## -    - plugin qtip
 | |
| ## -    - plugin http_auth
 | |
| ## -    - plugin jscolor
 | |
| ## -
 | |
| 
 | |
| ## -------------------
 | |
| ## - Install http_auth
 | |
| ## -
 | |
| 
 | |
| ## - Download within the plugin manager
 | |
| ## -
 | |
| cp -a ${WEBMAIL_BASEDIR}/plugins/http_auth $WEBMAIL_BASEDIR/roundcubemail-${ROUNDCUBE_VERSION}/plugins/
 | |
| 
 | |
| 
 | |
| ## -------------------
 | |
| ## - Install jscolor
 | |
| ## -
 | |
| 
 | |
| ## - Download within the plugin manager
 | |
| ## -
 | |
| cp -a $WEBMAIL_BASEDIR/plugins/jscolor $WEBMAIL_BASEDIR/roundcubemail-${ROUNDCUBE_VERSION}/plugins/
 | |
| 
 | |
| 
 | |
| ## - create configuration file
 | |
| ## -
 | |
| cp -a $WEBMAIL_BASEDIR/roundcubemail-${ROUNDCUBE_VERSION}/plugins/jscolor/config.inc.php.dist \
 | |
|    $WEBMAIL_BASEDIR/roundcubemail-${ROUNDCUBE_VERSION}/plugins/jscolor/config.inc.php
 | |
| 
 | |
| 
 | |
| 
 | |
| ## ------------------
 | |
| ## - Install calendar
 | |
| ## -
 | |
| cp -a $WEBMAIL_BASEDIR/plugins/calendar $WEBMAIL_BASEDIR/roundcubemail-${ROUNDCUBE_VERSION}/plugins/
 | |
| 
 | |
| cp -a $WEBMAIL_BASEDIR/roundcubemail-${ROUNDCUBE_VERSION}/plugins/calendar/config.inc.php.dist \
 | |
|    $WEBMAIL_BASEDIR/roundcubemail-${ROUNDCUBE_VERSION}/plugins/calendar/config.inc.php
 | |
| 
 | |
| 
 | |
| ## - edit $WEBMAIL_BASEDIR/roundcubemail-${ROUNDCUBE_VERSION}/plugins/calendar/config.inc.php
 | |
| ## -
 | |
| ## - adjust the following variables:
 | |
| ## -    $rcmail_config['calendar_admin'] = 'ckubu@oopen.de';
 | |
| ## -
 | |
| ## -    # Notice: make this folder writable for webserver user
 | |
| ## -    #
 | |
| ## -    $rcmail_config['cal_tempdir'] = '$WEBMAIL_BASEDIR/temp'; i.e. /var/www/webmail.oopen.de/temp
 | |
| ## -    $rcmail_config['backend'] = "database";
 | |
| ## -
 | |
| ## -
 | |
| ## -    # smtp login data needed for cronjob "reminders.php"
 | |
| ## -    #
 | |
| ## -    $rcmail_config['cron_log'] = true;
 | |
| ## -    $rcmail_config['cron_smtp_user'] = 'adm@oopen.de'; //smtp user
 | |
| ## -    $rcmail_config['cron_smtp_pass'] = 'EadGl15E'; //smtp password
 | |
| ## -    $rcmail_config['cron_rc_url'] = 'http://webmail.oopen.de/'; //trailing slash !!!
 | |
| ## -    $rcmail_config['cron_ip'] = '127.0.0.1'; //please use real IP
 | |
| ## -    $rcmail_config['cron_sender'] = 'noreply@oopen.de';
 | |
| ## -
 | |
| vim $WEBMAIL_BASEDIR/roundcubemail-${ROUNDCUBE_VERSION}/plugins/calendar/config.inc.php
 | |
| 
 | |
| chown $WEBSERVER_USER:$WEBSERVER_GROUP $WEBMAIL_BASEDIR/roundcubemail-${ROUNDCUBE_VERSION}/plugins/calendar/temp
 | |
| 
 | |
| ## - create tables for calendar plugin in roundcube database
 | |
| ## - you will find needed sql-statements in directora calendar/SQL
 | |
| ## -
 | |
| ## - !! Do that as roundcube user !!
 | |
| ## - if not, you have to adjust ownerchip of tables and sequences afterwards
 | |
| ## -    ALTER TABLE <tablen ame> OWNER TO <new owner>;
 | |
| ## -    ALTER SEQUENCE <sequence name> OWNER TO <new owner>;
 | |
| ## -
 | |
| 
 | |
| 
 | |
| ## - Trigger cronjob for sending reminders
 | |
| ## -
 | |
| ## -
 | |
| ## -     */5 * * * *  su $WEBSERVER_USER -c"php5 -d suhosin.session.encrypt=off $WEBMAIL_BASEDIR/roundcubemail-${ROUNDCUBE_VERSION}/plugins//calendar/cron/reminders.php" > /dev/null
 | |
| ## -
 | |
| ## - !! Notice 
 | |
| ## -
 | |
| ## - I have compiled and installed php from source code. so i ha to change
 | |
| ## - my crontab rule because of errors ("Class rcmail not found" or
 | |
| ## - "Location not found" to
 | |
| ## -
 | |
| ## -    */5 * * * * su www-data -c "cd /var/www/webmail.initiativenserver.de/htdocs/plugins/calendar/cron ; /usr/local/php/bin/php -d suhosin.session.encrypt=off -f reminders.php"
 | |
| ## -
 | |
| crontab -l > /tmp/tmp_crontab
 | |
| echo "" >> /tmp/tmp_crontab
 | |
| echo "## - Trigger cronjob for sending reminders (calendar plugin roundcube)" >> /tmp/tmp_crontab
 | |
| echo "## -" >> /tmp/tmp_crontab
 | |
| echo "*/5 * * * *  su $WEBSERVER_USER -c\"php5 -d suhosin.session.encrypt=off $WEBMAIL_BASEDIR/roundcubemail-${ROUNDCUBE_VERSION}/plugins//calendar/cron/reminders.php > /dev/null" >> /tmp/tmp_crontab
 | |
| crontab /tmp/tmp_crontab
 | |
| rm /tmp/tmp_crontab
 | |
| 
 | |
| 
 | |
| ## - Note: register plugin either with plugin_manager or with roundcube methode NOT BOTH
 | |
| 
 | |
| ## - register calendar plugin with plugin_manager
 | |
| ## -
 | |
| ## - edit: $WEBMAIL_BASEDIR/roundcubemail-${ROUNDCUBE_VERSION}/plugins/plugin_manager/config.inc.php
 | |
| ## -
 | |
| ## - add to array $rcmail_config['plugin_manager_defaults'] (Section calendaring)
 | |
| ## - after line "'calendar' => array("
 | |
| ## -
 | |
| ## -        'calendar' => array(
 | |
| ## -          'label_name' => 'calendar.pluginname',
 | |
| ## -          'label_description' => 'calendar.plugindescription',
 | |
| ## -          'buttons' => array('#calendar_button', '#rcmrowcalendarlink', '#rcmrowcalendarcategories', '#rcmrowcalendarfeeds'), 
 | |
| ## -          'reload' => true,
 | |
| ## -          'config' => './?_task=settings&_action=edit-prefs&_section=calendarlink&_framed=1',
 | |
| ## -          'section' => 'calendarlink',
 | |
| ## -          'uninstall' => true,
 | |
| ## -          'uninstall_request' => array(
 | |
| ## -            'action' => 'plugin.calendar_uninstall',
 | |
| ## -            'method' => 'post',
 | |
| ## -          ),
 | |
| ## -          'active' => true
 | |
| ## -        ),
 | |
| ## -
 | |
| vim $WEBMAIL_BASEDIR/roundcubemail-${ROUNDCUBE_VERSION}/plugins/plugin_manager/config.inc.php
 | |
| 
 | |
| 
 | |
| ## - register calendar plugin without using plugin_manager
 | |
| ## -
 | |
| ## - edit  $WEBMAIL_BASEDIR/roundcubemail-${ROUNDCUBE_VERSION}/config/main.inc.php
 | |
| ## -
 | |
| ## - add "calendar" to array plugins
 | |
| ## -    $rcmail_config['plugins'] = array('global_alias','contextmenue', 'password', 'acl', 'calendar')
 | |
| ## -
 | |
| vim $WEBMAIL_BASEDIR/roundcubemail-${ROUNDCUBE_VERSION}/config/main.inc.php
 | |
| 
 | |
| 
 | |
| 
 | |
| ## -----------------------
 | |
| ## - Install calendar_plus
 | |
| ## -
 | |
| 
 | |
| 
 | |
| 
 | |
| ## -----------------
 | |
| ## - Install carddav
 | |
| ## -
 | |
| 
 | |
| 
 | |
| 
 | |
| ## ----------------------
 | |
| ## - Install carddav_plus
 | |
| ## -
 | |
| 
 | |
| 
 | |
| 
 | |
| ## --------------------------------------------------- #
 | |
| ## --- Install vacation plugin bhusigen rc-vacation -- #
 | |
| ## --------------------------------------------------- #
 | |
| 
 | |
| ## - see: https://github.com/bhuisgen/rc-vacation/
 | |
| 
 | |
| ## - Download from site https://github.com/bhuisgen/rc-vacation/ and
 | |
| ## - store archive in $WEBMAIL_BASEDIR
 | |
| ## -
 | |
| cd $WEBMAIL_BASEDIR
 | |
| rm rc-vacation-master.zip
 | |
| wget -O rc-vacation-master.zip https://github.com/bhuisgen/rc-vacation/archive/master.zip
 | |
| 
 | |
| cd $WEBMAIL_BASEDIR/roundcubemail-${ROUNDCUBE_VERSION}/plugins
 | |
| unzip $WEBMAIL_BASEDIR/rc-vacation-master.zip
 | |
| ln -s rc-vacation-master $WEBMAIL_BASEDIR/roundcubemail-${ROUNDCUBE_VERSION}/plugins/vacation
 | |
| 
 | |
| 
 | |
| ## -
 | |
| ## - or use git to get the sources directly:
 | |
| ## -
 | |
| cd $WEBMAIL_BASEDIR/roundcubemail-${ROUNDCUBE_VERSION}/plugins
 | |
| git clone https://github.com/bhuisgen/rc-vacation.git
 | |
| 
 | |
| ln -s rc-vacation vacation
 | |
| 
 | |
| cp $WEBMAIL_BASEDIR/roundcubemail-${ROUNDCUBE_VERSION}/plugins/vacation/config.inc.php.dist \
 | |
|    $WEBMAIL_BASEDIR/roundcubemail-${ROUNDCUBE_VERSION}/plugins/vacation/config.inc.php
 | |
| 
 | |
| 
 | |
| if [ "$_db_type" = "pgsql" ];then
 | |
| 
 | |
|    ## -------------------------------------------------------------- ##
 | |
|    ## - !! That (very long) part concerns to PostgeSQL Database !! - ##
 | |
|    ## -------------------------------------------------------------- ##
 | |
| 
 | |
|    ## - Note: In the following sql statements set the correct AUTOREPLY domain !!
 | |
|    ## -       Also chnage the database parameters as yor needs
 | |
|    ## -
 | |
|    ## - edit configuration $WEBMAIL_BASEDIR/roundcubemail-${ROUNDCUBE_VERSION}/plugins/vacation/config.inc.php
 | |
|    ## -
 | |
|    ## -    $rcmail_config['vacation_gui_vacationforwarder'] = TRUE;
 | |
|    ## -    $rcmail_config['vacation_forwarder_multiple'] = TRUE;
 | |
|    ## -    $rcmail_config['vacation_forwarder_separator'] = ',';
 | |
|    ## -
 | |
|    ## -    $rcmail_config['vacation_driver'] = 'sql';
 | |
|    ## -
 | |
|    ## -    #configure your database connection to POSTFIX database
 | |
|    ## -    $rcmail_config['vacation_sql_dsn'] = '${_db_type}://${_db_user}:${_db_pass}@localhost/${_db_name}';
 | |
|    ## -
 | |
|    ## -
 | |
|    ## -    # !! NOTE: You have to create postgres function udf_forwarders_out and
 | |
|    ## -    #          udf_forwarders_in to get the following SQL statements working
 | |
|    ## -    #
 | |
|    ## -    /* - OLD: vcation.pl included in posfixadmin until version 2.3.7
 | |
|    ## -    $rcmail_config['vacation_sql_read'] =
 | |
|    ## -       array("SELECT subject AS vacation_subject, body AS vacation_message, " .
 | |
|    ## -                 "CASE WHEN vacation.active = TRUE THEN 1 ELSE 0 END AS vacation_enable, " .
 | |
|    ## -                 "udf_forwarders_out(%username,'$_autoreply_domain',',') AS vacation_forwarder FROM vacation,alias " .
 | |
|    ## -             "WHERE email=%username AND address=%username  AND vacation.domain=%email_domain;"
 | |
|    ## -            );
 | |
|    ## -    */
 | |
|    ## -    /* - NEW: vcation.pl included in posfixadmin since version 2.91
 | |
|    ## -    $rcmail_config['vacation_sql_read'] =
 | |
|    ## -       array("SELECT subject AS vacation_subject, body AS vacation_message, date_part('epoch',activefrom)::int AS vacation_start, date_part('epoch',activeuntil)::int AS vacation_end, " .
 | |
|    ## -                 "CASE WHEN vacation.active = TRUE THEN 1 ELSE 0 END AS vacation_enable, " .
 | |
|    ## -                 "udf_forwarders_out(%username,'autoreply.oopen.de',',') AS vacation_forwarder FROM vacation,alias " .
 | |
|    ## -             "WHERE email=%username AND address=%username  AND vacation.domain=%email_domain;"
 | |
|    ## -            );
 | |
|    ## -    */
 | |
|    ## -    
 | |
|    ## -    
 | |
|    ## -    /* !! Wichtig:  
 | |
|    ## -          Nur wenn rcmail_config['vacation_gui_vacationforwarder'] = FALSE
 | |
|    ## -    */
 | |
|    ## -    
 | |
|    ## -    
 | |
|    ## -    /* - OLD: vcation.pl included in posfixadmin until version 2.3.7
 | |
|    ## -    $rcmail_config['vacation_gui_vacationforwarder'] = FALSE;
 | |
|    ## -    $rcmail_config['vacation_sql_write'] =
 | |
|    ## -       array("DELETE FROM vacation WHERE email=%email AND " .
 | |
|    ## -                "domain=%email_domain;",
 | |
|    ## -              "DELETE from vacation_notification WHERE on_vacation=%email;",
 | |
|    ## -             "INSERT INTO vacation (email,domain,subject,body,created," .
 | |
|    ## -                "active) VALUES (%email,%email_domain,%vacation_subject," .
 | |
|    ## -                   "%vacation_message,NOW(),udf_set_active(%vacation_enable));",
 | |
|    ## -              "UPDATE alias SET goto = udf_forwarders_in(udf_forwarders_out(%email,'$_autoreply_domain',',')," .
 | |
|    ## -                                       "%email,'$_autoreply_domain',',',udf_set_active(%vacation_enable))" .
 | |
|    ## -                            ", modified = NOW() " .
 | |
|    ## -                            " WHERE address = %email"
 | |
|    ## -    
 | |
|    ## -        );
 | |
|    ## -    */
 | |
|    ## -    /* - NEW: vcation.pl included in posfixadmin since version 2.91
 | |
|    ## -    ---------------------------------------------------------------
 | |
|    ## -    $rcmail_config['vacation_gui_vacationforwarder'] = FALSE;
 | |
|    ## -    $rcmail_config['vacation_sql_write'] =
 | |
|    ## -       array("DELETE FROM vacation WHERE email=%email AND domain=%email_domain;",
 | |
|    ## -             "DELETE from vacation_notification WHERE on_vacation=%email;",
 | |
|    ## -             "INSERT INTO vacation (email,domain,subject,body,activefrom,activeuntil,interval_time,created,active) " .
 | |
|    ## -                "VALUES (%email,%email_domain,%vacation_subject,%vacation_message," .
 | |
|    ## -                         "to_timestamp(%vacation_start - extract(timezone from current_timestamp))," .
 | |
|    ## -                         "to_timestamp(%vacation_end + 86399 - extract(timezone from current_timestamp))," .
 | |
|    ## -                         "86400,NOW(),udf_set_active(%vacation_enable));",
 | |
|    ## -             "UPDATE alias SET goto = udf_forwarders_in(udf_forwarders_out(%email,'$_autoreply_domain',',')," .
 | |
|    ## -                                         "%email,'$_autoreply_domain',',',udf_set_active(%vacation_enable))" .
 | |
|    ## -                               ", modified = NOW() " .
 | |
|    ## -                           " WHERE address = %email"
 | |
|    ## -    
 | |
|    ## -       );
 | |
|    ## -    */
 | |
|    ## -    
 | |
|    ## -    
 | |
|    ## -    /* !! Wichtig:  
 | |
|    ## -          Nur wenn rcmail_config['vacation_gui_vacationforwarder'] = TRUE 
 | |
|    ## -    */
 | |
|    ## -    
 | |
|    ## -    /* - OLD: vcation.pl included in posfixadmin until version 2.3.7
 | |
|    ## -       -------------------------------------------------------------
 | |
|    ## -    $rcmail_config['vacation_gui_vacationforwarder'] = TRUE;
 | |
|    ## -    $rcmail_config['vacation_sql_write'] =
 | |
|    ## -       array("DELETE FROM vacation WHERE email=%email AND " .
 | |
|    ## -                "domain=%email_domain;",
 | |
|    ## -              "DELETE from vacation_notification WHERE on_vacation=%email;",
 | |
|    ## -             "INSERT INTO vacation (email,domain,subject,body,created," .
 | |
|    ## -                "active) VALUES (%email,%email_domain,%vacation_subject," .
 | |
|    ## -                   "%vacation_message,NOW(),udf_set_active(%vacation_enable));",
 | |
|    ## -              "UPDATE alias SET goto = udf_forwarders_in(%vacation_forwarder," .
 | |
|    ## -                                       "%email,'$_autoreply_domain',',',udf_set_active(%vacation_enable))" .
 | |
|    ## -                            ", modified = NOW() " .
 | |
|    ## -                            " WHERE address = %email"
 | |
|    ## -    
 | |
|    ## -        );
 | |
|    ## -    */
 | |
|    ## -    /* - NEW: vcation.pl included in posfixadmin since version 2.91
 | |
|    ## -    ---------------------------------------------------------------
 | |
|    ## -    $rcmail_config['vacation_gui_vacationforwarder'] = TRUE;
 | |
|    ## -    $rcmail_config['vacation_sql_write'] =
 | |
|    ## -       array("DELETE FROM vacation WHERE email=%email AND domain=%email_domain;",
 | |
|    ## -              "DELETE from vacation_notification WHERE on_vacation=%email;",
 | |
|    ## -             "INSERT INTO vacation (email,domain,subject,body,activefrom,activeuntil,interval_time,created,active) " .
 | |
|    ## -                "VALUES (%email,%email_domain,%vacation_subject,%vacation_message," .
 | |
|    ## -                         "to_timestamp(%vacation_start - extract(timezone from current_timestamp))," .
 | |
|    ## -                         "to_timestamp(%vacation_end + 86399 - extract(timezone from current_timestamp))," .
 | |
|    ## -                         "86400,NOW(),udf_set_active(%vacation_enable));",
 | |
|    ## -              "UPDATE alias SET goto = udf_forwarders_in(%vacation_forwarder," .
 | |
|    ## -                                       "%email,'$_autoreply_domain',',',udf_set_active(%vacation_enable))" .
 | |
|    ## -                            ", modified = NOW() " .
 | |
|    ## -                            " WHERE address = %email"
 | |
|    ## -       );
 | |
|    ## -    */
 | |
| 
 | |
|    ## -
 | |
|    vim $WEBMAIL_BASEDIR/roundcubemail-${ROUNDCUBE_VERSION}/plugins/vacation/config.inc.php
 | |
| 
 | |
| 
 | |
|    ## - create postfix trigger function udf_forwarders_out:
 | |
|    ## -
 | |
|    cat <<EOF > /tmp/postgres.forwarders_out.sql
 | |
| CREATE LANGUAGE plpgsql;
 | |
| 
 | |
| CREATE FUNCTION udf_forwarders_out(email_str text, vacation_domain text, list_seperator character) RETURNS text
 | |
|     LANGUAGE plpgsql
 | |
|     AS \$\$
 | |
|    DECLARE
 | |
|       forward_str text;
 | |
|       local_email_part TEXT;
 | |
|       domain_email_part TEXT;
 | |
|    BEGIN
 | |
|       
 | |
|       -- get list of forwarders
 | |
|       --
 | |
|       SELECT goto INTO forward_str FROM alias WHERE address=email_str;
 | |
|       
 | |
|       -- entferne mailbox emailadresse
 | |
|       -- 
 | |
|       forward_str = replace(forward_str, email_str, '' );
 | |
|       
 | |
|       -- entferne vacation adresse
 | |
|       --
 | |
|       local_email_part = substring(email_str, 1, position('@' in email_str) - 1);
 | |
|       domain_email_part = substring(email_str,  position('@' in email_str) + 1 );
 | |
|       forward_str = replace(forward_str, local_email_part || '#' || domain_email_part || '@' || vacation_domain, '');
 | |
| 
 | |
|       -- enferne doppelte seperatorzeichen 
 | |
|       --
 | |
|       WHILE position( list_seperator || list_seperator in forward_str ) > 0 LOOP
 | |
|          forward_str = replace(forward_str, list_seperator || list_seperator , '');
 | |
|       END LOOP;
 | |
| 
 | |
|       -- entferne erstes zeichen wenn es das seperatorzeichen ist
 | |
|       --
 | |
|       IF substring(forward_str,1,1)  = list_seperator THEN
 | |
|          forward_str = substring(forward_str from 2);
 | |
|       END IF;
 | |
| 
 | |
| 
 | |
|       -- entferne letztes zeichen wenn es das seperatorzeichen ist
 | |
|       --
 | |
|       IF substring(forward_str from  char_length(forward_str))  = list_seperator THEN
 | |
|          forward_str = substring(forward_str, 1, char_length(forward_str) - 1);
 | |
|       END IF;
 | |
| 
 | |
| 
 | |
|       -- forward_str = substring(forward_str from  char_length(forward_str));
 | |
| 
 | |
|       RETURN forward_str;
 | |
|    END;
 | |
|    \$\$;
 | |
| EOF
 | |
| 
 | |
|    ## - create function
 | |
|    ## -
 | |
|    ## - Note 1.
 | |
|    ## - if datbase language plpgsql already exists, an error occurs. but you can
 | |
|    ## - savely ignore that error
 | |
|    ## -
 | |
|    ## - Note 2.
 | |
|    ## - if you create the function not as postfix database user, you have to
 | |
|    ## - give the permission afterwards:
 | |
|    ## -    ALTER FUNCTION public.udf_forwarders_out(email_str text, vacation_domain text, list_seperator character) OWNER TO postfix;
 | |
|    ## - But we will use the db postfix user (here also named postfix)
 | |
|    ## -
 | |
|    psql -Upostfix postfix < /tmp/postgres.forwarders_out.sql
 | |
| 
 | |
|    rm /tmp/postgres.forwarders_out.sql
 | |
| 
 | |
|    
 | |
|    ## - create sql file for installing function udf_set_active:
 | |
|    ## -
 | |
|    cat <<EOF > /tmp/postgres.set_active.sql
 | |
| CREATE LANGUAGE plpgsql;
 | |
|  
 | |
| CREATE FUNCTION udf_set_active(vacation_enable text) RETURNS boolean
 | |
|     LANGUAGE plpgsql
 | |
|     AS \$\$
 | |
|    DECLARE
 | |
|       return_val boolean;
 | |
|    BEGIN
 | |
|  
 | |
|       return_val = 't';
 | |
|  
 | |
|       IF vacation_enable = '' THEN
 | |
|          return_val = 'f';
 | |
|       END IF;
 | |
|  
 | |
|       IF vacation_enable = '0' THEN
 | |
|          return_val = 'f';
 | |
|       END IF;
 | |
|  
 | |
|       IF lower(vacation_enable) = 'false' THEN
 | |
|          return_val = 'f';
 | |
|       END IF;
 | |
|  
 | |
|       RETURN return_val;
 | |
|    END;
 | |
|    \$\$;
 | |
| EOF
 | |
|  
 | |
|    ## - create function udf_set_active
 | |
|    ## -
 | |
|    ## - Note 1.
 | |
|    ## - if datbase language plpgsql already exists, an error occurs. but you can
 | |
|    ## - savely ignore that error
 | |
|    ## -
 | |
|    ## - Note 2.
 | |
|    ## - if you create the function not as postfix database user, you have to
 | |
|    ## - give the permission afterwards:
 | |
|    ## -    ALTER FUNCTION public.udf_forwarders_in(forewarders_str text, email_str text, vacation_domain text, list_seperator character, vacation_enable boolean) OWNER TO postfix;
 | |
|    ## - But we will use the db postfix user (here also named postfix)
 | |
|    ## -
 | |
|    psql -Upostfix postfix < /tmp/postgres.set_active.sql
 | |
| 
 | |
|    rm /tmp/postgres.set_active.sql
 | |
| 
 | |
| 
 | |
|    ## - create postfix database function udf_forwarders_in:
 | |
|    ## -
 | |
|    cat <<EOF > /tmp/postgres.forwarders_in.sql
 | |
| CREATE LANGUAGE plpgsql;
 | |
| 
 | |
| CREATE FUNCTION udf_forwarders_in(forewarders_str text, email_str text, vacation_domain text, list_seperator character, vacation_enable boolean) RETURNS text
 | |
|     LANGUAGE plpgsql
 | |
|     AS \$\$
 | |
|    DECLARE
 | |
|       return_str text;
 | |
|       local_email_part TEXT;
 | |
|       domain_email_part TEXT;
 | |
|    BEGIN
 | |
| 
 | |
|       return_str = email_str;
 | |
| 
 | |
|       IF vacation_enable THEN
 | |
|         local_email_part = substring(email_str, 1, position('@' in email_str) - 1);
 | |
|         domain_email_part = substring(email_str,  position('@' in email_str) + 1 );
 | |
|         return_str = return_str || list_seperator || local_email_part || '#' || domain_email_part || '@' || vacation_domain;
 | |
|       END IF;
 | |
| 
 | |
|       IF char_length(forewarders_str) > 7 THEN
 | |
|          return_str = return_str || list_seperator || forewarders_str;
 | |
|       END IF;
 | |
| 
 | |
|       RETURN return_str;
 | |
|    END;
 | |
|    \$\$;
 | |
| EOF
 | |
| 
 | |
|    ## - create function udf_forwarders_in
 | |
|    ## -
 | |
|    ## - Note 1.
 | |
|    ## - if datbase language plpgsql already exists, an error occurs. but you can
 | |
|    ## - savely ignore that error
 | |
|    ## -
 | |
|    ## - Note 2.
 | |
|    ## - if you create the function not as postfix database user, you have to
 | |
|    ## - give the permission afterwards:
 | |
|    ## -    ALTER FUNCTION public.udf_forwarders_in(forewarders_str text, email_str text, vacation_domain text, list_seperator character, vacation_enable boolean) OWNER TO postfix;
 | |
|    ## - But we will use the db postfix user (here also named postfix)
 | |
|    ## -
 | |
|    psql -Upostfix postfix < /tmp/postgres.forwarders_in.sql
 | |
| 
 | |
|    rm /tmp/postgres.forwarders_in.sql
 | |
| 
 | |
| elif [ "$_db_type" = "mysql" ];then
 | |
| 
 | |
|    ## ---------------------------------------------------------- ##
 | |
|    ## - !! That (very long) part concerns to MySQL Database !! - ##
 | |
|    ## ---------------------------------------------------------- ##
 | |
| 
 | |
|    ## - Note: In the following sql statements set the correct AUTOREPLY domain !!
 | |
|    ## -       Also chnage the database parameters as yor needs
 | |
|    ## -
 | |
|    ## - edit configuration $WEBMAIL_BASEDIR/roundcubemail-${ROUNDCUBE_VERSION}/plugins/vacation/config.inc.php
 | |
|    ## -
 | |
|    ## -    $rcmail_config['vacation_gui_vacationforwarder'] = FALSE;
 | |
|    ## -    $rcmail_config['vacation_forwarder_multiple'] = FALSE;
 | |
|    ## -    $rcmail_config['vacation_forwarder_separator'] = ',';
 | |
|    ## -
 | |
|    ## -    $rcmail_config['vacation_driver'] = 'sql';
 | |
|    ## -
 | |
|    ## -    #configure your database connection to POSTFIX database
 | |
|    ## -    $rcmail_config['vacation_sql_dsn'] = '${_db_type}://${_db_user}:${_db_pass}@localhost/${_db_name}';
 | |
|    ## -
 | |
|    ## -    # !! NOTE: You have to create myql functions FORWARDERS_OUT and 
 | |
|    ## -    #          FORWARDERS_IN to get the following SQL read statement working
 | |
|    ## -    #
 | |
|    ## -
 | |
|    ## -    // read data queries
 | |
|    ## -    /* - OLD: vcation.pl included in posfixadmin until version 2.3.7
 | |
|    ## -    $rcmail_config['vacation_sql_read'] =
 | |
|    ## -       array("SELECT subject AS vacation_subject, body AS vacation_message, " .
 | |
|    ## -                 "vacation.active AS vacation_enable, FORWARDERS_OUT(%username,'$_autoreply_domain',',') AS vacation_forwarder FROM vacation,alias " .
 | |
|    ## -             "WHERE email=%username AND address=%username  AND vacation.domain=%email_domain;"
 | |
|    ## -            );
 | |
|    ## -    *)
 | |
|    ## -    /* - NEW: vcation.pl included in posfixadmin since version 2.91 */
 | |
|    ## -    $rcmail_config['vacation_sql_read'] =
 | |
|    ## -       array("SELECT subject AS vacation_subject, body AS vacation_message," .
 | |
|    ## -                     "UNIX_TIMESTAMP(activefrom) AS vacation_start," .
 | |
|    ## -                     "UNIX_TIMESTAMP(activeuntil) AS vacation_end," .
 | |
|    ## -                     "vacation.active AS vacation_enable," .
 | |
|    ## -                     "FORWARDERS_OUT(%username,'autoreply.initiativenserver.de',',') AS vacation_forwarder " .
 | |
|    ## -             "FROM vacation,alias " .
 | |
|    ## -             "WHERE email=%username AND address=%username  AND vacation.domain=%email_domain;"
 | |
|    ## -            );
 | |
|    ## -    
 | |
|    ## -    
 | |
|    ## -    // write data queries
 | |
|    ## -    /* !! Wichtig:  
 | |
|    ## -          Nur wenn rcmail_config['vacation_gui_vacationforwarder'] = FALSE
 | |
|    ## -    */
 | |
|    ## -    
 | |
|    ## -    /* - OLD: vcation.pl included in posfixadmin until version 2.3.7
 | |
|    ## -    $rcmail_config['vacation_gui_vacationforwarder'] = FALSE;
 | |
|    ## -    $rcmail_config['vacation_sql_write'] =
 | |
|    ## -       array("DELETE FROM vacation WHERE email=%email AND " .
 | |
|    ## -                "domain=%email_domain;",
 | |
|    ## -              "DELETE from vacation_notification WHERE on_vacation=%email;",
 | |
|    ## -             "INSERT INTO vacation (email,domain,subject,body,created," .
 | |
|    ## -                "active) VALUES (%email,%email_domain,%vacation_subject," .
 | |
|    ## -                   "%vacation_message,NOW(),%vacation_enable);",
 | |
|    ## -              "UPDATE alias SET goto = FORWARDERS_IN(FORWARDERS_OUT(%email,'$_autoreply_domain',',')," .
 | |
|    ## -                                       "%email,'$_autoreply_domain',',',%vacation_enable)" .
 | |
|    ## -                                ", modified = NOW() " .
 | |
|    ## -                            " WHERE address = %email"
 | |
|    ## -      );
 | |
|    ## -    /*
 | |
|    ## -
 | |
|    ## -    /* - NEW: vcation.pl included in posfixadmin since version 2.91 */
 | |
|    ## -    /*
 | |
|    ## -    $rcmail_config['vacation_gui_vacationforwarder'] = FALSE;
 | |
|    ## -    $rcmail_config['vacation_sql_write'] =
 | |
|    ## -       array("DELETE FROM vacation WHERE email=%email AND domain=%email_domain;",
 | |
|    ## -             "DELETE from vacation_notification WHERE on_vacation=%email;",
 | |
|    ## -             "INSERT INTO vacation (email,domain,subject,body,activefrom,activeuntil,interval_time,created,active) " .
 | |
|    ## -                "VALUES (%email,%email_domain,%vacation_subject,%vacation_message," .
 | |
|    ## -                         "CONCAT(DATE(FROM_UNIXTIME(%vacation_start)), ' 00:00:00')," .
 | |
|    ## -                         "CONCAT(DATE(FROM_UNIXTIME(%vacation_end)), ' 23:59:59')," .
 | |
|    ## -                         "86400,NOW(),%vacation_enable);",
 | |
|    ## -              "UPDATE alias SET goto = FORWARDERS_IN(FORWARDERS_OUT(%email,'autoreply.initiativenserver.de',',')," .
 | |
|    ## -                                       "%email,'autoreply.initiativenserver.de',',',%vacation_enable)" .
 | |
|    ## -                                ", modified = NOW() " .
 | |
|    ## -                            " WHERE address = %email"
 | |
|    ## -      );
 | |
|    ## -    */
 | |
|    ## -    
 | |
|    ## -    /* !! Wichtig:  
 | |
|    ## -          Nur wenn rcmail_config['vacation_gui_vacationforwarder'] = TRUE
 | |
|    ## -    */
 | |
|    ## -    
 | |
|    ## -    /*
 | |
|    ## -
 | |
|    ## -    /* - OLD: vcation.pl included in posfixadmin until version 2.3.7
 | |
|    ## -    $rcmail_config['vacation_gui_vacationforwarder'] = TRUE;
 | |
|    ## -    $rcmail_config['vacation_sql_write'] =
 | |
|    ## -       array("DELETE FROM vacation WHERE email=%email AND " .
 | |
|    ## -                "domain=%email_domain;",
 | |
|    ## -              "DELETE from vacation_notification WHERE on_vacation=%email;",
 | |
|    ## -             "INSERT INTO vacation (email,domain,subject,body,created," .
 | |
|    ## -                "active) VALUES (%email,%email_domain,%vacation_subject," .
 | |
|    ## -                   "%vacation_message,NOW(),%vacation_enable);",
 | |
|    ## -              "UPDATE alias SET goto = FORWARDERS_IN(%vacation_forwarder," .
 | |
|    ## -                                       "%email,'autoreply.initiativenserver.de',',',%vacation_enable)" .
 | |
|    ## -                                ", modified = NOW() " .
 | |
|    ## -                            " WHERE address = %email"
 | |
|    ## -      );
 | |
|    ## -    */
 | |
|    ## -    
 | |
|    ## -    /* - NEW: vcation.pl included in posfixadmin since version 2.91 */
 | |
|    ## -    $rcmail_config['vacation_gui_vacationforwarder'] = TRUE;
 | |
|    ## -    $rcmail_config['vacation_sql_write'] =
 | |
|    ## -       array("DELETE FROM vacation WHERE email=%email AND domain=%email_domain;",
 | |
|    ## -             "DELETE from vacation_notification WHERE on_vacation=%email;",
 | |
|    ## -             "INSERT INTO vacation (email,domain,subject,body,activefrom,activeuntil,interval_time,created,active) " .
 | |
|    ## -                "VALUES (%email,%email_domain,%vacation_subject,%vacation_message," .
 | |
|    ## -                         "CONCAT(DATE(FROM_UNIXTIME(%vacation_start)), ' 00:00:00')," .
 | |
|    ## -                         "CONCAT(DATE(FROM_UNIXTIME(%vacation_end)), ' 23:59:59')," .
 | |
|    ## -                         "86400,NOW(),%vacation_enable);",
 | |
|    ## -              "UPDATE alias SET goto = FORWARDERS_IN(%vacation_forwarder," .
 | |
|    ## -                                       "%email,'autoreply.initiativenserver.de',',',%vacation_enable)" .
 | |
|    ## -                                ", modified = NOW() " .
 | |
|    ## -                            " WHERE address = %email"
 | |
|    ## -      );
 | |
|    ## -    
 | |
|    ## -
 | |
|    vim $WEBMAIL_BASEDIR/roundcubemail-${ROUNDCUBE_VERSION}/plugins/vacation/config.inc.php
 | |
| 
 | |
| 
 | |
|    ## - create function FORWARDERS_OUT:
 | |
|    ## -
 | |
|    cat <<EOF > /tmp/FORWARDERS_OUT.sql
 | |
| DROP FUNCTION IF EXISTS FORWARDERS_OUT ;
 | |
| 
 | |
| DELIMITER |
 | |
| 
 | |
| CREATE FUNCTION FORWARDERS_OUT (email_str TEXT, vacation_domain TEXT , list_seperator CHAR)
 | |
|    RETURNS TEXT
 | |
|    DETERMINISTIC
 | |
|    BEGIN
 | |
|       DECLARE forward_str TEXT;
 | |
|       DECLARE local_email_part TEXT;
 | |
|       DECLARE domain_email_part TEXT;
 | |
|       DECLARE first_char CHAR;
 | |
|       DECLARE last_char CHAR;
 | |
| 
 | |
|       -- get list of forwarders
 | |
|       -- 
 | |
|       SELECT goto INTO forward_str FROM alias WHERE address=email_str;
 | |
| 
 | |
|       -- entferne mailbox emailadresse
 | |
|       --
 | |
|       SET forward_str =  REPLACE(forward_str, email_str, '' );
 | |
|       -- SELECT REPLACE(forward_str, email_str, '' ) INTO forward_str;
 | |
| 
 | |
|       -- entferne vacation adresse
 | |
|       -- 
 | |
|       SET local_email_part = SUBSTRING(email_str,1, LOCATE('@',email_str) - 1);
 | |
|       SET domain_email_part = SUBSTRING(email_str, LOCATE('@',email_str) + 1, LENGTH(email_str));
 | |
|       SET forward_str = REPLACE(forward_str, CONCAT(local_email_part, "#" ,domain_email_part,"@", vacation_domain), '');
 | |
|       -- SELECT REPLACE(forward_str, CONCAT(list_seperator,list_seperator), list_seperator) INTO forward_str;
 | |
| 
 | |
|       -- enferne doppelte seperatorzeichen
 | |
|       -- 
 | |
|       WHILE LOCATE(CONCAT(list_seperator,list_seperator) , forward_str) DO
 | |
|          SET forward_str = REPLACE(forward_str, CONCAT(list_seperator,list_seperator), list_seperator);
 | |
|          -- SELECT REPLACE(forward_str, CONCAT(list_seperator,list_seperator), list_seperator) INTO forward_str;
 | |
|       END WHILE ;
 | |
| 
 | |
|       -- entferne erstes zeichen wenn es das seperatorzeichen ist
 | |
|       --
 | |
|       IF LEFT(forward_str,1) = list_seperator THEN
 | |
|          SET forward_str =  SUBSTRING(forward_str FROM 2);
 | |
|          -- SELECT SUBSTRING(forward_str FROM 2) INTO forward_str;
 | |
|       END IF;
 | |
| 
 | |
|       -- entferne letztes zeichen wenn es das seperatorzeichen ist
 | |
|       --
 | |
|       IF RIGHT(forward_str,1) = list_seperator THEN
 | |
|          SET forward_str = SUBSTRING(forward_str , 1, LENGTH(forward_str) - 1);
 | |
|          -- SELECT SUBSTRING(forward_str , 1, LENGTH(forward_str) - 1) INTO forward_str;
 | |
|       END IF;
 | |
| 
 | |
|       RETURN forward_str;
 | |
|    END |
 | |
| 
 | |
| DELIMITER ;
 | |
| EOF
 | |
| 
 | |
|    ## - create function
 | |
|    ## -
 | |
|    ## - Note 1.
 | |
|    ## -  Create function as postfix database user
 | |
|    ## -
 | |
|    ## -  The postfix databaseuser wil need 'Super_priv'. At MySQL monitor 
 | |
|    ## -  (as mysql admin user i.e. root) type:
 | |
|    ## -        UPDATE user SET Super_priv = 'Y' WHERE User = 'postfix';
 | |
|    ## -
 | |
|    ## - Note 2.
 | |
|    ## - You can verify on mysql monitor (database postfix) with:
 | |
|    ## -    SHOW FUNCTION STATUS;
 | |
|    ## - or see the code:
 | |
|    ## -    SHOW CREATE FUNCTION FORWARDERS_OUT;
 | |
|    ## -
 | |
|    mysql -upostfix -p postfix < /tmp/FORWARDERS_OUT.sql
 | |
| 
 | |
|    rm /tmp/FORWARDERS_OUT.sql
 | |
| 
 | |
| 
 | |
|    ## - create database function FORWARDERS_IN:
 | |
|    ## -
 | |
|    cat <<EOF > /tmp/FORWARDERS_IN.sql
 | |
| DROP FUNCTION IF EXISTS FOWARDERS_IN ;
 | |
| 
 | |
| DELIMITER |
 | |
| 
 | |
| CREATE FUNCTION FORWARDERS_IN (forewarders_str TEXT,
 | |
|                                   email_str TEXT,
 | |
|                                   vacation_domain TEXT ,
 | |
|                                   list_seperator CHAR ,
 | |
|                                   vacation_enable BOOLEAN)
 | |
|    RETURNS TEXT
 | |
|    DETERMINISTIC
 | |
|    BEGIN
 | |
|       DECLARE return_str TEXT;
 | |
|       DECLARE local_email_part TEXT;
 | |
|       DECLARE domain_email_part TEXT;
 | |
| 
 | |
| 
 | |
|       SET return_str = email_str;
 | |
| 
 | |
|       IF vacation_enable THEN
 | |
|          SET local_email_part = SUBSTRING(email_str,1, LOCATE('@',email_str) - 1);
 | |
|          SET domain_email_part = SUBSTRING(email_str, LOCATE('@',email_str) + 1, LENGTH(email_str));
 | |
|          SET return_str = CONCAT(return_str, list_seperator, local_email_part, "#" ,domain_email_part,"@", vacation_domain);
 | |
|       END IF;
 | |
| 
 | |
|       IF LENGTH(forewarders_str) > 2 THEN
 | |
|          SET return_str = CONCAT(return_str, list_seperator, forewarders_str);
 | |
|       END IF;
 | |
| 
 | |
|       RETURN return_str;
 | |
|    END |
 | |
| 
 | |
| DELIMITER ;
 | |
| EOF
 | |
| 
 | |
| 
 | |
|    ## - create function FOWARDERS_IN
 | |
|    ## -
 | |
|    ## - Note 1.
 | |
|    ## -  Create function as postfix database user
 | |
|    ## -
 | |
|    ## -  The postfix databaseuser wil need 'Super_priv'. At MySQL monitor 
 | |
|    ## -  (as mysql admin user i.e. root) type:
 | |
|    ## -        UPDATE user SET Super_priv = 'Y' WHERE User = 'postfix';
 | |
|    ## -
 | |
|    ## - Note 2.
 | |
|    ## - You can verify on mysql monitor (database postfix) with:
 | |
|    ## -    SHOW FUNCTION STATUS;
 | |
|    ## - or see the code:
 | |
|    ## -    SHOW CREATE FUNCTION FOWARDERS_IN;
 | |
|    ## -
 | |
| 
 | |
|    mysql -upostfix -p postfix < /tmp/FORWARDERS_IN.sql
 | |
| 
 | |
|    rm /tmp/FORWARDERS_IN.sql
 | |
| 
 | |
| else
 | |
|    echo -e "\n\t[ ERROR ]: Unknown database type \"$_db_type\""
 | |
| fo
 | |
| 
 | |
| 
 | |
|  
 | |
| ## - Since version 0.9.0, due to changes in the way roundcube access database, the
 | |
| ## - vacation plugin doesn'work anymore. At least this plugins are affected:
 | |
| ## -    - vacation plugin
 | |
| ## -    - aliases plugin
 | |
| ## -    - forward plugin
 | |
| ## -
 | |
| ## - To Fix that issue, in file <plugin-dir>lib/drivers/sql.php replace
 | |
| ## - all occurences of
 | |
| ## -
 | |
| ## -    $db = new rcube_mdb2($dsn, '', FALSE);
 | |
| ## -
 | |
| ## - with:
 | |
| ## -
 | |
| ## -    if (!class_exists('rcube_db')) {
 | |
| ## -       $db = new rcube_mdb2($dsn, '', FALSE);
 | |
| ## -    } else {
 | |
| ## -       $db = rcube_db::factory($dsn, '', FALSE);
 | |
| ## -    }
 | |
| ## -
 | |
| 
 | |
| ## - !! Notice: already fixed since in actual plugin distribution !!
 | |
| ## -
 | |
| #perl -i.ORIG -n -p -e "s#^(\s*)(\\\$db\ +=\ +new rcube_mdb2\(\\\$dsn.*)#\1//!\2\n\1if (!class_exists('rcube_db')) {\n\1   \\\$db = new rcube_mdb2(\\\$dsn, '', FALSE);\n\1} else {\n\1   \\\$db = rcube_db::factory(\\\$dsn, '', FALSE);\n\1}\n#g" \
 | |
| #   $WEBMAIL_BASEDIR/roundcubemail-${ROUNDCUBE_VERSION}/plugins/vacation/lib/drivers/sql.php
 | |
| 
 | |
| 
 | |
| ## - Note: register plugin either with plugin_manager or with roundcube methode NOT BOTH
 | |
| 
 | |
| 
 | |
| ## - register vacation plugin with plugin_manager
 | |
| ## -
 | |
| ## - edit: $WEBMAIL_BASEDIR/roundcubemail-${ROUNDCUBE_VERSION}/plugins/plugin_manager/config.inc.php
 | |
| ## -
 | |
| ## - add to array $rcmail_config['plugin_manager_defaults'] (Section globalplugins)
 | |
| ## - after line "'globalplugins' => array("
 | |
| ## -
 | |
| ## -        'vacation' => array('protected' => true, 'active' => true),
 | |
| ## -
 | |
| vim $WEBMAIL_BASEDIR/roundcubemail-${ROUNDCUBE_VERSION}/plugins/plugin_manager/config.inc.php
 | |
| 
 | |
| 
 | |
| ## - register vacation plugin with roundcube
 | |
| ## -
 | |
| ## - edit  $WEBMAIL_BASEDIR/roundcubemail-${ROUNDCUBE_VERSION}/config/main.inc.php
 | |
| ## -
 | |
| ## - add "rc-vacation" to array plugins
 | |
| ## -    $rcmail_config['plugins'] = array('global_alias','contextmenue', 'password', 'acl', 'calendar', 'managesieve', 'markasjunk2', 'vkeyboard', 'vacation');
 | |
| ## -
 | |
| vim $WEBMAIL_BASEDIR/roundcubemail-${ROUNDCUBE_VERSION}/config/main.inc.php
 | |
| 
 | |
| 
 | |
| ## ------------------------------------------------------------------- ##
 | |
| 
 | |
| ## ------------------------------------------- #
 | |
| ## --- Install vacation plugin for roundcube - #
 | |
| ## ---            vacation-1.9.9             - #
 | |
| ## ------------------------------------------- #
 | |
| 
 | |
| cd /var/www/webmail.warenform.de/htdocs/plugins/
 | |
| unzip  /usr/local/src/mailsystem/tarballs/vacation-1.9.9.zip
 | |
| 
 | |
| ## - Enable the vacation plugin in config/main.inc.php.
 | |
| ## - 
 | |
| ## - add 'vacation' to the array in $rcmail_config['plugins']
 | |
| ## -
 | |
| ## -   $rcmail_config['plugins'] = array('acl','password', 'vacation', 'jqueryui', 'calendar') 
 | |
| ## -
 | |
| vim /var/www/webmail.warenform.de/htdocs/config/main.inc.php
 | |
| 
 | |
| 
 | |
| ## - Edit config.ini to configure vacation plugin
 | |
| ## -
 | |
| ## - add lines
 | |
| ## -
 | |
| 
 | |
| cat <<EOF >> /var/www/webmail.warenform.de/htdocs/plugins/vacation/config.ini
 | |
| [localhost]
 | |
| driver = "virtual"
 | |
| 
 | |
| ; Specifies a DSN (see db.inc.php) that has access to the dbase specified
 | |
| ; below. -- Optional.
 | |
| ;
 | |
| dsn = "${_db_type}://${_db_user}:${_db_pass}@localhost/${_db_name}"
 | |
| 
 | |
| ; Applies to Postfix SMTP-server only. See
 | |
| ; http://www.postfix.org/VIRTUAL_README.html#autoreplies.
 | |
| ; This must match the transport in
 | |
| ; /etc/postfix/transport and /etc/postfix/master.cf -- Required
 | |
| ;
 | |
| transport = "$_autoreply_domain"
 | |
| 
 | |
| ; Database used by the mailserver. The vacation and virtual alias tables must exist
 | |
| ; in this database.  -- Required.
 | |
| dbase = "postfix"
 | |
| 
 | |
| ; Always maintain an \$email -> \$email alias in the alias table. Defaults 
 | |
| ; to true if omitted. -- Optional.
 | |
| ;
 | |
| always_keep_copy = true
 | |
| 
 | |
| ; Parameters used by the SQL-Queries
 | |
| ;     %e = email address, 
 | |
| ;     %d = domainname, 
 | |
| ;     %i = domain_id, 
 | |
| ;     %m is required as the Roundcube database should be different from the mailserver's database.
 | |
| ;     %g = goto .
 | |
| ; The latter is used for the transport. %g will expands to john@domain.org@\$transport
 | |
| 
 | |
| ; Query to retrieve aliases for the current user. -- Required.
 | |
| ;
 | |
| ##!select_query = "SELECT destination FROM %m.virtual_aliases WHERE source='%e' AND destination='%g'"
 | |
| select_query = "SELECT goto FROM alias WHERE address='%e' AND goto='%g'";
 | |
| 
 | |
| ; Aliases are recreated when saving vacation settings. -- Required.
 | |
| ;
 | |
| ##!delete_query = "DELETE FROM %m.virtual_aliases WHERE domain_id=%i AND source='%e'"
 | |
| delete_query = "DELETE FROM alias WHERE domain='%d' AND address ='%e'";
 | |
| 
 | |
| ; Query to create new aliases. -- Required.
 | |
| ;
 | |
| ##!insert_query = "INSERT INTO %m.virtual_aliases (domain_id,source,destination) VALUES (%i,'%e','%g')"
 | |
| insert_query = "INSERT INTO alias (address,goto,domain,active) VALUES ('%e','%g','%d',true)"
 | |
| 
 | |
| ; Required if you use a domain_id for storing the domain's in the alias table.
 | |
| ;
 | |
| ##!domain_lookup_query = "SELECT id FROM postfix.virtual_domains WHERE name='%d'"
 | |
| 
 | |
| ; Creates /etc/postfixadmin/vacation.conf which has database configuration 
 | |
| ; for the vacation.pl script. -- Optional.
 | |
| ;
 | |
| ; It uses the selected DSN to create the file. Make sure this file is only readable
 | |
| ; by the vacation user after it's created.
 | |
| ; If unset or false, you must edit vacation.pl manually and set database accordingly.
 | |
| ;
 | |
| createvacationconf = false
 | |
| 
 | |
| ; If vacation/auto-reply gets disabled, should we delete the subject/body set 
 | |
| ; by the end-user? -- Optional. Defaults to true.
 | |
| ;
 | |
| always_keep_message = true
 | |
| 
 | |
| ; If set to True, the end-user will not be able to set forwards. Defaults to false. Optional
 | |
| disable_forward = False
 | |
| 
 | |
| EOF
 | |
| 
 | |
| perl -i -n -p -e"s#^(\s*)(subject\s*=\s*.+)#\#\1\2\n\1subject = \"Abwesenheitsnachricht\"#" \
 | |
|    /var/www/webmail.warenform.de/htdocs/plugins/vacation/config.ini
 | |
| 
 | |
| cp /var/www/webmail.warenform.de/htdocs/plugins/vacation/default.txt /var/www/webmail.warenform.de/htdocs/plugins/vacation/default.txt.ORIG
 | |
| cat<<EOF >/var/www/webmail.warenform.de/htdocs/plugins/vacation/default.txt
 | |
| Hallo,
 | |
| 
 | |
| ich bin vom <Datum> bis <Datum> nicht im Büro. In dringenden Fällen melden Sie sich bitte bei <email@domain.tld>.
 | |
| 
 | |
| MfG
 | |
| <Name>
 | |
| EOF
 | |
| 
 | |
| 
 | |
| ## - RECOMMEND: if you don't want to display the forward fieldset, then 
 | |
| ## - comment out the concerning code in vacation.php and replace with a 
 | |
| ## - hidden field to realise, that always a copy is send to the concerning 
 | |
| ## - email address
 | |
| ## -
 | |
| ## - comment out line 160 to 188 (incl.):
 | |
| ## -
 | |
| ## -            $out .= '</fieldset><fieldset><legend>' . $this->gettext('forward') . '</legend>';
 | |
| ## -    
 | |
| ## -             // Keep a local copy of the mail
 | |
| ## -             $field_id = 'vacation_keepcopy';
 | |
| ## -             $input_localcopy = new html_checkbox(array('name' => '_vacation_keepcopy', 'id' => $field_id, 'value' => 1));
 | |
| ## -             $out .= sprintf("<p><label for=\"%s\">%s</label> %s</p>\n",
 | |
| ## -                   $field_id,
 | |
| ## -                   rep_specialchars_output($this->gettext('keepcopy')),
 | |
| ## -                   $input_localcopy->show($settings['keepcopy']));
 | |
| ## -    
 | |
| ## -    
 | |
| ## -    
 | |
| ## -          // Information on the forward in a seperate fieldset.
 | |
| ## -          if (! isset($this->inicfg['disable_forward']) || ( isset($this->inicfg['disable_forward']) && $this->inicfg['disable_forward']==false))
 | |
| ## -          {
 | |
| ## -                            $out .= '<p>' . $this->gettext('separate_forward') . '</p>';
 | |
| ## -    
 | |
| ## -             // Forward mail to another account
 | |
| ## -             $field_id = 'vacation_forward';
 | |
| ## -             $input_autoresponderforward = new html_inputfield(array('name' => '_vacation_forward', 'id' => $field_id, 'size' => 90));
 | |
| ## -             $out .= sprintf("<p><label for=\"%s\">%s</label> %s</p>\n",
 | |
| ## -                   $field_id,
 | |
| ## -                   rep_specialchars_output($this->gettext('forwardingaddresses')),
 | |
| ## -                   $input_autoresponderforward->show($settings['forward']));
 | |
| ## -    
 | |
| ## -    
 | |
| ## -          }
 | |
| ## -                    $out .= "</fieldset>\n";
 | |
| ## -
 | |
| ## - replace with:
 | |
| ## -
 | |
| ## -            // ckubu 20111202
 | |
| ## -            // dont't show forward fieldset
 | |
| ## -            $field_id = 'vacation_keepcopy';
 | |
| ## -            $out .= sprintf("<input type=\"hidden\" name=\"_vacation_keepcopy\" id=\"%s\" value=\"1\" />", $field_id);
 | |
| ## -
 | |
| 
 | |
| 
 | |
| ## - that vacation plugin doesn't work with postgres database out of the box. some changes 
 | |
| ## - on lib/virtual.class.php is needed
 | |
| ## -
 | |
| cat <<EOF > /tmp/vacation-1.9.9-virtual.class.diff
 | |
| 50a51,52
 | |
| >         /* CHANGED ckubu: that doesn't work with postgres database backend
 | |
| > 
 | |
| 52a55,58
 | |
| >         */
 | |
| >         $sql = sprintf("SELECT subject,body,active FROM vacation WHERE email='%s'",
 | |
| >             Q($this->user->data['username']));
 | |
| >         
 | |
| 65a72,74
 | |
| > 
 | |
| >             /* CHANGED ckubu: that doesn't work with postgres database backend
 | |
| > 
 | |
| 66a76,77
 | |
| >             */
 | |
| >             $vacArr['enabled'] = ($row['active'] == 't') && ($fwdArr['enabled'] == 1);
 | |
| 85a97,98
 | |
| >         /* CHANGED ckubu: that doesn't work with postgres database backend
 | |
| > 
 | |
| 86a100,101
 | |
| >         */
 | |
| >         $sql = sprintf("UPDATE vacation SET created=now(),active=false WHERE email='%s'", Q($this->user->data['username']));
 | |
| 112a128,130
 | |
| > 
 | |
| >                 /* CHANGED ckubu: that doesn't work with postgres database backend
 | |
| > 
 | |
| 113a132,133
 | |
| >                 */
 | |
| >                 $sql = "INSERT INTO vacation (email,subject,body,domain,created,active)  VALUES (?,?,?,?,NOW(),true)";
 | |
| 114a135,137
 | |
| > 
 | |
| >                 /* CHANGED ckubu: that doesn't work with postgres database backend
 | |
| > 
 | |
| 115a139,140
 | |
| >                 */
 | |
| >                 $sql = "UPDATE vacation SET email=?,subject=?,body=?,domain=?,active=true WHERE email=?";
 | |
| 280c305
 | |
| < ?>
 | |
| \ Kein Zeilenumbruch am Dateiende.
 | |
| ---
 | |
| > ?>
 | |
| EOF
 | |
| 
 | |
| cp $WEBMAIL_BASEDIR/htdocs/plugins/vacation/lib/virtual.class.php \
 | |
|    $WEBMAIL_BASEDIR/htdocs/plugins/vacation/lib/virtual.class.php.ORIG
 | |
| 
 | |
| patch -p0 $WEBMAIL_BASEDIR/htdocs/plugins/vacation/lib/virtual.class.php \
 | |
|    /tmp/vacation-1.9.9-virtual.class.diff
 | |
| 
 | |
| 
 | |
| 
 | |
| ## - the output of the vacation plugin is blso roken. for now, we will correct that
 | |
| ## - in a very very simple way, only for usability..
 | |
| ## -
 | |
| cp -a $WEBMAIL_BASEDIR/htdocs/plugins/vacation/skins/default \
 | |
|    $WEBMAIL_BASEDIR/htdocs/plugins/vacation/skins/default.ORIG
 | |
| 
 | |
| cat <<EOF > $WEBMAIL_BASEDIR/htdocs/plugins/vacation/skins/default/vacation.css
 | |
| #vacationpage
 | |
| {
 | |
|   width: 800px;
 | |
|   margin-left: 15px;
 | |
|   margin-top: 95px;
 | |
|   border: 1px solid #999999;
 | |
| }
 | |
| 
 | |
| #pagecontent {
 | |
|     position: absolute;
 | |
|     top: 85px;
 | |
|     left: 20px;
 | |
|     bottom: 20px;
 | |
|     width: 800px;
 | |
| 
 | |
| }
 | |
| 
 | |
| #pagecontent label {
 | |
|   float:left;
 | |
|   /*width:20%;*/
 | |
| 
 | |
|   margin-right:0.5em;
 | |
|   padding-top:0.2em;
 | |
|   text-align:left;
 | |
|   vertical-align: top;
 | |
|   color:#666666;
 | |
| font-size:11px;
 | |
| font-weight:bold;
 | |
| }
 | |
| EOF
 | |
| 
 | |
| ## ------------------------------------------------- #
 | |
| ## --- ENDE: Install vacation plugin for roundcube - #
 | |
| ## ---               vacation-1.9.9                - #
 | |
| ## ------------------------------------------------- #
 | |
| 
 | |
| ## ------------------------------------------------------------------- ##
 | |
| 
 | |
| 
 | |
| 
 |