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

Add token path to Agent config Command block #958

Open
wants to merge 26 commits into
base: v3
Choose a base branch
from

Conversation

sean-breen
Copy link

@sean-breen sean-breen commented Jan 7, 2025

Proposed changes

Allow the data plane key to be loaded from a file by adding a new configuration option token-path under the Command section of the agent config file. Also refactored some code to create new functions addTransportCredentials and validateTokenFile which are used when creating the gRPC credentials.

  • If both token and token-path are set:
    • token-path will take priority
    • token field will be used as a fallback when the token-path file does not exist or is inaccessible
command:
  server:
    host: "127.0.0.1"             # Command server host
    port: 8888                    # Command server port
  tls:
    server_name: test-local-server
    ca: /tmp/ca.pem
    cert: /tmp/cert.pem
    key: /tmp/key.pem
    generate_self_signed_cert: true
  auth:
    token: "1a2b3c4d"    
    token-path: "path/to/secret-token"    # Path to a file containing the authentication token for the command sever        

Checklist

Before creating a PR, run through this checklist and mark each as complete.

  • I have read the CONTRIBUTING document
  • I have run make install-tools and have attached any dependency changes to this pull request
  • If applicable, I have added tests that prove my fix is effective or that my feature works
  • If applicable, I have checked that any relevant tests pass after adding my changes
  • If applicable, I have updated any relevant documentation (README.md)
  • If applicable, I have tested my cross-platform changes on Ubuntu 22, Redhat 8, SUSE 15 and FreeBSD 13

@github-actions github-actions bot added the chore Pull requests for routine tasks label Jan 7, 2025
@sean-breen sean-breen marked this pull request as ready for review January 8, 2025 14:33
@sean-breen sean-breen requested a review from a team as a code owner January 8, 2025 14:33
@sean-breen sean-breen changed the title Draft: Add token path to Agent config Add token path to Agent config Jan 8, 2025
@sean-breen sean-breen changed the title Add token path to Agent config Add token path to Agent config Command block Jan 8, 2025
internal/grpc/grpc.go Outdated Show resolved Hide resolved
internal/grpc/grpc.go Outdated Show resolved Hide resolved
internal/grpc/grpc.go Outdated Show resolved Hide resolved
internal/grpc/grpc.go Outdated Show resolved Hide resolved
internal/grpc/grpc.go Outdated Show resolved Hide resolved
internal/grpc/grpc.go Outdated Show resolved Hide resolved
internal/grpc/grpc.go Outdated Show resolved Hide resolved
@sean-breen sean-breen requested a review from dhurley January 10, 2025 11:30
internal/grpc/grpc.go Outdated Show resolved Hide resolved
}
}

func Test_getTransportCredentials(t *testing.T) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just wondering if the struct array is needed since there is only one test case

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not really needed, but I was going to leave it there in case of expansion in the future.

sean-breen and others added 5 commits January 15, 2025 15:09
@sean-breen sean-breen added the v3.x Issues and Pull Requests related to the major version v3 label Jan 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
chore Pull requests for routine tasks v3.x Issues and Pull Requests related to the major version v3
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants