This small Go program is designed to be plugged into Pure-FTPd's authd program, providing authentication against a Paperless-NGX MariaDB or PostgreSQL database.
- Go installed on your machine
- Pure-FTPd with authd support
- MariaDB or PostgreSQL database configured for Paperless-NGX
- Authenticate users against a Paperless-NGX database
- Support for both MariaDB and PostgreSQL databases
- Automatic dependency resolution using Go Modules
-
Clone the repository:
git clone https://github.com/psych0d0g/pure-ftpd-paperless-dbauth.git
-
Change into the project directory:
cd pure-ftpd-paperless-dbauth
-
Run the build script to compile the binary:
./build.sh
-
Set up environment variables:
export PAPERLESS_DBHOST="your_database_host" export PAPERLESS_DBPORT="your_database_port" export PAPERLESS_DBNAME="your_database_name" export DB_USER="your_database_user" export PAPERLESS_DBPASS="your_database_password" export PAPERLESS_DBENGINE="postgres" # or "mysql" for MariaDB export PAPERLESS_CONSUMPTION_DIR="your_paperless_consumption_dir"
-
Set up authd configuration to use the compiled binary.
Run the compiled binary to authenticate users against the Paperless-NGX database.
AUTHD_ACCOUNT=username AUTHD_PASSWORD=password ./verify_pw
please refer to pure-ftpd documentation on how to integrate it with authd: https://github.com/jedisct1/pure-ftpd/blob/master/README.Authentication-Modules
Ensure your Paperless-NGX database has a table similar to the following:
CREATE TABLE auth_user (
id SERIAL PRIMARY KEY,
username VARCHAR(255) NOT NULL,
password VARCHAR(255) NOT NULL,
last_login TIMESTAMP,
is_superuser BOOLEAN NOT NULL,
first_name VARCHAR(30),
last_name VARCHAR(30),
email VARCHAR(255),
is_staff BOOLEAN NOT NULL,
is_active BOOLEAN NOT NULL,
date_joined TIMESTAMP NOT NULL
);
- Go - The Go Programming Language
- github.com/go-sql-driver/mysql - MySQL driver for Go
- github.com/lib/pq - PostgreSQL driver for Go
i am open to any improvement suggestions via issues or pull reqests
This project is licensed under the MIT License - see the LICENSE.md file for details.
- ChatGPT