diff options
author | Joshua Watt <JPEWhacker@gmail.com> | 2023-11-03 08:26:32 -0600 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2023-11-09 17:33:03 +0000 |
commit | 8cfb94c06cdfe3e6f0ec1ce0154951108bc3df94 (patch) | |
tree | 046a6d0d98b0b1bfb1467b2d3e4bbc29b181eb9b /bitbake/bin | |
parent | 1af725b2eca63fa113cedb6d77eb5c5f1de6e2f0 (diff) | |
download | poky-8cfb94c06cdfe3e6f0ec1ce0154951108bc3df94.tar.gz |
bitbake: hashserv: Add become-user API
Adds API that allows a user admin to impersonate another user in the
system. This makes it easier to write external services that have
external authentication, since they can use a common user account to
access the server, then impersonate the logged in user.
(Bitbake rev: 71e2f5b52b686f34df364ae1f2fc058f45cd5e18)
Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/bin')
-rwxr-xr-x | bitbake/bin/bitbake-hashclient | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/bitbake/bin/bitbake-hashclient b/bitbake/bin/bitbake-hashclient index 328c15cdec..cfbc197e52 100755 --- a/bitbake/bin/bitbake-hashclient +++ b/bitbake/bin/bitbake-hashclient | |||
@@ -166,6 +166,7 @@ def main(): | |||
166 | parser.add_argument('--log', default='WARNING', help='Set logging level') | 166 | parser.add_argument('--log', default='WARNING', help='Set logging level') |
167 | parser.add_argument('--login', '-l', metavar="USERNAME", help="Authenticate as USERNAME") | 167 | parser.add_argument('--login', '-l', metavar="USERNAME", help="Authenticate as USERNAME") |
168 | parser.add_argument('--password', '-p', metavar="TOKEN", help="Authenticate using token TOKEN") | 168 | parser.add_argument('--password', '-p', metavar="TOKEN", help="Authenticate using token TOKEN") |
169 | parser.add_argument('--become', '-b', metavar="USERNAME", help="Impersonate user USERNAME (if allowed) when performing actions") | ||
169 | parser.add_argument('--no-netrc', '-n', action="store_false", dest="netrc", help="Do not use .netrc") | 170 | parser.add_argument('--no-netrc', '-n', action="store_false", dest="netrc", help="Do not use .netrc") |
170 | 171 | ||
171 | subparsers = parser.add_subparsers() | 172 | subparsers = parser.add_subparsers() |
@@ -251,6 +252,8 @@ def main(): | |||
251 | if func: | 252 | if func: |
252 | try: | 253 | try: |
253 | with hashserv.create_client(args.address, login, password) as client: | 254 | with hashserv.create_client(args.address, login, password) as client: |
255 | if args.become: | ||
256 | client.become_user(args.become) | ||
254 | return func(args, client) | 257 | return func(args, client) |
255 | except bb.asyncrpc.InvokeError as e: | 258 | except bb.asyncrpc.InvokeError as e: |
256 | print(f"ERROR: {e}") | 259 | print(f"ERROR: {e}") |