Paper Lantern for cPanel accounts is being retired this year. Find out more »
cPanel & WHM Version 102 has been released, and brings a slew of great updates. Take a look at what is included, and then upgrade today!

ssh key support for create_remote_user_transfer_session

Terry Derks shared this idea 5 years ago
Open Discussion

WHM API create_remote_root_transfer_session supports ssh keys and passwords


WHM API create_remote_user_transfer_session only supports passwords

Use case:

This would be to automate account migrations between servers without having to grant those servers root access to each other or force a password reset for the cPanel user. The WHM API requests would be posted by key server which knows the .accesshash for the source and destination servers. Only that key server should have root access.

The idea is to basically use the functions like so. All API post requests are authenticated using the .accesshash

  1. new server: importsshkey (WHM API 1) # place a private key on root
  2. old server: SSH::importkey (cPanel API 2) # place the public key on the cpanel user
  3. old server: SSH::authkey (cPanel API 2) # authorize it to the cpanel user, not root
  4. new server: create_remote_user_transfer_session (WHM API 1) # since we're using keys, we don't need to reset the cPanel user's password
  5. new server: start_transfer_session (WHM API 1) # and so on with the move process

Leave a Comment
Attach a file