PageRenderTime 52ms CodeModel.GetById 26ms RepoModel.GetById 1ms app.codeStats 0ms

/doc/topics/web_application_firewall/index.md

http://github.com/gitlabhq/gitlabhq
Markdown | 95 lines | 67 code | 28 blank | 0 comment | 0 complexity | 37139c858deb6691301af8882f82f19b MD5 | raw file
Possible License(s): CC-BY-SA-4.0, Apache-2.0, CC-BY-3.0, CC0-1.0, JSON
  1. # Web Application Firewall - ModSecurity
  2. A web application firewall (or WAF) filters, monitors, and blocks HTTP traffic to
  3. and from a web application. By inspecting HTTP traffic, it can prevent attacks
  4. stemming from web application security flaws. It can be used to detect SQL injection,
  5. Cross-Site Scripting (XSS), Remote File Inclusion, Security Misconfigurations, and
  6. much more.
  7. ## Overview
  8. GitLab provides a WAF out of the box after Ingress is deployed.
  9. All you need to do is deploy your application along with a service
  10. and Ingress resource.
  11. In GitLab's [Ingress](../../user/clusters/applications.md#ingress) deployment, the [ModSecurity](https://modsecurity.org/) module is loaded
  12. into Ingress-NGINX by default and monitors the traffic going to the
  13. applications which have an Ingress.
  14. The ModSecurity module runs with the [OWASP Core Rule Set (CRS)](https://coreruleset.org/) by default. The OWASP CRS will detect and log a wide range of common attacks.
  15. NOTE: **Note**
  16. The WAF is deployed in "Detection-only mode" by default and will only log attack
  17. attempts.
  18. ## Requirements
  19. The Web Application Firewall requires:
  20. - **Kubernetes**
  21. To enable the WAF, you need:
  22. - Kubernetes 1.12+.
  23. - A load balancer. You can use NGINX-Ingress by deploying it to your
  24. Kubernetes cluster by either:
  25. - Using the [`nginx-ingress` Helm chart](https://github.com/helm/charts/tree/master/stable/nginx-ingress).
  26. - Installing the [Ingress GitLab Managed App](../../user/clusters/applications.md#ingress) with WAF enabled.
  27. - **Configured Kubernetes objects**
  28. To use the WAF on an application, you need to deploy the following Kubernetes resources:
  29. - [Deployment](https://kubernetes.io/docs/concepts/workloads/controllers/deployment/)
  30. - [Service](https://kubernetes.io/docs/concepts/services-networking/service/)
  31. - [Ingress Resource](https://kubernetes.io/docs/concepts/services-networking/ingress/)
  32. ## Quick start
  33. If you are using GitLab.com, see the [quick start guide](quick_start_guide.md) for
  34. how to use the WAF with GitLab.com and a Kubernetes cluster on Google Kubernetes Engine (GKE).
  35. If you are using a self-managed instance of GitLab, you need to configure the
  36. [Google OAuth2 OmniAuth Provider](../../integration/google.md) before
  37. you can configure a cluster on GKE. Once this is set up, you can follow the steps on the [quick start guide](quick_start_guide.md) to get started.
  38. NOTE: **Note**
  39. This guide shows how the WAF can be deployed using Auto DevOps. The WAF
  40. is available by default to all applications no matter how they are deployed,
  41. as long as they are using Ingress.
  42. ## Network firewall vs. Web Application Firewall
  43. A network firewall or packet filter looks at traffic at the Network (L3) and Transport (L4) layers
  44. of the [OSI Model](https://en.wikipedia.org/wiki/OSI_model), and denies packets from entry based on
  45. a set of rules regarding the network in general.
  46. A Web Application Firewall operates at the Application (L7) layer of the OSI Model and can
  47. examine all the packets traveling to and from a specific application. A WAF can set
  48. more advanced rules around threat detection.
  49. ## Features
  50. ModSecurity is enabled with the [OWASP Core Rule Set (CRS)](https://modsecurity.org/crs/) by
  51. default. The OWASP CRS logs attempts to the following attacks:
  52. - [SQL Injection](https://wiki.owasp.org/index.php/OWASP_Periodic_Table_of_Vulnerabilities_-_SQL_Injection)
  53. - [Cross-Site Scripting](https://wiki.owasp.org/index.php/OWASP_Periodic_Table_of_Vulnerabilities_-_Cross-Site_Scripting_(XSS))
  54. - [Local File Inclusion](https://wiki.owasp.org/index.php/Testing_for_Local_File_Inclusion)
  55. - [Remote File Inclusion](https://wiki.owasp.org/index.php/OWASP_Periodic_Table_of_Vulnerabilities_-_Remote_File_Inclusion)
  56. - [Code Injection](https://wiki.owasp.org/index.php/Code_Injection)
  57. - [Session Fixation](https://wiki.owasp.org/index.php/Session_fixation)
  58. - [Scanner Detection](https://wiki.owasp.org/index.php/Category:Vulnerability_Scanning_Tools)
  59. - [Metadata/Error Leakages](https://wiki.owasp.org/index.php/Improper_Error_Handling)
  60. It is good to have a basic knowledge of the following:
  61. - [Kubernetes](https://kubernetes.io/docs/home/)
  62. - [Ingress](https://kubernetes.github.io/ingress-nginx/)
  63. - [ModSecurity](https://www.modsecurity.org/)
  64. - [OWASP Core Rule Set](https://modsecurity.org/crs/)
  65. ## Roadmap
  66. More information on the direction of the WAF can be
  67. found in [Product Vision - Defend](https://about.gitlab.com/direction/defend/#waf)