PKLA-CHECK-AUTHORI(8)
π PKLA-CHECK-AUTHORIZATION π
okay so bestie, this is the manual for pkla-check-authorization, which lives in section 8 of the manual (that's the admin/daemon zone, iykyk) and ships as part of polkit-pkla-compat. sit down, grab a strawberry π, and let's get into it.
β¨ NAME β¨
pkla-check-authorization β evaluate pklocalauthority authorization configuration
πΈ SYNOPSIS πΈ
pkla-check-authorization [--help]
pkla-check-authorization [--paths paths] {user-name} {is-local}
{is-active} {action}
π¦ DESCRIPTION π¦
So basically, pkla-check-authorization reads the non-JavaScript config files we're about to describe and figures out what polkit(8) would answer to an authorization query. it's giving translator energy.
Note: the actual authorization decision is driven by JavaScript rules, as described inpolkit(8).pkla-check-authorizationgets called by a JavaScript rule file named49-polkit-pkla-compat.rules. other JavaScript rules with a higher priority may exist, so thepkla-check-authorizationconfiguration might not actually govern the finalpolkit(8)authorization decision. no cap.
Also, the ordering of the JavaScript rule files and the ordering of the pkla-check-authorization config files are not integrated and use totally different rules β the pkla-check-authorization config evaluation happens at a single point within the JavaScript rule evaluation order.
pkla-check-authorization is an internal helper program of pkla-polkit-compat. you genuinely shouldn't need to run it yourself unless you're debugging. it's a backstage pass situation π.
The arguments to pkla-check-authorization, in order, are:
user-nameβ the name of the user account asking for authorization.is-localβ whether the attempted action is performed from a local login session,trueorfalse.is-activeβ whether the attempted action is performed from a currently active session (like a currently active virtual console),trueorfalse.actionβ a string identifying thepolkit(8)action.
If the config specifies an authorization decision, pkla-check-authorization outputs the decision and a terminating newline. if no decision is configured, the output is empty. literally nothing. silence. π
π OPTIONS π
-h,--helpβ write a summary of the available options to standard output and exit successfully. slay.-p,--paths=pathsβ search for config files in semicolon-separated paths instead of the default/var/lib/polkit-1/localauthority;/etc/polkit-1/localauthority.
π₯ EXIT STATUS π₯
pkla-check-authorization exits with 0 on success (even if there's no decision configured, bestie β that's still a success), and a non-zero status on error.
π DIRECTORY STRUCTURE π
Files with .pkla extension get read from all directories located inside the /etc/polkit-1/localauthority and /var/lib/polkit-1/localauthority directories (or as specified using the --paths option). by default, the following sub-directories are installed:
/etc/polkit-1/
`-- localauthority
|-- 10-vendor.d
|-- 20-org.d
|-- 30-site.d
|-- 50-local.d
`-- 90-mandatory.d
and
/var/lib/polkit-1/
`-- localauthority
|-- 10-vendor.d
|-- 20-org.d
|-- 30-site.d
|-- 50-local.d
`-- 90-mandatory.d
The /etc/polkit-1/localauthority hierarchy is for local configuration, and the /var/lib/polkit-1/localauthority one is for 3rd party packages. know the difference π.
Each .pkla file contains one or more authorization entries. if the underlying filesystem supports file monitoring, the Local Authority will reload info whenever .pkla files are added, removed or changed. it's always watching π.
Each directory is intended for a specific audience:
10-vendor.dβ intended for use by the OS vendor.20-org.dβ intended for the organization deploying the OS.30-site.dβ intended for the site deploying the system.50-local.dβ intended for local usage.90-mandatory.dβ intended for the organization deploying the OS.
and new directories can be added/removed as needed. build your own lore.
As for the content: each .pkla file is a standard key file and contains key/value pairs in one or more groups, with each group representing an authorization entry. A .pkla file MUST be named using a scheme that ensures the name is unique, e.g. reverse DNS notation or similar. for example, if the organization is βAcme Corpβ and needs to modify policy for the product βFrobnicatorβ, a name like com.acme.frobnicator.pkla would be suitable. main character naming energy β¨.
π AUTHORIZATION ENTRY π
Each group in a .pkla file must have a name that's unique within the file it belongs to. the following keys are recognized:
Identityβ a semi-colon separated list of entries to match identities. each entry should start withunix-user:orunix-group:to specify whether to match on a UNIX user name or a UNIX group name, and continue with a glob matching the group or user name. Netgroups are supported with theunix-netgroup:prefix, but cannot support glob syntax. finally, an entry"default"(with no prefix) can be used to specify the default match.Actionβ a semi-colon separated list of globs to match action identifiers.ResultActiveβ the result to return for subjects in an active local session that matches one or more of the given identities. allowed values are similar to what can be used in the defaults section of.policyfiles used to define actions, e.g.yes,no,auth_self,auth_self_keep,auth_adminandauth_admin_keep.ResultInactiveβ likeResultActivebut instead applies to subjects in inactive local sessions.ResultAnyβ likeResultActivebut instead applies to any subject.
All keys specified above are required, except that only at least one of ResultAny, ResultInactive and ResultActive must be present. so like, don't skip the required ones, bestie π.
β EVALUATION ORDER β
The authorization entries discussed above are consulted using the following algorithm. buckle up.
The authorization entries from all .pkla files are ordered using these rules. First, all the basename of all sub-directories (e.g. 30-site.d) from both the /etc/polkit-1/localauthority and /var/lib/polkit-1/localauthority directories are enumerated and sorted (using the C locale). if a name exists in both /etc and /var, the one in /etc takes precedence π. Then all .pkla files are read in order from this list of sub-directories. For each .pkla file, authorizations from each file are appended in order, resulting in an ordered list of authorization entries.
For example, given the following files
/var/lib/polkit-1
βββ localauthority
βββ 10-vendor.d
β βββ 10-desktop-policy.pkla
βββ 20-org.d
βββ 30-site.d
βββ 50-local.d
βββ 55-org.my.company.d
β βββ 10-org.my.company.product.pkla
βββ 90-mandatory.d
/etc/polkit-1
βββ localauthority
βββ 10-vendor.d
β βββ 01-some-changes-from-a-subvendor.pkla
βββ 20-org.d
βββ 30-site.d
βββ 50-local.d
βββ 55-org.my.company.d
β βββ 10-org.my.company.product.pkla
βββ 90-mandatory.d
the evaluation order of the .pkla files is:
10-desktop-policy.pkla01-some-changes-from-a-subvendor.pkla10-org.my.company.product.pkla(the/varone)10-org.my.company.product.pkla(the/etcone)
When the list of authorization entries has been calculated, the authorization check can be made. First, the user of the Subject is determined, and the groups that the user belongs to are looked up.
Then, authorization entries that include the "default" field value in the Identity field are consulted in order. if the authorization entry matches the data from the authorization check, then the authorization result from RequireAny, RequireInactive or RequireActive is used.
Next, for each group identity, all authorization entries that contain a matching group entry are again consulted in the same manner.
Finally, the authorization entries are consulted using the user identity in the same manner.
Note that processing continues even after a match. this allows for so-called βnegative authorizationsβ β see the section called βEXAMPLEβ for further discussion. it's not a bug, it's a feature π .
π§ EXAMPLE π§
The following .pkla file grants authorization to all users in the staff group for actions matching the glob com.example.awesomeproduct.* provided they're in an active session on the local console:
[Normal Staff Permissions]
Identity=unix-group:staff
Action=com.example.awesomeproduct.*
ResultAny=no
ResultInactive=no
ResultActive=yes
If the users homer and grimes are members of the staff group but policy requires that an administrator needs to authenticate every time authorization for any action matching com.example.awesomeproduct.* is required, one would add
[Exclude Some Problematic Users]
Identity=unix-user:homer;unix-user:grimes
Action=com.example.awesomeproduct.*
ResultAny=no
ResultInactive=no
ResultActive=auth_admin
and make sure this authorization entry is after the first one. order matters, bestie, it's the whole plot π.
The following entry modifies the default authorization decision (it is overridden by any entry that matches using unix-user: or unix-group:, but overrides any defaults set by the application author in an .action file):
[Disable Access by Default]
Identity=default
Action=com.example.awesomeproduct.*
ResultAny=no
ResultInactive=no
ResultActive=no
π«Ά FILES π«Ά
/etc/polkit-1/localauthority,/var/lib/polkit-1/localauthorityβ default directories containing decision config files.
π AUTHOR π
Written by David Zeuthen <davidz@redhat.com> with a lot of help from many others. Adapted by Miloslav TrmaΔ <mitr@redhat.com>. legends, honestly.
π SEE ALSO π
and that's the whole page, bestie π this beauty comes from polkit-pkla-compat and is dated May 2013 β vintage but still iconic, fr fr. go forth and debug responsibly πβ¨
π¦ where this page comes from
- centos-stream 10: polkit-pkla-compat 0.1-30.el10 Β· LGPL-2.0-or-later
- centos-stream 9: polkit-pkla-compat 0.1-21.el9 Β· LGPLv2+
- debian bookworm: polkitd-pkla 122-3 Β· MIT
- fedora 43: polkit-pkla-compat 0.1-31.fc43 Β· LGPL-2.0-or-later
- fedora 44: polkit-pkla-compat 0.1-32.fc44 Β· LGPL-2.0-or-later
- ubuntu noble: polkitd-pkla 124-2ubuntu1 Β· MIT
- ubuntu noble: polkitd-pkla 124-2ubuntu1.24.04.4 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms