Helios is an end-to-end verifiable voting system. Project forked from benadida/helios-server
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.
You can install the Helios server easily by following 3 steps:
-
git clone https://github.com/bmalbusca/helios-server.git
-
cd helios-server/
-
sudo bash helios-install.sh
-
python2 manage.py runserver 0.0.0.0:8000
-
celery -A helios worker -S django -l info -E
(as a parallel process)
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:
- https://github.com/openSUSE/helios-server/tree/master/helios_auth/auth_systems
- https://github.com/pirati-cz/helios-server/tree/master/helios_auth/auth_systems
- https://github.com/shirlei/helios-server/tree/master/helios_auth/auth_systems
For our case, other documentation is provided at fenixedu. (other examples)
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 invokedviews.py
is where the user (front-end) is redirect to the urls available at the authentication method
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 booleandef get_auth_url(request, redirect_url):
returns urldef 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.
helios-server/helios_auth/auth_systems/__init__.py
- Add your authentication system herehelios-server/helios_auth/urls.py
- Add your urls (optional)helios-server/helios_auth/media/login-icons
- Add your authentication icon (42x42 png file with the same name as the auth)helios-server/settings.py
- Enable your default authentication system
The celery
and rabbitmq
are automatically installed if you proceed helios-server installation via requirements file.
django-celery-results
- compatible, substitute ofdjcelery
package
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'
python manage.py migrate django_celery_results
celery -A helios worker -S django -l info -E
- In other shell.
celery -A helios beat -l info
Documentation
- https://docs.celeryproject.org/en/stable/django/first-steps-with-django.html
- https://docs.celeryproject.org/en/stable/getting-started/brokers/rabbitmq.html
Issues
for redis usage: https://tekshinobi.com/django-celery-rabbitmq-redis-broker-results-backend/
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