diff --git a/README.md b/README.md index f757e93..a677186 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,65 @@ # ApachePHPffmpeg -Patil Web Technologies + Tested on Centos 7 64 bit Run Below Command On SSH Console ``` wget https://raw.githubusercontent.com/djamol/ApachePHPffmpeg/amol/latest.sh;sh latest.sh ``` + +Apache (+ Apache Mod -> Dos,APR,PCRE,APR-UTIL) + +NGINX/OpenLiteSpeed (Reverse Proxy Server) + +PHP + +MariaDB (DB Server) + +BIND DNS (DNS Server) + +PRO FTP (FTP Server) + +ConfigServer Security & Firewall (csf) + +CRON JOB + +AWStats + +Geo IP + +Mail Server(POSTFIX/SMTP/DoveCot) + +Domain Keys Identified Mail (DKIM For mail Server) + +Curl + +FFMPEG + +OpenSSL + +Webmin Server UI Admin Panel + +Much More... + +(Tested Timestamp Start : 06:07:20 PM --- End : 06:26:22 PM) +PHP Apache,PHP,MariaDB,Curl,OpenSSLL And Other Customization Auto Installation Maximum Time ->> Time 20-30 minutes + +(Tested Timestamp Start : 06:07:20 PM --- End : 06:26:22 PM) +FFMPEG Customization Auto Installation Maximum Time ->> Time 19-25 minutes + + +#Current Total Request With IP on 80 port means httpd server +#yum install net-tools -y + netstat -tn 2>/dev/null | grep :80 | awk '{print $5}' | cut -d: -f1 | sort | uniq -c | sort -nr | head + +# Disable SELinux on CentOS 7 / RHEL 7 / Fedora Linux + +check ->: sestatus + +vi /etc/selinux/config > change : SELINUX=disabled + +sudo shutdown -r now + + +TEST ONLINE SERVER TOOLS +SMTP (Sendmail/SMTP Mail Server) https://www.gmass.co/smtp-test +DNS : network-tools.com , https://mxtoolbox.com/ ,https://api.hackertarget.com/zonetransfer/?q=example.com diff --git a/auto b/auto index 6be2b6e..af3e4b2 100644 --- a/auto +++ b/auto @@ -21,12 +21,20 @@ if [ $BIND = "true" ] fi date +"%r" >> $BUILD;echo "Status : Auto Bind Installation END" >> $BUILD date +"%r" >> $BUILD;echo "Status : Auto Development Tool" >> $BUILD -if yum -y groupinstall "Development Tools"; then -echo -e "\033[33;32m yum -y groupinstall ----Development Tools Success ";date +"%r" >> $BUILD;echo "Success : Development Tools Install" >> $BUILD -else -echo -e "\033[33;31m yum -y groupinstall ----Development Tools Failed";date +"%r" >> $BUILD;echo "Failed : Development Tools Install" >> $BUILD +if [ $OSN = "debian" ] + then + apt update + apt install build-essential + echo "Debian groupinstall ----Development Tools Success";date +"%r" >> $BUILD; + else + if yum -y groupinstall "Development Tools"; then + echo -e "\033[33;32m yum -y groupinstall ----Development Tools Success ";date +"%r" >> $BUILD;echo "Success : Development Tools Install" >> $BUILD + else + echo -e "\033[33;31m yum -y groupinstall ----Development Tools Failed";date +"%r" >> $BUILD;echo "Failed : Development Tools Install" >> $BUILD + fi fi -if yum -y install sudo; then + +if yum -y install sudo expect; then echo -e "\033[33;32m Sudo Success";date +"%r" >> $BUILD;echo "Success : Sudo Install" >> $BUILD else echo -e "\033[33;31m Sudo Failed";date +"%r" >> $BUILD;echo "Failed : Sudo Install" >> $BUILD @@ -66,7 +74,7 @@ date +"%r" >> $BUILD;echo "Status : Auto Apache Installation Start" >> $BUILD echo -e "\e[32m########################################\n#### Apache2.4 Server Soft #########\n#####################################" if [ $Apache = "true" ] then - yum remove httpd -y; source "$SCRIPTPATH/inc/aprq.sh";source "$SCRIPTPATH/inc/apache.sh"; + yum remove httpd -y; source "$SCRIPTPATH/inc/aprq.sh";source "$SCRIPTPATH/inc/apache.sh"; source "$SCRIPTPATH/inc/apacheDOSmod.sh"; else echo "Reject By USER Apache INstall" fi @@ -79,7 +87,7 @@ mkdir /usr;mkdir /usr/share;mkdir /usr/share/ssl; mkdir /usr/share/ssl//certs; #CAC=IN #CAS=MAH #CAL=City #CAO="INDIA ORG" #CAU="DA Group" #CACM="serv.djamol.com" #CAM="nomail@djamol.com" SSLCERt=$(expect -c " -set timeout 10 +set timeout 35 spawn openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /usr/share/ssl/certs/amol.key -out /usr/share/ssl/certs/amol.cert expect \"Country Name*:\" send \"$CAC\r\" @@ -101,7 +109,7 @@ expect eof echo "$SSLCERt" SSLHTTPS=$(expect -c " -set timeout 10 +set timeout 35 spawn openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /usr/share/ssl/certs/ssl.crt -out /usr/share/ssl/certs/ssl.crt expect \"Country Name*:\" send \"$CAC\r\" @@ -125,15 +133,15 @@ echo "$SSLHTTPS" date +"%r" >> $BUILD;echo "Status : Auto Apache SSL Cert END" >> $BUILD -date +"%r" >> $BUILD;echo "Status : Auto PHP 5 Installation Start" >> $BUILD -echo -e "\e[32m########################################\n#### PHP 5 Package/Software #########\n#####################################" +date +"%r" >> $BUILD;echo "Status : Auto PHP Installation Start" >> $BUILD +echo -e "\e[32m########################################\n#### PHP Multiple Version Package/Software #########\n#####################################" if [ $PHPe = "true" ] then source "$SCRIPTPATH/inc/phpauto.sh"; else - echo "Reject By USER PHP 5 INstall" + echo "Reject By USER PHP INstall" fi -date +"%r" >> $BUILD;echo "Status : Auto PHP 5 Installation END" >> $BUILD +date +"%r" >> $BUILD;echo "Status : Auto PHP Multiple Version Installation END" >> $BUILD date +"%r" >> $BUILD;echo "Status : Auto Cron JOB Installation Start" >> $BUILD echo -e "\e[32m########################################\n#### Cron JOB Software #########\n#####################################" if [ $CRON = "true" ] @@ -175,10 +183,37 @@ echo -e "\e[32m###############################\n###PostFix Mail Software ####### if [ $PostFix = "true" ] then source "$SCRIPTPATH/inc/postfixauto.sh"; + source "$SCRIPTPATH/inc/opendkim.sh"; else echo "Reject By USER PostFix INstall" fi +echo -e "\e[32m###############################\n###Postfix-dovecot Mail Software #########\n#####################################" +if [ $PostDove = "true" ] + then + source "$SCRIPTPATH/inc/maildove.sh"; + source "$SCRIPTPATH/inc/opendkim.sh"; + else + echo "Reject By USER Postfix-dovecot INstall" +fi + +echo -e "\e[32m########################################\n#### AWStats Software #########\n########################################" +if [ $AW = "true" ] + then + source "$SCRIPTPATH/inc/awstats.sh"; + else + echo "Reject By USER AWStats INstall" +fi + +date +"%r" >> $BUILD;echo "Status : vnStat - Light Weight Console-based Network Monitor Start" >> $BUILD +source "$SCRIPTPATH/inc/vnstat.sh"; +date +"%r" >> $BUILD;echo "Status : Auto vnStat Installation END" >> $BUILD + +date +"%r" >> $BUILD;echo "Status : Auto AWStats Web analytics Installation END" >> $BUILD + date +"%r" >> $BUILD;echo "Status : Auto POSTFIX Installation END" >> $BUILD +date +"%r" >> $BUILD;echo "Status : Generate SSL Certificate Files" >> $BUILD +source "$SCRIPTPATH/inc/ssl.sh"; +date +"%r" >> $BUILD;echo "Status : Generate SSL Certificate END" >> $BUILD date +"%r" >> $BUILD;echo "Status : Last Setup bash Start" >> $BUILD source "$SCRIPTPATH/inc/last.sh"; date +"%r" >> $BUILD;echo "Status : Last Setup bash END" >> $BUILD @@ -192,6 +227,25 @@ date +"%r" >> $BUILD;echo "Status : Auto END OF Server Setup Installation Start" source "$SCRIPTPATH/inc/end.sh"; date +"%r" >> $BUILD;echo "Status : Auto END OF Server Setup Installation END" >> $BUILD +## Customize program run any where +mkdir /amol +#export PATH="$PATH:/pro" +#cp $SCRIPTPATH/pprogram/addftp /amol/addftp +#chmod -R +x /amol + +service apache2 reload + +date +"%r" >> $BUILD;echo "Status : Auto NGINX Installation Start" >> $BUILD +echo -e "\e[32m########################################\n#### NGINX Reverse Proxy Server Soft #########\n#####################################" +if [ $NGINX = "true" ] + then + source "$SCRIPTPATH/inc/nginx.sh"; + else + echo "Reject By USER NGINX INstall" +fi +date +"%r" >> $BUILD;echo "Status : Auto NGINX Installation END" >> $BUILD + + date +"%r" >> $BUILD;echo "Status : Auto FFMPEG Installation Start" >> $BUILD echo -e "\e[32m###############################\n###FFMPEG SOFT #########\n#####################################" @@ -202,3 +256,15 @@ if [ $FF = "true" ] echo "Reject By USER ffmpeg INstall" fi date +"%r" >> $BUILD;echo "Status : Auto FFMPEG Installation END" >> $BUILD +date +"%r" >> $BUILD;echo "Status : SSH PORT CHANGE 55 " >> $BUILD +service sshd restart +chkconfig mysql on +chkconfig apache2 on +chkconfig named on +chkconfig sshd on +###service iptables restart +iptables="iptables" +#${iptables} -F +#iptables -P INPUT ACCEPT +#iptables -P FORWARD ACCEPT +#iptables -P OUTPUT ACCEPT diff --git a/autoinstall b/autoinstall index 3cd29e2..d47fa22 100644 --- a/autoinstall +++ b/autoinstall @@ -1,5 +1,5 @@ ##for centos 7 (no required for centos minimal version) -## yum install iptables-services +yum install iptables-services -y systemctl start iptables systemctl enable iptables systemctl disable firewalld @@ -15,9 +15,20 @@ iptables -P INPUT DROP service iptables save service iptables stop - + chkconfig iptables off + chkconfig ip6tables off #### END ### +OSN="n"; +OSNAME=$(awk -F= '$1=="ID" { print $2 ;}' /etc/os-release) +if [ "$OSNAME" = "debian" ]; then + OSN="debian"; + echo "Detected OS Debian."; +else + OSN="other"; + echo "OS Detected:$OSNAME"; +fi + RED='\033[01;31m' RESET='\033[0m' @@ -63,10 +74,22 @@ echo -e "$GREEN # Copyright By PatilWeb.com # # IG:PatilWeb FB:PatilWeb TW:PatilWeb # $RESET"; + +full=`cat /etc/centos-release | tr -dc '0-9.'` +major=$(cat /etc/centos-release | tr -dc '0-9.'|cut -d \. -f1) +minor=$(cat /etc/centos-release | tr -dc '0-9.'|cut -d \. -f2) +#asynchronous=$(cat /etc/centos-release | tr -dc '0-9.'|cut -d \. -f3) + +echo "OS Version: $full" +echo "Major Relase: $major" +echo "Minor Relase: $minor" +#echo "Asynchronous Relase: $asynchronous" + echo -n "Enter Your Main Domain(Eg. domain.com) >" read text echo "Main Domain: $text" MAINDOMAIN=$text +ARCH=$(uname -m) MAINIP=$(hostname --ip-address) MYHOST=$(hostname) while true; do @@ -83,7 +106,7 @@ SCRIPT=$(readlink -f "$0") SCRIPTPATH=$(dirname "$SCRIPT") #echo $SCRIPTPATH -BIND="n"; CURL="n"; DB="n"; Apache="n";PHPe="n";CRON="n";CSSF="n";WCP="n";PFTP="n";PostFix="n";FF="n";PHPT="n"; +BIND="n"; CURL="n"; DB="n"; Apache="n";NGINX="n";PHPe="n";CRON="n";CSSF="n";WCP="n";PFTP="n";PostFix="n";PostDove="n";FF="n";PHPT="n";AW="n"; #set timezone rm -rf /etc/localtime ln -s /usr/share/zoneinfo/Asia/Kolkata /etc/localtime @@ -93,6 +116,9 @@ BUILDDIR=$SCRIPTPATH/log/ BUILDFILE=$RANDOM.txt BUILD=$BUILDDIR$BUILDFILE +FAILBUILDFILE=$RANDOM_failed.txt +FAILBUILD=$BUILDDIR$FAILBUILDFILE + echo $BUILD clear @@ -186,15 +212,45 @@ while true; do done echo "Enter Below Details For openssl Certificate "; -echo -n "Enter YOUR Country Code [XX] In Two Character e.g IN for India > ";read btext; -echo -n "Enter Your State > ";read stext; -echo -n "Enter Your City > ";read ctext; +echo -n "Enter YOUR Country Code [XX] In Two Character e.g IN for India > ";read ctrxx; +echo -n "Enter Your State > ";read statx; +echo -n "Enter Your City > ";read cityx; echo -n "Enter Your Organization > ";read otext; echo -n "Enter Your Organization Unit > ";read outext; echo -n "Enter Your Server Name > ";read srvtext; echo -n "Enter Your Email ID > ";read etext; + + + + + + +echo -e '▒█░▒░▓█░█▒░▒▒█░█▓░▒░█▓ █████▒ ▓█ ▒█▓▓█▓ ██████ ▓████▒░█░ ░█████░▒████▓ ▓█████░ + ░▓ █▓▓█ ▓ ██▒█░▓░▓█░█▓ ▓▒ █▓ ▒█ ▒▓▓▓█▓ ▓░█▓▒█░▓▒ █▓ ▓ ░█░ ▓ ▒▓ ▓█ ▓▒▓█▒█▒ + ▒█▒█▓▓█░█▓▓█▒█▒█▓▓█▒█▓ █▓ █▓░▓░ ▓█ ██▒▒█▓░█▒█▓▒█░██ █▓░█▒ ░ ▒█▒ ░▓ ██ ██ █▓▓█░█▒ + ░█████▓ ██████ ▓█████░▓█ █████░░█████ █▓ █▓░█▒░░▒█ ▓████▒░█████▒█▓ █████ ▒████▓ █▓░▒░█▒ '; +echo -e "$GREEN +# Powered By DjAmol Group Inc # +# Email : Support@djamol.com # +# Website : www.djamol.com # +# Copyright By PatilWeb.com # +# IG:PatilWeb FB:PatilWeb TW:PatilWeb # +$RESET"; +echo -e "\e[32m########################################\n#### Nginx (as Reverse Server Proxy) Soft. #########\n########################################" +while true; do + read -p "Do you wish to install (Nginx Server as Reverse Proxy) program?" yn + case $yn in + [Yy]* ) NGINX="true";sed -i 's/:80/:8088/' $SCRIPTPATH/pprogram/adddomain;break;; + [Nn]* ) echo "Reject Program : Nginx Server as Reverse Proxy (By You) " >> $BUILD; break;; + * ) echo "Please answer yes or no.";; + esac +done + + + + echo -e '▒█░▒░▓█░█▒░▒▒█░█▓░▒░█▓ █████▒ ▓█ ▒█▓▓█▓ ██████ ▓████▒░█░ ░█████░▒████▓ ▓█████░ ░▓ █▓▓█ ▓ ██▒█░▓░▓█░█▓ ▓▒ █▓ ▒█ ▒▓▓▓█▓ ▓░█▓▒█░▓▒ █▓ ▓ ░█░ ▓ ▒▓ ▓█ ▓▒▓█▒█▒ ▒█▒█▓▓█░█▓▓█▒█▒█▓▓█▒█▓ █▓ █▓░▓░ ▓█ ██▒▒█▓░█▒█▓▒█░██ █▓░█▒ ░ ▒█▒ ░▓ ██ ██ █▓▓█░█▒ @@ -240,7 +296,7 @@ echo -e "\e[34m########################################\n#### Cron JOB Softwar while true; do read -p "Do you wish to install (Cron JOB) program?" yn case $yn in - [Yy]* ) CRON="n";="true"; break;; + [Yy]* ) CRON="true"; break;; [Nn]* ) echo "Reject Program : Cron JOB (By You) " >> $BUILD; break;; * ) echo "Please answer yes or no.";; esac @@ -291,7 +347,7 @@ while true; do esac done -echo -n "Control Panel Username (Eg. root) > ";read btext;weba=$btext; +echo -n "Control Panel Username (Eg. root) > ";read wuaxt;weba=$wuaxt; echo -n "Control Panel Password (Eg. pass1234) > ";read ctext;webp=$ctext; echo -n "Control Panel Port (Eg. 2083) > ";read ctext;webo=$ctext; if ! [ "$webo" -eq "$webo" ] 2> /dev/null @@ -336,15 +392,54 @@ echo -e "$GREEN # IG:PatilWeb FB:PatilWeb TW:PatilWeb # $RESET"; echo -e "\e[34m########################################\n#### PostFix Mail Solution ###########\n########################################" + echo -e "########################" + echo -e "OPTION - MAIL SERVER" + echo -e "########################" + echo -e "1. POSTFIX MAIL SERVER" + echo -e "2. POSTFIX+Dovecot(POP3,IMAP) MAIL SERVER with Config mysqlDB" + echo -e "3. NO MAIL SERVER(NONE)" + echo -n "Please enter option [1 - 3]" + read opt + case $opt in + 1) echo -e "************ POSTFIX ONLY *************"; + PostFix="true"; + echo "MAIL Program : POSTFIX ONLY with sendmail server (By You) " >> $BUILD;; + 2) echo -e "************ POSTFIX+Dovecot *************"; + PostDove="true"; + echo "MAIL Program : POSTFIX+Dovecot(POP3,IMAP) MAIL SERVER with Config mysqlDB (By You) " >> $BUILD;; + 2) echo -e "************ NO MAIL SERVER *************"; + echo "MAIL Program : NO MAIL SERVER (By You) " >> $BUILD;; + *) echo -e "$opt is an invaild option. Please select option between 1-3 only"; + echo -e "Press [enter] key to continue. . ."; + read enterKey;; +esac + + + +clear + +echo -e '▒█░▒░▓█░█▒░▒▒█░█▓░▒░█▓ █████▒ ▓█ ▒█▓▓█▓ ██████ ▓████▒░█░ ░█████░▒████▓ ▓█████░ + ░▓ █▓▓█ ▓ ██▒█░▓░▓█░█▓ ▓▒ █▓ ▒█ ▒▓▓▓█▓ ▓░█▓▒█░▓▒ █▓ ▓ ░█░ ▓ ▒▓ ▓█ ▓▒▓█▒█▒ + ▒█▒█▓▓█░█▓▓█▒█▒█▓▓█▒█▓ █▓ █▓░▓░ ▓█ ██▒▒█▓░█▒█▓▒█░██ █▓░█▒ ░ ▒█▒ ░▓ ██ ██ █▓▓█░█▒ + ░█████▓ ██████ ▓█████░▓█ █████░░█████ █▓ █▓░█▒░░▒█ ▓████▒░█████▒█▓ █████ ▒████▓ █▓░▒░█▒ '; +echo -e "$GREEN +# Powered By DjAmol Group Inc # +# Email : Support@djamol.com # +# Website : www.djamol.com # +# Copyright By PatilWeb.com # +# IG:PatilWeb FB:PatilWeb TW:PatilWeb # +$RESET"; +echo -e "\e[34m########################################\n#### FFMPEG Software ###########\n########################################" while true; do - read -p "Do you wish to install (Mail Forward And Sendmail )Postfix program?" yn + read -p "Do you wish to install (Video FrameWork )FFMPEG program?" yn case $yn in - [Yy]* ) PostFix="true"; break;; - [Nn]* ) echo "Reject Program : PostFix (By You) " >> $BUILD; break;; + [Yy]* ) FF="true"; break;; + [Nn]* ) echo "Reject Program : FFMPEG (By You) " >> $BUILD; break;; * ) echo "Please answer yes or no.";; esac done + clear echo -e '▒█░▒░▓█░█▒░▒▒█░█▓░▒░█▓ █████▒ ▓█ ▒█▓▓█▓ ██████ ▓████▒░█░ ░█████░▒████▓ ▓█████░ @@ -358,12 +453,12 @@ echo -e "$GREEN # Copyright By PatilWeb.com # # IG:PatilWeb FB:PatilWeb TW:PatilWeb # $RESET"; -echo -e "\e[34m########################################\n#### FFMPEG Software ###########\n########################################" +echo -e "\e[34m########################################\n#### AWStats is Web analytics Software ###########\n########################################" while true; do - read -p "Do you wish to install (Video FrameWork )FFMPEG program?" yn + read -p "Do you wish to install (AWStats )WebAnalytics program?" yn case $yn in - [Yy]* ) FF="true"; break;; - [Nn]* ) echo "Reject Program : FFMPEG (By You) " >> $BUILD; break;; + [Yy]* ) AW="true"; break;; + [Nn]* ) echo "Reject Program : AWStats (By You) " >> $BUILD; break;; * ) echo "Please answer yes or no.";; esac done @@ -432,17 +527,24 @@ WEBP=$webp WEBO=$webo SCRIPTPATH=$SCRIPTPATH BUILD=$BUILD -CAC=$btext -CAS=$stext -CAL=Aurangabad +FAILBUILD=$FAILBUILD +CAC=$ctrxx +OS=$full +OSV=$major +OSM=$minor +CAS=$statx +CAL=$cityx CAO=$otext CAU=$outext CACM=$srvtext CAM=$etext BIND=$BIND +OSN=$OSN CURL=$CURL DB=$DB WCP=$WCP +AW=$AW +NGINX=$NGINX Apache=$Apache PHPe=$PHPe PHPT=$PHPT; @@ -450,7 +552,9 @@ CRON=$CRON CSSF=$CSSF PFTP=$PFTP PostFix=$PostFix +PostDove=$PostDove MAINDOMAIN=$MAINDOMAIN +ARCH=$ARCH MAINIP=$MAINIP MYHOST=$MYHOST EXTRAD=$EXTRAD @@ -472,6 +576,82 @@ chmod +x inc/*.sh + +RED='\033[01;31m' +RESET='\033[0m' +GREEN='\033[01;32m' +echo -e ' ..:ir7YsJYLii:. + :iL1XqEZggQgQgQgRMQRQRRDd2Yi. + .rIZBBBBBQBRgPSjLrr::.......::rv5dBQBBQ2i + .vPBBBQMEbSU7i: :vPBBBX: + :IRBQQdKUj7i:. rPBBq: + .URBQRE5v77:....... dZdbEPEPEbZdEbZM1 igBQL + :PBRZEDUrirLi...:.:.. SgPKPKPqPKPKPKPKPR7 .PBBs + .EQRPbdPi:ivv7.:::::.. YgKIS25ISKPIS25IIIPM: .PBQv + JBMPKPES.:7v7vi:::::.. rgqI5252SPuJd55UI2IIPg. 7BBZ: + ZBPPXqPq.:vv77rr:::::. :DPSSI52Sqg EPIIUIUIIdd :BgQ7 + RBPPSKKD::77rrrrr:::::..dbISI525SRi :gK25UI2I2DS iBbMs + EBPPSXSbS:r7rrrriri:::..XZ55ISI55g2 LgS2IUI1I5gs . SQKR7 + :BPqXKSKqqirrrrririi::..JgSXIS2S5bE. .. XdSU222UI5Rr . . . .RPSQ + PgPXqXKSKbY:rirrriiii:.7gXSISI5IKgi .... .Dq52IUI25SR: . . . . . EqXP7 +iEEKqSqXKXPPr:iiiii:i:.igKS5SISISEs ..... :gS52212U5qg. . . . . . . . qq2SY +vZPPSKSXXXSPPv::iiii:.:EPXISI5ISq2 iP2IUIUIU5Pd ... ..... . . .E2IIj +iZdKKXqSX5X1qd5i::i::.PbKIS5SIKSPvirv77r7r7iiS5UIUIU225bX ............. YX1jXs + bgPXKXX1dBR5SdZ27:..SDqSS5XXKJ1KPdDZgZDZDZZPS25UIUIU2USZu ........... iXjL5Pr + iBPqXK2UBBgBSXKZDPY7U2IqXqX17srjPPqbqPqPqPPPKqIIUIUIU22XZY ......... iUY7uKQ + gQqKI2BBvgB17b1KqZP5jsvsJvvSKqrLIS5SIS5S5SII2P25UI12UIUSd2. ..... .:7vrrUKQr + QQXbBBXZBP:PIrrXKXSKXSUJ1P5XXPr ........ . 1d25UIUI1225PEJi.....:irrrYSKQL + DBPdQBBgiuuYr5qPSK5X5KSX5S5SSEY..:::::::::..5dIIU21I12UI5PddKXI5U21SSqPQ7 + jBZX5LirLuvvb1j5XqKq5SIS5X5SSD1:.i:i:i:iii::ubS5UIUI12U225IXXXSK5X5qDg: + .EBMrLX12rYKJusuKUuXPD5dPbqS5E5::i:iiiiiii::7SKXI5UIUIU2U2UIUIU5SggJ + :dBQgPPI2J2Y21r7.1QPZr..rI55dXi:riiiririri:ivuX5X5SIIUIUI255Pggs + .2RQqPKqI5uu:v.Rgd: X7:ZI5KZP7irrrrrrrrrrrirrvLjuU122IIqdgq7 + .PKKSqXPKY7EQ.i rgJBRBvrY5Ivir7777r7777v77r77vvYs5PdXL. + .IMgdZdEPEZDPP1Z: .EQQBivr77Psrv7vvLvYLsYssu1SXEdb2r. + .qBQDZDEggMgRMQQBQBDZEQRs7Jv7sEqUvssJJuuIIPPZEdSJi. + .:irrrrvus1vJJjjsLsvL77ii.. '; +echo -e '▒█░▒░▓█░█▒░▒▒█░█▓░▒░█▓ █████▒ ▓█ ▒█▓▓█▓ ██████ ▓████▒░█░ ░█████░▒████▓ ▓█████░ + ░▓ █▓▓█ ▓ ██▒█░▓░▓█░█▓ ▓▒ █▓ ▒█ ▒▓▓▓█▓ ▓░█▓▒█░▓▒ █▓ ▓ ░█░ ▓ ▒▓ ▓█ ▓▒▓█▒█▒ + ▒█▒█▓▓█░█▓▓█▒█▒█▓▓█▒█▓ █▓ █▓░▓░ ▓█ ██▒▒█▓░█▒█▓▒█░██ █▓░█▒ ░ ▒█▒ ░▓ ██ ██ █▓▓█░█▒ + ░█████▓ ██████ ▓█████░▓█ █████░░█████ █▓ █▓░█▒░░▒█ ▓████▒░█████▒█▓ █████ ▒████▓ █▓░▒░█▒ '; +echo -e "$GREEN +# Powered By DjAmol Group Inc # +# Email : Support@djamol.com # +# Website : www.djamol.com # +# Copyright By PatilWeb.com # +# IG:PatilWeb FB:PatilWeb TW:PatilWeb # +$RESET"; + + + +while true; do + read -p "Do you wish to show log(Yes/Y) or run in background(No/N)?" yn + case $yn in + [Yy]* ) + tail -f $BUILD | sed '/^AmolInstaller: SUCCESS$/ q' + #color #tail -f t.txt | awk '{if ($5 ~ /INFO/) print "\033[1;32m"$0"\033[0m"; else if ($1 ~ /SEVERE/) print "\033[1;31m"$0"\033[0m"; else print $0}' + break;; + [Nn]* ) echo "Reject LiveMonitor-Log : Now Relax Installation is Started in Background (By You) " >> $BUILD; + + echo -e "$GREEN +Now Relax Installation is Started in Background +####################### +Now Relax Installation is Started in Background +PHP Apache,PHP,MariaDB,Curl,OpenSSLL And Other Customization Auto Installation Maximum Time ->> Time 20-30 minutes +FFMPEG Customization Auto Installation Maximum Time ->> Time 19-25 minutes +Check Installation is Completed By Command +ffmpeg -v +amol +###################################### +$RESET"; + + break;; + * ) echo "Please answer yes or no.";; + esac +done + + + clear RED='\033[01;31m' RESET='\033[0m' @@ -525,12 +705,32 @@ But if you want check output then all output live store in ServerInstaller-output.log File Command To Check LOG 1)All-Command-OUPUT(Show on Console) - cat ServerInstaller-output.log; + cat ApachePHPffmpeg-amol/ServerInstaller-output.log; 2)Status-OUPUT-Only(Show on Console) - cat log/*.txt; + cat ApachePHPffmpeg-amol/log/*.txt; &(if) FFMPEG Installation Output 1) All-Output - cat FFMPEG-output.log; + cat ApachePHPffmpeg-amol/FFMPEG-output.log; 2) Status Output ONly cat /root/djamolDEV/ffmpeg/log/*.txt; + ####################### + After Complete Installation + You Can use below shell command + ####################### + # adddomain <-for add domain in apache server with bind dns + # addftp OR addftpuser <- add ftp account to access ftp service + # backup <- backup home directory with server config files + # dbbackup <- database backup StructureWithDATA or Only Table Structure + # dbrestore <- restore database from sql file + # sinfo <- Your VPS benchmark information + ###################################### +Now Relax Installation is Started in Background +PHP Apache,PHP,MariaDB,Curl,OpenSSLL And Other Customization Auto Installation Maximum Time ->> Time 20-30 minutes +FFMPEG Customization Auto Installation Maximum Time ->> Time 19-25 minutes +Check Installation is Completed By Command +ffmpeg -v +amol +###################################### +Live Track Status Run ssh Below command +tail -f $BUILD | sed '/^AmolInstaller: SUCCESS$/ q' $RESET"; diff --git a/autorpm.sh b/autorpm.sh new file mode 100644 index 0000000..a56d76b --- /dev/null +++ b/autorpm.sh @@ -0,0 +1,326 @@ +##for centos 7 (no required for centos minimal version) +## yum install iptables-services + systemctl start iptables + systemctl enable iptables + systemctl disable firewalld + systemctl stop firewalld + iptables -P INPUT ACCEPT + iptables -F + iptables -A INPUT -m state --state ESTABLISHED -j ACCEPT + iptables -A INPUT -m state --state RELATED -j ACCEPT + iptables -A INPUT -p tcp --dport 22 -j ACCEPT + iptables -A INPUT -p tcp --dport 80 -j ACCEPT + iptables -A INPUT -p tcp --dport 443 -j ACCEPT # if need + # add any other port you need, like above + iptables -P INPUT DROP + service iptables save + service iptables stop + chkconfig iptables off + chkconfig ip6tables off + #### END ### + + +RED='\033[01;31m' +RESET='\033[0m' +GREEN='\033[01;32m' +echo -e ' ..:ir7YsJYLii:. + :iL1XqEZggQgQgQgRMQRQRRDd2Yi. + .rIZBBBBBQBRgPSjLrr::.......::rv5dBQBBQ2i + .vPBBBQMEbSU7i: :vPBBBX: + :IRBQQdKUj7i:. rPBBq: + .URBQRE5v77:....... dZdbEPEPEbZdEbZM1 igBQL + :PBRZEDUrirLi...:.:.. SgPKPKPqPKPKPKPKPR7 .PBBs + .EQRPbdPi:ivv7.:::::.. YgKIS25ISKPIS25IIIPM: .PBQv + JBMPKPES.:7v7vi:::::.. rgqI5252SPuJd55UI2IIPg. 7BBZ: + ZBPPXqPq.:vv77rr:::::. :DPSSI52Sqg EPIIUIUIIdd :BgQ7 + RBPPSKKD::77rrrrr:::::..dbISI525SRi :gK25UI2I2DS iBbMs + EBPPSXSbS:r7rrrriri:::..XZ55ISI55g2 LgS2IUI1I5gs . SQKR7 + :BPqXKSKqqirrrrririi::..JgSXIS2S5bE. .. XdSU222UI5Rr . . . .RPSQ + PgPXqXKSKbY:rirrriiii:.7gXSISI5IKgi .... .Dq52IUI25SR: . . . . . EqXP7 +iEEKqSqXKXPPr:iiiii:i:.igKS5SISISEs ..... :gS52212U5qg. . . . . . . . qq2SY +vZPPSKSXXXSPPv::iiii:.:EPXISI5ISq2 iP2IUIUIU5Pd ... ..... . . .E2IIj +iZdKKXqSX5X1qd5i::i::.PbKIS5SIKSPvirv77r7r7iiS5UIUIU225bX ............. YX1jXs + bgPXKXX1dBR5SdZ27:..SDqSS5XXKJ1KPdDZgZDZDZZPS25UIUIU2USZu ........... iXjL5Pr + iBPqXK2UBBgBSXKZDPY7U2IqXqX17srjPPqbqPqPqPPPKqIIUIUIU22XZY ......... iUY7uKQ + gQqKI2BBvgB17b1KqZP5jsvsJvvSKqrLIS5SIS5S5SII2P25UI12UIUSd2. ..... .:7vrrUKQr + QQXbBBXZBP:PIrrXKXSKXSUJ1P5XXPr ........ . 1d25UIUI1225PEJi.....:irrrYSKQL + DBPdQBBgiuuYr5qPSK5X5KSX5S5SSEY..:::::::::..5dIIU21I12UI5PddKXI5U21SSqPQ7 + jBZX5LirLuvvb1j5XqKq5SIS5X5SSD1:.i:i:i:iii::ubS5UIUI12U225IXXXSK5X5qDg: + .EBMrLX12rYKJusuKUuXPD5dPbqS5E5::i:iiiiiii::7SKXI5UIUIU2U2UIUIU5SggJ + :dBQgPPI2J2Y21r7.1QPZr..rI55dXi:riiiririri:ivuX5X5SIIUIUI255Pggs + .2RQqPKqI5uu:v.Rgd: X7:ZI5KZP7irrrrrrrrrrrirrvLjuU122IIqdgq7 + .PKKSqXPKY7EQ.i rgJBRBvrY5Ivir7777r7777v77r77vvYs5PdXL. + .IMgdZdEPEZDPP1Z: .EQQBivr77Psrv7vvLvYLsYssu1SXEdb2r. + .qBQDZDEggMgRMQQBQBDZEQRs7Jv7sEqUvssJJuuIIPPZEdSJi. + .:irrrrvus1vJJjjsLsvL77ii.. '; +echo -e '▒█░▒░▓█░█▒░▒▒█░█▓░▒░█▓ █████▒ ▓█ ▒█▓▓█▓ ██████ ▓████▒░█░ ░█████░▒████▓ ▓█████░ + ░▓ █▓▓█ ▓ ██▒█░▓░▓█░█▓ ▓▒ █▓ ▒█ ▒▓▓▓█▓ ▓░█▓▒█░▓▒ █▓ ▓ ░█░ ▓ ▒▓ ▓█ ▓▒▓█▒█▒ + ▒█▒█▓▓█░█▓▓█▒█▒█▓▓█▒█▓ █▓ █▓░▓░ ▓█ ██▒▒█▓░█▒█▓▒█░██ █▓░█▒ ░ ▒█▒ ░▓ ██ ██ █▓▓█░█▒ + ░█████▓ ██████ ▓█████░▓█ █████░░█████ █▓ █▓░█▒░░▒█ ▓████▒░█████▒█▓ █████ ▒████▓ █▓░▒░█▒ '; +echo -e "$GREEN +# Powered By DjAmol Group Inc # +# Email : Support@djamol.com # +# Website : www.djamol.com # +# Copyright By PatilWeb.com # +# IG:PatilWeb FB:PatilWeb TW:PatilWeb # +$RESET"; +echo -n "Enter Your Main Domain(Eg. domain.com) >" +read text +echo "Main Domain: $text" +MAINDOMAIN="demo.com" +MAINIP=$(hostname --ip-address) +MYHOST=$(hostname) +echo "Main IP: $MAINIP"; +SCRIPT=$(readlink -f "$0") +# Absolute path this script is in, thus /home/user/bin +SCRIPTPATH=$(dirname "$SCRIPT") +#echo $SCRIPTPATH + +BIND="n"; CURL="n"; DB="n"; Apache="n";PHPe="n";CRON="n";CSSF="n";WCP="n";PFTP="n";PostFix="n";FF="n";PHPT="n";AW="n"; +#set timezone +rm -rf /etc/localtime +ln -s /usr/share/zoneinfo/Asia/Kolkata /etc/localtime + +mkdir $SCRIPTPATH/log +BUILDDIR=$SCRIPTPATH/log/ +BUILDFILE=$RANDOM.txt +BUILD=$BUILDDIR$BUILDFILE + +echo $BUILD +clear + +echo -e '▒█░▒░▓█░█▒░▒▒█░█▓░▒░█▓ █████▒ ▓█ ▒█▓▓█▓ ██████ ▓████▒░█░ ░█████░▒████▓ ▓█████░ + ░▓ █▓▓█ ▓ ██▒█░▓░▓█░█▓ ▓▒ █▓ ▒█ ▒▓▓▓█▓ ▓░█▓▒█░▓▒ █▓ ▓ ░█░ ▓ ▒▓ ▓█ ▓▒▓█▒█▒ + ▒█▒█▓▓█░█▓▓█▒█▒█▓▓█▒█▓ █▓ █▓░▓░ ▓█ ██▒▒█▓░█▒█▓▒█░██ █▓░█▒ ░ ▒█▒ ░▓ ██ ██ █▓▓█░█▒ + ░█████▓ ██████ ▓█████░▓█ █████░░█████ █▓ █▓░█▒░░▒█ ▓████▒░█████▒█▓ █████ ▒████▓ █▓░▒░█▒ '; +echo -e "$GREEN +# Powered By DjAmol Group Inc # +# Email : Support@djamol.com # +# Website : www.djamol.com # +# Copyright By PatilWeb.com # +# IG:PatilWeb FB:PatilWeb TW:PatilWeb # +$RESET"; +BIND="true" +CURL="true"; +DB="true"; +Apache="true"; +ctrxx="IN"; +statx="Mah"; +cityx="Pune"; +otext="DA Group Inc"; +outext="IT Sector"; +srvtext="server.demo.com"; +etext="demo@demo.com"; +PHPe="true"; +# testing php program +PHPT="no"; +CRON="true"; +CSSF="true"; +WCP="true"; +weba="admin"; +webp="pass@123"; +webo="2066"; +if ! [ "$webo" -eq "$webo" ] 2> /dev/null +then +echo "Sorry integers only now your control panel PORT - default 2083"; webo=2083; +fi +PFTP="true"; +PostFix="true"; +FF="true"; +AW="true"; +EXTRAD="no"; +EXTRADS="no"; + + +set -a +# Global Variable to access any bash other files run by this file +#TESTVARIABLE=hellohelloheloo +WEBA=$weba +WEBP=$webp +WEBO=$webo +SCRIPTPATH=$SCRIPTPATH +BUILD=$BUILD +CAC=$ctrxx +CAS=$statx +CAL=$cityx +CAO=$otext +CAU=$outext +CACM=$srvtext +CAM=$etext +BIND=$BIND +CURL=$CURL +DB=$DB +WCP=$WCP +AW=$AW +Apache=$Apache +PHPe=$PHPe +PHPT=$PHPT; +CRON=$CRON +CSSF=$CSSF +PFTP=$PFTP +PostFix=$PostFix +MAINDOMAIN=$MAINDOMAIN +MAINIP=$MAINIP +MYHOST=$MYHOST +EXTRAD=$EXTRAD +EXTRADS=$EXTRADS +FF=$FF +# ... +# Here put all the variables that will be marked for export +# and that will be available from within test2 (and all other commands). +# If test2 modifies the variables, the modifications will never be +# seen in the present script! +set +a + +# Here, even if test2 modifies TESTVARIABLE, you'll still have + # TESTVARIABLE=hellohelloheloo +#./start.sh > FFMPEG-output.log 2>&1 & +chmod +x auto*; +chmod +x inc/*.sh +./auto > ServerInstaller-output.log 2>&1 & + + + + +RED='\033[01;31m' +RESET='\033[0m' +GREEN='\033[01;32m' +echo -e ' ..:ir7YsJYLii:. + :iL1XqEZggQgQgQgRMQRQRRDd2Yi. + .rIZBBBBBQBRgPSjLrr::.......::rv5dBQBBQ2i + .vPBBBQMEbSU7i: :vPBBBX: + :IRBQQdKUj7i:. rPBBq: + .URBQRE5v77:....... dZdbEPEPEbZdEbZM1 igBQL + :PBRZEDUrirLi...:.:.. SgPKPKPqPKPKPKPKPR7 .PBBs + .EQRPbdPi:ivv7.:::::.. YgKIS25ISKPIS25IIIPM: .PBQv + JBMPKPES.:7v7vi:::::.. rgqI5252SPuJd55UI2IIPg. 7BBZ: + ZBPPXqPq.:vv77rr:::::. :DPSSI52Sqg EPIIUIUIIdd :BgQ7 + RBPPSKKD::77rrrrr:::::..dbISI525SRi :gK25UI2I2DS iBbMs + EBPPSXSbS:r7rrrriri:::..XZ55ISI55g2 LgS2IUI1I5gs . SQKR7 + :BPqXKSKqqirrrrririi::..JgSXIS2S5bE. .. XdSU222UI5Rr . . . .RPSQ + PgPXqXKSKbY:rirrriiii:.7gXSISI5IKgi .... .Dq52IUI25SR: . . . . . EqXP7 +iEEKqSqXKXPPr:iiiii:i:.igKS5SISISEs ..... :gS52212U5qg. . . . . . . . qq2SY +vZPPSKSXXXSPPv::iiii:.:EPXISI5ISq2 iP2IUIUIU5Pd ... ..... . . .E2IIj +iZdKKXqSX5X1qd5i::i::.PbKIS5SIKSPvirv77r7r7iiS5UIUIU225bX ............. YX1jXs + bgPXKXX1dBR5SdZ27:..SDqSS5XXKJ1KPdDZgZDZDZZPS25UIUIU2USZu ........... iXjL5Pr + iBPqXK2UBBgBSXKZDPY7U2IqXqX17srjPPqbqPqPqPPPKqIIUIUIU22XZY ......... iUY7uKQ + gQqKI2BBvgB17b1KqZP5jsvsJvvSKqrLIS5SIS5S5SII2P25UI12UIUSd2. ..... .:7vrrUKQr + QQXbBBXZBP:PIrrXKXSKXSUJ1P5XXPr ........ . 1d25UIUI1225PEJi.....:irrrYSKQL + DBPdQBBgiuuYr5qPSK5X5KSX5S5SSEY..:::::::::..5dIIU21I12UI5PddKXI5U21SSqPQ7 + jBZX5LirLuvvb1j5XqKq5SIS5X5SSD1:.i:i:i:iii::ubS5UIUI12U225IXXXSK5X5qDg: + .EBMrLX12rYKJusuKUuXPD5dPbqS5E5::i:iiiiiii::7SKXI5UIUIU2U2UIUIU5SggJ + :dBQgPPI2J2Y21r7.1QPZr..rI55dXi:riiiririri:ivuX5X5SIIUIUI255Pggs + .2RQqPKqI5uu:v.Rgd: X7:ZI5KZP7irrrrrrrrrrrirrvLjuU122IIqdgq7 + .PKKSqXPKY7EQ.i rgJBRBvrY5Ivir7777r7777v77r77vvYs5PdXL. + .IMgdZdEPEZDPP1Z: .EQQBivr77Psrv7vvLvYLsYssu1SXEdb2r. + .qBQDZDEggMgRMQQBQBDZEQRs7Jv7sEqUvssJJuuIIPPZEdSJi. + .:irrrrvus1vJJjjsLsvL77ii.. '; +echo -e '▒█░▒░▓█░█▒░▒▒█░█▓░▒░█▓ █████▒ ▓█ ▒█▓▓█▓ ██████ ▓████▒░█░ ░█████░▒████▓ ▓█████░ + ░▓ █▓▓█ ▓ ██▒█░▓░▓█░█▓ ▓▒ █▓ ▒█ ▒▓▓▓█▓ ▓░█▓▒█░▓▒ █▓ ▓ ░█░ ▓ ▒▓ ▓█ ▓▒▓█▒█▒ + ▒█▒█▓▓█░█▓▓█▒█▒█▓▓█▒█▓ █▓ █▓░▓░ ▓█ ██▒▒█▓░█▒█▓▒█░██ █▓░█▒ ░ ▒█▒ ░▓ ██ ██ █▓▓█░█▒ + ░█████▓ ██████ ▓█████░▓█ █████░░█████ █▓ █▓░█▒░░▒█ ▓████▒░█████▒█▓ █████ ▒████▓ █▓░▒░█▒ '; +echo -e "$GREEN +# Powered By DjAmol Group Inc # +# Email : Support@djamol.com # +# Website : www.djamol.com # +# Copyright By PatilWeb.com # +# IG:PatilWeb FB:PatilWeb TW:PatilWeb # +$RESET"; + +echo -e "$GREEN +Now Relax Installation is Started in Background +####################### +Now Relax Installation is Started in Background +PHP Apache,PHP,MariaDB,Curl,OpenSSLL And Other Customization Auto Installation Maximum Time ->> Time 20-30 minutes +FFMPEG Customization Auto Installation Maximum Time ->> Time 19-25 minutes +Check Installation is Completed By Command +ffmpeg -v +amol +###################################### +$RESET"; + + + + +clear +RED='\033[01;31m' +RESET='\033[0m' +GREEN='\033[01;32m' +echo -e ' ..:ir7YsJYLii:. + :iL1XqEZggQgQgQgRMQRQRRDd2Yi. + .rIZBBBBBQBRgPSjLrr::.......::rv5dBQBBQ2i + .vPBBBQMEbSU7i: :vPBBBX: + :IRBQQdKUj7i:. rPBBq: + .URBQRE5v77:....... dZdbEPEPEbZdEbZM1 igBQL + :PBRZEDUrirLi...:.:.. SgPKPKPqPKPKPKPKPR7 .PBBs + .EQRPbdPi:ivv7.:::::.. YgKIS25ISKPIS25IIIPM: .PBQv + JBMPKPES.:7v7vi:::::.. rgqI5252SPuJd55UI2IIPg. 7BBZ: + ZBPPXqPq.:vv77rr:::::. :DPSSI52Sqg EPIIUIUIIdd :BgQ7 + RBPPSKKD::77rrrrr:::::..dbISI525SRi :gK25UI2I2DS iBbMs + EBPPSXSbS:r7rrrriri:::..XZ55ISI55g2 LgS2IUI1I5gs . SQKR7 + :BPqXKSKqqirrrrririi::..JgSXIS2S5bE. .. XdSU222UI5Rr . . . .RPSQ + PgPXqXKSKbY:rirrriiii:.7gXSISI5IKgi .... .Dq52IUI25SR: . . . . . EqXP7 +iEEKqSqXKXPPr:iiiii:i:.igKS5SISISEs ..... :gS52212U5qg. . . . . . . . qq2SY +vZPPSKSXXXSPPv::iiii:.:EPXISI5ISq2 iP2IUIUIU5Pd ... ..... . . .E2IIj +iZdKKXqSX5X1qd5i::i::.PbKIS5SIKSPvirv77r7r7iiS5UIUIU225bX ............. YX1jXs + bgPXKXX1dBR5SdZ27:..SDqSS5XXKJ1KPdDZgZDZDZZPS25UIUIU2USZu ........... iXjL5Pr + iBPqXK2UBBgBSXKZDPY7U2IqXqX17srjPPqbqPqPqPPPKqIIUIUIU22XZY ......... iUY7uKQ + gQqKI2BBvgB17b1KqZP5jsvsJvvSKqrLIS5SIS5S5SII2P25UI12UIUSd2. ..... .:7vrrUKQr + QQXbBBXZBP:PIrrXKXSKXSUJ1P5XXPr ........ . 1d25UIUI1225PEJi.....:irrrYSKQL + DBPdQBBgiuuYr5qPSK5X5KSX5S5SSEY..:::::::::..5dIIU21I12UI5PddKXI5U21SSqPQ7 + jBZX5LirLuvvb1j5XqKq5SIS5X5SSD1:.i:i:i:iii::ubS5UIUI12U225IXXXSK5X5qDg: + .EBMrLX12rYKJusuKUuXPD5dPbqS5E5::i:iiiiiii::7SKXI5UIUIU2U2UIUIU5SggJ + :dBQgPPI2J2Y21r7.1QPZr..rI55dXi:riiiririri:ivuX5X5SIIUIUI255Pggs + .2RQqPKqI5uu:v.Rgd: X7:ZI5KZP7irrrrrrrrrrrirrvLjuU122IIqdgq7 + .PKKSqXPKY7EQ.i rgJBRBvrY5Ivir7777r7777v77r77vvYs5PdXL. + .IMgdZdEPEZDPP1Z: .EQQBivr77Psrv7vvLvYLsYssu1SXEdb2r. + .qBQDZDEggMgRMQQBQBDZEQRs7Jv7sEqUvssJJuuIIPPZEdSJi. + .:irrrrvus1vJJjjsLsvL77ii.. '; +echo -e '▒█░▒░▓█░█▒░▒▒█░█▓░▒░█▓ █████▒ ▓█ ▒█▓▓█▓ ██████ ▓████▒░█░ ░█████░▒████▓ ▓█████░ + ░▓ █▓▓█ ▓ ██▒█░▓░▓█░█▓ ▓▒ █▓ ▒█ ▒▓▓▓█▓ ▓░█▓▒█░▓▒ █▓ ▓ ░█░ ▓ ▒▓ ▓█ ▓▒▓█▒█▒ + ▒█▒█▓▓█░█▓▓█▒█▒█▓▓█▒█▓ █▓ █▓░▓░ ▓█ ██▒▒█▓░█▒█▓▒█░██ █▓░█▒ ░ ▒█▒ ░▓ ██ ██ █▓▓█░█▒ + ░█████▓ ██████ ▓█████░▓█ █████░░█████ █▓ █▓░█▒░░▒█ ▓████▒░█████▒█▓ █████ ▒████▓ █▓░▒░█▒ '; +echo -e "$GREEN +# Powered By DjAmol Group Inc # +# Email : Support@djamol.com # +# Website : www.djamol.com # +# Copyright By PatilWeb.com # +# IG:PatilWeb FB:PatilWeb TW:PatilWeb # +$RESET"; + + +echo -e "$GREEN +Now Relax Installation is Started in Background +But if you want check output then all output live store in +ServerInstaller-output.log File +Command To Check LOG +1)All-Command-OUPUT(Show on Console) + cat ApachePHPffmpeg-amol/ServerInstaller-output.log; +2)Status-OUPUT-Only(Show on Console) + cat ApachePHPffmpeg-amol/log/*.txt; +&(if) FFMPEG Installation Output + 1) All-Output + cat ApachePHPffmpeg-amol/FFMPEG-output.log; + 2) Status Output ONly + cat /root/djamolDEV/ffmpeg/log/*.txt; + ####################### + After Complete Installation + You Can use below shell command + ####################### + # adddomain <-for add domain in apache server with bind dns + # addftp OR addftpuser <- add ftp account to access ftp service + # backup <- backup home directory with server config files + # dbbackup <- database backup StructureWithDATA or Only Table Structure + # dbrestore <- restore database from sql file + # sinfo <- Your VPS benchmark information + ###################################### +Now Relax Installation is Started in Background +PHP Apache,PHP,MariaDB,Curl,OpenSSLL And Other Customization Auto Installation Maximum Time ->> Time 20-30 minutes +FFMPEG Customization Auto Installation Maximum Time ->> Time 19-25 minutes +Check Installation is Completed By Command +ffmpeg -v +amol +###################################### +Live Track Status Run ssh Below command + tail -f $BUILD | sed '/^AmolInstaller: SUCCESS$/ q' +$RESET"; diff --git a/conf/a b/conf/a new file mode 100644 index 0000000..20e04a5 --- /dev/null +++ b/conf/a @@ -0,0 +1,112 @@ +prog="amol (Auto Installer)" +RESET='\033[0m' +NOCOLOR='\033[0m' +RED='\033[0;31m' +GREEN='\033[0;32m' +ORANGE='\033[0;33m' +BLUE='\033[0;34m' +PURPLE='\033[0;35m' +CYAN='\033[0;36m' +LIGHTGRAY='\033[0;37m' +DARKGRAY='\033[1;30m' +LIGHTRED='\033[1;31m' +LIGHTGREEN='\033[1;32m' +YELLOW='\033[1;33m' +LIGHTBLUE='\033[1;34m' +LIGHTPURPLE='\033[1;35m' +LIGHTCYAN='\033[1;36m' +WHITE='\033[1;37m' +echo -e " ${RED} + ..:ir7YsJYLii:. + :iL1XqEZggQgQgQgRMQRQRRDd2Yi. + .rIZBBBBBQBRgPSjLrr::.......::rv5dBQBBQ2i ${GREEN} + .vPBBBQMEbSU7i: :vPBBBX: + :IRBQQdKUj7i:. rPBBq: + .URBQRE5v77:....... dZdbEPEPEbZdEbZM1 igBQL ${ORANGE} + :PBRZEDUrirLi...:.:.. SgPKPKPqPKPKPKPKPR7 .PBBs + .EQRPbdPi:ivv7.:::::.. YgKIS25ISKPIS25IIIPM: .PBQv + JBMPKPES.:7v7vi:::::.. rgqI5252SPuJd55UI2IIPg. 7BBZ: ${PURPLE} + ZBPPXqPq.:vv77rr:::::. :DPSSI52Sqg EPIIUIUIIdd :BgQ7 + RBPPSKKD::77rrrrr:::::..dbISI525SRi :gK25UI2I2DS iBbMs + EBPPSXSbS:r7rrrriri:::..XZ55ISI55g2 LgS2IUI1I5gs . SQKR7 ${CYAN} + :BPqXKSKqqirrrrririi::..JgSXIS2S5bE. .. XdSU222UI5Rr . . . .RPSQ + PgPXqXKSKbY:rirrriiii:.7gXSISI5IKgi .... .Dq52IUI25SR: . . . . . EqXP7 +iEEKqSqXKXPPr:iiiii:i:.igKS5SISISEs ..... :gS52212U5qg. . . . . . . . qq2SY ${YELLOW} +vZPPSKSXXXSPPv::iiii:.:EPXISI5ISq2 iP2IUIUIU5Pd ... ..... . . .E2IIj +iZdKKXqSX5X1qd5i::i::.PbKIS5SIKSPvirv77r7r7iiS5UIUIU225bX ............. YX1jXs ${LIGHTGRAY} + bgPXKXX1dBR5SdZ27:..SDqSS5XXKJ1KPdDZgZDZDZZPS25UIUIU2USZu ........... iXjL5Pr + iBPqXK2UBBgBSXKZDPY7U2IqXqX17srjPPqbqPqPqPPPKqIIUIUIU22XZY ......... iUY7uKQ ${LIGHTCYAN} + gQqKI2BBvgB17b1KqZP5jsvsJvvSKqrLIS5SIS5S5SII2P25UI12UIUSd2. ..... .:7vrrUKQr + QQXbBBXZBP:PIrrXKXSKXSUJ1P5XXPr ........ . 1d25UIUI1225PEJi.....:irrrYSKQL + DBPdQBBgiuuYr5qPSK5X5KSX5S5SSEY..:::::::::..5dIIU21I12UI5PddKXI5U21SSqPQ7 ${LIGHTGRAY} + jBZX5LirLuvvb1j5XqKq5SIS5X5SSD1:.i:i:i:iii::ubS5UIUI12U225IXXXSK5X5qDg: + .EBMrLX12rYKJusuKUuXPD5dPbqS5E5::i:iiiiiii::7SKXI5UIUIU2U2UIUIU5SggJ ${LIGHTRED} + :dBQgPPI2J2Y21r7.1QPZr..rI55dXi:riiiririri:ivuX5X5SIIUIUI255Pggs + .2RQqPKqI5uu:v.Rgd: X7:ZI5KZP7irrrrrrrrrrrirrvLjuU122IIqdgq7 + .PKKSqXPKY7EQ.i rgJBRBvrY5Ivir7777r7777v77r77vvYs5PdXL. ${PURPLE} + .IMgdZdEPEZDPP1Z: .EQQBivr77Psrv7vvLvYLsYssu1SXEdb2r. + .qBQDZDEggMgRMQQBQBDZEQRs7Jv7sEqUvssJJuuIIPPZEdSJi. + .:irrrrvus1vJJjjsLsvL77ii.. +${NOCOLOR}"; +case "$1" in + start) + start + ;; + stop) + stop + ;; + status) +echo -e "${LIGHTGRAY}====================================" +echo -e "${BLUE}HTTPD Apache VERSION${GREEN}" +/usr/local/bin/httpd -v +echo -e "${LIGHTGRAY}====================================" +echo -e "${BLUE}PHP VERSION ${GREEN}" +/usr/local/bin/php -v +echo -e "${LIGHTGRAY}====================================" +echo -e "${BLUE}MYSQL VERSION${GREEN}" +mysql -V +echo -e "${LIGHTGRAY}====================================" +echo -e "${BLUE}BIND DNS VERSION${GREEN}" +named -v +echo -e "${LIGHTGRAY}====================================" +echo -e "${BLUE}CURL VERSION${GREEN}" +curl -V +echo -e "${LIGHTGRAY}====================================" +echo -e "${BLUE}OPEN SSL${GREEN}" +openssl version +echo -e "${LIGHTGRAY}====================================" +echo -e "${BLUE}FFMPEG VERSION${GREEN}" +/usr/local/bin/ffmpeg -version + RETVAL=$? + ;; + restart) + stop + start + ;; + condrestart|try-restart) + if status -p ${pidfile} $httpd >&/dev/null; then + stop + start + fi + ;; + force-reload|reload) + reload + ;; + graceful|help|configtest|fullstatus) + $apachectl $@ + RETVAL=$? + ;; + *) + echo -e "${RED}Usage: $prog {status}${NOCOLOR}" + echo "Command :: service amol status" +esac + +$RETVAL +echo -e "${GREEN} +# Powered By DjA${ORANGE}mol Group Inc # +# Email : Support@dja${PURPLE}mol.com # +# Webs${CYAN}ite : www.dja${LIGHTPURPLE}mol.com # +# Copyright By PatilW${WHITE}eb.com # +# IG:P${YELLOW}atilWeb FB:Patil${LIGHTGREEN}Web TW:Pa${LIGHTPURPLE}tilWeb # +${NOCOLOR}"; +exit diff --git a/conf/apache2 b/conf/apache2 new file mode 100644 index 0000000..7ab66a5 --- /dev/null +++ b/conf/apache2 @@ -0,0 +1,124 @@ +#!/bin/bash +# +# httpd Startup script for the Apache HTTP Server +# +# chkconfig: - 85 15 +# description: The Apache HTTP Server is an efficient and extensible \ +# server implementing the current HTTP standards. +# processname: httpd +# config: /etc/httpd/conf/httpd.conf +# config: /etc/sysconfig/httpd +# pidfile: /usr/local/apache2/logs/httpd.pid +# +### BEGIN INIT INFO +# Provides: httpd +# Required-Start: $local_fs $remote_fs $network $named +# Required-Stop: $local_fs $remote_fs $network +# Should-Start: distcache +# Short-Description: start and stop Apache HTTP Server +# Description: The Apache HTTP Server is an extensible server +# implementing the current HTTP standards. +### END INIT INFO + +# Source function library. +. /etc/rc.d/init.d/functions + +if [ -f /etc/sysconfig/httpd ]; then + . /etc/sysconfig/httpd +fi + +# Start httpd in the C locale by default. +HTTPD_LANG=${HTTPD_LANG-"C"} + +# This will prevent initlog from swallowing up a pass-phrase prompt if +# mod_ssl needs a pass-phrase from the user. +INITLOG_ARGS="" + +# Set HTTPD=/usr/sbin/httpd.worker in /etc/sysconfig/httpd to use a server +# with the thread-based "worker" MPM; BE WARNED that some modules may not +# work correctly with a thread-based MPM; notably PHP will refuse to start. + +# Path to the apachectl script, server binary, and short-form for messages. +apachectl=/usr/local/apache2/bin/apachectl +httpd=${HTTPD-/usr/local/apache2/bin/httpd} +prog=httpd +pidfile=${PIDFILE-/usr/local/apache2/logs/httpd.pid} +lockfile=${LOCKFILE-/var/lock/subsys/httpd} +RETVAL=0 +STOP_TIMEOUT=${STOP_TIMEOUT-10} + +# The semantics of these two functions differ from the way apachectl does +# things -- attempting to start while running is a failure, and shutdown +# when not running is also a failure. So we just do it the way init scripts +# are expected to behave here. +start() { + echo -n $"Starting $prog: " + LANG=$HTTPD_LANG daemon --pidfile=${pidfile} $httpd $OPTIONS + RETVAL=$? + echo + [ $RETVAL = 0 ] && touch ${lockfile} + return $RETVAL +} + +# When stopping httpd, a delay (of default 10 second) is required +# before SIGKILLing the httpd parent; this gives enough time for the +# httpd parent to SIGKILL any errant children. +stop() { + echo -n $"Stopping $prog: " + killproc -p ${pidfile} -d ${STOP_TIMEOUT} $httpd + RETVAL=$? + echo + [ $RETVAL = 0 ] && rm -f ${lockfile} ${pidfile} +} +reload() { + echo -n $"Reloading $prog: " + if ! LANG=$HTTPD_LANG $httpd $OPTIONS -t >&/dev/null; then + RETVAL=6 + echo $"not reloading due to configuration syntax error" + failure $"not reloading $httpd due to configuration syntax error" + else + # Force LSB behaviour from killproc + LSB=1 killproc -p ${pidfile} $httpd -HUP + RETVAL=$? + if [ $RETVAL -eq 7 ]; then + failure $"httpd shutdown" + fi + fi + echo +} + +# See how we were called. +case "$1" in + start) + start + ;; + stop) + stop + ;; + status) + status -p ${pidfile} $httpd + RETVAL=$? + ;; + restart) + stop + start + ;; + condrestart|try-restart) + if status -p ${pidfile} $httpd >&/dev/null; then + stop + start + fi + ;; + force-reload|reload) + reload + ;; + graceful|help|configtest|fullstatus) + $apachectl $@ + RETVAL=$? + ;; + *) + echo $"Usage: $prog {start|stop|restart|condrestart|try-restart|force-reload|reload|status|fullstatus|graceful|help|configtest}" + RETVAL=2 +esac + +exit $RETVAL diff --git a/conf/awstats b/conf/awstats new file mode 100644 index 0000000..2f82ee0 --- /dev/null +++ b/conf/awstats @@ -0,0 +1,60 @@ +prog="amol (Awstats)" +case "$1" in + start) + start + mv /usr/local/apache2/conf/amolhost/awstats.bak /usr/local/apache2/conf/amolhost/awstats.conf + for i in `find /usr/local/apache2/conf/amolhost/ -name "*.conf" -type f`; do +echo "Path :$i" +f="$(basename -- $i)" +echo "File :$f" +sed -i 's/#CustomLog/CustomLog/g' $f +done +echo "Service is Started Httpd Log File (its required for awstats)" +service apache2 reload + + ;; + stop) + stop + mv /usr/local/apache2/conf/amolhost/awstats.conf /usr/local/apache2/conf/amolhost/awstats.bak +for i in `find /usr/local/apache2/conf/amolhost/ -name "*.conf" -type f`; do +echo "Path :$i" +f="$(basename -- $i)" +echo "File :$f" +sed -i 's/CustomLog/#CustomLog/g' $f +done +echo "Service is Stopped Log File (its required for awstats)" +service apache2 reload + ;; + status) +echo -e "${LIGHTGRAY}====================================" +echo -e "${BLUE}AWStats is an open source Web analytics reporting tool${GREEN}" +echo -e "${BLUE}You can start or stop${GREEN}" + RETVAL=$? + ;; + restart) + stop + start + ;; + condrestart|try-restart) + if status -p ${pidfile} $httpd >&/dev/null; then + stop + start + fi + ;; + force-reload|reload) + reload + ;; + graceful|help|configtest|fullstatus) + $apachectl $@ + RETVAL=$? + ;; + *) + echo -e "${RED}Usage: $prog {status,stop,start}${NOCOLOR}" + echo "Command :: service awstats status" +esac + +$RETVAL +echo -e "${GREEN} +# AWStats is an open source Web analytics reporting tool # +${NOCOLOR}"; +exit diff --git a/conf/awstats.conf b/conf/awstats.conf new file mode 100644 index 0000000..2a42996 --- /dev/null +++ b/conf/awstats.conf @@ -0,0 +1,22 @@ +LoadModule cgid_module modules/mod_cgid.so +AddHandler cgi-script .cgi .pl + +Alias /awstatsclasses "/usr/share/awstats/wwwroot/classes/" + +Alias /awstatscss "/usr/share/awstats/wwwroot/css/" + +Alias /awstatsicons "/usr/share/awstats/wwwroot/icon/" +ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/ +ScriptAlias /awstats/ "/usr/share/awstats/wwwroot/cgi-bin/" + + AddHandler cgi-script .cgi .pl + AllowOverride Indexes + DirectoryIndex awstats.pl + Options +ExecCGI +MultiViews +SymLinksIfOwnerMatch + # Require all granted + #OR $ htpasswd -c /etc/htpasswd/.htpasswd user1 + AuthType Basic + AuthName "Authentication AwStats Required[DjAmolGroupInc]" + AuthUserFile "/etc/htpasswd/.htpasswd" + Require valid-user + diff --git a/conf/awupdate.sh b/conf/awupdate.sh new file mode 100644 index 0000000..6973908 --- /dev/null +++ b/conf/awupdate.sh @@ -0,0 +1,66 @@ +#sh update.sh -d "domainname.com" + +while getopts ":a:d:" opt; do + case $opt in + a) arg_1="$OPTARG" + ;; + d) p_out="$OPTARG" + ;; + b) back_out="$OPTARG" + ;; + \?) echo "Invalid option -$OPTARG" >&2 + ;; + esac +done + +printf "Argument domain is %s\n" "$p_out" +printf "Argument all is %s\n" "$arg_1" +printf "back_Option(-b ) is %s\n" "$back_out" + +if [ -z "$p_out" ] +then + echo "\$p_out is empty" +else + echo "\$p_out is NOT empty" + /usr/bin/tar -czvf /var/logs/httpd/$p_out/`(date +%Y%m%d)`.log.tar.gz /var/logs/httpd/$p_out/aclog.log + rm -rf /var/logs/httpd/$p_out/aclog.log + /usr/share/awstats/wwwroot/cgi-bin/awstats.pl -config=$p_out -update + +fi + + +## all domain in already config awstats files + +FILES=/etc/awstats/* +for fp in $FILES +do +f="$(basename -- $fp)" +echo "Found $f file..." +domain=$( echo $f | sed "s/.*awstats.//;s/.conf.*//" ) +echo "Processing domain : $domain"; +aclog="/var/logs/httpd/$domain/aclog.log"; +if [ -f "$aclog" ]; then +echo "$aclog exist" + # take action on each file. $f store current file name + /usr/bin/tar -czvf /var/logs/httpd/$domain/`(date +%Y%m%d)`.log.tar.gz $aclog + #rm -rf /var/logs/httpd/$domain/aclog.log + cat /dev/null > $aclog + /usr/share/awstats/wwwroot/cgi-bin/awstats.pl -config=$domain -update + if [ "$back_out" = "true" ] + then + echo "files not remove tar.gz backup file"; + else + rm -rf /var/logs/httpd/$domain/`(date +%Y%m%d)`.log.tar.gz + fi + +fi + + + +done + + + +#/usr/bin/tar -czvf /var/logs/httpd/domain.info/`(date +%Y%m%d)`.log.tar.gz /var/logs/httpd/domain.info/aclog.log +#rm -rf /var/logs/httpd/domain.info/aclog.log +#/usr/share/awstats/wwwroot/cgi-bin/awstats.pl -config=domain.info -update diff --git a/conf/bandwidth b/conf/bandwidth new file mode 100644 index 0000000..4bb025f --- /dev/null +++ b/conf/bandwidth @@ -0,0 +1,16 @@ +# This will mean that the domain is limited to 50mb bandwidth (52428800), +# that it can only have 400 connections at once and +# that any files over 1mb will be limited to 200kb/s (204800). +# For anyone reading this later you can also put an extension instead +# of * to limit just zips,rars,avis or whatever. + +# +#BandwidthModule On +#ForceBandWidthModule On +#Bandwidth all "52428800" +#MaxConnection all "400" +#LargeFileLimit * 1024 204800 +#BandWidthError 510 +# +#.... diff --git a/conf/copy-Index-of-URL-files-subfolder-auto-downloads-all b/conf/copy-Index-of-URL-files-subfolder-auto-downloads-all new file mode 100644 index 0000000..9ed1e53 --- /dev/null +++ b/conf/copy-Index-of-URL-files-subfolder-auto-downloads-all @@ -0,0 +1,17 @@ + + +I use wget -rkpN -e robots=off http://www.example.com/ + +-r means recursively + +-k means convert links. So links on the webpage will be localhost instead of example.com/bla + +-p means get all webpage resources so obtain images and javascript files to make website work properly. + +-N is to retrieve timestamps so if local files are newer than files on remote website skip them. + +-e is a flag option it needs to be there for the robots=off to work. + +robots=off means ignore robots file. + +I also had -c in this command so if they connection dropped if would continue where it left off from when i re-run the command. I figured -N would go well with -c diff --git a/conf/fm.inc b/conf/fm.inc new file mode 100644 index 0000000..58dfb8b --- /dev/null +++ b/conf/fm.inc @@ -0,0 +1,5 @@ + \ No newline at end of file diff --git a/conf/fm.php b/conf/fm.php new file mode 100644 index 0000000..24fbe9d --- /dev/null +++ b/conf/fm.php @@ -0,0 +1,65 @@ + 'Password', 'Username2' => 'Password2', ...) +//add user with password 'username' => password_hash('password', PASSWORD_DEFAULT) +$login_users = array('demo' => password_hash('demo1234', PASSWORD_DEFAULT), +'admin' => '$2y$10$gECf0VfZ7r541a6ro0VVxOcnJjNvRdBxloWtyoAuo9.TGAW2KzPCq', //admin@54321 +'superuser' => '$2y$10$p/Lyq45CgfQ/HZGbeSo2WuLs37ThIWpFiurrNPbRBxHxLf1ri9mce'//google@9545553061 +); +// Auth with login/password (set true/false to enable/disable it) +$use_auth = true; + +// Readonly users (username array) +$readonly_users = array( + 'user' +); + +// user specific directories +// array('Username' => 'Directory path', 'Username2' => 'Directory path', ...) +$directories_users = array(); + +// Enable highlight.js (https://highlightjs.org/) on view's page +$use_highlightjs = true; + +// highlight.js style +$highlightjs_style = 'vs'; + +// Enable ace.js (https://ace.c9.io/) on view's page +$edit_files = true; + +// Default timezone for date() and time() - http://php.net/manual/en/timezones.php +$default_timezone = 'Etc/UTC'; // UTC + +// Root path for file manager +$root_path = $_SERVER['DOCUMENT_ROOT']; + +// Root url for links in file manager.Relative to $http_host. Variants: '', 'path/to/subfolder' +// Will not working if $root_path will be outside of server document root +$root_url = ''; + +// Server hostname. Can set manually if wrong +$http_host = $_SERVER['HTTP_HOST']; + +// input encoding for iconv +$iconv_input_encoding = 'UTF-8'; + +// date() format for file modification date +$datetime_format = 'd.m.y H:i'; + +// allowed file extensions for upload and rename +$allowed_extensions = ''; // 'gif,png,jpg' + +// Array of files and folders excluded from listing +$GLOBALS['exclude_items'] = array(); + +// Google Docs Viewer +$GLOBALS['online_viewer'] = true; + +//Sticky Nav bar +$sticky_navbar = true; + +//max upload file size +define('MAX_UPLOAD_SIZE', '2048'); +include 'fm.inc'; +?> diff --git a/conf/ftpquota b/conf/ftpquota new file mode 100644 index 0000000..c57d5b4 --- /dev/null +++ b/conf/ftpquota @@ -0,0 +1,1097 @@ +#!/usr/bin/env perl +# ------------------------------------------------------------------------- +# Copyright (C) 2000-2013 TJ Saunders +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA. +# +# $Id: ftpquota,v 1.6 2013/04/23 23:25:20 castaglia Exp $ +# ------------------------------------------------------------------------- + +use strict; + +use Fcntl qw(:flock); +use File::Basename qw(basename); +use Getopt::Long; +use IO::Seekable; + +my $program = basename($0); +my $verbose = 0; + +# These formats are highly dependent on the quota record definitions in +# mod_quotatab.h. Should those definitions change, these format strings will +# need to be adjusted accordingly. +my $limit_format = "Z81I1C1I1d3L3"; +my $tally_format = "Z81I1d3L3"; + +# These sizes are determined by the sizes of the quota_limit_t and +# quota_tally_t structs (NOT using C's sizeof(), though -- alignment issues) +my $limit_reclen = 126; +my $tally_reclen = 121; + +# the values for these variables is similarly dependent on the actual +# values defined in mod_quotatab.h +my $ALL_QUOTA = 10; +my $USER_QUOTA = 20; +my $GROUP_QUOTA = 30; +my $CLASS_QUOTA = 40; + +my $HARD_LIMIT = 1; +my $SOFT_LIMIT = 2; + +my $LIMIT_TABLE = 100; +my $TALLY_TABLE = 101; + +my $LIMIT_MAGIC = hex(7626); +my $TALLY_MAGIC = hex(7644); + +my $default_limit_table = "./ftpquota.limittab"; +my $default_tally_table = "./ftpquota.tallytab"; +my $default_name = ""; +my $default_quota_type = $ALL_QUOTA; +my $default_limit_type = $HARD_LIMIT; +my $default_per_session = 0; +my $default_bytes_in = -1.0; +my $default_bytes_out = -1.0; +my $default_bytes_xfer = -1.0; +my $default_files_in = 0; +my $default_files_out = 0; +my $default_files_xfer = 0; + +my $byte_units = "byte"; + +my %opts = (); +GetOptions(\%opts, 'Bu=n', 'bytes-upload=n', 'Bd=n', 'bytes-download=n', + 'Bt=n', 'bytes-xfer=n', 'Fu=n', 'files-upload=n', 'Fd=n', 'files-download=n', + 'Ft=n', 'files-xfer', 'L|limit-type=s', 'N|name=s', 'P|per-session', + 'Q|quota-type=s', 'help', 'table-path=s', 'units=s', 'verbose', 'type=s', + 'add-record', 'create-table', 'delete-record', 'show-records', + 'update-record'); + +usage() if (defined($opts{'help'})); + +my ($table, $table_type); +my %record = (); + +parse_options(); + +if (defined($opts{'add-record'})) { + open_table(); + wlock_table(); + add_record(); + unlock_table(); + close_table(); + exit 0; +} + +if (defined($opts{'create-table'})) { + open_table(); + close_table(); + exit 0; +} + +if (defined($opts{'delete-record'})) { + open_table(); + wlock_table(); + delete_record(); + unlock_table(); + close_table(); + exit 0; +} + +if (defined($opts{'show-records'})) { + open_table(); + rlock_table(); + print_table(); + unlock_table(); + close_table(); + exit 0; +} + +if (defined($opts{'update-record'})) { + open_table(); + wlock_table(); + update_record(); + unlock_table(); + close_table(); + exit 0; +} + +# if no operations have been specified, note this and exit +print STDOUT "$program: no operations to perform, exiting\n"; + +exit; + +# ------------------------------------------------------------------------- +sub add_record { + print STDOUT "$program: adding record\n" if $verbose; + + my $add_quota_type; + + # first, find the matching record. Note that this option requires + # both --name and --quota-type + + if (!defined($opts{'Q'})) { + print STDOUT "$program: --add-record requires --quota-type option\n"; + exit(1); + + } else { + $add_quota_type = get_quota_type(quota_type => $opts{'Q'}); + } + + if ($add_quota_type != $ALL_QUOTA) { + if (!defined($opts{'N'})) { + print STDOUT "$program: --add-record requires --name option\n"; + exit(1); + } + } + + # now, see if there is a matching record already in the table + if (find_record(name => $opts{'N'}, quota_type => $add_quota_type)) { + print STDOUT "$program: unable to add record: matching record already exists\n"; + exit(1); + } + + # move to the end of the table, and write the new record + set_table_position(0, SEEK_END); + + my $formatted_record; + + if ($table_type == $LIMIT_TABLE) { + $formatted_record = pack($limit_format, + $record{'name'}, $record{'quota_type'}, + $record{'per_session'}, $record{'limit_type'}, + $record{'bytes_in'}, $record{'bytes_out'}, $record{'bytes_xfer'}, + $record{'files_in'}, $record{'files_out'}, $record{'files_xfer'}); + + } elsif ($table_type == $TALLY_TABLE) { + + $formatted_record = pack($tally_format, + $record{'name'}, $record{'quota_type'}, + $record{'bytes_in'}, $record{'bytes_out'}, $record{'bytes_xfer'}, + $record{'files_in'}, $record{'files_out'}, $record{'files_xfer'}); + } + + write_record(record => $formatted_record); +} + +# ------------------------------------------------------------------------- +sub check_table { + my $data; + + print STDOUT "$program: checking table '$table'\n" if $verbose; + + sysread TABLE, $data, 4; + + # unpack what was read in + my ($magic) = unpack("L", $data); + + if ($table_type == $LIMIT_TABLE) { + + if ($magic != $LIMIT_MAGIC) { + print STDOUT "$program: bad header: $magic != $LIMIT_MAGIC\n" if + $verbose; + die "$program: mismatched table header, exiting\n"; + + } else { + print STDOUT "$program: table has correct header\n" if $verbose; + } + + } elsif ($table_type == $TALLY_TABLE) { + + if ($magic != $TALLY_MAGIC) { + print STDOUT "$program: bad header magics: $magic != $TALLY_MAGIC\n" if + $verbose; + die "$program: mismatched table header, exiting\n"; + + } else { + print STDOUT "$program: table has correct header\n" if $verbose; + } + } +} + +# ------------------------------------------------------------------------- +sub close_table { + print STDOUT "$program: closing table '$table'\n" if $verbose; + + close(TABLE); +} + +# ------------------------------------------------------------------------- +sub delete_record { + print STDOUT "$program: deleting record\n" if $verbose; + + my $delete_quota_type; + + # first, find the matching record. Note that this option requires + # both --name and --quota-type + + if (!defined($opts{'Q'})) { + print STDOUT "$program: --delete-record requires --quota-type option\n"; + exit(1); + + } else { + $delete_quota_type = get_quota_type(quota_type => $opts{'Q'}); + } + + if ($delete_quota_type != $ALL_QUOTA) { + if (!defined($opts{'N'})) { + print STDOUT "$program: --delete-record requires --name option\n"; + exit(1); + } + } + + # now, find the matching record in the table + unless (find_record(name => $opts{'N'}, quota_type => $delete_quota_type)) { + print STDOUT "$program: unable to delete record: no match found\n"; + exit(1); + } + rewind_record(); + + print STDOUT "$program: modifying table '$table'\n" if $verbose; + + # first, record the current file position + my $position = get_table_position(); + + # next, advance past this record to be deleted, and read in the + # rest of the file + + seek_record(1); + + my ($nrecords, @records) = read_table(); + + # Rewind the previous position, and "delete" that record by simply + # overwriting it. Note that this approach works for file tables -- + # tables in other formats, such as SQL, will have a much easier time + # deleting a quota record. + + set_table_position($position, SEEK_SET); + + if ($nrecords > 0) { + for (my $i = 0; $i < $nrecords; $i++) { + write_record(record => $records[$i]); + } + + # Truncate the table + truncate_table(len => get_table_position() - 4); + + } else { + + # Truncate the table + truncate_table(len => $position - 4); + } + + # done + exit(0); +} + +# ------------------------------------------------------------------------- +sub find_record { + my %args = @_; + my $nrecords = 0; + + my $search_name = $args{'name'}; + my $search_quota_type = $args{'quota_type'}; + + while (my $record = read_record()) { + $nrecords++; + + my ($name, $quota_type, @junk); + + # unpack the binary record structure + if ($table_type == $LIMIT_TABLE) { + ($name, $quota_type, @junk) = unpack($limit_format, $record); + + } elsif ($table_type == $TALLY_TABLE) { + ($name, $quota_type, @junk) = unpack($tally_format, $record); + } + + # remove any NULs from $name + $name =~ s/(\0*)?//; + + if ($search_quota_type == $ALL_QUOTA and + $quota_type == $ALL_QUOTA) { + return $record; + + } elsif ($name eq $search_name and + $quota_type == $search_quota_type) { + return $record; + } + } + + return undef; +} + +# ------------------------------------------------------------------------- +sub get_display_bytes { + my %args = @_; + + my $bytes = $args{'bytes'}; + + if ($byte_units eq "byte") { + # no calculation necessary + + unless ($bytes eq "unlimited" || $bytes <= 0) { + return sprintf "bytes:\t%.2f", $bytes; + } else { + return sprintf "bytes:\tunlimited"; + } + + } elsif ($byte_units eq "kilo") { + # divide by 1024.0 + my $adj_bytes = $bytes / 1024.0; + + unless ($bytes eq "unlimited" || $bytes <= 0) { + return sprintf "Kb:\t%.2f", $adj_bytes; + } else { + return sprintf "Kb:\tunlimited"; + } + + } elsif ($byte_units eq "mega") { + # divide by 1024.0 * 1024.0 + my $adj_bytes = $bytes / (1024.0 * 1024.0); + + unless ($bytes eq "unlimited" || $bytes <= 0) { + return sprintf "Mb:\t%.2f", $adj_bytes; + } else { + return sprintf "Mb:\tunlimited"; + } + + } elsif ($byte_units eq "giga") { + # divide by 1024.0 * 1024.0 * 1024.0 + my $adj_bytes = $bytes / (1024.0 * 1024.0 * 1024.0); + + unless ($bytes eq "unlimited" || $bytes <= 0) { + return sprintf "Gb:\t%.2f", $adj_bytes; + } else { + return sprintf "Gb:\tunlimited"; + } + } +} + +# ------------------------------------------------------------------------- +sub get_quota_type { + my %args = @_; + + my $quota_type = $args{'quota_type'}; + + # given the command-line --quote-type option value, return the + # corresponding numeric value + + if ($quota_type eq "all") { + return $ALL_QUOTA; + + } elsif ($quota_type eq "user") { + return $USER_QUOTA; + + } elsif ($quota_type eq "group") { + return $GROUP_QUOTA; + + } elsif ($quota_type eq "class") { + return $CLASS_QUOTA; + + } else { + print STDERR "$program: unknown quota type: $quota_type\n"; + exit(1); + } +} + +# ------------------------------------------------------------------------- +sub get_table_position { + return sysseek(TABLE, 0, 1); +} + +# ------------------------------------------------------------------------- +sub open_table { + + # if the table doesn't exist, create it if requested + if (defined($opts{'create-table'})) { + die "$program: cannot create existing table\n" if (-e $table); + + print STDOUT "$program: creating new table\n" if $verbose; + + open(TABLE, "> $table") or + die "$program: unable to create $table: $!\n"; + + print STDOUT "$program: writing header for new table\n" if $verbose; + + # write out the identifying header for the table type + if ($table_type == $LIMIT_TABLE) { + syswrite TABLE, pack("L", $LIMIT_MAGIC); + + } elsif ($table_type == $TALLY_TABLE) { + syswrite TABLE, pack("L", $TALLY_MAGIC); + } + + } else { + + print STDOUT "$program: opening table '$table'\n" if $verbose; + + if (defined($opts{'show-records'})) { + open(TABLE, "< $table") or + die "$program: unable to open $table: $!\n"; + + } else { + open(TABLE, "+< $table") or + die "$program: unable to open $table: $!\n"; + } + + check_table(); + } +} + +# ------------------------------------------------------------------------- +sub parse_options { + + $verbose = 1 if (defined($opts{'verbose'})); + + if (defined($opts{'type'})) { + + die "$program: unknown table type: $opts{'type'}\n" if + ($opts{'type'} ne 'limit' and $opts{'type'} ne 'tally'); + + if ($opts{'type'} eq 'limit') { + $table_type = $LIMIT_TABLE; + $table = $default_limit_table; + } + + if ($opts{'type'} eq 'tally') { + $table_type = $TALLY_TABLE; + $table = $default_tally_table; + } + + } else { + die "$program: missing required --type parameter\n"; + } + + $table = $opts{'table-path'} if (defined($opts{'table-path'})); + + if (defined($opts{'N'})) { + $record{'name'} = $opts{'N'}; + + # make sure the name is not too long + die "$program: name is too long, must be less than 80 characters\n" + if (length($record{'name'}) >= 80); + + } else { + $record{'name'} = $default_name; + } + + if (defined($opts{'P'})) { + $record{'per_session'} = 1; + + } else { + $record{'per_session'} = $default_per_session; + } + + if (defined($opts{'Q'})) { + if ($opts{'Q'} eq "all") { + $record{'quota_type'} = $ALL_QUOTA; + + } elsif ($opts{'Q'} eq "user") { + $record{'quota_type'} = $USER_QUOTA; + + # it's an error if there's no -N option present as well + unless (defined($opts{'N'})) { + print STDOUT "$program: quota type \"user\" requires --name option\n"; + exit(1); + } + + } elsif ($opts{'Q'} eq "group") { + $record{'quota_type'} = $GROUP_QUOTA; + + # it's an error if there's no -N option present as well + unless (defined($opts{'N'})) { + print STDOUT "$program: quota type \"group\" requires --name option\n"; + exit(1); + } + + } elsif ($opts{'Q'} eq "class") { + $record{'quota_type'} = $CLASS_QUOTA; + + # it's an error if there's no -N option present as well + unless (defined($opts{'N'})) { + print STDOUT "$program: quota type \"class\" requires --name option\n"; + exit(1); + } + + } else { + print STDERR "$program: unknown quota type: $opts{'Q'}\n"; + exit(1); + } + + } else { + $record{'quota_type'} = $ALL_QUOTA; + } + + if (defined($opts{'L'})) { + if ($opts{'L'} eq "hard") { + $record{'limit_type'} = $HARD_LIMIT; + + } elsif ($opts{'L'} eq "soft") { + $record{'limit_type'} = $SOFT_LIMIT; + + } else { + print STDERR "$program: unknown limit type: $opts{'L'}\n"; + exit(1); + } + + } else { + $record{'limit_type'} = $HARD_LIMIT; + } + + # process the --units option, if present + if (defined($opts{'units'})) { + + if ($opts{'units'} eq "B" or $opts{'units'} eq "byte") { + $byte_units = "byte"; + + } elsif ($opts{'units'} eq "Kb" or $opts{'units'} eq "kilo") { + $byte_units = "kilo"; + + } elsif ($opts{'units'} eq "Mb" or $opts{'units'} eq "mega") { + $byte_units = "mega"; + + } elsif ($opts{'units'} eq "Gb" or $opts{'units'} eq "giga") { + $byte_units = "giga"; + + } else { + print STDERR "$program: unknown unit type: $opts{'units'}\n"; + exit(1); + } + } + + if (defined($opts{'Bu'}) || defined($opts{'bytes-upload'})) { + if (defined($opts{'Bu'}) && defined($opts{'bytes-upload'})) { + print STDOUT "$program: do not use both --Bu and --bytes-upload options\n"; + exit(1); + } + + $record{'bytes_in'} = $opts{'Bu'} if (defined($opts{'Bu'})); + $record{'bytes_in'} = $opts{'bytes-upload'} if + (defined($opts{'bytes-upload'})); + + if ($record{'bytes_in'} <= 0.0) { + print STDERR "$program: notice: upload bytes value '", $record{'bytes_in'}, "' means 'unlimited'\n"; + } + + if ($record{'bytes_in'} != $default_bytes_in) { + if ($byte_units eq "kilo") { + $record{'bytes_in'} = $record{'bytes_in'} * 1024.0; + + } elsif ($byte_units eq "mega") { + $record{'bytes_in'} = $record{'bytes_in'} * 1024.0 * 1024.0; + + } elsif ($byte_units eq "giga") { + $record{'bytes_in'} = $record{'bytes_in'} * 1024.0 * 1024.0 * 1024.0; + } + } + + } else { + + $record{'bytes_in'} = $default_bytes_in if ($table_type == $LIMIT_TABLE); + $record{'bytes_in'} = 0.0 if ($table_type == $TALLY_TABLE); + } + + if (defined($opts{'Bd'}) || defined($opts{'bytes-download'})) { + if (defined($opts{'Bd'}) && defined($opts{'bytes-download'})) { + print STDOUT "$program: do not use both --Bd and --bytes-download options\n"; + exit(1); + } + + $record{'bytes_out'} = $opts{'Bd'} if (defined($opts{'Bd'})); + $record{'bytes_out'} = $opts{'bytes-download'} if + (defined($opts{'bytes-download'})); + + if ($record{'bytes_out'} <= 0.0) { + print STDERR "$program: notice: download bytes value '", $record{'bytes_out'}, "' means 'unlimited'\n"; + } + + if ($record{'bytes_out'} != $default_bytes_out) { + if ($byte_units eq "kilo") { + $record{'bytes_out'} = $record{'bytes_out'} * 1024.0; + + } elsif ($byte_units eq "mega") { + $record{'bytes_out'} = $record{'bytes_out'} * 1024.0 * 1024.0; + + } elsif ($byte_units eq "giga") { + $record{'bytes_out'} = $record{'bytes_out'} * 1024.0 * 1024.0 * 1024.0; + } + } + + } else { + + $record{'bytes_out'} = $default_bytes_out if ($table_type == $LIMIT_TABLE); + $record{'bytes_out'} = 0.0 if ($table_type == $TALLY_TABLE); + } + + if (defined($opts{'Bx'}) || defined($opts{'bytes-xfer'})) { + if (defined($opts{'Bx'}) && defined($opts{'bytes-xfer'})) { + print STDOUT "$program: do not use both --Bx and --bytes-xfer options\n"; + exit(1); + } + + $record{'bytes_xfer'} = $opts{'Bx'} if (defined($opts{'Bx'})); + $record{'bytes_xfer'} = $opts{'bytes-xfer'} if + (defined($opts{'bytes-xfer'})); + + if ($record{'bytes_xfer'} <= 0.0) { + print STDERR "$program: notice: transfer bytes value '", $record{'bytes_xfer'}, "' means 'unlimited'\n"; + } + + if ($record{'bytes_xfer'} != $default_bytes_xfer) { + if ($byte_units eq "kilo") { + $record{'bytes_xfer'} = $record{'bytes_xfer'} * 1024.0; + + } elsif ($byte_units eq "mega") { + $record{'bytes_xfer'} = $record{'bytes_xfer'} * 1024.0 * 1024.0; + + } elsif ($byte_units eq "giga") { + $record{'bytes_xfer'} = + $record{'bytes_xfer'} * 1024.0 * 1024.0 * 1024.0; + } + } + + } else { + + $record{'bytes_xfer'} = $default_bytes_xfer if + ($table_type == $LIMIT_TABLE); + $record{'bytes_xfer'} = 0.0 if ($table_type == $TALLY_TABLE); + } + + if (defined($opts{'Fu'}) || defined($opts{'files-upload'})) { + if (defined($opts{'Fu'}) && defined($opts{'files-upload'})) { + print STDOUT "$program: do not use both --Fu and --files-upload options\n"; + exit(1); + } + + $record{'files_in'} = $opts{'Fu'} if (defined($opts{'Fu'})); + $record{'files_in'} = $opts{'files-upload'} if + (defined($opts{'files-upload'})); + + if ($record{'files_in'} <= 0) { + print STDERR "$program: notice: upload files value '", $record{'files_in'}, "' means 'unlimited'\n"; + } + + } else { + + $record{'files_in'} = $default_files_in if ($table_type == $LIMIT_TABLE); + $record{'files_in'} = 0 if ($table_type == $TALLY_TABLE); + } + + if (defined($opts{'Fd'}) || defined($opts{'files-download'})) { + if (defined($opts{'Fd'}) && defined($opts{'files-download'})) { + print STDOUT "$program: do not use both --Fd and --files-download options\n"; + exit(1); + } + + $record{'files_out'} = $opts{'Fd'} if (defined($opts{'Fd'})); + $record{'files_out'} = $opts{'files-download'} if + (defined($opts{'files-download'})); + + if ($record{'files_out'} <= 0) { + print STDERR "$program: notice: download files value '", $record{'files_out'}, "' means 'unlimited'\n"; + } + + } else { + + $record{'files_out'} = $default_files_out if ($table_type == $LIMIT_TABLE); + $record{'files_out'} = 0 if ($table_type == $TALLY_TABLE); + } + + if (defined($opts{'Fx'}) || defined($opts{'files-xfer'})) { + if (defined($opts{'Fx'}) && defined($opts{'files-xfer'})) { + print STDOUT "$program: do not use both --Fx and --files-xfer options\n"; + exit(1); + } + + $record{'files_xfer'} = $opts{'Fx'} if (defined($opts{'Fx'})); + $record{'files_xfer'} = $opts{'files-xfer'} if + (defined($opts{'files-xfer'})); + + if ($record{'files_xfer'} <= 0) { + print STDERR "$program: notice: transfer files value '", $record{'files_xfer'}, "' means 'unlimited'\n"; + } + + } else { + + $record{'files_xfer'} = $default_files_xfer if + ($table_type == $LIMIT_TABLE); + $record{'files_xfer'} = 0 if ($table_type == $TALLY_TABLE); + } +} + +# ------------------------------------------------------------------------- +sub print_record { + my %args = @_; + + my $record = $args{'record'}; + + my ($name, $quota_type, $per_session, $limit_type, $bytes_in, $bytes_out, + $bytes_xfer, $files_in, $files_out, $files_xfer); + + if ($table_type == $LIMIT_TABLE) { + ($name, $quota_type, $per_session, $limit_type, $bytes_in, $bytes_out, + $bytes_xfer, $files_in, $files_out, $files_xfer) = unpack($limit_format, + $record); + + } elsif ($table_type == $TALLY_TABLE) { + + ($name, $quota_type, $bytes_in, $bytes_out, $bytes_xfer, + $files_in, $files_out, $files_xfer) = unpack($tally_format, $record); + } + + + # make the symbolic values legible + $quota_type = "All" if ($quota_type == $ALL_QUOTA); + $quota_type = "User" if ($quota_type == $USER_QUOTA); + $quota_type = "Group" if ($quota_type == $GROUP_QUOTA); + $quota_type = "Class" if ($quota_type == $CLASS_QUOTA); + + if ($table_type == $LIMIT_TABLE) { + $limit_type = "Hard" if ($limit_type == $HARD_LIMIT); + $limit_type = "Soft" if ($limit_type == $SOFT_LIMIT); + + if ($per_session eq 1) { + $per_session = "True"; + + } else { + $per_session = "False"; + } + } + + # print "unlimited" if quota is unlimited, but only for limit tables + if ($table_type == $LIMIT_TABLE) { + $bytes_in = "unlimited" if ($bytes_in <= 0.0); + $bytes_out = "unlimited" if ($bytes_out <= 0.0); + $bytes_xfer = "unlimited" if ($bytes_xfer <= 0.0); + + $files_in = "unlimited" if ($files_in <= 0); + $files_out = "unlimited" if ($files_out <= 0); + $files_xfer = "unlimited" if ($files_xfer <= 0); + } + + print STDOUT "-------------------------------------------\n"; + print STDOUT " Name: $name\n"; + print STDOUT " Quota Type: $quota_type\n"; + + if ($table_type == $LIMIT_TABLE) { + print STDOUT " Per Session: $per_session\n"; + print STDOUT " Limit Type: $limit_type\n"; + } + + print STDOUT " Uploaded ", get_display_bytes('bytes' => $bytes_in), "\n"; + print STDOUT " Downloaded ", get_display_bytes('bytes' => $bytes_out), + "\n"; + print STDOUT " Transferred ", get_display_bytes('bytes' => $bytes_xfer), + "\n"; + + print STDOUT " Uploaded files:\t$files_in\n"; + print STDOUT " Downloaded files:\t$files_out\n"; + print STDOUT " Transferred files:\t$files_xfer\n"; +} + +# ------------------------------------------------------------------------- +sub print_table { + my $have_records = 0; + + while (my $record = read_record()) { + $have_records = 1; + print_record(record => $record); + } + print STDOUT "$program: (empty table)\n" unless ($have_records); + + # done + exit(0); +} + +# ------------------------------------------------------------------------- +sub read_record { + my $record; + my $bread; + + if ($table_type == $LIMIT_TABLE) { + $bread = sysread TABLE, $record, $limit_reclen; + + } elsif ($table_type == $TALLY_TABLE) { + $bread = sysread TABLE, $record, $tally_reclen; + } + + if ($bread) { + return $record; + + } else { + return undef; + } +} + +# ------------------------------------------------------------------------- +sub read_table { + my @records = (); + my $nrecords_read = 0; + + # read from TABLE + while (my $record = read_record()) { + $nrecords_read++; + push(@records, $record); + } + + return ($nrecords_read, @records); +} + +# ------------------------------------------------------------------------- +sub rewind_record { + if ($table_type == $LIMIT_TABLE) { + sysseek TABLE, -$limit_reclen, 1; + + } elsif ($table_type == $TALLY_TABLE) { + sysseek TABLE, -$tally_reclen, 1; + } +} + +# ------------------------------------------------------------------------- +sub rlock_table { + print STDOUT "$program: read-locking table '$table'\n" if $verbose; + + flock(TABLE, LOCK_SH); +} + +# ------------------------------------------------------------------------- +sub seek_record { + my ($n) = @_; + + if ($table_type == $LIMIT_TABLE) { + sysseek TABLE, $limit_reclen, $n; + + } elsif ($table_type == $TALLY_TABLE) { + sysseek TABLE, $tally_reclen, $n; + } +} + +# ------------------------------------------------------------------------- +sub set_table_position { + my ($position, $whence) = @_; + + my $result = sysseek(TABLE, $position, $whence); + + print STDOUT "$program: set table position to $result\n" if $verbose; + + return $result; +} + +# ------------------------------------------------------------------------- +sub truncate_table { + my %args = @_; + + my $length = $args{'len'}; + + # don't forget about the header (4 bytes) + truncate TABLE, $length + 4; +} + +# ------------------------------------------------------------------------- +sub unlock_table { + print STDOUT "$program: unlocking table '$table'\n" if $verbose; + + flock(TABLE, LOCK_UN); +} + +# ------------------------------------------------------------------------- +sub update_record { + my $current_record; + my $search_quota_type; + + # first, find the matching record. Note that this option requires + # both --name and --quota-type + + if (!defined($opts{'Q'})) { + print STDOUT "$program: --update-record requires --quota-type option\n"; + exit(1); + + } else { + $search_quota_type = get_quota_type(quota_type => $opts{'Q'}); + } + + if ($search_quota_type != $ALL_QUOTA) { + if (!defined($opts{'N'})) { + print STDOUT "$program: --update-record requires --name option\n"; + exit(1); + } + } + + # now, find the matching record in the table + open_table(); + unless ($current_record = find_record(name => $opts{'N'}, + quota_type => $search_quota_type)) { + print STDOUT "$program: unable to update record: no match found\n"; + exit(1); + } + rewind_record(); + + print STDOUT "$program: updating table '$table'\n" if $verbose; + + # now, adjust the current record with the updated values in the requested + # record + + my ($name, $quota_type, $per_session, $limit_type, @junk); + + if ($table_type == $LIMIT_TABLE) { + ($name, $quota_type, $per_session, $limit_type, + @junk) = unpack($limit_format, $current_record); + + } elsif ($table_type == $TALLY_TABLE) { + + ($name, $quota_type, @junk) = unpack($tally_format, $current_record); + } + + my $formatted_record; + + if ($table_type == $LIMIT_TABLE) { + $formatted_record = pack($limit_format, $name, $quota_type, + $record{'per_session'}, $record{'limit_type'}, + $record{'bytes_in'}, $record{'bytes_out'}, $record{'bytes_xfer'}, + $record{'files_in'}, $record{'files_out'}, $record{'files_xfer'}); + + } elsif ($table_type == $TALLY_TABLE) { + + $formatted_record = pack($tally_format, $name, $quota_type, + $record{'bytes_in'}, $record{'bytes_out'}, $record{'bytes_xfer'}, + $record{'files_in'}, $record{'files_out'}, $record{'files_xfer'}); + } + + write_record(record => $formatted_record); + + # done + exit(0); +} + +# ------------------------------------------------------------------------- +sub wlock_table { + print STDOUT "$program: write-locking table '$table'\n" if $verbose; + + flock(TABLE, LOCK_EX); +} + +# ------------------------------------------------------------------------- +sub write_record { + my %args = @_; + my $record = $args{'record'}; + + print STDOUT "$program: writing record\n" if $verbose; + + die "$program: error writing table: $!\n" unless + syswrite TABLE, $record; +} + +# ------------------------------------------------------------------------- +sub usage { + + print STDOUT < @@ -314,13 +314,13 @@ LogLevel warn # define per- access logfiles, transactions will be # logged therein and *not* in this file. # - CustomLog "logs/access_log" common + #CustomLog "logs/access_log" common # # If you prefer a logfile with access, agent, and referer information # (Combined Logfile Format) you can use the following directive. # - #CustomLog "logs/access_log" combined + CustomLog "logs/access_log" combined @@ -397,7 +397,7 @@ LogLevel warn AddType application/x-compress .Z AddType application/x-gzip .gz .tgz AddType text/html .php .phps - AddType x-httpd-php .php + AddHandler php5-script .php # @@ -519,4 +519,7 @@ SSLRandomSeed connect builtin AddType application/x-httpd-php-source .phps SetHandler application/x-httpd-php - +ScriptAlias /amolpanel/ "/usr/share/amolpanel/" + + Require all granted + diff --git a/conf/ind b/conf/ind new file mode 100644 index 0000000..f896ed6 --- /dev/null +++ b/conf/ind @@ -0,0 +1,29 @@ + +
File Manager

';$apacheInfo = explode("\n", shell_exec("/usr/local/bin/httpd -v")); $apVersion = substr($apacheInfo[0], strpos($apacheInfo[0], ":") + 2); $apBuildDate = substr($apacheInfo[1], strpos($apacheInfo[1], ":") + 2);$getStatus = shell_exec("service apache2 status");$green = '
';$red ='
';$gray='
';$end ='
';if (strpos($getStatus, "running") !== false) {$apStatus = "Running";$ap=true;}else { $apStatus = "Stopped";$ap=false;}$f= explode("\n", shell_exec("/usr/local/bin/ffmpeg -version")); $p= explode("\n", shell_exec("/usr/local/bin/php -v")); $m= explode("\n", shell_exec("/usr/bin/mysql -V")); $MgetStatus = shell_exec("service mysql status");if (strpos($MgetStatus, "running") !== false) {$mStatus = "Running";$mx =true;}else { $mStatus = "Stopped";$mx =false;}$b= explode("\n", shell_exec("/usr/sbin/named -v")); $bgetStatus = shell_exec("service named status");if (strpos($bgetStatus, "running") !== false) { $bStatus = "Running"; $bn=true;}else { $bStatus = "Stopped";$bn=false;}if($bn){ echo $green; }else{ echo $red;}echo' '.$b[0].'
'.$bStatus.'
'.$end;if($mx){ echo $green; }else{ echo $red;}echo' '.$m[0].'
'.$mStatus.'
'.$end;echo $gray;echo' '.$p[0].'
';echo $end;echo $gray;echo' '.$f[0].';'.$f[1].'
';echo $end;if($ap){ echo $green; }else{ echo $red;}echo' '.$apVersion.'
'.$apBuildDate.'
'.$apStatus.'
'.$end; ?> +

It works Apache!



File Manager


Change user name password for filemanager
diff --git a/conf/mail2/aliases b/conf/mail2/aliases new file mode 100644 index 0000000..a9dbdce --- /dev/null +++ b/conf/mail2/aliases @@ -0,0 +1,2 @@ +postmaster: root +root: postmaster@domain.com diff --git a/conf/mail2/dovecot-sql.conf b/conf/mail2/dovecot-sql.conf new file mode 100644 index 0000000..41f8606 --- /dev/null +++ b/conf/mail2/dovecot-sql.conf @@ -0,0 +1,4 @@ +driver = mysql +connect = host=127.0.0.1 dbname=mail user=mail_admin password=whynotchangeme +default_pass_scheme = CRYPT +password_query = SELECT email as user, password FROM users WHERE email='%u'; diff --git a/conf/mail2/dovecot.conf b/conf/mail2/dovecot.conf new file mode 100644 index 0000000..762c98d --- /dev/null +++ b/conf/mail2/dovecot.conf @@ -0,0 +1,43 @@ +# 2.0.9: /etc/dovecot/dovecot.conf +# OS: Linux 3.5.0-34-generic x86_64 CentOS release 6.4 (Final) +log_timestamp = "%Y-%m-%d %H:%M:%S " +mail_location = maildir:/home/vmail/%d/%n/Maildir +namespace { + inbox = yes + location = + prefix = INBOX. + separator = . + type = private +} +passdb { + args = /etc/dovecot/dovecot-sql.conf + driver = sql +} +protocols = imap pop3 +service auth { + unix_listener /var/spool/postfix/private/auth { + group = postfix + mode = 0660 + user = postfix + } + unix_listener auth-master { + mode = 0600 + user = vmail + } + user = root +} +ssl_cert = > /etc/postfix/master.cf diff --git a/conf/mail2/read.txt b/conf/mail2/read.txt new file mode 100644 index 0000000..04c3fc0 --- /dev/null +++ b/conf/mail2/read.txt @@ -0,0 +1 @@ + maildove.sh diff --git a/conf/mail2/setmailbox.sql b/conf/mail2/setmailbox.sql new file mode 100644 index 0000000..fca1280 --- /dev/null +++ b/conf/mail2/setmailbox.sql @@ -0,0 +1,4 @@ +USE mail; +INSERT INTO domains (domain) VALUES ('domain.com'); +INSERT INTO users (email, password) VALUES ('user@domain.com', ENCRYPT('changeme')); + diff --git a/conf/nginx-shell b/conf/nginx-shell new file mode 100644 index 0000000..29f6332 --- /dev/null +++ b/conf/nginx-shell @@ -0,0 +1,128 @@ +#!/bin/sh +# +# nginx - this script starts and stops the nginx daemon +# +# chkconfig: - 85 15 +# description: Nginx is an HTTP(S) server, HTTP(S) reverse \ +# proxy and IMAP/POP3 proxy server +# processname: nginx +# config: /usr/local/nginx/conf/nginx.conf +# pidfile: /var/run/nginx.pid + +# Source function library. +. /etc/rc.d/init.d/functions + +# Source networking configuration. +. /etc/sysconfig/network + +# Check that networking is up. +[ "$NETWORKING" = "no" ] && exit 0 + +nginx="/usr/local/nginx/sbin/nginx" +prog=$(basename $nginx) + +NGINX_CONF_FILE="/usr/local/nginx/conf/nginx.conf" + +[ -f /etc/sysconfig/nginx ] && . /etc/sysconfig/nginx + +lockfile=/var/lock/subsys/nginx + +make_dirs() { + # make required directories + user=`$nginx -V 2>&1 | grep "configure arguments:" | sed 's/[^*]*--user=\([^ ]*\).*/\1/g' -` + if [ -z "`grep $user /etc/passwd`" ]; then + useradd -M -s /bin/nologin $user + fi + options=`$nginx -V 2>&1 | grep 'configure arguments:'` + for opt in $options; do + if [ `echo $opt | grep '.*-temp-path'` ]; then + value=`echo $opt | cut -d "=" -f 2` + if [ ! -d "$value" ]; then + # echo "creating" $value + mkdir -p $value && chown -R $user $value + fi + fi + done +} + +start() { + [ -x $nginx ] || exit 5 + [ -f $NGINX_CONF_FILE ] || exit 6 + make_dirs + echo -n $"Starting $prog: " + daemon $nginx -c $NGINX_CONF_FILE + retval=$? + echo + [ $retval -eq 0 ] && touch $lockfile + return $retval +} + +stop() { + echo -n $"Stopping $prog: " + killproc $prog -QUIT + retval=$? + echo + [ $retval -eq 0 ] && rm -f $lockfile + return $retval +} + +restart() { + configtest || return $? + stop + sleep 3 + start +} + +reload() { + configtest || return $? + echo -n $"Reloading $prog: " + killproc $nginx -HUP + RETVAL=$? + echo +} + +force_reload() { + restart +} + +configtest() { + $nginx -t -c $NGINX_CONF_FILE +} + +rh_status() { + status $prog +} + +rh_status_q() { + rh_status >/dev/null 2>&1 +} + +case "$1" in + start) + rh_status_q && exit 0 + $1 + ;; + stop) + rh_status_q || exit 0 + $1 + ;; + restart|configtest) + $1 + ;; + reload) + rh_status_q || exit 7 + $1 + ;; + force-reload) + force_reload + ;; + status) + rh_status + ;; + condrestart|try-restart) + rh_status_q || exit 0 + ;; + *) + echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload|configtest}" + exit 2 +esac diff --git a/conf/proftpd.conf b/conf/proftpd.conf index be8f1fe..f23a1a2 100644 --- a/conf/proftpd.conf +++ b/conf/proftpd.conf @@ -9,7 +9,6 @@ ServerType standalone DeferWelcome off DefaultServer on DefaultRoot ~ !wheel - IdentLookups off UseReverseDNS off TransferLog /usr/local/apache/domlogs/ftpxferlog @@ -17,8 +16,8 @@ AuthPAM off TLSEngine on TLSRequired off - TLSRSACertificateFile /etc/proftpd/ftpd-rsa.pem - TLSRSACertificateKeyFile /etc/proftpd/ftpd-rsa-key.pem + TLSRSACertificateFile /etc/pki/tls/certs/proftpd.pem + TLSRSACertificateKeyFile /etc/pki/tls/certs/proftpd.pem TLSVerifyClient off TLSCipherSuite HIGH:MEDIUM:+TLSv1:!SSLv2:+SSLv3 TLSOptions NoSessionReuseRequired @@ -77,4 +76,3 @@ ShowSymlinks on TimeoutIdle 600 MaxInstances none RequireValidShell off - diff --git a/conf/rpm/Read b/conf/rpm/Read new file mode 100644 index 0000000..9766475 --- /dev/null +++ b/conf/rpm/Read @@ -0,0 +1 @@ +ok diff --git a/conf/rpm/mod_bw-rpm-source.zip b/conf/rpm/mod_bw-rpm-source.zip new file mode 100644 index 0000000..e28855d Binary files /dev/null and b/conf/rpm/mod_bw-rpm-source.zip differ diff --git a/conf/shellprogress.php b/conf/shellprogress.php new file mode 100644 index 0000000..ef0608b --- /dev/null +++ b/conf/shellprogress.php @@ -0,0 +1,53 @@ +function cal($now){ +$end=104141;$start=101117; +$percent = ($now-$start) / ($end-$start) * 100; +$per= number_format((float)$percent, 2, '.', ''); +return $per.'%'.show_status($percent,100); +} + + +function show_status($done, $total, $size=30) { + + static $start_time; + + // if we go over our bound, just ignore it + if($done > $total) return; + + if(empty($start_time)) $start_time=time(); + $now = time(); + + $perc=(double)($done/$total); + + $bar=floor($perc*$size); + + $status_bar="\r["; + $status_bar.=str_repeat("=", $bar); + if($bar<$size){ + $status_bar.=">"; + $status_bar.=str_repeat(" ", $size-$bar); + } else { + $status_bar.="="; + } + + $disp=number_format($perc*100, 0); + + //$status_bar.="] $disp% $done/$total"; + + $rate = ($now-$start_time)/$done; + $left = $total - $done; + $eta = round($rate * $left, 2); + + $elapsed = $now - $start_time; + + ///$status_bar.= " remaining: ".number_format($eta)." sec. elapsed: ".number_format($elapsed)." sec."; + + return "$status_bar "; + + flush(); + + // when done, send a newline + if($done == $total) { + return "\n"; + } + +} diff --git a/conf/webmin/config b/conf/webmin/config new file mode 100644 index 0000000..1ff5c29 --- /dev/null +++ b/conf/webmin/config @@ -0,0 +1,30 @@ +test_manual=0 +show_list=0 +mime_types=/etc/mime.types +auto_mods=1 +stop_cmd=/usr/local/apache2/bin/apachectl stop +pid_file=/usr/local/apache2/logs/httpd.pid +test_apachectl=1 +max_servers=100 +httpd_dir=/usr/local/apache2 +start_cmd=systemctl start httpd +show_order=0 +test_always=0 +apachectl_path=/usr/local/apache2/bin/apachectl +show_names=0 +test_config=1 +apply_cmd=/usr/local/apache2/bin/apachectl graceful +httpd_path=/usr/local/apache2/bin/apachectl +allow_virtualmin=0 +virt_name= +defines_mods= +link_dir= +access_conf= +virt_file=/usr/local/apache2/conf/httpd.conf +srm_conf= +graceful_cmd= +httpd_conf= +defines_file= +httpd_version= +apache_docbase= +defines_name= diff --git a/conf/webmin/r.txt b/conf/webmin/r.txt new file mode 100644 index 0000000..4286f42 --- /dev/null +++ b/conf/webmin/r.txt @@ -0,0 +1 @@ +r diff --git a/extra/bwtheme.wbt.gz b/extra/bwtheme.wbt.gz new file mode 100644 index 0000000..796f160 Binary files /dev/null and b/extra/bwtheme.wbt.gz differ diff --git a/extra/iptables.sh b/extra/iptables.sh new file mode 100644 index 0000000..143ab36 --- /dev/null +++ b/extra/iptables.sh @@ -0,0 +1,151 @@ +# +iptables="iptables" + +# 1. Delete all existing rules +${iptables} -F + +# 2. Set default chain policies +#iptables -P INPUT DROP +#iptables -P FORWARD DROP +#iptables -P OUTPUT DROP + +# 3. Block a specific ip-address +#BLOCK_THIS_IP="x.x.x.x" +#iptables -A INPUT -s "$BLOCK_THIS_IP" -j DROP + +# 4. Allow ALL incoming SSH +${iptables} -A INPUT -i eth0 -p tcp --dport 55 -m state --state NEW,ESTABLISHED -j ACCEPT +${iptables} -A OUTPUT -o eth0 -p tcp --sport 55 -m state --state ESTABLISHED -j ACCEPT + +# 5. Allow incoming SSH only from a specific network +#iptables -A INPUT -i eth0 -p tcp -s 192.168.200.0/24 --dport 22 -m state --state NEW,ESTABLISHED -j ACCEPT +#iptables -A OUTPUT -o eth0 -p tcp --sport 22 -m state --state ESTABLISHED -j ACCEPT + +# 6. Allow incoming HTTP +${iptables} -A INPUT -i eth0 -p tcp --dport 80 -m state --state NEW,ESTABLISHED -j ACCEPT +${iptables} -A OUTPUT -o eth0 -p tcp --sport 80 -m state --state ESTABLISHED -j ACCEPT + +# Allow incoming HTTPS +${iptables} -A INPUT -i eth0 -p tcp --dport 443 -m state --state NEW,ESTABLISHED -j ACCEPT +${iptables} -A OUTPUT -o eth0 -p tcp --sport 443 -m state --state ESTABLISHED -j ACCEPT + +# 7. MultiPorts (Allow incoming SSH, HTTP, and HTTPS) +${iptables} -A INPUT -i eth0 -p tcp -m multiport --dports 22,80,443 -m state --state NEW,ESTABLISHED -j ACCEPT +${iptables} -A OUTPUT -o eth0 -p tcp -m multiport --sports 22,80,443 -m state --state ESTABLISHED -j ACCEPT + +# 8. Allow outgoing SSH +${iptables} -A OUTPUT -o eth0 -p tcp --dport 55 -m state --state NEW,ESTABLISHED -j ACCEPT +${iptables} -A INPUT -i eth0 -p tcp --sport 55 -m state --state ESTABLISHED -j ACCEPT + +# 9. Allow outgoing SSH only to a specific network +#iptables -A OUTPUT -o eth0 -p tcp -d 192.168.101.0/24 --dport 22 -m state --state NEW,ESTABLISHED -j ACCEPT +#iptables -A INPUT -i eth0 -p tcp --sport 22 -m state --state ESTABLISHED -j ACCEPT + +# 10. Allow outgoing HTTPS +${iptables} -A OUTPUT -o eth0 -p tcp --dport 443 -m state --state NEW,ESTABLISHED -j ACCEPT +${iptables} -A INPUT -i eth0 -p tcp --sport 443 -m state --state ESTABLISHED -j ACCEPT + +# 11. Load balance incoming HTTPS traffic +#iptables -A PREROUTING -i eth0 -p tcp --dport 443 -m state --state NEW -m nth --counter 0 --every 3 --packet 0 -j DNAT --to-destination 192.168.1.101:443 +#iptables -A PREROUTING -i eth0 -p tcp --dport 443 -m state --state NEW -m nth --counter 0 --every 3 --packet 1 -j DNAT --to-destination 192.168.1.102:443 +#iptables -A PREROUTING -i eth0 -p tcp --dport 443 -m state --state NEW -m nth --counter 0 --every 3 --packet 2 -j DNAT --to-destination 192.168.1.103:443 + +# 12. Ping from inside to outside +${iptables} -A OUTPUT -p icmp --icmp-type echo-request -j ACCEPT +${iptables} -A INPUT -p icmp --icmp-type echo-reply -j ACCEPT + +# 13. Ping from outside to inside +${iptables} -A INPUT -p icmp --icmp-type echo-request -j ACCEPT +${iptables} -A OUTPUT -p icmp --icmp-type echo-reply -j ACCEPT + +# 14. Allow loopback access +${iptables} -A INPUT -i lo -j ACCEPT +${iptables} -A OUTPUT -o lo -j ACCEPT + +# 15. Allow packets from internal network to reach external network. +# if eth1 is connected to external network (internet) +# if eth0 is connected to internal network (192.168.1.x) +${iptables} -A FORWARD -i eth0 -o eth1 -j ACCEPT + +# 16. Allow outbound DNS +${iptables} -A OUTPUT -p udp -o eth0 --dport 53 -j ACCEPT +${iptables} -A INPUT -p udp -i eth0 --sport 53 -j ACCEPT + +# 17. Allow NIS Connections +# rpcinfo -p | grep ypbind ; This port is 853 and 850 +#iptables -A INPUT -p tcp --dport 111 -j ACCEPT +#iptables -A INPUT -p udp --dport 111 -j ACCEPT +#iptables -A INPUT -p tcp --dport 853 -j ACCEPT +#iptables -A INPUT -p udp --dport 853 -j ACCEPT +#iptables -A INPUT -p tcp --dport 850 -j ACCEPT +#iptables -A INPUT -p udp --dport 850 -j ACCEPT + +# 18. Allow rsync from a specific network +#${iptables} -A INPUT -i eth0 -p tcp -s 192.168.101.0/24 --dport 873 -m state --state NEW,ESTABLISHED -j ACCEPT +#${iptables} -A OUTPUT -o eth0 -p tcp --sport 873 -m state --state ESTABLISHED -j ACCEPT + +# 19. Allow MySQL connection only from a specific network +#${iptables} -A INPUT -i eth0 -p tcp -s 192.168.200.0/24 --dport 3306 -m state --state NEW,ESTABLISHED -j ACCEPT +#${iptables} -A OUTPUT -o eth0 -p tcp --sport 3306 -m state --state ESTABLISHED -j ACCEPT + +# 20. Allow Sendmail or Postfix +${iptables} -A INPUT -i eth0 -p tcp --dport 25 -m state --state NEW,ESTABLISHED -j ACCEPT +${iptables} -A OUTPUT -o eth0 -p tcp --sport 25 -m state --state ESTABLISHED -j ACCEPT + +# 21. Allow IMAP and IMAPS +#iptables -A INPUT -i eth0 -p tcp --dport 143 -m state --state NEW,ESTABLISHED -j ACCEPT +#iptables -A OUTPUT -o eth0 -p tcp --sport 143 -m state --state ESTABLISHED -j ACCEPT +#iptables -A INPUT -i eth0 -p tcp --dport 993 -m state --state NEW,ESTABLISHED -j ACCEPT +#iptables -A OUTPUT -o eth0 -p tcp --sport 993 -m state --state ESTABLISHED -j ACCEPT + +# 22. Allow POP3 and POP3S +#iptables -A INPUT -i eth0 -p tcp --dport 110 -m state --state NEW,ESTABLISHED -j ACCEPT +#iptables -A OUTPUT -o eth0 -p tcp --sport 110 -m state --state ESTABLISHED -j ACCEPT +#iptables -A INPUT -i eth0 -p tcp --dport 995 -m state --state NEW,ESTABLISHED -j ACCEPT +#iptables -A OUTPUT -o eth0 -p tcp --sport 995 -m state --state ESTABLISHED -j ACCEPT + +# 23. Prevent DoS attack +#${iptables} -A INPUT -p tcp --dport 80 -m limit --limit 25/minute --limit-burst 100 -j ACCEPT + +# 24. Port forwarding 422 to 22 +#iptables -t nat -A PREROUTING -p tcp -d 192.168.102.37 --dport 422 -j DNAT --to 192.168.102.37:22 +#iptables -A INPUT -i eth0 -p tcp --dport 422 -m state --state NEW,ESTABLISHED -j ACCEPT +#iptables -A OUTPUT -o eth0 -p tcp --sport 422 -m state --state ESTABLISHED -j ACCEPT + +# 25. Log dropped packets +${iptables} -N LOGGING +${iptables} -A INPUT -j LOGGING +${iptables} -A LOGGING -m limit --limit 2/min -j LOG --log-prefix "IPTables Packet Dropped: " --log-level 7 +${iptables} -A LOGGING -j DROP + + + +# Accept any related or established connections +${iptables} -I INPUT 1 -m state --state RELATED,ESTABLISHED -j ACCEPT +${iptables} -I OUTPUT 1 -m state --state RELATED,ESTABLISHED -j ACCEPT + +# Allow all traffic on the loopback interface +${iptables} -A INPUT -i lo -j ACCEPT +${iptables} -A OUTPUT -o lo -j ACCEPT + +# Allow outbound DHCP request +${iptables} -A OUTPUT –o eth0 -p udp --dport 67:68 --sport 67:68 -j ACCEPT + +# Allow inbound SSH +${iptables} -A INPUT -i eth0 -p tcp -m tcp --dport 22 -m state --state NEW -j ACCEPT + +# Allow outbound email +${iptables} -A OUTPUT -i eth0 -p tcp -m tcp --dport 25 -m state --state NEW -j ACCEPT + +# Outbound DNS lookups +${iptables} -A OUTPUT -o eth0 -p udp -m udp --dport 53 -j ACCEPT + +# Outbound PING requests +${iptables} -A OUTPUT –o eth0 -p icmp -j ACCEPT + +# Outbound Network Time Protocol (NTP) requests +${iptables} -A OUTPUT –o eth0 -p udp --dport 123 --sport 123 -j ACCEPT + +# Outbound HTTP +${iptables} -A OUTPUT -o eth0 -p tcp -m tcp --dport 80 -m state --state NEW -j ACCEPT +${iptables} -A OUTPUT -o eth0 -p tcp -m tcp --dport 443 -m state --state NEW -j ACCEPT diff --git a/extra/ldap.txt b/extra/ldap.txt new file mode 100644 index 0000000..0d16fad --- /dev/null +++ b/extra/ldap.txt @@ -0,0 +1,175 @@ + 207 ls + 208 vi log.txt + 209 slapd --help + 210 slapd -V + 211 slapd -VV + 212 date + 213 slapd -VVV + 214 date + 215 pwd + 216 which slapd + 217 cd /etc/openldap/ + 218 ls + 219 cd slapd.d/ + 220 ls + 221 cd .. + 222 vi ldap.conf + 223 cd slapd.d/ + 224 ls + 225 pwd + 226 cd /etc + 227 cd init.d/ + 228 ls + 229 ll + 230 cd .. + 231 ps aux | more + 232 ps aux | grep slapd + 233 cd /var + 234 ls + 235 cd log + 236 ls + 237 ll + 238 systemctl stop slapd + 239 systemctl status slapd + 240 ps aux | grep slapd + 241 cd /etc/openldap/ + 242 ls + 243 cd slapd.d/ + 244 ls + 245 vi cn\=config + 246 vi cn\=config.ldif + 247 cd .. + 248 ls + 249 vi ldap.conf + 250 mv slapd.d/ slapd.d-old + 251 systemctl start slapd + 252 which slapd + 253 /usr/sbin/slapd --help + 254 /usr/sbin/slapd -VVV + 255 /usr/sbin/slapd -VV + 256 /usr/sbin/slapd -d -1 + 257 ls + 258 mv slapd.d-old/ slapd.d + 259 /usr/sbin/slapd -d -1 + 260 claer + 261 clear + 262 /usr/sbin/slapd -d -1 + 263 clear + 264 /usr/sbin/slapd -d 64 + 265 /usr/sbin/slapd -d 128 + 266 cd + 267 yum --help + 268 yum --help | uni + 269 yum --help |rem + 270 yum --help | grep uni + 271 yum --help | grep rem + 272 yum list openldap + 273 yum list openldap* + 274 yum --help | grep era + 275 yum erase openldap* + 276 yum list openldap* + 277 yum erase openldap.x* + 278 yum list openldap* + 279 yum --help | grep era + 280 date + 281 clear + 282 yum -y install openldap compat-openldap openldap-clients openldap-servers openldap-servers-sql openldap-devel + 283 systemctl start slapd + 284 systemctl enable slapd + 285 systemctl status slapd + 286 cd shekhar/ + 287 vi ldaprootpasswd.ldif + 288 ls + 289 slappasswd + 290 vi ldaprootpasswd.ldif + 291 echo psswd admin + 292 ldapadd -Y EXTERNAL -H ldapi:/// -f ldaprootpasswd.ldif + 293 pwd + 294 ls /usr/share/openldap-servers/ + 295 cp /usr/share/openldap-servers/DB_CONFIG.example /var/lib/ldap/DB_CONFIG + 296 chown -R ldap:ldap /var/lib/ldap/DB_CONFIG + 297 systemctl restart slapd + 298 ldapadd -Y EXTERNAL -H ldapi:/// -f /etc/openldap/schema/cosine.ldif + 299 ldapadd -Y EXTERNAL -H ldapi:/// -f /etc/openldap/schema/nis.ldif + 300 ldapadd -Y EXTERNAL -H ldapi:/// -f /etc/openldap/schema/inetorgperson.ldif + 301 vi ldapdomain.ldif + 302 ll + 303 cat ldaprootpasswd.ldif + 304 cat ldaprootpasswd.ldif >> ldapdomain.ldif + 305 vi ldapdomain.ldif + 306 ldapmodify -Y EXTERNAL -H ldapi:/// -f ldapdomain.ldif + 307 vi baseldapdomain.ldif + 308 ldapadd -Y EXTERNAL -x -D cn=auth,dc=example,dc=com -W -f baseldapdomain.ldif + 309 slaptest -u + 310 ps aux | grep slapd + 311 cd /etc/openldap/ + 312 ls + 313 ll + 314 date + 315 cd slapd.d/ + 316 ls + 317 ll + 318 rm cn\=cn=cn\=config.ldif + 319 rm cn\=cn=config.ldif + 320 ls + 321 ll + 322 cd cn=cn\=config + 323 cd cn\=config + 324 ls + 325 ll + 326 cd .. + 327 echo --- shekhar exiting + 328 ls + 329 cat log.txt + 330 ldapsearch -x -H ldap://ldap.forumsys.com:389 -D cn=read-only-admin,dc=example,dc=com -W -b "o=example.com" -s base + 331 ls + 332 cat log.txt + 333 ldapsearch -x -H ldap://127.0.0.1: -D cn=auth,dc=example,dc=com + 334 ldapsearch -x -H ldap://127.0.0.1 -D cn=auth,dc=example,dc=com + 335 ldapsearch -x -H ldap://example.com:389 -D cn=auth,dc=example,dc=com -W -b "o=example.com" -s base + 336 ldapsearch -x -H ldap://127.0.0.1:389 -D cn=auth,dc=example,dc=com -W -b "o=example.com" -s base + 337 ldapsearch -x -H ldap://173.82.108.74:389 -D cn=auth,dc=example,dc=com -W -b "o=example.com" -s base + 338 ls + 339 ldapadd -x -W -D "cn=user2,dc=agamitech,dc=com" -f base.ldif + 340 sh + 341 ldapadd -x -W -D "cn=user2,dc=agamitech,dc=com" -f base.ldif + 342 ldapadd -x -H ldap://localhost -D "dc=example,dc=com" -f /root/user.ldif -W + 343 touch /root/user.ldif + 344 ldapadd -x -H ldap://localhost -D "dc=example,dc=com" -f /root/user.ldif -W + 345 ldapadd -x -H ldap://localhost -D "cn=auth,dc=example,dc=com" -f /root/user.ldif -W + 346 cat /root/user.ldif + 347 ldapadd -Z -x -W -D "cn=auth,dc=example,dc=com" -f /root/user.ldif + 348 ldapadd -Z -x -W -H ldap://localhost -D "cn=auth,dc=example,dc=com" -f /root/user.ldif + 349 ldapadd -x -D "cn=auth,dc=example,dc=com" -f /root/user.ldif + 350 ldapadd -x -D cn=Manager,dc=srv,dc=world -W -f ldapuser.ldif + 351 mkdir ldap + 352 ldapadd -x -D cn=auth,dc=example,dc=com -W -f ldap/ldapuser.ldif + 353 touch ldap/ldapuser.ldif + 354 ldapadd -x -D cn=auth,dc=example,dc=com -W -f ldap/ldapuser.ldif + 355 cat ldap/ldapuser.ldif + 356 slappasswd + 357 cd ldap/ + 358 ls + 359 vi ldapuser.ldif + 360 ldapadd -x -D cn=auth,dc=example,dc=com -W -f ldapuser.ldif + 361 vi ldapuser.ldif + 362 ldapadd -x -D cn=auth,dc=example,dc=com -W -f ldapuser.ldif + 363 vi ldapuser.ldif + 364 ldapadd -x -D cn=auth,dc=example,dc=com -W -f ldapuser.ldif + 365 vi ldapuser.ldif + 366 ldapadd -x -D cn=auth,dc=example,dc=com -W -f ldapuser.ldif + 367 vi ldapuser.ldif + 368 ldapadd -x -D cn=auth,dc=example,dc=com -W -f ldapuser.ldif + 369 cat ldapuser.ldif + 370 ldapadd -x -D cn=auth,dc=example,dc=com -W -f ldapuser.ldif + 371 cd .. + 372 ls + 373 vi log2.txt + 374 cd / + 375 mkdir amol + 376 cd amol + 377 wget https://raw.githubusercontent.com/djamol/ApachePHPffmpeg/amol/latest.sh;sh latest.sh + 378 sh latest.sh + 379 tail -f /amol/ApachePHPffmpeg-amol/log/10977.txt | sed '/^AmolInstaller: SUCCESS$/ q' + 380 yum remove -y webmin + 381 history diff --git a/extra/mail-dovecot.txt b/extra/mail-dovecot.txt new file mode 100644 index 0000000..7015648 --- /dev/null +++ b/extra/mail-dovecot.txt @@ -0,0 +1,70 @@ +yum -y install dovecot dovecot-mysql dovecot-pigeonhole +touch /etc/dovecot/dovecot-sql.conf +ln -s /etc/dovecot/dovecot-sql.conf /etc/dovecot-sql.conf +ln -s /etc/dovecot/dovecot.conf /etc/dovecot.conf +systemctl enable dovecot +systemctl start dovecot + + + +yum -y install amavisd-new spamassassin clamav-server clamav-data clamav-update clamav-filesystem clamav clamav-scanner-systemd clamav-devel clamav-lib clamav-server-systemd unzip bzip2 perl-DBD-mysql postgrey re2c + +sa-update +freshclam +systemctl enable amavisd.service +systemctl start amavisd.service +systemctl start clamd@amavisd.service +systemctl enable postgrey.service +systemctl start postgrey.service + + + + + Configuring Postfix by edit /etc/postfix/main.cf file: + +home_mailbox = Maildir/ # Line 421 - Uncomment +systemctl enable postfix +systemctl restart postfix + + +useradd amolmail +passwd amolmail + +telnet localhost smtp +ehlo localhost # Type this line +mail from: # Mail sender address +rcpt to: # Mail receiver address +data # To input body of Email +Welcome to TheSkillPedia mail server # Body of the Email +. # After you finished with content +quit # Exit from mail + + + +cd /home/amolmail/Maildir/new/ +Read mail +cat /home/sangwan/Maildir/new/***** + + +vi /etc/dovecot/dovecot.conf +protocols = imap pop3 lmtp # Line 24 - umcomment +vi /etc/dovecot/conf.d/10-mail.conf +mail_location = maildir:~/Maildir # Line 24 - uncomment +vi /etc/dovecot/conf.d/10-auth.conf +disable_plaintext_auth = yes #line 10 - uncomment +auth_mechanisms = plain login #Line 100 - Add the word: "login" +vi /etc/dovecot/conf.d/10-master.conf +#Line 91, 92 - Uncomment and add "postfix" +#mode = 0600 + user = postfix + group = postfix + + + systemctl enable dovecot +systemctl start dovecot + +Sequence 5. Testing Dovecot +telnet localhost pop3 +user amolmail #Enter the mail user name +pass centos #Enter the password +retr 1 #Type this command to view mail diff --git a/extra/mail2-databasemysql.txt b/extra/mail2-databasemysql.txt new file mode 100644 index 0000000..d1a0e88 --- /dev/null +++ b/extra/mail2-databasemysql.txt @@ -0,0 +1,89 @@ +yum install postfix dovecot dovecot-mysql system-switch-mail -y +mkdir /etc/postfix/backup/ + cp -rf /etc/postfix/* /etc/postfix/backup/ + +BASE_DIR=/root/protos-apps/mail/bootstrap +cp $BASE_DIR/postfix/mysql* /etc/postfix/ +chown root:postfix /etc/postfix/mysql-virtual_*.cf +chmod 644 /etc/postfix/mysql-virtual_*.cf +groupadd -g 5000 vmail +useradd -g vmail -u 5000 vmail -d /home/vmail -m + + + spawn openssl req -new -x509 -days 3650 -nodes -out /etc/ssl/certs/postfix.pem -keyout /etc/ssl/private/postfix.pem + + + +postconf -e 'myhostname = woho.co.in' +postconf -e 'mydestination = localhost, localhost.localdomain, mail.woho.co.in' +postconf -e 'mynetworks = 127.0.0.0/8' +postconf -e 'inet_interfaces = all' +postconf -e 'message_size_limit = 30720000' +postconf -e 'virtual_alias_domains =' +postconf -e 'virtual_alias_maps = proxy:mysql:/etc/postfix/mysql-virtual_forwardings.cf, mysql:/etc/postfix/mysql-virtual_email2email.cf' +postconf -e 'virtual_mailbox_domains = proxy:mysql:/etc/postfix/mysql-virtual_domains.cf' +postconf -e 'virtual_mailbox_maps = proxy:mysql:/etc/postfix/mysql-virtual_mailboxes.cf' +postconf -e 'virtual_mailbox_base = /home/vmail' +postconf -e 'virtual_uid_maps = static:5000' +postconf -e 'virtual_gid_maps = static:5000' +postconf -e 'smtpd_sasl_type = dovecot' +postconf -e 'smtpd_sasl_path = private/auth' +postconf -e 'smtpd_sasl_auth_enable = yes' +postconf -e 'broken_sasl_auth_clients = yes' +postconf -e 'smtpd_sasl_authenticated_header = yes' +postconf -e 'smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination' +postconf -e 'smtpd_use_tls = yes' +postconf -e 'smtpd_tls_cert_file = /etc/ssl/certs/postfix.pem' +postconf -e 'smtpd_tls_key_file = /etc/ssl/private/postfix.pem' +postconf -e 'virtual_create_maildirsize = yes' +postconf -e 'virtual_maildir_extended = yes' +postconf -e 'proxy_read_maps = $local_recipient_maps $mydestination $virtual_alias_maps $virtual_alias_domains $virtual_mailbox_maps $virtual_mailbox_domains $relay_recipient_maps $relay_domains $canonical_maps $sender_canonical_maps $recipient_canonical_maps $relocated_maps $transport_maps $mynetworks $virtual_mailbox_limit_maps' +postconf -e 'virtual_transport = dovecot' +postconf -e 'dovecot_destination_recipient_limit = 1' +echo 'dovecot unix - n n - - pipe flags=DRhu user=vmail:vmail argv=/usr/libexec/dovecot/deliver -f ${sender} -d ${recipient}' >> /etc/postfix/master.cf + + + +BASE_DIR=/root/protos-apps/mail/bootstrap +mkdir /etc/dovecot/backup/ +cp -rf /etc/dovecot/*.conf /etc/dovecot/backup/ + +cp $BASE_DIR/dovecot/dovecot.conf /etc/dovecot/dovecot.conf +cp $BASE_DIR/dovecot/dovecot-sql.conf /etc/dovecot/dovecot-sql.conf +chgrp dovecot /etc/dovecot/dovecot-sql.conf +chmod o= /etc/dovecot/dovecot-sql.conf + + +BASE_DIR=/root/protos-apps/mail/bootstrap +cp $BASE_DIR/postfix/aliases /etc/aliases +chown root:root /etc/aliases +newaliases + + +BASE_DIR=/root/protos-apps/mail/bootstrap +##mysql -u root -p '' < $BASE_DIR/sql/mail.sql +##mysql -u root -p '' < $BASE_DIR/sql/setmailbox.sql + +CREATE DATABASE mail; +USE mail; + +GRANT SELECT, INSERT, UPDATE, DELETE ON mail.* TO 'mail_admin'@'localhost' IDENTIFIED BY 'whynotchangeme'; +GRANT SELECT, INSERT, UPDATE, DELETE ON mail.* TO 'mail_admin'@'localhost.localdomain' IDENTIFIED BY 'whynotchangeme'; +FLUSH PRIVILEGES; + +CREATE TABLE domains (domain varchar(50) NOT NULL, PRIMARY KEY (domain) ); +CREATE TABLE forwardings (source varchar(80) NOT NULL, destination TEXT NOT NULL, PRIMARY KEY (source) ); +CREATE TABLE users (email varchar(80) NOT NULL, password varchar(20) NOT NULL, PRIMARY KEY (email) ); +CREATE TABLE transport ( domain varchar(128) NOT NULL default '', transport varchar(128) NOT NULL default '', UNIQUE KEY domain (domain) ); +USE mail; +INSERT INTO domains (domain) VALUES ('woho.co.in'); +INSERT INTO users (email, password) VALUES ('amol@woho.co.in', ENCRYPT('amol')); + +sudo postmap -q woho.co.in mysql:/etc/postfix/mysql-virtual_domains.cf +sudo postmap -q amol@woho.co.in mysql:/etc/postfix/mysql-virtual_mailboxes.cf + +yum install cyrus-sasl-plain -y + + +service postfix restart +service dovecot restart diff --git a/extra/mail2.zip b/extra/mail2.zip new file mode 100644 index 0000000..35d4838 Binary files /dev/null and b/extra/mail2.zip differ diff --git a/extra/read.txt b/extra/read.txt new file mode 100644 index 0000000..849a295 --- /dev/null +++ b/extra/read.txt @@ -0,0 +1 @@ +extra files diff --git a/ffmpeg.md b/ffmpeg.md new file mode 100644 index 0000000..691b213 --- /dev/null +++ b/ffmpeg.md @@ -0,0 +1,30 @@ + + +I compressed a 40-minute HD video presentation from 505MB to 183MB +That's like going from 100MB → 36MB. +Original video was HD and output was almost zero noticeable difference. +It's a video file "I'd like to keep around, but HD is overkill." +Here's the command I used with reasons: + +ffmpeg -n -loglevel error -i inputfile.mp4 -vcodec libx264 -crf 28 -preset faster -tune film outputfilename.mp4 + + -n : avoid overwriting output files (safer for testing then batching) + -loglevel error : show errors and hide the rows and rows of progress + -i inputfile.mp4 : input file name + -vcodec libx264 : swiped from the top answer above + -crf 28 : single-pass compression with minor noticeable difference ("0 = lossless, 23 = default, 51 = worst; subjectively sane range is 17–28") ref docs + -preset faster : looks 2x faster than default encoding time of 'medium' ref docs + -tune film : specify input is an HQ video (other options include 'cartoon', 'stillimage'..) ref docs + outputfilename.mp4 : output file name + +For a directory of video files: + +for i in *.{avi,flv,m4v,mov,wmv,mp4,MP4,TS,mkv}; do ffmpeg -n -loglevel error -i "$i" -vcodec libx264 -crf 28 -preset faster -tune film "cc${i}"; done + +Issues: + + a cleaner way of collecting "all video files" without having all the extensions in the command + a cleaner way to output the filename without "cc" prefix, AND being able to confirm video before deleting + .webm files don't work with the command. Had to swap "cc${i}" → "${i%.*}.mp4" + +ffmpeg -n -loglevel error -i inputfile.mp4 -vcodec libx264 -crf 28 -preset faster -tune film outputfilename.mp4 diff --git a/inc/apache.sh b/inc/apache.sh index c3c781f..0e70ee8 100644 --- a/inc/apache.sh +++ b/inc/apache.sh @@ -15,6 +15,7 @@ then echo -e "\033[33;32m httpd download Success";date +"%r" >> $BUILD;echo "Success : File Download $FILE" >> $BUILD else echo -e "\033[33;31m httpd download Failed";date +"%r" >> $BUILD;echo "Failed : File Download $FILE" >> $BUILD + echo "Failed : File Download $FILE" >> $FAILBUILD fi else echo -e "\033[33;32m file " $FILE " exists.";date +"%r" >> $BUILD;echo "Status : Already Exist $FILE" >> $BUILD @@ -23,6 +24,7 @@ if tar -xzf $FILE; then echo -e "\033[33;32m extract httpd Success";date +"%r" >> $BUILD;echo "Success : Extract $FILE" >> $BUILD else echo -e "\033[33;31m extract httpd Failed"date +"%r" >> $BUILD;echo "Failed : Extract $FILE" >> $BUILD +echo "Failed : File Download $FILE" >> $FAILBUILD tar -xzf httpd-2* fi @@ -36,3 +38,36 @@ cd httpd-2.4.18 make make install date +"%r" >> $BUILD;echo "Apache Program Complete" >> $BUILD +# Link httpd program path to any where execute httpd file using httpd file path export into $PATH (echo $PATH) +#export PATH="$PATH:" +#export PATH="$PATH:/usr/local/apache2/bin" +ln -s /usr/local/apache2/bin/httpd /usr/local/bin + +## user account permission +#usermod -a -G groupname username #usermod -a -G group1,group2 username /multiple group +#groupadd groupname #usermod -g groupname username /primary group +groupadd amolhttpd +groupadd user +useradd -g amolhttpd -G daemon,user server # // primary group =amolhttpd ..add new user =server + +#chown server:amolhttpd -R /home/www + mkdir -p /var/logs/httpd/ + chown server:amolhttpd -R /var/logs/httpd/ + + + + +#mkdir /opt/httpd +#chmod -R 755 /opt/httpd +#cd /opt/httpd +#wget http://mirrors.viethosting.com/apache//httpd/httpd-2.4.39.tar.gz -O httpd-2.4.39.tar.gz +#wget https://github.com/apache/apr/archive/1.7.0.tar.gz -O apr-1.7.0.tar.gz +#wget https://github.com/apache/apr-util/archive/1.6.1.tar.gz -O apr-util-1.6.1.tar.gz +#tar -zxvf httpd-2.4.39.tar.gz +#tar -zxvf apr-1.7.0.tar.gz +#tar -zxvf apr-util-1.6.1.tar.gz +#mv apr-1.7.0 /opt/httpd/httpd-2.4.39/srclib/apr +#mv apr-util-1.6.1 /opt/httpd/httpd-2.4.39/srclib/apr-util +#cd /opt/httpd/httpd-2.4.39 +#./buildconf + diff --git a/inc/apacheDOSmod.sh b/inc/apacheDOSmod.sh new file mode 100644 index 0000000..fa2a99a --- /dev/null +++ b/inc/apacheDOSmod.sh @@ -0,0 +1,56 @@ + +#Install CSF +#cd $SCRIPTPATH +#rm -fv csf.tgz +cd $SCRIPTPATH/src +FILE=mod_evasive.tar.gz +if [ ! -f $FILE ] +then + echo -e "\033[33;34m file " $FILE " does not exist.";date +"%r" >> $BUILD;echo "Status : Downloading $FILE" >> $BUILD + ### +else + echo -e "\033[33;32m file " $FILE " exists.";date +"%r" >> $BUILD;echo "Status : Exist $FILE" >> $BUILD +fi + +tar -xzf mod_evasive.tar.gz +cd mod_evasive* +/usr/local/apache2/bin/apxs -i -a -c mod_evasive24.c + + +#added in domainauto.sh +#LoadModule evasive24_module modules/mod_evasive24.so +#echo -e '\nLoadModule evasive24_module modules/mod_evasive24.so\n' >> /usr/local/apache2/conf/httpd.conf +#echo -e '\n\nDOSHashTableSize 3097\nDOSPageCount 2\nDOSSiteCount 50\nDOSPageInterval 1\nDOSSiteInterval 1\nDOSBlockingPeriod 60\nDOSEmailNotify mramolpatil1@gmail.com\n' >> /usr/local/apache2/conf/httpd.conf + + +cd $SCRIPTPATH/src +FILE=mod_qos.tar.gz +if [ ! -f $FILE ] +then + echo -e "\033[33;34m file " $FILE " does not exist.";date +"%r" >> $BUILD;echo "Status : Downloading $FILE" >> $BUILD + ### +else + echo -e "\033[33;32m file " $FILE " exists.";date +"%r" >> $BUILD;echo "Status : Exist $FILE" >> $BUILD +fi + +tar -xzf mod_qos.tar.gz +cd mod_qos* +cd apache2 +/usr/local/apache2/bin/apxs -i -c mod_qos.c -lcrypto -lpcre + + + +## add this line LoadModule qos_module modules/mod_qos.so +#echo -e '\nLoadModule qos_module modules/mod_qos.so\n' >> /usr/local/apache2/conf/httpd.conf +#echo -e '\n\n# max connection per IP is\nQS_SrvMaxConnPerIP 15 \n' >> /usr/local/apache2/conf/httpd.conf + +#service apache2 restart +## LOG TRACK +mkdir -p /var/log/apache/mod_evasive +chown daemon:amolhttpd –R /var/log/apache/mod_evasive +# httpd.conf file DOSLogDir "/var/log/apache/mod_evasive" + +#test mod +#perl test.pl +# if above command return "HTTP/1.1 302 Found" multiple times then its work +date +"%r" >> $BUILD;echo "mod_evasive DOS Apache Program Complete" >> $BUILD diff --git a/inc/aprq.sh b/inc/aprq.sh index f5d509a..0d1960c 100644 --- a/inc/aprq.sh +++ b/inc/aprq.sh @@ -13,6 +13,7 @@ then echo -e "\033[33;32m pcre download Success";date +"%r" >> $BUILD;echo "Success : File Download $FILE" >> $BUILD else echo -e "\033[33;31m pcre download Failed";date +"%r" >> $BUILD;echo "Failed : File Download $FILE" >> $BUILD + echo "Failed : File Download $FILE" >> $FAILBUILD fi else echo -e "\033[33;32m file " $FILE " exists.";date +"%r" >> $BUILD;echo "Status : Already Exist $FILE" >> $BUILD @@ -23,6 +24,7 @@ if tar -xzf pcre-8.37.tar.gz; then echo -e "\033[33;32m extract pcre Success";date +"%r" >> $BUILD;echo "Success : Extract $FILE" >> $BUILD else echo -e "\033[33;31m extract pcre Failed";date +"%r" >> $BUILD;echo "Failed : Extract $FILE" >> $BUILD +echo "Failed : File Download $FILE" >> $FAILBUILD fi cd pcre-8.37 ./configure --prefix=/usr/local/pcre --enable-utf8 --enable-unicode-properties @@ -57,6 +59,7 @@ then echo -e "\033[33;34m file " $FILE " does not exist."; if wget http://redrockdigimark.com/apachemirror//apr/apr-1.5.2.tar.gz; then echo -e "\033[33;32m apr download Success";date +"%r" >> $BUILD;echo "Success : File Download $FILE" >> $BUILD + echo "Failed : File Download $FILE" >> $FAILBUILD else echo -e "\033[33;31m apr download Failed";date +"%r" >> $BUILD;echo "Failed : File Download $FILE" >> $BUILD fi @@ -67,6 +70,7 @@ if tar -xzf $FILE; then echo -e "\033[33;32m extract apr Success";date +"%r" >> $BUILD;echo "Success : Extract $FILE" >> $BUILD else echo -e "\033[33;31m extract apr Failed"date +"%r" >> $BUILD;echo "Failed : Extract $FILE" >> $BUILD + echo "Failed : File Download $FILE" >> $FAILBUILD fi cd $SCRIPTPATH/src @@ -78,6 +82,7 @@ then echo -e "\033[33;32m apr-util download Success";date +"%r" >> $BUILD;echo "Success : File Download $FILE" >> $BUILD else echo -e "\033[33;31m apr-util download Failed";date +"%r" >> $BUILD;echo "Failed : File Download $FILE" >> $BUILD + echo "Failed : File Download $FILE" >> $FAILBUILD fi else echo -e "\033[33;32m file " $FILE " exists.";date +"%r" >> $BUILD;echo "Status : File Exist $FILE" >> $BUILD @@ -86,4 +91,5 @@ if tar -xzf $FILE; then echo -e "\033[33;32m extract apr-util Success";date +"%r" >> $BUILD;echo "Success : Extract $FILE" >> $BUILD else echo -e "\033[33;31m extract apr-util Failed"date +"%r" >> $BUILD;echo "Failed : Extract $FILE" >> $BUILD + echo "Failed : EXTRACT $FILE" >> $FAILBUILD fi diff --git a/inc/awstats.sh b/inc/awstats.sh new file mode 100644 index 0000000..fc12f09 --- /dev/null +++ b/inc/awstats.sh @@ -0,0 +1,36 @@ +##access asstats GUI WEB PAGE +##http://example.com/awstats/?config=example.com +##http://example.com/awstats/?config=domain.in +mkdir /etc/htpasswd + +rpm -ivh http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-5.noarch.rpm +yum --enablerepo=epel install awstats -y + +# htpasswd -c /etc/local/user amol + +cp -f $SCRIPTPATH/conf/awstats.conf /usr/local/apache2/conf/amolhost/awstats.conf + +#WEBA="test1" +#WEBP="djamol007" +SSLCERt=$(expect -c " +set timeout 35 + spawn /usr/local/apache2/bin/htpasswd -c /etc/htpasswd/.htpasswd $WEBA + expect \"password*:\" + send \"$WEBP\r\" + expect \"password*:\" + send \"$WEBP\r\" +expect eof +") +echo "$SSLCERt" + +#GeoIP +# sh geoip.sh + +cp /etc/awstats/awstats.localhost.localdomain.conf /etc/awstats/awstats.$MAINDOMAIN.conf +sed -i "s/localhost.localdomain/$MAINDOMAIN/" /etc/awstats/awstats.$MAINDOMAIN.conf +sed -i "s/^LogFile.*/LogFile=\"/usr/local/apache2/logs/access_log\"/" /etc/awstats/awstats.$MAINDOMAIN.conf +sed -i "s/^HostAliases.*/HostAliases=\"localhost\ 127.0.0.1\ ${MAINDOMAIN}\"/" /etc/awstats/awstats.$MAINDOMAIN.conf +/usr/share/awstats/wwwroot/cgi-bin/awstats.pl -config=$MAINDOMAIN -update +## cronjob update daily + +echo "0 * * * * /usr/share/awstats/wwwroot/cgi-bin/awstats.pl -config=${MAINDOMAIN} -update" >> /var/spool/cron/root diff --git a/inc/binddns.sh b/inc/binddns.sh index e67cb5a..0db3b4e 100644 --- a/inc/binddns.sh +++ b/inc/binddns.sh @@ -3,6 +3,51 @@ # WWW.DjAmol.Com # djamolpatil@gmail.com +# Disable IP v6 issue(Ipv6 unreachable errors) Add below two lines in /etc/named.conf +# listen-on-v6 { none; }; +# filter-aaaa-on-v4 yes; +# +#Install From Source +yum install libuv libuv-devel libnghttp2-devel libcap-devel # openssl-devel try without openssl devel rpm + +cd $SCRIPTPATH/src +FILE=bind-9.18.1.tar.xz +if [ ! -f $FILE ] +then + echo -e "\033[33;34m file " $FILE " does not exist.";date +"%r" >> $BUILD;echo "Status : Downloading $FILE" >> $BUILD + wget http://bind.org/bind-9.18.1.tar.xz +else + echo -e "\033[33;32m file " $FILE " exists.";date +"%r" >> $BUILD;echo "Status : Exist $FILE" >> $BUILD +fi + +# tar xf bind-9.18.1.tar.xz +cd bind-9.18.1 +./configure --with-openssl --enable-threads --with-libxml2 --prefix=/usr/local/named +make +make install +chkconfig named on +chkconfig --level 35 named on +service named start + +if [ $OSN = "debian" ] + then +#Install From RPM +if yum -y install bind9; then +echo -e "\033[33;32m Debian BIND DNS Success " +date +"%r" >> $BUILD;echo "Success :Debian BIND DNS Install" >> $BUILD +#chkconfig named on +chkconfig --level 35 named on +service named start + +else +echo -e "\033[33;31m yum -y BIND DNS Failed";date +"%r" >> $BUILD;echo "Failed : debianBIND DNS Install" >> $BUILD + echo "Failed :Debian BIND DNS INSTALL" >> $FAILBUILD + +fi + +else + +#Install From RPM if yum -y install bind; then echo -e "\033[33;32m yum -y BIND DNS Success " date +"%r" >> $BUILD;echo "Success : BIND DNS Install" >> $BUILD @@ -12,4 +57,8 @@ service named start else echo -e "\033[33;31m yum -y BIND DNS Failed";date +"%r" >> $BUILD;echo "Failed : BIND DNS Install" >> $BUILD + echo "Failed : BIND DNS INSTALL" >> $FAILBUILD + +fi + fi diff --git a/inc/cron.sh b/inc/cron.sh index 895a862..2ce4559 100644 --- a/inc/cron.sh +++ b/inc/cron.sh @@ -10,6 +10,7 @@ if cp cacert.pem /usr/local/ssl/cert.pem; then echo -e "\033[33;32m cronie For Cert.pem Success";date +"%r" >> $BUILD;echo "Success : cert.pem devel Install" >> $BUILD else cp $SCRIPTPATH/src/cacert.pem /usr/local/ssl/cert.pem; echo -e "\033[33;31m cronie For Cert.pem Failed";date +"%r" >> $BUILD;echo "Failed : cert.pem Certification from curl.haxx.se website Install" >> $BUILD +echo -e "\033[33;31m cronie For Cert.pem Failed";date +"%r" >> $FAILBUILD;echo "Failed : cert.pem Certification from curl.haxx.se website Install" >> $FAILBUILD fi cp php.ini-production /usr/local/lib/php.ini # openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /usr/share/ssl/certs/test.pem -out /usr/share/ssl/certs/test.pem @@ -35,6 +36,7 @@ if yum -y install cronie; then echo -e "\033[33;32m cronie For CronJOB Success";date +"%r" >> $BUILD;echo "Success : Cronie for cronjob Install" >> $BUILD else echo -e "\033[33;31m cronie For CronJoB Failed";date +"%r" >> $BUILD;echo "Failed : cronie for CronJOB Install" >> $BUILD +echo "Failed : cronie for CronJOB Install" >> $FAILBUILD fi chkconfig crond on service crond start diff --git a/inc/csf.sh b/inc/csf.sh index e7b8725..a765f2b 100644 --- a/inc/csf.sh +++ b/inc/csf.sh @@ -21,3 +21,20 @@ tar -xzf csf.tgz cd csf sh install.sh date +"%r" >> $BUILD;echo "CSF Program Complete" >> $BUILD + +sh /usr/local/csf/bin/remove_apf_bfd.sh + + + sed -i '/TESTING =/c\TESTING = "0"' /etc/csf/csf.conf + sed -i '/TCP_IN =/c\TCP_IN = "20,21,22,25,53,55,2066,80,110,143,443,465,587,993,995"' /etc/csf/csf.conf + sed -i '/TCP_OUT =/c\TCP_OUT = "20,21,22,25,53,80,2066,110,113,443,587,993,995"' /etc/csf/csf.conf + sed -i '/UDP_IN =/c\UDP_IN = "20,21,53"' /etc/csf/csf.conf + sed -i '/UDP_OUT =/c\UDP_OUT = "20,21,53,113,123"' /etc/csf/csf.conf + sed -i '/PORTFLOOD =/c\PORTFLOOD = "80;tcp;50;10"' /etc/csf/csf.conf + sed -i '/CONNLIMIT =/c\CONNLIMIT = "80;10,55;2"' /etc/csf/csf.conf + sed -i '/CT_LIMIT =/c\CT_LIMIT = "100"' /etc/csf/csf.conf + sed -i '/CT_PERMANENT =/c\CT_PERMANENT = "1"' /etc/csf/csf.conf + sed -i '/CT_INTERVAL =/c\CT_INTERVAL = "60"' /etc/csf/csf.conf + sed -i '/CT_BLOCK_TIME =/c\CT_BLOCK_TIME = "3600"' /etc/csf/csf.conf + # csf -r + diff --git a/inc/curl.sh b/inc/curl.sh index 13bb82d..776044d 100644 --- a/inc/curl.sh +++ b/inc/curl.sh @@ -13,6 +13,7 @@ then echo -e "\033[33;32m openssl download Success";date +"%r" >> $BUILD;echo "Success : File Download $FILE" >> $BUILD else echo -e "\033[33;31m openssl download Failed";date +"%r" >> $BUILD;echo "Failed : File Download $FILE" >> $BUILD + echo "Failed : File Download $FILE" >> $FAILBUILD fi else echo -e "\033[33;32m file " $FILE " exists.";date +"%r" >> $BUILD;echo "Status : Already Exist $FILE" >> $BUILD @@ -22,17 +23,17 @@ fi if tar -zxf openssl-1.0.1s.tar.gz; then echo -e "\033[33;32m extract openssl Success";date +"%r" >> $BUILD;echo "Success : $FILE Extract" >> $BUILD else -echo -e "\033[33;31m extract openssl Failed";date +"%r" >> $BUILD;echo "Failed : $FILE Extract" >> $BUILD +echo -e "\033[33;31m extract openssl Failed";date +"%r" >> $BUILD;echo "Failed : $FILE Extract" >> $BUILD;echo "Failed : $FILE Extract" >> $FAILBUILD fi if yum -y install zlib-devel; then echo -e "\033[33;32m zlib install Success";date +"%r" >> $BUILD;echo "Success : Install zlib devel" >> $BUILD else -echo -e "\033[33;31m zlib install Failed";date +"%r" >> $BUILD;echo "Failed : Install zlib devel" >> $BUILD +echo -e "\033[33;31m zlib install Failed";date +"%r" >> $BUILD;echo "Failed : Install zlib devel" >> $BUILD;echo "Failed : Install zlib devel" >> $FAILBUILD fi if cd openssl-1.0.1s; then echo -e "\033[33;32m goto openssl Success";date +"%r" >> $BUILD;echo "Success : goto dir openssl" >> $BUILD else -echo -e "\033[33;31m goto openssl Failed";date +"%r" >> $BUILD;echo "Failed : goto dir openssl" >> $BUILD +echo -e "\033[33;31m goto openssl Failed";date +"%r" >> $BUILD;echo "Failed : goto dir openssl" >> $BUILD;echo "Failed : goto dir openssl" >> $FAILBUILD fi ./config shared -fPIC --prefix=/opt/ssl --openssldir=/etc/pki/tls zlib-dynamic shared make @@ -51,7 +52,7 @@ then if wget http://curl.haxx.se/download/curl-7.48.0.tar.gz; then echo -e "\033[33;32m curl download Success";date +"%r" >> $BUILD;echo "Success : File Download $FILE" >> $BUILD else - echo -e "\033[33;31m curl download Failed";date +"%r" >> $BUILD;echo "Failed : File Download $FILE" >> $BUILD + echo -e "\033[33;31m curl download Failed";date +"%r" >> $BUILD;echo "Failed : File Download $FILE" >> $BUILD;echo "Failed : File Download $FILE" >> $FAILBUILD fi else echo -e "\033[33;32m file " $FILE " exists.";date +"%r" >> $BUILD;echo "Status : Already Exist $FILE" >> $BUILD @@ -61,12 +62,12 @@ fi if tar -xzf curl-7.48.0.tar.gz; then echo -e "\033[33;32m extract curl Success";date +"%r" >> $BUILD;echo "Success : Extract $FILE" >> $BUILD else -echo -e "\033[33;31m extract curl Failed";date +"%r" >> $BUILD;echo "Failed : Extract $FILE" >> $BUILD +echo -e "\033[33;31m extract curl Failed";date +"%r" >> $BUILD;echo "Failed : Extract $FILE" >> $BUILD;echo "Failed : Extract $FILE" >> $FAILBUILD fi if cd curl-7.48.0; then echo -e "\033[33;32m curl goto Success";date +"%r" >> $BUILD;echo "Success : goto curl folder" >> $BUILD else -echo -e "\033[33;31m curl goto Failed";date +"%r" >> $BUILD;echo "Failed : goto curl folder" >> $BUILD +echo -e "\033[33;31m curl goto Failed";date +"%r" >> $BUILD;echo "Failed : goto curl folder" >> $BUILD;echo "Failed : goto curl folder" >> $FAILBUILD fi ./configure --prefix=/opt/curl-ssl --with-ssl=/opt/ssl --enable-http --enable-ftp LDFLAGS=-L/opt/ssl/lib CPPFLAGS=-I/opt/ssl/include make diff --git a/inc/cvpsauto.sh b/inc/cvpsauto.sh index a42f3cc..8b03feb 100644 --- a/inc/cvpsauto.sh +++ b/inc/cvpsauto.sh @@ -5,6 +5,8 @@ #weba=admin;webp=admin;webport=2083; +cd $SCRIPTPATH/src + # Wemin Manual/tar.gz file installation FILE=webmin-1.791.tar.gz if [ ! -f $FILE ] @@ -13,7 +15,7 @@ then if wget http://prdownloads.sourceforge.net/webadmin/webmin-1.791.tar.gz; then echo -e "\033[33;32m Webmin Success";date +"%r" >> $BUILD;echo "Success : Download File $FILE" >> $BUILD else - echo -e "\033[33;31m Webmin Failed";date +"%r" >> $BUILD;echo "Failed : Download File $FILE" >> $BUILD + echo -e "\033[33;31m Webmin Failed";date +"%r" >> $BUILD;echo "Failed : Download File $FILE" >> $BUILD;echo "Failed : Download File $FILE" >> $FAILBUILD fi else echo -e "\033[33;32m file " $FILE " exists.";date +"%r" >> $BUILD;echo "Status : Exist $FILE" >> $BUILD @@ -53,3 +55,7 @@ service webmin start date +"%r" >> $BUILD;service webmin status >> $BUILD date +"%r" >> $BUILD;echo "Status : Webmin Automatic Program :$SECURE_WEBMIN" >> $BUILD date +"%r" >> $BUILD;echo "Webmin Program Complete" >> $BUILD + +cp -rf $SCRIPTPATH/conf/webmin/config /etc/webmin/apache/ +chown root:bin /etc/webmin/apache/config +chmod 600 /etc/webmin/apache/config diff --git a/inc/domainauto.sh b/inc/domainauto.sh index f72acf0..a9aad39 100644 --- a/inc/domainauto.sh +++ b/inc/domainauto.sh @@ -1,7 +1,19 @@ # HIDE Apache Version,PHP,Openssl details on http #Example : Apache/2.4.18 (Unix) OpenSSL/1.0.2g PHP/5.6.20 To only Show ("apache") -echo -e '\nServerSignature Off\nServerTokens Prod\n' >> /usr/local/apache2/conf/httpd.conf - +echo -e '\nServerSignature Off\nServerTokens Prod\n Include conf/amolhost/*.conf\n' >> /usr/local/apache2/conf/httpd.conf +echo -e '\n\nDOSHashTableSize 3097\nDOSPageCount 2\nDOSSiteCount 50\nDOSPageInterval 1\nDOSSiteInterval 1\nDOSBlockingPeriod 60\nDOSEmailNotify mramolpatil1@gmail.com\n' >> /usr/local/apache2/conf/httpd.conf +mkdir -p /usr/local/apache2/conf/amolhost +touch /usr/local/apache2/conf/amolhost/main.conf +touch /usr/local/apache2/conf/amolhost/domain.conf +#touch /usr/local/apache2/conf/amolhost/global.conf +PORTX = 80 +if [ $NGINX = "true" ] + then + PORTX=8088 + echo "Default PORT $PORTX" + else + echo "Default PORT 80" +fi echo "Domain Added (MAIN):$MAINDOMAIN (Domain Directory:/home/www)" @@ -14,7 +26,15 @@ echo "Request By You Domains: $EXTRAD (...Wait..)" IFS=', ' read -r -a array <<< "$EXTRAD" for element in "${array[@]}" do - echo -e '\nServerName '$element'\nServerAlias www.'$element'\nDocumentRoot /home/www/domain/'$element'\nServerAdmin webmaster@djamol.com\n' >> /usr/local/apache2/conf/httpd.conf + LogFile="" + if [ $AW = "true" ] + then + mkdir -p /var/logs/httpd/$element + LogFile="CustomLog /var/logs/httpd/$element/aclog.log \"combined\"" + else + LogFile="#CustomLog /var/logs/httpd/$element/aclog.log \"combined\"" + fi + echo -e '\nServerName '$element'\nServerAlias www.'$element'\n'$LogFile'\nDocumentRoot /home/www/domain/'$element'\nServerAdmin webmaster@djamol.com\n' >> /usr/local/apache2/conf/amolhost/domain.conf echo -e '$TTL 14400\n@ 86400 IN SOA ns1.'$MAINDOMAIN'. djamolpatil.gmail.com. (\n 2016033003 ; serial, todays date+todays\n 3600 ; refresh, seconds\n 7200 ; retry, seconds\n 1209600 ; expire, seconds\n 86400 ) ; minimum, seconds\n\n'$element'. 86400 IN NS ns1.'$MAINDOMAIN'.\n'$element'. 86400 IN NS ns2.'$MAINDOMAIN'.\n\n\n'$element'. IN A '$MAINIP'\nmail.'$element'. IN A '$MAINIP'\nmail.'$element'. IN MX 5 mail.'$element'.\n\nwww IN CNAME '$element'.\nftp IN CNAME '$element'.\n' >> /var/named/$element.db echo -e '\nzone "'$element'" { type master; file "/var/named/'$element'.db";};' >> /etc/named.main.zones echo "Domain Added :$element (Domain Directory:/home/www/domain/$element)" @@ -32,7 +52,7 @@ echo "Request By You Domains For HTTPS Enable: $EXTRADS (...Wait..)" IFS=', ' read -r -a array <<< "$EXTRADS" for element in "${array[@]}" do - echo -e '\nServerName '$element'\nServerAlias www.'$element'\nDocumentRoot /home/www/domain/'$element'\n\nSSLEngine on\n SSLCertificateFile /usr/share/ssl/certs/ssl.crt\n SSLCertificateKeyFile /usr/share/ssl/certs/ssl.crt\n \n\n' >> /usr/local/apache2/conf/httpd.conf + echo -e '\nServerName '$element'\nServerAlias www.'$element'\nDocumentRoot /home/www/domain/'$element'\n\nSSLEngine on\n SSLCertificateFile /usr/share/ssl/certs/ssl.crt\n SSLCertificateKeyFile /usr/share/ssl/certs/ssl.crt\n \n\n' >> /usr/local/apache2/conf/amolhost/domain.conf echo "Domain HTTPS enable :$element Done" done diff --git a/inc/end.sh b/inc/end.sh index f31b2bf..064f311 100644 --- a/inc/end.sh +++ b/inc/end.sh @@ -1,7 +1,31 @@ +systemctl start httpd +#systemctl restart httpd.service + /etc/init.d/apache2 restart systemctl restart proftpd service named restart +chkconfig --add apache2 +chkconfig apache2 on +chkconfig --level 345 apache2 on + + + +### SSH Secure PORT +sed -i '/#Port/c\Port 55' /etc/ssh/sshd_config + +echo -e 'Ciphers aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128\nMACs hmac-sha1,umac-64@openssh.com,hmac-ripemd160' >> /etc/ssh/sshd_config + +##check port ssh +semanage port -l | grep ssh +##enable 55 port for ssh in semanage linux +semanage port -a -t ssh_port_t -p tcp 55 +semanage port -a -t ssh_port_t -p tcp 55 +#service sshd restart +#default enable php 7 + sed -i '/LoadModule php5_module/c\#LoadModule php5_module modules/libphp5.so' /usr/local/apache2/conf/httpd.conf + sed -i '/LoadModule php7_module/c\LoadModule php7_module modules/libphp7.so' /usr/local/apache2/conf/httpd.conf + service apache2 restart date +"%r" >> $BUILD;/usr/local/apache2/bin/httpd -v >> $BUILD;openssl version >> $BUILD; /usr/local/bin/php -v >> $BUILD;mysql -V >> $BUILD;named -v >> $BUILD;curl -V >> $BUILD; diff --git a/inc/ffmpeg.sh b/inc/ffmpeg.sh index e96f539..341aa72 100644 --- a/inc/ffmpeg.sh +++ b/inc/ffmpeg.sh @@ -15,6 +15,7 @@ cd $SCRIPTPATH/inc/ffmpeg chmod +x *.sh set -a # Global Variable to access any bash other files run by this file +ServBUILD=$BUILD SCRIPTPATH=$SCRIPTPATH # seen in the present script! set +a diff --git a/inc/ffmpeg/acc.sh b/inc/ffmpeg/acc.sh index 11fc298..c6f58d5 100644 --- a/inc/ffmpeg/acc.sh +++ b/inc/ffmpeg/acc.sh @@ -26,7 +26,7 @@ then if wget -O $_package $SOURCE_URL/$_package; then date +"%r" >> $BUILD;echo "Success : File Download $_package" >> $BUILD else - date +"%r" >> $BUILD;echo "Failed : File Download $_package" >> $BUILD + date +"%r" >> $BUILD;echo "Failed : File Download $_package" >> $BUILD;echo "Failed : File Download $_package" >> $FAILBUILD fi else cp $SCRIPTPATH/src/ffmpeg/$_package $INSTALL_SDIR/ @@ -42,7 +42,7 @@ if make install; then date +"%r" >> $BUILD;echo "Succcess :acc Installled" >> $BUILD; echo -e $RED" acc Installed Success ......"$RESET else -date +"%r" >> $BUILD;echo "Failed :acc Installation Failed" >> $BUILD; +date +"%r" >> $BUILD;echo "Failed :acc Installation Failed" >> $BUILD;echo "Failed :acc Installation Failed" >> $FAILBUILD; echo -e $RED"Failed :acc Installation Failed ......"$RESET fi echo -e $RED" diff --git a/inc/ffmpeg/amrnb.sh b/inc/ffmpeg/amrnb.sh index 40da136..551f9ab 100644 --- a/inc/ffmpeg/amrnb.sh +++ b/inc/ffmpeg/amrnb.sh @@ -31,7 +31,7 @@ then if wget -O $_package $SOURCE_URL/$_package; then date +"%r" >> $BUILD;echo "Success : File Download $_package" >> $BUILD else - date +"%r" >> $BUILD;echo "Failed : File Download $_package" >> $BUILD + date +"%r" >> $BUILD;echo "Failed : File Download $_package" >> $BUILD;echo "Failed : File Download $_package" >> $FAILBUILD fi else cp $SCRIPTPATH/src/ffmpeg/$_package $INSTALL_SDIR/ @@ -46,7 +46,7 @@ if make install; then date +"%r" >> $BUILD;echo "Succcess :amrnb Installled" >> $BUILD; echo -e $RED" amrnb Installed Success ......"$RESET else -date +"%r" >> $BUILD;echo "Failed :amrnb Installation Failed" >> $BUILD; +date +"%r" >> $BUILD;echo "Failed :amrnb Installation Failed" >> $BUILD;echo "Failed :amrnb Installation Failed" >> $FAILBUILD; echo -e $RED"Failed :amrnb Installation Failed ......"$RESET fi echo -e $RED" diff --git a/inc/ffmpeg/amrwb.sh b/inc/ffmpeg/amrwb.sh index cb0ecf0..72f0d68 100644 --- a/inc/ffmpeg/amrwb.sh +++ b/inc/ffmpeg/amrwb.sh @@ -31,7 +31,7 @@ then if wget -O $_package $SOURCE_URL/$_package; then date +"%r" >> $BUILD;echo "Success : File Download $_package" >> $BUILD else - date +"%r" >> $BUILD;echo "Failed : File Download $_package" >> $BUILD + date +"%r" >> $BUILD;echo "Failed : File Download $_package" >> $BUILD;echo "Failed : File Download $_package" >> $FAILBUILD fi else cp $SCRIPTPATH/src/ffmpeg/$_package $INSTALL_SDIR/ @@ -46,7 +46,7 @@ if make install; then date +"%r" >> $BUILD;echo "Succcess :amrwb Installled" >> $BUILD; echo -e $RED" amrwb Installed Success ......"$RESET else -date +"%r" >> $BUILD;echo "Failed :amrwb Installation Failed" >> $BUILD; +date +"%r" >> $BUILD;echo "Failed :amrwb Installation Failed" >> $BUILD;echo "Failed :amrwb Installation Failed" >> $FAILBUILD; echo -e $RED"Failed :amrwb Installation Failed ......"$RESET fi echo -e $RED" diff --git a/inc/ffmpeg/codecs.sh b/inc/ffmpeg/codecs.sh index 4929cea..7486749 100644 --- a/inc/ffmpeg/codecs.sh +++ b/inc/ffmpeg/codecs.sh @@ -36,7 +36,7 @@ then if wget -O $_package $SOURCE_URL/$_package; then date +"%r" >> $BUILD;echo "Success : File Download $_package" >> $BUILD else - date +"%r" >> $BUILD;echo "Failed : File Download $_package" >> $BUILD + date +"%r" >> $BUILD;echo "Failed : File Download $_package" >> $BUILD;echo "Failed : File Download $_package" >> $FAILBUILD fi else cp $SCRIPTPATH/src/ffmpeg/$_package $INSTALL_SDIR/ @@ -44,7 +44,8 @@ else fi - tar -xvjf $codec_source + tar -xvjf $_package + tar xjf $_package chown -R root.root all-20071007/ mkdir -pv $INSTALL_DDIR/lib/codecs/ cp -vrf all-20071007/* $INSTALL_DDIR/lib/codecs/ diff --git a/inc/ffmpeg/faad2.sh b/inc/ffmpeg/faad2.sh index 099260a..142e5e5 100644 --- a/inc/ffmpeg/faad2.sh +++ b/inc/ffmpeg/faad2.sh @@ -31,7 +31,7 @@ then if wget -O $_package $SOURCE_URL/$_package; then date +"%r" >> $BUILD;echo "Success : File Download $_package" >> $BUILD else - date +"%r" >> $BUILD;echo "Failed : File Download $_package" >> $BUILD + date +"%r" >> $BUILD;echo "Failed : File Download $_package" >> $BUILD;echo "Failed : File Download $_package" >> $FAILBUILD fi else cp $SCRIPTPATH/src/ffmpeg/$_package $INSTALL_SDIR/ @@ -49,7 +49,7 @@ if make install; then date +"%r" >> $BUILD;echo "Succcess : faad2 Installled" >> $BUILD; echo -e $RED" faad2 Installed Success ......"$RESET else -date +"%r" >> $BUILD;echo "Failed : faad2 Installation Failed" >> $BUILD; +date +"%r" >> $BUILD;echo "Failed : faad2 Installation Failed" >> $BUILD;echo "Failed : faad2 Installation Failed" >> $FAILBUILD; echo -e $RED"Failed : faad2 Installation Failed ......"$RESET fi echo -e $RED" diff --git a/inc/ffmpeg/facc.sh b/inc/ffmpeg/facc.sh index 330c640..59dfea2 100644 --- a/inc/ffmpeg/facc.sh +++ b/inc/ffmpeg/facc.sh @@ -31,7 +31,7 @@ then if wget -O $_package $SOURCE_URL/$_package; then date +"%r" >> $BUILD;echo "Success : File Download $_package" >> $BUILD else - date +"%r" >> $BUILD;echo "Failed : File Download $_package" >> $BUILD + date +"%r" >> $BUILD;echo "Failed : File Download $_package" >> $BUILD;echo "Failed : File Download $_package" >> $FAILBUILD fi else cp $SCRIPTPATH/src/ffmpeg/$_package $INSTALL_SDIR/ @@ -48,7 +48,7 @@ if make install; then date +"%r" >> $BUILD;echo "Succcess :faac Installled" >> $BUILD; echo -e $RED" faac Installed Success ......"$RESET else -date +"%r" >> $BUILD;echo "Failed :faac Installation Failed" >> $BUILD; +date +"%r" >> $BUILD;echo "Failed :faac Installation Failed" >> $BUILD;echo "Failed :faac Installation Failed" >> $FAILBUILD; echo -e $RED"Failed :faac Installation Failed ......"$RESET fi echo -e $RED" diff --git a/inc/ffmpeg/fdkaac.sh b/inc/ffmpeg/fdkaac.sh index f02e30c..bb68d9f 100644 --- a/inc/ffmpeg/fdkaac.sh +++ b/inc/ffmpeg/fdkaac.sh @@ -41,7 +41,7 @@ then if wget -O $_package $SOURCE_URL/$_package; then date +"%r" >> $BUILD;echo "Success : File Download $_package" >> $BUILD else - date +"%r" >> $BUILD;echo "Failed : File Download $_package" >> $BUILD + date +"%r" >> $BUILD;echo "Failed : File Download $_package" >> $BUILD;echo "Failed : File Download $_package" >> $FAILBUILD fi else cp $SCRIPTPATH/src/ffmpeg/$_package $INSTALL_SDIR/ @@ -57,7 +57,7 @@ if make install; then date +"%r" >> $BUILD;echo "Succcess :fdk-aac Installled" >> $BUILD; echo -e $RED" fdk-aac Success ......"$RESET else -date +"%r" >> $BUILD;echo "Failed :fdk-aac Installation Failed" >> $BUILD; +date +"%r" >> $BUILD;echo "Failed :fdk-aac Installation Failed" >> $BUILD;echo "Failed :fdk-aac Installation Failed" >> $FAILBUILD; echo -e $RED"Failed :fdk-aac Installation Failed ......"$RESET fi fi diff --git a/inc/ffmpeg/ffmpeg.sh b/inc/ffmpeg/ffmpeg.sh index 3866889..47491ea 100644 --- a/inc/ffmpeg/ffmpeg.sh +++ b/inc/ffmpeg/ffmpeg.sh @@ -60,7 +60,7 @@ then if wget -O $_package $SOURCE_URL/$_package; then date +"%r" >> $BUILD;echo "Success : File Download $_package" >> $BUILD else - date +"%r" >> $BUILD;echo "Failed : File Download $_package" >> $BUILD + date +"%r" >> $BUILD;echo "Failed : File Download $_package" >> $BUILD;echo "Failed : File Download $_package" >> $FAILBUILD fi else cp $SCRIPTPATH/src/ffmpeg/$_package $INSTALL_SDIR/ @@ -89,7 +89,7 @@ fi date +"%r" >> $BUILD;echo "Succcess :FFMPEG-FrameWork Installled" >> $BUILD; echo -e $RED" FreeType FFMPEG-FrameWork Success ......"$RESET else -date +"%r" >> $BUILD;echo "Failed :FFMPEG-FrameWork Installation Failed" >> $BUILD; +date +"%r" >> $BUILD;echo "Failed :FFMPEG-FrameWork Installation Failed" >> $BUILD;echo "Failed :FFMPEG-FrameWork Installation Failed" >> $FAILBUILD; echo -e $RED"Failed :FFMPEG-FrameWork Installation Failed ......"$RESET fi diff --git a/inc/ffmpeg/flvtool.sh b/inc/ffmpeg/flvtool.sh index 4dc32aa..98121de 100644 --- a/inc/ffmpeg/flvtool.sh +++ b/inc/ffmpeg/flvtool.sh @@ -33,7 +33,7 @@ then echo -e "\033[33;34m file " $_package " does not exist."; if wget -O $_package $SOURCE_URL/$_package; then - date +"%r" >> $BUILD;echo "Success : File Download $_package" >> $BUILD + date +"%r" >> $BUILD;echo "Success : File Download $_package" >> $BUILD;echo "Success : File Download $_package" >> $FAILBUILD else date +"%r" >> $BUILD;echo "Failed : File Download $_package" >> $BUILD fi diff --git a/inc/ffmpeg/freetype.sh b/inc/ffmpeg/freetype.sh index 08eb708..5cb83c7 100644 --- a/inc/ffmpeg/freetype.sh +++ b/inc/ffmpeg/freetype.sh @@ -34,7 +34,7 @@ then if wget -O $_package $SOURCE_URL/$_package; then date +"%r" >> $BUILD;echo "Success : File Download $_package" >> $BUILD else - date +"%r" >> $BUILD;echo "Failed : File Download $_package" >> $BUILD + date +"%r" >> $BUILD;echo "Failed : File Download $_package" >> $BUILD;echo "Failed : File Download $_package" >> $FAILBUILD fi else cp $SCRIPTPATH/src/ffmpeg/$_package $INSTALL_SDIR/ @@ -50,7 +50,7 @@ if make install; then date +"%r" >> $BUILD;echo "Succcess :freetype Installled" >> $BUILD; echo -e $RED" FreeType Installed Success ......"$RESET else -date +"%r" >> $BUILD;echo "Failed :FreeType Installation Failed" >> $BUILD; +date +"%r" >> $BUILD;echo "Failed :FreeType Installation Failed" >> $BUILD;echo "Failed :FreeType Installation Failed" >> $FAILBUILD; echo -e $RED"Failed :FreeType Installation Failed ......"$RESET fi echo -e $RED" diff --git a/inc/ffmpeg/git.sh b/inc/ffmpeg/git.sh index 61374e4..9cb794b 100644 --- a/inc/ffmpeg/git.sh +++ b/inc/ffmpeg/git.sh @@ -41,7 +41,7 @@ then if wget -O $_package $SOURCE_URL/$_package; then date +"%r" >> $BUILD;echo "Success : File Download $_package" >> $BUILD else - date +"%r" >> $BUILD;echo "Failed : File Download $_package" >> $BUILD + date +"%r" >> $BUILD;echo "Failed : File Download $_package" >> $BUILD;echo "Failed : File Download $_package" >> $FAILBUILD fi else cp $SCRIPTPATH/src/ffmpeg/$_package $INSTALL_SDIR/ @@ -56,7 +56,7 @@ if make install; then date +"%r" >> $BUILD;echo "Succcess :Git Installled" >> $BUILD; echo -e $RED" Git Installed Success ......"$RESET else -date +"%r" >> $BUILD;echo "Failed :Git Installation Failed" >> $BUILD; +date +"%r" >> $BUILD;echo "Failed :Git Installation Failed" >> $BUILD;echo "Failed :Git Installation Failed" >> $FAILBUILD; echo -e $RED"Failed :Git Installation Failed ......"$RESET fi diff --git a/inc/ffmpeg/lame.sh b/inc/ffmpeg/lame.sh index f41aceb..051012d 100644 --- a/inc/ffmpeg/lame.sh +++ b/inc/ffmpeg/lame.sh @@ -34,7 +34,7 @@ then if wget -O $_package $SOURCE_URL/$_package; then date +"%r" >> $BUILD;echo "Success : File Download $_package" >> $BUILD else - date +"%r" >> $BUILD;echo "Failed : File Download $_package" >> $BUILD + date +"%r" >> $BUILD;echo "Failed : File Download $_package" >> $BUILD;echo "Failed : File Download $_package" >> $FAILBUILD fi else cp $SCRIPTPATH/src/ffmpeg/$_package $INSTALL_SDIR/ @@ -49,8 +49,9 @@ make -j$cpu if make install; then date +"%r" >> $BUILD;echo "Succcess :lame Installled" >> $BUILD; echo -e $RED" lame Installed Success ......"$RESET +ln -sf $INSTALL_DDIR/bin/lame /usr/local/bin else -date +"%r" >> $BUILD;echo "Failed :lame Installation Failed" >> $BUILD; +date +"%r" >> $BUILD;echo "Failed :lame Installation Failed" >> $BUILD;echo "Failed :lame Installation Failed" >> $FAILBUILD; echo -e $RED"Failed :lame Installation Failed ......"$RESET fi echo -e $RED" diff --git a/inc/ffmpeg/liba52.sh b/inc/ffmpeg/liba52.sh index b14fda6..955ac98 100644 --- a/inc/ffmpeg/liba52.sh +++ b/inc/ffmpeg/liba52.sh @@ -31,7 +31,7 @@ then if wget -O $_package $SOURCE_URL/$_package; then date +"%r" >> $BUILD;echo "Success : File Download $_package" >> $BUILD else - date +"%r" >> $BUILD;echo "Failed : File Download $_package" >> $BUILD + date +"%r" >> $BUILD;echo "Failed : File Download $_package" >> $BUILD;echo "Failed : File Download $_package" >> $FAILBUILD fi else cp $SCRIPTPATH/src/ffmpeg/$_package $INSTALL_SDIR/ @@ -55,7 +55,7 @@ if make install; then date +"%r" >> $BUILD;echo "Succcess :liba52 Installled" >> $BUILD; echo -e $RED" liba52 Installed Success ......"$RESET else -date +"%r" >> $BUILD;echo "Failed :liba52 Installation Failed" >> $BUILD; +date +"%r" >> $BUILD;echo "Failed :liba52 Installation Failed" >> $BUILD;echo "Failed :liba52 Installation Failed" >> $FAILBUILD; echo -e $RED"Failed :liba52 Installation Failed ......"$RESET fi echo -e $RED" diff --git a/inc/ffmpeg/libao.sh b/inc/ffmpeg/libao.sh index c79100c..c28a06f 100644 --- a/inc/ffmpeg/libao.sh +++ b/inc/ffmpeg/libao.sh @@ -31,7 +31,7 @@ then if wget -O $_package $SOURCE_URL/$_package; then date +"%r" >> $BUILD;echo "Success : File Download $_package" >> $BUILD else - date +"%r" >> $BUILD;echo "Failed : File Download $_package" >> $BUILD + date +"%r" >> $BUILD;echo "Failed : File Download $_package" >> $BUILD;echo "Failed : File Download $_package" >> $FAILBUILD fi else cp $SCRIPTPATH/src/ffmpeg/$_package $INSTALL_SDIR/ @@ -47,7 +47,7 @@ if make install; then date +"%r" >> $BUILD;echo "Succcess :libao Installled" >> $BUILD; echo -e $RED" libao Installed Success ......"$RESET else -date +"%r" >> $BUILD;echo "Failed :libao Installation Failed" >> $BUILD; +date +"%r" >> $BUILD;echo "Failed :libao Installation Failed" >> $BUILD;echo "Failed :libao Installation Failed" >> $FAILBUILD; echo -e $RED"Failed :libao Installation Failed ......"$RESET fi ldconfig diff --git a/inc/ffmpeg/mplayer.sh b/inc/ffmpeg/mplayer.sh index ac89594..cd0bfdb 100644 --- a/inc/ffmpeg/mplayer.sh +++ b/inc/ffmpeg/mplayer.sh @@ -2,7 +2,7 @@ # Amol Patil #Email US :support@djamol.com # WEB@DjAmol.com -_package='MPlayer-1.3.0.tar.xz' +_package='mplayer-export-snapshot.tar.bz2' clear sleep 2 echo -e ' @@ -38,14 +38,18 @@ else cp $SCRIPTPATH/src/ffmpeg/$_package $INSTALL_SDIR/ echo -e "\033[33;32m file " $_package " exists.";date +"%r" >> $BUILD;echo "Status : Already Exist $_package" >> $BUILD fi - -tar -xvJf $_package +tar xvf $_package +#tar -xvJf $_package #/usr/local/avpffmpeg/bin/svn checkout svn://svn.mplayerhq.hu/mplayer/trunk mplayer #cd mplayer/ -cd MPlayer-1.3.0/ -./configure --prefix=$INSTALL_DDIR --codecsdir=$INSTALL_DDIR/lib/codecs/ \ +cd mplayer-exp* +echo y | ./configure --prefix=$INSTALL_DDIR --codecsdir=$INSTALL_DDIR/lib/codecs/ \ --extra-cflags=-I/usr/local/avpffmpeg/include/ --extra-ldflags=-L/usr/local/avpffmpeg/lib \ - --with-freetype-config=/usr/local/avpffmpeg/bin/freetype-config --yasm=/usr/local/avpffmpeg/bin/yasm --disable-gui + --with-freetype-config=$INSTALL_DDIR/bin/freetype-config --yasm=$INSTALL_DDIR/bin/yasm --disable-gui + +#./configure --prefix=$INSTALL_DDIR --codecsdir=$INSTALL_DDIR/lib/codecs/ \ +# --extra-cflags=-I/usr/local/avpffmpeg/include/ --extra-ldflags=-L/usr/local/avpffmpeg/lib \ +# --with-freetype-config=/usr/local/avpffmpeg/bin/freetype-config --yasm=/usr/local/avpffmpeg/bin/yasm --disable-gui make -j$cpu if make install; then date +"%r" >> $BUILD;echo "Succcess :MPlayer Installled" >> $BUILD; diff --git a/inc/ffmpeg/mplayer.sh.old b/inc/ffmpeg/mplayer.sh.old new file mode 100644 index 0000000..ac89594 --- /dev/null +++ b/inc/ffmpeg/mplayer.sh.old @@ -0,0 +1,89 @@ +#!/bin/bash +# Amol Patil +#Email US :support@djamol.com + # WEB@DjAmol.com +_package='MPlayer-1.3.0.tar.xz' +clear +sleep 2 +echo -e ' + ▒█░▒░▓█░█▒░▒▒█░█▓░▒░█▓ █████▒ ▓█ ▒█▓▓█▓ ██████ ▓████▒░█░ ░█████░▒████▓ ▓█████░ + ░▓ █▓▓█ ▓ ██▒█░▓░▓█░█▓ ▓▒ █▓ ▒█ ▒▓▓▓█▓ ▓░█▓▒█░▓▒ █▓ ▓ ░█░ ▓ ▒▓ ▓█ ▓▒▓█▒█▒ + ▒█▒█▓▓█░█▓▓█▒█▒█▓▓█▒█▓ █▓ █▓░▓░ ▓█ ██▒▒█▓░█▒█▓▒█░██ █▓░█▒ ░ ▒█▒ ░▓ ██ ██ █▓▓█░█▒ + ░█████▓ ██████ ▓█████░▓█ █████░░█████ █▓ █▓░█▒░░▒█ ▓████▒░█████▒█▓ █████ ▒████▓ █▓░▒░█▒ +'; +echo -e "$GREEN +# Powered By DjAmol Group Inc # +# Email : Support@djamol.com # +# Website : www.djamol.com # +# Copyright By PatilWeb.com # +# IG:PatilWeb FB:PatilWeb TW:PatilWeb # +$RESET"; + +echo -e $RED"Installation of $_package ....... started"$RESET + +cd $INSTALL_SDIR/ +rm -rf mplayer* + cd $INSTALL_SDIR + +if [ ! -f $SCRIPTPATH/src/ffmpeg/$_package ] +then + echo -e "\033[33;34m file " $_package " does not exist."; + + if wget -O $_package $SOURCE_URL/$_package; then + date +"%r" >> $BUILD;echo "Success : File Download $_package" >> $BUILD + else + date +"%r" >> $BUILD;echo "Failed : File Download $_package" >> $BUILD + fi +else + cp $SCRIPTPATH/src/ffmpeg/$_package $INSTALL_SDIR/ + echo -e "\033[33;32m file " $_package " exists.";date +"%r" >> $BUILD;echo "Status : Already Exist $_package" >> $BUILD +fi + +tar -xvJf $_package +#/usr/local/avpffmpeg/bin/svn checkout svn://svn.mplayerhq.hu/mplayer/trunk mplayer +#cd mplayer/ +cd MPlayer-1.3.0/ +./configure --prefix=$INSTALL_DDIR --codecsdir=$INSTALL_DDIR/lib/codecs/ \ + --extra-cflags=-I/usr/local/avpffmpeg/include/ --extra-ldflags=-L/usr/local/avpffmpeg/lib \ + --with-freetype-config=/usr/local/avpffmpeg/bin/freetype-config --yasm=/usr/local/avpffmpeg/bin/yasm --disable-gui +make -j$cpu +if make install; then +date +"%r" >> $BUILD;echo "Succcess :MPlayer Installled" >> $BUILD; +echo -e $RED" MPlayer Installed Success ......"$RESET +else +date +"%r" >> $BUILD;echo "Failed :MPlayer Installation Failed" >> $BUILD; +echo -e $RED"Failed :MPlayer Installation Failed ......"$RESET +fi +cp -f etc/codecs.conf $INSTALL_DDIR/etc/mplayer/codecs.conf +ln -sf /usr/local/avpffmpeg/bin/mplayer /usr/local/bin/mplayer +ln -sf /usr/local/avpffmpeg/bin/mplayer /usr/bin/mplayer +ln -sf /usr/local/avpffmpeg/bin/mencoder /usr/bin/mencoder +ln -sf /usr/local/avpffmpeg/bin/mencoder /usr/local/bin/mencoder +echo -e $RED" + :rvri + :vJUJYri:::::i:: + .sDgEJi r7i + .KQX7. .L: + iRRs. 5vsvv7v7Yv Kr + :gd5. 5Yv7LYL777I. M + PbuI .. ru7rrv:77rrr5 Q7 + QUYI. . I7r7vr .srir7j BJ + g2LYj ULr7rS 17rirJ: Rr + EY7JL i1r7rj: 2rrirU KS + sUvvvI. 57rr7U 7LrrivJ r1. +.1sv7vss 2v7r7J sriiiJ: r7: +:jjv77r7L ru777vY :7rirr2 7i: + uJvriBMvI: KL7vr:vuUIUI1urririrru :r: + Zvi1BBEiK2i:ii7:...jI2IUI11Lririrvr ..X + gJ5BYB:i.iUYr:..rJ: Jririrv7 .ur + DZQBu : 7Yvv77777j. iYriiiirjr:...:iUY + 5q: ...v:7Ls7v7uvU: is7iriri77vvvvSr + :SYJ:::::. Iqr :7U. .rLrrrrirrrsU + vq1vri. Er u75. .::iirrJJ. + 1JvJv.Ii rBB:.i. . . ..r7i + LRbbPZbEKI .BR s:....:ir7Lr: + :......ir..... +"$RESET + +echo -e $RED"Installation of $_package ....... Completed"$RESET +sleep 2 diff --git a/inc/ffmpeg/php0ffmpeg b/inc/ffmpeg/php0ffmpeg new file mode 100644 index 0000000..2c473c4 --- /dev/null +++ b/inc/ffmpeg/php0ffmpeg @@ -0,0 +1,7 @@ + wget http://downloads.sourceforge.net/project/ffmpeg-php/ffmpeg-php/0.6.0/ffmpeg-php-0.6.0.tbz2 + tar -xjf ffmpeg-php-0.6.0.tbz2 + cd ffmpeg-php-0.6.0 + phpize +./configure --enable-shared --with-ffmpeg=/usr/local/avpffmpeg +make +make install diff --git a/inc/ffmpeg/post.sh b/inc/ffmpeg/post.sh index d465534..d436910 100644 --- a/inc/ffmpeg/post.sh +++ b/inc/ffmpeg/post.sh @@ -26,7 +26,7 @@ echo " " echo "The ffmpeg and dependency package installation has been completed. You can use the following" echo "paths for the major binary locations. (Powered ByDjAmolGroup) Make sure to configure it in your conversion scripts too." echo "" -which {ffmpeg,mplayer,mencoder,flvtool2,MP4Box,yamdi} +which {ffmpeg,mplayer,mencoder,flvtool2,MP4Box,lame,yamdi} echo " " echo " Don't forget to do the following " echo " " diff --git a/inc/ffmpeg/start.sh b/inc/ffmpeg/start.sh index 8bc9496..c849ced 100644 --- a/inc/ffmpeg/start.sh +++ b/inc/ffmpeg/start.sh @@ -21,7 +21,8 @@ LD_LIBRARY_PATH=$LD_LIBRARY_PATH LIBRARY_PATH=$LIBRARY_PATH CPATH=$CPATH BUILDFILE=$RANDOM.txt -BUILD=$BUILDDIR$BUILDFILE +#BUILD=$BUILDDIR$BUILDFILE ## New Log BUILD File +BUILD=$ServBUILD ## Append in server build log file # Global Variable to access any bash other files run by this file #TESTVARIABLE=hellohelloheloo # ... @@ -357,4 +358,4 @@ echo -e "\e[32m########################################\n#### 37 POST INSTALL ## ./post.sh date +"%r" >> $BUILD;echo "Status :37 POST INSTALL Install END" >> $BUILD; date +"%r" >> $BUILD;echo "Status :100% FFMpeg Process is Ended..Thanks For Choosing Our Service" >> $BUILD; - +echo "AmolInstaller: SUCCESS" >> $BUILD; ##tail read BULD Live Close after match this text( autoinstall define function) diff --git a/inc/ftp.sh b/inc/ftp.sh index fa4d86a..c2bdb87 100644 --- a/inc/ftp.sh +++ b/inc/ftp.sh @@ -5,13 +5,45 @@ ## Pro ftpd installation #rpm -ivh http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-8.noarch.rpm -rpm -ivh http://ftp.astral.ro/mirrors/fedora/pub/epel/epel-release-latest-7.noarch.rpm +rpm -ivh http://ftp.astral.ro/mirrors/fedora/pub/epel/epel-release-latest-$OSV.noarch.rpm yum -y install proftpd proftpd-utils + + +groupadd ftpgroup +useradd -G ftpgroup djamoltest -s /sbin/nologin -d /home/www2 +#passwd djamol +#additional +chmod -R 1750 /home/www2 +setsebool -P allow_ftpd_full_access=1 +SSLCERt=$(expect -c " +set timeout 35 + spawn openssl req -x509 -nodes -newkey rsa:1024 -keyout /etc/pki/tls/certs/proftpd.pem -out /etc/pki/tls/certs/proftpd.pem + expect \"Country Name*:\" + send \"$CAC\r\" + expect \"State*:\" + send \"$CAS\r\" + expect \"Locality*:\" + send \"$CAL\r\" + expect \"Organization Name*:\" + send \"$CAO\r\" + expect \"Organizational Unit*:\" + send \"$CAU\r\" + expect \"Common Name*:\" + send \"$CACM\r\" + expect \"Email*:\" + send \"$CAM\r\" +expect eof +") +echo "$SSLCERt" +chmod 0440 /etc/pki/tls/certs/proftpd.pem +#systemctl restart proftpd.service +####additional + cp -f $SCRIPTPATH/conf/proftpd.conf /etc/proftpd.conf mkdir /etc/proftpd; touch /etc/proftpd/passwd.vhosts;chmod 640 /etc/proftpd/passwd.vhosts -cp -f $SCRIPTPATH/conf/ftpd-rsa.pem /etc/proftpd/ftpd-rsa.pem -cp -f $SCRIPTPATH/conf/ftpd-rsa-key.pem /etc/proftpd/ftpd-rsa-key.pem - chmod 600 /etc/proftpd/*.pem +#cp -f $SCRIPTPATH/conf/ftpd-rsa.pem /etc/proftpd/ftpd-rsa.pem +#cp -f $SCRIPTPATH/conf/ftpd-rsa-key.pem /etc/proftpd/ftpd-rsa-key.pem +# chmod 600 /etc/proftpd/*.pem systemctl start proftpd.service systemctl enable proftpd.service diff --git a/inc/geoip.sh b/inc/geoip.sh new file mode 100644 index 0000000..122ace2 --- /dev/null +++ b/inc/geoip.sh @@ -0,0 +1,98 @@ +mkdir /usr/local/share/GeoIP +#wget http://geolite.maxmind.com/download/geoip/database/GeoLiteCountry/GeoIP.dat.gz +#wget http://geolite.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz +#wget http://geolite.maxmind.com/download/geoip/database/asnum/GeoIPASNum.dat.gz +cd $SCRIPTPATH/src/geoip +FILE=GeoIP.dat.gz +if [ ! -f $FILE ] +then + echo -e "\033[33;34m file " $FILE " does not exist."; + + if wget https://github.com/djamol/geoip/raw/master/GeoIP.dat.gz; then + echo -e "\033[33;32m GeoIP download Success";date +"%r" >> $BUILD;echo "Success : File Download $FILE" >> $BUILD + else + echo -e "\033[33;31m GeoIP download Failed";date +"%r" >> $BUILD;echo "Failed : File Download $FILE" >> $BUILD;echo "Failed : File Download $FILE" >> $FAILBUILD + fi +else + echo -e "\033[33;32m file " $FILE " exists.";date +"%r" >> $BUILD;echo "Status : Already Exist $FILE" >> $BUILD + echo "Status : GeoIP.dat Database Installed" >> $BUILD; + cp $SCRIPTPATH/src/geoip/GeoIP.dat.gz /usr/local/share/GeoIP/GeoIP.dat.gz +fi + + +FILE=GeoLiteCity.dat.gz +if [ ! -f $FILE ] +then + echo -e "\033[33;34m file " $FILE " does not exist."; + + if wget https://github.com/djamol/geoip/raw/master/GeoLiteCity.dat.gz; then + echo -e "\033[33;32m GeoLiteCity download Success";date +"%r" >> $BUILD;echo "Success : File Download $FILE" >> $BUILD + else + echo -e "\033[33;31m GeoLiteCity download Failed";date +"%r" >> $BUILD;echo "Failed : File Download $FILE" >> $BUILD;echo "Failed : File Download $FILE" >> $FAILBUILD + fi +else + echo -e "\033[33;32m file " $FILE " exists.";date +"%r" >> $BUILD;echo "Status : Already Exist $FILE" >> $BUILD + echo "Status : GeoIP.dat Database Installed" >> $BUILD; + cp $SCRIPTPATH/src/geoip/GeoLiteCity.dat.gz /usr/local/share/GeoIP/GeoLiteCity.dat.gz +fi + +FILE=GeoIPASNum.dat.gz +if [ ! -f $FILE ] +then + echo -e "\033[33;34m file " $FILE " does not exist."; + + if wget https://github.com/djamol/geoip/raw/master/GeoIPASNum.dat.gz; then + echo -e "\033[33;32m GeoIPASNum download Success";date +"%r" >> $BUILD;echo "Success : File Download $FILE" >> $BUILD + else + echo -e "\033[33;31m GeoIPASNum download Failed";date +"%r" >> $BUILD;echo "Failed : File Download $FILE" >> $BUILD;echo "Failed : File Download $FILE" >> $FAILBUILD + fi +else + echo -e "\033[33;32m file " $FILE " exists.";date +"%r" >> $BUILD;echo "Status : Already Exist $FILE" >> $BUILD + echo "Status : GeoIP.dat Database Installed" >> $BUILD; + cp $SCRIPTPATH/src/geoip/GeoIPASNum.dat.gz /usr/local/share/GeoIP/GeoIPASNum.dat.gz +fi + +cd /usr/local/share/GeoIP + +gunzip *gz + +#Step 2: Install the GeoIP C API +#There will be a dependency on zlib so make sure zlib-devel is installed: + +yum install zlib-devel -y +cd /usr/local/share/GeoIP +#wget http://geolite.maxmind.com/download/geoip/api/c/GeoIP-1.4.6.tar.gz +#wget https://github.com/djamol/geoip/raw/master/GeoIP-1.4.6.tar.gz +tar xvzf GeoIP-1.4.6.tar.gz +cd GeoIP-1.4.6 +./configure +make +make check +sudo make install + + +#Make it possible to link against the geoip library: +#sudo echo '/usr/local/lib' > /etc/ld.so.conf.d/geoip.conf +#sudo ldconfig + + + +#Step 3: Install the Geo::IP Perl Module +cd /usr/local/share/GeoIP +#wget http://geolite.maxmind.com/download/geoip/api/perl/Geo-IP-1.38.tar.gz +#wget https://github.com/djamol/geoip/raw/master/Geo-IP-1.38.tar.gz +tar xzvf Geo-IP-1.38.tar.gz +cd Geo-IP-1.38 +perl Makefile.PL LIBS='-L/usr/local/lib' +make +make test +sudo make install + + +#Step 4: Enable the GeoIP Plugin + +#Edit /etc/awstats/awstats.yourdomain.conf to add these lines: + +#LoadPlugin="geoip GEOIP_STANDARD /usr/local/share/GeoIP/GeoIP.dat" +#LoadPlugin="geoip_city_maxmind GEOIP_STANDARD /usr/local/share/GeoIP/GeoLiteCity.dat" +#LoadPlugin="geoip_org_maxmind GEOIP_STANDARD /usr/local/share/GeoIP/GeoIPASNum.dat" diff --git a/inc/last.sh b/inc/last.sh index 17d6672..1f02009 100644 --- a/inc/last.sh +++ b/inc/last.sh @@ -2,30 +2,77 @@ # DjAmol Group Pvt Ltd. # WWW.DjAmol.Com # djamolpatil@gmail.com +PORTX = 80 +if [ $NGINX = "true" ] + then + PORTX=8088 + echo "Default PORT $PORTX" + else + echo "Default PORT 80" +fi - +mkdir -p /usr/local/apache2/conf/amolhost ## Make Public folder And enable php allow to access makefolder/create file and more -mkdir /home; mkdir /home/www -echo "

It works Apache!

" >> /home/www/index.php +mkdir /home; mkdir /home/www; +#mkdir -p /home/www/filemanager; +mkdir -p /usr/share/amolpanel/; +chmod 755 /usr/share/amolpanel/; +cp -f $SCRIPTPATH/conf/fm.php /usr/share/amolpanel/index.php +cp -f $SCRIPTPATH/conf/fm.inc /usr/share/amolpanel/fm.inc +chmod 644 /usr/share/amolpanel/index.php; +chmod 644 /usr/share/amolpanel/fm.inc; + +cp -f $SCRIPTPATH/conf/ind /home/www//index.php +#echo "" >> /home/www/index.php +#echo "

It works Apache!



File Manager


Change user name password for filemanager edit /home/www/filemanager/index.php
" >> /home/www/index.php #First :We need to set the owner/group of the web root (and any directories/files therein): -chown -R daemon:daemon /home/www +#chown -R daemon:daemon /home/www +chown server:amolhttpd -R /home #Second:We need to setup the proper permissions for users and groups.'go'-'group' and 'other'.rwx-Read,Write,execute chmod go-rwx /home/www/;chmod go+x /home/www/;chgrp -R www-data /home/www/;chmod -R go-rwx /home/www/ chmod -R g+rx /home/www/;chmod -R g+rwx /home/www/ +chown server:amolhttpd -R /home + #Auto Start Apache2 on boot/reboot server #touch /etc/init.d/apache2 #echo -e '#!/bin/bash\n# apache2-Startup script for the Apache HTTP Server\n/usr/local/apache2/bin/apachectl $@' >> /etc/init.d/apache2 -cp -f $SCRIPTPATH/apache2 /etc/init.d/apache2 +cp -f $SCRIPTPATH/conf/apache2 /etc/init.d/apache2 chmod 755 /etc/init.d/apache2 chkconfig --add apache2 chkconfig --list apache2 chkconfig apache2 on systemctl daemon-reload; /etc/init.d/apache2 restart +#https://confluence.atlassian.com/kb/starting-service-on-linux-throws-a-no-such-file-or-directory-error-794203722.html +sed -i -e 's/\r//g' /etc/init.d/apache2 #This issue may occurs on *nix systems , looking for ^M at the end of each line. date +"%r" >> $BUILD;echo "Apache Make Boot script complete start it from webmin.panel Startup and bootup option" >> $BUILD +cp -f $SCRIPTPATH/conf/a /etc/init.d/amol +chmod 755 /etc/init.d/amol +chkconfig --add amol +chkconfig --list amol +chkconfig amol on + +## proftpd quota limit +## $ sudo ftpquota --add-record --type=limit --name=UserName --quota-type=user --bytes-upload=10485760 +## UserName : exist in passwd.vhosts file and 10485760 = 10MB on user UserName +echo -e 'LoadModule mod_quotatab.c\nLoadModule mod_quotatab_file.c\n\nQuotaEngine on\nQuotaLog /var/log/proftpd/quota.log\n#QuotaDefault is not supported on the proftp-version on CentOS 6\nQuotaDefault user false hard 5242880 0 0 0 0 0\nQuotaDisplayUnits Mb\nQuotaOptions ScanOnLogin\nQuotaDirectoryTally off\n\n QuotaLimitTable file:/etc/proftpd/ftpquota.limittab\n QuotaTallyTable file:/etc/proftpd/ftpquota.tallytab\n\n' >> /etc/proftpd.conf + +cp -f $SCRIPTPATH/conf/ftpquota /usr/bin/ +chmod +x /usr/bin/ftpquota +yum -y install perl +cd /etc/proftpd +ftpquota --create-table --type limit +ftpquota --create-table --type tally + + +## awstats update automatically +mkdir -p /etc/awstats/ +cp -f $SCRIPTPATH/conf/awupdate.sh /etc/awstats/update.sh +echo -e '55 23 * * * sh /etc/awstats/update.sh #update awstats' >> /var/spool/cron/root + # sed '/pattern/a some text here\nNewline' filename #sed '/libphp5.so/a # grep PHP set php.ini file declare path\nPHPIniDir /usr/' # sed '/DirectoryIndex /c index.php index.cgi index.pl index.php index.xhtml index.htm ' filename.txt @@ -52,16 +99,54 @@ echo curl -V #OPEN SSL VERSION echo openssl version +#AmolPrograms +mkdir -p /usr/amol/bin +#cp -f $SCRIPTPATH/pgrogram/ftp /usr/amol/bin/addftp +#export PATH="$PATH:/usr/amol/bin" +for filename in $SCRIPTPATH/pprogram/*; do + if [ ! -d "$filename" ]; then # if not directory + # for ((i=0; i<=3; i++)); do + # echo "$filename" "Logs/$(basename "$filename" .txt)_Log$i.txt" + echo "$filename Command Added" + FX=`basename $filename` + echo "Filname-$FX" + cp -f $filename /usr/amol/bin/$FX + chmod 755 -R /usr/amol/bin/$FX + ln -sf /usr/amol/bin/$FX /usr/local/bin + # done + fi +done +#chmod -R +x /usr/amol/bin + + cp -f $SCRIPTPATH/conf/apache.conf /etc/webmin/apache/config cp -f $SCRIPTPATH/conf/httpd.conf /usr/local/apache2/conf/httpd.conf +#disable php 5.6 +sed -i '/LoadModule php5_module/c\#LoadModule php5_module modules/libphp5.so' /usr/local/apache2/conf/httpd.conf +echo -e '\nTraceEnable Off\n' >> /usr/local/apache2/conf/httpd.conf + sed -i "s/host.name.com/$MYHOST/g" /usr/local/apache2/conf/httpd.conf cp -f $SCRIPTPATH/conf/php.ini /usr/local/lib/php.ini + LogFile="" + if[ $AW="true" ] + then + mkdir -p /var/logs/httpd/$element + LogFile="CustomLog /var/logs/httpd/$MAINDOMAIN/aclog.log \"combined\"" + else + LogFile="#CustomLog /var/logs/httpd/$MAINDOMAIN/aclog.log \"combined\"" +fi -echo -e '\nServerName '$MAINDOMAIN'\nServerAlias www.'$MAINDOMAIN'\nDocumentRoot /home/www\nServerAdmin webmaster@djamol.com\n' >> /usr/local/apache2/conf/httpd.conf -echo -e '\nServerName '$MAINDOMAIN'\nServerAlias www.'$MAINDOMAIN'\nDocumentRoot /home/www\n\nSSLEngine on\n SSLCertificateFile /usr/share/ssl/certs/ssl.crt\n SSLCertificateKeyFile /usr/share/ssl/certs/ssl.crt\n \n\n' >> /usr/local/apache2/conf/httpd.conf +echo -e '\nServerName '$MAINDOMAIN'\nServerAlias www.'$MAINDOMAIN'\n'$LogFile'\nDocumentRoot /home/www\nServerAdmin webmaster@djamol.com\n' >> /usr/local/apache2/conf/amolhost/main.conf +echo -e '\nServerName '$MAINDOMAIN'\nServerAlias www.'$MAINDOMAIN'\n'$LogFile'\nDocumentRoot /home/www\n\nSSLEngine on\n SSLCertificateFile /usr/share/ssl/certs/ssl.crt\n SSLCertificateKeyFile /usr/share/ssl/certs/ssl.crt\n \n\n' >> /usr/local/apache2/conf/amolhost/main.conf sed -i '/listen-on port/c\ listen-on port 53 { any; };' /etc/named.conf sed -i '/allow-query/c\ allow-query { any; };' /etc/named.conf +sed -i '/recursion /c\recursion no;\n additional-from-cache no;\n rate-limit {\n responses-per-second 5;\n };' /etc/named.conf + + +echo -e '\n include "/etc/named.main.zones";' >> /etc/named.conf + + touch /etc/named.main.zones; chmod 640 /etc/named.main.zones; chown -R root:named /etc/named.main.zones echo -e 'include "/etc/named.main.zones";' >> /etc/named.conf echo -e '$TTL 14400\n@ 86400 IN SOA ns1.'$MAINDOMAIN'. djamolpatil.gmail.com. (\n 2016033001 ; serial, todays date+todays\n 3600 ; refresh, seconds\n 7200 ; retry, seconds\n 1209600 ; expire, seconds\n 86400 ) ; minimum, seconds\n\nns1.'$MAINDOMAIN'. 86400 IN NS ns1.'$MAINDOMAIN'.\nns1.'$MAINDOMAIN'. 86400 IN NS ns2.'$MAINDOMAIN'.\n\n\nns1.'$MAINDOMAIN'. IN A '$MAINIP'\n\nns1.'$MAINDOMAIN'. IN MX 0 ns1.'$MAINDOMAIN'.\n\nmail IN CNAME ns1.'$MAINDOMAIN'.\nwww IN CNAME ns1.'$MAINDOMAIN'.\nftp IN CNAME ns1.'$MAINDOMAIN'.\n' >> /var/named/ns1.$MAINDOMAIN.db @@ -69,3 +154,12 @@ echo -e '$TTL 14400\n@ 86400 IN SOA ns1.'$MAINDOMAIN'. djamolpatil echo -e '$TTL 14400\n@ 86400 IN SOA ns1.'$MAINDOMAIN'. djamolpatil.gmail.com. (\n 2016033003 ; serial, todays date+todays\n 3600 ; refresh, seconds\n 7200 ; retry, seconds\n 1209600 ; expire, seconds\n 86400 ) ; minimum, seconds\n\n'$MAINDOMAIN'. 86400 IN NS ns1.'$MAINDOMAIN'.\n'$MAINDOMAIN'. 86400 IN NS ns2.'$MAINDOMAIN'.\n\n\n'$MAINDOMAIN'. IN A '$MAINIP'\nmail.'$MAINDOMAIN'. IN A '$MAINIP'\nns1.'$MAINDOMAIN'. IN A '$MAINIP'\nns2.'$MAINDOMAIN'. IN A '$MAINIP'\n'$MAINDOMAIN'. IN MX 5 '$MAINDOMAIN'.\n\n\nwww IN CNAME '$MAINDOMAIN'.\nftp IN CNAME '$MAINDOMAIN'.\nmobile IN CNAME '$MAINDOMAIN'.\nwap IN CNAME '$MAINDOMAIN'.\n' >> /var/named/$MAINDOMAIN.db echo -e 'zone "ns1.'$MAINDOMAIN'" { type master; file "/var/named/ns1.'$MAINDOMAIN'.db";};\nzone "ns2.'$MAINDOMAIN'" { type master; file "/var/named/ns2.'$MAINDOMAIN'.db";};\nzone "'$MAINDOMAIN'" { type master; file "/var/named/'$MAINDOMAIN'.db";};' >> /etc/named.main.zones + +service qmail stop +echo -e '\nTraceEnable Off\n' >> /usr/local/apache2/conf/httpd.conf +# disabled selinux config -Setting up SELinux +sed -i s/^SELINUX=.*$/SELINUX=disabled/ /etc/selinux/config +setenforce 0 + + + diff --git a/inc/mail.sh b/inc/mail.sh index 00cb67c..ce03a20 100644 --- a/inc/mail.sh +++ b/inc/mail.sh @@ -7,7 +7,11 @@ # mail.mobiletel.com. IN A 001.10.011.123 # mail.mobiletel.com. IN MX 5 mail.mobiletel.com. - +## +# POSTFIX LOG check # +#journalctl -u postfix +# for save logs need in the main.cf for postfix -> syslog_name = postfix +## # INSTALL postfix(Mail Service/server) yum -y install postfix sendmail service sendmail start diff --git a/inc/maildove.sh b/inc/maildove.sh new file mode 100644 index 0000000..12b3a61 --- /dev/null +++ b/inc/maildove.sh @@ -0,0 +1,120 @@ +yum install postfix dovecot dovecot-mysql system-switch-mail -y +mkdir -p /backup/postfix +cp -rf /etc/postfix/* /backup/postfix/ +mkdir -p /backup/dovecot +cp -rf /etc/dovecot/*.conf /backup/dovecot/ + +cp $SCRIPTPATH/conf/mail2/mysql* /etc/postfix/ +chown root:postfix /etc/postfix/mysql-virtual_*.cf +chmod 644 /etc/postfix/mysql-virtual_*.cf +groupadd -g 5000 vmail +useradd -g vmail -u 5000 vmail -d /home/vmail -m + +mkdir -p /etc/ssl/private; +mkdir -p /etc/ssl/certs; +#openssl req -new -x509 -days 3650 -nodes -out /etc/ssl/certs/postfix.pem -keyout /etc/ssl/private/postfix.pem +SSLCERt=$(expect -c " +set timeout 35 + spawn openssl req -new -x509 -days 3650 -nodes -out /etc/ssl/certs/postfix2.pem -keyout /etc/ssl/private/postfix2.pem + expect \"Country Name*:\" + send \"$CAC\r\" + expect \"State*:\" + send \"$CAS\r\" + expect \"Locality*:\" + send \"$CAL\r\" + expect \"Organization Name*:\" + send \"$CAO\r\" + expect \"Organizational Unit*:\" + send \"$CAU\r\" + expect \"Common Name*:\" + send \"$mails\r\" + expect \"Email*:\" + send \"$CAM\r\" +expect eof +") +echo "$SSLCERt" + +postconf -e "myhostname = $MAINDOMAIN" +postconf -e "mydestination = localhost, localhost.localdomain, mail.$MAINDOMAIN" +postconf -e 'mynetworks = 127.0.0.0/8' +postconf -e 'inet_interfaces = all' +postconf -e 'message_size_limit = 30720000' +postconf -e 'virtual_alias_domains =' +postconf -e 'smtp_recipient_restrictions =hash:/etc/postfix/recipient_access' +postconf -e 'virtual_alias_maps = proxy:mysql:/etc/postfix/mysql-virtual_forwardings.cf, mysql:/etc/postfix/mysql-virtual_email2email.cf' +postconf -e 'virtual_mailbox_domains = proxy:mysql:/etc/postfix/mysql-virtual_domains.cf' +postconf -e 'virtual_mailbox_maps = proxy:mysql:/etc/postfix/mysql-virtual_mailboxes.cf' +postconf -e 'virtual_mailbox_base = /home/vmail' +postconf -e 'virtual_uid_maps = static:5000' +postconf -e 'virtual_gid_maps = static:5000' +postconf -e 'smtpd_sasl_type = dovecot' +postconf -e 'smtpd_sasl_path = private/auth' +postconf -e 'smtpd_sasl_auth_enable = yes' +postconf -e 'broken_sasl_auth_clients = yes' +postconf -e 'smtpd_sasl_authenticated_header = yes' +postconf -e 'smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination' +postconf -e 'smtpd_use_tls = yes' +postconf -e 'smtpd_tls_cert_file = /etc/ssl/certs/postfix2.pem' +postconf -e 'smtpd_tls_key_file = /etc/ssl/private/postfix2.pem' +postconf -e 'virtual_create_maildirsize = yes' +postconf -e 'virtual_maildir_extended = yes' +postconf -e 'proxy_read_maps = $local_recipient_maps $mydestination $virtual_alias_maps $virtual_alias_domains $virtual_mailbox_maps $virtual_mailbox_domains $relay_recipient_maps $relay_domains $canonical_maps $sender_canonical_maps $recipient_canonical_maps $relocated_maps $transport_maps $mynetworks $virtual_mailbox_limit_maps' +postconf -e 'virtual_transport = dovecot' +postconf -e 'dovecot_destination_recipient_limit = 1' +echo 'dovecot unix - n n - - pipe flags=DRhu user=vmail:vmail argv=/usr/libexec/dovecot/deliver -f ${sender} -d ${recipient}' >> /etc/postfix/master.cf +touch /etc/postfix/recipient_access +echo 'root@localhost REJECT \n root@$MAINDOMAIN REJECT' >> /etc/postfix/recipient_access +chown root:postfix /etc/postfix/recipient_access + + + + +cp $SCRIPTPATH/conf/mail2/dovecot.conf /etc/dovecot/dovecot.conf +cp $SCRIPTPATH/conf/mail2/dovecot-sql.conf /etc/dovecot/dovecot-sql.conf +chgrp dovecot /etc/dovecot/dovecot-sql.conf +chmod o= /etc/dovecot/dovecot-sql.conf + +cp $SCRIPTPATH/conf/mail2/aliases /etc/aliases +chown root:root /etc/aliases +newaliases + + +##mysql -u root -p '' < $BASE_DIR/sql/mail.sql +mysql -u root < $SCRIPTPATH/conf/mail2/mail.sql + +#CREATE DATABASE mail; +#USE mail; + +#GRANT SELECT, INSERT, UPDATE, DELETE ON mail.* TO 'mail_admin'@'localhost' IDENTIFIED BY 'whynotchangeme'; +#GRANT SELECT, INSERT, UPDATE, DELETE ON mail.* TO 'mail_admin'@'localhost.localdomain' IDENTIFIED BY 'whynotchangeme'; +#FLUSH PRIVILEGES; + +#CREATE TABLE domains (domain varchar(50) NOT NULL, PRIMARY KEY (domain) ); +#CREATE TABLE forwardings (source varchar(80) NOT NULL, destination TEXT NOT NULL, PRIMARY KEY (source) ); +#CREATE TABLE users (email varchar(80) NOT NULL, password varchar(20) NOT NULL, PRIMARY KEY (email) ); +#CREATE TABLE transport ( domain varchar(128) NOT NULL default '', transport varchar(128) NOT NULL default '', UNIQUE KEY domain (domain) ); +#USE mail; +#INSERT INTO domains (domain) VALUES ('woho.co.in'); +#INSERT INTO users (email, password) VALUES ('amol@woho.co.in', ENCRYPT('amol')); +postmap /etc/postfix/recipient_access +postmap -q $MAINDOMAIN mysql:/etc/postfix/mysql-virtual_domains.cf +postmap -q amol@MAINDOMAIN mysql:/etc/postfix/mysql-virtual_mailboxes.cf +echo "And Please Create MX Entry in Your Domain DNS: \n +Example : +mail.$MAINDOMAIN. IN A $MAINIP +mail.$MAINDOMAIN. IN MX 5 mail.$MAINDOMAIN. +Another Domain (Entry) +anotherdomain.com IN MX 5 mail.$MAINDOMAIN. +google.com IN MX 5 mail.$MAINDOMAIN. +yahoo.com IN MX 5 mail.$MAINDOMAIN. +And run below commands +postmap -q example.com mysql:/etc/postfix/mysql-virtual_domains.cf +postmap -q amol@example.com mysql:/etc/postfix/mysql-virtual_mailboxes.cf +postmap -q admin@example.com mysql:/etc/postfix/mysql-virtual_forwardings.cf; +service postfix reload +" +chown vmail:vmail -R /home/vmail + +service postfix restart +service dovecot restart + diff --git a/inc/mysql.sh b/inc/mysql.sh index 4e934c1..7033c28 100644 --- a/inc/mysql.sh +++ b/inc/mysql.sh @@ -6,22 +6,53 @@ cd $SCRIPTPATH/src +#if [ $OSN = "debian" ] +# then + + # # Mysql / Mariadb Installation -touch /etc/yum.repos.d/MariaDB.repo -echo -e '[mariadb]\nname = MariaDB\nbaseurl = http://yum.mariadb.org/10.2/rhel7-amd64\ngpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB\ngpgcheck=1' >> /etc/yum.repos.d/MariaDB.repo -yum -y list|grep MariaDB-server -rpm --import https://yum.mariadb.org/RPM-GPG-KEY-MariaDB +#touch /etc/yum.repos.d/MariaDB.repo +#echo -e "[mariadb]\nname = MariaDB\nbaseurl = http://yum.mariadb.org/10.2/rhel$OSV-amd64\ngpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB\ngpgcheck=1" >> /etc/yum.repos.d/MariaDB.repo +#yum -y list|grep MariaDB-server +#rpm --import https://yum.mariadb.org/RPM-GPG-KEY-MariaDB +curl -sS https://downloads.mariadb.com/MariaDB/mariadb_repo_setup | sudo bash +yum install -y mariadb-server if yum -y install MariaDB-server MariaDB-client MariaDB-devel MariaDB-shared; then echo -e "\033[33;32m extract MariaDB Success";date +"%r" >> $BUILD;echo "Success : Install MariaDB" >> $BUILD yum -y remove postfix else -echo -e "\033[33;31m extract MariaDB Failed";date +"%r" >> $BUILD;echo "Failed : Install MariadB" >> $BUILD +echo -e "\033[33;31m extract MariaDB Failed";date +"%r" >> $BUILD;echo "Failed : Install MariadB" >> $BUILD; +fi +if mysql -V; then +echo -e "\033[33;32m Mariadb is Installed"; +else +yum -y install mariadb-*; +fi + +yum -y install expect + + +# else +# echo "Debian MariaDB ";date +"%r" >> $BUILD; +# apt-get install expect mariadb-* +# curl -LsS -O https://downloads.mariadb.com/MariaDB/mariadb_repo_setup +# bash mariadb_repo_setup --mariadb-server-version=10.6 +# sudo apt-get update +# sudo apt-get install mariadb-server mariadb-client mariadb-devel mariadb-shared +# echo "Status : OK Debian-Maria DB" >> $BUILD +#fi + + +if mysql -V; then +echo -e "\033[33;32m Mariadb is Installed"; +else +echo -e "\033[33;32m Mariadb is Failed";echo "Failed : Install MariadB" >> $FAILBUILD fi + systemctl start mysql.service ##mysql_secure_installation ## MYSQL SECURE INSTALLATION Start -yum -y install expect # Not required in actual script diff --git a/inc/nginx.sh b/inc/nginx.sh new file mode 100644 index 0000000..f565e86 --- /dev/null +++ b/inc/nginx.sh @@ -0,0 +1,190 @@ +##[ "$jemalloc_install" = "y" ] && COMMAND="--with-ld-opt='-ljemalloc'" +##[ ! -s $SRC_DIR/nginx-1.6.0.tar.gz ] && wget -c http://nginx.org/download/nginx-1.6.0.tar.gz -O $SRC_DIR/nginx-1.6.0.tar.gz +#wget http://nginx.org/download/nginx-1.6.0.tar.gz -O nginx-1.6.0.tar.gz +cd $SCRIPTPATH/src/openlite + +## REquired +yum -y install openssl-devel +adduser --no-create-home --system --user-group --shell /bin/false www + + +##REQUIRED +FILE=jemalloc-3.6.0.tar.bz2 +if [ ! -f $FILE ] +then + echo -e "\033[33;34m file " $FILE " does not exist."; + if wget https://github.com/djamol/centos-INSTALLER/raw/master/src/openlite/jemalloc-3.6.0.tar.bz2 -O $FILE; then + echo -e "\033[33;32m jemalloc download Success";date +"%r" >> $BUILD;echo "Success : File Download $FILE" >> $BUILD + else + echo -e "\033[33;31m jemalloc download Failed";date +"%r" >> $BUILD;echo "Failed : File Download $FILE" >> $BUILD + echo "Failed : File Download $FILE" >> $FAILBUILD + fi +else + echo -e "\033[33;32m file " $FILE " exists.";date +"%r" >> $BUILD;echo "Status : Already Exist $FILE" >> $BUILD +fi +tar xjf jemalloc-3.6.0.tar.bz2 +cd jemalloc* +./configure +cpu_num=`cat /proc/cpuinfo | grep processor | wc -l` +make -j $cpu_num +make install +echo '/usr/local/lib' > /etc/ld.so.conf.d/local.conf +ldconfig + + +COMMAND="--with-ld-opt='-ljemalloc'" + +cd $SCRIPTPATH/src/openlite + +FILE=nginx.tar.gz +if [ ! -f $FILE ] +then + echo -e "\033[33;34m file " $FILE " does not exist."; + if wget https://github.com/djamol/centos-INSTALLER/raw/master/src/openlite/nginx-1.9.9.tar.gz -O $FILE; then + echo -e "\033[33;32m nginx download Success";date +"%r" >> $BUILD;echo "Success : File Download $FILE" >> $BUILD + else + echo -e "\033[33;31m nginx download Failed";date +"%r" >> $BUILD;echo "Failed : File Download $FILE" >> $BUILD + echo "Failed : File Download $FILE" >> $FAILBUILD + fi +else + echo -e "\033[33;32m file " $FILE " exists.";date +"%r" >> $BUILD;echo "Status : Already Exist $FILE" >> $BUILD +fi +if tar -zxf $FILE; then +echo -e "\033[33;32m extract nginx Success";date +"%r" >> $BUILD;echo "Success : Extract $FILE" >> $BUILD +else +echo -e "\033[33;31m extract nginx Failed"date +"%r" >> $BUILD;echo "Failed : Extract $FILE" >> $BUILD +echo "Failed : File Download $FILE" >> $FAILBUILD +fi +cd nginx-* + +sed -i 's@CFLAGS="$CFLAGS -g"@#CFLAGS="$CFLAGS -g"@' auto/cc/gcc + +./configure --user=www --group=www --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module --with-http_gzip_static_module $COMMAND + +make && make install + +mkdir -p /home/wwwlogs/nginx /usr/local/nginx/conf/vhost +rm -f /usr/local/nginx/conf/nginx.conf + +cat > /usr/local/nginx/conf/nginx.conf < /usr/local/nginx/conf/proxy.conf < /usr/local/nginx/conf/vhost/default.conf <> /etc/opendkim.conf +echo "AutoRestartRate 10/1h" >> /etc/opendkim.conf +echo "SignatureAlgorithm rsa-sha256" >> /etc/opendkim.conf +echo "TemporaryDirectory /var/tmp" >> /etc/opendkim.conf +sed -i "s|^Mode.*|Mode sv|" /etc/opendkim.conf +sed -i "s|^Canonicalization.*|Canonicalization relaxed/simple|" /etc/opendkim.conf +sed -i "s|^# ExternalIgnoreList|ExternalIgnoreList|" /etc/opendkim.conf +sed -i "s|^# InternalHosts|InternalHosts|" /etc/opendkim.conf +sed -i 's|^# KeyTable|KeyTable|' /etc/opendkim.conf +sed -i "s|^# SigningTable|SigningTable|" /etc/opendkim.conf +sed -i "s|Umask.*|Umask 022|" /etc/opendkim.conf +fi + +#echo "AutoRestart Yes" >> /etc/opendkim.conf +#echo "AutoRestartRate 10/1h" >> /etc/opendkim.conf +#echo "UMask 002" >> /etc/opendkim.conf +#echo "Syslog yes" >> /etc/opendkim.conf +#echo "SyslogSuccess Yes" >> /etc/opendkim.conf +#echo "LogWhy Yes" >> /etc/opendkim.conf +#echo "Canonicalization relaxed/simple" >> /etc/opendkim.conf +#echo "ExternalIgnoreList refile:/etc/opendkim/TrustedHosts" >> /etc/opendkim.conf +#echo "InternalHosts refile:/etc/opendkim/TrustedHosts" >> /etc/opendkim.conf +#echo "KeyTable refile:/etc/opendkim/KeyTable" >> /etc/opendkim.conf +#echo "SigningTable refile:/etc/opendkim/SigningTable" >> /etc/opendkim.conf +#echo "Mode sv" >> /etc/opendkim.conf +#echo "PidFile /var/run/opendkim/opendkim.pid" >> /etc/opendkim.conf +#echo "SignatureAlgorithm rsa-sha256" >> /etc/opendkim.conf +#echo "UserID opendkim:opendkim" >> /etc/opendkim.conf +#echo "Socket inet:12301@localhost" >> /etc/opendkim.conf + +#cat >> /etc/opendkim/SigningTable <> TrustedHosts <> /etc/opendkim/SigningTable +echo -e '$MAINDOMAIN $MAINDOMAIN:default:/etc/opendkim/keys/$MAINDOMAIN/default.private' >> /etc/opendkim/KeyTable +echo "127.0.0.1" > /etc/opendkim/TrustedHosts +echo "localhost" >> /etc/opendkim/TrustedHosts +echo -e '*.$MAINDOMAIN' >> /etc/opendkim/TrustedHosts +chown opendkim:opendkim /etc/opendkim/keys/ -R + +systemctl start opendkim +systemctl enable opendkim + +## POSTFIX WITH Opendkim +cat >> /etc/postfix/main.cf <<'EOF' +#smtpd_milters setting +smtpd_milters = inet:127.0.0.1:8891 +non_smtpd_milters = $smtpd_milters +milter_protocol = 2 +milter_default_action = accept +EOF + +systemctl restart postfix + +echo "Success : ADD TXT Record $MAINDOMAIN \n " >> $BUILD + +cat /etc/opendkim/keys/$MAINDOMAIN/default.txt >> $BUILD + +postmap -q domain.com mysql:/etc/postfix/mysql-virtual_domains.cf +postmap -q amol@domain.com mysql:/etc/postfix/mysql-virtual_mailboxes.cf +service postfix reload +echo "+++++++++++++++++ opendkim ended +++++++++\n "; +echo "Success : opendkim\n " >> $BUILD diff --git a/inc/openlitespeed/OpenLite-master.zip b/inc/openlitespeed/OpenLite-master.zip new file mode 100644 index 0000000..8691951 Binary files /dev/null and b/inc/openlitespeed/OpenLite-master.zip differ diff --git a/inc/openlitespeed/README.md b/inc/openlitespeed/README.md new file mode 100644 index 0000000..1841092 --- /dev/null +++ b/inc/openlitespeed/README.md @@ -0,0 +1,12 @@ +# OpenLite + + + + + + +yum -y install wget unzip;wget --no-check-certificate -O installer.zip https://github.com/djamol/OpenLite/archive/master.zip; unzip installer.zip; cd OpenLite-master;chmod +x hostadd;;chmod +x shell/*.sh;chmod +x lsws.sh;./lsws.sh + + + +./lsws.sh & + + + + LLNMP一键安装包 by djamol.com + + + +
+

LLNMP

+
+
+ +
+ + + diff --git a/inc/openlitespeed/conf/llnmp.jpg b/inc/openlitespeed/conf/llnmp.jpg new file mode 100644 index 0000000..0688ea7 Binary files /dev/null and b/inc/openlitespeed/conf/llnmp.jpg differ diff --git a/inc/openlitespeed/conf/memcached-centos b/inc/openlitespeed/conf/memcached-centos new file mode 100644 index 0000000..1b7a0d3 --- /dev/null +++ b/inc/openlitespeed/conf/memcached-centos @@ -0,0 +1,107 @@ +#!/bin/sh +# +# chkconfig: - 55 45 +# description: The memcached daemon is a network memory cache service. +# processname: memcached +# config: /etc/sysconfig/memcached +# pidfile: /var/run/memcached/memcached.*.pid + +# Source function library. +. /etc/init.d/functions + +PORT=11211 +USER=memcached +MAXCONN=1024 +OPTIONS="" + +if [ -f /etc/sysconfig/memcached ];then + . /etc/sysconfig/memcached +fi + +# Check that networking is up. +. /etc/sysconfig/network + +if [ "$NETWORKING" = "no" ] +then + exit 0 +fi + +RETVAL=0 +prog="/usr/local/memcached/bin/memcached" + +start_instance() { + echo -n $"Starting $prog ($1): " + daemon --pidfile /var/run/memcached/memcached.$1.pid memcached -d -p $PORT -u $USER -m $2 -c $MAXCONN -P /var/run/memcached/memcached.$1.pid $OPTIONS + RETVAL=$? + echo + [ $RETVAL -eq 0 ] && touch /var/lock/subsys/memcached.$1 + PORT=`expr $PORT + 1` +} + +stop_instance() { + echo -n $"Stopping $prog ($1): " + killproc -p /var/run/memcached/memcached.$1.pid /usr/bin/memcached + RETVAL=$? + echo + if [ $RETVAL -eq 0 ] ; then + rm -f /var/lock/subsys/memcached.$1 + rm -f /var/run/memcached.$1.pid + fi +} + +start () { + # insure that /var/run/memcached has proper permissions + mkdir -p /var/run/memcached + if [ "`stat -c %U /var/run/memcached`" != "$USER" ]; then + chown $USER /var/run/memcached + fi + + start_instance default 64; + #start_instance block 16; + #start_instance content 128; + #start_instance filter 128; + #start_instance form 32; + #start_instance menu 16; + #start_instance page 8; + #start_instance update 8; + #start_instance views 8; +} +stop () { + stop_instance default; + #stop_instance block; + #stop_instance content; + #stop_instance filter; + #stop_instance form; + #stop_instance menu; + #stop_instance page; + #stop_instance update; + #stop_instance views; +} + +restart () { + stop + start +} + + +# See how we were called. +case "$1" in + start) + start + ;; + stop) + stop + ;; + status) + status memcached + ;; + restart|reload|force-reload) + restart + ;; + *) + echo $"Usage: $0 {start|stop|status|restart|reload|force-reload}" + exit 1 +esac + +exit $? + diff --git a/inc/openlitespeed/conf/memcached-debian b/inc/openlitespeed/conf/memcached-debian new file mode 100644 index 0000000..6c6241d --- /dev/null +++ b/inc/openlitespeed/conf/memcached-debian @@ -0,0 +1,86 @@ +#! /bin/sh +# + +PORT=11211 +USER=memcached +MAXCONN=1024 +OPTIONS="" +DAEMON=/usr/local/memcached/bin/memcached + +RETVAL=0 +prog="/usr/local/memcached/bin/memcached" + +start_instance() { + echo -n $"Starting $prog ($1): " + start-stop-daemon --start --quiet --pidfile /var/run/memcached/memcached.$1.pid --exec $DAEMON -- -d -p $PORT -u $USER -m $2 -c $MAXCONN -P /var/run/memcached/memcached.$1.pid $OPTIONS + RETVAL=$? + echo + [ $RETVAL -eq 0 ] && touch /var/lock/memcached.$1 + PORT=`expr $PORT + 1` +} + +stop_instance() { + echo -n $"Stopping $prog ($1): " + start-stop-daemon --stop --quiet --oknodo --pidfile /var/run/memcached/memcached.$1.pid --exec $DAEMON + RETVAL=$? + echo + if [ $RETVAL -eq 0 ] ; then + rm -f /var/lock/memcached.$1 + rm -f /var/run/memcached/memcached.$1.pid + fi +} +start () { + # insure that /var/run/memcached has proper permissions + mkdir -p /var/run/memcached + if [ "`stat -c %U /var/run/memcached`" != "$USER" ]; then + chown $USER /var/run/memcached + fi + + start_instance default 64; + #start_instance block 16; + #start_instance content 128; + #start_instance filter 128; + #start_instance form 32; + #start_instance menu 16; + #start_instance page 8; + #start_instance update 8; + #start_instance views 8; +} +stop () { + stop_instance default; + #stop_instance block; + #stop_instance content; + #stop_instance filter; + #stop_instance form; + #stop_instance menu; + #stop_instance page; + #stop_instance update; + #stop_instance views; +} + +restart () { + stop + start +} + +# See how we were called. +case "$1" in + start) + start + ;; + stop) + stop + ;; + status) + status memcached + ;; + restart|reload|force-reload) + restart + ;; + *) + echo $"Usage: $0 {start|stop|status|restart|reload|force-reload}" + exit 1 +esac + +exit $? + diff --git a/inc/openlitespeed/conf/memcached.php b/inc/openlitespeed/conf/memcached.php new file mode 100644 index 0000000..a7d485f --- /dev/null +++ b/inc/openlitespeed/conf/memcached.php @@ -0,0 +1,863 @@ + | + +----------------------------------------------------------------------+ +*/ + +$VERSION='$Id: memcache.php,v 1.1.2.3 2008/08/28 18:07:54 mikl Exp $'; + +define('DATE_FORMAT','Y/m/d H:i:s'); +define('GRAPH_SIZE',200); +define('MAX_ITEM_DUMP',50); + +$MEMCACHE_SERVERS[] = 'localhost:11211'; // add more as an array + + +////////// END OF DEFAULT CONFIG AREA ///////////////////////////////////////////////////////////// + +///////////MEMCACHE FUNCTIONS ///////////////////////////////////////////////////////////////////// + +function sendMemcacheCommands($command){ + global $MEMCACHE_SERVERS; + $result = array(); + + foreach($MEMCACHE_SERVERS as $server){ + $strs = explode(':',$server); + $host = $strs[0]; + $port = $strs[1]; + $result[$server] = sendMemcacheCommand($host,$port,$command); + } + return $result; +} +function sendMemcacheCommand($server,$port,$command){ + + $s = @fsockopen($server,$port); + if (!$s){ + die("Cant connect to:".$server.':'.$port); + } + + fwrite($s, $command."\r\n"); + + $buf=''; + while ((!feof($s))) { + $buf .= fgets($s, 256); + if (strpos($buf,"END\r\n")!==false){ // stat says end + break; + } + if (strpos($buf,"DELETED\r\n")!==false || strpos($buf,"NOT_FOUND\r\n")!==false){ // delete says these + break; + } + if (strpos($buf,"OK\r\n")!==false){ // flush_all says ok + break; + } + } + fclose($s); + return parseMemcacheResults($buf); +} +function parseMemcacheResults($str){ + + $res = array(); + $lines = explode("\r\n",$str); + $cnt = count($lines); + for($i=0; $i< $cnt; $i++){ + $line = $lines[$i]; + $l = explode(' ',$line,3); + if (count($l)==3){ + $res[$l[0]][$l[1]]=$l[2]; + if ($l[0]=='VALUE'){ // next line is the value + $res[$l[0]][$l[1]] = array(); + list ($flag,$size)=explode(' ',$l[2]); + $res[$l[0]][$l[1]]['stat']=array('flag'=>$flag,'size'=>$size); + $res[$l[0]][$l[1]]['value']=$lines[++$i]; + } + }elseif($line=='DELETED' || $line=='NOT_FOUND' || $line=='OK'){ + return $line; + } + } + return $res; + +} + +function dumpCacheSlab($server,$slabId,$limit){ + list($host,$port) = explode(':',$server); + $resp = sendMemcacheCommand($host,$port,'stats cachedump '.$slabId.' '.$limit); + + return $resp; + +} + +function flushServer($server){ + list($host,$port) = explode(':',$server); + $resp = sendMemcacheCommand($host,$port,'flush_all'); + return $resp; +} +function getCacheItems(){ + $items = sendMemcacheCommands('stats items'); + $serverItems = array(); + $totalItems = array(); + foreach ($items as $server=>$itemlist){ + $serverItems[$server] = array(); + $totalItems[$server]=0; + if (!isset($itemlist['STAT'])){ + continue; + } + + $iteminfo = $itemlist['STAT']; + + foreach($iteminfo as $keyinfo=>$value){ + if (preg_match('/items\:(\d+?)\:(.+?)$/',$keyinfo,$matches)){ + $serverItems[$server][$matches[1]][$matches[2]] = $value; + if ($matches[2]=='number'){ + $totalItems[$server] +=$value; + } + } + } + } + return array('items'=>$serverItems,'counts'=>$totalItems); +} +function getMemcacheStats($total=true){ + $resp = sendMemcacheCommands('stats'); + if ($total){ + $res = array(); + foreach($resp as $server=>$r){ + foreach($r['STAT'] as $key=>$row){ + if (!isset($res[$key])){ + $res[$key]=null; + } + switch ($key){ + case 'pid': + $res['pid'][$server]=$row; + break; + case 'uptime': + $res['uptime'][$server]=$row; + break; + case 'time': + $res['time'][$server]=$row; + break; + case 'version': + $res['version'][$server]=$row; + break; + case 'pointer_size': + $res['pointer_size'][$server]=$row; + break; + case 'rusage_user': + $res['rusage_user'][$server]=$row; + break; + case 'rusage_system': + $res['rusage_system'][$server]=$row; + break; + case 'curr_items': + $res['curr_items']+=$row; + break; + case 'total_items': + $res['total_items']+=$row; + break; + case 'bytes': + $res['bytes']+=$row; + break; + case 'curr_connections': + $res['curr_connections']+=$row; + break; + case 'total_connections': + $res['total_connections']+=$row; + break; + case 'connection_structures': + $res['connection_structures']+=$row; + break; + case 'cmd_get': + $res['cmd_get']+=$row; + break; + case 'cmd_set': + $res['cmd_set']+=$row; + break; + case 'get_hits': + $res['get_hits']+=$row; + break; + case 'get_misses': + $res['get_misses']+=$row; + break; + case 'evictions': + $res['evictions']+=$row; + break; + case 'bytes_read': + $res['bytes_read']+=$row; + break; + case 'bytes_written': + $res['bytes_written']+=$row; + break; + case 'limit_maxbytes': + $res['limit_maxbytes']+=$row; + break; + case 'threads': + $res['rusage_system'][$server]=$row; + break; + } + } + } + return $res; + } + return $resp; +} + +////////////////////////////////////////////////////// + +// +// don't cache this page +// +header("Cache-Control: no-store, no-cache, must-revalidate"); // HTTP/1.1 +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); // HTTP/1.0 + +function duration($ts) { + global $time; + $years = (int)((($time - $ts)/(7*86400))/52.177457); + $rem = (int)(($time-$ts)-($years * 52.177457 * 7 * 86400)); + $weeks = (int)(($rem)/(7*86400)); + $days = (int)(($rem)/86400) - $weeks*7; + $hours = (int)(($rem)/3600) - $days*24 - $weeks*7*24; + $mins = (int)(($rem)/60) - $hours*60 - $days*24*60 - $weeks*7*24*60; + $str = ''; + if($years==1) $str .= "$years year, "; + if($years>1) $str .= "$years years, "; + if($weeks==1) $str .= "$weeks week, "; + if($weeks>1) $str .= "$weeks weeks, "; + if($days==1) $str .= "$days day,"; + if($days>1) $str .= "$days days,"; + if($hours == 1) $str .= " $hours hour and"; + if($hours>1) $str .= " $hours hours and"; + if($mins == 1) $str .= " 1 minute"; + else $str .= " $mins minutes"; + return $str; +} + +// create graphics +// +function graphics_avail() { + return extension_loaded('gd'); +} + +function bsize($s) { + foreach (array('','K','M','G') as $i => $k) { + if ($s < 1024) break; + $s/=1024; + } + return sprintf("%5.1f %sBytes",$s,$k); +} + +// create menu entry +function menu_entry($ob,$title) { + global $PHP_SELF; + if ($ob==$_GET['op']){ + return "
  • $title
  • "; + } + return "
  • $title
  • "; +} + +function getHeader(){ + $header = << + +MEMCACHE INFO + + + +
    +

    + + memcache.php by Harun Yayli +

    +
    +
    +
    +EOB; + + return $header; +} +function getFooter(){ + global $VERSION; + $footer = '
    + +'; + + return $footer; + +} +function getMenu(){ + global $PHP_SELF; +echo "