Improved code in gam upload sakey.

This commit is contained in:
Ross Scroggs
2024-04-26 08:33:50 -07:00
parent 941fe97785
commit 6b8170dd2f
7 changed files with 29 additions and 16 deletions

View File

@@ -864,13 +864,13 @@ gam delete sakeys <ServiceAccountKeyList>+ [doit]
``` ```
## Upload a Service Account key to a service account with no keys ## Upload a Service Account key to a service account with no keys
There are two cases where you will use this command: There are two cases where you will use this command:
* Your workspace is configured to disable service account private key uploads. * 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, eith mamually or with the `gam delete sakeys` command. * 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 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. any `oauth2service.json` file to other users, you must redistribute the updated file with the new key.
``` ```
gam upload sakey gam upload sakey [admin <EmailAddress>]
(algorithm KEY_ALG_RSA_1024|KEY_ALG_RSA_2048)| (algorithm KEY_ALG_RSA_1024|KEY_ALG_RSA_2048)|
((localkeysize 1024|2048|4096 [validityhours <Number>])| ((localkeysize 1024|2048|4096 [validityhours <Number>])|
(yubikey yubikey_pin yubikey_slot AUTHENTICATION (yubikey yubikey_pin yubikey_slot AUTHENTICATION

View File

@@ -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 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 ### 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. 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 ### 6.74.02
Fixed bug in `gam <UserTypeEntity> print shareddrives ... formatjson` that caused a trap. Fixed bug in `gam <UserTypeEntity> print shareddrives ... formatjson` that caused a trap.

View File

@@ -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$ rm -f /Users/admin/GAMConfig/oauth2.txt
admin@server:/Users/admin/bin/gamadv-xtd3$ ./gam version 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 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 <ross.scroggs@gmail.com> Ross Scroggs <ross.scroggs@gmail.com>
Python 3.12.3 64-bit final Python 3.12.3 64-bit final
MacOS Sonoma 14.4.1 x86_64 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>del C:\GAMConfig\oauth2.txt
C:\GAMADV-XTD3>gam version C:\GAMADV-XTD3>gam version
WARNING: Config File: C:\GAMConfig\gam.cfg, Section: DEFAULT, Item: oauth2_txt, Value: C:\GAMConfig\oauth2.txt, Not Found 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 <ross.scroggs@gmail.com> Ross Scroggs <ross.scroggs@gmail.com>
Python 3.12.3 64-bit final Python 3.12.3 64-bit final
Windows-10-10.0.17134 AMD64 Windows-10-10.0.17134 AMD64

View File

@@ -3,7 +3,7 @@
Print the current version of Gam with details Print the current version of Gam with details
``` ```
gam version 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 <ross.scroggs@gmail.com> Ross Scroggs <ross.scroggs@gmail.com>
Python 3.12.3 64-bit final Python 3.12.3 64-bit final
MacOS Sonoma 14.4.1 x86_64 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 Print the current version of Gam with details and time offset information
``` ```
gam version timeoffset 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 <ross.scroggs@gmail.com> Ross Scroggs <ross.scroggs@gmail.com>
Python 3.12.3 64-bit final Python 3.12.3 64-bit final
MacOS Sonoma 14.4.1 x86_64 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 Print the current version of Gam with extended details and SSL information
``` ```
gam version extended 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 <ross.scroggs@gmail.com> Ross Scroggs <ross.scroggs@gmail.com>
Python 3.12.3 64-bit final Python 3.12.3 64-bit final
MacOS Sonoma 14.4.1 x86_64 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 Path: /Users/Admin/bin/gamadv-xtd3
Version Check: Version Check:
Current: 5.35.08 Current: 5.35.08
Latest: 6.75.00 Latest: 6.75.01
echo $? echo $?
1 1
``` ```
@@ -72,7 +72,7 @@ echo $?
Print the current version number without details Print the current version number without details
``` ```
gam version simple gam version simple
6.75.00 6.75.01
``` ```
In Linux/MacOS you can do: In Linux/MacOS you can do:
``` ```
@@ -82,7 +82,7 @@ echo $VER
Print the current version of Gam and address of this Wiki Print the current version of Gam and address of this Wiki
``` ```
gam help gam help
GAM 6.75.00 - https://github.com/taers232c/GAMADV-XTD3 GAM 6.75.01 - https://github.com/taers232c/GAMADV-XTD3
Ross Scroggs <ross.scroggs@gmail.com> Ross Scroggs <ross.scroggs@gmail.com>
Python 3.12.3 64-bit final Python 3.12.3 64-bit final
MacOS Sonoma 14.4.1 x86_64 MacOS Sonoma 14.4.1 x86_64

View File

@@ -1406,7 +1406,7 @@ gam rotate sakey|sakeys retain_none
yubikey_serialnumber <Number> yubikey_serialnumber <Number>
[localkeysize 1024|2048|4096]) [localkeysize 1024|2048|4096])
gam upload sakey gam upload sakey [admin <EmailAddress>]
(algorithm KEY_ALG_RSA_1024|KEY_ALG_RSA_2048)| (algorithm KEY_ALG_RSA_1024|KEY_ALG_RSA_2048)|
((localkeysize 1024|2048|4096 [validityhours <Number>])| ((localkeysize 1024|2048|4096 [validityhours <Number>])|
(yubikey yubikey_pin yubikey_slot AUTHENTICATION|SIGNATURE (yubikey yubikey_pin yubikey_slot AUTHENTICATION|SIGNATURE

View File

@@ -2,12 +2,18 @@
Merged GAM-Team version Merged GAM-Team version
6.75.01
Improved code in `gam upload sakey`.
6.75.00 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. 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 6.74.02
Fixed bug in `gam <UserTypeEntity> print shareddrives ... formatjson` that caused a trap. Fixed bug in `gam <UserTypeEntity> print shareddrives ... formatjson` that caused a trap.

View File

@@ -12537,14 +12537,15 @@ def doUpdateSvcAcctKeys():
def doReplaceSvcAcctKeys(): def doReplaceSvcAcctKeys():
doProcessSvcAcctKeys(mode='retainnone') doProcessSvcAcctKeys(mode='retainnone')
# gam upload sakey|sakeys # gam upload sakey|sakeys [admin <EmailAddress>]
# (algorithm KEY_ALG_RSA_1024|KEY_ALG_RSA_2048)| # (algorithm KEY_ALG_RSA_1024|KEY_ALG_RSA_2048)|
# ((localkeysize 1024|2048|4096 [validityhours <Number>])| # ((localkeysize 1024|2048|4096 [validityhours <Number>])|
# (yubikey yubikey_pin yubikey_slot AUTHENTICATION # (yubikey yubikey_pin yubikey_slot AUTHENTICATION
# yubikey_serialnumber <String> # yubikey_serialnumber <String>
# [localkeysize 1024|2048|4096]) # [localkeysize 1024|2048|4096])
def doUploadSvcAcctKeys(): def doUploadSvcAcctKeys():
_, httpObj, _, _, _, _ = _getLoginHintProjectInfo(True) login_hint = getEmailAddress(noUid=True) if checkArgumentPresent(['admin']) else None
httpObj, _ = getCRMService(login_hint)
iam = getAPIService(API.IAM, httpObj) iam = getAPIService(API.IAM, httpObj)
if doProcessSvcAcctKeys(mode='upload', iam=iam): if doProcessSvcAcctKeys(mode='upload', iam=iam):
sa_email = GM.Globals[GM.OAUTH2SERVICE_JSON_DATA]['client_email'] sa_email = GM.Globals[GM.OAUTH2SERVICE_JSON_DATA]['client_email']