Skip to content

Commit 580f23a

Browse files
committed
[_775] add test for pam_password secrets file generation
prc_write_irodsA.py invokes a function in the irods.client_init module which adapts to iRODS server version, using the new authentication framework in iRODS 4.3+ and legacy auth in previous versions.
1 parent c01ea3c commit 580f23a

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed

irods/test/harness/test_script_parameters

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ declare -A wrappers=(
2121
[test008_prc_write_irodsA_utility_in_native_mode.bats]=../login_auth_test.sh
2222
[test009_test_special_characters_in_pam_passwords_auth_framework.bats]=../login_auth_test.sh
2323
[test010_issue_362_rogue_chars_in_pam_password.bats]=../login_auth_test.sh
24+
[test011_write_pam_password_secrets_file.bats]=../login_auth_test.sh
2425
)
2526

2627
# keys for Image and User refer to the basename after resolution to a wrapper if one is used
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#!/usr/bin/env bats
2+
3+
# The tests in this BATS module must be run as a (passwordless) sudo-enabled user.
4+
# It is also required that the python irodsclient be installed under irods' ~/.local environment.
5+
6+
. $BATS_TEST_DIRNAME/test_support_functions
7+
8+
# Setup in the wrapper script (../login_auth_test.sh) includes creation of Linux user alissa with login password test123 .
9+
10+
@test "test_writing_secrets" {
11+
iadmin mkuser alissa rodsuser
12+
13+
# Make a new environment and pam_password secrets file for iRODS user alissa.
14+
rm -fr .irods/.irodsA
15+
CLIENT_JSON=~/.irods/irods_environment.json
16+
jq '.["irods_user_name"]="alissa"|.["irods_authentication_scheme"]="pam_password"' >$CLIENT_JSON.$$ <$CLIENT_JSON
17+
mv $CLIENT_JSON.$$ $CLIENT_JSON
18+
/pyN/bin/prc_write_irodsA.py --ttl 10 pam_password <<<"test123"
19+
20+
# Test that iCommands pam_password auth works with the secrets file.
21+
ils </dev/null | grep '/alissa\>'
22+
23+
# Test that python irods client pam_password authentication works with the secrets file.
24+
python -c 'import irods.helpers as h; ses=h.make_session(); c=h.home_collection(ses); print(ses.collections.get(c).path)'|\
25+
grep '/alissa\>'
26+
}

0 commit comments

Comments
 (0)