PSM Session Hangs for SSH when logon account is associated

PSM Session Hangs for SSH when logon account is associated

133
Created On 11/10/26 11:02 AM - Last Modified 11/10/26 12:59 PM


Symptom


When running a Unix SSH session with PSM, the SSH session hangs. This will occur when there is a logon account associated with the target account.


Environment


11.1;11.2;11.3;11.4;11.5;11.6;11.7;12.1;12.2;12.6;12.7;13.0;13.2 Privileged Access Manager (PAM, self-hosted);Privilege Cloud PSM;Privileged Session Management (PSM) PSM

Cause


When executing an SSH session through PSM, it uses a specific login sequence.
The sequence itself is specified in the AutoLogonSequenceWithLogonAccount
in Options-Connection Components-{PSM-SSH}-Target Settings-Client Specific
parameter in the PVWA.


The object is a standard regular expression. By default, it is looking for a
standard Unix prompt of the form [username@hostname ~]$, and then will issue
an exec su - command in order to login as the actual root user.
(NOTE: Security best practice is to limit root login to only the actual
console. Users that have administrative rights will either su as in this case
or use sudo (or its equivalent) to get root access.)

Depending on the operating system, the logon account associated with the root
user may not always have the default prompt. If the default prompt is not seen
by the PSM, then the login session will hang and eventually time out.


Resolution


There are a couple of different ways to solve this particular problem.

1) Change the prompt at the user level to the default expected by the PSM:

Note that the command options will vary by operating system, so it is
recommended to test the actual commands.

The prompt uses a combination of the "whoami" and "hostname" commands. The
path and options to these commands will vary by operating system. For example:
Solaris: Use /usr/ucb/whoami and /usr/bin/hostname
CentOS: Use /usr/bin/whoami and /bin/hostname -s

To get the path of a particular command, use the which command.
For example, which whoami will return the location of the whoami command.
In addition, some operating systems will require the use of the escape
operator \ to escape some characters that the shell treats as special
characters.

Before implementing a new prompt, it is recommended to test the prompt before
using PSM

--
1. Login to the system as the associated login user
2. Depending on the shell that is invoked, follow the instructions below
--
Bourne shell (sh):
1. As the associated logon account, open the .profile with an editor.
2. Enter the following line in the file:
PS1="[`/usr/bin/whoami`@/bin/hostname` ~]$ "
3. Save the file
--

Korn shall(ksh):
This is the same as Bourne shell, except that the .kshrc file needs to be
modified
--

Bash shell (bash)
This is the same as the Bourne shell, except that the .bashrc file needs to
be modified
--

For Bourne, Korn and bash, test the login prompt as follows:
Bourne: . ~/.profile
ksh: . ~/.kshrc
bash: . ~/.bashrc

C-Shell (csh)
1. Open the .cshrc file with a text editor
2. Enter the following line in the file:
set prompt="[`/usr/bin/whoami`@/bin/hostname` ~]$ "
3. Save the file

Test the login prompt by: source ~/.cshrc
--
Note that most C-Shell prompts use the "%" prompt as opposed to the "$"
prompt. To maintain this convention, the regular expression needs to be
modified.

--
2) Change the regular expression:
==
CAUTION: Making changes to the regular expressions may cause the following
issues if not done correctly
* Error message when attempting to connect through PSM
* Exposure of the root password at the SSH login prompt on the PSM
==

A regular expression that will work with most Unix variants is the following:
(.*\$)|(.*%) >exec su - {Username}
Password:>{Password}

==
CAUTION: It is CRITICAL that the "Password:>{Password}" be on a separate line.
In the regex they will appear as though they are on the same line. If the
"Password:>{Password}" prompt is not on a separate line then the root password
could be exposed!
==
--
1. Log into the PVWA as a user authorized to make configuration changes (usually this is the
administrator user)
2. Navigate to the "Administration" page (v8 and higher) or the "System Configuration" page (v7)
3. Go to the object, which is contained in Options -> Connection Components ->
"PSM-SSH" -> Target Settings -> Client Specific ->
AutoLogonSequenceWithLogonAccount

4. Click the "Value" where a separate popup window appears
5. Copy and paste the regular expression (above) into the popup window
6. Click OK
7. Click "Apply" to save the changes
8. Restart the PSM
--


Additional Information


Details

SYMPTOM:

When running a Unix SSH session with PSM, the SSH session hangs. This will occur when there is a logon account associated with the target account.

 

PROBLEM:

When executing an SSH session through PSM, it uses a specific login sequence.
The sequence itself is specified in the AutoLogonSequenceWithLogonAccount
in Options-Connection Components-{PSM-SSH}-Target Settings-Client Specific
parameter in the PVWA.

 

The object is a standard regular expression. By default, it is looking for a
standard Unix prompt of the form [username@hostname ~]$, and then will issue
an exec su - command in order to login as the actual root user.
(NOTE: Security best practice is to limit root login to only the actual
console. Users that have administrative rights will either su as in this case
or use sudo (or its equivalent) to get root access.)

Depending on the operating system, the logon account associated with the root
user may not always have the default prompt. If the default prompt is not seen
by the PSM, then the login session will hang and eventually time out.

 

SOLUTION:

There are a couple of different ways to solve this particular problem.

 

1) Change the prompt at the user level to the default expected by the PSM:


Note that the command options will vary by operating system, so it is
recommended to test the actual commands.

The prompt uses a combination of the "whoami" and "hostname" commands. The
path and options to these commands will vary by operating system. For example:
Solaris: Use /usr/ucb/whoami and /usr/bin/hostname
CentOS: Use /usr/bin/whoami and /bin/hostname -s

To get the path of a particular command, use the which command.

For example, which whoami will return the location of the whoami command.

In addition, some operating systems will require the use of the escape
operator \ to escape some characters that the shell treats as special
characters.

Before implementing a new prompt, it is recommended to test the prompt before
using PSM

 

1. Login to the system as the associated login user

2. Depending on the shell that is invoked, follow the instructions below


Bourne shell (sh):
1. As the associated logon account, open the .profile with an editor.
2. Enter the following line in the file:
PS1="[`/usr/bin/whoami`@/bin/hostname` ~]$ "
3. Save the file

Korn shall(ksh):
This is the same as Bourne shell, except that the .kshrc file needs to be
modified

Bash shell (bash)
This is the same as the Bourne shell, except that the .bashrc file needs to
be modified

For Bourne, Korn and bash, test the login prompt as follows:

Bourne: . ~/.profile
ksh: . ~/.kshrc
bash: . ~/.bashrc

C-Shell (csh)
1. Open the .cshrc file with a text editor
2. Enter the following line in the file:
set prompt="[`/usr/bin/whoami`@/bin/hostname` ~]$ "
3. Save the file

Test the login prompt by: source ~/.cshrc

 

Note that most C-Shell prompts use the "%" prompt as opposed to the "$"
prompt. To maintain this convention, the regular expression needs to be
modified.

 

2) Change the regular expression:

CAUTION: Making changes to the regular expressions may cause the following
issues if not done correctly
* Error message when attempting to connect through PSM
* Exposure of the root password at the SSH login prompt on the PSM

 

A regular expression that will work with most Unix variants is the following:


(.*\$)|(.*%) >exec su - {Username}
Password:>{Password}

 

CAUTION: It is CRITICAL that the "Password:>{Password}" be on a separate line.
In the regex they will appear as though they are on the same line. If the
"Password:>{Password}" prompt is not on a separate line then the root password

could be exposed!

 

1. Log into the PVWA as a user authorized to make configuration changes (usually this is the

administrator user)

2. Navigate to the "Administration" page (v8 and higher) or the "System Configuration" page (v7)

3. Go to the object, which is contained in Options -> Connection Components ->
"PSM-SSH" -> Target Settings -> Client Specific ->
AutoLogonSequenceWithLogonAccount

4. Click the "Value" where a separate popup window appears

5. Copy and paste the regular expression (above) into the popup window

6. Click OK

7. Click "Apply" to save the changes

8. Restart the PSM




Actions
  • Print
  • Copy Link

    https://knowledgebase.paloaltonetworks.com/KCSArticleDetail?id=kA1hj0000001DPsCAM&lang=en_US&refURL=http%3A%2F%2Fknowledgebase.paloaltonetworks.com%2FKCSArticleDetail