Associate security policies with data objects in the filesystem, including volumes, directories, and files. You can associated up to sixteen security policies with a data object in the filesystem.
You can associate security policies with a volume, the volume
mount path, or both the volume and the volume mount path. However, you can only
tag a volume mount path through the maprcli create
volume command with the
rootdirsecuritypolicy option. You cannot tag a volume mount
path through the Control System.
/opt/mapr/bin/maprcli volume create -name <volName> -path <mountPath> -securitypolicy <policy1,policy2,...>curl -k -X POST 'https://<hostname>:8443/rest/volume/create?name=<volName>&path=<volPath>&securityPolicy=<policy>' --user mapr:maprvolume create.hadoop mfs, extended attributes, and Java APIs.hadoop mfs -setsecuritypolicytag <policyName> <filePath>setfattr command to
tag and restore security attributes. Security policies use a
special format for the extended attribute name, which is always
set to the keyword
security.mapr.policy.security.mapr.policy.security.mapr.policy.| Command Type | ||
|---|---|---|
| Linux | Tag an extended attribute name | Use the following command to set an extended
attribute name on a file/directory and/or a
FUSE-mounted file
path: |
| Associate one or more security policies | To associate one or more security policies with
the file /mapr/lab/foo.txt, specify
a comma-separated list of security policy names. For
example, to associate two security policies named
Lab_Security_Policy and
Sensitive_Data to
/mapr/lab/foo.txt,
use: |
|
| Replace security policies | The setfattr command replaces
any existing security policies with the specified
policies. To remove the
Sensitive_Data policy and keep
the Lab_Security_Policy, specify
the Lab_Security_Policy in the
-v argument without the
Sensitive_Data
policy: |
|
| Associate a security policy with a directory | Use a similar command to associate a security
policy to a
directory:
When a directory is tagged with one or more security
policies:
|
|
| Hadoop | Set security policy attributes | The
For example, to associate a security policy
hadoop fs -setfattr -n
security.mapr.policy -v "Lab_Security_Policy"
/mapr/lab/foo.txtIf security policy
tags already exist for the specified object, this
command replaces any existing security policies
with the specified policies. Assume that there are
two security policies -
To
remove hadoop
fs -setfattr -n security.policy -v
"Lab_Security_Policy"
/mapr/lab/foo.txtYou can use the hadoop mfs command as well. To add policies to an already exisitng set of policies, use the format:
To overwrite existing policies with the new policies, use the format:
|
| Java API | Tag security policy attributes |
The following example demonstrates how to use the
Java API to tag the security policy as an extended
attribute
|
| C APIs | Associate a security policy with a filesystem object in C | Use the setxattr or
fsetxattr system call. The brief
synopsis is as follows; for more details, refer to
the setxattr(2) Linux manual
pages.
|