Skip to main content
Version: v46

SSH Target Configuration

SSH targets provide access to remote hosts using SSH.

This article describes configuring SSH services, host-key verification, and account access in PrivX. It also includes instructions for enabling personal-account access for directory users on Unix hosts. For general information about adding hosts and configuring accounts, see Setting Up Hosts.

Adding SSH Targets​

To add a host manually, start with the host information and options described in Adding Hosts. Then configure the SSH service and account settings below.

Alternatively, use the PrivX host-deployment script to add SSH targets automatically. The script also enables certificate-based authentication. For more information about using the host-deployment script, see Script-Based Certificate-Authentication Setup.

To allow connections to SSH hosts, add a host entry with the following considerations:

  1. Under Service, add a new service with the SSH type and specify the address and the port of the SSH server on the host.

  2. Expand Additional Settings and configure the options relevant to your connection:

    • If the Trust on first use option is disabled, add the SSH host keys to the service. In this case regular PrivX users can connect only if the host key matches one of the provided values. PrivX administrators can establish connections even if the host key is missing or incorrect.

    • To also allow non-administrator users to accept changed host keys, enable Trust on changed host keys. This can be useful in automated environments where host keys change frequently or unpredictably, and are not used for target verification.

      caution

      Allowing users to bypass SSH server validation with enabled Trust on changed host keys increases the risk of man-in-the-middle attacks. Enable this setting only in secure networks that verify hosts by other means.

    • Enable the Justification option if you want to require users to provide a justification before connecting to a host service. For configuration instructions, see Connection Justification.

  3. Under Accounts, add a new account and specify which PrivX roles may access the host, and which target accounts they are given access as.

    • The access options of the accounts can be limited under Allowed Service Options. By default, they all are enabled. You can change the default values in Administration → Settings → Host Store.

SSH Connections to Unix​

Before you begin, configure personal-account access as described in Automatic Account and Home Directory for Directory Users.

By default, directory users who have been granted access through PrivX still need the following before they can access target hosts successfully:

  • The PrivX-user's Unix account must be recognized on the target host. To accomplish this, configure the target host to support logins from the corresponding user directories.
  • The user's home directory should be created during their initial login.

The following example configures these features on a Debian-based host for AD users:

  1. Install the libnss-ldapd and nslcd LDAP name services.

  2. In /etc/nslcd.conf, specify the AD server address, bind credentials, search base, SSL options, and attribute mappings.

    Example /etc/nslcd.conf:

    # The user and group nslcd should run as.
    uid nslcd
    gid nslcd

    # Replace with the address of your AD service
    uri ldap://ad.example.com

    # Replace with the base DN for querying users
    base CN=Users,DC=example,DC=com

    # Replace with your bind credentials
    binddn Administrator@example.com
    bindpw example_password

    # Replace with your SSL options
    ssl start_tls
    tls_reqcert demand
    tls_cacertfile /etc/ssl/certs/ca-certificates.crt

    # The search scope.
    scope sub

    # Filter for finding users
    filter passwd (objectClass=person)

    # Map Unix attributes if they do not exist in your AD
    map passwd uid sAMAccountName
    map passwd homeDirectory "/home/$sAMAccountName"
    map passwd gecos displayName
    map passwd uidNumber unixUID
    map passwd gidNumber unixGID
  3. Allow LDAP authentication in the NSS configuration /etc/nssswitch.conf: add ldap to passwd, group, and shadow.

    passwd: compat ldap
    group: compat ldap
    shadow: compat ldap
  4. Restart the relevant services such as nscd and nslcd to apply your configuration changes. Run the following command to verify that the host recognizes the AD users:

    getent passwd

    If getent passwd dos not return AD users:

    • Run the LDAP name service nslcd in debug mode:
      systemctl stop nscd nslcd
      nslcd -d
    • Run getent passwd again and check the nslcd output for errors such as bind failures or missing user attributes. After debugging, restart the LDAP name services.
  5. Automatic home-directory creation is handled by the PAM module pam_mkhomedir. To enable PAM authentication on the OpenSSH server, configure the following in /etc/ssh/sshd.conf:

    ChallengeResponseAuthentication yes
    UsePAM yes
  6. Run pam-auth-update and enable Create home directory on login to set up automatic home-directory creation. After that restart OpenSSH server to apply the changes. PrivX-users with personal-account access to the host can now log in to the target host.