x icon indicating copy to clipboard operation
x copied to clipboard

Allow configuration for IPv4 binding

Open Sytten opened this issue 1 year ago • 6 comments

Preflight checklist

Ory Network Project

No response

Describe your problem

Golang by default binds to IPv6, which doesn't work for everybody. It would be nice if we could specify tcp4 for: https://github.com/ory/x/blob/6511eb1be9fe8389e93b50955a88121c1b728b22/networkx/listener.go#L30

Describe your ideal solution

Ideally the parent service config can pass down an override for the IPv4 vs IPv6 binding with a default to IPv6. I can push the PR, but I am not sure if we want to offer another function to avoid a breaking change in the interface.

func MakeListener(network string, address string, socketPermission *configx.UnixPermission) (net.Listener, error)

Workarounds or alternatives

There is none right now.

Version

Kratos 1.1.0

Additional Context

No response

Sytten avatar Mar 13 '24 21:03 Sytten

This should be possible by specifying an IPv4 literal as the listening address, no?

Please reopen if I'm mistaken.

alnr avatar Mar 28 '24 16:03 alnr

You are mistaken, by default it will always use IPv6 even with an IPv4 address is given at least for common cases like 0.0.0.0

Sytten avatar Mar 28 '24 22:03 Sytten

Confirmed, and very weird. Go listens on IPv6 given net.Listen("tcp", "0.0.0.0:0").

We can't change any interfaces.

On my machine, net.Listen("tcp", "127.0.0.1:0") binds a IPv4 address. So the problem is probably only acute if you want to listen on all IPv4 addresses (which is not currently possible)?

We could add a special case just for "0.0.0.0" and force IPv4 in that case. WDYT?

alnr avatar Mar 29 '24 11:03 alnr

Hello contributors!

I am marking this issue as stale as it has not received any engagement from the community or maintainers for a year. That does not imply that the issue has no merit! If you feel strongly about this issue

  • open a PR referencing and resolving the issue;
  • leave a comment on it and discuss ideas on how you could contribute towards resolving it;
  • leave a comment and describe in detail why this issue is critical for your use case;
  • open a new issue with updated details and a plan for resolving the issue.

Throughout its lifetime, Ory has received over 10.000 issues and PRs. To sustain that growth, we need to prioritize and focus on issues that are important to the community. A good indication of importance, and thus priority, is activity on a topic.

Unfortunately, burnout has become a topic of concern amongst open-source projects.

It can lead to severe personal and health issues as well as opening catastrophic attack vectors.

The motivation for this automation is to help prioritize issues in the backlog and not ignore, reject, or belittle anyone.

If this issue was marked as stale erroneously you can exempt it by adding the backlog label, assigning someone, or setting a milestone for it.

Thank you for your understanding and to anyone who participated in the conversation! And as written above, please do participate in the conversation if this topic is important to you!

Thank you 🙏✌️

github-actions[bot] avatar Mar 30 '25 00:03 github-actions[bot]

Not stale

Sytten avatar Mar 30 '25 02:03 Sytten

Would the solution outlined here work for you?

alnr avatar Apr 02 '25 18:04 alnr