Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DEV-385: Fix unwrap when provider response fails #13

Merged
merged 36 commits into from
Jan 17, 2024

Conversation

ethho
Copy link
Contributor

@ethho ethho commented Jan 12, 2024

From DEV-385:

{"log":"[2023-12-01 16:59:04.034][pam-oidc][0.1.4][ERROR][3094049498]: thread '<unnamed>' panicked at 'called Result::unwrap() on an Err value: Error(\"EOF while parsing a value\", line: 1, column: 0)': src/lib.rs:190\nfatal runtime error: failed to initiate panic, error 5\n","file":"/var/lib/mysql/mysqld-error.log"} at

let json: Value = serde_json::from_str(&body).unwrap();

Try to reproduce this issue to see what action triggers it

Commits

  • cargo init
  • mv Dockerfile
  • WIP docker compose stack
  • Add example pam_unix user ap_user
  • Document pam_unix testing process

@ethho
Copy link
Contributor Author

ethho commented Jan 15, 2024

As of fe8b560, I am able to replicate the error observed in production (see DEV-385). Using a milagros.env file that looks like:

DJ_AUTH_USER=milagros
DJ_AUTH_PASSWORD=
DJ_AUTH_TOKEN='ey<token from above>POW3g'

Where the token is from the Jupyter logs that Drew sent.

Console Logs
$ cat config/libpam_oidc.yaml
client.id: works
client.secret: <client_secret>
url.auth:     https://accounts.datajoint.com/realms/datajoint/protocol/openid-connect/auth
url.token:    https://accounts.datajoint.com/realms/datajoint/protocol/openid-connect/token
url.userinfo: https://accounts.datajoint.com/realms/datajoint/protocol/openid-connect/userinfo
username.key: preferred_username
scopes: "openid"
token.min_size: 128  # maximum password length
log.path: /tmp/libpam_oidc.log
log.level: Info  # Error || Warn || Info || Debug
$ alias dkc="docker compose"
$ dkc run -it --build percona python3 /opt/test.py
# ...
Authenticated (pam_unix)? True
Reason (pam_unix): Success
Authenticating with DJ_AUTH_USER='milagros'
[2024-01-15 21:30:10.899][pam-oidc][0.1.4][INFO][4020109068]: Auth detected. Proceeding...
[2024-01-15 21:30:10.899][pam-oidc][0.1.4][INFO][4020109068]: Inputs read.
[2024-01-15 21:30:10.900][pam-oidc][0.1.4][INFO][4020109068]: Check as password.
[2024-01-15 21:30:11.195][pam-oidc][0.1.4][ERROR][4020109068]: Wrong password provided. Details: ServerResponse(StandardErrorResponse { error: invalid_grant, error_description: Some("Invalid user credentials"), error_uri: None })
Authenticated (oidc user:pass)? False
Reason (oidc user:pass): Permission denied
Authenticating with DJ_AUTH_USER='milagros'
[2024-01-15 21:30:11.198][pam-oidc][0.1.4][INFO][4020109068]: Auth detected. Proceeding...
[2024-01-15 21:30:11.198][pam-oidc][0.1.4][INFO][4020109068]: Inputs read.
[2024-01-15 21:30:11.198][pam-oidc][0.1.4][INFO][4020109068]: Check as token.
[2024-01-15 21:30:11.198][pam-oidc][0.1.4][INFO][4020109068]: Verifying token.
[2024-01-15 21:30:11.507][pam-oidc][0.1.4][ERROR][4020109068]: thread '<unnamed>' panicked at 'called `Result::unwrap()` on an `Err` value: Error("EOF while parsing a value", line: 1, column: 0)': src/lib.rs:195
fatal runtime error: failed to initiate panic, error 5

@ethho
Copy link
Contributor Author

ethho commented Jan 17, 2024

See documentation in the updated README.

@ethho ethho marked this pull request as ready for review January 17, 2024 04:15
@yambottle yambottle merged commit 276ae3a into datajoint-company:master Jan 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants