add two env vars to pass password/keyphrase (#9)

MSCP_SSH_AUTH_PASSWORD passes a password, and MSCP_SSH_AUTH_PASSPHRASE
passes a passphrase for publickey auth. They enable avoiding interactive
password input. Test cases are also added.
This commit is contained in:
Ryo Nakamura
2024-02-06 10:35:38 +09:00
parent 9908fb309d
commit ff45d9d71b
11 changed files with 172 additions and 20 deletions

View File

@@ -72,6 +72,17 @@ struct mscp_ssh_opts {
bool enable_nagle; /** enable Nagle's algorithm if true */
};
/** @def
* Environment variable that passes password for ssh password auth
*/
#define ENV_SSH_AUTH_PASSWORD "MSCP_SSH_AUTH_PASSWORD"
/** @def
* Environment vraible that passes passphrase for private key
*/
#define ENV_SSH_AUTH_PASSPHRASE "MSCP_SSH_AUTH_PASSPHRASE"
/**
* @struct mscp_stats
* @brief Structure to get mscp statistics