Exemple #1
0
def appendLocalKeyInRemote(key, authorized_key_path, ip, user, passwd):
    """ Adds localkey as an authorized key in remotehost over SSH """

    key_append_cmd = 'echo "%s" >> %s' % (key, authorized_key_path)
    sshToOtherClient(ip, user, passwd, key_append_cmd)
    logging.debug(
        "******** Local key has been added into authorized_keys in %s ********",
        ip)
def getRemoteKey(cmd, path, ip, user, passwd):
    """ Uses ssh-keygen command over SSH to generate id_rsa.pub on remotehost """
    
    remote_key_generation_result = sshToOtherClient (ip, user, passwd, cmd)
    showKeyCmd = 'cat %s' %(path)
    remote_key = sshToOtherClient (ip, user, passwd, showKeyCmd)
    logging.debug ("******** Remote key for %s has been generated successfully : %s ********", ip, remote_key)
    return remote_key
def getRemoteKey(cmd, path, ip, user, passwd):
    """Uses ssh-keygen command over SSH to generate id_rsa.pub on remotehost"""

    sshToOtherClient(ip, user, passwd, cmd)
    showKeyCmd = 'cat %s' % (path)
    remote_key = sshToOtherClient(ip, user, passwd, showKeyCmd)
    logging.debug("Remote key for %s has been generated successfully : %s",
                  ip, remote_key)
    return remote_key
def appendLocalKeyInRemote(key, authorized_key_path, ip, user, passwd):
    """ Adds localkey as an authorized key in remotehost over SSH """

    key_append_cmd = 'echo "%s" >> %s' % (key, authorized_key_path)
    sshToOtherClient(ip, user, passwd, key_append_cmd)
    logging.debug("Local key has been added into authorized_keys in %s", ip)