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

feature: support useragent and ip allow/blocking, and namespace interval idling overrides #20

Merged
merged 6 commits into from
Dec 15, 2023

Conversation

shreddedbacon
Copy link
Member

@shreddedbacon shreddedbacon commented Dec 12, 2023

This adds support for being able to define

  • allowing IP addresses via /lists/allowedips file which is a single line per entry of ip address to allow
  • blocking IP addresses via /lists/blockedips file which is a single line per entry of ip address to block
  • allowing user agents via a /lists/allowedagents file which is a single line per entry of useragents or regex patterns to match against. These must be go based regular expressions.
  • blocking user agents via a /lists/blockedagents file which is a single line per entry of useragents or regex patterns to match against. These must be go based regular expressions.

There are also annotations that can be added to specific ingress objects that allow for ip allowlist or specific user agent blocking.

  • idling.amazee.io/ip-allow-list - a comma separated list of ip addresses to allow, will be checked against x-forward-for, but if true-client-ip is provided it will prefer this.
  • idling.amazee.io/ip-block-list - a comma separated list of ip addresses to allow, will be checked against x-forward-for, but if true-client-ip is provided it will prefer this.
  • idling.amazee.io/allowed-agents - a comma separated list of user agents or regex patterns to allow.
  • idling.amazee.io/blocked-agents - a comma separated list of user agents or regex patterns to block.

Note: Providing the annotations overrides the global block list, it does not append.

Additionally, you can add annotations to a namespace to allow the interval checks within the namespace to be different to the globally applied intervals.

  • idling.amazee.io/prometheus-interval - set this to the time interval for prometheus checks, the format must be in 30m|4h|1h30m notation
  • idling.amazee.io/pod-interval - set this to the time interval for pod uptime checks, the format must be in 30m|4h|1h30m notation

Also requests can be forced to verify by using a javascript snippet in the unidling page to call back to aergia to prove that they are a user and not a bot or some other automated system. See the README on how to turn this feature on and also the annotation to disable this per namespace if required.

Using these features would allow a platform operator to restrict how environments are unidled.

@shreddedbacon shreddedbacon force-pushed the support-ip-useragent-blocking branch 2 times, most recently from 1b41e03 to 970818a Compare December 13, 2023 03:59
@shreddedbacon shreddedbacon force-pushed the support-ip-useragent-blocking branch from 970818a to aecc326 Compare December 13, 2023 09:26
@shreddedbacon shreddedbacon marked this pull request as ready for review December 13, 2023 09:35
@shreddedbacon shreddedbacon force-pushed the support-ip-useragent-blocking branch from 5f242c5 to db37b41 Compare December 13, 2023 11:55
@shreddedbacon shreddedbacon force-pushed the support-ip-useragent-blocking branch from db37b41 to 7fa150b Compare December 13, 2023 12:04
@shreddedbacon shreddedbacon changed the title feature: support useragent blocking and ip allow and block lists feature: support useragent and ip allow/blocking, and namespace interval idling overrides Dec 13, 2023
@shreddedbacon shreddedbacon force-pushed the support-ip-useragent-blocking branch 6 times, most recently from e69e12d to 09a03cf Compare December 14, 2023 02:08
@shreddedbacon shreddedbacon force-pushed the support-ip-useragent-blocking branch from 09a03cf to e71e12e Compare December 14, 2023 02:58
@shreddedbacon shreddedbacon force-pushed the support-ip-useragent-blocking branch from b2f920b to ac55dde Compare December 15, 2023 04:48
@shreddedbacon shreddedbacon merged commit 1fefc1c into main Dec 15, 2023
7 checks passed
@shreddedbacon shreddedbacon deleted the support-ip-useragent-blocking branch December 15, 2023 05:06
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.

1 participant