Code Monkey home page Code Monkey logo

mod_crypt's Introduction

mod_crypt

THIS IS A PROOF-OF-CONCEPT project i made for my graduation thesis at the third year.

If you are interested in the project, you can read the thesis clicking here. Feel free to contact me in case you have somethink to say about it.

mod_crypt is an apache module that provides per-user file encryption

In the directories this module is enabled, Apache will return an encrypted copy of the requested files, using a user-specific key.

The user authentication is a simple ?user=user_id querystring on the request: there is no need of passwords or private tokens here, the layer of security is provided by the encryption itself.

Note that encrypted file will be returned with an application/octet-stream mimetype

Installation and configuration

This is created and tested only for GNU/Linux systems. You also need to have Apache and Openssl already installed

Clone this repository (or download it), enter the directory and compile mod_crypt.c by running:

# apxs -i -a -c -n crypt mod_crypt.c -lcrypto

Cool! the module now should be up and running, but you are not done yet.

On the directories you want to enable, add the following directive in your .htaccess (as provided in the .htaccess of this repository):

SetHandler crypt-handler

ACL file

Well, probably not every user should be allowed to see all the files on the directory, right? That's why you can set an Access Control List with a simple .csv file. As you can see in the acl.csv.example, the row format is the following:

file_path;list,user,allowed;

The first row is the header and it will not be processed, so a super-minimal acl.csv should look like this:

path;users_allowed;
secretFile.txt;John,Giorgio;
superSecretFile.txt;Giorgio;

Given this ACL, ../secretFile.txt?user=John will return the secretFile.txt encrpyted for John, while ../superSecretFile.txt?user=John will return a 403 error.

There are two Apache directives that provides a better acl customisation, just include them in your apache config file:

CryptRootPath /path/to/your/directory/
CryptAclFile /path/to/your/directory/acl.csv

CryptRootPath provides the root path of files in your acl, so you don't need to specify it everytime in your acl.csv

If not specified, the default is /

CryptAclFile just provides the path of Acl file. Default is CryptRootPath/acl.csv. Remember that http user will need read access to those files

KEY files

Every user need to provide his public .pem RSA key to the server. mod_crypt will use the .pem file with the requesting user as filename, searching into a specific directory.

The directory can be set in the apache configuration file as well:

CryptKeysRoot /path/to/keys

mod_crypt's People

Contributors

gbalduzzi avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.