Skip to main content

Posts

Showing posts from August, 2015

Comodo CWAF

cd /usr/src rm -rf /usr/src/comodo*  DOwnload  https://docs.google.com/uc?export=download&id=0B_Z7t7PO4imFMU1mVG52c3VGM0k tar xvzf comodobr.tar.gz cp -pa comodo/cwaf_catalog.cgi /usr/local/cpanel/whostmgr/cgi cp -pa comodo/addon_cwaf.cgi /usr/local/cpanel/whostmgr/cgi cp -pa comodo/cwaf /usr/local/cpanel/whostmgr/cgi cp -pa comodo/cwaf_sharedlib.pl /usr/local/cpanel/whostmgr/cgi cp -pa comodo/addon_cwaf.conf /var/cpanel/apps cp -pa comodo/cwaf_var/cwaf /var/cpanel cp -pa comodo/perl5 /opt/cpanel/ /usr/local/cpanel/bin/register_appconfig /var/cpanel/apps/addon_cwaf.conf rm -rf /var/cpanel/cwaf/rules/modsec_nagios.conf mv /usr/local/apache/conf/modsec2.conf /usr/local/apache/conf/modsec2.conf.$(date +%d-%m-%y) rm -rf modsec2.conf Download and update  https://docs.google.com/uc?export=download&id=0B_Z7t7PO4imFSEI5WDFWTHg4eGs yes | mv /usr/local/apache/conf/modsec2.user.conf /usr/local/apache/conf/modsec2.user.conf.`date +%h-%d-%y-%s` DOwnload  https://docs

SOFTACULOUS BACKUP DISABLE

#!/bin/bash if [  -f /tmp/testsoftaculous99999.txt ]; then exit 0 fi sed -i '/disable_backup_restore/ s/...$/ 1;/g' /usr/local/cpanel/whostmgr/cgi/softaculous/enduser/universal.php sed -i '/disable_auto_backup/ s/...$/ 1;/g' /usr/local/cpanel/whostmgr/cgi/softaculous/enduser/universal.php sed -i '/auto_backup_limit/ s/...$/ 1;/g' /usr/local/cpanel/whostmgr/cgi/softaculous/enduser/universal.php sed -i '/max_backups/ s/...$/ 1;/g' /usr/local/cpanel/whostmgr/cgi/softaculous/enduser/universal.php /usr/local/cpanel/bin/cpuwatch 10 find /home/*/ -maxdepth 2 -type d -iname "softaculous_backups" -exec rm -rvf "{}" \; touch /tmp/testsoftaculous99999.txt

Hardening Linux

SQL INJECTION USING SQLMAP =============================== python sqlmap.py -u "http://www.site.com/section.php?id=51" Discover db  python sqlmap.py -u "http://www.sitemap.com/section.php?id=51" --dbs Discover tble python sqlmap.py -u "http://www.site.com/section.php?id=51" --tables -D database name Get coloumns of table python sqlmap.py -u "http://www.site.com/section.php?id=51" --columns -D database -T tablename Get data from table $ python sqlmap.py -u "http://www.site.com/section.php?id=51" --dump -D database -T tablename NMAP ========= nmap -sS 192.168.0.101 --perform stealthy scan nmap -PS -p 22,80 192.168.0.101--scan specific ports nmap -sV--find host service version number nmap -PN 192.168.0.101 --- Scan a Host to check its protected by Firewall Lynis ++++++++ yum install git cd /usr/src && git clone https://github.com/CISOfy/lynis.git cd /usr/src/lynis/  ./lynis audit system -Q  TCP SYN Flood Protection net.ipv4.tcp_sy

cPanel backup

#!/bin/sh monthdate=`date +%d` todatemysql=`date '+%y%m%d'` yestermonthmysql=`date -d '1 day ago' '+%y%m%d'` nowdcpaccess=`date '+%m\/%d\/%Y'` yesterdcpaccess=`date -d '1 day ago'  '+%m\/%d\/%Y'` nowdaperror=`date '+%a %b %d'` yesterdaperror=`date -d '1 day ago' '+%a %b %d'` nowdmessages=`date '+%b %d'` yesterdmessages=`date -d '1 day ago' '+%b %d'` nowdmail=`date '+%Y-%m-%d'` yesterdmail=`date -d '1 day ago' '+%Y-%m-%d'` mkdir /root/govrequest/$monthdate for i in `cat /root/govrequest/accounts`; do touch /root/govrequest/$monthdate/$i.cpanel.log touch /root/govrequest/$monthdate/$i.apache.log touch /root/govrequest/$monthdate/$i.messages.log touch /root/govrequest/$monthdate/$i.mail.log #monthly cpbackup pkgrund=`date +%d` if [ "$pkgrund" -eq "27" ] || [ "$pkgrund" -eq "30" ];then mkdir /root/govrequest/$monthdate.cpbackup /sc

Docker PROJECT KIMCHID installation

DOcker set up on kvm 1) check the system support KVM virtualization grep -Ei "svm|vmx" /proc/cpuinfo --color  modprobe kvm modprobe kvm_intel If the cpu is intel and not amd 2) install ml elrepo kernel rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org rpm -Uvh http://www.elrepo.org/elrepo-release-6-6.el6.elrepo.noarch.rpm yum --enablerepo=elrepo-kernel install kernel-ml echo "savedefault --default=0 --once" | grub --batch 3)yum install pyflakes python-pep8 python-requests  yum install python-unittest2 python-ordereddict yum install gcc make autoconf automake gettext-devel git python-cherrypy python-cheetah libvirt-python libvirt libvirt-daemon-config-network python-imaging  PyPAM m2crypto python-jsonschema rpm-build qemu-kvm python-psutil python-ethtool sos python-ipaddr python-ldap python-lxml nfs-utils iscsi-initiator-utils libxslt pyparted nginx  python-libguestfs libguestfs-tools python-websockify novnc spice-html5 python-configobj 4)service libvirtd r

Permission concept in LINUX

Umask =========== - Configuring Default File / Directory Permissions When a user creates a file, how does the system determine that file's initial permissions? This is done based on the user's umask value. The umask value specifies which permissions are not to be set. In Ubuntu, the default umask value for a normal user is 002, while the default for root is 022. You can find out the current umask value (or set it) using the umask command. If (as a normal user) you run the command: umask You'll see something like 0002 displayed, however octal numbers are preceded by a 0 (in the same way hex would be preceded by 0x), so the umask value itself is actually 002. This value is an octal (base 8, digits 0-7) value which is subtracted from a base value of 777 for directories, or subtracted from a base value of 666 for files. A umask of 002 basically means don't remove any permissions from the base value for "user" or "group", but "other" is not a

Mysql master slave replication

I needed to replicate my nagios server for disaster recovery. The database was "db_nagiosql_v32"  On My main server which is master I had, Make sure to create log file and director if doesnot exist , also mysql ownership [root@nagios ~]# cat /etc/my.cnf [mysqld] server-id= 1 log_bin= /var/log/mysql/mysql-bin.log binlog_do_db = db_nagiosql_v32 Restart the mysql /etc/init.d/nagios  restart Stopping mysqld:                                           [  OK  ] Starting mysqld:                                           [  OK  ] Enter in to mysql prompt GRANT REPLICATION SLAVE ON *.* TO 'replicant'@'%' IDENTIFIED BY 'password'; mysql> FLUSH PRIVILEGES; mysql> USE db_nagiosql_v32 mysql> FLUSH TABLES WITH READ LOCK; Dump the database and scp to the destination server mysql> UNLOCK TABLES;  mysql> SHOW MASTER STATUS; +------------------+----------+-----------------+------------------+ | File             | Position | Binlog_Do