How to Block 100,000+ Individual IP addresses

后端 未结 11 1227
长发绾君心
长发绾君心 2020-12-07 09:39

Introduction

How do you Block large number of IP address from your web application/server. Obviously that can easily be done in P

11条回答
  •  Happy的楠姐
    2020-12-07 10:29

    If you're blocking IPs, you really should be doing this at the firewall level (you don't want users from unwelcome IP addresses getting very far into your system). Thus, I suggest writing a bash script that queries the database and modifies your firewall configuration file accordingly (this assumes that you want a solution which utilizes IP addresses stored in your web database -- there very well might be a better place to store such information).

    EDIT: If you wanted to add IP addresses to the blacklist at the PHP level, as @Populus suggested, here is the manual on how to use system calls in PHP: http://php.net/manual/en/function.system.php

    And here are the commands you would need to use to add an ip address to your blacklist if you're using iptables: http://www.cyberciti.biz/faq/linux-iptables-drop/

提交回复
热议问题