Server mode with Docker and LDAP
Besides the local version (one program on your own computer, without sign-in), OmniPressix can run as a shared server: one Docker container on the company network, everybody opens it in the browser and signs in with their company user name (LDAP, so e.g. OpenLDAP or Active Directory). It is the same program; in the container it runs with -server.
What changes in server mode:
- Without signing in there is only the sign-in page. After signing in, the header shows the name and an icon to sign out instead of “Quit program”.
- Templates are stored together in the volume
/data/templates– all signed-in users see and edit the same templates. The log (docker logs) records who signed in and who saved or deleted which template. - Photos (passport photos) are stored in the volume under
/data/fotos/benutzer/<login name>, and each user only sees their own. They stay there until the user deletes them in the “Photos” area (“Delete all photos”). Because this is personal data: protect the volume and backups accordingly and have photos that are no longer needed deleted. - Templates also contain the loaded card data (CSV/ODS) and the fonts. Because all users see every template, this data is visible to everybody: only save templates with data that anyone may see (protect the volume and backups). PDFs are not stored on the server; they only pass through the program while the PDF is being created.
- The automatic interim state in the browser is separate for each user and is deleted on signing out (you are asked first). If the sign-in merely expires, it is kept and is back after signing in again.
- A sign-in is valid for 12 hours (
OMNIPRESSIX_SESSION_TTL). After a restart of the container you have to sign in again. - After 5 wrong passwords for a user name (or 20 from one address) signing in is blocked for 5 minutes.
Quick try-out (with test LDAP)#
Without a directory of your own you can try everything with the supplied test LDAP:
cd docker/test-ldap
docker compose up --build
Then open http://localhost:8080 and sign in as erika / erika-pw. max / max-pw is not in the group omnipressix and is rejected. For testing only: the passwords are in plain text in the file, and the LDAP connection is unencrypted. Clean up with docker compose down -v.
Setting up#
Everything for Docker is in the docker/ folder. It is still built from the main folder, because that is where the source code is – the Compose files are already set up for this.
- In the
docker/folder copy the fileomnipressix.env.exampletoomnipressix.envand adapt it to your own directory (the values are explained in the file and below).omnipressix.envcontains the password of the service account and is therefore in.gitignore. - Build and start: ``
cd docker docker compose up -d --build`Without Compose, in the main folder:docker build -f docker/Dockerfile -t omnipressix .anddocker run -d -p 8080:8080 --env-file docker/omnipressix.env -v omnipressixfree-daten:/data omnipressix` - Check:
docker logs docker-omnipressix-1should show “LDAP-Anmeldung aktiv” (LDAP sign-in active); a warning names the reason if the LDAP server cannot be reached or the service account does not fit. After about 30 secondsdocker psshows “healthy”. - HTTPS: Passwords must not travel unencrypted from the browser to the server. Either put a reverse proxy with a certificate in front (nginx, Traefik, Caddy, …) and set
OMNIPRESSIX_TRUST_PROXY=true, or mount the certificate and key into the container and setOMNIPRESSIX_TLS_CERT/OMNIPRESSIX_TLS_KEY. Port 8080 should then only be reachable by the proxy.
The image is small (no shell, “distroless”), does not run as root and checks itself (HEALTHCHECK). Back up the templates in the volume: e.g. with “Export all” in the templates window or with docker cp. With docker cp take the subfolder .versions along if the earlier versions should be kept as well.
Settings (environment variables)#
The variables are called OMNIPRESSIX_…. Up to version 4.0 they were called OMNIPRESSIXFREE_…: these old names keep working but are deprecated – the program writes a notice to the log at start (“Die Umgebungsvariable OMNIPRESSIXFREE_… ist veraltet, bitte OMNIPRESSIX_… verwenden”), once per variable. If both are set, the new one wins. This also applies to the …_FILE variants (Docker secrets). The switch is therefore just renaming the lines in the .env file or in docker-compose.yml; a restart is enough.
| Variable | Meaning |
|---|---|
OMNIPRESSIX_AUTH | ldap = sign-in through LDAP; keine = without sign-in (only in an isolated network). Without it server mode does not start. |
OMNIPRESSIX_LDAP_URL | ldaps://ldap.firma.de:636 (encrypted) or ldap://…:389 |
OMNIPRESSIX_LDAP_STARTTLS | true = switch to encryption with ldap:// |
OMNIPRESSIX_LDAP_CA_FILE | own certificate authority as a PEM file (mount it via a volume) |
OMNIPRESSIX_LDAP_INSECURE_SKIP_VERIFY | true = do not check the certificate – for testing only |
OMNIPRESSIX_LDAP_BIND_DN | service account for searching the users (variant A) |
OMNIPRESSIX_LDAP_BIND_PASSWORD | its password, or …_BIND_PASSWORD_FILE with the path to a file (Docker secret) |
OMNIPRESSIX_LDAP_BASE_DN | where the users are, e.g. ou=people,dc=firma,dc=de |
OMNIPRESSIX_LDAP_USER_FILTER | search filter, %s = entered name. Default (uid=%s), Active Directory: (sAMAccountName=%s) |
OMNIPRESSIX_LDAP_USER_DN | variant B without a service account: uid=%s,ou=people,dc=firma,dc=de or for AD %s@firma.local |
OMNIPRESSIX_LDAP_GROUP_DN | only members of these group(s) may sign in, separate several with ; |
OMNIPRESSIX_LDAP_ADMIN_GROUP_DN | optional, administrator role: members may do everything; separate several groups with ;; see Roles: administrator and “read and print only” |
OMNIPRESSIX_LDAP_READONLY_GROUP_DN | optional, reader role: members may only read and print; separate several groups with ; |
OMNIPRESSIX_LDAP_NAME_ATTR | attribute with the displayed name, default displayName (otherwise cn) |
OMNIPRESSIX_LDAP_TIMEOUT | waiting time for the LDAP server, default 10s |
OMNIPRESSIX_SESSION_TTL | duration of a sign-in, default 12h |
OMNIPRESSIX_TRUST_PROXY | true behind a reverse proxy |
OMNIPRESSIX_TLS_CERT, OMNIPRESSIX_TLS_KEY | HTTPS directly in the program |
OMNIPRESSIX_ADDR, OMNIPRESSIX_TEMPLATES_DIR, OMNIPRESSIX_PHOTOS_DIR | already set in the image to 0.0.0.0:8080, /data/templates and /data/fotos |
OMNIPRESSIX_TEMPLATE_VERSIONS | how many earlier versions are kept per template, default 20, 0 = none (Earlier versions) |
OMNIPRESSIX_PRINT_LOG | print log, in the image /data/druckprotokoll.jsonl (so it is in the volume); aus switches it off |
OMNIPRESSIX_SETTINGS_DIR | folder for the users' settings (one file per user, only with sign-in), default settings; put it under /data in the image so it survives updates |
OMNIPRESSIX_PRINT_LOG_MAX_MB | size in MB above which the print log is set aside, default 20, 0 = never |
Variant A – service account (recommended): The program signs in with BIND_DN, searches for the user under BASE_DN with USER_FILTER and then checks that user’s password. This works with any login-name attribute and also when normal users may not read groups. The service account only needs read permissions.
Variant B – direct: Without a service account the login name is inserted into USER_DN. For the group check the user must then be allowed to read the group themselves; with Active Directory (%s@firma.local) also set BASE_DN and USER_FILTER.
Card data from the directory#
With a service account and a search base, administrators can load card data straight from the directory, see Load from the directory. The service account needs read permissions on the person objects (and the groups). Readers do not see the button.
Roles: administrator and “read and print only”#
With two groups from Active Directory (or another LDAP directory) two roles can be assigned:
| Role | Variable | may |
|---|---|---|
| Administrator | OMNIPRESSIX_LDAP_ADMIN_GROUP_DN | everything: design, save, import and delete templates, fonts, formats |
| Reader | OMNIPRESSIX_LDAP_READONLY_GROUP_DN | only read and print: load card data and photos, load and export templates, create or print cards as PDF |
Example for Active Directory (groups with their DN, several per role separated with ;):
OMNIPRESSIX_LDAP_ADMIN_GROUP_DN=CN=OmniPressix-Admins,OU=Gruppen,DC=firma,DC=local
OMNIPRESSIX_LDAP_READONLY_GROUP_DN=CN=OmniPressix-Leser,OU=Gruppen,DC=firma,DC=local
Who may sign in and who gets which role:
- Anyone in the administrator group, the reader group or in
OMNIPRESSIX_LDAP_GROUP_DNmay sign in. Everyone else is rejected as before. The groups do not have to be contained in each other. - With an administrator group: all members are administrators, every other signed-in user is a reader. Anyone in both groups is an administrator.
- With a reader group only (without an administrator group): members are readers, all others (who come in through
OMNIPRESSIX_LDAP_GROUP_DN) may do everything. The program then requires…_GROUP_DN, otherwise nobody would have all rights, and reports this at start. - Without both groups nothing changes: every signed-in user may do everything.
- The role is read at every sign-in; a change of group applies from the next sign-in (a session lasts at most
OMNIPRESSIX_SESSION_TTL, default 12 h). If the membership cannot be determined (error in the directory), the user stays signed in, but as a reader; the reason is in the log (docker logs). The same group types and rules apply as for the groups below; without a service account the user must be allowed to read the groups themselves.
What the reader sees: The header shows “Read and print only”. Card page, fields, layers, drawing and fonts on the left, the properties panel on the right, undo, “New” and “Save” are missing; fields cannot be clicked, editing keyboard shortcuts and the corresponding search commands (Ctrl+K) do not exist. What remains is card data (import, view, edit, choose cards to print), photos, templates (load and export, without saving, importing and deleting) and printing. Loading a template and printing the cards is the intended workflow; images dragged onto the window are always photos for readers, fonts and layout files are rejected.
Important – what the lock protects: The program enforces the role for everything that is stored on the server and applies to everyone: a request to save or delete templates without the administrator role is answered with “403 Forbidden”, even if someone bypasses the buttons. Designing in the browser (editing fields), on the other hand, only locks the user interface: it is your own working copy in the browser, which changes nothing on the server, and could be unlocked with the browser’s developer tools – a reader could then work on their copy and print, but could not change any template for others. If printing other people’s layouts is to be ruled out, the only help is write-protected templates and the print log, which records every job with the user.
Groups: Direct members of groupOfNames and AD groups (member), groupOfUniqueNames (uniqueMember) and posixGroup (memberUid) are recognised. Nested groups do not count.
Example Active Directory (variant A):
OMNIPRESSIX_LDAP_URL=ldaps://dc1.firma.local:636
OMNIPRESSIX_LDAP_BIND_DN=CN=svc-omnipressix,OU=Dienste,DC=firma,DC=local
OMNIPRESSIX_LDAP_BIND_PASSWORD_FILE=/run/secrets/ldap_passwort
OMNIPRESSIX_LDAP_BASE_DN=OU=Mitarbeiter,DC=firma,DC=local
OMNIPRESSIX_LDAP_USER_FILTER=(&(objectClass=user)(sAMAccountName=%s))
OMNIPRESSIX_LDAP_GROUP_DN=CN=OmniPressix,OU=Gruppen,DC=firma,DC=local
If signing in does not work: For security reasons the sign-in page only says “Benutzername oder Passwort falsch” (wrong user name or password); the exact reason (wrong service account, wrong search base, not in the group, certificate expired, …) is shown by docker logs.