fetch-url does not use --no-check-certificate on HTTP to HTTPS redirects
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
debian-installer-utils (Debian) |
New
|
Unknown
|
|||
debian-installer-utils (Ubuntu) |
Invalid
|
Medium
|
Unassigned | ||
Trusty |
Invalid
|
Medium
|
Unassigned | ||
Xenial |
Invalid
|
Medium
|
Unassigned | ||
Bionic |
Invalid
|
Medium
|
Unassigned | ||
Cosmic |
Invalid
|
Medium
|
Unassigned |
Bug Description
[Impact]
* fetch-url fails to download files from URL with HTTP to HTTPS
redirect if server has invalid/cannot be verified certificate.
* Install fails in case a preseed/other files use an HTTP URL
that redirects to an HTTPS URL with an invalid certificate.
* Servers/URLs that started using HTTP to HTTPS redirect and
have their URLs already spread over scripts/
start to cause install/deployment failures.
* This fix checks for debian-
in the HTTP protocol as well (to enable --no-check-
which is OK as that option must be explicitly enabled by users,
indicating awareness of the SSL/HTTPS context and certificates
that may not be verified.
[Test Case]
* Setup web-server with HTTP to HTTPS redirect and an invalid/
self-signed certificate, and put a file (eg, preseed) on it.
* Boot with preseed option 'url=http://<server>/preseed' and
the install will fail in the 'network-preseed' stage, with
syslog errors about invalid/cannot be verified certificates,
suggesting the 'wget --no-check-
* Other files downloaded by the installer can hit same error,
if using HTTP URLs from that server.
* In the installer shell, run:
~ # fetch-url http://<server>/<file>
[Regression Potential]
* Low risk of regression, this only expands the check from HTTPS-only
to HTTPS or HTTP, to *then* check for d-i/allow_
* The theoretical case is that a HTTP URL with no redirect to HTTPS
may use --no-check-
(it should not cause problems at all, the option should be ignored)
but anyway, since the user acknowledged that sort of behavior with
the d-i/allow_
[Other Info]
* Debian Bug #913740.
[Problem Description]
In fetch-url the --no-check-
In case of HTTP to HTTPS redirect, that option is not enabled, and may
cause fetch-url to fail if the certificate cannot be verified.
Since that option/
debian-
is aware of SSL/HTTPS context and agrees w/ non-verified certificates)
we can just check for this in the HTTP protocol too, and assume HTTPS
may potentially be used, as the user specified this option.
An alternative/obvious solution in the _user_ side is to specify HTTPS
URLs upfront, but there are cases when an user does not know for sure
whether the server uses/supports that, or the server might change its
behavior and start HTTP to HTTPS redirect after URLs have spread over
(e.g., scripts and infrastructure) - thus a fix in the installer side
is a simpler and more complete approach.
Changed in debian-installer-utils (Ubuntu): | |
status: | New → Confirmed |
assignee: | nobody → Mauricio Faria de Oliveira (mfo) |
Changed in debian-installer-utils (Debian): | |
status: | Unknown → New |
Changed in debian-installer-utils (Ubuntu): | |
importance: | Undecided → Medium |
tags: | added: rls-x-notfixing |
Testing performed with Disco, Cosmic, Bionic, Xenial, and Trusty.
The output is similar if not identical, so pasting just one test, from Disco.
(Web Server, HTTP/HTTPS redirect, setup not included, ping me if interested.)
$ wget http:// archive. ubuntu. com/ubuntu/ dists/disco/ main/installer- amd64/current/ images/ netboot/ ubuntu- installer/ amd64/{linux,initrd.gz}
$ GUEST=disco
$ virt-install \ qcow2,bus= virtio, format= qcow2,size= 8 \ virbr0, model=virtio \ args='console= ttyS0 url=http:// 192.168. 122.1/preseed debian- installer/ allow_unauthent icated_ ssl=true'
--name $GUEST \
--vcpus 2 \
--memory 1024 \
--disk $GUEST.
--network bridge=
--graphics none \
--import \
--boot \
kernel=linux,\
initrd=initrd.gz,\
kernel_
The installer hits an error when trying to get the preseed file:
┌──────────┤ [!!] Download debconf preconfiguration file ├──────────┐ 192.168. 122.1/preseed. The installation will proceed in │ ─────── ─────── ─────── ─────── ─────── ─────── ─────── ─────── ─────── ───┘
│ │
│ Failed to retrieve the preconfiguration file │
│ The file needed for preconfiguration could not be retrieved from │
│ http://
│ non-automated mode. │
│ │
│ <Continue> │
│ │
└─
The synthetic tests with fetch-url:
===
~ # cat /proc/cmdline 192.168. 122.1/preseed debian- installer/ allow_unauthent icated_ ssl=true
console=ttyS0 url=http://
~ # cat /etc/default- release
disco
Without patch:
---
~ # fetch-url http:// 192.168. 122.1/preseed preseed certificate' .
ERROR: cannot verify 192.168.122.1's certificate, ...
...
To connect to 192.168.122.1 insecurely, use `--no-check-
~ # echo $?
1
With patch:
---
~ # wget --no-check- certificate http:// 192.168. 122.1/di- utils_1. 124ubuntu2_ amd64.udeb 1.124ubuntu2_ amd64.udeb
~ # udpkg -i di-utils_
~ # fetch-url http:// 192.168. 122.1/preseed preseed /192.168. 122.1// preseed [11/11] -> "./_fetch- url_preseed. 1467" [1]
WARNING: cannot verify 192.168.122.1's certificate, ...
...
2018-11-14 13:17:03 URL:https:/
~ # echo $?
0
With patch and Without d-i/allow_ unauthenticated _ssl=true: No Change
---
~ # cat /proc/cmdline 192.168. 122.1/preseed
console=ttyS0 url=http://
~ # wget --no-check- certificate http:// 192.168. 122.1/di- utils_1. 124ubuntu2_ amd64.udeb 1.124ubuntu2_ amd64.udeb
~ # udpkg -i di-utils_
~ # fetch-url http:// 192.168. 122.1/preseed preseed certificate' .
ERROR: cannot verify 192.168.122.1's certificate, ...
...
To connect to 192.168.122.1 insecurely, use `--no-check-
~ # echo $?
1