102.9. john-1.9.0.jumbo1
John the Ripper password hash cracker
| Version | 1.9.0.jumbo1, release 2 |
| Shelf | security — Security applications: GnuPG and front-ends, password and secret managers, certificates, scanners, forensics and audit |
| Phase | 41_system (System), 933 of 1047 in build order |
| Licence | GPL-2.0-or-later |
| Homepage | https://www.openwall.com/john/ |
| Build time | 6.8 SBU |
| Installed size | 90.2 MiB in 529 files |
| Recipe | ports/core/security/john/kpkgbuild |
About
John the Ripper, in its community “jumbo” edition, is a password hash cracker. With its *2john converters it reads the hash out of a LUKS header, a KeePass database, an encrypted PDF, ZIP or 7-Zip archive, an SSH key or /etc/shadow, and then tests candidate passwords against it, which answers how long a password of your own would hold. The package ships upstream’s small default password.lst and no other wordlist. Its GPU formats run through OpenCL when a device is present.
John chooses its SIMD code only when it is compiled, so build.sh builds it five times, once per instruction-set level, and installs the five as a chain that hands over at start-up to the best one the processor can run. This is the per-level form of the rule in Every port.
Why it is in KDOS
The comment above it in script/phases/41_system/packages.d/security.txt:
Reads a hash out of a LUKS header, a KeePass database, an encrypted PDF or ZIP, or /etc/shadow, and answers "how long would this take" — about your own material. No breach corpus is shipped.
Sources
john-1.9.0.jumbo1.tar.gz(45.3 MiB)
sha25616bfecad0cddad146564abb76b6e6b28a71653670c2799d60ca4035db5f3b9c4
upstream: https://github.com/openwall/john/archive/refs/tags/1.9.0-Jumbo-1.tar.gz
archive copy: sources-4/security--john-1.9.0.jumbo1.tar.gz
Dependencies
Depends on: autoconf, pkgconf, openssl, zlib, bzip2, gmp, libpcap, opencl-headers, ocl-icd.
Required by: no port names it.
Patches
build.sh applies these; kpkg applies nothing by itself.
blake2-align.patch— MovesJTR_ALIGN(64)insrc/blake2.hfrom beforetypedef struct __blake2s_stateand__blake2b_stateto after their closing braces. Placed before the typedef, the attribute attaches to the declaration and not to the type, so the struct’s size is never padded to its alignment, andblake2b_state S[4][1]insideblake2bp_statebecomes an array whose element size is not a multiple of its alignment, which GCC rejects as an error with no-Wno-switch to answer it. Only the two_statestructs are moved:blake2sp_stateandblake2bp_statehave the same placement but are in no array, and their attribute sits inside an#ifwhere moving it would change the alignment of the non-SIMD build.cprepair-ldflags.patch— Adds@LDFLAGS@to the link line ofcprepairinsrc/Makefile.in. Upstream links it with noLDFLAGSat all, so it would miss the tree’s linker flags, among them-z now, whose absence the package lint warns about.cpu-fallback-first.patch— CallsCPU_detect_or_fallback()at the very top ofmain()insrc/john.c, beforesig_preinit()andpath_init(). Those two are compiled for the build’s SIMD level, so without the patch the AVX-512 build dies ofSIGILLon an AVX2 machine before it reaches the fallback. The early call is made only in a build withCPU_FALLBACKand a fixedJOHN_SYSTEMWIDE_EXEC, where the test needs nothing those two functions set up.opencl-topology.patch— Insrc/opencl_common.h, guards AMD’scl_device_topology_amdunion onCL_DEVICE_TOPOLOGY_TYPE_PCIE_AMDinstead of onCL_DEVICE_TOPOLOGY_AMD. Current OpenCL headers define the second macro without the union, so with upstream’s guard the union is never declared and the OpenCL build stops at an unknown type.
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 john'
What kpkg does
kpkg runs these steps, in this order, as root inside the chroot. The port directory is /ports/core/security/john.
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/john
echo '16bfecad0cddad146564abb76b6e6b28a71653670c2799d60ca4035db5f3b9c4 john-1.9.0.jumbo1.tar.gz' | 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/john
SRC=$SRC_ROOT/john-1.9.0.jumbo1
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf john-1.9.0.jumbo1.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 recipe’s helpers _tag and the five paths PKGNAME, PORT_SRC, SRC_ROOT, SRC and PKG set as shell variables. Its body, verbatim:
patch -p1 -i "$PORT_SRC/blake2-align.patch"
patch -p1 -i "$PORT_SRC/opencl-topology.patch"
patch -p1 -i "$PORT_SRC/cpu-fallback-first.patch"
patch -p1 -i "$PORT_SRC/cprepair-ldflags.patch"
export CFLAGS="$CFLAGS -fcommon"
cd src
_opts=(--prefix=/usr --disable-native-tests --disable-mpi --enable-pcap --enable-opencl)
_base_cflags="$CFLAGS"
for _lvl in avx512bw:john avx2:john-non-avx512bw xop:john-non-avx2 avx:john-non-xop; do
CFLAGS="$_base_cflags -DCPU_FALLBACK" ./configure "${_opts[@]}" \
--enable-simd="${_lvl%%:*}"
make clean
make
mv ../run/john ../run/.simd-"${_lvl#*:}"
done
CFLAGS="$_base_cflags" ./configure "${_opts[@]}"
make clean
make
mv ../run/john ../run/john-non-avx
for _f in ../run/.simd-*; do
mv "$_f" ../run/"${_f#../run/.simd-}"
done
install -dm755 $PKG/usr/share/john $PKG/usr/bin
cd ../run
rm -f $(grep -l '^#!.*python2' *.py)
for f in *; do
if [ -L "$f" ]; then
ln -s "$(readlink "$f")" $PKG/usr/bin/"$f"
elif [ -f "$f" ] && [ "$(head -c4 "$f")" = $'\x7fELF' ]; then
install -m755 "$f" $PKG/usr/bin/"$f"
else
cp -a "$f" $PKG/usr/share/john/
fi
done
rm -rf $PKG/usr/share/john/ztex
install -Dm644 "$SRC/doc/COPYING" $PKG/usr/share/licenses/$name/COPYING
install -Dm644 "$SRC/doc/LICENSE" $PKG/usr/share/licenses/$name/LICENSE
for f in *2john*; do
[ -e $PKG/usr/bin/"$f" ] && continue
[ "$(head -c2 "$f")" = '#!' ] || continue
chmod 755 $PKG/usr/share/john/"$f"
ln -s ../share/john/"$f" $PKG/usr/bin/"$f"
done
The switches, and why each is set:
--prefix=/usr— For john this does more than place files. It makes the build system-wide: john readsjohn.conf, the rules and the.chrfiles from/usr/share/johnand keeps its pot, log and session files in~/.john, instead of looking for everything in the directory its binary is in, which for a command in/usr/binholds none of it. It also setsJOHN_SYSTEMWIDE_EXECto/usr/bin, the directory the fallback chain belowexecs from.--disable-native-tests— Do not probe the build machine’s processor. Without it configure compiles in the best instruction set the builder has, and the package dies ofSIGILLon any processor that lacks it.--enable-simd— In the loop,--enable-simd=avx512bw,avx2,xopandavxin turn. Each compiles every file with that level exceptjohn.c, which is told the level by a define and tests the processor for it first. The level must not go intoCFLAGS, orjohn.citself would be compiled for it and die before the test. The fifth build, with no--enable-simd, is the SSE2 baseline every x86-64 processor runs.-DCPU_FALLBACK— Added to the four SIMD builds. When the processor fails the test, johnexecv()s the next build down by the namex86-64.hgives it, from/usr/bin, withargvunchanged:john(AVX-512BW) tojohn-non-avx512bw(AVX2) tojohn-non-avx2(XOP) tojohn-non-xop(AVX) tojohn-non-avx(SSE2). Becauseargvis passed on,unshadow,zip2johnand the other links tojohnkeep their meaning through the chain.export CFLAGS="$CFLAGS -fcommon"— Several format files declare file-scope globals withoutstaticunder names another format file also uses:psaltandkeyfiles_datain both the CPU and the OpenCL TrueCrypt formats,insizeacross many of the OpenCL formats, and others. With GCC’s default-fno-commonevery such name is a multiple-definition link error;-fcommonmerges them, as the code was written for.--disable-mpi— Build without OpenMPI support, which is off unless asked for; there is no OpenMPI port.--enable-pcap— Make configure stop with “PCAP not installed/usable” when libpcap is missing, instead of quietly leaving out the helpers that need it (vncpcap2john,SIPdump,eapmd5tojohn). libpcap is independs.--enable-opencl— Build the GPU formats. configure includes them whenCL/cl.hcompiles and-lOpenCLlinks, which is what opencl-headers and ocl-icd independsprovide; the “OpenCL support” line of configure’s summary says whether it did.
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/john, 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 john-1.9.0.jumbo1-2.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/john, and runs the triggers its paths call for.
Contents
Installed programs: 7z2john.pl, DPAPImk2john.py, SIPdump, adxcsouf2john.py, aem2john.py, aix2john.pl, aix2john.py, andotp2john.py, androidbackup2john.py, androidfde2john.py, ansible2john.py, apex2john.py, applenotes2john.py, aruba2john.py, axcrypt2john.py, base64conv, bestcrypt2john.py, bitcoin2john.py, bitlocker2john, bitshares2john.py, bks2john.py, blockchain2john.py, calc_stat, cisco2john.pl, cprepair, cracf2john.py, dashlane2john.py, deepsound2john.py, diskcryptor2john.py, dmg2john, dmg2john.py, eapmd5tojohn, ecryptfs2john.py, ejabberd2john.py, electrum2john.py, encfs2john.py, enpass2john.py, ethereum2john.py, filezilla2john.py, geli2john.py, genmkvpwd, gpg2john, hccap2john, hccapx2john.py, htdigest2john.py, ibmiscanner2john.py, ikescan2john.py, itunes_backup2john.pl, iwork2john.py, john, john-non-avx, john-non-avx2, john-non-avx512bw, john-non-xop, kdcdump2john.py, keepass2john, keychain2john.py, keyring2john.py, keystore2john.py, kirbi2john.py, known_hosts2john.py, kwallet2john.py, lastpass2john.py, ldif2john.pl, libreoffice2john.py, lion2john-alt.pl, lion2john.pl, lotus2john.py, luks2john.py, mac2john-alt.py, mac2john.py, mcafee_epo2john.py, mkvcalcproba, monero2john.py, money2john.py, mozilla2john.py, multibit2john.py, neo2john.py, office2john.py, openbsd_softraid2john.py, openssl2john.py, padlock2john.py, pcap2john.py, pdf2john.pl, pem2john.py, pfx2john.py, pgpdisk2john.py, pgpsda2john.py, pgpwde2john.py, prosody2john.py, ps_token2john.py, pse2john.py, putty2john, pwsafe2john.py, racf2john, radius2john.pl, radius2john.py, rar2john, raw2dyna, sap2john.pl, signal2john.py, sipdump2john.py, ssh2john.py, sspr2john.py, staroffice2john.py, strip2john.py, telegram2john.py, tezos2john.py, tgtsnarf, truecrypt2john.py, uaf2john, unafs, undrop, unique, unshadow, vdi2john.pl, vmx2john.py, vncpcap2john, wpapcap2john, zip2john.
Installed directories: /usr/share/john, /usr/share/licenses/john.
Notes
The baseline build is the last one made. The helper programs it leaves in run/ (calc_stat, SIPdump, the *2john converters written in C) are the only copies shipped, and being SSE2 builds they run on any x86-64. The loop parks each SIMD john as .simd-<name> so the next make clean does not delete it, and renames the five into place at the end. A new level must use a name x86-64.h expects, or nothing ever execs it.
The install sorts run/ by kind: ELF programs and the links to john go to /usr/bin, and everything else (scripts, the Python modules they import, data) to /usr/share/john. The Python scripts that declare python2 are deleted first, since the tree has no Python 2. Each scripted *2john converter then gets a link in /usr/bin, so ssh2john.py is a command.
run/ztex holds prebuilt FPGA bitstreams and a USB controller image for the ZTEX 1.15y board. --enable-ztex is not passed, so nothing in the package can load them, and build.sh removes them.