Three-Server Setup

This setup is designed for work environments and involves dividing system services between three servers:

  1. The Staffcop Enterprise, NFS server. rustSrv is enabled on this server.

  2. The file scanner, NFS client.

  3. The file scanner database in PostgreSQL.

Attention

Before installation, please check the system requirements.

Staffcop Server Setup

Before setup, install the Staffcop Enterprise server with a file server license.

Staffcop distribution link

Activating rustSrv and the FILE_TAG_MANAGER Parameter

The file scanner interacts with rustSrv, the configuration assignment mechanism. It may already be enabled.

  1. Check the rustSrv status:

staffcop info | grep RustSrv

If active: RustrSrv = True.

  1. Activate rustSrv, if it is inactive:

sudo staffcop enable rustsrv
  1. Enable FILE_TAG_MANAGER in the Staffcop configuration:

sudo sh -c 'echo "FILE_TAG_MANAGER = True" >> /etc/staffcop/config'
  1. Specify the path to the local spooler folder for the file scanner:

echo "SPOOLER_SCANNER_PATH = \"/var/lib/etl/scanner_queue\"" | sudo tee -a /etc/staffcop/config

Note

Do not skip this step. If you don’t specify the local folder path, the ETL module may not find the scanner job queue. This will result in failure to extract and transfer data for scanning.

  1. Restart Staffcop to apply changes:

sudo staffcop restart

Setting up a Shared File System (NFS)

NFS is used to transfer files from Staffcop to the file scanner for analysis. Staffcop places the files in a shared folder on the NFS server, and the file scanner retrieves them for scanning.

  1. Install the NFS server:

sudo apt update && sudo apt install nfs-kernel-server -y
  1. Identify the staffcop user’s UID/GID:

id staffcop

# Example output: uid=116(staffcop) gid=119(staffcop).

Attention

The Staffcop user’s UID/GID must match on both servers.

  1. Create a group and a user:

sudo groupadd -g 1001 staffcop # creates a group named staffcop
sudo useradd -u 1001 -g 1001 -m -s /bin/bash staffcop # creates the user staffcop and links it to the created group
sudo passwd staffcop # sets a password for the user staffcop

Note

If any questions arise, please contact technical support.

  1. Create and configure the spooler directory.

sudo mkdir -p /var/lib/etl/scanner_queue
sudo chown 116:119 /var/lib/etl/scanner_queue  # use YOUR uid:gid values from step 2!
sudo chmod 775 /var/lib/etl/scanner_queue
  1. Set up folder export for the file scanner server:

echo "/var/lib/etl/scanner_queue <IP_Server_from_FS_DB_and_FS>(rw,sync,no_subtree_check,all_squash,anonuid=<uid п.№2>,anongid=<gid п.№2>)" | sudo tee -a /etc/exports
  1. Apply all settings and restart the server:

sudo exportfs -ra
sudo systemctl restart nfs-kernel-server

Database Server Setup

PostgreSQL Installation

  1. Add the PostgreSQL repository:

    sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list'
    wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
    
  2. Install the selected version, for example PostgreSQL 15:

    sudo apt update
    sudo apt -y --no-install-recommends install postgresql-15
    

    All commands below are listed for version 15. Replace 15 with your version number.

  3. For basic setup, allow connections:

sudo sed -i "s/#listen_addresses = 'localhost'/listen_addresses = '*'/" /etc/postgresql/15/main/postgresql.conf
  1. Increase the connection limit:

    sudo sed -i 's/max_connections = .*/max_connections = 500/' /etc/postgresql/15/main/postgresql.conf
    
  2. Restart the system to apply all changes:

    sudo systemctl restart postgresql@15-main
    

Creating a User and Database

  1. Connect to the database:

    sudo -u postgres psql
    
  2. Create a user:

    CREATE USER file_scanner WITH PASSWORD 'your_complex_password';
    
  3. Create a database:

    CREATE DATABASE file_scanner WITH OWNER = file_scanner TEMPLATE = template0;
    
  4. Allow the user to create databases:

    ALTER USER file_scanner CREATEDB;
    
  5. Exit the PostgreSQL console:

    \q
    

User Access Setup

  1. Set up user access for file_scanner. Open the pg_hba.conf file:

    sudo nano /etc/postgresql/15/main/pg_hba.conf
    
  2. Append a line to the file for access from the local interface:

    host    file_scanner    file_scanner    samenet            md5
    
  3. Restart PostgreSQL:

    sudo systemctl restart postgresql@15-main
    

File Scanner Setup

File Scanner Installation

  1. Before installing the file scanner, install the libpq-dev package:

apt install libpq-dev
  1. Download the latest deb package for your OS from the build repository.

Ubuntu 22.04:

wget http://distr.staffcop.su/file-scanner/ubuntu-22.04/file-scanner.deb
  1. Install the package:

sudo apt install ./<deb-package>

where <deb-package> is file-scanner.deb.

  1. During installation, an interactive script will prompt you for database connection parameters. Enter the following values:

  • Database name — file scanner database name

  • Database user — file scanner database user

  • Database password — the password specified when creating the file scanner user

  • Database host — IP address of the database server

  • Database port5432 — standard PostgreSQL port

Scanner Initialization

Initialize the scanner:

sudo file-scanner init

Scanner Status

Check that the scanner is active:

sudo systemctl status file-scanner

The status should be active.

NFS Client Installation and Configuration

  1. Install the NFS client:

sudo apt update && sudo apt install nfs-common -y
  1. Create a mount point:

sudo mkdir -p /var/lib/etl/scanner_queue
sudo chmod 775 /var/lib/etl/scanner_queue
  1. Set up automatic mounting at boot. For Ubuntu:

echo "<IP_Staffcop>:/var/lib/etl/scanner_queue /var/lib/etl/scanner_queue nfs defaults 0 0" | sudo tee -a /etc/fstab

where <IP_Staffcop> — is the NFS server address.

  1. Mount the folder:

sudo mount -a
  1. Check the mount:

mount | grep etl

The mounted NFS folder should be displayed.

  1. Append line SPOOLER_SCANNER_PATH = "/var/lib/etl/scanner_queue" to the configuration file:

sudo nano /etc/file-scanner/config
  1. Restart the file scanner:

sudo systemctl restart file-scanner

Final Server Setup

You can finish the installation at any time after installing the file scanner.

Obtaining an API token from Staffcop

  1. Log in to the Staffcop Enterprise web interface as an administrator.

  2. Go to Control PanelServer Settings.

  3. Find the API_TOKEN for file scanner parameter, copy and save the token.

Inserting a Token into the File Scanner Configuration

  1. Open the file scanner configuration file:

sudo nano /etc/file-scanner/config
  1. Find the line API_TOKEN = "" and enter the copied token between the quotation marks:

API_TOKEN = "COPIED_TOKEN"
  1. Save changes with Ctrl+O, press Enter, and exit using Ctrl+X.

  2. Restart the file scanner:

sudo systemctl restart file-scanner

Specifying the File Scanner URL in Staffcop

  1. Return to the Staffcop web interface.

  2. Go to Control PanelServer Settings.

  3. Find the URL file scanner parameter.

  4. Enter the full HTTP address of your file scanner server in the format http://<IP_Server_from_FS_DB_and_FS>:8081.

  5. Select Save.

Verifying Functionality

Make sure all key services are running:

  1. On the Staffcop server:

staffcop info | grep RustSrv

Make sure that rustSrv = True.

  1. On the file scanner server:

sudo systemctl status file-scanner

Verify that the service status shows active (running).

If both checks pass, your two-server setup has been successfully installed and configured.