diff --git a/conf/install_postfixadmin.conf.sample b/conf/install_postfixadmin.conf.sample index 73fb5d2..80afd3b 100644 --- a/conf/install_postfixadmin.conf.sample +++ b/conf/install_postfixadmin.conf.sample @@ -1,77 +1,260 @@ -## - Postfixadmin environment for server -## - +# ----------------------------------------------- +# - Configuration for postfixadmin install script +# ----------------------------------------------- -## ------------------------------------- -## - +# - Version of Postfix Admin +# - +PF_ADMIN_VERSION= -#HOSTNAME="a.mx.oopen.de" -#DOMAIN="oopen.de" -ADMIN_EMAIL="admin\@warenform.de" - -APACHE_CONF_DIR=/usr/local/apache2/conf -APACHE_VHOST_DIR=/usr/local/apache2/conf/vhosts -APACHE_BASE_WEBDIR=/var/www -APACHE_LOG_DIR=/var/log/apache2 - -APACHE_USER=www-data -APACHE_GROUP=www-data - -_use_mod_php_fpm=true -_use_mod_fcgid=false -_use_mod_php=false - -APACHE_SERVER_CERT=server-bundle.crt -APACHE_SERVER_KEY=server.key - -## - Leave empty if not needed -## - -CERT_ChainFile="" +# - Name of the website - usualy 'webmail..' +# - +WEBSITE_NAME="" +# - IPv4 Address +# - IPV4="" + +# - IPv6 Address +# - IPV6="" -#_pf_admin_version=2.3.7 -_pf_admin_version=3.0.2 +# - Is apache installed from debian package system ? +# - +# - Boolean, possible values are 'true', 'false' +# - +# - Defaults to 'false' +# +#APACHE_DEBIAN_INSTALLATION="" -#_db_type='mysql' -_db_type='pgsql' +# - Apache User +# - +# - If ommitted, script tries to determine the user under which user the webserver +# - is running. If that fails, parameter defaults to 'www-data' +# - +#HTTP_USER="" -_db_name='postfix' -_db_user='postfix' -_db_pass='' -#_db_host='localhost' -_db_host='/var/run/postgresql' +# - Apache Group +# - +# - If ommitted, script tries to determine the user under which group the webserver +# - is running. If that fails, parameter defaults to 'www-data' +# - +#HTTP_GROUP="" -# - mysql_credential_args +# - Webmasters E-Mail Address +# - +# - Defaults to 'admin@.' +# - +#WEBMASTER_EMAIL="" + +# - Base Directory of Roundcube Website +# - +# - Note: it's not the 'DocumentRoot' directory, but the directory where +# - the 'DocumentRoot' Directory lives. +# - +# - Defaults to '/var/www/$WEBSITE_NAME' +# - +#WEBSITE_BASEDIR="" + +# - Directory, where apache places the log-files for thw webmailers site. +# - +# - Defaults to '/var/log/apache2' +# - +#APACHE_LOG_DIR="" + +# - Directory where certificate and key for the roundcube website +# - are stored. +# - +# - Example: +# - APACHE_CERT_DIR="/var/lib/dehydrated/certs/$WEBSITE_NAME" +# - +# - Defaults to +# - '/etc/apache2' if apache is installed from debian package system +# - '/usr/local/apache2/conf' otherwise +# - +APACHE_CERT_DIR="" + +# - Certificate for the Rounfcube Website +# - +# - Example: +# - APACHE_SERVER_CERT="fullchain.pem" +# - +# - Defaults to 'server-bundle.crt' +# - +APACHE_SERVER_CERT="" + +# - Key File for the Rounfcube Website +# - +# - Example: +# - APACHE_SERVER_KEY="privkey.pem" +# - +# - Defaults to 'server.key' +# - +APACHE_SERVER_KEY="" + +# - Certification Chain File +# - +# - Deprecated since Apache 2.4 - Leave empty if not present +# - +#CERT_ChainFile="" + +# - Type of PHP installation. +# - +# - Possible values are: 'php_fpm' , 'fcgid' , 'mod_php +# - +# - defaults to 'php_fpm'' +# - +#PHP_TYPE="" + +# - Directory where apache vhosts definitions live. +# - +# - Defaults to +# - '/etc/apache2/sites-available' if installed from debain package system +# - '/usr/local/apache2/conf/vhosts' otherwise +# - +#APACHE_VHOST_DIR="" + +# - Hostname for vacation / absence messages +# - +# - Defaults to 'autoreply.. +# - +#AUTOREPLY_HOSTNAME="" + + + +# - Is MySQL installed from debian package system? +# - +# - Only needed, if DB_TYPE is set to 'mysql' +# - +# - Defaults to 'false' +# - +#MYSQL_DEBIAN_INSTALLATION="" + +# - mysql_credential_args (root access to MySQL Database) # - # - Example # - mysql_credential_args="--login-path=local" # - mysql_credential_args="--defaults-file=/etc/mysql/debian.cnf" (Debian default) # - mysql_credential_args="--defaults-file=/usr/local/mysql/sys-maint.cnf" # - -mysql_credential_args="" +# - Defaults to: +# - '/etc/mysql/debian.cnf' if MySQL is installed from debian package system +# - '/usr/local/mysql/sys-maint.cnf' otherwise +# - +#MYSQL_CREDENTIALS="" -# _encrypt=md5crypt -_encrypt=cleartext -_spam_folder=Spam +# - The wa passwords will be encrypted. +# - +# - $CONF['encrypt'] +# - +# - Possible values: +# - md5crypt = internal postfix admin md5 +# - md5 = md5 sum of the password +# - cleartext = clear text passwords +# - mysql_encrypt = useful for PAM integration +# - +# - authlib = support for courier-authlib style passwords - also set $CONF['authlib_default_flavor'] +# - dovecot:CRYPT-METHOD = use dovecotpw -s 'CRYPT-METHOD'. Example: dovecot:CRAM-MD5 +# - IMPORTANT: +# - - don't use dovecot:* methods that include the username in the hash - you won't be able +# - to login to PostfixAdmin in this case +# - - you'll need at least dovecot 2.1 for salted passwords ('doveadm pw' 2.0.x doesn't support the '-t' option) +# - - dovecot 2.0.0 - 2.0.7 is not supported +# - +ENCRYPTION_METHOD="cleartext" +#ENCRYPTION_METHOD="dovecot:CRAM-MD5" -_autoreply_domain='' -vacation_user=vacation -vacation_group=vacation +# - If you use the dovecot encryption method: where is the dovecotpw binary located? +# - +# - Defaults to '/usr/local/dovecot/bin/doveadm pw' +# - +#DOVEADM_PW="" -deleted_maildirs="/var/deleted-maildirs" -deleted_maildomains="/var/deleted-maildomains" +# - Directory where deleted mailbox will be saved +# - +# - defaults to '/var/deleted-maildirs' +# - +#DELETED_MAILBOX_DIR= -_welcome_email=" +# - Directory where deleted domains will be saved +# - +# - defaults to '/var/deleted-maildomains' +# - +#DELETED_DOMAINS_DIR= + +# - Welcome Message +# - This message is send to every newly created mailbox. +# - +WELCOME_MESSAGE=" Hallo, -Ihre neue E-Mail Adresse ist eingerichtet. +Ihre/Deine neue E-Mail Adresse ist eingerichtet. -Das WARENFORM-Team +O.OPEN -- -WARENFORM | Phone: +49 30 / 61 65 17 52 -0 -Dresdner Str. 11 | Fax: +49 30 / 61 65 17 52 -66 -D-10999 Berlin | http://www.warenform.net" +O.OPEN | Phone: +49 30 / 290 484 91 +Erkelenzdamm 21 | Fax: +49 30 / 290 484 99 +D-10999 Berlin | E-MAIL: oo@oopen.de +" + + +# ========== +# - Settings Postfix Database +# ========== + +# - Type of Postfix database +# - +# - Possible values are 'pgsql' (PostgeSQL) or 'mysql' (MySQL) +# - +POSTFIX_DB_TYPE="pgsql" + +# - Host of Postfix Database +# - +# - Defaults to 'localhost' +# - +#POSTFIX_DB_HOST="" + +# - Unix socket where PostgreSQL is listening +# - +# - Only possible, for postgreSQL +# - +# - Defaults to '/var/run/postgresql' +# - +#POSTFIX_DB_SOCKET="" + +# - Name of Postfix Database +# - +# - Defaults to 'postfix' +# - +#POSTFIX_DB_NAME= + +# - User of Postfix Database +# - +# - used for setting $config['password_db_dsn'] +# - +# - Defaults to 'postfix' +# - +#POSTFIX_DB_USER="" + +# - Password of Postfix Database +# - +POSTFIX_DB_PASS='' + + +# ========== +# - vacation +# ========== + +# - Vacation User +# - +# - Defaults to 'vacation' +# - +#VACATION_USER="" + +# - Vacation Group +# - +# - Defaults to '' +# - +#VACATION_GROUP="vacation" diff --git a/install_postfixadmin.sh b/install_postfixadmin.sh index 14fddb3..d1c1dcc 100755 --- a/install_postfixadmin.sh +++ b/install_postfixadmin.sh @@ -89,6 +89,52 @@ echo_skipped() { echo -e "\033[75G[ \033[30m\033[1mskipped\033[m ]" } +detect_os_1 () { + + if $(which lsb_release > /dev/null 2>&1) ; then + + os_dist="$(lsb_release -i | awk '{print tolower($3)}')" + os_version="$(lsb_release -r | awk '{print tolower($2)}')" + os_codename="$(lsb_release -c | awk '{print tolower($2)}')" + + if [[ "$os_dist" = "debian" ]]; then + if $(echo "$os_version" | grep -q '\.') ; then + os_version=$(echo "$os_version" | cut --delimiter='.' -f1) + fi + fi + + elif [[ -e "/etc/os-release" ]]; then + + . /etc/os-release + + os_dist=$ID + os_version=${os_version_ID} + + fi + + # remove whitespace from os_dist and os_version + os_dist="${os_dist// /}" + os_version="${os_version// /}" + +} + + + +# - Is 'systemd' supported on this system +# - +if [ "X`which systemd`" = "X" ]; then + SYSTEMD_EXISTS=false +else + SYSTEMD_EXISTS=true +fi + +# - Set variable +# - os_dist +# - os_version +# - os_codename +# - +detect_os_1 + if [ "$POSTFIX_DB_TYPE" = "postgres" -o "$POSTFIX_DB_TYPE" = "postgresql" -o "$POSTFIX_DB_TYPE" = "pgsql" -o "$POSTFIX_DB_TYPE" = "psql" ];then POSTFIX_DB_TYPE=pgsql @@ -289,14 +335,6 @@ else warn "Getting major number of latest installed PHP version failed! - No installed PHP versiond found!" fi -# - Is 'systemd' supported on this system -# - -if [ "X`which systemd`" = "X" ]; then - SYSTEMD_EXISTS=false -else - SYSTEMD_EXISTS=true -fi - echo "" echo "" @@ -447,9 +485,12 @@ _needed_packages=" libemail-valid-perl libmail-sendmail-perl liblog-log4perl-perl - libmail-sender-perl libdbi-dev + libemail-sender-perl cpanminus" +if [[ $os_version -lt 9 ]] ; then + _needed_packages="$_needed_packages libmail-sender-perl" +fi if [[ "$POSTFIX_DB_TYPE" = "pgsql" ]] ; then _needed_packages="$_needed_packages libdbd-pgsql @@ -485,7 +526,8 @@ _failed=false > $log_file _needed_cpan_modules=" CPAN - DBI" + DBI + Mail::Sender" if [[ "$POSTFIX_DB_TYPE" = "pgsql" ]] ; then _needed_cpan_modules="$_needed_cpan_modules DBD::Pg" @@ -606,9 +648,15 @@ if [[ $? -ne 0 ]] ; then _failed=true fi +if [[ ! -d "${WEBSITE_BASEDIR}/postfixadmin-${PF_ADMIN_VERSION}/templates_c" ]]; then + mkdir ${WEBSITE_BASEDIR}/postfixadmin-${PF_ADMIN_VERSION}/templates_c + if [[ $? -ne 0 ]] ; then + _failed=true + fi +fi chown -R ${HTTP_USER}:$HTTP_GROUP ${WEBSITE_BASEDIR}/postfixadmin-${PF_ADMIN_VERSION}/templates_c >> $log_file 2>&1 if [[ $? -ne 0 ]] ; then - _failed=true + _failed=true fi if $_failed; then @@ -1471,7 +1519,7 @@ fi # - echononl "\tCreate entry in /etc/hosts for '$AUTOREPLY_HOSTNAME'" if ! grep -q "$AUTOREPLY_HOSTNAME" /etc/hosts > $log_file 2>&1 ; then - perl -i -n -p -e"s#(^\s*127.0.0.1\s+localhost.*)#\1\n\n127.0.0.1 ${AUTOREPLY_HOSTNAME}" /etc/hosts > $log_file 2>&1 + perl -i -n -p -e"s#(^\s*127.0.0.1\s+localhost.*)#\1\n\n127.0.0.1 ${AUTOREPLY_HOSTNAME}#" /etc/hosts > $log_file 2>&1 if [[ $? -eq 0 ]] ; then echo_ok else