Recorded SSH sessions to devices that only accept a local account (root, appliance accounts) using Secret Vault + BYOV

Overview

Some devices can only be managed over SSH with a local account: hypervisor hosts that only allow root (for example XCP-ng), appliances with a single built-in admin account, or network devices that can’t authenticate against AD, LDAP or TACACS.

These devices fall under the Additional Supported Platforms in NPS-AM (no local account management or pre-configured activity steps), so by default you can only reach them with a Requester (your own AD identity) login.

This guide shows how to keep the local credential in the NPS vault and inject it into a proxied, recorded SSH session, with approval workflow and live monitoring, without ever revealing the password to the user.

This addresses the idea raised here: Local Account for SSH

How it works

  1. The device is onboarded as a Linux resource by IP, with no service account management.
  2. The local credential is stored in an NPS Secret Vault.
  3. NPS is configured as its own Bring Your Own Vault (BYOV) connector, which can check out credentials stored in a Secret Vault for use in an activity.
  4. An activity uses the Vault login account type with that connector.
  5. A pre-session PowerShell step strips the domain\ or resource\ prefix so the device receives only the plain username.
  6. The session runs through the NPS SSH proxy, so it is recorded and can be watched live.

Prerequisites

  • NPS-AM 26.03 (links below point to 26.03 docs)
  • Network connectivity from the NPS proxy service to the device on TCP/22
  • The local username and password for the device

Step 1: Onboard the device as a Linux resource

Add the device as a Linux resource using its IP address or DNS name. Use a dummy /any service account as it will not be used.

Note: host scans will not complete on devices that aren’t a standard supported Linux distribution. That is expected and doesn’t affect session launch.

Step 2: Create a Secret Vault and store the local credential

Create a Secret Vault resource, then add the local account (for example root) and its password.

Step 3: Create a BYOV connector that points to NPS itself

Go to Configuration > Integration Connectors and add a connector:

Field Value
Connector Template BYOV
API Url http://localhost:6500
App ID <Your Newly Created Vault Name>
Client Certificate leave blank
Skip Certificate Check selected
Checkout Script Block copy the script from the BYOV Connector Configuration page below
Checkin Script Block leave blank

Tip: if several devices use the same local username with different passwords, test credential matching in a lab first. The checkout script looks for an exact username match, then for <host>\<username>.

Step 4: Create the activity

Create a new activity:

Step 5: Strip the domain or resource prefix from the username

NPS passes the login account as domain\username or resource\username. A device that only knows the local account will reject that. Add a Run Custom PowerShell Script action in the Pre-Session (Grant) stage with the following script:

# This is how to access the current activity session
$activitySession = Get-SbPAMActivitySession -Id $SessionId
$username = $activitySession.loginaccountname

if ($activitySession.loginaccountname.contains('\'))
{
    ($domain,$username)=$activitySession.loginaccountname.Split('\')
}

$LoginAccount = $username

if ($LoginAccount -ne $activitySession.loginaccountname)
{
    # Change the loginaccount
    Set-SbPAMActivitySessionLoginAccount -SessionId $SessionId -LoginAccount $LoginAccount
}

Full write-up of this step: Removing domain from username in ssh connections

Step 6: Create the access policy

Create a resource-based access policy and add:

Step 7: Launch the session

From My Activities, select the activity and resource and create the session. When it shows Available, connect. NPS checks out the vaulted credential, passes the plain username to the device and proxies the SSH session.

Verify

Things to know

  • No automatic rotation. NPS doesn’t manage local accounts on these devices, so the password in the Secret Vault is static. Update it there when it changes, or add rotation logic to the BYOV Checkin Script Block if the device can be scripted against.
  • Shared accounts. If several people use the same local account, accountability comes from the NPS session record (requester, approver, recording), not from the device’s own logs.
  • Custom script. Step 5 is a custom PowerShell action. Retest after NPS upgrades.

Questions or results from other device types are welcome below.

4 Likes

Thanks for getting this written up, it’s incredibly helpful! I am seeing some odd behavior though when adding a resource manually. First it seems you have to tie a service account to the resource in order to be able to scan it. I simply created a dummy service account with random information for this purpose. However, when then adding those manually onboarded resources to an access policy for this activity, the activity won’t populate. Unless I add an additional resource that was not manually added, but was added and scanned successfully, none of my manual resources will be able to be used in the access policy. Have you seen that behavior? I am on NPS build 26.07.00001 if anyone else has had a similar issue.

The fact that your guide says to not assign a service account to these manually created resources seems impossible to do on my build of NPS unless I am missing a specific location to do so.

Hi @DavidHenry you do need a dummy or any service account, I have rectified the post.

The Access policy behaviour is unexpected. Have you chosen the platform?

I am on build Version 26.07.00001 and I created an Access policy and added a user, activity and the resource with dummy service account it works?

Are you able to launch the SSH session? Opening a support ticket might help.

Thanks for the clarification! I’m not sure if the resources needed to be “scanned” and fail with the dummy credentials first, but they do appear properly for use now. Thanks for this awesome writeup!