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

[security] Allow config client dns bind addr and port #13390

Merged

Conversation

shoothzj
Copy link
Member

@shoothzj shoothzj commented Dec 18, 2021

Motivation

By default, the pulsar client dns start listen on 0.0.0.0, which could be a security risk

Modifications

  • Allow config client dns bind addr and port
  • And default behavior is not changed

Documentation

Check the box below and label this PR (if you have committer privilege).

Need to update docs?

  • doc

    IMO, this change to code will generated doc automatically.

@github-actions github-actions bot added the doc Your PR contains doc changes, no matter whether the changes are in markdown or code files. label Dec 18, 2021
@shoothzj shoothzj force-pushed the security-allow-config-dns-bind-addr-port branch 2 times, most recently from 266069d to b6ba69e Compare December 19, 2021 23:46
@shoothzj
Copy link
Member Author

/pulsarbot run-failure-checks

@shoothzj
Copy link
Member Author

Copy link
Member

@michaeljmarshall michaeljmarshall left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am +1 on this change, but I think a few things need to be addressed first.

@shoothzj - Have you tested out this change? Your PR description doesn't mention test coverage.

@@ -295,6 +295,19 @@
@JsonIgnore
private Clock clock = Clock.systemDefaultZone();

@ApiModelProperty(
name = "dnsLookupBindAddress",
value = "The Pulsar client dns lookup bind address."
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add the default value and that it means the client will bind to 0.0.0.0?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add the default value and that it means the client will bind to 0.0.0.0?

@michaeljmarshall the default behavior is similar, but it's not bind to 0.0.0.0.

        if (localAddress == null) {
            future = b.register();
        } else {
            future = b.bind(localAddress);
        }

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I might be missing something. Since the default behavior isn't changed by this PR, doesn't that mean we will still bind to 0.0.0.0? My only request here is that we update this annotation with a little more documentation about the default behavior.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@michaeljmarshall I misunderstood your meaning, added the defautl behavior notion

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No worries, thanks for updating it.

@shoothzj shoothzj force-pushed the security-allow-config-dns-bind-addr-port branch from b6ba69e to 70f4a33 Compare December 22, 2021 00:15
@shoothzj
Copy link
Member Author

@michaeljmarshall Currently, I test it locally, and have some configuration read, write test. It's hard to write unit test for this pr, need a mock dns server and ensure the test machine has different network interface.

@shoothzj
Copy link
Member Author

/pulsarbot run-failure-checks

@shoothzj shoothzj force-pushed the security-allow-config-dns-bind-addr-port branch from 70f4a33 to ea0ef42 Compare December 22, 2021 06:29
Copy link
Contributor

@315157973 315157973 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@shoothzj
Copy link
Member Author

@michaeljmarshall ping

Copy link
Member

@michaeljmarshall michaeljmarshall left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@shoothzj - thanks for updating the test and confirming that you tested locally.

I have one last question about documentation, and then I'll approve this PR.

@@ -295,6 +295,19 @@
@JsonIgnore
private Clock clock = Clock.systemDefaultZone();

@ApiModelProperty(
name = "dnsLookupBindAddress",
value = "The Pulsar client dns lookup bind address."
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I might be missing something. Since the default behavior isn't changed by this PR, doesn't that mean we will still bind to 0.0.0.0? My only request here is that we update this annotation with a little more documentation about the default behavior.

Copy link
Member

@michaeljmarshall michaeljmarshall left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@codelipenghui codelipenghui merged commit 76045bd into apache:master Dec 23, 2021
@shoothzj shoothzj deleted the security-allow-config-dns-bind-addr-port branch December 23, 2021 02:33
Technoboy- pushed a commit to Technoboy-/pulsar that referenced this pull request Dec 29, 2021
### Motivation

By default, the pulsar client dns start listen on `0.0.0.0`, which could be a security risk

### Modifications

- Allow config client dns bind addr and port
- And default behavior is not changed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
doc Your PR contains doc changes, no matter whether the changes are in markdown or code files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants