bosh icon indicating copy to clipboard operation
bosh copied to clipboard

bosh_cli cannot easily log in to BOSH director running on port 443

Open james-masson opened this issue 12 years ago • 7 comments

We've noticed that running BOSH director NGINX listening on port 443 makes life hard for bosh_cli.

bosh_cli seems to assume that https://bosh-director == https://bosh-director:25555

When you specify the director URL as https://bosh-director:443 - the "target" operation seems to succeed, but the "login" operation fails.

Manually editing .bosh_config to insert extra '443's as appropriate allows login to succeed, but this will be undone every time a 'bosh target' operation is run.

Apologies for the lack of direct examples, let me know if you can't duplicate this.

james-masson avatar Apr 09 '14 08:04 james-masson

We have created an issue in Pivotal Tracker to manage this. You can view the current status of your issue at: http://www.pivotaltracker.com/story/show/69162954. This repo is managed by the 'BOSH' team.

cf-gitbot avatar Apr 09 '14 08:04 cf-gitbot

@goehmen, can your team address this issue?

CF Community Pair (@khwang1 & @chou)

chou avatar Apr 09 '14 23:04 chou

bosh team will respond

goehmen avatar Apr 09 '14 23:04 goehmen

Ran into this again today...

you'll get something similar to this:

jmasson@x220 ~/bosh/cloudcredo-product $ bosh target https://1.2.3.4:443
Target set to `Bosh Lite Director'
jmasson@x220 ~/bosh/cloudcredo-product $ bosh login
Your username: director
Enter password: ***************
[WARNING] cannot access director, trying 4 more times...
^C
Exiting...

at this point you edit ~/.bosh_config to...

---
target: https://1.2.3.4:443   <--- :443 added here
target_name: Bosh Lite Director
target_version: 1.2411.0 (f71e2276)

and now bosh login works:

jmasson@x220 ~/bosh/cloudcredo-product $ bosh login
Your username: director
Enter password: ************
Logged in as `director'

james-masson avatar Apr 22 '14 10:04 james-masson

normalize_url is causing this problem (https://github.com/cloudfoundry/bosh/blob/master/bosh_cli/lib/cli/base_command.rb#L209). to_s method does not output ":443" since 443 is the default port for SSL (see https://github.com/ruby/ruby/blob/trunk/lib/uri/generic.rb#L1478)

irb(main):044:0* require 'uri' => false irb(main):045:0> url = 'https://localhost:8443' => "https://localhost:8443" irb(main):046:0> uri = URI.parse(url) => #<URI::HTTPS:0x007f81e995b240 URL:https://localhost:8443> irb(main):047:0> print uri.to_s https://localhost:8443=> nil irb(main):048:0> url = 'https://localhost:443' => "https://localhost:443" irb(main):049:0> uri = URI.parse(url) => #<URI::HTTPS:0x007f81e9972378 URL:https://localhost> irb(main):050:0> print uri.to_s https://localhost=> nil

If we fix/special case this, this scenario should work just fine.

dims avatar Jun 15 '14 15:06 dims

Here's a pull request that works for me : https://github.com/cloudfoundry/bosh/pull/588

dims avatar Jun 16 '14 00:06 dims

Closing this issue. We have a story that's almost at the top of the backlog (will be done within a week) to fix this.

cppforlife avatar Aug 05 '14 04:08 cppforlife