~ubuntu-branches/ubuntu/natty/libapache-mod-security/natty-updates

« back to all changes in this revision

Viewing changes to httpd.conf.example-full

  • Committer: Bazaar Package Importer
  • Author(s): Alberto Gonzalez Iniesta
  • Date: 2005-04-10 12:28:03 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20050410122803-nm4vr14v0qf3i297
Tags: 1.8.7-1
* New upstream release. (Closes: #285365)
* Fixes several security issues, thus the urgency.
* Set proper permissions on test suite scripts (Closes: #304195)
* Corrected minor typo in README.Debian (Closes: #304196)
* debian/control: Reworded packages descriptions to be more useful.
  (Closes: #304445)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
 
2
 
<IfModule mod_security.c>
3
 
 
4
 
    # Turn the filtering engine On or Off
5
 
    SecFilterEngine On
6
 
 
7
 
    # Make sure that URL encoding is valid
8
 
    SecFilterCheckURLEncoding On
9
 
 
10
 
    # Only allow bytes from this range
11
 
    SecFilterForceByteRange 32 126
12
 
 
13
 
    # The audit engine works independently and
14
 
    # can be turned On of Off on the per-server or
15
 
    # on the per-directory basis. "On" will log everything,
16
 
    # "DynamicOrRelevant" will log dynamic requests or violations,
17
 
    # and "RelevantOnly" will only log policy violations
18
 
    SecAuditEngine RelevantOnly
19
 
 
20
 
    # The name of the audit log file
21
 
    SecAuditLog /var/log/apache/audit.log
22
 
 
23
 
    SecFilterDebugLog /var/log/apache/modsec_debug.log
24
 
    SecFilterDebugLevel 0
25
 
 
26
 
    # Should mod_security inspect POST payloads
27
 
    SecFilterScanPOST On
28
 
 
29
 
    # Action to take by default
30
 
    SecFilterDefaultAction "deny,log,status:500"
31
 
 
32
 
    # Redirect user on filter match
33
 
    SecFilter xxx redirect:http://127.0.0.1
34
 
 
35
 
    # Execute the external script on filter match
36
 
    SecFilter yyy log,exec:/usr/share/mod-security/report-attack.pl
37
 
 
38
 
    # Simple filter
39
 
    SecFilter 111
40
 
    
41
 
    # Only check the QUERY_STRING variable
42
 
    SecFilterSelective QUERY_STRING 222
43
 
 
44
 
    # Only check the body of the POST request
45
 
    SecFilterSelective POST_PAYLOAD 333
46
 
 
47
 
    # Only check arguments (will work for GET and POST)
48
 
    SecFilterSelective ARGS 444
49
 
 
50
 
    # Test filter
51
 
    SecFilter "/cgi-bin/modsec-test.pl/keyword"
52
 
 
53
 
    # Another test filter, will be denied with 404 but not logged
54
 
    # action supplied as a parameter overrides the default action
55
 
    SecFilter 999 "deny,nolog,status:500"
56
 
 
57
 
    # Prevent OS specific keywords
58
 
    SecFilter /etc/passwd
59
 
 
60
 
    # Prevent path traversal (..) attacks
61
 
    SecFilter "\.\./"
62
 
 
63
 
    # Weaker XSS protection but allows common HTML tags
64
 
    SecFilter "<[[:space:]]*script"
65
 
 
66
 
    # Prevent XSS atacks (HTML/Javascript injection)
67
 
    SecFilter "<(.|\n)+>"
68
 
 
69
 
    # Very crude filters to prevent SQL injection attacks
70
 
    SecFilter "delete[[:space:]]+from"
71
 
    SecFilter "insert[[:space:]]+into"
72
 
    SecFilter "select.+from"
73
 
 
74
 
    # Require HTTP_USER_AGENT and HTTP_HOST headers
75
 
    SecFilterSelective "HTTP_USER_AGENT|HTTP_HOST" "^$"
76
 
 
77
 
    # Forbid file upload
78
 
    SecFilterSelective "HTTP_CONTENT_TYPE" multipart/form-data
79
 
 
80
 
    # Only watch argument p1
81
 
    SecFilterSelective "ARG_p1" 555
82
 
 
83
 
    # Watch all arguments except p1
84
 
    SecFilterSelective "ARGS|!ARG_p2" 666
85
 
 
86
 
    # Only allow our own test utility to send requests (or Mozilla)
87
 
    SecFilterSelective HTTP_USER_AGENT "!(mod_security|mozilla)"
88
 
 
89
 
    # Do not allow variables with this name
90
 
    SecFilterSelective ARGS_NAMES 777
91
 
 
92
 
    # Do now allow this variable value (names are ok)
93
 
    SecFilterSelective ARGS_VALUES 888
94
 
 
95
 
    # Test for a POST variable parsing bug, see test #41
96
 
    SecFilterSelective ARG_p2 AAA
97
 
 
98
 
    # Stop spamming through FormMail
99
 
    # note the exclamation mark at the beginning
100
 
    # of the filter - only requests that match this regex will
101
 
    # be allowed
102
 
    <Location /cgi-bin/FormMail>
103
 
        SecFilterSelective "ARG_recipient" "!@webkreator.com$"
104
 
    </Location>
105
 
 
106
 
    # when allowing upload, only allow images
107
 
    # note that this is not foolproof, a determined attacker
108
 
    # could get around this 
109
 
    <Location /fileupload.php>
110
 
        SecFilterInheritance Off
111
 
        SecFilterSelective POST_PAYLOAD "!image/(jpeg|bmp|gif)"
112
 
    </Location>
113
 
 
114
 
</IfModule>