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

[BUG] cloudflare-token.conf "notes" field default value breaks API call #23

Closed
1 task done
git-n-pissed opened this issue Mar 2, 2024 · 3 comments
Closed
1 task done

Comments

@git-n-pissed
Copy link

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

The unban action of the clouldflare-token.conf file fails. This is happening because the initial GET call to the Cloudflare API has notes in its query string, and the default value of notes is Fail2Ban <name>. The space in that value is causing the failure.

I.e. this:

# The message to include in the firewall IP banning rule.
#
notes = Fail2Ban <name>

Should be changed to this (confirmed working):

# The message to include in the firewall IP banning rule.
#
notes = Fail2Ban_<name>

You might also be able to get away with using %20, instead of an _, but I haven't tried that.

Expected Behavior

Unban action shouldn't fail

Steps To Reproduce

1.) Cause a ban
2.) View the Cloudflare dashboard and see the ban was added (Security > WAF > Tools > IP Access Rules)
3.) Wait the required unban time (default is 10 minutes)
4.) View the fail2ban.log and verify that an unban was attempted
5.) View the Cloudflare dashboard and see that the ban still exists

Environment

- OS: Ubuntu Server 22.04
- How docker service was installed: Docker Compose

CPU architecture

x86-64

Docker creation

version: '3.6'
services:
  fail2ban:
    image: linuxserver/fail2ban:1.0.2
    container_name: fail2ban
    restart: always
    network_mode: host
    cap_add:
      - NET_ADMIN
      - NET_RAW
    environment:
      - PUID=0
      - PGID=0
      - TZ=Etc/UTC
      - VERBOSITY=-vv
    volumes:
      # Redacted, inconsequential

Container logs

2024-03-02 08:13:49,476 7F7774227B48 INFO  Starting Fail2ban v1.0.2
 2024-03-02 08:13:49,477 7F7772921B38 INFO  Observer start...
 2024-03-02 08:13:49,479 7F7774227B48 INFO  Connected to fail2ban persistent database '/config/fail2ban/fail2ban.sqlite3'
 2024-03-02 08:13:49,480 7F7774227B48 INFO  Creating new jail 'example_app'
 2024-03-02 08:13:49,483 7F7774227B48 INFO  Jail 'example_app' uses poller {}
 2024-03-02 08:13:49,484 7F7774227B48 INFO  Initiated 'polling' backend
 2024-03-02 08:13:49,485 7F7774227B48 INFO    maxRetry: 5
 2024-03-02 08:13:49,485 7F7774227B48 INFO    findtime: 600
 2024-03-02 08:13:49,485 7F7774227B48 INFO    banTime: 600
 2024-03-02 08:13:49,485 7F7774227B48 INFO    encoding: UTF-8
 2024-03-02 08:13:49,486 7F7774227B48 INFO  Added logfile: '/remotelogs/example_app/example_app.log' (pos = 359928, hash = 22499f352d6720a30ca01927965e88bd737c2848)
 2024-03-02 08:13:49,572 7F7774227B48 INFO  Jail 'example_app' started
 2024-03-02 08:14:33,615 7F77723D4B38 INFO  [example_app] Found 2607:f8b0:4005:0802:0000:0000:0000:200e - 2024-03-02 08:14:33
 2024-03-02 08:14:38,818 7F77723D4B38 INFO  [example_app] Found 2607:f8b0:4005:0802:0000:0000:0000:200e - 2024-03-02 08:14:38
 2024-03-02 08:14:43,420 7F77723D4B38 INFO  [example_app] Found 2607:f8b0:4005:0802:0000:0000:0000:200e - 2024-03-02 08:14:43
 2024-03-02 08:14:47,622 7F77723D4B38 INFO  [example_app] Found 2607:f8b0:4005:0802:0000:0000:0000:200e - 2024-03-02 08:14:47
 2024-03-02 08:14:52,225 7F77723D4B38 INFO  [example_app] Found 2607:f8b0:4005:0802:0000:0000:0000:200e - 2024-03-02 08:14:52
 2024-03-02 08:14:52,778 7F77721CDB38 NOTIC [example_app] Ban 2607:f8b0:4005:0802:0000:0000:0000:200e
 2024-03-02 08:24:52,026 7F77721CDB38 NOTIC [example_app] Unban 2607:f8b0:4005:0802:0000:0000:0000:200e
Copy link

github-actions bot commented Mar 2, 2024

Thanks for opening your first issue here! Be sure to follow the relevant issue templates, or risk having this issue marked as invalid.

@LinuxServer-CI
Copy link
Contributor

This issue has been automatically marked as stale because it has not had recent activity. This might be due to missing feedback from OP. It will be closed if no further activity occurs. Thank you for your contributions.

@LinuxServer-CI LinuxServer-CI closed this as not planned Won't fix, can't repro, duplicate, stale Jun 1, 2024
@LinuxServer-CI LinuxServer-CI moved this from Issues to Done in Issue & PR Tracker Jun 1, 2024
Copy link

github-actions bot commented Jul 1, 2024

This issue is locked due to inactivity

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 1, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
Archived in project
Development

No branches or pull requests

2 participants