Help us learn about your current experience with the documentation. Take the survey.

SMTP Rake 任务

  • 版本:Free, Premium, Ultimate
  • 产品:GitLab Self-Managed

以下是与 SMTP 相关的 Rake 任务。

密钥

GitLab 可以使用 SMTP 配置密钥来读取加密文件。以下提供的 Rake 任务用于更新加密文件的内容。

显示密钥

显示当前 SMTP 密钥的内容。

  • Linux 包安装:

    sudo gitlab-rake gitlab:smtp:secret:show
  • 自行编译安装:

    bundle exec rake gitlab:smtp:secret:show RAILS_ENV=production

示例输出

password: '123'
user_name: 'gitlab-inst'

编辑密钥

在您的编辑器中打开密钥内容,退出时将修改后的内容写入加密密钥文件。

  • Linux 包安装:

    sudo gitlab-rake gitlab:smtp:secret:edit EDITOR=vim
  • 自行编译安装:

    bundle exec rake gitlab:smtp:secret:edit RAILS_ENV=production EDITOR=vim

写入原始密钥

通过 STDIN 提供内容来写入新的密钥。

  • Linux 包安装:

    echo -e "password: '123'" | sudo gitlab-rake gitlab:smtp:secret:write
  • 自行编译安装:

    echo -e "password: '123'" | bundle exec rake gitlab:smtp:secret:write RAILS_ENV=production

密钥示例

编辑器示例

当编辑命令与您的编辑器不兼容时,可以使用写入任务:

# Write the existing secret to a plaintext file
sudo gitlab-rake gitlab:smtp:secret:show > smtp.yaml
# Edit the smtp file in your editor
...
# Re-encrypt the file
cat smtp.yaml | sudo gitlab-rake gitlab:smtp:secret:write
# Remove the plaintext file
rm smtp.yaml

KMS 集成示例

它也可以用作接收由 KMS 加密内容的应用程序:

gcloud kms decrypt --key my-key --keyring my-test-kms --plaintext-file=- --ciphertext-file=my-file --location=us-west1 | sudo gitlab-rake gitlab:smtp:secret:write

Google Cloud 密钥集成示例

它也可以用作从 Google Cloud 获取密钥的接收应用程序:

gcloud secrets versions access latest --secret="my-test-secret" > $1 | sudo gitlab-rake gitlab:smtp:secret:write