Skip to content

Commit

Permalink
pam/integration-tests/native: Check that the user 'r' is accepted
Browse files Browse the repository at this point in the history
This is something that was manually tested, but since 'r' is a special
string in the native model, let's add an explicit check, ensuring that
a such user can work properly.

And no, we won't support a 'r' secret, even though we could just wait
for a broker refusal before using it as a "go back" command.
  • Loading branch information
3v1n0 committed Sep 24, 2024
1 parent 1f7c6e5 commit 2b78755
Show file tree
Hide file tree
Showing 3 changed files with 242 additions and 0 deletions.
1 change: 1 addition & 0 deletions pam/integration-tests/native_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ func TestNativeAuthenticate(t *testing.T) {

"Deny authentication if max attempts reached": {tape: "max_attempts"},
"Deny authentication if user does not exist": {tape: "unexistent_user"},
"Deny authentication if user does not exist and matches cancel key": {tape: "cancel_key_user"},
"Deny authentication if newpassword does not match required criteria": {tape: "bad_password"},

"Exit authd if local broker is selected": {tape: "local_broker"},
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,198 @@
> ./pam_authd login socket=${AUTHD_TESTS_CLI_AUTHENTICATE_TESTS_SOCK} force_native_client=true
Username:






























────────────────────────────────────────────────────────────────────────────────
> ./pam_authd login socket=${AUTHD_TESTS_CLI_AUTHENTICATE_TESTS_SOCK} force_native_client=true
Username: r






























────────────────────────────────────────────────────────────────────────────────
> ./pam_authd login socket=${AUTHD_TESTS_CLI_AUTHENTICATE_TESTS_SOCK} force_native_client=true
Username: r
== Broker selection (use 'r' to go back) ==
1 - local
2 - ExampleBroker
Select broker:


























────────────────────────────────────────────────────────────────────────────────
> ./pam_authd login socket=${AUTHD_TESTS_CLI_AUTHENTICATE_TESTS_SOCK} force_native_client=true
Username: r
== Broker selection (use 'r' to go back) ==
1 - local
2 - ExampleBroker
Select broker: 2
Insert 'r' to cancel the request and go back
Gimme your password:
























────────────────────────────────────────────────────────────────────────────────
> ./pam_authd login socket=${AUTHD_TESTS_CLI_AUTHENTICATE_TESTS_SOCK} force_native_client=true
Username: r
== Broker selection (use 'r' to go back) ==
1 - local
2 - ExampleBroker
Select broker: 2
Insert 'r' to cancel the request and go back
Gimme your password:
user not found
user not found
PAM Authenticate() for user "r" exited with error (PAM exit code: 7): Authentication failure
acct=incomplete
PAM AcctMgmt() exited with error (PAM exit code: 25): The return value should be ignored by PAM
dispatch
>

















────────────────────────────────────────────────────────────────────────────────
> ./pam_authd login socket=${AUTHD_TESTS_CLI_AUTHENTICATE_TESTS_SOCK} force_native_client=true
Username: r
== Broker selection (use 'r' to go back) ==
1 - local
2 - ExampleBroker
Select broker: 2
Insert 'r' to cancel the request and go back
Gimme your password:
user not found
user not found
PAM Authenticate() for user "r" exited with error (PAM exit code: 7): Authentication failure
acct=incomplete
PAM AcctMgmt() exited with error (PAM exit code: 25): The return value should be ignored by PAM
dispatch
>

















────────────────────────────────────────────────────────────────────────────────
43 changes: 43 additions & 0 deletions pam/integration-tests/testdata/tapes/native/cancel_key_user.tape
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
Output cancel_key_user.txt
Output cancel_key_user.gif # If we don't specify a .gif output, it will create a default out.gif file.

# Configuration header to standardize the output.
# Does not work with the "Source" command.
Set Width 800
Set Height 500
# TODO: Ideally, we should use Ubuntu Mono. However, the github runner is still on Jammy, which does not have it.
# We should update this to use Ubuntu Mono once the runner is updated.
Set FontFamily "Monospace"
Set FontSize 13
Set Padding 0
Set Margin 0
Set Shell bash

Hide
Type "./pam_authd login socket=${AUTHD_TESTS_CLI_AUTHENTICATE_TESTS_SOCK} force_native_client=true"
Enter
Sleep 300ms
Show

Hide
Type "r"
Sleep 300ms
Show

Hide
Enter
Sleep 300ms
Show

Hide
Type "2"
Enter
Sleep 500ms
Show

Hide
Enter
Sleep 500ms
Show

Sleep 300ms

0 comments on commit 2b78755

Please sign in to comment.