token:# Settings for the tokens. issuer:"Auth Service"# Must match issuer in the Registry config. expiration:900 ext_auth: command:"/extensions/ext_auth.sh"# Can be a relative path too; $PATH works. args: [""] acl: -match: { ip:"127.0.0.0/8" } actions: ["*"] comment:"Allow everything from localhost (IPv4)" -match: { account:"/.+/", type:"registry", name:"catalog" } actions: ["*"] comment:"Logged in users can query the catalog." -match: { labels: { "group":"CICD" } } actions: ["*"] comment:"User assigned to group 'CICD' is able to push" -match: { account:"/.+/" } actions: ["pull"] comment:"Logged in users can pull all images."
extensions配置是基于上面的配置的ext_auth,例如是个脚本:
1 2 3 4 5 6 7 8 9 10 11 12 13
read u p
if [ "$u" == "cicd" ]; then if [ "$p" == "$CICD_SECRET" ]; then echo'{"labels": {"group": ["CICD"]}}' exit 0 fi exit 1 fi