Add support for using HTTP TLS client cert
What does this MR do?
Some customers need to configure mutual TLS authentication for Webhooks. This commit adds support for an instance-wide client certificate via two settings added in gitlab!140263 (merged):
gitlab_rails['http_client']['tls_client_cert_file'] = '/path/to/cert.pem'
gitlab_rails['http_client']['tls_client_cert_password'] = 'somepassword'
Related issues
How to set up and validate locally
You can test mutual TLS authentication via https://client.badssl.com/
:
- Run
gitlab-rails console
. - Run
::Gitlab::HTTP_V2.get('https://client.badssl.com')
. This should fail:
irb(main):001:0> ::Gitlab::HTTP_V2.get('https://client.badssl.com')
=>
"<html>\r\n" +
"<head><title>400 No required SSL certificate was sent</title></head>\r\n" +
"<body bgcolor=\"white\">\r\n" +
"<center><h1>400 Bad Request</h1></center>\r\n" +
"<center>No required SSL certificate was sent</center>\r\n" +
"<hr><center>nginx/1.10.3 (Ubuntu)</center>\r\n" +
"</body>\r\n" +
"</html>\r\n"
- Download the client cert:
curl -o /tmp/badssl.com-client.pem https://badssl.com/certs/badssl.com-client.pem
- In
/etc/gitlab/gitlab.rb
, add:
gitlab_rails['http_client']['tls_client_cert_file'] = '/tmp/badssl.com-client.pem'
gitlab_rails['http_client']['tls_client_cert_password'] = 'badssl.com'
- Run
gitlab-ctl reconfigure
. - Repeat steps 1 and 2 again. This should succeed:
irb(main):001:0> ::Gitlab::HTTP_V2.get('https://client.badssl.com')
=>
"<!DOCTYPE html>\n" +
"<html>\n" +
"<head>\n" +
" <meta charset=\"utf-8\">\n" +
" <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n" +
" <link rel=\"shortcut icon\" href=\"/icons/favicon-green.ico\"/>\n" +
" <link rel=\"apple-touch-icon\" href=\"/icons/icon-green.png\"/>\n" +
" <title>client.badssl.com</title>\n" +
" <link rel=\"stylesheet\" href=\"/style.css\">\n" +
" <style>body { background: green; }</style>\n" +
"</head>\n" +
"<body>\n" +
"<div id=\"content\">\n" +
" <h1 style=\"font-size: 12vw;\">\n" +
" client.<br>badssl.com\n" +
" </h1>\n" +
"</div>\n" +
"\n" +
"<div id=\"footer\">\n" +
" This site requires a <a href=\"https://en.wikipedia.org/wiki/Transport_Layer_Security#Client-authenticated_TLS_handshake\">client-authenticated</a> TLS handshake.\n" +
"</div>\n" +
"\n" +
"</body>\n" +
"</html>\n"
Checklist
See Definition of done.
For anything in this list which will not be completed, please provide a reason in the MR discussion.
Required
-
MR title and description are up to date, accurate, and descriptive. -
MR targeting the appropriate branch. -
Latest Merge Result pipeline is green. -
When ready for review, MR is labeled "~workflow::ready for review" per the Distribution MR workflow.
For GitLab team members
If you don't have access to this, the reviewer should trigger these jobs for you during the review process.
-
The manual Trigger:ee-package
jobs have a green pipeline running against latest commit. -
If config/software
orconfig/patches
directories are changed, make sure thebuild-package-on-all-os
job within theTrigger:ee-package
downstream pipeline succeeded. -
If you are changing anything SSL related, then the Trigger:package:fips
manual job within theTrigger:ee-package
downstream pipeline must succeed. -
If CI configuration is changed, the branch must be pushed to dev.gitlab.org
to confirm regular branch builds aren't broken.
Expected (please provide an explanation if not completing)
-
Test plan indicating conditions for success has been posted and passes. -
Documentation created/updated. -
Tests added. -
Integration tests added to GitLab QA. -
Equivalent MR/issue for the GitLab Chart opened. -
Validate potential values for new configuration settings. Formats such as integer 10
, duration10s
, URIscheme://user:passwd@host:port
may require quotation or other special handling when rendered in a template and written to a configuration file.
Merge request reports
Activity
added devopssystems groupdistribution sectioncore platform labels
assigned to @stanhu
changed milestone to %16.8
- A deleted user
added featureaddition typefeature labels
1 Warning aa59b82e: The commit body should not contain more than 72 characters per line. For more information, take a look at our Commit message guidelines. Reviewer roulette
Changes that require review have been detected! A merge request is normally reviewed by both a reviewer and a maintainer in its primary category and by a maintainer in all other categories.
To spread load more evenly across eligible reviewers, Danger has picked a candidate for each review slot. Feel free to override these selections if you think someone else would be better-suited or use the GitLab Review Workload Dashboard to find other available reviewers.
To read more on how to use the reviewer roulette, please take a look at the Engineering workflow and code review guidelines. Please consider assigning a reviewer or maintainer who is a domain expert in the area of the merge request.
Once you've decided who will review this merge request, mention them as you normally would! Danger does not automatically notify them for you.
Reviewer Maintainer @WarheadsSE
(UTC-5, 3 hours ahead of
@stanhu
)@apatterson2
(UTC-7, 1 hour ahead of
@stanhu
)If needed, you can retry the
danger-review
job that generated this comment.Generated by
DangerThis needs gitlab!141660 (merged) to work.
changed milestone to %16.9
mentioned in merge request gitlab!141660 (merged)
mentioned in issue gitlab#27450 (closed)
added 44 commits
-
d922cb4b...43d13cfc - 43 commits from branch
master
- 120e6674 - Add support for using HTTP TLS client cert
-
d922cb4b...43d13cfc - 43 commits from branch
added workflowready for review label
added workflowin review label and removed workflowready for review label
requested review from @clemensbeck
- Resolved by Clemens Beck
mentioned in merge request gitlab!142510 (merged)
added 33 commits
-
120e6674...81034e2f - 32 commits from branch
master
- aa59b82e - Add support for using HTTP TLS client cert
-
120e6674...81034e2f - 32 commits from branch
requested review from @clemensbeck
E2E Test Result Summary
allure-report-publisher
generated test report!qa-subset-test:
test report for 0c843ba4expand test summary
+---------------------------------------------------------------------+ | suites summary | +----------------+--------+--------+---------+-------+-------+--------+ | | passed | failed | skipped | flaky | total | result | +----------------+--------+--------+---------+-------+-------+--------+ | Data Stores | 93 | 0 | 3 | 0 | 96 | ✅ | | Package | 172 | 0 | 3 | 0 | 175 | ✅ | | Create | 195 | 1 | 24 | 0 | 220 | ❌ | | Release | 15 | 0 | 0 | 0 | 15 | ✅ | | Govern | 155 | 0 | 4 | 0 | 159 | ✅ | | Plan | 163 | 0 | 1 | 0 | 164 | ✅ | | Systems | 8 | 0 | 0 | 0 | 8 | ✅ | | Verify | 93 | 0 | 0 | 0 | 93 | ✅ | | GitLab Metrics | 2 | 0 | 1 | 0 | 3 | ✅ | | Manage | 2 | 0 | 0 | 0 | 2 | ✅ | | Configure | 1 | 0 | 0 | 0 | 1 | ✅ | | Monitor | 25 | 0 | 1 | 0 | 26 | ✅ | | Analytics | 3 | 0 | 0 | 0 | 3 | ✅ | +----------------+--------+--------+---------+-------+-------+--------+ | Total | 927 | 1 | 37 | 0 | 965 | ❌ | +----------------+--------+--------+---------+-------+-------+--------+
Test plan passed in a local Docker environment.requested review from @apatterson2
- Resolved by Andrew Patterson
LGTM (with possible exception of documentation nit).
-
Green pipeline at https://gitlab.com/gitlab-org/omnibus-gitlab/-/pipelines/1148417825. QA test failures are known issues that are not likely caused by this change. -
Code examination. -
Passes test plan.
-
added 1 commit
- 0c843ba4 - Improve gitlab.rb.template comment for mutual TLS section
@balasankarc Would you please merge this MR? I do not have permissions.
requested review from @balasankarc
removed review request for @apatterson2
enabled an automatic merge when the pipeline for f2f4fe5a succeeds
mentioned in commit eeb43658
added workflowstaging-canary label and removed workflowin review label
added workflowcanary label and removed workflowstaging-canary label
added workflowstaging label and removed workflowcanary label
added workflowproduction label and removed workflowstaging label
mentioned in commit gitlab@15680b0c
mentioned in merge request gitlab!143115 (merged)
mentioned in commit gitlab@204ed47e
mentioned in commit gitlab@34782cdd
mentioned in commit gitlab@286493c2
mentioned in commit gitlab@556a5f9e
mentioned in issue gitlab-org/charts/gitlab#5305
added releasedcandidate label
added releasedpublished label and removed releasedcandidate label