Skip to content

F2B 0.10.4 _still_ sending "$f2bV_matches" to abuseipdb #2590

Closed

Description

@mc4bbs

We will be very grateful, if your problem was described as completely as possible,
enclosing excerpts from logs (if possible within DEBUG mode, if no errors evident
within INFO mode), and configuration in particular of effected relevant settings
(e.g., with fail2ban-client -d | grep 'affected-jail-name' for a particular
jail troubleshooting).
Thank you in advance for the details, because such issues like "It does not work"
alone could not help to resolve anything!
Thanks! (remove this paragraph and other comments upon reading)

Environment:

Fill out and check ([x]) the boxes which apply. If your Fail2Ban version is outdated,
and you can't verify that the issue persists in the recent release, better seek support
from the distribution you obtained Fail2Ban from

  • Fail2Ban version (including any possible distribution suffixes):
  • OS, including release name/version:
  • Fail2Ban installed via OS/distribution mechanisms
  • You have not applied any additional foreign patches to the codebase
  • Some customizations were done to the configuration (provide details below is so)

The issue:

F2B 0.10.4 still sending "$f2bV_matches" to abuseipdb as seen in prior versions of f2B 0.10.x. I searched for an existing case for this issue and couldn't find it.

Steps to reproduce

Always happens. No need to do anything special to replicate.

Expected behavior

Send log data to abuseipdb via cURL

Observed behavior

from abuseipdb:

Reported IP | Date | Comment | Categories
218.92.0.138 | 37 minutes ago | $f2bV_matches | Brute-Force SSH
222.186.173.226 | 2 hours ago | $f2bV_matches | Brute-Force SSH
218.92.0.173 | 2 hours ago | $f2bV_matches | Brute-Force SSH
176.31.253.204 | 2 hours ago | $f2bV_matches | Brute-Force SSH
51.15.152.61 | 2 hours ago | $f2bV_matches | Fraud VoIP Hacking
69.158.207.141 | 3 hours ago | $f2bV_matches | Brute-Force SSH

Any additional information

Configuration, dump and another helpful excerpts

Any customizations done to /etc/fail2ban/ configuration

Relevant parts of /var/log/fail2ban.log file:

Not sure if this is related:

2020-01-09 12:55:08,244 fail2ban.actions        [1823]: ERROR   Failed to execute ban jail 'asterisk' action 'abuseipdb' info 'ActionInfo({'family': 'inet4', 'matches': u'[2020-01-09 12:54:45] NOTICE[2175] chan_sip.c: Registration from \'<sip:933@192.168.244.6:5060>\' failed for \'81.171.107.159:56449\' - Wrong password\n[2020-01-09 12:54:45] SECURITY[2212] res_security_log.c: SecurityEvent="InvalidPassword",EventTV="2020-01-09T12:54:45.704-0500",Severity="Error",Service="SIP",EventVersion="2",AccountID="933",SessionID="0x7f5ac400f838",LocalAddress="IPV4/UDP/192.168.244.6/5060",RemoteAddress="IPV4/UDP/81.171.107.159/56449",Challenge="06dfe5d5",ReceivedChallenge="06dfe5d5",ReceivedHash="a19c66a412b1da96592b238594179930"\n[2020-01-09 12:55:07] NOTICE[2175] chan_sip.c: Registration from \'<sip:2146@192.168.244.6:5060>\' failed for \'81.171.107.159:65529\' - Wrong password\n[2020-01-09 12:55:07] SECURITY[2212] res_security_log.c: SecurityEvent="InvalidPassword",EventTV="2020-01-09T12:55:07.191-0500",Severity="Error",Service="SIP",EventVersion="2",AccountID="2146",SessionID="0x7f5ac4c6fb48",LocalAddress="IPV4/UDP/192.168.244.6/5060",RemoteAddress="IPV4/UDP/81.171.107.159/65529",Challenge="52aebef7",ReceivedChallenge="52aebef7",ReceivedHash="d9d18f64601efb30c18a4e5b47f55554"', 'ip': '81.171.107.159', 'F-*': {'matches': [(u'[', u'2020-01-09 12:54:45', u"] NOTICE[2175] chan_sip.c: Registration from '<sip:933@192.168.244.6:5060>' failed for '81.171.107.159:56449' - Wrong password"), u'[2020-01-09 12:54:45] SECURITY[2212] res_security_log.c: SecurityEvent="InvalidPassword",EventTV="2020-01-09T12:54:45.704-0500",Severity="Error",Service="SIP",EventVersion="2",AccountID="933",SessionID="0x7f5ac400f838",LocalAddress="IPV4/UDP/192.168.244.6/5060",RemoteAddress="IPV4/UDP/81.171.107.159/56449",Challenge="06dfe5d5",ReceivedChallenge="06dfe5d5",ReceivedHash="a19c66a412b1da96592b238594179930"', u"[2020-01-09 12:55:07] NOTICE[2175] chan_sip.c: Registration from '<sip:2146@192.168.244.6:5060>' failed for '81.171.107.159:65529' - Wrong password", u'[2020-01-09 12:55:07] SECURITY[2212] res_security_log.c: SecurityEvent="InvalidPassword",EventTV="2020-01-09T12:55:07.191-0500",Severity="Error",Service="SIP",EventVersion="2",AccountID="2146",SessionID="0x7f5ac4c6fb48",LocalAddress="IPV4/UDP/192.168.244.6/5060",RemoteAddress="IPV4/UDP/81.171.107.159/65529",Challenge="52aebef7",ReceivedChallenge="52aebef7",ReceivedHash="d9d18f64601efb30c18a4e5b47f55554"'], 'failures': 4, 'ip4': u'81.171.107.159'}, 'fid': <function <lambda> at 0x7fba90f3b9b0>, 'raw-ticket': <function <lambda> at 0x7fba90f3be60>, 'failures': 4})': Error banning 81.171.107.159

Relevant lines from monitored log files in question:

Activity

  1. sebres commented on Jan 9, 2020

    @sebres
    Contributor

    I searched for an existing case for this issue and couldn't find it.

    But it is there (#2310:) And it got fixed in 521de5e, so normally already in 0.10.3.

    May be you had manually changed the action, so it has been not upgraded. Or it is simply not the stock action that you're using.
    So check (and fix) the code mentioned in #2310 (comment)

    Anyway I don't see the issue in current (changed) code of action too:

    actionban = lgm=$(printf '%%.1000s\n...' "<matches>"); curl -sSf "https://api.abuseipdb.com/api/v2/report" -H "Accept: application/json" -H "Key: <abuseipdb_apikey>" --data-urlencode "comment=$lgm" --data-urlencode "ip=<ip>" --data "categories=<abuseipdb_category>"

    Tag <matches> is enclosed in double-quotes so the variable $f2bV_matches will be interpolated there during assignment of lgm.

  2. sebres commented on Jan 9, 2020

    @sebres
    Contributor

    Not sure if this is related

    As for ERROR Failed to execute ban jail: this looks like an additional message dumping the ticket info.
    Do you have still some other lines before or hereafter this error could explain that?

  3. mc4bbs commented on Jan 9, 2020

    @mc4bbs
    Author

    @sebres -- thanks for the reply.

    I completely erased ALL data and material from the former version of F2B I was running, as abuseipdb is getting rid of API V1 at the end of this month.

    I downloaded the NEWEST version available, 0.10.4 and performed a fresh install.

    After configuring my jail.local file and /etc/fail2ban/action.d/abuseipdb.conf as required (simple things: an sshd and an asterisk jail and my apikey), it started humming.

    When I saw this sort of thing being reported from my account on abuseipdb:

    222.186.173.226 | 2 hours ago | $f2bV_matches | Brute-Force SSH
    218.92.0.173 | 2 hours ago | $f2bV_matches | Brute-Force SSH
    176.31.253.204 | 2 hours ago | $f2bV_matches | Brute-Force SSH
    51.15.152.61 | 2 hours ago | $f2bV_matches | Fraud VoIP Hacking
    69.158.207.141 | 3 hours ago | $f2bV_matches | Brute-Force SSH
    

    I searched and discovered the write-ups you mentioned, but upon examining "the fix", my code already appears that way.

    Either I am missing something, or the fix does not fix the problem with Ubuntu Linux.

    Here is the code from my /etc/fail2ban/action.d/abuseipdb.conf file:

    actionban = lgm=$(printf '%%s\n...' "<matches>"); curl --fail --tlsv1.1 --data "key=<abuseipdb_apikey>" --data-urlencode "comment=$lgm" --data "ip=<ip>" --data "category=<abuseipdb_category>" "https://www.abuseipdb.com/report/json"
    
    actionban = curl --fail 'https://api.abuseipdb.com/api/v2/report' \
        -H 'Accept: application/json' \
        -H 'Key: <abuseipdb_apikey>' \
        --data-urlencode 'comment=<matches>' \
        --data-urlencode 'ip=<ip>' \
        --data 'categories=<abuseipdb_category>'
    

    What is wrong? What am I not seeing?

  4. sebres commented on Jan 9, 2020

    @sebres
    Contributor

    Here is the code from my /etc/fail2ban/action.d/abuseipdb.conf file

    Well it looks like you have actionban 2 times (the last is wrong but it wins and overwrites the first), so simply remove it or compare the whole file with stock config:

    actionban = lgm=$(printf '%%s\n...' "<matches>"); curl --fail --tlsv1.1 --data "key=<abuseipdb_apikey>" --data-urlencode "comment=$lgm" --data "ip=<ip>" --data "category=<abuseipdb_category>" "https://www.abuseipdb.com/report/json"
    
    - actionban = curl --fail 'https://api.abuseipdb.com/api/v2/report' \
    -     -H 'Accept: application/json' \
    -     -H 'Key: <abuseipdb_apikey>' \
    -     --data-urlencode 'comment=<matches>' \
    -     --data-urlencode 'ip=<ip>' \
    -     --data 'categories=<abuseipdb_category>'

    to be sure some local config does not overwrite that also, check the interpolated variant (in the dump) too:

    fail2ban-client -d | grep '<matches>'
    

    You should see this tag in double-quotes and never in single-quotes.

    What is wrong? What am I not seeing?

    Also note the time of the ban... You did provide:

    222.186.173.226 | 2 hours ago | $f2bV_matches | Brute-Force SSH
    ...
    69.158.207.141 | 3 hours ago | $f2bV_matches | Brute-Force SSH

    So check what do you see for the fresh bans.

  5. mc4bbs commented on Jan 9, 2020

    @mc4bbs
    Author

    I was wondering about those two statements -- but assumed someone who wrote it knew better than me... I just made the changes and did a fail2ban-client reload and will report back shortly. Thanks!

  6. mc4bbs commented on Jan 10, 2020

    @mc4bbs
    Author

    @sebres -- it's not reporting at all now. I gave it several hours (I normally have at least 75 IPs an hour).

    I looked closer at the one line I should have:

    actionban = lgm=$(printf '%%s\n...' "<matches>"); curl --fail --tlsv1.1 --data "key=<abuseipdb_apikey>" --data-urlencode "comment=$lgm" --data "ip=<ip>" --data "category=<abuseipdb_category>" "https://www.abuseipdb.com/report/json"
    

    It does not transmit to the API V2 URL. Is that a mistake? Could that be the problem?

    When I replace the URL (see below), it's still not reporting... I'm at my wit's end with this.

    actionban = lgm=$(printf '%%s\n...' "<matches>"); curl --fail --tlsv1.1 --data "key=<abuseipdb_apikey>" --data-urlencode "comment=$lgm" --data "ip=<ip>" --data "category=<abuseipdb_category>" "https://api.abuseipdb.com/api/v2/report"
    

    I'm dealing with TWO changes -- moving from API V1 to API V2 and upgrading from 0.9.x to 0.10.x of F2B -- so that complicates things for me.


    BTW:

    I went back to using this section of the script to perform the cURL:

    actionban = curl --fail 'https://api.abuseipdb.com/api/v2/report' \
        -H 'Accept: application/json' \
        -H 'Key: <abuseipdb_apikey>' \
        --data-urlencode 'comment=<matches>' \
        --data-urlencode 'ip=<ip>' \
        --data 'categories=<abuseipdb_category>'
    

    Once again, reports are flowing -- but with the "$f2bV_matches" stuff again...

    Reported IP | Date | Comment | Categories
    77.247.110.166 | 12 minutes ago | $f2bV_matches | Fraud VoIP Hacking
    14.225.3.47 | 16 minutes ago | $f2bV_matches | Brute-Force SSH
    222.186.30.31 | 26 minutes ago | $f2bV_matches | Brute-Force SSH
    77.247.110.17 | 40 minutes ago | $f2bV_matches | Fraud VoIP Hacking

    Thanks for any advise.

  7. sebres commented on Jan 10, 2020

    @sebres
    Contributor

    it's not reporting at all now.

    I don't use abuseipdb so don't have a key and not really familiar with it... so no idea why it does not ban, but your action looks still old. Anyway you can do the tests it from command line.

    Your current action would produce something like this:

    f2bV_abuseipdb_apikey="your-key";
    f2bV_matches="test comment"; 
    testip=192.0.2.1;
    
    lgm=$(printf '%s\n...' "$f2bV_matches"); curl --fail --tlsv1.1 --data "key=$f2bV_abuseipdb_apikey" --data-urlencode "comment=$lgm" --data "ip=$testip" --data "category=sshd" "https://www.abuseipdb.com/report/json"
    

    I get 422 Unprocessable Entity if I try it from shell.

    However the latest version of this action would produce a command similar this:

    lgm=$(printf '%.1000s\n...' "$f2bV_matches"); curl -sSf "https://api.abuseipdb.com/api/v2/report" -H "Accept: application/json" -H "Key: $f2bV_abuseipdb_apikey" --data-urlencode "comment=$lgm" --data-urlencode "ip=$testip" --data "categories=sshd"
    

    I get 401 Unauthorized here (pretty clear because tested with artificial key).
    So change the key (f2bV_abuseipdb_apikey) and try it from the shell.
    And if it works in shell but doesn't work in fail2ban, please take a look into fail2ban.log for some errors after Ban ... and provide it here.

    I went back to using this section of the script to perform the cURL ... 'comment=<matches>'
    but with the "$f2bV_matches" stuff again...

    Well as already said it was a long fixed bug, but if you still need this old config - you have to replace single quotes with double-quotes (e. g. "comment=<matches>").

  8. mc4bbs commented on Jan 10, 2020

    @mc4bbs
    Author

    The URL in the cURL command is invalid for an AbuseIPDB V2 API key.

    Like I said above: I'm contending with TWO changes -- moving from API V1 to API V2 and upgrading from 0.9.x to 0.10.x of Fail2Ban

    Instructions for the AbuseIPDB V2 API is at https://docs.abuseipdb.com/#introduction

    It seems there are INDEED issues with v 0.10.4 in respect to API V2. Considering that API V1 will completely stop working in 15 days, I predict a LOT MORE PEOPLE will have this issue.

    From all the testing I have done, it seems that the actual variable "matches" contains the value "$f2bV_matches". My current abuseipdb.conf is here (minus my key, of course):

    # Fail2ban configuration file
    #
    # Action to report IP address to abuseipdb.com
    # You must sign up to obtain an API key from abuseipdb.com.
    #
    # NOTE: These reports may include sensitive Info.
    # If you want cleaner reports that ensure no user data see the helper script at the below website.
    #
    # IMPORTANT:
    #
    # Reporting an IP of abuse is a serious complaint. Make sure that it is
    # serious. Fail2ban developers and network owners recommend you only use this
    # action for:
    #   * The recidive where the IP has been banned multiple times
    #   * Where maxretry has been set quite high, beyond the normal user typing
    #     password incorrectly.
    #   * For filters that have a low likelihood of receiving human errors
    #
    # This action relies on a api_key being added to the above action conf,
    # and the appropriate categories set.
    #
    # Example, for ssh bruteforce (in section [sshd] of `jail.local`):
    #   action = %(known/action)s
    #            %(action_abuseipdb)s[abuseipdb_apikey="my-api-key", abuseipdb_category="18,22"]
    #
    # See below for catagories.
    #
    # Original Ref: https://wiki.shaunc.com/wikka.php?wakka=ReportingToAbuseIPDBWithFail2Ban
    # Added to fail2ban by Andrew James Collett (ajcollett)
    
    ## abuseIPDB Catagories, `the abuseipdb_category` MUST be set in the jail.conf action call.
    # Example, for ssh bruteforce: action = %(action_abuseipdb)s[abuseipdb_category="18,22"]
    # ID    Title   Description
    # 3       Fraud Orders
    # 4       DDoS Attack
    # 9       Open Proxy
    # 10    Web Spam
    # 11    Email Spam
    # 14    Port Scan
    # 18    Brute-Force
    # 19    Bad Web Bot
    # 20    Exploited Host
    # 21    Web App Attack
    # 22    SSH     Secure Shell (SSH) abuse. Use this category in combination with more specific categories.
    # 23    IoT Targeted
    # See https://abuseipdb.com/categories for more descriptions
    
    [Init]
    # Option:  abuseipdb_apikey
    # Notes    Your API key from abuseipdb.com
    # Values:  STRING  Default: None
    # Register for abuseipdb [https://www.abuseipdb.com], get api key and set below.
    # You will need to set the catagory in the action call.
    
    abuseipdb_apikey = "n0youcanthavemyprivatekeybadf00df00barf00f"
    
    [Definition]
    
    # Option:  actionstart
    # Notes.:  command executed on demand at the first ban (or at the start of Fail2Ban if actionstart_on_demand is set to false).
    # Values:  CMD
    #
    actionstart =
    
    # Option:  actionstop
    # Notes.:  command executed at the stop of jail (or at the end of Fail2Ban)
    # Values:  CMD
    #
    actionstop =
    
    # Option:  actioncheck
    # Notes.:  command executed once before each actionban command
    # Values:  CMD
    #
    actioncheck =
    
    # Option:  actionban
    # Notes.:  command executed when banning an IP. Take care that the
    #          command is executed with Fail2Ban user rights.
    #
    #          ** IMPORTANT! **
    #
    #          By default, this posts directly to AbuseIPDB's API, unfortunately
    #          this results in a lot of backslashes/escapes appearing in the
    #          reports. This also may include info like your hostname.
    #          If you have your own web server with PHP available, you can
    #          use my (Shaun's) helper PHP script by commenting out the first #actionban
    #          line below, uncommenting the second one, and pointing the URL at
    #          wherever you install the helper script. For the PHP helper script, see
    #          <https://wiki.shaunc.com/wikka.php?wakka=ReportingToAbuseIPDBWithFail2Ban>
    #
    #          --ciphers ecdhe_ecdsa_aes_256_sha is used to workaround a
    #          "NSS error -12286" from curl as it attempts to connect using
    #          SSLv3. See https://www.centos.org/forums/viewtopic.php?t=52732
    # Tags:    See jail.conf(5) man page
    # Values:  CMD
    #
    
    # actionban = lgm=$(printf '%%s\n...' "<matches>"); curl --fail --tlsv1.1 --data "key=<abuseipdb_apikey>" --data-urlencode "comment=$lgm" --data "ip=<ip>" --data "category=<abuseipdb_category>" "https://www.abuseipdb.com/report/json"
    
    # actionban = lgm=$(printf '%%s\n...' "<matches>"); curl --fail --tlsv1.1 --data "key=<abuseipdb_apikey>" --data-urlencode "comment=$lgm" --data "ip=<ip>" --data "category=<abuseipdb_category>" "https://api.abuseipdb.com/api/v2/report"
    
    actionban = curl --fail 'https://api.abuseipdb.com/api/v2/report' \
        -H 'Accept: application/json' \
        -H 'Key: <abuseipdb_apikey>' \
        --data-urlencode 'comment=<matches>' \
        --data-urlencode 'ip=<ip>' \
        --data 'categories=<abuseipdb_category>'
    
    # Option:  actionunban
    # Notes.:  command executed when unbanning an IP. Take care that the
    #          command is executed with Fail2Ban user rights.
    # Tags:    See jail.conf(5) man page
    # Values:  CMD
    #
    actionunban =
    

    You'll notice that in my last and final test for today, I replaced the portion of the script that includes the comments with >> --data-urlencode 'comment=' \ <<

    This results in the same on abuseipdb.com:

    Reported IP | Date | Comment | Categories
    222.186.180.223 | 1 hour ago | $f2bV_matches | Brute-Force SSH
    222.186.175.181 | 1 hour ago | $f2bV_matches | Brute-Force SSH

    This makes me believe the problem is with the part of the script that sets the variable $match

    What do you think @sebres ? Whom else should be brought in on this if it's not your expertise?

  9. mc4bbs commented on Jan 10, 2020

    @mc4bbs
    Author

    @sebres -- Please re-open this case. It is obviously an issue that needs to be addressed.

  10. sebres commented on Jan 10, 2020

    @sebres
    Contributor

    You'll notice that in my last and final test for today, I replaced the portion of the script that includes the comments with >> --data-urlencode 'comment=' \ <<

    No. I don't.
    Please read attentive (in any of my comments) replace single quotes with double quotes.
    I still see single quotes in your version of the action.
    So you have 2 possibilities:

    • either:
    - --data-urlencode 'comment=<matches>'
    + --data-urlencode "comment=<matches>"

    like described in this #2310 (comment) that I provided in my first comment to your issue.
    Do you really not see the difference?

    Whom else should be brought in on this if it's not your expertise?

    Although I'm not familiar with abuseipdb, but I can read shell script and know a difference between '$v' and "$v" in shell:

    $ v="this is a comment"
    $ echo 'comment=$v'
    comment=$v
    $ echo "comment=$v"
    comment=this is a comment
    

    But if you don't believe me, you can ask people contributing to this action: @ajcollett, @todgru, @mercurytoxic. Or even some other participating in discussions on several PR's or issues.

  11. sebres commented on Jan 10, 2020

    @sebres
    Contributor

    Please re-open this case. It is obviously an issue that needs to be addressed.

    I can, but I don't see why it should be necessary.

    Neither I don't understand why you won't do what I tell you, nor I don't follow how (and from where) you obtained this "broken" action.
    You said it is 0.10.4 - but it is not, if you download our official release 0.10.4, you'll notice it had definitely another file.

  12. mc4bbs commented on Jan 10, 2020

    @mc4bbs
    Author

    I've done all you've asked:

    • I've performed a fresh, clean install of fail2ban -- fail2ban-client -V reports 0.10.4 -- is there a newer version I am unaware of??
    • I made the changes you said to. It broke it, I reported it as such.
    • You said to use the other (first) section of code), which is clearly NOT for API V2 and has the wrong URL.
    • I dove in and tried to tweak it a few times, with mixed results.
    • I posted my work and results.
    • You tell me you're not an expert in this area and to seek others.
    • You claim I didn't perform my due diligence, tell me to put it in double quotes (again), which I have done for a second time and it's now broken again and not reporting anything.

    This isn't rocket science, but something is wrong and the advise you're providing isn't helping.

  13. sebres commented on Jan 10, 2020

    @sebres
    Contributor
    1. please download our official release 0.10.4 (I posted you above) and compare its /config/action.d/abuseipdb.conf with your version of file - it is definitely not what you're describing,
      I'm not responsible here for every distribution around the world (some things are matter of maintainers of that distribution).
    2. No. You don't, see P.5 below.
    3. I said that looks better as the second (but you could test it in shell).
    4. I don't know what is so complex there... just try actual version of config file.
    5. Yes - you posted "it does not work", no - that is not a result or report:
    • I asked about errors in fail2ban.log - you ignored that;
    • I said use latest/current/actual config file - you ignored that;
    • I said replace single quote with double quote, your last config example show pretty sure '<matches>';
    • I said check it via shell (and said how you'd do that, just replace a key in variable and test) - you ignored that too.
    1. I told you I'm not familiar with this action, but I wrote 1000 others and I know how shell does work.
    2. again if it does not work, TRY the LATEST VERSION of this config file or even if you want to repair your broken version for some reason, then provide a correct issue description after you changed it to double quotes (for example an error excerpt from the fail2ban.log). "it's now broken again and not reporting anything" is not a description and does not help at all.

    Anyway you don't listen what one tell you, so it makes no sense.

  14. mc4bbs commented on Jan 10, 2020

    @mc4bbs
    Author

    @sebres , I understand you are trying to help, but you are being very condescending and making assumptions that I didn't do what you asked because there were no viable results. I do not see anything in the log file that would be helpful.

    I use fail2ban integrated with AbuseIPDB in order to be a good netizen and report malicious actors -- I don't have to do it.

    Let's start from scratch. I know you are trying to help, but your lack of AbuseIPDB API V2 knowledge and experience is getting in the way here, which is why I asked you to OPEN this case once again so we could engage people who know about AbuseIPDB API V2 integration with fail2ban.

    I have (sigh) once again installed fial2ban and reinstalled, getting a fresh download from the site you recommend. Upon installing, I go into the virgin /etc/fail2ban/action.d/abuseipdb.conf to see this;

    # Option:  actionban
    # Notes.:  command executed when banning an IP. Take care that the
    #          command is executed with Fail2Ban user rights.
    #
    #          ** IMPORTANT! **
    #
    #          By default, this posts directly to AbuseIPDB's API, unfortunately
    #          this results in a lot of backslashes/escapes appearing in the
    #          reports. This also may include info like your hostname.
    #          If you have your own web server with PHP available, you can
    #          use my (Shaun's) helper PHP script by commenting out the first #actionban
    #          line below, uncommenting the second one, and pointing the URL at
    #          wherever you install the helper script. For the PHP helper script, see
    #          <https://wiki.shaunc.com/wikka.php?wakka=ReportingToAbuseIPDBWithFail2Ban>
    #
    #          --ciphers ecdhe_ecdsa_aes_256_sha is used to workaround a
    #          "NSS error -12286" from curl as it attempts to connect using
    #          SSLv3. See https://www.centos.org/forums/viewtopic.php?t=52732
    # Tags:    See jail.conf(5) man page
    # Values:  CMD
    #
    actionban = lgm=$(printf '%%s\n...' "<matches>"); curl --fail --tlsv1.1 --data "key=<abuseipdb_apikey>" --data-urlencode "comment=$lgm" --data "ip=<ip>" --data "category=<abuseipdb_category>" "https://www.abuseipdb.com/report/json"
    
    # Option:  actionunban
    # Notes.:  command executed when unbanning an IP. Take care that the
    #          command is executed with Fail2Ban user rights.
    # Tags:    See jail.conf(5) man page
    # Values:  CMD
    #
    actionunban =
    

    As you can see, the hard-coded URL points to the AbuseIPDB API V1 URL only. This will NOT WORK as of February 1st 2020. AbuseIPDB has been sending e-mails to everyone still reporting under API V1 to change NOW.

    The code you had me install has no AbuseIPDB API V2 and therefore, won't function.

    So, now that I only have an API V2 key and the 0.10.4 code does not point to the right URL, now what do I do next?

  15. mc4bbs commented on Jan 10, 2020

    @mc4bbs
    Author

    I copied my jail.local over, here's the log so far... if it helps.

    fail2ban.log

  16. mc4bbs commented on Jan 10, 2020

    @mc4bbs
    Author

    Here's more log file..

    fail2ban.log

  17. mc4bbs commented on Jan 10, 2020

    @mc4bbs
    Author

    To be VERY, VERY clear -- I have no API V1 key, therefore the URL "https://www.abuseipdb.com/report/json" will do nothing for me at all, ever. They are not giving our new API V1 keys and I no longer have one. I'm on V2 now, which uses the URL "https://api.abuseipdb.com/api/v2/report" exclusively. I have pointed this out a few times already and provided links to the AbuseIPDB API V2 documentation, but you've ignored this.

  18. mc4bbs commented on Jan 10, 2020

    @mc4bbs
    Author

    I am migrating this problem to #2594

  19. sebres commented on Jan 10, 2020

    @sebres
    Contributor

    I have (sigh) once again installed fial2ban and reinstalled,

    WHY?
    I told you just to replace the single config file!

    I have (sigh) once again installed fial2ban and reinstalled, getting a fresh download from the site you recommend. Upon installing, I go into the virgin /etc/fail2ban/action.d/abuseipdb.conf to see this

    Sure because I suppose you've downloaded stock 0,10.4, but API 2 was not yet implemented there.
    It is arrives firstly within #2302 (see commit 8da9bfb), so it is firstly released with 0.10.5.

    To be VERY, VERY clear -- I have no API V1 key, therefore the URL

    Then why you're trying that all?
    I told you already several times:

    • either you can replace the quotes ONLY in your "working" config (not the whole config with 0.10.4 that doesn't support it).
    • or BETTER you can use NEWEST version of action.d/abuseipdb.conf supporting V2.

    HowTo:

    • download this single raw file actual version of 0.10th branch.
    • replace your config file with this version;
    • fail2ban-client reload in order to update run-time.
  20. sebres commented on Jan 10, 2020

    @sebres
    Contributor

    fail2ban.log

    Do you see that:

    curl: (22) The requested URL returned error: 429 Too Many Requests
    

    the error message is obvious (and had nothing to do with method you're using).
    That are probably just really too many requests.

  21. mc4bbs commented on Jan 10, 2020

    @mc4bbs
    Author

    Yep -- that's because of the OLD V1 URL.

  22. mc4bbs commented on Jan 10, 2020

    @mc4bbs
    Author

    Pretty soon EVERY F2B user who reports to AbuseIPDB will be getting this error when they turn off V1 in 20 days...

  23. sebres commented on Jan 10, 2020

    @sebres
    Contributor

    Yep -- that's because of the OLD V1 URL.

    No, I don't think so. Error "429 too many requests" is to signal that some limit is exceeding (probably they throttle the maximal reports per hour/day (I don't know, please check the docu on abuseipdb site).

    Pretty soon EVERY F2B user who reports to AbuseIPDB will be getting this error when they turn off V1 in 20 days...

    Yes, and? What we should do?

    • 0.10.5 is out. So try to notify each maintainer of every distribution to update his packets.
    • even without 0.10.5 release, it was available since 7 Juni 19 (as Upgrade to AbuseIPDB API v2 #2302 got rebased) in mainline on github, so:
      • the maintainer can get it from there, but they wouldn't because this is simply a config file. because...
      • EVERY F2B user (using AbuseIP) can update the config by himself (the opensource is even... open).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions