Security

This page explains how Stacklane protects accounts and data, what you should do as an operator, and how to report a vulnerability.

Security model#

Accounts and roles#

Every user belongs to one organization. The organization owns the resources, invoices and API tokens. Within an organization, a user has one of these roles:

RoleAccess
administratorFull access, including users and roles
engineerManages resources
billingInvoices and company details
viewerRead only

Every customer endpoint limits its queries to the organization of the caller. A customer cannot see or change another organization's data.

Platform staff have a separate staff role: owner, admin, billing or support. Back-office endpoints require a staff role. Only owner and admin can change platform settings. The last owner cannot lose the role.

Passwords#

Sessions#

When a user signs in, Stacklane creates a session and returns two things:

Every access token names its session. Stacklane checks on every request that the session still exists and the user is still active. When a user signs out, or an administrator removes a session, the access token stops working at once.

When the access token expires, the browser uses the refresh cookie to get a new one:

Only a SHA-256 hash of the refresh secret is stored. Expired sessions are removed every hour.

Users can see their active sessions and their sign-in history in the portal.

Two-factor authentication#

Users can turn on two-factor authentication with a TOTP authenticator app. They get 10 recovery codes when they set it up.

An organization administrator can require two-factor authentication for all users of the organization. Users without two-factor authentication must then set it up before they can use the portal.

If a user loses both the app and the recovery codes, a server administrator can remove two-factor authentication with stacklane user reset-two-factor.

API tokens#

Users can create personal API tokens for scripts and integrations. A token has a role and an optional expiry date, and can be revoked.

See API for details.

Rate limits#

Stacklane limits how often some actions can be done. Limits are counted per client IP address, per account or per organization.

ActionLimit
All API requests1200 per minute per IP address
Sign-in30 per 10 minutes per IP address, and 10 per 15 minutes per account and IP address
Failed sign-insAfter 100 failed attempts for one account, sign-in to that account is blocked until the 15-minute window ends
Two-factor codes20 per 10 minutes per IP address, and 10 per 15 minutes per account
Sign-up6 per hour per IP address
Password reset and verification email10 per 15 minutes per IP address, and 3 per hour per email address
Password changes, two-factor changes, new recovery codes, signing out other sessions, showing a hosting account password10 per 10 minutes per user
New support tickets20 per hour per organization
Domain availability searches60 per 10 minutes per organization
Payments20 per 10 minutes per organization
Payment and DDoS webhooks300 per 5 minutes per IP address
Control panel sign-in30 per 10 minutes per organization

A request over the limit gets 429 Too Many Requests. The counters are kept in memory and reset when Stacklane restarts.

The panel also protects itself against overload:

These limits do not stop a large network attack. Use network-level DDoS protection in front of the panel.

Web interface#

Secrets at rest#

Stacklane encrypts these secrets with XChaCha20-Poly1305, using a key derived from the secret key:

The API never returns these secrets after they are saved.

Payments and webhooks#

Audit log#

Every change writes an audit record with:

Failed sign-ins and failed two-factor codes are also recorded. Organization administrators can read the audit log of their organization in the portal.

The trace ID comes from an incoming W3C traceparent header when there is one. Stacklane returns it in the X-Trace-Id response header. Use it to find the matching log lines and audit records.

Database access#

All database queries use static SQL with bound parameters. The Rust code forbids unsafe blocks.

Hardening recommendations#

Network#

  1. Keep server.listen on 127.0.0.1. Never expose the HTTP port to the internet.
  2. Put a reverse proxy with TLS in front of Stacklane and use an https address in server.public_url. See Installation.
  3. Set server.behind_proxy = true only when all traffic comes through your proxy.
  4. Use a firewall on the server. Allow only the ports of your proxy and SSH.
  5. Use network-level DDoS protection for the panel.
  6. Leave the webhook paths reachable: /api/billing/v1/webhooks/ for payment providers and /api/network/v1/ddos/events for your DDoS detector.

Secret key and backups#

  1. Do not change the owner or mode of /etc/stacklane/secret.key (stacklane:stacklane, 0600).
  2. Back up the key, but not in the same place as the database backups, or encrypt your backups. Anyone with both can read all stored credentials.
  3. Keep /etc/stacklane/stacklane.toml readable only by root and the stacklane group. It contains the SMTP password.
  4. Test your restore procedure. See Operations.

Accounts#

  1. Turn on two-factor authentication for every staff account.
  2. Give staff the lowest role they need. Use support or billing instead of admin where you can.
  3. Keep at least two owner accounts, so you do not lose access when one person is not available.
  4. Turn off public sign-up in Administration → Platform settings if you do not want customers to create accounts themselves.
  5. Keep Require a verified email address turned on.
  6. Remove staff roles from people who leave, with stacklane user staff --role none or in the back office.

Integrations#

  1. Give the Proxmox API token, panel accounts and registrar accounts only the permissions Stacklane needs.
  2. Use TLS for the connections to Proxmox, the hosting panels and your SMTP server. Keep the PowerDNS API on a private network.
  3. Rotate integration secrets when someone with access leaves.

Operations#

  1. Never enable cloud.simulate or billing.simulate on a production system.
  2. Install security updates of the operating system.
  3. Upgrade Stacklane when a new version comes out. Security fixes are released for the latest minor version only.
  4. Do not weaken the systemd sandbox. If you need changes, use a drop-in file and keep the sandbox settings.
  5. Review the audit log for iam.auth.login_failed events, and watch your proxy log for many 429 responses.

Reporting a vulnerability#

Do not open public issues for security problems. Use the Report a vulnerability button on the Security tab of the Stacklane repository on GitHub. Include:

You get an answer within three working days. You are kept informed until a fix is released.

Supported versions#

Security fixes are released for the latest minor version.

Scope#

In scope:

Out of scope: