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

Adding support for the gitlab_sshd configuration hash #421

Merged
merged 2 commits into from
Oct 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -434,12 +434,14 @@ initial connections for ssh operations. GitLab has created a feature that allows
authorized ssh keys to be stored in the db (instead of the `authorized_keys`
file for the `git` user)

You can enable this feature in GitLab using the `store_git_keys_in_db` parameter.
You can enable this feature in GitLab using the `store_git_keys_in_db` parameter,
or by enabling `gitlab-sshd` as it is configured to use fast lookup automatically.

Please note, managing the sshd service and openssh is outside the scope of this
module. You will need to configure the AuthorizedKeysCommand for the `git` user
in sshd.server yourself. Instructions for this are provided by GitLab at [Fast
lookup of authorized SSH keys in the databasse][15]
Please note, while you can manage [gitlab-sshd][23] (Gitlab's standalone SSH server)
with this module, you can not manage openssh and the sshd service as it is outside
the scope of the module. You will need to configure the AuthorizedKeysCommand
for the `git` user in sshd.server yourself. Instructions for this are provided by
GitLab at [Fast lookup of authorized SSH keys in the databasse][15]

### Setting up GitLab HA

Expand Down Expand Up @@ -520,3 +522,4 @@ broader community is able to maintain the module.‚
[20]: https://vshn.ch
[21]: https://docs.gitlab.com/ee/system_hooks/system_hooks.html
[22]: https://docs.gitlab.com/ee/administration/file_hooks.html
[23]: https://docs.gitlab.com/ee/administration/operations/gitlab_sshd.html
9 changes: 9 additions & 0 deletions REFERENCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ The following parameters are available in the `gitlab` class:
* [`gitlab_kas`](#-gitlab--gitlab_kas)
* [`gitlab_pages`](#-gitlab--gitlab_pages)
* [`gitlab_rails`](#-gitlab--gitlab_rails)
* [`gitlab_sshd`](#-gitlab--gitlab_sshd)
* [`gitlab_workhorse`](#-gitlab--gitlab_workhorse)
* [`grafana`](#-gitlab--grafana)
* [`logging`](#-gitlab--logging)
Expand Down Expand Up @@ -391,6 +392,14 @@ Hash of 'gitlab_pages' config parameters.

Default value: `undef`

##### <a name="-gitlab--gitlab_sshd"></a>`gitlab_sshd`

Data type: `Optional[Hash]`

Hash of 'gitlab_sshd' config parameters.

Default value: `undef`

##### <a name="-gitlab--gitlab_workhorse"></a>`gitlab_workhorse`

Data type: `Optional[Hash]`
Expand Down
2 changes: 2 additions & 0 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
# @param gitlab_kas Hash of 'gitlab_kas' config parameters.
# @param gitlab_pages Hash of 'gitlab_pages' config parameters.
# @param gitlab_rails Hash of 'gitlab_pages' config parameters.
# @param gitlab_sshd Hash of 'gitlab_sshd' config parameters.
# @param gitlab_workhorse Hash of 'gitlab_workhorse' config parameters.
# @param grafana Hash of 'grafana' config parameters.
# @param logging Hash of 'logging' config parameters.
Expand Down Expand Up @@ -132,6 +133,7 @@
Optional[Hash] $gitlab_kas = undef,
Optional[Hash] $gitlab_pages = undef,
Optional[Hash] $gitlab_rails = undef,
Optional[Hash] $gitlab_sshd = undef,
Optional[Hash] $grafana = undef,
Optional[Hash] $high_availability = undef,
Optional[Hash] $logging = undef,
Expand Down
1 change: 1 addition & 0 deletions manifests/omnibus_config.pp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
$gitlab_kas = $gitlab::gitlab_kas
$gitlab_pages = $gitlab::gitlab_pages
$gitlab_rails = $gitlab::gitlab_rails
$gitlab_sshd = $gitlab::gitlab_sshd
$grafana = $gitlab::grafana
$high_availability = $gitlab::high_availability
$letsencrypt = $gitlab::letsencrypt
Expand Down
12 changes: 12 additions & 0 deletions spec/classes/init_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -461,6 +461,18 @@
with_content(%r{^\s*geo_logcursor\['enable'\] = true$})
}
end
describe 'gitlab_sshd' do
let(:params) do
{ gitlab_sshd: {
'enable' => true
} }
end

it {
is_expected.to contain_file('/etc/gitlab/gitlab.rb'). \
with_content(%r{^\s*gitlab_sshd\['enable'\] = true$})
}
end
end
end
end
Expand Down
9 changes: 9 additions & 0 deletions templates/gitlab.rb.erb
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,15 @@ sidekiq_cluster['<%= k -%>'] = <%= decorate(@sidekiq_cluster[k]) %>
<%- @shell.keys.sort.each do |k| -%>
gitlab_shell['<%= k -%>'] = <%= decorate(@shell[k]) %>
<%- end end -%>
<%- if @gitlab_sshd -%>

###############
# gitlab-sshd #
###############

<%- @gitlab_sshd.keys.sort.each do |k| -%>
gitlab_sshd['<%= k -%>'] = <%= decorate(@gitlab_sshd[k]) %>
<%- end end -%>
<%- if @postgresql -%>

#####################
Expand Down