Skip to content

Helios server. Helios is an end-to-end verifiable voting system.

License

Notifications You must be signed in to change notification settings

bmalbusca/helios-server

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Helios Election System

Helios is an end-to-end verifiable voting system. Project forked from benadida/helios-server

Travis Build Status

This fork is a more user-friendly version of the helios-server. Also, this still a version with high compatiblity with the orginal repository, which should be fine to update this fork automatically. See Changelog.

Installation

You can install the Helios server easily by following 3 steps:

  1. git clone https://github.com/bmalbusca/helios-server.git

  2. cd helios-server/

  3. sudo bash helios-install.sh

Run

  1. python2 manage.py runserver 0.0.0.0:8000

  2. celery -A helios worker -S django -l info -E (as a parallel process)

Development

OAuth integration

Examples

To help developing a new authentication method (Fenix Oauth), was used Source Trail. This tool helps to find dependencies and the code diagram easily. From other forks, it is possible to found others authentication integrations:

For our case, other documentation is provided at fenixedu. (other examples)

Intro

The authentication systems have dependencies with: models.py,tests.py and views.py

In those files you will find the import and callbacks of the available authentication systems:

  • models.py is where the user authentication method is invoked
  • views.py is where the user (front-end) is redirect to the urls available at the authentication method

Getting started

The authentication need to be integrated as unique file, for example our_auth.py, and should have the following (standard) methods:

  • def can_create_election(user_id, user_info): returns boolean
  • def get_auth_url(request, redirect_url): returns url
  • def get_user_info_after_auth(request): returns object {type:,user-id:, emai:,info:{}, token:{}}

Other methods that we can implement is :

  • def send_message(user_id, name, user_info, subject, body):- using a mail server

Some services are already reconized by Django. So, you don't need to specify a url because Django have a default redirecting url (that should be used when managing the service) . Search on google if your service is on of them. If not, you should create a route (function) to handle the redirecting from the oauth service.

Files to be updated

  1. helios-server/helios_auth/auth_systems/__init__.py - Add your authentication system here
  2. helios-server/helios_auth/urls.py - Add your urls (optional)
  3. helios-server/helios_auth/media/login-icons - Add your authentication icon (42x42 png file with the same name as the auth)
  4. helios-server/settings.py - Enable your default authentication system

Celery integration

Installation

The celery and rabbitmq are automatically installed if you proceed helios-server installation via requirements file.

Dependencies

  • django-celery-results - compatible, substitute of djcelery package
Configuration

At settings.py add:

  INSTALLED_APPS = (
    ...,
    'django_celery_results',
)
    # set up celery                                                                                                                               
    CELERY_BROKER_URL = get_from_env('CELERY_BROKER_URL', 'amqp://localhost')                                                                     
    
    CELERY_RESULT_BACKEND = 'django-db'  

How to run

  1. python manage.py migrate django_celery_results
  2. celery -A helios worker -S django -l info -E
  3. In other shell. celery -A helios beat -l info

References

Documentation

Issues

for redis usage: https://tekshinobi.com/django-celery-rabbitmq-redis-broker-results-backend/

Email server

To send an email with the user credencials (using the batch mode), it will be necessary to run the celery and, having the send_mail() method defined at the user authentication level.

Assuming that the authentication method can send emails, in this version/fork, if there are no email variables in the environment, it is still possible to test the email. The emails will be redirected to the console. (see settings.py)

## Deploy 1. Active your virtual environment (optional) 2. Collect static files sudo .venv/bin/python2 manage.py collectstatic; Make sure the collectstatic is enabled on settings.py 3. Verify static files paths at your new static folder 4. Use a provisioner to launch Apache/Nginx services and Celery

Dev groups

Relevant issues

Issue #1 - Election is not JSON serializable

Packages

No packages published

Languages

  • Python 53.6%
  • JavaScript 29.1%
  • HTML 15.2%
  • CSS 1.5%
  • Other 0.6%