简体   繁体   English

python结构如何保护ssh凭据?

[英]How does python fabric protect ssh credentials?

So I've recently stumbled upon python fabric api and have been really happy with how it can help me with day-to-day sysadmin tasks. 所以我最近偶然发现了python fabric api,并且非常满意它如何帮助我完成日常的系统管理任务。 I would like to start using it at work but it is a very security-conscious environment. 我想在工作中开始使用它,但它是一个非常注重安全的环境。 I was wondering how fabric handles the ssh password you provide to it while it runs it's tasks? 我想知道Fabric在运行它的任务时如何处理你提供给它的ssh密码? I'm assuming it plonks it in memory somewhere and pulls it out when required to login to the next host in env.hosts ? 我假设它在某个地方将它存储在内存中并在需要登录env.hosts的下一个主机时将其拉出来? How does it protect this password while in memory? 如何在内存中保护此密码?

I can see I'm going to be asked lots of questions along these lines so I'm looking for a nice way to explain to security-minded type of people that fabric is nice and friendly and doesn't pose a risk or at least no more of a risk than anything else we already have :) 我可以看到我会被问到很多这样的问题,所以我正在寻找一种很好的方式向安全意识的人解释面料既美观又友好,不会造成风险或至少没有比我们已有的任何其他风险:)

I looked briefly through the source @dm03514 referenced and I believe you are correct in that if and when fabric needs to prompt interactively for a password, it will read it into memory and store it for the duration of the fabric python process. 我简要介绍了引用的 @ dm03514,我相信你是正确的,如果Fabric需要以交互方式提示输入密码,它会将其读入内存并在结构python进程期间存储它。 The way to address your concern is not with fabric itself but with ensuring your ssh infrastructure is using keys instead of passphrases and ssh agent forwarding where appropriate. 解决您的问题的方法不是使用结构本身,而是确保您的ssh基础结构在适当时使用密钥而不是密码和ssh代理转发。 Use enrypted ssh keys and ssh-agent to unlock them and fabric will be able to utilize that same mechanism and thus avoid ssh passwords getting involved at all. 使用enrypted ssh密钥和ssh-agent来解锁它们,然后结构将能够利用相同的机制,从而避免使用ssh密码。 For sudo passwords, you'll either have to allow passwordless sudo or accept the risk of fabric having the sudo password in memory while it is working. 对于sudo密码,你要么必须允许无密码sudo,要么接受结构在工作时在内存中使用sudo密码的风险。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM