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

Add loginctl_linger_users fact #410

Closed
wants to merge 1 commit into from
Closed

Add loginctl_linger_users fact #410

wants to merge 1 commit into from

Conversation

jcpunk
Copy link
Contributor

@jcpunk jcpunk commented Feb 5, 2024

Pull Request (PR) description

Add a fact listing users with linger enabled.

As near as I can tell from the systemd source, root is always able to linger even it not setup explicitly.

This Pull Request (PR) fixes the following issues

@jcpunk jcpunk requested a review from zilchms February 5, 2024 20:25
@jcpunk jcpunk added the enhancement New feature or request label Feb 5, 2024
Copy link
Contributor

@zilchms zilchms left a comment

Choose a reason for hiding this comment

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

I am willing to let it pass with the tests written the way they are, but i would suggest we find someone with better rspec knowledge to go over it too before we merge

Copy link

@h0tw1r3 h0tw1r3 left a comment

Choose a reason for hiding this comment

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

Generally not in favor of adding facts like this, particularly on widely used modules. A function or resource may be more appropriate.

That said, what's an sample use case?

@jcpunk
Copy link
Contributor Author

jcpunk commented Feb 6, 2024

My overall plan is to feed this value back into

systemd::logind_settings:
    KillExcludeUsers:

So my users with linger will have the ability to trivially persist processes.

Pat

@h0tw1r3
Copy link

h0tw1r3 commented Feb 6, 2024

I'm confused, isn't that redundant if touching a /var/lib/systemd/linger/ file is the same as adding to KillExcludeUsers in the logind conf file?

@traylenator
Copy link
Contributor

I'm confused, isn't that redundant if touching a /var/lib/systemd/linger/ file is the same as adding to KillExcludeUsers in the logind conf file?

Maybe a slight difference:

I guess enable linger will stop things being killed that are running in the systemd --user scope however all other user processes would be killed. Better to encourage users to run long lived processes in the correct context if they want them to survive.

I'm kind of worried about this fact as it would be pretty large in our case.

@jcpunk
Copy link
Contributor Author

jcpunk commented Feb 6, 2024

If this fact looks to be too much, I can always run it out of one of my private modules. Just figured I'd default to "share with the community".

@h0tw1r3
Copy link

h0tw1r3 commented Feb 6, 2024

I'm kind of worried about this fact as it would be pretty large in our case.

Agree. My basic objection to a fact like this.

@jcpunk
Copy link
Contributor Author

jcpunk commented Feb 6, 2024

No worries, I'll close this out and run the fact privately.

@jcpunk jcpunk closed this Feb 6, 2024
@jcpunk jcpunk deleted the fact-loginctl_linger_users branch February 6, 2024 15:30
@smortex
Copy link
Member

smortex commented Feb 6, 2024

No worries, I'll close this out and run the fact privately.

I also have some "private" facts, mostly because they are not related to a specific module and very site-specific or just not needed by the module to operate and only provide filtering help for tools like choria (e.g. freebsd_reboot_required, nginx_vhosts), but with some adjustments they may make sense for other organizations (in fact some are present in multiple control-repos I manage).

I wonder if it would make sense to have a section of the voxpupuli website with such custom facts that are listed with a short descriptions on a page in a similar way we have PQL queries?

@traylenator
Copy link
Contributor

If I was going to do this and am actually thinking about it I would not rely on puppet to maintain that list. I'd set up a path unit and service and sync /var/lib/systemd/linger entries to KillExcludeUsers settings.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants