aboutsummaryrefslogtreecommitdiff

Cgit simple authentication

Simple authentication for cgit powered by sqlite and redis

Configure

Add this project as cgit auth-filter

auth-filter=/opt/cgit-simple-authentication/target/release/cgit-simple-authentication

Available options for this filter:

# Set cookie time to live
cgit-simple-auth-cookie-ttl=600
# Specify database location (Default is /etc/cgit/auth.db) 
cgit-simple-auth-database=/etc/cgit/auth.db
# Should authenticate in repositories root view
cgit-simple-auth-bypass-root=false
# Should enable authenticate in all repository
# Available options: full, part, none
cgit-simple-auth-protect=full
# Use PAM to provide verification
# Available options: false(disable PAM)
# Or 'system-auth', 'system-login' etc. (write the method you need)
cgit-simple-auth-use-pam=false

Available options for repositories:

You should set cgit-simple-auth-protect=part

repo.url=test
# Enable protect for this repository
repo.protect=true

Usage

You should initialize your database first

cargo run -- database init

Then add user with

cargo run -- user add admin hunter2

More usage information, see --help.

Program help

Simple Authentication Filter for cgit

USAGE:
    cgit-simple-authentication.exe [SUBCOMMAND]

FLAGS:
    -h, --help       Prints help information
    -V, --version    Prints version information

SUBCOMMANDS:
    database    Database rated commands
    repo        Repository ACL rated commands
    user        Users rated commands
    help        Prints this message or the help of the given subcommand(s)

Source

Most of the ideas come from: https://github.com/varphone/cgit-gogs-auth-filter

License

Copyright (C) 2021-2022 KunoiSayami

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 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 https://www.gnu.org/licenses/.