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

Permissions of secrets.d generations #369

Open
Mikilio opened this issue Jul 17, 2023 · 2 comments
Open

Permissions of secrets.d generations #369

Mikilio opened this issue Jul 17, 2023 · 2 comments

Comments

@Mikilio
Copy link
Contributor

Mikilio commented Jul 17, 2023

I am using the home-manager module.

I've censored some ls commands to illustrate the issue:

› ls /run/user/1000/ -lah
total 0
drwx------ 13 mikilio users 460 Jul 17 02:16 .
drwxr-xr-x  3 root    root   60 Jul 17 00:20 ..
lrwxrwxrwx  1 mikilio users  26 Jul 17 02:15 secrets -> /run/user/1000/secrets.d/2
drwxr-x--x  3 mikilio users  60 Jul 17 02:15 secrets.d

› ls /run/user/1000/secrets.d -lah
total 0
drwxr-x--x  3 mikilio users  60 Jul 17 02:15 .
drwx------ 13 mikilio users 460 Jul 17 02:16 ..
drwxr-x--x  2 mikilio users 100 Jul 17 02:15 2

› ls /run/user/1000/secrets.d/2 -lah
total 12K
drwxr-x--x 2 mikilio users 100 Jul 17 02:15 .
drwxr-x--x 3 mikilio users  60 Jul 17 02:15 ..
-r-------- 1 mikilio users  16 Jul 17 02:15 foo 
-r-------- 1 mikilio users  16 Jul 17 02:15 bar
-r-------- 1 mikilio users  30 Jul 17 02:15 furries

As you can tell my directory /run/user/1000/secrets.d/2 is readable by other users. However, I do not necessarily want to let other users know what kind of passwords I store even if they can't read them. To at least have the option of privacy I think the easiest fix would be to XOR all permissions of the keys and set it as the permission of the generations directory.

@Mikilio Mikilio changed the title Permissions of secrets.d Permissions of secrets.d generations Jul 17, 2023
@dasJ
Copy link
Collaborator

dasJ commented Jul 17, 2023

Could you run namei -l /run/user/1000/secrets.d/2? For me, /run/user/1000 already has 700 permissions

@Mikilio
Copy link
Contributor Author

Mikilio commented Jul 18, 2023

It is true /run/user/1000 has 700 and its files can not be accessed directly!
The vulnerability comes from something I was in control of myself. Basically because of #287 I have set the paths to a directory in my somewhere in my home directory and that was to one that had loose permissions. Any user could see which keys I have, because the symlinks have the same name as the actual file.

Now the symlinks weren't created by myself but by the newly introduced option in sops-nix , so I don't know if there should be a check for this kind of unsecurity or if secret files should be hashed or if this should be blamed on the user.

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

No branches or pull requests

2 participants