thorntech/sftpgateway-backend

By thorntech

Updated about 1 month ago

Lightweight SFTP server streaming files directly to AWS S3, Azure Blob, and Google Cloud Storage.

Image
Security
Integration & delivery
Databases & storage
1

5.9K

thorntech/sftpgateway-backend repository overview

SFTP Gateway

What's New in 3.8.3

  • Fixed a cloud copy failure affecting SFTP clients that preserve file timestamps on upload (AWS S3, Azure Blob, Alibaba OSS)
  • More descriptive error messages when a cloud copy fails
  • Addressed CVE-2026-41293, CVE-2026-43512, CVE-2026-43515 (Tomcat), CVE-2026-33117 (Azure Key Vault), CVE-2026-40973 (Spring Boot), CVE-2026-0636 (Bouncy Castle), and Netty/PostgreSQL JDBC CVEs

For the full changelog, see the CHANGELOG.


SFTP Gateway is a secure, scalable, and easy-to-use solution for transferring files via SFTP to cloud storage services such as AWS S3, Azure Blob, and Google Cloud Storage. Files are streamed directly to cloud storage—data is never stored in transit or exposed to a third party.

Administrators manage the SFTP service through an intuitive web dashboard with support for OIDC and LDAP integration.

Components

SFTP Gateway consists of two container images that work together:

ImageDescription
thorntech/sftpgateway-backend (this image)Core SFTP server, API, and cloud storage integration
thorntech/sftpgateway-admin-uiWeb-based administration dashboard

A PostgreSQL database is also required (included in the quick start below).

Quick Start

1. Generate Credentials

Run the following to generate security credentials and a self-signed TLS certificate, and save them to a .env file that Docker Compose picks up automatically:

# Generate security credentials
SECURITY_CLIENT_ID=$(openssl rand -hex 16)
SECURITY_CLIENT_SECRET=$(openssl rand -hex 32)
SECURITY_JWT_SECRET=$(uuidgen 2>/dev/null \
  || cat /proc/sys/kernel/random/uuid 2>/dev/null \
  || openssl rand -hex 16)

# Generate a self-signed TLS certificate (valid for 1 year)
openssl req -x509 -newkey rsa:2048 -keyout tls.key -out tls.crt \
  -days 365 -nodes -subj "/CN=localhost" 2>/dev/null

# Save everything to .env (Docker Compose reads this automatically)
{
  echo "SECURITY_CLIENT_ID=${SECURITY_CLIENT_ID}"
  echo "SECURITY_CLIENT_SECRET=${SECURITY_CLIENT_SECRET}"
  echo "SECURITY_JWT_SECRET=${SECURITY_JWT_SECRET}"
  printf 'WEBSITE_BUNDLE_CRT="%s"\n' "$(cat tls.crt)"
  printf 'WEBSITE_KEY="%s"\n' "$(cat tls.key)"
} > .env

rm -f tls.crt tls.key
echo "Credentials saved to .env"
2. Create docker-compose.yml

Create a docker-compose.yml file:

services:

  db:
    container_name: sftpgw_container_db
    image: postgres:16-alpine
    environment:
      POSTGRES_DB: sftpgw
      POSTGRES_USER: sftpgw
      POSTGRES_PASSWORD: sftpgw
      PGDATA: /var/lib/postgresql/data/pgdata
      POSTGRES_INITDB_ARGS: "--data-checksums"
    volumes:
      - postgres_data:/var/lib/postgresql/data
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U sftpgw -d sftpgw"]
      interval: 5s
      timeout: 5s
      retries: 5
    restart: unless-stopped
    networks:
      - sftpgw-network

  init-permissions:
    image: thorntech/sftpgateway-backend:3.8.3
    user: root
    entrypoint: ["/bin/sh", "-c"]
    command: ["chown -R sftpgw:sftpgw /mnt/sftpgw_1"]
    volumes:
      - mount:/mnt/sftpgw_1

  backend:
    container_name: backend
    image: thorntech/sftpgateway-backend:3.8.3
    depends_on:
      db:
        condition: service_healthy
      init-permissions:
        condition: service_completed_successfully
    environment:
      SPRING_DATASOURCE_URL: jdbc:postgresql://db:5432/sftpgw
      SPRING_DATASOURCE_USERNAME: sftpgw
      SPRING_DATASOURCE_PASSWORD: sftpgw
      SECURITY_CLIENT_ID: ${SECURITY_CLIENT_ID}
      SECURITY_CLIENT_SECRET: ${SECURITY_CLIENT_SECRET}
      SECURITY_JWT_SECRET: ${SECURITY_JWT_SECRET}
      SERVER_PORT: 8080
      FEATURES_FIRST_CONNECTION_CLOUD_PROVIDER: lfs
      FEATURES_FIRST_CONNECTION_BASE_PREFIX: /mnt/sftpgw_1
      AWS_REGION: ${AWS_REGION:-us-east-1}
      HOME: /home/sftpgw
    volumes:
      - sftpgw_home:/home/sftpgw
      - mount:/mnt/sftpgw_1
    ports:
      - "8080:8080"
      - "2244:22"
    user: "sftpgw"
    working_dir: /opt/sftpgw
    restart: unless-stopped
    networks:
      - sftpgw-network

  ui:
    container_name: sftpgw-ui
    image: thorntech/sftpgateway-admin-ui:3.8.3
    environment:
      BACKEND_URL: http://backend:8080/
      SECURITY_CLIENT_ID: ${SECURITY_CLIENT_ID}
      SECURITY_CLIENT_SECRET: ${SECURITY_CLIENT_SECRET}
      CLOUD_PROVIDER: lfs
      WEBSITE_BUNDLE_CRT: ${WEBSITE_BUNDLE_CRT}
      WEBSITE_KEY: ${WEBSITE_KEY}
    ports:
      - "80:80"
      - "443:443"
    restart: unless-stopped
    networks:
      - sftpgw-network

volumes:
  postgres_data:
    driver: local
  sftpgw_home:
    driver: local
  mount:
    driver: local

networks:
  sftpgw-network:
    driver: bridge
3. Start the Services
docker compose up -d

Access the admin dashboard at https://localhost and the SFTP server on port 2244.

Configuration

Backend Environment Variables
VariableDescriptionRequired
SPRING_DATASOURCE_URLPostgreSQL JDBC connection stringYes
SPRING_DATASOURCE_USERNAMEDatabase usernameYes
SPRING_DATASOURCE_PASSWORDDatabase passwordYes
SECURITY_CLIENT_IDOAuth client ID (must match UI)Yes
SECURITY_CLIENT_SECRETOAuth client secret (must match UI)Yes
SECURITY_JWT_SECRETJWT signing secretYes
SERVER_PORTAPI server port (default: 8080)No
FEATURES_FIRST_CONNECTION_CLOUD_PROVIDERInitial cloud provider: lfs, s3, azureblob, gcp (default: none)No
FEATURES_FIRST_CONNECTION_BASE_PREFIXBase path for local file storage (default: none)No
AWS_REGIONDefault AWS region (default: us-east-1)No
Ports
PortProtocolDescription
22TCPSFTP server
8080TCPREST API
Volumes
PathDescription
/home/sftpgwApplication home directory
/mnt/sftpgw_1Local file storage mount point

Cloud Storage Authentication

SFTP Gateway supports multiple methods for authenticating with cloud storage providers:

  1. Admin Dashboard -- Configure credentials directly through the web interface
  2. Environment Variables -- Pass cloud provider credentials as environment variables (e.g., AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY)
  3. IAM Roles -- When running on AWS, attach an IAM role to your container host or ECS task

Cloud Storage Support

SFTP Gateway supports streaming files to:

  • AWS S3
  • Azure Blob Storage
  • Google Cloud Storage
  • Local filesystem

Configure storage destinations through the admin dashboard.

Security

SFTP Gateway container images are built on Docker Hub Infrastructure (DHI) with near-zero CVEs and a distroless runtime, minimizing the attack surface. Every release includes SBOMs (Software Bill of Materials) and SLSA Build Level 3 provenance attestations, providing verifiable proof of build integrity.

You can inspect the SBOM and provenance for any image using Docker Scout or the BuildKit imagetools:

# View attestations with Docker Scout
docker scout attestation list thorntech/sftpgateway-backend:latest

# Inspect SBOM and provenance with buildx
docker buildx imagetools inspect thorntech/sftpgateway-backend:latest --format '{{json .SBOM}}'
docker buildx imagetools inspect thorntech/sftpgateway-backend:latest --format '{{json .Provenance}}'

License & Terms

SFTP Gateway is commercial software. Use is governed by the End User License Agreement. A 30-day free trial is included — no payment information required.

To purchase a license, visit sftpgateway.com/purchase.

Support

For technical support, contact [email protected].

Documentation

Full documentation is available at sftpgateway.com.

About Thorn Technologies

SFTP Gateway is developed by Thorn Technologies, specialists in secure file transfer and cloud integration solutions.

Tag summary

Content type

Image

Digest

sha256:4f703d750

Size

364.1 MB

Last updated

about 1 month ago

docker pull thorntech/sftpgateway-backend