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

listen address: 0.0.0.0:2022 doesn't listen on tcp4, only tpc6 #122

Open
erjoalgo opened this issue Sep 25, 2023 · 1 comment
Open

listen address: 0.0.0.0:2022 doesn't listen on tcp4, only tpc6 #122

erjoalgo opened this issue Sep 25, 2023 · 1 comment

Comments

@erjoalgo
Copy link

Not sure what has changed but by default my sshesame instance is only listening on ipv6 despite being configured with a listen address of 0.0.0.0:2022:

# using listen_address: 127.0.0.1:2022
Sep 24 23:42:53 my-hostname sshesame[1950846]: INFO 2023/09/24 23:42:53 Listening on 127.0.0.1:2022
Sep 24 23:43:26 my-hostname systemd[1]: Stopping sshesame.service - sshesame...
Sep 24 23:43:26 my-hostname systemd[1]: sshesame.service: Deactivated successfully.
Sep 24 23:43:26 my-hostname systemd[1]: Stopped sshesame.service - sshesame.
Sep 24 23:43:26 my-hostname systemd[1]: Started sshesame.service - sshesame.
Sep 24 23:43:26 my-hostname sshesame[1951085]: INFO 2023/09/24 23:43:26 No host keys configured, using keys at "/home/USER/.local/share/sshesame"


# using listen_address: 0.0.0.0:2022
Sep 24 23:43:26 my-hostname sshesame[1951085]: INFO 2023/09/24 23:43:26 Listening on [::]:2022
go version
go version go1.20.7 linux/amd64
@erjoalgo
Copy link
Author

I modified github.com/jaksi/[email protected]/conn.go to use tcp4 instead of tcp and now the service is listening on the intended address, 0.0.0.0:2022:

l, err := net.Listen("tcp4", address)

Not sure if there has been a change in go to default to ipv6, the go contributor's comment in the bug below appears to suggest that using net: Listen("tcp", "0.0.0.0:1234") would bind to both ipv4 and ipv6 addresses, but on my system nothing was listening on ipv4:

golang/go#48723 (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

1 participant