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

Remote Agent Part1: bootstrap #622

Open
wants to merge 5 commits into
base: remote-agent
Choose a base branch
from

Conversation

iwangjintian
Copy link
Contributor

@iwangjintian iwangjintian commented Jan 26, 2025

Bootstrap changes are :

  1. Symphony control plane side to enable cert based authentication

  2. Symphony control plane side to trust specific CAs

  3. Symphony control plane side to trust specific subjectNames

  4. Symphony control plane side to have a file server to download agent

  5. Agent side to call file server to download symphony agent

  6. Agent side to call bootstrap endpoint

The bootstrap would exchange bootstrap certificate for working certificate. The bootstrap certificate now is pre-defined. (I randomly created a self-signed CA from cert manager and issued one client cert)
The bootstrap script would do this and start the agent. (we have a task to run the agent as a service)
The agent would use the topology.json to render the providers for it. And the http binding in remote agent serves purely as a client.

Copy link
Contributor

@msftcoderdjw msftcoderdjw left a comment

Choose a reason for hiding this comment

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

Approved this change as long as the file conflict is resolved. I still have comments, please take a look and fix in next improvement PR.

// Set the spec fields
spec := map[string]interface{}{
"secretName": secretName,
"duration": "2160h", // 90 days
Copy link
Contributor

Choose a reason for hiding this comment

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

Make these two values configurable.

target, err := c.TargetsManager.GetState(ctx, id, namespace)
if err != nil {
tLog.InfofCtx(ctx, "V (Targets) : onBootstrap target %s in namespace %s not found", id, namespace)
err := json.Unmarshal(request.Body, &target)
Copy link
Contributor

Choose a reason for hiding this comment

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

User new JsonUnmarshal function.

})
}
var topology model.TopologySpec
json.Unmarshal(request.Body, &topology)
Copy link
Contributor

Choose a reason for hiding this comment

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

New Json unmarshal function

assert.NotNil(t, authResponse.AccessToken)
assert.Equal(t, "Bearer", authResponse.TokenType)
}
// func TestTargetsOnBootstrap(t *testing.T) {
Copy link
Contributor

Choose a reason for hiding this comment

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

remove or modify?

}
fs := &fasthttp.FS{
Root: "/", // Directory to serve files from
IndexNames: []string{"index.html"},
Copy link
Contributor

Choose a reason for hiding this comment

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

What is this file?

key: "tls.crt"

- inLine: |
-----BEGIN CERTIFICATE-----
Copy link
Contributor

Choose a reason for hiding this comment

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

should we keep this inline?

echo "private.pem"
echo "remote-agent"

./remote-agent -config=$config -client-cert=./public.pem -client-key=./private.pem -target-name=$target_name -namespace=$namespace -topology=$topology
Copy link
Contributor

Choose a reason for hiding this comment

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

run as a service.

@@ -0,0 +1,21 @@
-----BEGIN CERTIFICATE-----
Copy link
Contributor

Choose a reason for hiding this comment

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

I doubt you cannot have this file checked in, especially when we backport this to extension repo.

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.

2 participants