105.17. libssh-0.12.2
SSH protocol library (client and server)
| Version | 0.12.2, release 1 |
| Shelf | net-libs — Networking and protocol libraries |
| Phase | 41_system (System), 795 of 1047 in build order |
| Licence | LGPL-2.1-or-later |
| Homepage | https://www.libssh.org/ |
| Build time | 0.5 SBU |
| Installed size | 1.0 MiB in 18 files |
| Recipe | ports/core/net-libs/libssh/kpkgbuild |
About
libssh is a C library implementing the SSH protocol, client and server, with SFTP and SCP. It is not OpenSSH’s code. wireshark uses it for remote capture over SSH, remmina and krdc for SSH sessions and tunnels, kio-extras for the sftp:/ locations of Dolphin and the file dialogs, and konsole and nbdkit for their SSH support. Cryptography comes from openssl.
Sources
libssh-0.12.2.tar.xz(741.9 KiB)
sha25649560f677d96e3706a904ac2de1116e25f3680937d51e5c92198fcba4a1c1e9f
upstream: https://www.libssh.org/files/0.12/libssh-0.12.2.tar.xz
archive copy: sources-3/net-libs--libssh-0.12.2.tar.xz
Dependencies
Depends on: cmake, ninja, pkgconf, openssl, zlib, krb5, libfido2.
Required by (6): kio-extras, konsole, krdc, nbdkit, remmina, wireshark.
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.
-DWITH_GCRYPT=OFF, line 23: libgcrypt (explained with the switches below)-DWITH_MBEDTLS=OFF, line 24: mbedtls
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 libssh'
What kpkg does
kpkg runs these steps, in this order, as root inside the chroot. The port directory is /ports/core/net-libs/libssh.
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/net-libs/libssh
echo '49560f677d96e3706a904ac2de1116e25f3680937d51e5c92198fcba4a1c1e9f libssh-0.12.2.tar.xz' | 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/libssh
SRC=$SRC_ROOT/libssh-0.12.2
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf libssh-0.12.2.tar.xz -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:
mkdir build && cd build
cmake .. -G Ninja \
-DCMAKE_POLICY_VERSION_MINIMUM=3.5 \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=/usr \
-DCMAKE_INSTALL_LIBDIR=lib \
-DBUILD_SHARED_LIBS=ON \
-DWITH_GSSAPI=ON \
-DWITH_ZLIB=ON \
-DWITH_SFTP=ON \
-DWITH_SERVER=ON \
-DWITH_GCRYPT=OFF \
-DWITH_MBEDTLS=OFF \
-DWITH_NACL=OFF \
-DWITH_FIDO2=ON \
-DWITH_PKCS11_URI=OFF \
-DWITH_PKCS11_PROVIDER=OFF \
-DWITH_GEX=ON \
-DWITH_PCAP=ON \
-DWITH_EXEC=ON \
-DWITH_SYMBOL_VERSIONING=ON \
-DWITH_INSECURE_NONE=OFF \
-DWITH_BLOWFISH_CIPHER=OFF \
-DWITH_EXAMPLES=OFF \
-DWITH_INTERNAL_DOC=OFF \
-DUNIT_TESTING=OFF \
-DCLIENT_TESTING=OFF \
-DSERVER_TESTING=OFF \
-DGSSAPI_TESTING=OFF \
-DFUZZ_TESTING=OFF \
-DWITH_BENCHMARKS=OFF
ninja
DESTDIR=$PKG ninja install
The switches, and why each is set:
-DWITH_GSSAPI=ON— Build GSSAPI (Kerberos) user authentication against krb5. This and-DWITH_ZLIB=ON(compression),-DWITH_SFTP=ON,-DWITH_SERVER=ON(the server-side API),-DWITH_GEX=ON(Diffie-Hellman group exchange),-DWITH_PCAP=ON(writing a session’s packets to a pcap file for debugging),-DWITH_EXEC=ONand-DWITH_SYMBOL_VERSIONING=ONare upstream’s defaults.-DWITH_EXEC=ON— Let libssh run commands named in an SSH configuration file or in options:Match exec,ProxyCommandand OpenSSH-styleProxyJump.-DWITH_GCRYPT=OFF— Use OpenSSL as the crypto backend, not libgcrypt;-DWITH_MBEDTLS=OFFlikewise rules out mbed TLS.-DWITH_NACL=OFF— Do not look for libnacl for curve25519; upstream’s default is to use it when found. The tree has no libnacl, and the curve25519 key exchange is then served by OpenSSL.-DWITH_FIDO2=ON— Support FIDO2/U2F security-key SSH keys (sk-ecdsa,sk-ed25519) through libfido2. Upstream leaves it off.-DWITH_PKCS11_URI=OFF— Accept nopkcs11:URIs for keys held on smart cards and HSMs, and with-DWITH_PKCS11_PROVIDER=OFFuse no OpenSSL PKCS#11 provider. Both are upstream’s defaults.-DWITH_INSECURE_NONE=OFF— Leave out thenonecipher and MAC, which send a session unencrypted and unauthenticated.-DWITH_BLOWFISH_CIPHER=OFFleaves out Blowfish-CBC. Both are upstream’s defaults.-DWITH_EXAMPLES=OFF— Build none of the example programs, which upstream builds by default.-DWITH_INTERNAL_DOC=OFF— Generate no Doxygen documentation of the internals.-DCLIENT_TESTING=OFF— Build none of the test suites: with-DUNIT_TESTING=OFF,-DSERVER_TESTING=OFF,-DGSSAPI_TESTING=OFF,-DFUZZ_TESTING=OFFand-DWITH_BENCHMARKS=OFF. The client and server suites need OpenSSH and dropbear to run against, and the fuzzers turn thenonecipher on.
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/libssh, 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 libssh-0.12.2-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/libssh, and runs the triggers its paths call for.
Contents
Installed libraries: libssh.so.
Installed directories: /usr/include/libssh, /usr/lib/cmake/libssh, /usr/share/licenses/libssh.
Short descriptions
libssh.pc |
The SSH Library |