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

The sample docker-compose.yml requires user to add siwe-oidc entry in their /etc/hosts #86

Open
rht opened this issue Apr 4, 2024 · 5 comments

Comments

@rht
Copy link

rht commented Apr 4, 2024

Is there a way to not having to manually edit /etc/hosts in

# Need siwe-oidc in /etc/hosts for localhost to allow both the host and Keycloak to reach the IdP
? I often do docker compose down, which resets the IP address. Having to edit this manually every time slows down my debug workflow. Also, I am on NixOS, so /etc/hosts is a symlink to a /nix/store and is editable only by nixos-rebuild or similar commands

I have tried various options, such as

  1. Specifying 127.0.0.1 as the address. This failed with "couldn't connect to server"
  2. Specifying 127.0.0.1 as the address, with network_mode: "host". This failed with siwe-oidc not being able to access the Redis container.
  3. Automatically fetch the container IP address via sudo docker inspect -f '{{range.NetworkSettings.Networks}}{{.IPAddress}}{{end}}' "$siwe_container_name" and change SIWEOIDC_BASE_URL to reflect this URL, but this caused the siwe-oidc container to constantly restart.
  4. host.docker.internal (https://stackoverflow.com/questions/24319662/from-inside-of-a-docker-container-how-do-i-connect-to-the-localhost-of-the-mach) doesn't work because that address is only for use within the container, not from the host.
@sbihel
Copy link
Member

sbihel commented Apr 4, 2024

Could you expand on what you're trying to do? This is supposed to be a little hack for manual testing purposes, to ensure it's accessible by the tester and keycloack, and that the hostname matches the issuer URL.

@rht
Copy link
Author

rht commented Apr 4, 2024

@FantasticoFox, @it-spiderman, and I are trying to use SIWE OIDC for login for our MediaWiki instance, which is run via Docker Compose. We simplified our setup by not using Keycloak at all. We are also using the localhost for local testing purpose. We know that there is no problem on production, when a domain exists for the service. It's just rather incovenient having to edit /etc/hosts with the Docker instance IP address.

@sbihel
Copy link
Member

sbihel commented Apr 4, 2024

In your testing, if your idp isn't running in docker-compose then it seems like you can skip this step?

@rht
Copy link
Author

rht commented Apr 5, 2024

We are using SIWE OIDC solely for authenticating user, to provide a proved wallet address. The identity lives in MediaWiki, which is managed by Docker Compose. MediaWiki needs to access the SIWE service, be it from internal siwe-oidc location, or external via IP address. Having SIWEOIDC_BASE_URL done via IP address of the Docker instance, and that if it can be made to not keep restarting every time, might solve the problem.

@rht
Copy link
Author

rht commented Apr 5, 2024

@it-spiderman had another possible solution in inblockio/aqua-docker-mediawiki#4 (comment).

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