Coquelicot
==========
-Coquelicot is a "one-click" file sharing web application with specific
-thoughts on protecting users privacy.
+Coquelicot is a "one-click" file sharing web application with a specific
+focus on protecting users' privacy.
-Basic principle: users can upload a file to the server, it return they
-get a unique URL which can be shared to others in order to download the
-file.
+Basic principle: users can upload a file to the server, in return they
+get a unique URL which can be shared with others in order to download
+the file.
-Coquelicot aims to protect, to some extents, users and system
-administrators from disclosure of the files exchanged from passive
-and not so active attackers.
+Coquelicot aims to protect, to some extent, users and system
+administrators from disclosure of the files exchanged from passive and
+not so active attackers.
Features
--------
- * Uploading a file is protected by a common password
+ * Support for different authentication methods
- In order to prevent random Internet users to eat bandwidth and disk
- space, uploading a file to share is protected by a common password.
+ In order to prevent random Internet users to eat bandwidth and
+ disk space, Coquelicot limits upload to authenticated users.
+ It currently ships with two authentication mechanisms:
+
+ - "simplepass": users will need to provide a global, pre-shared,
+ password;
+ - "imap": users will need to provide a login and a password,
+ those credentials will be used to authenticate against an existing
+ IMAP server.
+
+ It is possible to integrate more authentication mechanisms by
+ implementing a single method, some Javascript, and a template partial
+ to render the common fields. For more information have a look at the
+ notes below.
* Mandatory expiration
* Support for one-time download
- An user might want to allow exactly _one_ download of a file,
- to more closely replace an email attachment.
+ An user might want to allow exactly _one_ download of a file, to more
+ closely replace an email attachment. The file will be removed after
+ the first complete download and concurrent downloads are prevented.
* Upload progress bar
* Files are stored encrypted on the server
- Upon upload, files are written to the disk using symmetric
+ While being uploaded, files are written to the disk using symmetric
encryption. The encryption key is _not_ stored directly by
Coquelicot. It is either generated randomly and given as part of the
download URL, or specified by the uploader.
When a file has expired, it is removed from the server. In order
to make it harder to retrieve its content through filesystem
- analysis, it is filled with zeroes first.
+ analysis, it is filled with zeros first.
Setup
-----
Coquelicot is written in Ruby using the Sinatra web framework.
-On Debian, one can fulfill its dependencies by issueing:
+On Debian, one can fulfill its dependencies by issuing:
apt-get install libsinatra-ruby1.8 libopenssl-ruby1.8 \
libhaml-ruby1.8 liblockfile-ruby libgettext-ruby1.8 \
- rake
-
-Then create the translation catalog through:
-
- rake makemo
+ libjson-ruby1.8 rake
Finally you need to figure out the best way to host a Rack application
depending on your setup. *evil grin*
-Test suite
-----------
+Coquelicot is intended to be run on a fully encrypted system and accessible
+only through HTTPS.
-Coquelicot test suite is written using RSpec.
+Configuration
+-------------
-On Debian, you will need those extra packages:
+By default Coquelicot is configured to authenticate with the
+"simplepass" mechanism and some other reasonable defaults.
- apt-get install librspec-ruby1.8 libhpricot-ruby1.8
+It is possible to overwrite these settings from a configuration file
+named `settings.yml` that will be used if it is present in the `conf`
+directory of the application.
-You will also need the unpackaged gems "timecop" and "rack-test".
+All available settings with their default values are documented in
+`conf/settings-default.yml`.
-Then, running the test suite is just a matter of typing:
+Further settings example:
- spec test_coquelicot.rb
+ * `conf/settings-simplepass.yml`: shows how to change the default
+ password for the "simplepass" mechanism.
-Future
-------
+ * `conf/settings-imap.yml`: necessary configuration for the "imap"
+ authentication mechanism.
+
+You can copy one of these examples to `conf/settings.yml` and adjust them
+according to your environment.
+
+Garbage collection
+------------------
+
+To cleanup files automatically when they expired, coquelicot comes with
+a cleanup script, that does the garbage collection for you. The easiest
+way is to add `ext/coquelicot_gc.rb` as a cron job that runs every 5
+minutes (or so).
+
+Test and development
+--------------------
+
+As Coquelicot uses Bundle, the first step to work on Coquelicot
+is installing the proper dependencies by issuing:
+
+ bundle install
+
+Coquelicot test suite is written using RSpec. Running the test suite is just a
+matter of typing:
+
+ bundle exec rspec
+
+To update the translation source files, use:
+
+ bundle exec rake updatepo
+
+This will update `po/coquelicot.pot` and merge the new strings in the various
+`po/*/coquelicot.po` files.
+
+Migrate from Jyraphe
+--------------------
- * Integrate other authentication systems for uploads
+Jyraphe [1] is another free software web file sharing application.
+Coquelicot provides a migration script to import Jyraphe 0.5 repositories in
+`tools/migrate_jyraphe.rb`.
- A common password is a pretty limited authentication scheme.
- One could like to also configure no password or integrate with
- webmails or other authentication system.
+[1] http://home.gna.org/jyraphe/
+
+Future
+------
* More flexible expiration
It might be interesting to also offer a calendar for specifying
an exact date after which the file will be unavailable.
- * Upper-bound expiration time
-
- Malicious users could specify an arbitrary number of minutes before
- the file is expired. This should be limited by an upper-bound.
-
* Hide file size (padding)
There is currently a real close mapping from original file size to
Encryption is done using OpenSSL. Cipher is AES-256-CBC with key and IV
created using the pbkdf2_hmac_sha1() implementation of PKCS5. The later
-is fead using the former 'Salt' and the given passphrase.
+is fed using the former 'Salt' and the given passphrase.
Once decrypted, content has the following format:
<URL name> <file name>
+Authentication Mechanisms
+-------------------------
+
+It is possible to authenticate users against your own common authentication
+mechanism.
+
+Such an authentication mechanism needs to provide the following 3 files,
+with the following responsabilities:
+
+ * `lib/coquelicot/auth/<METHOD>.rb`:
+
+ A class implementing the actual authentication. This class must
+ implement an `authenticate` method. It will receive the form fields
+ as usual (params). This method should either return true if upload
+ should be allowed.
+
+ * `public/javascripts/coquelicot.auth.<METHOD>.js:`
+
+ This file should define 'authentication' as an object with the following
+ methods:
+
+ - `getData()`: returns an object of all the necessary data
+ to authenticate on the app side. Keys should have the same name
+ as the input fields used to authenticate without Javascript.
+ - `focus()`: set the focus on the first authentication form field.
+ - (optional) `handleSuccess()`: arbitrary action upon successful
+ authentication. This is called after the livebox is closed.
+ - (optional) `handleReject()`: arbitrary action when access
+ get rejected. One can reset authentication fields after a failed
+ authentication.
+ - (optional) `handleFailure()`: arbitrary action when there was
+ a problem in the authentication procedure.
+
+ * `views/auth/<METHOD>.haml`:
+
+ Render the necessary form fields that will be used for authentication.
+
+ The authentication method can be set in the application settings
+ including mandatory options for this method.
+
Authors
-------
-Coquelicot © 2010 potager.org <jardiniers@potager.org>
+Coquelicot © 2010-2012 potager.org <jardiniers@potager.org>
+ © 2011 mh / immerda.ch <mh+coquelicot@immerda.ch>
Coquelicot is distributed under the GNU Affero General Public License
version 3. See LICENSE for details.
+
+Background image (`public/images/background.jpg`) derived from:
+"coquelicot" © 2008 Jean-Louis Zimmermann
+Licensed under Creative Commons Attributions 2.0 Generic
+<https://secure.flickr.com/photos/jeanlouis_zimmermann/2478019744/>