Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

x-forwarded-for support for logging true user IP #20367

Open
XANi opened this issue Apr 26, 2024 · 6 comments
Open

x-forwarded-for support for logging true user IP #20367

XANi opened this issue Apr 26, 2024 · 6 comments
Labels
area/audit-log backlog kind/requirement New feature or idea on top of harbor

Comments

@XANi
Copy link

XANi commented Apr 26, 2024

As far as I loooked there is no option to enable using IP in x-forwarded-for header for access logs

We use harbor behind a loadbalancer and only loadbalancer IP gets logged. Security-wise it should probably only accept that header from whitelisted proxy IPs/networks.

@wy65701436 wy65701436 added area/audit-log kind/requirement New feature or idea on top of harbor backlog labels Apr 29, 2024
@MinerYang
Copy link
Contributor

Could you try to add env TRUE_CLIENT_IP_HEADER in the harbor core configmap if it's installed via harbor-helm

@XANi
Copy link
Author

XANi commented May 6, 2024

I assume by "core configmap" you mean harbor.yml and by adding env you mean adding

env:
  normal:
    TRUE_CLIENT_IP_HEADER: x-forwarded-for

to the end of the file ? (I'm not very familar with harbor)

If so, no, doesn't work, I added it then re-ran install.sh but it still logs the proxy IP

@MinerYang
Copy link
Contributor

If you deploy by docker compose, would you try bellowing steps?

  1. stop harbor instance
docker compose down -v 
  1. edit the common/config/core/env file by adding TRUE_CLIENT_IP_HEADER
TRUE_CLIENT_IP_HEADER=xxx
  1. restart harbor
docker compose up -d 

@XANi
Copy link
Author

XANi commented May 6, 2024

Did not work

[09:50:51]d1-harbor:/opt/harbor-install/installer☠ cat common/config/core/env |grep x-forw
TRUE_CLIENT_IP_HEADER=x-forwarded-for

(i've also verified that traffic on the port does have that header in lowercase)

@MinerYang
Copy link
Contributor

Ooops,it is not been logged the audit logs.
we will follow this requirement the future.
Please monitor this PR #19725

@XANi
Copy link
Author

XANi commented May 6, 2024

@MinerYang I dunno if here is proper place to say it but it really should have second parameter with list of allowed IPs/nets aside from "what header to use". Else anything (not just the LB that can ensure that header is not faked) could send a request with XFF and bogus IP in it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/audit-log backlog kind/requirement New feature or idea on top of harbor
Projects
None yet
Development

No branches or pull requests

3 participants