Skip to content

Commit

Permalink
Issue #2250397 by AntiNSA - Always follow (limited) redirects in cURL…
Browse files Browse the repository at this point in the history
… requests.

This is to avoid issues caused by sites, like GitHub, changing their URLs for downloads.
  • Loading branch information
omega8cc committed Apr 26, 2014
1 parent b3ac2b1 commit 7396f21
Show file tree
Hide file tree
Showing 14 changed files with 115 additions and 114 deletions.
40 changes: 20 additions & 20 deletions BARRACUDA.sh.txt
Expand Up @@ -1305,31 +1305,31 @@ extract_archive () {
# Download and extract archive from dev mirror.
get_dev_arch () {
if [ ! -z $1 ] ; then
curl -s -O --retry 10 --retry-delay 15 -A iCab "http://files.aegir.cc/dev/$1"
curl -L --max-redirs 10 -k -s -O --retry 10 --retry-delay 15 -A iCab "http://files.aegir.cc/dev/$1"
extract_archive "$1"
fi
}
#
# Download and extract from dev/version mirror.
get_dev_ext () {
if [ ! -z $1 ] ; then
curl -s -O --retry 10 --retry-delay 15 -A iCab "http://files.aegir.cc/dev/$_AEGIR_VERSION/$1"
curl -L --max-redirs 10 -k -s -O --retry 10 --retry-delay 15 -A iCab "http://files.aegir.cc/dev/$_AEGIR_VERSION/$1"
extract_archive "$1"
fi
}
#
# Download and extract from dev/contrib mirror.
get_dev_contrib () {
if [ ! -z $1 ] ; then
curl -s -O --retry 10 --retry-delay 15 -A iCab "http://files.aegir.cc/dev/contrib/$1"
curl -L --max-redirs 10 -k -s -O --retry 10 --retry-delay 15 -A iCab "http://files.aegir.cc/dev/contrib/$1"
extract_archive "$1"
fi
}
#
# Download and extract archive from dev/src mirror.
get_dev_src () {
if [ ! -z $1 ] ; then
curl -s -O --retry 10 --retry-delay 15 -A iCab "http://files.aegir.cc/dev/src/$1"
curl -L --max-redirs 10 -k -s -O --retry 10 --retry-delay 15 -A iCab "http://files.aegir.cc/dev/src/$1"
extract_archive "$1"
fi
}
Expand Down Expand Up @@ -2491,11 +2491,11 @@ tune_sql_memory_limits () {
msg "INFO: Running MySQLTuner check on all databases..."
msg "NOTE! This step may take a LONG time, please wait..."
rm -f /var/opt/mysqltuner*
### curl -s --retry 10 --retry-delay 15 -A iCab "https://raw.github.com/major/MySQLTuner-perl/master/mysqltuner.pl" -o /var/opt/mysqltuner.pl
curl -s --retry 10 --retry-delay 15 -A iCab "http://files.aegir.cc/dev/mysqltuner.pl" -o /var/opt/mysqltuner.pl
### curl -L --max-redirs 10 -k -s --retry 10 --retry-delay 15 -A iCab "https://raw.githubusercontent.com/major/MySQLTuner-perl/master/mysqltuner.pl" -o /var/opt/mysqltuner.pl
curl -L --max-redirs 10 -k -s --retry 10 --retry-delay 15 -A iCab "http://files.aegir.cc/dev/mysqltuner.pl" -o /var/opt/mysqltuner.pl
if [ ! -e "/var/opt/mysqltuner.pl" ] ; then
mrun "sleep 60"
curl -s --retry 10 --retry-delay 15 -A iCab "http://files.aegir.cc/dev/mysqltuner.pl" -o /var/opt/mysqltuner.pl
curl -L --max-redirs 10 -k -s --retry 10 --retry-delay 15 -A iCab "http://files.aegir.cc/dev/mysqltuner.pl" -o /var/opt/mysqltuner.pl
fi
if [ -e "/var/opt/mysqltuner.pl" ] ; then
perl /var/opt/mysqltuner.pl > /var/opt/mysqltuner-$_INSTALLER_VERSION-$_NOW.txt 2>&1
Expand Down Expand Up @@ -4135,7 +4135,7 @@ upgrade_aegir_master () {
if [ ! -d "/var/aegir/.drush/provision/http" ] ; then
cd /var/aegir/.drush
rm -f -r /var/aegir/.drush/{provision,drush_make}
curl -s --retry 10 --retry-delay 15 -A iCab "http://files.aegir.cc/versions/stable/tar/provision-$_AEGIR_VERSION.tar.gz" | tar -xzf -
curl -L --max-redirs 10 -k -s --retry 10 --retry-delay 15 -A iCab "http://files.aegir.cc/versions/stable/tar/provision-$_AEGIR_VERSION.tar.gz" | tar -xzf -
get_dev_ext "drush_make.tar.gz" &> /dev/null
rm -f -r /var/aegir/drush
cd /var/aegir
Expand Down Expand Up @@ -4722,8 +4722,8 @@ update_sources_list () {
msg "INFO: Now looking for the best/fastest $_THIS_OS mirror, this may take a while, please wait..."
mkdir -p /opt/tmp/helpers
cd /opt/tmp/helpers
curl -s --retry 10 --retry-delay 15 -A iCab "http://files.aegir.cc/versions/master/aegir/helpers/ffmirror.sh.txt" -o ffmirror.sh.txt
curl -s --retry 10 --retry-delay 15 -A iCab "http://files.aegir.cc/versions/master/aegir/helpers/apt-list-ubuntu.txt" -o apt-list-ubuntu.txt
curl -L --max-redirs 10 -k -s --retry 10 --retry-delay 15 -A iCab "http://files.aegir.cc/versions/master/aegir/helpers/ffmirror.sh.txt" -o ffmirror.sh.txt
curl -L --max-redirs 10 -k -s --retry 10 --retry-delay 15 -A iCab "http://files.aegir.cc/versions/master/aegir/helpers/apt-list-ubuntu.txt" -o apt-list-ubuntu.txt
_MIRROR=`bash ffmirror.sh.txt < apt-list-ubuntu.txt`
_MIRROR=`bash ffmirror.sh.txt < apt-list-ubuntu.txt`
echo " "
Expand Down Expand Up @@ -4758,7 +4758,7 @@ update_sources_list () {
if [ -e "/opt/tmp/$_BOA_REPO_NAME/aegir/conf/etc-apt-preferences-ubuntu.txt" ] ; then
cp -af /opt/tmp/$_BOA_REPO_NAME/aegir/conf/etc-apt-preferences-ubuntu.txt /etc/apt/preferences
else
curl -s --retry 10 --retry-delay 15 -A iCab "http://files.aegir.cc/versions/master/aegir/conf/etc-apt-preferences-ubuntu.txt" -o /etc/apt/preferences
curl -L --max-redirs 10 -k -s --retry 10 --retry-delay 15 -A iCab "http://files.aegir.cc/versions/master/aegir/conf/etc-apt-preferences-ubuntu.txt" -o /etc/apt/preferences
fi
elif [ "$_THIS_OS" = "Debian" ] ; then
_MIRROR_CHECK=NO
Expand All @@ -4780,8 +4780,8 @@ update_sources_list () {
msg "INFO: Now looking for the best/fastest $_THIS_OS mirror, this may take a while, please wait..."
mkdir -p /opt/tmp/helpers
cd /opt/tmp/helpers
curl -s --retry 10 --retry-delay 15 -A iCab "http://files.aegir.cc/versions/master/aegir/helpers/ffmirror.sh.txt" -o ffmirror.sh.txt
curl -s --retry 10 --retry-delay 15 -A iCab "http://files.aegir.cc/versions/master/aegir/helpers/apt-list-debian.txt" -o apt-list-debian.txt
curl -L --max-redirs 10 -k -s --retry 10 --retry-delay 15 -A iCab "http://files.aegir.cc/versions/master/aegir/helpers/ffmirror.sh.txt" -o ffmirror.sh.txt
curl -L --max-redirs 10 -k -s --retry 10 --retry-delay 15 -A iCab "http://files.aegir.cc/versions/master/aegir/helpers/apt-list-debian.txt" -o apt-list-debian.txt
_MIRROR=`bash ffmirror.sh.txt < apt-list-debian.txt`
_MIRROR=`bash ffmirror.sh.txt < apt-list-debian.txt`
echo " "
Expand Down Expand Up @@ -4817,14 +4817,14 @@ update_sources_list () {
if [ -e "/opt/tmp/$_BOA_REPO_NAME/aegir/conf/etc-apt-preferences-wheezy.txt" ] ; then
cp -af /opt/tmp/$_BOA_REPO_NAME/aegir/conf/etc-apt-preferences-wheezy.txt /etc/apt/preferences
else
curl -s --retry 10 --retry-delay 15 -A iCab "http://files.aegir.cc/versions/master/aegir/conf/etc-apt-preferences-wheezy.txt" -o /etc/apt/preferences
curl -L --max-redirs 10 -k -s --retry 10 --retry-delay 15 -A iCab "http://files.aegir.cc/versions/master/aegir/conf/etc-apt-preferences-wheezy.txt" -o /etc/apt/preferences
fi
fi
if [ "$_REL_VERSION" = "squeeze" ] ; then
if [ -e "/opt/tmp/$_BOA_REPO_NAME/aegir/conf/etc-apt-preferences-squeeze.txt" ] ; then
cp -af /opt/tmp/$_BOA_REPO_NAME/aegir/conf/etc-apt-preferences-squeeze.txt /etc/apt/preferences
else
curl -s --retry 10 --retry-delay 15 -A iCab "http://files.aegir.cc/versions/master/aegir/conf/etc-apt-preferences-squeeze.txt" -o /etc/apt/preferences
curl -L --max-redirs 10 -k -s --retry 10 --retry-delay 15 -A iCab "http://files.aegir.cc/versions/master/aegir/conf/etc-apt-preferences-squeeze.txt" -o /etc/apt/preferences
fi
fi
fi
Expand All @@ -4838,20 +4838,20 @@ update_sources_list () {
if [ -e "/opt/tmp/$_BOA_REPO_NAME/aegir/conf/etc-apt-preferences-ubuntu.txt" ] ; then
cp -af /opt/tmp/$_BOA_REPO_NAME/aegir/conf/etc-apt-preferences-ubuntu.txt /etc/apt/preferences
else
curl -s --retry 10 --retry-delay 15 -A iCab "http://files.aegir.cc/versions/master/aegir/conf/etc-apt-preferences-ubuntu.txt" -o /etc/apt/preferences
curl -L --max-redirs 10 -k -s --retry 10 --retry-delay 15 -A iCab "http://files.aegir.cc/versions/master/aegir/conf/etc-apt-preferences-ubuntu.txt" -o /etc/apt/preferences
fi
else
if [ "$_REL_VERSION" = "wheezy" ] ; then
if [ -e "/opt/tmp/$_BOA_REPO_NAME/aegir/conf/etc-apt-preferences-wheezy.txt" ] ; then
cp -af /opt/tmp/$_BOA_REPO_NAME/aegir/conf/etc-apt-preferences-wheezy.txt /etc/apt/preferences
else
curl -s --retry 10 --retry-delay 15 -A iCab "http://files.aegir.cc/versions/master/aegir/conf/etc-apt-preferences-wheezy.txt" -o /etc/apt/preferences
curl -L --max-redirs 10 -k -s --retry 10 --retry-delay 15 -A iCab "http://files.aegir.cc/versions/master/aegir/conf/etc-apt-preferences-wheezy.txt" -o /etc/apt/preferences
fi
else
if [ -e "/opt/tmp/$_BOA_REPO_NAME/aegir/conf/etc-apt-preferences-squeeze.txt" ] ; then
cp -af /opt/tmp/$_BOA_REPO_NAME/aegir/conf/etc-apt-preferences-squeeze.txt /etc/apt/preferences
else
curl -s --retry 10 --retry-delay 15 -A iCab "http://files.aegir.cc/versions/master/aegir/conf/etc-apt-preferences-squeeze.txt" -o /etc/apt/preferences
curl -L --max-redirs 10 -k -s --retry 10 --retry-delay 15 -A iCab "http://files.aegir.cc/versions/master/aegir/conf/etc-apt-preferences-squeeze.txt" -o /etc/apt/preferences
fi
fi
fi
Expand Down Expand Up @@ -5755,7 +5755,7 @@ if [ "$_AEGIR_VERSION" = "HEAD" ] ; then
fi
fi
else
curl -s --retry 10 --retry-delay 15 -A iCab "http://files.aegir.cc/versions/stable/tar/boa-$_INSTALLER_VERSION.tar.gz" | tar -xzf -
curl -L --max-redirs 10 -k -s --retry 10 --retry-delay 15 -A iCab "http://files.aegir.cc/versions/stable/tar/boa-$_INSTALLER_VERSION.tar.gz" | tar -xzf -
_BOA_REPO_NAME="boa"
fi
#
Expand Down Expand Up @@ -8975,7 +8975,7 @@ csf_install () {
if ! netcat -w 8 -z www.configserver.com 80 ; then
get_dev_arch "csf.tgz" &> /dev/null
else
curl -s -O --retry 10 --retry-delay 15 -A iCab "http://www.configserver.com/free/csf.tgz"
curl -L --max-redirs 10 -k -s -O --retry 10 --retry-delay 15 -A iCab "http://www.configserver.com/free/csf.tgz"
extract_archive "csf.tgz"
fi
cd csf
Expand Down
18 changes: 9 additions & 9 deletions BOA.sh.txt
Expand Up @@ -60,7 +60,7 @@ setup ()
echo "nameserver 8.8.4.4" >>/etc/resolv.conf
fi
fi
_CURL_TEST=$(curl -s -I "http://files.aegir.cc" 2> /dev/null)
_CURL_TEST=$(curl -L --max-redirs 10 -k -s -I "http://files.aegir.cc" 2> /dev/null)
if [[ "$_CURL_TEST" =~ "200 OK" ]] ; then
_DO_NOTHING=YES
else
Expand All @@ -80,14 +80,14 @@ setup ()
ln -sf /opt/local/bin/octopus /usr/local/bin/octopus
fi
rm -f /opt/local/bin/{barracuda*,boa*,drushextra*,octopus*,randpass*,sqlmagic*,syncpass*,thinkdifferent*}
curl -s --retry 10 --retry-delay 5 -A iCab "http://files.aegir.cc/versions/master/aegir/tools/bin/barracuda" -o /opt/local/bin/barracuda
curl -s --retry 10 --retry-delay 5 -A iCab "http://files.aegir.cc/versions/master/aegir/tools/bin/boa" -o /opt/local/bin/boa
curl -s --retry 10 --retry-delay 5 -A iCab "http://files.aegir.cc/versions/master/aegir/tools/bin/drushextra" -o /opt/local/bin/drushextra
curl -s --retry 10 --retry-delay 5 -A iCab "http://files.aegir.cc/versions/master/aegir/tools/bin/octopus" -o /opt/local/bin/octopus
curl -s --retry 10 --retry-delay 5 -A iCab "http://files.aegir.cc/versions/master/aegir/tools/bin/randpass" -o /opt/local/bin/randpass
curl -s --retry 10 --retry-delay 5 -A iCab "http://files.aegir.cc/versions/master/aegir/tools/bin/sqlmagic" -o /opt/local/bin/sqlmagic
curl -s --retry 10 --retry-delay 5 -A iCab "http://files.aegir.cc/versions/master/aegir/tools/bin/syncpass" -o /opt/local/bin/syncpass
curl -s --retry 10 --retry-delay 5 -A iCab "http://files.aegir.cc/versions/master/aegir/tools/bin/thinkdifferent" -o /opt/local/bin/thinkdifferent
curl -L --max-redirs 10 -k -s --retry 10 --retry-delay 5 -A iCab "http://files.aegir.cc/versions/master/aegir/tools/bin/barracuda" -o /opt/local/bin/barracuda
curl -L --max-redirs 10 -k -s --retry 10 --retry-delay 5 -A iCab "http://files.aegir.cc/versions/master/aegir/tools/bin/boa" -o /opt/local/bin/boa
curl -L --max-redirs 10 -k -s --retry 10 --retry-delay 5 -A iCab "http://files.aegir.cc/versions/master/aegir/tools/bin/drushextra" -o /opt/local/bin/drushextra
curl -L --max-redirs 10 -k -s --retry 10 --retry-delay 5 -A iCab "http://files.aegir.cc/versions/master/aegir/tools/bin/octopus" -o /opt/local/bin/octopus
curl -L --max-redirs 10 -k -s --retry 10 --retry-delay 5 -A iCab "http://files.aegir.cc/versions/master/aegir/tools/bin/randpass" -o /opt/local/bin/randpass
curl -L --max-redirs 10 -k -s --retry 10 --retry-delay 5 -A iCab "http://files.aegir.cc/versions/master/aegir/tools/bin/sqlmagic" -o /opt/local/bin/sqlmagic
curl -L --max-redirs 10 -k -s --retry 10 --retry-delay 5 -A iCab "http://files.aegir.cc/versions/master/aegir/tools/bin/syncpass" -o /opt/local/bin/syncpass
curl -L --max-redirs 10 -k -s --retry 10 --retry-delay 5 -A iCab "http://files.aegir.cc/versions/master/aegir/tools/bin/thinkdifferent" -o /opt/local/bin/thinkdifferent
echo "### $_TODAY ###" >> /opt/local/bin/boa
echo "### $_TODAY ###" >> /opt/local/bin/barracuda
echo "### $_TODAY ###" >> /opt/local/bin/octopus
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.txt
Expand Up @@ -77,6 +77,7 @@
* Force MariaDB 5.5 re-install if installed version doesn't match latest.
* Issue #2238805 - Command filtering - no word containing *drush* is allowed.
* Issue #2247997 - Update docs/REMOTE.txt with workaround for websh issue.
* Issue #2250397 - Always follow (limited) redirects in cURL requests.
* Issue #GH-304 - [rvm] use $_RUBY_VERSION as default.
* Issue #GH-305 - Check disk usage before running install/upgrade.
* Nginx: Allow to configure keywords for aggressive requests rate monitoring.
Expand Down
2 changes: 1 addition & 1 deletion OCTOPUS.sh.txt
Expand Up @@ -1793,7 +1793,7 @@ if [ "$_AEGIR_VERSION" = "HEAD" ] ; then
cd /opt/tmp
fi
else
curl -s --retry 10 --retry-delay 15 -A iCab "http://files.aegir.cc/versions/stable/tar/boa-$_INSTALLER_VERSION.tar.gz" | tar -xzf -
curl -L --max-redirs 10 -k -s --retry 10 --retry-delay 15 -A iCab "http://files.aegir.cc/versions/stable/tar/boa-$_INSTALLER_VERSION.tar.gz" | tar -xzf -
_BOA_REPO_NAME="boa"
fi
if [ ! -e "/opt/tmp/$_BOA_REPO_NAME/aegir/helpers/apt.conf.noninteractive" ] ; then
Expand Down
6 changes: 3 additions & 3 deletions aegir/scripts/AegirSetupA.sh.txt
Expand Up @@ -239,15 +239,15 @@ extract_archive () {
# Download and extract from dev/contrib mirror.
get_dev_contrib () {
if [ ! -z $1 ] ; then
curl -s -O --retry 10 --retry-delay 15 -A iCab "http://files.aegir.cc/dev/contrib/$1"
curl -L --max-redirs 10 -k -s -O --retry 10 --retry-delay 15 -A iCab "http://files.aegir.cc/dev/contrib/$1"
extract_archive "$1"
fi
}
#
# Download and extract from dev.
get_dev_ext () {
if [ ! -z $1 ] ; then
curl -s -O --retry 10 --retry-delay 15 -A iCab "http://files.aegir.cc/dev/$_AEGIR_VERSION/$1"
curl -L --max-redirs 10 -k -s -O --retry 10 --retry-delay 15 -A iCab "http://files.aegir.cc/dev/$_AEGIR_VERSION/$1"
extract_archive "$1"
fi
}
Expand Down Expand Up @@ -1007,7 +1007,7 @@ else
if [ ! -d "$_ROOT/.drush/provision/http" ] ; then
cd $_ROOT/.drush
rm -f -r $_ROOT/.drush/{provision,drush_make}
curl -s --retry 10 --retry-delay 15 -A iCab "http://files.aegir.cc/versions/stable/tar/provision-$_AEGIR_VERSION.tar.gz" | tar -xzf -
curl -L --max-redirs 10 -k -s --retry 10 --retry-delay 15 -A iCab "http://files.aegir.cc/versions/stable/tar/provision-$_AEGIR_VERSION.tar.gz" | tar -xzf -
get_dev_ext "drush_make.tar.gz" &> /dev/null
cp -af /var/aegir/drush/includes/table.inc /data/disk/o1/tools/drush/includes/table.inc
fi
Expand Down
6 changes: 3 additions & 3 deletions aegir/scripts/AegirSetupB.sh.txt
Expand Up @@ -172,15 +172,15 @@ extract_archive () {
# Download and extract from dev.
get_dev_ext () {
if [ ! -z $1 ] ; then
curl -s -O --retry 10 --retry-delay 15 -A iCab "http://files.aegir.cc/dev/$_AEGIR_VERSION/$1"
curl -L --max-redirs 10 -k -s -O --retry 10 --retry-delay 15 -A iCab "http://files.aegir.cc/dev/$_AEGIR_VERSION/$1"
extract_archive "$1"
fi
}
#
# Download and extract from dev/contrib mirror.
get_dev_contrib () {
if [ ! -z $1 ] ; then
curl -s -O --retry 10 --retry-delay 15 -A iCab "http://files.aegir.cc/dev/contrib/$1"
curl -L --max-redirs 10 -k -s -O --retry 10 --retry-delay 15 -A iCab "http://files.aegir.cc/dev/contrib/$1"
extract_archive "$1"
fi
}
Expand Down Expand Up @@ -418,7 +418,7 @@ if [ "$_AEGIR_VERSION" = "HEAD" ] ; then
rm -f -r $_ROOT/.drush/*/.git
get_dev_ext "clean_missing_modules.tar.gz" &> /dev/null
else
curl -s --retry 10 --retry-delay 15 -A iCab "http://files.aegir.cc/versions/stable/tar/provision-$_AEGIR_VERSION.tar.gz" | tar -xzf -
curl -L --max-redirs 10 -k -s --retry 10 --retry-delay 15 -A iCab "http://files.aegir.cc/versions/stable/tar/provision-$_AEGIR_VERSION.tar.gz" | tar -xzf -
if [ "$_STATUS" = "UPGRADE" ] ; then
get_dev_ext "drush_make.tar.gz" &> /dev/null
fi
Expand Down

0 comments on commit 7396f21

Please sign in to comment.