@@ -57,7 +57,7 @@ def env_dir_fullpath(authtype): return os.path.join( os.environ['HOME'] , '.iro
5757def json_env_fullpath (authtype ): return os .path .join ( env_dir_fullpath (authtype ), 'irods_environment.json' )
5858def secrets_fullpath (authtype ): return os .path .join ( env_dir_fullpath (authtype ), '.irodsA' )
5959
60- SERVER_ENV_PATH = os .path .expanduser ('~irods /.irods/irods_environment.json' )
60+ RODSADMIN_ENV_PATH = os .path .expanduser ('~/.irods/irods_environment.json' )
6161
6262SERVER_ENV_SSL_SETTINGS = {
6363 "irods_ssl_certificate_chain_file" : "/etc/irods/ssl/irods.crt" ,
@@ -67,9 +67,6 @@ def secrets_fullpath(authtype): return os.path.join( env_dir_fullpath(authtype
6767 "irods_ssl_verify_server" : "cert"
6868}
6969
70- def update_service_account_for_SSL ():
71- json_file_update ( SERVER_ENV_PATH , ** SERVER_ENV_SSL_SETTINGS )
72-
7370CLIENT_OPTIONS_FOR_SSL = {
7471 "irods_client_server_policy" : "CS_NEG_REQUIRE" ,
7572 "irods_client_server_negotiation" : "request_server_negotiation" ,
@@ -82,9 +79,9 @@ def update_service_account_for_SSL():
8279}
8380
8481
85- def client_env_from_server_env (user_name , auth_scheme = "" ):
82+ def client_env_keys_from_admin_env (user_name , auth_scheme = "" ):
8683 cli_env = {}
87- with open (SERVER_ENV_PATH ) as f :
84+ with open (RODSADMIN_ENV_PATH ) as f :
8885 srv_env = json .load (f )
8986 for k in [ "irods_host" , "irods_zone_name" , "irods_port" ]:
9087 cli_env [k ] = srv_env [k ]
@@ -163,7 +160,7 @@ def create_env_dirs(self):
163160 # -- create environment configurations and secrets
164161 with pam_password_in_plaintext ():
165162 for dirname ,lookup in self .user_auth_envs .items ():
166- if lookup ['AUTH' ] == 'pam' :
163+ if lookup ['AUTH' ] in ( 'pam' , 'pam_password' ) :
167164 ses = iRODSSession ( host = gethostname (),
168165 user = lookup ['USER' ],
169166 zone = 'tempZone' ,
@@ -179,7 +176,7 @@ def create_env_dirs(self):
179176 #elif lookup['AUTH'] == 'XXXXXX': # TODO: insert other authentication schemes here
180177 elif lookup ['AUTH' ] in ('native' , '' ,None ):
181178 scrambled_pw = pw_encode ( lookup ['PASSWORD' ] )
182- cl_env = client_env_from_server_env (TEST_RODS_USER )
179+ cl_env = client_env_keys_from_admin_env (TEST_RODS_USER )
183180 if lookup .get ('AUTH' ,None ) is not None : # - specify auth scheme only if given
184181 cl_env ['irods_authentication_scheme' ] = lookup ['AUTH' ]
185182 dirbase = os .path .join (os .environ ['HOME' ],dirname )
@@ -199,18 +196,19 @@ def create_env_dirs(self):
199196 retval = dirs .keys ()
200197 return retval
201198
199+ PAM_SCHEME_STRING = 'pam'
202200
203201 @classmethod
204202 def setUpClass (cls ):
205203 cls .admin = helpers .make_session ()
204+ if cls .admin .server_version > (4 ,3 ):
205+ cls .PAM_SCHEME_STRING = cls .user_auth_envs ['.irods.pam' ]['AUTH' ] = 'pam_password'
206206
207207 @classmethod
208208 def tearDownClass (cls ):
209209 cls .admin .cleanup ()
210210
211211 def setUp (self ):
212- if os .environ ['HOME' ] != '/var/lib/irods' :
213- self .skipTest ('Must be run as irods' )
214212 super (TestLogins ,self ).setUp ()
215213
216214 def tearDown (self ):
@@ -244,12 +242,14 @@ def _setup_rodsuser_and_optional_pw(self, name, make_irods_pw = False):
244242 self .admin .users .remove ( name )
245243
246244 def tst0 (self , ssl_opt , auth_opt , env_opt , name = TEST_RODS_USER , make_irods_pw = False ):
247-
245+ _auth_opt = auth_opt
246+ if auth_opt .startswith ('pam' ):
247+ auth_opt = self .PAM_SCHEME_STRING
248248 with self ._setup_rodsuser_and_optional_pw (name = name , make_irods_pw = make_irods_pw ):
249249 self .envdirs = self .create_env_dirs ()
250250 if not self .envdirs :
251251 raise RuntimeError ('Could not create one or more client environments' )
252- auth_opt_explicit = 'native' if auth_opt == '' else auth_opt
252+ auth_opt_explicit = 'native' if _auth_opt == '' else _auth_opt
253253 verbosity = False
254254 #verbosity='' # -- debug - sanity check by printing out options applied
255255 out = {'' :'' }
@@ -282,7 +282,7 @@ def tst0(self, ssl_opt, auth_opt, env_opt, name = TEST_RODS_USER, make_irods_pw
282282 cadata = None ,
283283 cafile = SSL_cert ),
284284 ** CLIENT_OPTIONS_FOR_SSL )
285- lookup = self .user_auth_envs ['.irods.' + ('native' if not (auth_opt ) else auth_opt )]
285+ lookup = self .user_auth_envs ['.irods.' + ('native' if not (_auth_opt ) else _auth_opt )]
286286 session = iRODSSession ( host = gethostname (),
287287 user = lookup ['USER' ],
288288 zone = 'tempZone' ,
@@ -327,7 +327,7 @@ def test_4(self):
327327 self .tst0 ( ssl_opt = False , auth_opt = 'native' , env_opt = True , make_irods_pw = True )
328328
329329 # == test explicit scheme 'pam'
330-
330+
331331 def test_5 (self ):
332332 self .tst0 ( ssl_opt = True , auth_opt = 'pam' , env_opt = False )
333333
@@ -511,20 +511,21 @@ def test_ssl_with_server_verify_set_to_none_281(self):
511511 with helpers .file_backed_up (env_file ):
512512 with open (env_file ) as env_file_handle :
513513 env = json .load ( env_file_handle )
514- env .update ({ "irods_client_server_negotiation" : "request_server_negotiation" ,
515- "irods_client_server_policy" : "CS_NEG_REQUIRE" ,
516- "irods_ssl_ca_certificate_file" : "/path/to/some/file.crt" , # does not need to exist
514+ env .update ({
515+ # "irods_client_server_negotiation": "request_server_negotiation",
516+ # "irods_client_server_policy": "CS_NEG_REQUIRE",
517+ # "irods_ssl_ca_certificate_file": "/path/to/some/file.crt", # does not need to exist
517518 "irods_ssl_verify_server" : "none" ,
518- "irods_encryption_key_size" : 32 ,
519- "irods_encryption_salt_size" : 8 ,
520- "irods_encryption_num_hash_rounds" : 16 ,
521- "irods_encryption_algorithm" : "AES-256-CBC" })
519+ # "irods_encryption_key_size": 32,
520+ # "irods_encryption_salt_size": 8,
521+ # "irods_encryption_num_hash_rounds": 16,
522+ # "irods_encryption_algorithm": "AES-256-CBC"
523+ })
522524 with open (env_file ,'w' ) as f :
523525 json .dump (env ,f )
524526 with helpers .make_session () as session :
525527 session .collections .get ('/{session.zone}/home/{session.username}' .format (** locals ()))
526528
527-
528529if __name__ == '__main__' :
529530 # let the tests find the parent irods lib
530531 sys .path .insert (0 , os .path .abspath ('../..' ))
0 commit comments