How to automate key passphrase entry process with robotframework without using an ssh-agent ?
Is It possible to use an alternate passpharse entry such as following? But with a such solution I loose RF login framework.
*** Settings ***
Library SSHLibrary
Library OperatingSystem
*** Variables ***
${HOST} example.com
${USERNAME} user
${PRIVATE_KEY} /path/to/private/key
${PASSPHRASE} YourPassphraseHere
*** Keywords ***
SSH Login With Passphrase
[Arguments] ${host} ${username} ${private_key} ${passphrase}
${output}= Run Process ssh -i ${private_key} ${username}@${host} stdout=PIPE stderr=PIPE stdin=PIPE
${stdout}= Get From Handle ${output.stdout}
${stderr}= Get From Handle ${output.stderr}
Should Not Contain ${stderr} Enter passphrase
Should Contain ${stdout} ${username}@${host}'s password:
Write ${output.stdin} ${passphrase}\n
${stdout_after_passphrase}= Get From Handle ${output.stdout}
Log ${stdout_after_passphrase}
Close All Handles
*** Test Cases ***
Example Test
SSH Login With Passphrase ${HOST} ${USERNAME} ${PRIVATE_KEY} ${PASSPHRASE}
# Perform other actions
Extracted comments from parakimo source code, connect function:
If a private key requires a password to unlock it, and a password is
passed in, that password will be used to attempt to unlock the key.
[…]
:param str password:
Used for password authentication; is also used for private key decryption if passphrase is not given
Why using same password for login and to unlock authentification keys?