Skip to main content
REST API reference
A newer release of this product is available.

Manage name mappings for SVMs

Manage name mappings for Storage Virtual Machines (SVMs) to ensure consistent user credential handling across different identity protocols such as CIFS, UNIX, and Kerberos. These mappings enable proper file access regardless of the client's connection type, whether NFS or CIFS. Utilize the priority list to control the order of mapping application and prevent duplicate patterns.

Overview

Name mapping is used to map CIFS identities to UNIX identities, Kerberos identities to UNIX identities, and UNIX identities to CIFS identities. It needs this information to obtain user credentials and provide proper file access regardless of whether they are connecting from an NFS client or a CIFS client.

The system keeps a set of conversion rules for each Storage Virtual Machine (SVM). Each rule consists of two pieces: a pattern and a replacement. Conversions start at the beginning of the appropriate list and perform a substitution based on the first matching rule. The pattern is a UNIX-style regular expression. The replacement is a string containing escape sequences representing subexpressions from the pattern, as in the UNIX sed program.

Name mappings are applied in the order in which they occur in the priority list; for example, a name mapping that occurs at position 2 in the priority list is applied before a name mapping that occurs at position 3. Each mapping direction (Kerberos-to-UNIX, Windows-to-UNIX, and UNIX-to-Windows) has its own priority list. You are prevented from creating two name mappings with the same pattern.

Examples

Creating a name-mapping with client_match as the ip-address

Use the following API to create a name-mapping. Note the return_records=true query parameter is used to obtain the newly created entry in the response.

# The API:
POST /api//name-services/name-mappings

# The call:
curl -X POST "https://<mgmt-ip>/api/name-services/name-mappings?return_records=true" -H "accept: application/json" -H "Content-Type: application/json" -d "{ \"client_match\": \"10.254.101.111/28\", \"direction\": \"win_unix\", \"index\": 1, \"pattern\": \"ENGCIFS_AD_USER\", \"replacement\": \"unix_user1\", \"svm\": { \"name\": \"vs1\", \"uuid\": \"f71d3640-0226-11e9-8526-000c290a8c4b\" }}"

# The response:
{
"num_records": 1,
"records": [
  {
    "svm": {
      "uuid": "f71d3640-0226-11e9-8526-000c290a8c4b",
      "name": "vs1"
    },
    "direction": "win_unix",
    "index": 1,
    "pattern": "ENGCIFS_AD_USER",
    "replacement": "unix_user1",
    "client_match": "10.254.101.111/28"
  }
]
}

Creating a name-mapping with client_match as the hostname

Use the following API to create a name-mapping. Note the return_records=true query parameter is used to obtain the newly created entry in the response.

# The API:
POST /api//name-services/name-mappings

# The call:
curl -X POST "https://<mgmt-ip>/api/name-services/name-mappings?return_records=true" -H "accept: application/json" -H "Content-Type: applicatio/json" -d "{ \"client_match\": \"google.com\", \"direction\": \"win_unix\", \"index\": 2, \"pattern\": \"ENGCIFS_AD_USER\", \"replacement\": \"unix_user1\", \"svm\": { \"name\": \"vs1\", \"uuid\": \"f71d3640-0226-11e9-8526-000c290a8c4b\" }}"

# The response:
{
"num_records": 1,
"records": [
  {
    "svm": {
      "uuid": "f71d3640-0226-11e9-8526-000c290a8c4b",
      "name": "vs1"
    },
    "direction": "win_unix",
    "index": 2,
    "pattern": "ENGCIFS_AD_USER",
    "replacement": "unix_user1",
    "client_match": "google.com"
  }
]
}

Retrieving all name-mapping configurations for all SVMs in the cluster

# The API:
GET /api/name-services/name-mappings

# The call:
curl -X GET "https://<mgmt-ip>/api/name-services/name-mappings?fields=*&return_records=true&return_timeout=15" -H "accept: application/json"

# The response:
{
"records": [
  {
    "svm": {
      "uuid": "f71d3640-0226-11e9-8526-000c290a8c4b",
      "name": "vs1"
    },
    "direction": "win_unix",
    "index": 1,
    "pattern": "ENGCIFS_AD_USER",
    "replacement": "unix_user1",
    "client_match": "10.254.101.111/28"
  },
  {
    "svm": {
      "uuid": "f71d3640-0226-11e9-8526-000c290a8c4b",
      "name": "vs1"
    },
    "direction": "win_unix",
    "index": 2,
    "pattern": "ENGCIFS_AD_USER",
    "replacement": "unix_user1",
    "client_match": "google.com"
  }
],
"num_records": 2
}

Retrieving a name-mapping configuration for a specific SVM, and for the specified direction and index


# The API:
GET /api/name-services/name-mappings/{svm.uuid}/{direction}/{index}

# The call:
curl -X GET "https://<mgmt-ip>/api/name-services/name-mappings/f71d3640-0226-11e9-8526-000c290a8c4b/win_unix/1" -H "accept: application/json"

# The response:
{
"svm": {
  "uuid": "f71d3640-0226-11e9-8526-000c290a8c4b",
  "name": "vs1"
},
"direction": "win_unix",
"index": 1,
"pattern": "ENGCIFS_AD_USER",
"replacement": "unix_user1",
"client_match": "10.254.101.111/28"
}

Updating a specific name-mapping configuration


# The API:
PATCH /api//name-services/name-mappings/{svm.uuid}/{direction}/{index}

# The call:
curl -X PATCH "https://<mgmt-ip>/api/name-services/name-mappings/f71d3640-0226-11e9-8526-000c290a8c4b/win_unix/1" -H "accept: application/json" -H "Content-Type: application/json" -d "{ \"client_match\": \"10.254.101.222/28\", \"pattern\": \"ENGCIFS_LOCAL_USER\", \"replacement\": \"pcuser\"}"

# swapping a specified namemapping entry by index
curl -X PATCH "https://<mgmt-ip>/api/name-services/name-mappings/f71d3640-0226-11e9-8526-000c290a8c4b/win-unix/3?new_index=1" -H "accept: application/json" -H "Content-Type: application/json" -d "{  \"pattern\": \"ENGCIFS_AD_USER\", \"replacement\": \"unix_user1\"}"

Removing a specific name-mapping configuration


# The API:
DELETE /api/name-services/name-mappings/{svm.uuid}/{direction}/{index}

# The call:
curl -X DELETE "https://<mgmt-ip>/api/name-services/name-mappings/f71d3640-0226-11e9-8526-000c290a8c4b/win_unix/1" -H "accept: application/json"