Skip to content

Configuring Votix

Laul edited this page May 18, 2022 · 4 revisions

Configuring Votix

Most of the votix configuration is done in the file .env.local. On production and development this file overrides default values from config/services.yaml and .env.

Configure secrets

Important note : Never generate or use production secrets on a Votix configured with APP_ENV=dev or APP_DEBUG=true as these environnements can leak secrets.

Use this command to generate secrets :

sudo -u votix php bin/console votix:config:generate-secrets
# Example output
+-----------------------+------------------------+-----------------------------------------------------+
| Parameter             | Value                  | Action needed                                       |
+-----------------------+------------------------+-----------------------------------------------------+
| app_secret            | [stored in .env.local] | Keep it secret !                                    |
| votix_secret          | [stored in .env.local] | Keep it secret !                                    |
| votix_key_secret      | [stored in .env.local] | Keep it secret !                                    |
| votix_result_password | ACLPs:WW6W4LJuj        | Note it without mistakes and keep it secret for now |
+-----------------------+------------------------+-----------------------------------------------------+

Here are sample values generated :

# This is a base64 encoded secret for symfony, not currently used but might be in the future
APP_SECRET=GeNKXe/VwSsJnjKcMM3qw2kzucCUHrTWtKmLc9XO+zg=
# This is a base64 encoded secret for generating votix tokens in urls
VOTIX_SECRET=d4+HeBtNzraQxZCw9A6d36iyGJOljvngFa0lOM7+P8w=
# This is a base64 encoded secret passphrase to protect the decryption key
VOTIX_KEY_SECRET=ektTYmZ3ZUN3K1huM2U2RSNXako=
# This is a base64 encoded password of a password that will be required to decrypt the votes
VOTIX_RESULT_PASSWORD=aFdiTko6ajVTbz10OXpW

Configure mailer

⚠️Warning : You need to request for production access if you use AWS SES at least one week

Use this command to generate mailer config :

sudo -u votix php bin/console votix:config:mailer
# example output
Be sure that your system time is correct or the configuration will fail !
Are you using Amazon SES? (Y/n) y
Please enter the ACCESS_KEY : AAA
Please enter the SECRET_KEY : BBB
Please enter the region (default: eu-west-1) : 
Generated DSN (for info): ses+api://AAA:BBB@default?region=eu-west-1
Please enter the FROM header (name <mail>, ex. Votix <[email protected]>): Votix <[email protected]>
Please enter the Reply-To header (eg [email protected]): [email protected]
Please enter the Return-Path header (eg [email protected]): [email protected]
Please enter YOUR OWN EMAIL for testing the configuration now: [email protected]
# Here are the description of the variables configured in .env.local :
MAILER_DSN # see https://symfony.com/doc/current/mailer.html
VOTIX_FROM # Mail "from" that will be displayed in recipient's email client
VOTIX_REPLY_TO # Mail that will receive the responses if someone is trying to reply
VOTIX_RETURN_PATH # Mail that will receive notification if the mail is not delivered

References:

Configure Base URL

Due to technical reasons, your instance url cannot be detected using the command line interface, you need to provide your instance url using this variable in the .env.local file.

# example
VOTIX_LINK_BASE=https://subdomain.example.com/vote/

Configure opening window

Open http://timestamp.fr/ and get the timestamp you want for the opening datetime and closing datetime

VOTIX_START=0
VOTIX_END=1558317580
[email protected]

Configure admin password

sudo -u votix php bin/console security:encode-password

Copy the encoded password, open this online base64 encoder : https://gchq.github.io/CyberChef/#recipe=To_Base64('A-Za-z0-9%2B/%3D')&input=cGFzdGUgeW91ciBwYXNzd29yZCBoZXJl

Paste the whole string like $argon2id$v=19$m=65536,t=4,p=1$MDRPQXQzVU9jREFTSkl6WQ$AHMT5Rnml93cYZxVKqCm5jHGyNXv7I9xZ9ihOGHaZow

Write the base64 output to the .env.local

VOTIX_ADMIN_PASSWORD=JGFyZ29uMmlkJHY9MTkkbT02....pYQ09tQQ==