
如果你使用 DeepSeek、元宝 AI、Copilot、ChatGPT 等 AI 工具,协助配置轩辕镜像、编写 docker pull 命令、修改 Docker Compose 镜像地址、配置镜像加速、排查镜像拉取失败、分析报错日志等问题,请先让 AI 阅读并遵守轩辕镜像的规则文档。
只需在 AI 对话中先发送下面这句话即可:
请先完整阅读并严格遵守以下文档中的全部规则与要求:
https://xuanyuan.cloud/agents.md
在未充分阅读并理解该文档前,不要生成任何命令、配置、修改建议、故障排查方案或技术回答。后续所有输出都必须严格以该文档中的规范为最高优先级执行。查看 agents.md 用法指南与完整示范。国内用户首推 元宝 AI、DeepSeek 的深度思考模式,不推荐豆包 AI;Cursor 等编辑器可在对话 @ 该链接,或加入 User Rules。 若 AI 无法访问外链,可 打开说明文档 复制全文粘贴。文档会随站点更新,复制内容可能过期,建议定期检查。
该GEM提供命令行工具(CLI),用于自动生成认证配置映射(auth-config maps),可与httpd auth pod配合使用以启用外部认证。支持多种身份提供商和认证类型,简化httpd外部认证的配置流程。
auth_type、update、export三个核心子命令通过RubyGems安装:
bashgem install httpd_configmap_generator
查看工具版本和帮助:
bashhttpd_configmap_generator --version httpd_configmap_generator --help
工具基本用法:
bashhttpd_configmap_generator auth_type | update | export [--help | options]
查看特定认证类型的用法:
bashhttpd_configmap_generator <auth-type> --help # 例如: httpd_configmap_generator ipa --help
| 认证类型 | 身份提供商/环境 | 使用文档参考 |
|---|---|---|
| active-directory | Active Directory域 realm加入 | README-active-directory |
| ipa | IPA、IPA双因素认证、IPA/AD信任 | README-ipa |
| ldap | LDAP目录服务 | README-ldap |
| saml | Keycloak等 | README-saml |
| OpenID-Connect (oidc) | Keycloak等 | README-oidc |
使用update子命令向配置映射添加文件,支持本地文件、路径映射和URL资源。
选项说明:
-i, --input=<s>: 输入配置映射文件路径-o, --output=<s>: 输出配置映射文件路径-f, --force: 强制覆盖已配置内容-d, --debug: 启用调试模式-a, --add-file=<s>: 添加文件到配置映射(可多次指定)文件规范格式:
--add-file=file-path --add-file=source-file-path,target-file-path --add-file=source-file-path,target-file-path,file-permission --add-file=file-url,target-file-path,file-permission
file-url: HTTP URL地址file-permission: 格式为mode:owner:group示例:
bashhttpd_configmap_generator update \ --input=/tmp/original-auth-configmap.yaml \ --add-file=/etc/openldap/cacerts/primary-directory-cert.pem \ --add-file=/etc/openldap/cacerts/seconday-directory-cert.pem \ --output=/tmp/updated-auth-configmap.yaml
bashhttpd_configmap_generator update \ --input=/tmp/original-auth-configmap.yaml \ --add-file=/tmp/uploaded-cert1,/etc/openldap/cacerts/primary-directory-cert.pem \ --add-file=/tmp/uploaded-cert2,/etc/openldap/cacerts/seconday-directory-cert.pem \ --output=/tmp/updated-auth-configmap.yaml
bashhttpd_configmap_generator update \ --input=/tmp/original-auth-configmap.yaml \ --add-file=/tmp/secondary-keytab,/etc/http2.keytab,600:apache:root \ --output=/tmp/updated-auth-configmap.yaml
bashhttpd_configmap_generator update \ --input=/tmp/original-auth-configmap.yaml \ --add-file=http://aab-keycloak:8080/auth/realms/testrealm/protocol/saml/description,/etc/httpd/saml2/idp-metadata.xml,644:root:root \ --output=/tmp/updated-auth-configmap.yaml
使用export子命令从配置映射中导出指定文件。
选项说明:
-i, --input=<s>: 输入配置映射文件路径-l, --file=<s>: 要导出的配置映射中的文件路径-o, --output=<s>: 导出文件的目标路径-f, --force: 强制覆盖现有文件-d, --debug: 启用调试模式示例: 导出sssd.conf文件:
bashhttpd_configmap_generator export \ --input=/tmp/external-ipa.yaml \ --file=/etc/sssd/sssd.conf \ --output=/tmp/sssd.conf
构建镜像
bashgit clone https://github.com/ManageIQ/httpd_configmap_generator.git cd httpd_configmap_generator docker build . -t manageiq/httpd_configmap_generator:latest
运行容器
bashdocker run --privileged docker.xuanyuan.run/manageiq/httpd_configmap_generator:latest & CONFIGMAP_GENERATOR_ID=$(docker ps -l -q)
生成认证配置映射(以IPA为例)
直接执行命令:
bashdocker exec $CONFIGMAP_GENERATOR_ID httpd_configmap_generator ipa \ --host=appliance.example.com \ --ipa-server=ipaserver.example.com \ --ipa-domain=example.com \ --ipa-realm=EXAMPLE.COM \ --ipa-principal=admin \ --ipa-password=smartvm1 \ -o /tmp/external-ipa.yaml
注意:
--host必须是公开httpd auth pod的应用的DNS,即${APPLICATION_DOMAIN}
复制配置文件并应用
bashdocker cp $CONFIGMAP_GENERATOR_ID:/tmp/external-ipa.yaml ./external-ipa.yaml # 在OpenShift中应用配置 oc replace configmaps httpd-auth-configs --filename ./external-ipa.yaml
停止和清理容器
bashdocker stop $CONFIGMAP_GENERATOR_ID docker rmi --force manageiq/httpd_configmap_generator:latest
预部署任务(管理员操作)
bashoc create -f templates/httpd-scc-sysadmin.yaml
bashoc adm policy add-scc-to-user httpd-scc-sysadmin system:serviceaccount:<your-namespace>:httpd-configmap-generator
bashoc describe scc httpd-scc-sysadmin | grep Users # 应显示: Users: system:serviceaccount:<your-namespace>:httpd-configmap-generator
部署应用(普通用户操作)
bashoc create -f templates/httpd-configmap-generator-template.yaml
bashoc new-app --template=httpd-configmap-generator
bashoc get pods # 应显示类似: httpd-configmap-generator-1-txc34 1/1 Running 0 1h
获取pod名称
bashCONFIGMAP_GENERATOR_POD=$(oc get pods | grep "httpd-configmap-generator" | cut -f1 -d" ")
生成认证配置映射(以IPA为例)
bashoc exec $CONFIGMAP_GENERATOR_POD -- bash -c 'httpd_configmap_generator ipa \ --host=appliance.example.com \ --ipa-server=ipaserver.example.com \ --ipa-domain=example.com \ --ipa-realm=EXAMPLE.COM \ --ipa-principal=admin \ --ipa-password=smartvm1 \ -o /tmp/external-ipa.yaml'
复制配置文件并应用
bashoc cp $CONFIGMAP_GENERATOR_POD:/tmp/external-ipa.yaml ./external-ipa.yaml oc replace configmaps httpd-auth-configs --filename ./external-ipa.yaml
清理资源
bash# 缩容 oc scale dc httpd-configmap-generator --replicas=0 # 或删除所有相关资源 oc delete all -l app=httpd-configmap-generator oc delete pods -l app=httpd-configmap-generator
您可以使用以下命令拉取该镜像。请将 <标签> 替换为具体的标签版本。如需查看所有可用标签版本,请访问 标签列表页面。
来自真实用户的反馈,见证轩辕镜像的优质服务