Skip to content

Commit eeb4365

Browse files
balasankarcstanhu
andcommitted
Merge branch 'sh-support-mutual-tls-http-client' into 'master'
Add support for using HTTP TLS client cert See merge request https://gitlab.com/gitlab-org/omnibus-gitlab/-/merge_requests/7349 Merged-by: Balasankar 'Balu' C <[email protected]> Approved-by: Clemens Beck <[email protected]> Approved-by: Andrew Patterson <[email protected]> Approved-by: Balasankar 'Balu' C <[email protected]> Reviewed-by: Clemens Beck <[email protected]> Co-authored-by: Stan Hu <[email protected]>
2 parents 27e1bed + 51697fd commit eeb4365

File tree

4 files changed

+38
-0
lines changed

4 files changed

+38
-0
lines changed

files/gitlab-config-template/gitlab.rb.template

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,11 @@ external_url 'GENERATED_EXTERNAL_URL'
192192
###! request (default: 10)
193193
# gitlab_rails['webhook_timeout'] = 10
194194

195+
### HTTP client settings
196+
###! This is for setting up the mutual TLS client cert and password for the certificate file.
197+
# gitlab_rails['http_client']['tls_client_cert_file'] = nil
198+
# gitlab_rails['http_client']['tls_client_cert_password'] = nil
199+
195200
### GraphQL Settings
196201
###! Tells the rails application how long it has to complete a GraphQL request.
197202
###! We suggest this value to be higher than the database timeout value

files/gitlab-cookbooks/gitlab/attributes/default.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -615,6 +615,8 @@
615615

616616
default['gitlab']['gitlab_rails']['webhook_timeout'] = nil
617617

618+
default['gitlab']['gitlab_rails']['http_client'] = {}
619+
618620
default['gitlab']['gitlab_rails']['graphql_timeout'] = nil
619621

620622
default['gitlab']['gitlab_rails']['initial_root_password'] = nil

files/gitlab-cookbooks/gitlab/templates/default/gitlab.yml.erb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,9 @@ production: &base
110110
# Number of seconds to wait for HTTP response after sending webhook HTTP POST request (default: 10)
111111
webhook_timeout: <%= @webhook_timeout %>
112112

113+
## HTTP client settings
114+
http_client: <%= @http_client.to_json %>
115+
113116
### GraphQL Settings
114117
# Tells the rails application how long it has to complete a GraphQL request.
115118
# We suggest this value to be higher than the database timeout value

spec/chef/cookbooks/gitlab/recipes/gitlab-rails/gitlab_yml/gitlab_spec.rb

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,34 @@
8484
end
8585
end
8686

87+
describe 'HTTP client settings' do
88+
context 'with default configuration' do
89+
it 'renders gitlab.yml with empty HTTP client settings' do
90+
expect(gitlab_yml[:production][:gitlab][:http_client]).to eq({})
91+
end
92+
end
93+
94+
context 'with mutual TLS settings configured' do
95+
before do
96+
stub_gitlab_rb(
97+
gitlab_rails: {
98+
http_client: {
99+
tls_client_cert_file: '/path/to/tls_cert_file',
100+
tls_client_cert_password: 'somepassword'
101+
}
102+
}
103+
)
104+
end
105+
106+
it 'renders gitlab.yml with HTTP client settings' do
107+
expect(gitlab_yml[:production][:gitlab][:http_client]).to eq(
108+
tls_client_cert_file: '/path/to/tls_cert_file',
109+
tls_client_cert_password: 'somepassword'
110+
)
111+
end
112+
end
113+
end
114+
87115
describe 'SMIME email settings' do
88116
context 'with default configuration' do
89117
it 'renders gitlab.yml with SMIME email settings disabled' do

0 commit comments

Comments
 (0)