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

Docker container cannot connect to yubihsm connector running on host on Ubuntu 22.04.3 LTS #53

Open
larryliuuu opened this issue Jan 29, 2024 · 1 comment

Comments

@larryliuuu
Copy link

  1. Running yubihsm-connector on host:
sudo yubihsm-connector -d --enable-host-header-allowlist  --host-header-allowlist localhost,localhost.,127.0.0.1,[::1]],host.docker.internal,host.docker.internal.,172.17.0.1,172.17.0.2,host.docker.internal:12345 -l localhost:12345
  1. Test on host shows success
curl localhost:12345/connector/status
  1. Start Docker container
docker pull ubuntu
docker run -it --add-host=host.docker.internal:host-gateway ubuntu bash
  1. [container] Install curl and check /etc/hosts in container to ensure that we can contact services running on the host
apt-get update && apt-get install curl
cat /etc/hosts
    172.17.0.1	host.docker.internal
  1. [container] Run a test (Tried with IP 172.17.0.1 as well)
root@c29483c2f844:/# curl -i host.docker.internal:12345/connector/status
curl: (7) Failed to connect to host.docker.internal port 12345 after 0 ms: Connection refused
  1. Check docker container's host headers look ok by quitting yubihsm-connector on the host, starting an http listener on the host and running curl from container again.
GET / HTTP/1.1
Host: host.docker.internal:12345
User-Agent: curl/7.81.0
Accept: */*

HTTP/1.1 200 OK

Docker container can definitely contact the host, but it seems that the yubihsm-connector host header allowlist is not accepting host.docker.internal if the request comes from a container?

@Jak3A1
Copy link

Jak3A1 commented Aug 22, 2024

Did you ever get a fix for this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants