Stegvis

Operations

This page is for everyone who runs Stegvis on their own server. How to work with Stegvis is described in the guide; security hardening in detail in SECURITY.md. All commands run in the program folder that contains app.py (in the package the folder stegvis-VERSION/, in the source code app/).

Where the data lives

Everything lives in the data folder, by default data/ in the program folder, changeable with STEGVIS_DATA:

PathContents
system.dborganisations and platform accounts
secret.keykey for sessions and stored secrets such as mail passwords and the keys of two-factor sign-in. Without it these secrets can no longer be read: everyone with two-factor sign-in then has to be reset.
tenants/<slug>/stegvis.dball data of an organisation
tenants/<slug>/uploads/its files
geloescht/data of deleted organisations; delete it by hand once the retention periods have passed

Starting

pip install -r requirements.txt
python app.py     # for trying it out: development server on http://127.0.0.1:8000
python serve.py   # for production: waitress, behind a reverse proxy with TLS

Optional: pip install pypdf for the steps that split and merge PDFs.

Setting it up on a server with systemd, Apache or nginx and TLS is described in the installation guide for Linux.

On first start, Stegvis creates the platform account admin. The password is shown once in the console; sign in with the organisation system. There you then create the first organisation.

On the internet, you need at least these settings:

STEGVIS_SECURE_COOKIE=1
STEGVIS_BEHIND_PROXY=1
STEGVIS_BASE_URL=https://stegvis.example.org
STEGVIS_PLATFORM_NETS=10.0.0.0/8

In PowerShell you set variables like this: $env:STEGVIS_PORT = "8080". An example for nginx and further hardening tips are in SECURITY.md. Stegvis also runs under gunicorn (installed with requirements.txt on Linux), for example gunicorn -w 1 --threads 8 -b 127.0.0.1:5000 app:app, with a single worker, because the protection against sign-in attempts counts per process.

Commands

The command-line tools print their messages in German; the options are listed here with their meaning.

CommandEffect
python app.pydevelopment server
python serve.pyproduction server (waitress)
python tools/backup.pybackup to backups/ next to the data folder; the server may keep running
  --ziel FOLDERdifferent target folder
  --org SLUGonly this organisation, without system.db and secret.key
  --ohne-dateiendatabases only (and secret.key); back up the file storage separately, see Backup
python tools/restore.py FILErestore from a backup; the server must be stopped, the tool asks for confirmation
  --pruefenonly check the backup, change nothing
  --org SLUGonly this organisation, the others stay untouched
  --jawithout asking, for scripts
python tools/update.py FOLDER …update on Linux with systemd: install a new package into one or more program folders, backing up data and program first; run as root. Also ships as update.py next to the packages, see Update
  --pruefenonly show what would happen
  --quelle FOLDERfolder with the packages; default: the tool's own folder if it contains packages, otherwise /opt
  --paket FILEexactly this package instead of the newest matching one
  --sicherung FOLDERtarget of the backups, one subfolder per program folder; default /var/backups/stegvis
  --dienst NAMEspecify the systemd service (only with a single program folder); otherwise it is found via WorkingDirectory
  --behalten NAMEanother entry in the program folder that should be kept (can be given more than once)
  --behalte-sicherungen Nnumber of program backups to keep per folder, default 5
  --ohne-pipdo not update the dependencies
  --erzwingenalso install the same or an older version, or switch between Standard and Pro
  --jawithout asking
python tools/reset_2fa.pyemergency: reset an account's two-factor sign-in when nobody can help in the user interface any more – for example the only admin with a lost phone. The server may keep running; all sessions of the account end, and the action is logged
  --org SLUGorganisation of the account; system for platform accounts
  --user NAMEuser name
python testdaten_generator.pycreate more demo cases
  --tenant SLUGorganisation, default demo
  --faelle Ncases per process
  --seed Nreproducible result
  --resetrebuild the demo organisation from scratch first; only applies to the organisation demo named “Demo GmbH”
  --fallakte [N]case files with rounds: five additional processes (among them the design approval with CAD data and details per version) in which documents go back and forth between internal teams and several external parties, with versions and folders; N cases per kind (60 if omitted) and 6 complex ones. Shown in the “Flow” tab Pro; without Pro they are ordinary cases with files. Regular demo cases are only created in addition with --faelle; can be combined with --reset
  --komplex NN case files per kind with many rounds and all external parties; the title ends in “– komplex”, find them in the case list by searching for “komplex” (status “All”)
python -m teststest suite, always works in a temporary folder; -v shows the individual tests
python tools/i18n_check.py enfind missing translations of a language
python tools/web_check.pycompare the website with the code and show open items; only useful in the source tree with Web/

Environment variables

Stegvis is configured only through environment variables, which are read at start-up. Changes therefore only take effect after a restart. 1 turns a switch on.

Server

VariableMeaningDefault
STEGVIS_DATAdata folderapp/data
STEGVIS_HOSTaddress the server listens on127.0.0.1
STEGVIS_PORTport5000 with serve.py, 8000 with app.py
STEGVIS_THREADSthreads of serve.py8
STEGVIS_DEBUG1 = Flask debug mode; only allowed on 127.0.0.1off
STEGVIS_SECRETkey instead of secret.key. It is then not part of any backup, so keep it separately.–
STEGVIS_BASE_URLpublic address for links in e-mails and for returning from sign-in via Entra ID / OIDC; required in production–
STEGVIS_BEHIND_PROXY1 = evaluate the headers of the reverse proxy. The server must then be reachable only through the proxy.off
STEGVIS_SECURE_COOKIE1 = session cookie only over HTTPSoff
STEGVIS_ORIGINSadditional allowed origins, comma-separated–
STEGVIS_UPDATE_CHECK0 = stop checking for new versions, see Update1

Sign-in

VariableMeaningDefault
STEGVIS_SESSION_HOURSmaximum length of a session in hours12
STEGVIS_IDLE_MINUTESsign-out after inactivity, in minutes120
STEGVIS_PASSWORD_MINminimum password length10
STEGVIS_LOGIN_MAX_FAILSfailed attempts until an account is locked5
STEGVIS_LOGIN_LOCK_MINUTESduration of this lock in minutes15
STEGVIS_IP_MAX_FAILSfailed attempts per IP address20
STEGVIS_SSO_SESSION_HOURSmaximum length of a session via Entra ID / OIDC Pro, in hours; shorter because Stegvis only learns that a person has left at their next sign-in8

Platform and organisations

VariableMeaningDefault
STEGVIS_PLATFORM_PASSWORDinitial password of the platform account admin on first startrandom, shown in the console
STEGVIS_PLATFORM_NETSplatform administration only from these networks, e.g. 10.0.0.0/8, 192.168.1.20; strongly recommended on the internetfrom anywhere
STEGVIS_PLATFORM_2FA1 = two-factor sign-in mandatory for all platform accounts; anyone who does not have it yet sets it up at the next sign-inoff
STEGVIS_PLATFORM_IDLE_MINUTESsign-out of the platform administration after inactivity, in minutes30
STEGVIS_TENANT_QUOTA_MBdefault storage quota per organisation; can be changed per organisation0 = unlimited
STEGVIS_DEFAULT_ORGslug under which an earlier single installation is adoptedstandard
STEGVIS_DEFAULT_ORG_NAMEname of this organisationStandard-Organisation

Files

VariableMeaningDefault
STEGVIS_MAX_FILE_GBlargest single file; the app and the page of an external link upload in chunks. File fields can stay below it20
STEGVIS_MAX_UPLOAD_MBsize per request: for chunked uploads per chunk (at most 32 MB), for public forms and the API all files of one save together50
STEGVIS_MAX_FILESfiles per save25
STEGVIS_PDF_MAX_MBlargest PDF file Stegvis splits or merges50
STEGVIS_PDF_MAX_SEITENhighest page count of a PDF file and of a result2000
STEGVIS_BLOCKED_EXTblocked file extensions, comma-separated; replaces the default listexe,com,bat,cmd,scr,pif,msi,msp,dll,cpl,js,jse,vbs,vbe,wsf,wsh,ps1,psm1,hta,jar,lnk,reg,sh,app,html,htm,xhtml,xht,shtml,mht,mhtml,svg,svgz

Large files, such as plans or contracts with many versions:

E-mail

These variables define the system account. It only applies if none is entered in the platform administration and an organisation does not use its own mail server.

VariableMeaningDefault
STEGVIS_SMTP_HOSTmail server–
STEGVIS_SMTP_PORTport; 25, 465, 587 and 2525 are allowed587
STEGVIS_SMTP_SECURITYstarttls, ssl or nonestarttls
STEGVIS_SMTP_USERuser name–
STEGVIS_SMTP_PASSWORDpassword–
STEGVIS_SMTP_FROMsender address; if not set, the user name–
STEGVIS_SMTP_FROM_NAMEsender nameStegvis
STEGVIS_MAIL_WORKER0 = this process sends no mail, does not handle expired links, fires no timer events (wait, deadline exits) and does not hand tasks over to deputies on the first day of an absence1

Calls to other systems

VariableMeaningDefault
STEGVIS_LOOKUP_HOSTShosts that lookups and API steps of all organisations may call, comma-separated. Hosts for individual organisations are approved in the platform administration (organisation → Master data → “Allowed API targets”).none
STEGVIS_LOOKUP_PORTSallowed ports for targets without their own port443,80,8443,8080
STEGVIS_LOOKUP_ALLOW_HTTP1 = also unencrypted HTTP: for all hosts in STEGVIS_LOOKUP_HOSTS, for targets of individual organisations only with the flag httpoff
STEGVIS_LOOKUP_ALLOW_PRIVATE1 = also internal networks such as 10.x or localhost: for all hosts in STEGVIS_LOOKUP_HOSTS, for targets of individual organisations only with the flag internoff
STEGVIS_DB_ALLOW_PLAINTEXTPro 1 = unencrypted database connections within your own network, only for targets with the flags intern klartextoff
STEGVIS_ODBC_DRIVERSPro ODBC drivers that admins may choose for database connections, comma-separated, names as in odbcinst.ini, e.g. ODBC Driver 18 for SQL Server,PostgreSQL Unicodenone

Each target of an organisation goes on its own line: host name or IP address, optionally with a port and the flags intern (internal) and http, for example erp.example.org:44300 or 10.20.0.15:8000 intern http. A port on a target applies only to that target; without a port, the ports from STEGVIS_LOOKUP_PORTS apply. The platform administration can only set the flags if the installation allows them via STEGVIS_LOOKUP_ALLOW_PRIVATE or STEGVIS_LOOKUP_ALLOW_HTTP. If a setting is withdrawn later, Stegvis blocks the affected targets again. Metadata and link-local addresses always stay blocked.

Stegvis connects only to the address that was resolved during the check, including when sending mail. A name that is redirected to an internal address between check and call (DNS rebinding) therefore leads nowhere. If a proxy is configured (HTTPS_PROXY etc.), the proxy resolves the names; it should then block internal targets itself. The organisations' lists are stored in system.db and come back with a full backup.

Databases Pro

Database queries in calculations and selection lists (see the guide) need a driver in Stegvis's Python environment. Stegvis does not ship one; restart the server after installing it.

Database targets are approved in the platform administration like other targets, but always with a port, e.g. abc123.hana.prod-eu10.hanacloud.ondemand.com:443 or sql01.firma.local:1433 intern. STEGVIS_LOOKUP_HOSTS does not apply to databases. Unencrypted connections (klartext, plain text) only work together with intern, only if STEGVIS_DB_ALLOW_PLAINTEXT=1 is set, and only if the name points exclusively to internal addresses. Connections are read-only, opened anew for each query, with a time and row limit.

Demo

VariableMeaningDefault
STEGVIS_DEMO1 = on first start, organisation demo with known passwords; for testing onlyoff
STEGVIS_DEMO_TENANT1 = create the organisation demo, also alongside others, and rebuild it from scratch regularlyoff
STEGVIS_DEMO_RESET_HOURSinterval between these resets in hours; 0 = never24
STEGVIS_DEMO_CASES0 = demo without prepared cases1

Backup

python tools/backup.py --ziel /mnt/backup

The result is a single ZIP file. The server may keep running; the databases are backed up consistently using SQLite's backup function. This also works on Windows and without sqlite3 installed.

The backup contains everything in plain text

All case data and the key are stored unencrypted in the file. Protect it like the data itself, and do not store it on the same disk: it will not help you there if that disk fails. The backup does not delete old copies either; retention and clean-up are up to you.

Regularly via cron, here daily at 3 a.m., with 30 days of retention:

0 3 * * * cd /opt/stegvis && STEGVIS_DATA=/var/lib/stegvis python tools/backup.py --ziel /mnt/backup
0 4 * * * find /mnt/backup -name 'stegvis-backup-*.zip' -mtime +30 -delete

With --org SLUG you get a backup of a single organisation, for example for a handover. It contains no data of other organisations and not secret.key either.

Many large files: --ohne-dateien backs up only the databases (and secret.key). You then back up the file storage tenants/*/uploads/ separately, for example with rsync or a snapshot of the disk – ideally right after the database backup so both match. Restoring such a backup keeps the existing file storage; --pruefen says so.

python tools/backup.py --ziel /mnt/backup --ohne-dateien
rsync -a --delete /var/lib/stegvis/tenants/ /mnt/backup/files/ --include='*/' --include='uploads/***' --exclude='*'

Restore

  1. Check the backup. This changes nothing and is worth doing even without a reason:
    python tools/restore.py /mnt/backup/stegvis-backup-20261105-030000.zip --pruefen
  2. Stop the server. If it is still running, the tool refuses to work.
  3. Restore, with the same STEGVIS_DATA as the server:
    python tools/restore.py /mnt/backup/stegvis-backup-20261105-030000.zip
    The tool shows what will be replaced and asks for confirmation. To restore only one organisation, append --org SLUG; the others stay untouched, including their sessions.
  4. Start the server. It applies database changes itself, so an older backup also works with newer code.

Note:

The check detects damage but is no substitute for a signature: only restore backups from a trusted source.

Update

On Linux with systemd, the tool update.py takes care of all steps. It ships next to the packages with every release and always matches their version. Put everything that belongs to the release into /opt: the packages, update.py and SHA256SUMS. Then:

sudo python3 /opt/update.py /opt/stegvis --pruefen      # look first
sudo python3 /opt/update.py /opt/stegvis
sudo python3 /opt/update.py /opt/stegvis-test /opt/stegvis   # several instances one after another

For each program folder, the tool proceeds as follows:

  1. Choose the package: the newest package of the same edition, so Pro never accidentally becomes Standard. The checksum must match SHA256SUMS. It installs the same or older versions only with --erzwingen (force).
  2. Find the service: it reads the service, env file, data folder and service user from the systemd unit whose WorkingDirectory is the program folder.
  3. Show the plan: version, new, changed and removed files. It only continues after asking for confirmation.
  4. Back up: it backs up the data with tools/backup.py of the installed version, as the service user. Then it stops the service and backs up the program folder as programm-….tar.gz. Both end up in /var/backups/stegvis/<folder>/.
  5. Replace: the program files are replaced. Anything that no longer exists in the new version is removed, as is __pycache__. If something goes wrong, the tool restores the old state itself.
  6. Start: pip install -U -r requirements.txt only runs if the file has changed. Then it starts the service and waits until the server is running. The server creates new columns and tables itself.

The data folder, .venv and backups/ are never touched. Of the program backups, the last five are kept; the data backups are covered by your own clean-up as with the backup.

Without the tool, for example on Windows: create a backup, stop the server, replace the program folder with the contents of the new package and leave the data folder in place. Then run pip install -U -r requirements.txt and start the server.

Back to an older version: stop the service and empty the program folder, except for the data folder, .venv and backups/. Then unpack the program backup there and restore the data backup from before the update with restore.py.

Notice of new versions

Org admins and platform admins see the installed version at the bottom of the sidebar, and a notice as soon as a newer one is available. For this, the server fetches https://stegvis.dev/version.json once a day. It sends nothing about your installation, and nothing is ever installed automatically. The check runs independently of STEGVIS_LOOKUP_HOSTS. If the server should not make any outbound connection at all, set STEGVIS_UPDATE_CHECK=0. More on this under privacy.

Licence (Pro edition) Pro

Stegvis comes as a Standard and a Pro edition (see Standard and Pro). The Pro edition is the program folder with the subfolder app/pro/; its features are unlocked with a licence key. Without the folder, the Standard edition runs, and a licence key changes nothing about that.

  1. Install the Pro edition like an update and restart the server. The folder app/pro/ is only loaded at start-up.
  2. In the platform administration (organisation system), open Licence, paste the key (it starts with STEGVIS-PRO-1.) and click Save licence key. No restart is needed for this.
  3. The page then shows “Stegvis Pro”, the licence details and the unlocked features. In the sidebar, a small “PRO” appears next to “Stegvis”.
QuestionAnswer
What does a licence cover?The whole installation, with all organisations.
Is it checked online?No. The key is signed and checked on your server. Stegvis reports nothing to the outside.
What happens when it expires?A 30-day grace period during which everything keeps running; the “Licence” page and the reddish “PRO” point this out. After that, the Pro features are locked. Data is never locked, existing organisations keep working, and configured API accesses stay stored.
Renew or extend?Enter the new key on the same page; it replaces the old one.
Where is the key stored?In system.db in the data folder. The backup contains it.
Who sees what?Only the platform administration sees the licence details. Signed-in users of the organisations only see whether Pro is active. Every change is recorded in the system log.

If you are interested in a Pro licence: stegvis@hahn.ws.

Common problems

SymptomCause and remedy
Sign-in fails behind the proxy, the log shows all visitors as 127.0.0.1STEGVIS_BEHIND_PROXY=1 is missing
Links in e-mails contain no address, a notice appears at start-upSet STEGVIS_BASE_URL
Larger uploads fail although the limit in Stegvis is high enoughThe proxy has its own limit, for nginx e.g. client_max_body_size 50m;, for Apache LimitRequestBody 52428800. Set both to match STEGVIS_MAX_UPLOAD_MB. Only affects public forms and the API; the app uploads in chunks
A link for external people is not sentThe reason is shown on the case. You need external recipients to be allowed under Email & notifications, a mail server and STEGVIS_BASE_URL
Mails stay in the outboxIs the process running with STEGVIS_MAIL_WORKER=0? Otherwise check the error under Email & notifications
No notice of a new version, the log says “Update-Prüfung nicht möglich” (update check not possible)The server cannot reach stegvis.dev, for example because of a firewall. Stegvis keeps working normally and tries again the next day
Start-up aborts: secret.key is empty or damagedRestore it from the backup. If you delete the file, a new key is created: all sessions end, and stored mail passwords can no longer be read
The code from the authenticator app is rejected although it is correctThe clock of the server or the phone is wrong; the codes change every 30 seconds. Check time synchronisation (NTP) on the server, and turn on automatic time on the phone
“PDF steps need the package pypdf”pip install pypdf in Stegvis's environment, then restart
Database connection: “The driver for … is not installed on the server”pip install hdbcli or pip install pyodbc in Stegvis's environment, then restart (see Databases)
Database connection to SAP Datasphere fails with “cannot connect”The server's public IP is missing in Datasphere under Trusted IPs. Changes there sometimes take a few minutes
restore.py reports “Der Server läuft noch” (the server is still running)Stop the processes it names. After a crash nothing blocks; the lock expires with the process
↑ Contents