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

mirrord stealing to different app #2819

Closed
aviramha opened this issue Oct 11, 2024 · 3 comments · Fixed by #2874
Closed

mirrord stealing to different app #2819

aviramha opened this issue Oct 11, 2024 · 3 comments · Fixed by #2874
Assignees

Comments

@aviramha
Copy link
Member

aviramha commented Oct 11, 2024

Some of our users want to use mirrord over kubectl proxy which runs on a bastion host they SSH and port-forward to.
They're running
ssh -L 8080:localhost:8080
then inside the ssh
kubectl proxy

then on their local machine

kubectl config set-cluster testt --server=http://localhost:8080 --insecure-skip-tls-verify=true
kubectl config set-context testt --cluster=testt
kubectl config use-context testt

then they mirrord exec a Java Bootspring app that listens on 8080, requests gets stolen but when it's stolen it is sent to... the kubectl proxy (ssh forward) instead of the app :|
happens on macOS

ssh version:
OpenSSH_9.7p1, LibreSSL 3.3.6

lsof output (lsof -nP -iTCP:8080 -sTCP:LISTEN):

ssh     36023 user    7u  IPv6 0x.ccc      0t0  TCP [::1]:8080 (LISTEN)

ssh     36023 user    8u  IPv4  0xbb...      0t0  TCP [127.0.0.1:8080](http://127.0.0.1:8080/) (LISTEN)

nc      36503 user    5u  IPv4 0xaaa..      0t0  TCP *:8080 (LISTEN)
Copy link

linear bot commented Oct 11, 2024

@aviramha
Copy link
Member Author

Managed to reproduce on macOS:

  1. Open IPython (or your favorite python interpreter)
s1 = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s1.bind(("127.0.0.1", 8080))
s.listen()
s2 = socket.socket(socket.AF_INET6, socket.SOCK_STREAM)
s2.bind(("::1", 8080))
s2.listen()
  1. In another terminal, run
mirrord exec -t deployment/ip-visit-counter -- nc -l 8080

curl http://127.0.0.1:8080 - you'd get the python (it'd be stuck unless you accept)
curl the remote 8080 (can port map if your target listens on something else) -> goes to python

@aviramha aviramha removed their assignment Oct 25, 2024
@aviramha
Copy link
Member Author

image

I think solution is to avoid using REUSEADDR in mirrord sockets.

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

Successfully merging a pull request may close this issue.

2 participants