Native FPolicy File Blocking
Applies to
ONTAP 9
Answer
Overview:
Certain administrators want to have policies that do not allow certain file types to be stored on the file server basically requesting for file filter request. These could be music, video or other such file types. The scan for such files can be either based on:
Based on file extensions (native support in Data ONTAP) - for example, block all files matching *.mp3. This is a less reliable approach. It does not need data access to files. Native support for file blocking based on file extensions does not require a connection to any external FPolicy server.
Based on file magic signature (requires external server) - for example, block all files with magic and signature matching mp3 format. This is more accurate as signature matching is done, similar to what anti-virus scanners do to detect viruses.
For more information, see the following link:
FPolicy file blocking for ONTAP 9
The administrator enables event for CREATE, OPEN, CLOSE and RENAME requests. When the FPolicy server is notified of these event triggers, it can run checks based on either of the two mechanisms (file extension or file signature) and DENY requests if match is found.
Sample Configuration:
Perform the following steps to configure a Native FPolicy.
- Configure the Policy Event:
Cluster::> vserver fpolicy policy event create -vserver SvmName -event-name Event -protocol cifs -file-operations create,open,rename
Cluster::> vserver fpolicy policy event show -vserver SvmName -event-name Event -instance
Vserver: SvmName
Event: Event
Protocol: cifs
File Operations: create, open, rename
Filters: -
Is Volume Operation Required: false
- Configure Policy:
Cluster::> vserver fpolicy policy create -vserver SvmName -policy-name blockext -events Event -engine native -is-mandatory true -allow-privileged-access no -is-passthrough-read-enabled false
Cluster::> vserver fpolicy policy show -vserver SvmName -instance
Vserver: SvmName
Policy: blockext
Events to Monitor: Event
FPolicy Engine: native
Is Mandatory Screening Required: true
Allow Privileged Access: no
User Name for Privileged Access: -
Is Passthrough Read Enabled: false
Configure Policy Scope:
Cluster::> vserver fpolicy policy scope create -vserver SvmName -policy-name blockext -file-extensions-to-include mp3,mp4,flv,wmv -shares-to-include "*" -is-file-extension-check-on-directories-enabled true
Cluster::> vserver fpolicy policy scope show -vserver SvmName -instance
Vserver: SvmName
Policy: blockext
Shares to Include: *
Shares to Exclude: -
Volumes to Include: -
Volumes to Exclude: -
Export Policies to Include: -
Export Policies to Exclude: -
File Extensions to Include: mp3, mp4, flv, wmv
File Extensions to Exclude: -
Is File Extension Check on Directories Enabled: true
- Enable Policy: Cannot assign same sequence number to multiple policies under the single vserver, but for the policy in different vserver same sequence numbers which were used in previous vserver can be used.
Cluster::> vserver fpolicy enable -vserver SvmName -policy-name blockext -sequence-number 1
Cluster::> vserver fpolicy show -vserver SvmName
Sequence
Vserver Policy Name Number Status Engine
------- ----------- -------- ------ ------
SvmName blockext 1 on native
Cluster::> event log show -time > 2m
Time Node Severity Event
------------------- ------------ ------------- --------------------------
3/27/2017 10:35:34 cm2520n2-ams INFORMATIONAL mgmt.fpolicy.policy.enabled: FPolicy policy blockext is enabled on Vserver SvmName.
- Tests results using above policy from a Windows client:
Attempt to rename a file using mp3, mp4, flv, or wmv extension is Denied
Attempt to open a file with mp3, mp4, flv, or wmv extension is Denied
Attempt to delete a file with mp3, mp4, flv, or wmv extension is Denied
Attempt to copy a file with mp3, mp4, flv, or wmv extension to the share is Denied
For more information, see the CIFS and NFS Auditing Guide for your version of ONTAP.
Additional Information
Common KBs for Native File Blocking issues:
- Not blocking anything:
- FPolicy is not working, files are not getting blocked
- How to configure native Fpolicy in ONTAP to block extensions
- Blocking but not the right extension or location: