def validate_ssh_key_path(ssh_key_path):
assert os.path.isfile(ssh_key_path), 'could not find ssh private key: {}'.format(ssh_key_path)
assert stat.S_IMODE(
os.stat(ssh_key_path).st_mode) & (stat.S_IRWXG + stat.S_IRWXO) == 0, (
'ssh_key_path must be only read / write / executable by the owner. It may not be read / write / executable '
'by group, or other.')
with open(ssh_key_path) as fh:
assert 'ENCRYPTED' not in fh.read(), ('Encrypted SSH keys (which contain passphrases) '
'are not allowed. Use a key without a passphrase.')
评论列表
文章目录