Installation on Linux
This guide is for anyone who can set up a Linux server. It explains what matters for Stegvis, but not the basics of systemd, Apache or TLS. To try Stegvis out, you need none of this: the demo mode on your own computer is enough. There is no separate guide for Windows yet.
In the examples, stegvis.example.org stands for your address. Replace the other paths and names as needed, too.
Prerequisites
- required: Linux with systemd and Python 3; developed and tested with Python 3.11
- required: Apache or nginx as a reverse proxy, plus a TLS certificate, for example from Let’s Encrypt
- required: an address such as
stegvis.example.org; it later goes intoSTEGVIS_BASE_URL - optional: a mail server if Stegvis is to send e-mails (notifications, links for external people)
No database server is needed: Stegvis stores everything in SQLite files in its data folder.
Setting up the program
Stegvis runs under its own user, which may only write to its data. The program belongs to root:
sudo useradd --system --home /opt/stegvis --shell /usr/sbin/nologin stegvis
sudo mkdir -p /opt/stegvis /var/lib/stegvis /var/backups/stegvis /etc/stegvis
sudo chown stegvis:stegvis /var/lib/stegvis /var/backups/stegvis
sudo chmod 700 /var/lib/stegvis /var/backups/stegvis
Stegvis comes as a package, such as stegvis-0.9.4-pro.tar.gz (or -standard), together with SHA256SUMS and the update tool update.py. The package contains only what is needed to run it, all in one folder stegvis-0.9.4/. Check the checksum against SHA256SUMS and unpack the contents into /opt/stegvis so that app.py sits directly there. Then install the dependencies:
sha256sum -c SHA256SUMS --ignore-missing
sudo tar -xzf stegvis-0.9.4-pro.tar.gz -C /opt/stegvis --strip-components=1
sudo python3 -m venv /opt/stegvis/.venv
sudo /opt/stegvis/.venv/bin/pip install -r /opt/stegvis/requirements.txt
Optional: to split and merge PDFs in processes, also install pypdf:
sudo /opt/stegvis/.venv/bin/pip install pypdf
Settings
Put the settings in a file of their own. The service and the tools then read the same values, and passwords are not in the unit file. File /etc/stegvis/stegvis.env:
STEGVIS_DATA=/var/lib/stegvis
STEGVIS_PORT=5000
STEGVIS_BASE_URL=https://stegvis.example.org
STEGVIS_SECURE_COOKIE=1
STEGVIS_BEHIND_PROXY=1
# Platform administration only from your own network; comma-separated, no spaces
STEGVIS_PLATFORM_NETS=203.0.113.10
# System account for e-mails; can also be entered in the platform administration
#STEGVIS_SMTP_HOST=mail.example.org
#STEGVIS_SMTP_USER=stegvis@example.org
#STEGVIS_SMTP_PASSWORD=geheim
# Hosts that lookups and API steps of all organisations may call;
# hosts for individual organisations are approved in the platform administration
#STEGVIS_LOOKUP_HOSTS=api.example.org
sudo chown root:stegvis /etc/stegvis/stegvis.env
sudo chmod 640 /etc/stegvis/stegvis.env
Write values without quotes and without spaces. All variables are listed under operations.
Setting up the service
File /etc/systemd/system/stegvis.service:
[Unit]
Description=Stegvis
After=network.target
[Service]
User=stegvis
Group=stegvis
WorkingDirectory=/opt/stegvis
EnvironmentFile=/etc/stegvis/stegvis.env
ExecStart=/opt/stegvis/.venv/bin/python serve.py
Restart=on-failure
[Install]
WantedBy=multi-user.target
sudo systemctl daemon-reload
sudo systemctl enable --now stegvis
systemctl status stegvis
That works too; on Linux, gunicorn is already installed with requirements.txt. Just replace one line with ExecStart=/opt/stegvis/.venv/bin/gunicorn --workers 1 --threads 8 --bind 127.0.0.1:5000 app:app; the port must match STEGVIS_PORT and the proxy. Stick to one worker with several threads: the protection against sign-in attempts counts per process, so with three workers an attacker would get three times as many attempts.
Reverse proxy
Stegvis only listens on 127.0.0.1; the proxy talks to the outside world. Two things matter here: the proxy must pass on the original Host and set X-Forwarded-Proto, otherwise sign-in fails the origin check. And it has its own limit for uploads, which must match STEGVIS_MAX_UPLOAD_MB (default 50 MB).
Apache
sudo a2enmod ssl proxy proxy_http headers rewrite
sudo certbot certonly --apache -d stegvis.example.org
File /etc/apache2/sites-available/stegvis.conf:
<VirtualHost *:80>
ServerName stegvis.example.org
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}$1 [R=301,L]
</VirtualHost>
<VirtualHost *:443>
ServerName stegvis.example.org
SSLEngine on
SSLCertificateFile /etc/letsencrypt/live/stegvis.example.org/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/stegvis.example.org/privkey.pem
ProxyPreserveHost On
ProxyPass / http://127.0.0.1:5000/
ProxyPassReverse / http://127.0.0.1:5000/
RequestHeader set X-Forwarded-Proto "https"
# 50 MB, matching STEGVIS_MAX_UPLOAD_MB
LimitRequestBody 52428800
ErrorLog ${APACHE_LOG_DIR}/stegvis_error.log
CustomLog ${APACHE_LOG_DIR}/stegvis_access.log combined
</VirtualHost>
sudo a2ensite stegvis
sudo apachectl configtest && sudo systemctl reload apache2
nginx
server {
listen 443 ssl;
server_name stegvis.example.org;
ssl_certificate /etc/letsencrypt/live/stegvis.example.org/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/stegvis.example.org/privkey.pem;
# matching STEGVIS_MAX_UPLOAD_MB
client_max_body_size 50m;
location / {
proxy_pass http://127.0.0.1:5000;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto https;
}
}
server {
listen 80;
server_name stegvis.example.org;
return 301 https://$host$request_uri;
}
First start
On the first start, Stegvis creates the platform account admin. Its random password appears once in the log:
sudo journalctl -u stegvis | grep -A3 "erster Start"
- Open
https://stegvis.example.organd sign in with the organisationsystemand the useradmin. You will have to change the password. - Create the first organisation. You continue working with its account; the platform administration does not see any cases.
- Send a test e-mail under Administration → Email & notifications.
- Start a test case and check that the links in the e-mails lead to the right address.
If something does not work, see the common problems and sudo journalctl -u stegvis -f.
Backup and tools
The commands under operations need the same settings as the service and must run as its user. A small script takes care of this. File /usr/local/bin/stegvis-tool:
#!/bin/sh
set -a
. /etc/stegvis/stegvis.env
set +a
cd /opt/stegvis
exec .venv/bin/python "$@"
sudo chmod 755 /usr/local/bin/stegvis-tool
sudo -u stegvis stegvis-tool tools/backup.py --ziel /var/backups/stegvis
If you restore a backup as root, the files then belong to root and the service can no longer write to its data. So always use sudo -u stegvis.
Daily backup, file /etc/cron.d/stegvis:
0 3 * * * stegvis /usr/local/bin/stegvis-tool tools/backup.py --ziel /var/backups/stegvis
0 4 * * * stegvis find /var/backups/stegvis -name 'stegvis-backup-*.zip' -mtime +30 -delete
The backups contain all data in plain text and should also be kept on another machine. Restoring works like this; details are under operations:
sudo systemctl stop stegvis
sudo -u stegvis stegvis-tool tools/restore.py /var/backups/stegvis/stegvis-backup-20261105-030000.zip
sudo systemctl start stegvis
Update
Copy everything that belongs to the new version to /opt: the packages, update.py and SHA256SUMS. The tool does the rest:
# on your computer
scp stegvis-0.9.4-pro.tar.gz update.py SHA256SUMS server:/tmp/
# on the server
sudo mv /tmp/stegvis-0.9.4-pro.tar.gz /tmp/update.py /tmp/SHA256SUMS /opt/
sudo python3 /opt/update.py /opt/stegvis --pruefen # shows what would happen
sudo python3 /opt/update.py /opt/stegvis
First it backs up the data (as user stegvis) and the program folder to /var/backups/stegvis/stegvis/. Then it stops the service, replaces the program files, removes old ones, updates .venv if needed and starts the service again. The data folder, .venv and backups/ remain untouched. Stegvis applies database changes itself on start. All steps, options and how to roll back are described under operations.
Multiple instances
Multiple organisationsPro do not need a separate installation: with the Pro edition, a single instance already keeps them apart, with its own database and file storage per organisation. Separate instances are mainly worthwhile for test and production on one server. Each one then needs its own env file, its own data folder and port, its own service and its own virtual host.
Switching over from an earlier installation
An existing database of a single installation (data/stegvis.db) is automatically adopted as the organisation standard on the first start. All accounts remain valid; signing in only gains the field “Organisation”. Details are in the README.md.