Jump to content
sleed

[RST] Mysql , Apache2 & PHP Script Installer Debian/Ubuntu

Recommended Posts

Buna. Am facut acest script bash pentru a putea instala mai usor un server LAMP pentru Ubuntu / Debian. Casa il faceti sa mearga tot ce trebuie sa faceti este sa copiati codul intr un fisier , sa redenumiti fisierul .sh , exemplu : sleed.sh , apoi sa il faceti rulabil fisierul prin comanda : chmod +x sleed.sh , apoi il rulati cu

./sleed.sh
.

#!/bin/bash
# sleed Script LAMP Installer
# Romanian Security Team
echo "Romanian Security Team - The essence of future is the digital core !!!"
echo -e "\e[92mWebserver Script for Debian/Ubuntu Script by sleed [ Romanian Security Team] - RSTFORUMS.COM"
sleep 1
echo "====Show CPU INFO / MEMORY / RELEASE /...===="
cat /etc/*-release
sleep 1
echo "///////////////////Show Who are logged in////////////////////////////"
w
sleep 1
echo "///////////Show kernel/////////////////"
uname -a
head -n1 /etc/issue
sleep 1
cat /proc/partitions
echo "////////////////Show Partitions/////////////"
sleep 1
grep MemTotal /proc/meminfo
echo "///////////////Show Ram seen by system///////////////////"
sleep 1
grep "model name" /proc/cpuinfo
echo "////////////////Show proc name///////////"
sleep 1
ifconfig | grep inet | awk '{ print $3 }'
echo "///////////////Find IP Broadcast & IPV6 Adress////////////"
sleep 1
ifconfig | grep inet | awk '{ print $2 }'
echo "//////////Find Ipv4 Adress////////////"
sleep 1
cat /etc/hosts
echo "//////////Find Hosts//////////"

STRING="Starting upgrade & update"
#print variable on a screen
# ---- Upgrade & Update --------
echo $STRING
STRING2="UPDATE Done..."
/usr/bin/apt-get -v update
echo $STRING3
sleep 1
/usr/bin/apt-get -v dist-upgrade
STRING3="Upgrade Done..."
#End of Upgrade & Update

#Install LAMP
/usr/bin/apt-get install -v apache2 php5 libapache2-mod-php5 -v
sleep 10
/usr/bin/apt-get install -v mysql-server libapache2-mod-auth-mysql php5-mysql
sleep 10
echo "WRITE YOUR MYSQL ROOT PASSWORD, press enter, write your password and press 3 times enter!"
/usr/bin/mysql_secure_installation
sleep 5
/usr/bin/apt-get install -v php5-curl php5-gd php5-idn php-pear php5-imagick php5-imap php5-mcrypt php5-memcache php5-ming php5-ps php5-pspell php5-recode php5-snmp php5-sqlite php5-tidy php5-xmlrpc php5-xsl
sleep 1
/etc/init.d/apache2 start
sleep 1
/etc/init.d/mysql restart
sleep 1

# Apache Minimal Security
echo "#Apache Minimal Security"
echo "ServerTokens prod" >> /etc/apache2/conf.d/security
echo "ServerSignature Off" >> /etc/apache2/conf.d/security
echo "FileETag none" >> /etc/apache2/conf.d/security
echo "ServerSignature Off" >> /etc/apache2/conf.d/security
echo "TraceEnable Off" >> /etc/apache2/conf.d/security
echo "LimitRequestBody 25000" >> /etc/apache2/apache2.conf
echo "LimitRequestFields 40" >> /etc/apache2/conf.d/security
echo "LimitRequestFieldSize 4000" >> /etc/apache2/apache2.conf
echo "LimitRequestLine 4000" >> /etc/apache2/conf.d/security

/etc/init.d/apache2 reload
echo "#########Thank You########"

Gata l-am modificat, e un miny script sa i spunem asa..

Edited by sleed
  • Upvote 2
Link to comment
Share on other sites

Scriptul nu respecta niciun standard. Mai mult:

- Sterge log-urile acelea inutil

- Instaleaza extensii php aiurea

- Adauga in apache2.conf o gramada de variabile care nu respecta layout-ul default (Ar trebui puse in '/etc/apache2/conf.d/security' si dat cu replace, sa nu fie de doua ori)

- MaxRequestsPerChild 10000 cauzeaza incarcarea excesiva a proceselor (ele nu se mai regenereaza)

- Nu are niciun fel de statement sa verifice daca exista sau nu un fisier (exemplu: 3 incercari de a deschide un browser si alte 3 de a da kill)

- Succesiune de comenzi non sense precum:


touch /var/www/info.php
echo "<?php phpinfo(); ?>" >> /var/www/info.php

Sau intai se face print la o variabila si apoi este setata ?!


echo $STRING4
STRING4="Clear LOGS"

- 50 de secunde timp pierdut cu sleep-uri.

Bash scripting facut pe calapod

Edited by aelius
Link to comment
Share on other sites

+toata partea asta care e degeaba. nu folosesti nici o informatie de aici

echo "====Show CPU INFO / MEMORY / RELEASE /...===="
cat /etc/*-release
sleep 7
echo "///////////////////Show Who are logged in////////////////////////////"
w
sleep 7
echo "///////////Show kernel/////////////////"
uname -a
head -n1 /etc/issue
sleep 7
cat /proc/partitions
echo "////////////////Show Partitions/////////////"
sleep 7
grep MemTotal /proc/meminfo
echo "///////////////Show Ram seen by system///////////////////"
sleep 7
grep "model name" /proc/cpuinfo
echo "////////////////Show proc name///////////"
sleep 7
ifconfig | grep inet | awk '{ print $3 }'
echo "///////////////Find IP Broadcast & IPV6 Adress////////////"
sleep 7
ifconfig | grep inet | awk '{ print $2 }'
echo "//////////Find Ipv4 Adress////////////"
sleep 7
cat /etc/hosts
echo "//////////Find Hosts//////////"

  • Upvote 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...