{"id":16310610,"url":"https://github.com/astj/go-ping-sql","last_synced_at":"2025-04-14T04:42:05.678Z","repository":{"id":72101849,"uuid":"283863588","full_name":"astj/go-ping-sql","owner":"astj","description":null,"archived":false,"fork":false,"pushed_at":"2020-07-30T20:14:12.000Z","size":4,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2023-08-02T15:21:52.771Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/astj.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-07-30T19:47:19.000Z","updated_at":"2024-06-19T07:47:10.213Z","dependencies_parsed_at":"2024-06-19T07:47:09.383Z","dependency_job_id":"c9af659f-087e-4186-8522-fc986f41840b","html_url":"https://github.com/astj/go-ping-sql","commit_stats":null,"previous_names":[],"tags_count":0,"template":null,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/astj%2Fgo-ping-sql","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/astj%2Fgo-ping-sql/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/astj%2Fgo-ping-sql/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/astj%2Fgo-ping-sql/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/astj","download_url":"https://codeload.github.com/astj/go-ping-sql/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248824662,"owners_count":21167343,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-10T21:42:33.847Z","updated_at":"2025-04-14T04:42:05.650Z","avatar_url":"https://github.com/astj.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# go-ping-sql\n\nSQL ping for mysql/postgres.\nFor MySQL, this pinger uses https://github.com/go-sql-driver/mysql .\nFor Postgres, this pinger uses https://github.com/lib/pq .\n\n## prepare\n\nIf you want to test with RDS TLS connection, you need to download certificate file according to https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/UsingWithRDS.SSL.html .\n\n## mysql\n\n### without tls\n\n```\ngo run main.go mysql \"user:pass@tcp(your.database.region.rds.amazonaws.com:3306)/database\"\n```\n\n### with tls required, but without specifying CA certificate file\n\nThis should fail all RDS because of lacking root CA file\n```\ngo run main.go mysql \"user:pass@tcp(your.database.region.rds.amazonaws.com:3306)/database?tls=true\"\n```\n\n### with TLS required and CA certificate file\n\n```\ngo run main.go --ssl-ca rds-ca-2019-root.pem mysql \"user:pass@tcp(your.database.region.rds.amazonaws.com:3306)/database?tls=custom\"\n```\n\nThis should pass when:\n- Target RDS instance has configured to use `rds-ca-2019` cert file\n- One of following conditions are met:\n  - prior to Go 1.15\n  - Go 1.15 and target DB instance that was created or updated to the rds-ca-2019 certificate AFTER July 28, 2020\n\nWhich means, if the instance was created or updated to the rds-ca-2019 certificate prior to July 28, 2020, behavior will change at Go 1.15.\n\nIn such cases, you'll see following error messages:\n```\ngo run main.go --ssl-ca rds-ca-2019-root.pem mysql \"user:pass@tcp(your.database.region.rds.amazonaws.com:3306)/database?tls=custom\"\n2020/07/30 19:53:03 x509: certificate relies on legacy Common Name field, use SANs or temporarily enable Common Name matching with GODEBUG=x509ignoreCN=0\nexit status 1\n```\n\n## postgres\n\n### sslmode=require\n\nThis should pass, as long as the instance is using `rds-ca-2019`\n\n(And this is default sslmode with github.com/lib/pq)\n\n```\nPGPASSWORD=xxx go run main.go postgres \"user=xxx dbname=xxx sslmode=require host=your.db.region.rds.amazonaws.com\"\n```\n\n### sslmode=verify-ca\n\n```\nPGSSLROOTCERT=rds-ca-2019-root.pem PGPASSWORD=xxx go run main.go postgres \"user=xxx dbname=xxx sslmode=verify-ca host=your.db.region.rds.amazonaws.com\"\n```\n\nThis should also pass, but this requires CA cert file by `PGSSLROOTCERT` env.\nOtherwise you'll see:\n\n```\nPGPASSWORD=xxx go run main.go postgres \"user=xxx dbname=xxx sslmode=verify-ca host=your.db.region.rds.amazonaws.com\"\n2020/07/31 05:10:27 x509: certificate signed by unknown authority\nexit status 1\n```\n\n### sslmode=verify-full\n\n```\nPGSSLROOTCERT=rds-ca-2019-root.pem PGPASSWORD=xxx go run main.go postgres \"user=xxx dbname=xxx sslmode=verify-full host=your.db.region.rds.amazonaws.com\"\n```\n\nThis will pass when the same condition as \"with TLS required and CA certificate file\" of MySQL.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fastj%2Fgo-ping-sql","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fastj%2Fgo-ping-sql","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fastj%2Fgo-ping-sql/lists"}