Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- for server in servers:
- ssh = paramiko.SSHClient()
- ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
- try:
- ssh.connect(server, **ssh_auth)
- except paramiko.AuthenticationException:
- print "Authentication Failed for",server
- sftp = ssh.open_sftp()
- ldap_conf_lines = sftp.open('/etc/ldap.conf').readlines()
- ssh.close()
- ldap_conf_data = parse_ldap_conf(ldap_conf_lines)
- report_file.write('hostname: %s, bind_timelimit: %s, timelimit: %s, AAA Auth: %s\n' %
- (server,
- ldap_conf_data.get('bind_timelimit'), # or ldap_conf_data.get('#bind_timelimit'),
- ldap_conf_data.get('timelimit'), # or ldap_conf_data.get('#timelimit'),
- ldap_conf_data.get('host') or ldap_conf_data.get('uri'),
- ))
Add Comment
Please, Sign In to add comment