Cobbler的权限管理依赖认证模块(authentication)和授权模块(authorization)。其中,authn_configfile模块通过/etc/cobbler/users.digest文件实现用户认证(用户名/密码),authz_allowall模块(默认)允许所有认证用户拥有全部权限,但可通过修改/etc/cobbler/users.conf文件细化权限控制。
Cobbler的Web管理界面需要cobbler-web包支持,安装命令如下(Ubuntu系统):
sudo apt update
sudo apt install cobbler-web -y
编辑/etc/cobbler/modules.conf文件,设置认证方式为authn_configfile(基于users.digest文件):
sudo vim /etc/cobbler/modules.conf
修改[authentication]段,确保module参数为authn_configfile:
[authentication]
module = authn_configfile
使用htdigest命令向/etc/cobbler/users.digest文件添加用户(realm固定为Cobbler):
-c选项):sudo htdigest -c /etc/cobbler/users.digest "Cobbler" admin
执行后会提示输入并确认密码(如admin123)。-c选项):sudo htdigest /etc/cobbler/users.digest "Cobbler" newuser
输入密码后,用户newuser即可在Web界面使用。默认授权(所有认证用户拥有全部权限):
编辑/etc/cobbler/modules.conf,设置[authorization]段为authz_allowall:
[authorization]
module = authz_allowall
此模式下,所有通过认证的用户均可访问Cobbler Web界面的全部功能。
细化权限(可选):
若需限制用户权限,可修改/etc/cobbler/users.conf文件。例如,将cblradmin设为管理员:
[admins]
admin = "cblradmin"
重启cobblerd服务使配置生效:
sudo systemctl restart cobblerd
通过浏览器访问Cobbler Web界面(默认HTTPS):
https://<Cobbler服务器IP>/cobbler_web
使用创建的用户(如admin)登录,验证是否能执行添加系统、编辑profile等操作。
modules.conf或users.conf后未生效,需重启cobblerd服务。authz_allowall为默认配置,适合测试环境;生产环境建议通过users.conf细化权限,避免未授权操作。/etc/cobbler/users.digest文件的权限正确(仅root可写),防止密码泄露:sudo chmod 600 /etc/cobbler/users.digest