企业🤖AI智能体构建引擎,智能编排和调试,一键部署,支持私有化部署方案 广告
# Proxying assets > 原文:[https://docs.gitlab.com/ee/security/asset_proxy.html](https://docs.gitlab.com/ee/security/asset_proxy.html) * [Installing Camo server](#installing-camo-server) * [Using the Camo server](#using-the-camo-server) # Proxying assets[](#proxying-assets "Permalink") 在管理面向公众的 GitLab 实例时,可能存在的安全隐患是通过引用问题,评论等中的图像来窃取用户 IP 地址的能力. 例如,在问题描述中添加`![Example image](http://example.com/example.png)`将导致从外部服务器加载图像以便显示. 但是,这也允许外部服务器记录用户的 IP 地址. 减轻这种情况的一种方法是将所有外部映像代理到您控制的服务器. 可以将 GitLab 配置为在问题,评论等中请求外部图像/视频/音频时使用资产代理服务器.这有助于确保恶意图像在获取时不会暴露用户的 IP 地址. 当前,我们建议使用[cactus / go-camo,](https://github.com/cactus/go-camo#how-it-works)因为它支持代理视频,音频并且更可配置. ## Installing Camo server[](#installing-camo-server "Permalink") 一台 Camo 服务器用作代理. 要将 Camo 服务器安装为资产代理,请执行以下操作: 1. 部署`go-camo`服务器. 有用的说明可以在[建立 catus / go-camo 中找到](https://github.com/cactus/go-camo#building) . 2. 确保您的 GitLab 实例正在运行,并且您已经创建了私有 API 令牌. 使用 API​​,在您的 GitLab 实例上配置资产代理设置. 例如: ``` curl --request "PUT" "https://gitlab.example.com/api/v4/application/settings?\ asset_proxy_enabled=true&\ asset_proxy_url=https://proxy.gitlab.example.com&\ asset_proxy_secret_key=<somekey>" \ --header 'PRIVATE-TOKEN: <my_private_token>' ``` 支持以下设置: | Attribute | Description | | --- | --- | | `asset_proxy_enabled` | 启用资产代理. 如果启用,则要求: `asset_proxy_url` ). | | `asset_proxy_secret_key` | 与资产代理服务器共享的机密. | | `asset_proxy_url` | 资产代理服务器的 URL. | | `asset_proxy_whitelist` | 与这些域匹配的资产将不会被代理. 允许使用通配符. 您的 GitLab 安装网址会自动列入白名单. | 3. 重新启动服务器,以使更改生效. 每次更改资产代理的任何值时,都需要重新启动服务器. ## Using the Camo server[](#using-the-camo-server "Permalink") 一旦 Camo 服务器运行并且启用了 GitLab 设置,任何引用外部源的图像,视频或音频都将被代理到 Camo 服务器. 例如,以下是 Markdown 中图像的链接: ``` ![logo](https://about.gitlab.com/images/press/logo/jpg/gitlab-icon-rgb.jpg) ``` 以下是可能导致源链接的示例: ``` http://proxy.gitlab.example.com/f9dd2b40157757eb82afeedbf1290ffb67a3aeeb/68747470733a2f2f61626f75742e6769746c61622e636f6d2f696d616765732f70726573732f6c6f676f2f6a70672f6769746c61622d69636f6e2d7267622e6a7067 ```