102.1. libewf-20240506
Expert Witness Format (E01, Ex01) forensic image library, the ewf tools and ewfmount
| Version | 20240506, release 1 |
| Shelf | security — Security applications: GnuPG and front-ends, password and secret managers, certificates, scanners, forensics and audit |
| Phase | 41_system (System), 925 of 1047 in build order |
| Licence | LGPL-3.0-or-later |
| Homepage | https://github.com/libyal/libewf |
| Build time | 1.2 SBU |
| Installed size | 12.1 MiB in 29 files |
| Recipe | ports/core/security/libewf/kpkgbuild |
About
libewf reads and writes the Expert Witness Compression Format, the .E01 and .Ex01 (and SMART .s01) evidence files that forensic acquisition tools produce: a disk image split into segments, compressed, and carrying hashes of the acquired data. It reads the logical evidence files, .L01 and .Lx01, as well. The package holds the library and the ewf tools: ewfacquire and ewfacquirestream to make an image, ewfinfo, ewfverify, ewfexport, ewfrecover and ewfdebug, and ewfmount, which presents an image as a raw file through FUSE. sleuthkit and testdisk open evidence files through it. It is one of the libyal libraries, as are libbfio, libvhdi, libvmdk and libvslvm.
Sources
libewf-20240506.tar.gz(2.6 MiB)
sha256247d8ee9572392a2404be514d1137f099970f41f240c1134ddc3f04322281c67
upstream: https://github.com/libyal/libewf/releases/download/20240506/libewf-experimental-20240506.tar.gz
archive copy: sources-4/security--libewf-20240506.tar.gzfuse3.patch
sha256ae613b97b539dbde175b9450c20236f8f57f065422bd4e3c61fc71a55400651c
Dependencies
Depends on: pkgconf, zlib, bzip2, openssl, util-linux, fuse.
Required by (2): sleuthkit, testdisk.
Optional, off in KDOS
These switches in build.sh turn off a feature whose library is a port here. The recipe may turn each off on purpose, or because the library was not yet a port when the recipe was written; this list cannot tell which.
--disable-python, line 21: python3 (explained with the switches below)
Patches
build.sh applies these; kpkg applies nothing by itself.
fuse3.patch— Portsewfmountto the libfuse 3 API. configure detects libfuse 3 and definesHAVE_LIBFUSE3, but the sources test onlyHAVE_LIBFUSEandHAVE_LIBOSXFUSE, so without the patchewfmountbuilds with no FUSE support at all. The patch addsHAVE_LIBFUSE3to each of those guards, setsFUSE_USE_VERSIONto 30 for it, creates the session withfuse_new()and thenfuse_mount()instead of libfuse 2’s channel calls, unmounts withfuse_unmount()beforefuse_destroy(), and adds the extra arguments libfuse 3 passes togetattr,readdirand the directory filler.
Installation
From the repository root, inside the build container, this is the line kdosbuild runs for the port:
script/chroot/exec.sh bash -c 'source script/phases/41_system/phase.env && kpkg install libewf'
What kpkg does
kpkg runs these steps, in this order, as root inside the chroot. The port directory is /ports/core/security/libewf.
1. Verify every declared source. Each file a sha256 = line names, found in the port directory or in /var/cache/kpkg/sources, must hash to its line; a mismatch stops the build before anything is unpacked.
cd /ports/core/security/libewf
echo '247d8ee9572392a2404be514d1137f099970f41f240c1134ddc3f04322281c67 libewf-20240506.tar.gz' | sha256sum -c -
echo 'ae613b97b539dbde175b9450c20236f8f57f065422bd4e3c61fc71a55400651c fuse3.patch' | sha256sum -c -
2. Unpack. The work directory is emptied and the first source is unpacked into $SRC with its top directory stripped; any later tarball lands unstripped beside it in $SRC_ROOT, and a file that is not a tarball is copied into $SRC.
SRC_ROOT=/var/cache/kpkg/work/libewf
SRC=$SRC_ROOT/libewf-20240506
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf libewf-20240506.tar.gz -C "$SRC" --strip-components=1
Every config.guess and config.sub older than automake’s is then replaced with automake’s, so a configure script recognises the musl target.
3. Build. build.sh is sourced in a subshell under set -e, from $SRC, with name, version, release and the five paths PKGNAME, PORT_SRC, SRC_ROOT, SRC and PKG set as shell variables. Its body, verbatim:
patch -p1 -i "$PORT_SRC/fuse3.patch"
./configure \
--prefix=/usr \
--libdir=/usr/lib \
--mandir=/usr/share/man \
--disable-static \
--disable-nls \
--disable-rpath \
--disable-python \
--enable-multi-threading-support \
--enable-openssl-evp-md \
--enable-openssl-evp-cipher \
--with-pthread \
--with-zlib \
--with-adler32=zlib \
--with-bzip2 \
--with-openssl \
--with-libuuid=/usr \
--with-libfuse \
--with-libcerror=no \
--with-libcthreads=no \
--with-libcdata=no \
--with-libcdatetime=no \
--with-libclocale=no \
--with-libcnotify=no \
--with-libcsplit=no \
--with-libuna=no \
--with-libcfile=no \
--with-libcpath=no \
--with-libbfio=no \
--with-libfcache=no \
--with-libfdata=no \
--with-libfdatetime=no \
--with-libfguid=no \
--with-libfvalue=no \
--with-libhmac=no \
--with-libcaes=no \
--with-libodraw=no \
--with-libsmdev=no \
--with-libsmraw=no
for have in HAVE_PTHREAD HAVE_ZLIB HAVE_BZLIB HAVE_LIBCRYPTO HAVE_UUID_GENERATE_RANDOM HAVE_LIBFUSE3; do
if ! grep -q "^#define $have 1" common/config.h; then
echo "libewf: configure did not find $have" >&2
exit 1
fi
done
make
make DESTDIR=$PKG install
rm -f $PKG/usr/lib/*.la
The switches, and why each is set:
--with-libcerror=no,--with-libcthreads=no,--with-libcdata=no,--with-libcdatetime=no,--with-libclocale=no,--with-libcnotify=no,--with-libcsplit=no,--with-libuna=no,--with-libcfile=no,--with-libcpath=no,--with-libbfio=no,--with-libfcache=no,--with-libfdata=no,--with-libfdatetime=no,--with-libfguid=no,--with-libfvalue=no,--with-libhmac=no,--with-libcaes=no,--with-libodraw=no,--with-libsmdev=no,--with-libsmraw=no— For each of these libyal support libraries, “no” means “use the local version”: the copy in the release tarball is compiled intolibewfand the tools. None of them but libbfio is a port, and without the switch configure would link any copy it found installed instead. libbfio has a port, but libewf keeps its own: its consumers open an image by file name (libewf_handle_open()in sleuthkit), so no libbfio object crosses into libewf from outside.--enable-multi-threading-support,--with-pthread— Build the thread-safe library on POSIX threads. Both are upstream’s defaults when pthreads is found.--enable-openssl-evp-md,--with-openssl— Compute the MD5, SHA-1 and SHA-256 hashes of the image data with OpenSSL’s EVP digests instead of the bundled libhmac’s own code.--enable-openssl-evp-cipher— Do AES with OpenSSL’s EVP ciphers in the bundled libcaes.--with-zlib,--with-adler32=zlib— Compress and decompress with zlib, and take the Adler-32 checksums from zlib rather than from libewf’s own implementation.--with-bzip2— Build libewf’s bzip2 chunk compression on bzip2, forEx01images whose chunks are bzip2-compressed. Upstream’s README lists bzip2 compression ofEx01as not supported, a work in progress.--with-libuuid=/usr— Generate image GUIDs with util-linux’slibuuid;ewfacquirewrites one into each image it makes. The switch names a directory rather thanyesbecause the pkg-config branch of this release’slibuuid.m4links nothing.--with-libfuse— Buildewfmounton libfuse. The tree’s fuse is libfuse 3, which configure finds, and whichewfmountcan use only with the patch below.--disable-rpath— Link the tools without anRPATHto/usr/lib.--disable-python— Build nopyewfmodule; upstream’s default.
The common switches of each build system are explained in the Flag glossary.
4. Package. kpkg removes libtool archives, the info directory index, mimeinfo.cache and every fonts.dir from $PKG, copies the source’s licence files into /usr/share/licenses/libewf, prunes what the image does not ship, lints the tree and rolls it reproducibly:
tar --sort=name --format=gnu --numeric-owner --owner=0 --group=0 \
--mtime=@$SOURCE_DATE_EPOCH \
--use-compress-program='xz -9 -T0 --block-size=32MiB --no-adjust' \
-cf libewf-20240506-1.tar.xz -C "$PKG" .
5. Adopt. kpkgadd installs the package’s files over the root, refusing a path another package owns, records the file list in /var/lib/kpkg/db/libewf, and runs the triggers its paths call for.
Contents
Installed programs: ewfacquire, ewfacquirestream, ewfdebug, ewfexport, ewfinfo, ewfmount, ewfrecover, ewfverify.
Installed libraries: libewf.so.
Installed directories: /usr/include/libewf, /usr/share/licenses/libewf.
Short descriptions
ewfacquire |
acquires data in the EWF format |
ewfacquirestream |
acquires data in the EWF format from stdin |
ewfexport |
exports media data stored in EWF files |
ewfinfo |
show meta data stored in EWF files |
ewfmount |
mount data stored in EWF files |
ewfrecover |
exports media data stored in EWF files |
ewfverify |
verifies media data stored in EWF files |
libewf.pc |
Library to access the Expert Witness Compression Format (EWF) format |
Notes
The loop after configure reads common/config.h and stops the build unless pthreads, zlib, bzip2, libcrypto, uuid_generate_random and libfuse 3 were all found. configure treats every one of them as optional and would otherwise build a smaller libewf without saying so.
rm -f $PKG/usr/lib/*.la removes the libtool archive the install leaves behind.