> For the complete documentation index, see [llms.txt](https://docs.elimity.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.elimity.com/gateways-ntfs/v1.2.2/step-by-step-deployment-guide.md).

# Step-by-step deployment guide

{% hint style="info" %}
This version of the gateway is currently compatible with Elimity Insights server versions matching `>3.40.0`.
{% endhint %}

## 1. Ensuring your files are accessible to the gateway

The Elimity Insights gateway for NTFS scans from the container's local filesystem. This means you have to explicitly mount all the files you want to target. Refer to the sections below for additional details.

### Local directories

Let's assume you deploy the gateway on a plain Windows Server VM and want to scan some directories on the local filesystem: `C:\dir1\subdir` and `D:\dir2`. The following Docker Compose specification would be a good starting point:

```yaml
services:
  ntfs-gateway:
    image: europe-west1-docker.pkg.dev/elimity-general/docker/ntfs-gateway:<tag>
    restart: always
    ports:
      - 8080:80
    volumes:
      - .\config:C:\app\config
      - C:\dir1\subdir:C:\target1
      - D:\dir2:C:\target2
```

In this case you would typically configure the built-in connector to target `C:\target1` and `C:\target2`. Note that you can freely choose the destination paths for these mounts.

### SMB shares via host mount

Scanning permissions for SMB shares is very similar to scanning permissions for local directories, we just need one extra preliminary step to mount the shares into the local filesystem. Microsoft provides explicit support for making SMB share mounts available to containers, [the official documentation](https://learn.microsoft.com/en-us/virtualization/windowscontainers/manage-containers/persistent-storage#smb-mounts) contains detailed instructions about setting this up. In short: to mount a directory `dir` in share `\\host\share` to local drive `D:`, run the following PowerShell command:

```powershell
PS C:\> New-SmbGlobalMapping D: \\host\share\dir -Persistent $true
```

You can now mount the `D:` drive into the NTFS gateway container using a Docker Compose specification based on the following snippet:

```yaml
services:
  ntfs-gateway:
    image: europe-west1-docker.pkg.dev/elimity-general/docker/ntfs-gateway:<tag>
    restart: always
    ports:
      - 8080:80
    volumes:
      - .\config:C:\app\config
      - D:\:C:\target
```

### SMB shares via container mount

The NTFS gateway also supports mounting SMB shares directly from within the container. In this case you don't need to mount them from the host. Instead use the `connection` configuration option to provide SMB share addresses and credentials to the gateway. After mounting the shares you can use their UNC paths in [the built-in connector's target configuration](/reference-manual/built-in-connectors/ntfs/targets-configuration.md). Refer to [the dedicated section on this page](#id-3.-configuring-the-gateway) for additional information. Note that this approach is especially suitable for serverless deployments on e.g. Azure App Service.

## 2. Generating a secret token

To make sure your gateway only serves requests from authenticated sources, we need to generate a secret token. You could do this for example with OpenSSL:

```shell-session
$ openssl rand -base64 32
```

You should use this token to configure [the built-in connector](/reference-manual/built-in-connectors/ntfs.md). The gateway itself only has to verify this token, so we just need to provide it with a hash (hex-encoded SHA256). You can again use OpenSSL for this step:

```shell-session
$ echo -n 'paste-secret-token-here' | openssl dgst
```

Note down the resulting hash for later use.

## 3. Configuring the gateway

To configure your gateway, mount a JSON configuration file at `/app/config/config.json` with the properties listed below. Refer to the following attachment for a starting point:

{% file src="/files/yK6el9cOaJHFBToaz1wc" %}

Edit the following properties in this file to configure the gateway to your needs:

<table data-full-width="true"><thead><tr><th>Property</th><th>Type</th><th>Description</th></tr></thead><tbody><tr><td><code>connection</code></td><td><code>optional[object]</code></td><td>Configuration object describing which network resources the gateway should connect with before scanning</td></tr><tr><td><code>connection.networkResources</code></td><td><code>list[string]</code></td><td>UNC paths of the network resources to connect with, e.g. <code>"\\\\host\\share\\dir"</code></td></tr><tr><td><code>connection.password</code></td><td><code>string</code></td><td>Password to authenticate network resource connections</td></tr><tr><td><code>connection.userName</code></td><td><code>string</code></td><td>Username to authenticate network resource connections</td></tr><tr><td><code>secretTokenHash</code></td><td><code>string</code></td><td>Secret token hash you noted down in step 2</td></tr></tbody></table>

## 4. Deploying the gateway

Having configured the gateway we can now deploy it so the built-in connector can start importing. Since we distribute the gateway as a Docker image, our recommendation for deployment is to use a CaaS solution like Azure App Service. If that's not an option, you can also manually deploy the image on e.g. Windows Server. Refer to [our documentation about gateways and import agents](/technical-guides/gateways-and-import-agents.md) for additional details.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.elimity.com/gateways-ntfs/v1.2.2/step-by-step-deployment-guide.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
