https://github.com/crystalnet-org/pure-ftpd-paperless-dbauth
a small go programm to plug into pureftpd's authd programm that verifies users against a paperless-ngx mariadb or postgresql database
https://github.com/crystalnet-org/pure-ftpd-paperless-dbauth
authentication mariadb paperless paperless-ng paperless-ngx postgresql pure-ftpd pureftpd
Last synced: about 2 months ago
JSON representation
a small go programm to plug into pureftpd's authd programm that verifies users against a paperless-ngx mariadb or postgresql database
- Host: GitHub
- URL: https://github.com/crystalnet-org/pure-ftpd-paperless-dbauth
- Owner: CrystalNET-org
- License: mit
- Created: 2023-12-17T10:24:44.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-01-20T10:24:31.000Z (over 1 year ago)
- Last Synced: 2024-01-20T11:28:03.598Z (over 1 year ago)
- Topics: authentication, mariadb, paperless, paperless-ng, paperless-ngx, postgresql, pure-ftpd, pureftpd
- Language: Go
- Homepage:
- Size: 14.2 MB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE.md
Awesome Lists containing this project
README
# Pure-FTPd Authd Database Authenticator
[](https://ci.cluster.lan.crystalnet.org/repos/5)
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.
## Prerequisites
- Go installed on your machine
- Pure-FTPd with authd support
- MariaDB or PostgreSQL database configured for Paperless-NGX## Features
- Authenticate users against a Paperless-NGX database
- Support for both MariaDB and PostgreSQL databases
- Automatic dependency resolution using Go Modules## Getting Started
### Installation
1. Clone the repository:
```bash
git clone https://github.com/psych0d0g/pure-ftpd-paperless-dbauth.git
```2. Change into the project directory:
```bash
cd pure-ftpd-paperless-dbauth
```3. Run the build script to compile the binary:
```bash
./build.sh
```### Configuration
1. Set up environment variables:
```bash
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"
```2. Set up authd configuration to use the compiled binary.
### Test
Run the compiled binary to authenticate users against the Paperless-NGX database.
```bash
AUTHD_ACCOUNT=username AUTHD_PASSWORD=password ./verify_pw
```### authd configuration
please refer to pure-ftpd documentation on how to integrate it with authd: https://github.com/jedisct1/pure-ftpd/blob/master/README.Authentication-Modules
### Database Schema
Ensure your Paperless-NGX database has a table similar to the following:
```sql
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
);
```### Built With
- Go - The Go Programming Language
- github.com/go-sql-driver/mysql - MySQL driver for Go
- github.com/lib/pq - PostgreSQL driver for Go### Contributing
i am open to any improvement suggestions via issues or pull reqests
### License
This project is licensed under the MIT License - see the LICENSE.md file for details.
### Acknowledgments
- ChatGPT