psmp vi editor

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements

Welcome Idira to LIVEcommunity!

Our community just got stronger! Explore new identity security resources, connect with experts, and discover more ways to learn and collaborate.

Meet Idira

psmp vi editor

L1 Bithead

Hi,

 

Does anyone know how to prevent psmp sessions from closing when users use a vi editor?

My users complain their psmp sessions close after running a vi edit command.

 

I tried a work around by adding |~ regex rule to the ShellPromptForAudit configuration. It seems to work for 90% of the cases.

 

For files which are large, my users get a connection closed by remote host with this error printed at the top of the ssh window. [Error: The complexity of matching the regular expression exceeded predefined bounds. Try refactoring the regular expression to make each choice made by the state machine unambiguous. This exception is thrown to prevent "eternal" matches that takes an indefinite period time to locate.]

 

Any help is appreciated.

5 REPLIES 5

L1 Bithead

full error message:

channel_handle_rfd: channel 0: PSServices Input fatal error occured [Error: The complexity of matching the regular expression exceeded predefined bounds. Try refactoring the regular expression to make each choice made by the state machine unambiguous. This exception is thrown to prevent "eternal" matches that takes an indefinite period time to locate.]

L7 Applicator

I don't think I've seen this error before, or at least haven't noticed it.

 

Do you have TerminateOnShellPromptFailure set to Yes?

 

What is the setting for PromptTimeout (if set)?

L7 Applicator

Hi @Aaron Tan​ 

 

It seems like you’re encountering a limitation with the regular expression in the ShellPromptForAudit configuration, specifically when users are working with large files in vi editor. Here are a few suggestions.

 

  1. Please try refactoring the regular expression to make it less complex in ShellPromptForAudit 
  2. Narrow down the scope of the regular expression to focus only on the specific prompts or patterns relevant to the PSMP sessions.
  3. Here is a basic example of a regular expression pattern that could potentially be used in the ShellPromptForAudit configuration to match common prompts in vi editor:

 

^(?:\[[0-9]+[a-zA-Z]*\])?\s*\w*@\w*(?:\:[\w\/]*)?\s*[^#$%>]*[#$%>]\s*

 

This regular expression attempts to match prompts commonly encountered in vi editor sessions, such as : for command mode or > for insert mode.

 

However, please note that this is a simplified example and may not cover all possible prompts or patterns in your specific environment.

 

Hope it helps !

Actually TerminateOnShellPromptFailure is set to No. But I have validated that the ShellPromptForAudit configuration is still in effect. Not sure if this is expected.

 

PromptTimeout is set to 300000.

L2 Linker

Malhar is correct, this was due to the complexity of your regex string you made in the ShellPromptForAudit parameter in a later version PSMP after 12.2.5.

 

Please note, PSMP is checking for prompt constantly to audit the keystrokes. Due to vi updating the whole terminal screen when launching (pushing everything as one output buffer). if the output is over the defined buffer limit, this issue will appear.

 

This does not affect nano because it pushes multiple smaller output buffers when it launches, therefore less characters has to be checked at a time against the regex.

 

Optimized regex patterns is considered a good practice (ie: .*) or ask the user using other edit tool ie: nano.

  • 229 Views
  • 5 replies
  • 0 Likes
Like what you see?

Show your appreciation!

Click Like if a post is helpful to you or if you just want to show your support.

Click Accept as Solution to acknowledge that the answer to your question has been provided.

The button appears next to the replies on topics you’ve started. The member who gave the solution and all future visitors to this topic will appreciate it!

These simple actions take just seconds of your time, but go a long way in showing appreciation for community members and the LIVEcommunity as a whole!

The LIVEcommunity thanks you for your participation!