From 01fe0ea9b068c6c070fd29531b9718bf0672c782 Mon Sep 17 00:00:00 2001 From: hcourse-nydig Date: Wed, 4 Aug 2021 11:33:33 +0100 Subject: [PATCH 1/5] :bug: Fixes shell arguments being passed twice to aws command Removes first param from arg lists before calling aws cli. Fixes both bash and fish Resolves: #375, #376 --- bin/install.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/bin/install.sh b/bin/install.sh index 7020b0e..fcee2bf 100755 --- a/bin/install.sh +++ b/bin/install.sh @@ -98,10 +98,10 @@ if ! grep '^#OktaAWSCLI' "${bash_functions}" &>/dev/null; then cat <<'EOF' >>"${bash_functions}" #OktaAWSCLI function okta-aws { - withokta "aws --profile $1" "$@" + withokta "aws --profile $1" "${@:2}" } function okta-sls { - withokta "sls --stage $1" "$@" + withokta "sls --stage $1" "${@:2}" } EOF fi @@ -111,12 +111,12 @@ fishFunctionsDir="${PREFIX}/fish_functions" mkdir -p "${fishFunctionsDir}" cat <<'EOF' >"${fishFunctionsDir}/okta-aws.fish" function okta-aws - withokta "aws --profile $argv[1]" $argv + withokta "aws --profile $argv[1]" $argv[2..-1] end EOF cat <<'EOF' >"${fishFunctionsDir}/okta-sls.fish" function okta-sls - withokta "sls --stage $argv[1]" $argv + withokta "sls --stage $argv[1]" $argv[2..-1] end EOF From 998ecd2834fd3627467752eeffcaf8d75bc8d46b Mon Sep 17 00:00:00 2001 From: David Tanner Date: Wed, 4 Aug 2021 07:39:27 -0600 Subject: [PATCH 2/5] Fix profile issues for okta-aws and okta-sls --- bin/install.sh | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/bin/install.sh b/bin/install.sh index 7020b0e..232ce87 100755 --- a/bin/install.sh +++ b/bin/install.sh @@ -98,10 +98,10 @@ if ! grep '^#OktaAWSCLI' "${bash_functions}" &>/dev/null; then cat <<'EOF' >>"${bash_functions}" #OktaAWSCLI function okta-aws { - withokta "aws --profile $1" "$@" + OKTA_PROFILE="$1" withokta "aws --profile $1" "$@" } function okta-sls { - withokta "sls --stage $1" "$@" + OKTA_PROFILE="$1" withokta "sls --stage $1" "$@" } EOF fi @@ -111,12 +111,14 @@ fishFunctionsDir="${PREFIX}/fish_functions" mkdir -p "${fishFunctionsDir}" cat <<'EOF' >"${fishFunctionsDir}/okta-aws.fish" function okta-aws - withokta "aws --profile $argv[1]" $argv + set -lx OKTA_PROFILE "$argv[1]" + OKTA_PROFILE="$1" withokta "aws --profile $argv[1]" $argv end EOF cat <<'EOF' >"${fishFunctionsDir}/okta-sls.fish" function okta-sls - withokta "sls --stage $argv[1]" $argv + set -lx OKTA_PROFILE "$argv[1]" + OKTA_PROFILE="$1" withokta "sls --stage $argv[1]" $argv end EOF From b9036d96f4a1851ce2866d36701230dcc1d9452e Mon Sep 17 00:00:00 2001 From: Russ Sivak Date: Wed, 4 Aug 2021 13:56:33 -0400 Subject: [PATCH 3/5] changing oktadeveloper to oktadev --- Readme.MD | 10 +++++----- bin/Install-OktaAwsCli.ps1 | 2 +- bin/install.sh | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Readme.MD b/Readme.MD index 719c6a0..858711b 100644 --- a/Readme.MD +++ b/Readme.MD @@ -30,7 +30,7 @@ This tool has been verified to work on macOS Sierra, High Sierra, Windows Server 1. Run the following in a [PowerShell console](http://technet.microsoft.com/library/hh831491.aspx#start-windows-powershell) ```pwsh - Set-ExecutionPolicy -Scope Process -ExecutionPolicy unrestricted -Force; Invoke-Expression ((New-Object Net.WebClient).DownloadString('https://raw.githubusercontent.com/oktadeveloper/okta-aws-cli-assume-role/master/bin/Install-OktaAwsCli.ps1')); .$profile + Set-ExecutionPolicy -Scope Process -ExecutionPolicy unrestricted -Force; Invoke-Expression ((New-Object Net.WebClient).DownloadString('https://raw.githubusercontent.com/oktadev/okta-aws-cli-assume-role/master/bin/Install-OktaAwsCli.ps1')); .$profile ``` 2. Customize **%userprofile%\\.okta\\config.properties** and set **OKTA_ORG** and **OKTA_AWS_APP_URL** appropriately. For example, ```properties @@ -44,7 +44,7 @@ This tool has been verified to work on macOS Sierra, High Sierra, Windows Server `PREFIX` value (default: `~/.okta`): ```bash - PREFIX=~/.okta bash <(curl -fsSL https://raw.githubusercontent.com/oktadeveloper/okta-aws-cli-assume-role/master/bin/install.sh) -i + PREFIX=~/.okta bash <(curl -fsSL https://raw.githubusercontent.com/oktadev/okta-aws-cli-assume-role/master/bin/install.sh) -i ``` 2. Customize **~/.okta/config.properties** and set **OKTA_ORG** and **OKTA_AWS_APP_URL** appropriately. For example, @@ -75,7 +75,7 @@ Read more at [@tom-smith-okta's okta-awscli-java Docker repo](https://hub.docker Create a `.okta` directory in your home directory. For example, `~/.okta`. Download the latest release JAR and put it in `.okta`: -https://github.com/oktadeveloper/okta-aws-cli-assume-role/releases +https://github.com/oktadev/okta-aws-cli-assume-role/releases Create `~/.okta/config.properties` and set **OKTA_ORG** and **OKTA_AWS_APP_URL** appropriately. For example, @@ -121,7 +121,7 @@ The proxy URI _must_ be of the form `http://host:port/`. Both the host and port ## Compiling the application -The application was built and compiled with [JetBrains' IntelliJ IDEA](https://www.jetbrains.com/idea/). Note that you don't have to compile the application in order to be able to execute it, since the compiled executable (a JAR file) is available [on GitHub](https://github.com/oktadeveloper/okta-aws-cli-assume-role/releases). +The application was built and compiled with [JetBrains' IntelliJ IDEA](https://www.jetbrains.com/idea/). Note that you don't have to compile the application in order to be able to execute it, since the compiled executable (a JAR file) is available [on GitHub](https://github.com/oktadev/okta-aws-cli-assume-role/releases). ### Prerequisites First of all, it goes without saying that you will need to install the [Java SE 11x](http://www.oracle.com/technetwork/java/javase/downloads/index.html) or the [Java JDK 11x](https://www.oracle.com/technetwork/java/javase/downloads/jdk11-downloads-5066655.html). @@ -132,7 +132,7 @@ Then you will need [Maven 2 or later](https://maven.apache.org/install.html) to Get a single JAR with all dependencies: -Use ```git clone https://github.com/oktadeveloper/okta-aws-cli-assume-role.git``` to clone the repository locally. Then, build with Maven: +Use ```git clone https://github.com/oktadev/okta-aws-cli-assume-role.git``` to clone the repository locally. Then, build with Maven: ```bash mvn package diff --git a/bin/Install-OktaAwsCli.ps1 b/bin/Install-OktaAwsCli.ps1 index 4d30251..eae8e54 100644 --- a/bin/Install-OktaAwsCli.ps1 +++ b/bin/Install-OktaAwsCli.ps1 @@ -30,7 +30,7 @@ function Install-OktaAwsCli { New-Item -ItemType File -Path $HOME\.okta\uptodate -Force | Out-Null # .NET apparently doesn't default to TLS 1.2 and GitHub requires it [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12 - $LatestReleaseResponse = Invoke-RestMethod -Uri "https://api.github.com/repos/oktadeveloper/okta-aws-cli-assume-role/releases/latest" + $LatestReleaseResponse = Invoke-RestMethod -Uri "https://api.github.com/repos/oktadev/okta-aws-cli-assume-role/releases/latest" $Asset = $LatestReleaseResponse.assets | Where-Object { $_.content_type -eq "application/java-archive" } $Client = New-Object System.Net.WebClient $Client.DownloadFile($Asset.browser_download_url, "$Home\.okta\okta-aws-cli.jar") diff --git a/bin/install.sh b/bin/install.sh index 7020b0e..e475f2a 100755 --- a/bin/install.sh +++ b/bin/install.sh @@ -14,7 +14,7 @@ # See the License for the specific language governing permissions and # limitations under the License. # -repo_url="https://github.com/oktadeveloper/okta-aws-cli-assume-role" +repo_url="https://github.com/oktadev/okta-aws-cli-assume-role" dotokta="${HOME}/.okta" printusage() { From 03b281907e7dd67eb2efa7d429372c79271d4681 Mon Sep 17 00:00:00 2001 From: Russ Sivak Date: Wed, 4 Aug 2021 15:16:53 -0400 Subject: [PATCH 4/5] make grep for the location tag case insensitive --- bin/install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/install.sh b/bin/install.sh index ace79cf..37d91a2 100755 --- a/bin/install.sh +++ b/bin/install.sh @@ -80,7 +80,7 @@ PREFIX="$(cd -P -- "${PREFIX}" && pwd)" echo "Installing into ${PREFIX}" | sed "s#$HOME#~#g" mkdir -p ${PREFIX} -releaseUrl=$(curl -sLI ${repo_url}/releases/latest | grep -e "location:.*tag" | cut -c11-) +releaseUrl=$(curl -sLI ${repo_url}/releases/latest | grep -ie "location:.*tag" | cut -c11-) releaseTag=$(echo $releaseUrl | awk 'BEGIN{FS="/"}{print $8}' | tr -d '\r') url=${repo_url}/releases/download/${releaseTag}/okta-aws-cli-${releaseTag:1}.jar dest=${PREFIX}/$(basename ${url}) From 6cd0a81099ea9d37c8336a5c86293f7dc46ee1fa Mon Sep 17 00:00:00 2001 From: Russ Sivak Date: Wed, 4 Aug 2021 16:02:44 -0400 Subject: [PATCH 5/5] fixing fish --- bin/install.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/install.sh b/bin/install.sh index 37d91a2..edb8db1 100755 --- a/bin/install.sh +++ b/bin/install.sh @@ -112,13 +112,13 @@ mkdir -p "${fishFunctionsDir}" cat <<'EOF' >"${fishFunctionsDir}/okta-aws.fish" function okta-aws set -lx OKTA_PROFILE "$argv[1]" - OKTA_PROFILE="$1" withokta "aws --profile $argv[1]" $argv[2..-1] + withokta "aws --profile $argv[1]" $argv[2..-1] end EOF cat <<'EOF' >"${fishFunctionsDir}/okta-sls.fish" function okta-sls set -lx OKTA_PROFILE "$argv[1]" - OKTA_PROFILE="$1" withokta "sls --stage $argv[1]" $argv[2..-1] + withokta "sls --stage $argv[1]" $argv[2..-1] end EOF