@@ -548,5 +548,34 @@ def test_delete_current_user(self):
548
548
self .cli_commit ()
549
549
self .cli_discard ()
550
550
551
+ def test_pam_nologin (self ):
552
+ # Testcase for T7443, test if we can login with a non-privileged user
553
+ # when there are only 5 minutes left until the system reboots
554
+ username = users [0 ]
555
+ password = f'{ username } -pSWd-t3st'
556
+
557
+ self .cli_set (base_path + ['user' , username , 'authentication' , 'plaintext-password' , password ])
558
+ self .cli_commit ()
559
+
560
+ # Login with proper credentials
561
+ out , err = self .ssh_send_cmd (ssh_test_command , username , password )
562
+ # verify login
563
+ self .assertFalse (err )
564
+ self .assertEqual (out , self .ssh_test_command_result )
565
+
566
+ # Request system reboot in 5 minutes - this will activate pam_nologin.so
567
+ # and prevent any login - but we have this disabled, so we must be able
568
+ # to login to the router
569
+ self .op_mode (['reboot' , 'in' , '4' ])
570
+
571
+ # verify login
572
+ # Login with proper credentials - after reboot is pending
573
+ out , err = self .ssh_send_cmd (ssh_test_command , username , password )
574
+ self .assertFalse (err )
575
+ self .assertEqual (out , self .ssh_test_command_result )
576
+
577
+ # Cancel pending reboot - we do wan't to preceed with the remaining tests
578
+ self .op_mode (['reboot' , 'cancel' ])
579
+
551
580
if __name__ == '__main__' :
552
581
unittest .main (verbosity = 2 )
0 commit comments