config : waf file-upload-restriction-rule
 
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 upload restriction policy. See “config 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 more information, 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-id <id_str>
set file-type_name <file-type-extension_str>
next
end
next
end
Variable
Description
Default
<file-upload-restriction-rule_name>
Type the name of a new or existing rule. The maximum length is 35 characters.
To display the list of existing rules, type:
edit ?
No default.
host-status {enable | disable}
Enable to apply this exception only to HTTP requests for specific web hosts. Also configure host <protected‑host_name>.
Disable to match the exception based upon the other criteria, such as the URL, but regardless of the Host: field.
disable
host <protected‑host_name>
Type the name of a protected host that the Host: field of an HTTP request must be in order to match the rule. The maximum length is 255 characters.
This setting applies only if host-status is enable.
No default.
request-file <url_pattern>
Depending on your selection in request-type {regular | plain}, type either:
the literal URL, such as /fileupload, that the HTTP request must contain in order to match the signature exception. The URL must begin with a slash ( / ).
a regular expression, such as ^/*.php, matching all and only the URLs to which the signature exception should apply. The pattern is not required to begin with a slash ( / ). However, it must at least match URLs that begin with a slash, such as /index.cfm.
Do not include the name of the web host, such as www.example.com, which is configured separately in host <protected‑host_name>. The maximum length is 255 characters.
Note: Regular expressions beginning with an exclamation point ( ! ) are not supported. For information on language and regular expression matching, see the FortiWeb Administration Guide.
No default.
request-type {regular | plain}
Select whether request-file <url_pattern> will contain a literal URL (plain), or a regular expression designed to match multiple URLs (regular).
plain
file-size-limit <size_int>
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 from 0 to 5,120 KB (5 MB).
0
<entry_index>
Type the index number of the individual entry in the table. Each entry in the table can define one file type. The valid range is from 1 to 9,999,999,999,999,999,999.
No default.
file-type-id <id_str>
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:
00001 (GIF)
00002 (JPG)
00003 (PDF)
00004 (XML)
00005 (MP3)
00006 (MIDI)
00007 (WAVE)
00008 (FLV for a Macromedia Flash Video)
00009 (RAR)
00010 (ZIP)
00011 (BMP)
00012 (RM for RealMedia)
00013 (MPEG for MPEG v)
00014 (3GPP)
No default.
file-type_name <file-type-extension_str>
Type the extension, such as MP3, of the file type to allow to be uploaded. Recognized file types are updated by FortiGuard services and may vary. For a list of available names, use the GUI.
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
Related topics
config waf file-upload-restriction-policy