Compare commits
1 commit
master
...
dependabot
Author | SHA1 | Date | |
---|---|---|---|
|
e757f7d849 |
2
.gitignore
vendored
|
@ -3,5 +3,3 @@ node_modules
|
|||
public
|
||||
resources
|
||||
.hugo_build.lock
|
||||
sec
|
||||
tmp/
|
||||
|
|
|
@ -1,15 +0,0 @@
|
|||
steps:
|
||||
build:
|
||||
image: realaravinth/nvm-node16-insecure
|
||||
environment:
|
||||
- NVM_DIR="$HOME/.nvm"
|
||||
when:
|
||||
event: [push, pull_request, tag, deployment]
|
||||
branch: master
|
||||
commands:
|
||||
- apt-get update
|
||||
- apt update && apt-get -y --no-install-recommends install curl tar gnupg curl wget git build-essential
|
||||
- npm install yarn
|
||||
- make env
|
||||
- make ci-deploy
|
||||
secrets: [FORGEJO_WRITE_DEPLOY_KEY, LIBREPAGES_DEPLOY_SECRET]
|
27
Makefile
|
@ -1,27 +0,0 @@
|
|||
default:
|
||||
./scripts/hugo.sh build
|
||||
|
||||
ci-deploy: ## Deploy from CI/CD. Only call from within CI
|
||||
@if [ "${CI}" != "woodpecker" ]; \
|
||||
then echo "Only call from within CI. Will re-write your local Git configuration. To override, set export CI=woodpecker"; \
|
||||
exit 1; \
|
||||
fi
|
||||
git config --global user.email "${CI_COMMIT_AUTHOR_EMAIL}"
|
||||
git config --global user.name "${CI_COMMIT_AUTHOR}"
|
||||
./scripts/hugo.sh deploy librepages public "${CI_COMMIT_AUTHOR} <${CI_COMMIT_AUTHOR_EMAIL}>"
|
||||
./scripts/ci.sh --init "$$FORGEJO_WRITE_DEPLOY_KEY"
|
||||
cat /tmp/ci-ssh-id
|
||||
./scripts/ci.sh --deploy ${LIBREPAGES_DEPLOY_SECRET} librepages
|
||||
./scripts/ci.sh --clean
|
||||
|
||||
env: ## Download build dependencies and setup dev environment
|
||||
./scripts/hugo.sh install
|
||||
npm ci
|
||||
npm run clean
|
||||
npm run build
|
||||
|
||||
help: ## Prints help for targets with comments
|
||||
@cat $(MAKEFILE_LIST) | grep -E '^[a-zA-Z_-]+:.*?## .*$$' | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
|
||||
|
||||
serve:
|
||||
./scripts/hugo.sh hugo server
|
|
@ -1,20 +1,20 @@
|
|||
[[docs]]
|
||||
name = "Webmasters"
|
||||
name = "Introduction"
|
||||
weight = 510
|
||||
identifier = "Webmasters"
|
||||
url = "/docs/webmasters/"
|
||||
identifier = "Introduction"
|
||||
url = "/docs/introduction/"
|
||||
|
||||
[[docs]]
|
||||
name = "User Manual"
|
||||
name = "Terminology"
|
||||
weight = 520
|
||||
identifier = "user-manual"
|
||||
url = "/docs/user-manual/"
|
||||
identifier = "Terminology"
|
||||
url = "/docs/terminology/"
|
||||
|
||||
[[docs]]
|
||||
name = "Self-Hosting"
|
||||
name = "Self-Hosted"
|
||||
weight = 530
|
||||
identifier = "Self-Hosting"
|
||||
url = "/docs/self-hosting/"
|
||||
identifier = "Self-Hosted"
|
||||
url = "/docs/self-hosted/"
|
||||
|
||||
[[docs]]
|
||||
name = "API"
|
||||
|
@ -51,9 +51,10 @@
|
|||
name = "Contact"
|
||||
url = "/contact/"
|
||||
weight = 40
|
||||
|
||||
[[main]]
|
||||
name = "Docs"
|
||||
url = "/docs/webmasters/installing-captcha/"
|
||||
url = "/docs/introduction/installing-captcha/"
|
||||
weight = 500
|
||||
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@ title = "mCaptcha"
|
|||
titleSeparator = "-"
|
||||
titleAddition = "mCaptcha"
|
||||
description = "mCaptcha - PoW based DoS protection"
|
||||
docsRepo = "https://git.batsense.net/mCaptcha/website"
|
||||
docsRepo = "https://github.com/mCaptcha/website"
|
||||
editPage = true
|
||||
|
||||
## Open Graph + Twitter Cards
|
||||
|
|
|
@ -12,10 +12,11 @@ attackers a run for their money. And we do all of this without tracking
|
|||
your users. Oh and did I mention our UX is great?
|
||||
|
||||
At mCaptcha, we believe in digital freedom and privacy and so we built
|
||||
a proof-of-work based CAPTCHA system that doesn’t track. Seriously, no
|
||||
an proof-of-work based CAPTCHA system that doesn’t track. Seriously, no
|
||||
tracking. But that isn’t the killer feature, our system doesn’t require
|
||||
the user to pick cars or ID sidewalks — our system does it’s
|
||||
thing(usually at the click of a button) and gets out of the way.
|
||||
thing(usually at the click of a button) and gets out of the way. Our
|
||||
Philosophy
|
||||
|
||||
## Philosophy
|
||||
|
||||
|
|
|
@ -1,51 +0,0 @@
|
|||
---
|
||||
title: "February, 2023: Monthly Report"
|
||||
description: "Gusted and I secured funding from NLnet to work on mCaptcha in 2023, we suffered an outage from 15 January to February 6, polyfill benchmarking support in mCaptcha"
|
||||
lead: "We are mCaptcha. We build kickass CAPTCHA systems that give (DDoS) attackers a run for their money. And we do all of this without tracking your users. Oh and did I mention our UX is great?"
|
||||
date: 2023-03-08
|
||||
lastmod: 2023-03-08
|
||||
draft: false
|
||||
weight: 50
|
||||
images: ["icon.png"]
|
||||
contributors: ["Aravinth Manivannan"]
|
||||
---
|
||||
|
||||
Hello and welcome to the (August 2022 to) February, 2023 monthly report!
|
||||
|
||||
## TL;DR
|
||||
|
||||
_[Gusted](https://gusted.xyz) and I secured funding from NLnet to work
|
||||
on mCaptcha in 2023, we suffered an outage from 15 January to February
|
||||
6, polyfill benchmarking support in mCaptcha_
|
||||
|
||||
## We have funding!
|
||||
|
||||
[Gusted](https://gusted.xyz) and I applied and secured funding through
|
||||
2023 development is funded through the [NGI0
|
||||
Entrust](https://nlnet.nl/entrust) Fund, via [NLnet](https://nlnet.nl).
|
||||
|
||||
The full list of tasks that we'll be working on in the period is is
|
||||
available
|
||||
[here](https://git.batsense.net/mCaptcha/2023-NLnet/projects/6).
|
||||
|
||||
## Infrastructure outage: 15 January, 2023 to February 6, 2023
|
||||
|
||||
A hard disk on of the servers hosting mCaptcha infrastructure failed,
|
||||
which caused the outage. Fixing the hard disk lead to additional
|
||||
problems, the fan on that server was failing and we couldn't get spares
|
||||
sooner.
|
||||
|
||||
We had current backups, so there was no data loss.
|
||||
|
||||
Going forward, we are planning to create Infrastructure-as-Code to fully
|
||||
restore all mCaptcha infrastructure, so that in the even of an outage,
|
||||
we could restore our infrastructure in much shorter duration.
|
||||
|
||||
## mCaptcha/survey now includes polyfill benchmarking
|
||||
|
||||
mCaptcha/survey runs benchmarks with mCaptcha's PoW algorithm to collect
|
||||
statistics on how mCaptcha performs on various browsers and devices. So
|
||||
far, we've only been running benchmarks with the WebAssembly
|
||||
implementation. This [pull request](https://github.com/mCaptcha/survey/pull/14) added support for running benchmarks
|
||||
with the JavaScript polyfill implementation on browsers without
|
||||
WebAssembly support.
|
|
@ -1,6 +1,6 @@
|
|||
---
|
||||
title: "July, 2022: Monthly Report"
|
||||
description: "Codeberg is trying out mCaptcha, Gitea is getting mCaptcha support, mCaptcha supports MariaDB, I've applied for NLnet and Open Tech Fund, documentation is updated: tutorials and glossary is added and glue libraries have new releases."
|
||||
description: "Codeberg is trying you mCaptcha, Gitea is getting mCaptcha support, mCaptcha supports MariaDB, I've applied for NLnet and Open Tech Fund, documentation is updated: tutorials and glossary is added and glue libraries have new releases."
|
||||
lead: "We are mCaptcha. We build kickass CAPTCHA systems that give (DDoS) attackers a run for their money. And we do all of this without tracking your users. Oh and did I mention our UX is great?"
|
||||
date: 2022-08-04
|
||||
lastmod: 2022-08-04
|
||||
|
@ -14,7 +14,7 @@ Hello and welcome to the July, 2022 monthly report!
|
|||
|
||||
## TL;DR
|
||||
|
||||
_Codeberg is trying out mCaptcha, Gitea is getting mCaptcha support,
|
||||
_Codeberg is trying you mCaptcha, Gitea is getting mCaptcha support,
|
||||
mCaptcha supports MariaDB, I've applied for NLnet and Open Tech Fund,
|
||||
documentation is updated: tutorials and glossary is added and glue libraries
|
||||
have new releases._
|
||||
|
@ -69,7 +69,7 @@ mCaptcha docs over the months have become inconsistent and incorrect. I
|
|||
cleaned up some of the mess and added [a
|
||||
tutorial](/docs/introduction/installing-captcha/) to help folks install
|
||||
mCaptcha on their website. The docs also gets [a
|
||||
glossary](/docs/webmasters/terminology/), which contain explanations
|
||||
glossary](/docs/terminology/access-token/), which contain explanations
|
||||
to mCaptcha jargon.
|
||||
|
||||
## New releases: glue libraries
|
||||
|
|
|
@ -1,73 +0,0 @@
|
|||
---
|
||||
title: "Introducing mCaptcha net"
|
||||
description: "A network of mCaptcha instances sharing PoW stats to make mCaptcha more efficient and accessible"
|
||||
date: 2023-10-19
|
||||
lastmod: 2023-10-19
|
||||
draft: false
|
||||
weight: 50
|
||||
images: ["icon.png"]
|
||||
contributors: ["Aravinth Manivannan"]
|
||||
---
|
||||
|
||||
mCaptcha uses a Proof-of-Work (PoW) based algorithm to offer
|
||||
Denial-of-Service protection, because of [its excellent accessibility
|
||||
characteristics](https://www.w3.org/TR/turingtest/#proof-of-work). PoW
|
||||
within mCaptcha is configuration --- webmasters can configure
|
||||
[difficulty factors](/docs/terminology/difficulty-factor) for their
|
||||
installations, which determines waiting time for visitors. But PoW can
|
||||
become inaccessible if webmasters choose a very high difficulty factor.
|
||||
So they have to maintain a balance which imposes sufficient load on DDoS
|
||||
attackers while also being accessible to common folk.
|
||||
|
||||
{{< alert icon="⭐" text=" mCaptcha installation: integration of the mCaptcha widget to a service." >}}
|
||||
|
||||
To help webmasters correctly configure difficult factors, we are
|
||||
building a feedback loop which would gather performance statistics from
|
||||
voluntary mCaptcha installations and make them available to other
|
||||
mCaptcha installations. The performance statistics can be used by all
|
||||
mCaptcha instances to automatically optimize an installation. We are
|
||||
calling this the mCaptcha net.
|
||||
|
||||
## Participation is optional
|
||||
|
||||
Participation in the mCaptcha net is disabled by default and is
|
||||
optional as it has privacy implications: it will reveal the
|
||||
existence of an mCaptcha instance.
|
||||
|
||||
The admins of mCaptcha instances can choose to upload truly anonymous
|
||||
PoW performance statistics to a number of [mCaptcha/survey](https://git.batsense.net/mCaptcha/survey) instances.
|
||||
The data uploaded is public and so is accessible to all mCaptcha
|
||||
instances.
|
||||
|
||||
We also offer opt-in controls at installation level:
|
||||
|
||||
{{% img src="installation-level-opt-in.png" alt="A screenshot of the 'add sitekey' form on the mCaptcha dashboard with a checkbox for anonymously publishing performance statistics. It is not checked by default." caption="Add sitekey form on the mCaptcha dashboard with a checkbox for anonymously publishing performance statistics. It is not checked by default." %}}
|
||||
|
||||
## Ensuring anonymity
|
||||
|
||||
mCaptcha doesn't fingerprint its users. Performance parameters include:
|
||||
|
||||
1. Time taken to generate PoW
|
||||
2. The difficulty factor for which the PoW was computed
|
||||
3. Type of client library used.
|
||||
|
||||
```json
|
||||
"time":14,
|
||||
"difficulty_factor":50000,
|
||||
"worker_type":"wasm"
|
||||
```
|
||||
|
||||
This doesn't include the usual fingerprinting parameters like
|
||||
User-Agent, cookies, and IP address. Additionally, we use pseudo IDs
|
||||
at both mCaptcha/mCaptcha and mCaptcha/survey to avoid exposing installations.
|
||||
|
||||
{{% img src="working-rpc.png" alt="A screenshot of a tmux window with logs of mCaptcha/mCaptcha and mCapctha/survey showing both of them talking to eachother" caption="mCaptcha/mCaptcha uploading performance statistics to a mCaptcha/survey instance" %}}
|
||||
|
||||
## Status
|
||||
|
||||
We now have performance statistics uploads to mCaptcha/survey instances
|
||||
working. Pull request [mCaptcha/mCaptcha#92](https://github.com/mCaptcha/mCaptcha/pull/92)
|
||||
added abilities to mCaptcha to upload statistics to mCaptcha/survey instances and
|
||||
[mCaptcha/survey#40](https://git.batsense.net/mCaptcha/survey/pulls/17) enable survey to process the uploaded data. We will soon build a
|
||||
self-tuning algorithm within mCaptcha to use this data and optimize
|
||||
installations automatically.
|
Before Width: | Height: | Size: 52 KiB |
Before Width: | Height: | Size: 315 KiB |
|
@ -1,34 +0,0 @@
|
|||
---
|
||||
title: "Testing on screenreaders"
|
||||
description: "A network of mCaptcha instances sharing PoW stats to make mCaptcha more efficient and accessible"
|
||||
date: 2024-02-10
|
||||
lastmod: 2024-02-12
|
||||
draft: false
|
||||
weight: 50
|
||||
images: ["icon.png"]
|
||||
contributors: ["Aravinth Manivannan"]
|
||||
---
|
||||
|
||||
[HAN University of Applied Sciences](www.han.nl) kindly did an
|
||||
accessibility test of the mCaptcha widget and the showcase site, which
|
||||
features a real world integration of mCaptcha in a third-party service.
|
||||
The report motived us to make screen reader testing an integral part of
|
||||
the release process.
|
||||
|
||||
Here are the results:
|
||||
|
||||
## Android in-built screen reader on Fennec
|
||||
|
||||
<iframe title="Testing mCaptcha on Android screenreader with Fennec browser" width="560" height="315" src="https://peertube.batsense.net/videos/embed/e9579d73-b19e-4051-9337-8432fc15c3b3" frameborder="0" allowfullscreen="" sandbox="allow-same-origin allow-scripts allow-popups"></iframe>
|
||||
|
||||
## NVDA on Microsoft Windows and Mozilla Firefox
|
||||
|
||||
<iframe title="Testing mCaptcha on NVDA screen reader on MS Windows with Mozilla Firefox browser" width="560" height="315" src="https://peertube.batsense.net/videos/embed/cf534270-8089-4aad-95b3-543c467a6a12" frameborder="0" allowfullscreen="" sandbox="allow-same-origin allow-scripts allow-popups"></iframe>
|
||||
|
||||
## macOS in-built screen reader on Google Chrome
|
||||
|
||||
<iframe title="Testing mCaptcha on macOS in-built screen reader and Google Chrome browser" width="560" height="315" src="https://peertube.batsense.net/videos/embed/45be4f8c-1978-4650-b9f1-972cfead8420" frameborder="0" allowfullscreen="" sandbox="allow-same-origin allow-scripts allow-popups"></iframe>
|
||||
|
||||
## iOS in-built screen reader on Safari
|
||||
|
||||
<iframe title="Testing mCaptcha on iOS screenreader with Safari" width="560" height="315" src="https://peertube.batsense.net/videos/embed/ac9722a4-3dce-4c40-bb0c-7bc8d721c3db" frameborder="0" allowfullscreen="" sandbox="allow-same-origin allow-scripts allow-popups"></iframe>
|
|
@ -1,6 +1,6 @@
|
|||
---
|
||||
title : "Webmasters"
|
||||
description: "Introduction to mCaptcha for webmasters"
|
||||
title : "Introduction"
|
||||
description: "Introduction to mCaptcha."
|
||||
lead: ""
|
||||
date: 2020-10-06T08:48:45+00:00
|
||||
lastmod: 2020-10-06T08:48:45+00:00
|
|
@ -10,7 +10,7 @@ draft: false
|
|||
images: []
|
||||
menu:
|
||||
docs:
|
||||
parent: "Webmasters"
|
||||
parent: "Introduction"
|
||||
weight: 512
|
||||
toc: true
|
||||
---
|
Before Width: | Height: | Size: 23 KiB After Width: | Height: | Size: 23 KiB |
Before Width: | Height: | Size: 26 KiB After Width: | Height: | Size: 26 KiB |
Before Width: | Height: | Size: 62 KiB After Width: | Height: | Size: 62 KiB |
|
@ -8,7 +8,7 @@ draft: false
|
|||
images: []
|
||||
menu:
|
||||
docs:
|
||||
parent: "Webmasters"
|
||||
parent: "Introduction"
|
||||
weight: 511
|
||||
toc: true
|
||||
---
|
||||
|
@ -37,9 +37,19 @@ a new site key, click on "New Site" button in the dashboard.
|
|||
{{% img src="new-sitekey-btn.png" alt="mCaptcha dashboard with the 'new site key' button highlighted" %}}
|
||||
|
||||
There are two options to create a new site key, easy and advanced. **We
|
||||
are going to use the [easy mode](/docs/webmasters/configuring-difficulty-factor#easy-option) in this tutorial.** If you are interested
|
||||
are going to use the easy mode in this tutorial.** If you are interested
|
||||
in learning more about the advance mode, please see [here](/docs/introduction/configuring-difficulty-factor/#advance-option).
|
||||
|
||||
> ### [Easy Mode](/docs/introduction/configuring-difficulty-factor/#easy-option)
|
||||
>
|
||||
> Easy mode asks a few basic statistics about your website and generates a
|
||||
> configuration that should work for your website. Currently, easy mode is
|
||||
> guided by assumptions on suitable difficulty factors to protect a
|
||||
> website but it will be fine-tuned as mCaptcha sees more deployment.
|
||||
>
|
||||
> Configuration generated by easy mode can be tweaked later using the
|
||||
> advance mode, as you become more familiar with how mCaptcha works.
|
||||
|
||||
Fill the form and submit it.
|
||||
|
||||
{{% img src="new-sitekey-easy-mode-filled.png" alt="mCaptcha dashboard with the 'new site key' form in easy mode, with details filled in" %}}
|
||||
|
@ -70,20 +80,16 @@ to replace `Your {{paste your widget link}}` with the link obtained from
|
|||
the previous step.
|
||||
|
||||
```html
|
||||
<label
|
||||
data-mcaptcha_url="{{paste your widget link here}}"
|
||||
for="mcaptcha__token"
|
||||
id="mcaptcha__token-label"
|
||||
>
|
||||
mCaptcha authorization token.
|
||||
<a
|
||||
href="https://mcaptcha.org/docs/user-manual/how-to-mcaptcha-without-js/"
|
||||
>Instructions</a
|
||||
>.
|
||||
<input type="text" name="mcaptcha__token" id="mcaptcha__token" />
|
||||
</label>
|
||||
<div id="mcaptcha__widget-container"></div>
|
||||
<script src="https://unpkg.com/@mcaptcha/vanilla-glue@0.1.0-rc2/dist/index.js"></script>
|
||||
<script src="https://unpkg.com/@mcaptcha/vanilla-glue@0.1.0-alpha-2/dist/index.js"></script>
|
||||
<script charset="utf-8">
|
||||
let config = {
|
||||
widgetLink: new URL(
|
||||
{{paste yout widget link}}
|
||||
),
|
||||
};
|
||||
new mcaptchaGlue.default(config);
|
||||
</script>
|
||||
```
|
||||
|
||||
A full example is available
|
||||
|
@ -91,7 +97,7 @@ A full example is available
|
|||
|
||||
## 5. Configure backend to authenticate CAPTCHA tokens
|
||||
|
||||
1. Get [authorization token](/docs/webmasters/terminology/#authorization-token) from the user's
|
||||
1. Get [access token](/docs/terminology/access-token) from the user's
|
||||
form submission payload. The access token will be associated with a
|
||||
parameter called `mcaptcha__token`.
|
||||
|
||||
|
@ -114,8 +120,6 @@ resp = requests.post(
|
|||
resp = resp.json()
|
||||
```
|
||||
|
||||
**Note**: secret (`mcaptcha_account_secret` from above) is available in Dashboard > Settings > Secret
|
||||
|
||||
3. If access token is valid, allow access to protected resource or deny
|
||||
access.
|
||||
|
Before Width: | Height: | Size: 28 KiB After Width: | Height: | Size: 28 KiB |
Before Width: | Height: | Size: 23 KiB After Width: | Height: | Size: 23 KiB |
Before Width: | Height: | Size: 64 KiB After Width: | Height: | Size: 64 KiB |
Before Width: | Height: | Size: 29 KiB After Width: | Height: | Size: 29 KiB |
Before Width: | Height: | Size: 26 KiB After Width: | Height: | Size: 26 KiB |
Before Width: | Height: | Size: 26 KiB After Width: | Height: | Size: 26 KiB |
|
@ -1,5 +1,5 @@
|
|||
---
|
||||
title : "Self-Hosting"
|
||||
title : "Self-Hosted"
|
||||
description: "Instructions to self-host mCaptcha"
|
||||
lead: ""
|
||||
date: 2021-07-21 15:44
|
130
content/docs/self-hosted/bare-metal.md
Normal file
|
@ -0,0 +1,130 @@
|
|||
---
|
||||
title: "Deploy bare metal"
|
||||
description: "Bare metal deployment is tedious, most of this will be automated with a script in the future."
|
||||
lead: "Bare metal deployment is tedious, most of this will be automated with a script in the future."
|
||||
date: 2021-07-21 14:49
|
||||
lastmod: 2021-07-21 14:49
|
||||
draft: false
|
||||
images: []
|
||||
menu:
|
||||
docs:
|
||||
parent: "Self-Hosted"
|
||||
weight: 532
|
||||
toc: true
|
||||
---
|
||||
|
||||
### 2. Configure
|
||||
|
||||
mcaptcha is highly configurable.
|
||||
|
||||
Configuration is applied/merged in the following order:
|
||||
|
||||
1. path to configuration file passed in via `MCAPTCHA_CONFIG`
|
||||
2. `./config/default.toml`
|
||||
3. `/etc/mcaptcha/config.toml`
|
||||
4. environment variables.
|
||||
|
||||
|
||||
|
||||
### 1. Install postgres if you don't have it already.
|
||||
For Debian based distributions:
|
||||
```bash
|
||||
sudo apt install postgres
|
||||
```
|
||||
|
||||
### 2. Create new user for running `mcaptcha`
|
||||
|
||||
```bash
|
||||
$ sudo useradd -b /srv -m -s /usr/bin/zsh mcaptcha
|
||||
```
|
||||
|
||||
### 3. Create new user in Postgres
|
||||
|
||||
```bash
|
||||
$ sudo -iu postgres # switch to `postgres` user
|
||||
$ psql
|
||||
postgres=# CREATE USER mcaptcha WITH PASSWORD 'my super long password and yes you need single quote`;
|
||||
$ createdb -O mcaptcha mcaptcha # create db 'mcaptcha' with 'mcaptcha' as owner
|
||||
```
|
||||
|
||||
### 4. Install and load [`mCaptcha/cache`](https://github.com/mCaptcha/cache) module:
|
||||
|
||||
See [`mCaptcha/cache`](https://github.com/mCaptcha/cache) for more
|
||||
details.
|
||||
|
||||
### 4. Build `mcaptcha`
|
||||
|
||||
To build `mcaptcha`, you need the following dependencies:
|
||||
|
||||
1. rust
|
||||
2. node(`v14.16.0`)
|
||||
3. yarn(JavaScript package manager)
|
||||
4. make
|
||||
|
||||
## How to build
|
||||
|
||||
1. Install Cargo using [rustup](https://rustup.rs/) with:
|
||||
|
||||
```bash
|
||||
$ curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
|
||||
```
|
||||
|
||||
2. Install node(`v14.16.0`)
|
||||
|
||||
3. Install yarn(JavaScript package manager)
|
||||
|
||||
4. Build with make:
|
||||
|
||||
```bash
|
||||
$ make dev-env && \
|
||||
make release
|
||||
```
|
||||
|
||||
### 5. Install package:
|
||||
|
||||
```bash
|
||||
$ 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/mcaptcha.service`:
|
||||
|
||||
```systemd
|
||||
[Unit]
|
||||
Description=mCaptcha: a CAPTCHA system that gives attackers a run for their money
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
User=mcaptcha
|
||||
ExecStart=/usr/bin/mcaptcha
|
||||
Restart=on-failure
|
||||
RestartSec=1
|
||||
SuccessExitStatus=3 4
|
||||
RestartForceExitStatus=3 4
|
||||
SystemCallArchitectures=native
|
||||
MemoryDenyWriteExecute=true
|
||||
NoNewPrivileges=true
|
||||
Environment="RUST_LOG=info"
|
||||
|
||||
[Unit]
|
||||
After=sound.target
|
||||
Wants=network-online.target
|
||||
Wants=network-online.target
|
||||
Requires=postgresql.service
|
||||
After=syslog.target
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
```
|
||||
|
||||
2. Enable service:
|
||||
|
||||
```bash
|
||||
$ sudo systemctl daemon-reload && \
|
||||
sudo systemctl enable mcaptcha && \ # Auto startup during boot
|
||||
sudo systemctl start mcaptcha
|
||||
``
|
||||
```
|
101
content/docs/self-hosted/dependencies.md
Normal file
|
@ -0,0 +1,101 @@
|
|||
---
|
||||
title: "Database and cache"
|
||||
description: "mCaptcha server requires dependencies like a Postgres
|
||||
database and a Redis cache"
|
||||
lead: "mCaptcha server requires dependencies like a Postgres
|
||||
database and a Redis cache"
|
||||
date: 2021-07-21 14:49
|
||||
lastmod: 2021-07-21 14:49
|
||||
draft: false
|
||||
images: []
|
||||
menu:
|
||||
docs:
|
||||
parent: "Self-Hosted"
|
||||
weight: 534
|
||||
toc: true
|
||||
---
|
||||
|
||||
## Notes
|
||||
|
||||
### Database
|
||||
|
||||
- Database migrations are baked into the server binary so don't worry
|
||||
about them.
|
||||
|
||||
- When compiling from source, unset database configuration(comment out
|
||||
database configuration/ `unset` relevant environment variables).
|
||||
`mCaptcha` uses [`sqlx`](https://crates.io/crates/sqlx) database client
|
||||
library which checks SQL queries at compile time. So if you are starting
|
||||
with a fresh database without migrations applied, compilation will fail.
|
||||
|
||||
### Redis
|
||||
|
||||
- Redis is an optional dependency. Currently, the non-Redis configuration
|
||||
doesn't persist CAPTCHA heat. So if there's a systems failure, CAPTCHA
|
||||
heat will be reset and visitor count will start from 0. For small
|
||||
installations, this should post a problem as heat is short lived and is
|
||||
reset anyways at cool down period.
|
||||
|
||||
- mCaptcha uses a custom Redis module called
|
||||
[cache](https://github.com/mCaptcha/cache) to overcome some of Redis'
|
||||
limitations.
|
||||
|
||||
|
||||
## Instructions
|
||||
|
||||
Once again, there are two ways to go about this:
|
||||
|
||||
1. Docker
|
||||
2. Bare metal
|
||||
|
||||
### Docker
|
||||
|
||||
### Database
|
||||
|
||||
Download and run Postgres
|
||||
|
||||
```bash
|
||||
docker create --name mcaptcha-postgres \
|
||||
-e POSTGRES_PASSWORD=<database-password> \
|
||||
-p 5432:5432 \
|
||||
postgres && docker start mcaptcha-postgres
|
||||
```
|
||||
|
||||
### Redis
|
||||
|
||||
```bash
|
||||
docker create --name mcaptcha-cache \
|
||||
-p 6379:6379 \
|
||||
mcaptcha/cache && docker start mcaptcha-cache
|
||||
```
|
||||
|
||||
See [mCaptcha/cache](https://github.com/mCaptcha/cache) for more
|
||||
details.
|
||||
|
||||
### 1. Install Postgres if you don't have it already.
|
||||
|
||||
For Debian based distributions:
|
||||
|
||||
```bash
|
||||
sudo apt install postgres
|
||||
```
|
||||
|
||||
### 2. Create new user for running `mCaptcha`
|
||||
|
||||
```bash
|
||||
$ sudo useradd -b /srv -m -s /usr/bin/bash mcaptcha
|
||||
```
|
||||
|
||||
### 3. Create new user in Postgres
|
||||
|
||||
```bash
|
||||
$ sudo -iu postgres # switch to `postgres` user
|
||||
$ psql
|
||||
postgres=# CREATE USER mcaptcha WITH PASSWORD 'my super long password and yes you need single quote';
|
||||
$ createdb -O mcaptcha mcaptcha # create db 'mcaptcha' with 'mcaptcha' as owner
|
||||
```
|
||||
|
||||
### 4. Install [`mCaptcha/cache`](https://github.com/mCaptcha/cache)
|
||||
|
||||
See [`mCaptcha/cache`](https://github.com/mCaptcha/cache) for more
|
||||
details.
|
|
@ -7,8 +7,8 @@ draft: false
|
|||
images: []
|
||||
menu:
|
||||
docs:
|
||||
parent: "Self-Hosting"
|
||||
weight: 534
|
||||
parent: "Self-Hosted"
|
||||
weight: 533
|
||||
toc: true
|
||||
---
|
||||
|
||||
|
@ -33,7 +33,7 @@ for configurable options.
|
|||
|
||||
If you have already have a Postgres instance running, then:
|
||||
|
||||
```
|
||||
```bash
|
||||
docker run -p <host-machine-port>:<port-in-configuration-file> \
|
||||
--add-host=database:<database-ip-addrss> \
|
||||
-e RUST_LOG=debug \
|
||||
|
@ -42,26 +42,18 @@ docker run -p <host-machine-port>:<port-in-configuration-file> \
|
|||
```
|
||||
|
||||
If you don't have a Postgres instance running, you can either install
|
||||
one using a package manager or launch one with docker.
|
||||
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 mcaptcha instance.
|
||||
|
||||
## With docker-compose
|
||||
|
||||
1. Download docker-compose file and the configuration file:
|
||||
1. Follow steps above to build docker image.
|
||||
|
||||
```
|
||||
wget https://raw.githubusercontent.com/mCaptcha/mCaptcha/master/.env.docker-compose
|
||||
wget https://raw.githubusercontent.com/mCaptcha/mCaptcha/master/docker-compose.yml
|
||||
```
|
||||
2. Set database password [docker-compose configuration]('../docker-compose.yml).
|
||||
|
||||
2. Configure deployment using `.env.docker-compose` environment variable
|
||||
file
|
||||
3. Launch network
|
||||
|
||||
3. Launch containers:
|
||||
|
||||
```
|
||||
```bash
|
||||
docker-compose up -d
|
||||
```
|
||||
|
||||
4. Configure SSL using reverse proxy: mCaptcha doesn't support SSL at
|
||||
the moment, so please use a reverse proxy to secure your instance. A
|
||||
reference nginx virtual host configuration file is available [here](../bare-metal/#6-install-and-configure-nginx).
|
|
@ -8,7 +8,7 @@ draft: false
|
|||
images: []
|
||||
menu:
|
||||
docs:
|
||||
parent: "Self-Hosting"
|
||||
parent: "Self-Hosted"
|
||||
weight: 531
|
||||
toc: true
|
||||
---
|
||||
|
@ -17,6 +17,5 @@ toc: true
|
|||
|
||||
There are two main ways to self-host mCaptcha:
|
||||
|
||||
1. [Bare metal](../bare-metal)
|
||||
2. [With Docker](../docker)
|
||||
2. [With Ansible](../ansible)
|
||||
1. [Bare metal](./bare-metal)
|
||||
2. [With Docker](./docker)
|
|
@ -1,50 +0,0 @@
|
|||
---
|
||||
title: "Using Ansible"
|
||||
description: "Deploy mCaptcha software using Ansible playbooks"
|
||||
lead: "Deploy mCaptcha software using Ansible playbooks"
|
||||
date: 2023-12-03 15:14
|
||||
lastmod: 2023-12-09 03:09
|
||||
draft: false
|
||||
images: []
|
||||
menu:
|
||||
docs:
|
||||
parent: "Self-Hosting"
|
||||
weight: 533
|
||||
toc: true
|
||||
---
|
||||
|
||||
Ansible playbooks to install mCaptcha are available [here](https://git.batsense.net/mCaptcha/iac).
|
||||
|
||||
## Instructions
|
||||
|
||||
### Installation
|
||||
|
||||
1. Clone the repository:
|
||||
|
||||
```bash
|
||||
git clone https://git.batsense.net/mCaptcha/iac && cd iac
|
||||
```
|
||||
|
||||
2. Create inventory file. You should have SSH access to the remote
|
||||
machine, and the user must have `sudo` privileges. Example inventory
|
||||
file:
|
||||
|
||||
```ini
|
||||
[mcaptcha_hosts]
|
||||
"mcaptcha_hosts"
|
||||
<node name> ansible_host=<node IP> ansible_user=<remote username>
|
||||
```
|
||||
|
||||
It is important that the group name be `mcaptcha_hosts`.
|
||||
|
||||
3. Configure installation by editing [ansible/vars/mcaptcha/vars.yml](https://git.batsense.net/mCaptcha/iac/src/branch/master/ansible/vars/mcaptcha/vars.yml). Most parameters have defaults, and the required parameters are annotated.
|
||||
4. Run playbook:
|
||||
|
||||
```bash
|
||||
ansible-playbook -i path/to/inventory-file -f 10 ./ansible/mcaptcha.yml
|
||||
```
|
||||
|
||||
### Update
|
||||
|
||||
1. Pull changes from Git repository
|
||||
2. Rerun playbook
|
|
@ -1,180 +0,0 @@
|
|||
---
|
||||
title: "Deploy bare metal"
|
||||
description: "Bare metal deployment is tedious, most of this will be automated with a script in the future."
|
||||
lead: "Bare metal deployment is tedious, most of this will be automated with a script in the future."
|
||||
date: 2021-07-21 14:49
|
||||
lastmod: 2021-07-21 14:49
|
||||
draft: false
|
||||
images: []
|
||||
menu:
|
||||
docs:
|
||||
parent: "Self-Hosting"
|
||||
weight: 532
|
||||
toc: true
|
||||
---
|
||||
|
||||
## 1. Install Database
|
||||
|
||||
The following databases are supported:
|
||||
|
||||
1. Postgres
|
||||
2. MariaDB
|
||||
|
||||
Please install the database of your choice. Then:
|
||||
|
||||
1. Create new database user for mCaptcha
|
||||
2. Create new database for mCaptcha
|
||||
|
||||
mCaptcha binary has migrations baked-in and is applied on start up. The
|
||||
choice of database is described using the [scheme](https://developer.mozilla.org/en-US/docs/Learn/Common_questions/Web_mechanics/What_is_a_URL#scheme) of the database URL. For
|
||||
instance:
|
||||
|
||||
1. Postgres: `postgres://mcaptcha:password@localhost:5432/mcaptcha`
|
||||
2. Mariadb: `mysql://mcaptcha:password@localhost:3306/mcaptcha`
|
||||
|
||||
## 2. Optionally, install mCaptcha/cache
|
||||
|
||||
We recommend this for larger instances. For single-user instances or for
|
||||
instances that protect personal websites, we recommend using the
|
||||
internal cache system. To do so, please comment out the
|
||||
[`redis`](https://github.com/mCaptcha/mCaptcha/blob/d4967626ee59504b32b0f85e409b4e3444ddc4f0/config/default.toml#L54) section of the configuration file.
|
||||
|
||||
Please see [`mCaptcha/cache`](https://github.com/mCaptcha/cache) for more details.
|
||||
|
||||
## 3. Install mCaptcha
|
||||
|
||||
### 3.1 Install from source
|
||||
|
||||
To build `mcaptcha`, you need the following dependencies:
|
||||
|
||||
1. rust
|
||||
2. node(`v20`)
|
||||
3. yarn(JavaScript package manager)
|
||||
4. make
|
||||
|
||||
With all dependencies installed, run:
|
||||
|
||||
```
|
||||
make dev-env && make release
|
||||
```
|
||||
|
||||
And the following commands to install the compiled binary:
|
||||
|
||||
```
|
||||
sudo cp ./target/release/mcaptcha /usr/bin/ && \
|
||||
mkdir sudo /etc/mcaptcha && \
|
||||
sudo cp config/default.toml /etc/mcaptcha/config.toml
|
||||
```
|
||||
|
||||
### 3.2 Install pre-compiled binary
|
||||
|
||||
#### i. Download assets
|
||||
|
||||
```
|
||||
wget https://dl.mcaptcha.org/mcaptcha/mCaptcha/master/mcaptcha-master-linux-amd64.tar.gz.asc
|
||||
wget https://dl.mcaptcha.org/mcaptcha/mCaptcha/master/mcaptcha-master-linux-amd64.tar.gz.sha256
|
||||
wget https://dl.mcaptcha.org/mcaptcha/mCaptcha/master/mcaptcha-master-linux-amd64.tar.gz
|
||||
```
|
||||
|
||||
### ii Verify checksum
|
||||
|
||||
```
|
||||
sha256sum -c mcaptcha-master-linux-amd64.tar.gz.sha256
|
||||
```
|
||||
|
||||
### iii Verify GPG signature
|
||||
|
||||
All mcaptcha binaries are signed with [our GPG
|
||||
key](https://keyserver.ubuntu.com/pks/lookup?search=73DAC973A9ADBB9ADCB5CDC4595A08135BA9FF73&fingerprint=on&op=index).
|
||||
Please verify signatures to verify authenticity.
|
||||
|
||||
```
|
||||
gpg --keyserver keyserver.ubuntu.com --recv 73DAC973A9ADBB9ADCB5CDC4595A08135BA9FF73
|
||||
gpg --verify mcaptcha-master-linux-amd64.tar.gz.asc
|
||||
```
|
||||
|
||||
### iv. Install
|
||||
|
||||
```
|
||||
tar -xvzf mcaptcha-master-linux-amd64.tar.gz \
|
||||
&& sudo cp mcaptcha-master-linux-amd64/mcaptcha /usr/local/bin \
|
||||
&& sudo mkdir /etc/mcaptcha \
|
||||
&& sudo cp mcaptcha-master-linux-amd64/config.toml /etc/mcaptcha/
|
||||
```
|
||||
|
||||
### 4. Configuration
|
||||
|
||||
mCaptcha is highly configurable.
|
||||
|
||||
Configuration is applied/merged in the following order:
|
||||
|
||||
1. path to configuration file passed in via `MCAPTCHA_CONFIG`
|
||||
2. `./config/default.toml`
|
||||
3. `/etc/mcaptcha/config.toml`
|
||||
4. environment variables. Please see
|
||||
[here](https://github.com/mCaptcha/mCaptcha/blob/master/docs/CONFIGURATION.md) for a full list of environment variables.
|
||||
|
||||
### 5. Systemd service configuration:
|
||||
|
||||
1. Copy the following to `/etc/systemd/system/mcaptcha.service`:
|
||||
|
||||
```
|
||||
[Unit]
|
||||
Description=mCaptcha: a CAPTCHA system that gives attackers a run for their money
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
User=mcaptcha
|
||||
ExecStart=/usr/bin/mcaptcha
|
||||
Restart=on-failure
|
||||
RestartSec=1
|
||||
SuccessExitStatus=3 4
|
||||
RestartForceExitStatus=3 4
|
||||
SystemCallArchitectures=native
|
||||
MemoryDenyWriteExecute=true
|
||||
NoNewPrivileges=true
|
||||
Environment="RUST_LOG=info"
|
||||
|
||||
[Unit]
|
||||
After=sound.target
|
||||
Wants=network-online.target
|
||||
Wants=network-online.target
|
||||
Requires=postgresql.service
|
||||
After=syslog.target
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
```
|
||||
|
||||
2. Enable service:
|
||||
|
||||
```
|
||||
sudo systemctl daemon-reload && \
|
||||
sudo systemctl enable mcaptcha && \ # Auto startup during boot
|
||||
sudo systemctl start mcaptcha
|
||||
```
|
||||
|
||||
### 6. Install and configure Nginx
|
||||
|
||||
mCaptcha doesn't implement SSL yet. Please use a reverse proxy like
|
||||
Nginx to add SSL to your deployment. Here's an example virtual host
|
||||
configuration for Nginx:
|
||||
|
||||
```
|
||||
server {
|
||||
server_name <your mcaptcha hostname>;
|
||||
listen 80;
|
||||
listen [::]:80;
|
||||
|
||||
location / {
|
||||
proxy_pass http://127.0.0.1:<mcaptcha_port>;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection "upgrade";
|
||||
proxy_set_header X-Forwarded-For $remote_addr;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
}
|
||||
|
||||
}
|
||||
```
|
9
content/docs/terminology/_index.md
Normal file
|
@ -0,0 +1,9 @@
|
|||
---
|
||||
title : "Terminology"
|
||||
description: "Information about terminology used in mCaptcha, some of which unique to the project"
|
||||
lead: ""
|
||||
date: 2022-07-27T08:48:45+00:00
|
||||
lastmod: 2020-07-27T08:48:45+00:00
|
||||
draft: false
|
||||
images: []
|
||||
---
|
37
content/docs/terminology/access-token.md
Normal file
|
@ -0,0 +1,37 @@
|
|||
---
|
||||
title: "Access token"
|
||||
description: "mCaptcha implements leaky bucket algorithm to measure
|
||||
current traffic levels. Cooldown period specifies the leak or the time
|
||||
after which a visitor addition is decremented."
|
||||
lead: ""
|
||||
date: 2022-07-22
|
||||
lastmod: 2022-07-22 20:17
|
||||
draft: false
|
||||
images: []
|
||||
menu:
|
||||
docs:
|
||||
parent: "Terminology"
|
||||
weight: 521
|
||||
toc: true
|
||||
---
|
||||
|
||||
When a visitor solves the CAPTCHA and sends their solution to an
|
||||
mCaptcha instance, the solution will be verified for correctness. If the
|
||||
solution is correct, mCaptcha will return a single use access token.
|
||||
|
||||
This access token should be attached to the visitor's requited to the
|
||||
protected service and the protected service should validity of the
|
||||
access token with the mCaptcha instance and only allow access to
|
||||
protected resource if the access token is valid.
|
||||
|
||||
## Validate access token:
|
||||
|
||||
```bash
|
||||
curl --location --request POST 'https://mcaptcha.example.net/api/v1/pow/siteverify' \
|
||||
--header 'Content-Type: application/json' \
|
||||
--data-raw '{
|
||||
"token": "replace this with the access token presented by visitor",
|
||||
"key": "replace this with the sitekey associated with the CAPTCHA"
|
||||
"secret": "replace this with mCaptcha account secret, available in settings"
|
||||
}'
|
||||
```
|
30
content/docs/terminology/cooldown-period.md
Normal file
|
@ -0,0 +1,30 @@
|
|||
---
|
||||
title: "Cooldown Period"
|
||||
description: "mCaptcha implements leaky bucket algorithm to measure
|
||||
current traffic levels. Cooldown period specifies the leak or the time
|
||||
after which a visitor addition is decremented."
|
||||
lead: ""
|
||||
date: 2022-07-22
|
||||
lastmod: 2022-07-22 20:17
|
||||
draft: false
|
||||
images: []
|
||||
menu:
|
||||
docs:
|
||||
parent: "Terminology"
|
||||
weight: 522
|
||||
toc: true
|
||||
---
|
||||
|
||||
mCaptcha implements leaky bucket algorithm to measure
|
||||
current traffic levels. Cooldown period specifies the leak or the time
|
||||
after which a visitor addition is decremented.
|
||||
|
||||
For instance, if initial traffic level is 0 and a user visits one
|
||||
second later, the traffic level will be incremented to 1. Now, if the
|
||||
cooldown period is set to 30 seconds, the traffic level will be
|
||||
decremented after 30 seconds. So after 30 seconds, the traffic level will
|
||||
go from 1 to 0.
|
||||
|
||||
## Easy Mode: Default cooldown
|
||||
|
||||
When configuring mCaptcha in [easy Mode](/docs/introduction/configuring-difficulty-factor/#easy-option), the default cooldown period is set to 30 seconds.
|
23
content/docs/terminology/difficulty-factor/index.md
Normal file
|
@ -0,0 +1,23 @@
|
|||
---
|
||||
title: "Difficulty Factor"
|
||||
description: "Difficulty factor determines the time it takes to solve a CAPTCHA, there are two modes to setting difficulty factor: advance and easy, this page documents both modes."
|
||||
lead: ""
|
||||
date: 2022-07-22
|
||||
lastmod: 2022-07-22 20:17
|
||||
draft: false
|
||||
images: []
|
||||
menu:
|
||||
docs:
|
||||
parent: "Terminology"
|
||||
weight: 523
|
||||
toc: true
|
||||
---
|
||||
|
||||
Difficulty factor determines the time it takes to solve a CAPTCHA. The
|
||||
higher the difficulty factor, the longer it will take to generate a
|
||||
proof of work for it to solve the CAPTCHA.
|
||||
|
||||
mCaptcha's proof of work based mechanism makes it highly accessible to
|
||||
people with special needs but it is important to choose the difficulty factor
|
||||
with care as very high difficulty factors will make the CAPTCHA
|
||||
inaccessible to users on slow devices.
|
Before Width: | Height: | Size: 62 KiB After Width: | Height: | Size: 62 KiB |
|
@ -1,20 +1,23 @@
|
|||
---
|
||||
title: "Webmasters FAQ"
|
||||
description: "Frequently asked questions related to using mCaptcha as a webmaster"
|
||||
title: "Site key"
|
||||
description: "Site key is the unique identifier associated with a CAPTCHA created on mCaptcha"
|
||||
lead: ""
|
||||
date: 2022-07-27T08:48:45+00:00
|
||||
lastmod: 2020-07-27T08:48:45+00:00
|
||||
date: 2022-07-22
|
||||
lastmod: 2022-07-22 20:17
|
||||
draft: false
|
||||
images: []
|
||||
menu:
|
||||
docs:
|
||||
parent: "Webmasters"
|
||||
parent: "Terminology"
|
||||
weight: 524
|
||||
toc: true
|
||||
---
|
||||
|
||||
### Easy Mode: Default cooldown period
|
||||
Site key is a unique identifier associated with CAPTCHA configurations
|
||||
created on mCaptcha. It is required to integrate a CAPTCHA with your
|
||||
website.
|
||||
|
||||
When configuring mCaptcha in [easy mode](/docs/webmasters/configuring-difficulty-factor/#easy-option), the default cooldown period is set to 30 seconds.
|
||||
|
||||
## How to get site key from dashboard?
|
||||
## How to get site key?
|
||||
|
||||
1. Go to "Site keys" on the side panel in the dashboard
|
||||
|
Before Width: | Height: | Size: 26 KiB After Width: | Height: | Size: 26 KiB |
49
content/docs/terminology/visitor-threshold.md
Normal file
|
@ -0,0 +1,49 @@
|
|||
---
|
||||
title: "Visitor Threshold"
|
||||
description: "Visitor threshold is used to split traffic into levels. If
|
||||
the traffic level supersceedes the configured threshold, then mCaptcha will
|
||||
increase difficulty factor based on the configuration provided."
|
||||
lead: ""
|
||||
date: 2022-07-22
|
||||
lastmod: 2022-07-22 20:17
|
||||
draft: false
|
||||
images: []
|
||||
menu:
|
||||
docs:
|
||||
parent: "Terminology"
|
||||
weight: 525
|
||||
toc: true
|
||||
---
|
||||
|
||||
mCaptcha's variable difficulty factor mechanism requires a website's traffic
|
||||
statistics be split into levels, so that it can deploy the right
|
||||
difficulty factor for each level.
|
||||
|
||||
Visitor threshold is used to traffic into levels and mCaptcha accepts a
|
||||
difficulty configuration for each of these levels. When current traffic
|
||||
exceeds a difficulty factor, mCaptcha will increase the difficulty
|
||||
factor to the next configured level.
|
||||
|
||||
For instance, consider the configuration given below:
|
||||
|
||||
- Cool down period: 30 seconds
|
||||
|
||||
| Level | Difficulty Factor | Visitor Threshold |
|
||||
| ----- | ----------------- | ----------------- |
|
||||
| 1 | 5,000 | 2,000 |
|
||||
| 2 | 50,000 | 5,000 |
|
||||
| 3 | 500,000 | 10,000 |
|
||||
| 4 | 5,000,000 | 15,000 |
|
||||
|
||||
If the website sees 2,000 requests in a 30 second window, level 1
|
||||
difficulty factor(5,000) will be deployed. If the traffic increases to
|
||||
5,000 requests in a 30 second window, then difficulty factor will be
|
||||
upgraded to level 2(50,000). Likewise 10,000 and 15,000 requests over 30
|
||||
seconds will result in difficulty factor being upgraded to 500,000 and
|
||||
5,000,000 respectively.
|
||||
|
||||
Visitor threshold is how mCaptcha determines which difficulty factor
|
||||
level to deploy. mCaptcha uses leaky bucket algorithm to keep the
|
||||
visitor threshold constantly updated within the configured cool down
|
||||
period. So, at any given moment the, the current visitor level will be
|
||||
the amount of traffic that was served in the cool down period specified.
|
|
@ -1,9 +0,0 @@
|
|||
---
|
||||
title : "User Manual"
|
||||
description: "Introduction to mCaptcha for users"
|
||||
lead: ""
|
||||
date: 2023-10-27T08:48:45+00:00
|
||||
lastmod: 2023-10-27T08:48:45+00:00
|
||||
draft: false
|
||||
images: []
|
||||
---
|
|
@ -1,151 +0,0 @@
|
|||
---
|
||||
title: "CLI tool"
|
||||
description: "Instructions to install mCaptcha CLI"
|
||||
lead: ""
|
||||
date: 2023-10-27T08:48:45+00:00
|
||||
lastmod: 2023-10-27T08:48:45+00:00
|
||||
draft: false
|
||||
menu:
|
||||
docs:
|
||||
parent: "user-manual"
|
||||
---
|
||||
|
||||
A CLI tool exists to compute mCaptcha challenges. It can be installed
|
||||
from multiple sources:
|
||||
|
||||
## Install
|
||||
|
||||
### crates.io
|
||||
|
||||
The CLI tool is available on, [crates.io](https://crates.io), the Rust
|
||||
language's package registry. Rust language toolchain is required to
|
||||
install from crates.io, please see [rustup.rs](https://rustup.rs) for
|
||||
Instructions to install it.
|
||||
|
||||
```bash
|
||||
cargo install mcaptcha-cli
|
||||
```
|
||||
|
||||
### Pre-compiled binaries
|
||||
|
||||
Nightly builds and stable releases are regularly published to
|
||||
[dl.mcaptcha.org](https://dl.mcaptcha.org/mcaptcha/cli) for a variety of
|
||||
CPU architectures and operating systems.
|
||||
|
||||
1. Download binary, checksum and GPG signature files
|
||||
|
||||
```bash
|
||||
wget https://dl.mcaptcha.org/mcaptcha/cli/{VERSION}/{FILENAME}.tar.gz
|
||||
wget https://dl.mcaptcha.org/mcaptcha/cli/{VERSION}/{FILENAME}.tar.gz.asc
|
||||
wget https://dl.mcaptcha.org/mcaptcha/cli/{VERSION}/{FILENAME}.tar.gz.sha256
|
||||
```
|
||||
|
||||
2. Verify checksum
|
||||
|
||||
```bash
|
||||
sha256sum -c {FILENAME}.tar.gz.sha256
|
||||
```
|
||||
|
||||
3. Download mCaptcha's GPG release keys and verify GPG signature
|
||||
|
||||
```bash
|
||||
gpg --keyserver keyserver.ubuntu.com --recv 73DAC973A9ADBB9ADCB5CDC4595A08135BA9FF73
|
||||
gpg --verify {FILENAME}.tar.gz.asc
|
||||
```
|
||||
|
||||
4. Install Binary
|
||||
|
||||
```bash
|
||||
tar -xvzf {FILENAME}.tar.gz && sudo cp {FILENAME}/mcaptcha-cli /usr/local/bin
|
||||
```
|
||||
|
||||
### Build from source
|
||||
|
||||
1. Install Rust tool chain
|
||||
Please see [here](https://rustup.rs) for instructions.
|
||||
2. Download source code
|
||||
|
||||
```bash
|
||||
git clone https://git.batsense.net/mCaptcha/cli
|
||||
```
|
||||
|
||||
3. Compile and install
|
||||
|
||||
```bash
|
||||
cargo build --release && sudp cp ./target/release/mcaptcha-cli
|
||||
/usr/local/bin
|
||||
```
|
||||
|
||||
## Pass mCaptcha challenge
|
||||
|
||||
The CLI tool requires details about the challenge to work on it. The
|
||||
tool can be used in three different modes compute challenge:
|
||||
|
||||
1. Protected Page: Compute mCaptcha challenge for the CAPTCHA at a
|
||||
protected page
|
||||
2. Widget URL: Compute PoW for captcha at widget URL
|
||||
3. (Developer mode) Offline: Computes PoW over given CAPTCHA parameters
|
||||
|
||||
### From protected page URL
|
||||
|
||||
The most convenient mode: copy the URL of the webpage which has the
|
||||
mCaptcha widget (example: showcase.mcaptcha.org) and run the CLI tool
|
||||
with it to get an authorization code:
|
||||
Compute challenge using the URL
|
||||
|
||||
```bash
|
||||
03:39 atm@lab cli ±|feat-parse-webpage ✗|→ mcaptcha-cli protected-page https://showcase.mcaptcha.org/
|
||||
Authorization token: eRAZJiMrW58uDYA1s64Tmwq1u30HutuF
|
||||
```
|
||||
|
||||
### Widget URL
|
||||
|
||||
If you have the widget URL (will be in format https://mcaptcha.example.org/widget?sitekey=randomstring), it can be used to solve challenge as well:
|
||||
|
||||
```bash
|
||||
Compute PoW by fetching parameters from CAPTCHA URL
|
||||
|
||||
Usage: mcaptcha-cli online --url <URL>
|
||||
|
||||
Options:
|
||||
-u, --url <URL> URL of the CAPTCHA. Example: https://example.org/widget?sitekey=foo
|
||||
-h, --help Print help
|
||||
```
|
||||
|
||||
Example usage:
|
||||
|
||||
```bash
|
||||
13:32 atm@lab cli ±|online ✗|→ mcaptcha-cli online -u https://demo.mcaptcha.org/widget?sitekey=pHy0AktWyOKuxZDzFfoaewncWecCHo23
|
||||
Authorization token: 3xleN26OctBuVu3X4t6CYyUjErhaxQvz
|
||||
```
|
||||
|
||||
### [Developer mode] Offline
|
||||
|
||||
Useful while debugging mCaptcha configurations, works on raw challenge
|
||||
parameters.
|
||||
|
||||
Help menu:
|
||||
|
||||
```bash
|
||||
Compute PoW with offline parameters
|
||||
|
||||
Usage: mcaptcha-cli offline --salt <SALT> --phrase <PHRASE> --difficulty-factor <DIFFICULTY_FACTOR>
|
||||
|
||||
Options:
|
||||
-s, --salt <SALT> Salt with which PoW should be computed
|
||||
-p, --phrase <PHRASE> Phrase over which PoW should be computed
|
||||
-d, --difficulty-factor <DIFFICULTY_FACTOR> Difficulty Factor
|
||||
-h, --help Print help
|
||||
```
|
||||
|
||||
Example usage:
|
||||
|
||||
```bash
|
||||
13:28 atm@lab cli ±|online|→ mcaptcha-cli offline -s $(rand 32) -p $(rand 32) -d 50000
|
||||
difficulty: 50000
|
||||
nonce: 90507
|
||||
original phrase: f351f333d44b2c6b5bf7f033b065bbb8fb5e9dd153bd402e43ed04425f5a3859
|
||||
result: 340276562956196291522979356090220150471
|
||||
```
|
||||
|
||||
Where rand is [this](https://github.com/realaravinth/dotfiles/blob/6fc6c87cc912e17488a35c0d3327ecf393221270/scripts/rand#L20) script.
|
|
@ -1,22 +0,0 @@
|
|||
---
|
||||
title: "Use mCaptcha without JavaScript"
|
||||
description: "Instructions to solve mCaptcha with JavaScript disabled"
|
||||
lead: ""
|
||||
date: 2023-10-27T08:48:45+00:00
|
||||
lastmod: 2023-10-27T08:48:45+00:00
|
||||
draft: false
|
||||
menu:
|
||||
docs:
|
||||
parent : "user-manual"
|
||||
---
|
||||
|
||||
To use mCaptcha without JavaScript:
|
||||
|
||||
|
||||
1. Install mCaptcha CLI too. Please see [here](./cli) for instructions.
|
||||
2. Copy the URL of the protected page
|
||||
3. Run mCaptcha CLI with that URL:
|
||||
```bash
|
||||
mcapthca-cli protected-page <URL>
|
||||
```
|
||||
4. Copy authorization code and paste it in the form
|
|
@ -1,86 +0,0 @@
|
|||
---
|
||||
title: "Terminology"
|
||||
description: "Information about terminology used in mCaptcha, some of which unique to the project"
|
||||
lead: ""
|
||||
date: 2022-07-27T08:48:45+00:00
|
||||
lastmod: 2020-07-27T08:48:45+00:00
|
||||
draft: false
|
||||
menu:
|
||||
docs:
|
||||
parent: "Webmasters"
|
||||
---
|
||||
|
||||
## Authorization token
|
||||
|
||||
When a visitor solves the CAPTCHA and sends their solution to an
|
||||
mCaptcha instance, the solution will be verified for correctness. If the
|
||||
solution is correct, mCaptcha will return a single use authorization token.
|
||||
|
||||
This authorization token should be attached to the visitor's requited to the
|
||||
protected service and the protected service should validity of the
|
||||
authorization token with the mCaptcha instance and only allow authorization to
|
||||
protected resource if the authorization token is valid.
|
||||
|
||||
## Cooldown Period
|
||||
|
||||
mCaptcha implements leaky bucket algorithm to measure
|
||||
current traffic levels. Cooldown period specifies the leak or the time
|
||||
after which a visitor addition is decremented.
|
||||
|
||||
For instance, if initial traffic level is 0 and a user visits one
|
||||
second later, the traffic level will be incremented to 1. Now, if the
|
||||
cooldown period is set to 30 seconds, the traffic level will be
|
||||
decremented after 30 seconds. So after 30 seconds, the traffic level will
|
||||
go from 1 to 0.
|
||||
|
||||
## Difficulty Factor
|
||||
|
||||
Difficulty factor determines the time it takes to solve a CAPTCHA. The
|
||||
higher the difficulty factor, the longer it will take to generate a
|
||||
proof of work for it to solve the CAPTCHA.
|
||||
|
||||
mCaptcha's proof of work based mechanism makes it highly accessible to
|
||||
people with special needs but it is important to choose the difficulty factor
|
||||
with care as very high difficulty factors will make the CAPTCHA
|
||||
inaccessible to users on slow devices.
|
||||
|
||||
## Sitekey
|
||||
|
||||
Site key is a unique identifier associated with CAPTCHA configurations
|
||||
created on mCaptcha. It is required to integrate a CAPTCHA with your
|
||||
website.
|
||||
|
||||
## Visitor Threshold
|
||||
|
||||
mCaptcha's variable difficulty factor mechanism requires a website's traffic
|
||||
statistics be split into levels, so that it can deploy the right
|
||||
difficulty factor for each level.
|
||||
|
||||
Visitor threshold is used to traffic into levels and mCaptcha accepts a
|
||||
difficulty configuration for each of these levels. When current traffic
|
||||
exceeds a difficulty factor, mCaptcha will increase the difficulty
|
||||
factor to the next configured level.
|
||||
|
||||
For instance, consider the configuration given below:
|
||||
|
||||
- Cool down period: 30 seconds
|
||||
|
||||
| Level | Difficulty Factor | Visitor Threshold |
|
||||
| ----- | ----------------- | ----------------- |
|
||||
| 1 | 5,000 | 2,000 |
|
||||
| 2 | 50,000 | 5,000 |
|
||||
| 3 | 500,000 | 10,000 |
|
||||
| 4 | 5,000,000 | 15,000 |
|
||||
|
||||
If the website sees 2,000 requests in a 30 second window, level 1
|
||||
difficulty factor(5,000) will be deployed. If the traffic increases to
|
||||
5,000 requests in a 30 second window, then difficulty factor will be
|
||||
upgraded to level 2(50,000). Likewise 10,000 and 15,000 requests over 30
|
||||
seconds will result in difficulty factor being upgraded to 500,000 and
|
||||
5,000,000 respectively.
|
||||
|
||||
Visitor threshold is how mCaptcha determines which difficulty factor
|
||||
level to deploy. mCaptcha uses leaky bucket algorithm to keep the
|
||||
visitor threshold constantly updated within the configured cool down
|
||||
period. So, at any given moment the, the current visitor level will be
|
||||
the amount of traffic that was served in the cool down period specified.
|
|
@ -7,25 +7,6 @@ draft: false
|
|||
images: []
|
||||
---
|
||||
|
||||
## Funding
|
||||
|
||||
### NLnet
|
||||
|
||||
<div align="center">
|
||||
<img
|
||||
height="150px"
|
||||
alt="NLnet NGIZero logo"
|
||||
src="/third-party/NGIZero-green.hex.svg"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<br />
|
||||
|
||||
2023 development is funded through the [NGI0 Entrust
|
||||
Fund](https://nlnet.nl/entrust), via [NLnet](https://nlnet.nl/). Please
|
||||
see [here](https://nlnet.nl/project/mCaptcha/) for more details.
|
||||
|
||||
|
||||
## Free software libraries and tools
|
||||
|
||||
mCaptcha is built entirely using free software libraries tools. We are
|
||||
|
|
|
@ -6,9 +6,9 @@
|
|||
</div>
|
||||
<div class="col-lg-9 col-xl-8 text-center">
|
||||
<p class="lead">{{ .Params.lead | safeHTML }}</p>
|
||||
<a class="btn btn-primary btn-lg px-4 mb-2" href="https://showcase.mcaptcha.org/" role="button">Try mCaptcha</a>
|
||||
<a class="btn btn-primary btn-lg px-4 mb-2" href="https://demo.mcaptcha.org/" role="button">Try mCaptcha</a>
|
||||
     
|
||||
<a class="btn btn-primary btn-lg px-4 mb-2" href="{{ "/docs/webmasters/installing-captcha/" | absURL }}" role="button">Get started</a>
|
||||
<a class="btn btn-primary btn-lg px-4 mb-2" href="{{ "/docs/introduction/installing-captcha/" | absURL }}" role="button">Get started</a>
|
||||
<p class="meta">Libre software <a href="https://github.com/mCaptcha">GitHub</a></p>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -1 +1 @@
|
|||
<p class="edit-page"><a href="{{ .Site.Params.docsRepo }}/blob/master/content/{{ .File.Path }}"><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-edit-2"><path d="M17 3a2.828 2.828 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5L17 3z"></path></svg>Edit this page on git.batsense.net</a></p>
|
||||
<p class="edit-page"><a href="{{ .Site.Params.docsRepo }}/blob/master/content/{{ .File.Path }}"><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-edit-2"><path d="M17 3a2.828 2.828 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5L17 3z"></path></svg>Edit this page on GitHub</a></p>
|
||||
|
|
4369
package-lock.json
generated
|
@ -52,8 +52,5 @@
|
|||
"standard-version": "^9.1",
|
||||
"stylelint": "^13.11",
|
||||
"stylelint-config-standard": "^20.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"yarn": "^1.22.19"
|
||||
}
|
||||
}
|
||||
|
|
119
scripts/ci.sh
|
@ -1,119 +0,0 @@
|
|||
#!/bin/bash
|
||||
# ci.sh: Helper script to automate deployment operations on CI/CD
|
||||
# Copyright © 2022 Aravinth Manivannan <realaravinth@batsense.net>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero General Public License as
|
||||
# published by the Free Software Foundation, either version 3 of the
|
||||
# License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Affero General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
set -xEeuo pipefail
|
||||
#source $(pwd)/scripts/lib.sh
|
||||
|
||||
readonly SSH_ID_FILE=/tmp/ci-ssh-id
|
||||
readonly SSH_REMOTE_NAME=origin-ssh
|
||||
|
||||
match_arg() {
|
||||
if [ $1 == $2 ] || [ $1 == $3 ]
|
||||
then
|
||||
return 0
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
help() {
|
||||
cat << EOF
|
||||
USAGE: ci.sh [SUBCOMMAND]
|
||||
Helper script to automate deployment operations on CI/CD
|
||||
|
||||
Subcommands
|
||||
|
||||
-c --clean cleanup secrets, SSH key and other runtime data
|
||||
-i --init <SSH_PRIVATE_KEY> initialize environment, write SSH private to file
|
||||
-d --deploy <PAGES-SECRET> <TARGET BRANCH> push branch to Gitea and call Pages server
|
||||
-h --help print this help menu
|
||||
EOF
|
||||
}
|
||||
|
||||
# $1: SSH private key
|
||||
write_ssh(){
|
||||
truncate --size 0 $SSH_ID_FILE
|
||||
echo "$1" > $SSH_ID_FILE
|
||||
chmod 600 $SSH_ID_FILE
|
||||
}
|
||||
|
||||
set_ssh_remote() {
|
||||
http_remote_url=$(git remote get-url origin)
|
||||
remote_hostname=$(echo $http_remote_url | cut -d '/' -f 3)
|
||||
repository_owner=$(echo $http_remote_url | cut -d '/' -f 4)
|
||||
repository_name=$(echo $http_remote_url | cut -d '/' -f 5)
|
||||
ssh_remote="git@git.batsense.net:mcaptcha/website.git"
|
||||
git remote add $SSH_REMOTE_NAME $ssh_remote
|
||||
}
|
||||
|
||||
clean() {
|
||||
if [ -f $SSH_ID_FILE ]
|
||||
then
|
||||
shred $SSH_ID_FILE
|
||||
rm $SSH_ID_FILE
|
||||
fi
|
||||
}
|
||||
|
||||
# $1: Pages API secret
|
||||
# $2: Deployment target branch
|
||||
deploy() {
|
||||
if (( "$#" < 2 ))
|
||||
then
|
||||
help
|
||||
else
|
||||
git -c core.sshCommand="/usr/bin/ssh -oStrictHostKeyChecking=no -i $SSH_ID_FILE"\
|
||||
push --force $SSH_REMOTE_NAME $2
|
||||
curl -vv --location --request \
|
||||
POST "https://deploy.batsense.net/api/v1/update"\
|
||||
--header 'Content-Type: application/json' \
|
||||
--data-raw "{ \"secret\": \"$1\", \"branch\": \"$2\" }"
|
||||
fi
|
||||
}
|
||||
|
||||
if (( "$#" < 1 ))
|
||||
then
|
||||
help
|
||||
exit -1
|
||||
fi
|
||||
|
||||
|
||||
if match_arg $1 '-i' '--init'
|
||||
then
|
||||
if (( "$#" < 2 ))
|
||||
then
|
||||
help
|
||||
exit -1
|
||||
fi
|
||||
set_ssh_remote
|
||||
write_ssh "$2"
|
||||
elif match_arg $1 '-c' '--clean'
|
||||
then
|
||||
clean
|
||||
elif match_arg $1 '-d' '--deploy'
|
||||
then
|
||||
if (( "$#" < 3 ))
|
||||
then
|
||||
help
|
||||
exit -1
|
||||
fi
|
||||
deploy $2 $3
|
||||
elif match_arg $1 '-h' '--help'
|
||||
then
|
||||
help
|
||||
else
|
||||
help
|
||||
fi
|
157
scripts/hugo.sh
|
@ -1,157 +0,0 @@
|
|||
#!/bin/bash
|
||||
# Used in CI workflow: install hugo binary from GitHub
|
||||
# Copyright © 2021 Aravinth Manivannan <realaravinth@batsense.net>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero General Public License as
|
||||
# published by the Free Software Foundation, either version 3 of the
|
||||
# License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Affero General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
readonly PROJECT_ROOT=$(pwd)
|
||||
readonly TARBALL=hugo.tar.gz
|
||||
readonly SOURCE="https://github.com/gohugoio/hugo/releases/download/v0.110.0/hugo_extended_0.110.0_linux-amd64.tar.gz"
|
||||
|
||||
readonly BIN_PATH=tmp/bin
|
||||
readonly BIN=$BIN_PATH/hugo
|
||||
|
||||
readonly DIST=public
|
||||
|
||||
source $(pwd)/scripts/lib.sh
|
||||
|
||||
help() {
|
||||
cat << EOF
|
||||
hugo.sh: hugo build script
|
||||
USAGE:
|
||||
hugo.sh <options>
|
||||
OPTIONS:
|
||||
b build build website
|
||||
c clean clean dependencies and build artifacts
|
||||
d deploy deploy build to branch
|
||||
h help print this help menu
|
||||
i install install build dependencies
|
||||
u url make urls relative
|
||||
z hugo invoke hugo
|
||||
EOF
|
||||
}
|
||||
|
||||
download() {
|
||||
if [ ! -e $BIN_PATH ];
|
||||
then
|
||||
mkdir -p $BIN_PATH
|
||||
cd $BIN_PATH
|
||||
echo "[*] Downloading Hugo"
|
||||
wget --quiet --output-document=$TARBALL $SOURCE
|
||||
tar -xvzf $TARBALL > /dev/null
|
||||
rm $TARBALL
|
||||
echo "[*] Downloaded hugo into $BIN"
|
||||
cd $PROJECT_ROOT
|
||||
fi
|
||||
}
|
||||
|
||||
init() {
|
||||
if [ ! -d $BIN_PATH ]
|
||||
then
|
||||
mkdir $BIN_PATH
|
||||
fi
|
||||
|
||||
if [ ! -f $BIN ]
|
||||
then
|
||||
cd $BIN_PATH
|
||||
download
|
||||
fi
|
||||
}
|
||||
|
||||
run() {
|
||||
$BIN "${@:1}"
|
||||
}
|
||||
|
||||
build() {
|
||||
run
|
||||
}
|
||||
|
||||
no_absolute_url() {
|
||||
sed -i 's/https:\/\/mcaptcha.org//g' $(find public -type f | grep html)
|
||||
}
|
||||
|
||||
clean() {
|
||||
rm -rf $BIN_PATH || true
|
||||
rm -rf $DIST || true
|
||||
echo "[*] Workspace cleaned"
|
||||
}
|
||||
|
||||
# $1: branch name
|
||||
# $2: directory containing build assets
|
||||
# $3: Author in <author-name author@example.com> format
|
||||
deploy() {
|
||||
cd $PROJECT_ROOT
|
||||
original_branch=$(git branch --show-current)
|
||||
tmp_dir=$(mktemp -d)
|
||||
cp -r $2/* $tmp_dir
|
||||
|
||||
if [[ -z $(git ls-remote --heads origin ${1}) ]]
|
||||
then
|
||||
echo "[*] Creating deployment branch $1"
|
||||
git stash
|
||||
git checkout --orphan $1
|
||||
else
|
||||
echo "[*] Deployment branch $1 exists, pulling changes from remote"
|
||||
git fetch origin $1
|
||||
git stash
|
||||
git switch $1
|
||||
fi
|
||||
|
||||
git rm -rf .
|
||||
/bin/rm -rf *
|
||||
cp -r $tmp_dir/* .
|
||||
git add --all
|
||||
if [ $(git status --porcelain | xargs | sed '/^$/d' | wc -l) -gt 0 ];
|
||||
then
|
||||
echo "[*] Repository has changed, committing changes"
|
||||
git commit \
|
||||
--author="$3" \
|
||||
--message="new deploy: $(date --iso-8601=seconds)"
|
||||
fi
|
||||
git checkout $original_branch
|
||||
}
|
||||
|
||||
check_arg $1
|
||||
download
|
||||
|
||||
if match_arg $1 'c' 'clean'
|
||||
then
|
||||
clean
|
||||
elif match_arg $1 'i' 'install'
|
||||
then
|
||||
init
|
||||
elif match_arg $1 'd' 'deploy'
|
||||
then
|
||||
check_arg $2
|
||||
check_arg $3
|
||||
check_arg $4
|
||||
deploy $2 $3 $4
|
||||
elif match_arg $1 'b' 'build'
|
||||
then
|
||||
build
|
||||
elif match_arg $1 'h' 'help'
|
||||
then
|
||||
help
|
||||
elif match_arg $1 'z' 'hugo'
|
||||
then
|
||||
hugo "${@:3}"
|
||||
else
|
||||
echo "Error: $1 is not an option"
|
||||
help
|
||||
exit 1
|
||||
fi
|
||||
|
||||
exit 0
|
|
@ -1,32 +0,0 @@
|
|||
#!/bin/bash
|
||||
# Copyright © 2021 Aravinth Manivannan <realaravinth@batsense.net>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero General Public License as
|
||||
# published by the Free Software Foundation, either version 3 of the
|
||||
# License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Affero General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
check_arg(){
|
||||
if [ -z $1 ]
|
||||
then
|
||||
help
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
match_arg() {
|
||||
if [ $1 == $2 ] || [ $1 == $3 ]
|
||||
then
|
||||
return 0
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
}
|
|
@ -1,98 +0,0 @@
|
|||
#!/bin/bash
|
||||
# Used in CI workflow: install and check for spelling errors
|
||||
# Copyright © 2021 Aravinth Manivannan <realaravinth@batsense.net>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero General Public License as
|
||||
# published by the Free Software Foundation, either version 3 of the
|
||||
# License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Affero General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
readonly MISSPELL_DOWNLOAD="https://github.com/client9/misspell/releases/download/v0.3.4/misspell_0.3.4_linux_64bit.tar.gz"
|
||||
readonly TMP_DIR=$(pwd)/tmp
|
||||
readonly PROJECT_ROOT=$(pwd)
|
||||
readonly MISSPELL_TARBALL="$TMP_DIR/misspell.tar.bz2"
|
||||
readonly MISSPELL="$TMP_DIR/misspell"
|
||||
|
||||
set -Eeuo pipefail
|
||||
|
||||
source $(pwd)/scripts/lib.sh
|
||||
|
||||
FLAGS=""
|
||||
|
||||
help() {
|
||||
cat << EOF
|
||||
spellcheck.sh: Check for spelling errors
|
||||
USAGE:
|
||||
spellcheck.sh <options>
|
||||
OPTIONS:
|
||||
c --check check for spelling erros
|
||||
h --help print this help menu
|
||||
w --write check and fix spelling errors
|
||||
EOF
|
||||
}
|
||||
|
||||
|
||||
|
||||
download() {
|
||||
if [ ! -e $MISSPELL ];
|
||||
then
|
||||
echo "[*] Downloading misspell"
|
||||
wget --quiet --output-doc=$MISSPELL_TARBALL $MISSPELL_DOWNLOAD;
|
||||
cd $TMP_DIR
|
||||
tar -xf $MISSPELL_TARBALL;
|
||||
cd $PROJECT_ROOT
|
||||
pip install codespell
|
||||
else
|
||||
echo "[*] Found misspell"
|
||||
fi
|
||||
}
|
||||
|
||||
spell_check_codespell() {
|
||||
_check(){
|
||||
codespell $FLAGS $PROJECT_ROOT/$1 #|| true
|
||||
}
|
||||
_check README.md
|
||||
_check contents
|
||||
}
|
||||
|
||||
spell_check_misspell() {
|
||||
mkdir $TMP_DIR || true
|
||||
download
|
||||
|
||||
_check(){
|
||||
$MISSPELL $FLAGS $PROJECT_ROOT/$1
|
||||
}
|
||||
|
||||
_check contents
|
||||
_check README.md
|
||||
}
|
||||
|
||||
check_arg $1
|
||||
|
||||
if match_arg $1 'w' '--write'
|
||||
then
|
||||
echo "[*] checking and correcting spellings"
|
||||
FLAGS="-w"
|
||||
spell_check_misspell
|
||||
spell_check_codespell
|
||||
elif match_arg $1 'c' '--check'
|
||||
then
|
||||
echo "[*] checking spellings"
|
||||
spell_check_misspell
|
||||
spell_check_codespell
|
||||
elif match_arg $1 'h' '--help'
|
||||
then
|
||||
help
|
||||
else
|
||||
echo "undefined option"
|
||||
help
|
||||
exit 1
|
||||
fi
|
103
static/third-party/NGIZero-green.hex.svg
vendored
|
@ -1,103 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!-- Generator: Adobe Illustrator 16.0.4, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
||||
|
||||
<svg
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
version="1.1"
|
||||
id="Ebene_1"
|
||||
x="0px"
|
||||
y="0px"
|
||||
width="165.92125"
|
||||
height="191.45087"
|
||||
viewBox="0 0 165.92125 191.45086"
|
||||
enable-background="new 0 0 198.425 198.425"
|
||||
xml:space="preserve"
|
||||
sodipodi:docname="NGIZero-green.svg"
|
||||
inkscape:version="0.92.4 (5da689c313, 2019-01-14)"><metadata
|
||||
id="metadata4142"><rdf:RDF><cc:Work
|
||||
rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title></dc:title></cc:Work></rdf:RDF></metadata><defs
|
||||
id="defs4140" /><sodipodi:namedview
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#666666"
|
||||
borderopacity="1"
|
||||
objecttolerance="10"
|
||||
gridtolerance="10"
|
||||
guidetolerance="10"
|
||||
inkscape:pageopacity="0"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:window-width="1920"
|
||||
inkscape:window-height="1007"
|
||||
id="namedview4138"
|
||||
showgrid="false"
|
||||
inkscape:zoom="1.6820179"
|
||||
inkscape:cx="-191.39267"
|
||||
inkscape:cy="54.855534"
|
||||
inkscape:window-x="0"
|
||||
inkscape:window-y="0"
|
||||
inkscape:window-maximized="1"
|
||||
inkscape:current-layer="Ebene_1"
|
||||
fit-margin-top="0"
|
||||
fit-margin-left="0"
|
||||
fit-margin-right="0"
|
||||
fit-margin-bottom="0" />
|
||||
<polygon
|
||||
points="36.911,63.104 36.911,66.116 36.911,132.309 36.911,135.321 39.346,136.825 96.715,169.921 99.273,171.419 101.853,169.921 159.319,136.825 161.938,135.321 161.938,132.309 161.938,66.116 161.938,63.104 159.308,61.6 101.841,28.504 99.234,27.006 96.629,28.504 39.347,61.6 "
|
||||
id="polygon4013"
|
||||
style="fill:#96c00a;fill-opacity:1"
|
||||
transform="matrix(1.3249745,0,0,1.3249745,-48.642464,-35.674938)" />
|
||||
<polygon
|
||||
points="161.712,62.925 161.712,131.589 99.212,167.589 36.712,131.589 36.712,62.925 99.212,26.925 "
|
||||
id="polygon4015"
|
||||
style="fill:#97bf00;fill-opacity:0.91764706"
|
||||
transform="matrix(1.3249745,0,0,1.3249745,-48.642464,-35.674938)" />
|
||||
<polygon
|
||||
stroke-miterlimit="10"
|
||||
points="157.712,65.379 157.712,133.046 99.212,166.88 40.712,133.046 40.712,65.379 99.212,31.546 "
|
||||
id="Outerline"
|
||||
transform="matrix(1.3249745,0,0,1.3249745,-48.642464,-35.674938)"
|
||||
style="fill:none;stroke:#ffffff;stroke-width:2;stroke-miterlimit:10"
|
||||
inkscape:label="#outerline" />
|
||||
|
||||
|
||||
<g
|
||||
id="g4281"
|
||||
transform="matrix(1.3249745,0,0,1.3249745,-47.067006,-23.859001)"><path
|
||||
inkscape:connector-curvature="0"
|
||||
id="path42"
|
||||
style="fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.55783975"
|
||||
d="m 133.45691,60.461638 v 0 c 2.27263,0 4.11462,1.841988 4.11462,4.114628 v 27.330241 c 0,2.27264 -1.84199,4.114628 -4.11462,4.114628 -2.27264,0 -4.11463,-1.841988 -4.11463,-4.114628 V 64.576266 c 0,-2.27264 1.84199,-4.114628 4.11463,-4.114628" /><g
|
||||
transform="matrix(0.55783976,0,0,-0.55783976,120.13631,77.682765)"
|
||||
id="g44"><path
|
||||
inkscape:connector-curvature="0"
|
||||
id="path46"
|
||||
style="fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none"
|
||||
d="M 0,0 H -0.506 C -0.57,0 -0.633,-0.008 -0.698,-0.01 -0.762,-0.008 -0.825,0 -0.89,0 h -7.283 c -3.929,0 -7.359,-2.965 -7.613,-6.885 -0.278,-4.296 3.124,-7.867 7.361,-7.867 0.776,0 1.343,-0.754 1.111,-1.494 -0.658,-2.088 -2.341,-3.751 -4.547,-4.333 -2.074,-0.547 -4.276,-0.821 -6.605,-0.821 -4.007,0 -7.574,0.865 -10.7,2.595 -3.127,1.73 -5.57,4.144 -7.331,7.24 -1.761,3.096 -2.641,6.617 -2.641,10.564 0,4.006 0.88,7.558 2.641,10.654 1.761,3.097 4.219,5.493 7.377,7.195 3.156,1.698 6.768,2.549 10.836,2.549 4.681,0 8.865,-1.269 12.55,-3.807 2.341,-1.612 5.524,-1.588 7.757,0.171 3.48,2.741 3.289,8.045 -0.315,10.452 -1.7,1.136 -3.538,2.112 -5.512,2.928 -4.553,1.881 -9.623,2.823 -15.208,2.823 -6.679,0 -12.69,-1.412 -18.03,-4.235 -5.344,-2.822 -9.517,-6.738 -12.522,-11.747 -3.005,-5.008 -4.508,-10.67 -4.508,-16.983 0,-6.315 1.503,-11.975 4.508,-16.984 3.005,-5.009 7.148,-8.924 12.43,-11.747 5.282,-2.824 11.231,-4.235 17.849,-4.235 4.613,0 9.197,0.699 13.751,2.095 0.045,0.014 0.091,0.028 0.136,0.042 7.104,2.202 11.884,8.86 11.884,16.297 v 9.047 C 6.486,-2.904 3.583,0 0,0" /></g><g
|
||||
transform="matrix(0.55783976,0,0,-0.55783976,85.80763,64.525332)"
|
||||
id="g48"><path
|
||||
inkscape:connector-curvature="0"
|
||||
id="path50"
|
||||
style="fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none"
|
||||
d="m 0,0 v -49.176 c 0,-4.023 -3.262,-7.285 -7.286,-7.285 h -1.381 c -2.181,0 -4.247,0.977 -5.631,2.662 l -24.229,29.505 c -1.804,2.197 -5.368,0.921 -5.368,-1.922 v -22.96 c 0,-4.023 -3.261,-7.285 -7.285,-7.285 -4.023,0 -7.285,3.262 -7.285,7.285 V 0 c 0,4.024 3.262,7.285 7.285,7.285 h 1.468 c 2.184,0 4.253,-0.979 5.636,-2.669 l 24.135,-29.475 c 1.802,-2.202 5.37,-0.927 5.37,1.918 V 0 c 0,4.024 3.261,7.285 7.285,7.285 C -3.262,7.285 0,4.024 0,0" /></g></g><g
|
||||
aria-label="Z E R O"
|
||||
transform="matrix(0.94681934,0,0,0.94681934,-209.97267,182.03385)"
|
||||
style="font-variant:normal;font-weight:600;font-stretch:normal;font-size:31.76000023px;font-family:'Montserrat SemiBold';-inkscape-font-specification:Montserrat-SemiBold;font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-feature-settings:normal;text-align:start;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:0.7171717;fill-rule:nonzero;stroke:none"
|
||||
id="text56"><path
|
||||
inkscape:connector-curvature="0"
|
||||
d="m 243.58117,-73.015206 h 19.46231 v 3.613321 l -12.42176,15.02707 h 12.77844 v 4.512774 h -20.17567 v -3.613321 l 12.42176,-15.02707 h -12.06508 z"
|
||||
id="path2325" /><path
|
||||
inkscape:connector-curvature="0"
|
||||
d="m 278.7684,-73.015206 h 16.11262 v 4.512774 h -10.14211 v 4.311172 h 9.5373 v 4.512773 h -9.5373 v 5.303672 h 10.48328 v 4.512774 H 278.7684 Z"
|
||||
id="path2327" /><path
|
||||
inkscape:connector-curvature="0"
|
||||
d="m 320.00367,-62.749034 q 1.87645,0 2.68285,-0.697851 0.82192,-0.697852 0.82192,-2.295157 0,-1.581796 -0.82192,-2.26414 -0.8064,-0.682344 -2.68285,-0.682344 h -2.51226 v 5.939492 z m -2.51226,4.125078 v 8.761915 h -5.97051 v -23.153165 h 9.11859 q 4.57481,0 6.69938,1.535274 2.14008,1.535273 2.14008,4.853945 0,2.295156 -1.11657,3.768399 -1.10105,1.473242 -3.33418,2.171093 1.22512,0.279141 2.18661,1.271641 0.97699,0.976992 1.96949,2.9775 l 3.24113,6.575313 h -6.3582 l -2.82242,-5.753399 q -0.85293,-1.736875 -1.73688,-2.372695 -0.86844,-0.635821 -2.32617,-0.635821 z"
|
||||
id="path2329" /><path
|
||||
inkscape:connector-curvature="0"
|
||||
d="m 357.57911,-69.107237 q -2.72938,0 -4.23364,2.016016 -1.50425,2.016015 -1.50425,5.675859 0,3.644336 1.50425,5.660352 1.50426,2.016015 4.23364,2.016015 2.74488,0 4.24914,-2.016015 1.50426,-2.016016 1.50426,-5.660352 0,-3.659844 -1.50426,-5.675859 -1.50426,-2.016016 -4.24914,-2.016016 z m 0,-4.32668 q 5.58281,0 8.7464,3.19461 3.1636,3.194609 3.1636,8.823945 0,5.613828 -3.1636,8.808438 -3.16359,3.194609 -8.7464,3.194609 -5.56731,0 -8.74641,-3.194609 -3.16359,-3.19461 -3.16359,-8.808438 0,-5.629336 3.16359,-8.823945 3.1791,-3.19461 8.74641,-3.19461 z"
|
||||
id="path2331" /></g></svg>
|
Before Width: | Height: | Size: 7.3 KiB |