Dev.to Security 🔐 Cybersecurity 👁 0 📖 4 min read

Casvisor 2.0: system accounts, SQL auditing, jobs and access requests in an open-source bastion host

Casvisor is an open-source bastion host, Apache-2.0, written in Go. People open SSH, RDP, VNC or Telnet sessions to your servers from a browser tab, or bring their own ssh, scp and VS Code through its SSH gateway. They o

Casvisor is an open-source bastion host, Apache-2.0, written in Go. People open SSH, RDP, VNC or Telnet sessions to your servers from a browser tab, or bring their own ssh, scp and VS Code through its SSH gateway. They only reach the assets a permission gives them, never see the servers' passwords, and every session is recorded.

When we first published the project, we wrote down what it did not do yet. This week we tagged 2.0.0, and most of that list is now in the release.

System accounts

An asset used to have one set of credentials, shared by everyone allowed to connect. Now an asset can carry several system accounts, for example root, deploy and readonly, and each permission says which account the user may connect with:

  • the asset's own account, an account with the same name as the user, all accounts, or a named account; a permission without an account keeps its old behaviour
  • the workbench lists one row per asset and account; on the SSH gateway the account goes in the user name: ssh -p 2222 alice@deploy@[email protected]
  • the password stays on the server. The browser only receives the account name, and the permission is checked again for that account when the session opens its WebSocket
  • rotate a password now, and Casvisor sets a fresh 24-character password on the server and signs in with it once to prove it works
  • push an account: if the server does not have it yet, Casvisor creates it (useradd -m on Linux, New-LocalUser over Windows OpenSSH)
  • rotate on a schedule, 30 days by default, with a retry an hour after a failure
  • revoking the permission, disabling or deleting the account disconnects the sessions that use it, immediately

Password changes are carried out through the asset's own account, which needs root, passwordless sudo, or Administrator on Windows. Only SSH assets support them for now.

Databases

MySQL, MariaDB and PostgreSQL are now asset types with a SQL console in the browser: databases, tables and columns on the left, run a selection or the whole editor, one tab per result.

  • every statement goes through the command rules before it is sent, and into the command records with its result
  • rules also match the statement with comments removed, so /* note */ DROP TABLE t is still caught; MySQL's executable /*! ... */ comments are kept
  • results stop at 1,000 rows; Copy and CSV export are separate permissions, and export is checked on the server against the account the session is using
  • a database session has no screen to record; its playback is the list of statements
  • network gateways and system accounts work for databases too

Jobs

/jobs runs one command, a Bash or PowerShell script, or a file copy on many SSH assets at once, picked by name or by tag, with a concurrency limit and a per-asset timeout. Each asset's output, exit code and duration are kept separately (the last 1 MB of output), failed assets can be retried on their own, and a job can be cancelled or copied. Every asset's run is a session, and command rules apply.

Access requests

Users can see which assets exist in the organization (name, protocol, tags, account names, but not addresses or passwords), ask for one with a reason and an end time, and must include the Connect action. An administrator approves, possibly narrowing the actions or the end time, and Casvisor creates the permission. Withdrawing it removes the permission and disconnects open sessions. Pending requests can be cancelled by the user.

Smaller additions

  • TOTP two-step verification for local accounts, with any authenticator app
  • session, command and operation logs export to CSV, and forward to syslog as RFC 5424 JSON or CEF, with exponential backoff on a dropped TCP connection
  • images and files can move between the browser and an RDP session through the clipboard
  • the SSH gateway forwards a local port to any asset: ssh -p 2222 -N -L 13306:db-01:3306 [email protected], then DBeaver or mstsc connects to localhost. This is a transparent tunnel: it is listed and logged as a session, but not recorded, and SQL is not parsed

What is still missing

  • a database client over port forwarding is not audited; only the browser console is
  • password rotation is SSH-only, and jobs on Windows assets have not been tested in production
  • no Ansible playbooks or scheduled jobs
  • access requests have no email or chat notification, and there is no login or command approval
  • syslog has no TLS, there are no reports, and recordings still live on the local disk
  • no Kubernetes terminal, asset tree or bulk import yet

Upgrading

docker pull casbin/casvisor:2.0.0, or download the archive for your platform from the releases page. The data stays in the database; existing permissions without an account behave as before.

Casvisor is Apache-2.0. Recording, the SSH gateway, network gateways and everything above are in the open-source project; there is no enterprise edition.

📰 Read the original article on Dev.to Security

Originally published by Dev.to Security. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.