Operating Systems

Secure Oracle Solaris with cnspec

Scan Oracle Solaris systems against security best practices with cnspec.

Scan your Oracle Solaris systems to find security risks before they become incidents. The Mondoo Oracle Solaris Security policy checks Solaris 11.4 systems for kernel and network hardening, exposed network services, SSH configuration, account and password settings, auditing, and software integrity. cnspec also exposes Solaris users, groups, SMF services, IPS packages, zones, ZFS pools and datasets, and file system metadata as queryable MQL resources, so you can write your own policies for the controls that matter most in your environment.

New to cnspec? Start with the Quickstart, or read the Operating systems overview to see every platform cnspec can secure.

Prerequisites

To query a Solaris system with cnspec, you must have:

cnspec doesn't run on Solaris itself. You run it on your workstation (or any Linux, macOS, or Windows host) and it connects to the Solaris system over SSH, so nothing is installed on the target.

Connect over SSH

To scan a remote Solaris system using SSH, authenticating with your SSH agent and any matching entry in ~/.ssh/config:

cnspec scan ssh user@HOST

To authenticate with a password, add --ask-pass and cnspec prompts you for it:

cnspec scan ssh user@HOST --ask-pass

To use an SSH key for authentication:

cnspec scan ssh user@HOST -i /path/to/identity_key

To scan using a specific port, include it in the target:

cnspec scan ssh user@HOST:2222

Scan with elevated privileges

On Solaris, root is usually a role you can't log in as directly, so you connect as a regular user. A few checks need root: the ones that read the audit configuration, /etc/shadow, and the sudo rules. If the user you connect as can run sudo, add --sudo so cnspec runs those checks with elevated privileges:

cnspec scan ssh user@HOST --sudo

cnspec elevates with sudo, or with doas if the target doesn't have sudo installed. It doesn't use pfexec. Make sure the user you connect as has a sudo rule (for example, in /etc/sudoers.d/) that lets it run commands without an interactive password prompt.

Without --sudo, cnspec skips the checks that need root instead of reporting them as failures.

Scan with the Mondoo Oracle Solaris Security policy

The Mondoo Oracle Solaris Security policy has 71 checks for Oracle Solaris 11.4, grouped into these areas:

  • Kernel and process hardening, such as ASLR, non-executable stacks and heaps, and setuid core dumps
  • Network stack settings, such as IP forwarding, source routing, and ICMP redirects
  • Network services, such as telnet, FTP, the r-services, NFS, SNMP, and graphical login
  • SSH server configuration, including file permissions, ciphers, MACs, and key exchange algorithms
  • Accounts and authentication, such as the root role, login retries, password hashing, and password length
  • Permissions on sensitive files such as /etc/passwd and /etc/shadow
  • Auditing and logging
  • Software integrity for IPS packages and publishers
  • Firewall and time synchronization
  • Privilege escalation through sudo

Each failed check includes remediation steps as shell commands and Ansible tasks.

Mondoo Platform users: Enable the policy in your space. In the Mondoo App, go to Findings > Policies, search for "Solaris", and add the policy. To learn more, read Manage policies in Mondoo Platform.

Open source users: Pass the open-source policy bundle URL directly to cnspec:

cnspec scan ssh user@HOST --sudo \
  --policy-bundle https://raw.githubusercontent.com/mondoohq/cnspec/refs/heads/main/content/mondoo-solaris-security.mql.yaml

To scan with a policy you wrote yourself, pass its file path to --policy-bundle instead.

When a scan completes, cnspec prints a summary of the checks it ran, grouped by policy. Each check shows a pass or fail result, and the report ends with a risk score from 0 (no risk) to 100 (highest risk). Failed checks include remediation guidance. To send results to a file or change the output format (JSON, SARIF, and more), read Report Results.

Example checks

Open a cnspec shell to explore resources interactively:

cnspec shell ssh user@HOST --sudo

Ensure SSH root login is disabled

cnspec> sshd.config.params["PermitRootLogin"] == "no"
[ok] value: "no"

Ensure the SSH service is online

SMF services are identified by their full FMRI, so use svc:/network/ssh:default rather than an abbreviation such as ssh:

cnspec> service("svc:/network/ssh:default").running
[ok] value: true

List all online SMF services

cnspec> services.where(running) { name }

Ensure root login is restricted to the console

cnspec> parse.ini("/etc/default/login").params["CONSOLE"] == "/dev/console"
[ok] value: "/dev/console"

Ensure only root has UID 0

cnspec> users.where(uid == 0).all(name == "root")
[ok] value: true

List installed IPS packages

cnspec> packages.where(name == /openssl/) { name version }

List zones and their isolation settings

cnspec> solaris.zones { name state brand ipType }

Ensure every ZFS pool is healthy

cnspec> zfs.pools.all(health == "ONLINE")
[ok] value: true

List all listening ports and their processes

cnspec> ports.listening { port protocol address process.executable }

These are just a few examples. To go beyond the Mondoo Oracle Solaris Security policy, create your own policies with the checks that matter most for your Solaris environment.

Learn more

On this page