Skip to content

Commit 903e412

Browse files
author
Sebastian L
committed
Use busybox wget
- No need for real wget anymore, newer busybox wget works just fine with https urls - Add needed libraries for resolving
1 parent 5616cef commit 903e412

File tree

2 files changed

+8
-32
lines changed

2 files changed

+8
-32
lines changed

src/etc/initramfs-tools/hooks/wget.sh

Lines changed: 7 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -5,28 +5,12 @@ case $1 in
55
esac
66
. /usr/share/initramfs-tools/hook-functions
77

8-
copy_exec /usr/bin/wget /usr/bin/real_wget
9-
10-
strace_and_copy_libs_for_url ()
11-
{
12-
LIB_PAT="\".*/lib/.*\""
13-
STRACED_LIBS=$(strace /usr/bin/wget --no-iri -q -O - "$1" 2>&1 | grep -o "$LIB_PAT")
14-
15-
echo "$STRACED_LIBS" | while IFS= read -r line
16-
do
17-
# Strip the quotation marks
18-
line="${line%\"}"
19-
line="${line#\"}"
20-
21-
if [ -f "$line" ]
22-
then
23-
copy_exec "$line"
24-
fi
25-
done
26-
}
27-
28-
strace_and_copy_libs_for_url "https://www.debian.org"
29-
strace_and_copy_libs_for_url "https://raw.githubusercontent.com/stupidpupil/https-keyscript/master/tests/fixtures/encrypted_keyfile"
30-
strace_and_copy_libs_for_url "https://mozilla-modern.badssl.com"
8+
# To find out what library are needed do
9+
# strace busybox wget https://badssl.com 2>&1 | grep open
10+
for needed_lib in "libnss_dns.*" "libnss_files.so.*" "libresolv.so.*" "ld-linux-*.so.*" "libc.so.*"
11+
do
12+
lib=$(find /lib/ -name "$needed_lib" -type f)
13+
copy_exec "$lib"
14+
done
3115

3216
copy_exec /etc/ssl/certs/ca-certificates.crt

src/lib/cryptsetup/scripts/wget_or_ask

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,6 @@ if [ -z "$url" ] || [ -z "$openssl_passphrase" ]; then
3434
use_https=0
3535
fi
3636

37-
if [ -x /usr/bin/real_wget ]; then
38-
wget_path="/usr/bin/real_wget"
39-
elif [ -x /usr/bin/wget ]; then
40-
wget_path="/usr/bin/wget"
41-
else
42-
wget_path="wget"
43-
fi
44-
4537
#
4638
# Plymouth helper functions
4739
#
@@ -149,7 +141,7 @@ https_try_fetch ()
149141

150142
message "Fetching remote keyfile for $CRYPTTAB_NAME..."
151143

152-
encrypted_keyfile=$($wget_path --secure-protocol=PFS -q -O - "$url")
144+
encrypted_keyfile=$(wget -q -O - "$url")
153145

154146
if [ $? -eq 0 ]; then
155147
decrypted_keyfile=$(echo "$encrypted_keyfile" | openssl enc -base64 -aes-256-cbc -md sha256 -d -salt -k "$openssl_passphrase")

0 commit comments

Comments
 (0)