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

Smibhid UI log not logging correct IP from request #216

Open
sam57719 opened this issue Aug 11, 2024 · 7 comments
Open

Smibhid UI log not logging correct IP from request #216

sam57719 opened this issue Aug 11, 2024 · 7 comments
Assignees
Labels
🐛 bug Something isn't working ⚙ framework framework related 🆘 help wanted Extra attention is needed ❌ invalid This doesn't seem right 🔌 plugin plugin related

Comments

@sam57719
Copy link
Collaborator

Believe it's being proxied by docker.

Might be able to add --proxy-headers to the unicorn run command on the webserver to pass through the real ip.

@sam57719 sam57719 added ⚙ framework framework related 🐛 bug Something isn't working 🔌 plugin plugin related labels Aug 11, 2024
@sam57719 sam57719 self-assigned this Aug 11, 2024
@sam57719
Copy link
Collaborator Author

Looking like we might need a reverse proxy in front of the webserver container to add the x-real-ip or x-forwarded-for headers with the real IP.

Unless we change to docker host networking

@sjefferson99 thoughts?

@sjefferson99
Copy link
Member

What do we need the IP for?

@sam57719
Copy link
Collaborator Author

Currently logging the docker network gateway to the smibhid-ui-log db - tis incorrect, and is annoying. Would be a good thing to fix. A proxy using caddy seems really easy.

Steps:

  1. add caddy to the docker-compose files.
  2. remove webserver_port override ability from smib-webserver and hardcode internal port to '80' (would be handled by caddy.
  3. create a Caddyfile with 3 lines
http:// {
    reverse_proxy smib-webserver:80
}

I will try it as I think this will be beneficial down the line to have the correct IP address logged. Also means we can resolve an IP to the hostname if the client doesn't provide the device-hostname header.

@sjefferson99
Copy link
Member

Given the smibhid code does send a hostname and we have no specific plans to add a device that can't, the Ip address seems superfluous. But by all means have a go at working out how to solve with a reverse proxy providing it doesn't add complexity that will make smib less reliable or less secure.

@sam57719
Copy link
Collaborator Author

If anything - it makes it easier to secure the webserver behind https if and when it goes publicly accessible

@sam57719
Copy link
Collaborator Author

Smib (prod) looks to be logging correct ips! Need to establish why

@sam57719
Copy link
Collaborator Author

Working fine on prod smib-pi, not on own pi

SMIB-PI: docker 26.1.3 - working
Own Pi: docker 27.1.1 - not working - even with reverse proxy

@sam57719 sam57719 added 🆘 help wanted Extra attention is needed ❌ invalid This doesn't seem right labels Aug 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 bug Something isn't working ⚙ framework framework related 🆘 help wanted Extra attention is needed ❌ invalid This doesn't seem right 🔌 plugin plugin related
Projects
None yet
Development

No branches or pull requests

2 participants