Merge branch 'master' into no-standard-sqlite-db

This commit is contained in:
Evert Pot 2016-02-04 03:01:44 -05:00
commit 709eb19851
16 changed files with 137 additions and 883 deletions

6
.gitignore vendored
View file

@ -10,3 +10,9 @@ Specific/virtualhosts/baikal.apache2
# Composer stuff
composer.lock
vendor
# Build
/build
# Vim
.*.swp

73
CHANGELOG.md Normal file
View file

@ -0,0 +1,73 @@
ChangeLog
=========
0.3.0 (????-??-??)
------------------
* Now requires PHP 5.5.
* Upgraded to sabre/dav 3.1
* Support for WebDAV-Sync.
* Support for Calendar subscriptions.
* Support for iCalender and vCard export plugins.
* Created a central `dav.php` that does both carddav and caldav. `cal.php`
and `card.php` are still there, but will be removed in a future version.
* Added ability for users to change the calendar color.
* Moved server logic to a new class: `Baikal\Core\Server`.
* List of timezones is not generated from `DateTimeZone` class.
* Simplified packaging scripts into a Makefile.
* Fixed: bug when using a MySQL schema name that contains a whitespace.
* Twig is now a composer dependency.
* Moved documentation to sabre.io.
0.2.7 (2014-02-02)
------------------
* @jeromeschneider: New error detection: composer has not been installed.
* @Busch: added rewrite rules for apache2 hosts.
* @jeromeschneider: Corrected the http/https protocol detection.
* @josteink, @janpieper, @jaltek, @Jentsch, @GeeF and @fhemberger: Improved
INSTALL.md.
* @janpieper: Added CalDAV and CardDAV instructions for BlackBerry OS 10.
* James Lay: Add Quick & Dirty install guide for Ubuntu 12.04 in INSTALL.md.
* @torzak: Auth more compatible with Synology software.
* @skyhook19: Added Thunderbird CardDAV setup instructions.
* @cimm: Update OS X and iOS installation instructions.
* @Jentsch: Removing eXecutable flag from non executables like text files or
php scripts.
* @Jentsch: Adding eXecutable flag to a bash script.
* @altima: Improved CardDAV and CalDAV auth compatibility with Windows Phones.
* @fhemberger: Make calendar description optional.
* @fhemberger: Make HTML5 shiv a local resource.
* @fhemberger: Improve application security.
* @janpieper and @evert: Fixing #139: Prevent PHP from parsing your MySQL
credentials.
* Ships with sabre/dav 1.8.6
0.2.6 (2013-07-07)
------------------
* No changes
* Ships with sabre/dav 1.8.6
0.2.5 (2013-07-07)
------------------
* Baïkal releases are now based on composer thanks to @evert.
* Formal and Flake are not longer submodules
* Moved a few classes around.
* Ships with sabre/dav 1.8.6
0.2.4 (2012-11-18)
------------------
* Ships with sabre/dav 1.8.0
0.2.3 (2012-11-08)
-----------------
* Ships with sabre/dav 1.5.7

View file

@ -1,27 +0,0 @@
# 0.2.7
*Feb 2, 2014*
@jeromeschneider: New error detection: composer has not been installed
@Busch: added rewrite rules for apache2 hosts
@jeromeschneider: Corrected the http/https protocol detection
@josteink, @janpieper, @jaltek, @Jentsch, @GeeF and @fhemberger: Improved INSTALL.md
@janpieper: Added CalDAV and CardDAV instructions for BlackBerry OS 10
James Lay: Add Quick & Dirty install guide for Ubuntu 12.04 in INSTALL.md
@torzak: Auth more compatible with Synology software
@skyhook19: Added Thunderbird CardDAV setup instructions
@cimm: Update OS X and iOS installation instructions
@Jentsch: Removing eXecutable flag from non executables like text files or php scripts
@Jentsch: Adding eXecutable flag to a bash script
@altima: Improved CardDAV and CalDAV auth compatibility with Windows Phones
@fhemberger: Make calendar description optional
@fhemberger: Make HTML5 shiv a local resource
@fhemberger: Improve application security
@janpieper and @evert: Fixing #139: Prevent PHP from parsing your MySQL credentials
# 0.2.6
# 0.2.5
Upgraded SabreDAV from 1.8.0 to 1.8.6
Baïkal releases are now based on composer thanks to @evert

View file

@ -31,7 +31,7 @@ use PDO;
/**
* The Baikal Server
*
* This class sets up the underlying Sabre\DAV\Server object.
* This class sets up the underlying Sabre\DAV\Server object.
*
* @copyright Copyright (C) Jérôme Schneider <mail@jeromeschneider.fr>
* @author Evert Pot (http://evertpot.com/)
@ -41,63 +41,63 @@ class Server {
/**
* Is CalDAV enabled?
*
*
* @var bool
*/
protected $enableCalDAV;
/**
* is CardDAV enabled?
*
* @var bool
*
* @var bool
*/
protected $enableCardDAV;
/**
* "Basic" or "Digest"
*
* @var string
* "Basic" or "Digest"
*
* @var string
*/
protected $authType;
/**
* HTTP authentication realm
*
* @var string
* HTTP authentication realm
*
* @var string
*/
protected $authRealm;
/**
* Reference to Database object
*
* @var PDO
* Reference to Database object
*
* @var PDO
*/
protected $pdo;
/**
* baseUri for the sabre/dav server
*
* baseUri for the sabre/dav server
*
* @var string
*/
protected $baseUri;
/**
* The sabre/dav Server object
*
* @var \Sabre\DAV\Server
* The sabre/dav Server object
*
* @var \Sabre\DAV\Server
*/
protected $server;
/**
* Creates the server object.
*
* @param bool $enableCalDAV
* @param bool $enableCardDAV
* @param string $authType
* @param string $authRealm
* @param PDO $pdo
* @param string $baseUri
* Creates the server object.
*
* @param bool $enableCalDAV
* @param bool $enableCardDAV
* @param string $authType
* @param string $authRealm
* @param PDO $pdo
* @param string $baseUri
*/
function __construct($enableCalDAV, $enableCardDAV, $authType, $authRealm, PDO $pdo, $baseUri) {
@ -114,7 +114,7 @@ class Server {
/**
* Starts processing
*
*
* @return void
*/
function start() {
@ -145,7 +145,7 @@ class Server {
$nodes[] = new \Sabre\CalDAV\CalendarRoot($principalBackend, $calendarBackend);
}
if ($this->enableCardDAV) {
$carddavBackend = new \Sabre\CardDAV\Backend\PDO($GLOBALS["DB"]->getPDO());
$carddavBackend = new \Sabre\CardDAV\Backend\PDO($GLOBALS["DB"]->getPDO());
$nodes[] = new \Sabre\CardDAV\AddressBookRoot($principalBackend, $carddavBackend);
}

View file

@ -1,80 +0,0 @@
#!/usr/bin/env sh
TEMPDATE="`date +%Y-%m-%d-%H-%M-%S`"
TEMPDIR="/tmp/baikal-flat-$TEMPDATE-temp"
TEMPARCHIVE="$TEMPDIR/temparchive.tgz"
TEMPDIRDEREFERENCE="/tmp/baikal-flat-$TEMPDATE"
echo "########################################################################"
echo "#"
echo "# Baïkal Packaging script"
echo "#"
echo "# Packaging project for flat distribution (replacing symlinks"
echo "# by their target). Useful for FTP deployment"
echo "#"
echo "# TEMPDIR: $TEMPDIR"
rm -rf /tmp/baikal-flat
# Export Project
# Requires the git-archive-all script by https://github.com/Kentzo (https://github.com/Kentzo/git-archive-all)
mkdir $TEMPDIR && \
git-archive-all --force-submodules $TEMPARCHIVE && \
cd $TEMPDIR && tar -xzf $TEMPARCHIVE && rm $TEMPARCHIVE && \
# Dereferencig symlinks
cp -RfL $TEMPDIR $TEMPDIRDEREFERENCE && \
rm -Rf $TEMPDIR && \
TEMPDIR=$TEMPDIRDEREFERENCE/temparchive && \
# Jump to tempdir
cd $TEMPDIR && \
# Cleaning Resources
rm -f Core/Resources/Web/README.md && \
rm -Rf Core/Resources/Web/TwitterBootstrap && \
# Cleaning Scripts
rm -Rf Core/Scripts && \
rm -Rf Core/Frameworks/Baikal/Scripts && \
# Cleaning WWWRoot
rm -Rf Core/Frameworks/Baikal/WWWRoot && \
rm -Rf Core/Frameworks/BaikalAdmin/WWWRoot && \
# Cleaning Specific/Virtualhosts
rm -Rf Specific/virtualhosts && \
# Installing dependencies (composer)
composer install && \
# Removing composer stuff
rm -f composer.* && \
# Moving HTML roots
mv html/* . && \
mv html/.htaccess . && \
rm -Rf html && \
# Tagging Distrib
cat Core/Distrib.php | sed -e "s/\"regular\"/\"flat\"/g" > Core/Distrib2.php && \
rm -f Core/Distrib.php && \
mv Core/Distrib2.php Core/Distrib.php && \
# Deploy empty DB
mkdir -p Specific/db && \
cp Core/Resources/Db/SQLite/db.sqlite Specific/db && \
# Add ENABLE_INSTALL
touch Specific/ENABLE_INSTALL && \
# Zipping package
cd .. && \
mv $TEMPDIR baikal-flat && \
zip -r baikal-flat.zip baikal-flat && \
mv baikal-flat.zip ~/Desktop/ && \
# Displaying result
echo "# Success: ~/Desktop/baikal-flat.zip"

View file

@ -1,53 +0,0 @@
#!/usr/bin/env sh
TEMPDATE="`date +%Y-%m-%d-%H-%M-%S`"
TEMPDIR="/tmp/baikal-regular-$TEMPDATE"
TEMPARCHIVE="$TEMPDIR/temparchive.tgz"
echo "########################################################################"
echo "#"
echo "# Baïkal Packaging script"
echo "#"
echo "# Packaging project for regular distribution"
echo "#"
echo "# TEMPDIR: $TEMPDIR"
rm -rf /tmp/baikal-regular
# Export Project
# Requires the git-archive-all script by https://github.com/Kentzo (https://github.com/Kentzo/git-archive-all)
mkdir -p $TEMPDIR && \
git-archive-all --force-submodules $TEMPARCHIVE && \
cd $TEMPDIR && tar -xzf $TEMPARCHIVE && rm $TEMPARCHIVE && \
TEMPDIR=$TEMPDIR/temparchive && \
# Jump to tempdir
cd $TEMPDIR && \
# Cleaning Scripts
rm -Rf Core/Scripts && \
rm -Rf Core/Frameworks/Baikal/Scripts && \
# Deploy empty DB
mkdir -p Specific/db && \
cp Core/Resources/Db/SQLite/db.sqlite Specific/db && \
# Add ENABLE_INSTALL
touch Specific/ENABLE_INSTALL && \
# Installing dependencies (composer)
composer install && \
# Removing composer stuff
rm -f composer.* && \
# GZipping package
cd .. && \
mv $TEMPDIR baikal-regular && \
tar -cvzf baikal-regular.tgz baikal-regular && \
mv baikal-regular.tgz ~/Desktop/ && \
# Displaying result
echo "# Success: ~/Desktop/baikal-regular.tgz"

View file

@ -117,11 +117,6 @@ CREATE TABLE groupmembers (
UNIQUE(principal_id, member_id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
INSERT INTO principals (uri,email,displayname) VALUES
('principals/admin', 'admin@example.org','Administrator'),
('principals/admin/calendar-proxy-read', null, null),
('principals/admin/calendar-proxy-write', null, null);
CREATE TABLE propertystorage (
id INT UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT,
path VARBINARY(1024) NOT NULL,
@ -137,6 +132,3 @@ CREATE TABLE users (
digesta1 VARBINARY(32),
UNIQUE(username)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
INSERT INTO users (username,digesta1) VALUES
('admin', '87fd274b7b6c01e48d7c2f965da8ddf7');

View file

@ -118,10 +118,6 @@ CREATE TABLE groupmembers (
);
INSERT INTO principals (uri,email,displayname) VALUES ('principals/admin', 'admin@example.org','Administrator');
INSERT INTO principals (uri,email,displayname) VALUES ('principals/admin/calendar-proxy-read', null, null);
INSERT INTO principals (uri,email,displayname) VALUES ('principals/admin/calendar-proxy-write', null, null);
CREATE TABLE propertystorage (
id integer primary key asc,
path text,
@ -139,5 +135,3 @@ CREATE TABLE users (
UNIQUE(username)
);
INSERT INTO users (username,digesta1) VALUES
('admin', '87fd274b7b6c01e48d7c2f965da8ddf7');

View file

@ -1,455 +0,0 @@
# INSTALLING Baïkal
This document is a part of the Baïkal project. Baïkal is an open
source lightweight CalDAV and CardDAV server released under the GNU GPL. Baïkal
is copyright (c) 2013-2014 Net Gusto.
Baïkal homepage is http://baikal-server.com
This document describes the system requirements for Baïkal and the
installation routine.
# 1 - System requirements
Baïkal is based on PHP 5.3.1+, and uses a SQLite3 or MySQL 5.5+ with PHP PDO. This
document does not cover the installation of these requirements.
## 1.1 - System requirements for FTP-driven hosting
The following configuration is the minimum required:
- an hosted webserver running apache 2 and PHP 5.3.1+
- SQLite3 or MySQL 5.5+
- PHP 5.3.1 or newer with the following extensions:
- PDO and SQLite3 or MySQL
- DOM (php-xml)
Some extensions can be optionally compiled into PHP. A list of loaded
extensions can be checked using the phpinfo() function.
- 30 MB of disk space
## 1.2 - System requirements for dedicated server hosting
The following configuration is the minimum required:
- an Apache2 web server capable of running PHP, and accessible through a
dedicated subdomain (something like "dav.mydomainname.com")
NOTE: this document only covers sub-domain based installations. Other
installations modes are possible, though not documented (yet).
- root access to a command line on this server
NOTE: tools to create and manage users are command line only. Web-based
interfaces will be produced in the future.
- PHP 5.3.1 or newer with the following extensions:
- PDO and SQLite3 or MySQL
- DOM (php-xml)
Some extensions can be optionally compiled into PHP. A list of loaded
extensions can be checked using the phpinfo() function.
- SQLite3 or MySQL 5.5+
- 30 MB of disk space
# 2 - Obtaining Baïkal
To get Baïkal, navigate to the following location:
http://baikal-server.com
# 3 - Installation
## 3.1 - Installing Baïkal on a FTP-driven hosting
To install Baïkal on a FTP-driven hosting:
* Download the "Baikal Flat package for FTP"
* Unzip the package on you computer
* Send the unzipped package on the remote host via FTP
* (optional) Rename the Baïkal folder to whatever you want
* Navigate to the HTTP URL where you just uploaded Baïkal
* Follow the instructions of the initialization web tool
## 3.2 - Installing Baïkal on a dedicated host
### 3.2.1 Using the Baïkal "regular package"
#### 3.2.1.1 - Unpacking files
To install Baïkal on a dedicated host, download the "Regular package".
Unpack the source package outside of the web site root
directory on your server. The location must be accessible to the web server.
Usually, it will be something like /var/www/
```sh
# a. Enter the directory where the websites are stored
$ root:~> cd /var/www
```
Unpacking will produce a directory with a name like baikal-x.y.z, where x.y.z
correspond to the Baïkal version. For example, the Baïkal 0.2.0 source package
will create a directory named baikal-0.2.0
```sh
# b. Unpack the package using:
$ root:/var/www> tar xzf baikal-0.2.0.tgz
```
Rename the untar'd directory to the name of your baikal dedicated subdomain.
```sh
# c. Rename the directory to match your domain (good practice)
$ root:/var/www> mv baikal-0.2.0 dav.mydomain.com
# d. Enter the new Baïkal directory
$ root:/var/www> cd dav.mydomain.com
```
In order to grant Apache access to the files of your Baïkal installation,
you'll have to grant the user running the apache process r+w permissions on
the Baïkal files. In our example, we will suppose the linux username/usergroup
running Apache is www-data:www-data
```sh
# e. Change permissions on the files
$ root:/var/www/dav.mydomain.com> chown www-data:www-data Specific -Rf
```
#### 3.2.1.2 - Setting up a Web Server
Baikal must be bound to a domain/subdomain in order to run properly.
This package provides default virtualhost configuration files for Apache 2 and for nginx in
Specific/virtualhosts/
To enable your host to run Baikal, you'll have to add the Baikal virtualhost
to your Web Server environment.
##### Setting up the Apache virtualhost
In our example, we will assume that the apache2 configuration directory is: `/etc/apache2`
```sh
# a. Enter the Apache2 configuration directory
$ root:/var/www> cd /etc/apache2
# b. Enter the sites-available directory
$ root:/etc/apache2> cd sites-available
# c. Symlink the Baikal virtualhost file to this directory
$ root:/etc/apache2/sites-available> ln -s /var/www/dav.mydomain.com/Specific/virtualhosts/baikal.apache2
# d. Customize the virtualhost config file
$ root:/etc/apache2/sites-available> nano baikal.apache2
# e. In baikal.apache2, replace references to dav.mydomain.com with your own domain name
# f. Activate the new virtualhost
$ root:/etc/apache2/sites-available> cd ../sites-enabled
$ root:/etc/apache2/sites-enabled> ln -s ../sites-available/baikal.apache2
# h. Restart apache
$ root:/etc/apache2/sites-enabled> /etc/init.d/apache2 restart
```
##### Setting up the nginx virtualhost
In our example, we will assume that the nginx configuration directory is: `/etc/nginx`
```sh
# a. Enter the nginx configuration directory
$ root:/var/www> cd /etc/nginx
# b. Enter the sites-available directory
$ root:/etc/nginx> cd sites-available
# c. Symlink the Baikal virtualhost file to this directory
$ root:/etc/nginx/sites-available> ln -s /var/www/dav.mydomain.com/Specific/virtualhosts/baikal.nginx
# d. Customize the virtualhost config file
$ root:/etc/nginx/sites-available> nano baikal.nginx
# e. In baikal.nginx, replace references to dav.mydomain.com with your own domain name.
# It may be possible that you have to modify the value of the fastcgi_pass directive too.
# Please consult your server's documentation if you receive a 404 error.
# f. Activate the new virtualhost
$ root:/etc/nginx/sites-available> cd ../sites-enabled
$ root:/etc/nginx/sites-enabled> ln -s ../sites-available/baikal.nginx
# h. Restart nginx
$ root:/etc/nginx/sites-enabled> /etc/init.d/nginx restart
```
#### 3.2.1.3 - Setting up Baïkal
To enable the installation tool you have to create a temporary file.
```sh
# Replace with your actual document root
$ root: cd /var/www/dav.mydomain.com touch Specific/ENABLE_INSTALL
```
In a web browser, navigate to http://dav.mydomain.com and follow the instructions of the initialization web tool
### 3.2.2 Using Baïkal "Bleeding-edge" version for developers (requires git and composer)
Baïkal "Bleeding-edge" is using composer to install its dependencies. Please check that you have git and composer installed on your system before going any further.
```sh
# a. Checkout the Baïkal source code
$ root:/var/www> git clone https://github.com/jeromeschneider/Baikal.git dav.mydomain.com
# b. Enter the new dav.mydomain.com directory
$ root:/var/www> cd dav.mydomain.com
```
In order to grant Apache access to the files of your Baïkal installation,
you'll have to grant the user running the apache process `r+w` permissions on
the Baïkal files. In our example, we will suppose the linux username/usergroup
running Apache is `www-data:www-data`
```sh
# c. Install Baïkal dependencies using composer
$ root:/var/www/dav.mydomain.com> composer install
# d. Change permissions on the files
$ root:/var/www/dav.mydomain.com> chown www-data:www-data . -Rf
```
You now have to declare Baïkal in your webserver. You may follow instructions in **"3.2.1.2 - Setting up a Web Server"** above to do so.
# 4 - Accessing the Baïkal Web Admin
Navigate to http://dav.mydomain.com/admin/
# 5 - Connecting your CalDAV / CardDAV client to Baïkal
## 5.1 - Apple Calendar (OS X):
Note: Calendar is called iCal on older OS X versions.
Add a new CalDAV account:
* In Preferences... > Accounts click the `+` button
* Follow the wizard:
* Account Type: CalDAV
* User Name: the username you just created (in our example, jerome)
* Password: the password you just defined
* Server Address: http://dav.mydomain.com/cal.php/principals/jerome (replace domain and username)
* Change the account description if you want
## 5.2 - Apple Calendar (iOS):
Add a new CalDAV account:
* In Settings > Mail, Contacts, Calendar > Add Account > Other
* Tap Add CalDAV Account under CALENDARS
* Configure your account:
* Server: http://dav.mydomain.com/cal.php/principals/jerome (replace domain and username)
* User Name: the username you just created (in our example, jerome)
* Password: the password you just defined
* Description: optional, whatever you want
* Tap Next
## 5.3 - Apple Contacts (OS X):
Note: Contacts is called Address Book on older OS X versions.
Add a new CardDAV account:
* In Preferences... > Accounts click the `+` button
* Follow the wizard:
* Account Type: CardDAV
* User name: the username you just created (in our example, jerome)
* Password: the password you just defined
* Server address: http://dav.mydomain.com/card.php/addressbooks/jerome/default (replace domain and username)
* Change the account description if you want
## 5.4 - Apple Contacts (iOS):
Add a new CardDAV account:
* in Settings > Mail, Contacts, Calendar > Add Account > Other
* Tap Add CardDAV Account under CONTACTS
* Configure your account:
* Server: dav.mydomain.com/card.php (note: no http:// nor https://, and no trailing slash)
* User Name: the username you just created (in our example, jerome)
* Password: the password you just defined
* Description: optional, whatever you want
* Tap Next
It can take a little while as iOS seems to look for a secure connection first. It will show a popup when it doesn't find any certificates. Accept this when you are **not** using Baikal over SSL.
## 5.5 - Thunderbird/SOGo connector:
Add a new CardDAV account:
* Install "SOGo Connector Thunderbird extension" (http://sogo.nu/downloads/frontends.html)
* Navigate to "Address book" > "New" > "Remote address book"
* paste this URL: http://dav.mydomain.com/card.php/addressbooks/username/default/ of and replace the domain name, and the username with the correct values
* When asked, provide user/password; your CardDAV account should be up and running
* **Important notes**: some users reported that, for SOGo to work, you have to host your baikal on a **https** line, and keep usernames simple (no '@' in the username or any non ascii-alphanumeric char)
## 5.6 - Thunderbird/Lightning:
Add a new CalDAV account:
* Navigate to "Lightning" > "New account" > "On the network" > "URL"
* paste this URL: http://dav.mydomain.com/cal.php/calendars/username/default of and replace the domain name, and the username with the correct values
* When asked, provide user/password; your CalDAV account should be up and running
* Note: if you need to get access to multiple Baikal accounts on the same server, you need to change the multirealm settings in Thunderbirds about:config. Go to "Tools" => "Options" => "Advanced" => "Config Editor". Search for "calendar.network.multirealm" and change the default (false) to "true". Delete all passwords and restart Thunderbird. Now each calendar asks for a user / password.
**Hint**: Thunderbird's password manager can only store one authentication per auth realm. Thus you can't use two calendars with two different credentials. This problem can be solved by adding the credentials to the URL, like `http://username:password@dav.mydomain.com/cal.php/calendars/username/default`
## 5.7 BlackBerry OS10
Add a new CalDAV account:
* in Settings > Accounts > Add Account > Advanced
* Select "CalDAV"
* Username: the username you just created
* Password: the password you just defined
* Server Address: `dav.mydomain.com/cal.php/calendars/username/default` and replace domain and username with the correct values
Add a new CardDAV account:
* in Settings > Accounts > Add Account > Advanced
* Select "CardDAV"
* Username: the username you just created
* Password: the password you just defined
* Email Address: an email address you want this CardDAV account to be assigned to
* Server Address: `dav.mydomain.com/card.php/addressbooks/username/default` and replace domain and username with the correct values
__Important notes:__
* Make sure you've configured Baikal to use `basic` as authentication mechanism.
* Its required to use SSL for CardDAV!
## 5.8 Windows Phone 8.1 (Developer Preview)
Add a new CalDAV/CardDAV account:
* in Settings > email+accounts > Add an Account > iCloud
* Username: the username you just created
* Password: the password you just defined
* Select Advanced Settings
* Contacts server (CardDAV): `dav.mydomain.com/card.php/addressbooks/username/default` and replace domain and username with the correct values
* Calendar server (CalDAV): `dav.mydomain.com/cal.php/calendars/username/default` and replace domain and username with the correct values
* You can optional activate/deactivate content that will be synced
## 5.9 Android (4.1.2) SG2
Add a new CalDAV account:
* Download a DAV Sync Client (i.e. DAVdroid; if DAVdroid, see 5.10 below also)
* Add a new DAVdroid account
* I.e. enter the following URL-Format for CalDAV: `http://dav.mydomain.com/cal.php/calendars/<username>/default/ or http://YOUR_IP/cal.php/calendars/<username>/default/`
* Use your email-address as account name
* Mark your calendar as active on your device: In the Calendar-App select Settings/Calendar and activate it.
* Sync it
Add a new CardDAV account:
* Add a new DAVdroid account
* I.e. enter the following URL-Format for CalDAV: `http://dav.mydomain.com/card.php/addressbooks/<username>/default/ or http://YOUR_IP/card.php/addressbooks/<username>/default/`
* Use your email-address as account name
* In the Phone-App select Contacts/Accounts select the 2nd DAVdroid and Synchronize Contacts.
* Sync it
__Note__
* If you want to synchronize your current contacts to the server export it to USB and Import it again as DAVdroid contacts
* Sync it
## 5.10 DAVdroid (Android)
Android does not support CardDAV or CalDAV out of the box so you'll need a 3rd party client. There are multiple options available. Here we'll have a look at [DAVdroid](http://davdroid.bitfire.at/), an open-source CalDAV/CardDAV synchronization app for Android 4+. The app is available on [many different stores](http://davdroid.bitfire.at/download), and even on the FOSS [F-Droid](https://f-droid.org/repository/browse/?fdfilter=carddav&fdid=at.bitfire.davdroid) one. Install the app from your favourite store.
Add a CalDAV account:
* In Settings > Accounts > Add account
* Tap DAVdroid
* Follow the wizard
* Select `http://` or `https://` and add the path to your CalDAV server: `dav.mydomain.com/cal.php/principals/jerome` (replace domain and username)
* User name: the username you just created (in our example, jerome)
* Password: the password you just defined
* Leave the preemptive authentication `checked`
* Tap `→`
* Select the calendar(s) you want to sync
* Tap `→`
* Choose a unique account name (has to be different from the CardDAV one)
* Tap `✓`
DAVdroid should now start syncing your calendar(s), give it some time.
Add a CardDAV account:
* In Settings > Accounts > Add account
* Tap DAVdroid
* Follow the wizard
* Select `http://` or `https://` and add the path to your CardDAV server: `dav.mydomain.com/card.php/addressbooks/jerome/default` (replace domain and username)
* User name: the username you just created (in our example, jerome)
* Password: the password you just defined
* Leave the preemptive authentication `checked`
* Tap `→`
* Select the address book you want to sync
* Tap `→`
* Choose a unique account name (has to be different from the CalDAV one)
* Tap `✓`
DAVdroid should now start syncing your address book, give it some time.
# 6 - You're done
You may now create new calendars, new events, new contact (: Enjoy.
# 7 - Troubleshooting
Please read TROUBLESHOOTING.md in this folder.
# 8 - User contributed quick & dirty install guides
## Ubuntu 12.04 - James Lay & Frederic Hemberger
```sh
cd /var/www
sudo chown -R www-data:www-data baikal
mysql -u root -p #password#
```
```mysql
CREATE DATABASE baikal;
GRANT DELETE, INSERT, SELECT, UPDATE, CREATE ON baikal.* TO 'baikal'@'localhost' IDENTIFIED BY '#password#';
exit
```
```sh
mysql -u root -p #password# -D baikal < /var/www/baikal/Core/Resources/Db/MySQL/db.sql
sudo touch /var/www/baikal/Specfic/ENABLE_INSTALL
sudo chown www-data /var/www/baikal/Specific/ENABLE_INSTALL
sudo vi /etc/apache2/sites-available/baikal
```
```plain
<VirtualHost *:80>
ServerName baikal
DocumentRoot /var/www/baikal
ErrorLog /var/logsbaikal.error_log
TransferLog /var/log/baikal.access_log
LogLevel warn
<Directory "/var/www/baikal">
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
```
```sh
sudo ln -s /etc/apache2/sites-available/baikal /etc/apache2/sites-enabled
sudo service apache2 restart
```
Point your browser to http://hostname/baikal and there you go.

View file

@ -1,5 +1,20 @@
.PHONY: build-assets
.PHONY: build-assets dist clean
BUILD_DIR="build/baikal"
BUILD_FILES=Core html Specific ChangeLog.md LICENSE.txt README.md composer.json
VERSION=$(shell php -r "include 'Core/Distrib.php'; echo BAIKAL_VERSION;")
dist: vendor/autoload.php
# Building Baikal $(VERSION)
rm -r $(BUILD_DIR)
mkdir -p $(BUILD_DIR)
cp -R $(BUILD_FILES) $(BUILD_DIR)
touch $(BUILD_DIR)/Specific/ENABLE_INSTALL
composer install -d $(BUILD_DIR)
rm $(BUILD_DIR)/composer.*
cd build; zip -r baikal-$(VERSION).zip baikal/
build-assets: vendor/autoload.php
cat vendor/sabre/dav/examples/sql/mysql.*.sql > Core/Resources/Db/MySQL/db.sql
@ -10,4 +25,3 @@ vendor/autoload.php: composer.lock
composer.lock: composer.json
composer update

View file

@ -1,51 +1,19 @@
# 1. About this package
Baïkal
======
This package contains a release of Baïkal.
Go to http://baikal-server.com to get more information about this package, and upgrades.
This is the source repository for the Baïkal CalDAV and CardDAV server.
# 2. What is Baïkal ?
* Go to [baikal-server.com][1] to get more information about this project.
* Head to [sabre.io/baikal][2] for information about installation, upgrading
and troubleshooting.
Baïkal is an open source lightweight CalDAV and CardDAV server. It's developped
by Jérôme Schneider and based on the excellent [SabreDAV](http://code.google.com/p/sabredav/ "SabreDAV") project.
Baïkal is distributed under the GPL license.
Credits
-------
To get more info about the GPL license, visit
http://www.opensource.org/licenses/gpl-license.php.
Bäikal is developed by [Jérôme Schneider][3] from [Net Gusto][3] and [fruux][4].
Many thanks to Daniel Aleksandersen (@zcode) for greatly improving the quality of the project page (http://baikal-server.com).
# 3. Baïkal requirements
Baïkal is based on PHP 5.3.1+, and uses a SQLite3 or MySQL with PHP PDO. For more
information regarding these requirements see the INSTALL.md file in this folder.
# 4. What should you do if you have a problem ?
1. Read the available documentation carefully
2. Search the web carefully about Baïkal CalDAV CardDAV
3. If you have identified a genuine new bug,
report it at https://github.com/jeromeschneider/Baikal/issues
# 5. How to install / configure Baïkal
Please read INSTALL.md in this folder.
# 6. How to configure my CalDAV / CardDAV client ?
Please read INSTALL.md in this folder.
# 7. How to upgrade my Baïkal server to a new version ?
Please read UPGRADE.md in this folder.
# 8. Troubleshooting
Please read TROUBLESHOOTING.md in this folder.
# 9. Credits
Baïkal is developed by Jérôme Schneider.
Jérôme Schneider (@jeromeschneider) is admin and lead developer.
Many thanks to Daniel Aleksandersen (@zcode) for greatly improving the quality of the project page (http://baikal-server.com). Much appreciated, Daniel :)
-- Jérôme Schneider <mail@jeromeschneider.fr> Mon, 21 Aug 2012 12:17:00 +0100
[1]: http://baikal-server.com/
[2]: http://sabre.io/baikal/
[3]: http://netgusto.com/
[4]: https://fruux.com/

View file

@ -1,16 +0,0 @@
<VirtualHost *:80>
DocumentRoot /var/www/dav.mydomain.com/html
ServerName dav.mydomain.com
RewriteEngine On
RewriteRule /.well-known/carddav /card.php [R,L]
RewriteRule /.well-known/caldav /cal.php [R,L]
<Directory "/var/www/dav.mydomain.com/html">
Options None
Options +FollowSymlinks
AllowOverride All
</Directory>
</VirtualHost>

View file

@ -1,31 +0,0 @@
server {
listen 80;
server_name dav.mydomain.com;
root /var/www/dav.mydomain.com/html;
index index.php;
rewrite ^/.well-known/caldav /cal.php redirect;
rewrite ^/.well-known/carddav /card.php redirect;
charset utf-8;
location ~ /(\.ht|Core|Specific) {
deny all;
return 404;
}
location ~ ^(.+\.php)(.*)$ {
try_files $fastcgi_script_name =404;
fastcgi_split_path_info ^(.+\.php)(.*)$;
fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
include /etc/nginx/fastcgi_params;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /var/www/nginx-default;
}
}

View file

@ -1,115 +0,0 @@
# 1. About this package
This package contains a release of Baïkal.
Go to http://baikal-server.com to get more information about this package, and upgrades.
# 2. Problem with authentication (CalDAV and CardDAV)
On webservers where PHP is served as FastCGI (check your phpinfo()
to find out if that's the case for you), Apache does not pass HTTP
Auth informations to PHP, and thus preventing Cal/CardDAV to auth
requests properly.
Baïkal tries to address this issue by re-routing HTTP Auth informations
using Apaches mod_rewrite. This is done by the Apache config directives
found in the /.htaccess file that comes with Baïkal (or /html/.htaccess
for the non-ftp package).
Note: if this file is empty / does not exist, you should try to add it manually
(sometimes FTP clients decide to not send files with names beginning with a dot ".")
# 3. Troubleshooting calendar access (please check 2. first)
To troubleshoot user auth / data access, you may use curl to debug server responses. On a command line, run:
curl -so - --digest --user username:password http://hostname/cal.php/calendars/username/default
(Be sure that the username exists, has the right password set, and has a calendar named default first).
If you see this, auth works for this username/password/calendar, so it has to be client-related:
GET is only implemented on File objects
If you see this, password is wrong (case-sensitive) (despite the message indicating that it's the username):
Incorrect username
If you see this, username is wrong:
The supplied username was not on file
If you see this, auth works but the "principals" part of the URL is wrong (the /username/ after "calendars" in the URL):
Principal with name username not found
If you see this, auth works but the calendar does not exist for this user:
Calendar with name 'defaults' could not be found
If you see this, auth works and the calendar exists, but the provided user has no permission to access this calendar:
Sabre_DAVACL_Exception_NeedPrivileges
If you see one of these, the URL is not well formed / invalid:
File not found: XXXXX in 'root'
Or
The requested URL XXXXX was not found on this server.
If you see nothing at all, curl cannot resolve your host.
# 4. Database is readonly (sqlite)
Using SQLite (the default setup), if you have troubles when putting data in the database,
(an exception "unable to open database file" is thrown) check that:
* the system user running your Apache/PHP has write permissions on Specific/db/ (*the folder*)
* the system user running your Apache/PHP has write permissions on Specific/db/db.sqlite (*the file*)
# 5. Problems with PHP and CGI / FastCGI
Quoting @RubenMarsman
> Hi,
>
> Even with the given workarounds, I still can't authenticate using either Basic or Digest authentication. The problem is that my webhoster runs PHP as CGI and somehow writing the http authenticate header in the (REDIRECT_)HTTP_AUTHORIZATION variable does not work.
> I've seen similar problems on forums of owncloud.
> There is another workaround that helps, but somehow it only works for Basic authentication. With Digest, the http authenticate header is always empty. I don't know what causes this behaviour at my hoster.
> **My workaround:**
> in .htaccess add the lines to store the authorization header in the REMOTE_USER variable.
> ```
> <IfModule mod_rewrite.c>
> RewriteEngine On
> RewriteRule .* - [E=REMOTE_USER:%{HTTP:Authorization}]
> </IfModule>
> ```
> In both cal.php and card.php add the lines to use this value:
> ```
> if ((isset($_SERVER['REDIRECT_HTTP_AUTHORIZATION'])==false) && (isset($_SERVER['REDIRECT_REMOTE_USER'])))
> {
> $_SERVER['REDIRECT_HTTP_AUTHORIZATION']=$_SERVER['REDIRECT_REMOTE_USER'];
> }
> ```
>
# 6. Problems with nginx when running Baïkal in a subdirectory
See https://github.com/netgusto/Baikal/issues/212
# 7. Problems with eAccelerator (Function name must be a string [...])
Quoting @jeff-h on https://github.com/netgusto/Baikal/issues/136
>
> My web hosting came with eAccelerator already installed. It seems this is incompatible with Baikal (or more accurately the SabreDav library). The error was:
>
> Fatal error: Function name must be a string in .../vendor/sabre/dav/lib/Sabre/DAV/Server.php on line 235
>
> I fixed this by turning off eAccelerator for my install, by putting the following in my .htaccess:
>
> php_flag eaccelerator.enable 0
> php_flag eaccelerator.optimizer 0
>
See also <http://comments.gmane.org/gmane.comp.php.sabredav/670>

View file

@ -1,16 +0,0 @@
This document explains how to upgrade your Baïkal installation
## Upgrading Baïkal
1. First thing, if you are using MySQL, backup your database. If you are using SQLite, your db file is in the `Specific` folder, backup this folder.
2. Rename your Baïkal root folder. For example from `/var/baikal` to `/var/baikal-old`
3. Download and unzip baïkal to exact folder of your old installation: `/var/baikal` in our example.
4. Replace the folder `baikal/Specific` (the new one) by `baikal-old/Specific` (the old one) (even for MySQL)
5. If working on SSH, apply correct ownership/permissions to files.
1. For the ownership, you can refer to the old installation `baikal-old`. Use `ls -l baikal-old/` command to see the ownership (for example `root:www-data`), and then set them with `sudo chown -Rf root:www-data baikal`
2. For the permissions, you can execute the following command: `sudo chmod -Rf 770 baikal`
6. Using your browser, navigate to your baikal admin, the Upgrade wizard should start.
## Troubleshooting
See TROUBLESHOOTING.md