Script setup_ssh
Tool to setup the SSH configuration on a remote node.
This is needed before we can join the node into the cluster.
|
_CheckJoin(transport)
Checks if a join is safe or dangerous. |
|
|
|
|
|
|
|
|
|
|
|
SetupSSH(transport)
Sets the SSH up on the other side. |
|
|
|
ParseOptions()
Parses options passed to program. |
|
|
|
|
list
|
|
|
|
boolean
|
LoginViaKeys(transport,
username,
keys)
Try to login on the given transport via a list of keys. |
|
|
|
|
|
|
|
|
Imports:
getpass,
logging,
paramiko,
os,
optparse,
sys,
cli,
constants,
errors,
netutils,
ssconf,
ssh,
utils
Checks if a join is safe or dangerous.
Note: This function relies on the fact, that all hosts have the same
configuration at compile time of Ganeti. So that the constants do not
mismatch.
- Parameters:
transport - The paramiko transport instance
- Returns:
- True if the join is safe; False otherwise
|
_RunRemoteCommand(transport,
command)
|
|
Invokes and wait for the command over SSH.
- Parameters:
transport - The paramiko transport instance
command - The command to be executed
|
_InvokeDaemonUtil(transport,
command)
|
|
Invokes daemon-util on the remote side.
- Parameters:
transport - The paramiko transport instance
command - The daemon-util command to be run
|
_ReadSftpFile(sftp,
filename)
|
|
Reads a file over sftp.
- Parameters:
sftp - An open paramiko SFTP client
filename - The filename of the file to read
- Returns:
- The content of the file
|
_WriteSftpFile(sftp,
name,
perm,
data)
|
|
SFTPs data to a remote file.
- Parameters:
sftp - A open paramiko SFTP client
name - The remote file name
perm - The remote file permission
data - The data to write
|
Sets the SSH up on the other side.
- Parameters:
transport - The paramiko transport instance
|
Sets up the logging.
- Parameters:
|
Load the list of available private keys.
It loads the standard ssh key from disk and then tries to connect to
the ssh agent too.
- Returns: list
- a list of
paramiko.PKey
|
Formats a paramiko.PKey.get_fingerprint() human readable.
- Parameters:
fpr - The fingerprint to be formatted
- Returns:
- A human readable fingerprint
|
LoginViaKeys(transport,
username,
keys)
|
|
Try to login on the given transport via a list of keys.
- Parameters:
transport - the transport to use
username - the username to login as
keys (list) - list of paramiko.PKey to use for authentication
- Returns: boolean
- True or False depending on whether the login was successfull or
not
|
Load the known hosts.
- Returns:
- paramiko.util.load_host_keys dict
|
_VerifyServerKey(transport,
host,
host_keys)
|
|
Verify the server keys.
- Parameters:
transport - A paramiko.transport instance
host - Name of the host we verify
host_keys - Loaded host keys
- Raises:
HostkeyVerificationError - When the host identify couldn't be verified
|