File tree Expand file tree Collapse file tree 9 files changed +68
-3
lines changed
spec/chef/cookbooks/gitlab/recipes Expand file tree Collapse file tree 9 files changed +68
-3
lines changed Original file line number Diff line number Diff line change @@ -38,3 +38,5 @@ spec/examples.txt
38
38
.projections.json
39
39
40
40
coverage /
41
+
42
+ junit_rspec.xml
Original file line number Diff line number Diff line change @@ -221,10 +221,12 @@ To enable HTTPS:
221
221
the password when you reconfigure GitLab . In that case , Omnibus GitLab
222
222
fails silently with no error messages.
223
223
224
- To remove the password from the key:
224
+ To specify the password for the key file, store the password in a text file
225
+ (for example, ` /etc/gitlab/ssl/key_file_password.txt` ) and add the following
226
+ to ` /etc/gitlab/gitlab.rb` :
225
227
226
- ` ` ` shell
227
- openssl rsa -in certificate_before.key -out certificate_after.key
228
+ ` ` ` ruby
229
+ nginx['ssl_password_file'] = '/etc/gitlab/ssl/key_file_password.txt'
228
230
` ` `
229
231
230
232
1 . Reconfigure GitLab:
Original file line number Diff line number Diff line change @@ -1436,6 +1436,7 @@ external_url 'GENERATED_EXTERNAL_URL'
1436
1436
# nginx['ssl_session_timeout'] = "1d"
1437
1437
1438
1438
# nginx['ssl_dhparam'] = nil # Path to dhparams.pem, eg. /etc/gitlab/ssl/dhparams.pem
1439
+ # nginx['ssl_password_file'] = nil # Path to file with passphrases for ssl certificate secret keys
1439
1440
# nginx['listen_addresses'] = ['*', '[::]']
1440
1441
1441
1442
##! **Defaults to forcing web browsers to always communicate using only HTTPS**
Original file line number Diff line number Diff line change 711
711
default [ 'gitlab' ] [ 'nginx' ] [ 'ssl_session_tickets' ] = "off"
712
712
default [ 'gitlab' ] [ 'nginx' ] [ 'ssl_session_timeout' ] = "1d" # settings from by https://ssl-config.mozilla.org/#server=nginx&version=1.17.7&config=intermediate&openssl=1.1.1d&ocsp=false&guideline=5.6
713
713
default [ 'gitlab' ] [ 'nginx' ] [ 'ssl_dhparam' ] = nil # Path to dhparam.pem
714
+ default [ 'gitlab' ] [ 'nginx' ] [ 'ssl_password_file' ] = nil
714
715
default [ 'gitlab' ] [ 'nginx' ] [ 'listen_addresses' ] = [ '*' ]
715
716
default [ 'gitlab' ] [ 'nginx' ] [ 'listen_port' ] = nil # override only if you have a reverse proxy
716
717
default [ 'gitlab' ] [ 'nginx' ] [ 'listen_https' ] = nil # override only if your reverse proxy internally communicates over HTTP
Original file line number Diff line number Diff line change @@ -98,6 +98,10 @@ server { ## HTTPS server
98
98
<% if @ssl_dhparam %>
99
99
ssl_dhparam <%= @ssl_dhparam %> ;
100
100
<% end %>
101
+
102
+ <% if @ssl_password_file %>
103
+ ssl_password_file '<%= @ssl_password_file %> ';
104
+ <% end %>
101
105
<% end %>
102
106
103
107
## Real IP Module Config
Original file line number Diff line number Diff line change @@ -59,6 +59,10 @@ server { ## HTTPS server
59
59
<% if @ssl_dhparam %>
60
60
ssl_dhparam <%= @ssl_dhparam %> ;
61
61
<% end %>
62
+
63
+ <% if @ssl_password_file %>
64
+ ssl_password_file '<%= @ssl_password_file %> ';
65
+ <% end %>
62
66
<% end %>
63
67
64
68
## Real IP Module Config
Original file line number Diff line number Diff line change @@ -57,6 +57,10 @@ server {
57
57
<% if @ssl_dhparam %>
58
58
ssl_dhparam <%= @ssl_dhparam %> ;
59
59
<% end %>
60
+
61
+ <% if @ssl_password_file %>
62
+ ssl_password_file '<%= @ssl_password_file %> ';
63
+ <% end %>
60
64
<% end %>
61
65
62
66
## Real IP Module Config
Original file line number Diff line number Diff line change @@ -71,6 +71,10 @@ server { ## HTTPS server
71
71
<% if @ssl_dhparam %>
72
72
ssl_dhparam <%= @ssl_dhparam %> ;
73
73
<% end %>
74
+
75
+ <% if @ssl_password_file %>
76
+ ssl_password_file '<%= @ssl_password_file %> ';
77
+ <% end %>
74
78
<% end %>
75
79
76
80
## Real IP Module Config
Original file line number Diff line number Diff line change 307
307
expect ( content ) . to include ( "ssl_verify_depth 7" )
308
308
}
309
309
end
310
+
311
+ describe 'ssl_password_file' do
312
+ context 'by default' do
313
+ it 'does not set ssl_password_file' do
314
+ http_conf . each_value do |conf |
315
+ expect ( chef_run ) . to render_file ( conf ) . with_content { |content |
316
+ expect ( content ) . not_to include ( "ssl_password_file" )
317
+ }
318
+ end
319
+ end
320
+ end
321
+
322
+ context 'when explicitly specified' do
323
+ before do
324
+ stub_gitlab_rb (
325
+ external_url : 'https://localhost' ,
326
+ mattermost_external_url : 'https://mattermost.localhost' ,
327
+ registry_external_url : 'https://registry.localhost' ,
328
+ pages_external_url : 'https://pages.localhost' ,
329
+ nginx : {
330
+ ssl_password_file : '/etc/gitlab/ssl/gitlab_password_file.txt'
331
+ } ,
332
+ mattermost_nginx : {
333
+ ssl_password_file : '/etc/gitlab/ssl/mattermost_password_file.txt'
334
+ } ,
335
+ pages_nginx : {
336
+ ssl_password_file : '/etc/gitlab/ssl/pages_password_file.txt'
337
+ } ,
338
+ registry_nginx : {
339
+ ssl_password_file : '/etc/gitlab/ssl/registry_password_file.txt'
340
+ }
341
+ )
342
+ end
343
+
344
+ it "sets ssl_password_file correctly in nginx config" do
345
+ http_conf . each do |service , conf |
346
+ expect ( chef_run ) . to render_file ( conf ) . with_content { |content |
347
+ expect ( content ) . to include ( "ssl_password_file '/etc/gitlab/ssl/#{ service } _password_file.txt';" )
348
+ }
349
+ end
350
+ end
351
+ end
352
+ end
310
353
end
311
354
312
355
context 'when is enabled' do
You can’t perform that action at this time.
0 commit comments