Exemplo n.º 1
0
 def test_update_all_four(self):
     old_rule = PamdRule.rulefromstring(
         'auth      	sufficient	pam_unix.so nullok try_first_pass')
     new_rule = PamdRule.rulefromstring('one      	two	three four five')
     update_rule(self.pamd, old_rule, new_rule)
     self.assertIn(str(new_rule).rstrip(), str(self.pamd))
     self.assertNotIn(str(old_rule).rstrip(), str(self.pamd))
Exemplo n.º 2
0
 def test_update_rule_module_path(self):
     old_rule = PamdRule.rulefromstring('auth      	required	pam_env.so')
     new_rule = PamdRule.rulefromstring(
         'session      	required	pam_limits.so')
     update_rule(self.pamd, old_rule, new_rule)
     self.assertIn(str(new_rule).rstrip(), str(self.pamd))
     self.assertNotIn(str(old_rule).rstrip(), str(self.pamd))
Exemplo n.º 3
0
 def test_update_rule_module_path_slash(self):
     old_rule = PamdRule.rulefromstring('auth      	required	pam_env.so')
     new_rule = PamdRule.rulefromstring(
         'auth      	required	/lib64/security/pam_duo.so')
     update_rule(self.pamd, old_rule, new_rule)
     self.assertIn(str(new_rule).rstrip(), str(self.pamd))
     self.assertNotIn(str(old_rule).rstrip(), str(self.pamd))
Exemplo n.º 4
0
 def test_update_rule_module_args(self):
     old_rule = PamdRule.rulefromstring(
         'auth      	sufficient	pam_unix.so nullok try_first_pass')
     new_rule = PamdRule.rulefromstring(
         'auth      	sufficient	pam_unix.so uid uid')
     update_rule(self.pamd, old_rule, new_rule)
     self.assertIn(str(new_rule).rstrip(), str(self.pamd))
     self.assertNotIn(str(old_rule).rstrip(), str(self.pamd))
Exemplo n.º 5
0
 def test_update_rule_control_more_complex(self):
     old_rule = PamdRule.rulefromstring(
         'session   	[success=1 test=me default=ignore]	pam_succeed_if.so service in crond quiet use_uid'
     )
     new_rule = PamdRule.rulefromstring(
         'session   	[success=2 test=me default=ignore]	pam_succeed_if.so service in crond quiet use_uid'
     )
     update_rule(self.pamd, old_rule, new_rule)
     self.assertIn(str(new_rule).rstrip(), str(self.pamd))
     self.assertNotIn(str(old_rule).rstrip(), str(self.pamd))
Exemplo n.º 6
0
 def test_update_first_three(self):
     old_rule = PamdRule.rulefromstring('auth      	required	pam_env.so')
     new_rule = PamdRule.rulefromstring('one      	two	three')
     update_rule(self.pamd, old_rule, new_rule)
     self.assertIn(str(new_rule).rstrip(), str(self.pamd))
     self.assertNotIn(str(old_rule).rstrip(), str(self.pamd))
Exemplo n.º 7
0
 def test_update_rule_control_simple(self):
     old_rule = PamdRule.rulefromstring('auth      	required	pam_env.so')
     new_rule = PamdRule.rulefromstring('auth      	sufficent	pam_env.so')
     update_rule(self.pamd, old_rule, new_rule)
     self.assertIn(str(new_rule).rstrip(), str(self.pamd))
     self.assertNotIn(str(old_rule).rstrip(), str(self.pamd))
Exemplo n.º 8
0
 def test_update_rule_type(self):
     old_rule = PamdRule.rulefromstring('auth      	required	pam_env.so')
     new_rule = PamdRule.rulefromstring('session      	required	pam_env.so')
     update_rule(self.pamd, old_rule, new_rule)
     self.assertIn(str(new_rule).rstrip(), str(self.pamd))
     self.assertNotIn(str(old_rule).rstrip(), str(self.pamd))
Exemplo n.º 9
0
 def test_update_rule_control_simple(self):
     old_rule = PamdRule.rulefromstring('auth      	required	pam_env.so')
     new_rule = PamdRule.rulefromstring('auth      	sufficent	pam_env.so')
     update_rule(self.pamd, old_rule, new_rule)
     self.assertIn(str(new_rule).rstrip(), str(self.pamd))
     self.assertNotIn(str(old_rule).rstrip(), str(self.pamd))
Exemplo n.º 10
0
 def test_update_all_four(self):
     old_rule = PamdRule.rulefromstring('auth      	sufficient	pam_unix.so nullok try_first_pass')
     new_rule = PamdRule.rulefromstring('one      	two	three four five')
     update_rule(self.pamd, old_rule, new_rule)
     self.assertIn(str(new_rule).rstrip(), str(self.pamd))
     self.assertNotIn(str(old_rule).rstrip(), str(self.pamd))
Exemplo n.º 11
0
 def test_update_first_three(self):
     old_rule = PamdRule.rulefromstring('auth      	required	pam_env.so')
     new_rule = PamdRule.rulefromstring('one      	two	three')
     update_rule(self.pamd, old_rule, new_rule)
     self.assertIn(str(new_rule).rstrip(), str(self.pamd))
     self.assertNotIn(str(old_rule).rstrip(), str(self.pamd))
Exemplo n.º 12
0
 def test_update_rule_module_args(self):
     old_rule = PamdRule.rulefromstring('auth      	sufficient	pam_unix.so nullok try_first_pass')
     new_rule = PamdRule.rulefromstring('auth      	sufficient	pam_unix.so uid uid')
     update_rule(self.pamd, old_rule, new_rule)
     self.assertIn(str(new_rule).rstrip(), str(self.pamd))
     self.assertNotIn(str(old_rule).rstrip(), str(self.pamd))
Exemplo n.º 13
0
 def test_update_rule_control_more_complex(self):
     old_rule = PamdRule.rulefromstring('session   	[success=1 test=me default=ignore]	pam_succeed_if.so service in crond quiet use_uid')
     new_rule = PamdRule.rulefromstring('session   	[success=2 test=me default=ignore]	pam_succeed_if.so service in crond quiet use_uid')
     update_rule(self.pamd, old_rule, new_rule)
     self.assertIn(str(new_rule).rstrip(), str(self.pamd))
     self.assertNotIn(str(old_rule).rstrip(), str(self.pamd))
Exemplo n.º 14
0
 def test_update_rule_module_path_slash(self):
     old_rule = PamdRule.rulefromstring('auth      	required	pam_env.so')
     new_rule = PamdRule.rulefromstring('auth      	required	/lib64/security/pam_duo.so')
     update_rule(self.pamd, old_rule, new_rule)
     self.assertIn(str(new_rule).rstrip(), str(self.pamd))
     self.assertNotIn(str(old_rule).rstrip(), str(self.pamd))