-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #13 from ethho/dev-385-debug
DEV-385: Fix unwrap when provider response fails
- Loading branch information
Showing
15 changed files
with
725 additions
and
195 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
pam-oidc/target | ||
.git | ||
.gitignore |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
name: Create Versioned Release | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
tags: | ||
- 'v*.*.*' | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
- name: Build | ||
run: | | ||
export DOCKER_TAG="${{ github.ref_name }}" | ||
docker compose build builder | ||
mkdir -p pam-oidc/bin | ||
docker compose cp builder:/tmp/pam-oauth2/libpam_oidc_gnu.so ./pam-oidc/bin/ | ||
docker compose cp builder:/tmp/pam-oauth2/libpam_oidc_musl.so ./pam-oidc/bin/ | ||
- name: Touch Changelog | ||
if: startsWith(github.ref, 'refs/tags/') | ||
run: touch "docs/CHANGELOG-${{ github.ref_name }}.md" | ||
- name: Release | ||
uses: softprops/action-gh-release@v1 | ||
if: startsWith(github.ref, 'refs/tags/') | ||
with: | ||
files: | | ||
./pam-oidc/bin/libpam_oidc_gnu.so | ||
./pam-oidc/bin/libpam_oidc_musl.so | ||
body_path: docs/CHANGELOG-${{ github.ref_name }}.md |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,8 @@ | ||
target | ||
libpam_oidc.yaml | ||
.env | ||
Cargo.lock | ||
*.env | ||
Cargo.lock | ||
|
||
# Added by cargo | ||
|
||
/target |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,8 @@ | ||
{ | ||
"editor.rulers": [95] | ||
"editor.rulers": [ | ||
95 | ||
], | ||
"rust-analyzer.linkedProjects": [ | ||
"./pam-oidc/Cargo.toml" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
auth required pam_warn.so | ||
auth required pam_unix.so audit | ||
account required pam_unix.so audit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
auth sufficient libpam_oidc.so /etc/datajoint/libpam_oidc.yaml | ||
account optional libpam_oidc.so | ||
account optional libpam_oidc.so |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,35 @@ | ||
# docker compose up --build | ||
# docker buildx bake --set "*.platform=linux/amd64" --load | ||
version: "2.4" | ||
# docker compose up --build percona | ||
version: "3" | ||
services: | ||
app: | ||
build: . | ||
image: pam_oidc:v0.1.4 | ||
percona: | ||
container_name: pam-oauth2-percona | ||
build: | ||
context: . | ||
dockerfile: docker/percona.dockerfile | ||
args: | ||
- BUILDER_TAG=${DOCKER_TAG:-v0.1.5} | ||
environment: | ||
- DJ_AUTH_USER | ||
- DJ_AUTH_PASSWORD | ||
- DJ_AUTH_TOKEN | ||
# - RUSTFLAGS=-C link-arg=-undefined | ||
# - RUSTFLAGS=-C target-feature=-crt-static | ||
command: tail -f /dev/null | ||
- MYSQL_ROOT_PASSWORD=password | ||
env_file: | ||
- .env | ||
command: /docker-entrypoint.sh mysqld | ||
healthcheck: | ||
test: [ "CMD", "mysqladmin", "ping", "-h", "localhost" ] | ||
timeout: 30s | ||
retries: 5 | ||
interval: 15s | ||
ports: | ||
- 3306:3306 | ||
volumes: | ||
- ./config/service_example:/etc/pam.d/oidc # add a 'oidc' config that utilizes pam_oidc | ||
- ./config/libpam_oidc.yaml:/etc/datajoint/libpam_oidc.yaml # add pam_oidc-specific config | ||
- ./tests/test.py:/workspace/test.py # python test | ||
- ./pam-oidc:/workspace/pam-oidc # mount source for dev | ||
- ./tests/test.py:/opt/test.py | ||
- ./config/libpam_oidc.yaml:/etc/datajoint/libpam_oidc.yaml | ||
depends_on: | ||
builder: | ||
condition: service_completed_successfully | ||
image: datajoint/pam-oauth2-percona:${DOCKER_TAG:-v0.1.5} | ||
builder: | ||
container_name: pam-oauth2-builder | ||
build: | ||
context: . | ||
dockerfile: docker/builder.dockerfile | ||
image: datajoint/pam-oauth2-builder:${DOCKER_TAG:-v0.1.5} |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
FROM mcr.microsoft.com/devcontainers/rust:1.0.7-bullseye | ||
RUN \ | ||
apt-get update && \ | ||
apt-get install \ | ||
musl-tools libssl-dev pkg-config libssl-dev build-essential \ | ||
gcc g++ openssl \ | ||
libpam0g-dev libpam0g gdb git -y | ||
ENV RUSTFLAGS="-C target-feature=-crt-static" | ||
WORKDIR /tmp/pam-oauth2 | ||
COPY pam-oidc /tmp/pam-oauth2/pam-oidc | ||
RUN \ | ||
cd pam-oidc && \ | ||
rustup target add x86_64-unknown-linux-gnu && \ | ||
rustup target add x86_64-unknown-linux-musl && \ | ||
rustup show && \ | ||
cargo build --release --target x86_64-unknown-linux-musl && \ | ||
cargo build --release --target x86_64-unknown-linux-gnu && \ | ||
cp target/x86_64-unknown-linux-musl/release/libpam_oidc.so /tmp/pam-oauth2/libpam_oidc_musl.so && \ | ||
cp target/x86_64-unknown-linux-gnu/release/libpam_oidc.so /tmp/pam-oauth2/libpam_oidc_gnu.so |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
ARG BUILDER_TAG | ||
FROM datajoint/pam-oauth2-builder:${BUILDER_TAG} as builder | ||
FROM percona:8 | ||
USER root | ||
RUN \ | ||
yum -y install python3 python3-pip && \ | ||
pip3 install python-pam | ||
|
||
# Fetch the binary from the release page | ||
# ADD https://github.com/datajoint-company/pam-oauth2/releases/download/0.1.4/libpam_oidc_linux_amd64.so /usr/lib64/security/libpam_oidc.so | ||
# RUN chmod +rx /usr/lib64/security/libpam_oidc.so | ||
|
||
# https://www.percona.com/blog/getting-percona-pam-to-work-with-percona-server-its-client-apps/ | ||
RUN \ | ||
chgrp mysql /etc/shadow && \ | ||
chmod g+r /etc/shadow && \ | ||
useradd ap_user && \ | ||
echo "ap_user:password" | chpasswd | ||
USER mysql:mysql | ||
|
||
# https://docs.percona.com/percona-server/8.0/pam-plugin.html#installation | ||
COPY --from=builder /tmp/pam-oauth2/libpam_oidc_gnu.so /usr/lib64/security/libpam_oidc.so | ||
RUN echo 'plugin_load_add = auth_pam.so' >> /etc/my.cnf | ||
COPY config/pam_unix /etc/pam.d/mysqld | ||
COPY config/service_example /etc/pam.d/oidc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
### Fixed | ||
|
||
* Fix fatal crash when using invalid access token #13. |
Oops, something went wrong.