diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-06-16 15:09:00 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-06-16 15:09:00 +0300 |
commit | 9bfdb5cf67ca45ac6d354e18168f5df12b60ccd2 (patch) | |
tree | 632218f5978fd547675f4b4e73dabcb22d62fc87 /lib/system_check/app | |
parent | 6cf1f4c521a621fa2b4dc1735bf5a8c2846f7e6a (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib/system_check/app')
-rw-r--r-- | lib/system_check/app/ci_jwt_signing_key_check.rb | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/lib/system_check/app/ci_jwt_signing_key_check.rb b/lib/system_check/app/ci_jwt_signing_key_check.rb new file mode 100644 index 00000000000..2777daf0123 --- /dev/null +++ b/lib/system_check/app/ci_jwt_signing_key_check.rb @@ -0,0 +1,30 @@ +# frozen_string_literal: true + +module SystemCheck + module App + class CiJwtSigningKeyCheck < SystemCheck::BaseCheck + set_name 'Valid CI JWT signing key?' + + def check? + key_data = Rails.application.secrets.ci_jwt_signing_key + return false unless key_data.present? + + OpenSSL::PKey::RSA.new(key_data) + + true + rescue OpenSSL::PKey::RSAError + false + end + + def show_error + $stdout.puts ' Rails.application.secrets.ci_jwt_signing_key is missing or not a valid RSA key.'.color(:red) + $stdout.puts ' CI_JOB_JWT will not be generated for CI jobs.'.color(:red) + + for_more_information( + 'doc/ci/variables/predefined_variables.md', + 'doc/ci/examples/authenticating-with-hashicorp-vault/index.md' + ) + end + end + end +end |