8a53449ad0353d5c18296b79b52a2a7b957f6421René Genz """ Check ssh login as LDAP user with Kerberos credentials """
ee1e4c0fa7e8a973ecf16b7535664b8f47fc7e75Niranjan M.R ssh = SSHClient(multihost.master[0].sys_hostname,
ee1e4c0fa7e8a973ecf16b7535664b8f47fc7e75Niranjan M.R except paramiko.ssh_exception.AuthenticationException:
ee1e4c0fa7e8a973ecf16b7535664b8f47fc7e75Niranjan M.R pytest.fail("Authentication Failed as user %s" % ('foo1'))
ee1e4c0fa7e8a973ecf16b7535664b8f47fc7e75Niranjan M.R """ Run kinit after user login """
ee1e4c0fa7e8a973ecf16b7535664b8f47fc7e75Niranjan M.R ssh = SSHClient(multihost.master[0].sys_hostname,
ee1e4c0fa7e8a973ecf16b7535664b8f47fc7e75Niranjan M.R except paramiko.ssh_exception.AuthenticationException:
ee1e4c0fa7e8a973ecf16b7535664b8f47fc7e75Niranjan M.R pytest.fail("Authentication Failed as user %s" % ('foo2'))
ee1e4c0fa7e8a973ecf16b7535664b8f47fc7e75Niranjan M.R (_, _, exit_status) = ssh.execute_cmd(args='kinit',
ee1e4c0fa7e8a973ecf16b7535664b8f47fc7e75Niranjan M.R """ Run kinit with KRB5CCNAME=KCM: """
ee1e4c0fa7e8a973ecf16b7535664b8f47fc7e75Niranjan M.R ssh = SSHClient(multihost.master[0].sys_hostname,
ee1e4c0fa7e8a973ecf16b7535664b8f47fc7e75Niranjan M.R except paramiko.ssh_exception.AuthenticationException:
ee1e4c0fa7e8a973ecf16b7535664b8f47fc7e75Niranjan M.R pytest.fail("Authentication Failed as user %s" % ('foo3'))
ee1e4c0fa7e8a973ecf16b7535664b8f47fc7e75Niranjan M.R (_, _, exit_status) = ssh.execute_cmd('KRB5CCNAME=KCM:; kinit',
ee1e4c0fa7e8a973ecf16b7535664b8f47fc7e75Niranjan M.R (stdout, _, _) = ssh.execute_cmd('KRB5CCNAME=KCM:;klist')
ee1e4c0fa7e8a973ecf16b7535664b8f47fc7e75Niranjan M.R if 'Ticket cache: KCM:14583103' in str(line.strip()):
ee1e4c0fa7e8a973ecf16b7535664b8f47fc7e75Niranjan M.R """ Test Offline ssh login """
ee1e4c0fa7e8a973ecf16b7535664b8f47fc7e75Niranjan M.R multihost.master[0].transport.get_file('/etc/sssd/sssd.conf',
ee1e4c0fa7e8a973ecf16b7535664b8f47fc7e75Niranjan M.R domain_section = "%s/%s" % ('domain', 'EXAMPLE.TEST')
ee1e4c0fa7e8a973ecf16b7535664b8f47fc7e75Niranjan M.R sssdconfig.set(domain_section, 'cache_credentials', 'True')
ee1e4c0fa7e8a973ecf16b7535664b8f47fc7e75Niranjan M.R sssdconfig.set(domain_section, 'krb5_store_password_if_offline',
ee1e4c0fa7e8a973ecf16b7535664b8f47fc7e75Niranjan M.R sssdconfig.set('pam', 'offline_credentials_expiration', '0')
ee1e4c0fa7e8a973ecf16b7535664b8f47fc7e75Niranjan M.R print("Could not fetch sssd.conf")
ee1e4c0fa7e8a973ecf16b7535664b8f47fc7e75Niranjan M.R multihost.master[0].transport.put_file('/tmp/sssd.conf',
ee1e4c0fa7e8a973ecf16b7535664b8f47fc7e75Niranjan M.R ssh = SSHClient(multihost.master[0].sys_hostname,
ee1e4c0fa7e8a973ecf16b7535664b8f47fc7e75Niranjan M.R except paramiko.ssh_exception.AuthenticationException:
ee1e4c0fa7e8a973ecf16b7535664b8f47fc7e75Niranjan M.R pytest.fail("Unable to authenticate as %s" % ('foo4'))
ee1e4c0fa7e8a973ecf16b7535664b8f47fc7e75Niranjan M.R 'dirsrv@example1'])
ee1e4c0fa7e8a973ecf16b7535664b8f47fc7e75Niranjan M.R multihost.master[0].run_command(['systemctl', 'stop', 'krb5kdc'])
ee1e4c0fa7e8a973ecf16b7535664b8f47fc7e75Niranjan M.R ssh = SSHClient(multihost.master[0].sys_hostname,
ee1e4c0fa7e8a973ecf16b7535664b8f47fc7e75Niranjan M.R except paramiko.ssh_exception.AuthenticationException:
ee1e4c0fa7e8a973ecf16b7535664b8f47fc7e75Niranjan M.R pytest.fail("Unable to authenticate as %s" % ('foo4'))