Tuesday, February 28, 2012

Good website to design buttons

Good website to design your own buttons as per your requirements.

http://www.uiparade.com/wp-content/themes/artiste/live-tools/index.html#

PCI Compliance crossdomain.xml files changes

Since it has been marked as a serious threat in PCI Compliance I am making the below mentioned changes. 

File location: /home/webadmin/public_html/crossdomain.xml

Old line:     <site-control permitted-cross-domain-policies="all"/>
New Line:     <site-control permitted-cross-domain-policies="trusted"/>


Details by McFee
The Internet browser security model, known as Same-Origin Policy, prevents one domain from accessing content from another domain.

McAfee has detected that your web application contains a crossdomain.xml file that has an allow-all policy. A crossdomain.xml file allows a third party web applications using Adobe flash player to access data from the domain hosting the crossdomain.xml file.

The correct way to configure a crossdomain.xml file is to setup the file to only allow access from "trusted" web applications. The crossdomain.xml file detected on this host has an allow-all policy, means that your web application allows any web application on the internet to Interact with your data. Thus, your web application "trusts" the entire internet.

An attacker could leverage this by embedding a malicious Adobe Flash Player file into a web site on the internet and have that file access sensitive content stored on your web application. Sensitive information includes items such as personally identifiable information (PII) and user credentials.


It becomes very difficult if you have a development team of 30-35 people and all of them are making changes on daily basis and committing the same into SVN. But then the problem is you need to have someone who keeps on updating the SVN whenever there is a need. This results in lot of wasted time. So you can refer to the steps below to setup the POST_COMMIT system such that everytime a developer commits the public_html folder gets updated automatically. 

Let me know in case of any query of problem. 

Create repository:
1. login as root
2. Goto the SVN folder /home/svn/mysvn
3. Run the command: svnadmin create mynewsvn This creates a repository svnadmin create /path/to/repository
4. Run CHMOD and CHOWN commands to make it 775, and user1:user1 (user1 should be in the apache group as well as svn group) 

Auto Update system Setup:
1. Checkout repository wth a user (say user1)
2. Copy update_svn.php to the website's root folder (public_html or htdocs). We have copied this file to production root /home/mysite/public_html
3. Copy the svn_update_step1.sh and svn_update_step2.sh to svn's hooks folder. (/home/svn/mysvn/mynewsvn/hooks)
4. edit update_svn.php. Change the path of svn_update_step1.sh
5. Create key for 'user1'. follow the steps below:
login as 'user1'
ssh-keygen
leave passphrase empty
the keys will be stored in the /home/user1/.ssh folder
cd /home/user1/.ssh
cat id_rsa.pub > id_key_svn
permissions for /home/user1/.ssh folder and files in it should be 600
6. copy the id_rsa file to a location where apache can access it (/home/user1/id_key_svn this is the location because apache is running with USER1)
7. edit svn_update_step1.sh. Change the key path, user name, and location of svn_update_step2.sh
8. edit svn_update_step2.sh. Change the path of hook folder, path of website folder.
9. edit/create the hooks/post-commit file. add the following lines:
#!/bin/sh
10. edit .profile file in /home/velocity folder and add the following lines at the bottom of the file:
ssh-agent bash
ssh-add ~/.ssh/id_rsa


If things don't work,

1. check if the key file works.

ssh -luser1 -i <path_to_key> <host_name>
User should be able to login without and password

2. Open the http://<host_name>update_svn.php. Check the apache error logs
3. login as velocity and run the post-commit/svn_update_step1.sh/svn_update_step2.sh and check the errors



----------------------------------------------------
Filename: .profile


ssh-agent bash
ssh-add ~/.ssh/id_rsa
----------------------------------------------------
Filename: post-commit

#!/bin/sh
wget http://localhost/update_svn.php
----------------------------------------------------
Filename: svn_update_step1.sh

ssh -i /home/user1/id_key_svn user1@localhost /home/svn/mysvn/mynewsvn/hooks/svn_update_step2.sh
----------------------------------------------------
Filename: svn_update_step2.sh

#!/bin/sh
cd /home/svn/mysvn/mynewsvn/hooks
rm -f filelist
rm -f log
echo "user " >> log
whoami >> log
svnlook dirs-changed /home/svn/mysvn/mynewsvn >> /home/svn/mysvn/mynewsvn/hooks/filelist; sed -i -e 's#^#/home/webadmin/public_html/#' /home/svn/mysvn/mynewsvn/hooks/filelist; cat /home/svn/mysvn/mynewsvn/hooks/filelist | xargs /usr/bin/svn up -N >> /home/svn/mysvn/mynewsvn/hooks/log

----------------------------------------------------
Filename: update_svn.php

<?php
$output = shell_exec('/home/svn/mysvn/user1/hooks/svn_update_step1.sh');
echo "<pre>$output</pre>";
?>

----------------------------------------------------

How to zip or archive or tar a directory and exclude one directory


tar -czpf /path/to/backups/my_backup.tar.gz --exclude path/to/images/tmp path/to/images/

How to enable mod_deflate module on apache2 on Opensuse


Error shown in error log of apache.

[Sun Apr 11 22:41:23 2010] [error] an unknown filter was not added: DEFLATE
  [Sun Apr 11 22:48:54 2010] [error] an unknown filter was not added: DEFLATE
  [Sun Apr 11 22:50:23 2010] [error] an unknown filter was not added: DEFLATE

This means mod_deflate has not been installed. 

To tweak your Apache setup, use the following two lines:
sudo a2enmod deflate
  sudo /etc/init.d/apache2 force-reload
And you'll get rid of those errors.

Saturday, January 21, 2012

How to see disk space utilization in Linux

Listing size and % usage of each partition.

[root@288832-web3 ~]# df -H
Filesystem Size Used Avail Use% Mounted on
/dev/sda5 279G 265G 0 100% /
/dev/sda2 2.1G 355M 1.7G 18% /tmp
/dev/sda1 104M 26M 73M 26% /boot
tmpfs 13G 0 13G 0% /dev/shm
------------------------------------------------------------------

Find How Much Disk Space Is Being Used Show Display
Login as root
then cd /
then execute: du -hc --max-depth=1
Output:
[root@hostname /]# du -hc --max-depth=1
0 ./net


1.6G ./usr
16K ./lost+found
515M ./proc
8.0K ./misc
648M ./var
112K ./dev
8.0K ./mnt
66M ./lib
8.0K ./selinux
7.3M ./bin
77M ./root
4.2M ./boot
28K ./tmp
2.7M ./backups
20M ./sbin
8.0K ./media
8.0K ./srv
0 ./sys
43M ./etc
42M ./home
8.0K ./opt
3.0G .
3.0G total

Taken from: http://www.wallpaperama.com/forums/linux-command-to-find-how-much-disk-space-is-being-used-show-display-t713.html