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

policy: add REFUSE #114

Closed
wants to merge 1 commit into from
Closed

policy: add REFUSE #114

wants to merge 1 commit into from

Conversation

drakkan
Copy link
Contributor

@drakkan drakkan commented Aug 10, 2024

in strict whitelist policies we want to refuse a connection from a not allowed upstream address whether the proxy header is set or not set.

Before this change if the upstream address is not allowed:

  1. if the policy returns REJECT, the connection is allowed if no proxy
    header is sent
  2. if the policy returns REQUIRE, the connection is allowed if a proxy
    header is set, even if the upstream address is not allowed to set it.

The new REFUSE policy can be returned for not allowed addresses so that the connection is always refused.

in strict whitelist policies we want to refuse a connection from a not
allowed upstream address whether the proxy header is set or not set.

Before this change if the upstream address is not allowed:

1) if the policy returns REJECT, the connection is allowed if no proxy
   header is sent
2) if the policy returns REQUIRE, the connection is allowed if a proxy
   header is set, even if the upstream address is not allowed to set it.

The new REFUSE policy can be returned for not allowed addresses so that
the connection is always refused.
@coveralls
Copy link

Coverage Status

coverage: 95.119%. remained the same
when pulling 98ac070 on drakkan:refuse
into b718e7c on pires:main.

@drakkan
Copy link
Contributor Author

drakkan commented Aug 10, 2024

I just noticed #110: if we join that PR, another way to reject a disallowed IP is to return an error from the policy function, while with this PR we can do return proxyproto.REFUSE, nil but in this case the connection errors out after reading the header instead of failing in Accept

@drakkan
Copy link
Contributor Author

drakkan commented Aug 11, 2024

closing, once #110 is merged we don't need a new policy we can just return an error for not allowed upstream ip addresses

@drakkan drakkan closed this Aug 11, 2024
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

Successfully merging this pull request may close these issues.

2 participants