Open mulkieran opened 4 years ago
Related: #196
@waltdisgrace @mulkieran It appears that keyctl get_persistent
and any corresponding syscall does refresh the expiration timer even when it does not create a new persistent keyring. Adding a new key to or listing the contents of the persistent keyring does not. It also appears that the granularity is the largest component of the time in weeks, days, hours, minutes, and seconds.
I think one way we could theoretically avoid refreshing the timer each time we check the expiration is by saving the persistent keyring ID as an optional type in the StratKeyActions
once it has been attached. I don't know of a way that the persistent keyring would be able to be unattached from the session keyring that stratisd has assigned to it so we could count on it being attached until it expires. From here, we could provide an interface for getting the persistent keyring ID and the time until the keyring expires from StratKeyActions
in addition to a method to refresh the keyring if it has expired. Before any operation on the keyring itself, it could refresh the keyring expiration, and if reporting on the current time until expiration, we could simply report the duration of time until it expires without refreshing it. I would be happy to put up a PR before @waltdisgrace starts working on exposing this over the D-Bus API.
@jbaublitz Rather than going ahead w/ the implementation, can you assist @waltdisgrace in putting a dummy method or methods in the appropriately chosen trait in https://github.com/stratis-storage/stratisd/blob/develop-2.1.0/src/engine/engine.rs? That should be enough to make it possible for @waltdisgrace to modify the D-Bus layer and the CLI as appropriate to expose the time remaining until the key expires.
We're happy with the CLI side, but the stratisd side was just a dummy, moving back to long term.
This isn't in the main path for anything, taking it off all boards for now.
Daemon side:
note that this will require a little design work.
I believe we export the list of keys via the FetchProperties interface as a list of strings, or something like that. We might have to extend the FetchProperties interface with an additional property, or consider some other way of getting at this information.as well as some consideration about the future, and whether the keys will ever have different expiration times.On the CLI side: