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

Mysql SSL connection support from pull request #8049 #10866

Merged
merged 10 commits into from Apr 2, 2018

Conversation

gwaggott
Copy link
Contributor

Hi,

I require an SSL connection to MySQL in AWS RDS, so I'm creating a new pull request from the changes first proposed in #8049.

Can you let me know what further work is required to make it suitable for merging.

Regards,
Geoff

@mattab mattab added Needs Review PRs that need a code review Pull Request WIP Indicates the current pull request is still work in progress and not ready yet for a review. labels Dec 6, 2016
@mattab mattab added this to the 3.0.0 milestone Dec 6, 2016
@mattab mattab modified the milestones: 3.0.1, 3.0.0 Dec 15, 2016
@mattab
Copy link
Member

mattab commented Dec 27, 2016

Hi Geoff,

Thanks for the Pull request! It looks really good so far. Ideally we would be running the test on Travis CI. Maybe you could investigate how we could enable ssl connections on Travis CI so the integration test could run?

@mattab mattab added c: Security For issues that make Matomo more secure. Please report issues through HackerOne and not in Github. Major Indicates the severity or impact or benefit of an issue is much higher than normal but not critical. and removed Pull Request WIP Indicates the current pull request is still work in progress and not ready yet for a review. labels Dec 27, 2016
@mattab
Copy link
Member

mattab commented Jan 21, 2017

Hi @gwaggott
This PR would be very useful to have. Maybe you could find some time to create an automated test on CI/Travis using the MySQL SSL connection?

@mattab
Copy link
Member

mattab commented Apr 26, 2017

Thank you for this proposed pull request.

Because it was last updated more than one month ago, it is our policy to close pull requests opened for a long time without updates. If you would like to continue work on the pull request, please simply ping us to have it re-opened (after you have pushed a new commit).

We hope you understand this and we look forward to seeing an update from you on this pull request or another one!

Thanks.

@tsteur
Copy link
Member

tsteur commented Jan 25, 2018

I think this PR would be actually good to merge and can't really "break" anything and users confirm it works. Be good to have SSL support for mysql?

@cah-andrew-fitzgerald
Copy link

copy-pasting my response from #7039


We're currently running 2.16.1 in a Docker container.
To confirm the PR works, I:
* downloaded the 2.16.1 release from builds.matomo.org
* manually copied the PR changes to the local 2.16.1 release
* updated the dockerfile to point to the local release instead of pulling from builds.matomo.org
* updated the config in our dockerfile to use the new SSL config options
* deployed the docker container and successfully connected to an AWS RDS MySQL instance which is configured to only allow SSL connections
* verified that piwik had no error messages and was able to successfully query the database

@fitzoh
Copy link
Contributor

fitzoh commented Feb 3, 2018

@tsteur/@mattab any updates on this one?

@mattab mattab reopened this Feb 4, 2018
@mattab
Copy link
Member

mattab commented Feb 4, 2018

As @tsteur mentions, in this particular case of a security improvement, it's still better to have the feature un-tested (but confirmed as working by a few users) rather than not have it at all.

We'll definitely take a look at it (Assigned it to 3.4.0 for now)

@cah-andrew-fitzgerald
Copy link

So I need to backtrack a little bit on my initial statement about this working.

It's a little difficult for me to troubleshoot, as I'm not particularly familiar with the piwik/matomo internals, and we're working off an older version (2.16.1), but is it possible that piwik/matomo is creating multiple mysql connections, where one is using ssl for the db connection and the other isn't?

We're observing the following behavior:

The core of piwik/matomo works fine. dashboards load, I can view visitor logs, etc.

A couple widgets that are dynamically updated are failing to load, and the root cause appears to be a mysql auth issue. These are items like the real time visitor count. The only relevant logs I'm able to find in our dockerized container are from nginx logs:

2018/02/12 02:53:58 [error] 71#71: *6857 FastCGI sent in stderr: "PHP message: Error in Piwik (tracker): SQLSTATE[28000] [1045] Access denied for user 'mysqluser'@'10.some.ip' (using password: YES)" while reading response header from upstream, client: some.ip, server: *.myurl.com, request: "GET /piwik.php?e_c=somelongquerystream HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "analytics.myhost.com", referrer: "https://myapplication.com/"

@cah-andrew-fitzgerald
Copy link

Figured it out, Tracker does in fact set up a separate database connection.
I've got a patch for the Tracker PDO mysql adapter, will work on getting a PR open for it.

@mattab mattab modified the milestones: 3.4.0, 3.3.1 Mar 19, 2018
@mattab
Copy link
Member

mattab commented Mar 20, 2018

Hi @cah-andrewfitzgerald
We're planning to review the PR very soon. Would you maybe be able to open the PR for the tracker SSL support so we can review at the same time?

@cah-andrew-fitzgerald
Copy link

Sorry for the delay @mattab, I've got a reminder set to take a look after work today

@fitzoh
Copy link
Contributor

fitzoh commented Mar 21, 2018

@mattab see #12631 for tracker PDO changes

@diosmosis
Copy link
Member

@mattab tested locally & tweaked the PR a bit (included a new option so it'll work w/ self-signed certificates (for testing)). good to merge

@diosmosis
Copy link
Member

Created an issue for writing the FAQ: #12636

@fitzoh
Copy link
Contributor

fitzoh commented Mar 22, 2018

Probably an unnecessary reminder, but this should not be released without merging #12631 (as Tracker requests will fail if the db requires SSL).

@mattab mattab modified the milestones: 3.4.0, 3.4.1 Mar 22, 2018
@diosmosis diosmosis removed the Needs Review PRs that need a code review label Mar 25, 2018
@diosmosis
Copy link
Member

@mattab can we merge this PR?

@diosmosis diosmosis added the not-in-changelog For issues or pull requests that should not be included in our release changelog on matomo.org. label Mar 25, 2018
@diosmosis diosmosis merged commit 0a46f18 into matomo-org:3.x-dev Apr 2, 2018
InfinityVoid pushed a commit to InfinityVoid/matomo that referenced this pull request Oct 11, 2018
…o-org#10866)

* Mysql SSL connection support from pull request matomo-org#8049

* updated minified js

* Add ssl_no_verify config option for skipping certificate verification (works only on some PHP setups).

* Remove TODO comment from DbOverSSLCheck diagnostic, will create issue.

* Skip test if SSL is not enabled

* Undo changes to piwik.js for tests.

* Tweak to DbSSLTest.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c: Security For issues that make Matomo more secure. Please report issues through HackerOne and not in Github. Major Indicates the severity or impact or benefit of an issue is much higher than normal but not critical. not-in-changelog For issues or pull requests that should not be included in our release changelog on matomo.org.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants