Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Format shell scripts #3590

Merged
merged 1 commit into from
Feb 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions build/generate_default_cert_and_key.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/bash
#!/usr/bin/env bash

openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout default.key -out default.crt -subj "/CN=NGINXIngressController"
cat default.key default.crt > default.pem
cat default.key default.crt >default.pem
rm default.key default.crt
2 changes: 1 addition & 1 deletion hack/docker.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#! /bin/bash
#!/usr/bin/env bash

git_commit=$1
git_tag=$2
Expand Down
3 changes: 1 addition & 2 deletions hack/prepare-major-release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@

DOCS_TO_UPDATE_FOLDER=docs/content

if [ $# != 4 ];
then
if [ $# != 4 ]; then
echo "Invalid number of arguments" 1>&2
echo "Usage: $0 prev_ic_version ic-version prev_helm_chart_version helm-chart-version" 1>&2
exit 1
Expand Down
3 changes: 1 addition & 2 deletions hack/verify-codegen.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,7 @@ echo "diffing ${DIFFROOT} against freshly generated codegen"
ret=0
diff -Naupr "${DIFFROOT}" "${TMP_DIFFROOT}" || ret=$?
cp -a "${TMP_DIFFROOT}"/* "${DIFFROOT}"
if [[ $ret -eq 0 ]]
then
if [[ $ret -eq 0 ]]; then
echo "${DIFFROOT} up to date."
else
echo "${DIFFROOT} is out of date. Please run hack/update-codegen.sh"
Expand Down
5 changes: 3 additions & 2 deletions tests/data/dos/bad_clients_xff.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
#!/bin/sh
#!/usr/bin/env bash

HOST=$1
IP_AND_PORT=$2
URI='bad_path.html'
NUM=600
CONNS=300
while true; do
echo "ab -l -n ${NUM} -c ${CONNS} -d -s 5 \
echo "ab -l -n ${NUM} -c ${CONNS} -d -s 5 \
-H "Host: ${HOST}" \
-H "X-Forwarded-For: 1.1.1.1" \
${IP_AND_PORT}${URI}"
Expand Down
29 changes: 15 additions & 14 deletions tests/data/dos/good_clients_xff.sh
Original file line number Diff line number Diff line change
@@ -1,27 +1,28 @@
#!/bin/bash
#!/usr/bin/env bash

HOST=$1
IP_AND_PORT=$2
URI='good_path.html'


declare -a array=("/faq.php?sid=e6106109db52fec6127b73b152224dea#f4r0"
"/styles/prosilver/theme/print.css"
"/styles/prosilver/theme/images/bg_header.gif"
"/styles/prosilver/template/styleswitcher.js")

declare -a array=(
"/faq.php?sid=e6106109db52fec6127b73b152224dea#f4r0"
"/styles/prosilver/theme/print.css"
"/styles/prosilver/theme/images/bg_header.gif"
"/styles/prosilver/template/styleswitcher.js"
)

while true; do
URI=${array[$(( RANDOM % 3 ))]}
URI=${array[$((RANDOM % 3))]}
echo ${HOST}
echo ${IP_AND_PORT}
echo 'curl -b cookiefile -c cookiefile -L -s -o /dev/null -w "%{http_code}\n" -m 10 --connect-timeout 5 -A "Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_3_3 like Mac OS X; en-us) AppleWebKit/533.17.9 (KHTML, like Gecko) Version/5.0.2 Mobile/8J2 Safari/6533.18.5" -H "Host: ${HOST}" -H "X-Forwarded-For: 3.3.3.2" ${IP_AND_PORT}${URI}'
curl -b cookiefile -c cookiefile -L -s -o /dev/null -w "%{http_code}\n" -m 10 --connect-timeout 5 -A "Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_3_3 like Mac OS X; en-us) AppleWebKit/533.17.9 (KHTML, like Gecko) Version/5.0.2 Mobile/8J2 Safari/6533.18.5" -H "Host: ${HOST}" -H "X-Forwarded-For: 3.3.3.2" ${IP_AND_PORT}${URI} &
URI=${array[$(( RANDOM % 3 ))]}
curl -b cookiefile -c cookiefile -L -s -o /dev/null -w "%{http_code}\n" -m 10 --connect-timeout 5 -A "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_6_8) AppleWebKit/534.30 (KHTML, like Gecko) Chrome/12.0.742.112 Safari/534.30" -H "Host: ${HOST}" -H "X-Forwarded-For: 31.212.17.19" ${IP_AND_PORT}${URI} &
URI=${array[$(( RANDOM % 3 ))]}
curl -b cookiefile -c cookiefile -L -s -o /dev/null -w "%{http_code}\n" -m 10 --connect-timeout 5 -A "Mozilla/5.0 (Windows; U; Windows NT 5.1; de; rv:1.9.2.3) Gecko/20100401 Firefox/3.6.3" -H "Host: ${HOST}" -H "X-Forwarded-For: 46.117.23.157" ${IP_AND_PORT}${URI} &
curl -b cookiefile -c cookiefile -L -s -o /dev/null -w "%{http_code}\n" -m 10 --connect-timeout 5 -A "Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_3_3 like Mac OS X; en-us) AppleWebKit/533.17.9 (KHTML, like Gecko) Version/5.0.2 Mobile/8J2 Safari/6533.18.5" -H "Host: ${HOST}" -H "X-Forwarded-For: 3.3.3.2" ${IP_AND_PORT}${URI} &
URI=${array[$((RANDOM % 3))]}
curl -b cookiefile -c cookiefile -L -s -o /dev/null -w "%{http_code}\n" -m 10 --connect-timeout 5 -A "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_6_8) AppleWebKit/534.30 (KHTML, like Gecko) Chrome/12.0.742.112 Safari/534.30" -H "Host: ${HOST}" -H "X-Forwarded-For: 31.212.17.19" ${IP_AND_PORT}${URI} &
URI=${array[$((RANDOM % 3))]}
curl -b cookiefile -c cookiefile -L -s -o /dev/null -w "%{http_code}\n" -m 10 --connect-timeout 5 -A "Mozilla/5.0 (Windows; U; Windows NT 5.1; de; rv:1.9.2.3) Gecko/20100401 Firefox/3.6.3" -H "Host: ${HOST}" -H "X-Forwarded-For: 46.117.23.157" ${IP_AND_PORT}${URI} &

curl -b cookiefile -c cookiefile -L -s -o /dev/null -w "%{http_code}\n" -m 10 --connect-timeout 5 -A "Mozilla/5.0 (Windows; U; Windows NT 5.1; de; rv:1.9.2.3) Gecko/20100401 Firefox/3.6.3" -H "Host: ${HOST}" -H "X-Forwarded-For: 111.212.17.19" ${IP_AND_PORT}
curl -b cookiefile -c cookiefile -L -s -o /dev/null -w "%{http_code}\n" -m 10 --connect-timeout 5 -A "Mozilla/5.0 (Windows; U; Windows NT 5.1; de; rv:1.9.2.3) Gecko/20100401 Firefox/3.6.3" -H "Host: ${HOST}" -H "X-Forwarded-For: 111.212.17.19" ${IP_AND_PORT}

killall curl
sleep 0.2
Expand Down