Certificate Verification
Hi Guys,
Apologies if I'm jumping ahead, but I've noticed that commit 101bd654711d1904597a9933e61d2d935133b384 now adds SSL verification.
This appears to stop usage not only when using self signed certificates, but also when using certificates that require a CA Certificate to be attached (eg: GoDaddy certificates - at least from my linux box).
Is there a way to make the cli to read the root chain being provided as part of the certificate?
If using self-signed certificates (which most people are in dev), this will completely prevent usage. Are there plans to have a flag to disable verification so it can be used with self-signed certs?
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/66644298
What was the original Pivotal Tracker ticket that caused this https://github.com/cloudfoundry/cli/commit/101bd654711d1904597a9933e61d2d935133b384patch to be added?
Searching through the tracker, it seems like it was this one: https://www.pivotaltracker.com/story/show/66365530
The ticket doesn't explicitly say it should stop access if its an invalid cert; just to show a warning/error message. Like Google Chrome. Hopefully there's a way to implement this feature. As Aristoteles mentioned, self-signed certs are very common for non-production environments.
Hmm, maybe I should've search through the tracker before posting issues to github!
Looks https://www.pivotaltracker.com/story/show/66528632 is the story about being able to bypass ssl verification. Personally I'd rather have an environment variable rather than --insecure or --skip-ssl-verification in the command line.
For curl it is -k I think. Which is at least short.
On Thu, Feb 27, 2014 at 9:17 PM, Aristoteles Neto [email protected] wrote:
Hmm, maybe I should've search through the tracker before posting issues to github!
Looks https://www.pivotaltracker.com/story/show/66528632 is the story about being able to bypass ssl verification. Personally I'd rather have an environment variable rather than --insecure or --skip-ssl-verification in the command line.
Reply to this email directly or view it on GitHub: https://github.com/cloudfoundry/cli/issues/95#issuecomment-36322664
@wdneto We discussed -k, --insecure, and eventually settled on --skip-ssl-verification as the most explicit and obvious of the three. Of course if we use an env variable, it's a moot point which one we use as you'll only type it a handful of times.
@drnic, would you prefer an env variable over a flag?
Cool
FYI, my reasoning for preferring an env var is simply consistency. in my view, it's a global behavior modification (similar to that of tracing), so I'd group it with CF_TRACE.
Makes perfect sense.
We should avoid environment variables if possible. They're difficult to discover, impossible to validate (set CF_RACE=true, see what effect it has) and lead to a grab bag of poorly thought out inputs.
Looking at the referenced story (https://www.pivotaltracker.com/story/show/66528632), I'm wondering why the command line argument has to be specified in so many places. Couldn't you simply add a flag on the api command (cf api api.example.com --skip-ssl-verification) and persist the preference in ~/.cf/config.json? Wouldn't that cover all operations that you then drive against that api server?
I'm also not a big fan of environment variables because I believe this particular option should be specific to an api target. I want to be able to use self-signed in dev and trusted in prod and not worry too much about figuring out if the env is set or not.
@sykesm Has the story changed? I wanted the exact same behavior, and I think "When I execute a subsequent cf command that makes a request to the cloud controller, Then I see that command executes successfully as well" was intended to capture that.
@mkocher Probably not - but the wording of the task list raised a red flag in my mind:
- add flag for api command
- add flag for login command
- add flag for logreggator tail command ...
Given you're looking for the same behavior, I'm happy. Thanks.
Thinking about it, I'd have to agree that the behavior should be tied to the api you're connecting to.
The same could be said for tracing, although that's less likely to be left on all the time (in any target). All I was really trying to advocate consistency :-)
It's good to see so much discussion of this topic :)
I agree with @sykesm and @wdneto that this behavior is tied to the api you've specified. The two possible entry points for the cli are the api and login commands.
cf api my-cloud.com
cf auth -u $USERNAME -p $PASSWORD
# alternatively...
cf login -a my-cloud.com
A user should be able to specify this flag when they login interactively as well as when they're using the commands that are intended for scripting (eg: cf api).
The addition of the flag to the cf log command may have been an oversight? I don't recall why that task was added.
I believe the actual task is that cf logs should respect the user's choice to ignore ssl validation errors.
this is fixed on edge. please have a look.
Is there a way to just add a certificate or specify a certificate to trust? For example, in java we use keytool to import certificates that are okay to trust. This way we feel more secure about trusting the endpoint.
It should be possible to permanently accept a certificate on your machine, without using the CF cli. My expectation is that it would be similar to what you described, although it would vary from OS to OS.
We haven't actually wrote any documentation on how it works on windows or Linux or OS X. Would this be useful to you?
What sort of certificate have you seen that wasn't trusted? I personally see it a lot with bosh-lite deployments, but my understanding is that a lot of "Real" CF deployments will have legitimate ssl certificates.
Sent From A Very Small Keyboard
On May 3, 2014, at 11:03, Chirag Patel [email protected] wrote:
Is there a way to just add a certificate or specify a certificate to trust? For example, in java we use keytool to import certificates that are okay to trust. This way we feel more secure about trusting the endpoint.
— Reply to this email directly or view it on GitHub.
I am actually using a dev box (bosh-lite deployment) and have created a self signed certificate. I modified the SSL certs in cf-manifest before deploying. I am able to login successfully using the cf-gradle-plugin by importing my certificate using keytool. It doesn't look like there is such an option in the cli. I tried to import my cert in my OS X keychain but no luck.