1

Normally it is very easy to convert ssh and scp commands into tramp format for access via dired.

For example

The command line

ssh username@hostname

will become

/ssh:username@hostname:

in emacs.

Unfortunately, I'm unsure how to convert even the simplest CyberArk example command for use with tramp:

ssh username@target-username@target-hostname@cyberark-psm-hostname

Question

How will I be able to use TRAMP to connect via SSH when proxying through a CyberArk Privileged Session Manager server?

I found out this week I will not have access to CyberArk PSM for several more months so I will not be able to test any solutions on my own. My hope is that someone in the community has already figured out how to do this and will share their expertise. Thank you!

Melioratus
  • 4,504
  • 1
  • 25
  • 43

1 Answers1

1

I've never heard of CyberArk Privileged Session Manager, but from your description adding it to tramp-methods shouldn't be too hard. The simplest way is probably to add an entry with

 (add-to-list 'tramp-methods
             ("psm"
               (tramp-login-program "ssh")
               (tramp-login-args
                (("-l" "username")
                 ("-p" "%p")
                 ("%c")
                 ("-e" "none")
                 ("%u@%h@cyberark-psm-hostname")))
               (tramp-async-args
                (("-q")))
               (tramp-remote-shell "/bin/sh")
               (tramp-remote-shell-login
                ("-l"))
               (tramp-remote-shell-args
                ("-c"))))

Then you can use it by opening /psm:target-username@target-hostname:….

db48x
  • 15,741
  • 1
  • 19
  • 23
  • 1
    Wahoo!!! I successfully tested your answer in emacs 26.x after tweaking the values and adding some parameters from `sshx` and `scpx` tramp-methods. With the updates I was able to create new `psm-sshx` and `psm-scpx` tramp-methods. Unfortunately for me, when I tested the new config in emacs 25.1, I hit a known tramp bug `tramp-file-name-handler: Host ‘remote-hostname’ looks like a remote host, ‘psm-sshx’ can only use the local host`. As a temporary work around for emacs 25.1, I added an host alias in my `~/.ssh/config` and tramp works normally again. Thank you so much!!! – Melioratus Mar 12 '20 at 15:53