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

Restricting the ports for outgoing connection to a range of pre-defined ports #78

Closed
KishanKishore opened this issue Jan 15, 2021 · 1 comment

Comments

@KishanKishore
Copy link

KishanKishore commented Jan 15, 2021

Hi,
Is there a way to restrict the ports used for outgoing connections when starting the Kafka Proxy server? I am specifying the bootstrap server using the --bootstrap-server-mapping option and tried to use the --dynamic-listeners-disable and --dynamic-sequential-min-port but these options didn't seem to help. I have a firewall that blocks all outgoing connections by default and I have allowed port 9092 but I get the following error:

Reading data from destination_ip_address:destination_port had error: read tcp source_ip_address:source_port->destination_ip_address:destination_port: wsarecv: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.

This is because the Read TCP operation is happening on a random port that is blocked.

Update 1: After reading some code I found that the --dynamic-sequential-min-port parameter is being used to create servers/listeners using net.Listen method. So from what I understand this parameter is irrelevant to my problem. Can someone confirm ?

@everesio
Copy link
Contributor

Hi,

Indeed --dynamic-sequential-min-port applies only to the server listener.

An outgoing connection uses an ephemeral port on the client side (kafka proxy) when connecting to the kafka broker.
TPC port range can be set globally by changing kernel parameters.

Probably you should check or change your firewall rules to filter destination and not source port for outgoing connections.

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