Merge lp:~vila/bzr/920455-ssl-defaults into lp:bzr/2.5
| Status: | Merged |
|---|---|
| Approved by: | Martin Packman on 2012-01-31 |
| Approved revision: | 6463 |
| Merged at revision: | 6468 |
| Proposed branch: | lp:~vila/bzr/920455-ssl-defaults |
| Merge into: | lp:bzr/2.5 |
| Diff against target: |
242 lines (+67/-47) (has conflicts) 4 files modified
bzrlib/errors.py (+2/-1) bzrlib/tests/test_https_urllib.py (+8/-17) bzrlib/transport/http/_urllib2_wrappers.py (+50/-29) doc/en/release-notes/bzr-2.5.txt (+7/-0) Text conflict in doc/en/release-notes/bzr-2.5.txt |
| To merge this branch: | bzr merge lp:~vila/bzr/920455-ssl-defaults |
| Related bugs: |
| Reviewer | Review Type | Date Requested | Status |
|---|---|---|---|
| Martin Packman (community) | 2012-01-30 | Approve on 2012-01-31 | |
| Gordon Tyler | 2012-01-30 | Pending | |
| Jelmer Vernooij | 2012-01-30 | Pending | |
|
Review via email:
|
|||
This proposal supersedes a proposal from 2012-01-25.
Commit Message
Provide an ``ssl.ca_certs`` default value for supported platforms.
Description of the Change
Resubmitting a slightly simpler implementation to ensure we're still agreeing, see my replies to previous reviews too.
This add default values for the ssl.ca_certs config option pointing to the
most probable place where the certificates are place for supported
platforms.
Feedback needed from windows and osx packagers unless we rely on them to fix
it when building 2.5.0...
I've changed the tests so at least test_default_exists
bzrlib/
I've also change the option to fail if a non-existing path is used and
changed the code to check the config option only if ssl.cert_reqs is not none.
With these changes, either:
- the certificates are there and they will be checked by default
- they are not but ssl.cert_reqs is none, no need to bother the user
especially since that is the obvious workaround for now if something goes
wrong with the verification,
- an error is raised if the user ask for verification but we can't find the
CAs.
| Vincent Ladeuil (vila) wrote : | # |
| Martin Packman (gz) wrote : | # |
So, on windows we're mostly stuffed because ideally we'd use the Internet Explorer certificate store, but that's a completely different interface to openssl and the cert dir used on nix systems.
The best we can do is bundle curl-ca-bundle.crt with the all-in-one installer like we did previously:
<http://
Then accept the fact branching over https will be broken for everyone else using a python installer or running setup.py themselves.
This is why I was picky about the error message given for the original change... unfortunately it's now just a ValueError and traceback due to the default config value being bad. This branch changes one of those but not the other.
| Jelmer Vernooij (jelmer) wrote : | # |
32 def test_specified_
33 path = os.path.
34 stack = self.get_
35 - self.warnings = []
36 - def warning(*args):
37 - self.warnings.
38 - self.overrideAt
39 - self.assertEqua
40 - stack.get(
41 - self.assertLeng
42 - self.assertCont
43 - "is not valid for \"ssl.ca_certs\"")
44 + self.assertRais
Should it really be an error if the ssl.ca_certs path doesn't exist? What if e.g. "ssl.ca_reqs = optional", it doesn't seem like it should be a problem if the ca_certs are missing.
default_ca_cert() seems to return "/etc/ssl/..." on Windows. This seems wrong in any case. I realize you've asked for feedback from the packagers, but I think we should raise ValueError or return None for now at least.
| Vincent Ladeuil (vila) wrote : | # |
> This is why I was picky about the error message given for the original
> change... unfortunately it's now just a ValueError and traceback due to the
> default config value being bad. This branch changes one of those but not the
> other.
No, please do try again (with this proposal):
bzr config --remove launchpad_username
bzr config ssl.ca_
vila:~/
bzr: ERROR: Bad value "/I-dont-exist" for option "ssl.ca_certs".
So you get a proper error message that we may want to clarify but you don't
get a traceback.
You got a traceback prior to this change because default_ca_certs() was
raising it which is why I changed the implementation as ValueError is caught
for the *_from_store() functions, not the _default() functions.
I could change the ConfigValueError message to include 'See bzr help
ssl.ca_certs' but we froze the strings for 2.5 so I'd rather do that for
trunk.
I'll file bugs for windows and osx installers to make sure a bundle is
included.
| Vincent Ladeuil (vila) wrote : | # |
> Review: Approve
> 32 def test_specified_
> 33 path = os.path.
> 34 stack = self.get_
> 35 - self.warnings = []
> 36 - def warning(*args):
> 37 - self.warnings.
> 38 - self.overrideAt
> 39 - self.assertEqua
> 40 - stack.get(
> 41 - self.assertLeng
> 42 - self.assertCont
> 43 - "is not valid for \"ssl.ca_certs\"")
> 44 + self.assertRais
> Should it really be an error if the ssl.ca_certs path doesn't
> exist? What if e.g. "ssl.ca_reqs = optional", it doesn't seem like
> it should be a problem if the ca_certs are missing.
Indeed ! That's why I also change the code to query the option only if
required ;)
> default_ca_cert() seems to return "/etc/ssl/..." on Windows. This
> seems wrong in any case.
Yes.
> I realize you've asked for feedback from the packagers, but I
> think we should raise ValueError or return None for now at least.
That's what will happen if the option is needed, see
ca_certs_
| Jelmer Vernooij (jelmer) wrote : | # |
On 01/30/2012 03:19 PM, Vincent Ladeuil wrote:
> > Review: Approve
> > 32 def test_specified_
> > 33 path = os.path.
> > 34 stack = self.get_
> > 35 - self.warnings = []
> > 36 - def warning(*args):
> > 37 - self.warnings.
> > 38 - self.overrideAt
> > 39 - self.assertEqua
> > 40 - stack.get(
> > 41 - self.assertLeng
> > 42 - self.assertCont
> > 43 - "is not valid for \"ssl.ca_certs\"")
> > 44 + self.assertRais
>
> > Should it really be an error if the ssl.ca_certs path doesn't
> > exist? What if e.g. "ssl.ca_reqs = optional", it doesn't seem like
> > it should be a problem if the ca_certs are missing.
>
> Indeed ! That's why I also change the code to query the option only if
> required ;)
You're (correctly) trying to retrieve the ca certs too if
ssl.ca_
becomes a terminal error. It shouldn't be if ssl.ca_
if ssl.ca_
>
>
> > I realize you've asked for feedback from the packagers, but I
> > think we should raise ValueError or return None for now at least.
>
> That's what will happen if the option is needed, see
> ca_certs_
I don't see how that's the case. We'll be trying to retrieve the ca
certs in that case and it'll cause ConfigOptionVal
(and bzr to be aborted), right?
Cheers,
Jelmer
- 6461. By Vincent Ladeuil on 2012-01-31
-
Get rid of 'optional' for ssl.ca_reqs to simplify the model.
| Vincent Ladeuil (vila) wrote : | # |
> You're (correctly) trying to retrieve the ca certs too if
ssl.ca_
a terminal error. It shouldn't be if ssl.ca_
ssl.ca_
Right, trying to fix that led to too much complications which I want to
avoid for 2.5. So, as discussed on IRC, I've file http:/pad.
support 'optional' later and just removed it from the actual implementation.
... and I'll take care of the news conflicts when/if this proposal is approved ;)
- 6462. By Vincent Ladeuil on 2012-01-31
-
mgz said this should be good for windows all-in-one installer.
| Martin Packman (gz) wrote : | # |
Trying a value relative to sys.executable is right for the installer, but what is absolutely required is the pretty message in the case where there are no certs, rather than what I currently get with this branch:
C:\bzr\
bzr: ERROR: Bad value "C:\Dev\
That's no good to man or beast, if it can't validate the cert, it *must* say what needs fixing, and how to disable the validation. This nearly exists already, but the logic seems to have been broken so the "no valid trusted SSL CA certificates file set" message branch doesn't get hit:
<https:/
What I expect is something like:
>bzr info https:/
bzr: ERROR: No valid trusted SSL CA certificates file found.
See `bzr help ssl.ca_certs` for how to specify trusted CA certificates.
Pass -Ossl.cert_
We nearly have all the bits, they just need connecting and tidying up.
- 6463. By Vincent Ladeuil on 2012-01-31
-
Feedback from mgz.
| Martin Packman (gz) wrote : | # |
With changes, the output is now:
C:\bzr\
Value "C:\Dev\
No valid trusted SSL CA certificates file set. See 'bzr help ssl.ca_certs' for more information on setting trusted CAs.
bzr: ERROR: _ssl.c:331: No root certificates specified for verification of other-side certificates.
Still not totally ideal but is good enough and I an poke later when some other exception stuff is sorted.
- 6464. By Vincent Ladeuil on 2012-01-31
-
We need a clearer understanding of ssl errors.
| Vincent Ladeuil (vila) wrote : | # |
sent to pqm by email

@gz, Gordon: Feedback on where you expect to install the bundled ca certs expected ;)