Skip to content

Secure the installation

The base installation encrypts every interface with certificates generated by SmartAGT. Before lasting use, apply this checklist.

Prerequisites

Checklist

Protect the secrets

The KEKs and the passwords of the PostgreSQL roles live only in the environment of the services:

  • never in a YAML file, a script or a shared file
  • typed without display, never as a command argument, which would stay in the history
  • in a console closed once the operation is done
  • readable by administrators only

The environment files are restricted to root at installation. Check it:

sudo stat -c '%a %U %n' /etc/smartagt/backend.env /etc/smartagt/bff.env

Expected result: every file shows 600 root.

The environment of a service is stored in its registry key, readable by default by every user of the server. Restrict these keys to administrators and the system:

$names = 'SmartAGT-Platform-Service', 'smartagt-rag-ingestor-worker', 'smartagt-rag-embed-worker', 'smartagt-scheduler-worker', 'SmartAGT-AI-Gateway-Service', 'smartagt-frontend-service'
foreach ($name in $names) {
    $key = [Microsoft.Win32.Registry]::LocalMachine.OpenSubKey("SYSTEM\CurrentControlSet\Services\$name", 'ReadWriteSubTree', 'ChangePermissions, ReadPermissions')
    $acl = $key.GetAccessControl()
    $acl.SetAccessRuleProtection($true, $false)
    foreach ($rule in @($acl.Access)) { [void]$acl.RemoveAccessRule($rule) }
    foreach ($sid in 'S-1-5-32-544', 'S-1-5-18') {
        $acl.AddAccessRule((New-Object Security.AccessControl.RegistryAccessRule((New-Object Security.Principal.SecurityIdentifier $sid), 'FullControl', 'ContainerInherit', 'None', 'Allow')))
    }
    $key.SetAccessControl($acl)
    $key.Close()
}

Expected result: (Get-Acl HKLM:\SYSTEM\CurrentControlSet\Services\SmartAGT-Platform-Service).Access lists only BUILTIN\Administrators and NT AUTHORITY\SYSTEM.

Apply this check on every node, for the services it carries.

The environment files are restricted to root at installation: backend.env on the Backend nodes, bff.env on the Frontend nodes. Check it:

sudo stat -c '%a %U %n' /etc/smartagt/*.env

Expected result: every file shows 600 root.

The environment of a service is stored in its registry key, readable by default by every user of the server. Restrict these keys to administrators and the system. The loop only handles the services present on the node:

$names = 'SmartAGT-Platform-Service', 'smartagt-rag-ingestor-worker', 'smartagt-rag-embed-worker', 'smartagt-scheduler-worker', 'SmartAGT-AI-Gateway-Service', 'smartagt-frontend-service'
foreach ($name in $names | Where-Object { Test-Path "HKLM:\SYSTEM\CurrentControlSet\Services\$_" }) {
    $key = [Microsoft.Win32.Registry]::LocalMachine.OpenSubKey("SYSTEM\CurrentControlSet\Services\$name", 'ReadWriteSubTree', 'ChangePermissions, ReadPermissions')
    $acl = $key.GetAccessControl()
    $acl.SetAccessRuleProtection($true, $false)
    foreach ($rule in @($acl.Access)) { [void]$acl.RemoveAccessRule($rule) }
    foreach ($sid in 'S-1-5-32-544', 'S-1-5-18') {
        $acl.AddAccessRule((New-Object Security.AccessControl.RegistryAccessRule((New-Object Security.Principal.SecurityIdentifier $sid), 'FullControl', 'ContainerInherit', 'None', 'Allow')))
    }
    $key.SetAccessControl($acl)
    $key.Close()
}

Expected result: on every node, Get-Acl on the key of a SmartAGT service lists only BUILTIN\Administrators and NT AUTHORITY\SYSTEM.

Filter the flows

Open each port for inbound traffic in the server firewall, to the intended clients only. The full flow matrix is in Network.

Port Default listener Open to
9000 Frontend Every address User workstations, or the reverse proxy only
8000 Public API Loopback Applications, if the API is exposed (Advanced YAML of the Backend)
8001 AI Gateway Every address Connected tools, also allowed in the Network list of the console
8010 Internal link Loopback Frontend servers, in a distributed installation

Open each port for inbound traffic in the firewall of the nodes that carry it, to the intended clients only. User workstations and connected tools go through the reverse proxy and the load balancers, never directly to a node. The full flow matrix is in Network.

Port Nodes Open to
9000 Frontend Frontend nodes Reverse proxy only
8000 Public API Platform nodes Frontend nodes, for the attachment, and the API load balancer if applications call it
8001 AI Gateway Nodes with the gateway role Gateway load balancer only
8010 Internal link Platform nodes Internal link load balancer only