Skip to content

fix: decline to support fido2 multi drive setups#1109

Merged
RoyalOughtness merged 6 commits intosecureblue:livefrom
ShadowSlayer1441:fido2_root_fix
Aug 25, 2025
Merged

fix: decline to support fido2 multi drive setups#1109
RoyalOughtness merged 6 commits intosecureblue:livefrom
ShadowSlayer1441:fido2_root_fix

Conversation

@ShadowSlayer1441
Copy link
Copy Markdown
Collaborator

@ShadowSlayer1441 ShadowSlayer1441 commented Jun 8, 2025

Currently if you launch the fido2 autounlock script from a run0 terminal, it mostly works, but your recovery key is not saved because root doesn't have a home directory (at least not at /var/home/root/. Considering drive encryption is global to the machine, there's no reason to put the recovery key in a specific user's directory, thus always putting the recovery key in /var/home/ is an elegant solution.

Copy link
Copy Markdown
Collaborator

@HastD HastD left a comment

Choose a reason for hiding this comment

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

I think it's a little strange to put anything other than users' home directories in /var/home; I don't know of anything else that does this. I suggest instead changing "/var/home/$SUDO_USER" to ~"$SUDO_USER", which will correctly identify the home directory of SUDO_USER regardless of whether that's root (or some other user with a home directory in a nonstandard location). Do note that the ~ has to be outside quotes for it to be properly expanded by the shell. [edit: this doesn't work]

@ShadowSlayer1441
Copy link
Copy Markdown
Collaborator Author

I think it's a little strange to put anything other than users' home directories in /var/home; I don't know of anything else that does this. I suggest instead changing "/var/home/$SUDO_USER" to ~"$SUDO_USER", which will correctly identify the home directory of SUDO_USER regardless of whether that's root (or some other user with a home directory in a nonstandard location). Do note that the ~ has to be outside quotes for it to be properly expanded by the shell.

The problem is that when you run ujust from run0, $SUDO_USER is blank. We could add something to test and find the home directory regardless, but this is a lot of complexity. I agree it is unusual, but it doesn't make sense either for a drive encryption key to be only accessible from one user anyway.

@HastD
Copy link
Copy Markdown
Collaborator

HastD commented Jun 9, 2025

That doesn't seem right—I just tried running a nested run0 session (which is what I'm pretty sure is happening when you run a ujust script that requires root from a run0 shell) and it sets SUDO_USER to root, as expected.

I also think that on a multi-user system, there definitely could be good reason that a system administrator might not want the recovery key to be visible to all unprivileged users. So, putting it in the calling user's home directory still seems like the best option. If somehow SUDO_USER is blank (which I don't think should happen), the best fallback might be to put it in root's home directory.

@ShadowSlayer1441
Copy link
Copy Markdown
Collaborator Author

You're right, it's not blank it's still root.

echo ~"$SUDO_USER" is giving me ~user, not the home path. Seems like ~ won't substitute correctly when the user name is substituted. At least on my secureblue install.

@HastD
Copy link
Copy Markdown
Collaborator

HastD commented Jun 9, 2025

Oops, my bad, that works in fish but not in bash—forgot to switch to bash to check that. A method that does work in bash is:

getent passwd "$SUDO_USER" | cut -d: -f6

@RoyalOughtness
Copy link
Copy Markdown
Collaborator

TBH, we should port these to python instead of continuing to build on the bash versions

@RoyalOughtness RoyalOughtness added the question Further information is requested label Jul 7, 2025
@RoyalOughtness RoyalOughtness changed the title fix: running as fido2_unlock as root fix: decline to support fido2 multi drive setups Aug 25, 2025
@RoyalOughtness RoyalOughtness enabled auto-merge (squash) August 25, 2025 16:36
@RoyalOughtness RoyalOughtness merged commit 34e1d0c into secureblue:live Aug 25, 2025
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

question Further information is requested

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants