Commit Graph

447 Commits

Author SHA1 Message Date
Panu Matilainen 60baf9c297 Deprecate beecrypt support
Beecrypt upstream is dead for seven years, this is not a healthy situation
(death tends to have that effect...) for any component, and even less
so for security sensitive component. Deprecate for later removal now
that we have multiple nicer alternatives.
2020-03-23 13:44:29 +02:00
Panu Matilainen cec09e4e00 Remove support for obsolete --with-beecrypt configure switch 2020-03-23 13:44:29 +02:00
Panu Matilainen 7de982ac09 Drop the experimental LMDB backend
In the three years that LMDB support has been in the tree, and four
since upstream promised 1.0.0 in a couple of months, there have been
no upstream changes towards eliminating the key size limitations that
we need. And in the meanwhile it has become clearer that LMDB is not
the promised land it seemed on the outset, instead it has issues
like requiring the database size to be pre-determined (#902).

Drop support for LMDB, there's active development going on in the area
of database backends and we cannot afford to drag along an experimental
backend that is blocked on upstream design limitations and shows no signs
of moving forward. We can always bring it back if the upstream situation
changes.
2020-03-20 12:31:04 +02:00
Michael Schroeder 7cc9eb84a3 Add support for reading BDB without the library
This commit implements a read-only backend that allows accessing
of BerkeleyDB databases without using the BerkeleyDB library.
The code supports btree version 9-10 and hash version 8-10.

There are two use cases for this:

1) Conversion of an existing BerkeleyDB to a different
   backend.

2) Allowing package scriptlets to do database queries while
   in a transaction that replaced rpm with a version that
   no longer links against BerkeleyDB.

If both BerkeleyDB and the read-only backend are enabled, rpm will
default to BerkeleyDB.
2020-01-13 16:12:13 +02:00
Michael Schroeder 7949d290b8 Remove the experimental status from the ndb database 2020-01-13 13:09:52 +02:00
Michael Schroeder 4c7323f69b Fix building with no BerkeleyDB support
The configure script used to define BDB even if BerkeleyDB has
been disabled.
2019-12-26 09:00:37 +01:00
Panu Matilainen 9c8a3faf42 Fix sqlite database access for unprivileged readers in WAL mode
As of sqlite 3.22.0, a database in WAL mode can be opened readonly
if one or more of the following is true:

1) The -shm and -wal files already exists and are readable
2) There is write permission on the directory containing the database
   so that the -shm and -wal files can be created.
3) The database connection is opened using the immutable query parameter.

Regular users running queries cannot have permission to create, and
immutable databases can only exist on readonly media (because all locking
is disabled) so there's no choice but to leave the -shm and -wal files
around at all times, a little ugly as it might be.
2019-11-21 09:36:50 +02:00
Ross Burton 22ed98efe3 configure.ac: prefer pkg-config to find libgcrypt
libgcrypt from 1.8.5 provides a pkg-config file as well as the traditional
libgcrypt-config script.  As pkg-config is more resiliant in the face of
complicated build environments (for example cross-compilation and sysroots)
prefer the pkg-config file, falling back to libgcrypt-config if that doesn't
exist.
2019-11-21 09:36:28 +02:00
Panu Matilainen 9fe75561f9 Replace uses of localtime() with the re-entrant variant
LGTM flags localtime() as a "dangerous" function, which seems a bit
over the top to me, but as we're flirting with threads, it certainly
is not thread-safe.
2019-10-31 11:59:20 +01:00
Panu Matilainen 07129b641b Add an experimental sqlite based rpmdb backend
All normal functionality is expected to work. Automatic generation
of missing index tables is missing, but that's not relevant at this time.
Going forward, we'll also want some sort of compatibility tracking
for the sql schema.

The database scheme basically just mirrors what BDB does, using strings
for strings and blobs for everything else due to the way integers are
handled in the sqlite C API, for now at least. Some amount of schema
changes are to be expected before this is considered final.

Performance is similar or better with BDB in the current unsafe CDB
model, but sqlite uses proper database transactions so this is expected
to be an order of magnitude more robust.

Many things are stupid and/or kind of backwards here due to the internal
API, which I've avoided changing in order to keep it backportable for the
time being. https://github.com/rpm-software-management/rpm/pull/836 is
needed but otherwise this should drop quite trivially into 4.14.x too.
However as we're planning for a longer term future here, it would be dumb
to limit ourselves by what's possible with an internal BDB-oriented API,
so I've fairly major changes planned in that direction.
2019-10-18 10:38:34 +03:00
Panu Matilainen a84a33816a Add configure option to build with -Werror
-Werror is a bit tricky as it'll cause autoconf tests fail left and right
if it's just passed normally via CFLAGS, so we need to sneak it in
by some other means.

Note that while developers should always enable this, -Werror must never
ever be a default as it'll eventually just cause bogus build failures
when old releases get built with newer compilers.
2019-10-16 12:12:40 +03:00
Michael Schroeder 3625ca14c7 Refactor mmap/munmap/mremap handling in ndb
Also emulate mremap with mmap/munmap in ndb if it is not
available.
2019-10-16 12:09:51 +03:00
Panu Matilainen 5c0801a1a3 Change the default crypto implementation to libgcrypt (from NSS)
libgcrypt is a much more straightforward and lightweight as a library,
doesn't come with a massive runtime library of its own, runtime which
messes with SIGPIPE and all, has a nice clearly compatible license (LGPL)
and is somewhat faster than NSS. What's not to like?

Change the default and add relevant documentation to INSTALL. Drop
the hopefully now unnecessary override from distcheck flags, and
switch CI over too. Note that in CI, openssl-devel is still needed
for ima-evm (missing dep in ima-evm-utils-devel?)
2019-09-11 09:58:00 +03:00
Michael Schroeder 037106ecc8 Support libgrypt as crypto library 2019-09-10 09:55:41 +03:00
Panu Matilainen 67f8f2b01d Axe support for Python 2
Python 2 will be EOL by the time of the next major rpm release,
time to retire the Python 2 bindings. Specifically we require
Python >= 3.1 for surrogateescape-support.
2019-08-12 09:54:44 +03:00
Panu Matilainen 7c520be4da Bump version to mark the beginning of new devel cycle 2019-06-26 17:54:30 +03:00
Panu Matilainen 464d21dc8c Fix build with --disable-openmp
AC_OPENMP supports --enable/disable-openmp out of the box, but as it
only sets OPENMP_CFLAGS *if needed by the compiler to support openmp*,
it's utterly useless for conditional building. And because AC_OPENMP
doesn't set $ac_cv_prog_c_openmp to anything if --disable-openmp was
used, we need to test that it's neither empty nor unsupported to
determine if we actually have openmp, in order to set an autoconf
define that we can actually use to conditionalize aspects of the
build on. Argh.
2019-06-24 17:12:17 +02:00
Howard Johnson 4c2b3f25f6 Rename rpmqv.c to rpm.c, as it's the main source for the rpm command 2019-06-03 15:10:46 +03:00
Panu Matilainen 56662b1b1b Add infrastructure for OpenMP support in librpmbuild
Enable OpenMP use in librpmbuild and set the number of OMP threads
from rpm config after spec parsing. The place matters as we want to
allow individual specs to control and disable parallel builds.
2019-05-21 10:54:53 +02:00
Panu Matilainen d48981ad7e Support build-id generation from compressed ELF files (elfutils >= 0.175)
Use dwelf_elf_begin() for reading ELF files for build-id generation on
versions that have it to support compressed ELF files such as kernel
modules (RhBug:1650072,1650074). Note that debugedit still cannot handle
compressed files, this is only for build-id generation.
2019-04-10 09:39:37 +03:00
Panu Matilainen ad16a04b6e Add plugin for logging audit events for package operations as per OSPP v4.2
When enabled, log audit events for package install, update and remove.
The log includes the operation, package nevra, signature check result,
whether signatures are being enforced enforced and overall operation
result code. Package install/update/remove are logged as such,
obsoletion is logged as install + remove (whereas the erasure element
on updates is silent). Enable compilation in CI.

Loosely based on initial RHEL 7-8 implementations by Pavlina Moravcova
Varekova and Florian Festi (RhBug:1555326, RhBug:1607612)
2019-04-09 11:04:02 +02:00
Panu Matilainen 1fac727638 Default to Python 3 for bindings, deprecate Python 2 support
Python 2 EOL is closing in fast, time we start looking forward instead
of backward too. Document how to build for Python 2 for now, and update
version requirements.
2019-02-26 11:58:15 +02:00
Panu Matilainen 3e6b0d0fb8 Don't bother checking for python and perl binaries
Should've been in commit ba85c95963,
we no longer use these for anything. Drop check for PGP while at it.
2019-02-26 10:02:01 +02:00
Panu Matilainen e1d3811883 Support building rpm without Berkeley DB, simplify the configuration
Replace the --with-external-db switch with the following simple logic:
if internal copy of BDB is detected, use it, otherwise look for an
external one. By default BDB is still required, but it's now possible
to build without it by using --disable-bdb argument to configure.
If no database is built in, we'll segfault for now, to be dealt with
in coming commits.

This is a rather historical moment, BTW.
2019-02-01 15:21:08 +02:00
Panu Matilainen 815a362875 Fix BDB build when automatically selecting internal BDB
Commit 9e64f8d5b7 was supposed to allow
this but actually building the internal BDB requires with_external_db to
be "no", whereas in the automatic case it was "maybe", resulting in
the internal BDB not actually getting built at all.
2019-02-01 13:54:59 +02:00
Panu Matilainen b4c832caed Add experimental support for non-privileged chroot on Linux
If host kernel supports user namespaces, this allows non-privileged users
to perform chrooted operations such as installations and verification.
With caveats. Only root:root ownership is supported in the namespace, so
packages with other file ownerships will fail to install properly, chown()
fails with -EINVAL similarly to what happens on squashed NFS-mount. We
don't handle that particularly gracefully.

Also add the obligatory disabler, and use it for the test-suite for
now. Only two tests (61 and 342) actually fail because of it, simply
because things are ... different with user namespaces.
2019-01-17 14:08:21 +02:00
Panu Matilainen 69e8b91dcc Add a built-in macro for fetching number of CPUs, affinity aware and all
There's an increasing number of placing wanting to know the number of
CPU's for parallel processing, and increasingly these things are running
in containers and such where the total host CPU count is not meaningful.
2019-01-15 11:16:04 +02:00
Panu Matilainen 090ce7a75d Drop support for patch < 2.1
The oldest patch version available from http://ftp.gnu.org/gnu/patch/
is patch 2.5 from August 1997, the same year when commit
636fc4bec9 added support for
"modern patch programs", 21 years ago almost to date. A bit of digging
around reveals that GNU patch 2.1 released in 1993 and patch 2.2 earlier
in 1997. Makes me think perhaps we can risk dropping support for 2.1
without a huge uproar from the community... RIP old fella.
2018-10-25 16:10:13 +03:00
Panu Matilainen 3f3cb3eabf Bump the minimum Python version requirement to 2.7
Older Python versions are long since past their EOL, we don't need to
support them either. Python 2.7 is also the least incompatible version
compared to Python 3, going forward. Nuke the now unnecessary compat
macros.
2018-10-04 18:05:37 +03:00
Florian Festi 449ed5d9d7 Add switch to disable systemd-inhibit plugin
to allow building without systemd dependency

Resolves #361
2018-02-26 15:33:11 +01:00
Panu Matilainen d7dfd0dc0c Drop -fPIC -DPIC from rpm's forced gcc build flags
These things are up to distro/platform build policies, it's not as if
rpm actually required position independent code. And as it happens,
 doing the right thing renders PR #350 unnecessary.
2018-02-19 15:24:30 +02:00
Mike Crowe a3652af66f Make configure cope with multiple users/groups with ID 0
If /etc/passwd contains multiple users with UID 0 then user_with_uid0 will
contain a line feed which results in config.h containing:

 #define UID_0_USER "root

(i.e. without a closing quote.)

The same problem occurs with /etc/group.

Let's only emit the first match in each case so that there is only ever a
single result.
2018-01-05 15:53:52 +02:00
Panu Matilainen c4fe194556 Check for getline() as a required function in configure
This became mandatory in commit aeb58f654a.
2017-11-09 16:13:20 +02:00
Panu Matilainen 8c4bfd74b5 Error out on --enable-ndb if system doesn't support mremap() (#334)
mremap() is Linux-specific, so ndb is effectively Linux-only.
2017-11-03 13:48:41 +02:00
Panu Matilainen 014246b050 Test for lsetxattr() presence, don't try building IMA plugin without it
Came up in PR #260 review, we shouldn't assume the presence of this
Linux-specific API.
2017-10-27 12:49:29 +03:00
Neal Gompa 48eed77980 configure: Fix typo for libcrypto usability check for OpenSSL check
The typo in this check prevents rpm for correctly detecting
compatibility with OpenSSL 1.0.2.
2017-10-16 10:03:28 +03:00
Panu Matilainen eef82b0e81 Less naive version of sync-after-transaction (RhBug:1461765)
If syncfs() is available (ie on Linux), only sync modified filesystems.
In order to do this, keep the diskspace information around throughout
the transaction.

Skip the sync entirely on chroot installations for now, but this
too should be configurable (always/auto/never or so).

There's a bit of a chicken-egg problem with post-transaction plugins:
for example systemd_inhibit should only be released after syncing,
but OTOH some other plugins might be performing actions whose results
should be syncing. Leaving it alone for now.
2017-09-07 12:01:39 +03:00
Panu Matilainen 80b5c12eaa Use pkg-config for figuring python cflags and libs
Simplifies things a bit and also makes "PYTHON=python3 ./configure" work,
whereas it previously barfed on figuring the library names like
"libpython3.6m"
2017-09-05 12:00:30 +03:00
Panu Matilainen d6be2e4312 Mark ndb and lmdb experimental in configure too
Nobody reads release notes, better carry the message here...
2017-09-01 14:03:39 +03:00
Jeff Johnson ed9de1992f Add LMDB backend to RPM
v2 (Neal Gompa)
  * Switch from RPM_CHECK_LIB to PKG_CHECK_MODULES
  * Fix notation of file name in lmdb.c
  * Remove MDB_FIXEDMAP flag to prevent portability issues
  * Add comment that lmdb is an option for %_db_backend

Closes: #281
Fixes: #128
2017-08-17 12:49:06 +03:00
Panu Matilainen 7e65bec67d Revert "Only build bundled fts if system has a bad version that doesn't handle LFS"
The subtle test is too subtle for its own good, this patch breaks
thirty six testcases on 32bit architectures.

This reverts commit 1eadabe445.
2017-08-10 20:15:02 +03:00
Panu Matilainen 2321badddc Bump version to appear newer than latest stable branch (4.14.x) 2017-08-10 10:52:33 +03:00
Jeff Johnson 3684424fe2 Add support for zstd compressed payload
v2 (Igor Gnatenko):
    * Switch off from RPM_CHECK_LIB
    * Reference zstd from rpm.pc
    * Link rpmio with zstd
  v3 (Florian Festi):
    * move changes to cvtfmode into separate patches
    * do not error out on wrong compression levels
    * ifdef out zstdio
    Closes: https://github.com/rpm-software-management/rpm/issues/256
    Closes: https://github.com/rpm-software-management/rpm/issues/297
    Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
2017-08-09 17:41:03 +02:00
Mark Wielaard 0da5cab15a config: Detect major/minor warnings and include the correct system header.
glibc 2.25 introduced (really long and annoying) warnings for each use
of the major/minor macros from the wrong header:

lib/cpio.c: In function ‘rpmcpioHeaderWrite’:
lib/cpio.c:245:13: warning: In the GNU C Library, "major" is defined
 by <sys/sysmacros.h>. For historical compatibility, it is
 currently defined by <sys/types.h> as well, but we plan to
 remove this soon. To use "major", include <sys/sysmacros.h>
 directly. If you did not intend to use a system-defined macro
 "major", you should undefine it after including <sys/types.h>.
     dev = major(st->st_dev); SET_NUM_FIELD(hdr->devMajor, dev, field);
             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Adjust the configure check to correctly detect the header to include
that doesn't produce those warning producing macros.

Tested against RHEL7 (glibc 2.17) and Fedora 26 (glibc 2.25).

Signed-off-by: Mark Wielaard <mark@klomp.org>
2017-07-21 15:35:18 +02:00
Panu Matilainen e9227ffb55 Check for libimaevm availability/usability in configure
Commit edd709e453 introduced a
dependency on ima-evm-utils >= 1.0, silently breaking build with
older versions that eg Fedora has. Explicitly test for sign_hash()
that takes all the necessary arguments and error out cleanly if
not present/too old.
2017-06-09 11:13:47 +03:00
Panu Matilainen a63bd11c16 Only librpmsign needs libimaevm, dont link to EVERYTHING... 2017-06-08 17:20:37 +03:00
Ayappan 2329af6667 Generalize primary user/group for platforms (#210) 2017-05-18 16:50:18 +03:00
Panu Matilainen 11323f335b Actually test for __progname too
Hopefully resurrecting whatever got broken by the round of changes
surrounding this, __progname is not an entirely glibc/linux thing.
2017-03-24 14:20:48 +02:00
Panu Matilainen 2a7e395f01 Determine setprogname() availability by actually testing for it
This way we dont need to include separate tests for the entire
BSD'ish family tree and who knows, might even cover some other
cases too.
2017-03-24 13:41:04 +02:00
Gleb Fotengauer-Malinovskiy 1eadabe445 Only build bundled fts if system has a bad version that doesn't handle LFS
Older versions of glibc included an fts implementation that didn't have
Large File Support on 32-bit systems.  We worked that around by bundling
fts into rpm codebase.  Thanks to Mark Wielaard, glibc >= 2.23 has LFS
support in fts.

Unfortunately, we can't drop bundled fts because we have to support
build with other libcs which do not implement fts at all or their
implementations do not provide Large File Support.

Signed-off-by: Gleb Fotengauer-Malinovskiy <glebfm@altlinux.org>

[pmatilai: Added comment to configure.ac as the test is rather subtle,
           thanks for Mark Wielaard for the explanation]
2017-03-24 12:42:40 +02:00