Skip to content

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

Merged
codelipenghui merged 2 commits into
apache:masterfrom
hezhangjian:security-allow-config-dns-bind-addr-port
Dec 23, 2021
Merged

[security] Allow config client dns bind addr and port#13390
codelipenghui merged 2 commits into
apache:masterfrom
hezhangjian:security-allow-config-dns-bind-addr-port

Conversation

@hezhangjian

@hezhangjian hezhangjian commented Dec 18, 2021

Copy link
Copy Markdown
Member

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
@hezhangjian hezhangjian 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
@hezhangjian

Copy link
Copy Markdown
Member Author

/pulsarbot run-failure-checks

@hezhangjian

Copy link
Copy Markdown
Member Author

@michaeljmarshall michaeljmarshall left a comment

Copy link
Copy Markdown
Member

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.


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

Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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.

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

Copy link
Copy Markdown
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.

@hezhangjian

Copy link
Copy Markdown
Member Author

/pulsarbot run-failure-checks

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

@315157973 315157973 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@hezhangjian

Copy link
Copy Markdown
Member Author

@michaeljmarshall ping

@michaeljmarshall michaeljmarshall left a comment

Copy link
Copy Markdown
Member

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.


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

Copy link
Copy Markdown
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.

@michaeljmarshall michaeljmarshall left a comment

Copy link
Copy Markdown
Member

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
@hezhangjian hezhangjian 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.

5 participants