Repository navigation
bootstrap: passwordless sudo for key-only platform users; groups once; inventory fixes - #19
Merged
Merged
Conversation
…udoers drop-in) A key-only platform user (no password in the platform) cannot answer sudo's prompt, so Ansible become and other automation over SSH could never act as root. setup_user now writes /etc/sudoers.d/90-teknoir-<user> with NOPASSWD for exactly that user, mode 0440, checked with visudo -cf before it is moved into place; with a password set the drop-in is removed again. Golden files regenerated (UPDATE_GOLDEN=1 go test in pkg/templates). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…login_user host var Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… message Every run appended the user to the users and sudo lines of /etc/group again (rpi4-8gb-black-se had it 12 times). Use usermod -aG when the user is not yet a member, with the old sed as a fallback. The message for a missing extra key no longer claims password-only login: the device key authorizes logins. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
With CREATE_USER=true (or an OS build) the user is created without a prompt, so the 'has to be created' warning was noise in every unattended run. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…in name; inventory reports left-out devices Review findings on the passwordless-sudo change: - The rule is '#<uid> ALL=(ALL:ALL) NOPASSWD: ALL' in /etc/sudoers.d/90-teknoir-platform-user. A user name can no longer become a sudoers keyword (a platform user 'ALL' would have given every account root), and the file name has no '.', which sudo's includedir skips. Drop-ins of earlier platform users (90-teknoir-<name>) are removed. - tnctl bootstrap now runs ValidateTemplateData before rendering, and the Username must be a lowercase login name (not root). - Group membership falls back to /etc/group when getent is missing. - Write and validation failures leave no drop-in and only warn. - ansible-inventory prints one stderr line per device it leaves out. - docs/commands/ansible.md: the plugin is deprecated; become; synchronize needs use_ssh_args and verify_host (else rsync skips the host key check). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ith noglob) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
becomeand tnctl could never act as root. The bootstrap now installs/etc/sudoers.d/90-teknoir-platform-userwith#<uid> ALL=(ALL:ALL) NOPASSWD: ALL.visudo -cfbefore it is moved into place.., which sudo's includedir would skip.tnctl bootstrapnow runsValidateTemplateDatabefore rendering.Usernamemust be a lowercase login name (^[a-z_][a-z0-9_-]{0,31}$) and notroot.users/sudoin/etc/groupagain; one staging device had it 12 times. The script now usesusermod -aGonly for missing memberships, falling back to/etc/groupwithout getent.ansible_teknoir_login_user.docs/commands/ansible.mdmarks the teknoir/ansible inventory plugin as deprecated and adds sections on become and onsynchronize.synchronizeneedsuse_ssh_argsandverify_host; otherwise rsync skips the host key check, because the module putsStrictHostKeyChecking=nofirst.CREATE_USER=true) no longer warn that the user "has to be created", and the missing-extra-key message is correct now.Review
An adversarial review found:
All are fixed in 041a614 and later. The stale-file cleanup uses
find, because the scripts run withnoglob.Tests
go vet,go test ./...andpkg/templatestests pass, with goldens regenerated after merging main (fix(bootstrap): onboarding and re-runs with tnctl (keys, k3s token, pull secret) #17, fix(bootstrap): keep the legacy artifact-registry-secret credential #20).90-teknoir-teknoiris removed;vm-rebootstrap-01on staging, fresh bootstrap and re-runs:tnctl ansible -bgives root asteknoirwithout a password.playbooks/rebootstrap-device.yml(an earlier commit of this branch).tnctl ansible all -b -m command -a 'id -u'returned 0 on all of them.🤖 Generated with Claude Code