Skip to main content
Version: v46

Quick SSH Access

Use this quick setup to give a local PrivX user SSH access to a target host through the PrivX Web UI. You create a user and a role, map the user to the role, and grant the role access to the host’s root account.

To verify access, log in to PrivX as the new user and connect to the host using the root password. You can then enable certificate authentication so the user can connect without entering the target account password.

Prerequisites​

Before you begin, make sure you have:

  • A licensed PrivX deployment. For setup instructions, see Quick PrivX Setup.

  • A target host that the PrivX server can reach over SSH. For this example:

    • The PrivX server must be able to establish SSH connections to the target host.
    • The target host has a root account that can be connected to through SSH.

If you do not have a separate target host, you can use the PrivX server itself.

Adding Users and Permissions​

  1. Create the local PrivX user who will log in to the PrivX Web UI:

    1. Open the PrivX Web UI and log in as the superuser.

    2. Go to Administration → Users and click Add User.

    3. In the New User form, enter a username and password, complete the other required fields, and click Save.

  2. Create a role and use a mapping rule to make the local user a member. You will grant this role access to the target account when you add the host.

    1. Go to Administration → Roles, click Add Role and complete the other required fields.

    2. Under Mapping Rules, click Add Rule and set rules to match users to this role:

      1. Select Local users as the directory.
      2. In Search String, enter (principal=<username>). Replace <username> with the username you created in the step 1.

      In this example, we add a rule to include the local user(s) who have the principal alice into the role:

      Add Role view with Matching users showing one match

      Press Enter or click outside the field to update Matching Users. The count should be 1. The number of role members is indicated by Matching Users.

  3. Leave the other role settings at their defaults and click Save.

  4. To verify role membership, open the menu next to the role and select List Members. Check that the list includes the user you created.

    Role members view listing alice as a member

Adding Target Hosts​

Add the target host to PrivX and specify which role can access its root account:

  1. Go to Administration → Hosts and click Add Host.

  2. In the New Host form, enter a Name that users can recognize and add the host’s network address under Addresses.

  3. In the Services form, add an SSH service. Enter the fully qualified domain name (FQDN) and port of the SSH server. Enable Trust on first use under Additional Settings to allow users to accept the SSH host key when they first connect.

  4. In the Accounts form, add the root account. Under Roles, select the role you created.

    For this walkthrough, leave Password empty. When the user connects as root, PrivX prompts them for the target host’s root password. To let members of the same role connect without knowing that password, store it in PrivX. For instructions, see Granting SSH Access to Root Through Roles.

    note

    If you also configure an RDP service that uses domain accounts, enter the username in username@domain format. For example, enter Domain\Administrator as Administrator@Domain.

    Settings accounts on target host
  5. Click Save. The target host appears on the Hosts page.

Connecting with PrivX Web UI​

After you have set up roles to access hosts, you may test connections as follows:

  1. Log in to the PrivX Web UI with the username and password of the local PrivX user you created.

  2. Go to Connections → Hosts. Expand the target host and select its SSH service. If the host is missing, check that the user is a member of the role you selected for the host’s root account.

    Visualizing list of available hosts
  3. If prompted, verify and accept the SSH host key. When PrivX prompts you for the target account password, enter the host’s root password. The SSH session opens in the PrivX Web UI.

Enable Certificate Authentication​

To allow users to connect without entering the target account password, configure the target host to accept short-lived SSH certificates issued by PrivX.

To enable certificate authentication for OpenSSH connections, run the PrivX host-deployment script on the target host. The host-deployment script is a Python script that configures the OpenSSH server on the target host to accept certificates issued by PrivX. The script also sets up allowed principals for target users.

For full instructions, see Script-Based Certificate-Authentication Setup.

To obtain and run the host-deployment script:

  1. Create a host-deployment script:

    1. Log in to the PrivX Web UI as the superuser.

    2. Go to Deployment → SSH Target Hosts and in the SSH Target Host Configuration form:

      • Select Configure using a deployment script.
      • To delegate host-management and connection-management permissions at a more granular level, select from the drop-down menu the access group to which you want to deploy the host.
      • Click Add Script and download deploy.py when prompted.
  2. Upload deploy.py to the target host. You can use the File Transfers tab in a PrivX Web UI connection to the host.

  3. Execute the host-deployment script as root on the target host.

    In the command, use --principals to specify the target accounts and the roles that are allowed to access them. Also add the --standalone option if your target host is not hosted by a supported cloud provider.

    For example, allowing both the target accounts root and johndoe to be accessed by members of Example Role and privx-admin (replace /path/to/deploy.py with the path of the host-deployment script, note that role names with spaces need to be quoted):

    In the following example, members of the role you created or privx-admin can access both root and johndoe. Replace /path/to/deploy.py with the path to the uploaded script and <role-name> with the role name in both places. Keep the quotation marks if the name contains spaces.

    # python /path/to/deploy.py --standalone --principals \
    root="<role-name>",privx-admin:johndoe="<role-name>",privx-admin

To test certificate authentication, log in to PrivX as the local user you created and start a new SSH connection to the host’s root account. The session should open without prompting for the root password.

To verify certificate authentication on the target host, check the OpenSSH server logs. The following excerpt shows that the server accepted an RSA certificate for root:

Accepted publickey for root from 192.0.2.26 port 50930 ssh2: RSA-CERT \
ID alice@127.0.0.1:53188 serial 4920619392583124720 (serial 4920619392583124720) \
CA RSA 98:16:36:bf:6e:c6:3f:e5:a1:5e:31:61:c1:37:ef:d8