====== WAF Web Application Firewall ====== Bei Hetzner habe ich ein paar WAFs, genauer gesagt ModSecurity unter NGINX konfiguriert. \\ Dafür habe ich ein paar Cusom Rules konfiguriert die Zugriff nur von bestimmten IPs zulassen: ====== Custom Rules ====== SecRule REQUEST_FILENAME "@endsWith /api.php" \ "id:2000, \ chain, \ phase:1, \ log, \ pass" SecRule REMOTE_ADDR "@ipMatchFromFile ip_allowlist.txt" \ ctl:ruleEngine=DetectionOnly SecRule REQUEST_FILENAME "@endsWith /api.php" \ "id:2001, \ phase:1, \ t:lowercase, \ log, \ deny, \ msg:'Zugriff verboten'" SecRule REQUEST_FILENAME "@endsWith /api/getcontact.php" \ "id:2002, \ chain, \ phase:1, \ t:lowercase, \ log, \ pass" SecRule REMOTE_ADDR "@ipMatchFromFile ip_allowlist.txt" \ ctl:ruleEngine=DetectionOnly SecRule REQUEST_FILENAME "@endsWith /api/getcontact.php" \ "id:2003, \ phase:1, \ t:lowercase, \ log, \ deny, \ msg:'Zugriff verboten'" Durch das **t:lowercase** sind alle Zugriffe auf die URI **/api/getContact.php** sowie **/api/getcontact.php** nur per Allowlist erreichbar. Wichtig hierbei ist die **REQUEST_URI** kleingeschrieben anzugeben auch wenn die eigentliche URI Großbuchstaben enthält.