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

sshkey customization is ignored #142

Closed
supakeen opened this issue Mar 1, 2025 · 6 comments
Closed

sshkey customization is ignored #142

supakeen opened this issue Mar 1, 2025 · 6 comments
Labels
🐞 bug Something isn't working

Comments

@supakeen
Copy link
Member

supakeen commented Mar 1, 2025

The documented sshkey customization is not plumbed through in images. The struct exists but nothing seems to be generated on it.

$ cat sshkey.toml 
[[customizations.sshkey]]
user = "testuser"
key = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKNh/u8oWHfYwr01X8G8ijSC3hPfKfLpK8MISxg2mq1O [email protected]"
$ ./image-builder manifest --distro fedora-43 --blueprint sshkey.toml minimal-raw-zst | jq . | rg testuser     
$
@supakeen supakeen added the 🐞 bug Something isn't working label Mar 1, 2025
@supakeen
Copy link
Member Author

supakeen commented Mar 1, 2025

A workaround is to use the directories and files customization like so:

[[customizations.directories]]
path = "/home/testuser/.ssh"
mode = "0700"

[[customizations.files]]
path = "/home/testuser/.ssh/authorized_keys"
mode = "0600"
data = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKNh/u8oWHfYwr01X8G8ijSC3hPfKfLpK8MISxg2mq1O [email protected]"

@supakeen
Copy link
Member Author

supakeen commented Mar 1, 2025

@FrostyX, after a chat with @achilleas-k (see the linked PR) it turns out that the correct way to do this is by using the user customization instead. It's not written down super clearly in the documentation but it will modify a user if it already exists. Something like:

[[customizations.user]]
name = "testuser"
keys = ["ssh-edsa XXXX xxx"]

Is thus the way SSH keys could be added to users.

@FrostyX
Copy link

FrostyX commented Mar 1, 2025

Thank you both. I will test once I can and reopen if necessary.

@FrostyX
Copy link

FrostyX commented Mar 2, 2025

[[customizations.user]]
name = "testuser"
keys = ["ssh-edsa XXXX xxx"]

I don't think this works. Maybe I am looking in a wrong place, but ~/.ssh wasn't created for my user.

@supakeen supakeen reopened this Mar 2, 2025
@supakeen
Copy link
Member Author

supakeen commented Mar 2, 2025

I mixed things up. The user customization takes a single key as a string, see here

[[customizations.user]]
name = "testuser"
key = "ssh-edsa XXXX xxx"

@FrostyX
Copy link

FrostyX commented Mar 2, 2025

Thank you very much, this one works.
GitHub says I don't have the permission to close this issue, so feel free to do so.

@supakeen supakeen closed this as completed Mar 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐞 bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants