Skip to content

Commit 119c293

Browse files
authored
Accept IPE_INSECURE to control if curl should skip HTTPS checks (#1226)
1 parent 6d5164c commit 119c293

2 files changed

Lines changed: 32 additions & 23 deletions

File tree

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -470,6 +470,7 @@ Here's the list of all the supported environment variables:
470470
| Extension | Environment variable | Description |
471471
|---|---|---|
472472
| | `IPE_DEBUG=1` | By setting this environment variable, the script will print all the commands it executes (it will be very verbose, useful only for debug purposes) |
473+
| | `IPE_INSECURE=1` | By setting this environment variable, HTTPS certificate validation is disabled for network operations performed by the program |
473474
| | `IPE_PROCESSOR_COUNT` | By default all available processors. Set this environment variable to override the number of processors detected by the script (used for parallel compilation) |
474475
| | `IPE_DONT_ENABLE=1` | By default the script will install and enable the extensions.<br />If you want to only install them (without enabling them) you can set this environment variable.<br />To enable the extensions at a later time you can execute the command `docker-php-ext-enable-<extension>` (for example: `docker-php-ext-enable-xdebug`).<br />**Beware**: installing some PHP extensions requires that other PHP extensions are already enabled, so use this feature wisely. |
475476
| | `IPE_SKIP_CHECK=1` | By default the script will check if the extensions can be enabled: if you want to skip this check, you can use this flag.<br />**Beware**: extensions may be enabled even if they break PHP: use this function wisely. |

install-php-extensions

Lines changed: 31 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -395,7 +395,7 @@ resolvePHPModuleVersion() {
395395
;;
396396
esac
397397
resolvePHPModuleVersion_peclModule="$(getPeclModuleName "$resolvePHPModuleVersion_module")"
398-
resolvePHPModuleVersion_xml="$(curl -sSLf "http://pecl.php.net/rest/r/$resolvePHPModuleVersion_peclModule/allreleases.xml")"
398+
resolvePHPModuleVersion_xml="$(curl $IPE_CURL_FLAGS -sSLf "http://pecl.php.net/rest/r/$resolvePHPModuleVersion_peclModule/allreleases.xml")"
399399
# remove line endings, collapse spaces
400400
resolvePHPModuleVersion_versions="$(printf '%s' "$resolvePHPModuleVersion_xml" | tr -s ' \t\r\n' ' ')"
401401
# one line per release (eg <r><v>1.2.3</v><s>stable</s></r>)
@@ -459,7 +459,7 @@ resolvePeclStabilityVersion() {
459459
esac
460460
resolvePeclStabilityVersion_peclModule="$(getPeclModuleName "$1")"
461461
peclStabilityFlagToVersion_url="http://pecl.php.net/rest/r/$resolvePeclStabilityVersion_peclModule/$2.txt"
462-
if ! peclStabilityFlagToVersion_result="$(curl -sSLf "$peclStabilityFlagToVersion_url")"; then
462+
if ! peclStabilityFlagToVersion_result="$(curl $IPE_CURL_FLAGS -sSLf "$peclStabilityFlagToVersion_url")"; then
463463
peclStabilityFlagToVersion_result=''
464464
fi
465465
if test -z "$peclStabilityFlagToVersion_result"; then
@@ -2252,24 +2252,24 @@ installMicrosoftSqlServerODBC() {
22522252
installMicrosoftSqlServerODBC_url=https://download.microsoft.com/download/9dcab408-e0d4-4571-a81a-5a0951e3445f/msodbcsql18_18.6.1.1-1_$installMicrosoftSqlServerODBC_arch.apk
22532253
fi
22542254
printf 'APK package URL: %s\n' "$installMicrosoftSqlServerODBC_url"
2255-
curl -sSLf -o /tmp/src/msodbcsql.apk "$installMicrosoftSqlServerODBC_url"
2255+
curl $IPE_CURL_FLAGS -sSLf -o /tmp/src/msodbcsql.apk "$installMicrosoftSqlServerODBC_url"
22562256
printf '\n' | apk add --allow-untrusted /tmp/src/msodbcsql.apk
22572257
rm -rf /tmp/src/msodbcsql.apk
22582258
;;
22592259
debian)
22602260
printf -- '- installing the Microsoft APT key\n'
22612261
if test $DISTRO_VERSION_NUMBER -ge 13; then
2262-
curl https://packages.microsoft.com/keys/microsoft-2025.asc | gpg --dearmor --yes --output /usr/share/keyrings/microsoft-prod.gpg
2262+
curl $IPE_CURL_FLAGS https://packages.microsoft.com/keys/microsoft-2025.asc | gpg --dearmor --yes --output /usr/share/keyrings/microsoft-prod.gpg
22632263
elif test $DISTRO_VERSION_NUMBER -ge 12; then
2264-
curl https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor --yes --output /usr/share/keyrings/microsoft-prod.gpg
2264+
curl $IPE_CURL_FLAGS https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor --yes --output /usr/share/keyrings/microsoft-prod.gpg
22652265
elif test $DISTRO_VERSION_NUMBER -ge 11; then
2266-
curl -sSLf -o /etc/apt/trusted.gpg.d/microsoft.asc https://packages.microsoft.com/keys/microsoft.asc
2266+
curl $IPE_CURL_FLAGS -sSLf -o /etc/apt/trusted.gpg.d/microsoft.asc https://packages.microsoft.com/keys/microsoft.asc
22672267
else
2268-
curl -sSLf https://packages.microsoft.com/keys/microsoft.asc | apt-key add -
2268+
curl $IPE_CURL_FLAGS -sSLf https://packages.microsoft.com/keys/microsoft.asc | apt-key add -
22692269
fi
22702270
if ! test -f /etc/apt/sources.list.d/mssql-release.list; then
22712271
printf -- '- adding the Microsoft APT source list\n'
2272-
curl -sSLf https://packages.microsoft.com/config/debian/$DISTRO_VERSION_NUMBER/prod.list >/etc/apt/sources.list.d/mssql-release.list
2272+
curl $IPE_CURL_FLAGS -sSLf https://packages.microsoft.com/config/debian/$DISTRO_VERSION_NUMBER/prod.list >/etc/apt/sources.list.d/mssql-release.list
22732273
invokeAptGetUpdate
22742274
fi
22752275
printf -- '- installing the APT package\n'
@@ -2610,21 +2610,21 @@ installLibcClient2007e() {
26102610
installLibcClient2007e_url="http://ftp.debian.org/debian/pool/main/u/uw-imap/mlock_${installLibcClient2007e_version}_${installLibcClient2007e_arch}.deb"
26112611
installLibcClient2007e_deb="$(mktemp -p /tmp/src)"
26122612
printf '# Installing mlock from %s\n' "$installLibcClient2007e_url"
2613-
curl -sSLf -o "$installLibcClient2007e_deb" "$installLibcClient2007e_url"
2613+
curl $IPE_CURL_FLAGS -sSLf -o "$installLibcClient2007e_deb" "$installLibcClient2007e_url"
26142614
dpkg -i "$installLibcClient2007e_deb"
26152615
fi
26162616
if ! test -f /usr/lib/libc-client.so.2007e; then
26172617
installLibcClient2007e_url="http://ftp.debian.org/debian/pool/main/u/uw-imap/libc-client2007e_${installLibcClient2007e_version}_${installLibcClient2007e_arch}.deb"
26182618
installLibcClient2007e_deb="$(mktemp -p /tmp/src)"
26192619
printf '# Installing libc-client2007e from %s\n' "$installLibcClient2007e_url"
2620-
curl -sSLf -o "$installLibcClient2007e_deb" "$installLibcClient2007e_url"
2620+
curl $IPE_CURL_FLAGS -sSLf -o "$installLibcClient2007e_deb" "$installLibcClient2007e_url"
26212621
dpkg -i "$installLibcClient2007e_deb"
26222622
fi
26232623
if ! test -f /usr/include/c-client/utf8.h; then
26242624
installLibcClient2007e_url="http://ftp.debian.org/debian/pool/main/u/uw-imap/libc-client2007e-dev_${installLibcClient2007e_version}_${installLibcClient2007e_arch}.deb"
26252625
installLibcClient2007e_deb="$(mktemp -p /tmp/src)"
26262626
printf '# Installing libc-client2007e-dev from %s\n' "$installLibcClient2007e_url"
2627-
curl -sSLf -o "$installLibcClient2007e_deb" "$installLibcClient2007e_url"
2627+
curl $IPE_CURL_FLAGS -sSLf -o "$installLibcClient2007e_deb" "$installLibcClient2007e_url"
26282628
dpkg -i "$installLibcClient2007e_deb"
26292629
PACKAGES_VOLATILE="$PACKAGES_VOLATILE libc-client2007e-dev"
26302630
fi
@@ -2657,8 +2657,8 @@ installComposer() {
26572657
# $3. additional flags for the composer installed (optional)
26582658
actuallyInstallComposer() {
26592659
actuallyInstallComposer_installer="$(mktemp -p /tmp/src)"
2660-
curl -sSLf -o "$actuallyInstallComposer_installer" https://getcomposer.org/installer
2661-
actuallyInstallComposer_expectedSignature="$(curl -sSLf https://composer.github.io/installer.sig)"
2660+
curl $IPE_CURL_FLAGS -sSLf -o "$actuallyInstallComposer_installer" https://getcomposer.org/installer
2661+
actuallyInstallComposer_expectedSignature="$(curl $IPE_CURL_FLAGS -sSLf https://composer.github.io/installer.sig)"
26622662
actuallyInstallComposer_actualSignature="$(php -n -r "echo hash_file('sha384', '$actuallyInstallComposer_installer');")"
26632663
if test "$actuallyInstallComposer_expectedSignature" != "$actuallyInstallComposer_actualSignature"; then
26642664
printf 'Verification of composer installer failed!\nExpected signature: %s\nActual signature: %s\n' "$actuallyInstallComposer_expectedSignature" "$actuallyInstallComposer_actualSignature" >&2
@@ -2784,7 +2784,7 @@ installCargo() {
27842784
export RUSTFLAGS='-C target-feature=-crt-static'
27852785
;;
27862786
esac
2787-
curl https://sh.rustup.rs -sSf | sh -s -- -y -q
2787+
curl $IPE_CURL_FLAGS https://sh.rustup.rs -sSf | sh -s -- -y -q
27882788
case "$DISTRO" in
27892789
alpine)
27902790
if test $DISTRO_MAJMIN_VERSION -le 310; then
@@ -2829,7 +2829,7 @@ installNewRelic() {
28292829
installNewRelic_search="$installNewRelic_search-musl"
28302830
;;
28312831
esac
2832-
installNewRelic_file="$(curl -sSLf -o- "$installNewRelic_baseUrl" | sed -E 's/<[^>]*>//g' | grep -Eo "$installNewRelic_search.tar.gz" | sort | head -1)"
2832+
installNewRelic_file="$(curl $IPE_CURL_FLAGS -sSLf -o- "$installNewRelic_baseUrl" | sed -E 's/<[^>]*>//g' | grep -Eo "$installNewRelic_search.tar.gz" | sort | head -1)"
28332833
installNewRelic_url="$installNewRelic_baseUrl$installNewRelic_file"
28342834
installNewRelic_src="$(getPackageSource "$installNewRelic_url")"
28352835
cd -- "$installNewRelic_src"
@@ -3155,7 +3155,7 @@ EOF
31553155
getPackageSource() {
31563156
mkdir -p /tmp/src
31573157
getPackageSource_tempFile=$(mktemp -p /tmp/src)
3158-
curl -sSLf -o "$getPackageSource_tempFile" "$1"
3158+
curl $IPE_CURL_FLAGS -sSLf -o "$getPackageSource_tempFile" "$1"
31593159
getPackageSource_tempDir=$(mktemp -p /tmp/src -d)
31603160
cd "$getPackageSource_tempDir"
31613161
tar -xzf "$getPackageSource_tempFile" 2>/dev/null || tar -xf "$getPackageSource_tempFile" 2>/dev/null || (
@@ -3257,7 +3257,7 @@ installRemoteModule() {
32573257
installRemoteModule_tmp2=$(php -r 'echo PHP_MAJOR_VERSION . PHP_MINOR_VERSION . (ZEND_THREAD_SAFE ? "-zts" : "");')
32583258
installRemoteModule_tmp="$(mktemp -p /tmp/src -d)"
32593259
cd "$installRemoteModule_tmp"
3260-
curl -sSLf --user-agent Docker https://blackfire.io/api/v1/releases/probe/php/$installRemoteModule_distro/$installRemoteModule_tmp1/$installRemoteModule_tmp2 | tar xz
3260+
curl $IPE_CURL_FLAGS -sSLf --user-agent Docker https://blackfire.io/api/v1/releases/probe/php/$installRemoteModule_distro/$installRemoteModule_tmp1/$installRemoteModule_tmp2 | tar xz
32613261
mv blackfire-*.so $(getPHPExtensionsDir)/blackfire.so
32623262
cd - >/dev/null
32633263
installRemoteModule_manuallyInstalled=1
@@ -4122,7 +4122,7 @@ installRemoteModule() {
41224122
;;
41234123
relay)
41244124
if test -z "$installRemoteModule_version"; then
4125-
installRemoteModule_version="$(curl -sSLf https://builds.r2.relay.so/meta/latest)"
4125+
installRemoteModule_version="$(curl $IPE_CURL_FLAGS -sSLf https://builds.r2.relay.so/meta/latest)"
41264126
installRemoteModule_version="${installRemoteModule_version#v}"
41274127
fi
41284128
case $(uname -m) in
@@ -4197,7 +4197,7 @@ installRemoteModule() {
41974197
fi
41984198
else
41994199
installRemoteModule_regex="https://downloads.saxonica.com/SaxonC/${installRemoteModule_edition}/[0-9]+/SaxonC${installRemoteModule_edition}-${installRemoteModule_architecture}-[0-9\-]+.zip"
4200-
installRemoteModule_url="$(curl -sSLf https://www.saxonica.com/download/c.xml | grep -Eo "$installRemoteModule_regex" | head -n 1)"
4200+
installRemoteModule_url="$(curl $IPE_CURL_FLAGS -sSLf https://www.saxonica.com/download/c.xml | grep -Eo "$installRemoteModule_regex" | head -n 1)"
42014201
if test $? -ne 0 || test -z "$installRemoteModule_url"; then
42024202
printf "Failed to determine SaxonC download URL - Nothing matches\n%s\n" "$installRemoteModule_regex"
42034203
exit 1
@@ -4351,7 +4351,7 @@ installRemoteModule() {
43514351
;;
43524352
pdo_snowflake)
43534353
if test -z "$installRemoteModule_version"; then
4354-
installRemoteModule_version="$(curl -sSLf https://api.github.com/repos/snowflakedb/pdo_snowflake/releases/latest 2>/dev/null | grep -o '"tag_name": *"[^"]*"' | head -1 | sed 's/.*"v*\([^"]*\)".*/\1/')"
4354+
installRemoteModule_version="$(curl $IPE_CURL_FLAGS -sSLf https://api.github.com/repos/snowflakedb/pdo_snowflake/releases/latest 2>/dev/null | grep -o '"tag_name": *"[^"]*"' | head -1 | sed 's/.*"v*\([^"]*\)".*/\1/')"
43554355
if test -z "$installRemoteModule_version"; then
43564356
printf 'Failed to detect pdo_snowflake version\n' >&2
43574357
exit 1
@@ -4766,7 +4766,7 @@ installRemoteModule() {
47664766
esac
47674767
;;
47684768
esac
4769-
installRemoteModule_url="$(curl -sSLf -o - https://tideways.com/profiler/downloads | grep -Eo "\"[^\"]+/tideways-php-([0-9]+\.[0-9]+\.[0-9]+)-$installRemoteModule_architecture.tar.gz\"" | cut -d'"' -f2)"
4769+
installRemoteModule_url="$(curl $IPE_CURL_FLAGS -sSLf -o - https://tideways.com/profiler/downloads | grep -Eo "\"[^\"]+/tideways-php-([0-9]+\.[0-9]+\.[0-9]+)-$installRemoteModule_architecture.tar.gz\"" | cut -d'"' -f2)"
47704770
if test -z "$installRemoteModule_url"; then
47714771
echo 'Failed to find the tideways tarball to be downloaded'
47724772
exit 1
@@ -5027,7 +5027,7 @@ installRemoteModule() {
50275027
if test $(compareVersions "$installRemoteModule_version" 1.0.0) -lt 0; then
50285028
installRemoteModule_src="$(getPackageSource http://archive.apache.org/dist/zookeeper/zookeeper-3.5.9/apache-zookeeper-3.5.9.tar.gz)"
50295029
else
5030-
installRemoteModule_tmp="$(curl -sSLf https://downloads.apache.org/zookeeper/stable | sed -E 's/["<>]/\n/g' | grep -E '^(apache-)?zookeeper-[0-9]+\.[0-9]+\.[0-9]+\.(tar\.gz|tgz)$' | head -n1)"
5030+
installRemoteModule_tmp="$(curl $IPE_CURL_FLAGS -sSLf https://downloads.apache.org/zookeeper/stable | sed -E 's/["<>]/\n/g' | grep -E '^(apache-)?zookeeper-[0-9]+\.[0-9]+\.[0-9]+\.(tar\.gz|tgz)$' | head -n1)"
50315031
if test -z "$installRemoteModule_tmp"; then
50325032
echo 'Failed to detect the zookeeper library URL' >&2
50335033
exit 1
@@ -5125,7 +5125,7 @@ configureInstaller() {
51255125
if false && anyStringInList '' "$PHP_MODULES_TO_INSTALL"; then
51265126
USE_PICKLE=2
51275127
else
5128-
curl -sSLf https://github.com/FriendsOfPHP/pickle/releases/latest/download/pickle.phar -o /tmp/pickle
5128+
curl $IPE_CURL_FLAGS -sSLf https://github.com/FriendsOfPHP/pickle/releases/latest/download/pickle.phar -o /tmp/pickle
51295129
chmod +x /tmp/pickle
51305130
USE_PICKLE=1
51315131
fi
@@ -5434,6 +5434,14 @@ mkdir -p /tmp/pickle.tmp
54345434
IPE_ERRFLAG_FILE="$(mktemp -p /tmp/src)"
54355435
CONFIGURE_FILE=/tmp/configure-options
54365436
IPE_APK_FLAGS=''
5437+
case "${IPE_INSECURE:-}" in
5438+
1 | y* | Y*)
5439+
IPE_CURL_FLAGS='-k'
5440+
;;
5441+
*)
5442+
IPE_CURL_FLAGS=''
5443+
;;
5444+
esac
54375445
setDistro
54385446
case "$DISTRO_VERSION" in
54395447
debian@8)

0 commit comments

Comments
 (0)