MihanEntalpo / cryptboard.io

Web clipboard and simple messanger with end-to-end RSA+AES encryption
MIT License
389 stars 26 forks source link

CryptBoard.io - anonymous encrypted web clipboard and chat

Cryptboard.io allows to send text messages and files between multiple devices

Website: https://cryptboard.io/

Screenshot of a clipboard page

Why would I need it?

Features

Disclaimers

Usage of the official app

Details on secure usage could be found at https://cryptboard.io/security

Technologies

Detail on used technologies is here: https://cryptboard.io/about

Deploying your own installation

Docker installation

Prerequisites:

Installation:

  1. Clone repo.
git clone git@github.com:MihanEntalpo/cryptboard.io.git
  1. Install docker, docker-compose and nginx

Installation of docker described at https://docs.docker.com/get-docker/

Installation of docker-compose described at https://docs.docker.com/compose/install/

Install nginx by your repo's package manager

  1. Create config file
cp web-app/.env.docker.example web-app/.env.docker
  1. Generate public and private keys for usage with JWT:

Run command:

ssh-keygen -t rsa -b 4096 -m PEM -f jwtRS256.key
# Don't add passphrase
openssl rsa -in jwtRS256.key -pubout -outform PEM -out jwtRS256.key.pub

Files jwtRS256.key and jwtRS256.key.pub would be created.

  1. Put contents of the files to .env.docker

Content of the files should be put in one-liners with "\n" string joining splitted lines, and put it to JWT_PUBLIC_KEY and JWT_PRIVATE_KEY variables.

To make it simple just run the following bash command:

Fill JWT_PRIVATE_KEY in .env.docker:

LINE=$(cat ./web-app/jwtRS256.key | tr '\n' '$' | sed 's|\$|\\\\n|g;s|^|JWT_PRIVATE_KEY=|g'); sed -i "s|^JWT_PRIVATE_KEY.*|$LINE|g" -i ./web-app/.env.docker

Fill JWT_PUBLIC_KEY in .env.docker:

LINE=$(cat ./web-app/jwtRS256.key.pub | tr '\n' '$' | sed 's|\$|\\\\n|g;s|^|JWT_PUBLIC_KEY=|g'); sed -i "s|^JWT_PUBLIC_KEY.*|$LINE|g" -i ./web-app/.env.docker
  1. Fill some other variables

SERVER_HOST should be set to your HTTP host configured in Nginx or any other reverse-proxy server.

On official app this variable is set to cryptboard.io

SERVER_PORT should be a port, that is opened from docker container with running app

  1. Build docker imaged
./build-docker-images.sh
  1. Run docker-compose cluster:
./docker-compose.sh up -d

All normal docker-compose commands could be used with docker-compose.sh, for example:

./docker-compose.sh ps -a
./docker-compose.sh up -d
./docker-compose.sh stop

So, instead of docker-compose ps you run ./docker-compose.sh ps and so on.

This is just a simplification to use docker-compose without specifying docker-compose.yml file and .env.docker envfile for every call.

  1. Check if application is running:

Open url http://127.0.0.1:{SERVER_PORT}/ in browser (You you are deploying app not locally, but on some online server, replace 127.0.0.1 by it's real IP)

  1. Configure nginx to be a reverse-proxy to this local server and make it use SSL if needed (SSL keys could be obtained from LetsEncrypt)

Use conf/nginx/docker-proxypass.conf as a template for your docker config.

You will need to set the right hostname, proxy_pass port, logfiles location and letsencrypt key and cert files.

Old good dockerless installation

Recommended for development

Prerequisites:

Installation:

Instructions are made for deb-based distro:

  1. Install needed packages
sudo apt-get install nginx-full php-fpm php-redis git
  1. Clone repo
git clone git@github.com:MihanEntalpo/cryptboard.io.git
  1. Create config file
cp web-app/.env.example web-app/.env
  1. Install composer, and install requirements:

Composer installation instructions are here: https://getcomposer.org/download/

Run:

cd web-app
./composer.phat install

Or if you've installed composer into your PATH:

cd web-app
composer.phat install
  1. Generate public and private keys for usage with JWT:

Run command:

ssh-keygen -t rsa -b 4096 -m PEM -f jwtRS256.key
# Don't add passphrase
openssl rsa -in jwtRS256.key -pubout -outform PEM -out jwtRS256.key.pub

Files jwtRS256.key and jwtRS256.key.pub would be created.

  1. Put contents of the files to .env file

Content of the files should be put in one-liners with "\n" string joining splitted lines, and put it to JWT_PUBLIC_KEY and JWT_PRIVATE_KEY variables.

To make it simple just run the following bash command:

Fill JWT_PRIVATE_KEY in .env:

LINE=$(cat ./web-app/jwtRS256.key | tr '\n' '$' | sed 's|\$|\\\\n|g;s|^|JWT_PRIVATE_KEY=|g'); sed -i "s|^JWT_PRIVATE_KEY.*|$LINE|g" -i ./web-app/.env

Fill JWT_PUBLIC_KEY in .env:

LINE=$(cat ./web-app/jwtRS256.key.pub | tr '\n' '$' | sed 's|\$|\\\\n|g;s|^|JWT_PUBLIC_KEY=|g'); sed -i "s|^JWT_PUBLIC_KEY.*|$LINE|g" -i ./web-app/.env
  1. Fill some other variables

SERVER_HOST should be set to your HTTP host configured in Nginx or any other reverse-proxy server.

On official app this variable is set to cryptboard.io

  1. Configure Nginx

Use file conf/nginx/dockerless.conf as a template for your configuration.

You should change:

server_name, SSL certificate and key, root folder and PHP fastcgi_pass url

  1. Open site in browser and check if it's running.

If it's not, look for logs of nginx and php and check what should be changed.