Skip to content

Unix socket support for trust bundle URL #5932

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

Merged
merged 22 commits into from
Apr 17, 2025

Conversation

kfox1111
Copy link
Contributor

@kfox1111 kfox1111 commented Mar 7, 2025

Pull Request check list

  • Commit conforms to CONTRIBUTING.md?
  • Proper tests/regressions included?
  • Documentation updated?

The trust_bundle_url option can talk to a unix socket in addition to an https server.

This allows code running on the local node to run without needing to race to open a tcp port increasing security and it does not require a https certificate increasing ease of maintenance while still maintaining security.

It also passes a bit of metadata to the remote so it can make programmatic policy decisions.

@kfox1111 kfox1111 mentioned this pull request Mar 13, 2025
@amartinezfayo
Copy link
Member

amartinezfayo commented Mar 18, 2025

It also passes a bit of metadata to the remote so it can make programmatic policy decisions.

I think that this is represented by the trust-domain, server-address, server-port and mode parameters that are set as query string parameters in this PR.
Could you expand on why is this needed and how it would be used?

Short sort answer, so that the plugin on the other side of the unix socket can use the metadata to make educated choices on what the best process is to attest the server (fetch the trust bundle) for this particular node.

Some of that is explained here:
#5950

But for example, take the spiffe-ha-agent https://github.com/spiffe/spire-ha-agent. I can extend the spire-ha-agent to have such a unix socket. spire-agent@a and spire-agent@b can both be configured to point at the same unix socket. The spire-ha-agent can hand over the correct trust bundle to the right agent based on the server-address information that the agent passes along.

There are other algorithms that may prioritize one source or another for fetching updated trust bundles, based on if the mode=bootstrap vs rebootstrap, the amount of time its been in the bootstrapping mode, etc.

Why would be different than using an URL with HTTPS?

It isnt. its switching the url from http over tcp socket to http over unix socket.

But, it also adds the ability to pass on additional metadata about the current spire-agent's attestation process along so that the plugin on the other side of the socket can make policy decisions based on it. This could be added to the tls mode url as well, though probably would need to be behind a new config option in that case, to prevent breakage.

Copy link
Member

@amartinezfayo amartinezfayo left a comment

Choose a reason for hiding this comment

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

Could you please update agent_full.conf with the new trust_bundle_unix_socket setting?
We also need to update spire_agent.md with this. It would be good to have some explanation about the use cases where the UDS support for the trust bundle URL can be leveraged.

if c.TrustBundleURL != "" {
u, err := url.Parse(c.TrustBundleURL)
if err != nil {
return fmt.Errorf("unable to parse trust bundle URL: %w", err)
}
if u.Scheme != "https" {
if c.TrustBundleUnixSocket != "" {
if u.Scheme != "https" && u.Scheme != "http" {
Copy link
Member

Choose a reason for hiding this comment

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

After putting some more thought on this, I think that we would support http only, at least initially. Use cases for https are not very clear for now.

kfox1111 and others added 6 commits April 10, 2025 15:55
Co-authored-by: Agustín Martínez Fayó <[email protected]>
Signed-off-by: kfox1111 <[email protected]>
Signed-off-by: Kevin Fox <[email protected]>
Signed-off-by: Kevin Fox <[email protected]>
Signed-off-by: Kevin Fox <[email protected]>
Signed-off-by: Kevin Fox <[email protected]>
Signed-off-by: Kevin Fox <[email protected]>
@kfox1111 kfox1111 force-pushed the trust-bundle-url-unix branch from 603972a to 801ba51 Compare April 11, 2025 14:55
Copy link
Member

@amartinezfayo amartinezfayo left a comment

Choose a reason for hiding this comment

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

Thank you @kfox1111!

@amartinezfayo amartinezfayo merged commit d76a21a into spiffe:main Apr 17, 2025
35 checks passed
@amartinezfayo amartinezfayo added this to the 1.12.1 milestone Apr 17, 2025
@kfox1111 kfox1111 deleted the trust-bundle-url-unix branch April 17, 2025 17:01
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