Announcement

Collapse
No announcement yet.

fail2ban & WordPress Plugin: some help with PHP please?

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Snowhog
    replied
    Originally posted by SteveRiley View Post
    I suspect it'll work. I have to fly to Honolulu this evening for a telecom conference; back home Wednesday. We can experiment on Thursday if you'd like.
    Fly to Hawaii for a telecom conference?!! Who doesn't have the concept of what a 'teleconference' is about? Or do you just want to go to Hawaii for other reasons? Hmm?

    Leave a comment:


  • SteveRiley
    replied
    I suspect it'll work. I have to fly to Honolulu this evening for a telecom conference; back home Wednesday. We can experiment on Thursday if you'd like.

    Leave a comment:


  • Feathers McGraw
    replied
    Originally posted by SteveRiley View Post
    As I think about this some more, what I suspect you want to do is have Fail2Ban's list survive a reboot, but still allow the entries to unban once the required time has elapsed. Is this correct?
    Exactly, otherwise any host that gets banned is on the blacklist, regardless of whether or not it got unbanned afterwards. So when you reboot, you'd be re-banning (permanently) all the unbanned IPs as well as the banned ones.

    My addition is supposed to remove entries from the blacklist when they are unbanned, so you don't end up re-banning people you previously wanted to unban.

    Leave a comment:


  • SteveRiley
    replied
    Originally posted by Feathers McGraw View Post
    any reason why this might cause my pi to explode?
    Probably not your Pi, but possibly your head.

    I know my head isn't completely where yours is at the moment (uh, don't go there...just...don't). As I think about this some more, what I suspect you want to do is have Fail2Ban's list survive a reboot, but still allow the entries to unban once the required time has elapsed. Is this correct?

    Leave a comment:


  • Feathers McGraw
    replied
    so, how about this :

    Code:
    actionunban = iptables -D fail2ban-<name> -s <ip> -j DROP
                     sed -i".bak" '/<ip>/d' /etc/fail2ban/ip.blacklist
    ?

    any reason why this might cause my pi to explode?
    Last edited by Feathers McGraw; Jan 19, 2014, 09:05 AM. Reason: formatting

    Leave a comment:


  • Feathers McGraw
    replied
    Yeah, but if I'd like the ip.blacklist file to always reflect the current state of iptables, I'll have to modify "actionunban" or whatever it's called to search for that IP address in the ip.blacklist file and remove it. Otherwise there's little point in fail2ban being able to block people for a few hours and then unblock them, since they'll be blocked permanently after a reboot (unless I manually edit the list to unblock them, which surely defeats the point of automating with fail2ban!).

    Leave a comment:


  • SteveRiley
    replied
    Oh. Duh, reading without comprehending again!

    To remove an IP address from the permanent block list, just edit the file. Then, after a reboot, that IP will no longer be banned.

    Leave a comment:


  • Feathers McGraw
    replied
    Thanks. That's useful for manually releasing a block, but I was getting at the fact that fail2ban usually unbans people after the specified amount of time, but anyone that is banned once will be permanently banned using the instructions in the link above, right?

    EDIT: after a reboot, that is.

    Leave a comment:


  • SteveRiley
    replied
    Originally posted by Feathers McGraw View Post
    How do you deal with offenders that are on dynamic IPs? Surely when the IP addresses rotate, you'll still be banning the wrong user?
    Probably a good argument for not permanently banning. You could get really fancy and have some kind of script look up potential to-be-banned addresses against whois, and if the address is in a netblock reserved for dynamic addresses, you could not add them to the block list. But because there's no single standard format for notating such blocks, I don't see the point.

    Originally posted by Feathers McGraw View Post
    That tutorial includes an actionban statement that writes IPs to the blacklist, but how are the bans released?
    Code:
    sudo iptables -D [i]chain[/i] -s [i]ip-addr[/i] -j DROP
    Fill in the italicized items appropriately.

    Leave a comment:


  • Feathers McGraw
    replied
    Cool! Thanks, that looks like a good solution.

    Now fail2ban is up and running I just have to make sure I don't ban myself... lol.

    (my home network is whitelisted, but I could easily lock myself out at work etc.)

    How do you deal with offenders that are on dynamic IPs? Surely when the IP addresses rotate, you'll still be banning the wrong user?

    That tutorial includes an actionban statement that writes IPs to the blacklist, but how are the bans released?

    Feathers

    Leave a comment:


  • SteveRiley
    replied
    Originally posted by Feathers McGraw View Post
    Unfortunately, you won't be able to access my turbo instructive tutorials for a few hours!! I'm sure you're inconsolable!
    Can't see any of your site at the moment, actually. Me <-- sad!

    Originally posted by Feathers McGraw View Post
    As I understand it, iptables rules don't survive a reboot. What's the best way to make sure they are restored? I've read a few things, but most of them seem to be working around Network Manager. I'm pretty sure the Pi doesn't have NM...
    This should work: http://zach.seifts.us/posts/2013/07/...ans-persistent

    Leave a comment:


  • Feathers McGraw
    replied
    Thanks for the link.

    That's cool, I just wanted to be clear on what you meant when you said it "failed" - just the login or your entire connection to the server.

    Glad it's working, thanks for your help testing.

    Unfortunately, you won't be able to access my turbo instructive tutorials for a few hours!! I'm sure you're inconsolable!

    Moving on...

    As I understand it, iptables rules don't survive a reboot. What's the best way to make sure they are restored? I've read a few things, but most of them seem to be working around Network Manager. I'm pretty sure the Pi doesn't have NM...

    Leave a comment:


  • SteveRiley
    replied
    My earlier round was only a one-shot thing. The ban happened on the third shot from my second round. If Fail2Ban is banning after the third failed attempt from the same source IP address, then it makes sense that the third attempt from my second round got hung -- that would be my fourth attempt from the same source IP address, which by definition is "anything after the third."

    Leave a comment:


  • Feathers McGraw
    replied
    Yep, your domain name appears there.

    I'm just surprised that only one of those login attempts was written to the log file (initially), and yet you were still banned! Or do you mean you were banned on your second iteration, when you were using a much more appropriately suggestive username?

    Code:
    Jan 18 10:49:22 samhobbs wordpress(www.samhobbs.co.uk)[21060]: Authentication failure for dayncchaigh from 37.187.79.141
    Jan 18 17:23:34 samhobbs wordpress(www.samhobbs.co.uk)[3766]: Authentication failure for admin from 86.173.246.243
    Jan 18 22:54:03 samhobbs wordpress(www.samhobbs.co.uk)[4587]: Authentication failure for h4x0rd00d from 24.19.53.43
    Jan 19 00:32:42 samhobbs wordpress(www.samhobbs.co.uk)[4913]: Authentication failure for insertinto from 24.19.53.43
    Jan 19 00:32:50 samhobbs wordpress(www.samhobbs.co.uk)[4884]: Authentication failure for insertinto from 24.19.53.43
    Jan 19 00:32:59 samhobbs wordpress(www.samhobbs.co.uk)[4844]: Authentication failure for insertinto from 24.19.53.43
    Lol...

    Leave a comment:


  • SteveRiley
    replied
    Originally posted by Feathers McGraw View Post
    veneer of innocence
    Yeah, I think we all knew it's just for show. Deep down you're as twisted as the rest of us!

    OK, I tried three times, with a little bit of SQL even. Attemps one and two returned the "invalid login" error, while attempt three just hang. Looks like Fail2Ban did its job.

    To see current bans, run
    Code:
    sudo iptables -L
    Some discussion about how Fail2Ban watches log files and builds its block files: http://stuffphilwrites.com/2013/03/p...ders-fail2ban/
    Last edited by SteveRiley; Jan 18, 2014, 06:40 PM.

    Leave a comment:

Users Viewing This Topic

Collapse

There are 0 users viewing this topic.

Working...
X