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

Implement mTLS support in both the mysql backend and probes. #139

Closed
wants to merge 9 commits into from

Conversation

miguelff
Copy link
Contributor

@miguelff miguelff commented Feb 3, 2021

Implements the enhancement described in #112

The following docs describe how to use the new feature:

Changes include a small refactoring to remove some unused code and to have a single source of truth for creating DB connection strings, and I pulled most of the TLS setup from gh-ost

This has been tested successfully using the following configuration against docker mysql:5.7

{
  "ListenPort": 9777,
  "BackendMySQLHost": "0.0.0.0",
  "BackendMySQLPort": 3306,
  "BackendMySQLSchema": "freno_backend",
  "BackendMySQLUser": "root",
  "BackendMySQLPassword": "passw0rd",
  "BackendMySQLTlsCaCertPath": "▩▩▩▩▩▩▩▩▩▩▩▩▩/ca.pem",
  "BackendMySQLTlsClientCertPath": "▩▩▩▩▩▩▩▩▩▩▩▩▩/client-cert.pem",
  "BackendMySQLTlsClientKeyPath": "▩▩▩▩▩▩▩▩▩▩▩▩▩/client-key.pem",
  "Domain": "us-east-1/production",
  "ShareDomain": "production",
  "Stores": {
    "MySQL": {
      "User": "root",
      "Password": "passw0rd",
      "TlsCaCertPath": "▩▩▩▩▩▩▩▩▩▩▩▩▩/ca.pem",
      "TlsClientCertPath": "▩▩▩▩▩▩▩▩▩▩▩▩▩/client-cert.pem",
      "TlsClientKeyPath": "▩▩▩▩▩▩▩▩▩▩▩▩▩/client-key.pem",
      "MetricQuery": "select unix_timestamp(now(6)) - unix_timestamp(ts) as lag_check from meta.heartbeat order by ts desc limit 1",
      "ThrottleThreshold": 1.0,
      "Clusters": {
        "local": {
          "User": "root",
          "Password": "passw0rd",
          "StaticHostsSettings" : {
              "Hosts": [
                "localhost:3306"
              ]
          }
        }
      }
    }
  }
}

cc @shlomi-noach

Copy link

@shlomi-noach shlomi-noach left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@miguelff neither of us own this repo anymore yet here we are again 😂. Left some comments inline. Let me know what you think!

pkg/config/config.go Show resolved Hide resolved
pkg/mysql/probe.go Show resolved Hide resolved
pkg/group/mysql.go Outdated Show resolved Hide resolved
Copy link

@shlomi-noach shlomi-noach left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good! Thank you for fixing password redaction.

if err != nil {
return nil, err
}

db.SetMaxOpenConns(maxConnections)
db.SetMaxIdleConns(maxConnections)
log.Debugf("created db at: %s", uri)
log.Debugf("created db at: %s", url.Redacted())

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TIL url.Redacted()

@timvaillancourt timvaillancourt added this to the v1.2.1 milestone Mar 19, 2021
@timvaillancourt timvaillancourt self-requested a review May 8, 2021 03:34
@miguelff
Copy link
Contributor Author

Closing as stale

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

Successfully merging this pull request may close these issues.

None yet

3 participants