在鳄梨酱 RDP 会话中获取客户端主机名

Get client hostname in Guacamole RDP session

我们在 RDP 会话中使用鳄梨酱,但因为我们在城市周围有几个工作站。每次用户连接时 returns:

ClientAddress: 10.0.0.1XX (Guacamole Server IP)
ClientName: Guacamole RDP

我想知道是否有办法让每个连接都给我 IP 和通过 Guac 连接的工作站的真实名称。

E.x. 而不是 10.0.0.190 我需要 192.168.1.XX 和 ClientName TAG10(每个工作站都有自己的主机名。)

谢谢!

对于 guacamole 版本 1.0.0 及更高版本,您需要在 tomcat 中配置 RemoteIpValve 才能查看源 IP。

首先,确保您的代理发送 X-Forwarded-For header。例如(在 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;
}

接下来,在tomcat中配置RemoteIpValve。用于将远程IP地址传递给应用程序。

转到 tomcat conf 目录,并编辑此文件 (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" />

更多信息,您可以参考这里: Guacamole - Hostname logging within database