mirror of
https://github.com/arcan1s/ahriman.git
synced 2025-06-28 06:41:43 +00:00
feat: add support of pam authentication
Add naive implementation of user password check by calling su command. Also change some authentication method to require username to be string instead of optional string
This commit is contained in:
@ -12,6 +12,7 @@ Collection of the examples of docker compose configuration files, which covers s
|
||||
* [Index](index): repository with index page generator enabled.
|
||||
* [Multi repo](multirepo): run web service with two separated repositories.
|
||||
* [OAuth](oauth): web service with OAuth (GitHub provider) authentication enabled.
|
||||
* [PAM](pam): web service with PAM authentication enabled.
|
||||
* [Pull](pull): normal service, but in addition with pulling packages from another source (e.g. GitHub repository).
|
||||
* [Sign](sign): create repository with database signing.
|
||||
* [Web](web): simple web service with authentication enabled.
|
||||
|
6
recipes/pam/README.md
Normal file
6
recipes/pam/README.md
Normal file
@ -0,0 +1,6 @@
|
||||
# PAM
|
||||
|
||||
1. Create system user `demo` with password from `AHRIMAN_PASSWORD` environment variable and group `wheel`.
|
||||
2. Setup repository named `ahriman-demo` with architecture `x86_64`.
|
||||
3. Start web server at port `8080`.
|
||||
4. Repository is available at `http://localhost:8080/repo`.
|
63
recipes/pam/compose.yml
Normal file
63
recipes/pam/compose.yml
Normal file
@ -0,0 +1,63 @@
|
||||
services:
|
||||
backend:
|
||||
image: arcan1s/ahriman:edge
|
||||
privileged: true
|
||||
|
||||
environment:
|
||||
AHRIMAN_DEBUG: yes
|
||||
AHRIMAN_OUTPUT: console
|
||||
AHRIMAN_PASSWORD: ${AHRIMAN_PASSWORD}
|
||||
AHRIMAN_PORT: 8080
|
||||
AHRIMAN_PRESETUP_COMMAND: useradd -d / -G wheel -M demo; (cat /run/secrets/password; echo; cat /run/secrets/password) | passwd demo
|
||||
AHRIMAN_REPOSITORY: ahriman-demo
|
||||
AHRIMAN_UNIX_SOCKET: /var/lib/ahriman/ahriman/ahriman.sock
|
||||
|
||||
configs:
|
||||
- source: service
|
||||
target: /etc/ahriman.ini.d/99-settings.ini
|
||||
secrets:
|
||||
- password
|
||||
|
||||
volumes:
|
||||
- type: volume
|
||||
source: repository
|
||||
target: /var/lib/ahriman
|
||||
volume:
|
||||
nocopy: true
|
||||
|
||||
healthcheck:
|
||||
test: curl --fail --silent --output /dev/null http://backend:8080/api/v1/info
|
||||
interval: 10s
|
||||
start_period: 30s
|
||||
|
||||
command: web
|
||||
|
||||
frontend:
|
||||
image: nginx
|
||||
ports:
|
||||
- 8080:80
|
||||
|
||||
configs:
|
||||
- source: nginx
|
||||
target: /etc/nginx/conf.d/default.conf
|
||||
|
||||
volumes:
|
||||
- type: volume
|
||||
source: repository
|
||||
target: /srv
|
||||
read_only: true
|
||||
volume:
|
||||
nocopy: true
|
||||
|
||||
configs:
|
||||
nginx:
|
||||
file: nginx.conf
|
||||
service:
|
||||
file: service.ini
|
||||
|
||||
secrets:
|
||||
password:
|
||||
environment: AHRIMAN_PASSWORD
|
||||
|
||||
volumes:
|
||||
repository:
|
18
recipes/pam/nginx.conf
Normal file
18
recipes/pam/nginx.conf
Normal file
@ -0,0 +1,18 @@
|
||||
server {
|
||||
listen 80;
|
||||
|
||||
location /repo {
|
||||
rewrite ^/repo/(.*) /$1 break;
|
||||
autoindex on;
|
||||
root /srv/ahriman/repository;
|
||||
}
|
||||
|
||||
location / {
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarder-Proto $scheme;
|
||||
|
||||
proxy_pass http://backend:8080;
|
||||
}
|
||||
}
|
3
recipes/pam/service.ini
Normal file
3
recipes/pam/service.ini
Normal file
@ -0,0 +1,3 @@
|
||||
[auth]
|
||||
target = pam
|
||||
full_access_group = wheel
|
Reference in New Issue
Block a user