【发布时间】:2016-04-05 16:00:34
【问题描述】:
我正在为 OpenShift 项目使用 rhc cli 工具。我遇到了默认 rhc ssh 密钥的问题。
在任何与 ssh 相关的操作(设置、应用程序创建等)上,如果 ~/.ssh/id_rsa 密钥不存在,rhc 将创建它。我不喜欢这种行为,我希望它使用 ~/.ssh/OpenShift-SSH-Keys/my_id_rsa 之类的东西。
因为在 rhc 设置期间,它没有询问我要从哪个位置加载密钥。因此,我还查看了~/.openshift/express.conf,我只看到了 ssl 的配置;不是 ssh。
所以我在互联网上找到了以下配置行添加到~/.openshift/express.conf:
ssh_key_file='~/.ssh/OpenShift-SSH-Keys/my_id_rsa'
我添加了它并修改了我的~/.ssh/config 文件:
# Openshift *.rhcloud.com ssh-key config
Host *.rhcloud.com
IdentityFile ~/.ssh/OpenShift-SSH-Keys/my_id_rsa
IdentitiesOnly yes
VerifyHostKeyDNS yes
StrictHostKeyChecking no
PasswordAuthentication no
UserKnownHostsFile ~/.ssh/known_hosts
最后,我这样设置我的帐户:
rhc setup --config ~/.openshift/express.conf -l myusername@gmail.com
此命令行的输出:
OpenShift Client Tools (RHC) Setup Wizard
This wizard will help you upload your SSH keys, set your application namespace, and check that other programs like Git are
properly installed.
If you have your own OpenShift server, you can specify it now. Just hit enter to use the server for OpenShift Online:
openshift.redhat.com.
Enter the server hostname: |openshift.redhat.com|
You can add more servers later using 'rhc server'.
Using myusername@gmail.com to login to openshift.redhat.com
RSA 1024 bit CA certificates are loaded due to old openssl compatibility
Password: ************************
OpenShift can create and store a token on disk which allows to you to access the server without using your password. The
key is stored in your home directory and should be kept secret. You can delete the key at any time by running 'rhc
logout'.
Generate a token now? (yes|no) yes
Generating an authorization token for this client ... RSA 1024 bit CA certificates are loaded due to old openssl compatibility
lasts 29 days
Saving configuration to /Users/theuser/.openshift/express.conf ... done
No SSH keys were found. We will generate a pair of keys for you.
Created: /Users/theuser/.ssh/id_rsa.pub
Your public SSH key must be uploaded to the OpenShift server to access code. Upload now? (yes|no) no
You can upload your public SSH key at a later time using the 'rhc sshkey' command
Checking for git ... found git version 2.5.0
Checking common problems .. done
Checking for a domain ... mydomainz1955
Checking for applications ... found 1
myapp http://myapp-mydomainz1955.rhcloud.com/
You are using 2 of 3 total gears
The following gear sizes are available to you: small
Your client tools are now configured.
正如您在命令行输出中看到的:No SSH keys were found. We will generate a pair of keys for you.,虽然我在~/.openshift/express.conf 中指定我已经生成了 ssh 密钥,但rhc setup 没有考虑它们或没有找到它们。
那么根据你们的说法,是否可以在 rhc 设置期间以某种方式为 ssh 密钥加载指定不同的位置?
注意:我知道如何添加额外的 ssh 密钥,但我想停止 rhc 创建/使用~/.ssh/id_rsa
【问题讨论】:
标签: ssh openshift ssh-keys openshift-client-tools