A platform for conducting democratic decision making processes, written in PHP.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Martin Wandelt e21b2667a4
Add license information
4 months ago
daemon Add license information 4 months ago
lib Add license information 4 months ago
modules Add license information 4 months ago
.gitignore Add config.php to .gitignore file 5 months ago
LICENSE Add license information 4 months ago
README.md Fix markdown code block syntax 6 months ago
config-example.php Fix PHP syntax error in example config 6 months ago
process.php Add license information 4 months ago
update_keys.php Add license information 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.

  1. 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
    
  2. 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
    
  3. Create a directory for storing server keys

    $ sudo mkdir /etc/partcp
    $ sudo chown www-data /etc/partcp
    $ sudo chmod 700 /etc/partcp
    
  4. 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
    
  5. 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>
    
  6. Reload Apache configuration

    $ sudo systemctl reload apache2
    
  7. 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>.

  8. 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

  1. Install ParTCP command line client on your local machine.

    https://codeberg.org/ParTCP/partcp-cli

  2. Create local identity.

    $ partcp create_id root@my-partcp.org
    
  3. Create random string as credential for key submission.

     $ export credential=`openssl rand -base64 12`
    
  4. Generate credential hash code.

    $ echo -n $credential | sha256sum
    

    Copy output to clipboard.

  5. Register participant on the server.

    Compose From and Participant-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>
    
  6. 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
    
  7. 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>