Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dev/core#1137 - Make ssl database connections without client certificates work in php7 #298

Merged
merged 1 commit into from
Jun 28, 2020

Conversation

demeritcowboy
Copy link
Contributor

@demeritcowboy demeritcowboy commented Jun 27, 2020

https://lab.civicrm.org/dev/core/-/issues/1137. Also related to civicrm/civicrm-core#17694 and I did some more investigating.

  1. In php5 the only ssl-related value you would need to set is ca=true and mysqli_ssl_set and mysqli_real_connect will work without requiring client certificates.
  2. In php7 this does not work. But if you set ca to an actual ca file (and use the correct hostname in real_connect) then it will work.
  3. Alternatively in php7, you can do it without setting any certificate values but then you need MYSQLI_CLIENT_SSL in the real_connect call.

In either case in php7 note that it will be picky about the hostname you use in real_connect - it needs to match the cert used by the server.

So I see no reason not to set the CLIENT_SSL flag in this block (which only executes when you specify you want ssl) since then you have the choice of no client certificate (which will be the most common scenario), or you can choose to use certificates. My guess on why pear::DB does not set this is because it's from php5.

There is still more needed - see 17694 - but this will allow using without client certificates.

@seamuslee001

@civibot
Copy link

civibot bot commented Jun 27, 2020

(Standard links)

@seamuslee001
Copy link
Contributor

This seems to be fine to me test fail unrelated

@seamuslee001 seamuslee001 merged commit 297fd86 into civicrm:master Jun 28, 2020
@demeritcowboy demeritcowboy deleted the make-ssl-work branch June 28, 2020 22:42
@demeritcowboy
Copy link
Contributor Author

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants