Polkit-127

#### Beyond Linux® From Scratch (System V Edition) - Version r13.0-1090

### Chapter 4. Security

- Prev

  p11-kit-0.26.4

- Next

  polkit-gnome-0.105

- Up
- Home

# Polkit-127

## Introduction to Polkit

Polkit is a toolkit for defining and handling authorizations. It is used for allowing unprivileged processes to communicate with privileged processes.

### Note

Development versions of BLFS may not build or run some packages properly if LFS or dependencies have been updated since the most recent stable versions of the books.

### Package Information

- Download (HTTP): https://github.com/polkit-org/polkit/archive/127/polkit-127.tar.gz

- Download MD5 sum: 2cc95f1b02fc1de6c9e52db986642ec4

- Download size: 484 KB

- Estimated disk space required: 7.8 MB (with tests)

- Estimated build time: 0.3 SBU (with tests; using parallelism=4)

### Polkit Dependencies

#### Required

duktape-2.7.0 and GLib-2.88.2 (GObject Introspection recommended)

#### Recommended

libxslt-1.1.45, Linux-PAM-1.7.2, and elogind-257.16

### Note

Since elogind uses PAM to register user sessions, it is a good idea to build Polkit with PAM support so elogind can track Polkit sessions.

#### Optional

GTK-Doc-1.36.1 and dbusmock-0.38.1 (required for tests)

#### Optional Runtime Dependencies

One polkit authentication agent for using polkit in the graphical environment: polkit-kde-agent in Plasma-6.6.5 for KDE, the agent built in gnome-shell-50.3 for GNOME, polkit-gnome-0.105 for XFCE, and lxqt-policykit-2.4.0 for LXQt

### Note

If libxslt-1.1.45 is installed, then docbook-xml-4.5 and docbook-xsl-nons-1.79.2 are required. If you have installed libxslt-1.1.45, but you do not want to install any of the DocBook packages mentioned, you will need to use `-D man=false` in the instructions below.

## Kernel Configuration

Some tests need user namespace support. If you are going to run the test suite, enable the support and recompile the kernel if necessary:

    General setup --->
      -*- Namespaces support --->                                       [NAMESPACES]
        [*] User namespace                                                 [USER_NS]

## Installation of Polkit

There should be a dedicated user and group to take control of the polkitd daemon after it is started. Issue the following commands as the `root` user:

    groupadd -fg 27 polkitd &&
    useradd -c "PolicyKit Daemon Owner" -d /etc/polkit-1 -u 27 \
            -g polkitd -s /bin/false polkitd

Install Polkit by running the following commands:

    mkdir build &&
    cd    build &&

    meson setup ..                     \
          --prefix=/usr                \
          --buildtype=release          \
          -D man=true                  \
          -D session_tracking=elogind  \
          -D systemdsystemunitdir=/tmp \
          -D tests=true

Build the package:

    ninja

To test the results, first ensure that the system D-Bus daemon is running, and both D-Bus Python-1.4.0 and dbusmock-0.38.1 are installed. Then run ninja test.

Now, as the `root` user:

    ninja install

Remove some files that aren't useful on a SysV system as the `root` user:

    rm -v /tmp/*.service                 &&
    rm -rf /usr/lib/{sysusers,tmpfiles}.d

## Command Explanations

`--buildtype=release`: Specify a buildtype suitable for stable releases of the package, as the default may produce unoptimized binaries.

`-D tests=true`: This switch allows to run the test suite of this package. As Polkit is used for authorizations, its integrity can affect system security. So it's recommended to run the test suite building this package.

`-D os_type=lfs`: Use this switch if you did not create the `/etc/lfs-release` file or distribution auto detection will fail and you will be unable to use Polkit.

`-D authfw=shadow`: This switch enables the package to use the Shadow rather than the Linux PAM Authentication framework. Use it if you have not installed Linux PAM.

`-D introspection=false`: Use this option if you are certain that you do not need gobject-introspection files for polkit, or do not have installed GLib-2.88.2 with GObject Introspection.

`-D man=false`: Use this option to disable generating and installing manual pages. This is useful if libxslt is not installed.

`-D examples=true`: Use this option to build the example programs.

`-D gtk_doc=true`: Use this option to enable building and installing the API documentation.

## Contents

Installed Programs: pkaction, pkcheck, pkexec, pkttyagent, and polkitd
Installed Libraries: libpolkit-agent-1.so and libpolkit-gobject-1.so
Installed Directories: /etc/polkit-1, /usr/include/polkit-1, /usr/lib/polkit-1, /usr/share/gtk-doc/html/polkit-1, and /usr/share/polkit-1

### Short Descriptions

pkaction | is used to obtain information about registered PolicyKit actions
pkcheck | is used to check whether a process is authorized for action
pkexec | allows an authorized user to execute a command as another user
pkttyagent | is used to start a textual authentication agent for the subject
polkitd | provides the org.freedesktop.PolicyKit1 D-Bus service on the system message bus
`libpolkit-agent-1.so` | contains the Polkit authentication agent API functions
`libpolkit-gobject-1.so` | contains the Polkit authorization API functions

- Prev

  p11-kit-0.26.4

- Next

  polkit-gnome-0.105

- Up
- Home