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

Using agent token in cloud-init user-data #91

Open
10 tasks
runephilosof-karnovgroup opened this issue Jan 30, 2024 · 4 comments
Open
10 tasks

Using agent token in cloud-init user-data #91

runephilosof-karnovgroup opened this issue Jan 30, 2024 · 4 comments
Labels
bug Something isn't working security

Comments

@runephilosof-karnovgroup
Copy link

runephilosof-karnovgroup commented Jan 30, 2024

Some providers apply cloud-init to vps using http calls to a server in the network, some do it by providing a file etc to the vps.
The issue with the http api approach is that this endpoint can be called by all users of the vps and therefore could be called by a pipeline step to extract the agent-token.

Providers

Metadata/userdata/cloud-init is accessible to everything running on the agent, not only root.
So you should not save the woodpecker token in that.
Or alternatively, the server should invalidate the tokens after first use.

Originally posted by @runephilosof-karnovgroup in #15 (comment)

@anbraten
Copy link
Member

anbraten commented Feb 8, 2024

@runephilosof-karnovgroup Do you have an idea how we could get the token securely onto that machine?

Worst case we could ssh to that machine and save a file somehow. 🤔

Or alternatively, the server should should invalidate the tokens after first use.

That would be tough to achieve as it would break most other agent setups.

@runephilosof-karnovgroup
Copy link
Author

What is a valid use case of reusing agent specific registration tokens?
I am not suggesting invalidating the global agent registration token.

My own autoscaler uses the global agent registration token, because of this problem. It then matches up the agents with their agent IDs using their hostnames.

@anbraten
Copy link
Member

anbraten commented Feb 8, 2024

What is a valid use case of reusing agent specific registration tokens?

It's currently just "the specific" agent token which is also used to identify the agent again when re-connecting / after restarts. Woodpecker currently has nothing like a registration token AFAIK.

My own autoscaler uses the global agent registration token, because of this problem. It then matches up the agents with their agent IDs using their hostnames.

How do you inject the global token then if not via cloud-init? As part of the image?

@runephilosof-karnovgroup
Copy link
Author

runephilosof-karnovgroup commented Feb 8, 2024

What is a valid use case of reusing agent specific registration tokens?

It's currently just "the specific" agent token which is also used to identify the agent again when re-connecting / after restarts. Woodpecker currently has nothing like a registration token AFAIK.

I am suggesting it should have (in the other issue, let's keep that discussion there, it becomes confusing otherwise).

How do you inject the global token then if not via cloud-init? As part of the image?

Yes. I build it into the image.

@anbraten anbraten changed the title Woodpecker token is available to jobs Using agent token in cloud-init user-data Mar 17, 2024
@xoxys xoxys added bug Something isn't working security labels Mar 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working security
Projects
None yet
Development

No branches or pull requests

3 participants