guacamole - 在 Guacamole RDP 会话中获取客户端主机名
问题描述
我们使用 Guacamole 进行 RDP 会话,但因为我们在城市周围有几个工作站。每次用户连接时,它都会返回:
ClientAddress: 10.0.0.1XX (Guacamole Server IP)
ClientName: Guacamole RDP
我需要知道每个连接是否有办法为我提供通过 Guac 连接的工作站的 IP 和真实名称。
Ex而不是10.0.0.190
我需要192.168.1.XX
的 ClientName TAG10(每个工作站都有自己的主机名。)
谢谢!
解决方案
对于 guacamole 1.0.0 及以上版本,您需要RemoteIpValve
在您的 tomcat 中进行配置才能看到源 IP。
首先,确保您的代理发送X-Forwarded-For
标头。例如(在 nginx 中):
location /guacamole/ {
proxy_pass http://HOSTNAME:8080/guacamole/;
proxy_buffering off;
proxy_http_version 1.1;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $http_connection;
access_log off;
}
接下来,RemoteIpValve
在tomcat中进行配置。它用于将远程 IP 地址传递给应用程序。
转到 tomcatconf
目录,并编辑此文件 ( conf/server.xml
)。在该<Host>
部分下,添加以下内容:
<Valve className="org.apache.catalina.valves.RemoteIpValve"
internalProxies="127.0.0.1"
remoteIpHeader="x-forwarded-for"
remoteIpProxiesHeader="x-forwarded-by"
protocolHeader="x-forwarded-proto" />
有关更多信息,您可以参考这里: 鳄梨酱 - 数据库中的主机名日志记录
推荐阅读
- c# - 根据反射得到的对象构建一个TreeView
- java - 使用 apache common exec 写入 pdf
- php - Symfony Ldap 检查密码
- kubernetes - 大使映射问题
- ansible - 我们可以在 ansible playbook 中设置 remote_tmp 值吗
- xml - XSLT,将一些带有前缀的标签从 lt/gt 更改为 <>,而有些标签仍然带有 lt/gt
- java - 带有图像数据的 Java Volley 请求多部分表单
- java - 使用powershell修改部分JAVA_HOME文件夹路径
- html - 该页面在移动模式下显示屏幕外的隐藏项目
- java - 如何搜索 FTS3 表,以便搜索到的单词显示在列表顶部