Skip to content

Latest commit

 

History

History
63 lines (47 loc) · 999 Bytes

README.md

File metadata and controls

63 lines (47 loc) · 999 Bytes

antispam

ngx.shared.dict based access control. use redis to share data with each others.

usage


http {
    lua_shared_dict prison 500m;
    lua_shared_dict rules 10m;

    lua_package_path '/path/to/antispam/?.lua;;';
    init_by_lua_file /path/to/antispam/init.lua;    

    ...

    server {
        access_by_lua_file /path/to/antispam/antispam.lua;

        ...

        location ~* /antimanage/(ban|delete|purge) {
            allow 10.0.0.0/8;
            deny all;
            content_by_lua_file /path/to/antispam/$1.lua;
        }
    }
}

config


see config.lua

rules


  • add rule in config.lua
  • add rule func in antispam.lua

manual control


  • ban
curl http://0:80/antimanage/ban?key=xxxx&ttl=500

key required, ip/token/ip+uri ...
ttl optional, seconds to ban

  • delelte
curl http://0:80/antimanage/delete?key=xxxx

key required,ip/token/ip+uri ...

  • purge
curl http://0:80/antimanage/purge