diff --git a/README.md b/README.md index 2fd6cffc446c0c35a70d929a26acc337238480f9..c0ce3f0ea95c8043627162a7356242b142db85a8 100644 --- a/README.md +++ b/README.md @@ -17,16 +17,26 @@ Flags: ## Prerequisites -* The private key corresponding to the public key, used to create a compute instance, is required -* Only RSA PKCS #1 v1.5 is supported by OpenStack +Download and unzip the latest release for your operating system from the [releases](../../releases/latest) page. + +* The private key corresponding to the public key used to create a compute instance is required. +* Only RSA PKCS #1 v1.5 is supported by OpenStack. +* **OpenStack environment variables for authentication must be set.** These are typically sourced from an `openrc` file, which includes credentials like your OpenStack username, project, and authentication endpoint. Without these environment variables, the tool will not be able to authenticate with OpenStack. + +For reference, you can find simple examples of `openrc` files for Linux/macOS and Windows below: + +- [Example `openrc.sh` for Linux/macOS](openrc.sh) +- [Example `openrc.ps1` for Windows](openrc.ps1) ## TLS options -* `OS_CACERT` - environment variable with a path to custom CA certificate. +* `OS_CACERT` - environment variable with a path to a custom CA certificate. * `OS_INSECURE` - skip endpoint TLS certificate validation. Set to `true` **only if you are otherwise convinced of the OpenStack endpoint's authenticity**. ## Windows +Before using `nova-password` on Windows, make sure to source the OpenStack environment variables by running the `openrc.ps1` script. + ```sh .\openrc.ps1 .\nova-password.exe --private-key-path C:\Users\user\key.pem my-server @@ -35,3 +45,16 @@ Flags: # or .\nova-password.exe my-server -i C:\Users\user\.ssh\putty.ppk ``` + +## Linux / macOS + +Before using `nova-password` on Linux or macOS, ensure that the OpenStack environment variables are sourced by running the `openrc.sh` script. + +```sh +source ~/openrc.sh +nova-password --private-key-path ~/.ssh/id_rsa my-server +# or +nova-password 717433dc-4c2e-4d62-9467-6dd3715b2c6c server-name +# or +nova-password my-server -i ~/.ssh/putty.ppk +``` diff --git a/openrc.ps1 b/openrc.ps1 new file mode 100644 index 0000000000000000000000000000000000000000..3dccc71ab806d9dfb7b44b28d998847f358c8997 --- /dev/null +++ b/openrc.ps1 @@ -0,0 +1,9 @@ +$env:OS_AUTH_URL="http://keystone.local/v3" +$env:OS_IDENTITY_API_VERSION="3" +$env:OS_PROJECT_NAME="my-project" +$env:OS_PROJECT_DOMAIN_NAME="domain" +$env:OS_USERNAME="my-username" +$env:OS_USER_DOMAIN_NAME="domain" +$Password = Read-Host -Prompt "Please enter your OpenStack Password" -AsSecureString +$env:OS_PASSWORD = [Runtime.InteropServices.Marshal]::PtrToStringAuto([Runtime.InteropServices.Marshal]::SecureStringToBSTR($Password)) +$env:OS_REGION_NAME="region" diff --git a/openrc.sh b/openrc.sh new file mode 100644 index 0000000000000000000000000000000000000000..c172376f34336c50ecd287f417f30073e66e132d --- /dev/null +++ b/openrc.sh @@ -0,0 +1,10 @@ +export OS_AUTH_URL="http://keystone.local/v3" +export OS_IDENTITY_API_VERSION=3 +export OS_PROJECT_NAME="my-project" +export OS_PROJECT_DOMAIN_NAME="domain" +export OS_USERNAME="my-username" +export OS_USER_DOMAIN_NAME="domain" +echo "Please enter your OpenStack Password: " +read -sr OS_PASSWORD_INPUT +export OS_PASSWORD="${OS_PASSWORD_INPUT}" +export OS_REGION_NAME="region"