2

I am in the process of setting up the rhc client tools to connect to OpenShift. During 'rhc setup', it is suppose to generate the ssh keys under:

~/.ssh/

However, this .ssh folder is being used for another connection and my preference is not to modify this folder.

Is it possible to somehow specify a different location for ssh keys generation during rhc setup?

Because during rhc setup, I was not asked where to generate the keys and I also looked in ~/.openshift/express.conf and I only saw the configurations for ssl; not ssh.

Thanks.

King-Wizard
  • 15,628
  • 6
  • 82
  • 76
mk3lai
  • 43
  • 3

2 Answers2

0

If you already have existing ssh keys in your .ssh folder, the rhc setup command probably asked if you wanted to upload your existing keys, not create new ones. if you log into the openshift web console, you can see if it uploaded a key for you.

King-Wizard
  • 15,628
  • 6
  • 82
  • 76
0

Not sure how it works on windows. Did you try setting the HOME env variable upon running rhc? Or whatever HOME* variables there are on windows to specify user's home dir (HOMEPATH, HOMEDRIVE...).

I can only assume whoever downvoted this is an idiot. Just tried on linux and it is working. I can't test on windows but it's highly likely that it would work there as well. Anyway, for whoever finds it useful:

$ HOME=/home/crackit/newhome rhc setup
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'.

Login to openshift.redhat.com: xxxxx@yyyyyy.zzz
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 ... lasts about 1 month

Saving configuration to /home/crackit/newhome/.openshift/express.conf ... done

No SSH keys were found. We will generate a pair of keys for you.

    Created: /home/crackit/newhome/.ssh/id_rsa.pub

Your public SSH key must be uploaded to the OpenShift server to access code.
Upload now? (yes|no)
yes

  default (type: ssh-rsa)
  -----------------------
    Fingerprint: ba:49:1e:2a:22:1d:e4:69:3b:ee:62:09:dc:2d:4c:f1

  dpospisi (type: ssh-rsa)
  ------------------------
    Fingerprint: 83:89:a7:c4:bd:31:31:8c:26:a4:82:a5:8e:6e:c0:65

You can enter a name for your key, or leave it blank to use the default name.
Using the same name as an existing key will overwrite the old key.

Provide a name for this key: |asdfghhjjkk| gah

Uploading key 'gah' ... done

Checking for git ... found git version 2.1.0

Checking common problems .. done

Checking for a domain ... asdfghh

Checking for applications ... found 2

  jenkins http://aaaa-bbbbbb.rhcloud.com/
  tmp     http://tmp-bbbbbb.rhcloud.com/

  You are using 2 of 3 total gears
  The following gear sizes are available to you: small, medium

Your client tools are now configured.
akostadinov
  • 17,364
  • 6
  • 77
  • 85
  • @King-Wizard, if you have a key already at that other location (specified by the `HOME` env variable), then it will not create a new pair. I see your question is different though. I looked at the source and I see ssh key hardcoded to `~/.ssh/id_rsa` in `lib/rhc/config.rb`. There is no command line option to affect ssh setup of `rhc setup`. So you can just select `No` in rhc setup and then add key with `rhc sshkey add` command or you can explain what and why are you trying to do for a better answer. – akostadinov Dec 30 '15 at 09:51
  • Part 1/2: @ akostadinov Let is imagine if I do not want to set the $HOME environment variable and want instead use my ssh keys located at a certain custom path. Take also in consideration that I have my `~/.ssh/config` file good and well configured and pointing to the custom path where my ssh keys are located. After having added `ssh_key_file='~/.ssh/OpenShift-SSH-Keys/my_id_rsa'` to `~/.openshift/custom-express.conf` and ran `rhc setup --config ~/.openshift/custom-express.conf -l ` I can notice that the file is taken in consideration by `rhc setup` – King-Wizard Jan 03 '16 at 00:07
  • Part 2/2: @ akostadinov but the `ssh_key_file='~/.ssh/OpenShift-SSH-Keys/my_id_rsa'` instruction does not seem to be taken in consideration by the `rhc cli`. According to you why does not it take it in consideration and how would you do to fix that problem? Is the syntax of the instruction wrong or deprecated? – King-Wizard Jan 03 '16 at 00:08
  • @King-Wizard, as to `why` I can't say. As I said, the ssh key part is pretty much hard-coded. Most probably that use case was not considered when tool was written. You could file a bug if you wish. But in my personal opinion `rhc setup` is meant to cover most common use cases. If you want something exotic, you need some other commands. I wrote you these commands in your other question(s). – akostadinov Jan 03 '16 at 17:56
  • for those who wonder - this is the other question: http://stackoverflow.com/a/34559668/520567 – akostadinov Jan 03 '16 at 18:04