@@ -303,67 +303,7 @@ SecRule TX:ANOMALY_SCORE "@gt %{tx.anomaly_score_threshold}" \
303303```
304304
305305
306- ## API Integration
307306
308- For programmatic ModSecurity management, use the REST API:
309-
310- ### List CRS Rules
311- ``` bash
312- curl -X GET http://localhost:3001/api/modsec/crs-rules \
313- -H " Authorization: Bearer YOUR_TOKEN"
314- ```
315-
316- ### Toggle CRS Rule
317- ``` bash
318- curl -X PATCH http://localhost:3001/api/modsec/crs/rules/RULE_FILE/toggle \
319- -H " Authorization: Bearer YOUR_TOKEN" \
320- -H " Content-Type: application/json" \
321- -d ' {
322- "enabled": false
323- }'
324- ```
325-
326- ### List Custom Rules
327- ``` bash
328- curl -X GET http://localhost:3001/api/modsec/rules \
329- -H " Authorization: Bearer YOUR_TOKEN"
330- ```
331-
332- ### Create Custom Rule
333- ``` bash
334- curl -X POST http://localhost:3001/api/modsec/rules \
335- -H " Authorization: Bearer YOUR_TOKEN" \
336- -H " Content-Type: application/json" \
337- -d ' {
338- "name": "Block SQL Injection",
339- "category": "Security",
340- "ruleContent": "SecRule ARGS \"@detectSQLi\" \"id:1001,phase:2,block,msg:\"SQL Injection Attack Detected\"\"",
341- "description": "Blocks SQL injection attempts",
342- "enabled": true
343- }'
344- ```
345-
346- ### Update Custom Rule
347- ``` bash
348- curl -X PUT http://localhost:3001/api/modsec/rules/RULE_ID \
349- -H " Authorization: Bearer YOUR_TOKEN" \
350- -H " Content-Type: application/json" \
351- -d ' {
352- "name": "Block SQL Injection",
353- "category": "Security",
354- "ruleContent": "SecRule ARGS \"@detectSQLi\" \"id:1001,phase:2,block,msg:\"SQL Injection Attack Detected\"\"",
355- "description": "Blocks SQL injection attempts",
356- "enabled": false
357- }'
358- ```
359-
360- ### Delete Custom Rule
361- ``` bash
362- curl -X DELETE http://localhost:3001/api/modsec/rules/RULE_ID \
363- -H " Authorization: Bearer YOUR_TOKEN"
364- ```
365-
366- For complete API documentation, see the [ API Reference] ( /api/modsecurity ) .
367307
368308
369309For more information on related topics:
0 commit comments