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:
-
Under Service, add a new service with the SSH type and specify the address and the port of the SSH server on the host.
-
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.
cautionAllowing 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.
-
-
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:
-
Install the
libnss-ldapdandnslcdLDAP name services. -
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 nslcdgid nslcd# Replace with the address of your AD serviceuri ldap://ad.example.com# Replace with the base DN for querying usersbase CN=Users,DC=example,DC=com# Replace with your bind credentialsbinddn Administrator@example.combindpw example_password# Replace with your SSL optionsssl start_tlstls_reqcert demandtls_cacertfile /etc/ssl/certs/ca-certificates.crt# The search scope.scope sub# Filter for finding usersfilter passwd (objectClass=person)# Map Unix attributes if they do not exist in your ADmap passwd uid sAMAccountNamemap passwd homeDirectory "/home/$sAMAccountName"map passwd gecos displayNamemap passwd uidNumber unixUIDmap passwd gidNumber unixGID -
Allow LDAP authentication in the NSS configuration
/etc/nssswitch.conf: addldaptopasswd,group, andshadow.passwd: compat ldapgroup: compat ldapshadow: compat ldap -
Restart the relevant services such as
nscdandnslcdto apply your configuration changes. Run the following command to verify that the host recognizes the AD users:getent passwdIf
getent passwddos not return AD users:- Run the LDAP name service
nslcdin debug mode:systemctl stop nscd nslcdnslcd -d - Run
getent passwdagain and check thenslcdoutput for errors such as bind failures or missing user attributes. After debugging, restart the LDAP name services.
- Run the LDAP name service
-
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 yesUsePAM yes -
Run
pam-auth-updateand 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.