This sample extends the generic Linux SSH password-management flow with account discovery. In addition to checking and changing passwords, it enumerates Unix accounts and group memberships and reports them back to Safeguard.
Platform Script: GenericLinuxWithDiscovery.json
A generic Linux host with local accounts in /etc/passwd, password hashes in /etc/shadow, and standard Unix identity commands such as id and awk.
| Operation | Description |
|---|---|
CheckSystem |
Verifies the service account can log in and access the required privileged data. |
CheckPassword |
Validates a managed-account password by comparing it to the /etc/shadow entry. |
ChangePassword |
Changes the managed-account password through the interactive passwd command. |
DiscoverAccounts |
Enumerates local accounts, UIDs, primary GIDs, and group memberships, then emits WriteDiscoveredAccount records. |
DiscoverSshHostKey |
Retrieves the SSH host key for trust-on-first-use style onboarding. |
- A Linux host reachable over SSH
- A service account with enough privilege to read
/etc/shadow, inspect/etc/passwd, and run the discovery pipeline commands (grep,wc,cut,tr,id, andawk) - An account-discovery job in SPP if you want to use
DiscoverAccounts
- Upload the script:
Import-SafeguardCustomPlatformScript -FilePath ./GenericLinuxWithDiscovery.json - Create a custom platform using this script
- Create an asset using the platform
- Configure service account and managed account(s)
- Test with
Test-SafeguardAssetAccountPassword -ExtendedLogging
The password-management operations follow the same interactive SSH pattern as the generic Linux sample. DiscoverAccounts logs in, sets a predictable shell environment, counts candidate accounts in /etc/passwd, then runs a shell pipeline that combines /etc/passwd data with id output to collect each user's UID, primary group, and supplemental groups. It parses the resulting lines with regex, writes one discovered account per match, and can still return partial results if the command times out after producing some data.
DiscoveryQuery- Required reserved parameter that enables account discovery in SPPDelegationPrefix- Privilege-elevation command used during password and discovery operationsUserKey- Optional SSH private key for the service accountRequestTerminal- Keeps the connection in interactive shell mode
- Discovers local
/etc/passwdaccounts only - The discovery operation can return partial results when the remote command times out
FuncUserDomainis declared for discovery but is not used by the sample's discovery login flow- Password validation and change still depend on
/etc/shadowaccess and Linuxpasswdprompts