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

log ip for failed logins #133

Closed
benneti opened this issue Jan 3, 2022 · 8 comments
Closed

log ip for failed logins #133

benneti opened this issue Jan 3, 2022 · 8 comments

Comments

@benneti
Copy link

benneti commented Jan 3, 2022

It would be nice if the log would contain the ip for a failed login attempt, then it would be possible to write a simple fail2ban filter to harden the page a bit.

ddvk added a commit that referenced this issue Jan 28, 2022
@benneti
Copy link
Author

benneti commented Feb 2, 2022

thanks! I'll try it as soon as the docker hub is updated

@benneti
Copy link
Author

benneti commented Feb 2, 2022

I am not sure whether this is a problem of my setup (podman) or anything else, but the ip reportet is the internal ip of the virtual network device. Any idea on that?
EDIT: just checked, the same happens in docker.

@ddvk
Copy link
Owner

ddvk commented Feb 3, 2022

if you are connecting from the host on which docker is running, that is the case, try connecting from a different host

@benneti
Copy link
Author

benneti commented Feb 3, 2022

Thanks for the reply.

It was a different host, even in a completely different network. (I wanted to be sure that the router does no strange stuff when accessing it's own IP).
Also I have nginx setup with

proxy_set_header        X-Real-IP $remote_addr;
proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;

which should lead to the correct IP passed to the container.

@benneti
Copy link
Author

benneti commented Feb 3, 2022

Taking a closer look, I think the problem might be that one needs some way to configure "which headers to hold the real client IP" or some logic for it.
(I have no idea what docker/podman do as the ip I get is always of their respective virtual network.)
See:
gin-gonic/gin#2686
gin-gonic/gin#2693
gin-gonic/gin#2632
Maybe "SetTrustedProxies" should be configurable (for example I would need to add "10.88.0.1" to maybe fix this)?

@ddvk
Copy link
Owner

ddvk commented Feb 3, 2022

yes, I saw that, there has been some drama. I pushed a new version, you should set RM_TRUST_PROXY=1, then it should trust those headers

@benneti
Copy link
Author

benneti commented Feb 3, 2022

ah nice, thank you very much!

@benneti
Copy link
Author

benneti commented Feb 3, 2022

just tried, it works now!

@benneti benneti closed this as completed Feb 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants