Comment 2 for bug 1006528

Revision history for this message
Lars Hansson (romabysen) wrote :

This is also a problem with valid ssh2 ecdsa keys, paramiko does not support them. Since I have a lot of new installations where ecdsa is the default this makes the lens not so useful. Since there's no estimate on when paramiko will support these key types I put together a function that parses a known_hosts file:

def parse_known_hosts(infile):
    hosts = []
    try:
        f = open(infile)
    except IOError:
        return hosts
    for line in f:
        fields = line.split(' ')
        if len(fields) < 3:
            continue
        names = fields[0].split(',')
        hosts = hosts + names
    f.close()
    return hosts

It's works pretty much the same as the parsing in paramiko but it supports any key type. Feel free to include it in the lens.