简体   繁体   English

如何使用受密码保护的私钥执行盐状态git.latest

[英]How can I execute the salt state git.latest with password protected private key

I'm using salt to pull a git repo. 我正在用盐拉一个git repo。

myrepo:
   git.latest:
     - rev: master
     - target: home/myuser/myapp
     - runas: myuser

I have added an id_rsa file into /home/myuser/.ssh/ , including the private key to authenticate to github. 我在/home/myuser/.ssh/添加了一个id_rsa文件,其中包括用于对github进行身份验证的私钥。 If this private key is not password protected the above git.latest state works fine. 如果此私钥没有密码保护,则上面的git.latest状态可以正常工作。

If the private key is password protected (as it should be) the above git.latest state fails with the error message "fatal: The remote end hung up unexpectedly" . 如果私钥受到密码保护(应该是密码保护),则上面的git.latest状态将失败,并显示错误消息"fatal: The remote end hung up unexpectedly" The reason that this state fails is that the system is asking for the private key password. 此状态失败的原因是系统要求输入私钥密码。

Now I'm wondering how I could tell my salt master to provide the password to the password protected private key. 现在,我想知道如何告诉盐管理员将密码提供给受密码保护的私钥。 I think it should somehow work with a linux key chain util - or is there even some similar functionality build-in within saltstack? 我认为它应该以某种方式与linux钥匙链实用程序一起工作-甚至在Saltstack中是否内置了一些类似的功能?

I'd suggest that you use special key used only for that purpose. 我建议您使用仅用于此目的的特殊密钥。 Github offers deploy keys for this very scenario: https://help.github.com/articles/managing-deploy-keys Github在这种情况下提供了部署密钥: https : //help.github.com/articles/managing-deploy-keys

They are easily set up and easily revoked. 它们很容易设置和撤销。

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

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