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:
| Path | Contents |
|---|---|
system.db | organisations and platform accounts |
secret.key | key 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.db | all 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.
| Command | Effect |
|---|---|
python app.py | development server |
python serve.py | production server (waitress) |
python tools/backup.py | backup to backups/ next to the data folder; the server may keep running |
--ziel FOLDER | different target folder |
--org SLUG | only this organisation, without system.db and secret.key |
--ohne-dateien | databases only (and secret.key); back up the file storage separately, see Backup |
python tools/restore.py FILE | restore from a backup; the server must be stopped, the tool asks for confirmation |
--pruefen | only check the backup, change nothing |
--org SLUG | only this organisation, the others stay untouched |
--ja | without 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 |
--pruefen | only show what would happen |
--quelle FOLDER | folder with the packages; default: the tool's own folder if it contains packages, otherwise /opt |
--paket FILE | exactly this package instead of the newest matching one |
--sicherung FOLDER | target of the backups, one subfolder per program folder; default /var/backups/stegvis |
--dienst NAME | specify the systemd service (only with a single program folder); otherwise it is found via WorkingDirectory |
--behalten NAME | another entry in the program folder that should be kept (can be given more than once) |
--behalte-sicherungen N | number of program backups to keep per folder, default 5 |
--ohne-pip | do not update the dependencies |
--erzwingen | also install the same or an older version, or switch between Standard and Pro |
--ja | without asking |
python tools/reset_2fa.py | emergency: 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 SLUG | organisation of the account; system for platform accounts |
--user NAME | user name |
python testdaten_generator.py | create more demo cases |
--tenant SLUG | organisation, default demo |
--faelle N | cases per process |
--seed N | reproducible result |
--reset | rebuild 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 N | N 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 tests | test suite, always works in a temporary folder; -v shows the individual tests |
python tools/i18n_check.py en | find missing translations of a language |
python tools/web_check.py | compare 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
| Variable | Meaning | Default |
|---|---|---|
STEGVIS_DATA | data folder | app/data |
STEGVIS_HOST | address the server listens on | 127.0.0.1 |
STEGVIS_PORT | port | 5000 with serve.py, 8000 with app.py |
STEGVIS_THREADS | threads of serve.py | 8 |
STEGVIS_DEBUG | 1 = Flask debug mode; only allowed on 127.0.0.1 | off |
STEGVIS_SECRET | key instead of secret.key. It is then not part of any backup, so keep it separately. | – |
STEGVIS_BASE_URL | public address for links in e-mails and for returning from sign-in via Entra ID / OIDC; required in production | – |
STEGVIS_BEHIND_PROXY | 1 = evaluate the headers of the reverse proxy. The server must then be reachable only through the proxy. | off |
STEGVIS_SECURE_COOKIE | 1 = session cookie only over HTTPS | off |
STEGVIS_ORIGINS | additional allowed origins, comma-separated | – |
STEGVIS_UPDATE_CHECK | 0 = stop checking for new versions, see Update | 1 |
Sign-in
| Variable | Meaning | Default |
|---|---|---|
STEGVIS_SESSION_HOURS | maximum length of a session in hours | 12 |
STEGVIS_IDLE_MINUTES | sign-out after inactivity, in minutes | 120 |
STEGVIS_PASSWORD_MIN | minimum password length | 10 |
STEGVIS_LOGIN_MAX_FAILS | failed attempts until an account is locked | 5 |
STEGVIS_LOGIN_LOCK_MINUTES | duration of this lock in minutes | 15 |
STEGVIS_IP_MAX_FAILS | failed attempts per IP address | 20 |
STEGVIS_SSO_SESSION_HOURS | maximum 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-in | 8 |
Platform and organisations
| Variable | Meaning | Default |
|---|---|---|
STEGVIS_PLATFORM_PASSWORD | initial password of the platform account admin on first start | random, shown in the console |
STEGVIS_PLATFORM_NETS | platform administration only from these networks, e.g. 10.0.0.0/8, 192.168.1.20; strongly recommended on the internet | from anywhere |
STEGVIS_PLATFORM_2FA | 1 = two-factor sign-in mandatory for all platform accounts; anyone who does not have it yet sets it up at the next sign-in | off |
STEGVIS_PLATFORM_IDLE_MINUTES | sign-out of the platform administration after inactivity, in minutes | 30 |
STEGVIS_TENANT_QUOTA_MB | default storage quota per organisation; can be changed per organisation | 0 = unlimited |
STEGVIS_DEFAULT_ORG | slug under which an earlier single installation is adopted | standard |
STEGVIS_DEFAULT_ORG_NAME | name of this organisation | Standard-Organisation |
Files
| Variable | Meaning | Default |
|---|---|---|
STEGVIS_MAX_FILE_GB | largest single file; the app and the page of an external link upload in chunks. File fields can stay below it | 20 |
STEGVIS_MAX_UPLOAD_MB | size per request: for chunked uploads per chunk (at most 32 MB), for public forms and the API all files of one save together | 50 |
STEGVIS_MAX_FILES | files per save | 25 |
STEGVIS_PDF_MAX_MB | largest PDF file Stegvis splits or merges | 50 |
STEGVIS_PDF_MAX_SEITEN | highest page count of a PDF file and of a result | 2000 |
STEGVIS_BLOCKED_EXT | blocked file extensions, comma-separated; replaces the default list | exe,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:
- In chunks: the app and the page of an external link upload every file in chunks of at most 32 MB, with a progress bar; after an interruption, the same file continues where it stopped. The limit per file is
STEGVIS_MAX_FILE_GB.STEGVIS_MAX_UPLOAD_MBand the proxy's limit (ApacheLimitRequestBody, nginxclient_max_body_size) do not need to grow for this – only for public forms and the API, which still send files in one request. - Proxy timeout: with the last chunk, Stegvis computes the checksum of the whole file (measured at about 1 GB per second on SSD, much less on slow disks). The template
setup/stegvis.confsetsProxyTimeout 600; for nginx the equivalent isproxy_read_timeout 600s;. If the proxy aborts anyway, Stegvis finishes the calculation and the browser continues afterwards. - The space of a file being uploaded is reserved in the quota from the first chunk; unfinished uploads without a new chunk disappear after 48 hours.
- Plan for disk space: new versions never overwrite the old ones, and removed files stay archived. A case file therefore grows with every round. The storage quota per organisation (
STEGVIS_TENANT_QUOTA_MB) limits this. The platform administration shows files of 100 MB and more separately in each organisation's usage. - The backup contains all files. Its duration and the space needed at the target grow accordingly.
- “Download current state as ZIP” Pro is built in a temporary file on the server, up to 2000 MB per download. The temporary directory needs enough space for it.
- Which files external people may upload (type, size, number) is set by each organisation under Administration → Files from external people, at most up to these limits.
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.
| Variable | Meaning | Default |
|---|---|---|
STEGVIS_SMTP_HOST | mail server | – |
STEGVIS_SMTP_PORT | port; 25, 465, 587 and 2525 are allowed | 587 |
STEGVIS_SMTP_SECURITY | starttls, ssl or none | starttls |
STEGVIS_SMTP_USER | user name | – |
STEGVIS_SMTP_PASSWORD | password | – |
STEGVIS_SMTP_FROM | sender address; if not set, the user name | – |
STEGVIS_SMTP_FROM_NAME | sender name | Stegvis |
STEGVIS_MAIL_WORKER | 0 = 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 absence | 1 |
Calls to other systems
| Variable | Meaning | Default |
|---|---|---|
STEGVIS_LOOKUP_HOSTS | hosts 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_PORTS | allowed ports for targets without their own port | 443,80,8443,8080 |
STEGVIS_LOOKUP_ALLOW_HTTP | 1 = also unencrypted HTTP: for all hosts in STEGVIS_LOOKUP_HOSTS, for targets of individual organisations only with the flag http | off |
STEGVIS_LOOKUP_ALLOW_PRIVATE | 1 = 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 intern | off |
STEGVIS_DB_ALLOW_PLAINTEXT | Pro 1 = unencrypted database connections within your own network, only for targets with the flags intern klartext | off |
STEGVIS_ODBC_DRIVERS | Pro 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 Unicode | none |
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.
- SAP HANA and SAP Datasphere:
pip install hdbcli(SAP's Python driver, SAP Developer License). In Datasphere, create a database user with Read Access (SQL) only under Space → Database Access → Database Users and redeploy the space; enter the public IP address of the Stegvis server under System → Configuration → IP Allowlist → Trusted IPs. Port 443; the connection is always encrypted, with certificate verification. - ODBC, e.g. SQL Server or PostgreSQL:
pip install pyodbc, on Linux also unixODBC (apt install unixodbc) and the vendor's driver. Which drivers admins may choose is set bySTEGVIS_ODBC_DRIVERS. Stegvis enforces encryption with certificate verification for SQL Server (Encrypt=yes,TrustServerCertificate=no) and PostgreSQL (SSLmode=verify-fullwith the system's root certificates, requires libpq 16 or later). Other drivers only work unencrypted within your own network.
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
| Variable | Meaning | Default |
|---|---|---|
STEGVIS_DEMO | 1 = on first start, organisation demo with known passwords; for testing only | off |
STEGVIS_DEMO_TENANT | 1 = create the organisation demo, also alongside others, and rebuild it from scratch regularly | off |
STEGVIS_DEMO_RESET_HOURS | interval between these resets in hours; 0 = never | 24 |
STEGVIS_DEMO_CASES | 0 = demo without prepared cases | 1 |
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.
- Included:
system.db,secret.keyand, for each organisation, its database and files. Files that are already compressed (PDF, images, Office, archives) and files of 256 MB and more go in uncompressed – that saves a lot of time with large files. - Not included:
geloescht/, so that deleted organisations do not come back, and a key fromSTEGVIS_SECRET. You have to keep that one separately.
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
- 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 - Stop the server. If it is still running, the tool refuses to work.
- Restore, with the same
STEGVIS_DATAas the server:
The tool shows what will be replaced and asks for confirmation. To restore only one organisation, appendpython tools/restore.py /mnt/backup/stegvis-backup-20261105-030000.zip--org SLUG; the others stay untouched, including their sessions. - Start the server. It applies database changes itself, so an older backup also works with newer code.
Note:
- Safety copy: before restoring,
backups/vor-restore-….zipis created next to the data folder. If an error occurs during the swap, the previous state is kept. - Changes since the backup are lost. This also applies to organisations created afterwards; the tool names them beforehand, and they remain in the safety copy.
- All affected sessions end; people sign in again.
- Pending mails are not sent automatically. What was still in the outbox at backup time may have been delivered long ago and would otherwise reach customers twice. It can be sent again under Administration → Email & notifications; this then covers all failed mails of the organisation.
- Links for external people: they are valid again as they were in the backup. A link sent since the backup is unknown and has to be created again.
- Different key: if you restore a single organisation on an installation with a different key, the tool points this out. You then have to re-enter mail passwords and create links for external people again.
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:
- 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). - Find the service: it reads the service, env file, data folder and service user from the systemd unit whose
WorkingDirectoryis the program folder. - Show the plan: version, new, changed and removed files. It only continues after asking for confirmation.
- Back up: it backs up the data with
tools/backup.pyof the installed version, as the service user. Then it stops the service and backs up the program folder asprogramm-….tar.gz. Both end up in/var/backups/stegvis/<folder>/. - 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. - Start:
pip install -U -r requirements.txtonly 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.
- Install the Pro edition like an update and restart the server. The folder
app/pro/is only loaded at start-up. - In the platform administration (organisation
system), open Licence, paste the key (it starts withSTEGVIS-PRO-1.) and click Save licence key. No restart is needed for this. - The page then shows “Stegvis Pro”, the licence details and the unlocked features. In the sidebar, a small “PRO” appears next to “Stegvis”.
| Question | Answer |
|---|---|
| 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
| Symptom | Cause and remedy |
|---|---|
| Sign-in fails behind the proxy, the log shows all visitors as 127.0.0.1 | STEGVIS_BEHIND_PROXY=1 is missing |
| Links in e-mails contain no address, a notice appears at start-up | Set STEGVIS_BASE_URL |
| Larger uploads fail although the limit in Stegvis is high enough | The 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 sent | The 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 outbox | Is 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 damaged | Restore 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 correct | The 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 |