Giter Site home page Giter Site logo

Comments (6)

ralcantaraperez avatar ralcantaraperez commented on May 25, 2024 1

I don't know if it can help you but I'm using this file to force systemd to inherit keys (in Ubuntu /etc/systemd/system/service_name.service.d/customexec.conf):

[Service]
KeyringMode=shared

from pam_e4crypt.

neithernut avatar neithernut commented on May 25, 2024 1

Thanks for the hint. Maybe I should add this to the README.

from pam_e4crypt.

neithernut avatar neithernut commented on May 25, 2024

We use the session keyring. That keyring is inherited by child processes. Unlike the user and user session keyrings, it is not bound to a UID and can not be used by arbitrary sessions of the same user. As far as I remember, using the session keyring was the only possibility to get the module to work properly (keys in other keyrings would be ignored), but I could well be mistaken. At least the e4crypt tool uses the session key, as is apparent from your keyctl output.

It could well be that systemd-run initializes its own session keyring and hence doesn't propagate your keys to services. Honestly, I don't care about systemd and I try to stay as far away as possible from it.

This module will probably be of no use for solving this problem. You could try to link the keys to a user keyring using keyctl link and then link them back to the service's session from there.

TL;DR: his is clearly outside the scope of this module. Anyways, good luck.

from pam_e4crypt.

seebaclo avatar seebaclo commented on May 25, 2024

Just quick recap after I found solution:

pam_keyinit module automatically links user keyring @u to session keyring @s so I couldn't link back @s to u@ due to recursion.

User keyring @u is automatically linked to user session keyring @us. I could link from @s to @us manually after login but it was too late for some services to get access. On the other hand linking it early didn't work (services didn't used this keyring then).

So, finally I had to disable pam_keyinit module from system-login pam section and link session keyring @s to user keyring @u. I don't know if there are any disadvantages of this as I don't add any keys to my user keyring anyway and Archlinux even didn't include this module by default. It's still included in systemd-user pam section and i believe it's enough.

from pam_e4crypt.

seebaclo avatar seebaclo commented on May 25, 2024

Hm, I just thinked about it:

e4crypt tool uses session keyring by default but it has -k option which provide ability to choose keyring manually i.e e4crypt add_key -k @u.

You wrote that you can't use other keyrings within pam_e4crypt - wasn't pam_keyinit the reason here as it occurred in my case? If yes whe can move pam_keyinit module below pam_e4crypt in system-login pam section and add key to user's keyring which will be automatically linked to session's keyring by pam_keyinit later.

So we end up with keys in both user and session keyrings which should be easier to manage.

from pam_e4crypt.

okias avatar okias commented on May 25, 2024

@seebaclo could you publish your service file? I'm trying to do something similiar and this would really help me.

from pam_e4crypt.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.