Customizable & simple Pleroma/Kocaptcha-compatible CAPTCHA.
Iri al dosiero
Jaidyn Ann 0d2d99ed1d Generate random session tokens 2023-08-08 18:42:52 -05:00
captcha Add example captcha challenges 2023-08-08 14:35:28 -05:00
COPYING Add copy of the AGPLv3 2023-08-08 15:01:30 -05:00
README.md README.md and helper script 2023-08-08 16:11:01 -05:00
kaptchapelo.asd Init 2023-08-06 00:07:04 -05:00
kaptchapelo.lisp Generate random session tokens 2023-08-08 18:42:52 -05:00
run-kaptchapelo.lisp Allow running in foreground 2023-08-08 16:46:20 -05:00

Kaptĉapelo

Kaptĉapelo is a simple Kocaptcha-compatible CAPTCHA server, to keep out robots and people with dubious intent. Rather than auto-generated challenges like Kocaptcha, though, Kaptĉapelo lets you create shiny, pretty, custom challenges.

Since Kaptĉapelo is a kinda-sorta drop-in replacement for Kocaptcha, you can use it as CAPTCHA for your Pleroma server.

Installation

Setup

Kaptĉapelo requires the following:

  • A Common Lisp implementation. Id recommend Steel Bank Common Lisp, which is robust and available on many operating systems under the package-name sbcl.
  • Quicklisp, a “package-manager” for Common Lisp libraries.

To install these, you can run the following commands (replacing guix with your package-manager of choice)…

$ guix install sbcl
$ mkdir --parents ~/.local/lib/quicklisp/
$ wget https://beta.quicklisp.org/quicklisp.lisp
$ sbcl --load quicklisp.lisp

And then, in SBCL, run…

* (quicklisp-quickstart:install :path "~/.local/lib/quicklisp/")
* (ql:add-to-init-file)
* (quit)

Back in the shell, we can clone Kaptĉapelo…

$ cd ~/.local/lib/quicklisp/local-projects/
$ git clone https://notabug.org/jadedctrl/kaptchapelo

Execution

In the sources, you can find a script (run-kaptchapelo.lisp), which can be used like so:

$ # First, lets make it executable…
$ chmod +x ~/.local/lib/quicklisp/local-projects/kaptchapelo/run-kaptchapelo.lisp
$ # … now we can run it…
$ ~/.local/lib/quicklisp/local-projects/kaptchapelo/run-kaptchapelo.lisp

Now, Kaptchapelo should be running and good to go; visit http://localhost:5001 and have a look!

Configuration

Web-server

Youll probably be running Kaptchapelo through a reverse proxy; heres how you can add it to an existing server definition with nginx:

server {
	[…]

	location /new {
		set $target http://localhost:5001;
		proxy_buffering off;
		proxy_pass http://localhost:5001;
	}

	location /captcha/ {
		set $target http://localhost:5001;
		proxy_buffering off;
		proxy_pass http://localhost:5001;
	}

	[…]
}

That is to say, you dont need a dedicated subdomain!

Custom captchas

Making custom captchas is easy! A challenge is simply a PNG file (question) and a TXT file (answer). … thats it! Literally.

Note that the PNG and TXT files should have the same name (bird.png and bird.txt, not bird2.png and bird1.txt), and that the TXT answer should consist of one line with no newline.

A peek through this repositorys example captchas (in ./captcha/) should give you the idea.

Captcha directory

Its likely youll want to provide a custom directory in which to store your captchas; no problem! Just edit the aforementioned run-kaptchapelo.lisp script, which contains a line…

:captcha-directory #p"~/.local/lib/quicklisp/local-projects/kaptchapelo/captcha/"

… all you have to do is replace the path there with your own. In addition, you can also change the port and address by editing this script.

Misc. information

Author: Jaidyn Ann @jadedctrl@jam.xwx.moe
License: GNU AGPLv3