Skip to content

Spoje-NET/apache2-auth-redmine

Repository files navigation

apache_auth_redmine

Authenticate Apache Users using Redmine's database

authentificators read its configuration from default redmine's db config /etc/redmine/default/database.yml

Based on original script by Anders Nordby [email protected]

Installation:

sudo apt install lsb-release wget
echo "deb http://repo.vitexsoftware.cz $(lsb_release -sc) main" | sudo tee /etc/apt/sources.list.d/vitexsoftware.list
sudo wget -O /etc/apt/trusted.gpg.d/vitexsoftware.gpg http://repo.vitexsoftware.cz/keyring.gpg
sudo apt update
sudo apt install apache2-auth-redmine

Tested on Debian 9 & 10

Configuration

The package provide enabled /etc/apache2/confs-availble/auth_redmine.conf with default external Auth definitions

DefineExternalAuth  redmineuser pipe /usr/lib/apache2/redmine-mysql-auth.pl
DefineExternalGroup redminegroup pipe /usr/lib/apache2/redmine-group-mysql-auth.pl

The following examples use it:

Simple known user auth

<Directory "/var/www/html/usersonly">
        AuthType Basic
        AuthName "Only for Redmine Users" 
        AuthBasicProvider external
        AuthExternal redmineuser
        Require valid-user
</Directory>

Group membership based auth

<Directory "/var/www/html/adminsonly">
        AuthType Basic
        AuthName "Only for Redmine Admins" 
        AuthBasicProvider external
        AuthExternal redmineuser
        GroupExternal redminegroup
        Require external-group admins
</Directory>

Please look into Vagrantfile for details how to install on real system.

Testing

We provide example Vagrant.with whole setup in the box.

In this cloned repository simply run

vagrant up

And wait to things be done. After image download, package installation and additional provisioning web iside virtual machine become reachable at

http://localhost:8090

Then you can try to open Apache's locations only for redmine users and group members

For Users Only for Admins

Testing users:

login password member of group
admin Cli@queel3
john dydCag9knag admin
doe steevCor2ov users

Auth tool read login and password from stdin in simple format

login
password

So You can test basic functionality from commandline:

echo -e "admin\nCli@queel3\n" | /usr/lib/apache2/redmine-mysql-auth.pl 

The credentials was accepted. The script ends with 0 code as you can check using "$?" macro:

echo $?
0

Unsuccessfull attempt ends with one return code.

See Also:

Apache Redmin

Spoje.Net