Friday, October 3, 2014
Changing qpidd to rabbitmq for Openstack
Monday, September 29, 2014
Configure HA using Corosync and pacemaker
/etc/sysconfig/iptables. Towards the end of the file, but before any REJECT statements, we add the following lines:
-A INPUT -p udp -m state --state NEW -m multiport --dports 5404,5405 -j ACCEPT
-A INPUT -m tcp -p tcp --dport 7788 -j ACCEPT
-A INPUT -m tcp -p tcp --dport 3306 -j ACCEPT
Installing modules
yum -y install wget
rpm -Uvh http://elrepo.org/elrepo-release-6-5.el6.elrepo.noarch.rpm
yum -y install drbd84-utils kmod-drbd84 --enablerepo=elrepo
yum -y install pacemaker corosync cluster-glue
wget -P /etc/yum.repos.d/ http://download.opensuse.org/repositories/network:/ha-clustering:/Stable/CentOS_CentOS-6/network:ha-clustering:Stable.repo
yum install crmsh
Configure Corosync
vi /etc/corosync/corosync.conf
totem {
version: 2
secauth: off
threads: 0
interface {
ringnumber: 0
bindnetaddr: 10.0.0.0
mcastaddr: 226.94.1.1
mcastport: 5405
ttl: 1
}
}
logging {
fileline: off
to_stderr: no
to_logfile: yes
to_syslog: yes
logfile: /var/log/cluster/corosync.log
debug: off
timestamp: on
logger_subsys {
subsys: AMF
debug: off
}
}
amf {
mode: disabled
}
service {
# Load the Pacemaker Cluster Resource Manager
ver: 1
name: pacemaker
}
aisexec {
user: root
group: root
}
chkconfig --level 3 corosync on
service corosync start
chkconfig --level 3 pacemaker on
service pacemaker start
Checking the Cluster Connectivity
corosync-objctl runtime.totem.pg.mrp.srp.members
Check the service and cluster status
crm_mon -1
Configuring the cluster
>>crm configure
property no-quorum-policy="ignore" pe-warn-series-max="1000" pe-input-series-max="1000" pe-error-series-max="1000" cluster-recheck-interval="5min"
property stonith-enabled=false
commit
Adding a Cluster server for common IP (VIP)
>>crm configure
primitive p_api-ip ocf:heartbeat:IPaddr2 params ip="10.0.0.199" cidr_netmask="24" op monitor interval="30s"
commit
Now we need to configure the needed services in the CRM.
Thursday, September 25, 2014
Checking loadspeed of a Site Using phantomjs
Installing the module
sudo yum install fontconfig freetype libfreetype.so.6 libfontconfig.so.1 libstdc++.so.6
tar jxvf phantomjs-1.9.7-linux-i686.tar.bz2
mv phantomjs-1.9.7-linux-x86_64 phantomjs
Basic examples
- arguments.js shows the arguments passed to the script
- countdown.js prints a 10 second countdown
- echoToFile.js writes the command line arguments to a file
- fibo.js lists the first few numbers in the Fibonacci sequence
- hello.js displays the famous message
- module.js and
universe.js
demonstrate the use of module system - outputEncoding.js displays a string in various encodings
- printenv.js displays the system's environment variables
- scandir.js lists all files in a directory and its subdirectories
- sleepsort.js sorts integers and delays display depending on their values
- version.js prints out PhantomJS version number
- page_events.js prints out page events firing: useful to better grasp
page.on*
callbacks
Rendering/rasterization
- colorwheel.js creates a color wheel using HTML5 canvas
- rasterize.js rasterizes a web page to image or PDF
- rendermultiurl.js renders multiple web pages to images
- technews.js captures Google News as a PNG image
Page automation
- direction.js uses Google Maps to print driving direction
- follow.js shows the number of followers of some Twitter accounts
- imagebin.js uploads an image to imagebin.org
- injectme.js injects itself into a web page context
- ipgeocode.js deduces the location via IP geocoding
- movies.js lists movies from kids-in-mind.com
- phantomwebintro.js uses jQuery to read #intro element text from phantomjs.org
- pizza.js uses yelp.com to find pizza places in Mountain View
- seasonfood.js displays the BBC seasonal food list
- tweets.js displays the most recent tweets
- unrandomize.js modifies a global object at page initialization
- waitfor.js waits until a test condition is true or a timeout occurs
Network
- detectsniff.js detects if a web page sniffs the user agent
- loadspeed.js computes the loading speed of a web site
- netlog.js dumps all network requests and responses
- netsniff.js captures network traffic in HAR format
- post.js sends an HTTP POST request to a test server
- postserver.js starts a web server and sends an HTTP POST request to it
- server.js starts a web server and sends an HTTP GET request to it
- serverkeepalive.js starts a web server which answers in plain text
- simpleserver.js starts a web server which answers in HTML
Script to check the loading time of a Site
========
#!/bin/bash
CURL="/usr/bin/curl"
GAWK="/usr/bin/gawk"
echo -n "Please pass the url you want to measure: "
read url
URL="$url"
result=`$CURL -o /dev/null -s -w %{time_connect}:%{time_starttransfer}:%{time_total} $URL`
echo " Time_Connect Time_startTransfer Time_total "
echo $result | $GAWK -F: '{ print $1" "$2" "$3}'
========
cat test.sh
#!/bin/bash
CURL="/usr/bin/curl"
GAWK="/usr/bin/gawk"
echo -n "Please pass the url you want to measure: "
read url
URL="$url"
result=`$CURL -o /dev/null -s -w %{time_connect}:%{time_starttransfer}:%{time_total} $URL`
echo " Time_Connect Time_startTransfer Time_total "
echo $result | $GAWK -F: '{ print $1" "$2" "$3}'
Sample Testing
[root@vps examples]# sh test.sh
Please pass the url you want to measure: http://www.adminz.in
Time_Connect Time_startTransfer Time_total
0.294 0.604 1.255
[root@vps examples]#
BASH Shellshock vulnerability and FIX
- Apache server using mod_cgi or mod_cgid are affected if CGI scripts are either written in bash, or spawn subshells. Such subshells are implicitly used by system/popen in C, by os.system/os.popen in Python, system/exec in PHP (when run in CGI mode), and open/system in Perl if a shell is used (which depends on the command string)
- ForceCommand is used in sshd configs to provide limited command execution capabilities for remote users. This flaw can be used to bypass that and provide arbitrary command execution. Some Git and Subversion deployments use such restricted shells. Regular use of OpenSSH is not affected because users already have shell access.
- DHCP clients invoke shell scripts to configure the system, with values taken from a potentially malicious server. This would allow arbitrary commands to be run, typically as root, on the DHCP client machine.
- Various daemons and SUID/privileged programs may execute shell scripts with environment variable values set / influenced by the user, which would allow for arbitrary commands to be run.
- Any other application which is hooked onto a shell or runs a shell script as using bash as the interpreter. Shell scripts which do not export variables are not vulnerable to this issue, even if they process untrusted content and store it in (unexported) shell variables and open subshells.
Workaround: Using mod_security:
SecRule REQUEST_HEADERS "^\(\) {" "phase:1,deny,id:1000000,t:urlDecode,status:400,log,msg:'CVE-2014-6271 - Bash Attack'"
SecRule REQUEST_LINE "\(\) {" "phase:1,deny,id:1000001,status:400,log,msg:'CVE-2014-6271 - Bash Attack'"
SecRule ARGS_NAMES "^\(\) {" "phase:2,deny,id:1000002,t:urlDecode,t:urlDecodeUni,status:400,log,msg:'CVE-2014-6271 - Bash Attack'"
SecRule ARGS "^\(\) {" "phase:2,deny,id:1000003,t:urlDecode,t:urlDecodeUni,status:400,log,msg:'CVE-2014-6271 - Bash Attack'"
SecRule FILES_NAMES "^\(\) {" "phase:2,deny,id:1000004,t:urlDecode,t:urlDecodeUni,status:400,log,msg:'CVE-2014-6271 - Bash Attack'"
Workaround: Using IPTables:
iptables using -m string --hex-string '|28 29 20 7B|'
cPanel’s Built-in php.ini File
WHERE IS THE CPanel PHP.INI?
If you're using cPanel and need to tweak your PHP settings, you might be looking for the php.ini
file. This file controls how PHP behaves on your server. For cPanel's default PHP installation, you can find the main php.ini
file at this location:
/usr/local/cpanel/3rdparty/etc/php.ini
Understanding this location is key for anyone needing to make direct changes to global PHP configurations within a cPanel environment.
REBUILDING CPANEL'S INTERNAL PHP
Sometimes, you might need to rebuild or refresh cPanel's internal PHP installation. This can be useful for troubleshooting or applying certain updates. You can do this using a specific script provided by cPanel:
/scripts/makecppphp
Running this script will recompile or reconfigure the PHP environment that cPanel itself uses, which can resolve various issues related to its internal functions.