waf file-upload-restriction-rule
Use this command to define the specific host and request URL for which file upload restrictions apply, and define the specific file types that can be uploaded to that host or URL.
To apply the rule, select it in a file security policy. For details, see waf file-upload-restriction-policy.
To use this command, your administrator account’s access control profile must have either w
or rw
permission to the wafgrp
area. For details, see Permissions.
Syntax
config waf file-upload-restriction-rule
edit "<file-upload-restriction-rule_name>"
set host-status {enable | disable}
set host "<protected-host_name>"
set request-file "<url_pattern>"
set request-type {regular | plain}
[set file-size-limit <size_int>]
config file-types
edit <entry_index>
set file-type_name "<file-type-extension_str>"
next
end
next
end
Variable | Description | Default |
Enter the name of a new or existing rule. The maximum length is 63 characters. To display the list of existing rules, enter:
|
No default. | |
Enable to apply this exception only to HTTP requests for specific web hosts. Disable to match the exception based upon the other criteria, such as the URL, but regardless of the |
disable
|
|
Enter the name of a protected host that the This setting applies only if host-status {enable | disable} is |
No default. | |
Depending on your selection in request-type {regular | plain}, type either:
Do not include the name of the web host, such as Note: Regular expressions beginning with an exclamation point ( |
No default. | |
Select whether analyzer-policy "<fortianalyzer-policy_name>" will contain a literal URL (plain ), or a regular expression designed to match multiple URLs (regular ). |
plain | |
Optionally, enter a number to represent the maximum size in kilobytes for any individual file. This places a size limit on allowed file types. The valid range is 0–30720 KB. | 0 | |
Enter the index number of the individual entry in the table. Each entry in the table can define one file type. The valid range is 1–9,999,999,999,999,999,999. | No default. | |
Select the numeric type ID that corresponds to the file type. Recognized IDs are updated by FortiGuard services and may vary. For a list of available IDs, select all file types in the GUI, then use the CLI to view their corresponding IDs. Common IDs include:
|
No default. | |
Enter the extension, such as Note: Microsoft Office Open XML file types such as .docx, xlsx, .pptx, and .vsdx are a type of ZIP-compressed XML. If you specify restrictions for them, those signatures will take priority. However, if you do not select a MSOOX restriction but do have an XML or ZIP restriction, the XML and ZIP restrictions will still apply, and the files will still be restricted. |
No default. |
Example
This example allows both MPEG and FLV files uploaded to the URL /file-uploads
on the host www.example.com
.
config waf file-upload-restriction-rule
edit "file-upload-rule1"
set host-status enable
set host "www.example.com"
set request-file "/file-uploads"
config file-types
edit 1
set file-type-id "00013"
set file-type-name "MPEG"
next
edit 2
set file-type-id "00008"
set file-type-name "FLV"
next
end
next
end