apt-get purge exim4*
cd ; wget -O - https://github.com/andryyy/mailcow/archive/v0.13.1.tar.gz | tar xfz -
cd mailcow*
mit z.B. vim die mailcow.config
bearbeiten (vim mailcow.config
)
sys_domain=usegroup.de
# admin master
# Das admin master passwort muss mindestens 8 Zeichen haben
# davon müssen mindestens 2 Zahlen sein und Groß- und Kleinbuchstaben verwendet werden
mailcow_admin_pass="<ADMIN_MASTER_PASSWORT>"
httpd_platform=apache2
my_rootpw="<DB_PASSWORT>"
my_mailcowpass="<DB_PASSWORT>"
Das ganze per ./install.sh
installieren.
Danach die installer.log runterladen und online löschen.
Danach werden die SSL-Zertifikate hochladen.
Jetzt ändern wir die Ports der HTTP-Oberfläche von 80/443 auf 8080/9090.
Mit den folgenden Befehlen werden die Ports in der /etc/apache2/sites-available/mailcow.conf
ersetzt.
sed -i 's/*:80/*:8080/' /etc/apache2/sites-available/mailcow.conf
sed -i 's/*:443/*:9090/' /etc/apache2/sites-available/mailcow.conf
Danach die Ports in der Apache2 Konfiguration ändern:
mcedit /etc/apache2/ports.conf
Und diese Zeilen hinzufügen bzw die vorhandenen anpassen:
Listen 8080
Listen 9090
Danach den Apache2-Server mit diesem Befehl neustarten:
service apache2 restart
Dann brauchen wir noch eine Anpassung der mynetworks und eine Umstellung des Postfix-Zertifikats. Das erledigen wir mit den folgenden Befehlen:
postconf -e message_size_limit=104857600
postconf -e 'mynetworks = <IP>/32, 127.0.0.0/8'
postconf -e smtpd_tls_CApath=/etc/ssl/certs/
postconf -e smtpd_tls_cert_file=/etc/ssl/certs/mail.usegroup.de.cert
postconf -e smtpd_tls_key_file=/etc/ssl/private/mail.usegroup.de.unencrypted.key
Danach müssen wir noch die SSL-Einstellungen von Dovecot angepasst werden:
vim /etc/dovecot/conf.d/10-ssl.conf
Konfiguration, wo die Schlüssel für die TLS-Kommunikation zu finden sind.
## SSL settings
# SSL/TLS support: yes, no, required. <doc/wiki/SSL.txt>
ssl = yes
# PEM encoded X.509 SSL/TLS certificate and private key. They're opened before
# dropping root privileges, so keep the key file unreadable by anyone but
# root. Included doc/mkcert.sh can be used to easily generate self-signed
# certificate, just make sure to update the domains in dovecot-openssl.cnf
ssl_cert = </etc/ssl/certs/mail.usegroup.de.cert
ssl_key = </etc/ssl/private/mail.usegroup.de.unencrypted.key
# If key file is password protected, give the password here. Alternatively
# give it when starting dovecot with -p parameter. Since this file is often
# world-readable, you may want to place this setting instead to a different
# root owned 0600 file by using ssl_key_password = <path.
#ssl_key_password =<PASSWORD>
# PEM encoded trusted certificate authority. Set this only if you intend to use
# ssl_verify_client_cert=yes. The file should contain the CA certificate(s)
# followed by the matching CRL(s). (e.g. ssl_ca = </etc/ssl/certs/ca.pem)
ssl_ca = </etc/ssl/certs/chain.thawte.pem
# Require that CRL check succeeds for client certificates.
ssl_require_crl = yes
# Request client to send a certificate. If you also want to require it, set
# auth_ssl_require_client_cert=yes in auth section.
ssl_verify_client_cert = yes
Die SSl-Zertifikate werden z.B. mit Filezilla in das /root
-Verzeichnis hochgeladen und danach mit den folgenden Befehlen verschoben:
cp mail.usegroup.de.cert /etc/ssl/certs/
cp mail.usegroup.de.key /etc/ssl/private/
cp mail.usegroup.de.thawte.cert /etc/ssl/certs/
cp chain.thawte.pem /etc/ssl/certs/
Jetzt wird noch der Passwortschutz des privaten Schlüssels entfernt:
openssl rsa -in /etc/ssl/private/mail.usegroup.de.key -out /etc/ssl/private/mail.usegroup.de.unencrypted.key
und die Rechte angepasst:
chmod 0600 /etc/ssl/private/mail.usegroup.*
Als nächstes kopieren wir den Schlüssel in das mail-Verzeichnis
cp /etc/ssl/private/mail.usegroup.de.unencrypted.key /etc/ssl/mail/mail.key
despite the file extension, mailcow expects a ascii PEM file not a binary .crt file,
so we do NOT need to openssl x509 -outform der -in your-cert.pem -out your-cert.crt
Und das Zertifikat auch noch rüberkopieren:
cp /etc/ssl/certs/mail.usegroup.de.cert /etc/ssl/mail/mail.crt
Danach starten wir noch Postfix mit folgendem Befehl neu:
service postfix restart
und überprüfen, ob dieser Korrekt gestartet wurde mit diesem Befehl:
systemctl status postfix.service
Dasselbe machen wir mit Dovecot auch:
service dovecot restart
und überprüfen dieses mit:
systemctl status dovecot.service
- auf https://mail.usegroup.de:9090/ mit admin@usegroup.de und <ADMIN_MASTER_PASSWORT> einloggen, über Control Center|Mailboxes alle Domains hinzufügen, max size per Mailbox und Domain Quota jeweils = physischer Platz ~= 150000.
- Über Control Center|Mailboxes alle Nutzer anlegen, Quota 0.
- Über Control Center|Aliases einen Postmaster oder Catchall anlegen.
- Über Control Center|Administration unter Postfiox restrictions die Checkbox "Use greylisting for unauthenticated, unknown and not whitelisted senders" ankreuzen, save changes klicken.
Generell können Fehler bei den Diensten auftreten, zum finden dieser Fehler kann man diese Schritte befolgen:
service <dienst> restart
und danach schaut man mit diesem systemctl -l <dienst>.service
Befehl nach einem Fehler.
Um die FEhlersuche zu vereinfachen, gibt es für OX unter /var/log/open-xchange/
die benötigten Log-Dateien.
Wir führen für die Isntallation die folgenden Befehle aus:
apt-get install git
git clone https://code.open-xchange.com/git/wd/testing/quickinstall -b 7.8
cd quickinstall
Danach ändern wir alle Branches von Master auf 7.8.1 mit folgendem Befehl:
sed -i 's/master/7.8.1/' set-versions.sh
Danach müssen noch ein paar Einstellungen in der set-versions.sh
vorgenommen werden:
vim set-versions.sh
darin ändern wir folgende Sachen:
OX_REPO_SOURCE=SOC
LDB_USER="<LDB user>"
LDB_PASS="<LDB passwort>"
Danach bearbeiten wir noch die Quick-Installation mit diesem Befehl:
vim ox-quickinstall.sh
und ändern folgende Abschnitte:
OX_LICENSE_CODE=<Lizenzschlüssel>
MYSQL_ROOT_PASS="<DB-Passwort>"
OX_DB_PASS="<DB-Passwort>"
OX_ADMINMASTER_PASS="<zu setzendes Adminmaster Passwort>"
Das Mailbackend lassen wir false weil wir die Dovecot/Postfix-Installation ja schon gemacht haben um bspw. Postfix/Amavis/Spamassassin/Pyzor/Clam sauber konfigurieren zu können.
Danach bearbeiten wir noch die create-context.sh
:
vim create-context.sh
und ändern folgendes:
OX_ADMINMASTER_PASS="<eben gesetztes OX_ADMINMASTER_PASS>"
OX_ADMIN_PASS="<zu setzendes Domainadmin Passwort>"
MAIL_DOMAIN=usegroup.de
MAIL_SERVER=mail.usegroup.de
EXTRAS=true
In Zeile 93 wird das hier angepasst (createuser...mheiland):
-u mheiland -d "Martin Heiland" -g Martin -s Heiland -p secret -e mheiland@"${MAIL_DOMAIN}" --imaplogin=mheiland
und durch das hier ersetzt:
-u jstaerk -d "Jochen Staerk" -g Jochen -s Staerk -p <PASSWORT> -e jstaerk@"${MAIL_DOMAIN}" --imaplogin=jstaerk@"${MAIL_DOMAIN}"
Danach löschen wir in den Zeilen 94-104 folgendes: createuser...mwagner bis srubbani inkl. der beiden creategroup
Danach installieren wir alles mit folgendem Befehl: ./ox-quickinstall.sh
Die Skripte liegen alle unter /opt/open-xchange/sbin/
.
Die Konfigurationsdateien liegen unter: /opt/open-xchange/etc/
.
Danach führen wir noch diesen Befehl aus:
echo PATH=$PATH:/opt/open-xchange/sbin/ >> ~/.bashrc && . ~/.bashrc
Um die Updates zu erhalten müssen wir deren Spurces in unsere einfügen mit diesen Befehlen:
wget http://software.open-xchange.com/products/DebianJessie.list
mv DebianJessie.list /etc/apt/sources.list.d/open-xchange.additional.list
und in den heruntergeladenen Dateien müssen wir noch unsere Login-Daten angeben:
sed -i 's/LDBUSER/<LDB USER>/' /etc/apt/sources.list.d/open-xchange.additional.list
sed -i 's/LDBPASSWORD/<LDB PASSWORT>/' /etc/apt/sources.list.d/open-xchange.additional.list
danach führen wir ein Update aus: `apt-get update``
und Installieren die benötigten Pakete:
apt-get install open-xchange-drive open-xchange-drive-comet open-xchange-drive-restricted open-xchange-drive-client-windows
Danach bearbeiten wir unseren vHost für OX:
vim /etc/apache2/sites-enabled/ox-http-custom.conf
und tragen dort folgendes ein:
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html/
<Directory /var/www/html/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
RedirectMatch ^/$ /appsuite/
</Directory>
<Directory /var/www/html/appsuite>
Options None +SymLinksIfOwnerMatch
AllowOverride Indexes FileInfo
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/access.log combined
# deflate
AddOutputFilterByType DEFLATE text/html text/plain text/javascript application/javascript text/css text/xml application/xml text/x-js application/x-javascript
# pre-compressed files
AddType text/javascript .jsz
AddType text/css .cssz
AddType text/xml .xmlz
AddType text/plain .po
AddEncoding gzip .jsz .cssz .xmlz
SetEnvIf Request_URI "\.(jsz|cssz|xmlz)$" no-gzip
ExpiresActive On
</VirtualHost>
Danach passen wir noch die SSL-vHost an:
vim /etc/apache2/sites-enabled/ox-https-custom.conf
und fügen folgenden Inhalt ein:
<VirtualHost *:443>
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html/
# SSL Configuration
# TLS
SSLEngine on
# Consider deploying a trusted TLS certificate
SSLCertificateFile /etc/ssl/certs/mail.usegroup.de.cert
SSLCertificateKeyFile /etc/ssl/private/mail.usegroup.de.unencrypted.key
SSLCertificateChainFile /etc/ssl/certs/chain.thawte.pem
SSLHonorCipherOrder on
SSLCipherSuite ECDH+AESGCM:ECDH+AES256:ECDH+AES128:!aNULL
SSLProtocol -all +TLSv1 +TLSv1.1 +TLSv1.2
# Security related headers
Header always set X-Content-Type-Options "nosniff"
Header always set X-Frame-Options "SAMEORIGIN"
Header always set X-XSS-Protection "1; mode=block"
Header always set X-Download-Options "noopen"
Header always set X-Permitted-Cross-Domain-Policies "none"
Header unset Server
# GZip compression is enabled by default for faster content transfer. Consider disabling mod_deflate to mitigate BREACH
Header always set Strict-Transport-Security "max-age=31536000; includeSubDomains; preload"
RequestHeader set X-Forwarded-Proto "https"
RewriteEngine On
RewriteCond %{HTTP_USER_AGENT} Calendar [OR]
RewriteCond %{HTTP_USER_AGENT} DataAccess [OR]
RewriteCond %{HTTP_USER_AGENT} DAVKit [OR]
RewriteCond %{HTTP_USER_AGENT} Lightning [OR]
RewriteCond %{HTTP_USER_AGENT} Adresboek [OR]
RewriteCond %{HTTP_USER_AGENT} dataaccessd [OR]
RewriteCond %{HTTP_USER_AGENT} Preferences [OR]
RewriteCond %{HTTP_USER_AGENT} Adressbuch [OR]
RewriteCond %{HTTP_USER_AGENT} AddressBook [OR]
RewriteCond %{HTTP_USER_AGENT} Address%20Book [OR]
RewriteCond %{HTTP_USER_AGENT} CalendarStore [OR]
RewriteCond %{HTTP_USER_AGENT} "OX Mail/6.0.22469.0" [OR]
RewriteCond %{HTTP_USER_AGENT} CoreDAV
# select if you run ajp (proxy_ajp.conf) or grizzly (proxy_http.conf), here grizzly is used:
RewriteRule (.*) http://localhost:8009/servlet/dav$1 [P] # for grizzly http service
<Directory /var/www/html>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
RedirectMatch ^/$ /appsuite/
</Directory>
<Directory /var/www/html/appsuite>
Options None +SymLinksIfOwnerMatch
AllowOverride Indexes FileInfo
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/access.log combined
# deflate
AddOutputFilterByType DEFLATE text/html text/plain text/javascript application/javascript text/css text/xml application/xml text/x-js application/x-javascript
# pre-compressed files
AddType text/javascript .jsz
AddType text/css .cssz
AddType text/xml .xmlz
AddType text/plain .po
AddEncoding gzip .jsz .cssz .xmlz
SetEnvIf Request_URI "\.(jsz|cssz|xmlz)$" no-gzip
ExpiresActive On
</VirtualHost>
Danach wird noch der Proxy angepasst:
vim /etc/apache/conf-available/ox_proxy_http_custom.conf
<IfModule mod_proxy_http.c>
ProxyRequests Off
ProxyStatus On
# When enabled, this option will pass the Host: line from the incoming request to the proxied host.
ProxyPreserveHost On
# Please note that the servlet path to the soap API has changed:
<Location /webservices>
# restrict access to the soap provisioning API
Order Deny,Allow
Deny from all
Allow from 127.0.0.1
# you might add more ip addresses / networks here
# Allow from 192.168 10 172.16
</Location>
# The old path is kept for compatibility reasons
<Location /servlet/axis2/services>
Order Deny,Allow
Deny from all
Allow from 127.0.0.1
</Location>
# Enable the balancer manager mentioned in
# http://oxpedia.org/wiki/index.php?title=AppSuite:Running_a_cluster#Updating_a_Cluster
<IfModule mod_status.c>
<Location /balancer-manager>
SetHandler balancer-manager
Order Deny,Allow
Deny from all
Allow from 127.0.0.1
</Location>
</IfModule>
<Proxy balancer://oxcluster>
Order deny,allow
Allow from all
# multiple server setups need to have the hostname inserted instead localhost
BalancerMember http://localhost:8009 timeout=100 smax=0 ttl=60 retry=60 loadfactor=50 route=APP1
# Enable and maybe add additional hosts running OX here
# BalancerMember http://oxhost2:8009 timeout=100 smax=0 ttl=60 retry=60 loadfactor=50 route=APP2
ProxySet stickysession=JSESSIONID|jsessionid scolonpathdelim=On
SetEnv proxy-initial-not-pooled
SetEnv proxy-sendchunked
</Proxy>
# The standalone documentconverter(s) within your setup (if installed)
# Make sure to restrict access to backends only
# See: http://httpd.apache.org/docs/$YOUR_VERSION/mod/mod_authz_host.html#allow for more infos
#<Proxy balancer://oxcluster_docs>
# Order Deny,Allow
# Deny from all
# Allow from backend1IP
# BalancerMember http://converter_host:8009 timeout=100 smax=0 ttl=60 retry=60 loadfactor=50 keepalive=On route=APP3
# ProxySet stickysession=JSESSIONID|jsessionid scolonpathdelim=On
# SetEnv proxy-initial-not-pooled
# SetEnv proxy-sendchunked
#</Proxy>
# Define another Proxy Container with different timeout for the sync clients. Microsoft recommends a minimum value of 15 minutes.
# Setting the value lower than the one defined as com.openexchange.usm.eas.ping.max_heartbeat in eas.properties will lead to connection
# timeouts for clients. See http://support.microsoft.com/?kbid=905013 for additional information.
#
# NOTE for Apache versions < 2.4:
# When using a single node system or using BalancerMembers that are assigned to other balancers please add a second hostname for that
# BalancerMember's IP so Apache can treat it as additional BalancerMember with a different timeout.
#
# Example from /etc/hosts: 127.0.0.1 localhost localhost_sync
#
# Alternatively select one or more hosts of your cluster to be restricted to handle only eas/usm requests
<Proxy balancer://eas_oxcluster>
Order deny,allow
Allow from all
# multiple server setups need to have the hostname inserted instead localhost
BalancerMember http://localhost:8009 timeout=1900 smax=0 ttl=60 retry=60 loadfactor=50 route=APP1
# Enable and maybe add additional hosts running OX here
# BalancerMember http://oxhost2:8009 timeout=1900 smax=0 ttl=60 retry=60 loadfactor=50 route=APP2
ProxySet stickysession=JSESSIONID|jsessionid scolonpathdelim=On
SetEnv proxy-initial-not-pooled
SetEnv proxy-sendchunked
</Proxy>
# When specifying additional mappings via the ProxyPass directive be aware that the first matching rule wins. Overlapping urls of
# mappings have to be ordered from longest URL to shortest URL.
#
# Example:
# ProxyPass /ajax balancer://oxcluster_with_100s_timeout/ajax
# ProxyPass /ajax/test balancer://oxcluster_with_200s_timeout/ajax/test
#
# Requests to /ajax/test would have a timeout of 100s instead of 200s
#
# See:
# - http://httpd.apache.org/docs/current/mod/mod_proxy.html#proxypass Ordering ProxyPass Directives
# - http://httpd.apache.org/docs/current/mod/mod_proxy.html#workers Worker Sharing
ProxyPass /ajax balancer://oxcluster/ajax
ProxyPass /appsuite/api balancer://oxcluster/ajax
ProxyPass /drive balancer://oxcluster/drive
ProxyPass /infostore balancer://oxcluster/infostore
ProxyPass /publications balancer://oxcluster/publications
ProxyPass /realtime balancer://oxcluster/realtime
ProxyPass /servlet balancer://oxcluster/servlet
ProxyPass /webservices balancer://oxcluster/webservices
#ProxyPass /documentconverterws balancer://oxcluster_docs/documentconverterws
ProxyPass /usm-json balancer://eas_oxcluster/usm-json
ProxyPass /Microsoft-Server-ActiveSync balancer://eas_oxcluster/Microsoft-Server-ActiveSync
</IfModule>
Danach deaktivieren und aktivieren wir unsere Konfigurationen mit diesen Befehlen:
a2dissite ox-http
a2dissite ox-https
a2disconf ox-proxy_http
a2ensite ox-http-custom
a2ensite ox-https-custom
a2enconf ox-proxy_http_custom
und starten anschließend Apache2 neu: service apache2 restart
Nachfolgend müssen wir noch ein paar Sachen anpassen:
in der /etc/apt/sources.list.d/open-xchange.additional.list
kommentieren wir das Repo für den Open-Xchange Messenger 1.4.0 stable aus (gibts erst ab wesentlich größeren OX Installationen) und
in der /etc/apt/sources.list.d/open-xchange.list
alle Zeilen auskommentieren (werden lt. Herrn Zucca von der Systemschmiede nach der Installtion nicht mehr gebraucht).
App Suite|Einstellungen|Email|Abwesenheitsnotiz meldet einen Fehler und loggt eine Exception in /var/log/open-xchange.log.0
. Damit bspw. Abwesenheitseinstellungen funktionieren, ändert man in der Datei /opt/open-xchange/etc/mailfilter.properties
die SIEVE_CREDSRC-Zeile auf
SIEVE_CREDSRC=mail
In der /etc/apache2/sites-available/mailcow.conf
in den Abschnitten für die vHosts
dav.usegroup.de
und autodiscover.usegroup.de
die Optionen SSLEngine on
, SSLCertificateFile
und SSLKeyFile
auskommentieren, in den anderen vhosts
SSLCertificateFile
auf /etc/ssl/certs/mail.usegroup.de.cert
SSLCertificateKeyFile
auf /etc/ssl/private/mail.usegroup.de.unencrypted.key
stellen und
SSLCertificateChainFile-Direktive
einfügen und auf /etc/ssl/certs/chain.thawte.pem
verweisen lassen.
Diese drei Änderungen des SSL-Zertifikats auch in der /etc/apache2/sites-available/ox-https.conf
vornehmen.
apt-get install open-xchange-report-client open-xchange-meta-outlook open-xchange-meta-mobility open-xchange-l10n-de-de open-xchange-appsuite-help-de-de open-xchange-appsuite-l10n-de-de open-xchange-documents-help-de-de
Zeit für einen finalen restart von OX
service open-xchange restart
Danach MySQL mit folgendem Befehl absichern:
mysql_secure_installation
Postfix testen
Je eine Mail mit
GTUBE Spam (XJS_C4JDBQADN1.NSBN3_2IDNEN_GTUBE-STANDARD-ANTI-UBE-TEST-EMAIL_C.34X)
und EICAR virus-signatur (X5O!P%@AP[4\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*)
Mit folgendem Befehl testen wir das:
spamassassin -D -t < /usr/share/doc/spamassassin/examples/sample-spam.txt 2>&1 | tee sa.out
Änderungen für Testdomain
Die Testdomain hat ein CaCert-Zertifikat, das in der /avr/log/open-xchange/open-xchange.log.0
SSL Exceptions werfen wird.
Um da zu vermeiden kann man zeitweise in der /usr/lib/jvm/java-1.7.0-openjdk-amd64/jre/lib/security/java.security
die Originalzeilen auskommentieren,
jdk.certpath.disabledAlgorithms=MD2, RSA keySize < 1024
jdk.tls.disabledAlgorithms=SSLv3, RC4, DH keySize < 768
einfügen und den Serverprozess mit service open-xchange restart
neu laden.
weiterhin macht es Sinn, das CAcert zum Download anzubieten, damit es in Browser importiert werden kann, in etwa so
cp /etc/ssl/certs/chain.CAcert.pem /var/www/html/
openssl x509 -outform der -in /var/www/html/chain.CAcert.pem -out /var/www/html/chain.CAcert.crt
chmod a+r /var/www/html/chain.\*
Wie in AppSuite:OXReportClient beschrieben:
einfach mal anzeigen
/opt/open-xchange/sbin/report -x -d
Absenden
/opt/open-xchange/sbin/report -x -s
und dann per cronjob regelmäßig absenden
vim /etc/cron.d/open-xchange_report.sh
folgendes eintragen
0 3 \* \* 7 open-xchange /opt/open-xchange/sbin/report -x -s 1> /dev/null 2>&1
und das ganze ausführbar machen:
chmod a+x /etc/cron.d/open-xchange_report.sh
Hier gibts ein kleinen Fehler:
Müsste aber
a2enconf ox_proxy_http_custom
sein