1

GoCD 加入基础密码验证

 1 year ago
source link: https://lihui.net/gocd-add-file-password-auth.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

GoCD 加入基础密码验证

10月 31, 2022 21点热度 1人点赞 0条评论

我们上一期完成了 gocd 的基本安装,安装完成了,但是存在一个问题,我们安装完成 gocd 是没有任何安全措施的,任何人都可以建立 pipeline 任何人都是 admin, 可以操作我们的 pipeline 等信息,这会造成一个问题,数据的安全没办法保证,因此我们需要有一个密码来确保我们 pipeline 的安全性,那如何在 gocd 中设置密码就成为一个关键的事情,也不能说网上没有设置密码的范本,而是一个完整的范本分散在多个地方,我在此做一个缝合剂,将所有的内容缝合起来,给自己的内容做一个梳理,同时帮助其他人也解决这个问题。

其实 这一部分用文字说起来很简单,采用的是使用文件创建密码的方式
本篇文章主要是基于文件验证的方式来配置gocd 的文件认证体系 (基于插件 gocd-filebased-authentication-plugin
使用的生成密码的文件的软件是 htpasswd

htpasswd 这个软件可能在系统中没有,因此,我们可以安装下
CentOS 安装指令

yum install httpd-tools

Ubuntu 安装指令

sudo apt-get install apache2-utils

安装完成之后就可以使用 htpasswd 软件进行生成密码文件
命令如下

sudo htpasswd -B -c /etc/go/passwd_auth_admin gocd-admin

所展示效果如下:

sudo htpasswd -B -c /etc/go/passwd_auth_admin gocd-admin
New password:
Re-type new password:
Adding password for user gocd-admin

然后去gocd 管理页面的 admin -> Security -> Authorization Configurations 将生成的密码文件添加到认证方式上

gocd-add-file-pass-auth.png

然后我们就可以使用刚才设置的账号密码登陆了,

如果忘记密码怎么办?
我们已经添加了密码文件到 gocd 中 ,因此我们只需要重新生成一个密码文件覆盖这个密码文件即可。


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK