Merge
This commit is contained in:
commit
ec0e5e0c4e
99
README.md
99
README.md
|
@ -1,99 +0,0 @@
|
||||||
Mail-in-a-Box
|
|
||||||
=============
|
|
||||||
|
|
||||||
By [@JoshData](https://github.com/JoshData) and [contributors](https://github.com/mail-in-a-box/mailinabox/graphs/contributors).
|
|
||||||
|
|
||||||
Mail-in-a-Box helps individuals take back control of their email by defining a one-click, easy-to-deploy SMTP+everything else server: a mail server in a box.
|
|
||||||
|
|
||||||
**Please see [https://mailinabox.email](https://mailinabox.email) for the project's website and setup guide!**
|
|
||||||
|
|
||||||
* * *
|
|
||||||
|
|
||||||
I am trying to:
|
|
||||||
|
|
||||||
* Make deploying a good mail server easy.
|
|
||||||
* Promote [decentralization](http://redecentralize.org/), innovation, and privacy on the web.
|
|
||||||
* Have automated, auditable, and [idempotent](http://sharknet.us/2014/02/01/automated-configuration-management-challenges-with-idempotency/) configuration.
|
|
||||||
* **Not** make a totally unhackable, NSA-proof server.
|
|
||||||
* **Not** make something customizable by power users.
|
|
||||||
|
|
||||||
This setup is what has been powering my own personal email since September 2013.
|
|
||||||
|
|
||||||
The Box
|
|
||||||
-------
|
|
||||||
|
|
||||||
Mail-in-a-Box turns a fresh Ubuntu 14.04 LTS 64-bit machine into a working mail server by installing and configuring various components.
|
|
||||||
|
|
||||||
It is a one-click email appliance. There are no user-configurable setup options. It "just works".
|
|
||||||
|
|
||||||
The components installed are:
|
|
||||||
|
|
||||||
* SMTP ([postfix](http://www.postfix.org/)), IMAP ([dovecot](http://dovecot.org/)), CardDAV/CalDAV ([ownCloud](http://owncloud.org/)), Exchange ActiveSync ([z-push](https://github.com/fmbiete/Z-Push-contrib))
|
|
||||||
* Webmail ([Roundcube](http://roundcube.net/)), static website hosting ([nginx](http://nginx.org/))
|
|
||||||
* Spam filtering ([spamassassin](https://spamassassin.apache.org/)), greylisting ([postgrey](http://postgrey.schweikert.ch/))
|
|
||||||
* DNS ([nsd4](http://www.nlnetlabs.nl/projects/nsd/)) with [SPF](https://en.wikipedia.org/wiki/Sender_Policy_Framework), DKIM ([OpenDKIM](http://www.opendkim.org/)), [DMARC](https://en.wikipedia.org/wiki/DMARC), [DNSSEC](https://en.wikipedia.org/wiki/DNSSEC), [DANE TLSA](https://en.wikipedia.org/wiki/DNS-based_Authentication_of_Named_Entities), and [SSHFP](https://tools.ietf.org/html/rfc4255) records automatically set
|
|
||||||
* Backups ([duplicity](http://duplicity.nongnu.org/)), firewall ([ufw](https://launchpad.net/ufw)), intrusion protection ([fail2ban](http://www.fail2ban.org/wiki/index.php/Main_Page)), system monitoring ([munin](http://munin-monitoring.org/))
|
|
||||||
|
|
||||||
It also includes:
|
|
||||||
|
|
||||||
* A control panel and API for adding/removing mail users, aliases, custom DNS records, etc. and detailed system monitoring.
|
|
||||||
* Our own builds of postgrey (adding better whitelisting) and dovecot-lucene (faster search for mail) distributed via the [Mail-in-a-Box PPA](https://launchpad.net/~mail-in-a-box/+archive/ubuntu/ppa) on Launchpad.
|
|
||||||
|
|
||||||
For more information on how Mail-in-a-Box handles your privacy, see the [security details page](security.md).
|
|
||||||
|
|
||||||
Installation
|
|
||||||
------------
|
|
||||||
|
|
||||||
See the [setup guide](https://mailinabox.email/guide.html) for detailed, user-friendly instructions.
|
|
||||||
|
|
||||||
For experts, start with a completely fresh (really, I mean it) Ubuntu 14.04 LTS 64-bit machine. On the machine...
|
|
||||||
|
|
||||||
Clone this repository:
|
|
||||||
|
|
||||||
$ git clone https://github.com/mail-in-a-box/mailinabox
|
|
||||||
$ cd mailinabox
|
|
||||||
|
|
||||||
_Optional:_ Download my PGP key and then verify that the sources were signed
|
|
||||||
by me:
|
|
||||||
|
|
||||||
$ curl -s https://keybase.io/joshdata/key.asc | gpg --import
|
|
||||||
gpg: key C10BDD81: public key "Joshua Tauberer <jt@occams.info>" imported
|
|
||||||
|
|
||||||
$ git verify-tag v0.18c
|
|
||||||
gpg: Signature made ..... using RSA key ID C10BDD81
|
|
||||||
gpg: Good signature from "Joshua Tauberer <jt@occams.info>"
|
|
||||||
gpg: WARNING: This key is not certified with a trusted signature!
|
|
||||||
gpg: There is no indication that the signature belongs to the owner.
|
|
||||||
Primary key fingerprint: 5F4C 0E73 13CC D744 693B 2AEA B920 41F4 C10B DD81
|
|
||||||
|
|
||||||
You'll get a lot of warnings, but that's OK. Check that the primary key fingerprint matches the
|
|
||||||
fingerprint in the key details at [https://keybase.io/joshdata](https://keybase.io/joshdata)
|
|
||||||
and on my [personal homepage](https://razor.occams.info/). (Of course, if this repository has been compromised you can't trust these instructions.)
|
|
||||||
|
|
||||||
Checkout the tag corresponding to the most recent release:
|
|
||||||
|
|
||||||
$ git checkout v0.18c
|
|
||||||
|
|
||||||
Begin the installation.
|
|
||||||
|
|
||||||
$ sudo setup/start.sh
|
|
||||||
|
|
||||||
For help, DO NOT contact me directly --- I don't do tech support by email or tweet (no exceptions).
|
|
||||||
|
|
||||||
Post your question on the [discussion forum](https://discourse.mailinabox.email/) instead, where me and other Mail-in-a-Box users may be able to help you.
|
|
||||||
|
|
||||||
The Acknowledgements
|
|
||||||
--------------------
|
|
||||||
|
|
||||||
This project was inspired in part by the ["NSA-proof your email in 2 hours"](http://sealedabstract.com/code/nsa-proof-your-e-mail-in-2-hours/) blog post by Drew Crawford, [Sovereign](https://github.com/al3x/sovereign) by Alex Payne, and conversations with <a href="http://twitter.com/shevski" target="_blank">@shevski</a>, <a href="https://github.com/konklone" target="_blank">@konklone</a>, and <a href="https://github.com/gregelin" target="_blank">@GregElin</a>.
|
|
||||||
|
|
||||||
Mail-in-a-Box is similar to [iRedMail](http://www.iredmail.org/) and [Modoboa](https://github.com/tonioo/modoboa).
|
|
||||||
|
|
||||||
The History
|
|
||||||
-----------
|
|
||||||
|
|
||||||
* In 2007 I wrote a relatively popular Mozilla Thunderbird extension that added client-side SPF and DKIM checks to mail to warn users about possible phishing: [add-on page](https://addons.mozilla.org/en-us/thunderbird/addon/sender-verification-anti-phish/), [source](https://github.com/JoshData/thunderbird-spf).
|
|
||||||
* In August 2013 I began Mail-in-a-Box by combining my own mail server configuration with the setup in ["NSA-proof your email in 2 hours"](http://sealedabstract.com/code/nsa-proof-your-e-mail-in-2-hours/) and making the setup steps reproducible with bash scripts.
|
|
||||||
* Mail-in-a-Box was a semifinalist in the 2014 [Knight News Challenge](https://www.newschallenge.org/challenge/2014/submissions/mail-in-a-box), but it was not selected as a winner.
|
|
||||||
* Mail-in-a-Box hit the front page of Hacker News in [April](https://news.ycombinator.com/item?id=7634514) 2014, [September](https://news.ycombinator.com/item?id=8276171) 2014, and [May](https://news.ycombinator.com/item?id=9624267) 2015.
|
|
||||||
* FastCompany mentioned Mail-in-a-Box a [roundup of privacy projects](http://www.fastcompany.com/3047645/your-own-private-cloud) on June 26, 2015.
|
|
|
@ -1,128 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
||||||
<!--
|
|
||||||
iOS/OS X Configuration Profile
|
|
||||||
|
|
||||||
Mobileconfig for iOS/OS X users to setup IMAP, SMTP, Contacts & Calendar
|
|
||||||
|
|
||||||
https://developer.apple.com/library/ios/featuredarticles/iPhoneConfigurationProfileRef/Introduction/Introduction.html
|
|
||||||
-->
|
|
||||||
<plist version="1.0">
|
|
||||||
<dict>
|
|
||||||
<key>PayloadContent</key>
|
|
||||||
<array>
|
|
||||||
<dict>
|
|
||||||
<key>CalDAVAccountDescription</key>
|
|
||||||
<string>PRIMARY_HOSTNAME calendar</string>
|
|
||||||
<key>CalDAVHostName</key>
|
|
||||||
<string>PRIMARY_HOSTNAME</string>
|
|
||||||
<key>CalDAVPort</key>
|
|
||||||
<real>443</real>
|
|
||||||
<key>CalDAVPrincipalURL</key>
|
|
||||||
<string>/cloud/remote.php/caldav/calendars/</string>
|
|
||||||
<key>CalDAVUseSSL</key>
|
|
||||||
<true/>
|
|
||||||
<key>PayloadDescription</key>
|
|
||||||
<string>PRIMARY_HOSTNAME (Mail-in-a-Box)</string>
|
|
||||||
<key>PayloadDisplayName</key>
|
|
||||||
<string>PRIMARY_HOSTNAME calendar</string>
|
|
||||||
<key>PayloadIdentifier</key>
|
|
||||||
<string>email.mailinabox.mobileconfig.PRIMARY_HOSTNAME.CalDAV</string>
|
|
||||||
<key>PayloadOrganization</key>
|
|
||||||
<string></string>
|
|
||||||
<key>PayloadType</key>
|
|
||||||
<string>com.apple.caldav.account</string>
|
|
||||||
<key>PayloadUUID</key>
|
|
||||||
<string>UUID1</string>
|
|
||||||
<key>PayloadVersion</key>
|
|
||||||
<integer>1</integer>
|
|
||||||
</dict>
|
|
||||||
<dict>
|
|
||||||
<key>EmailAccountDescription</key>
|
|
||||||
<string>PRIMARY_HOSTNAME mail</string>
|
|
||||||
<key>EmailAccountType</key>
|
|
||||||
<string>EmailTypeIMAP</string>
|
|
||||||
<key>IncomingMailServerAuthentication</key>
|
|
||||||
<string>EmailAuthPassword</string>
|
|
||||||
<key>IncomingMailServerHostName</key>
|
|
||||||
<string>PRIMARY_HOSTNAME</string>
|
|
||||||
<key>IncomingMailServerPortNumber</key>
|
|
||||||
<integer>993</integer>
|
|
||||||
<key>IncomingMailServerUseSSL</key>
|
|
||||||
<true/>
|
|
||||||
<key>OutgoingMailServerAuthentication</key>
|
|
||||||
<string>EmailAuthPassword</string>
|
|
||||||
<key>OutgoingMailServerHostName</key>
|
|
||||||
<string>PRIMARY_HOSTNAME</string>
|
|
||||||
<key>OutgoingMailServerPortNumber</key>
|
|
||||||
<integer>587</integer>
|
|
||||||
<key>OutgoingMailServerUseSSL</key>
|
|
||||||
<true/>
|
|
||||||
<key>OutgoingPasswordSameAsIncomingPassword</key>
|
|
||||||
<true/>
|
|
||||||
<key>PayloadDescription</key>
|
|
||||||
<string>PRIMARY_HOSTNAME (Mail-in-a-Box)</string>
|
|
||||||
<key>PayloadDisplayName</key>
|
|
||||||
<string>PRIMARY_HOSTNAME mail</string>
|
|
||||||
<key>PayloadIdentifier</key>
|
|
||||||
<string>email.mailinabox.mobileconfig.PRIMARY_HOSTNAME.E-Mail</string>
|
|
||||||
<key>PayloadOrganization</key>
|
|
||||||
<string></string>
|
|
||||||
<key>PayloadType</key>
|
|
||||||
<string>com.apple.mail.managed</string>
|
|
||||||
<key>PayloadUUID</key>
|
|
||||||
<string>UUID2</string>
|
|
||||||
<key>PayloadVersion</key>
|
|
||||||
<integer>1</integer>
|
|
||||||
<key>PreventAppSheet</key>
|
|
||||||
<false/>
|
|
||||||
<key>PreventMove</key>
|
|
||||||
<false/>
|
|
||||||
<key>SMIMEEnabled</key>
|
|
||||||
<false/>
|
|
||||||
</dict>
|
|
||||||
<dict>
|
|
||||||
<key>CardDAVAccountDescription</key>
|
|
||||||
<string>PRIMARY_HOSTNAME contacts</string>
|
|
||||||
<key>CardDAVHostName</key>
|
|
||||||
<string>PRIMARY_HOSTNAME</string>
|
|
||||||
<key>CardDAVPort</key>
|
|
||||||
<integer>443</integer>
|
|
||||||
<key>CardDAVPrincipalURL</key>
|
|
||||||
<string>/cloud/remote.php/carddav/addressbooks/</string>
|
|
||||||
<key>CardDAVUseSSL</key>
|
|
||||||
<true/>
|
|
||||||
<key>PayloadDescription</key>
|
|
||||||
<string>PRIMARY_HOSTNAME (Mail-in-a-Box)</string>
|
|
||||||
<key>PayloadDisplayName</key>
|
|
||||||
<string>PRIMARY_HOSTNAME contacts</string>
|
|
||||||
<key>PayloadIdentifier</key>
|
|
||||||
<string>email.mailinabox.mobileconfig.PRIMARY_HOSTNAME.carddav</string>
|
|
||||||
<key>PayloadOrganization</key>
|
|
||||||
<string></string>
|
|
||||||
<key>PayloadType</key>
|
|
||||||
<string>com.apple.carddav.account</string>
|
|
||||||
<key>PayloadUUID</key>
|
|
||||||
<string>UUID3</string>
|
|
||||||
<key>PayloadVersion</key>
|
|
||||||
<integer>1</integer>
|
|
||||||
</dict>
|
|
||||||
</array>
|
|
||||||
<key>PayloadDescription</key>
|
|
||||||
<string>PRIMARY_HOSTNAME (Mail-in-a-Box)</string>
|
|
||||||
<key>PayloadDisplayName</key>
|
|
||||||
<string>PRIMARY_HOSTNAME</string>
|
|
||||||
<key>PayloadIdentifier</key>
|
|
||||||
<string>email.mailinabox.mobileconfig.PRIMARY_HOSTNAME</string>
|
|
||||||
<key>PayloadOrganization</key>
|
|
||||||
<string></string>
|
|
||||||
<key>PayloadRemovalDisallowed</key>
|
|
||||||
<false/>
|
|
||||||
<key>PayloadType</key>
|
|
||||||
<string>Configuration</string>
|
|
||||||
<key>PayloadUUID</key>
|
|
||||||
<string>UUID4</string>
|
|
||||||
<key>PayloadVersion</key>
|
|
||||||
<integer>1</integer>
|
|
||||||
</dict>
|
|
||||||
</plist>
|
|
|
@ -1,44 +0,0 @@
|
||||||
<?xml version="1.0"?>
|
|
||||||
<clientConfig version="1.1">
|
|
||||||
<emailProvider id="PRIMARY_HOSTNAME">
|
|
||||||
<domain>PRIMARY_HOSTNAME</domain>
|
|
||||||
|
|
||||||
<displayName>PRIMARY_HOSTNAME (Mail-in-a-Box)</displayName>
|
|
||||||
<displayShortName>PRIMARY_HOSTNAME</displayShortName>
|
|
||||||
|
|
||||||
<incomingServer type="imap">
|
|
||||||
<hostname>PRIMARY_HOSTNAME</hostname>
|
|
||||||
<port>993</port>
|
|
||||||
<socketType>SSL</socketType>
|
|
||||||
<username>%EMAILADDRESS%</username>
|
|
||||||
<authentication>password-cleartext</authentication>
|
|
||||||
</incomingServer>
|
|
||||||
|
|
||||||
<outgoingServer type="smtp">
|
|
||||||
<hostname>PRIMARY_HOSTNAME</hostname>
|
|
||||||
<port>587</port>
|
|
||||||
<socketType>STARTTLS</socketType>
|
|
||||||
<username>%EMAILADDRESS%</username>
|
|
||||||
<authentication>password-cleartext</authentication>
|
|
||||||
<addThisServer>true</addThisServer>
|
|
||||||
<useGlobalPreferredServer>true</useGlobalPreferredServer>
|
|
||||||
</outgoingServer>
|
|
||||||
|
|
||||||
<documentation url="https://PRIMARY_HOSTNAME/">
|
|
||||||
<descr lang="en">PRIMARY_HOSTNAME website.</descr>
|
|
||||||
</documentation>
|
|
||||||
</emailProvider>
|
|
||||||
|
|
||||||
<webMail>
|
|
||||||
<loginPage url="https://PRIMARY_HOSTNAME/mail/" />
|
|
||||||
<loginPageInfo url="https://PRIMARY_HOSTNAME/mail/" >
|
|
||||||
<username>%EMAILADDRESS%</username>
|
|
||||||
<usernameField id="rcmloginuser" name="_user" />
|
|
||||||
<passwordField id="rcmloginpwd" name="_pass" />
|
|
||||||
<loginButton id="rcmloginsubmit" />
|
|
||||||
</loginPageInfo>
|
|
||||||
</webMail>
|
|
||||||
|
|
||||||
<clientConfigUpdate url="https://PRIMARY_HOSTNAME/.well-known/autoconfig/mail/config-v1.1.xml" />
|
|
||||||
|
|
||||||
</clientConfig>
|
|
|
@ -12,13 +12,6 @@
|
||||||
access_log off;
|
access_log off;
|
||||||
}
|
}
|
||||||
|
|
||||||
location = /mailinabox.mobileconfig {
|
|
||||||
alias /var/lib/mailinabox/mobileconfig.xml;
|
|
||||||
}
|
|
||||||
location = /.well-known/autoconfig/mail/config-v1.1.xml {
|
|
||||||
alias /var/lib/mailinabox/mozilla-autoconfig.xml;
|
|
||||||
}
|
|
||||||
|
|
||||||
# Roundcube Webmail configuration.
|
# Roundcube Webmail configuration.
|
||||||
rewrite ^/mail$ /mail/ redirect;
|
rewrite ^/mail$ /mail/ redirect;
|
||||||
rewrite ^/mail/$ /mail/index.php;
|
rewrite ^/mail/$ /mail/index.php;
|
||||||
|
@ -43,26 +36,6 @@
|
||||||
client_max_body_size 128M;
|
client_max_body_size 128M;
|
||||||
}
|
}
|
||||||
|
|
||||||
# Z-Push (Microsoft Exchange ActiveSync)
|
|
||||||
location /Microsoft-Server-ActiveSync {
|
|
||||||
include /etc/nginx/fastcgi_params;
|
|
||||||
fastcgi_param SCRIPT_FILENAME /usr/local/lib/z-push/index.php;
|
|
||||||
fastcgi_param PHP_VALUE "include_path=.:/usr/share/php:/usr/share/pear:/usr/share/awl/inc";
|
|
||||||
fastcgi_read_timeout 630;
|
|
||||||
fastcgi_pass php-fpm;
|
|
||||||
|
|
||||||
# Outgoing mail also goes through this endpoint, so increase the maximum
|
|
||||||
# file upload limit to match the corresponding Postfix limit.
|
|
||||||
client_max_body_size 128M;
|
|
||||||
}
|
|
||||||
location ~* ^/autodiscover/autodiscover.xml$ {
|
|
||||||
include fastcgi_params;
|
|
||||||
fastcgi_param SCRIPT_FILENAME /usr/local/lib/z-push/autodiscover/autodiscover.php;
|
|
||||||
fastcgi_param PHP_VALUE "include_path=.:/usr/share/php:/usr/share/pear:/usr/share/awl/inc";
|
|
||||||
fastcgi_pass php-fpm;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
# ADDITIONAL DIRECTIVES HERE
|
# ADDITIONAL DIRECTIVES HERE
|
||||||
|
|
||||||
# Disable viewing dotfiles (.htaccess, .svn, .git, etc.)
|
# Disable viewing dotfiles (.htaccess, .svn, .git, etc.)
|
||||||
|
|
|
@ -11,57 +11,4 @@
|
||||||
add_header Content-Security-Policy "frame-ancestors 'none';";
|
add_header Content-Security-Policy "frame-ancestors 'none';";
|
||||||
add_header Strict-Transport-Security max-age=31536000;
|
add_header Strict-Transport-Security max-age=31536000;
|
||||||
}
|
}
|
||||||
|
|
||||||
# ownCloud configuration.
|
|
||||||
rewrite ^/cloud$ /cloud/ redirect;
|
|
||||||
rewrite ^/cloud/$ /cloud/index.php;
|
|
||||||
rewrite ^/cloud/(contacts|calendar|files)$ /cloud/index.php/apps/$1/ redirect;
|
|
||||||
rewrite ^(/cloud/core/doc/[^\/]+/)$ $1/index.html;
|
|
||||||
location /cloud/ {
|
|
||||||
alias /usr/local/lib/owncloud/;
|
|
||||||
location ~ ^/cloud/(build|tests|config|lib|3rdparty|templates|data|README)/ {
|
|
||||||
deny all;
|
|
||||||
}
|
|
||||||
location ~ ^/cloud/(?:\.|autotest|occ|issue|indie|db_|console) {
|
|
||||||
deny all;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
location ~ ^(/cloud)((?:/ocs)?/[^/]+\.php)(/.*)?$ {
|
|
||||||
# note: ~ has precendence over a regular location block
|
|
||||||
# Accept URLs like:
|
|
||||||
# /cloud/index.php/apps/files/
|
|
||||||
# /cloud/index.php/apps/files/ajax/scan.php (it's really index.php; see 6fdef379adfdeac86cc2220209bdf4eb9562268d)
|
|
||||||
# /cloud/ocs/v1.php/apps/files_sharing/api/v1 (see #240)
|
|
||||||
# /cloud/remote.php/webdav/yourfilehere...
|
|
||||||
include fastcgi_params;
|
|
||||||
fastcgi_param SCRIPT_FILENAME /usr/local/lib/owncloud/$2;
|
|
||||||
fastcgi_param SCRIPT_NAME $1$2;
|
|
||||||
fastcgi_param PATH_INFO $3;
|
|
||||||
fastcgi_param MOD_X_ACCEL_REDIRECT_ENABLED on;
|
|
||||||
fastcgi_param MOD_X_ACCEL_REDIRECT_PREFIX /owncloud-xaccel;
|
|
||||||
fastcgi_read_timeout 630;
|
|
||||||
fastcgi_pass php-fpm;
|
|
||||||
error_page 403 /cloud/core/templates/403.php;
|
|
||||||
error_page 404 /cloud/core/templates/404.php;
|
|
||||||
client_max_body_size 1G;
|
|
||||||
fastcgi_buffers 64 4K;
|
|
||||||
}
|
|
||||||
location ^~ /owncloud-xaccel/ {
|
|
||||||
# This directory is for MOD_X_ACCEL_REDIRECT_ENABLED. ownCloud sends the full file
|
|
||||||
# path on disk as a subdirectory under this virtual path.
|
|
||||||
# We must only allow 'internal' redirects within nginx so that the filesystem
|
|
||||||
# is not exposed to the world.
|
|
||||||
internal;
|
|
||||||
alias /;
|
|
||||||
}
|
|
||||||
location ~ ^/((caldav|carddav|webdav).*)$ {
|
|
||||||
# Z-Push doesn't like getting a redirect, and a plain rewrite didn't work either.
|
|
||||||
# Properly proxying like this seems to work fine.
|
|
||||||
proxy_pass https://127.0.0.1/cloud/remote.php/$1;
|
|
||||||
}
|
|
||||||
rewrite ^/.well-known/host-meta /cloud/public.php?service=host-meta last;
|
|
||||||
rewrite ^/.well-known/host-meta.json /cloud/public.php?service=host-meta-json last;
|
|
||||||
rewrite ^/.well-known/carddav /cloud/remote.php/carddav/ redirect;
|
|
||||||
rewrite ^/.well-known/caldav /cloud/remote.php/caldav/ redirect;
|
|
||||||
|
|
||||||
# ADDITIONAL DIRECTIVES HERE
|
# ADDITIONAL DIRECTIVES HERE
|
||||||
|
|
|
@ -1,9 +1,4 @@
|
||||||
<html>
|
<html>
|
||||||
<head>
|
|
||||||
<title>this is a mail-in-a-box</title>
|
|
||||||
</head>
|
|
||||||
<body>
|
<body>
|
||||||
<h1>this is a mail-in-a-box</h1>
|
|
||||||
<p>take control of your email at <a href="https://mailinabox.email/">https://mailinabox.email/</a></p>
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
@ -1,24 +0,0 @@
|
||||||
<?php
|
|
||||||
/***********************************************
|
|
||||||
* File : config.php
|
|
||||||
* Project : Z-Push
|
|
||||||
* Descr : Autodiscover configuration file
|
|
||||||
************************************************/
|
|
||||||
|
|
||||||
// Defines the base path on the server
|
|
||||||
define('BASE_PATH', dirname($_SERVER['SCRIPT_FILENAME']). '/');
|
|
||||||
|
|
||||||
// The Z-Push server location for the autodiscover response
|
|
||||||
define('SERVERURL', 'https://PRIMARY_HOSTNAME/Microsoft-Server-ActiveSync');
|
|
||||||
|
|
||||||
define('USE_FULLEMAIL_FOR_LOGIN', true);
|
|
||||||
|
|
||||||
define('LOGFILEDIR', '/var/log/z-push/');
|
|
||||||
define('LOGFILE', LOGFILEDIR . 'autodiscover.log');
|
|
||||||
define('LOGERRORFILE', LOGFILEDIR . 'autodiscover-error.log');
|
|
||||||
define('LOGLEVEL', LOGLEVEL_INFO);
|
|
||||||
define('LOGUSERLEVEL', LOGLEVEL);
|
|
||||||
|
|
||||||
// the backend data provider
|
|
||||||
define('BACKEND_PROVIDER', 'BackendCombined');
|
|
||||||
?>
|
|
|
@ -1,16 +0,0 @@
|
||||||
<?php
|
|
||||||
/***********************************************
|
|
||||||
* File : config.php
|
|
||||||
* Project : Z-Push
|
|
||||||
* Descr : CalDAV backend configuration file
|
|
||||||
************************************************/
|
|
||||||
|
|
||||||
define('CALDAV_PROTOCOL', 'https');
|
|
||||||
define('CALDAV_SERVER', '127.0.0.1');
|
|
||||||
define('CALDAV_PORT', '443');
|
|
||||||
define('CALDAV_PATH', '/caldav/calendars/%u/');
|
|
||||||
define('CALDAV_PERSONAL', 'PRINCIPAL');
|
|
||||||
define('CALDAV_SUPPORTS_SYNC', false);
|
|
||||||
define('CALDAV_MAX_SYNC_PERIOD', 2147483647);
|
|
||||||
|
|
||||||
?>
|
|
|
@ -1,31 +0,0 @@
|
||||||
<?php
|
|
||||||
/***********************************************
|
|
||||||
* File : config.php
|
|
||||||
* Project : Z-Push
|
|
||||||
* Descr : CardDAV backend configuration file
|
|
||||||
************************************************/
|
|
||||||
|
|
||||||
|
|
||||||
define('CARDDAV_PROTOCOL', 'https'); /* http or https */
|
|
||||||
define('CARDDAV_SERVER', '127.0.0.1');
|
|
||||||
define('CARDDAV_PORT', '443');
|
|
||||||
define('CARDDAV_PATH', '/carddav/addressbooks/%u/');
|
|
||||||
define('CARDDAV_DEFAULT_PATH', '/carddav/addressbooks/%u/contacts/'); /* subdirectory of the main path */
|
|
||||||
define('CARDDAV_GAL_PATH', ''); /* readonly, searchable, not syncd */
|
|
||||||
define('CARDDAV_GAL_MIN_LENGTH', 5);
|
|
||||||
define('CARDDAV_CONTACTS_FOLDER_NAME', '%u Addressbook');
|
|
||||||
define('CARDDAV_SUPPORTS_SYNC', false);
|
|
||||||
|
|
||||||
// If the CardDAV server supports the FN attribute for searches
|
|
||||||
// DAViCal supports it, but SabreDav, Owncloud and SOGo don't
|
|
||||||
// Setting this to true will search by FN. If false will search by sn, givenName and email
|
|
||||||
// It's safe to leave it as false
|
|
||||||
define('CARDDAV_SUPPORTS_FN_SEARCH', false);
|
|
||||||
|
|
||||||
|
|
||||||
// If your carddav server needs to use file extension to recover a vcard.
|
|
||||||
// Davical needs it
|
|
||||||
// SOGo official demo online needs it, but some SOGo installation don't need it, so test it
|
|
||||||
define('CARDDAV_URL_VCARD_EXTENSION', '.vcf');
|
|
||||||
|
|
||||||
?>
|
|
|
@ -1,49 +0,0 @@
|
||||||
<?php
|
|
||||||
/***********************************************
|
|
||||||
* File : backend/combined/config.php
|
|
||||||
* Project : Z-Push
|
|
||||||
* Descr : configuration file for the
|
|
||||||
* combined backend.
|
|
||||||
************************************************/
|
|
||||||
|
|
||||||
class BackendCombinedConfig {
|
|
||||||
public static function GetBackendCombinedConfig() {
|
|
||||||
return array(
|
|
||||||
'backends' => array(
|
|
||||||
'i' => array(
|
|
||||||
'name' => 'BackendIMAP',
|
|
||||||
),
|
|
||||||
'c' => array(
|
|
||||||
'name' => 'BackendCalDAV',
|
|
||||||
),
|
|
||||||
'd' => array(
|
|
||||||
'name' => 'BackendCardDAV',
|
|
||||||
),
|
|
||||||
),
|
|
||||||
'delimiter' => '/',
|
|
||||||
'folderbackend' => array(
|
|
||||||
SYNC_FOLDER_TYPE_INBOX => 'i',
|
|
||||||
SYNC_FOLDER_TYPE_DRAFTS => 'i',
|
|
||||||
SYNC_FOLDER_TYPE_WASTEBASKET => 'i',
|
|
||||||
SYNC_FOLDER_TYPE_SENTMAIL => 'i',
|
|
||||||
SYNC_FOLDER_TYPE_OUTBOX => 'i',
|
|
||||||
SYNC_FOLDER_TYPE_TASK => 'c',
|
|
||||||
SYNC_FOLDER_TYPE_APPOINTMENT => 'c',
|
|
||||||
SYNC_FOLDER_TYPE_CONTACT => 'd',
|
|
||||||
SYNC_FOLDER_TYPE_NOTE => 'c',
|
|
||||||
SYNC_FOLDER_TYPE_JOURNAL => 'c',
|
|
||||||
SYNC_FOLDER_TYPE_OTHER => 'i',
|
|
||||||
SYNC_FOLDER_TYPE_USER_MAIL => 'i',
|
|
||||||
SYNC_FOLDER_TYPE_USER_APPOINTMENT => 'c',
|
|
||||||
SYNC_FOLDER_TYPE_USER_CONTACT => 'd',
|
|
||||||
SYNC_FOLDER_TYPE_USER_TASK => 'c',
|
|
||||||
SYNC_FOLDER_TYPE_USER_JOURNAL => 'c',
|
|
||||||
SYNC_FOLDER_TYPE_USER_NOTE => 'c',
|
|
||||||
SYNC_FOLDER_TYPE_UNKNOWN => 'i',
|
|
||||||
),
|
|
||||||
'rootcreatefolderbackend' => 'i',
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
?>
|
|
|
@ -1,51 +0,0 @@
|
||||||
<?php
|
|
||||||
/***********************************************
|
|
||||||
* File : config.php
|
|
||||||
* Project : Z-Push
|
|
||||||
* Descr : IMAP backend configuration file
|
|
||||||
************************************************/
|
|
||||||
|
|
||||||
define('IMAP_SERVER', '127.0.0.1');
|
|
||||||
define('IMAP_PORT', 993);
|
|
||||||
define('IMAP_OPTIONS', '/ssl/norsh/novalidate-cert');
|
|
||||||
define('IMAP_DEFAULTFROM', '');
|
|
||||||
|
|
||||||
define('SYSTEM_MIME_TYPES_MAPPING', '/etc/mime.types');
|
|
||||||
define('IMAP_AUTOSEEN_ON_DELETE', false);
|
|
||||||
define('IMAP_FOLDER_CONFIGURED', true);
|
|
||||||
define('IMAP_FOLDER_PREFIX', '');
|
|
||||||
define('IMAP_FOLDER_PREFIX_IN_INBOX', false);
|
|
||||||
// see our conf/dovecot-mailboxes.conf file for IMAP special flags settings
|
|
||||||
define('IMAP_FOLDER_INBOX', 'INBOX');
|
|
||||||
define('IMAP_FOLDER_SENT', 'SENT');
|
|
||||||
define('IMAP_FOLDER_DRAFT', 'DRAFTS');
|
|
||||||
define('IMAP_FOLDER_TRASH', 'TRASH');
|
|
||||||
define('IMAP_FOLDER_SPAM', 'SPAM');
|
|
||||||
define('IMAP_FOLDER_ARCHIVE', 'ARCHIVE');
|
|
||||||
|
|
||||||
|
|
||||||
// not used
|
|
||||||
define('IMAP_FROM_SQL_DSN', '');
|
|
||||||
define('IMAP_FROM_SQL_USER', '');
|
|
||||||
define('IMAP_FROM_SQL_PASSWORD', '');
|
|
||||||
define('IMAP_FROM_SQL_OPTIONS', serialize(array(PDO::ATTR_PERSISTENT => true)));
|
|
||||||
define('IMAP_FROM_SQL_QUERY', "select first_name, last_name, mail_address from users where mail_address = '#username@#domain'");
|
|
||||||
define('IMAP_FROM_SQL_FIELDS', serialize(array('first_name', 'last_name', 'mail_address')));
|
|
||||||
define('IMAP_FROM_SQL_FROM', '#first_name #last_name <#mail_address>');
|
|
||||||
define('IMAP_FROM_LDAP_SERVER', '');
|
|
||||||
define('IMAP_FROM_LDAP_SERVER_PORT', '389');
|
|
||||||
define('IMAP_FROM_LDAP_USER', 'cn=zpush,ou=servers,dc=zpush,dc=org');
|
|
||||||
define('IMAP_FROM_LDAP_PASSWORD', 'password');
|
|
||||||
define('IMAP_FROM_LDAP_BASE', 'dc=zpush,dc=org');
|
|
||||||
define('IMAP_FROM_LDAP_QUERY', '(mail=#username@#domain)');
|
|
||||||
define('IMAP_FROM_LDAP_FIELDS', serialize(array('givenname', 'sn', 'mail')));
|
|
||||||
define('IMAP_FROM_LDAP_FROM', '#givenname #sn <#mail>');
|
|
||||||
|
|
||||||
define('IMAP_SMTP_METHOD', 'sendmail');
|
|
||||||
|
|
||||||
global $imap_smtp_params;
|
|
||||||
$imap_smtp_params = array('host' => 'ssl://127.0.0.1', 'port' => 587, 'auth' => true, 'username' => 'imap_username', 'password' => 'imap_password');
|
|
||||||
|
|
||||||
define('MAIL_MIMEPART_CRLF', "\r\n");
|
|
||||||
|
|
||||||
?>
|
|
|
@ -5,7 +5,7 @@
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
|
|
||||||
<title>{{hostname}} - Mail-in-a-Box Control Panel</title>
|
<title>{{hostname}}</title>
|
||||||
|
|
||||||
<meta name="robots" content="noindex, nofollow">
|
<meta name="robots" content="noindex, nofollow">
|
||||||
|
|
||||||
|
@ -63,7 +63,6 @@
|
||||||
margin-bottom: 1em;
|
margin-bottom: 1em;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap-theme.min.css" integrity="sha384-fLW2N01lMqjakBkx3l/M9EahuwpSfeNvV63J5ezn3uZzapT0u7EYsXMjQV+0En5r" crossorigin="anonymous">
|
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
|
@ -104,7 +103,6 @@
|
||||||
<li><a href="#aliases" onclick="return show_panel(this);">Aliases</a></li>
|
<li><a href="#aliases" onclick="return show_panel(this);">Aliases</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
<li><a href="#sync_guide" onclick="return show_panel(this);">Contacts/Calendar</a></li>
|
|
||||||
<li><a href="#web" onclick="return show_panel(this);">Web</a></li>
|
<li><a href="#web" onclick="return show_panel(this);">Web</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
<ul class="nav navbar-nav navbar-right">
|
<ul class="nav navbar-nav navbar-right">
|
||||||
|
@ -147,10 +145,6 @@
|
||||||
{% include "aliases.html" %}
|
{% include "aliases.html" %}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="panel_sync_guide" class="admin_panel">
|
|
||||||
{% include "sync-guide.html" %}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div id="panel_web" class="admin_panel">
|
<div id="panel_web" class="admin_panel">
|
||||||
{% include "web.html" %}
|
{% include "web.html" %}
|
||||||
</div>
|
</div>
|
||||||
|
@ -158,12 +152,6 @@
|
||||||
<div id="panel_tls" class="admin_panel">
|
<div id="panel_tls" class="admin_panel">
|
||||||
{% include "ssl.html" %}
|
{% include "ssl.html" %}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<hr>
|
|
||||||
|
|
||||||
<footer>
|
|
||||||
<p>This is a <a href="https://mailinabox.email">Mail-in-a-Box</a>.</p>
|
|
||||||
</footer>
|
|
||||||
</div> <!-- /container -->
|
</div> <!-- /container -->
|
||||||
|
|
||||||
<div id="ajax_loading_indicator" style="display: none; position: fixed; left: 0; top: 0; width: 100%; height: 100%; z-index: 100000; text-align: center; background-color: rgba(255,255,255,.75)">
|
<div id="ajax_loading_indicator" style="display: none; position: fixed; left: 0; top: 0; width: 100%; height: 100%; z-index: 100000; text-align: center; background-color: rgba(255,255,255,.75)">
|
||||||
|
|
|
@ -14,10 +14,6 @@
|
||||||
|
|
||||||
<h3>Mobile/desktop apps</h3>
|
<h3>Mobile/desktop apps</h3>
|
||||||
|
|
||||||
<h4>Automatic configuration</h4>
|
|
||||||
|
|
||||||
<p>iOS and OS X only: Open <a style="font-weight: bold" href="https://{{hostname}}/mailinabox.mobileconfig">this configuration link</a> on your iOS device or on your Mac desktop to easily set up mail (IMAP/SMTP), Contacts, and Calendar. Your username is your whole email address.</p>
|
|
||||||
|
|
||||||
<h4>Manual configuration</h4>
|
<h4>Manual configuration</h4>
|
||||||
|
|
||||||
<p>Use the following settings when you set up your email on your phone, desktop, or other device:</p>
|
<p>Use the following settings when you set up your email on your phone, desktop, or other device:</p>
|
||||||
|
@ -39,17 +35,6 @@
|
||||||
<p>In addition to setting up your email, you’ll also need to set up <a href="#sync_guide" onclick="return show_panel(this);">contacts and calendar synchronization</a> separately.</p>
|
<p>In addition to setting up your email, you’ll also need to set up <a href="#sync_guide" onclick="return show_panel(this);">contacts and calendar synchronization</a> separately.</p>
|
||||||
|
|
||||||
<p>As an alternative to IMAP you can also use the POP protocol: choose POP as the protocol, port 995, and SSL or TLS security in your mail client. The SMTP settings and usernames and passwords remain the same. However, we recommend you use IMAP instead.</p>
|
<p>As an alternative to IMAP you can also use the POP protocol: choose POP as the protocol, port 995, and SSL or TLS security in your mail client. The SMTP settings and usernames and passwords remain the same. However, we recommend you use IMAP instead.</p>
|
||||||
|
|
||||||
<h4>Exchange/ActiveSync settings</h4>
|
|
||||||
|
|
||||||
<p>On iOS devices, devices on this <a href="http://z-push.org/compatibility/">compatibility list</a>, or using Outlook 2007 or later on Windows 7 and later, you may set up your mail as an Exchange or ActiveSync server. However, we’ve found this to be more buggy than using IMAP as described above. If you encounter any problems, please use the manual settings above.</p>
|
|
||||||
|
|
||||||
<table class="table">
|
|
||||||
<tr><th>Server</th> <td>{{hostname}}</td></tr>
|
|
||||||
<tr><th>Options</th> <td>Secure Connection</td></tr>
|
|
||||||
</table>
|
|
||||||
|
|
||||||
<p>Your device should also provide a contacts list and calendar that syncs to this box when you use this method.</p>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="col-sm-5">
|
<div class="col-sm-5">
|
||||||
|
|
|
@ -1,49 +0,0 @@
|
||||||
<div>
|
|
||||||
<h2>Contacts & Calendar Synchronization</h2>
|
|
||||||
|
|
||||||
<p>This box can hold your contacts and calendar, just like it holds your email.</p>
|
|
||||||
|
|
||||||
<hr>
|
|
||||||
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-sm-6">
|
|
||||||
<h4>In your browser</h4>
|
|
||||||
|
|
||||||
<p>You can edit your contacts and calendar from your web browser.</p>
|
|
||||||
|
|
||||||
<table class="table">
|
|
||||||
<thead><tr><th>For...</th> <th>Visit this URL</th></tr></thead>
|
|
||||||
<tr><th>Contacts</td> <td><a href="https://{{hostname}}/cloud/contacts">https://{{hostname}}/cloud/contacts</a></td></tr>
|
|
||||||
<tr><th>Calendar</td> <td><a href="https://{{hostname}}/cloud/calendar">https://{{hostname}}/cloud/calendar</a></td></tr>
|
|
||||||
</table>
|
|
||||||
|
|
||||||
<p>Log in settings are the same as with <a href="#mail-guide" onclick="return show_panel(this);">mail</a>: your
|
|
||||||
complete email address and your mail password.</p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="col-sm-6">
|
|
||||||
<h4>On your mobile device</h4>
|
|
||||||
|
|
||||||
<p>If you set up your <a href="#mail-guide" onclick="return show_panel(this);">mail</a> using Exchange/ActiveSync,
|
|
||||||
your contacts and calendar may already appear on your device.</p>
|
|
||||||
<p>Otherwise, here are some apps that can synchronize your contacts and calendar to your Android phone.</p>
|
|
||||||
|
|
||||||
<table class="table">
|
|
||||||
<thead><tr><th>For...</th> <th>Use...</th></tr></thead>
|
|
||||||
<tr><td>Contacts and Calendar</td> <td><a href="https://play.google.com/store/apps/details?id=at.bitfire.davdroid">DAVdroid</a> ($3.69; free <a href="https://f-droid.org/repository/browse/?fdfilter=dav&fdid=at.bitfire.davdroid">here</a>)</td></tr>
|
|
||||||
<tr><td>Only Contacts</td> <td><a href="https://play.google.com/store/apps/details?id=org.dmfs.carddav.sync">CardDAV-Sync free beta</a> (free)</td></tr>
|
|
||||||
<tr><td>Only Calendar</td> <td><a href="https://play.google.com/store/apps/details?id=org.dmfs.caldav.lib">CalDAV-Sync</a> ($2.89)</td></tr>
|
|
||||||
</table>
|
|
||||||
|
|
||||||
<p>Use the following settings:</p>
|
|
||||||
|
|
||||||
<table class="table">
|
|
||||||
<tr><td>Account Type</td> <td>CardDAV or CalDAV</td></tr>
|
|
||||||
<tr><td>Server Name</td> <td>{{hostname}}</td></tr>
|
|
||||||
<tr><td>Use SSL</td> <td>Yes</td></tr>
|
|
||||||
<tr><td>Username</td> <td>Your complete email address.</td></tr>
|
|
||||||
<tr><td>Password</td> <td>Your mail password.</td></tr>
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
|
@ -66,7 +66,7 @@ tools/editconf.py /etc/postfix/main.cf \
|
||||||
smtp_bind_address=$PRIVATE_IP \
|
smtp_bind_address=$PRIVATE_IP \
|
||||||
smtp_bind_address6=$PRIVATE_IPV6 \
|
smtp_bind_address6=$PRIVATE_IPV6 \
|
||||||
myhostname=$PRIMARY_HOSTNAME\
|
myhostname=$PRIMARY_HOSTNAME\
|
||||||
smtpd_banner="\$myhostname ESMTP Hi, I'm a Mail-in-a-Box (Ubuntu/Postfix; see https://mailinabox.email/)" \
|
smtpd_banner="\$myhostname ESMTP" \
|
||||||
mydestination=localhost
|
mydestination=localhost
|
||||||
|
|
||||||
# Tweak some queue settings:
|
# Tweak some queue settings:
|
||||||
|
|
|
@ -1,234 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
# Owncloud
|
|
||||||
##########################
|
|
||||||
|
|
||||||
source setup/functions.sh # load our functions
|
|
||||||
source /etc/mailinabox.conf # load global vars
|
|
||||||
|
|
||||||
# ### Installing ownCloud
|
|
||||||
|
|
||||||
echo "Installing ownCloud (contacts/calendar)..."
|
|
||||||
|
|
||||||
apt_install \
|
|
||||||
dbconfig-common \
|
|
||||||
php5-cli php5-sqlite php5-gd php5-imap php5-curl php-pear php-apc curl libapr1 libtool libcurl4-openssl-dev php-xml-parser \
|
|
||||||
php5 php5-dev php5-gd php5-fpm memcached php5-memcached unzip
|
|
||||||
|
|
||||||
apt-get purge -qq -y owncloud*
|
|
||||||
|
|
||||||
# Install ownCloud from source of this version:
|
|
||||||
owncloud_ver=8.2.3
|
|
||||||
owncloud_hash=bfdf6166fbf6fc5438dc358600e7239d1c970613
|
|
||||||
|
|
||||||
# Migrate <= v0.10 setups that stored the ownCloud config.php in /usr/local rather than
|
|
||||||
# in STORAGE_ROOT. Move the file to STORAGE_ROOT.
|
|
||||||
if [ ! -f $STORAGE_ROOT/owncloud/config.php ] \
|
|
||||||
&& [ -f /usr/local/lib/owncloud/config/config.php ]; then
|
|
||||||
|
|
||||||
# Move config.php and symlink back into previous location.
|
|
||||||
echo "Migrating owncloud/config.php to new location."
|
|
||||||
mv /usr/local/lib/owncloud/config/config.php $STORAGE_ROOT/owncloud/config.php \
|
|
||||||
&& \
|
|
||||||
ln -sf $STORAGE_ROOT/owncloud/config.php /usr/local/lib/owncloud/config/config.php
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Check if ownCloud dir exist, and check if version matches owncloud_ver (if either doesn't - install/upgrade)
|
|
||||||
if [ ! -d /usr/local/lib/owncloud/ ] \
|
|
||||||
|| ! grep -q $owncloud_ver /usr/local/lib/owncloud/version.php; then
|
|
||||||
|
|
||||||
# Download and verify
|
|
||||||
wget_verify https://download.owncloud.org/community/owncloud-$owncloud_ver.zip $owncloud_hash /tmp/owncloud.zip
|
|
||||||
|
|
||||||
# Clear out the existing ownCloud.
|
|
||||||
if [ -d /usr/local/lib/owncloud/ ]; then
|
|
||||||
echo "upgrading ownCloud to $owncloud_ver (backing up existing ownCloud directory to /tmp/owncloud-backup-$$)..."
|
|
||||||
mv /usr/local/lib/owncloud /tmp/owncloud-backup-$$
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Extract ownCloud
|
|
||||||
unzip -u -o -q /tmp/owncloud.zip -d /usr/local/lib #either extracts new or replaces current files
|
|
||||||
rm -f /tmp/owncloud.zip
|
|
||||||
|
|
||||||
# The two apps we actually want are not in ownCloud core. Clone them from
|
|
||||||
# their github repositories.
|
|
||||||
mkdir -p /usr/local/lib/owncloud/apps
|
|
||||||
git_clone https://github.com/owncloudarchive/contacts 9ba2e667ae8c7ea36d8c4a4c3413c374beb24b1b '' /usr/local/lib/owncloud/apps/contacts
|
|
||||||
git_clone https://github.com/owncloudarchive/calendar 2086e738a3b7b868ec59cd61f0f88b49c3f21dd1 '' /usr/local/lib/owncloud/apps/calendar
|
|
||||||
|
|
||||||
# Fix weird permissions.
|
|
||||||
chmod 750 /usr/local/lib/owncloud/{apps,config}
|
|
||||||
|
|
||||||
# Create a symlink to the config.php in STORAGE_ROOT (for upgrades we're restoring the symlink we previously
|
|
||||||
# put in, and in new installs we're creating a symlink and will create the actual config later).
|
|
||||||
ln -sf $STORAGE_ROOT/owncloud/config.php /usr/local/lib/owncloud/config/config.php
|
|
||||||
|
|
||||||
# Make sure permissions are correct or the upgrade step won't run.
|
|
||||||
# $STORAGE_ROOT/owncloud may not yet exist, so use -f to suppress
|
|
||||||
# that error.
|
|
||||||
chown -f -R www-data.www-data $STORAGE_ROOT/owncloud /usr/local/lib/owncloud
|
|
||||||
|
|
||||||
# If this isn't a new installation, immediately run the upgrade script.
|
|
||||||
# Then check for success (0=ok and 3=no upgrade needed, both are success).
|
|
||||||
if [ -f $STORAGE_ROOT/owncloud/owncloud.db ]; then
|
|
||||||
# ownCloud 8.1.1 broke upgrades. It may fail on the first attempt, but
|
|
||||||
# that can be OK.
|
|
||||||
sudo -u www-data php /usr/local/lib/owncloud/occ upgrade
|
|
||||||
if [ \( $? -ne 0 \) -a \( $? -ne 3 \) ]; then
|
|
||||||
echo "Trying ownCloud upgrade again to work around ownCloud upgrade bug..."
|
|
||||||
sudo -u www-data php /usr/local/lib/owncloud/occ upgrade
|
|
||||||
if [ \( $? -ne 0 \) -a \( $? -ne 3 \) ]; then exit 1; fi
|
|
||||||
sudo -u www-data php /usr/local/lib/owncloud/occ maintenance:mode --off
|
|
||||||
echo "...which seemed to work."
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
# ### Configuring ownCloud
|
|
||||||
|
|
||||||
# Setup ownCloud if the ownCloud database does not yet exist. Running setup when
|
|
||||||
# the database does exist wipes the database and user data.
|
|
||||||
if [ ! -f $STORAGE_ROOT/owncloud/owncloud.db ]; then
|
|
||||||
# Create user data directory
|
|
||||||
mkdir -p $STORAGE_ROOT/owncloud
|
|
||||||
|
|
||||||
# Create an initial configuration file.
|
|
||||||
instanceid=oc$(echo $PRIMARY_HOSTNAME | sha1sum | fold -w 10 | head -n 1)
|
|
||||||
cat > $STORAGE_ROOT/owncloud/config.php <<EOF;
|
|
||||||
<?php
|
|
||||||
\$CONFIG = array (
|
|
||||||
'datadirectory' => '$STORAGE_ROOT/owncloud',
|
|
||||||
|
|
||||||
'instanceid' => '$instanceid',
|
|
||||||
|
|
||||||
'forcessl' => true, # if unset/false, ownCloud sends a HSTS=0 header, which conflicts with nginx config
|
|
||||||
|
|
||||||
'overwritewebroot' => '/cloud',
|
|
||||||
'overwrite.cli.url' => '/cloud',
|
|
||||||
'user_backends' => array(
|
|
||||||
array(
|
|
||||||
'class'=>'OC_User_IMAP',
|
|
||||||
'arguments'=>array('{127.0.0.1:993/imap/ssl/novalidate-cert}')
|
|
||||||
)
|
|
||||||
),
|
|
||||||
'memcache.local' => '\\OC\\Memcache\\Memcached',
|
|
||||||
"memcached_servers" => array (
|
|
||||||
array('127.0.0.1', 11211),
|
|
||||||
),
|
|
||||||
'mail_smtpmode' => 'sendmail',
|
|
||||||
'mail_smtpsecure' => '',
|
|
||||||
'mail_smtpauthtype' => 'LOGIN',
|
|
||||||
'mail_smtpauth' => false,
|
|
||||||
'mail_smtphost' => '',
|
|
||||||
'mail_smtpport' => '',
|
|
||||||
'mail_smtpname' => '',
|
|
||||||
'mail_smtppassword' => '',
|
|
||||||
'mail_from_address' => 'owncloud',
|
|
||||||
'mail_domain' => '$PRIMARY_HOSTNAME',
|
|
||||||
);
|
|
||||||
?>
|
|
||||||
EOF
|
|
||||||
|
|
||||||
# Create an auto-configuration file to fill in database settings
|
|
||||||
# when the install script is run. Make an administrator account
|
|
||||||
# here or else the install can't finish.
|
|
||||||
adminpassword=$(dd if=/dev/urandom bs=1 count=40 2>/dev/null | sha1sum | fold -w 30 | head -n 1)
|
|
||||||
cat > /usr/local/lib/owncloud/config/autoconfig.php <<EOF;
|
|
||||||
<?php
|
|
||||||
\$AUTOCONFIG = array (
|
|
||||||
# storage/database
|
|
||||||
'directory' => '$STORAGE_ROOT/owncloud',
|
|
||||||
'dbtype' => 'sqlite3',
|
|
||||||
|
|
||||||
# create an administrator account with a random password so that
|
|
||||||
# the user does not have to enter anything on first load of ownCloud
|
|
||||||
'adminlogin' => 'root',
|
|
||||||
'adminpass' => '$adminpassword',
|
|
||||||
);
|
|
||||||
?>
|
|
||||||
EOF
|
|
||||||
|
|
||||||
# Set permissions
|
|
||||||
chown -R www-data.www-data $STORAGE_ROOT/owncloud /usr/local/lib/owncloud
|
|
||||||
|
|
||||||
# Execute ownCloud's setup step, which creates the ownCloud sqlite database.
|
|
||||||
# It also wipes it if it exists. And it updates config.php with database
|
|
||||||
# settings and deletes the autoconfig.php file.
|
|
||||||
(cd /usr/local/lib/owncloud; sudo -u www-data php /usr/local/lib/owncloud/index.php;)
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Update config.php.
|
|
||||||
# * trusted_domains is reset to localhost by autoconfig starting with ownCloud 8.1.1,
|
|
||||||
# so set it here. It also can change if the box's PRIMARY_HOSTNAME changes, so
|
|
||||||
# this will make sure it has the right value.
|
|
||||||
# * Some settings weren't included in previous versions of Mail-in-a-Box.
|
|
||||||
# * We need to set the timezone to the system timezone to allow fail2ban to ban
|
|
||||||
# users within the proper timeframe
|
|
||||||
# * We need to set the logdateformat to something that will work correctly with fail2ban
|
|
||||||
# Use PHP to read the settings file, modify it, and write out the new settings array.
|
|
||||||
TIMEZONE=$(cat /etc/timezone)
|
|
||||||
CONFIG_TEMP=$(/bin/mktemp)
|
|
||||||
php <<EOF > $CONFIG_TEMP && mv $CONFIG_TEMP $STORAGE_ROOT/owncloud/config.php;
|
|
||||||
<?php
|
|
||||||
include("$STORAGE_ROOT/owncloud/config.php");
|
|
||||||
|
|
||||||
\$CONFIG['trusted_domains'] = array('$PRIMARY_HOSTNAME');
|
|
||||||
|
|
||||||
\$CONFIG['memcache.local'] = '\\OC\\Memcache\\Memcached';
|
|
||||||
\$CONFIG['overwrite.cli.url'] = '/cloud';
|
|
||||||
\$CONFIG['mail_from_address'] = 'administrator'; # just the local part, matches our master administrator address
|
|
||||||
|
|
||||||
\$CONFIG['logtimezone'] = '$TIMEZONE';
|
|
||||||
\$CONFIG['logdateformat'] = 'Y-m-d H:i:s';
|
|
||||||
|
|
||||||
echo "<?php\n\\\$CONFIG = ";
|
|
||||||
var_export(\$CONFIG);
|
|
||||||
echo ";";
|
|
||||||
?>
|
|
||||||
EOF
|
|
||||||
chown www-data.www-data $STORAGE_ROOT/owncloud/config.php
|
|
||||||
|
|
||||||
# Enable/disable apps. Note that this must be done after the ownCloud setup.
|
|
||||||
# The firstrunwizard gave Josh all sorts of problems, so disabling that.
|
|
||||||
# user_external is what allows ownCloud to use IMAP for login. The contacts
|
|
||||||
# and calendar apps are the extensions we really care about here.
|
|
||||||
hide_output sudo -u www-data php /usr/local/lib/owncloud/console.php app:disable firstrunwizard
|
|
||||||
hide_output sudo -u www-data php /usr/local/lib/owncloud/console.php app:enable user_external
|
|
||||||
hide_output sudo -u www-data php /usr/local/lib/owncloud/console.php app:enable contacts
|
|
||||||
hide_output sudo -u www-data php /usr/local/lib/owncloud/console.php app:enable calendar
|
|
||||||
|
|
||||||
# When upgrading, run the upgrade script again now that apps are enabled. It seems like
|
|
||||||
# the first upgrade at the top won't work because apps may be disabled during upgrade?
|
|
||||||
# Check for success (0=ok, 3=no upgrade needed).
|
|
||||||
sudo -u www-data php /usr/local/lib/owncloud/occ upgrade
|
|
||||||
if [ \( $? -ne 0 \) -a \( $? -ne 3 \) ]; then exit 1; fi
|
|
||||||
|
|
||||||
# Set PHP FPM values to support large file uploads
|
|
||||||
# (semicolon is the comment character in this file, hashes produce deprecation warnings)
|
|
||||||
tools/editconf.py /etc/php5/fpm/php.ini -c ';' \
|
|
||||||
upload_max_filesize=16G \
|
|
||||||
post_max_size=16G \
|
|
||||||
output_buffering=16384 \
|
|
||||||
memory_limit=512M \
|
|
||||||
max_execution_time=600 \
|
|
||||||
short_open_tag=On
|
|
||||||
|
|
||||||
# Set up a cron job for owncloud.
|
|
||||||
cat > /etc/cron.hourly/mailinabox-owncloud << EOF;
|
|
||||||
#!/bin/bash
|
|
||||||
# Mail-in-a-Box
|
|
||||||
sudo -u www-data php -f /usr/local/lib/owncloud/cron.php
|
|
||||||
EOF
|
|
||||||
chmod +x /etc/cron.hourly/mailinabox-owncloud
|
|
||||||
|
|
||||||
# There's nothing much of interest that a user could do as an admin for ownCloud,
|
|
||||||
# and there's a lot they could mess up, so we don't make any users admins of ownCloud.
|
|
||||||
# But if we wanted to, we would do this:
|
|
||||||
# ```
|
|
||||||
# for user in $(tools/mail.py user admins); do
|
|
||||||
# sqlite3 $STORAGE_ROOT/owncloud/owncloud.db "INSERT OR IGNORE INTO oc_group_user VALUES ('admin', '$user')"
|
|
||||||
# done
|
|
||||||
# ```
|
|
||||||
|
|
||||||
# Enable PHP modules and restart PHP.
|
|
||||||
php5enmod imap
|
|
||||||
restart_service php5-fpm
|
|
|
@ -106,8 +106,6 @@ source setup/dkim.sh
|
||||||
source setup/spamassassin.sh
|
source setup/spamassassin.sh
|
||||||
source setup/web.sh
|
source setup/web.sh
|
||||||
source setup/webmail.sh
|
source setup/webmail.sh
|
||||||
source setup/owncloud.sh
|
|
||||||
source setup/zpush.sh
|
|
||||||
source setup/management.sh
|
source setup/management.sh
|
||||||
source setup/munin.sh
|
source setup/munin.sh
|
||||||
|
|
||||||
|
|
23
setup/web.sh
23
setup/web.sh
|
@ -55,29 +55,6 @@ tools/editconf.py /etc/php5/fpm/pool.d/www.conf -c ';' \
|
||||||
# since it depends on what domains we're serving, which we don't know
|
# since it depends on what domains we're serving, which we don't know
|
||||||
# until mail accounts have been created.
|
# until mail accounts have been created.
|
||||||
|
|
||||||
# Create the iOS/OS X Mobile Configuration file which is exposed via the
|
|
||||||
# nginx configuration at /mailinabox-mobileconfig.
|
|
||||||
mkdir -p /var/lib/mailinabox
|
|
||||||
chmod a+rx /var/lib/mailinabox
|
|
||||||
cat conf/ios-profile.xml \
|
|
||||||
| sed "s/PRIMARY_HOSTNAME/$PRIMARY_HOSTNAME/" \
|
|
||||||
| sed "s/UUID1/$(cat /proc/sys/kernel/random/uuid)/" \
|
|
||||||
| sed "s/UUID2/$(cat /proc/sys/kernel/random/uuid)/" \
|
|
||||||
| sed "s/UUID3/$(cat /proc/sys/kernel/random/uuid)/" \
|
|
||||||
| sed "s/UUID4/$(cat /proc/sys/kernel/random/uuid)/" \
|
|
||||||
> /var/lib/mailinabox/mobileconfig.xml
|
|
||||||
chmod a+r /var/lib/mailinabox/mobileconfig.xml
|
|
||||||
|
|
||||||
# Create the Mozilla Auto-configuration file which is exposed via the
|
|
||||||
# nginx configuration at /.well-known/autoconfig/mail/config-v1.1.xml.
|
|
||||||
# The format of the file is documented at:
|
|
||||||
# https://wiki.mozilla.org/Thunderbird:Autoconfiguration:ConfigFileFormat
|
|
||||||
# and https://developer.mozilla.org/en-US/docs/Mozilla/Thunderbird/Autoconfiguration/FileFormat/HowTo.
|
|
||||||
cat conf/mozilla-autoconfig.xml \
|
|
||||||
| sed "s/PRIMARY_HOSTNAME/$PRIMARY_HOSTNAME/" \
|
|
||||||
> /var/lib/mailinabox/mozilla-autoconfig.xml
|
|
||||||
chmod a+r /var/lib/mailinabox/mozilla-autoconfig.xml
|
|
||||||
|
|
||||||
# make a default homepage
|
# make a default homepage
|
||||||
if [ -d $STORAGE_ROOT/www/static ]; then mv $STORAGE_ROOT/www/static $STORAGE_ROOT/www/default; fi # migration #NODOC
|
if [ -d $STORAGE_ROOT/www/static ]; then mv $STORAGE_ROOT/www/static $STORAGE_ROOT/www/default; fi # migration #NODOC
|
||||||
mkdir -p $STORAGE_ROOT/www/default
|
mkdir -p $STORAGE_ROOT/www/default
|
||||||
|
|
|
@ -1,94 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
#
|
|
||||||
# Z-Push: The Microsoft Exchange protocol server
|
|
||||||
# ----------------------------------------------
|
|
||||||
#
|
|
||||||
# Mostly for use on iOS which doesn't support IMAP IDLE.
|
|
||||||
#
|
|
||||||
# Although Ubuntu ships Z-Push (as d-push) it has a dependency on Apache
|
|
||||||
# so we won't install it that way.
|
|
||||||
#
|
|
||||||
# Thanks to http://frontender.ch/publikationen/push-mail-server-using-nginx-and-z-push.html.
|
|
||||||
|
|
||||||
source setup/functions.sh # load our functions
|
|
||||||
source /etc/mailinabox.conf # load global vars
|
|
||||||
|
|
||||||
# Prereqs.
|
|
||||||
|
|
||||||
echo "Installing Z-Push (Exchange/ActiveSync server)..."
|
|
||||||
apt_install \
|
|
||||||
php-soap php5-imap libawl-php php5-xsl
|
|
||||||
|
|
||||||
php5enmod imap
|
|
||||||
|
|
||||||
# Copy Z-Push into place.
|
|
||||||
TARGETHASH=80cbe53de4ab8dd598d1f2af6f0a23fa396c529a
|
|
||||||
needs_update=0 #NODOC
|
|
||||||
if [ ! -f /usr/local/lib/z-push/version ]; then
|
|
||||||
needs_update=1 #NODOC
|
|
||||||
elif [[ $TARGETHASH != `cat /usr/local/lib/z-push/version` ]]; then
|
|
||||||
# checks if the version
|
|
||||||
needs_update=1 #NODOC
|
|
||||||
fi
|
|
||||||
if [ $needs_update == 1 ]; then
|
|
||||||
git_clone https://github.com/fmbiete/Z-Push-contrib $TARGETHASH '' /usr/local/lib/z-push
|
|
||||||
rm -f /usr/sbin/z-push-{admin,top}
|
|
||||||
ln -s /usr/local/lib/z-push/z-push-admin.php /usr/sbin/z-push-admin
|
|
||||||
ln -s /usr/local/lib/z-push/z-push-top.php /usr/sbin/z-push-top
|
|
||||||
echo $TARGETHASH > /usr/local/lib/z-push/version
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Configure default config.
|
|
||||||
sed -i "s^define('TIMEZONE', .*^define('TIMEZONE', '$(cat /etc/timezone)');^" /usr/local/lib/z-push/config.php
|
|
||||||
sed -i "s/define('BACKEND_PROVIDER', .*/define('BACKEND_PROVIDER', 'BackendCombined');/" /usr/local/lib/z-push/config.php
|
|
||||||
sed -i "s/define('USE_FULLEMAIL_FOR_LOGIN', .*/define('USE_FULLEMAIL_FOR_LOGIN', true);/" /usr/local/lib/z-push/config.php
|
|
||||||
sed -i "s/define('LOG_MEMORY_PROFILER', .*/define('LOG_MEMORY_PROFILER', false);/" /usr/local/lib/z-push/config.php
|
|
||||||
sed -i "s/define('BUG68532FIXED', .*/define('BUG68532FIXED', false);/" /usr/local/lib/z-push/config.php
|
|
||||||
sed -i "s/define('LOGLEVEL', .*/define('LOGLEVEL', LOGLEVEL_ERROR);/" /usr/local/lib/z-push/config.php
|
|
||||||
|
|
||||||
# Configure BACKEND
|
|
||||||
rm -f /usr/local/lib/z-push/backend/combined/config.php
|
|
||||||
cp conf/zpush/backend_combined.php /usr/local/lib/z-push/backend/combined/config.php
|
|
||||||
|
|
||||||
# Configure IMAP
|
|
||||||
rm -f /usr/local/lib/z-push/backend/imap/config.php
|
|
||||||
cp conf/zpush/backend_imap.php /usr/local/lib/z-push/backend/imap/config.php
|
|
||||||
|
|
||||||
# Configure CardDav
|
|
||||||
rm -f /usr/local/lib/z-push/backend/carddav/config.php
|
|
||||||
cp conf/zpush/backend_carddav.php /usr/local/lib/z-push/backend/carddav/config.php
|
|
||||||
|
|
||||||
# Configure CalDav
|
|
||||||
rm -f /usr/local/lib/z-push/backend/caldav/config.php
|
|
||||||
cp conf/zpush/backend_caldav.php /usr/local/lib/z-push/backend/caldav/config.php
|
|
||||||
|
|
||||||
# Configure Autodiscover
|
|
||||||
rm -f /usr/local/lib/z-push/autodiscover/config.php
|
|
||||||
cp conf/zpush/autodiscover_config.php /usr/local/lib/z-push/autodiscover/config.php
|
|
||||||
sed -i "s/PRIMARY_HOSTNAME/$PRIMARY_HOSTNAME/" /usr/local/lib/z-push/autodiscover/config.php
|
|
||||||
|
|
||||||
# Some directories it will use.
|
|
||||||
|
|
||||||
mkdir -p /var/log/z-push
|
|
||||||
mkdir -p /var/lib/z-push
|
|
||||||
chmod 750 /var/log/z-push
|
|
||||||
chmod 750 /var/lib/z-push
|
|
||||||
chown www-data:www-data /var/log/z-push
|
|
||||||
chown www-data:www-data /var/lib/z-push
|
|
||||||
|
|
||||||
# Add log rotation
|
|
||||||
|
|
||||||
cat > /etc/logrotate.d/z-push <<EOF;
|
|
||||||
/var/log/z-push/*.log {
|
|
||||||
weekly
|
|
||||||
missingok
|
|
||||||
rotate 52
|
|
||||||
compress
|
|
||||||
delaycompress
|
|
||||||
notifempty
|
|
||||||
}
|
|
||||||
EOF
|
|
||||||
|
|
||||||
# Restart service.
|
|
||||||
|
|
||||||
restart_service php5-fpm
|
|
Loading…
Reference in New Issue