Skip to main content

Credentials

A Collector reads most about a host when it can log in to it. Credentials are the logins it uses: SSH for Linux and other Unix-like hosts, WinRM for Windows, and SNMP for printers, switches, routers and other network devices. Without a credential, a host is still found and listed, but Starhive only knows that it answered and on which ports.

How secrets are protected​

When you save a credential, your browser encrypts its secret (password, private key, community or passphrases) for each Collector you choose. Starhive stores only the encrypted copy and can't read it. Only those Collectors can, with the private key each one created when it was installed, which never leaves its machine. Secrets are never written to logs or to scan results.

This has a few consequences:

  • Editing a credential without changing its secret: leave the secret empty, and the current one is kept.
  • Letting another Collector use it, or changing an SNMP credential's version or turning on its privacy: enter the secret again, as the new copy has to be encrypted in your browser.
  • Revoking a Collector drops the copies encrypted for it. A credential that no active Collector can open any more is marked No Collector. Edit it and enter the secret again for another Collector.

Add a credential​

Add a Collector first: a credential is locked to the Collectors that may use it.

  1. Go to Settings → Discovery, and under Credentials, click Add credential.
  2. Give it a Name, for example Linux servers.
  3. Under Log in with, choose SSH, WinRM (Windows) or SNMP (printers, network), and fill in its login (see below).
  4. Under Use only for, list the addresses, ranges or host names it may be tried against, one per line, such as 10.0.1.0/24, 10.0.2.10-10.0.2.20 or web01.corp.example. It's never tried anywhere else, so a login for one part of your network isn't sent to the rest.
  5. Under Collectors that may use it, choose the Collectors that scan those addresses.
  6. Click Encrypt and save.

When several credentials cover a host, the one that worked there last time is tried first.

SSH​

A Username, and either a Password or a Private key (with its Key passphrase, if it has one).

The account doesn't need to be root: everything the Collector runs on Linux only reads. The one exception is the host's serial number and hardware UUID, which Linux only shows to root. To have them read, allow the account to run just that one read-only command with sudo, with a line like this in a sudoers file (replace scan with the account's name):

scan ALL=(root) NOPASSWD: /usr/bin/grep -H . /sys/class/dmi/id/product_serial /sys/class/dmi/id/product_uuid

Use the path to grep that command -v grep prints on the host: on some systems, such as Alpine or older Debian and Ubuntu, it's /bin/grep, and a line with the wrong path doesn't match.

Without it, the host is scanned as usual, without its serial number and UUID.

The same goes for the names of the programs behind a host's network connections: any account can list the connections, but Linux tells only root which program holds another account's. To have them named, allow ss too, with the path command -v ss prints:

scan ALL=(root) NOPASSWD: /usr/bin/ss -tanp

Without it, the connections are still read, with only the scan account's own programs named.

WinRM (Windows)​

A Username, such as CORP\svc-scan, and a Password. The Collector tries WinRM over HTTPS (port 5986) first, then encrypted HTTP (port 5985). It logs in with NTLMv2, never Basic, so the password itself never reaches the host.

Set up the Windows hosts as described in Windows hosts below.

SNMP​

Choose SNMPv3 where your devices support it:

  • A Username.
  • Authentication: SHA-256 (the default), SHA-224, SHA-384, SHA-512, or SHA-1 for older devices.
  • Privacy (encryption): AES-128 (the default), AES-192 or AES-256 (each also in its Cisco variant), or none, which signs requests without encrypting them.
  • An Authentication passphrase and a Privacy passphrase, each at least 8 characters.

MD5, DES and SNMPv3 without authentication aren't supported.

SNMPv2c takes a Community. A v2c community travels unencrypted, so anyone on the network path can read it: prefer SNMPv3, and use a read-only community.

Windows hosts​

On Windows, the Collector logs in to a restricted PowerShell endpoint called StarhiveDiscovery. It can only run the handful of read-only commands the scan needs: it reads the computer, BIOS, operating system, processors, network adapters and addresses, physical disks, services, installed Windows updates, network connections, and the installed programs from the registry. Nothing in it can change the host or reach another computer. The scan account then needs no administrator rights of its own.

The endpoint's commands run as a local administrator account that Windows creates for each session. On a domain controller, that account is a member of Domain Admins. The endpoint still lets it run only the commands above, but you may prefer to scan domain controllers another way, or leave them out when you roll the endpoint out to all servers.

To set it up on a host, as an administrator, with the Collector's Windows download:

.\collector windows-endpoint > starhive-jea.ps1
powershell -ExecutionPolicy Bypass -File .\starhive-jea.ps1 -Account 'CORP\svc-scan'

-ExecutionPolicy Bypass lets the script run where the execution policy blocks local scripts, as it does by default on Windows 10 and 11, without changing the policy.

Name the scan account, or a group such as 'CORP\Starhive Scanners'. You can also roll the script out through Group Policy. Running it again replaces the endpoint, which is how you update it to a newer release's. The new endpoint allows only the accounts and groups given that time, so name all of them again, such as -Account 'CORP\svc-scan','CORP\Starhive Scanners'. -Remove instead of -Account removes the endpoint. Setting it up restarts the WinRM service. An endpoint set up with an older release can't read what newer releases added, such as disks, services, Windows updates and network connections: the rest of the host is still read, and setting the endpoint up again adds them.

Without the endpoint, the Collector needs an account that's an administrator on the host, or one that has been given WinRM and WMI remote access. Membership of Remote Management Users alone isn't enough.

Installed programs are read from the registry. Programs installed per user and Microsoft Store apps aren't listed.

Host keys​

The first time a Collector connects to a host, it remembers the host's SSH key (or its WinRM certificate, or its SNMPv3 engine). If that changes later, the Collector sends no credential to the host, and the host is listed as Host key changed: it could be another machine at the same address. This happens too when a host is reinstalled.

When you know why the key changed, open the host's newest scan in the profile's scan history, and click Trust new key on the host. It's offered only on the newest scan, as an older one may have seen another machine at that address, and only once the profile's Collector runs release 0.4.2 or later: an older one can't forget a key, so Starhive says to update it first. The profile's next scan forgets the key the Collector remembered for that address, trusts the one it finds there, and logs in with the scan's credentials. Until that scan, the host says its new key is trusted on the next scan. If you don't know why the key changed, find out first: if another machine has taken over the address, trusting its key sends it the credentials.