Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No grpc mode master #80

Merged

Conversation

awsjohns
Copy link

@awsjohns awsjohns commented Nov 14, 2023

This change creates a "no-grpc" RPM, gRPC build-dependencies are removed. Use-cases that need gRPC are not supported. Use-cases like EKS with SMB file share mounting are supported.
To use this feature, the environment variable CF_CRED_SPEC_FILE must be set before starting the daemon.
The use-case is documented here: https://github.com/awsjohns/credentials-fetcher/blob/no-grpc-mode-master/doc/eks_smb_use_case.md

Tested using a single credspec on Amazon Linux 2.

@awsjohns awsjohns changed the base branch from mainline to no-grpc-mode-master November 14, 2023 04:44
@awsjohns awsjohns marked this pull request as draft November 14, 2023 04:44
awsjohns and others added 8 commits November 14, 2023 04:49
ctest runs self tests while building RPM

Log from "rpmbuild -ba ~/rpmbuild/SPECS/credentials-fetcher.spec"
+ cd credentials-fetcher-v.1.2.0
+ ctest3
  /home/ec2-user/rpmbuild/BUILDROOT/credentials-fetcher-no-grpc-1.2.0-3.amzn2.x86_64//usr/sbin/credentials-fetcherd
-t
Test project /home/ec2-user/rpmbuild/BUILD/credentials-fetcher-v.1.2.0
    Start 1: check_help
1/2 Test #1: check_help .......................   Passed    0.00 sec
    Start 2: run_self_test
2/2 Test #2: run_self_test ....................   Passed    0.01 sec

100% tests passed, 0 tests failed out of 2
* Added credspec.json self-test during RPM build
* Enabled verbose logging of ctest3
* Reformatted code using clang-format

Log from "rpmbuild -ba ~/rpmbuild/SPECS/credentials-fetcher.spec":
...
+ cd credentials-fetcher-v.1.2.0
+ CF_CRED_SPEC_FILE=/home/ec2-user/rpmbuild/BUILDROOT/credentials-fetcher-no-grpc-1.2.0-3.amzn2.x86_64//usr/sbin/credentials_fetcher_sample_credspec.json
+ ctest3 -V /home/ec2-user/rpmbuild/BUILDROOT/credentials-fetcher-no-grpc-1.2.0-3.amzn2.x86_64//usr/sbin/credentials-fetcherd -t
UpdateCTestConfiguration  from :/home/ec2-user/rpmbuild/BUILD/credentials-fetcher-v.1.2.0/DartConfiguration.tcl
UpdateCTestConfiguration  from :/home/ec2-user/rpmbuild/BUILD/credentials-fetcher-v.1.2.0/DartConfiguration.tcl
Test project /home/ec2-user/rpmbuild/BUILD/credentials-fetcher-v.1.2.0
Constructing a list of tests
Done constructing a list of tests
Updating test list for fixtures
Added 0 tests to meet fixture requirements
Checking test dependency graph...
Checking test dependency graph end
test 1
    Start 1: check_help

1: Test command: /home/ec2-user/rpmbuild/BUILD/credentials-fetcher-v.1.2.0/credentials-fetcherd "--help"
1: Test timeout computed to be: 10000000
1: Usage:
1: Runtime Environment Variables:
1: CF_CRED_SPEC_FILE=<credential spec file>:<optional lease_id>
1:      <credential spec file>  Set to a path of a json credential file.
1:      <optional lease_id>     Use an optional colon followed by a lease identifier (Default: credspec)
1:
1: Allowed options
1:   --help                     produce help message
1:   --self_test                Run tests such as utf16 decode
1:   --verbosity                set verbosity level
1:   --aws_sm_secret_name       Name of secret containing username/password in AWS Secrets Manager (in same region)
1:   --version                  Version of credentials-fetcher
1/2 Test #1: check_help .......................   Passed    0.00 sec
test 2
    Start 2: run_self_test

2: Test command: /home/ec2-user/rpmbuild/BUILD/credentials-fetcher-v.1.2.0/credentials-fetcherd "--self_test"
2: Test timeout computed to be: 10000000
2: run diagnostic set
2: krb_files_dir = /var/credentials-fetcher/krbdir
2: cred_file =  (lease id: fixed_lease_id)
2: logging_dir = /var/credentials-fetcher/logging
2: unix_socket_dir = /var/credentials-fetcher/socket
2: Cred spec tests successful
2: read meta data file test is successful
2: <2>krb file path contains invalid characters
2: read invalid metadata test is successful
2: <2>directory path for kerberos tickets is not provided
2: krb dir not found test is successful
2: write meta data info to file test is successful
2/2 Test #2: run_self_test ....................   Passed    0.01 sec

100% tests passed, 0 tests failed out of 2
Prevent overwrite if secret name is provided as CLI option

Testing:
Built RPM with self-test
Rename to spec file to no-grpc
@awsjohns awsjohns marked this pull request as ready for review December 1, 2023 01:59
*  Added test_get_ticket_expiration()
*  Format with clang-format

Tests: Tested on AL2 and Ubuntu with 2 digit and 4 digit year formats in klist

klist with 4 digit year:
	Ticket cache: KEYRING:persistent:1000:1000
	Default principal: admin@CUSTOMERTEST.LOCAL

	Valid starting       Expires              Service principal
	12/04/2023 19:39:06  12/05/2023 05:39:06  krbtgt/CUSTOMERTEST.LOCAL@CUSTOMERTEST.LOCAL
	renew until 12/11/2023 19:39:04

klist with 4 digit year:
	Ticket cache: FILE:/tmp/krb5cc_2001112
	Default principal: Admin@CUSTOMERTEST.LOCAL

	Valid starting     Expires            Service principal
	12/04/23 21:58:51  12/05/23 07:58:51  krbtgt/CUSTOMERTEST.LOCAL@CUSTOMERTEST.LOCAL
	renew until 12/11/23 21:58:51
	12/04/23 21:58:51  12/05/23 07:58:51  EC2AMAZ-4MQOKF$@CUSTOMERTEST.LOCAL
@saikiranakula-amzn saikiranakula-amzn merged commit bd3c355 into aws:no-grpc-mode-master Dec 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants