规则语言是使用9个指令实现:

语法:SecRule VARIABLES OPERATOR [TRANSFORMATION_FUNCTIONS, ACTIONS]

Variables 以下几种:

Regular variables
Contain only one piece of information, or one string. For example, REMOTE_ADDR, always
contains the IP address of the client.
Collections
Groups of regular variables. Some collections (e.g., ARGS) allow enumeration, making
it possible to use its every member in a rule. Some other collections (e.g., ENV)

are not as flexible, but there is always going to be some way to extract individual regular
variables out of them.
Read-only collections
Many of the collections point to some data that cannot be modified, in which case
the collection itself will be available only for reading.
Read/write collections
When a collection is not based on immutable data ModSecurity will allow you to
modify it. A good example of a read/write collection is TX, which a collection that
starts empty and exists only as long as the currently processed transaction exists.
Special collections
Sometimes a collection is just a handy mechanism to retrieve information from
something that is not organised as a collection but it can seem that way. This is the
case with the XML collection, which takes an XPath expression as a (mandatory) parameter
and allows you to extract values out of an XML file.
Persistent collections
Some collections can be stored and retrieved later. This feature allows you to adopt a
wider view of your systems, for example tracking access per IP address or per session,
or per user account.

1、一个简单的规则

在rule/目录下创建myruls.conf

添加规则

SecRule ARGS "(testwwd)+" \
"msg:'wwd22 test',\
id:,\
phase:request,\
deny,\
status:"

nginx reload

测试:http://nginxip:nginxport/?test=testwwd

503拦截

2、针对struts漏洞

3、lua脚本

4、白名单、黑名单

6、自定义评分

modSecurity规则学习(四)——规则指令编写的更多相关文章

  1. Prometheus之告警规则的编写

    Prometheus之告警规则的编写 一.前置知识 二.需求 三.实现步骤 1.编写告警规则 2.修改prometheus.yml执行告警规则的位置 3.配置文件截图 4.页面上看告警数据信息 5.查 ...

  2. Hexo之旅(四):文章编写技巧

    hexo 编写文章可以使用以下命令创建hexo new "文件名" #创建的文章会在_pots目录下文章的后缀名是以md命名的文件格式,遵循markdown语法,所以编写文章可以使 ...

  3. modSecurity规则学习(三)——SecRule

    通用格式 SecRule VARIABLES OPERATOR [TRANSFORMATION_FUNCTIONS, ACTIONS]   阶段phase (1)request headers (2) ...

  4. 技术转载:Jni学习四:如何编写jni方法

    转载:http://blog.chinaunix.net/u1/38994/showart_1099528.html 一.概述: 在这篇文章中将会简单介绍如何编制一些简单的JNI 方法.我们都知道JN ...

  5. modSecurity规则学习(一)——配置文件

    环境:modSecurity3.0,nignx1.13.8 modSecurity配置文件 1.nginx.conf server { listen ; modsecurity on; //启动mod ...

  6. udev规则以及编写

    主要内容: udev简介 如何配置和使用udev 如何编写udev规则 字符串替换和匹配 udev主要作用 编写udev规则实例 难点解析 1. udev简介 1.1 什么是udev? udev是Li ...

  7. Vue.js-----轻量高效的MVVM框架(四、指令)

    Vue指令 指令 (Directives) 是特殊的带有前缀 v- 的特性.指令的值限定为绑定表达式,因此上面提到的 JavaScript 表达式及过滤器规则在这里也适用.指令的职责就是当其表达式的值 ...

  8. vue.js 四(指令和自定义指令)

    官方的指令说明已经很简单了,这里再写一遍,也是自己加深一下印象 v-text 就是写入单纯的文本,可以忽略这个指令直接双花括号代替 <span v-text="msg"> ...

  9. modSecurity规则学习(八)——防止CC攻击

    modSecurity日志收集:在phase 5阶段处理. 由于CC攻击主要考虑对动态请求的防护,所以要排除静态资源的请求,或者自定义动态请求的后缀或者关键字做接口针对性的防护. 定义需要排除的请求u ...

随机推荐

  1. 【jQuery02】点击标题面板显示内容

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...

  2. linux磁盘管理与分区 转载

    原文:http://zhengjianglong.leanote.com/post/linux%E7%A3%81%E7%9B%98%E5%88%86%E5%8C%BA 一.基础知识 一块磁盘可以分为多 ...

  3. 2016 10 26考试 NOIP模拟赛 杂题

    Time 7:50 AM -> 11:15 AM 感觉今天考完后,我的内心是崩溃的 试题 考试包 T1: 首先看起来是个贪心,然而,然而,看到那个100%数据为n <= 2000整个人就虚 ...

  4. POJ——T 3041 Asteroids

    http://poj.org/problem?id=3041 Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 23565   ...

  5. android仿最新版本号微信相冊--附源代码

    更改排版为 markdown: http://blog.csdn.net/self_study/article/details/69397859

  6. [MST] Store Store in Local Storage

    For an optimal user and developer experience, storing state in local storage is often a must. In thi ...

  7. SolrCloud怎样创建跟新索引信息

    发送leader,由leader定位地址.然后写到shard上,同一时候copy到replicaton . 如图

  8. OpenCASCADE License FAQs

    OpenCASCADE License FAQs 经常用人问我使用OpenCASCADE开发商业软件是否需要付费,下面从OpenCASCADE的官方网站上截取其回答翻译成中文,官方网址:https:/ ...

  9. NHibernate概括

    什么是?NHibernate?NHibernate是一个面向.NET环境的对象/关系数据库映射工具. 对象/关系数据库映射(object/relational mapping,ORM)这个术语表示一种 ...

  10. IP地址的规划和设计方法(二)

    五,IP地址规划方法           (1)IP地址规划的基本步骤           网络地址规划须要按下面6步进行:           a)推断用户对网络与主机数的需求:           ...