libmalcontent implements parental controls support which can be used by applications to filter or limit the access of child accounts to inappropriate content.
Go to file
Simon McVittie 1abce3eb91 manager: Return MCT_MANAGER_ERROR_DISABLED if no accountsservice
In distributions that package shared libraries and daemons separately,
it's possible to have the shared library (because it's required to run
something like Flatpak) but not the accountsservice daemon or its
malcontent extension (because the administrator of this particular
installation has no interest in parental controls, and their choice of
desktop environment is such that nothing else depends on accountsservice
either). This minimizes the memory and disk space cost of enabling the
libmalcontent feature in Flatpak for those who do not need it, while
keeping it available for those that do.

Treat this the same as if accountsservice is available but the
malcontent extension is not: fail open, by returning
MCT_MANAGER_ERROR_DISABLED.

Resolves: https://gitlab.freedesktop.org/pwithnall/malcontent/-/issues/27
Bug-Debian: https://bugs.debian.org/972145
Signed-off-by: Simon McVittie <smcv@debian.org>
2020-10-15 09:04:13 +01:00
.gitlab-ci ci: Use pre-built Docker images for CI builds 2020-07-21 11:58:51 +01:00
accounts-service Add option to tweak privileged group in polkit rules 2020-06-18 03:35:36 +07:00
build-aux build: Only update post-install caches when they exist 2020-04-05 10:52:05 +02:00
help Add Danish translation 2020-10-11 23:00:16 +02:00
libmalcontent manager: Return MCT_MANAGER_ERROR_DISABLED if no accountsservice 2020-10-15 09:04:13 +01:00
libmalcontent-ui build: Use meson.current_source_dir() instead of source_root() 2020-07-06 10:59:45 +01:00
malcontent-client tree-wide: Replace usages of whitelist/blacklist 2020-06-09 15:35:21 -07:00
malcontent-control malcontent-control: Add descriptive paragraphs to appdata releases 2020-09-08 12:52:17 +01:00
pam tests: Respect pamlibdir in installed tests 2020-04-28 13:57:29 +01:00
po Add Danish translation 2020-10-11 23:00:16 +02:00
subprojects subprojects: Limit depth when cloning 2020-07-21 12:43:24 +01:00
tools build: Port meson-make-symlink script to Python 2019-12-02 22:57:13 +08:00
.gitlab-ci.yml ci: Use pre-built Docker images for CI builds 2020-07-21 11:58:51 +01:00
COPYING Initial commit of README and COPYING 2018-09-24 15:35:58 +01:00
COPYING-DOCS help: Add a basic user manual for malcontent-control 2020-04-03 15:08:47 +01:00
NEWS 0.9.0 2020-09-03 12:03:51 +01:00
README.md tree-wide: Replace usages of whitelist/blacklist 2020-06-09 15:35:21 -07:00
malcontent.doap docs: Port README to Markdown and update a few references 2019-02-26 17:48:03 +00:00
meson.build 0.9.0 2020-09-03 12:03:51 +01:00
meson_options.txt Add option to tweak privileged group in polkit rules 2020-06-18 03:35:36 +07:00
template.test.in libeos-parental-controls: Add placeholder unit tests 2018-10-06 00:48:36 +01:00

README.md

malcontent

malcontent implements support for restricting the type of content accessible to non-administrator accounts on a Linux system. Typically, when this is used, a non-administrator account will be for a child using the system; and the administrator accounts will be for the parents; and the content being filtered will be apps which are not suitable for the child to use, due to (for example) being too violent.

It provides an accounts-service vendor extension for storing an app filter to restrict the childs access to certain applications; a simple library for accessing and applying the app filter; and a UI program (malcontent-control) for viewing and changing the parental controls settings on users.

The parental controls policy is stored in /var/lib/AccountsService/users/${user}, which is a key file readable and writable only by the accounts-service daemon. Access to the data is mediated through accounts-services D-Bus interface, which libmalcontent is a client library for.

All the library APIs are currently unstable and are likely to change wildly.

Two kinds of policy are currently supported:

  • A filter specifying whether installed applications are allowed to be run; this is typically set up to restrict access to a limited set of already-installed applications — but it can be set up to only allow access to a fixed list of applications and deny access to all others. Applications which are not currently installed are not subject to this filter.
  • A set of mappings from OARS categories to the maximum ratings for those categories which are permissible for a user to install apps with. For example, a mapping of violence-realistic=mild would prevent any applications containing more than mild violence from being installed. Applications which are already installed are not subject to this filter.

Additional policies may be added in future, such as filtering by content type or limiting the amount of time a user is allowed to use the system for.

Any application or service which provides the user with access to content which should be parentally filtered is responsible for querying the users parental controls filter and refusing to provide the content if not permitted by the filter. This could mean refusing to launch a flatpak app, hiding a search result in gnome-shell, or hiding an app in gnome-software because of its high OARS rating.

A sufficiently technically advanced user may always work around these parental controls. malcontent is not a mandatory access control (MAC) system like AppArmor or SELinux. However, its correct use by applications should provide enough of an obstacle to prevent users easily or accidentally having access to content which they shouldnt.

Example usage

malcontent ships a malcontent-client application which can be used to get and set parental controls policies for users.

$ # This sets the parental controls policy for user philip to allow no \\
    installation of apps with anything more than none for realistic violence, \\
    and to blocklist running the org.freedesktop.Bustle flatpak:
$ malcontent-client set philip \\
    violence-realistic=none \\
    app/org.freedesktop.Bustle/x86_64/stable
App filter for user 1000 set

With that policy in place, other applications which are aware of malcontent will apply the policy:

$ flatpak run org.freedesktop.Bustle
error: Running app/org.freedesktop.Bustle/x86_64/stable is not allowed by the policy set by your administrator

Development

When developing malcontent, you should be able to run an uninstalled version of malcontent-client or malcontent-control, as long as the polkit files from accounts-service/ and malcontent-control/org.freedesktop.MalcontentControl.policy.in have been installed system-wide (typically under /usr/share/polkit-1) where your system copy of polkitd can find them.

Dependencies

  • accounts-service
  • appstream-glib
  • dbus-daemon
  • flatpak
  • gio-2.0 ≥ 2.60
  • gio-unix-2.0 ≥ 2.60
  • glib-2.0 ≥ 2.60
  • gobject-2.0 ≥ 2.60
  • gtk+-3.0
  • polkit-gobject-1

Licensing

All code in the libraries in this project is licensed under LGPL-2.1+. Code in the malcontent-control application is licensed under GPL-2.0+. See COPYING and the copyright headers in individual files for more details.

Bugs

Bug reports and patches should be filed in GitLab.