Use host_cert_files for host certificates in config.yml.example

What does this MR do and why?

config.yml.example shows SSH host certificates for gitlab-sshd under sshd.host_key_certs:

sshd:
  host_key_certs:
    - /run/secrets/ssh-hostkeys/ssh_host_rsa_key-cert.pub

gitlab-sshd does not read that key. ServerConfig in internal/config/config.go reads host certificates from host_cert_files:

HostCertFiles []string `yaml:"host_cert_files,omitempty"`

and internal/sshd/server_config.go passes cfg.Server.HostCertFiles to parseHostCerts. The YAML loader ignores unknown keys, so anyone who copies the example gets no host certificates and no warning. The mismatch has been there since host certificate support was added in !661 (merged).

This MR renames the key in the example to host_cert_files and adds a one-line comment, like the one above host_key_files, that says what the setting is for. No code change.

Related: the same wrong key is what the Linux package writes today, tracked in omnibus-gitlab#10004 ("GitLab SSHD host certificate settings render the wrong GitLab Shell key"). That issue also says host_cert_files is the right key. This MR only fixes the example in this repository.

How to verify

  • grep -rn 'host_cert_files\|host_key_certs': before this change the only use of host_key_certs is config.yml.example; the code only knows host_cert_files.
  • python3 -c "import yaml; print(yaml.safe_load(open('config.yml.example'))['sshd']['host_cert_files'])" prints the three certificate paths.
  • CI copies config.yml.example to config.yml for the test jobs. Missing certificate files are logged and skipped by parseHostCerts (the example's host_key_files paths also do not exist in CI), so this does not change test behaviour.

This contribution was prepared with the help of an AI assistant. I reviewed the changes and take responsibility for them.

Merge request reports

Loading
Loading