From 6b8170dd2fdfbf457aaf3c8738846c2d38447da7 Mon Sep 17 00:00:00 2001 From: Ross Scroggs Date: Fri, 26 Apr 2024 08:33:50 -0700 Subject: [PATCH] Improved code in `gam upload sakey`. --- docs/Authorization.md | 6 +++--- docs/GamUpdates.md | 8 +++++++- docs/How-to-Upgrade-from-Standard-GAM.md | 4 ++-- docs/Version-and-Help.md | 12 ++++++------ src/GamCommands.txt | 2 +- src/GamUpdate.txt | 8 +++++++- src/gam/__init__.py | 5 +++-- 7 files changed, 29 insertions(+), 16 deletions(-) diff --git a/docs/Authorization.md b/docs/Authorization.md index a069f6d4..2d2e1c00 100644 --- a/docs/Authorization.md +++ b/docs/Authorization.md @@ -864,13 +864,13 @@ gam delete sakeys + [doit] ``` ## Upload a Service Account key to a service account with no keys There are two cases where you will use this command: -* Your workspace is configured to disable service account private key uploads. -* All of your service account keys have been deleted, eith mamually or with the `gam delete sakeys` command. +* Your workspace is configured to disable service account private key uploads and you are creating a project. +* All of your service account keys have been deleted, either manually or with the `gam delete sakeys` command. The `oauth2service.json` file is updated with the new private key. If you had previously distributed any `oauth2service.json` file to other users, you must redistribute the updated file with the new key. ``` -gam upload sakey +gam upload sakey [admin ] (algorithm KEY_ALG_RSA_1024|KEY_ALG_RSA_2048)| ((localkeysize 1024|2048|4096 [validityhours ])| (yubikey yubikey_pin yubikey_slot AUTHENTICATION diff --git a/docs/GamUpdates.md b/docs/GamUpdates.md index 5c162cc4..d565aa8a 100644 --- a/docs/GamUpdates.md +++ b/docs/GamUpdates.md @@ -10,12 +10,18 @@ Add the `-s` option to the end of the above commands to suppress creating the `g See [Downloads](https://github.com/taers232c/GAMADV-XTD3/wiki/Downloads) for Windows or other options, including manual installation +### 6.75.01 + +Improved code in `gam upload sakey`. + ### 6.75.00 -Updated `gam create project` to simplify handling the situation when your workspace is configured to disable service account private key uploads. +Updated `gam create project` to simplify handling the situation where your workspace is configured to disable service account private key uploads. Added command `gam upload sakey` to aid in this process. +* See: https://github.com/taers232c/GAMADV-XTD3/wiki/Authorization#upload-a-service-account-key-to-a-service-account-with-no-keys + ### 6.74.02 Fixed bug in `gam print shareddrives ... formatjson` that caused a trap. diff --git a/docs/How-to-Upgrade-from-Standard-GAM.md b/docs/How-to-Upgrade-from-Standard-GAM.md index 3c94a144..ccee9186 100644 --- a/docs/How-to-Upgrade-from-Standard-GAM.md +++ b/docs/How-to-Upgrade-from-Standard-GAM.md @@ -335,7 +335,7 @@ writes the credentials into the file oauth2.txt. admin@server:/Users/admin/bin/gamadv-xtd3$ rm -f /Users/admin/GAMConfig/oauth2.txt admin@server:/Users/admin/bin/gamadv-xtd3$ ./gam version WARNING: Config File: /Users/admin/GAMConfig/gam.cfg, Section: DEFAULT, Item: oauth2_txt, Value: /Users/admin/GAMConfig/oauth2.txt, Not Found -GAMADV-XTD3 6.75.00 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource +GAMADV-XTD3 6.75.01 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource Ross Scroggs Python 3.12.3 64-bit final MacOS Sonoma 14.4.1 x86_64 @@ -1009,7 +1009,7 @@ writes the credentials into the file oauth2.txt. C:\GAMADV-XTD3>del C:\GAMConfig\oauth2.txt C:\GAMADV-XTD3>gam version WARNING: Config File: C:\GAMConfig\gam.cfg, Section: DEFAULT, Item: oauth2_txt, Value: C:\GAMConfig\oauth2.txt, Not Found -GAMADV-XTD3 6.75.00 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource +GAMADV-XTD3 6.75.01 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource Ross Scroggs Python 3.12.3 64-bit final Windows-10-10.0.17134 AMD64 diff --git a/docs/Version-and-Help.md b/docs/Version-and-Help.md index 85ad61d1..773b0d31 100644 --- a/docs/Version-and-Help.md +++ b/docs/Version-and-Help.md @@ -3,7 +3,7 @@ Print the current version of Gam with details ``` gam version -GAMADV-XTD3 6.75.00 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource +GAMADV-XTD3 6.75.01 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource Ross Scroggs Python 3.12.3 64-bit final MacOS Sonoma 14.4.1 x86_64 @@ -15,7 +15,7 @@ Time: 2023-06-02T21:10:00-07:00 Print the current version of Gam with details and time offset information ``` gam version timeoffset -GAMADV-XTD3 6.75.00 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource +GAMADV-XTD3 6.75.01 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource Ross Scroggs Python 3.12.3 64-bit final MacOS Sonoma 14.4.1 x86_64 @@ -27,7 +27,7 @@ Your system time differs from www.googleapis.com by less than 1 second Print the current version of Gam with extended details and SSL information ``` gam version extended -GAMADV-XTD3 6.75.00 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource +GAMADV-XTD3 6.75.01 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource Ross Scroggs Python 3.12.3 64-bit final MacOS Sonoma 14.4.1 x86_64 @@ -64,7 +64,7 @@ MacOS High Sierra 10.13.6 x86_64 Path: /Users/Admin/bin/gamadv-xtd3 Version Check: Current: 5.35.08 - Latest: 6.75.00 + Latest: 6.75.01 echo $? 1 ``` @@ -72,7 +72,7 @@ echo $? Print the current version number without details ``` gam version simple -6.75.00 +6.75.01 ``` In Linux/MacOS you can do: ``` @@ -82,7 +82,7 @@ echo $VER Print the current version of Gam and address of this Wiki ``` gam help -GAM 6.75.00 - https://github.com/taers232c/GAMADV-XTD3 +GAM 6.75.01 - https://github.com/taers232c/GAMADV-XTD3 Ross Scroggs Python 3.12.3 64-bit final MacOS Sonoma 14.4.1 x86_64 diff --git a/src/GamCommands.txt b/src/GamCommands.txt index 2e22bb7f..0375148f 100644 --- a/src/GamCommands.txt +++ b/src/GamCommands.txt @@ -1406,7 +1406,7 @@ gam rotate sakey|sakeys retain_none yubikey_serialnumber [localkeysize 1024|2048|4096]) -gam upload sakey +gam upload sakey [admin ] (algorithm KEY_ALG_RSA_1024|KEY_ALG_RSA_2048)| ((localkeysize 1024|2048|4096 [validityhours ])| (yubikey yubikey_pin yubikey_slot AUTHENTICATION|SIGNATURE diff --git a/src/GamUpdate.txt b/src/GamUpdate.txt index 6c5302c4..3b214ca9 100644 --- a/src/GamUpdate.txt +++ b/src/GamUpdate.txt @@ -2,12 +2,18 @@ Merged GAM-Team version +6.75.01 + +Improved code in `gam upload sakey`. + 6.75.00 -Updated `gam create project` to simplify handling the situation when your workspace is configured to disable service account private key uploads. +Updated `gam create project` to simplify handling the situation where your workspace is configured to disable service account private key uploads. Added command `gam upload sakey` to aid in this process. +* See: https://github.com/taers232c/GAMADV-XTD3/wiki/Authorization#upload-a-service-account-key-to-a-service-account-with-no-keys + 6.74.02 Fixed bug in `gam print shareddrives ... formatjson` that caused a trap. diff --git a/src/gam/__init__.py b/src/gam/__init__.py index 5a0414fc..6e1c875d 100755 --- a/src/gam/__init__.py +++ b/src/gam/__init__.py @@ -12537,14 +12537,15 @@ def doUpdateSvcAcctKeys(): def doReplaceSvcAcctKeys(): doProcessSvcAcctKeys(mode='retainnone') -# gam upload sakey|sakeys +# gam upload sakey|sakeys [admin ] # (algorithm KEY_ALG_RSA_1024|KEY_ALG_RSA_2048)| # ((localkeysize 1024|2048|4096 [validityhours ])| # (yubikey yubikey_pin yubikey_slot AUTHENTICATION # yubikey_serialnumber # [localkeysize 1024|2048|4096]) def doUploadSvcAcctKeys(): - _, httpObj, _, _, _, _ = _getLoginHintProjectInfo(True) + login_hint = getEmailAddress(noUid=True) if checkArgumentPresent(['admin']) else None + httpObj, _ = getCRMService(login_hint) iam = getAPIService(API.IAM, httpObj) if doProcessSvcAcctKeys(mode='upload', iam=iam): sa_email = GM.Globals[GM.OAUTH2SERVICE_JSON_DATA]['client_email']