glfs/postlfs/security/libcap.xml
2024-02-19 19:11:27 +01:00

162 lines
4.6 KiB
XML

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
<!ENTITY % general-entities SYSTEM "../../general.ent">
%general-entities;
<!ENTITY libcap-download-http "&kernel-dl;/linux/libs/security/linux-privs/libcap2/libcap-&libcap-version;.tar.xz">
<!ENTITY libcap-download-ftp " ">
<!ENTITY libcap-md5sum "4667bacb837f9ac4adb4a1a0266f4b65">
<!ENTITY libcap-size "188 KB">
<!ENTITY libcap-buildsize "2.2 MB">
<!ENTITY libcap-time "less than 0.1 SBU">
]>
<sect1 id="libcap-pam" xreflabel="libcap-&libcap-version; with PAM">
<?dbhtml filename="libcap.html"?>
<title>libcap-&libcap-version; with PAM</title>
<indexterm zone="libcap-pam">
<primary sortas="a-libcap-pam">libcap</primary>
</indexterm>
<sect2 role="package">
<title>Introduction to libcap with PAM</title>
<para>
The <application>libcap</application> package was installed in
LFS, but if <application>Linux-PAM</application> support is desired,
the PAM module must be built (after installation of
<application>Linux-PAM</application>).
</para>
&lfs121_checked;
<bridgehead renderas="sect3">Package Information</bridgehead>
<itemizedlist spacing="compact">
<listitem>
<para>
Download (HTTP): <ulink url="&libcap-download-http;"/>
</para>
</listitem>
<listitem>
<para>
Download (FTP): <ulink url="&libcap-download-ftp;"/>
</para>
</listitem>
<listitem>
<para>
Download MD5 sum: &libcap-md5sum;
</para>
</listitem>
<listitem>
<para>
Download size: &libcap-size;
</para>
</listitem>
<listitem>
<para>
Estimated disk space required: &libcap-buildsize;
</para>
</listitem>
<listitem>
<para>
Estimated build time: &libcap-time;
</para>
</listitem>
</itemizedlist>
<bridgehead renderas="sect3">libcap Dependencies</bridgehead>
<bridgehead renderas="sect4">Required</bridgehead>
<para role="required">
<xref linkend="linux-pam"/>
</para>
</sect2>
<sect2 role="installation">
<title>Installation of libcap</title>
<note>
<para>
If you are upgrading libcap from a previous version, use the
instructions in
<ulink url="&lfs-root;/chapter08/libcap.html">
LFS libcap page
</ulink> to upgrade libcap. If <xref linkend="linux-pam"/> has been
built, the PAM module will automatically be built too.
</para>
</note>
<para>
Install <application>libcap</application> by running the following
commands:
</para>
<screen><userinput>make -C pam_cap</userinput></screen>
<para>
This package does not come with a test suite.
</para>
<para>
Now, as the <systemitem class="username">root</systemitem> user:
</para>
<screen role="root"><userinput>install -v -m755 pam_cap/pam_cap.so /usr/lib/security &amp;&amp;
install -v -m644 pam_cap/capability.conf /etc/security</userinput></screen>
</sect2>
<sect2 role="configuration">
<title>Configuring Libcap</title>
<para>
In order to allow <application>Linux-PAM</application> to grant
privileges based on POSIX capabilities, you need to add the libcap module
to the beginning of the <filename>/etc/pam.d/system-auth</filename> file.
Make the required edits with the following commands:
</para>
<screen role="root"><userinput>mv -v /etc/pam.d/system-auth{,.bak} &amp;&amp;
cat &gt; /etc/pam.d/system-auth &lt;&lt; "EOF" &amp;&amp;
<literal># Begin /etc/pam.d/system-auth
auth optional pam_cap.so</literal>
EOF
tail -n +3 /etc/pam.d/system-auth.bak &gt;&gt; /etc/pam.d/system-auth</userinput></screen>
<para>
Additionally, you'll need to modify the
<filename>/etc/security/capability.conf</filename> file to grant
necessary privileges to users, and utilize the <command>setcap</command>
utility to set capabilities on specific utilities as needed. See
<command>man 8 setcap</command> and
<command>man 3 cap_from_text</command> for additional information.
</para>
</sect2>
<sect2 role="content">
<title>Contents</title>
<segmentedlist>
<segtitle>Installed Programs</segtitle>
<segtitle>Installed Library</segtitle>
<segtitle>Installed Directories</segtitle>
<seglistitem>
<seg>None</seg>
<seg>pam_cap.so</seg>
<seg>None</seg>
</seglistitem>
</segmentedlist>
</sect2>
</sect1>