Security Measures for the WebGIS Portal¶
This chapter is intended for administrators and operators. It describes which protection mechanisms WebGIS has built in,
which keys in api.config, portal.config and settings.config (CMS) adjust them, and which settings are recommended for an
installation on the internet or in an intranet.
Instructions for the first steps after the installation (changing default passwords, disabling self-registration and login) can be found under
Security Measures (Hardening).
At the end of the chapter, the table Overview of all security-relevant keys gives an overview of all security-relevant keys with risk level and recommendation.
Basic principles¶
Strong, individual passwords. Default passwords such as
admin123orwebgisauthorare particularly vulnerable to brute-force attacks, in which programs automatically try millions of passwords. A password likeadmin123is cracked within seconds, whereas a password of at least 12 characters (better 16+) made of upper and lower case letters, digits and special characters, unrelated to names or dictionary words, takes years. Every account should have its own password; a password manager helps to generate and store them. Where possible, two-factor authentication should be used (see Two-factor authentication (2FA/TOTP)). More on this: OWASP Authentication Cheat SheetHTTPS in the intranet, too. An intranet is not secure by default: employee devices can be infected, passwords and session information can be read or manipulated in the network, and modern browsers increasingly block unencrypted connections. The WebGIS Portal should therefore always be operated via HTTPS. More on this: Transport Layer Security Cheat Sheet
Restrict the administration. Access to the administration interfaces (CMS, subscriber login of the API) should be limited to a specific group of people or to the internal network. In public instances the login should be disabled completely (see Subscriber login and subscriber database).
Use browser protection mechanisms. Security headers such as
Strict-Transport-Security (HSTS)andContent-Security-Policy (CSP)are enabled on the web server or reverse proxy.Update regularly. Both WebGIS and servers, databases and third-party components.
Monitor logins. Who logged in and when is logged. Frequent failed logins or unusual access to the administration can indicate an attack.
Know the attack scenarios. Intranet applications, too, are affected by man-in-the-middle attacks, session hijacking or cross-site scripting (XSS). More on this: OWASP Top 10 Security Risks
Note
The following sections describe the behavior with default values. Most protection mechanisms are active by default. Settings that weaken a protection are marked as compatibility opt-out in the table Overview of all security-relevant keys.
Subscriber login and subscriber database¶
Map authors and administrators (subscribers) log in via /Subscribers/Login of the WebGIS API.
Subscribers are stored in a subscriber database (SQL database or file system), which is specified with the same value
subscriber-db-connectionstring in api.config and portal.config
(api.config, portal.config).
Access to the database or directory should be limited to what is necessary (dedicated
database user with minimal rights, file system permissions only for the application user).
Passwords are hashed with PBKDF2-SHA256; older hashes are converted automatically at the next successful login. Login error messages are kept generic and protected against guessing user names; logins are logged.
Two keys control whether the subscriber login is available at all (without an entry, both are false):
allow-subscriber-login(api.config, portal.config): If the value isfalse, no login is possible. In internet instances it should befalsein both files, so that no configuration from outside is possible even with a copied configuration. The configuration is then done in an internal instance that shares the storage.allow-register-new-subscribers(api.config): Allows the self-registration of new subscribers. It may only betrueduring the installation to create the first administrator, and never on the internet. Further accounts are created by the administrator afterwards.
For installations on the internet, if a login is required, the login via an identity provider (OpenID Connect) is the recommended variant.
Password rules¶
When a password is created or changed, the following applies (details):
Minimum length
password-min-length(default12).The password must not be in a built-in list of common passwords. Optionally, this list can be extended with
password-blocklist-file(e.g. with lists of compromised passwords).User name, first name, last name and e-mail address must not be contained; trivial patterns (
aaaaaaaaaaaa,123456789012) are rejected.Optionally, a number of character classes can be required with
password-required-character-classes(0-4). The default is0: a sufficient length in combination with the blocklist is more effective than composition rules.The default password
webgisauthorof the initial installation can no longer be set; whoever logs in with it has to change it immediately.
The rules only apply to new or changed passwords; existing passwords remain valid. Every subscriber can change their own password on the Account page.
Two-factor authentication (2FA/TOTP)¶
Subscribers can set up two-factor authentication with an authenticator app (TOTP) and
recovery codes on the Account page. The key mfa-required (details) determines
who has to use it: none (default, optional), admins or all. Affected subscribers are guided through the setup at their next
login. mfa-issuer determines the name shown in the authenticator app.
Internet: at least
admins, betterall.Intranet:
adminsrecommended.With an SQL database, the Setup page of the API has to be run once after the update (table
webgis_api_subscriber_mfa). As long as the table is missing, the login works without a second factor (even withmfa-required); a warning is logged.Basic Authentication and DataLinq still use only user name and password.
The MFA secrets are encrypted with the crypto key of the API. If it changes, the two-factor authentication of the subscribers has to be reset (administrators can do this).
Captcha, lockout and IP throttling¶
The login is protected against brute-force attacks (details):
Captcha: After
login-captcha-after-failed-attemptsfailed attempts (default3, per user name or client IP) a captcha has to be solved. Every captcha can be used once and is only valid forcaptcha-lifetime-minutes(default5).Lockout per user name: After
login-lockout-after-failed-attemptsfailed attempts (default10,0= no lockout) the user name is temporarily locked. The duration increases according tologin-lockout-minutes(default1,5,15, the last value is repeated). The counter is reset afterlogin-failed-attempts-reset-minutes(default60) without further failed attempts.Throttling per client IP: From
login-ip-max-failed-attemptsfailed attempts (default30,0= off) withinlogin-ip-window-minutes(default15), every login from this IP requires a captcha and is delayed. An IP is deliberately not blocked hard (shared addresses, e.g. behind NAT).Multiple instances: By default the counters are kept in the memory of the respective instance. With load balancing they can be shared via Redis:
login-throttle-redis-connectionstring.Password cache: Successful password verifications for Basic Authentication and DataLinq are kept in memory for
password-verification-cache-seconds(default300), because hashing is intentionally expensive.0disables the cache.
Important
The IP throttling requires that the API sees the real client IP. Behind a reverse proxy, the X-Forwarded headers must therefore be configured correctly (see Reverse proxy and client IP).
Redirects after login¶
The redirect target of the subscriber login is validated before an access token is appended (protection against
open redirect). The host of portal-url is always allowed; all other targets are rejected with 400 Bad Request.
If the portal is reachable under a different host name, these hosts can be allowed with
subscriber-login-allowed-redirect-hosts (details). Only
your own hosts should be entered.
Portal CORS¶
The hmac endpoint of the portal delivers credentials for the API to the logged-in user. It may only be called by the browser from
allowed pages; otherwise a malicious page could request keys for its visitors in the background. All other pages of the portal
can by default only be called with login (cookies) from the portal and the API themselves
(details, in depth: CORS and the HMAC endpoint):
add-cors-origins-for-hmac: third-party pages that may call thehmacendpoint (value~= all pages, for testing only).add-cors-origins-for-default: additional origins that may call the other portal pages with login. Normally no entry is necessary. Value~= all pages (for testing only, warning in the log file).cors-default-allow-any-origin-without-credentials: defaultfalse. Withtrue, foreign origins may read public portal pages without login.
The wildcard ~ must not be used in production environments.
Dynamic content (SSRF protection)¶
The DynamicContentProxy loads content (GeoRSS, GeoJSON, API queries) on behalf of the viewer. So that it cannot be abused for attacks
on internal systems (server-side request forgery), the following applies
(details):
Only
httpandhttpswithout user information are allowed. Targets that point to loopback, private, link-local (e.g. cloud metadata) or other non-public addresses are rejected. This also applies to every redirect. Certificates are validated.The proxy only loads signed URLs. The API signs the URLs when a map is loaded.
allow-hosts: host names or patterns that may also point to internal addresses. Default empty. Only enter concrete internal sources, no broad patterns.allow-unsigned: defaultfalse.truealso allows unsigned URLs (only for maps that are not loaded via the API, e.g. MapBuilder HTML orcustom.js).timeout-seconds(default20),max-response-bytes(default 50 MB) andmax-redirects(default5) limit the download.
The search terms of the selection lists (VisFilter lookups) are validated as well: term-whitelist in the lookup section
(details) determines which characters are allowed.
Outbound TLS connections¶
Server certificates of outbound HTTPS connections (map services, ArcGIS, WMS, etc.) are validated. Internal services with self-signed certificates or certificates of an internal CA should be connected by installing the CA in the certificate store of the server. Only if this is not possible, the validation can be turned off (man-in-the-middle risk). The key is:
allow-untrusted-server-certificatesin thesecuritysection ofapi.config(details) and ofportal.config(details),allow_untrusted_server_certificatesin thesettings.configof the CMS (details).
The default is false in each case. In practice, true should only be used for legacy services in trusted networks.
For the portal, the following also applies: use-local-url-scheme (portal.config, details) may only be
true in local or offline environments, because the key exchange is then done unencrypted via HTTP.
CSRF protection¶
The forms of the subscriber management of the API (login, registration, account, two-factor authentication) and further
write endpoints are protected against cross-site request forgery by anti-forgery tokens.
The key disable-anti-forgery (security section of api.config, details)
turns this check off (default false). This only makes sense in special cases, e.g. if the API serves exclusively as
a backend for another application or if a reverse proxy prevents the check. Do not use on the internet.
Secured endpoints¶
Maintenance endpoints such as cache/clear are reachable without authentication by default, so that maintenance (e.g. after a
CMS deployment) works. As soon as credentials are configured in the security section of api.config or portal.config,
the endpoint is only reachable with valid credentials
(api.config, portal.config):
secure-endpoint-url-password: password that is passed as the query parameterpwd.secure-endpoint-basicauth-usernameandsecure-endpoint-basicauth-password: credentials for HTTP Basic Authentication.
In publicly accessible instances these keys must be set; in the intranet it is recommended.
Reverse proxy and client IP¶
If the API runs behind a reverse proxy, it sees the IP address of the proxy instead of that of the client by default. Among other things, this impairs the IP throttling of the login (details):
use-x-forwarded-headers(middlewaresection): takes over the X-Forwarded headers (defaultfalse). Only enable behind a reverse proxy.x-forwarded-known-proxiesandx-forwarded-known-networks: The headers are only accepted from these trusted proxies (IP addresses or networks in CIDR notation), by default only fromlocalhost. Only enter the proxies that are actually used, no broad networks.use-x-forwarded-headers-logging: logs the headers (for troubleshooting only).
Security report¶
The API contains a page that rates the security-relevant keys of api.config: /SecurityReport
(a Security-Bericht tile in the subscriber admin; the page itself is currently German only). For each key the page shows the current value (secrets and
connection strings only as set / not set), the default, category and risk, and a rating for internet and intranet
installations side by side. The rating corresponds to the table Overview of all security-relevant keys. Below the table all
subscribers are listed with their 2FA status (user names only); administrators without 2FA are marked red.
The page is independent of the subscriber login, so it is also available if the login (allow-subscriber-login) is disabled.
Access works like for the secured endpoints with their credentials
(secure-endpoint-url-password as parameter pwd, Basic authentication or bearer token). If no credentials are
configured, the page is only reachable directly on the server (localhost, without proxy). When the API starts, the
deviations with high and medium risk are additionally written to the log (category WebGIS.Security.Audit).
Overview of all security-relevant keys¶
Categories
Compatibility opt-out: A protection is active by default and can be turned off or relaxed for reasons of backward compatibility. Enabling the exception weakens security and should only be done when needed and with knowledge of the risk.
Feature enablement: A function is only available after it has been enabled. Enabling it enlarges the attack surface.
Fine-tuning: Values used to adjust a protection mechanism (times, limits, credentials, lists).
Risk levels (impact of an insecure value or of enabling the exception; default values are chosen to be secure)
High: An attack is directly possible or a protection mechanism is completely bypassed (e.g. takeover of accounts, access to internal systems, eavesdropping on or manipulation of traffic).
Medium: The protection is noticeably weakened; an attack needs additional prerequisites.
Low: Minor impact; defense in depth.
Info: No direct impact on security; operational or informational key.
Keys are written as section:key if they are located in a section of the configuration file (e.g.
security:cookie-secure); the link leads to the description in the respective configuration documentation. The
recommendations apply to standard installations. Where not stated otherwise, the recommendation equals the default value.
Key |
File |
Category |
Risk |
Recommendation internet |
Recommendation intranet |
|---|---|---|---|---|---|
api.config |
Feature enablement |
High |
|
|
|
portal.config |
Feature enablement |
High |
|
|
|
api.config |
Feature enablement |
High |
|
|
|
api.config |
Fine-tuning |
Info |
Restrict access to the database or directory; identical value in api.config and portal.config |
Same as internet |
|
portal.config |
Fine-tuning |
Info |
As in api.config |
As in api.config |
|
api.config |
Fine-tuning |
Medium |
Leave empty or enter only your own hosts |
Same as internet |
|
api.config |
Fine-tuning |
Medium |
|
|
|
api.config |
Fine-tuning |
Medium |
|
|
|
api.config |
Fine-tuning |
Low |
e.g. |
Optional |
|
api.config |
Fine-tuning |
Medium |
|
|
|
api.config |
Fine-tuning |
Low |
|
|
|
api.config |
Fine-tuning |
Low |
Recommended: list of compromised passwords |
Optional |
|
api.config |
Fine-tuning |
Medium |
|
|
|
api.config |
Fine-tuning |
Medium |
|
|
|
api.config |
Fine-tuning |
Low |
|
|
|
api.config |
Fine-tuning |
Low |
|
|
|
api.config |
Fine-tuning |
Low |
|
|
|
api.config |
Fine-tuning |
Low |
|
|
|
api.config |
Fine-tuning |
Low |
Set with multiple instances (load balancing) |
Only with multiple instances |
|
api.config |
Fine-tuning |
Low |
|
|
|
api.config |
Fine-tuning |
Low |
|
|
|
api.config |
Fine-tuning |
Medium |
|
|
|
api.config |
Fine-tuning |
Info |
Name in the authenticator app |
Name in the authenticator app |
|
api.config |
Compatibility opt-out |
High |
|
|
|
portal.config |
Compatibility opt-out |
High |
|
|
|
settings.config (CMS) |
Compatibility opt-out |
High |
|
|
|
api.config |
Compatibility opt-out |
High |
|
|
|
api.config |
Fine-tuning |
Medium |
Set (strong password) |
Setting recommended |
|
api.config |
Fine-tuning |
Medium |
Set (together with the password) |
Setting recommended |
|
api.config |
Fine-tuning |
Medium |
Set (strong password) |
Setting recommended |
|
portal.config |
Fine-tuning |
Medium |
Set (strong password) |
Setting recommended |
|
portal.config |
Fine-tuning |
Medium |
Set (together with the password) |
Setting recommended |
|
portal.config |
Fine-tuning |
Medium |
Set (strong password) |
Setting recommended |
|
portal.config |
Compatibility opt-out |
High |
|
|
|
api.config |
Compatibility opt-out |
High |
Empty (public targets only) |
Only concrete internal host names, no broad patterns |
|
api.config |
Compatibility opt-out |
High |
|
|
|
api.config |
Fine-tuning |
Low |
|
|
|
api.config |
Fine-tuning |
Low |
|
|
|
api.config |
Fine-tuning |
Low |
|
|
|
api.config |
Fine-tuning |
Medium |
Default; only extend by characters that are actually needed |
Default |
|
portal.config |
Fine-tuning |
High |
Only required third-party pages; never |
Only required third-party pages; never |
|
portal.config |
Fine-tuning |
High |
Empty; never |
Empty; never |
|
portal.config |
Compatibility opt-out |
Low |
|
|
|
api.config |
Fine-tuning |
Medium |
|
|
|
api.config |
Fine-tuning |
Medium |
Only the proxies actually used |
Only the proxies actually used |
|
api.config |
Fine-tuning |
Medium |
Only the networks of the proxies used (CIDR), no broad networks |
Only the networks of the proxies used (CIDR), no broad networks |
|
api.config |
Fine-tuning |
Info |
|
|