mirror of
https://github.com/mCaptcha/mCaptcha.git
synced 2026-02-11 01:55:40 +00:00
rename guard -> mcaptcha
This commit is contained in:
@@ -1,12 +1,12 @@
|
||||
# Configuration
|
||||
|
||||
Guard is highly configurable.
|
||||
mcaptcha is highly configurable.
|
||||
|
||||
Configuration is applied/merged in the following order:
|
||||
|
||||
1. path to configuration file passed in via `GUARD_CONFIG`
|
||||
1. path to configuration file passed in via `MCAPTCHA_CONFIG`
|
||||
2. `./config/default.toml`
|
||||
3. `/etc/guard/config.toml`
|
||||
3. `/etc/mcaptcha/config.toml`
|
||||
4. environment variables.
|
||||
|
||||
## Setup
|
||||
@@ -21,37 +21,37 @@ you will be overriding the values set in the configuration files.
|
||||
|
||||
| Name | Value |
|
||||
| ------------------------------------ | ------------------------------------------------------------- |
|
||||
| `GUARD_DATEBASE_PASSWORD` | Postgres password |
|
||||
| `GUARD_DATEBASE_NAME` | Postgres database name |
|
||||
| `GUARD_DATEBASE_PORT` | Postgres port |
|
||||
| `GUARD_DATEBASE_HOSTNAME` | Postgres hostmane |
|
||||
| `GUARD_DATEBASE_USERNAME` | Postgres username |
|
||||
| `GUARD_DATEBASE_POOL` | Postgres database connection pool size |
|
||||
| `MCAPTCHA_DATEBASE_PASSWORD` | Postgres password |
|
||||
| `MCAPTCHA_DATEBASE_NAME` | Postgres database name |
|
||||
| `MCAPTCHA_DATEBASE_PORT` | Postgres port |
|
||||
| `MCAPTCHA_DATEBASE_HOSTNAME` | Postgres hostmane |
|
||||
| `MCAPTCHA_DATEBASE_USERNAME` | Postgres username |
|
||||
| `MCAPTCHA_DATEBASE_POOL` | Postgres database connection pool size |
|
||||
| `DATABSE_URL` (overrides above vars) | databse URL in `postgres://user:pass@host:port/dbname` format |
|
||||
|
||||
#### Server:
|
||||
|
||||
| Name | Value |
|
||||
| ------------------------------------- | --------------------------------------------------- |
|
||||
| `GUARD_SERVER_PORT` | The port on which you want guard to listen to |
|
||||
| `PORT`(overrides `GUARD_SERVER_PORT`) | The port on which you want guard to listen to |
|
||||
| `GUARD_SERVER_IP` | The IP address on which you want guard to listen to |
|
||||
| `GUARD_SERVER_DOMAIN` | Domain under which guard will be\* |
|
||||
| `GUARD_SERVER_COOKIE_SECRET` | Cookie secret, must be long and random |
|
||||
| `GUARD_SERVER_ALLOW_REGISTRATION` | `bool` that controls | | registration |
|
||||
| `MCAPTCHA_SERVER_PORT` | The port on which you want mcaptcha to listen to |
|
||||
| `PORT`(overrides `MCAPTCHA_SERVER_PORT`) | The port on which you want mcaptcha to listen to |
|
||||
| `MCAPTCHA_SERVER_IP` | The IP address on which you want mcaptcha to listen to |
|
||||
| `MCAPTCHA_SERVER_DOMAIN` | Domain under which mcaptcha will be\* |
|
||||
| `MCAPTCHA_SERVER_COOKIE_SECRET` | Cookie secret, must be long and random |
|
||||
| `MCAPTCHA_SERVER_ALLOW_REGISTRATION` | `bool` that controls | | registration |
|
||||
|
||||
\* Authentication doesn't work without `GUARD_DOMAIN` set to the correct
|
||||
\* Authentication doesn't work without `MCAPTCHA_DOMAIN` set to the correct
|
||||
domain
|
||||
|
||||
### Configuration file location:
|
||||
|
||||
| Name | Value |
|
||||
| -------------- | ------------------- |
|
||||
| `GUARD_CONFIG` | Path to config file |
|
||||
| `MCAPTCHA_CONFIG` | Path to config file |
|
||||
|
||||
### Proof of work:
|
||||
|
||||
| Name | Value |
|
||||
| ---------------- | --------------------------------------------------------------------------------------- |
|
||||
| `GUARD_POW_SALT` | Salt has to be long and random |
|
||||
| `GUARD_POW_GC` | Garbage collection duration in seconds, requires tuning but 30 is a good starting point |
|
||||
| `MCAPTCHA_POW_SALT` | Salt has to be long and random |
|
||||
| `MCAPTCHA_POW_GC` | Garbage collection duration in seconds, requires tuning but 30 is a good starting point |
|
||||
|
||||
@@ -15,7 +15,7 @@ NOTE: We'll publish pre-built images once we reach `alpha`.
|
||||
1. Build image:
|
||||
|
||||
```bash
|
||||
$ cd guard && docker build -t mcaptcha/guard:latest .
|
||||
$ cd mcaptcha && docker build -t mcaptcha/mcaptcha:latest .
|
||||
```
|
||||
|
||||
2. Set configuration in [configuration file](../config/default.toml)
|
||||
@@ -29,13 +29,13 @@ docker run -p <host-machine-port>:<port-in-configuration-file> \
|
||||
--add-host=database:<database-ip-addrss> \
|
||||
-e RUST_LOG=debug \
|
||||
-e DATABASE_URL="postgres://<db-user>:<db-password>@database:<db-port>/<db-name>" \
|
||||
mcaptcha/guard:latest
|
||||
mcaptcha/mcaptcha:latest
|
||||
```
|
||||
|
||||
If you don't have a Postgres instance running, you can either install
|
||||
one using a package manager or launch one with docker. A [docker-compose
|
||||
configuration]('../docker-compose.yml) is available that will launch both
|
||||
a database instance guard instance.
|
||||
a database instance mcaptcha instance.
|
||||
|
||||
## With docker-compose
|
||||
|
||||
@@ -56,7 +56,7 @@ the future.
|
||||
|
||||
### 1. Install postgres if you don't have it already.
|
||||
|
||||
### 2. Create new user for running `guard`:
|
||||
### 2. Create new user for running `mcaptcha`:
|
||||
|
||||
```bash
|
||||
$ sudo useradd -b /srv -m -s /usr/bin/zsh mcaptcha
|
||||
@@ -71,9 +71,9 @@ postgres=# CREATE USER mcaptcha WITH PASSWORD 'my super long password and yes y
|
||||
$ createdb -O mcaptcha mcaptcha # create db 'mcaptcha' with 'mcaptcha' as owner
|
||||
```
|
||||
|
||||
### 4. Build `guard`:
|
||||
### 4. Build `mcaptcha`:
|
||||
|
||||
To build `guard`, you need the following dependencies:
|
||||
To build `mcaptcha`, you need the following dependencies:
|
||||
|
||||
1. rust
|
||||
2. node(`v14.16.0`)
|
||||
@@ -102,14 +102,14 @@ $ make dev-env && \
|
||||
### 5. Install package:
|
||||
|
||||
```bash
|
||||
$ sudo cp ./target/release/guard /usr/bin/ && \
|
||||
mkdir sudo /etc/guard && \
|
||||
sudo cp config/default.toml /etc/guard/config.toml
|
||||
$ sudo cp ./target/release/mcaptcha /usr/bin/ && \
|
||||
mkdir sudo /etc/mcaptcha && \
|
||||
sudo cp config/default.toml /etc/mcaptcha/config.toml
|
||||
```
|
||||
|
||||
### 6. Systemd service configuration:
|
||||
|
||||
1. Copy the following to `/etc/systemd/system/guard.service`:
|
||||
1. Copy the following to `/etc/systemd/system/mcaptcha.service`:
|
||||
|
||||
```systemd
|
||||
[Unit]
|
||||
@@ -118,7 +118,7 @@ Description=mCaptcha: a CAPTCHA system that gives attackers a run for their mone
|
||||
[Service]
|
||||
Type=simple
|
||||
User=mcaptcha
|
||||
ExecStart=/usr/bin/guard
|
||||
ExecStart=/usr/bin/mcaptcha
|
||||
Restart=on-failure
|
||||
RestartSec=1
|
||||
SuccessExitStatus=3 4
|
||||
@@ -142,6 +142,6 @@ WantedBy=multi-user.target
|
||||
2. Enable service:
|
||||
```bash
|
||||
$ sudo systemctl daemon-reload && \
|
||||
sudo systemctl enable guard && \ # Auto startup during boot
|
||||
sudo systemctl start guard
|
||||
sudo systemctl enable mcaptcha && \ # Auto startup during boot
|
||||
sudo systemctl start mcaptcha
|
||||
``
|
||||
|
||||
@@ -22,7 +22,7 @@ $ docker-compose logs -f
|
||||
- from just webserver:
|
||||
|
||||
```bash
|
||||
$ docker-compose logs -f guard
|
||||
$ docker-compose logs -f mcaptcha
|
||||
```
|
||||
|
||||
## Setting up elaborate development environment
|
||||
@@ -88,7 +88,7 @@ $ docker start mcaptcha-postgres
|
||||
4. Set configurations:
|
||||
|
||||
```bash
|
||||
$ cd guard # your copy of https://github.com/mCaptcha/guard
|
||||
$ cd mcaptcha # your copy of https://github.com/mCaptcha/mcaptcha
|
||||
$ echo 'export DATABASE_URL="postgres://postgres:password@localhost:5432/postgres"' > .env
|
||||
```
|
||||
|
||||
@@ -103,7 +103,7 @@ $ echo 'export DATABASE_URL="postgres://postgres:password@localhost:5432/postgre
|
||||
However, this project ships with a utility to run migrations!
|
||||
|
||||
```bash
|
||||
$ cd guard # your copy of https://github.com/mCaptcha/guard
|
||||
$ cd mcaptcha # your copy of https://github.com/mCaptcha/mcaptcha
|
||||
$ cargo run --bin tests-migrate
|
||||
```
|
||||
|
||||
@@ -114,14 +114,14 @@ That's it, you are all set!
|
||||
### Compile:
|
||||
|
||||
```bash
|
||||
$ cd guard # your copy of https://github.com/mCaptcha/guard
|
||||
$ cd mcaptcha # your copy of https://github.com/mCaptcha/mcaptcha
|
||||
$ make
|
||||
```
|
||||
|
||||
### Additional commands:
|
||||
|
||||
```bash
|
||||
➜ guard git:(master) ✗ make help
|
||||
➜ mcaptcha git:(master) ✗ make help
|
||||
docs - build documentation
|
||||
run - run developer instance
|
||||
test - run unit and integration tests
|
||||
|
||||
BIN
docs/res/icon-trans.png
Normal file
BIN
docs/res/icon-trans.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 142 KiB |
Reference in New Issue
Block a user