This commit is contained in:
vasco
2026-05-23 14:24:00 +01:00
parent ddcaf33130
commit 7a5767ef64
3 changed files with 29 additions and 19 deletions

View File

@@ -1,4 +1,6 @@
alias s="sudo systemctl"
function s() {
sudo systemctl "$@"
}
function instalar() {
yum list installed "$1" &>/dev/null && echo "$1 já instalado" || sudo yum install -y "$1"

View File

@@ -9,7 +9,7 @@ sudo ifconfig enp0s8 $IP_EXTERNAL netmask 255.255.255.0
sudo ifconfig enp0s9 $IP_INTERNAL netmask 255.255.255.0
# instalar mod security e apache
instalar epel_release
instalar epel-release
instalar httpd
instalar mod_security
instalar mod_security_crs
@@ -23,4 +23,5 @@ sudo iptables -A FORWARD -i enp0s8 -o enp0s9 -m state --state ESTABLISHED,RELATE
sudo iptables -t nat -A POSTROUTING -o enp0s8 -j MASQUERADE
sudo iptables-save > /etc/sysconfig/iptables
cp conf/httpd.conf /etc/httpd/httpd.conf
sudo cp conf/httpd.conf /etc/httpd/httpd.conf

View File

@@ -2,27 +2,34 @@
source CONFIG.sh
# instalar packages
if ! command -v node &> /dev/null || [[ "$(node -v)" != v24.* ]]; then
echo "Configurando repositório do Node.js 24..."
curl -fsSL https://rpm.nodesource.com/setup_24.x | sudo bash -
sudo yum remove -y nodejs
fi
instalar nodejs
# instalar juice-shop se nao existir
jspath="/var/juice-shop"
if [[ ! -f "$jspath/package.json" ]]; then
sudo mkdir -p "$jspath"
curl -L -o js.tar.gz "https://github.com/juice-shop/juice-shop/releases/download/v20.0.0/juice-shop-20.0.0_node24_linux_x64.tgz"
sudo tar -xzvf js.tar.gz -C "$jspath" --strip-components=1
rm js.tar.gz
sudo chown -R $USER:$USER "$jspath"
fi
# fazer so depois de instalar tudo
ativar_firewall
# interfaces
IP="10.60.0.2"
sudo ifconfig enp0s8 $IP netmask 255.255.255.0
sudo route add default gw 10.60.0.1
# instalar packages
instalar nodejs
# instalar juice-shop se nao existir
jspath="/var/juice-shop"
if [[ ! -d "$jspath" ]]; then
mkdir "$jspath"
curl -o js.tar.gz "https://github.com/juice-shop/juice-shop/releases/download/v20.0.0/juice-shop-20.0.0_node24_linux_x64.tgz"
tar -xzvf js.tar.gz "$jspath"
rm js.tar.gz
cd "$jspath"
npm i
fi
# fazer so depois de instalar tudo
ativar_firewall
# correr juice shop via npm
cd "$jspath"
npm start