validate.py 文件源码

python
阅读 28 收藏 0 点赞 0 评论 0

项目:dcos 作者: dcos 项目源码 文件源码
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.')
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号