server/rest: forward real client IP on proxied request
needs new proxmox dependency to get the RpcEnvironment changes, adding client_ip getter and setter. Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
committed by
Dietmar Maurer
parent
b64e9a97f3
commit
29633e2fe9
@ -7,6 +7,7 @@ pub struct RestEnvironment {
|
||||
env_type: RpcEnvironmentType,
|
||||
result_attributes: Value,
|
||||
user: Option<String>,
|
||||
client_ip: Option<std::net::SocketAddr>,
|
||||
}
|
||||
|
||||
impl RestEnvironment {
|
||||
@ -14,6 +15,7 @@ impl RestEnvironment {
|
||||
Self {
|
||||
result_attributes: json!({}),
|
||||
user: None,
|
||||
client_ip: None,
|
||||
env_type,
|
||||
}
|
||||
}
|
||||
@ -40,4 +42,12 @@ impl RpcEnvironment for RestEnvironment {
|
||||
fn get_user(&self) -> Option<String> {
|
||||
self.user.clone()
|
||||
}
|
||||
|
||||
fn set_client_ip(&mut self, client_ip: Option<std::net::SocketAddr>) {
|
||||
self.client_ip = client_ip;
|
||||
}
|
||||
|
||||
fn get_client_ip(&self) -> Option<std::net::SocketAddr> {
|
||||
self.client_ip.clone()
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user