marcus67 / little_brother

Parental Control Application implemented in Python 3 packaged for Debian and Ubuntu to monitor and limit kids' play time on Linux hosts
GNU General Public License v3.0
58 stars 9 forks source link

Differential limits by process, not calendar #94

Open skorvek opened 4 years ago

skorvek commented 4 years ago

I'm not clear how to write the configuration file to accomplish my goal. I want to apply different limits to different processes, as alluded to in the README introduction. I want to set an overall daily limit matching the login processes, but place an additional shorter limit on other processes (games for example). Creating multiple rule blocks for the same username seems to mix them together as viewed from the admin interface- it applies the last instance of the variable in the file. The context directive only seems to work for days of the week (arbitrary values prevent startup). I can apply multiple context_label directives but again only the last one appears in the admin interface.

Here's my latest attempt: What am I doing incorrectly?

[RuleSetCHILD] username=kidusername process_name_pattern=.*sh|systemd context_label=login priority=1 min_time_of_day=10:00 max_time_of_day=18:00 max_time_per_day=4h max_activity_duration=60m min_break=20m

scan_devices=true

[RuleSetCHILD-GAMES] username=kidusername process_name_pattern=etr|tuxfootball|tuxpuck context_label=arcade priority=4 min_time_of_day=10:00 max_time_of_day=18:00 max_time_per_day=2h max_activity_duration=30m min_break=20m

marcus67 commented 4 years ago

Hi Skorvek,

thank your your feedback.

You pointed out a shortcoming of LittleBrother. In the 0.2.x data model the process pattern is associated with the rule although --- as you correctly found out --- it's actually evaluated once for each user going through the rule sets. Very bad style, I have to admit. In version 0.3.x which will be released soon this has been fixed by cleanly moving the process pattern to the user. See https://github.com/marcus67/little_brother/blob/fb_configuration_gui/WEB_FRONTEND_MANUAL.md for a description of the new configuration frontend.

However, this is not what you want. You want three entities:

[user] 1<->N [process-pattern] 1<->N [rule]

I would second this. However, it's too late to incorporate this feature into the 0.3 release. I marked it for the next 0.4 release.

skorvek commented 4 years ago

Great- I’ll keep my eye out for it. This would be very helpful when we are all homeschooling because of the pandemic. It’s hard to keep the little ones on task! Thanks for the software.

MrFly commented 3 years ago

@marcus67 really great stuff I have to say :-) Thank you very much for this work - this is really something we searched a long time for.

But I have the same "questions" or "request" as @skorvek. Escpecially for the current home schooling situation, we have some needs:

Is there a way to set something like this in the current version 0.3.8 (newest)? I have to admit, I didn't really understand the current process name pattern (https://github.com/marcus67/little_brother/blob/fb_configuration_gui/WEB_FRONTEND_MANUAL.md); what does this really mean or do?

Another question: If the screen is locked, is this time counted as "active", because the user is logged in? If so, is there a way to take this "screen locked" times out of calculation by some configuration? What would be cool, too: List the active processes in the management view for the user (currently: Host/#Proz -> ABC(4) ).

With this features it really would be the nearly perfect tool for kids PC's and especially in the home schooling situation.

Again, thanks a lot, and I'll buy you some beer!