![]() |
4 months ago | |
---|---|---|
daemon | 4 months ago | |
lib | 4 months ago | |
modules | 4 months ago | |
.gitignore | 5 months ago | |
LICENSE | 4 months ago | |
README.md | 6 months ago | |
config-example.php | 6 months ago | |
process.php | 4 months ago | |
update_keys.php | 4 months ago |
README.md
ParTCP Server
ParTCP server is a platform for conducting democratic decision making processes. This is beta software right now, so expect errors and missing features.
Technical documentation (in German only) can be found here.
System requirements
- Linux
- OpenSSL
- Apache2 with headers module
- PHP 7 with OpenSSL support and sodium extension
- Git (for convenient installation and upgrading only)
Installation (for testing environments only, not for production use!)
The following instructions assume that the root directory of your web server
is /var/www/my-partcp.org
, that the address is my-partcp.org
and that
the web server process is running as user www-data
.
-
Clone project to your web server (as root)
$ cd /var/www $ sudo git clone https://codeberg.org/ParTCP/partcp-server.git $ sudo mv partcp-server my-partcp.org
-
Make all files and directories accessible for all users
$ cd my-partcp.org $ sudo find . -type f -exec chmod 644 {} \; $ sudo find . -type d -exec chmod 755 {} \; $ sudo chmod +x daemon/partcpd
-
Create a directory for storing server keys
$ sudo mkdir /etc/partcp $ sudo chown www-data /etc/partcp $ sudo chmod 700 /etc/partcp
-
Create a directory for data storage
$ sudo mkdir /var/www/my-partcp.org/data $ sudo chown www-data /var/www/my-partcp.org/data $ sudo chmod 755 /var/www/my-partcp.org/data
-
Adapt Apache configuration for ParTCP root directory
<Directory "/var/www/my-partcp.org"> # Make resources accessible regardless of client domain Header set Access-Control-Allow-Origin "*" Header set Access-Control-Allow-Methods "GET, POST, OPTIONS" Header set Access-Control-Allow-Headers "Origin, Content-Type, Cookie, Accept, Authorization, Access-Control-Allow-Origin, User-Agent" # Enable auto indexing and other options Options Indexes FollowSymLinks MultiViews # Auto index even if index file is present, and show hidden items DirectoryIndex disabled IndexIgnoreReset On # Have browsers handle YAML and Markdown files like plain text files AddType text/plain yaml md AddDefaultCharset utf-8 # Let all POST requests be handled by process.php script RewriteEngine on RewriteCond %{THE_REQUEST} ^POST [NC] RewriteRule .* process.php </Directory> <Directory ~ "^/var/www/my-partcp.org/.+"> # Do not execute PHP scripts in subdirectories, deliver them as plain text instead php_flag engine off AddType text/plain php AddDefaultCharset utf-8 </Directory>
-
Reload Apache configuration
$ sudo systemctl reload apache2
-
Create and edit configuration file
$ sudo cp config-example.php config.php $ sudo nano config.php
Adapt configuration parameters to your needs and finish editing by pressing
<ctrl-o>
,<return>
,<ctrl-x>
. -
Send test message
Check if the server works properly by sending a "ping" message from your local machine:
$ curl -d "Message-Type: ping" my-partcp.org
You should receive a response like this:
Signature: WHM08/cytInHm2h4z64J1pUjNg2U88B1q1ovZA5ETxSkJYhJQuKjn2RoA9X6k5Y2HCOTrrVcfRpk6/agk8trAg== From: my-partcp.org Date: 2021-03-30T09:06:56+02:00 Message-Type: receipt Original-Message: 'Message-Type: ping' Verification-Result: missing signature, nothing to verify Public-Key: > 8BbYgAcG4yPfKKhh64+uo/AxV0NkcxhIAmnnHq1aAosBJQqBJk1Fy6Hj3g6vsZxOv4W/gN4NwzLTIGerDMNxHg== Elapsed-Time: 0.585 ms
Setting up a root account
-
Install ParTCP command line client on your local machine.
-
Create local identity.
$ partcp create_id root@my-partcp.org
-
Create random string as credential for key submission.
$ export credential=`openssl rand -base64 12`
-
Generate credential hash code.
$ echo -n $credential | sha256sum
Copy output to clipboard.
-
Register participant on the server.
Compose
From
andParticipant-Id
elements from identity created in step 2.$ partcp send To: my-partcp.org From: root@my-partcp.org Message-Type: registration Participant-Id: root Credential: <insert clipboard content here> <ctrl-D>
-
Submit the public key of the new identity to the server.
Use random string from step 3 here.
$ partcp submit_key root@my-partcp.org $credential
-
Appoint participant as root admin.
$ partcp send To: my-partcp.org From: root@my-partcp.org Message-Type: root-appointment Participant-Id: root <ctrl-D>